Skip to content

Commit

Permalink
chore: change max-line-length to 120
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-olivier committed Dec 13, 2024
1 parent 9510c30 commit 52fb414
Show file tree
Hide file tree
Showing 33 changed files with 4 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ indent-after-paren=4
indent-string=' '

# Maximum number of characters on a single line.
max-line-length=100
max-line-length=120

# Maximum number of lines in a module.
max-module-lines=1000
Expand Down
1 change: 0 additions & 1 deletion src/kili/adapters/kili_api_gateway/event/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def __init__(self, graphql_client: GraphQLClient) -> None:
"""Initialize the paginator."""
self._graphql_client = graphql_client

# pylint: disable=too-many-arguments
def execute_query_from_paginated_call(
self,
query: str,
Expand Down
2 changes: 1 addition & 1 deletion src/kili/adapters/kili_api_gateway/user/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update_user_data_mapper(data: UserDataKiliGatewayInput) -> Dict:
return {
"activated": data.activated,
"apiKey": data.api_key,
# "auth0Id": data.auth0_id, # refused by the backend: only used for service account # noqa: ERA001 # pylint: disable=line-too-long
# "auth0Id": data.auth0_id, # refused by the backend: only used for service account # noqa: ERA001
"email": data.email,
"firstname": data.firstname,
"hasCompletedLabelingTour": data.has_completed_labeling_tour,
Expand Down
2 changes: 1 addition & 1 deletion src/kili/adapters/kili_api_gateway/user/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class UserDataKiliGatewayInput:

activated: Optional[bool] = None
api_key: Optional[str] = None
# auth0_id: Optional[str] = None # refused by the backend: only used for service account # noqa: ERA001 # pylint: disable=line-too-long
# auth0_id: Optional[str] = None # refused by the backend: only used for service account # noqa: ERA001
email: Optional[str] = None
firstname: Optional[str] = None
has_completed_labeling_tour: Optional[bool] = None
Expand Down
1 change: 0 additions & 1 deletion src/kili/core/graphql/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def __call__(
options: QueryOptions,
post_call_function: Optional[Callable] = None,
) -> Generator[Dict, None, None]:
# pylint: disable=line-too-long
"""Get a generator of objects of the specified type in accordance with the provided where."""
fragment = fragment_builder(fields)
query = self.query(fragment)
Expand Down
3 changes: 0 additions & 3 deletions src/kili/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ def format_result(
if isinstance(formatted_json, list):
if get_origin(object_) is list:
obj = get_args(object_)[0]
# pylint: disable=line-too-long
return [obj(element) for element in formatted_json] # pyright: ignore[reportGeneralTypeIssues]
# the legacy "orm" objects fall into this category.
# pylint: disable=line-too-long
return [object_(element) for element in formatted_json] # pyright: ignore[reportGeneralTypeIssues]

return object_(formatted_json)
Expand Down Expand Up @@ -287,7 +285,6 @@ def get_file_paths_to_upload(


def check_file_mime_type(path: str, input_type: str, raise_error=True) -> bool:
# pylint: disable=line-too-long
"""Returns true if the mime type of the file corresponds to the allowed mime types of the project."""
mime_type = get_mime_type(path.lower())

Expand Down
1 change: 0 additions & 1 deletion src/kili/domain/asset/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def check_asset_identifier_arguments(
asset_id_array: Optional[ListOrTuple[AssetId]],
asset_external_id_array: Optional[ListOrTuple[AssetExternalId]],
) -> None:
# pylint: disable=line-too-long
"""Check that a list of assets can be identified either by their asset IDs or their external IDs."""
if asset_id_array is not None:
if asset_external_id_array is not None:
Expand Down
1 change: 0 additions & 1 deletion src/kili/domain/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


@dataclass
# pylint: disable=too-many-instance-attributes
class EventFilters:
"""Event filters for running an event search."""

Expand Down
1 change: 0 additions & 1 deletion src/kili/entrypoints/cli/project/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def export_labels(
with_assets: bool,
normalized_coordinates: Optional[bool],
) -> None:
# pylint: disable=line-too-long
"""Export the Kili labels of a project to a given format.
\b
Expand Down
1 change: 0 additions & 1 deletion src/kili/entrypoints/cli/project/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def check_asset_type(key: str, value: str, http_client: Optional[HttpClient]) ->


def generate_json_metadata(as_frames: bool, fps: Optional[int]):
# pylint: disable=line-too-long
"""Generate the json_metadata for input of the import_assets service when uploading from a list of path.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/entrypoints/cli/project/member/list_.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def list_members(api_key: Optional[str], endpoint: Optional[str], project_id: st
)
)
members = pd.DataFrame(members_list)
# pylint: disable=line-too-long
members = pd.concat([members.drop(["user"], axis=1), members["user"].apply(pd.Series)], axis=1) # type: ignore
members = pd.concat(
[members.drop(["organization"], axis=1), members["organization"].apply(pd.Series)],
Expand Down
1 change: 0 additions & 1 deletion src/kili/entrypoints/mutations/asset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ def assign_assets_to_labelers(
asset_ids: Optional[List[str]] = None,
external_ids: Optional[List[str]] = None,
) -> List[Dict[str, Any]]:
# pylint: disable=line-too-long
"""Assign a list of assets to a list of labelers.
Args:
Expand Down
2 changes: 0 additions & 2 deletions src/kili/entrypoints/mutations/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def update_webhook(

@typechecked
def activate_plugin_on_project(self, plugin_name: str, project_id: str) -> Optional[str]:
# pylint: disable=line-too-long
"""Activates a plugin on a project.
Args:
Expand All @@ -167,7 +166,6 @@ def activate_plugin_on_project(self, plugin_name: str, project_id: str) -> Optio

@typechecked
def deactivate_plugin_on_project(self, plugin_name: str, project_id: str) -> str:
# pylint: disable=line-too-long
"""Activates a plugin on a project.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/entrypoints/queries/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def get_plugin_logs(
limit: int = 100,
skip: int = 0,
) -> str:
# pylint: disable=line-too-long
"""Get paginated logs of a plugin on a project.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/entrypoints/queries/project_user/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ def count_project_users(
"ORG_ADMIN",
),
) -> int:
# pylint: disable=line-too-long
"""Count the number of projects and their users that match a set of criteria.
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/kili/entrypoints/queries/project_version/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def project_version(
Args:
project_id: Filter on Id of project
fields: All the fields to request among the possible fields for the project versions
See [the documentation](https://docs.kili-technology.com/reference/graphql-api#projectVersions) # pylint:disable=line-too-long
See [the documentation](https://docs.kili-technology.com/reference/graphql-api#projectVersions)
for all possible fields.
first: Number of project versions to query
skip: Number of project versions to skip (they are ordered by their date
Expand Down
1 change: 0 additions & 1 deletion src/kili/event/presentation/client/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def list(
until_event_id: Optional[str] = None,
order: Optional[OrderType] = "asc",
) -> List[EventDict]:
# pylint: disable=line-too-long
"""List events of my project.
Args:
Expand Down
8 changes: 0 additions & 8 deletions src/kili/llm/presentation/client/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def export(
label_type_in: Optional[List[LabelType]] = None,
status_in: Optional[List[AssetStatus]] = None,
) -> Optional[List[Dict[str, Union[List[str], str]]]]:
# pylint: disable=line-too-long
"""Returns an export of llm assets with valid labels.
Args:
Expand Down Expand Up @@ -104,7 +103,6 @@ def export(
return None

def create_model(self, organization_id: str, model: dict) -> ModelDict:
# pylint: disable=line-too-long
"""Create a new model in an organization.
Args:
Expand Down Expand Up @@ -157,7 +155,6 @@ def create_model(self, organization_id: str, model: dict) -> ModelDict:
return self.kili_api_gateway.create_model(model=model_input)

def models(self, organization_id: str, fields: Optional[List[str]] = None) -> List[ModelDict]:
# pylint: disable=line-too-long
"""List models in an organization.
Args:
Expand All @@ -178,7 +175,6 @@ def models(self, organization_id: str, fields: Optional[List[str]] = None) -> Li
return list(self.kili_api_gateway.list_models(filters=converted_filters, fields=fields))

def model(self, model_id: str, fields: Optional[List[str]] = None) -> ModelDict:
# pylint: disable=line-too-long
"""Retrieve a specific model.
Args:
Expand All @@ -198,7 +194,6 @@ def model(self, model_id: str, fields: Optional[List[str]] = None) -> ModelDict:
)

def update_properties_in_model(self, model_id: str, model: dict) -> ModelDict:
# pylint: disable=line-too-long
"""Update properties of an existing model.
Args:
Expand Down Expand Up @@ -251,7 +246,6 @@ def update_properties_in_model(self, model_id: str, model: dict) -> ModelDict:
)

def delete_model(self, model_id: str) -> bool:
# pylint: disable=line-too-long
"""Delete a model from an organization.
Args:
Expand All @@ -268,7 +262,6 @@ def delete_model(self, model_id: str) -> bool:
def create_project_model(
self, project_id: str, model_id: str, configuration: dict
) -> ProjectModelDict:
# pylint: disable=line-too-long
"""Associate a model with a project.
Args:
Expand Down Expand Up @@ -365,7 +358,6 @@ def delete_project_model(self, project_model_id: str) -> bool:
def create_conversation(
self, project_id: str, initial_prompt: str, system_prompt: Optional[str] = None
) -> List[ChatItemDict]:
# pylint: disable=line-too-long
"""Create a new conversation in an LLM project starting with a user's prompt.
This method initiates a new conversation in the specified project by:
Expand Down
1 change: 0 additions & 1 deletion src/kili/presentation/client/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ def create_project(
tags: Optional[ListOrTuple[str]] = None,
compliance_tags: Optional[ListOrTuple[ComplianceTag]] = None,
) -> Dict[Literal["id"], str]:
# pylint: disable=line-too-long
"""Create a project.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/presentation/client/question.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def create_questions(
asset_id_array: Optional[ListOrTuple[str]] = None,
asset_external_id_array: Optional[ListOrTuple[str]] = None,
) -> List[Dict[Literal["id"], str]]:
# pylint:disable=line-too-long
"""Create questions.
Args:
Expand Down
3 changes: 0 additions & 3 deletions src/kili/services/asset_import/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ def get_content_type_and_data_from_content(
def get_type_and_data_from_content_array(
self, content_array: List[Optional[Union[str, bytes]]]
) -> List[Tuple[Union[bytes, str], Optional[str]]]:
# pylint:disable=line-too-long
"""Returns the data of the content (path) and its content type for each element in the array."""
return list(map(self.get_content_type_and_data_from_content, content_array))

Expand Down Expand Up @@ -417,7 +416,6 @@ def upload_json_content_to_bucket(self, assets: List[AssetLike]):
["text/plain"] * len(assets),
repeat(self.http_client),
)
# pylint: disable=line-too-long
return [AssetLike(**{**asset, "json_content": url}) for asset, url in zip(assets, url_gen)] # type: ignore

def import_batch(self, assets: List[AssetLike], verify: bool):
Expand Down Expand Up @@ -546,7 +544,6 @@ def filter_local_assets(self, assets: List[AssetLike], raise_error: bool):
if raise_error:
raise
if len(filtered_assets) == 0:
# pylint: disable=line-too-long
raise ImportValidationError(
"""No files to upload. Check that the paths exist and file types are compatible with the project."""
)
Expand Down
1 change: 0 additions & 1 deletion src/kili/services/export/format/kili/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def _save_assets_export(self, assets: List[Dict], output_filename: Path) -> None
self.logger.warning(output_filename)

def _clean_filepaths(self, assets: List[Dict]) -> List[Dict]:
# pylint: disable=line-too-long
"""Remove TemporaryDirectory() prefix from filepaths in "jsonContent" and "content" fields."""
for asset in assets:
if Path(asset["content"]).is_file():
Expand Down
1 change: 0 additions & 1 deletion src/kili/services/label_data_parsing/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def bounding_poly(self) -> BoundingPolyList:
return self._json_data["boundingPoly"]


# pylint: disable=line-too-long
class EntityInPdfAnnotation(_BaseNamedEntityRecognitionAnnotation, _BaseAnnotationWithBoundingPoly):
"""Class for parsing the "annotations" key of a job response for named entities recognition in PDFs."""

Expand Down
1 change: 0 additions & 1 deletion src/kili/services/label_data_parsing/json_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def __init__(
json_response: Dict,
job_names_to_parse: Optional[List[str]] = None,
) -> None:
# pylint: disable=line-too-long
"""Class for label json response parsing.
This class will modify the input json_response.
Expand Down
3 changes: 0 additions & 3 deletions src/kili/services/plugins/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
def check_file_mime_type(
path: Path, compatible_mime_extensions: List[str], verbose: bool = True
) -> bool:
# pylint: disable=line-too-long
"""Returns true if the mime type of the file corresponds to one of compatible_mime_extensions."""
mime_type = get_mime_type(path.as_posix())

Expand Down Expand Up @@ -167,7 +166,6 @@ def __init__(
self.handler_types = None

def _retrieve_plugin_src(self) -> List[Path]:
# pylint: disable=line-too-long
"""Retrieve script from plugin_path and execute it to prevent an upload with indentation errors."""
if self.plugin_path.is_dir():
file_path = self.plugin_path / "main.py"
Expand Down Expand Up @@ -197,7 +195,6 @@ def _retrieve_plugin_src(self) -> List[Path]:
return [file_path]

def _retrieve_requirements(self) -> Union[Path, None]:
# pylint: disable=line-too-long
"""Retrieve script from file_path and execute it to prevent an upload with indentation errors."""
if not self.plugin_path.is_dir():
return None
Expand Down
1 change: 0 additions & 1 deletion src/kili/use_cases/cloud_storage/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def _split_connection_url_into_storage_account_and_container_name(
"""Split the connection url into storage account and container name."""
split_value = ".blob.core.windows.net"
url_connection = urlparse(connection_url)
# pylint: disable=line-too-long
storage_account = url_connection.hostname.split( # pyright: ignore[reportOptionalMemberAccess]
split_value
)[0]
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/labels/geojson/bbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def geojson_polygon_feature_to_kili_bbox_annotation(
children: Optional[Dict] = None,
mid: Optional[str] = None,
) -> Dict[str, Any]:
# pylint: disable=line-too-long
"""Convert a geojson polygon feature to a Kili bounding box annotation.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/labels/geojson/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ def kili_json_response_to_feature_collection(json_response: Dict[str, Any]) -> D
def geojson_feature_collection_to_kili_json_response(
feature_collection: Dict[str, Any],
) -> Dict[str, Any]:
# pylint: disable=line-too-long
"""Convert a Geojson feature collection to a Kili label json response.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/labels/geojson/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def geojson_linestring_feature_to_kili_line_annotation(
children: Optional[Dict] = None,
mid: Optional[str] = None,
) -> Dict[str, Any]:
# pylint: disable=line-too-long
"""Convert a geojson linestring feature to a Kili line annotation.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/labels/geojson/point.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def geojson_point_feature_to_kili_point_annotation(
children: Optional[Dict] = None,
mid: Optional[str] = None,
) -> Dict[str, Any]:
# pylint: disable=line-too-long
"""Convert a geojson point feature to a Kili point annotation.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/labels/geojson/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ def geojson_polygon_feature_to_kili_polygon_annotation(
children: Optional[Dict] = None,
mid: Optional[str] = None,
) -> Dict[str, Any]:
# pylint: disable=line-too-long
"""Convert a geojson polygon feature to a Kili polygon annotation.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/labels/geojson/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ def geojson_polygon_feature_to_kili_segmentation_annotation(
children: Optional[Dict] = None,
mid: Optional[str] = None,
) -> Dict[str, Any]:
# pylint: disable=line-too-long
"""Convert a geojson polygon feature to a Kili segmentation annotation.
Args:
Expand Down
1 change: 0 additions & 1 deletion src/kili/utils/logcontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def __call__(cls, *args, **kwargs):


class LogContext(Dict[str, str], metaclass=Singleton):
# pylint: disable=line-too-long
"""Dict-like singleton that holds the data for the log context, to be passed to the request headers."""

def __init__(self) -> None:
Expand Down

0 comments on commit 52fb414

Please sign in to comment.