Git Product home page Git Product logo

pytime's Issues

Want to add improvements and fix some errors

Hi @shinux .
First of all, very nice module. Lot of handy methods to use for date and time manipulation.
I know last commit was years ago, but I would like to fix some things because I find this module useful and really easy to read. Also, it would be my first contribution to open source.

Here is what I found digging through PyTime, first some minor mistakes:

  1. At the end of filter.py, in method from_str, there is typo at last line, raise CanNotFormatError('Not well formated. Expecting something like May,21st.2015'). formated should be formatted
  2. At the end of filter.py, at if __name__ == '__main__':, there is PEP 8 violation. PEP 8: expected 2 blank lines after class or function definition, found 1. Missing one more blank line
  3. In function daysrange, parameter wipe is not documented.

Now second list may or may not be problems, you decide.

  1. In test_normal.py, in method test_function, this7 and this8 fail. On my machine, I setup this so it can show test as your tested, +2h offset I guess. I think you wanted to get from pytime.yesterday(1432310400 + gmt8offset) -> datetime.datetime(2015, 5, 22, 0, 0). And you get it, but you are comparing it to datetime.datetime(2015, 5, 22) which returns false, because tuple comparison fails here. Similiar is for this8.
  2. Maybe better aproach would be to rename daysrange to days_range, newyear to new_year, christeve to christ_eve and lastday to last_day. That is because words should be split with underscore by conventions of python using snake case, and you already use that convention for this_week, last_week, next_month and so on.
  3. In filter.py, in method __parse_not_only_str, function word usage in for loop is too broad term to be used. Maybe rename it to baseParser_function. Found some problems with pycharm too. link here

There are some other things, but I would like to change some of those mentioned above if you would allow me to make pull request.
Thank you for your time.

Confusion about month abbreviations

Thank you very much for checking my issue. I found that August was abbreviated as Agu instead of Aug when I used it, which made me very confused. I want to ask why this is?
example found in filter.py file:
NAMED_MONTHS = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4,
'May': 5, 'Jun': 6, 'Jul': 7, 'Agu': 8,
'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}

pytime.father() wrong for non-US countries

pytime.father(2020) gives me 2020-06-21
pytime.father(2021) gives me 2021-06-20

But for germany that day is on the 2020-05-21 / 2021-05-13.

Is there any way to get the fatherday for other countries?

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.