Skip to content

Commit

Permalink
Merge 61df2af into bdd49bc
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlarkin1 committed May 18, 2023
2 parents bdd49bc + 61df2af commit 49fa860
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions stone/frontend/ir_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
from collections import defaultdict

import copy
import inspect
import logging

from inspect import isclass
try:
from inspect import getfullargspec as get_args
except ImportError:
from inspect import getargspec as get_args

Check warning on line 12 in stone/frontend/ir_generator.py

View check run for this annotation

Codecov / codecov/patch

stone/frontend/ir_generator.py#L11-L12

Added lines #L11 - L12 were not covered by tests

_MYPY = False
if _MYPY:
import typing # noqa: F401 # pylint: disable=import-error,unused-import,useless-suppression
Expand Down Expand Up @@ -1074,7 +1079,7 @@ def _instantiate_data_type(self, data_type_class, data_type_args, loc):
assert issubclass(data_type_class, DataType), \
'Expected stone.data_type.DataType, got %r' % data_type_class

argspec = inspect.getargspec(data_type_class.__init__) # noqa: E501 # pylint: disable=deprecated-method,useless-suppression
argspec = get_args(data_type_class.__init__) # noqa: E501 # pylint: disable=deprecated-method,useless-suppression
argspec.args.remove('self')
num_args = len(argspec.args)
# Unfortunately, argspec.defaults is None if there are no defaults
Expand Down Expand Up @@ -1154,7 +1159,7 @@ def _resolve_type(self, env, type_ref, enforce_fully_defined=False):
if obj is Void and type_ref.nullable:
raise InvalidSpec('Void cannot be marked nullable.',
*loc)
elif inspect.isclass(obj):
elif isclass(obj):
resolved_data_type_args = self._resolve_args(env, type_ref.args)
data_type = self._instantiate_data_type(
obj, resolved_data_type_args, (type_ref.lineno, type_ref.path))
Expand Down

0 comments on commit 49fa860

Please sign in to comment.