Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and optimize code #42

Open
rvelaVenafi opened this issue Sep 15, 2020 · 0 comments
Open

Refactor and optimize code #42

rvelaVenafi opened this issue Sep 15, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@rvelaVenafi
Copy link
Contributor

rvelaVenafi commented Sep 15, 2020

@warrior-abhijit has suggested several changes to vcert-python code. We can address them together in one issue.

switch case will be better here ?
Originally posted by @warrior-abhijit in #41 (comment)

address todo now ?? as these are lot of if, else in here
Originally posted by @warrior-abhijit in #41 (comment)

regex match API would be lot better here and will remove lot of duplicate code below w.r.t regex match
Originally posted by @warrior-abhijit in #41 (comment)

switch case may be here as well ?
Originally posted by @warrior-abhijit in #41 (comment)

There is a handy Python wrapper called @Property. This can be handy here. It would look like this:
@Property
def base_url(self):
# This is a getter
return self._base_url

@base_url.setter
def base_url(self, value):
# This is the setter method
self._base_url = self._normalize_and_verify_base_url(value)

It's nicer for refactoring and is pretty explicit.
Originally posted by @HELGAHR in #41 (comment)

How safe is it in this method to assume that these dictionary keys resolve? I'm new to this code, but I usually think thrice before trying to access a node in the dictionary without .get().
Originally posted by @HELGAHR in #41 (comment)

Just a tidbit of input: Python string objects have a .startswith() method that's easier to read than a regex, although a regex works fine.
Originally posted by @HELGAHR in #41 (comment)

No use in having a doc string if the parameters aren't described, IMO.
Originally posted by @HELGAHR in #41 (comment)

@tr1ck3r tr1ck3r added the enhancement New feature or request label Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants