Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-104783: Remove locale.resetlocale() function#104784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 2 commits intopython:mainfromvstinner:remove_locale
Jun 6, 2023

Conversation

vstinner
Copy link
Member

@vstinnervstinner commentedMay 23, 2023
edited
Loading

@vstinner
Copy link
MemberAuthor

cc@methane

@methane
Copy link
Member

I am a bit afraid to remove the API since many projects are still using it.
How about waiting 3 more years? Or how about make it alias tolocale.getlocale()?

https://sourcegraph.com/search?q=locale.getdefaultlocale+lang%3Apython&patternType=standard&sm=1&groupBy=repo

@vstinner
Copy link
MemberAuthor

vstinner commentedMay 23, 2023
edited
Loading

Usingresetlocale regex, I only found one project in PyPI top 5,000 projects (2023-04-13) usinglocale.resetlocale(): shapely (2.0.1).

shapely-2.0.1/tests/test_locale.py: locale.resetlocale()

EDIT: I ignored pylint since I don't think that it's affected.

@vstinner
Copy link
MemberAuthor

vstinner commentedMay 23, 2023
edited
Loading

Usinggetdefaultlocale regex, I found the following projects in PyPI top 5,000 projects (2023-04-13) using locale.getdefaultlocale().

Affected projects (34):

  • Pint (0.20.1)
  • PyQt5 (5.15.9)
  • anyconfig (0.13.0)
  • anytemplate (0.1.6)
  • apache-airflow (2.5.3)
  • applicationinsights (0.11.10)
  • apprise (1.3.0)
  • awsebcli (3.20.5)
  • azure-cli-core (2.47.0)
  • azure-monitor-opentelemetry-exporter-1.0.0b13
  • docutils (0.19)
  • edk2-pytool-library (0.14.1)
  • elementpath (4.1.1)
  • future (0.18.3)
  • googleads (37.0.0)
  • gsutil (5.23)
  • hachoir (3.2.0)
  • l18n (2021.3)
  • micloud (0.6)
  • nibabel (5.1.0)
  • nltk (3.8.1)
  • numba (0.56.4)
  • opencensus-ext-azure (1.1.9)
  • os_sys (2.1.4)
  • oslo.i18n (6.0.0)
  • pipenv (2023.3.20)
  • pyenchant (3.2.2)
  • pyramid (2.0.1)
  • pytest-nunit (1.0.3)
  • rabbitpy (2.0.1)
  • tabcmd (2.0.11)
  • tables (3.8.0)
  • teamcity-messages (1.32)
  • undetected-chromedriver (3.4.6)
