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

ref: Add ruff rules for naming (N) #4187

Merged
merged 3 commits into from
Oct 19, 2024
Merged

Conversation

cbornet
Copy link
Collaborator

@cbornet cbornet commented Oct 17, 2024

Add ruff rules for naming (N)

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 17, 2024
@@ -50,8 +50,8 @@ def build(
api_key: str,
url: str,
timeout: int = 30000,
crawlerOptions: Data | None = None,
pageOptions: Data | None = None,
crawlerOptions: Data | None = None, # noqa: N803
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe it would be breaking to change the field config name ?

@@ -65,13 +65,13 @@ def validate_flow_id(cls, value):
return value

@field_serializer("flow_id")
def serialize_flow_id(value):
def serialize_flow_id(self, value):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or could be a staticmethod. Using an instance method for consistency with pydantic docs.

@@ -111,7 +113,8 @@ def validate_icon_atr(cls, v):
return v

@field_validator("data")
def validate_json(v):
@classmethod
def validate_json(cls, v):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Or could be a staticmethod. Using a class method for consistency with pydantic's docs.

@@ -82,7 +82,7 @@ async def log_package_run(self, payload: RunPayload):
await self._queue_event((self.send_telemetry_data, payload, "run"))

async def log_package_shutdown(self):
payload = ShutdownPayload(timeRunning=(datetime.now(timezone.utc) - self._start_time).seconds)
payload = ShutdownPayload(time_running=(datetime.now(timezone.utc) - self._start_time).seconds)
await self._queue_event(payload)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Shouldn't it go through self.send_telemetry_data ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Wow.. I think it should. Good catch.

"D1", # Missing docstrings
"N",
"N999", # Invalid module names
Copy link
Collaborator Author

@cbornet cbornet Oct 17, 2024

Choose a reason for hiding this comment

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

All component module names are PascalCase (eg. langflow.components.vectorstores.AstraDB)
I'm not sure if we can change that.

Copy link
Contributor

@ogabrielluiz ogabrielluiz left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 19, 2024
@cbornet cbornet enabled auto-merge (squash) October 19, 2024 15:24
@cbornet cbornet merged commit bdb4106 into langflow-ai:main Oct 19, 2024
27 checks passed
@cbornet cbornet deleted the ruff-rules-n branch October 19, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants