diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index cfa16321..f7f38edd 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -26,10 +26,10 @@ jobs: name: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v4 with: python-version: 3.7 - name: Install dependencies @@ -40,7 +40,7 @@ jobs: run: | ./scripts/build-docs python-fluent - name: artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: html path: | @@ -52,14 +52,14 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: html path: _build - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@4.0.0 + uses: JamesIves/github-pages-deploy-action@v4.4.1 with: branch: gh-pages # The branch the action should deploy to. folder: _build # The folder the action should deploy. diff --git a/.github/workflows/fluent.integration.yml b/.github/workflows/fluent.integration.yml index d4c3f456..739af338 100644 --- a/.github/workflows/fluent.integration.yml +++ b/.github/workflows/fluent.integration.yml @@ -8,19 +8,19 @@ on: - master paths: - .github/workflows/fluent.integration.yml - - 'fluent.syntax/**' - - '!fluent.syntax/docs/**' - - 'fluent.runtime/**' - - '!fluent.runtime/docs/**' + - "fluent.syntax/**" + - "!fluent.syntax/docs/**" + - "fluent.runtime/**" + - "!fluent.runtime/docs/**" pull_request: branches: - master paths: - .github/workflows/fluent.integration.yml - - 'fluent.syntax/**' - - '!fluent.syntax/docs/**' - - 'fluent.runtime/**' - - '!fluent.runtime/docs/**' + - "fluent.syntax/**" + - "!fluent.syntax/docs/**" + - "fluent.runtime/**" + - "!fluent.runtime/docs/**" jobs: integration: @@ -28,8 +28,8 @@ jobs: runs-on: ubuntu-latest continue-on-error: true steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.7 - name: Install dependencies diff --git a/.github/workflows/fluent.runtime.yml b/.github/workflows/fluent.runtime.yml index ce8ef5a0..ccae91b7 100644 --- a/.github/workflows/fluent.runtime.yml +++ b/.github/workflows/fluent.runtime.yml @@ -8,30 +8,30 @@ on: - master paths: - .github/workflows/fluent.runtime.yml - - 'fluent.runtime/**' - - '!fluent.runtime/docs/**' + - "fluent.runtime/**" + - "!fluent.runtime/docs/**" pull_request: branches: - master paths: - .github/workflows/fluent.runtime.yml - - 'fluent.runtime/**' - - '!fluent.runtime/docs/**' + - "fluent.runtime/**" + - "!fluent.runtime/docs/**" jobs: unit: name: unit tests - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # https://github.com/actions/setup-python/issues/544 strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + python-version: [3.6, 3.7, 3.8, 3.9, pypy3.9] fluent-syntax: [0.18.1] include: - python-version: 3.9 fluent-syntax: 0.17.0 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -49,16 +49,16 @@ jobs: name: flake8 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.9 - name: Install dependencies run: | python -m pip install wheel python -m pip install --upgrade pip - python -m pip install flake8==3.7.9 + python -m pip install flake8==6 - name: lint working-directory: ./fluent.runtime run: | - flake8 fluent + python -m flake8 diff --git a/.github/workflows/fluent.syntax.yml b/.github/workflows/fluent.syntax.yml index 68c1dd4c..00cc1b3c 100644 --- a/.github/workflows/fluent.syntax.yml +++ b/.github/workflows/fluent.syntax.yml @@ -8,26 +8,26 @@ on: - master paths: - .github/workflows/fluent.syntax.yml - - 'fluent.syntax/**' - - '!fluent.syntax/docs/**' + - "fluent.syntax/**" + - "!fluent.syntax/docs/**" pull_request: branches: - master paths: - .github/workflows/fluent.syntax.yml - - 'fluent.syntax/**' - - '!fluent.syntax/docs/**' + - "fluent.syntax/**" + - "!fluent.syntax/docs/**" jobs: unit: name: unit tests - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 # https://github.com/actions/setup-python/issues/544 strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9, pypy3] + python-version: [3.6, 3.7, 3.8, 3.9, pypy3.9] steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -43,15 +43,15 @@ jobs: name: flake8 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: 3.9 - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install flake8==3.7.9 + python -m pip install flake8==6 - name: lint working-directory: ./fluent.syntax run: | - flake8 + python -m flake8 diff --git a/.gitignore b/.gitignore index 01deed64..be1a0b82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ -.tox -.vscode +.* *.pyc -.eggs/ *.egg-info/ _build build diff --git a/fluent.runtime/fluent/runtime/__init__.py b/fluent.runtime/fluent/runtime/__init__.py index 60a8649e..ba597112 100644 --- a/fluent.runtime/fluent/runtime/__init__.py +++ b/fluent.runtime/fluent/runtime/__init__.py @@ -105,9 +105,9 @@ def format_pattern(self, pattern, args=None): return [result, errors] def _get_babel_locale(self): - for l in self.locales: + for lc in self.locales: try: - return babel.Locale.parse(l.replace('-', '_')) + return babel.Locale.parse(lc.replace('-', '_')) except babel.UnknownLocaleError: continue # TODO - log error diff --git a/fluent.runtime/tools/benchmarks/fluent_benchmark.py b/fluent.runtime/tools/benchmarks/fluent_benchmark.py index 6541381c..2248e27b 100644 --- a/fluent.runtime/tools/benchmarks/fluent_benchmark.py +++ b/fluent.runtime/tools/benchmarks/fluent_benchmark.py @@ -22,6 +22,7 @@ ten = Ten """ + @pytest.fixture def fluent_bundle(): bundle = FluentBundle(['pl'], use_isolating=False) @@ -48,7 +49,7 @@ def fluent_template(bundle): class TestBenchmark(object): def test_template(self, fluent_bundle, benchmark): - result = benchmark(lambda: fluent_template(fluent_bundle)) + benchmark(lambda: fluent_template(fluent_bundle)) def test_bundle(self, benchmark): def test_bundles(): @@ -61,7 +62,7 @@ def test_imports(): # prune cached imports fluent_deps = [ k for k in sys.modules.keys() - if k.split('.', 1)[0] in ('babel','fluent','pytz') + if k.split('.', 1)[0] in ('babel', 'fluent', 'pytz') ] for k in fluent_deps: del sys.modules[k]