# Path: pykintone/account.py
# class kintoneService(object):
#     ENCODE = "utf-8"
#     SELECT_LIMIT = 500
#     UPDATE_LIMIT = 100
# 
#     DATE_FORMAT = "%Y-%m-%d"
#     TIME_FORMAT = "%H:%M"
#     DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
#     TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
#     from tzlocal import get_localzone
#     __TIME_ZONE = get_localzone()
# 
#     def __init__(self, account):
#         self.account = account
#         self.__apps = []
# 
#     def __len__(self):
#         return len(self.__apps)
# 
#     def app(self, app_id="", api_token="", app_name=""):
#         from pykintone.application import Application
#         if not app_id:
#             return self.__apps[0]
#         else:
#             existed = [a for a in self.__apps if a.app_id == app_id]
#             # register if not exist
#             if len(existed) > 0:
#                 return existed[0]
#             else:
#                 _a = Application(self.account, app_id, api_token, app_name)
#                 self.__apps.append(_a)
#                 return _a
# 
#     def administration(self,requests_options=()):
#         from pykintone.application_settings.administrator import Administrator
#         return Administrator(self.account, requests_options=requests_options)
# 
#     def user_api(self, requests_options=()):
#         from pykintone.user_api import UserAPI
#         api = UserAPI(self.account, requests_options)
#         return api
# 
#     @classmethod
#     def value_to_date(cls, value):
#         return value if not value else datetime.strptime(value, cls.DATE_FORMAT)
# 
#     @classmethod
#     def value_to_time(cls, value):
#         return value if not value else datetime.strptime(value, cls.TIME_FORMAT)
# 
#     @classmethod
#     def value_to_datetime(cls, value):
#         if value:
#             d = datetime.strptime(value, cls.DATETIME_FORMAT)
#             return cls._to_local(d)
#         else:
#             return None
# 
#     @classmethod
#     def value_to_timestamp(cls, value):
#         if value:
#             d = datetime.strptime(value, cls.TIMESTAMP_FORMAT)
#             return cls._to_local(d)
#         else:
#             return None
# 
#     @classmethod
#     def _to_local(cls, d):
#         utc = d.replace(tzinfo=pytz.utc)  # configure timezone (on kintone, time is utc)
#         local = utc.astimezone(cls.__TIME_ZONE).replace(tzinfo=None)  # to local, and to native
#         return local
# 
#     @classmethod
#     def date_to_value(cls, date):
#         return date.strftime(cls.DATE_FORMAT)
# 
#     @classmethod
#     def time_to_value(cls, time):
#         return time.strftime(cls.TIME_FORMAT)
# 
#     @classmethod
#     def datetime_to_value(cls, dt):
#         local = dt.replace(tzinfo=cls.__TIME_ZONE)
#         utc = local.astimezone(pytz.utc)
#         value = utc.strftime(cls.DATETIME_FORMAT)
#         return value
# 
#     @classmethod
#     def get_default_field_list(cls, as_str=False):
#         from pykintone.structure import FieldType
#         fields = [
#             FieldType.CATEGORY,
#             FieldType.STATUS,
#             FieldType.RECORD_NUMBER,
#             FieldType.CREATED_TIME,
#             FieldType.CREATOR,
#             FieldType.STATUS_ASSIGNEE,
#             FieldType.UPDATED_TIME,
#             FieldType.MODIFIER
#         ]
#         if as_str:
#             str_fields = [f.value for f in fields]
#             return str_fields
#         else:
#             return fields


import re
import inspect
import pykintone.structure_field as sf
from enum import Enum
from datetime import datetime
from pykintone.account import kintoneService as ks

        return instance if is_set else None

    @classmethod
    def _field_to_property(cls, field_value, field_type=None, property_detail=None, initial_value=None):
        value = field_value

        # configure property's field type
        # from user definition
        _field_type = None if not property_detail else property_detail.field_type
        # from type value in field
        if not _field_type and field_type:
            f = [e for e in list(FieldType) if e.value == field_type]
            if len(f) > 0:
                _field_type = f[0]
        _field_type = _field_type if _field_type else cls._estimate_type_from_property(initial_value)

        if not _field_type:
            pass
        elif _field_type in (FieldType.ID, FieldType.REVISION, FieldType.RECORD_NUMBER):
            value = int(value)
        elif _field_type == FieldType.NUMBER:
            value = float(value)
        elif _field_type == FieldType.DATE:
            value = ks.value_to_date(value)
        elif _field_type == FieldType.TIME:
            value = ks.value_to_time(value)
        elif _field_type in [FieldType.DATETIME, FieldType.CREATED_TIME, FieldType.UPDATED_TIME]:
            value = ks.value_to_datetime(value)
        elif _field_type == FieldType.TIME_STAMP:

