Skip to content

Commit

Permalink
format by mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
antixar committed Feb 23, 2022
1 parent 953a68c commit 4b220be
Show file tree
Hide file tree
Showing 9 changed files with 296 additions and 227 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import base64
import json
import time
from datetime import datetime
from pathlib import Path

Expand Down Expand Up @@ -71,6 +72,8 @@ def get_stream_state():

def test_update_for_deleted_record(stream):
headers = stream.authenticator.get_auth_header()
stream_state = get_stream_state()
time.sleep(1)
response = create_note(stream, headers)
assert response.status_code == 201, "Note was note created"

Expand All @@ -79,7 +82,6 @@ def test_update_for_deleted_record(stream):
notes = set(record["Id"] for record in stream.read_records(sync_mode=None))
assert created_note_id in notes, "No created note during the sync"

stream_state = get_stream_state()
response = delete_note(stream, created_note_id, headers)
assert response.status_code == 204, "Note was not deleted"

Expand All @@ -94,6 +96,7 @@ def test_update_for_deleted_record(stream):
assert is_deleted, "Wrong field value for deleted note during the sync"

stream_state = get_stream_state()
time.sleep(1)
response = update_note(stream, created_note_id, headers)
assert response.status_code == 404, "Note was updated, but should not"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import concurrent.futures
from typing import Any, List, Mapping, Optional, Tuple

import requests
import requests # type: ignore[import]
from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import ConfiguredAirbyteCatalog
from requests import adapters as request_adapters
from requests.exceptions import HTTPError, RequestException
from requests.exceptions import HTTPError, RequestException # type: ignore[import]

from .exceptions import TypeSalesforceException
from .rate_limiting import default_backoff_handler
Expand Down Expand Up @@ -185,14 +185,14 @@ def __init__(
client_secret: str = None,
is_sandbox: bool = None,
start_date: str = None,
**kwargs,
):
**kwargs: Any,
) -> None:
self.refresh_token = refresh_token
self.token = token
self.client_id = client_id
self.client_secret = client_secret
self.access_token = None
self.instance_url = None
self.instance_url = ""
self.session = requests.Session()
# Change the connection pool size. Default value is not enough for parallel tasks
adapter = request_adapters.HTTPAdapter(pool_connections=self.parallel_tasks_size, pool_maxsize=self.parallel_tasks_size)
Expand All @@ -203,7 +203,7 @@ def __init__(
self.logger.info("using SANDBOX of Salesforce")
self.start_date = start_date

def _get_standard_headers(self):
def _get_standard_headers(self) -> Mapping[str, str]:
return {"Authorization": "Bearer {}".format(self.access_token)}

def get_streams_black_list(self) -> List[str]:
Expand Down Expand Up @@ -287,34 +287,32 @@ def describe(self, sobject: str = None, sobject_options: Mapping[str, Any] = Non
resp = self._make_request("GET", url, headers=headers)
if resp.status_code == 404 and sobject:
self.logger.error(f"not found a description for the sobject '{sobject}'. Sobject options: {sobject_options}")
return resp.json()
resp_json: Mapping[str, Any] = resp.json()
return resp_json

def generate_schema(self, stream_name: str = None, stream_options: Mapping[str, Any] = None) -> Mapping[str, Any]:
response = self.describe(stream_name, stream_options)
schema = {"$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "additionalProperties": True, "properties": {}}
for field in response["fields"]:
schema["properties"][field["name"]] = self.field_to_property_schema(field)
schema["properties"][field["name"]] = self.field_to_property_schema(field) # type: ignore[index]
return schema

def generate_schemas(self, stream_objects: Mapping[str, Any]) -> Mapping[str, Any]:
def load_schema(name: str, stream_options: Mapping[str, Any]) -> Tuple[Mapping[str, Any], Optional[str]]:
def load_schema(name: str, stream_options: Mapping[str, Any]) -> Tuple[str, Optional[Mapping[str, Any]], Optional[str]]:
try:
result = self.generate_schema(stream_name=name, stream_options=stream_options)
except RequestException as e:
return None, str(e)
return result, None
return name, None, str(e)
return name, result, None

stream_names = list(stream_objects.keys())
# try to split all requests by chunks
stream_schemas = {}
for i in range(0, len(stream_names), self.parallel_tasks_size):
chunk_stream_names = stream_names[i : i + self.parallel_tasks_size]
with concurrent.futures.ThreadPoolExecutor(max_workers=len(chunk_stream_names)) as executor:
for stream_name, (schema, err) in zip(
chunk_stream_names,
executor.map(
lambda args: load_schema(*args), [(stream_name, stream_objects[stream_name]) for stream_name in chunk_stream_names]
),
for stream_name, schema, err in executor.map(
lambda args: load_schema(*args), [(stream_name, stream_objects[stream_name]) for stream_name in chunk_stream_names]
):
if err:
self.logger.error(f"Loading error of the {stream_name} schema: {err}")
Expand Down Expand Up @@ -347,13 +345,16 @@ def field_to_property_schema(field_params: Mapping[str, Any]) -> Mapping[str, An
if sf_type in STRING_TYPES:
property_schema["type"] = ["string", "null"]
elif sf_type in DATE_TYPES:
property_schema = {"type": ["string", "null"], "format": "date-time" if sf_type == "datetime" else "date"}
property_schema = {
"type": ["string", "null"],
"format": "date-time" if sf_type == "datetime" else "date", # type: ignore[dict-item]
}
elif sf_type in NUMBER_TYPES:
property_schema["type"] = ["number", "null"]
elif sf_type == "address":
property_schema = {
"type": ["object", "null"],
"properties": {
"properties": { # type: ignore[dict-item]
"street": {"type": ["null", "string"]},
"state": {"type": ["null", "string"]},
"postalCode": {"type": ["null", "string"]},
Expand All @@ -365,7 +366,7 @@ def field_to_property_schema(field_params: Mapping[str, Any]) -> Mapping[str, An
},
}
elif sf_type == "base64":
property_schema = {"type": ["string", "null"], "format": "base64"}
property_schema = {"type": ["string", "null"], "format": "base64"} # type: ignore[dict-item]
elif sf_type == "int":
property_schema["type"] = ["integer", "null"]
elif sf_type == "boolean":
Expand All @@ -379,7 +380,10 @@ def field_to_property_schema(field_params: Mapping[str, Any]) -> Mapping[str, An
elif sf_type == "location":
property_schema = {
"type": ["object", "null"],
"properties": {"longitude": {"type": ["null", "number"]}, "latitude": {"type": ["null", "number"]}},
"properties": { # type: ignore[dict-item]
"longitude": {"type": ["null", "number"]},
"latitude": {"type": ["null", "number"]},
},
}
else:
raise TypeSalesforceException("Found unsupported type: {}".format(sf_type))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import backoff
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.sources.streams.http.exceptions import DefaultBackoffException
from requests import codes, exceptions
from requests import codes, exceptions # type: ignore[import]

TRANSIENT_EXCEPTIONS = (
DefaultBackoffException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
#

import copy
from typing import Any, Iterator, List, Mapping, MutableMapping, Tuple
from typing import Any, Iterator, List, Mapping, MutableMapping, Optional, Tuple

from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import AirbyteMessage, ConfiguredAirbyteCatalog
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
from airbyte_cdk.sources.utils.schema_helpers import split_config
from requests import codes, exceptions
from requests import codes, exceptions # type: ignore[import]

from .api import UNSUPPORTED_BULK_API_SALESFORCE_OBJECTS, UNSUPPORTED_FILTERING_STREAMS, Salesforce
from .streams import BulkIncrementalSalesforceStream, BulkSalesforceStream, IncrementalSalesforceStream, SalesforceStream
Expand All @@ -24,17 +24,18 @@ def _get_sf_object(config: Mapping[str, Any]) -> Salesforce:
sf.login()
return sf

def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, any]:
def check_connection(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> Tuple[bool, Optional[str]]:
try:
_ = self._get_sf_object(config)
return True, None
except exceptions.HTTPError as error:
error_data = error.response.json()[0]
error_code = error_data.get("errorCode")
if error.response.status_code == codes.FORBIDDEN and error_code == "REQUEST_LIMIT_EXCEEDED":
logger.warn(f"API Call limit is exceeded. Error message: '{error_data.get('message')}'")
return False, "API Call limit is exceeded"

return True, None

@classmethod
def generate_streams(
cls,
Expand Down Expand Up @@ -80,7 +81,11 @@ def streams(self, config: Mapping[str, Any], catalog: ConfiguredAirbyteCatalog =
return self.generate_streams(config, stream_objects, sf, state=state)

def read(
self, logger: AirbyteLogger, config: Mapping[str, Any], catalog: ConfiguredAirbyteCatalog, state: MutableMapping[str, Any] = None
self,
logger: AirbyteLogger,
config: Mapping[str, Any],
catalog: ConfiguredAirbyteCatalog,
state: Optional[MutableMapping[str, Any]] = None,
) -> Iterator[AirbyteMessage]:
"""
Overwritten to dynamically receive only those streams that are necessary for reading for significant speed gains
Expand Down
Loading

1 comment on commit 4b220be

@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 Salesforce(#10516)

Measures

Name Value Name Value Name Value
Coverage 83.7 Vulnerabilities 0 Duplicated Lines (%) 0.0
Code Smells 4 Reliability Rating A Security Rating A
Lines of Code 826 Lines to Cover 49 Quality Gate Status OK
Bugs 0 Duplicated Blocks 0 Blocker Issues 0
Critical Issues 1 Major Issues 4 Minor Issues 71

Detected Issues

Rule File Description Message
python:mypy_import (MINOR) source_salesforce/api.py Require that imported module can be found or has stubs Library stubs not installed for "requests.exceptions" (or incompatible with Python 3.7) . Code line: from requests.exceptions import HTTPError, RequestException
python:mypy_return_value (MINOR) source_salesforce/api.py Check that return value is compatible with signature Incompatible return value type (got "Tuple[None, str]", expected "Tuple[Mapping[str, Any], Optional[str]]") . Code line: return None, str(e)
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "sobject_options" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ...str = None, sobject_options: Mapping[str, Any] = None) -> Mapping[str,...
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "sobject" (default has type "None", argument has type "str") . Code line: def describe(self, sobject: str = None, sobject_options: Mapping[s...
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "stream_name" (default has type "None", argument has type "str") . Code line: def generate_schema(self, stream_name: str = None, stream_options:...
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "stream_options" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ... str = None, stream_options: Mapping[str, Any] = None) -> Mapping[str,...
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "sobject_options" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ..._name: str, sobject_options: Mapping[str, Any] = None, schema: dict = ...
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "schema" (default has type "None", argument has type "Dict[Any, Any]") . Code line: ...bject_options: Mapping[str, Any] = None, schema: dict = None, **kwargs
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Type[SalesforceStream]", variable has type "Type[IncrementalSalesforceStream]") . Code line: new_cls = SalesforceStream
python:S5799 (MAJOR) source_salesforce/streams.py:225 Implicit string and byte concatenations should not be confusing Merge these implicitly concatenated strings; or did you forget a comma?
python:S112 (MAJOR) source_salesforce/streams.py:335 "Exception" and "BaseException" should not be raised Replace this generic exception class with a more specific one.
python:mypy_import (MINOR) source_salesforce/source.py Require that imported module can be found or has stubs Library stubs not installed for "requests" (or incompatible with Python 3.7) . Code line: from requests import codes, exceptions
python:mypy_assignment (MINOR) source_salesforce/source.py Check that assigned value is compatible with target Incompatible default for argument "state" (default has type "None", argument has type "Mapping[str, Any]") . Code line: state: Mapping[str, Any] = None,
python:S5886 (MAJOR) source_salesforce/streams.py Function return types should be consistent with their type hint Remove this yield statement or annotate function "download_data" with "typing.Generator" or one of its supertypes.
python:mypy_assignment (MINOR) source_salesforce/source.py Check that assigned value is compatible with target Incompatible default for argument "state" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ...irbyteCatalog = None, state: Mapping[str, Any] = None) -> List[Stream]...
python:mypy_no_any_return (MINOR) source_salesforce/streams.py Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return last_record[self.cursor_field]
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "next_page_token" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ... path(self, next_page_token: Mapping[str, Any] = None, **kwargs) -> st...
python:mypy_return_value (MINOR) source_salesforce/streams.py Check that return value is compatible with signature Incompatible return value type (got "Mapping[str, Any]", expected "str") . Code line: return next_page_token
python:mypy_no_any_return (MINOR) source_salesforce/streams.py Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return response_data.get("nextRecordsUrl")
python:mypy_valid_type (MINOR) source_salesforce/streams.py 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_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "stream_slice" (default has type "None", argument has type "Mapping[str, any?]") . Code line: ...ing[str, Any], stream_slice: Mapping[str, any] = None, next_page_token...
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "next_page_token" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ...e: Mapping[str, any] = None, next_page_token: Mapping[str, Any] = None
python:mypy_operator (MINOR) source_salesforce/streams.py Check that operator is valid for operands Unsupported operand types for + ("str" and "Mapping[str, Any]") . Code line: query += next_page_token
python:mypy_valid_type (MINOR) source_salesforce/streams.py 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_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "stream_slice" (default has type "None", argument has type "Mapping[str, any?]") . Code line: ...ing[str, Any], stream_slice: Mapping[str, any] = None, next_page_token...
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "next_page_token" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ...e: Mapping[str, any] = None, next_page_token: Mapping[str, Any] = None
python:mypy_return (MINOR) source_salesforce/streams.py Check that function always returns a value Missing return statement . Code line: def next_page_token(self, last_record: dict) -> str:
python:mypy_return (MINOR) source_salesforce/streams.py Check that function always returns a value Missing return statement . Code line: def format_start_date(start_date: Optional[str]) -> Optional[str]:
python:mypy_no_any_return (MINOR) source_salesforce/streams.py Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Optional[str]" . Code line: return pendulum.parse(start_date).strftime("%Y-%m-%dT%H:%M...
python:mypy_attr_defined (MINOR) source_salesforce/streams.py Check that attribute exists Module has no attribute "parse" . Code line: return pendulum.parse(start_date).strftime("%Y-%m-%dT%H:%M...
python:mypy_attr_defined (MINOR) source_salesforce/streams.py Check that attribute exists Module "pendulum" does not explicitly export attribute "DateTime"; implicit reexport disabled . Code line: from pendulum import DateTime
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Mapping[str, Any]", variable has type "Dict[Any, Any]") . Code line: self.schema = self.sf_api.generate_schema([self.name])
python:mypy_arg_type (MINOR) source_salesforce/streams.py Check argument types in calls Argument 1 to "generate_schema" of "Salesforce" has incompatible type "List[str]"; expected "str" . Code line: self.schema = self.sf_api.generate_schema([self.name])
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible types in assignment (expression has type "float", variable has type "int") . Code line: delay_timeout = 0.5 + math.exp(delay_cnt) / 1000.0
python:S5799 (MAJOR) source_salesforce/streams.py:237 Implicit string and byte concatenations should not be confusing Merge these implicitly concatenated strings; or did you forget a comma?
python:mypy_has_type (MINOR) source_salesforce/streams.py Check that type of reference can be determined Cannot determine type of "record" . Code line: yield record
python:S5720 (CRITICAL) source_salesforce/streams.py:138 "self" should be the first argument to instance methods Rename "instance" to "self" or add the missing "self" parameter.
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "refresh_token" (default has type "None", argument has type "str") . Code line: refresh_token: str = None,
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "token" (default has type "None", argument has type "str") . Code line: token: str = None,
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "client_id" (default has type "None", argument has type "str") . Code line: client_id: str = None,
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "client_secret" (default has type "None", argument has type "str") . Code line: client_secret: str = None,
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "is_sandbox" (default has type "None", argument has type "bool") . Code line: is_sandbox: bool = None,
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "start_date" (default has type "None", argument has type "str") . Code line: start_date: str = None,
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "headers" (default has type "None", argument has type "Dict[Any, Any]") . Code line: ...elf, http_method: str, url: str, headers: dict = None, body: dict = No...
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "body" (default has type "None", argument has type "Dict[Any, Any]") . Code line: ...tr, url: str, headers: dict = None, body: dict = None, stream: bool = ...
python:mypy_assignment (MINOR) source_salesforce/api.py Check that assigned value is compatible with target Incompatible default for argument "params" (default has type "None", argument has type "Dict[Any, Any]") . Code line: ...t = None, body: dict = None, stream: bool = False, params: dict = None
python:mypy_no_any_return (MINOR) source_salesforce/api.py Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Mapping[str, Any]" . Code line: return resp.json()
python:mypy_import (MINOR) source_salesforce/api.py Require that imported module can be found or has stubs Library stubs not installed for "requests" (or incompatible with Python 3.7) . Code line: import requests
python:mypy_index (MINOR) source_salesforce/api.py Check indexing operations Unsupported target for indexed assignment ("object") . Code line: schema["properties"][field["name"]] = self.field_to_proper...
python:mypy_dict_item (MINOR) source_salesforce/api.py Check dict items in a dict expression {key: value, ...} Dict entry 1 has incompatible type "str": "str"; expected "str": "List[str]" . Code line: ... property_schema = {"type": ["string", "null"], "format": "date-time"...
python:mypy_dict_item (MINOR) source_salesforce/api.py Check dict items in a dict expression {key: value, ...} Dict entry 1 has incompatible type "str": "Dict[str, Dict[str, List[str]]]"; expected "str": "List[str]" . Code line: "properties": {
python:mypy_dict_item (MINOR) source_salesforce/api.py Check dict items in a dict expression {key: value, ...} Dict entry 1 has incompatible type "str": "str"; expected "str": "List[str]" . Code line: ... property_schema = {"type": ["string", "null"], "format": "base64"}
python:mypy_dict_item (MINOR) source_salesforce/api.py Check dict items in a dict expression {key: value, ...} Dict entry 1 has incompatible type "str": "Dict[str, Dict[str, List[str]]]"; expected "str": "List[str]" . Code line: "properties": {"longitude": {"type": ["null", "number"...
python:mypy_import (MINOR) source_salesforce/rate_limiting.py Require that imported module can be found or has stubs Library stubs not installed for "requests" (or incompatible with Python 3.7) . Code line: from requests import codes, exceptions
python:mypy_return (MINOR) source_salesforce/source.py Check that function always returns a value Missing return statement . Code line: def check_connection(self, logger: AirbyteLogger, config: Mapping[...
python:mypy_valid_type (MINOR) source_salesforce/source.py 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]:
python:mypy_assignment (MINOR) source_salesforce/source.py Check that assigned value is compatible with target Incompatible default for argument "state" (default has type "None", argument has type "MutableMapping[str, Any]") . Code line: ...alog: ConfiguredAirbyteCatalog, state: MutableMapping[str, Any] = None
python:mypy_valid_type (MINOR) source_salesforce/streams.py 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_import (MINOR) source_salesforce/streams.py Require that imported module can be found or has stubs Library stubs not installed for "requests" (or incompatible with Python 3.7) . Code line: import requests
python:mypy_return_value (MINOR) source_salesforce/streams.py Check that return value is compatible with signature Incompatible return value type (got "None", expected "str") . Code line: return self.sf_api.instance_url
python:mypy_valid_type (MINOR) source_salesforce/streams.py 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_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "stream_slice" (default has type "None", argument has type "Mapping[str, any?]") . Code line: ...ing[str, Any], stream_slice: Mapping[str, any] = None, next_page_token...
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "next_page_token" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ...e: Mapping[str, any] = None, next_page_token: Mapping[str, Any] = None
python:mypy_override (MINOR) source_salesforce/streams.py Check that method override is compatible with base class Signature of "path" incompatible with supertype "SalesforceStream" . Code line: def path(self, **kwargs) -> str:
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "json" (default has type "None", argument has type "Dict[Any, Any]") . Code line: ...ef _send_http_request(self, method: str, url: str, json: dict = None):
python:mypy_no_any_return (MINOR) source_salesforce/streams.py Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Optional[str]" . Code line: return job_id
python:mypy_return (MINOR) source_salesforce/streams.py Check that function always returns a value Missing return statement . Code line: def next_page_token(self, last_record: dict) -> str:
python:mypy_override (MINOR) source_salesforce/streams.py Check that method override is compatible with base class Signature of "read_records" incompatible with supertype "SalesforceStream" . Code line: def read_records(
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "cursor_field" (default has type "None", argument has type "List[str]") . Code line: cursor_field: List[str] = None,
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "stream_slice" (default has type "None", argument has type "Mapping[str, Any]") . Code line: stream_slice: Mapping[str, Any] = None,
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "stream_state" (default has type "None", argument has type "Mapping[str, Any]") . Code line: stream_state: Mapping[str, Any] = None,
python:mypy_arg_type (MINOR) source_salesforce/streams.py Check argument types in calls Argument "next_page_token" to "request_params" of "BulkSalesforceStream" has incompatible type "None"; expected "Mapping[str, Any]" . Code line: ...eam_state, stream_slice=stream_slice, next_page_token=next_page_token)
python:mypy_misc (MINOR) source_salesforce/streams.py Miscellaneous other checks "object" object is not iterable . Code line: for count, record in self.download_data(url=job_full_url):
python:mypy_has_type (MINOR) source_salesforce/streams.py Check that type of reference can be determined Cannot determine type of "record" . Code line: next_page_token = self.next_page_token(record)
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "stream_slice" (default has type "None", argument has type "Mapping[str, any?]") . Code line: ...ing[str, Any], stream_slice: Mapping[str, any] = None, next_page_token...
python:mypy_assignment (MINOR) source_salesforce/streams.py Check that assigned value is compatible with target Incompatible default for argument "next_page_token" (default has type "None", argument has type "Mapping[str, Any]") . Code line: ...e: Mapping[str, any] = None, next_page_token: Mapping[str, Any] = None

Coverage (83.7%)

File Coverage File Coverage
source_salesforce/init.py 100.0 source_salesforce/api.py 90.7
source_salesforce/exceptions.py 100.0 source_salesforce/rate_limiting.py 86.4
source_salesforce/source.py 92.0 source_salesforce/streams.py 85.1
source_salesforce/utils.py 100.0

Please sign in to comment.