Skip to content

Commit

Permalink
fix: address pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberglot committed Nov 8, 2024
1 parent 26e1cea commit b83e380
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions nada_dsl/nada_types/scalar_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,33 @@
# Constant dictionary that stores all the Nada types and is use to
# convert from the (mode, base_type) representation to the concrete Nada type
# (Integer, SecretBoolean,...)
_AnyScalarType = TypeVar("_AnyScalarType", 'Integer', 'UnsignedInteger', 'Boolean', 'PublicInteger', 'PublicUnsignedInteger', 'PublicBoolean', 'SecretInteger', 'SecretUnsignedInteger', 'SecretBoolean')
AnyScalarType = Union['Integer', 'UnsignedInteger', 'Boolean', 'PublicInteger', 'PublicUnsignedInteger', 'PublicBoolean', 'SecretInteger', 'SecretUnsignedInteger', 'SecretBoolean']

# pylint: disable=invalid-name
_AnyScalarType = TypeVar("_AnyScalarType",
'Integer',
'UnsignedInteger',
'Boolean',
'PublicInteger',
'PublicUnsignedInteger',
'PublicBoolean',
'SecretInteger',
'SecretUnsignedInteger',
'SecretBoolean')
# pylint: enable=invalid-name

AnyScalarType = Union['Integer',
'UnsignedInteger',
'Boolean',
'PublicInteger',
'PublicUnsignedInteger',
'PublicBoolean',
'SecretInteger',
'SecretUnsignedInteger',
'SecretBoolean']

# pylint: disable=global-variable-not-assigned
SCALAR_TYPES: dict[tuple[Mode, BaseType], type[AnyScalarType]] = {}
# pylint: enable=global-variable-not-assigned

AnyBoolean = Union['Boolean', 'PublicBoolean', 'SecretBoolean']

Expand Down Expand Up @@ -236,7 +260,7 @@ def binary_relational_operation(
case Mode.CONSTANT:
return new_scalar_type(mode, BaseType.BOOLEAN)(f(left.value, right.value)) # type: ignore
case Mode.PUBLIC | Mode.SECRET:
inner = globals()[operation]( # TODO: Should we use globals() here?
inner = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
)
return new_scalar_type(mode, BaseType.BOOLEAN)(inner) # type: ignore
Expand Down

0 comments on commit b83e380

Please sign in to comment.