Skip to content

Commit

Permalink
updated after review
Browse files Browse the repository at this point in the history
  • Loading branch information
bazarnov committed Apr 28, 2022
1 parent f3f2750 commit 7d1f1e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
- name: Amplitude
sourceDefinitionId: fa9f58c6-2d03-4237-aaa4-07d75e0c1396
dockerRepository: airbyte/source-amplitude
dockerImageTag: 0.1.5
dockerImageTag: 0.1.4
documentationUrl: https://docs.airbyte.io/integrations/sources/amplitude
icon: amplitude.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str,

def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]:
status = response.status_code
if status in list(HTTP_ERROR_CODES.keys()):
if status in HTTP_ERROR_CODES.keys():
error_msg_from_status(status)
yield from []
else:
Expand Down Expand Up @@ -167,7 +167,7 @@ def read_records(
yield from super().read_records(sync_mode, cursor_field, stream_slice, stream_state)
except requests.exceptions.HTTPError as error:
status = error.response.status_code
if status in list(HTTP_ERROR_CODES.keys()):
if status in HTTP_ERROR_CODES.keys():
error_msg_from_status(status)
yield from []
else:
Expand Down

1 comment on commit 7d1f1e6

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SonarQube Report

SonarQube report for Airbyte Connectors Source Amplitude(#12430)

Measures

Name Value Name Value Name Value
Vulnerabilities 0 Duplicated Lines (%) 0.0 Bugs 0
Duplicated Blocks 0 Code Smells 22 Reliability Rating A
Coverage 50.0 Quality Gate Status OK Lines to Cover 2
Lines of Code 226 Security Rating A Blocker Issues 0
Critical Issues 0 Major Issues 0 Minor Issues 22

Detected Issues

Rule File Description Message
python:mypy_attr_defined (MINOR) source_amplitude/api.py:135 Check that attribute exists Module has no attribute "parse" . Code line: start = pendulum.parse(stream_state.get(self.cursor_field)...
python:mypy_attr_defined (MINOR) source_amplitude/api.py:156 Check that attribute exists Module has no attribute "parse" . Code line: start = pendulum.parse(stream_slice["start"]).add(hours=6)
python:mypy_index (MINOR) source_amplitude/api.py:156 Check indexing operations Value of type "Optional[Mapping[str, Any]]" is not indexable . Code line: start = pendulum.parse(stream_slice["start"]).add(hours=6)
python:mypy_attr_defined (MINOR) source_amplitude/api.py:157 Check that attribute exists Module has no attribute "parse" . Code line: end = pendulum.parse(stream_slice["end"])
python:mypy_index (MINOR) source_amplitude/api.py:157 Check indexing operations Value of type "Optional[Mapping[str, Any]]" is not indexable . Code line: end = pendulum.parse(stream_slice["end"])
python:mypy_override (MINOR) source_amplitude/api.py:177 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "IncrementalAmplitudeStream" . Code line: def request_params(self, stream_slice: Mapping[str, Any], **kwargs...
python:mypy_attr_defined (MINOR) source_amplitude/api.py:179 Check that attribute exists Module has no attribute "parse" . Code line: params["start"] = pendulum.parse(stream_slice["start"]).strfti...
python:mypy_attr_defined (MINOR) source_amplitude/api.py:180 Check that attribute exists Module has no attribute "parse" . Code line: params["end"] = pendulum.parse(stream_slice["end"]).strftime(s...
python:mypy_import (MINOR) source_amplitude/api.py:16 Require that imported module can be found or has stubs Library stubs not installed for "requests" (or incompatible with Python 3.9) . Code line: import requests
python:mypy_var_annotated (MINOR) source_amplitude/api.py:56 Require variable annotation if type can't be inferred Need type annotation for "base_params" (hint: "base_params: Dict[, ] = ...") . Code line: base_params = {}
python:mypy_attr_defined (MINOR) source_amplitude/api.py:62 Check that attribute exists Module has no attribute "parse" . Code line: self._start_date = pendulum.parse(start_date)
python:mypy_valid_type (MINOR) source_amplitude/api.py:72 Check that type (annotation) is valid Module "pendulum" is not valid as a type . Code line: def _get_end_date(self, current_date: pendulum, end_date: pendulum...
python:mypy_attr_defined (MINOR) source_amplitude/api.py:73 Check that attribute exists pendulum? has no attribute "add" . Code line: if current_date.add(**self.time_interval).date() < end_date.da...
python:mypy_attr_defined (MINOR) source_amplitude/api.py:73 Check that attribute exists pendulum? has no attribute "date" . Code line: ... if current_date.add(**self.time_interval).date() < end_date.date():
python:mypy_attr_defined (MINOR) source_amplitude/api.py:74 Check that attribute exists pendulum? has no attribute "add" . Code line: end_date = current_date.add(**self.time_interval)
python:mypy_attr_defined (MINOR) source_amplitude/api.py:87 Check that attribute exists Module has no attribute "parse" . Code line: end_time = pendulum.parse(end[0])
python:mypy_valid_type (MINOR) source_amplitude/api.py:94 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ...e: Mapping[str, Any], stream_slice: Mapping[str, any] = None, next_pag...
python:mypy_attr_defined (MINOR) source_amplitude/api.py:102 Check that attribute exists Module has no attribute "parse" . Code line: start_datetime = pendulum.parse(stream_state[self.curs...
python:mypy_assignment (MINOR) source_amplitude/source.py:19 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "bytes", variable has type "str") . Code line: username = username.encode("latin1")
python:mypy_assignment (MINOR) source_amplitude/source.py:20 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "bytes", variable has type "str") . Code line: password = password.encode("latin1")
python:mypy_arg_type (MINOR) source_amplitude/source.py:21 Check argument types in calls Argument 1 to "join" of "bytes" has incompatible type "Tuple[str, str]"; expected "Iterable[Union[ByteString, memoryview]]" . Code line: token = b64encode(b":".join((username, password))).strip().dec...
python:mypy_valid_type (MINOR) source_amplitude/source.py:24 Check that type (annotation) is valid Function "builtins.any" is not valid as a type . Code line: ...logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:

Coverage (50.0%)

File Coverage File Coverage
source_amplitude/init.py 100.0 source_amplitude/api.py 66.7
source_amplitude/errors.py 91.7 source_amplitude/source.py 50.0

Please sign in to comment.