Skip to content

Commit

Permalink
Convert FBCODE to use the Ruff Formatter
Browse files Browse the repository at this point in the history
Summary:
Converts the directory specified to use the Ruff formatter. This is the last big diff to convert all of Fbcode to Ruff.

pomsky_fix_bugs

drop-conflicts
bypass-github-export-checks
allow-large-files

Reviewed By: amyreese

Differential Revision: D66886610

fbshipit-source-id: 8276a7f6164efec189ca0b87e535543ed5bc3615
  • Loading branch information
Thomas Polasek authored and facebook-github-bot committed Dec 6, 2024
1 parent 0a46735 commit b63e7cc
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 18 deletions.
4 changes: 1 addition & 3 deletions fboss/agent/tools/fboss_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ def list_optics(args):
def list_ports(args):
details = args.details
with get_client(args) as client:
for idx, intf in client.getPortStatus(
list(range(1, 65))
).items(): # noqa: B301 T25377293 Grandfathered in
for idx, intf in client.getPortStatus(list(range(1, 65))).items(): # noqa: B301 T25377293 Grandfathered in
stats = ""
if details:
stats = " (%s)" % client.getPortStats(idx)
Expand Down
8 changes: 4 additions & 4 deletions fboss/lib/bsp/bspmapping/run-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.

"""
Helper script for building and running the BSP Mapping script generation.
Helper script for building and running the BSP Mapping script generation.
This should be run from the root of the FBOSS repository.
This should be run from the root of the FBOSS repository.
Sample invocation:
Sample invocation:
[~/src/fboss-repo]$ ./fboss/lib/bsp/bspmapping/run-helper.py
[~/src/fboss-repo]$ ./fboss/lib/bsp/bspmapping/run-helper.py
"""

import os
Expand Down
1 change: 0 additions & 1 deletion fboss/oss/scripts/package-fboss.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class PackageFboss:
}

def __init__(self):

self.scratch_path = args.scratch_path
self.git_path = os.path.join(
self.scratch_path, "repos/github.com-facebook-fboss.git"
Expand Down
1 change: 0 additions & 1 deletion fboss/py/fboss/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,6 @@ def add_modules(main_func):


if __name__ == "__main__":

# -- Add sub-commands to "Main" -- #
add_modules(main)

Expand Down
3 changes: 0 additions & 3 deletions fboss/py/fboss/cli/commands/aggregate_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


def get_port_num(port: str) -> str:

port_num_match = AGG_PORT_NUM_RE.match(port)
if port_num_match:
return port_num_match.group("port_num")
Expand All @@ -28,7 +27,6 @@ def get_port_num(port: str) -> str:


def _should_print_agg_port_info(target_port_num: str, agg_port) -> bool:

# If there's no target set we print the info for all ports
if not target_port_num:
return True
Expand Down Expand Up @@ -87,7 +85,6 @@ def legacy_format(self, response):
)

def run(self, port):

port_num = get_port_num(port)
if port and not port_num:
print(f"Invalid aggregate port name: {port}")
Expand Down
1 change: 0 additions & 1 deletion fboss/py/fboss/cli/commands/port.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

class PortDetailsCmd(cmds.FbossCmd):
def run(self, ports, show_down=True):

with self._create_agent_client() as client:
try:
resp = client.getAllPortInfo()
Expand Down
1 change: 1 addition & 0 deletions fboss/util/cmis_200g_datapath_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
state. This script identifies all such bad ports on a given list of swicthes
and remediates them by re-applying the optics Stage set 0 config once again
"""

import subprocess
from time import sleep

Expand Down
10 changes: 5 additions & 5 deletions fboss/util/find_sai_spec_symbols_in_fboss.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3

"""
Scan every word in the SAI Spec for all SAI symbols of interest => Set1.
Scan every word in the FBOSS SAI API code for all SAI symbols of interest => Set2.
Print intersection of Set1 and Set2.
Scan every word in the SAI Spec for all SAI symbols of interest => Set1.
Scan every word in the FBOSS SAI API code for all SAI symbols of interest => Set2.
Print intersection of Set1 and Set2.
Sample invocation:
Sample invocation:
fboss/util/find_sai_spec_symbols_in_fboss.py $HOME/local/github/sai.git/inc $HOME/fbsource/fbcode/fboss/agent/hw/sai/api
fboss/util/find_sai_spec_symbols_in_fboss.py $HOME/local/github/sai.git/inc $HOME/fbsource/fbcode/fboss/agent/hw/sai/api
"""

import argparse
Expand Down

0 comments on commit b63e7cc

Please sign in to comment.