Aymeric Augustin
d6eaf4e6d2
Update comments mentioning Python 2.
2019-12-22 18:38:56 +01:00
Aymeric Augustin
45841eaf7b
Remove references to Python 2 in documentation.
2019-12-22 18:38:56 +01:00
Aymeric Augustin
0dddc1494d
Remove py3 marker.
2019-12-22 18:38:56 +01:00
Aymeric Augustin
75a23d24af
Remove import fallbacks.
2019-12-22 18:38:56 +01:00
Aymeric Augustin
798b3b3899
Remove sys.version_info[0] == 2 or 3.
2019-12-22 18:38:42 +01:00
Aymeric Augustin
8af25b1664
Remove six.
2019-12-22 17:56:09 +01:00
Aymeric Augustin
6b2200fc88
Remove u-prefixes.
2019-12-22 17:47:54 +01:00
Aymeric Augustin
c824d15aa1
Remove __future__ imports.
2019-12-22 17:47:54 +01:00
Aymeric Augustin
b6ea0f43ae
Remove duplicate -v flag.
2019-12-22 17:47:27 +01:00
Thomas Wolf
5daca95ddd
Merge pull request #2268 from aaugustin/improve-repository-structure
...
Improve repository structure
2019-12-22 16:41:53 +01:00
Thomas Wolf
54abc67aec
Merge pull request #2255 from aaugustin/implement-best-practices
...
Implement some Python best practices
2019-12-22 16:31:11 +01:00
Aymeric Augustin
00204f2b4c
Replace CommonTestCases for tokenizers with a mixin.
...
This is the same change as for (TF)CommonTestCases for modeling.
2019-12-22 15:35:25 +01:00
Aymeric Augustin
a3c5883f2c
Rename file for consistency.
2019-12-22 15:35:25 +01:00
Aymeric Augustin
daf8bebcdd
Remove unused GPTModelTester.
...
It isn't imported anywhere.
2019-12-22 15:35:25 +01:00
Aymeric Augustin
345c23a60f
Replace (TF)CommonTestCases for modeling with a mixin.
...
I suspect the wrapper classes were created in order to prevent the
abstract base class (TF)CommonModelTester from being included in test
discovery and running, because that would fail.
I solved this by replacing the abstract base class with a mixin.
Code changes are just de-indenting and automatic reformattings
performed by black to use the extra line space.
2019-12-22 15:35:18 +01:00
Aymeric Augustin
7e98e211f0
Remove unittest.main() in test modules.
...
This construct isn't used anymore these days.
Running python tests/test_foo.py puts the tests/ directory on
PYTHONPATH, which isn't representative of how we run tests.
Use python -m unittest tests/test_foo.py instead.
2019-12-22 14:42:03 +01:00
Aymeric Augustin
6be7cdda66
Move source code inside a src subdirectory.
...
This prevents transformers from being importable simply because the CWD
is the root of the git repository, while not being importable from other
directories. That led to inconsistent behavior, especially in examples.
Once you fetch this commit, in your dev environment, you must run:
$ pip uninstall transformers
$ pip install -e .
2019-12-22 14:15:13 +01:00
Aymeric Augustin
ced0a94204
Switch test files to the standard test_*.py scheme.
2019-12-22 14:15:13 +01:00
Aymeric Augustin
067395d5c5
Move tests outside of library.
2019-12-22 13:47:17 +01:00
Aymeric Augustin
698f9e3d7a
Remove trailing whitespace in README.
2019-12-22 13:29:58 +01:00
Aymeric Augustin
c11b3e2926
Sort imports for optional third-party libraries.
...
These libraries aren't always installed in the virtual environment where
isort is running. Declaring them properly avoids mixing these
third-party imports with local imports.
2019-12-22 11:19:13 +01:00
Aymeric Augustin
2a34d5b71b
Stabilize import order for packaging.
...
I don't want to consider it a dependency of transformers, but it's
usually there in local development and usually not there in CI.
2019-12-22 11:07:31 +01:00
Aymeric Augustin
c9270086ea
Disable flake8 F841 in CI to get a passing run.
...
I'll fix it later.
2019-12-22 11:00:06 +01:00
Aymeric Augustin
577a03664d
Enforce flake8 in CI.
2019-12-22 11:00:04 +01:00
Aymeric Augustin
7c6812645a
Restore proper import for HTTPError.
2019-12-22 10:59:08 +01:00
Aymeric Augustin
939148b050
Fix F401 flake8 warning (x28).
...
Do manually what autoflake couldn't manage.
2019-12-22 10:59:08 +01:00
Aymeric Augustin
783a616999
Fix F401 flake8 warning (x88 / 116).
...
This change is mostly autogenerated with:
$ python -m autoflake --in-place --recursive --remove-all-unused-imports --ignore-init-module-imports examples templates transformers utils hubconf.py setup.py
I made minor changes in the generated diff.
2019-12-22 10:59:08 +01:00
Aymeric Augustin
80327a13ea
Fix F401 flake8 warning (x152 / 268).
...
This change is mostly autogenerated with:
$ python -m autoflake --in-place --recursive examples templates transformers utils hubconf.py setup.py
I made minor changes in the generated diff.
2019-12-22 10:59:08 +01:00
Aymeric Augustin
654e051e2a
Ignore F401 flake8 warning (x326 / 594).
2019-12-22 10:59:08 +01:00
Aymeric Augustin
fa2ccbc081
Fix E266 flake8 warning (x90).
2019-12-22 10:59:08 +01:00
Aymeric Augustin
2ab78325f0
Fix F821 flake8 warning (x47).
...
Ignore warnings related to Python 2, because it's going away soon.
2019-12-22 10:59:07 +01:00
Aymeric Augustin
631be27078
Fix E722 flake8 warnings (x26).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
b0f7db73cd
Fix E741 flake8 warning (x14).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
ea89bec185
Fix E231 flake8 warning (x9).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
fd2f17a7a1
Fix E714 flake8 warning (x8).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
5eab3cf6bc
Fix W605 flake8 warning (x5).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
7dce8dc7ac
Fix E731 flake8 warning (x3).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
eed46f38b7
Fix E302 flake8 warning (x3).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
b1de7ae08a
Fix F811 flake8 warning (x1).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
357db7098c
Fix E712 flake8 warning (x1).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
f9c5317db2
Fix E265 flake8 warning (x1).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
28e608a2c2
Remove trailing whitespace from all Python files.
...
Fixes flake8 warning W291 (x224).
2019-12-22 10:59:07 +01:00
Aymeric Augustin
1efa0a7552
Add black-compatible flake8 configuration.
2019-12-22 10:59:07 +01:00
Aymeric Augustin
d0c9fe277a
Fix circular import in transformers.pipelines.
...
Submodules shouldn't import from their parent in general.
2019-12-22 10:59:07 +01:00
Aymeric Augustin
5ca054757f
Update "make style" to sort imports with isort.
2019-12-22 10:59:07 +01:00
Aymeric Augustin
9e80fc7b2f
Enforce isort in CI.
...
We need https://github.com/timothycrosley/isort/pull/1000 but there's no
release with this fix yet, so we'll install from GitHub.
2019-12-22 10:59:00 +01:00
Aymeric Augustin
158e82e061
Sort imports with isort.
...
This is the result of:
$ isort --recursive examples templates transformers utils hubconf.py setup.py
2019-12-22 10:57:46 +01:00
Aymeric Augustin
bc1715c1e0
Add black-compatible isort configuration.
...
lines_after_imports = 2 is a matter of taste; I like it.
2019-12-21 17:53:18 +01:00
Aymeric Augustin
36883c1192
Add "make style" to format code with black.
2019-12-21 17:53:18 +01:00
Aymeric Augustin
6e5291a915
Enforce black in CI.
2019-12-21 17:53:18 +01:00