Skip to content

Commit

Permalink
📝 docs: add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sarojbelbase committed Jun 6, 2021
1 parent 01e4e47 commit 2d90901
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ANS: Glad you thought. First of all, you get this beautifully named package call
>>> to_integer('abc123abc456')
>>> '123,456'

# convert to roman from devanagiri
# convert to roman from devanagari
>>> to_roman('तनहुँ ब्यास नगरपालिका सागेकी २२ वर्षीया युवतीकी एक जना आमाजु पर्ने थिइन्')
>>> 'tanahun byaasa nagarapaalikaa saageki 22 warsiyaa yuwatiki eka janaa amaaju parne thiin'

Expand All @@ -44,7 +44,7 @@ ANS: Glad you thought. First of all, you get this beautifully named package call

# replace something from a text if you feel awkward
>>> replace('I love this alamari package', 'alamari', 'daraaazzz')
>>> I love this daraaazzz package
>>> 'I love this daraaazzz package'

# get datetime object from a string or text
>>> parse_date('2021, June 5th 5:55')
Expand Down
2 changes: 1 addition & 1 deletion alamari/__about__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__package_name__ = 'alamari'
__version__ = '0.1.0'
__version__ = '0.1.1'
__author__ = 'Siddharth Belbase'
__author_email__ = 'siddharthbelbase@gmail.com'
__description__ = (
Expand Down
19 changes: 14 additions & 5 deletions alamari/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ def to_integer(given_input: str):
>>> to_integer('1')
1
>>> to_integer('abc123')
123
'123'
>>> to_integer('abc123abc')
123
'123'
>>> to_integer('abc123abc456')
123,456
'123,456'
Args:
given_input (str): any text with numbers in it
Expand All @@ -32,10 +32,15 @@ def to_integer(given_input: str):


def to_roman(given_text: str) -> str:
"""Converts the given devanagiri text into roman form
"""Converts the given devanagari text into roman form
Args:
given_text (str): devanagiri text
given_text (str): devanagari text
Example:
>>> to_roman('तनहुँ ब्यास नगरपालिका सागेकी २२ वर्षीया युवतीकी एक जना आमाजु पर्ने थिइन्')
'tanahun byaasa nagarapaalikaa saageki 22 warsiyaa yuwatiki eka janaa amaaju parne thiin'
Returns:
str: romanized text
Expand All @@ -50,6 +55,10 @@ def to_nepali_miti(english_date: date) -> date:
Args:
english_date (date): international date
Example:
>>> to_nepali_miti(2021, 6, 7)
'2078-02-24'
Returns:
date: returns nepali date in YY-M-D
"""
Expand Down
20 changes: 14 additions & 6 deletions alamari/humanize.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ def number(any_num: Number, padding: Optional[bool] = False) -> str:
Example:
>>> number(any_num = 9, padding = True)
09
'09'
>>> number(any_num = 9.54, padding = True)
09
'09'
>>> number(any_num = 12345675)
'1,23,45,675'
Returns:
str: returns a string in comma separated number
Expand All @@ -45,13 +48,13 @@ def date(any_date: datetime) -> str:
Example:
>>> date(any_date = 2021-06-02 05:55:55.185035)
2 hours ago
'2 hours ago'
Args:
any_date (datetime): any date with datetime format
Returns:
[type]: Returns date in humanized form
str: Returns date in humanized form
"""
return arrow.get(any_date).to('US/Pacific').humanize()

Expand All @@ -65,12 +68,17 @@ def nepal_date(local_date: datetime) -> str:
Example:
>>> nepal_date(local_date = 2021-06-02 05:55:55.185035)
just now
'just now'
Args:
local_date (datetime): any local date with datetime format
Example:
>>> replace('I love this alamari package', 'alamari', 'daraaazzz')
'I love this daraaazzz package'
Returns:
[type]: Returns date in humanized form
str: Returns date in humanized form
"""
return arrow.get(local_date).shift(minutes=-345).to('US/Pacific').humanize()

0 comments on commit 2d90901

Please sign in to comment.