Coder Social home page Coder Social logo

persiantools's People

Contributors

mhajiloo avatar theyahya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

persiantools's Issues

unnecessary utility

It seems you don't need utils at all.
You can use some kind of comprehension to make the code even much more readable and independent.

return ''.join(
    dic.get(char, char) # maybe dic is not a good name though
    for char in string
)

return utils.replace(string, dic)

a new function with a better name

I think you can write a new function like convert_numbers and accept from and to from the user. So? Then you don't need four functions that basically do the same thing.

def convert_numbers(from, to, string):
    return output

Extract the distance between two dates

How do I take the time interval between two dates based on the date ??
For example, the first date: 1400/02/26
Second Date: 1400/03/26
And I want to extract a list of days between these two dates

Getting more done in GitHub with ZenHub

Hola! @mhajiloo has created a ZenHub account for the mhajiloo organization. ZenHub is the only project management tool integrated natively in GitHub – created specifically for fast-moving, software-driven teams.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Multi-Repository burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • Time-saving shortcuts – like a quick repo switcher, a “Move issue” button, and much more.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @mhajiloo.

ZenHub Board

installation error

Collecting persiantools
Downloading persiantools-1.2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-7vMtxF/persiantools/setup.py", line 14, in
long_description=readme(),
File "/tmp/pip-build-7vMtxF/persiantools/setup.py", line 7, in readme
with open('README.rst', encoding='utf8') as f:
TypeError: 'encoding' is an invalid keyword argument for this function

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-7vMtxF/persiantools/

Accept unicode strings as input

The replace method in utils.py starts with checking if the input is of type string. This is not ideal because in python 2.x the strings are often of type unicode and that renders some of the functionalities of persiantools unusbale.

For instance, this won't work in persiantools:

digits.fa_to_en(u'۱۲۳۴')

This can be address by allowing the unicode data-type here

make this one better

if isinstance(value, int):
return value
if not isinstance(value, float):
try:
value = value.__int__()
except AttributeError:
pass
else:
if isinstance(value, int):
return value
raise TypeError(
'__int__ returned non-int (type %s)' % type(value).__name__)
raise TypeError(
'an integer is required (got type %s)' % type(value).__name__)
raise TypeError('integer argument expected, got float')

isintance takes a tuple of classes for the second argument. So you could basicly do something like this:

if not isinstance(value, (int, float)):
    raise TypeError('value should int or float object')
return int(value)

Why the result is not the same in Python and Sublime Text 3?

When testing your module, the result in Sublime Text 3 and Python IDLE is the same and none of them show the Day name (for instance: Jomeh), but when using the Python or CMD directly to work with the same code, it works fine!
Test:

from persiantools.jdatetime import JalaliDate
from datetime import datetime
print(datetime.today()) # Output: 2018-08-24 12:33:20.700418
print(JalaliDate.today()) # Output: 1397-06-02
print(JalaliDate(1369, 7, 1)) # Output: 1369-07-01

1
2

Allow conversion of month names to month numbers

While jdatetime defines MONTH_NAMES_FA and similar constants, they are not accessible directly through any methods. It would be great if we had a method that would accept the string 'خرداد' and would return the number 3.

Ideally, similar methods should be also available to get the month number given the transliterated month names (for 'Khordad' return 3), and for the days of the week.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.