# Path: pykintone/account.py
# class kintoneService(object):
#     ENCODE = "utf-8"
#     SELECT_LIMIT = 500
#     UPDATE_LIMIT = 100
# 
#     DATE_FORMAT = "%Y-%m-%d"
#     TIME_FORMAT = "%H:%M"
#     DATETIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
#     TIMESTAMP_FORMAT = "%Y-%m-%dT%H:%M:%S.%fZ"
#     from tzlocal import get_localzone
#     __TIME_ZONE = get_localzone()
# 
#     def __init__(self, account):
#         self.account = account
#         self.__apps = []
# 
#     def __len__(self):
#         return len(self.__apps)
# 
#     def app(self, app_id="", api_token="", app_name=""):
#         from pykintone.application import Application
#         if not app_id:
#             return self.__apps[0]
#         else:
#             existed = [a for a in self.__apps if a.app_id == app_id]
#             # register if not exist
#             if len(existed) > 0:
#                 return existed[0]
#             else:
#                 _a = Application(self.account, app_id, api_token, app_name)
#                 self.__apps.append(_a)
#                 return _a
# 
#     def administration(self,requests_options=()):
#         from pykintone.application_settings.administrator import Administrator
#         return Administrator(self.account, requests_options=requests_options)
# 
#     def user_api(self, requests_options=()):
#         from pykintone.user_api import UserAPI
#         api = UserAPI(self.account, requests_options)
#         return api
# 
#     @classmethod
#     def value_to_date(cls, value):
#         return value if not value else datetime.strptime(value, cls.DATE_FORMAT)
# 
#     @classmethod
#     def value_to_time(cls, value):
#         return value if not value else datetime.strptime(value, cls.TIME_FORMAT)
# 
#     @classmethod
#     def value_to_datetime(cls, value):
#         if value:
#             d = datetime.strptime(value, cls.DATETIME_FORMAT)
#             return cls._to_local(d)
#         else:
#             return None
# 
#     @classmethod
#     def value_to_timestamp(cls, value):
#         if value:
#             d = datetime.strptime(value, cls.TIMESTAMP_FORMAT)
#             return cls._to_local(d)
#         else:
#             return None
# 
#     @classmethod
#     def _to_local(cls, d):
#         utc = d.replace(tzinfo=pytz.utc)  # configure timezone (on kintone, time is utc)
#         local = utc.astimezone(cls.__TIME_ZONE).replace(tzinfo=None)  # to local, and to native
#         return local
# 
#     @classmethod
#     def date_to_value(cls, date):
#         return date.strftime(cls.DATE_FORMAT)
# 
#     @classmethod
#     def time_to_value(cls, time):
#         return time.strftime(cls.TIME_FORMAT)
# 
#     @classmethod
#     def datetime_to_value(cls, dt):
#         local = dt.replace(tzinfo=cls.__TIME_ZONE)
#         utc = local.astimezone(pytz.utc)
#         value = utc.strftime(cls.DATETIME_FORMAT)
#         return value
# 
#     @classmethod
#     def get_default_field_list(cls, as_str=False):
#         from pykintone.structure import FieldType
#         fields = [
#             FieldType.CATEGORY,
#             FieldType.STATUS,
#             FieldType.RECORD_NUMBER,
#             FieldType.CREATED_TIME,
#             FieldType.CREATOR,
#             FieldType.STATUS_ASSIGNEE,
#             FieldType.UPDATED_TIME,
#             FieldType.MODIFIER
#         ]
#         if as_str:
#             str_fields = [f.value for f in fields]
#             return str_fields
#         else:
#             return fields


# Path: pykintone/structure.py
import re
import inspect
import pykintone.structure_field as sf
from enum import Enum
from datetime import datetime
from pykintone.account import kintoneService as ks


        return instance if is_set else None

    @classmethod
    def _field_to_property(cls, field_value, field_type=None, property_detail=None, initial_value=None):
        value = field_value

        # configure property's field type
        # from user definition
        _field_type = None if not property_detail else property_detail.field_type
        # from type value in field
        if not _field_type and field_type:
            f = [e for e in list(FieldType) if e.value == field_type]
            if len(f) > 0:
                _field_type = f[0]
        _field_type = _field_type if _field_type else cls._estimate_type_from_property(initial_value)

        if not _field_type:
            pass
        elif _field_type in (FieldType.ID, FieldType.REVISION, FieldType.RECORD_NUMBER):
            value = int(value)
        elif _field_type == FieldType.NUMBER:
            value = float(value)
        elif _field_type == FieldType.DATE:
            value = ks.value_to_date(value)
        elif _field_type == FieldType.TIME:
            value = ks.value_to_time(value)
        elif _field_type in [FieldType.DATETIME, FieldType.CREATED_TIME, FieldType.UPDATED_TIME]:
            value = ks.value_to_datetime(value)
        elif _field_type == FieldType.TIME_STAMP:

            value = ks.value_to_timestamp(value)