Skip to main content

argparse-custom-types

Special custom types for argparse

How to install

pip install argparse_custom_types

Description

Additional custom types to be used with argparse

How to use

Import argparse_custom_types setup the custom type then pass the function to the type keyword in argparse.add_argument()

Types

  • int_range

    • custom int in range from start to stop (not including) optional step
    def int_range(start: int, stop: int, step: int = 1):
    
    • example:
    t = int_range(5, 21, 5)
    

    int types 5, 10, 15, 20 would be accepted

  • int_above

    def int_above(minimum: int):
    
    • int equal to or above the minimum entered
    • example:
    t = int_above(40)
    

    int types 40 and above would be accepted

  • int_below

    def int_below(maximum: int):
    
    • int equal to or below maximum
    • example:
    t = int_below(25)
    

    int types 25 or below would be accepted

  • int_even

    def int_even(pos_number: bool = True, neg_number: bool = False,include_zero: bool = False):
    
    • even int with option to include negative, zero or exclude positive
    • example:
    t = int_even(neg_number=True)
    

    int types 2, -30, 102 would be accepted int types 1, -29, 101 would not be accepted

  • int_odd

    def int_odd(pos_number: bool = True, neg_number: bool = False,include_zero: bool = False):
    
    • odd int with option to include negative, zero or exclude positive
    • example:
    t = int_odd(neg_number=True)
    

    int types 1, -29, 101 would be accepted int types 2, -30, 102 would not be accepted

  • in_sequence_strings

    def in_sequence_strings(sequence: Union[Tuple[str], List[str]],
                            show_on_invalid: bool = False,
                            case_sensitive: bool = True):
    
    • Value that is in the tuple or list and returns that value as a string.
    • example:
    t = in_sequence_strings(["one", "test", "parser"])
    

    any value not in the list ["one", "test", "parser"] will not be accepted

  • in_sequence_ints

  • def in_sequence_ints(sequence: Union[List[int], Tuple[int]],
                         show_on_invalid: bool = False):
    
    • Int value in sequence will be accepted and return a int value

Metadata

Release files for argparse-custom-types 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argparse-custom-types 0.2.0
File Size Uploaded Provenance Actions
argparse_custom_types-0.2.0.tar.gz 3.4 kB Without provenance Details for argparse_custom_types-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argparse-custom-types 0.2.0
File Interpreter ABI Platform Actions
argparse_custom_types-0.2.0-py3-none-any.whl Python 3 none any Details for argparse_custom_types-0.2.0-py3-none-any.whl

Total release size: 7.4 kB

Release files / argparse_custom_types-0.2.0.tar.gz

Download URL argparse_custom_types-0.2.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a9bb00b634778c620e3e4bda996fe1e62af0a6eb8128c16d515d1e2dd0122c9d
BLAKE2b-256 checksum
How to use checksums
02512a1d5e39e44c438e46e79dd78a20a4b0b282e1bb948ef0a7cf110342276b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

Release files / argparse_custom_types-0.2.0-py3-none-any.whl

Download URL argparse_custom_types-0.2.0-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98575360e2839e7b989ed68f6358577c2ef6cbd394da7a6de6519fb0623da6f9
BLAKE2b-256 checksum
How to use checksums
d8a6c2f941c0f3a0b021436fbf433b176acf654f0485c81428fe2eef3d6d73aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

Security for argparse-custom-types 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page