/usr/lib/python3/dist-packages/leather/data_types.py is in python3-leather 0.3.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/usr/bin/env python
from datetime import date, datetime
from decimal import Decimal
import six
class DataType(object):
"""
Base class for :class:`.Series` data types.
"""
@classmethod
def infer(cls, v):
for t in [DateTime, Date, Number, Text]:
if isinstance(v, t.types):
return t
raise TypeError('No data type available for %s' % type(v))
class Date(DataType):
"""
Data representing dates.
"""
types = (date,)
class DateTime(DataType):
"""
Data representing dates with times.
"""
types = (datetime,)
class Number(DataType):
"""
Data representing numbers.
"""
types = (int, float, Decimal)
class Text(DataType):
"""
Data representing text/strings.
"""
types = six.string_types
|