pax_global_header00006660000000000000000000000064147506510610014517gustar00rootroot0000000000000052 comment=02bd2e5dd4477b4f6db98c5e98149458eb3cc821 dateparser-1.2.1/000077500000000000000000000000001475065106100136525ustar00rootroot00000000000000dateparser-1.2.1/.coveragerc000066400000000000000000000000321475065106100157660ustar00rootroot00000000000000[run] source = dateparser dateparser-1.2.1/.editorconfig000066400000000000000000000004061475065106100163270ustar00rootroot00000000000000# http://editorconfig.org root = true [*] indent_style = space indent_size = 4 trim_trailing_whitespace = true insert_final_newline = true charset = utf-8 end_of_line = lf [*.bat] indent_style = tab end_of_line = crlf [LICENSE] insert_final_newline = false dateparser-1.2.1/.git-blame-ignore-revs000066400000000000000000000001121475065106100177440ustar00rootroot00000000000000# Apply the auto-formatter black 24c1637dcc77aac006db8ebcfbf5199fa7abac5d dateparser-1.2.1/.github/000077500000000000000000000000001475065106100152125ustar00rootroot00000000000000dateparser-1.2.1/.github/workflows/000077500000000000000000000000001475065106100172475ustar00rootroot00000000000000dateparser-1.2.1/.github/workflows/cifuzz.yml000066400000000000000000000020261475065106100213040ustar00rootroot00000000000000name: CIFuzz on: [pull_request] permissions: {} jobs: Fuzzing: runs-on: ubuntu-latest permissions: security-events: write steps: - name: Build Fuzzers id: build uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master with: oss-fuzz-project-name: 'dateparser' language: python - name: Run Fuzzers uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master with: oss-fuzz-project-name: 'dateparser' language: python fuzz-seconds: 600 output-sarif: true - name: Upload Crash uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' with: name: artifacts path: ./out/artifacts - name: Upload Sarif if: always() && steps.build.outcome == 'success' uses: github/codeql-action/upload-sarif@v2 with: # Path to SARIF file relative to the root of the repository sarif_file: cifuzz-sarif/results.sarif checkout_path: cifuzz-sarif dateparser-1.2.1/.github/workflows/main.yml000066400000000000000000000027451475065106100207260ustar00rootroot00000000000000name: Build on: push: branches: - master pull_request: branches: - master jobs: build: name: Build runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - python-version: "3.13" toxenv: pre-commit - python-version: "3.9" toxenv: min - python-version: "3.9" toxenv: min-all - python-version: "3.9" - python-version: "3.10" - python-version: "3.11" - python-version: "3.12" - python-version: "3.13" toxenv: all - python-version: "3.13" toxenv: scripts - python-version: "3.12" # Keep in sync with tox.ini toxenv: docs - python-version: "3.13" toxenv: twinecheck steps: - uses: actions/checkout@v3 - name: 'Set up Python ${{ matrix.python-version }}' uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install language-pack-fr run: sudo apt-get update && sudo apt-get install -y language-pack-fr build-essential - name: Install dependencies run: | python -m pip install --upgrade pip pip install tox - name: Run tests run: tox -e ${{ matrix.toxenv || 'py' }} - name: Upload coverage.xml to codecov uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} dateparser-1.2.1/.github/workflows/publish.yml000066400000000000000000000011661475065106100214440ustar00rootroot00000000000000name: Upload Python Package on: release: types: [created] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.x" - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine - name: Build and publish env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} run: | python setup.py sdist bdist_wheel twine upload dist/* dateparser-1.2.1/.gitignore000066400000000000000000000007231475065106100156440ustar00rootroot00000000000000*.py[cod] .python-version # C extensions *.so # Packages *.egg *.eggs *.egg-info dist build eggs parts bin var sdist develop-eggs .installed.cfg lib lib64 # Installer logs pip-log.txt # Unit test / coverage reports .coverage .tox nosetests.xml htmlcov coverage.xml # Translations *.mo # Mr Developer .mr.developer.cfg .project .pydevproject # Complexity output/*.html output/*/index.html # Sphinx docs/_build # Editors *.swp .idea .vscode/ # Other raw_data dateparser-1.2.1/.isort.cfg000066400000000000000000000000331475065106100155450ustar00rootroot00000000000000[settings] profile = black dateparser-1.2.1/.pre-commit-config.yaml000066400000000000000000000002161475065106100201320ustar00rootroot00000000000000repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.9.3 hooks: - id: ruff args: [ --fix ] - id: ruff-format dateparser-1.2.1/.readthedocs.yml000066400000000000000000000006011475065106100167350ustar00rootroot00000000000000version: 2 formats: all sphinx: configuration: docs/conf.py fail_on_warning: true build: os: ubuntu-20.04 tools: # For available versions, see: # https://docs.readthedocs.io/en/stable/config-file/v2.html#build-tools-python python: "3.11" # Keep in sync with .github/workflows/checks.yml python: install: - requirements: docs/requirements.txt - path: . dateparser-1.2.1/AUTHORS.rst000066400000000000000000000013071475065106100155320ustar00rootroot00000000000000======= Credits ======= Currently, more than 100 committers have contributed to this project, making this contributors list really hard to maintain, so we have decided to stop updating this list. To see the people behind this code, you can run ``git shortlog -s -n`` or visit the contributions section in Github: https://github.com/scrapinghub/dateparser/graphs/contributors We really appreciate **all the people that has contributed to this project with their time and ideas**. Special mention to **Waqas Shabir** (waqasshabbir), **Eugene Amirov** (Allactaga) and **Artur Sadurski** (asadurski) for creating and maintaining this awesome project. To all of you... thank you for building and improving this! dateparser-1.2.1/CONTRIBUTING.rst000066400000000000000000000137351475065106100163240ustar00rootroot00000000000000============ Contributing ============ Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: Types of Contributions ---------------------- Report Bugs ~~~~~~~~~~~ Report bugs at https://github.com/scrapinghub/dateparser/issues. If you are reporting a bug, please include: * Your operating system name and version. * Any details about your local setup that might be helpful in troubleshooting. * Detailed steps to reproduce the bug. Fix Bugs and Implement Features ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Look through the GitHub issues for bugs and feature requests. To avoid duplicate efforts, try to choose issues without related PRs or with staled PRs. We also encourage you to add new languages to the existing stack. Write Documentation ~~~~~~~~~~~~~~~~~~~ Dateparser could always use more documentation, whether as part of the official Dateparser docs, in docstrings, or even on the web in blog posts, articles, and such. After you make local changes to the documentation, you will be able to build the project running:: tox -e docs Then open ``.tox/docs/tmp/html/index.html`` in a web browser to see your local build of the documentation. .. note:: If you don't have ``tox`` installed, you need to install it first using ``pip install tox``. Submit Feedback ~~~~~~~~~~~~~~~ The best way to send feedback is to file an issue at https://github.com/scrapinghub/dateparser/issues. If you are proposing a feature: * Explain in detail how it would work. * Keep the scope as narrow as possible, to make it easier to implement. * Remember that contributions are welcome :) Get Started! ------------ Ready to contribute? Here's how to set up `dateparser` for local development. 1. Fork the `dateparser` repo on GitHub. 2. Clone your fork locally:: $ git clone git@github.com:your_name_here/dateparser.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development:: $ mkvirtualenv dateparser $ cd dateparser/ $ python setup.py develop 4. Create a branch for local development:: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: $ tox To get ``tox``, just ``pip install`` it into your virtualenv. In addition to tests, ``tox`` checks for code style and maximum line length (119 characters). 6. Commit your changes and push your branch to GitHub:: $ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. Pull Request Guidelines ----------------------- Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests. 2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in *README.rst*. 3. Check the pipelines (Github Actions) in the PR comments (or in https://github.com/scrapinghub/dateparser/actions) and make sure that the tests pass for all supported Python versions. 4. Check the new project coverage in the PR comments (or in https://app.codecov.io/gh/scrapinghub/dateparser/pulls) and make sure that it remained equal or higher than previously. 5. Follow the core developers' advice which aims to ensure code's consistency regardless of the variety of approaches used by many contributors. 6. In case you are unable to continue working on a PR, please leave a short comment to notify us. We will be pleased to make any changes required to get it done. Guidelines for Editing Translation Data --------------------------------------- English is the primary language of Dateparser. Dates in all other languages are translated into English equivalents before they are parsed. The language data that Dateparser uses to parse dates is in ``dateparser/data/date_translation_data``. For each supported language, there is a Python file containing translation data. Each translation data Python files contains different kinds of translation data for date parsing: month and week names - and their abbreviations, prepositions, conjunctions, frequently used descriptive words and phrases (like “today”), etc. Translation data Python files are generated from the following sources: - `Unicode CLDR `_ data in JSON format, located at ``dateparser_data/cldr_language_data/date_translation_data`` - Additional data from the Dateparser community in YAML format, located at ``dateparser_data/supplementary_language_data/date_translation_data`` If you wish to extend the data of an existing language, or add data for a new language, you must: #. Edit or create the corresponding file within ``dateparser_data/supplementary_language_data/date_translation_data`` See existing files to learn how they are defined, and see :ref:`language-data-template` for details. #. Regenerate the corresponding file within ``dateparser/data/date_translation_data`` running the following script:: dateparser_scripts/write_complete_data.py #. Write tests that cover your changes You should be able to find tests that cover the affected data, and use copy-and-paste to create the corresponding new test. If in doubt, ask Dateparser maintainers for help. .. toctree:: :maxdepth: 2 :hidden: template Updating the List of Supported Languages and Locales ---------------------------------------------------- Whenever the content of ``dateparser.data.languages_info.language_locale_dict`` is modified, use ``dateparser_scripts/update_supported_languages_and_locales.py`` to update the corresponding documentation table:: dateparser_scripts/update_supported_languages_and_locales.py dateparser-1.2.1/HISTORY.rst000066400000000000000000000406271475065106100155560ustar00rootroot00000000000000.. :changelog: History ======= 1.2.1 (2025-02-05) ------------------ Fixes: - Fix PytzUsageWarning (#1109) - Fix date_parser with prefer_month_of_year wrong results (#1224) - Fix skipped day when UTC and tz are different days (#1183) Improvements: - Avoid repeated loop over timezones (#1238) - Proofread README.rst (#1234) - Check for derived types for configuration (#1223) - Parse some abbreviated strings as relative dates (#1219) - Migrate from hijri-converter to hijridate (#1211) - Fixed ClusterFuzz build error by adding dateparser.data as a binary (#1208) - Fix an issue detected by OSSFuzz (#1203) - Support two-digit years in non-Gregorian calendars (#1187) - Refactored CI to run extras separately and test minimum versions of dependencies, replaced flake8 with ruff, fixed tests (#1248) - Set minimum versions for dependencies (#1248) - Limited ``numpy`` to 1.x when installing ``dateparser[fasttext]`` (#1248) 1.2.0 (2023-11-17) ------------------ New features: - New ``PREFER_MONTH_OF_YEAR`` setting (#1146) Fixes: - Absolute years in Russian are no longer being treated as a number of years in the past (#1129) Cleanups and internal improvements: - Removed the use of ``datetime.utcnow``, deprecated on Python 3.12 (#1179) - Applied Black formatting to the code base (#1158) - Initial integration with OSSFuzz (#1198) - Extended test cases (#1191) 1.1.8 (2023-03-22) ------------------ Improvements: - Improved date parsing for Chinese (#1148) - Improved date parsing for Czech (#1151) - Reorder language by popularity (#1152) - Fix leak of memory in cache (#1140) - Add support for "\d units later" (#1154) - Move modification in CLDR data to yaml (#1153) - Add support to use timezone via settings to get PREFER_DATES_FROM result (#1155) 1.1.7 (2023-02-02) ------------------ Improvements: - Add an “ago” synonym for Arabic (#1128) - Improved date parsing for Czech (#1131) - Improved date parsing for Indonesian (#1134) 1.1.6 (2023-01-12) ------------------ Improvements: - Fix the bug where Monday is parsed as a month (#1121) - Prevent ReDoS in Spanish sentence splitting regex (#1084) 1.1.5 (2022-12-29) ------------------ Improvements: - Parse short versions of day, month, and year (#1103) - Add a test for “in 1d” (#1104) - Update languages_info (#1107) - Add a workaround for zipimporter not having exec_module before Python 3.10 (#1069) - Stabilize tests at midnight (#1111) - Add a test case for French (#1110) Cleanups: - Remove the requirements-build file (#1113) 1.1.4 (2022-11-21) ------------------ Improvements: - Improved support for languages such as Slovak, Indonesian, Hindi, German and Japanese (#1064, #1094, #986, #1071, #1068) - Recursively create a model home (#996) - Replace regex sub with simple string replace (#1095) - Add Python 3.10, 3.11 support (#1096) - Drop support for Python 3.5, 3.6 versions (#1097) 1.1.3 (2022-11-03) ------------------ New features: - Add support for fractional units (#876) Improvements: - Fix the returned datetime skipping a day with time+timezone input and PREFER_DATES_FROM = 'future' (#1002) - Fix input translatation breaking keep_formatting (#720) - English: support "till date" (#1005) - English: support “after” and “before” in relative dates (#1008) Cleanups: - Reorganize internal data (#1090) - CI updates (#1088) 1.1.2 (2022-10-20) ------------------ Improvements: - Added support for negative timestamp (#1060) - Fixed PytzUsageWarning for Python versions >= 3.6 (#1062) - Added support for dates with dots and spaces (#1028) - Improved support for Ukrainian, Croatian and Russian (#1072, #1074, #1079, #1082, #1073, #1083) - Added support for parsing Unix timestamps consistently regardless of timezones (#954) - Improved tests (#1086) 1.1.1 (2022-03-17) ------------------ Improvements: - Fixed issue with regex library by pinning dependencies to an earlier version (< 2022.3.15, #1046). - Extended support for Russian language dates starting with lowercase (#999). - Allowed to use_given_order for languages too (#997). - Fixed link to settings section (#1018). - Defined UTF-8 encoding for Windows (#998). - Fixed directories creation error in CLI utils (#1022). 1.1.0 (2021-10-04) ------------------ New features: * Support language detection based on ``langdetect``, ``fastText``, or a custom implementation (see #932) * Add support for 'by