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

Sourcery refactored master branch #8

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 31, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

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

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

Comment on lines -62 to +65
if isinstance(other, ChainContext):
self.primary_map.maps[0:0] = other.primary_map
self.fallback_map.maps[0:0] = other.fallback_map
else:
if not isinstance(other, ChainContext):
return super().__ior__(other)
self.primary_map.maps[:0] = other.primary_map
self.fallback_map.maps[:0] = other.fallback_map
Copy link
Author

Choose a reason for hiding this comment

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

Function ChainContext.__ior__ refactored with the following changes:

Comment on lines -221 to +220
if isinstance(chain, Chain):
return Chain(self, *chain)
else:
return Chain(self, chain)
return Chain(self, *chain) if isinstance(chain, Chain) else Chain(self, chain)
Copy link
Author

Choose a reason for hiding this comment

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

Function Node.next refactored with the following changes:

Comment on lines -11 to +17
class Message(TypedDict): # type: ignore
role: Role
content: str
name: NotRequired[str]

else:
from typing_extensions import NotRequired, TypedDict

class Message(TypedDict):
role: Role
content: str
name: NotRequired[str]
class Message(TypedDict): # type: ignore
role: Role
content: str
name: NotRequired[str]
Copy link
Author

Choose a reason for hiding this comment

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

Lines 11-22 refactored with the following changes:

Copy link
Member

@CNSeniorious000 CNSeniorious000 Oct 31, 2023

Choose a reason for hiding this comment

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

This is wrong. These changes are introducing new static-type-checking failures.

Comment on lines -87 to +82
match = is_message_start.match(line)
if match:
if match := is_message_start.match(line):
Copy link
Author

Choose a reason for hiding this comment

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

Function parse_chat_markup refactored with the following changes:

Comment on lines -62 to +68
if op == "if" or op == "for" or op == "while":
if op in ["if", "for", "while"]:
self._ops_stack.append(op)
self._flush()
self._builder.add_line(f"{inner}:")
self._builder.indent()

elif op == "else" or op == "elif":
elif op in ["else", "elif"]:
Copy link
Author

Choose a reason for hiding this comment

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

Function TemplateCore._on_special_token refactored with the following changes:

  • Replace multiple comparisons of same variable with in operator [×2] (merge-comparisons)

@CNSeniorious000 CNSeniorious000 deleted the sourcery/master branch December 7, 2023 23:18
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