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 sdk and cli. #26

Merged
merged 2 commits into from
Aug 24, 2022
Merged

Conversation

IHosseini083
Copy link
Contributor

@IHosseini083 IHosseini083 commented Aug 24, 2022

Change Summary

  • Remove redundant list comprehensions from constants since the str.join() method takes an Iterable as first argument and dict.keys() also returns a set-like object, therefore it's iterable!

For example this

THEMES_HINT = f'''theme (available themes:
{", ".join([_ for _ in THEMES.keys()])})
'''

will become this

THEMES_HINT = f'''theme (available themes:
{", ".join(THEMES.keys())})
'''
  • Fix a typo in module docs:

python -mpasteme_cli corrected to python -m pasteme_cli

  • Add type annotations for methods and functions.
  • Turn Snippet class into a more concise and user friendly interface with more meaningful method names and instance attributes.
  • Add new types to represent responses from PasteMe API and give users a pythonic way of accessing response parameters using the dot notation. e.g:
from pasteme_cli.sdk import PasteMe

context = {
    "title": "My Snippet",
    ...
}

snippet = PasteMe(verbose=True).create(**context)
print(snippet.url)

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have written/changed corresponding tests for new implementations.

Copy link
Member

@lnxpy lnxpy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They look awesome to me! Thank you Iliya jan. So many cool refactors. :))

@lnxpy lnxpy changed the base branch from master to development August 24, 2022 19:07
@lnxpy lnxpy closed this Aug 24, 2022
@lnxpy lnxpy reopened this Aug 24, 2022
@lnxpy lnxpy merged commit fbe88c3 into collove:development Aug 24, 2022
@IHosseini083 IHosseini083 deleted the refactoring branch August 24, 2022 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants