Skip to content

argparse.FileType opens a file and never closes it #58032

Closed

Description

@DavidLayton
BPO 13824
Nosy @merwok, @mitar, @matrixise, @MojoVampire, @remilapeyre, @septatrix
Files
  • patch_3.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2012-01-19.12:25:39.321>
    labels = ['type-bug', 'library']
    title = 'argparse.FileType opens a file and never closes it'
    updated_at = <Date 2021-07-25.09:27:11.812>
    user = 'https://bugs.python.org/DavidLayton'

    bugs.python.org fields:

    activity = <Date 2021-07-25.09:27:11.812>
    actor = 'Nils Kattenbeck'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2012-01-19.12:25:39.321>
    creator = 'David.Layton'
    dependencies = []
    files = ['31852']
    hgrepos = []
    issue_num = 13824
    keywords = ['patch']
    message_count = 15.0
    messages = ['151615', '152518', '152519', '152530', '166068', '198336', '198376', '215298', '341670', '341761', '341764', '341852', '342153', '342503', '398184']
    nosy_count = 13.0
    nosy_names = ['bethard', 'eric.araujo', 'mitar', 'Paolo.Elvati', 'manveru', 'Stefan.Pfeiffer', 'paul.j3', 'David.Layton', 'matrixise', 'josh.r', 'remi.lapeyre', 'sebix', 'Nils Kattenbeck']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue13824'
    versions = ['Python 2.7']

    Linked PRs

    Activity

    1. paulj3 commented on May 11, 2019

      paulj3mannequin
      Mannequin

      While I continue to follow argparse issues, I'm not doing development (with my own repository, etc).

      I haven't revisited the issue since 2013, and don't know that much more about Python file handling. Occasionally 'FileType' issues come up on StackOverflow, and my most common suggestion is accept a string, and open the file yourself.

      In writing a solution, keep backward compatibility foremost in mind. We don't want to mess things up for existing code. And keep FileType simple, consistent with Steven's original intent - as a tool for simple input/output scripts.

      As for the idea of

      2 - Making the argument namespace itself support context management

      someone could experiment with a new Namespace class with the proper enter/exit methods. The use of a custom Namespace class is documented

      https://docs.python.org/3/library/argparse.html#the-namespace-object

      So the idea can be implemented and thoroughly tested without altering the default Namespace class and its use. (With one caution, subparsers won't use this custom class.)

    2. matrixise commented on May 14, 2019

      @matrixise
      Member

      Hi,

      Are you interested to write test cases? They could be useful for the fix.

      Thank you

    3. Septatrix commented on Jul 25, 2021

      Septatrixmannequin
      Mannequin

      A good alternative would be to use pathlib.Path. The only downside would be that one has to manually handle - but besides that it solves most problems.

      Still the fact that file descriptors are kept open should be added as a warning to the docs

    4. transferred this issue fromon Apr 10, 2022
    5. merwok commented on Jul 6, 2022

      @merwok
      Member

      A good alternative would be to use pathlib.Path.

      How so? FileType lets you specify that the argument should be readable or writable, so this would be a loss of functionality.

    6. serhiy-storchaka commented on Jan 1, 2024

      @serhiy-storchaka
      Member

      The current design has too many flaws. Open files are leaked if argparse itself fails or the user code fails or quits before it has chance to close all files. Output files are always rewritten in case of error. Input files can remain open for too long time and consume the limited resource of file descriptors. And solving it in the user code is difficult even if we ignore errors that can occur during parsing (see for example the pickletools CLI #85567).

      All solutions (making file opening lazy (and maybe explicit) or making the parser or the namespace object a context manager) require changing the user code. Minimizing changes in the user code increases chance of writing user code that does not do all thing properly.

      On other hand, explicit opening and closing files is not much more complex that proper use of FileType or its replacement. The only non-trivial thing that FileType does in comparison with the plain open() is returning the standard stream (depending on mode) if the argument is "-". We can provide an utility function for this, although the code is only non-trivial because it is general, for any concrete mode string it is simpler.

      I propose to deprecate argparse.FileType. Its existence in the stdlib implies that it is a preferable way to handle file arguments, but it is not so. You have less issues if you do not use it.

    7. gvanrossum commented on Jan 1, 2024

      @gvanrossum
      Member

      +1. Well argued. I’m not even sure we need a helper for ‘-‘ ; that API would be a bit convoluted, since closing stdin is fraught.

    8. added a commit that references this issue on Jan 2, 2024
    9. added a commit that references this issue on Jan 10, 2024
    10. added a commit that references this issue on Jan 22, 2024
    11. added a commit that references this issue on Feb 11, 2024
    12. added a commit that references this issue on Sep 2, 2024
    13. picnixz commented on Sep 7, 2024

      @picnixz
      Member

      @serhiy-storchaka Should we keep this one opened to deprecate FileType or do you want to close it (and not deprecate FileType for now)?

    14. added 2 commits that reference this issue on Sep 27, 2024
    15. serhiy-storchaka commented on Sep 27, 2024

      @serhiy-storchaka
      Member

      #124664 deprecates argparse.FileType. Since it is widely used, no warning is emitted at runtime. A runtime warning will be added later, perhaps in 3.16, and finally it will be removed.

    16. Mariatta commented on Sep 27, 2024

      @Mariatta
      Member

      A runtime warning will be added later, perhaps in 3.16, and finally it will be removed.

      Sorry, the sentence is a bit ambiguous.
      Do you mean to add the warning in 3.16 (so that the earliest removal is at least 3.18), or to have it finally removed in 3.16?

    17. Mariatta commented on Sep 27, 2024

      @Mariatta
      Member

      If say, we have it removed in 3.18, does it mean we will keep this ticket open for 4 years more from now?

    18. Mariatta commented on Sep 27, 2024

      @Mariatta
      Member

      I gathered that we just need to add this to pending-removal-in-future.rst and then we can close this ticket (after the PR is merged).

    19. serhiy-storchaka commented on Sep 28, 2024

      @serhiy-storchaka
      Member

      Sorry for ambiguous wording. I meant that in future (perhaps in 3.16) we will add a runtime warning and start normal deprecation period, so the feature could be removed two years later, in 3.18. This way authors will have more time to remove the usage of FileType and do not annoy users with deprecation warnings.

    20. Mariatta commented on Sep 28, 2024

      @Mariatta
      Member

      Thank you, the timeline is clearer to me now.

      I'm wondering two things:

      • Should we then raise PendingDeprecationWarning instead?
      • We know users shouldn't use this anymore. Why wait for 2 more releases? If we don't raise the warning, people won't be aware of the future deprecation until 2 releases later. If users have been using this functionality, they probably don't actively keep reading if the docs got updated with the note about "deprecated since 3.14". So I don't think delaying the deprecation warning will give people time to change. If this is broken and we don't want people to start using it's I suggest raising deprecation now and state that it will removed in 4 releases later (instead of 2).
    21. serhiy-storchaka commented on Oct 10, 2024

      @serhiy-storchaka
      Member

      These are very good questions.

      I am afraid of the amount of user code this may affect. FileType is no longer directly used in the Python stdlib or scripts, but it is used in the CLI of some vendor packages (charset, charset_normalizer, distlib) used to build the documentation. It may add some noise in the build output if they are used via a CLI. I am sure that FileType is used in many user scripts despite its flaws. For simple script it may be not critical that it leaks or clamps files on errors or closes stdin or stdout just before quitting. Deprecation warning will add a noise in normal cases, when all works.

      This is why I wanted to first make the deprecation silent, documentation-only. To give more time to authors without annoying users. This would also send signal to linters. I forgot about PendingDeprecationWarning, it mitigates the issue with annoying warnings.

      I will add PendingDeprecationWarning. But now I need to modify a number of tests in test_argparse to silence the warning or check for it. My laziness was the other reason.

    22. hugovk commented on Oct 10, 2024

      @hugovk
      Member

      I am afraid of the amount of user code this may affect.

      Searching the top 8k PyPI projects finds 384 matching lines in 138 projects for argparse.*FileType, which is ~1.7%.

      Details
      ❯ python3 ~/github/misc/cpython/search_pypi_top.py -q . "argparse.*FileType"
      ./dill-0.3.8.tar.gz: dill-0.3.8/dill/_objects.py: a['ArgParseFileType'] = argparse.FileType() # pickle ok
      ./commonmark-0.9.1.tar.gz: commonmark-0.9.1/commonmark/cmark.py: type=argparse.FileType('r'),
      ./commonmark-0.9.1.tar.gz: commonmark-0.9.1/commonmark/cmark.py: type=argparse.FileType('w'),
      ./conda-4.3.16.tar.gz: conda-4.3.16/conda/cli/main_config.py: # TODO: use argparse.FileType
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/__main__.py: subparser_cat.add_argument("files", nargs="*", type=argparse.FileType("rb"), help="Files to read", default=(sys.stdin,))
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/__main__.py: subparser_write.add_argument("--output", "-o", help="output file", type=argparse.FileType("wb"), default=sys.stdout)
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/__main__.py: subparser_write.add_argument("input_files", nargs="*", type=argparse.FileType("r"), help="Files to read", default=(sys.stdin,))
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/test/gen_interop_data.py: parser.add_argument("schema_path", type=argparse.FileType("r"))
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/test/gen_interop_data.py: type=argparse.FileType("wb"),
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/tool.py: subparser_dump.add_argument("input_file", type=argparse.FileType("rb"))
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/tool.py: subparser_rpcreceive.add_argument("-file", type=argparse.FileType("rb"), required=False)
      ./avro-1.11.3.tar.gz: avro-1.11.3/avro/tool.py: subparser_rpcsend.add_argument("-file", type=argparse.FileType("rb"))
      ./ConfigArgParse-1.7.tar.gz: ConfigArgParse-1.7/configargparse.py: FileType = argparse.FileType
      ./ConfigUpdater-3.2.tar.gz: ConfigUpdater-3.2/tools/stdlib_diff.py: cli.add_argument("-o", "--output", type=argparse.FileType("w"), default=sys.stdout)
      ./chardet-5.2.0.tar.gz: chardet-5.2.0/chardet/cli/chardetect.py: type=argparse.FileType("rb"),
      ./charset-normalizer-3.3.2.tar.gz: charset-normalizer-3.3.2/charset_normalizer/cli/__main__.py: "files", type=argparse.FileType("rb"), nargs="+", help="File(s) to be analysed"
      ./dataclass-wizard-0.22.3.tar.gz: dataclass-wizard-0.22.3/dataclass_wizard/wizard_cli/cli.py: class FileTypeWithExt(argparse.FileType):
      ./dataclass-wizard-0.22.3.tar.gz: dataclass-wizard-0.22.3/dataclass_wizard/wizard_cli/cli.py: Extends :class:`argparse.FileType` to add a default file extension if the
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/monitor.py: file_post_parser.add_argument("file", help="json file holding all details", type=argparse.FileType("r"))
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/monitor.py: file_update_parser.add_argument("file", help="json file holding all details", type=argparse.FileType("r"))
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/screenboard.py: "file", help="screenboard files to push to the server", nargs="+", type=argparse.FileType("r")
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/service_level_objective.py: file_create_parser.add_argument("file", help="json file holding all details", type=argparse.FileType("r"))
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/service_level_objective.py: file_update_parser.add_argument("file", help="json file holding all details", type=argparse.FileType("r"))
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/timeboard.py: "file", help="timeboard files to push to the server", nargs="+", type=argparse.FileType("r")
      ./datadog-0.49.1.tar.gz: datadog-0.49.1/datadog/dogshell/timeboard.py: web_view_parser.add_argument("file", help="timeboard file", type=argparse.FileType("r"))
      ./apache_airflow-2.9.2.tar.gz: apache_airflow-2.9.2/airflow/cli/cli_config.py: type=argparse.FileType("w", encoding="UTF-8"),
      ./apache_airflow-2.9.2.tar.gz: apache_airflow-2.9.2/airflow/cli/cli_config.py: type=argparse.FileType("w", encoding="UTF-8"),
      ./apache_airflow-2.9.2.tar.gz: apache_airflow-2.9.2/airflow/cli/utils.py: with argparse.FileType points to stdout (by setting the path to ``-``). This
      ./datamodel_code_generator-0.25.7.tar.gz: datamodel_code_generator-0.25.7/datamodel_code_generator/arguments.py: from argparse import ArgumentParser, FileType, HelpFormatter, Namespace
      ./black-24.4.2.tar.gz: black-24.4.2/scripts/migrate-black.py: parser.add_argument("--logfile", type=argparse.FileType("w"), default=sys.stdout)
      ./clldutils-3.22.2.tar.gz: clldutils-3.22.2/src/clldutils/clilib.py: Similar to `argparse.FileType`.
      ./aqtinstall-3.1.16.tar.gz: aqtinstall-3.1.16/aqt/helper.py: # passed through command line argparse.FileType("r")
      ./aqtinstall-3.1.16.tar.gz: aqtinstall-3.1.16/aqt/installer.py: type=argparse.FileType("r"),
      ./aliyun-python-sdk-core-2.15.1.tar.gz: aliyun-python-sdk-core-2.15.1/aliyunsdkcore/vendored/requests/packages/chardet/cli/chardetect.py: type=argparse.FileType('rb'), nargs='*',
      ./aliyun-python-sdk-core-v3-2.13.33.tar.gz: aliyun-python-sdk-core-v3-2.13.33/aliyunsdkcore/vendored/requests/packages/chardet/cli/chardetect.py: type=argparse.FileType('rb'), nargs='*',
      ./cloudformation-cli-0.2.37.tar.gz: cloudformation-cli-0.2.37/src/rpdk/core/invoke.py: from argparse import FileType
      ./clvm_rs-0.7.0.tar.gz: clvm_rs-0.7.0/venv/lib/python3.8/site-packages/pip/_vendor/chardet/cli/chardetect.py: type=argparse.FileType("rb"),
      ./arcgis2geojson-3.0.2.tar.gz: arcgis2geojson-3.0.2/arcgis2geojson/__init__.py: type=argparse.FileType("r"),
      ./argcomplete-3.4.0.tar.gz: argcomplete-3.4.0/test/test.py: parser.add_argument("--r", type=argparse.FileType("r"))
      ./argcomplete-3.4.0.tar.gz: argcomplete-3.4.0/test/test.py: parser.add_argument("--w", type=argparse.FileType("w"))
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: type = argparse.FileType('r')
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: type = argparse.FileType('wb', 1)
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('-x', type=argparse.FileType()),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('spam', type=argparse.FileType('r')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('-c', type=argparse.FileType('r'), default='no-file.txt'),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('-x', type=argparse.FileType('rb')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('spam', type=argparse.FileType('rb')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('-x', type=argparse.FileType('w')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('spam', type=argparse.FileType('w')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('-x', type=argparse.FileType('wb')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/test/test_argparse.py: Sig('spam', type=argparse.FileType('wb')),
      ./argparse-1.4.0.tar.gz: argparse-1.4.0/argparse.py: '--log', default=sys.stdout, type=argparse.FileType('w'),
      ./csvkit-2.0.0.tar.gz: csvkit-2.0.0/csvkit/utilities/csvgrep.py: from argparse import FileType
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument("InputFile",  type = argparse.FileType('rb'), nargs='?',
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument("-o", "--output", dest = 'OutputFile', type = argparse.FileType('wb'),
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument ("-j", "--json-file", dest = 'JsonFile', type=argparse.FileType('r'),
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument ("--pfx-file", dest='SignToolPfxFile', type=argparse.FileType('rb'),
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument ("--signer-private-cert", dest='OpenSslSignerPrivateCertFile', type=argparse.FileType('rb'),
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument ("--other-public-cert", dest='OpenSslOtherPublicCertFile', type=argparse.FileType('rb'),
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument ("--trusted-public-cert", dest='OpenSslTrustedPublicCertFile', type=argparse.FileType('rb'),
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Capsule/GenerateCapsule.py: parser.add_argument ("--embedded-driver", dest = 'EmbeddedDriver', type = argparse.FileType('rb'), action='append', default = [],
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Pkcs7Sign/Pkcs7Sign.py: parser.add_argument("--signer-private-cert", dest='SignerPrivateCertFile', type=argparse.FileType('rb'), help="specify the signer private cert filename.  If not specified, a test signer private cert is used.")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Pkcs7Sign/Pkcs7Sign.py: parser.add_argument("--other-public-cert", dest='OtherPublicCertFile', type=argparse.FileType('rb'), help="specify the other public cert filename.  If not specified, a test other public cert is used.")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Pkcs7Sign/Pkcs7Sign.py: parser.add_argument("--trusted-public-cert", dest='TrustedPublicCertFile', type=argparse.FileType('rb'), help="specify the trusted public cert filename.  If not specified, a test trusted public cert is used.")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Pkcs7Sign/Pkcs7Sign.py: parser.add_argument(metavar="input_file", dest='InputFile', type=argparse.FileType('rb'), help="specify the input filename")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py: group.add_argument("-o", "--output", dest='OutputFile', type=argparse.FileType('wb'), metavar='filename', nargs='*', help="specify the output private key filename in PEM format")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py: group.add_argument("-i", "--input", dest='InputFile', type=argparse.FileType('rb'), metavar='filename', nargs='*', help="specify the input private key filename in PEM format")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py: parser.add_argument("--public-key-hash", dest='PublicKeyHashFile', type=argparse.FileType('wb'), help="specify the public key hash filename that is SHA 256 hash of 2048 bit RSA public key in binary format")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py: parser.add_argument("--public-key-hash-c", dest='PublicKeyHashCFile', type=argparse.FileType('wb'), help="specify the public key hash filename that is SHA 256 hash of 2048 bit RSA public key in C structure format")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py: parser.add_argument("--private-key", dest='PrivateKeyFile', type=argparse.FileType('rb'), help="specify the private key filename.  If not specified, a test signing key is used.")
      ./edk2-basetools-0.1.51.tar.gz: edk2-basetools-0.1.51/edk2basetools/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py: parser.add_argument(metavar="input_file", dest='InputFile', type=argparse.FileType('rb'), help="specify the input filename")
      ./edk2_pytool_extensions-0.27.8.tar.gz: edk2_pytool_extensions-0.27.8/edk2toolext/capsule/capsule_tool.py: parser.add_argument('-o', dest='options_file', type=argparse.FileType('r'),
      ./edk2_pytool_extensions-0.27.8.tar.gz: edk2_pytool_extensions-0.27.8/edk2toolext/capsule/capsule_tool.py: parser.add_argument('capsule_payload', type=argparse.FileType('rb'),
      ./edx-django-release-util-1.4.0.tar.gz: edx-django-release-util-1.4.0/release_util/management/commands/check_reserved_keywords.py: type=argparse.FileType('r', encoding='UTF-8'),
      ./edx-django-release-util-1.4.0.tar.gz: edx-django-release-util-1.4.0/release_util/management/commands/check_reserved_keywords.py: type=argparse.FileType('r', encoding='UTF-8'),
      ./Faker-26.0.0.tar.gz: Faker-26.0.0/faker/cli.py: type=argparse.FileType("w"),
      ./df2gspread-1.0.4.tar.gz: df2gspread-1.0.4/bin/csv2gspread: parser.add_argument('--csv', type = argparse.FileType('r'), default = '-')
      ./brother_ql_inventree-1.2.tar.gz: brother_ql_inventree-1.2/brother_ql/brother_ql_analyse.py: parser.add_argument('file', help='The file to analyze', type=argparse.FileType('rb'))
      ./brother_ql_inventree-1.2.tar.gz: brother_ql_inventree-1.2/brother_ql/brother_ql_create.py: parser.add_argument('outfile', nargs='?', type=argparse.FileType('wb'), default=stdout, help='The file to write the instructions to. Defaults to stdout.')
      ./esp-idf-kconfig-2.2.0.tar.gz: esp-idf-kconfig-2.2.0/kconfgen/core.py: type=argparse.FileType("r"),
      ./esp-idf-kconfig-2.2.0.tar.gz: esp-idf-kconfig-2.2.0/kconfserver/core.py: type=argparse.FileType("r"),
      ./esp-idf-kconfig-2.2.0.tar.gz: esp-idf-kconfig-2.2.0/test/kconfserver/test_kconfserver.py: type=argparse.FileType("w"),
      ./esp-idf-size-1.5.0.tar.gz: esp-idf-size-1.5.0/esp_idf_size/core.py: type=argparse.FileType('r'))
      ./esp-idf-size-1.5.0.tar.gz: esp-idf-size-1.5.0/esp_idf_size/core.py: type=argparse.FileType('w'),
      ./esp_idf_panic_decoder-1.1.0.tar.gz: esp_idf_panic_decoder-1.1.0/esp_idf_panic_decoder/gdb_panic_server.py: parser.add_argument('input_file', type=argparse.FileType('r'),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/base_operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/base_operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/base_operations.py: type=argparse.FileType("w"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/base_operations.py: type=argparse.FileType("r"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/base_operations.py: type=argparse.FileType("r"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32/operations.py: "keyfile", help="Key file to digest (PEM format)", type=argparse.FileType("rb")
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c2/operations.py: "keyfile", help="Key file to digest (PEM format)", type=argparse.FileType("rb")
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c6/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c6/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c6/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32c6/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2beta1/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2beta1/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2beta1/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32h2beta1/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32p4/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32p4/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32p4/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32p4/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3beta2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3beta2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3beta2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espefuse/efuse/esp32s3beta2/operations.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: This class is a replacement of argparse.FileType('wb').
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: argparse.FileType('w')('-') returns STDOUT but argparse.FileType('wb') is not.
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: just like in the case of argparse.FileType('w').
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./esptool-4.7.0.tar.gz: esptool-4.7.0/espsecure/__init__.py: type=argparse.FileType("rb"),
      ./faust-cchardet-2.1.19.tar.gz: faust-cchardet-2.1.19/bin/cchardetect: type=argparse.FileType('rb'),
      ./cyclonedx_bom-4.5.0.tar.gz: cyclonedx_bom-4.5.0/CHANGELOG.md: [`argparse.FileType`](https://docs.python.org/3/library/argparse.html?highlight=pseudo-argument#argparse.FileType).
      ./cyclonedx_bom-4.5.0.tar.gz: cyclonedx_bom-4.5.0/cyclonedx_py/_internal/cli.py: from argparse import ArgumentParser, FileType, RawDescriptionHelpFormatter
      ./exrex-0.11.0.tar.gz: exrex-0.11.0/exrex.py: type=argparse.FileType('w', encoding='utf-8')
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/export_script_gen.py: 'src', type=argparse.FileType('r', encoding='UTF-8'), help='platform independent export file path'
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/export_script_gen.py: 'dest', type=argparse.FileType('w', encoding='UTF-8'), help='destination export file for required linker'
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/link_sbom.py: parser.add_argument('-o', '--output', type=argparse.FileType('w', encoding='UTF-8'), help='resulting SBOM file', required=True)
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/link_sbom.py: parser.add_argument('--vcs-info', type=argparse.FileType('r', encoding='UTF-8'), help='VCS information file', required=True)
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/rodata2asm.py: parser.add_argument('asm', type=argparse.FileType('w', encoding='UTF-8'), help='destination .asm file path')
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/rodata2cpp.py: parser.add_argument('rodata', type=argparse.FileType('rb'), help='input .rodata file path')
      ./catboost-1.2.5.tar.gz: catboost-1.2.5/catboost_all_src/build/scripts/rodata2cpp.py: parser.add_argument('cpp', type=argparse.FileType('w', encoding='UTF-8'), help='destination .cpp file path')
      ./icalendar-5.0.13.tar.gz: icalendar-5.0.13/src/icalendar/cli.py: parser.add_argument('--output', '-o', type=argparse.FileType('w'), default=sys.stdout, help='output file')
      ./img2pdf-0.5.1.tar.gz: img2pdf-0.5.1/src/img2pdf.py: type=argparse.FileType("wb"),
      ./facebook_business-20.0.0.tar.gz: facebook_business-20.0.0/examples/custom_audience_utils.py: create_group.add_argument('--file', type=argparse.FileType('rb'),
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/getArch.py: parser.add_argument('-targets', type=argparse.FileType('r'), help='input file with targets system to query Arch '
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/karmaSMB.py: parser.add_argument('-config', type=argparse.FileType('r'), metavar = 'pathname', help='config file name to map '
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/mimikatz.py: parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the mini shell')
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/mssqlclient.py: parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the SQL shell')
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/netview.py: parser.add_argument('-users', type=argparse.FileType('r'), help='input file with list of users to filter to output for')
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/netview.py: #parser.add_argument('-groups', type=argparse.FileType('r'), help='Filter output by members of the groups included in the input file')
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/netview.py: parser.add_argument('-targets', type=argparse.FileType('r'), help='input file with targets system to query info '
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/smbclient.py: parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the mini shell')
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/wmipersist.py: install_parser.add_argument('-vbs', type=argparse.FileType('r'), required=True, help='VBS filename containing the '
      ./impacket-0.11.0.tar.gz: impacket-0.11.0/examples/wmiquery.py: parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the WQL shell')
      ./fairseq-0.12.2.tar.gz: fairseq-0.12.2/fairseq/examples/speech_recognition/datasets/asr_prep_json.py: type=argparse.FileType("r", encoding="UTF-8"),
      ./fairseq-0.12.2.tar.gz: fairseq-0.12.2/fairseq/examples/speech_recognition/datasets/asr_prep_json.py: type=argparse.FileType("r", encoding="UTF-8"),
      ./fairseq-0.12.2.tar.gz: fairseq-0.12.2/fairseq/examples/speech_recognition/datasets/asr_prep_json.py: type=argparse.FileType("r", encoding="UTF-8"),
      ./fairseq-0.12.2.tar.gz: fairseq-0.12.2/fairseq/examples/speech_recognition/datasets/asr_prep_json.py: type=argparse.FileType("w"),
      ./josepy-1.14.0.tar.gz: josepy-1.14.0/src/josepy/jws.py: parser_sign.add_argument("-k", "--key", type=argparse.FileType("rb"), required=True)
      ./josepy-1.14.0.tar.gz: josepy-1.14.0/src/josepy/jws.py: parser_verify.add_argument("-k", "--key", type=argparse.FileType("rb"), required=False)
      ./lookml-3.0.3.tar.gz: lookml-3.0.3/lookml/lkml/__init__.py: "file", type=argparse.FileType("r"), help="path to the LookML file to parse"
      ./guesslang-2.2.1.tar.gz: guesslang-2.2.1/guesslang/__main__.py: from argparse import ArgumentParser, FileType
      ./gvm_tools-24.6.0.tar.gz: gvm_tools-24.6.0/scripts/update-task-target.gmp.py: from argparse import ArgumentParser, FileType, Namespace, RawTextHelpFormatter
      ./genson-1.3.0.tar.gz: genson-1.3.0/genson/__main__.py: file_type = argparse.FileType('r', encoding=self._get_encoding())
      ./mapbox_vector_tile-2.1.0.tar.gz: mapbox_vector_tile-2.1.0/mapbox_vector_tile/optimise.py: parser.add_argument("input_file", help="Input MVT file", type=argparse.FileType("r"))
      ./mapbox_vector_tile-2.1.0.tar.gz: mapbox_vector_tile-2.1.0/mapbox_vector_tile/optimise.py: "--output-file", help="Output file, default is stdout", type=argparse.FileType("w"), default=sys.stdout
      ./json_delta-2.0.2.tar.gz: json_delta-2.0.2/src/json_diff: parser.add_argument('left', nargs='?', type=argparse.FileType('rb'),
      ./json_delta-2.0.2.tar.gz: json_delta-2.0.2/src/json_diff: 'right', nargs='?', type=argparse.FileType('rb'),
      ./json_delta-2.0.2.tar.gz: json_delta-2.0.2/src/json_diff: '--output', '-o', type=argparse.FileType('wb'), metavar='FILE',
      ./json_delta-2.0.2.tar.gz: json_delta-2.0.2/src/json_patch: parser.add_argument('struc', nargs='?', type=argparse.FileType('rb'),
      ./json_delta-2.0.2.tar.gz: json_delta-2.0.2/src/json_patch: 'diff', nargs='?', type=argparse.FileType('rb'),
      ./json_delta-2.0.2.tar.gz: json_delta-2.0.2/src/json_patch: '--output', '-o', type=argparse.FileType('wb'),
      ./json_spec-0.12.0.tar.gz: json_spec-0.12.0/src/jsonspec/cli.py: class JSONFile(argparse.FileType):
      ./jsonpatch-1.33.tar.gz: jsonpatch-1.33/bin/jsondiff: parser.add_argument('FILE1', type=argparse.FileType('r'))
      ./jsonpatch-1.33.tar.gz: jsonpatch-1.33/bin/jsondiff: parser.add_argument('FILE2', type=argparse.FileType('r'))
      ./jsonpatch-1.33.tar.gz: jsonpatch-1.33/bin/jsonpatch: parser.add_argument('ORIGINAL', type=argparse.FileType('r'),
      ./jsonpatch-1.33.tar.gz: jsonpatch-1.33/bin/jsonpatch: parser.add_argument('PATCH', type=argparse.FileType('r'),
      ./markdownify-0.12.1.tar.gz: markdownify-0.12.1/markdownify/main.py: parser.add_argument('html', nargs='?', type=argparse.FileType('r'),
      ./jsonpointer-3.0.0.tar.gz: jsonpointer-3.0.0/bin/jsonpointer: ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'),
      ./jsonpointer-3.0.0.tar.gz: jsonpointer-3.0.0/bin/jsonpointer: parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+',
      ./bandit-1.7.9.tar.gz: bandit-1.7.9/bandit/cli/main.py: type=argparse.FileType("w", encoding="utf-8"),
      ./base58-2.1.1.tar.gz: base58-2.1.1/base58/__main__.py: type=argparse.FileType('r'),
      ./langid-1.1.6.tar.gz: langid-1.1.6/langid/tools/printfeats.py: parser.add_argument('--output', "-o", default=sys.stdout, type=argparse.FileType('w'), help = "write to OUTPUT")
      ./lark-1.1.9.tar.gz: lark-1.1.9/lark/tools/__init__.py: from argparse import ArgumentParser, FileType
      ./lark-1.1.9.tar.gz: lark-1.1.9/lark/tools/__init__.py: lalr_argparser.add_argument('-o', '--out', type=FileType('w', encoding=encoding), default=sys.stdout, help='the output file (default=stdout)')
      ./lark-1.1.9.tar.gz: lark-1.1.9/lark/tools/__init__.py: lalr_argparser.add_argument('grammar_file', type=FileType('r', encoding=encoding), help='A valid .lark file')
      ./lark-parser-0.12.0.tar.gz: lark-parser-0.12.0/lark/tools/__init__.py: from argparse import ArgumentParser, FileType
      ./lark-parser-0.12.0.tar.gz: lark-parser-0.12.0/lark/tools/__init__.py: lalr_argparser.add_argument('-o', '--out', type=FileType('w', **k), default=sys.stdout, help='the output file (default=stdout)')
      ./lark-parser-0.12.0.tar.gz: lark-parser-0.12.0/lark/tools/__init__.py: lalr_argparser.add_argument('grammar_file', type=FileType('r', **k), help='A valid .lark file')
      ./ldaptor-21.2.0.tar.gz: ldaptor-21.2.0/docs/source/examples/client_paged_search_results.py: type=argparse.FileType("r"),
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/compiler/_data_passing_using_volume.py: type=argparse.FileType('r'),
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/compiler/_data_passing_using_volume.py: type=argparse.FileType('w'),
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/components/_python_op.py: return "argparse.FileType('rt')"
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/components/_python_op.py: return "argparse.FileType('rb')"
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/components/_python_op.py: # For Output* we cannot use the build-in argparse.FileType objects since they do not create parent directories.
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/components/_python_op.py: # ~= return "argparse.FileType('wt')"
      ./kfp-2.8.0.tar.gz: kfp-2.8.0/kfp/deprecated/components/_python_op.py: # ~= return "argparse.FileType('wb')"
      ./lkml-1.3.4.tar.gz: lkml-1.3.4/lkml/__init__.py: "file", type=argparse.FileType("r"), help="path to the LookML file to parse"
      ./myst_parser-3.0.1.tar.gz: myst_parser-3.0.1/myst_parser/cli.py: type=argparse.FileType("r", encoding="utf8"),
      ./myst_parser-3.0.1.tar.gz: myst_parser-3.0.1/myst_parser/cli.py: type=argparse.FileType("w", encoding="utf8"),
      ./cbor2-5.6.4.tar.gz: cbor2-5.6.4/cbor2/tool.py: type=argparse.FileType("rb"),
      ./netmiko-4.3.0.tar.gz: netmiko-4.3.0/netmiko/cli_tools/netmiko_cfg.py: "--infile", help="Read commands from file", type=argparse.FileType("r")
      ./cchardet-2.1.7.tar.gz: cchardet-2.1.7/bin/cchardetect: type=argparse.FileType('rb'),
      ./msg_parser-1.2.0.tar.gz: msg_parser-1.2.0/msg_parser/cli.py: from argparse import FileType
      ./mkdocs_get_deps-0.2.0.tar.gz: mkdocs_get_deps-0.2.0/mkdocs_get_deps/__main__.py: type=argparse.FileType("r"),
      ./poetry_core-1.9.0.tar.gz: poetry_core-1.9.0/src/poetry/core/_vendor/lark/tools/__init__.py: from argparse import ArgumentParser, FileType
      ./poetry_core-1.9.0.tar.gz: poetry_core-1.9.0/src/poetry/core/_vendor/lark/tools/__init__.py: lalr_argparser.add_argument('-o', '--out', type=FileType('w', encoding=encoding), default=sys.stdout, help='the output file (default=stdout)')
      ./poetry_core-1.9.0.tar.gz: poetry_core-1.9.0/src/poetry/core/_vendor/lark/tools/__init__.py: lalr_argparser.add_argument('grammar_file', type=FileType('r', encoding=encoding), help='A valid .lark file')
      ./hsms-0.3.1.tar.gz: hsms-0.3.1/hsms/cmds/hsms.py: type=argparse.FileType("r"),
      ./pyarmor-8.5.10.zip: pyarmor-8.5.10/pyarmor/polyfills/argparse.py: '--log', default=sys.stdout, type=argparse.FileType('w'),
      ./httpie-3.2.2.tar.gz: httpie-3.2.2/httpie/cli/definition.py: from argparse import FileType
      ./msoffcrypto_tool-5.4.1.tar.gz: msoffcrypto_tool-5.4.1/msoffcrypto/__main__.py: parser.add_argument("infile", nargs="?", type=argparse.FileType("rb"), help="input file")
      ./msoffcrypto_tool-5.4.1.tar.gz: msoffcrypto_tool-5.4.1/msoffcrypto/__main__.py: parser.add_argument("outfile", nargs="?", type=argparse.FileType("wb"), help="output file (if blank, stdout is used)")
      ./oslo.log-6.0.0.tar.gz: oslo.log-6.0.0/oslo_log/cmds/convert_json.py: type=argparse.FileType(),
      ./pybase64-1.3.2.tar.gz: pybase64-1.3.2/src/pybase64/__main__.py: "input", type=argparse.FileType("rb"), help="input file used for the benchmark"
      ./pybase64-1.3.2.tar.gz: pybase64-1.3.2/src/pybase64/__main__.py: "input", type=argparse.FileType("rb"), help="input file to be encoded"
      ./pybase64-1.3.2.tar.gz: pybase64-1.3.2/src/pybase64/__main__.py: type=argparse.FileType("wb"),
      ./pybase64-1.3.2.tar.gz: pybase64-1.3.2/src/pybase64/__main__.py: "input", type=argparse.FileType("rb"), help="input file to be decoded"
      ./pybase64-1.3.2.tar.gz: pybase64-1.3.2/src/pybase64/__main__.py: type=argparse.FileType("wb"),
      ./polyglot-16.7.4.tar.gz: polyglot-16.7.4/polyglot/__main__.py: from argparse import ArgumentParser, FileType
      ./pykafka-2.8.0.tar.gz: pykafka-2.8.0/pykafka/cli/kafka_tools.py: type=argparse.FileType('w'), default=sys.stdout)
      ./portalocker-2.10.0.tar.gz: portalocker-2.10.0/portalocker/__main__.py: type=argparse.FileType('w'),
      ./pdfplumber-0.11.1.tar.gz: pdfplumber-0.11.1/pdfplumber/cli.py: "infile", nargs="?", type=argparse.FileType("rb"), default=sys.stdin.buffer
      ./pykakasi-2.3.0.tar.gz: pykakasi-2.3.0/src/pykakasi/cli.py: "-I", type=argparse.FileType("r"), default=sys.stdin, help="Specify input file (default STDIN)"
      ./pykakasi-2.3.0.tar.gz: pykakasi-2.3.0/src/pykakasi/cli.py: "-O", type=argparse.FileType("w"), default=sys.stdout, help="Specify output file (default STDOUT)"
      ./pyLDAvis-3.4.1.tar.gz: pyLDAvis-3.4.1/pyLDAvis/lib/python3.11/site-packages/pip/_vendor/chardet/cli/chardetect.py: type=argparse.FileType("rb"),
      ./pex-2.6.2.tar.gz: pex-2.6.2/pex/vendor/_vendored/pip/pip/_vendor/chardet/cli/chardetect.py: type=argparse.FileType('rb'), nargs='*',
      ./pytest_split-0.9.0.tar.gz: pytest_split-0.9.0/src/pytest_split/cli.py: type=argparse.FileType(),
      ./pandoc-2.3.tar.gz: pandoc-2.3/src/pandoc/__init__.py: # TODO: use argparse.FileType and access the filename attribute when needed.
      ./pglast-6.2.tar.gz: pglast-6.2/pglast/__main__.py: parser.add_argument('infile', nargs='?', type=argparse.FileType(),
      ./pglast-6.2.tar.gz: pglast-6.2/pglast/__main__.py: parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),
      ./pytype-2024.4.11.tar.gz: pytype-2024.4.11/pytype/tools/traces/run.py: parser.add_argument('input', type=argparse.FileType('r'),
      ./pyocd-0.36.0.tar.gz: pyocd-0.36.0/pyocd/subcommands/commander_cmd.py: type=argparse.FileType('r'),
      ./parliament-1.6.2.tar.gz: parliament-1.6.2/parliament/cli.py: type=argparse.FileType("r"),
      ./python-lsp-server-1.11.0.tar.gz: python-lsp-server-1.11.0/scripts/jsonschema2md.py: from argparse import ArgumentParser, FileType
      ./pickle5-0.0.12.tar.gz: pickle5-0.0.12/pickle5/pickle.py: 'pickle_file', type=argparse.FileType('br'),
      ./pickle5-0.0.12.tar.gz: pickle5-0.0.12/pickle5/pickletools.py: 'pickle_file', type=argparse.FileType('br'),
      ./pickle5-0.0.12.tar.gz: pickle5-0.0.12/pickle5/pickletools.py: '-o', '--output', default=sys.stdout, type=argparse.FileType('w'),
      ./premailer-3.10.0.tar.gz: premailer-3.10.0/premailer/__main__.py: type=argparse.FileType("r"),
      ./premailer-3.10.0.tar.gz: premailer-3.10.0/premailer/__main__.py: type=argparse.FileType("w"),
      ./pigar-2.1.4.tar.gz: pigar-2.1.4/pigar/_vendor/pip/_vendor/chardet/cli/chardetect.py: type=argparse.FileType("rb"),
      ./robotframework_robocop-5.3.0.tar.gz: robotframework_robocop-5.3.0/robocop/config.py: type=argparse.FileType("w"),
      ./rpaframework-28.6.0.tar.gz: rpaframework-28.6.0/src/RPA/scripts/crypto.py: "input", nargs="?", type=argparse.FileType("r"), default=sys.stdin
      ./rpaframework-28.6.0.tar.gz: rpaframework-28.6.0/src/RPA/scripts/crypto.py: type=argparse.FileType("rb"),
      ./rpaframework-28.6.0.tar.gz: rpaframework-28.6.0/src/RPA/scripts/crypto.py: type=argparse.FileType("wb"),
      ./rpaframework-28.6.0.tar.gz: rpaframework-28.6.0/src/RPA/scripts/crypto.py: type=argparse.FileType("rb"),
      ./rpaframework-28.6.0.tar.gz: rpaframework-28.6.0/src/RPA/scripts/crypto.py: type=argparse.FileType("wb"),
      ./pydicom-2.4.4.tar.gz: pydicom-2.4.4/pydicom/util/codify.py: type=argparse.FileType("w", encoding="UTF-8"),
      ./prov-2.0.1.tar.gz: prov-2.0.1/scripts/prov-compare: from argparse import ArgumentParser, RawDescriptionHelpFormatter, FileType
      ./prov-2.0.1.tar.gz: prov-2.0.1/scripts/prov-convert: from argparse import ArgumentParser, RawDescriptionHelpFormatter, FileType
      ./pypng-0.20220715.0.tar.gz: pypng-0.20220715.0/code/prichunkpng: type=argparse.FileType("rb"),
      ./pypng-0.20220715.0.tar.gz: pypng-0.20220715.0/code/priplan9topng: type=argparse.FileType("w"),
      ./pip_audit-2.7.3.tar.gz: pip_audit-2.7.3/pip_audit/_cli.py: to avoid `argparse.FileType`'s "eager" file creation, which is generally
      ./pip_audit-2.7.3.tar.gz: pip_audit-2.7.3/pip_audit/_cli.py: type=argparse.FileType("r"),
      ./PyNaCl-1.5.0.tar.gz: PyNaCl-1.5.0/docs/vectors/python/argondriver.py: type=argparse.FileType("w"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="r"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="rb"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="w"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="r"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="rb"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="w"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="rb"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="rb"),
      ./python_jsonpath-1.1.1.tar.gz: python_jsonpath-1.1.1/jsonpath/cli.py: type=argparse.FileType(mode="w"),
      ./pipenv-2024.0.1.tar.gz: pipenv-2024.0.1/pipenv/patched/pip/_vendor/chardet/cli/chardetect.py: type=argparse.FileType("rb"),
      ./pyzstd-0.16.0.tar.gz: pyzstd-0.16.0/src/__main__.py: g.add_argument('-D', '--dict', metavar='FILE', type=argparse.FileType('rb'),
      ./pyfaidx-0.8.1.1.tar.gz: pyfaidx-0.8.1.1/pyfaidx/cli.py: _input.add_argument('-b', '--bed', type=argparse.FileType('r'), help="bed file of regions (zero-based start coordinate)")
      ./pyfaidx-0.8.1.1.tar.gz: pyfaidx-0.8.1.1/pyfaidx/cli.py: output.add_argument('-o', '--out', type=argparse.FileType('w'), help="output file name (default: stdout)")
      ./python_snappy-0.7.2.tar.gz: python_snappy-0.7.2/src/snappy/__main__.py: type=argparse.FileType(mode='rb'),
      ./python_snappy-0.7.2.tar.gz: python_snappy-0.7.2/src/snappy/__main__.py: type=argparse.FileType(mode='wb'),
      ./pytest-benchmark-4.0.0.tar.gz: pytest-benchmark-4.0.0/src/pytest_benchmark/plugin.py: metavar="PATH", type=argparse.FileType('wb'),
      ./oci-2.129.0.tar.gz: oci-2.129.0/src/oci/_vendor/chardet/cli/chardetect.py: type=argparse.FileType('rb'), nargs='*',
      ./rule_engine-4.5.0.tar.gz: rule_engine-4.5.0/lib/rule_engine/debug_repl.py: type=argparse.FileType('r'),
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/ftconf.py: from argparse import ArgumentParser, FileType
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/ftdi_urls.py: from argparse import ArgumentParser, FileType
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/ftdi_urls.py: argparser.add_argument('-V', '--virtual', type=FileType('r'),
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/i2cscan.py: from argparse import ArgumentParser, FileType
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/i2cscan.py: argparser.add_argument('-V', '--virtual', type=FileType('r'),
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/pyterm.py: from argparse import ArgumentParser, FileType
      ./pyftdi-0.55.4.tar.gz: pyftdi-0.55.4/pyftdi/bin/pyterm.py: argparser.add_argument('-V', '--virtual', type=FileType('r'),
      ./srt-3.5.3.tar.gz: srt-3.5.3/srt_tools/utils.py: # Cannot use argparse.FileType as we need to know the encoding from the
      ./stanza-1.8.2.tar.gz: stanza-1.8.2/stanza/server/main.py: parser.add_argument('-i', '--input', type=argparse.FileType('r'), default=sys.stdin, help="Input file to process; each line contains one document (default: stdin)")
      ./stanza-1.8.2.tar.gz: stanza-1.8.2/stanza/server/main.py: parser.add_argument('-o', '--output', type=argparse.FileType('w'), default=sys.stdout, help="File to write annotations to (default: stdout)")
      ./unidiff-0.7.5.tar.gz: unidiff-0.7.5/bin/unidiff: type=argparse.FileType('r'),
      ./stix2-patterns-2.0.0.tar.gz: stix2-patterns-2.0.0/stix2patterns/validator.py: type=argparse.FileType("r"))
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/asm.py: type=argparse.FileType('wb'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/asm.py: type=argparse.FileType('r')
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/checksec.py: type=argparse.FileType('rb'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/checksec.py: type=argparse.FileType('rb'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/debug.py: type=argparse.FileType('r'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/disablenx.py: type=argparse.FileType('rb'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/phd.py: type=argparse.FileType('rb'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/pwnstrip.py: p.add_argument('-o', '--output', type=argparse.FileType('wb'), default=getattr(sys.stdout, 'buffer', sys.stdout))
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/pwnstrip.py: p.add_argument('file', type=argparse.FileType('rb'))
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/scramble.py: type=argparse.FileType('wb'),
      ./pwntools-4.12.0.tar.gz: pwntools-4.12.0/pwnlib/commandline/shellcraft.py: type = argparse.FileType('wb'),
      ./urlextract-1.9.0.tar.gz: urlextract-1.9.0/urlextract/urlextract_core.py: type=argparse.FileType(),
      ./textile-4.0.2.tar.gz: textile-4.0.2/textile/__main__.py: parser.add_argument('infile', nargs='?', type=argparse.FileType(),
      ./textile-4.0.2.tar.gz: textile-4.0.2/textile/__main__.py: parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),
      ./textract-1.6.5.tar.gz: textract-1.6.5/textract/cli.py: class FileType(argparse.FileType):
      ./readme_renderer-43.0.tar.gz: readme_renderer-43.0/readme_renderer/__main__.py: type=argparse.FileType('w'), default='-')
      ./wordcloud-1.9.3.tar.gz: wordcloud-1.9.3/wordcloud/wordcloud_cli.py: '--mask', metavar='file', type=argparse.FileType('rb'),
      ./wordcloud-1.9.3.tar.gz: wordcloud-1.9.3/wordcloud/wordcloud_cli.py: '--colormask', metavar='file', type=argparse.FileType('rb'),
      ./striprtf-0.0.26.tar.gz: striprtf-0.0.26/striprtf/striprtf: type=argparse.FileType("r", encoding="UTF-8"),
      ./tyro-0.8.5.tar.gz: tyro-0.8.5/src/tyro/_argparse.py: '--log', default=sys.stdout, type=argparse.FileType('w'),
      ./tyro-0.8.5.tar.gz: tyro-0.8.5/src/tyro/_arguments.py: type: Callable[[str], _T] | argparse.FileType | None = None,
      ./validate_pyproject-0.18.tar.gz: validate_pyproject-0.18/src/validate_pyproject/cli.py: _STDIN = argparse.FileType("r")("-")
      ./validate_pyproject-0.18.tar.gz: validate_pyproject-0.18/src/validate_pyproject/cli.py: type=argparse.FileType("r"),
      ./sphinxcontrib-openapi-0.8.4.tar.gz: sphinxcontrib-openapi-0.8.4/sphinxcontrib/openapi/__main__.py: type=argparse.FileType('w'),
      ./vcstool-0.3.0.tar.gz: vcstool-0.3.0/vcstool/commands/import_.py: return argparse.FileType('r')(value)
      ./vcstool-0.3.0.tar.gz: vcstool-0.3.0/vcstool/commands/validate.py: '--input', type=argparse.FileType('r'), default='-')
      ./tabcmd-2.0.14.tar.gz: tabcmd-2.0.14/tabcmd/execution/global_options.py: type=argparse.FileType("r", encoding="utf-8-sig"),
      ./tabcmd-2.0.14.tar.gz: tabcmd-2.0.14/tabcmd/execution/global_options.py: type=argparse.FileType("r", encoding="utf-8-sig"),
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/onnx/bin/checker.py: parser.add_argument("model_pb", type=argparse.FileType("rb"))
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/onnx/bin/checker.py: parser.add_argument("node_pb", type=argparse.FileType("rb"))
      ./tecton-0.9.12.tar.gz: tecton-0.9.12/tecton/vendor/dill/dill/_objects.py: a['ArgParseFileType'] = argparse.FileType() # pickle ok
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-1.16.1.tar.gz: onnx-1.16.1/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./sgqlc-16.3.tar.gz: sgqlc-16.3/sgqlc/codegen/operation.py: type=argparse.FileType('w'),
      ./sgqlc-16.3.tar.gz: sgqlc-16.3/sgqlc/codegen/operation.py: type=argparse.FileType('r', encoding=read_encoding),
      ./sgqlc-16.3.tar.gz: sgqlc-16.3/sgqlc/codegen/operation.py: type=argparse.FileType('r', encoding=read_encoding),
      ./sgqlc-16.3.tar.gz: sgqlc-16.3/sgqlc/codegen/schema.py: type=argparse.FileType('r', encoding=read_encoding),
      ./sgqlc-16.3.tar.gz: sgqlc-16.3/sgqlc/codegen/schema.py: type=argparse.FileType('w'),
      ./sgqlc-16.3.tar.gz: sgqlc-16.3/sgqlc/introspection/__main__.py: type=argparse.FileType('w'),
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/onnx/bin/checker.py: parser.add_argument("model_pb", type=argparse.FileType("rb"))
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/onnx/bin/checker.py: parser.add_argument("node_pb", type=argparse.FileType("rb"))
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnx-simplifier-0.4.36.tar.gz: onnx-simplifier-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./truffleHog-2.2.1.tar.gz: truffleHog-2.2.1/truffleHog/truffleHog.py: parser.add_argument('-i', '--include_paths', type=argparse.FileType('r'), metavar='INCLUDE_PATHS_FILE',
      ./truffleHog-2.2.1.tar.gz: truffleHog-2.2.1/truffleHog/truffleHog.py: parser.add_argument('-x', '--exclude_paths', type=argparse.FileType('r'), metavar='EXCLUDE_PATHS_FILE',
      ./vowpalwabbit-9.9.0.tar.gz: vowpalwabbit-9.9.0/utl/csv2vw: #    type=argparse.FileType('r'),
      ./xmljson-0.2.1.tar.gz: xmljson-0.2.1/xmljson/__main__.py: parser.add_argument('in_file', type=argparse.FileType(), nargs='?', default=in_file,
      ./xmljson-0.2.1.tar.gz: xmljson-0.2.1/xmljson/__main__.py: parser.add_argument('-o', '--out_file', type=argparse.FileType('w'), default=out_file,
      ./wavedrom-2.0.3.post3.tar.gz: wavedrom-2.0.3.post3/wavedrom/__init__.py: required=True, type=argparse.FileType('r'))
      ./wavedrom-2.0.3.post3.tar.gz: wavedrom-2.0.3.post3/wavedrom/__init__.py: nargs='?', type=argparse.FileType('w'), default=sys.stdout)
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/onnx/bin/checker.py: parser.add_argument("model_pb", type=argparse.FileType("rb"))
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/onnx/bin/checker.py: parser.add_argument("node_pb", type=argparse.FileType("rb"))
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxoptimizer-0.3.13.tar.gz: onnxoptimizer-0.3.13/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./yq-3.4.3.tar.gz: yq-3.4.3/yq/__init__.py: args.input_streams.insert(0, argparse.FileType()(args.jq_filter))
      ./yq-3.4.3.tar.gz: yq-3.4.3/yq/parser.py: parser.add_argument("input_streams", nargs="*", type=argparse.FileType(), metavar="files", default=[])
      ./zcbor-0.8.1.tar.gz: zcbor-0.8.1/zcbor/zcbor.py: from argparse import ArgumentParser, ArgumentTypeError, RawDescriptionHelpFormatter, FileType
      ./zconfig-4.1.tar.gz: zconfig-4.1/src/ZConfig/_schema_utils.py: schema_reader = argparse.FileType('r')(schema)
      ./zconfig-4.1.tar.gz: zconfig-4.1/src/ZConfig/schema2html.py: type=argparse.FileType('w'),
      ./zconfig-4.1.tar.gz: zconfig-4.1/src/ZConfig/validator.py: type=argparse.FileType('r'),
      ./zigpy_znp-0.12.2.tar.gz: zigpy_znp-0.12.2/zigpy_znp/tools/common.py: class ClosableFileType(argparse.FileType):
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/onnx/bin/checker.py: parser.add_argument("model_pb", type=argparse.FileType("rb"))
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/onnx/bin/checker.py: parser.add_argument("node_pb", type=argparse.FileType("rb"))
      ./zodbpickle-4.0.tar.gz: zodbpickle-4.0/src/zodbpickle/pickle_3.py: 'pickle_file', type=argparse.FileType('br'),
      ./zodbpickle-4.0.tar.gz: zodbpickle-4.0/src/zodbpickle/pickletools_3.py: 'pickle_file', type=argparse.FileType('br'),
      ./zodbpickle-4.0.tar.gz: zodbpickle-4.0/src/zodbpickle/pickletools_3.py: '-o', '--output', default=sys.stdout, type=argparse.FileType('w'),
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      ./onnxsim-0.4.36.tar.gz: onnxsim-0.4.36/third_party/onnx-optimizer/third_party/onnx/third_party/benchmark/tools/compare.py: type=argparse.FileType('r'),
      
      Time: 0:00:25.608394
      Found 384 matching lines in 138 projects
    23. added a commit that references this issue on Oct 23, 2024
    24. moved this from Bugs to Doc issues in Argparse issueson Oct 23, 2024
    25. added a commit that references this issue on Oct 30, 2024
    26. added a commit that references this issue on Dec 8, 2024
    27. added 2 commits that reference this issue on Jan 12, 2025
    28. added a commit that references this issue on Apr 8, 2025
    29. added a commit that references this issue on Oct 21, 2025
    30. henryiii commented on Feb 6, 2026

      @henryiii
      Contributor

      The docs don't really have an example for how to migrate away from this and keep - support. Having an example with a common mode or two would be helpful, I think. pylint detects usage of this now (code W4904), by the way, which is helpful.

    31. drcraig commented on May 10, 2026

      @drcraig

      I'm giving a talk on argparse at PyCon US next week (last minute addition from the waitlist, https://us.pycon.org/2026/schedule/presentation/165/, still hasn't appeared on the master schedule on the website as of 5/9), and I just now learned of the deprecation while reading the docs to prepare the talk. I'm trying now to think of a good alternative to advise people to use for the use case where a CLI program wants to read either one or more files or default to stdin.

      The use cases to replace are the 0 or 1 files version

      add_argument("infile", type=FileType("r"), default=sys.stdin, nargs="?")

      and the similar 0 or many files version

      add_argument("infiles", type=FileType("r"), default=[sys.stdin], nargs="*")

      The first thing I can think of is to have a helper function that you use to open the file, or pass through the existing stdin/out/err file object. Something like

      def open_file_or_io(file_path_or_io, **kwargs):
          if isinstance(file_path_or_io, IOBase):
              return nullcontext(file_path_or_io)
          return open(file_path_or_io, **kwargs)

      Maybe also need to pair that with a couple helpers to use with the type argument of add_argument that will handle translating "-" to sys.stdin or out. Something like

      def path_or_stream(stream):
          def _path_or_stream(arg):
              if arg == "-":
                  return stream
              elif isinstance(arg, IOBase):
                  return arg
              return Path(arg)
          return _path_or_stream

      So you'd use it like

      parser.add_argument("infile", type=path_or_stream(sys.stdin), default=sys.stdin)
      ...
      with open_file_or_io(args.infile) as fobj:
          ....

      Any reactions to that? I hesitate to stand up in front of a crowd and promote something I just made up and haven't used yet. But we need something to suggest to people now that the old way is officially deprecated.

    32. MojoVampire commented on May 16, 2026

      @MojoVampire
      Contributor

      @drcraig: I'm inclined to ask that the old way be undeprecated. I actually wrote my own subclass of argparse.FileType at work that works with contextlib.ExitStack, and it's extremely usable, aside from the new PendingDeprecationWarning, and integrating the feature into FileType itself is easy now that I've already done it once and explored the edge cases. Usage would boil down to:

      with contextlib.ExitStack() as stack:
           # define rest of parser = argparse.ArgumentParser()
           parser.add_argument('infile', type=argparse.FileType(stack=stack)
           parser.add_argument('outfile', type=argparse.FileType("w", stack=stack)
           args = parser.parse_args()  # If any argument fails to parse here, all files opened by that point will be automatically closed
      
           # Either do everything you want to do with the files within the with, or
           # call stack.pop_all() before finishing the with to pass the stack elsewhere
           # for management
      

      The behavior varies slightly for receiving - instead of a filename, only insofar as, instead of FileType.__call__ invoking self._stack.enter_context on the result of an open call, it instead invokes self._stack.callback(lambda: fileobj.closed or fileobj.flush()) when opened for write (and does nothing at all when it's opened for read), so sys.stdout (or its buffer, based on the mode) is guaranteed to be flushed (if not already closed) when the with block is exited.

      The two main objections I can see are:

      1. This is too FileType specific, and argparse could be made a context manager itself and implicitly manage all context-managers it produces. I'd say that this is a case where explicit is better than implicit (the developer has the option not to manage context manager types, and explicitly managing makes things less magical), and it makes FileType a good model for how to make your own context managed type converters for use with argparse
      2. It's a recipe that integrates two very different modules (contextlib and argparse) as the recommended way of using argparse. But contextlib.ExitStack is an amazing tool that does its one job very well, and reinventing it piecemeal seems wrong, and beyond that, we're not averse to providing recipes combining modules elsewhere in the docs (the itertools recipes at this point are built on top of itertools, collections, contextlib, functools, heapq, math, and operator at this point).

      The one thing it doesn't handle is cleaning up when a file is opened for write, and then a subsequent argument parsing failure closes it while leaving the empty file on disk. I'm largely okay with that; the user does know what they typed in after all, so the mystery file appearing isn't confusing.

    33. MojoVampire commented on May 19, 2026

      @MojoVampire
      Contributor

      Opened gh-150125 to propose restoring FileType.

    34. added a commit that references this issue on Jul 1, 2026
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions