Skip to content
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
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ repos:
hooks:
- id: formatting
name: "isort and black"
exclude: ^(tests/conftest.py)
exclude: ^tests/conftest\.py$
entry: bash -c '(isort "$@" && black "$@") || true; git add -u' --
language: system
types: [python]
stages: [commit]
stages: [pre-commit]

- repo: local
hooks:
Expand All @@ -28,16 +28,16 @@ repos:
entry: pylint
language: system
types: [python]
stages: [commit]
stages: [pre-commit]

- repo: local
hooks:
- id: pydocstyle
name: pydocstyle
exclude: ^(tests/.*|demo/*)
exclude: ^(tests/.*|demo/.*)$
language: system
entry: pydocstyle
stages: [commit]
stages: [pre-commit]

- repo: local
hooks:
Expand All @@ -46,7 +46,7 @@ repos:
entry: flake8
language: system
types: [python]
stages: [commit]
stages: [pre-commit]

- repo: local
hooks:
Expand All @@ -56,24 +56,24 @@ repos:
entry: yamllint
language: python
types: [file, yaml]
stages: [commit]
stages: [pre-commit]

- repo: local
hooks:
- id: pytest-check
name: pytest-check-src
entry: python -m pytest tests --cov=dynamicio --cov-report=html --cov-report=xml -v
exclude: ^(.github|.circleci|docs|.flake8|.gitlint|.pylintrc|.docs.Dockerfile|README.md|Makefile|setup.py)
exclude: ^(\.github|\.circleci|docs|\.flake8|\.gitlint|\.pylintrc|\.docs\.Dockerfile|README\.md|Makefile|setup\.py)$
language: system
pass_filenames: false
stages: [commit]
stages: [pre-commit]

- repo: local
hooks:
- id: pytest-check
name: pytest-check-demo
entry: python -m pytest demo/tests
exclude: ^(.github|.circleci|docs|.flake8|.gitlint|.pylintrc|.docs.Dockerfile|README.md|Makefile|setup.py)
exclude: ^(\.github|\.circleci|docs|\.flake8|\.gitlint|\.pylintrc|\.docs\.Dockerfile|README\.md|Makefile|setup\.py)$
language: system
pass_filenames: false
stages: [commit]
stages: [pre-commit]
6 changes: 2 additions & 4 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,8 @@ preferred-modules=


[EXCEPTIONS]

# Exceptions that will emit a warning when caught.
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception


[REFACTORING]
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dev-env-setup: install-poetry install-binary-packages-Darwin
@pyenv exec poetry self add poetry-pre-commit-plugin
@pyenv exec poetry run pre-commit install
@pyenv exec poetry run pre-commit install --hook-type commit-msg
@pyenv exec poetry run pre-commit migrate-config

# Checks for local development
check-linting:
Expand Down
1 change: 1 addition & 0 deletions dynamicio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A package for wrapping your I/O operations."""

# pylint: disable=abstract-method
import os
from contextlib import suppress
Expand Down
2 changes: 2 additions & 0 deletions dynamicio/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""Invokes dynamicio cli."""

# Application Imports
from dynamicio.cli import run

run()
2 changes: 2 additions & 0 deletions dynamicio/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implements the dynamicio Command Line Interface (CLI)."""

import argparse
import glob
import os
Expand All @@ -8,6 +9,7 @@
import pandas as pd # type: ignore
import yaml

# Application Imports
from dynamicio.errors import InvalidDatasetTypeError


Expand Down
2 changes: 2 additions & 0 deletions dynamicio/config/io_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
}
}
"""

__all__ = ["IOConfig", "SafeDynamicResourceLoader", "SafeDynamicSchemaLoader"]

import re
Expand All @@ -62,6 +63,7 @@
import yaml
from magic_logger import logger

# Application Imports
from dynamicio.config.pydantic import BindingsYaml, IOEnvironment


Expand Down
3 changes: 2 additions & 1 deletion dynamicio/config/pydantic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"""Pydantic config models."""

# Application Imports
from dynamicio.config.pydantic.config import BindingsYaml
from dynamicio.config.pydantic.io_resources import (
AthenaDataEnvironment,
IOEnvironment,
KafkaDataEnvironment,
LocalBatchDataEnvironment,
LocalDataEnvironment,
PostgresDataEnvironment,
S3DataEnvironment,
S3PathPrefixEnvironment,
AthenaDataEnvironment
)
from dynamicio.config.pydantic.table_schema import DataframeSchema, SchemaColumn
9 changes: 6 additions & 3 deletions dynamicio/config/pydantic/config.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"""Pydantic schema for YAML files."""

# pylint: disable=no-member, no-self-argument, unused-argument
"""Pydantic schema for YAML files"""

from typing import Mapping, MutableMapping

import pydantic

# Application Imports
import dynamicio.config.pydantic.io_resources as env_spec


Expand All @@ -21,14 +23,15 @@ def _validate_bindings(cls, value: Mapping):
if not isinstance(value, Mapping):
raise ValueError(f"Bindings must be a mapping. (got {value!r} instead).")
# Tell each binding its name
for (name, sub_config) in value.items():
for name, sub_config in value.items():
if not isinstance(sub_config, MutableMapping):
raise ValueError(f"Each element for the name binding must be a dict. (got {sub_config!r} instead)")
sub_config["__binding_name__"] = name
return value

def update_config_refs(self) -> "BindingsYaml":
"""Updates dynamic parts of the config:
"""Updates dynamic parts of the config.

- Configure _parent for all `IOEnvironment`s
- Replace all IOSchemaRef with actual schema objects
"""
Expand Down
4 changes: 2 additions & 2 deletions dynamicio/config/pydantic/io_resources.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pylint: disable=no-member, no-self-argument, unused-argument

"""This module contains pylint models for physical data sources (places the bytes are being read from)."""

# pylint: disable=no-member, no-self-argument, unused-argument, broad-exception-raised

import enum
import posixpath
from typing import Mapping, Optional, Union
Expand Down
9 changes: 5 additions & 4 deletions dynamicio/config/pydantic/table_schema.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""This module defines Config schema for data source (pandas dataframe)."""

# pylint: disable=no-member, no-self-argument, unused-argument

"""This module defines Config schema for data source (pandas dataframe)"""

import enum
from typing import Mapping, Sequence
Expand Down Expand Up @@ -51,11 +52,11 @@ def is_valid_pandas_type(cls, info):

@pydantic.validator("validations", pre=True)
def remap_validations(cls, info):
"""Remap the yaml structure of {validation_type: <params>} to a list with validation_type as a key"""
"""Remap the yaml structure of {validation_type: <params>} to a list with validation_type as a key."""
if not isinstance(info, dict):
raise ValueError(f"{info!r} should be a dict")
out = []
for (key, params) in info.items():
for key, params in info.items():
new_el = params.copy()
new_el.update({"name": key})
out.append(new_el)
Expand All @@ -79,7 +80,7 @@ class DataframeSchema(pydantic.BaseModel):

@pydantic.validator("columns", pre=True)
def supply_column_names(cls, info):
"""Tell each column its name (the key it is listed under)"""
"""Tell each column its name (the key it is listed under)."""
if not isinstance(info, Mapping):
raise ValueError(f"{info!r} shoudl be a dict.")

Expand Down
5 changes: 3 additions & 2 deletions dynamicio/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Implements the DynamicDataIO class which provides functionality for data: loading; sinking, and; schema validation."""
# pylint: disable=no-member

# pylint: disable=too-many-positional-arguments, disable=no-member
__all__ = ["DynamicDataIO", "SCHEMA_FROM_FILE", "CASTING_WARNING_MSG"]

import asyncio
Expand Down Expand Up @@ -100,7 +101,7 @@ def _schema_from_obj(target) -> DataframeSchema:
- CAN have `schema_validations` and `schema_metrics` attributes
"""
col_info = {}
for (col_name, dtype) in target.schema.items():
for col_name, dtype in target.schema.items():
col_validations = {}
col_metrics = []
try:
Expand Down
1 change: 1 addition & 0 deletions dynamicio/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Hosts exception implementations for different errors."""

# pylint: disable=missing-module-docstring, missing-class-docstring, missing-function-docstring, super-init-not-called
__all__ = [
"DynamicIOError",
Expand Down
1 change: 1 addition & 0 deletions dynamicio/metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A module responsible for metrics generation and logging."""

# pylint: disable=missing-function-docstring,missing-class-docstring
import json
import logging
Expand Down
1 change: 1 addition & 0 deletions dynamicio/mixins/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mixin utility functions."""

# pylint: disable=no-member, protected-access, too-few-public-methods

import inspect
Expand Down
3 changes: 2 additions & 1 deletion dynamicio/mixins/with_kafka.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""This module provides mixins that are providing Kafka I/O support."""
# pylint: disable=no-member, protected-access, too-few-public-methods

# pylint: disable=no-member, protected-access, too-few-public-methods, broad-exception-raised

from typing import Any, Callable, Mapping, MutableMapping, Optional

Expand Down
Loading