Skip to content

Commit 5b336f2

Browse files
authored
Merge branch 'master' into 1014/all-granularity
2 parents f6143cc + 7d7926a commit 5b336f2

File tree

11 files changed

+215
-90
lines changed

11 files changed

+215
-90
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 15 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
test:
1313
name: ${{ matrix.os }} (${{ matrix.python-version }})
1414
runs-on: ${{ matrix.os }}
15-
1615
strategy:
1716
fail-fast: false
1817
matrix:
@@ -22,102 +21,61 @@ jobs:
2221
# pypy3 randomly fails on Windows builds
2322
- os: windows-latest
2423
python-version: "pypy-3.7"
25-
24+
include:
25+
- os: ubuntu-latest
26+
path: ~/.cache/pip
27+
- os: macos-latest
28+
path: ~/Library/Caches/pip
29+
- os: windows-latest
30+
path: ~\AppData\Local\pip\Cache
2631
steps:
27-
# Check out latest code
2832
- uses: actions/checkout@v2
29-
30-
# Configure pip cache
31-
- name: Cache pip (Linux)
32-
uses: actions/cache@v2
33-
if: startsWith(runner.os, 'Linux')
34-
with:
35-
path: ~/.cache/pip
36-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
37-
restore-keys: |
38-
${{ runner.os }}-pip-
39-
40-
- name: Cache pip (macOS)
41-
uses: actions/cache@v2
42-
if: startsWith(runner.os, 'macOS')
43-
with:
44-
path: ~/Library/Caches/pip
45-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
46-
restore-keys: |
47-
${{ runner.os }}-pip-
48-
49-
- name: Cache pip (Windows)
33+
- name: Cache pip
5034
uses: actions/cache@v2
51-
if: startsWith(runner.os, 'Windows')
5235
with:
53-
path: ~\AppData\Local\pip\Cache
54-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
55-
restore-keys: |
56-
${{ runner.os }}-pip-
57-
58-
# Set up Python
36+
path: ${{ matrix.path }}
37+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
38+
restore-keys: ${{ runner.os }}-pip-
5939
- name: Set up Python ${{ matrix.python-version }}
6040
uses: actions/setup-python@v2
6141
with:
6242
python-version: ${{ matrix.python-version }}
63-
64-
# Install dependencies
6543
- name: Install dependencies
6644
run: |
6745
pip install -U pip setuptools wheel
6846
pip install -U tox tox-gh-actions
69-
70-
# Run tests
7147
- name: Test with tox
7248
run: tox
73-
74-
# Upload coverage report
7549
- name: Upload coverage to Codecov
7650
uses: codecov/codecov-action@v2
7751
with:
7852
file: coverage.xml
7953

8054
lint:
8155
runs-on: ubuntu-latest
82-
8356
steps:
84-
# Check out latest code
8557
- uses: actions/checkout@v2
86-
87-
# Set up Python
8858
- name: Set up Python 3.10
8959
uses: actions/setup-python@v2
9060
with:
9161
python-version: "3.10"
92-
93-
# Configure pip cache
9462
- name: Cache pip
9563
uses: actions/cache@v2
9664
with:
9765
path: ~/.cache/pip
98-
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
99-
restore-keys: |
100-
${{ runner.os }}-pip-
101-
102-
# Configure pre-commit cache
66+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
67+
restore-keys: ${{ runner.os }}-pip-
10368
- name: Cache pre-commit
10469
uses: actions/cache@v2
10570
with:
10671
path: ~/.cache/pre-commit
10772
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
108-
restore-keys: |
109-
${{ runner.os }}-pre-commit-
110-
111-
# Install dependencies
73+
restore-keys: ${{ runner.os }}-pre-commit-
11274
- name: Install dependencies
11375
run: |
11476
pip install -U pip setuptools wheel
11577
pip install -U tox
116-
117-
# Lint code
11878
- name: Lint code
119-
run: tox -e lint
120-
121-
# Lint docs
79+
run: tox -e lint -- --show-diff-on-failure
12280
- name: Lint docs
12381
run: tox -e docs

.pre-commit-config.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@ default_language_version:
22
python: python3
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.0.1
5+
rev: v4.1.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: fix-encoding-pragma
10-
args: [--remove]
11-
- id: requirements-txt-fixer
127
- id: check-ast
138
- id: check-yaml
149
- id: check-case-conflict
1510
- id: check-docstring-first
1611
- id: check-merge-conflict
12+
- id: check-builtin-literals
1713
- id: debug-statements
14+
- id: end-of-file-fixer
15+
- id: fix-encoding-pragma
16+
args: [--remove]
17+
- id: requirements-txt-fixer
18+
args: [requirements/requirements.txt, requirements/requirements-docs.txt, requirements/requirements-tests.txt]
19+
- id: trailing-whitespace
1820
- repo: https://github.com/timothycrosley/isort
19-
rev: 5.9.3
21+
rev: 5.10.1
2022
hooks:
2123
- id: isort
2224
- repo: https://github.com/asottile/pyupgrade
23-
rev: v2.29.0
25+
rev: v2.30.1
2426
hooks:
2527
- id: pyupgrade
2628
args: [--py36-plus]
@@ -29,12 +31,14 @@ repos:
2931
hooks:
3032
- id: python-no-eval
3133
- id: python-check-blanket-noqa
34+
- id: python-check-mock-methods
3235
- id: python-use-type-annotations
3336
- id: rst-backticks
3437
- id: rst-directive-colons
3538
- id: rst-inline-touching-normal
39+
- id: text-unicode-replacement-char
3640
- repo: https://github.com/psf/black
37-
rev: 21.9b0
41+
rev: 21.12b0
3842
hooks:
3943
- id: black
4044
args: [--safe, --quiet, --target-version=py36]
@@ -44,7 +48,7 @@ repos:
4448
- id: flake8
4549
additional_dependencies: [flake8-bugbear,flake8-annotations]
4650
- repo: https://github.com/pre-commit/mirrors-mypy
47-
rev: 'v0.910-1'
51+
rev: 'v0.930'
4852
hooks:
4953
- id: mypy
5054
additional_dependencies: [types-python-dateutil]

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
include LICENSE CHANGELOG.rst README.rst Makefile requirements-dev.txt tox.ini
1+
include LICENSE CHANGELOG.rst README.rst Makefile tox.ini
2+
recursive-include requirements *.txt
23
recursive-include tests *.py
34
recursive-include docs *.py *.rst *.bat Makefile

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: auto test docs clean
22

3-
auto: build39
3+
auto: build310
44

55
build36: PYTHON_VER = python3.6
66
build37: PYTHON_VER = python3.7
@@ -12,7 +12,8 @@ build36 build37 build38 build39 build310: clean
1212
$(PYTHON_VER) -m venv venv
1313
. venv/bin/activate; \
1414
pip install -U pip setuptools wheel; \
15-
pip install -r requirements-dev.txt; \
15+
pip install -r requirements/requirements-tests.txt; \
16+
pip install -r requirements/requirements-docs.txt; \
1617
pre-commit install
1718

1819
test:
@@ -22,14 +23,20 @@ test:
2223

2324
lint:
2425
. venv/bin/activate; \
25-
pre-commit run --all-files --show-diff-on-failure
26+
pre-commit run --all-files
2627

27-
docs:
28+
clean-docs:
2829
rm -rf docs/_build
30+
31+
docs:
2932
. venv/bin/activate; \
3033
cd docs; \
3134
make html
3235

36+
live-docs: clean-docs
37+
. venv/bin/activate; \
38+
sphinx-autobuild docs docs/_build/html
39+
3340
clean: clean-dist
3441
rm -rf venv .pytest_cache ./**/__pycache__
3542
rm -f .coverage coverage.xml ./**/*.pyc

arrow/locales.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
]
4747

4848

49-
_locale_map: Dict[str, Type["Locale"]] = dict()
49+
_locale_map: Dict[str, Type["Locale"]] = {}
5050

5151

5252
def get_locale(name: str) -> "Locale":
@@ -5743,7 +5743,7 @@ class SinhalaLocale(Locale):
57435743
}
57445744
# Sinhala: the general format to describe timeframe is different from past and future,
57455745
# so we do not copy the original timeframes dictionary
5746-
timeframes_only_distance = dict()
5746+
timeframes_only_distance = {}
57475747
timeframes_only_distance["second"] = "තත්පරයක්"
57485748
timeframes_only_distance["seconds"] = "තත්පර {0}"
57495749
timeframes_only_distance["minute"] = "මිනිත්තුවක්"

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@
5858
html_sidebars = {
5959
"**": ["about.html", "localtoc.html", "relations.html", "searchbox.html"]
6060
}
61+
62+
# Generate PDFs with unicode characters
63+
# https://docs.readthedocs.io/en/stable/guides/pdf-non-ascii-languages.html
64+
latex_engine = "xelatex"

requirements/requirements-docs.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-r requirements.txt
2+
doc8
3+
sphinx
4+
sphinx-autobuild
5+
sphinx-autodoc-typehints
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1+
-r requirements.txt
12
dateparser==1.*
2-
pre-commit==2.*
3-
pytest==6.*
4-
pytest-cov==3.*
5-
pytest-mock==3.*
3+
pre-commit
4+
pytest
5+
pytest-cov
6+
pytest-mock
67
python-dateutil>=2.7.0
78
pytz==2021.1
89
simplejson==3.*
9-
sphinx==4.*
10-
sphinx-autodoc-typehints==1.*
1110
typing_extensions; python_version < '3.8'

requirements/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
python-dateutil>=2.7.0
2+
typing_extensions; python_version < '3.8'

0 commit comments

Comments
 (0)