From fb0f419e39a70063938394a20d49fa3027f9f501 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Wed, 6 Nov 2024 08:42:46 -0600 Subject: [PATCH] Update python versions and data; add new pythons, remove old ones. Add github workflows and dependabot. --- .github/dependabot.yml | 13 ++ .github/workflows/tests.yml | 57 +++++ .pylintrc | 220 ++++++++++++++++++ CHANGES.rst | 8 +- MANIFEST.in | 1 + pyproject.toml | 5 + setup.cfg | 2 - setup.py | 37 ++- src/nti/__init__.py | 1 - src/nti/i18n/locales/cctld.py | 21 +- src/nti/i18n/locales/tlds-alpha-by-domain.txt | 145 ++---------- src/nti/i18n/locales/tlds.json | 191 ++++++++++++++- tox.ini | 32 ++- 13 files changed, 568 insertions(+), 165 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .pylintrc create mode 100644 pyproject.toml delete mode 100644 setup.cfg diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0b84a24 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# Keep GitHub Actions up to date with GitHub's Dependabot... +# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + groups: + github-actions: + patterns: + - "*" # Group all Actions updates into a single larger pull request + schedule: + interval: monthly diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..86de931 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,57 @@ +name: tests + +on: [push, pull_request] + +env: + PYTHONHASHSEED: 1042466059 + ZOPE_INTERFACE_STRICT_IRO: 1 + + +jobs: + test: + strategy: + matrix: + python-version: ["pypy-3.10", "3.10", "3.11", "3.12", "3.13"] + extras: + - "[test,docs]" + include: + - python-version: "3.13" + extras: "[test,docs,plone]" + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: 'setup.py' + - name: Install dependencies + run: | + python -m pip install -U pip setuptools wheel + python -m pip install -U coverage + python -m pip install -U -e ".${{ matrix.extras }}" + - name: Test + run: | + coverage run -m zope.testrunner --test-path=src --auto-color --auto-progress + coverage run -a -m sphinx -b doctest -d docs/_build/doctrees docs docs/_build/doctests + - name: Lint + if: matrix.python-version == '3.12' + run: | + python -m pip install -U pylint + pylint src + - name: Submit to Coveralls + # This is a container action, which only runs on Linux. + uses: AndreMiras/coveralls-python-action@develop + with: + parallel: true + + coveralls_finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + uses: AndreMiras/coveralls-python-action@develop + with: + parallel-finished: true diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..814d8a3 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,220 @@ +[MASTER] +load-plugins=pylint.extensions.bad_builtin, + pylint.extensions.check_elif, + pylint.extensions.code_style, + pylint.extensions.dict_init_mutate, + pylint.extensions.docstyle, + pylint.extensions.dunder, + pylint.extensions.comparison_placement, + pylint.extensions.confusing_elif, + pylint.extensions.for_any_all, + pylint.extensions.consider_refactoring_into_while_condition, + pylint.extensions.mccabe, + pylint.extensions.eq_without_hash, + pylint.extensions.redefined_variable_type, + pylint.extensions.overlapping_exceptions, + pylint.extensions.docparams, + pylint.extensions.private_import, + pylint.extensions.set_membership, + pylint.extensions.typing, + +# magic_value wants you to not use arbitrary strings and numbers +# inline in the code. But it's overzealous and has way too many false +# positives. Trust people to do the most readable thing. +# pylint.extensions.magic_value + +# Empty comment would be good, except it detects blank lines within +# a single comment block. +# +# Those are often used to separate paragraphs, like here. +# pylint.extensions.empty_comment, + +# consider_ternary_expression is a nice check, but is also overzealous. +# Trust the human to do the readable thing. +# pylint.extensions.consider_ternary_expression, + +# redefined_loop_name tends to catch us with things like +# for name in (a, b, c): name = name + '_column' ... +# pylint.extensions.redefined_loop_name, + +# This wants you to turn ``x in (1, 2)`` into ``x in {1, 2}``. +# They both result in the LOAD_CONST bytecode, one a tuple one a +# frozenset. In theory a set lookup using hashing is faster than +# a linear scan of a tuple; but if the tuple is small, it can often +# actually be faster to scan the tuple. +# pylint.extensions.set_membership, + +# Fix zope.cachedescriptors.property.Lazy; the property-classes doesn't seem to +# do anything. +# https://stackoverflow.com/questions/51160955/pylint-how-to-specify-a-self-defined-property-decorator-with-property-classes +# For releases prior to 2.14.2, this needs to be a one-line, quoted string. After that, +# a multi-line string. +# - Make zope.cachedescriptors.property.Lazy look like a property; +# fixes pylint thinking it is a method. +# - Run in Pure Python mode (ignore C extensions that respect this); +# fixes some issues with zope.interface, like IFoo.providedby(ob) +# claiming not to have the right number of parameters...except no, it does not. +init-hook = + import astroid.bases + astroid.bases.POSSIBLE_PROPERTIES.add('Lazy') + astroid.bases.POSSIBLE_PROPERTIES.add('LazyOnClass') + astroid.bases.POSSIBLE_PROPERTIES.add('readproperty') + astroid.bases.POSSIBLE_PROPERTIES.add('non_overridable') + import os + os.environ['PURE_PYTHON'] = ("1") + # Ending on a quoted string + # breaks pylint 2.14.5 (it strips the trailing quote. This is + # probably because it tries to handle one-line quoted strings as well as multi-blocks). + # The parens around it fix the issue. + + +[MESSAGES CONTROL] + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). +# NOTE: comments must go ABOVE the statement. In Python 2, mixing in +# comments disables all directives that follow, while in Python 3, putting +# comments at the end of the line does the same thing (though Py3 supports +# mixing) + + +# invalid-name, ; We get lots of these, especially in scripts. should fix many of them +# protected-access, ; We have many cases of this; legit ones need to be examinid and commented, then this removed +# no-self-use, ; common in superclasses with extension points +# too-few-public-methods, ; Exception and marker classes get tagged with this +# exec-used, ; should tag individual instances with this, there are some but not too many +# global-statement, ; should tag individual instances +# multiple-statements, ; "from gevent import monkey; monkey.patch_all()" +# locally-disabled, ; yes, we know we're doing this. don't replace one warning with another +# cyclic-import, ; most of these are deferred imports +# too-many-arguments, ; these are almost always because that's what the stdlib does +# redefined-builtin, ; likewise: these tend to be keyword arguments like len= in the stdlib +# undefined-all-variable, ; XXX: This crashes with pylint 1.5.4 on Travis (but not locally on Py2/3 +# ; or landscape.io on Py3). The file causing the problem is unclear. UPDATE: identified and disabled +# that file. +# see https://github.com/PyCQA/pylint/issues/846 +# useless-suppression: the only way to avoid repeating it for specific statements everywhere that we +# do Py2/Py3 stuff is to put it here. Sadly this means that we might get better but not realize it. +# duplicate-code: Yeah, the compatibility ssl modules are much the same +# In pylint 1.8.0, inconsistent-return-statements are created for the wrong reasons. +# This code raises it, even though there is only one return (the implicit ``return None`` is presumably +# what triggers it): +# def foo(): +# if baz: +# return 1 +# In Pylint 2dev1, needed for Python 3.7, we get spurious "useless return" errors: +# @property +# def foo(self): +# return None # generates useless-return +# Pylint 2.4 adds import-outside-toplevel. But we do that a lot to defer imports because of patching. +# Pylint 2.4 adds self-assigning-variable. But we do *that* to avoid unused-import when we +# "export" the variable and dont have a __all__. +# Pylint 2.6+ adds some python-3-only things that dont apply: raise-missing-from, super-with-arguments, consider-using-f-string, redundant-u-string-prefix +# cyclic import is added because it pylint is spuriously detecting that +# consider-using-assignment-expr wants you to transform things like: +# foo = get_foo() +# if foo: ... +# +# Into ``if (foo := get_foo()):`` +# But there are a *lot* of those. Trust people to do the right, most +# readable, thing +# +# docstring-first-line-empty: That's actually our standard, based on Django. +# XXX: unclear on the docstring warnings, missing-type-doc, missing-param-doc, +# differing-param-doc, differing-type-doc (are the last two replacements for the first two?) +# +# They should be addressed, in general they are a good thing, but sometimes they are +# unnecessary. +disable=wrong-import-position, + wrong-import-order, + missing-docstring, + ungrouped-imports, + invalid-name, + too-few-public-methods, + global-statement, + locally-disabled, + too-many-arguments, + useless-suppression, + duplicate-code, + useless-object-inheritance, + import-outside-toplevel, + self-assigning-variable, + consider-using-f-string, + consider-using-assignment-expr, + use-dict-literal, + missing-type-doc, + missing-param-doc, + differing-param-doc, + differing-type-doc, + compare-to-zero, + docstring-first-line-empty, + +enable=consider-using-augmented-assign + +[FORMAT] +max-line-length=100 +max-module-lines=1100 + +[MISCELLANEOUS] +# List of note tags to take in consideration, separated by a comma. +#notes=FIXME,XXX,TODO +# Disable that, we don't want them to fail the lint CI job. +notes= + +[VARIABLES] + +dummy-variables-rgx=_.* +init-import=true + +[TYPECHECK] + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldnt trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members=REQUEST,acl_users,aq_parent,providedBy + + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +# XXX: deprecated in 2.14; replaced with ignored-checks-for-mixins. +# The defaults for that value seem to be what we want +#ignore-mixin-members=yes + +# List of classes names for which member attributes should not be checked +# (useful for classes with attributes dynamically set). This can work +# with qualified names. +#ignored-classes=SSLContext, SSLSocket, greenlet, Greenlet, parent, dead + + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +#ignored-modules=gevent._corecffi,gevent.os,os,greenlet,threading,gevent.libev.corecffi,gevent.socket,gevent.core,gevent.testing.support +ignored-modules=psycopg2.errors + +[DESIGN] +max-attributes=12 +max-parents=10 +# Bump complexity up one. +max-complexity=11 + +[BASIC] +# Prospector turns ot unsafe-load-any-extension by default, but +# pylint leaves it off. This is the proximal cause of the +# undefined-all-variable crash. +unsafe-load-any-extension = yes +# This does not seem to work, hence the init-hook +property-classes=zope.cachedescriptors.property.Lazy,zope.cachedescriptors.property.Cached + +[CLASSES] +# List of interface methods to ignore, separated by a comma. This is used for +# instance to not check methods defines in Zope's Interface base class. + + + +# Local Variables: +# mode: conf +# End: diff --git a/CHANGES.rst b/CHANGES.rst index 000cd53..abb50fc 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,10 +3,14 @@ ========= -1.0.1 (unreleased) +1.1.0 (unreleased) ================== -- Nothing changed yet. +- Drop support for Python < 3.10. +- Add support for Python versions up to 3.13, the current version. +- Use native namespace packages. +- Make ``plone.i18n`` an optional dependency with the ``plone`` extra. +- Update included data files (TLDs and languages) to the current versions. 1.0.0 (2017-07-06) diff --git a/MANIFEST.in b/MANIFEST.in index fede0ef..0bdc292 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,6 +10,7 @@ include nose2.cfg include tox.ini include .travis.yml include *.txt +include .pylintrc recursive-include src *.zcml recursive-include src *.json diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..96625b5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,5 @@ +[build-system] +requires = [ + "wheel", + "setuptools", +] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2a9acf1..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py index d73a818..e535022 100755 --- a/setup.py +++ b/setup.py @@ -1,10 +1,12 @@ import codecs -from setuptools import setup, find_packages +from setuptools import setup +from setuptools import find_namespace_packages TESTS_REQUIRE = [ 'zope.configuration', 'zope.testrunner', + 'coverage', ] def _read(fname): @@ -25,40 +27,33 @@ def _read(fname): 'Intended Audience :: Developers', 'Natural Language :: English', 'Operating System :: OS Independent', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Framework :: Zope3', ], zip_safe=True, - packages=find_packages('src'), + packages=find_namespace_packages(where='src'), package_dir={'': 'src'}, include_package_data=True, - namespace_packages=['nti'], tests_require=TESTS_REQUIRE, install_requires=[ - 'setuptools', 'zope.component', 'zope.interface', 'zope.cachedescriptors', + # plone.i18n drags in Products.CMFCore, which + # in turn brings in a whole lot of stuff we don't want or need, + # almost all of it legacy. Sigh. + # 'plone.i18n', ], extras_require={ 'test': TESTS_REQUIRE, - 'test:python_version == "2.7"': [ - # Not ported to Py3 yet; Plus, version 3 adds hard dep on - # Products.CMFCore/Zope2 that we don't want. So long as we - # don't try to load its configuration, we can access its - # interfaces, though, on any version of Python. We just - # keep it here to avoid having to add 'pragma: no cover' to the - # conditional imports. - 'plone.i18n < 3.0', - 'zope.browserresource', # Used by plone.i18n implicitly - - ], + 'plone': [ + 'plone.i18n', + ] }, ) diff --git a/src/nti/__init__.py b/src/nti/__init__.py index 2cdb0e4..e69de29 100644 --- a/src/nti/__init__.py +++ b/src/nti/__init__.py @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover diff --git a/src/nti/i18n/locales/cctld.py b/src/nti/i18n/locales/cctld.py index d7d87bb..2cd2bf0 100644 --- a/src/nti/i18n/locales/cctld.py +++ b/src/nti/i18n/locales/cctld.py @@ -4,13 +4,11 @@ """ -from __future__ import print_function, unicode_literals, absolute_import, division __docformat__ = "restructuredtext en" -logger = __import__('logging').getLogger(__name__) - import json -import pkg_resources +from importlib import resources + from zope.interface import implementer from zope.cachedescriptors.property import Lazy @@ -34,15 +32,18 @@ def _domain_list(self): # This is encoded in IDNA, but python fails to decode # when the prefix, XN--, is capitalized. That's OK, we have to # lower-case things anyway. - tlds_bytes = pkg_resources.resource_string(__name__, 'tlds-alpha-by-domain.txt') - tlds_bytes_lower = tlds_bytes.lower() - tlds_str = tlds_bytes_lower.decode('idna') - return tlds_str.splitlines() + tlds_bytes = resources.read_binary(__name__, 'tlds-alpha-by-domain.txt') + tld_strs = [ + x.lower().decode('idna') + for x + in tlds_bytes.splitlines() + if not x.strip().startswith(b'#') + ] + return tuple(tld_strs) @Lazy def _language_map(self): - language_bytes = pkg_resources.resource_string(__name__, 'tlds.json') - language_str = language_bytes.decode('ascii') + language_str = resources.read_text(__name__, 'tlds.json') return json.loads(language_str) def getAvailableTLDs(self): diff --git a/src/nti/i18n/locales/tlds-alpha-by-domain.txt b/src/nti/i18n/locales/tlds-alpha-by-domain.txt index 18f38f1..818f6a3 100644 --- a/src/nti/i18n/locales/tlds-alpha-by-domain.txt +++ b/src/nti/i18n/locales/tlds-alpha-by-domain.txt @@ -1,7 +1,6 @@ -# Version 2017070600, Last Updated Thu Jul 6 07:07:01 2017 UTC +# Version 2024110600, Last Updated Wed Nov 6 07:07:01 2024 UTC AAA AARP -ABARTH ABB ABBOTT ABBVIE @@ -15,10 +14,8 @@ ACCENTURE ACCOUNTANT ACCOUNTANTS ACO -ACTIVE ACTOR AD -ADAC ADS ADULT AE @@ -26,7 +23,6 @@ AEG AERO AETNA AF -AFAMILYCOMPANY AFL AFRICA AG @@ -34,13 +30,11 @@ AGAKHAN AGENCY AI AIG -AIGO AIRBUS AIRFORCE AIRTEL AKDN AL -ALFAROMEO ALIBABA ALIPAY ALLFINANZ @@ -49,6 +43,7 @@ ALLY ALSACE ALSTOM AM +AMAZON AMERICANEXPRESS AMERICANFAMILY AMEX @@ -90,7 +85,6 @@ AUSPOST AUTHOR AUTO AUTOS -AVIANCA AW AWS AX @@ -101,7 +95,6 @@ BA BABY BAIDU BANAMEX -BANANAREPUBLIC BAND BANK BAR @@ -145,7 +138,6 @@ BIZ BJ BLACK BLACKFRIDAY -BLANCO BLOCKBUSTER BLOG BLOOMBERG @@ -154,7 +146,6 @@ BM BMS BMW BN -BNL BNPPARIBAS BO BOATS @@ -165,7 +156,6 @@ BOND BOO BOOK BOOKING -BOOTS BOSCH BOSTIK BOSTON @@ -181,8 +171,6 @@ BROTHER BRUSSELS BS BT -BUDAPEST -BUGATTI BUILD BUILDERS BUSINESS @@ -202,7 +190,6 @@ CALVINKLEIN CAM CAMERA CAMP -CANCERRESEARCH CANON CAPETOWN CAPITAL @@ -214,10 +201,8 @@ CARE CAREER CAREERS CARS -CARTIER CASA CASE -CASEIH CASH CASINO CAT @@ -226,10 +211,8 @@ CATHOLIC CBA CBN CBRE -CBS CC CD -CEB CENTER CEO CERN @@ -240,14 +223,13 @@ CG CH CHANEL CHANNEL +CHARITY CHASE CHAT CHEAP CHINTAI -CHLOE CHRISTMAS CHROME -CHRYSLER CHURCH CI CIPRIANI @@ -257,7 +239,6 @@ CITADEL CITI CITIC CITY -CITYEATS CK CL CLAIMS @@ -278,7 +259,6 @@ COFFEE COLLEGE COLOGNE COM -COMCAST COMMBANK COMMUNITY COMPANY @@ -291,7 +271,6 @@ CONSULTING CONTACT CONTRACTORS COOKING -COOKINGCHANNEL COOL COOP CORSICA @@ -299,6 +278,7 @@ COUNTRY COUPON COUPONS COURSES +CPA CR CREDIT CREDITCARD @@ -308,7 +288,6 @@ CROWN CRS CRUISE CRUISES -CSC CU CUISINELLA CV @@ -318,7 +297,6 @@ CY CYMRU CYOU CZ -DABUR DAD DANCE DATA @@ -360,18 +338,14 @@ DNP DO DOCS DOCTOR -DODGE DOG -DOHA DOMAINS DOT DOWNLOAD DRIVE DTV DUBAI -DUCK DUNLOP -DUNS DUPONT DURBAN DVAG @@ -392,7 +366,6 @@ ENERGY ENGINEER ENGINEERING ENTERPRISES -EPOST EPSON EQUIPMENT ER @@ -401,14 +374,11 @@ ERNI ES ESQ ESTATE -ESURANCE ET -ETISALAT EU EUROVISION EUS EVENTS -EVERBANK EXCHANGE EXPERT EXPOSED @@ -430,7 +400,6 @@ FEEDBACK FERRARI FERRERO FI -FIAT FIDELITY FIDO FILM @@ -456,7 +425,6 @@ FM FO FOO FOOD -FOODNETWORK FOOTBALL FORD FOREX @@ -469,11 +437,9 @@ FREE FRESENIUS FRL FROGANS -FRONTDOOR FRONTIER FTR FUJITSU -FUJIXEROX FUN FUND FURNITURE @@ -488,6 +454,7 @@ GAME GAMES GAP GARDEN +GAY GB GBIZ GD @@ -507,7 +474,6 @@ GIFTS GIVES GIVING GL -GLADE GLASS GLE GLOBAL @@ -523,7 +489,6 @@ GOLD GOLDPOINT GOLF GOO -GOODHANDS GOODYEAR GOOG GOOGLE @@ -543,7 +508,6 @@ GROUP GS GT GU -GUARDIAN GUCCI GUGE GUIDE @@ -564,7 +528,6 @@ HELP HELSINKI HERE HERMES -HGTV HIPHOP HISAMITSU HITACHI @@ -581,13 +544,11 @@ HOMEGOODS HOMES HOMESENSE HONDA -HONEYWELL HORSE HOSPITAL HOST HOSTING HOT -HOTELES HOTELS HOTMAIL HOUSE @@ -595,7 +556,6 @@ HOW HR HSBC HT -HTC HU HUGHES HYATT @@ -616,6 +576,7 @@ IMDB IMMO IMMOBILIEN IN +INC INDUSTRIES INFINITI INFO @@ -625,7 +586,6 @@ INSTITUTE INSURANCE INSURE INT -INTEL INTERNATIONAL INTUIT INVESTMENTS @@ -635,25 +595,20 @@ IQ IR IRISH IS -ISELECT ISMAILI IST ISTANBUL IT ITAU ITV -IVECO -IWC JAGUAR JAVA JCB -JCP JE JEEP JETZT JEWELRY JIO -JLC JLL JM JMP @@ -679,8 +634,8 @@ KG KH KI KIA +KIDS KIM -KINDER KINDLE KITCHEN KIWI @@ -702,12 +657,9 @@ KYOTO KZ LA LACAIXA -LADBROKES LAMBORGHINI LAMER LANCASTER -LANCIA -LANCOME LAND LANDROVER LANXESS @@ -728,7 +680,6 @@ LEGO LEXUS LGBT LI -LIAISON LIDL LIFE LIFEINSURANCE @@ -739,18 +690,17 @@ LILLY LIMITED LIMO LINCOLN -LINDE LINK LIPSY LIVE LIVING -LIXIL LK +LLC +LLP LOAN LOANS LOCKER LOCUS -LOFT LOL LONDON LOTTE @@ -765,13 +715,11 @@ LTD LTDA LU LUNDBECK -LUPIN LUXE LUXURY LV LY MA -MACYS MADRID MAIF MAISON @@ -785,12 +733,9 @@ MARKETING MARKETS MARRIOTT MARSHALLS -MASERATI MATTEL MBA MC -MCD -MCDONALDS MCKINSEY MD ME @@ -802,8 +747,7 @@ MEME MEMORIAL MEN MENU -MEO -METLIFE +MERCKMSD MG MH MIAMI @@ -823,7 +767,6 @@ MN MO MOBI MOBILE -MOBILY MODA MOE MOI @@ -831,8 +774,6 @@ MOM MONASH MONEY MONSTER -MONTBLANC -MOPAR MORMON MORTGAGE MOSCOW @@ -840,7 +781,6 @@ MOTO MOTORCYCLES MOV MOVIE -MOVISTAR MP MQ MR @@ -851,7 +791,7 @@ MTN MTR MU MUSEUM -MUTUAL +MUSIC MV MW MX @@ -859,11 +799,8 @@ MY MZ NA NAB -NADEX NAGOYA NAME -NATIONWIDE -NATURA NAVY NBA NC @@ -875,7 +812,6 @@ NETFLIX NETWORK NEUSTAR NEW -NEWHOLLAND NEWS NEXT NEXTDIRECT @@ -895,7 +831,6 @@ NISSAY NL NO NOKIA -NORTHWESTERNMUTUAL NORTON NOW NOWRUZ @@ -910,12 +845,10 @@ NYC NZ OBI OBSERVER -OFF OFFICE OKINAWA OLAYAN OLAYANGROUP -OLDNAVY OLLO OM OMEGA @@ -923,7 +856,6 @@ ONE ONG ONL ONLINE -ONYOURSIDE OOO OPEN ORACLE @@ -937,15 +869,12 @@ OTT OVH PA PAGE -PAMPEREDCHEF PANASONIC -PANERAI PARIS PARS PARTNERS PARTS PARTY -PASSAGENS PAY PCCW PE @@ -962,7 +891,6 @@ PHOTO PHOTOGRAPHY PHOTOS PHYSIO -PIAGET PICS PICTET PICTURES @@ -1013,10 +941,8 @@ QA QPON QUEBEC QUEST -QVC RACING RADIO -RAID RE READ REALESTATE @@ -1045,13 +971,10 @@ REXROTH RICH RICHARDLI RICOH -RIGHTATHOME RIL RIO RIP -RMIT RO -ROCHER ROCKS RODEO ROGERS @@ -1078,7 +1001,6 @@ SANDVIK SANDVIKCOROMANT SANOFI SAP -SAPO SARL SAS SAVE @@ -1087,7 +1009,6 @@ SB SBI SBS SC -SCA SCB SCHAEFFLER SCHMIDT @@ -1096,8 +1017,6 @@ SCHOOL SCHULE SCHWARZ SCIENCE -SCJOHNSON -SCOR SCOT SD SE @@ -1109,7 +1028,6 @@ SEEK SELECT SENER SERVICES -SES SEVEN SEW SEX @@ -1119,7 +1037,6 @@ SG SH SHANGRILA SHARP -SHAW SHELL SHIA SHIKSHA @@ -1128,8 +1045,6 @@ SHOP SHOPPING SHOUJI SHOW -SHOWTIME -SHRIRAM SI SILK SINA @@ -1159,21 +1074,19 @@ SOLUTIONS SONG SONY SOY +SPA SPACE -SPIEGEL +SPORT SPOT -SPREADBETTING SR SRL -SRT +SS ST STADA STAPLES STAR -STARHUB STATEBANK STATEFARM -STATOIL STC STCGROUP STOCKHOLM @@ -1193,12 +1106,10 @@ SURGERY SUZUKI SV SWATCH -SWIFTCOVER SWISS SX SY SYDNEY -SYMANTEC SYSTEMS SZ TAB @@ -1219,8 +1130,6 @@ TEAM TECH TECHNOLOGY TEL -TELECITY -TELEFONICA TEMASEK TENNIS TEVA @@ -1233,7 +1142,6 @@ THEATRE TIAA TICKETS TIENDA -TIFFANY TIPS TIRES TIROL @@ -1263,7 +1171,6 @@ TRADE TRADING TRAINING TRAVEL -TRAVELCHANNEL TRAVELERS TRAVELERSINSURANCE TRUST @@ -1280,7 +1187,6 @@ TZ UA UBANK UBS -UCONNECT UG UK UNICOM @@ -1314,27 +1220,22 @@ VIP VIRGIN VISA VISION -VISTA -VISTAPRINT VIVA VIVO VLAANDEREN VN VODKA -VOLKSWAGEN VOLVO VOTE VOTING VOTO VOYAGE VU -VUELOS WALES WALMART WALTER WANG WANGGOU -WARMAN WATCH WATCHES WEATHER @@ -1367,7 +1268,6 @@ WTC WTF XBOX XEROX -XFINITY XIHUAN XIN XN--11B4C3D @@ -1379,12 +1279,12 @@ XN--3BST00M XN--3DS443G XN--3E0B707E XN--3HCRJ9C -XN--3OQ18VL8PN36A XN--3PXU8K XN--42C2D9A XN--45BR5CYL XN--45BRJ9C XN--45Q11C +XN--4DBRK0CE XN--4GBRIM XN--54B7FTA0CC XN--55QW42G @@ -1410,6 +1310,7 @@ XN--BCK1B9A5DRE4C XN--C1AVG XN--C2BR7G XN--CCK2B3B +XN--CCKWCXETD XN--CG4BKI XN--CLCHC0EA0B2G2A9GCD XN--CZR694B @@ -1420,7 +1321,6 @@ XN--D1ALF XN--E1A4C XN--ECKVDTC9D XN--EFVY88H -XN--ESTV75G XN--FCT429K XN--FHBEI XN--FIQ228C5HS @@ -1446,12 +1346,11 @@ XN--IO0A7I XN--J1AEF XN--J1AMH XN--J6W193G -XN--JLQ61U9W7B +XN--JLQ480N2RG XN--JVR189M XN--KCRX77D1X4A XN--KPRW13D XN--KPRY57D -XN--KPU716F XN--KPUT3I XN--L1ACC XN--LGBBAT1AD8J @@ -1459,16 +1358,16 @@ XN--MGB9AWBF XN--MGBA3A3EJT XN--MGBA3A4F16A XN--MGBA7C0BBN0A -XN--MGBAAKC7DVF XN--MGBAAM7A8H XN--MGBAB2BD +XN--MGBAH1A3HJKRD XN--MGBAI9AZGQP6J XN--MGBAYH7GPA -XN--MGBB9FBPOB XN--MGBBH1A XN--MGBBH1A71E XN--MGBC0A9AZCG XN--MGBCA7DZDO +XN--MGBCPQ6GPA1A XN--MGBERP4A5D4AR XN--MGBGU82A XN--MGBI4ECEXP @@ -1488,13 +1387,15 @@ XN--NQV7FS00EMA XN--NYQY26A XN--O3CW4H XN--OGBPF8FL +XN--OTU796D XN--P1ACF XN--P1AI -XN--PBT977C XN--PGBS0DH XN--PSSY2U +XN--Q7CE6A XN--Q9JYB4C XN--QCKA1PMC +XN--QXA6A XN--QXAM XN--RHQV96G XN--ROVU88B @@ -1520,7 +1421,6 @@ XN--Y9A3AQ XN--YFRO4I67O XN--YGBI2AMMX XN--ZFR164B -XPERIA XXX XYZ YACHTS @@ -1540,7 +1440,6 @@ ZAPPOS ZARA ZERO ZIP -ZIPPO ZM ZONE ZUERICH diff --git a/src/nti/i18n/locales/tlds.json b/src/nti/i18n/locales/tlds.json index 11ea4b0..e928381 100644 --- a/src/nti/i18n/locales/tlds.json +++ b/src/nti/i18n/locales/tlds.json @@ -1,4 +1,15 @@ { + "ac": [], + "ad": [], + "ae": [], + "aero": [], + "af": [], + "ag": [], + "ai": [], + "al": [], + "am": [], + "an": [], + "ao": [], "aq": [ "en" ], @@ -11,79 +22,150 @@ "as": [ "en" ], + "asia": [], "at": [ "de" ], "au": [ "en" ], + "aw": [], + "ax": [], + "az": [], "ba": [ "bs" ], + "bb": [], + "bd": [], "be": [ "nl", "fr" ], + "bf": [], + "bg": [], + "bh": [], + "bi": [], + "biz": [], + "bj": [], + "bm": [], + "bn": [], + "bo": [], "br": [ "pt" ], + "bs": [], + "bt": [], + "bv": [], + "bw": [], + "by": [], + "bz": [], "ca": [ "en" ], "cat": [ "ca" ], + "cc": [], + "cd": [], + "cf": [], + "cg": [], "ch": [ "de" ], + "ci": [], + "ck": [], + "cl": [], + "cm": [], "cn": [ "zh" ], + "co": [], + "com": [], + "coop": [], "cr": [ "es" ], + "cu": [], + "cv": [], + "cx": [], + "cy": [], + "cz": [], "de": [ "de" ], + "dj": [], "dk": [ "da" ], + "dm": [], + "do": [], + "dz": [], + "ec": [], "edu": [ "en" ], "ee": [ "et" ], + "eg": [], + "er": [], "es": [ "es" ], + "et": [], + "eu": [], "fi": [ "fi" ], + "fj": [], + "fk": [], + "fm": [], "fo": [ "fo" ], "fr": [ "fr" ], + "ga": [], "gb": [ "en" ], + "gd": [], "ge": [ "ka" ], + "gf": [], + "gg": [], + "gh": [], + "gi": [], + "gl": [], + "gm": [], + "gn": [], "gov": [ "en" ], + "gp": [], + "gq": [], "gr": [ "gr" ], + "gs": [], + "gt": [], + "gu": [], + "gw": [], + "gy": [], + "hk": [], + "hm": [], + "hn": [], "hr": [ "hr" ], + "ht": [], "hu": [ "hu" ], + "id": [], + "ie": [], "il": [ "he" ], @@ -93,6 +175,8 @@ "in": [ "hi" ], + "info": [], + "int": [], "io": [ "en" ], @@ -111,69 +195,139 @@ "je": [ "en" ], + "jm": [], + "jo": [], + "jobs": [], "jp": [ "ja" ], + "ke": [], + "kg": [], + "kh": [], + "ki": [], + "km": [], + "kn": [], "kp": [ "ko" ], "kr": [ "ko" ], + "kw": [], + "ky": [], "kz": [ "kk" ], + "la": [], + "lb": [], + "lc": [], + "li": [], + "lk": [], + "lr": [], + "ls": [], + "lt": [], "lu": [ "lb" ], "lv": [ "lv" ], + "ly": [], + "ma": [], + "mc": [], "md": [ "mo" ], + "me": [], "mg": [ "mg" ], + "mh": [], "mil": [ "en" ], + "mk": [], + "ml": [], + "mm": [], "mn": [ "mn" ], + "mo": [], + "mobi": [], + "mp": [], + "mq": [], + "mr": [], + "ms": [], "mt": [ "mt" ], + "mu": [], + "museum": [], + "mv": [], + "mw": [], + "mx": [], + "my": [], + "mz": [], + "na": [], + "name": [], + "nc": [], + "ne": [], + "net": [], + "nf": [], + "ng": [], + "ni": [], "nl": [ "nl" ], "no": [ "no" ], + "np": [], + "nr": [], + "nu": [], + "nz": [], "om": [ "en" ], + "org": [], + "pa": [], + "pe": [], + "pf": [], + "pg": [], + "ph": [], + "pk": [], "pl": [ "pl" ], + "pm": [], + "pn": [], "pr": [ "es" ], + "pro": [], "ps": [ "ar" ], "pt": [ "pt" ], + "pw": [], + "py": [], + "qa": [], + "re": [], "ro": [ "ro" ], + "rs": [], "ru": [ "ru" ], + "rw": [], "sa": [ "ar" ], + "sb": [], + "sc": [], "sd": [ "su" ], @@ -183,12 +337,16 @@ "sg": [ "si" ], + "sh": [], "si": [ "sl" ], + "sj": [], "sk": [ "sk" ], + "sl": [], + "sm": [], "sn": [ "fr" ], @@ -198,12 +356,20 @@ "sr": [ "nl" ], + "ss": [], + "st": [], "su": [ "ru" ], + "sv": [], + "sy": [], + "sz": [], "tc": [ "tr" ], + "td": [], + "tel": [], + "tf": [], "tg": [ "to" ], @@ -222,34 +388,55 @@ "tm": [ "tk" ], + "tn": [], + "to": [], "tp": [ "pt" ], + "tr": [], + "travel": [], + "tt": [], + "tv": [], "tw": [ "zh" ], + "tz": [], + "ua": [], + "ug": [], "uk": [ "en" ], "us": [ "en" ], + "uy": [], + "uz": [], "va": [ "it" ], + "vc": [], + "ve": [], + "vg": [], "vi": [ "en" ], "vn": [ "vi" ], + "vu": [], + "wf": [], "ws": [ "sm" ], + "xxx": [], + "ye": [], + "yt": [], "yu": [ "sh" ], "za": [ "af" - ] -} \ No newline at end of file + ], + "zm": [], + "zw": [] +} diff --git a/tox.ini b/tox.ini index fb7a89a..d4476ce 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,33 @@ [tox] -envlist = pypy, py27, py34, py35, py36 +envlist = pypy,py27,py36,py37,py38,py39,pypy3,coverage,docs [testenv] -deps = - .[test] +# JAM: The comment and setting are cargo-culted from zope.interface. +# ``usedevelop`` is required otherwise unittest complains that it +# discovers a file in src/... but imports it from .tox/.../ +# ``skip_install`` also basically works, but that causes the ``extras`` +# not to be installed (though ``deps`` still are), and doesn't +# rebuild C extensions. +usedevelop = true +extras = test +commands = + coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress [] # substitute with tox positional args +setenv = + PYTHONHASHSEED=1042466059 + ZOPE_INTERFACE_STRICT_IRO=1 + +[testenv:coverage] +# The -i/--ignore arg may be necessary, I'm not sure. +# It was cargo-culted over from zope.interface. +commands = + coverage combine + coverage report -i + coverage html -i +depends = py27,py36,py37,py38,py39,pypy,pypy3,docs +parallel_show_output = true +[testenv:docs] +extras = docs commands = - zope-testrunner --test-path=src --auto-color --auto-progress [] # substitute with tox positional args + sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html + sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctests