Skip to content

Commit

Permalink
adjust to changes in registry
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed May 25, 2018
1 parent 2e08b47 commit 5c9975f
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions pandas/core/arrays/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,38 +30,21 @@ class IntegerDtype(ExtensionDtype):

@classmethod
def construct_from_string(cls, string):
if string == cls.name:
return cls()
else:
raise TypeError("Cannot construct a '{}' from "
"'{}'".format(cls, string))

@classmethod
def construct_from_string_strict(cls, string):
"""
Strict construction from a string, raise a TypeError if not
Construction from a string, raise a TypeError if not
possible
"""
if string[0] == 'I':
return cls.construct_from_string(string)
raise TypeError("could not construct PeriodDtype")
if string == cls.name:
return cls()
raise TypeError("Cannot construct a '{}' from "
"'{}'".format(cls, string))


class UnsignedIntegerDtype(IntegerDtype):
kind = 'u'
is_signed_integer = False
is_unsigned_integer = True

@classmethod
def construct_from_string_strict(cls, string):
"""
Strict construction from a string, raise a TypeError if not
possible
"""
if string[0] == 'U':
return cls.construct_from_string(string)
raise TypeError("could not construct PeriodDtype")


def to_integer_array(values):
"""
Expand Down Expand Up @@ -457,7 +440,7 @@ class UnsignedIntegerArray(IntegerArray):
setattr(module, classname, dtype_type)

# register
registry.register(dtype_type, dtype_type.construct_from_string_strict)
registry.register(dtype_type)


# create the Array
Expand Down

0 comments on commit 5c9975f

Please sign in to comment.