Skip to content

Code Review #1

@Ayplow

Description

@Ayplow

For c4ad472

  • No test suite
  • No linting

Solving the above will force most of the other problems to be solved, but here are some others that popped up

raise UnclosedQuote("Missing closing quote.")

  • Variable doesn't exist

Removing items from the middle of a list is a very slow method of skipping through elements.

if not arg.startswith("--"): continue

The difference between flags and options in your parser seems to be the prefix - - and -- (hardcoded at the moment) This is not convention - it is more generally expected that a single dash is used for the shorthand of either an option (-m=utf) or a flag (-f)

self.options = options
self.options_aliases = options_aliases
self.flags = flags
self.flags_aliases = flags_aliases

This data structure is larger than necessary, forcing consumers to use both dictionaries. It would be better to choose one - either iteration through values that declared their aliases or a map of all flags, with some keys holding identical values.

ctx = {type(a): a for a in ctx}

This form of lookup precludes a major use of these context annotations - subclassing. As we drop all information about the mro to do a property access, only the direct constructor of the value is relevant.

raise Exception("BRUH") # TODO: do custom error class

Yeah, do. This is a decent chunk of the library just missing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions