pouriya / tir Goto Github PK
View Code? Open in Web Editor NEWHave time.ir in shell!
Home Page: http://time.ir
License: Other
Have time.ir in shell!
Home Page: http://time.ir
License: Other
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.
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.
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 'اَمرداد'
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'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.