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

Fix flake8 failures #8256

Merged
merged 1 commit into from
Jul 31, 2023
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
2 changes: 1 addition & 1 deletion core/dbt/clients/agate_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Number(agate.data_types.Number):
# undo the change in https://github.com/wireservice/agate/pull/733
# i.e. do not cast True and False to numeric 1 and 0
def cast(self, d):
if type(d) == bool:
if type(d) == bool: # noqa: E721
raise agate.exceptions.CastError(
'Do not cast True to 1 or False to 0.'
)
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/contracts/graph/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def find_macro_by_name(
"""
filter: Optional[Callable[[MacroCandidate], bool]] = None
if package is not None:
def filter(candidate: MacroCandidate) -> bool:
def filter(candidate: MacroCandidate) -> bool: # noqa: F811
return package == candidate.macro.package_name

candidates: CandidateList = self._find_macros_by_name(
Expand Down
4 changes: 2 additions & 2 deletions core/dbt/events/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def create_info_text_log_line(e: T_Event, msg_fn: Callable[[T_Event], str]) -> s
def create_debug_text_log_line(e: T_Event, msg_fn: Callable[[T_Event], str]) -> str:
log_line: str = ''
# Create a separator if this is the beginning of an invocation
if type(e) == MainReportVersion:
if type(e) == MainReportVersion: # noqa: E721
separator = 30 * '='
log_line = f'\n\n{separator} {e.get_ts()} | {get_invocation_id()} {separator}\n'
color_tag: str = '' if this.format_color else Style.RESET_ALL
Expand All @@ -212,7 +212,7 @@ def create_debug_text_log_line(e: T_Event, msg_fn: Callable[[T_Event], str]) ->
# translates an Event to a completely formatted json log line
# you have to specify which message you want. (i.e. - e.message(), e.cli_msg(), e.file_msg())
def create_json_log_line(e: T_Event, msg_fn: Callable[[T_Event], str]) -> Optional[str]:
if type(e) == EmptyLine:
if type(e) == EmptyLine: # noqa: E721
return None # will not be sent to logger
# using preformatted string instead of formatting it here to be extra careful about timezone
values = event_to_serializable_dict(e, lambda _: e.get_ts_rfc3339(), lambda x: msg_fn(x))
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/events/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def message(self) -> str:
def asdict(cls, data: list) -> dict:
d = dict()
for k, v in data:
if type(v) == list:
if type(v) == list: # noqa: E721
d[k] = [str(x) for x in v]
return d

Expand Down
4 changes: 2 additions & 2 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ def create_test_node(
def get_hashable_md(
data: Union[str, int, float, List, Dict]
) -> Union[str, List, Dict]:
if type(data) == dict:
if type(data) == dict: # noqa: E721
return {k: get_hashable_md(data[k]) for k in sorted(data.keys())} # type: ignore
elif type(data) == list:
elif type(data) == list: # noqa: E721
return [get_hashable_md(val) for val in data] # type: ignore
else:
return str(data)
Expand Down
Loading