Code:
Pint-0.20.1.tar.gz: Pint-0.20.1/pint/facets/plain/registry.py: loc = locale.getdefaultlocale()[0]PyQt5-5.15.9.tar.gz: PyQt5-5.15.9/pylupdate/pylupdate_main.py: return path.encode(locale.getdefaultlocale()[1])PyQt5-5.15.9.tar.gz: PyQt5-5.15.9/sip/pylupdate/pylupdate_main.py: return path.encode(locale.getdefaultlocale()[1])anyconfig-0.13.0.tar.gz: anyconfig-0.13.0/src/anyconfig/cli/io.py: encoding = (locale.getdefaultlocale()[1] or 'UTF-8').lower()anytemplate-0.1.6.tar.gz: anytemplate-0.1.6/src/anytemplate/compat.py: ENCODING = locale.getdefaultlocale()[1] or "UTF-8"apache-airflow-2.5.3.tar.gz: apache-airflow-2.5.3/airflow/cli/commands/info_command.py: _locale = locale.getdefaultlocale()applicationinsights-0.11.10.tar.gz: applicationinsights-0.11.10/applicationinsights/channel/TelemetryContext.py: self.locale = locale.getdefaultlocale()[0]applicationinsights-0.11.10.tar.gz: applicationinsights-0.11.10/tests/applicationinsights_tests/channel_tests/TestTelemetryContext.py: self.assertEqual(locale.getdefaultlocale()[0], context.device.locale)apprise-1.3.0.tar.gz: apprise-1.3.0/apprise/AppriseLocale.py: lang = locale.getdefaultlocale()[0]apprise-1.3.0.tar.gz: apprise-1.3.0/test/test_locale.py: @mock.patch('locale.getdefaultlocale')awsebcli-3.20.5.tar.gz: awsebcli-3.20.5/ebcli/bundled/asciimatics/screen.py: encoding = getdefaultlocale()[1]awsebcli-3.20.5.tar.gz: awsebcli-3.20.5/ebcli/bundled/asciimatics/screen.py: from locale import getlocale, getdefaultlocaleazure-cli-core-2.47.0.tar.gz: azure-cli-core-2.47.0/azure/cli/core/telemetry.py: lambda: '{},{}'.format(locale.getdefaultlocale()[0], locale.getdefaultlocale()[1]))azure-monitor-opentelemetry-exporter-1.0.0b13.zip: azure-monitor-opentelemetry-exporter-1.0.0b13/azure/monitor/opentelemetry/exporter/_utils.py: "ai.device.locale": locale.getdefaultlocale()[0],docutils-0.19.tar.gz: docutils-0.19/docutils/io.py: _locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]docutils-0.19.tar.gz: docutils-0.19/docutils/utils/smartquotes.py: defaultlanguage = locale.getdefaultlocale()[0]edk2-pytool-library-0.14.1.tar.gz: edk2-pytool-library-0.14.1/edk2toollib/utility_functions.py: (_, encoding) = locale.getdefaultlocale()elementpath-4.1.1.tar.gz: elementpath-4.1.1/elementpath/collations.py: of locale.getdefaultlocale(), deprecated since Python 3.11.future-0.18.3.tar.gz: future-0.18.3/docs/3rd-party-py3k-compat-code/django_utils_encoding.py: encoding = locale.getdefaultlocale()[1] or 'ascii'googleads-37.0.0.tar.gz: googleads-37.0.0/googleads/common.py: _, encoding = locale.getdefaultlocale()gsutil-5.23.tar.gz: gsutil-5.23/gslib/utils/system_util.py: IS_CP1252 = locale.getdefaultlocale()[1] == WINDOWS_1252hachoir-3.2.0.tar.gz: hachoir-3.2.0/hachoir/wx/unicode.py: charset = locale.getdefaultlocale()[1]l18n-2021.3.tar.gz: l18n-2021.3/PKG-INFO: ``locale.getdefaultlocale()``). If it is not the one you want or if you need tol18n-2021.3.tar.gz: l18n-2021.3/l18n.egg-info/PKG-INFO: ``locale.getdefaultlocale()``). If it is not the one you want or if you need tol18n-2021.3.tar.gz: l18n-2021.3/l18n/translation.py: from locale import getdefaultlocalel18n-2021.3.tar.gz: l18n-2021.3/l18n/translation.py: self.set(getdefaultlocale()[0])micloud-0.6.tar.gz: micloud-0.6/micloud/micloud.py: self.locale = locale.getdefaultlocale()[0]nibabel-5.1.0.tar.gz: nibabel-5.1.0/nibabel/cmdline/dicomfs.py: encoding = locale.getdefaultlocale()[1]nltk-3.8.1.zip: nltk-3.8.1/nltk/util.py: encodings.append(locale.getdefaultlocale()[1])numba-0.56.4.tar.gz: numba-0.56.4/numba/misc/numba_sysinfo.py: locale.getdefaultlocale()])opencensus-ext-azure-1.1.9.tar.gz: opencensus-ext-azure-1.1.9/opencensus/ext/azure/common/utils.py: 'ai.device.locale': locale.getdefaultlocale()[0],os_sys-2.1.4.tar.gz: os_sys-2.1.4/edit/iomenu.py: locale_encoding = locale.getdefaultlocale()[1]os_sys-2.1.4.tar.gz: os_sys-2.1.4/edit/iomenu.py: locale_encoding = locale.getdefaultlocale()[1]os_sys-2.1.4.tar.gz: os_sys-2.1.4/server/utils/encoding.py: encoding = locale.getdefaultlocale()[1] or 'ascii'oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/_message.py: system_locale = locale.getdefaultlocale()oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/fixture.py: self.useFixture(fixtures.MonkeyPatch('locale.getdefaultlocale',oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: @mock.patch('locale.getdefaultlocale')oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: @mock.patch('locale.getdefaultlocale')oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: @mock.patch('locale.getdefaultlocale', return_value=('es', ''))oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: mock_getdefaultlocale):oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: mock_getdefaultlocale):oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: mock_getdefaultlocale.return_value = ('es',)oslo.i18n-6.0.0.tar.gz: oslo.i18n-6.0.0/oslo_i18n/tests/test_message.py: mock_getdefaultlocale.return_value = ('es',)pipenv-2023.3.20.tar.gz: pipenv-2023.3.20/pipenv/vendor/vistir/misc.py: locale_encoding = locale.getdefaultlocale()[1] or "ascii"pyenchant-3.2.2.tar.gz: pyenchant-3.2.2/enchant/utils.py: tag = locale.getdefaultlocale()[0]pyramid-2.0.1.tar.gz: pyramid-2.0.1/tests/test_integration.py: defaultlocale = locale.getdefaultlocale()[1]pytest-nunit-1.0.3.tar.gz: pytest-nunit-1.0.3/pytest_nunit/nunit.py: language_code = locale.getdefaultlocale()[0]rabbitpy-2.0.1.tar.gz: rabbitpy-2.0.1/rabbitpy/channel0.py: DEFAULT_LOCALE = locale.getdefaultlocale()tabcmd-2.0.11.tar.gz: tabcmd-2.0.11/tabcmd/execution/localize.py: current_locale, encoding = locale.getdefaultlocale()tables-3.8.0.tar.gz: tables-3.8.0/tables/tests/common.py: print('Default locale:      (%s, %s)' % locale.getdefaultlocale())teamcity-messages-1.32.tar.gz: teamcity-messages-1.32/teamcity/common.py: loc = locale.getdefaultlocale()undetected-chromedriver-3.4.6.tar.gz: undetected-chromedriver-3.4.6/undetected_chromedriver/__init__.py: language = locale.getdefaultlocale()[0].replace("_", "-")

@vstinner
Copy link
MemberAuthor

I am a bit afraid to remove the API since many projects are still using it.

If we decide to keep these functions, I suggest at least to update their deprecation documentation.

@methane
Copy link
Member

Usingresetlocale regex, I only found one project in PyPI top 5,000 projects (2023-04-13) usinglocale.resetlocale(): shapely (2.0.1).

I agree thatresetlocale is minor enough to removal.

I am a bit afraid to remove the API since many projects are still using it.

If we decide to keep these functions, I suggest at least to update their deprecation documentation.

Of course.

@vstinnervstinner changed the titlegh-104783: Remove locale.getdefaultlocale()gh-104783: Remove locale.resetlocale() functionJun 6, 2023
@vstinnervstinner merged commit0cb6b9b intopython:mainJun 6, 2023
@vstinnervstinner deleted the remove_locale branchJune 6, 2023 12:55
@vstinner
Copy link
MemberAuthor

Ok, let's start with removing locale.resetlocale(). The locale.getdefaultlocale() function can stay a little bit longer thanks to@methane :-)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@vstinner@methane@bedevere-bot@gpshead

[8]ページ先頭

©2009-2025 Movatter.jp