Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

class-argparse

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-argparse

Class based argument parser

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

Class-Argparse

Class based argument parser to simplify writing CLIs that have lots of options

How to use

class Main(ClassArgParser):

    def __init__(self) -> None:
        super().__init__(name="Class ArgParser")

    async def foo(self, first: str):
        print(f"foo, first={first}")

    def bar(self):
        print("bar")

    async def baz(self, first: str, second: int):
        print(f"baz, first={first}, second={second}")


if __name__ == "__main__":
    Main()()

How this works

  1. The class ClassArgParser extends ArgumentParser
  2. The initialization function finds add adds all the methods on child classes that are public i.e. their names don't start with __
  3. The object of the class is called and after identifying whether the function being called it is async or sync it runs the function accordingly

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc