Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions arkouda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@
intersect1d,
intp,
isnumeric,
isSupportedBool,
isSupportedDType,
isSupportedFloat,
isSupportedInt,
isSupportedNumber,
is_supported_bool,
is_supported_dtype,
is_supported_float,
is_supported_int,
is_supported_number,
is_registered,
is_sorted,
isfinite,
Expand Down Expand Up @@ -359,6 +359,11 @@
where,
zeros,
zeros_like,
isSupportedInt,
isSupportedNumber,
isSupportedBool,
isSupportedFloat,
isSupportedDType,
)
from arkouda.pandas import (
Row,
Expand Down Expand Up @@ -396,10 +401,10 @@
ruok,
shutdown,
)
from arkouda.client_dtypes import BitVector, BitVectorizer, Fields, IPv4, ip_address, is_ipv4, is_ipv6
from arkouda.client_dtypes import BitVector, bit_vectorizer, BitVectorizer, Fields, IPv4, ip_address, is_ipv4, is_ipv6
from arkouda.groupbyclass import GROUPBY_REDUCTION_TYPES, GroupBy, broadcast, groupable, unique
from arkouda.categorical import Categorical
from arkouda.logger import LogLevel, disableVerbose, enableVerbose, write_log
from arkouda.logger import LogLevel, disableVerbose, enableVerbose, disable_verbose, enable_verbose, write_log
from arkouda.infoclass import (
AllSymbols,
RegisteredSymbols,
Expand Down
8 changes: 4 additions & 4 deletions arkouda/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
import zmq # for typechecking

from arkouda import __version__, security
from arkouda.logger import ArkoudaLogger, LogLevel, getArkoudaLogger
from arkouda.logger import ArkoudaLogger, LogLevel, get_arkouda_logger
from arkouda.message import (
MessageFormat,
MessageType,
Expand Down Expand Up @@ -172,8 +172,8 @@ def _mem_get_factor(unit: str) -> int:
)


logger = getArkoudaLogger(name="Arkouda Client", logLevel=LogLevel.INFO)
clientLogger = getArkoudaLogger(name="Arkouda User Logger", logFormat="%(message)s")
logger = get_arkouda_logger(name="Arkouda Client", logLevel=LogLevel.INFO)
clientLogger = get_arkouda_logger(name="Arkouda User Logger", logFormat="%(message)s")


class ClientMode(Enum):
Expand Down Expand Up @@ -348,7 +348,7 @@ def __init__(
self._set_url(server, port, connect_url)
self.user = user
self._set_access_token(server, port, token)
self.logger = getArkoudaLogger(name="Arkouda Client")
self.logger = get_arkouda_logger(name="Arkouda Client")

def _set_url(self, server: str, port: int, connect_url: Optional[str] = None) -> None:
"""
Expand Down
35 changes: 23 additions & 12 deletions arkouda/client_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Functions
---------
- `BitVectorizer`: Creates a partially applied BitVector constructor.
- `bit_vectorizer`: Creates a partially applied BitVector constructor.
- `ip_address`: Converts various formats to an Arkouda IPv4 object.
- `is_ipv4`: Returns a boolean array indicating IPv4 addresses.
- `is_ipv6`: Returns a boolean array indicating IPv6 addresses.
Expand Down Expand Up @@ -49,6 +49,8 @@

"""

import warnings

from functools import partial
from ipaddress import ip_address as _ip_address
from typing import TYPE_CHECKING, Literal, Optional, TypeVar, Union
Expand All @@ -57,7 +59,7 @@

from typeguard import typechecked

from arkouda.numpy.dtypes import bitType, intTypes, isSupportedInt
from arkouda.numpy.dtypes import bitType, intTypes, is_supported_int
from arkouda.numpy.dtypes import uint64 as akuint64
from arkouda.numpy.pdarrayclass import RegistrationError, pdarray
from arkouda.pandas.groupbyclass import GroupBy, broadcast
Expand All @@ -73,7 +75,7 @@

__all__ = [
"BitVector",
"BitVectorizer",
"bit_vectorizer",
"Fields",
"IPv4",
"ip_address",
Expand All @@ -82,7 +84,7 @@
]


def BitVectorizer(width=64, reverse=False):
def bit_vectorizer(width=64, reverse=False):
"""
Make a callback (i.e. function) that can be called on an array to create a BitVector.

Expand All @@ -104,6 +106,15 @@ def BitVectorizer(width=64, reverse=False):
return partial(BitVector, width=width, reverse=reverse)


def BitVectorizer(*args, **kwargs):
warnings.warn(
"BitVectorizer is deprecated; use bit_vectorizer",
DeprecationWarning,
stacklevel=2,
)
return bit_vectorizer(*args, **kwargs)


class BitVector(pdarray):
"""
Represent integers as bit vectors, e.g. a set of flags.
Expand Down Expand Up @@ -230,7 +241,7 @@ def __getitem__(self, key):
A single formatted string or a BitVector slice.

"""
if isSupportedInt(key):
if is_supported_int(key):
# Return single value as a formatted string
return self.format(self.values[key])
else:
Expand All @@ -252,7 +263,7 @@ def __setitem__(self, key, value):
if isinstance(value, self.__class__):
# Set a slice or selection of values directly
self.values[key] = value.values
elif isSupportedInt(key) and isSupportedInt(value):
elif is_supported_int(key) and is_supported_int(value):
# Set a single value
self.values[key] = value
else:
Expand All @@ -261,7 +272,7 @@ def __setitem__(self, key, value):
def _binop(self, other, op):
# Based on other type, select which data to pass
# to _binop of pdarray
if isSupportedInt(other):
if is_supported_int(other):
otherdata = other
elif isinstance(other, self.__class__):
otherdata = other.values
Expand All @@ -279,7 +290,7 @@ def _binop(self, other, op):
def _r_binop(self, other, op):
# Cases where left operand is BitVector are handled above by _binop
# Only two cases to handle here: scalar int and int64 pdarray
if isSupportedInt(other):
if is_supported_int(other):
if op in self.conserves:
return self._cast(self.values._r_binop(other, op))
else:
Expand All @@ -306,7 +317,7 @@ def opeq(self, other, op):

"""
# Based on other type, select data to pass to pdarray opeq
if isSupportedInt(other):
if is_supported_int(other):
otherdata = other
elif isinstance(other, self.__class__):
otherdata = other.values
Expand Down Expand Up @@ -699,7 +710,7 @@ def export_uint(self):

def format(self, x):
"""Format a single integer IP address as a string."""
if not isSupportedInt(x):
if not is_supported_int(x):
raise TypeError("Argument must be an integer scalar")
return str(_ip_address(int(x)))

Expand All @@ -711,7 +722,7 @@ def normalize(self, x):
and convert it to an integer.

"""
if not isSupportedInt(x):
if not is_supported_int(x):
x = int(_ip_address(x))
if x < 0:
raise ValueError(f"Not an IP address: {_ip_address(x)}")
Expand Down Expand Up @@ -782,7 +793,7 @@ def __getitem__(self, key):
Formatted IP address string or a sliced IPv4 instance.

"""
if isSupportedInt(key):
if is_supported_int(key):
# Display single item as string
return self.format(self.values[key])
else:
Expand Down
15 changes: 10 additions & 5 deletions arkouda/dtypes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
int64,
int_scalars,
intTypes,
isSupportedBool,
isSupportedDType,
isSupportedFloat,
isSupportedInt,
isSupportedNumber,
is_supported_bool,
is_supported_dtype,
is_supported_float,
is_supported_int,
is_supported_number,
numeric_and_bool_scalars,
numeric_scalars,
numpy_scalars,
Expand All @@ -77,4 +77,9 @@
uint16,
uint32,
uint64,
isSupportedInt,
isSupportedNumber,
isSupportedBool,
isSupportedFloat,
isSupportedDType
)
Loading