Skip to content

Commit

Permalink
Removed drepricated code
Browse files Browse the repository at this point in the history
  • Loading branch information
aj3sh committed Jan 22, 2023
1 parent 1c3900e commit c327320
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 67 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Refactored converter
- Added locations feature
- Added Phone number parse feature
- Removed depreciated class and method

## v0.5.6 - (July 7, 2022)
- Test for automatic package publish
Expand Down
2 changes: 1 addition & 1 deletion nepali/datetime/_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class NepaliDateConverter:

def __init__(self):
warnings.warn(
message="This module is depreciated. Please use `converter` from `nepali.date_converter`",
message="This module is depreciated and will be removed on the future. Please use `converter` from `nepali.date_converter`",
category=DeprecationWarning
)

Expand Down
48 changes: 0 additions & 48 deletions nepali/datetime/_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ def to_date(self):
def to_nepalidatetime(self):
return nepalidatetime.from_nepali_date(self)

def to_nepali_datetime(self):
warnings.warn(
message="nepalidate.to_nepali_datetime is depreciated and no longer be available in version >= 1.0.0, use nepalidate.to_nepalidatetime instead.",
category=DeprecationWarning
)
return self.to_nepalidatetime()

def strftime(self, format):
NepaliDateTimeFormatter = self.get_formatter_class()
formatter = NepaliDateTimeFormatter(self)
Expand Down Expand Up @@ -144,13 +137,6 @@ def month(self):
def day(self):
return self.__day

@property
def week_day(self):
warnings.warn(
message="nepalidate.week_day field is depreciated and no longer be available in version >= 1.0.0, use nepalidate.weekday() method instead.",
category=DeprecationWarning
)
return self.weekday()

class nepalitime(pythonDateTime.time):

Expand Down Expand Up @@ -393,14 +379,6 @@ def weekday(self):
'''
return self.__npDate.weekday()

@property
def week_day(self):
warnings.warn(
message="nepalidate.week_day field is depreciated and no longer be available in version >= 1.0.0, use nepalidatetime.weekday() method instead.",
category=DeprecationWarning
)
return self.__npDate.weekday()

@property
def hour(self):
return self.__npTime.hour
Expand All @@ -412,29 +390,3 @@ def minute(self):
@property
def second(self):
return self.__npTime.second


class NepaliDate(nepalidate):
def __init__(self, *args, **kwargs):
warnings.warn(
message="NepaliDate is depreciated and no longer be available in version >= 1.0.0, use nepalidate instead.",
category=DeprecationWarning
)
super().__init__(*args, **kwargs)

class NepaliTime(nepalidate):
def __init__(self, *args, **kwargs):
warnings.warn(
message="NepaliTime is depreciated and no longer be available in version >= 1.0.0, use nepalitime instead.",
category=DeprecationWarning
)
super().__init__(*args, **kwargs)

class NepaliDateTime(nepalidate):
def __init__(self, *args, **kwargs):
warnings.warn(
message="NepaliDateTime is depreciated and no longer be available in version >= 1.0.0, use nepalidatetime instead.",
category=DeprecationWarning
)
super().__init__(*args, **kwargs)

18 changes: 0 additions & 18 deletions nepali/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ def to_utc_timezone(datetime_obj):
datetime_obj = datetime_obj.replace(tzinfo=get_timezone())
return datetime_obj.astimezone(pytz.timezone('UTC'))

def to_utc(datetime_obj):
warnings.warn(
message="to_utc is depreciated and no longer be available in version >= 1.0.0, use to_utc_timezone instead.",
category=DeprecationWarning
)
return to_utc_timezone(datetime_obj)

def to_nepali_timezone(datetime_obj):
if type(datetime_obj) != datetime.datetime:
Expand All @@ -29,12 +23,6 @@ def to_nepali_timezone(datetime_obj):
datetime_obj = datetime_obj.replace(tzinfo=get_timezone())
return datetime_obj.astimezone(NepaliTimeZone())

def to_local(datetime_obj):
warnings.warn(
message="to_local is depreciated and no longer be available in version >= 1.0.0, use to_nepali_timezone instead.",
category=DeprecationWarning
)
return to_nepali_timezone(datetime_obj)

def to_nepalidatetime(datetime_object):
"""
Expand All @@ -54,12 +42,6 @@ def to_nepalidatetime(datetime_object):
return None
raise InvalidNepaliDateTimeObjectException('Argument must be instance of nepalidate or nepalidatetime or datetime.datetime or datetime.date')

def to_nepali_datetime(datetime_object):
warnings.warn(
message="to_nepali_datetime is depreciated and no longer be available in version >= 1.0.0, use to_nepalidatetime instead.",
category=DeprecationWarning
)
return to_nepalidatetime(datetime_object)

def to_nepalidate(datetime_object):
nepalidatetime_obj = to_nepalidatetime(datetime_object)
Expand Down

0 comments on commit c327320

Please sign in to comment.