This repository was archived by the owner on May 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 283
Convert to attrs
, remove runtype
#720
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7a7b88e
Convert class-level constants to properties for attrs compatibility
5b95ce7
Convert source_table & schema to overridable properties for attrs com…
22e8ff2
Clarify optional (nullable) fields: explicit is better than implicit
8f8b844
Convert all runtypes to attrs
c8b1989
Convert the remaining classes to attrs
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
from abc import ABC | ||
|
||
import attrs | ||
|
||
|
||
@attrs.define | ||
class AbstractCompiler(ABC): | ||
pass | ||
|
||
|
||
@attrs.define(eq=False) | ||
class Compilable(ABC): | ||
pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -3,10 +3,11 @@ | |||||||
from itertools import zip_longest | ||||||||
from contextlib import suppress | ||||||||
import weakref | ||||||||
|
||||||||
import attrs | ||||||||
import dsnparse | ||||||||
import toml | ||||||||
|
||||||||
from runtype import dataclass | ||||||||
from typing_extensions import Self | ||||||||
|
||||||||
from data_diff.databases.base import Database, ThreadedDatabase | ||||||||
|
@@ -25,7 +26,7 @@ | |||||||
from data_diff.databases.mssql import MsSQL | ||||||||
|
||||||||
|
||||||||
@dataclass | ||||||||
@attrs.define | ||||||||
class MatchUriPath: | ||||||||
database_cls: Type[Database] | ||||||||
|
||||||||
|
@@ -92,8 +93,11 @@ def match_path(self, dsn): | |||||||
} | ||||||||
|
||||||||
|
||||||||
@attrs.define(init=False) | ||||||||
class Connect: | ||||||||
"""Provides methods for connecting to a supported database using a URL or connection dict.""" | ||||||||
database_by_scheme: Dict[str, Database] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [blackfmt] reported by reviewdog 🐶
Suggested change
|
||||||||
match_uri_path: Dict[str, MatchUriPath] | ||||||||
conn_cache: MutableMapping[Hashable, Database] | ||||||||
|
||||||||
def __init__(self, database_by_scheme: Dict[str, Database] = DATABASE_BY_SCHEME): | ||||||||
|
@@ -283,6 +287,7 @@ def __make_cache_key(self, db_conf: Union[str, dict]) -> Hashable: | |||||||
return db_conf | ||||||||
|
||||||||
|
||||||||
@attrs.define(init=False) | ||||||||
class Connect_SetUTC(Connect): | ||||||||
"""Provides methods for connecting to a supported database using a URL or connection dict. | ||||||||
|
||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[blackfmt] reported by reviewdog 🐶