Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Format code (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-iskw authored May 9, 2023
1 parent f456037 commit 853f6be
Show file tree
Hide file tree
Showing 53 changed files with 92 additions and 83 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ setup-python:
setup-pre-commit:
pre-commit install

lint: lint-python
lint:
pre-commit run --all-files

lint-python:
bash ci/lint_python.sh
Expand Down
27 changes: 12 additions & 15 deletions dbt_artifacts_loader/api/rest_api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,25 @@
#
#
import base64
import datetime
import json
from functools import lru_cache
from typing import Optional, Union, List
import datetime

from fastapi import FastAPI, Depends, HTTPException
# pylint: disable=E0611
from pydantic import BaseModel
from pydantic import Field
from typing import List, Optional, Union

from fastapi import Depends, FastAPI, HTTPException
from google.cloud import bigquery
# pylint: disable=E0611
from pydantic import BaseModel, Field

from dbt_artifacts_loader.api import config
from dbt_artifacts_loader.dbt.utils import (get_artifact_type_by_id,
get_dbt_schema_version,
get_default_load_job_config,
get_destination_table,
get_model_class,
load_table_from_json)
from dbt_artifacts_loader.dbt.version_map import ArtifactsTypes
from dbt_artifacts_loader.utils import download_gcs_object_as_text
from dbt_artifacts_loader.dbt.utils import (
get_dbt_schema_version,
get_default_load_job_config,
load_table_from_json,
get_artifact_type_by_id,
get_destination_table,
get_model_class)
from dbt_artifacts_loader.api import config

app = FastAPI()

Expand Down
13 changes: 6 additions & 7 deletions dbt_artifacts_loader/dbt/base_bigquery_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import typing
import json
from enum import Enum
from typing import Dict, Any, Optional, Union, List
import datetime
from datetime import date, datetime
import inspect
import json
import typing
from datetime import date, datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union

# pylint: disable=E0611
import typing_extensions
from google.cloud import bigquery
from pydantic import BaseModel
from pydantic.fields import ModelField

from google.cloud import bigquery


def datetime_handler(x):
"""The handler is used to deal with date and datetime"""
Expand Down
6 changes: 4 additions & 2 deletions dbt_artifacts_loader/dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
# limitations under the License.
#
#
from typing import Optional, List, Type
from typing import List, Optional, Type

from google.cloud import bigquery

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from dbt_artifacts_loader.dbt.version_map import ArtifactsTypes, ARTIFACT_INFO, DestinationTables
from dbt_artifacts_loader.dbt.version_map import (ARTIFACT_INFO,
ArtifactsTypes,
DestinationTables)


def get_dbt_schema_version(artifact_json: dict) -> str:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v1/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
from datetime import datetime
from typing import Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class CatalogMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v1/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v1/run_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class BaseArtifactMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v1/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class FreshnessMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v2/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v2/run_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class BaseArtifactMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v2/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class FreshnessMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v3/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v3/run_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class BaseArtifactMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v3/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class FreshnessMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v4/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v4/run_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class BaseArtifactMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v5/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v6/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v7/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v8/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
3 changes: 2 additions & 1 deletion dbt_artifacts_loader/dbt/v9/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel
from pydantic import Extra, Field, constr

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel


class ManifestMetadata(BaseBigQueryModel):
class Config:
Expand Down
5 changes: 2 additions & 3 deletions dbt_artifacts_loader/dbt/version_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from typing import Type
from enum import Enum
from dataclasses import dataclass
from enum import Enum
from typing import Type

from dbt_artifacts_loader.dbt.base_bigquery_model import BaseBigQueryModel

# v1
from dbt_artifacts_loader.dbt.v1.catalog import CatalogV1
from dbt_artifacts_loader.dbt.v1.manifest import ManifestV1
Expand Down
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v2/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/sources/v2.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v3/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5222,4 +5222,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/manifest/v3.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v3/run-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/run-results/v3.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v3/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/sources/v3.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v4/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5936,4 +5936,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/manifest/v4.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v4/run-results.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/run-results/v4.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v5/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5981,4 +5981,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/manifest/v5.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v6/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6206,4 +6206,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/manifest/v6.json"
}
}
2 changes: 1 addition & 1 deletion dbt_artifacts_loader/resources/v7/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6566,4 +6566,4 @@
},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://schemas.getdbt.com/dbt/manifest/v7.json"
}
}
Loading

0 comments on commit 853f6be

Please sign in to comment.