scrapinghub / scrapinghub/dateparser
Locale to_parserinfo throws error
Open
Nobody has claimed this yet.
Type: Bug
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
Hello this line
causes the following error
TypeError: type() takes 1 or 3 arguments
Reading the python documentation for python 2 or 3 > https://docs.python.org/3/library/functions.html#type
suggest that the proper signature is like X = type('X', (object,), dict(a=1)) hence string, tuple, dict.
# ERROR
return type(name, bases=[base_cls], dict=attributes)
TypeError: type() takes 1 or 3 arguments
...
# WORKS
type(name, (base_cls,), attributes)
<class 'dateparser.languages.locale.enParserInfo'>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open dateparser/languages/locale.py at line 543 and reproduce the reported TypeError from the locale-to-parserinfo path. Confirm the corrected type() argument structure works for the shown enParserInfo case and verify the relevant parser behavior before marking the issue done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100