Skip to content

Sourcery Starbot ⭐ refactored xmonader/pygundb #35

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

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the development branch, then run:

git fetch https://github.com/sourcery-ai-bot/pygundb development
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -15 to +20
ch = {
return {
SOUL: newuid(),
'put': {
soul: new_node(soul, **kwargs)
}
}
return ch
}
Copy link
Author

Choose a reason for hiding this comment

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

Function format_put_request refactored with the following changes:

Comment on lines -24 to +28
ch = {
return {
SOUL: newuid(),
'get': {
SOUL: soul
}
}
return ch
}
Copy link
Author

Choose a reason for hiding this comment

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

Function format_get_request refactored with the following changes:

Comment on lines -60 to -61
elif backend_db == "pickle":
backend = Pickle()
Copy link
Author

Choose a reason for hiding this comment

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

Function GunClient._init_backend refactored with the following changes:

Comment on lines -36 to -37
elif backend_db == "pickle":
backend = Pickle()
Copy link
Author

Choose a reason for hiding this comment

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

Function GUNRequestHandler._init_backend refactored with the following changes:

Comment on lines -48 to +54
# node with meta
node = {METADATA: {SOUL: name, STATE: {k: get_current_state() for k in kwargs}}, **kwargs}
return node
return {
METADATA: {
SOUL: name,
STATE: {k: get_current_state() for k in kwargs},
},
**kwargs,
}
Copy link
Author

Choose a reason for hiding this comment

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

Function new_node refactored with the following changes:

This removes the following comments ( why? ):

# node with meta

Comment on lines -112 to +115
else:
if (
is_reference(val) and dfs(graph[val["#"]]) or not is_reference and dfs(val)
): # The reference is found in this child
return True
if (
is_reference(val) and dfs(graph[val["#"]]) or not is_reference and dfs(val)
): # The reference is found in this child
return True
Copy link
Author

Choose a reason for hiding this comment

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

Function search.dfs refactored with the following changes:

if os.path.exists(path):
self.db = dbm.open(path)
else:
self.db = dbm.open(path, "c")
self.db = dbm.open(path) if os.path.exists(path) else dbm.open(path, "c")
Copy link
Author

Choose a reason for hiding this comment

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

Function UDB.__init__ refactored with the following changes:

if not item in res:
if item not in res:
Copy link
Author

Choose a reason for hiding this comment

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

Function uniquify refactored with the following changes:

  • Simplify logical expression using De Morgan identities (de-morgan)

Comment on lines -23 to +26
res = {}
for k, v in obj.items():
if k.startswith("list_"):
res[k] = listify(fix_lists(v))
else:
res[k] = fix_lists(v)
return res
return {
k: listify(fix_lists(v)) if k.startswith("list_") else fix_lists(v)
for k, v in obj.items()
}
Copy link
Author

Choose a reason for hiding this comment

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

Function fix_lists refactored with the following changes:

Comment on lines -63 to +60
if isinstance(v, dict):
res[k] = defaultify(v)
else:
res[k] = v
res[k] = defaultify(v) if isinstance(v, dict) else v
Copy link
Author

Choose a reason for hiding this comment

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

Function defaultify refactored with the following changes:

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.

1 participant