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

[ruff] 0.5.5 -> 0.8.4 #26666

Merged
merged 2 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,8 @@ class ConfigurableDocumenter(DataDocumenter):
def can_document_member(
cls, member: Any, _membername: str, _isattr: bool, _parent: Any
) -> bool:
return (
isinstance(member, ConfigurableDefinition)
or isinstance(member, type)
and issubclass(member, ConfigurableClass)
return isinstance(member, ConfigurableDefinition) or (
isinstance(member, type) and issubclass(member, ConfigurableClass)
)

def add_content(self, more_content) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,7 @@ def _helm_chart_helper(
if (
dagster_user_deployments_values.get("enabled")
and dagster_user_deployments_values.get("enableSubchart")
or release_name == "dagster"
):
) or release_name == "dagster":
# Wait for user code deployments to be ready
print("Waiting for user code deployments")
pods = api_client.core_api.list_namespaced_pod(namespace=namespace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ def within_docker():
from: https://stackoverflow.com/a/48710609/11295366
"""
cgroup_path = "/proc/self/cgroup"
return (
os.path.exists("/.dockerenv")
or os.path.isfile(cgroup_path)
return os.path.exists("/.dockerenv") or (
os.path.isfile(cgroup_path)
and any("docker" in line for line in open(cgroup_path, encoding="utf8"))
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extend-exclude = [
line-length = 100

# Fail if Ruff is not running this version.
required-version = "0.5.5"
required-version = "0.8.4"

[tool.ruff.lint]

Expand Down
2 changes: 1 addition & 1 deletion python_modules/dagster/dagster/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@
# from dagster.some.module import (
# Foo as Foo,
# )
pass # noqa: TCH005
pass # noqa: TC005


_DEPRECATED: Final[Mapping[str, TypingTuple[str, str, str]]] = {
Expand Down
6 changes: 3 additions & 3 deletions python_modules/dagster/dagster/_check/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def is_callable(obj: T_Callable, additional_message: Optional[str] = None) -> T_
if not callable(obj):
raise CheckError(
"Must be callable. Got"
f" {obj}.{additional_message and f' Description: {additional_message}.' or ''}"
f" {obj}.{(additional_message and f' Description: {additional_message}.') or ''}"
)
return obj

Expand Down Expand Up @@ -1788,8 +1788,8 @@ def _param_class_mismatch_exception(
additional_message: Optional[str] = None,
) -> ParameterCheckError:
additional_message = " " + additional_message if additional_message else ""
opt_clause = optional and "be None or" or ""
subclass_clause = superclass and f"that inherits from {superclass.__name__}" or ""
opt_clause = (optional and "be None or") or ""
subclass_clause = (superclass and f"that inherits from {superclass.__name__}") or ""
return ParameterCheckError(
f'Param "{param_name}" must {opt_clause}be a class{subclass_clause}. Got {obj!r} of'
f" type {type(obj)}.{additional_message}"
Expand Down
4 changes: 2 additions & 2 deletions python_modules/dagster/dagster/_cli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ def grpc_command(
raise click.UsageError(
"You must pass a valid --port/-p on Windows: --socket/-s not supported."
)
if not (port or socket and not (port and socket)):
if not (port or (socket and not (port and socket))):
raise click.UsageError("You must pass one and only one of --port/-p or --socket/-s.")

setup_interrupt_handlers()
Expand Down Expand Up @@ -871,7 +871,7 @@ def grpc_health_check_command(
raise click.UsageError(
"You must pass a valid --port/-p on Windows: --socket/-s not supported."
)
if not (port or socket and not (port and socket)):
if not (port or (socket and not (port and socket))):
raise click.UsageError("You must pass one and only one of --port/-p or --socket/-s.")

client = DagsterGrpcClient(port=port, socket=socket, host=host, use_ssl=use_ssl)
Expand Down
2 changes: 1 addition & 1 deletion python_modules/dagster/dagster/_cli/code_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def start_command(
raise click.UsageError(
"You must pass a valid --port/-p on Windows: --socket/-s not supported."
)
if not (port or socket and not (port and socket)):
if not (port or (socket and not (port and socket))):
raise click.UsageError("You must pass one and only one of --port/-p or --socket/-s.")

setup_interrupt_handlers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def for_nullable_inner_type(self) -> "ValidationContext":


class TraversalContext(ContextData):
__slots__ = ["_config_type", "_traversal_type", "_all_config_types"]
__slots__ = ["_all_config_types", "_config_type", "_traversal_type"]

def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ def the_schedule(context: ScheduleEvaluationContext):
"""

__slots__ = [
"_instance_ref",
"_scheduled_execution_time",
"_cm_scope_entered",
"_exit_stack",
"_instance",
"_instance_ref",
"_log_key",
"_logger",
"_repository_def",
"_repository_name",
"_resource_defs",
"_schedule_name",
"_resources_cm",
"_resources",
"_cm_scope_entered",
"_repository_def",
"_resources_cm",
"_schedule_name",
"_scheduled_execution_time",
]

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1585,8 +1585,7 @@ def can_run_with_parent(
# checks if there is a simple partition mapping between the parent and the child
has_identity_partition_mapping = (
# both unpartitioned
not candidate_node.is_partitioned
and not parent_node.is_partitioned
(not candidate_node.is_partitioned and not parent_node.is_partitioned)
# normal identity partition mapping
or isinstance(partition_mapping, IdentityPartitionMapping)
# for assets with the same time partitions definition, a non-offset partition
Expand Down
2 changes: 1 addition & 1 deletion python_modules/dagster/dagster/_serdes/serdes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,9 @@ class _LazySerializationWrapper(dict):
"""

__slots__ = [
"_descent_path",
"_obj",
"_whitelist_map",
"_descent_path",
]

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,8 @@ def dynamic_with_transitive_optional_output_job():
@op(out=Out(is_required=False))
def add_one_with_optional_output(context, i: int):
if (
context.run.parent_run_id
and i % 2 == 0 # re-execution run skipped odd numbers
or not context.run.parent_run_id
and i % 2 == 1 # root run skipped even numbers
(context.run.parent_run_id and i % 2 == 0) # re-execution run skipped odd numbers
or (not context.run.parent_run_id and i % 2 == 1) # root run skipped even numbers
):
yield Output(i + 1)

Expand Down
2 changes: 1 addition & 1 deletion python_modules/dagster/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def get_version() -> str:
"types-toml", # version will be resolved against toml
],
"ruff": [
"ruff==0.5.5",
"ruff==0.8.4",
],
},
entry_points={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
DagsterLibraryRegistry.register("dagster-airflow", __version__)

__all__ = [
"make_dagster_definitions_from_airflow_dags_path",
"DagsterCloudOperator",
"DagsterHook",
"DagsterLink",
"DagsterOperator",
"load_assets_from_airflow_dag",
"make_dagster_definitions_from_airflow_dag_bag",
"make_schedules_and_jobs_from_airflow_dag_bag",
"make_dagster_definitions_from_airflow_dags_path",
"make_dagster_job_from_airflow_dag",
"load_assets_from_airflow_dag",
"make_ephemeral_airflow_db_resource",
"make_persistent_airflow_db_resource",
"DagsterHook",
"DagsterLink",
"DagsterOperator",
"DagsterCloudOperator",
"make_schedules_and_jobs_from_airflow_dag_bag",
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
)

__all__ = [
"PipesGlueClient",
"PipesLambdaClient",
"PipesCloudWatchLogReader",
"PipesCloudWatchMessageReader",
"PipesECSClient",
"PipesEMRClient",
"PipesS3ContextInjector",
"PipesEMRServerlessClient",
"PipesGlueClient",
"PipesLambdaClient",
"PipesLambdaEventContextInjector",
"PipesS3MessageReader",
"PipesS3LogReader",
"PipesLambdaLogsMessageReader",
"PipesCloudWatchLogReader",
"PipesCloudWatchMessageReader",
"PipesEMRServerlessClient",
"PipesS3ContextInjector",
"PipesS3LogReader",
"PipesS3MessageReader",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from dagster_aws.pipes.clients.lambda_ import PipesLambdaClient

__all__ = [
"PipesGlueClient",
"PipesLambdaClient",
"PipesECSClient",
"PipesEMRServerlessClient",
"PipesEMRClient",
"PipesEMRServerlessClient",
"PipesGlueClient",
"PipesLambdaClient",
]
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ def create_adls2_client(storage_account: str, credential) -> DataLakeServiceClie
return DataLakeServiceClient(account_url, credential)


__all__ = ["create_adls2_client", "DataLakeServiceClient", "ResourceNotFoundError"]
__all__ = ["DataLakeServiceClient", "ResourceNotFoundError", "create_adls2_client"]
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ def create_blob_client(storage_account, credential) -> BlobServiceClient:
return BlobServiceClient(account_url, credential)


__all__ = ["create_blob_client", "generate_blob_sas", "BlobServiceClient", "ResourceNotFoundError"]
__all__ = ["BlobServiceClient", "ResourceNotFoundError", "create_blob_client", "generate_blob_sas"]
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
DagsterLibraryRegistry.register("dagster-census", __version__)

__all__ = [
"CensusResource",
"CensusOutput",
"CensusResource",
"census_resource",
"census_trigger_sync_op",
]
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,8 @@ def _assert_valid_credentials_combos(
azure_tenant_id: Optional[str] = None,
):
"""Ensure that all required credentials are provided for the given auth type."""
if (
oauth_client_id
and not oauth_client_secret
or oauth_client_secret
and not oauth_client_id
if (oauth_client_id and not oauth_client_secret) or (
oauth_client_secret and not oauth_client_id
):
raise ValueError(
"If using databricks service principal oauth credentials, both oauth_client_id and"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

DagsterLibraryRegistry.register("dagster-datadog", __version__)

__all__ = ["datadog_resource", "DatadogResource"]
__all__ = ["DatadogResource", "datadog_resource"]
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
DagsterLibraryRegistry.register("dagster-datahub", __version__)

__all__ = [
"datahub_rest_emitter",
"datahub_kafka_emitter",
"DatahubKafkaEmitterResource",
"DatahubConnection",
"DatahubKafkaEmitterResource",
"DatahubRESTEmitterResource",
"datahub_kafka_emitter",
"datahub_rest_emitter",
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from dagster_embedded_elt.dlt.resource import DagsterDltResource
from dagster_embedded_elt.dlt.translator import DagsterDltTranslator

__all__ = ["dlt_assets", "build_dlt_asset_specs", "DagsterDltTranslator", "DagsterDltResource"]
__all__ = ["DagsterDltResource", "DagsterDltTranslator", "build_dlt_asset_specs", "dlt_assets"]
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from dagster_embedded_elt.sling.sling_replication import SlingReplicationParam

__all__ = [
"SlingResource",
"SlingMode",
"sling_assets",
"DagsterSlingTranslator",
"SlingReplicationParam",
"SlingConnectionResource",
"SlingMode",
"SlingReplicationParam",
"SlingResource",
"sling_assets",
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

DagsterLibraryRegistry.register("dagster-github", __version__)

__all__ = ["github_resource", "GithubResource"]
__all__ = ["GithubResource", "github_resource"]
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

DagsterLibraryRegistry.register("dagster-mlflow", __version__)

__all__ = ["mlflow_tracking", "end_mlflow_on_run_finished"]
__all__ = ["end_mlflow_on_run_finished", "mlflow_tracking"]
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@
DagsterLibraryRegistry.register("dagster-pandas", __version__)

__all__ = [
"DataFrame",
"create_dagster_pandas_dataframe_type",
"create_structured_dataframe_type",
"PandasColumn",
"ColumnWithMetadataException",
"ConstraintWithMetadata",
"ConstraintWithMetadataException",
"DataFrame",
"MultiAggregateConstraintWithMetadata",
"MultiColumnConstraintWithMetadata",
"ConstraintWithMetadata",
"MultiConstraintWithMetadata",
"PandasColumn",
"RowCountConstraint",
"StrictColumnsConstraint",
"StrictColumnsWithMetadata",
"all_unique_validator",
"categorical_column_validator_factory",
"column_range_validation_factory",
"create_dagster_pandas_dataframe_type",
"create_structured_dataframe_type",
"dtype_in_set_validation_factory",
"nonnull",
"non_null_validation",
"categorical_column_validator_factory",
"nonnull",
]
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# NOTE: It is important NOT to import `pandera.polars` under the same pa_polars alias we use for
# the runtime import above-- that will confuse type checkers because that alias is a variable
# due to the runtime ImportError handling.
import pandera.polars # noqa: TCH004
import pandera.polars # noqa: TC004

DagsterPanderaSchema: TypeAlias = Union[pa.DataFrameSchema, "pandera.polars.DataFrameSchema"]
DagsterPanderaSchemaModel: TypeAlias = Type[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
from dagster_polars.version import __version__

__all__ = [
"PolarsParquetIOManager",
"BasePolarsUPathIOManager",
"DataFramePartitions",
"LazyFramePartitions",
"PolarsParquetIOManager",
"__version__",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from dagster_polars.io_managers.parquet import PolarsParquetIOManager

__all__ = [
"PolarsParquetIOManager",
"BasePolarsUPathIOManager",
"PolarsParquetIOManager",
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

DagsterLibraryRegistry.register("dagster-prometheus", __version__)

__all__ = ["prometheus_resource", "PrometheusResource"]
__all__ = ["PrometheusResource", "prometheus_resource"]
Loading
Loading