GithubHelp home page GithubHelp logo

pouriya / tir Goto Github PK

View Code? Open in Web Editor NEW
130.0 1.0 8.0 49 KB

Have time.ir in shell!

Home Page: http://time.ir

License: Other

Makefile 0.62% Python 99.38%
crawler time date calendar shell terminal iran iranian iranian-calendar

tir's Issues

Easier way to install

Hi,
First of all, thank you for your effort in making this software.
But, I want to ask is there any easier way to install this software?
I read the README file and i got it that I have to install lots of dependencies for using this.
It's good to build a way to install with only one command an enjoy it.
thanks.

Adding type hints

Hi!
I think it's better to use typing hints. That makes code cleaner. See PEP 484.
For example, this part:

def transform_numeral_date(data):
    # for example '1397/12/6' or 2018-2-25 which is my birthday :)
    if data.find('/') != -1:
        _type = 'solar'
    else: # assume gregorian
        _type = 'gregorian'
    data = data.strip().replace('/', '-').split('-')
    (year, month, day) = (transform_number(data[0])
                         ,transform_number(data[1])
                         ,transform_number(data[2]))
    season = find_season(int(month), _type)
    return (year, season, month, day)

Converts to:

from typing import Tuple
def transform_numeral_date(data: str) -> Tuple[int, Tuple[str, int], int, int]:
    # for example '1397/12/6' or 2018-2-25 which is my birthday :)
    if data.find('/') != -1:
        _type = 'solar'
    else: # assume gregorian
        _type = 'gregorian'
    data = data.strip().replace('/', '-').split('-')
    (year, month, day) = (transform_number(data[0])
                         ,transform_number(data[1])
                         ,transform_number(data[2]))
    season = find_season(int(month), _type)
    return (year, season, month, day)

If you think that's OK, I can fix it.

An error occurred

Hi.
There is a problem with executing " tir "
Given error :

Traceback (most recent call last):
  File "/usr/local/bin/tir", line 619, in <module>
    main(data)
  File "/usr/local/bin/tir", line 508, in main
    transformed = HTMLParser(data, transformers).parse()
  File "/usr/local/lib/python3.8/dist-packages/tir-19.10.7-py3.8.egg/tir/tir.py", line 282, in parse
    transform_data[name] = transformer(self.html)
  File "/usr/local/bin/tir", line 97, in find_dates
    solar = find_date(rows, 'shamsi')
  File "/usr/local/bin/tir", line 107, in find_date
    (weekday, (year, month_name, day)) = transform_date(date)
  File "/usr/local/lib/python3.8/dist-packages/tir-19.10.7-py3.8.egg/tir/tir.py", line 61, in transform_date
    date = transform_date_with_string_month(data[1].strip())
  File "/usr/local/lib/python3.8/dist-packages/tir-19.10.7-py3.8.egg/tir/tir.py", line 85, in transform_date_with_string_month
    ,transform_month(date[1])
  File "/usr/local/lib/python3.8/dist-packages/tir-19.10.7-py3.8.egg/tir/tir.py", line 177, in transform_month
    raise ValueError('unknown solar month {!r}'.format(month))
ValueError: unknown solar month 'اَمرداد'

tir.tir._TagNotFound: could not found HTML tag 'div' with attribute 'class' and value which should contain 'container top'

This error is raised while running the tir command:

Traceback (most recent call last):
File "/usr/local/bin/tir", line 555, in
main()
File "/usr/local/bin/tir", line 457, in main
transformed = HTMLParser(data, transformers).parse()
File "/usr/local/lib/python3.7/site-packages/tir-18.12.25-py3.7.egg/tir/tir.py", line 280, in parse
transform_data[name] = transformer(self.html)
File "/usr/local/bin/tir", line 84, in find_dates
container_top = search(html.body, 'div', 'class', ('container top',))
File "/usr/local/lib/python3.7/site-packages/tir-18.12.25-py3.7.egg/tir/tir.py", line 224, in search
raise _TagNotFound(tag, attr, val)
tir.tir._TagNotFound: could not found HTML tag 'div' with attribute 'class' and value which should contain 'container top'

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.