Skip to content

Enforce PEP-585 #10594

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

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions assets/scripts/build_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from glob import glob
from io import StringIO
from subprocess import CalledProcessError, CompletedProcess, check_output, run
from typing import TYPE_CHECKING, Dict, Final, List, Optional, Tuple
from typing import TYPE_CHECKING, Final, Optional

import click
import pkg_resources # noqa: TID251 # TODO: switch to importlib.metadata or importlib.resources
Expand Down Expand Up @@ -441,7 +441,7 @@ def combine_backend_results( # noqa: C901 - too complex
json.dump(expectations_info, outfile, indent=4)


def get_contrib_requirements(filepath: str) -> Dict:
def get_contrib_requirements(filepath: str) -> dict:
"""
Parse the python file from filepath to identify a "library_metadata" dictionary in any defined classes, and return a requirements_info object that includes a list of pip-installable requirements for each class that defines them.

Expand Down Expand Up @@ -491,8 +491,8 @@ def build_gallery( # noqa: C901 - 17
ignore_suppress: bool = False,
ignore_only_for: bool = False,
outfile_name: str = "",
only_these_expectations: List[str] | None = None,
only_consider_these_backends: List[str] | None = None,
only_these_expectations: list[str] | None = None,
only_consider_these_backends: list[str] | None = None,
context: Optional[FileDataContext] = None,
) -> None:
"""
Expand Down Expand Up @@ -704,7 +704,7 @@ def format_docstring_to_markdown(docstr: str) -> str: # noqa: C901 - too comple
return clean_docstr


def _disable_progress_bars() -> Tuple[str, FileDataContext]:
def _disable_progress_bars() -> tuple[str, FileDataContext]:
"""Return context_dir and context that was created"""
context_dir = os.path.join( # noqa: PTH118
os.path.sep, "tmp", f"gx-context-{os.getpid()}"
Expand Down
14 changes: 7 additions & 7 deletions assets/scripts/build_package_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json
import logging
import os
from typing import TYPE_CHECKING, List
from typing import TYPE_CHECKING

import pip
from great_expectations_contrib.commands import read_package_from_file, sync_package
Expand All @@ -22,15 +22,15 @@
logger.setLevel(logging.INFO)


def gather_all_contrib_package_paths() -> List[str]:
def gather_all_contrib_package_paths() -> list[str]:
"""Iterate through contrib/ and identify the relative paths to all contrib packages.

A contrib package is defined by the existence of a .great_expectations_package.json file.

Returns:
List of relative paths pointing to contrib packages
"""
package_paths: List[str] = []
package_paths: list[str] = []
for root, _, files in os.walk("contrib/"):
for file in files:
if file == "package_info.yml":
Expand All @@ -40,7 +40,7 @@ def gather_all_contrib_package_paths() -> List[str]:
return package_paths


def gather_all_package_manifests(package_paths: List[str]) -> List[dict]:
def gather_all_package_manifests(package_paths: list[str]) -> list[dict]:
"""Takes a list of relative paths to contrib packages and collects dictionaries to represent package state.

Args:
Expand All @@ -49,7 +49,7 @@ def gather_all_package_manifests(package_paths: List[str]) -> List[dict]:
Returns:
A list of dictionaries that represents contributor package manifests
""" # noqa: E501
payload: List[dict] = []
payload: list[dict] = []
root = os.getcwd() # noqa: PTH109
for path in package_paths:
try:
Expand Down Expand Up @@ -77,14 +77,14 @@ def gather_all_package_manifests(package_paths: List[str]) -> List[dict]:


def _run_pip(stmt: str) -> None:
args: List[str] = stmt.split(" ")
args: list[str] = stmt.split(" ")
if hasattr(pip, "main"):
pip.main(args)
else:
pip._internal.main(args)


def write_results_to_disk(path: str, package_manifests: List[dict]) -> None:
def write_results_to_disk(path: str, package_manifests: list[dict]) -> None:
"""Take the list of package manifests and write to JSON file.

Args:
Expand Down
5 changes: 2 additions & 3 deletions ci/checks/check_integration_test_gets_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import shutil
import subprocess
import sys
from typing import Set

IGNORED_VIOLATIONS = [
# TODO: Add IntegrationTestFixture for these tests or remove them if no longer needed
Expand Down Expand Up @@ -73,7 +72,7 @@ def check_dependencies(*deps: str) -> None:
raise Exception(f"Must have `{dep}` installed in PATH to run {__file__}") # noqa: TRY002, TRY003


def get_test_files(target_dir: pathlib.Path) -> Set[str]:
def get_test_files(target_dir: pathlib.Path) -> set[str]:
try:
res_snippets = subprocess.run( # noqa: PLW1510
[
Expand Down Expand Up @@ -103,7 +102,7 @@ def get_test_files(target_dir: pathlib.Path) -> Set[str]:
) from e


def get_test_files_in_test_suite(target_dir: pathlib.Path) -> Set[str]:
def get_test_files_in_test_suite(target_dir: pathlib.Path) -> set[str]:
try:
res_test_fixtures = subprocess.run( # noqa: PLW1510
[
Expand Down
5 changes: 2 additions & 3 deletions ci/checks/check_name_tag_snippets_referenced.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import shutil
import subprocess
import sys
from typing import List

# TODO: address ignored snippets by deleting snippet or test file, or adding documentation that references them # noqa: E501
IGNORED_VIOLATIONS = [
Expand Down Expand Up @@ -164,7 +163,7 @@ def check_dependencies(*deps: str) -> None:
raise Exception(f"Must have `{dep}` installed in PATH to run {__file__}") # noqa: TRY002, TRY003


def get_snippet_definitions(target_dir: pathlib.Path) -> List[str]:
def get_snippet_definitions(target_dir: pathlib.Path) -> list[str]:
try:
res_snippets = subprocess.run( # noqa: PLW1510
[
Expand Down Expand Up @@ -194,7 +193,7 @@ def get_snippet_definitions(target_dir: pathlib.Path) -> List[str]:
) from e


def get_snippets_used(target_dir: pathlib.Path) -> List[str]:
def get_snippets_used(target_dir: pathlib.Path) -> list[str]:
try:
res_snippet_usages = subprocess.run( # noqa: PLW1510
[
Expand Down
3 changes: 1 addition & 2 deletions ci/checks/check_no_line_number_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import shutil
import subprocess
import sys
from typing import List

ITEMS_IGNORED_FROM_LINE_NUMBER_SNIPPET_CHECKER = {
"docs/prepare_to_build_docs.sh",
Expand All @@ -22,7 +21,7 @@ def check_dependencies(*deps: str) -> None:
raise Exception(f"Must have `{dep}` installed in PATH to run {__file__}") # noqa: TRY002, TRY003


def run_grep(target_dir: pathlib.Path) -> List[str]:
def run_grep(target_dir: pathlib.Path) -> list[str]:
try:
res = subprocess.run( # noqa: PLW1510
[
Expand Down
3 changes: 1 addition & 2 deletions ci/checks/check_only_name_tag_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import shutil
import subprocess
import sys
from typing import List

ITEMS_IGNORED_FROM_NAME_TAG_SNIPPET_CHECKER = {
"docs/docusaurus/docs/components/connect_to_data/cloud/_abs_fluent_data_asset_config_keys.mdx",
Expand All @@ -54,7 +53,7 @@ def check_dependencies(*deps: str) -> None:
raise Exception(f"Must have `{dep}` installed in PATH to run {__file__}") # noqa: TRY002, TRY003


def run_grep(target_dir: pathlib.Path) -> List[str]:
def run_grep(target_dir: pathlib.Path) -> list[str]:
try:
res_positive = subprocess.run( # noqa: PLW1510
[
Expand Down
3 changes: 1 addition & 2 deletions ci/checks/validate_docs_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import subprocess
import sys
import tempfile
from typing import List


def check_dependencies(*deps: str) -> None:
Expand All @@ -32,7 +31,7 @@ def run_docusaurus_build(target_dir: str) -> None:
)


def run_grep(target_dir: str) -> List[str]:
def run_grep(target_dir: str) -> list[str]:
try:
res = subprocess.run( # noqa: PLW1510
[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import os
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -36,10 +36,10 @@ class DataProfilerProfileNumericColumnsDiffBetweenThresholdRange(DataProfilerPro
def _pandas( # noqa: C901 - too complex
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_diff = metrics.get("data_profiler.profile_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import os
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -38,10 +38,10 @@ class DataProfilerProfileNumericColumnsDiffBetweenInclusiveThresholdRange(
def _pandas( # noqa: C901 - too complex
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_diff = metrics.get("data_profiler.profile_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import os
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -38,10 +38,10 @@ class DataProfilerProfileNumericColumnsDiffGreaterThanOrEqualToThreshold(
def _pandas( # noqa: C901 - too complex
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_diff = metrics.get("data_profiler.profile_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import os
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -36,10 +36,10 @@ class DataProfilerProfileNumericColumnsDiffGreaterThanThreshold(DataProfilerProf
def _pandas( # noqa: C901 - too complex
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_diff = metrics.get("data_profiler.profile_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import os
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -38,10 +38,10 @@ class DataProfilerProfileNumericColumnsDiffLessThanOrEqualToThreshold(
def _pandas( # noqa: C901 - too complex
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_diff = metrics.get("data_profiler.profile_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import copy
import os
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -36,10 +36,10 @@ class DataProfilerProfileNumericColumnsDiffLessThanThreshold(DataProfilerProfile
def _pandas( # noqa: C901 - too complex
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_diff = metrics.get("data_profiler.profile_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import os
import warnings
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -40,10 +40,10 @@ class DataProfilerProfileNumericColumnsPercentDiffBetweenThresholdRange(
def _pandas( # noqa: C901 - 22
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_percent_diff = metrics.get("data_profiler.profile_percent_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import os
import warnings
from typing import Any, Dict, Optional
from typing import Any, Optional

import dataprofiler as dp
import pandas as pd
Expand Down Expand Up @@ -42,10 +42,10 @@ class DataProfilerProfileNumericColumnsPercentDiffBetweenInclusiveThresholdRange
def _pandas( # noqa: C901 - 22
cls,
execution_engine: PandasExecutionEngine,
metric_domain_kwargs: Dict,
metric_value_kwargs: Dict,
metrics: Dict[str, Any],
runtime_configuration: Dict,
metric_domain_kwargs: dict,
metric_value_kwargs: dict,
metrics: dict[str, Any],
runtime_configuration: dict,
):
profile_percent_diff = metrics.get("data_profiler.profile_percent_diff")
numeric_columns = metrics.get("data_profiler.profile_numeric_columns")
Expand Down
Loading
Loading