Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
eugene-kulak committed Jan 23, 2022
1 parent 06a75ef commit ae503c3
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"description": "The date from which you'd like to replicate data for AdCreatives and AdInsights APIs, in the format YYYY-MM-DDT00:00:00Z. All data generated after this date will be replicated.",
"order": 0,
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
"examples": [
"2017-01-25T00:00:00Z"
],
"examples": ["2017-01-25T00:00:00Z"],
"type": "string",
"format": "date-time"
},
Expand All @@ -21,19 +19,15 @@
"description": "The date until which you'd like to replicate data for AdCreatives and AdInsights APIs, in the format YYYY-MM-DDT00:00:00Z. All data generated between start_date and this date will be replicated. Not setting this option will result in always syncing the latest data.",
"order": 1,
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
"examples": [
"2017-01-26T00:00:00Z"
],
"examples": ["2017-01-26T00:00:00Z"],
"type": "string",
"format": "date-time"
},
"account_id": {
"title": "Account ID",
"description": "The Facebook Ad account ID to use when pulling data from the Facebook Marketing API.",
"order": 2,
"examples": [
"111111111111111"
],
"examples": ["111111111111111"],
"type": "string"
},
"access_token": {
Expand Down Expand Up @@ -99,32 +93,20 @@
}
}
},
"required": [
"name"
]
"required": ["name"]
}
}
},
"required": [
"start_date",
"account_id",
"access_token"
]
"required": ["start_date", "account_id", "access_token"]
},
"supportsIncremental": true,
"supported_destination_sync_modes": [
"append"
],
"supported_destination_sync_modes": ["append"],
"authSpecification": {
"auth_type": "oauth2.0",
"oauth2Specification": {
"rootObject": [],
"oauthFlowInitParameters": [],
"oauthFlowOutputParameters": [
[
"access_token"
]
]
"oauthFlowOutputParameters": [["access_token"]]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,29 @@

import logging
from datetime import datetime
from typing import Any, List, Mapping, Optional, Tuple, Type, Iterator, MutableMapping
from typing import Any, Iterator, List, Mapping, MutableMapping, Optional, Tuple, Type

import pendulum
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.models import (
AirbyteConnectionStatus,
AirbyteMessage,
AuthSpecification,
ConfiguredAirbyteStream,
ConnectorSpecification,
DestinationSyncMode,
OAuth2Specification,
Status, AirbyteMessage, ConfiguredAirbyteStream, SyncMode,
Status,
SyncMode,
)
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.config import BaseConfig
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.core import package_name_from_class
from airbyte_cdk.sources.utils.schema_helpers import ResourceSchemaLoader, InternalConfig
from airbyte_cdk.sources.utils.schema_helpers import (
InternalConfig,
ResourceSchemaLoader,
)
from pydantic import BaseModel, Field
from source_facebook_marketing.api import API
from source_facebook_marketing.streams import (
Expand Down Expand Up @@ -104,7 +110,7 @@ class Config:
custom_insights: Optional[List[InsightConfig]] = Field(
title="Custom Insights",
order=6,
description="A list which contains insights entries, each entry must have a name and can contains fields, breakdowns or action_breakdowns)"
description="A list which contains insights entries, each entry must have a name and can contains fields, breakdowns or action_breakdowns)",
)


Expand Down Expand Up @@ -255,7 +261,7 @@ def _read_incremental(
connector_state: MutableMapping[str, Any],
internal_config: InternalConfig,
) -> Iterator[AirbyteMessage]:
""" We override this method because we need to inject new state handling.
"""We override this method because we need to inject new state handling.
Old way:
pass stream_state in read_records and other methods
call stream_state = stream_instance.get_updated_state(stream_state, record_data) for each record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
import logging
from abc import ABC, abstractmethod
from enum import Enum
from typing import Any, Mapping, Optional, List
from typing import Any, List, Mapping, Optional

import pendulum
from facebook_business.adobjects.adreportrun import AdReportRun
from facebook_business.adobjects.campaign import Campaign
from facebook_business.adobjects.objectparser import ObjectParser
from facebook_business.api import FacebookResponse, FacebookAdsApiBatch

from facebook_business.api import FacebookAdsApiBatch, FacebookResponse

logger = logging.getLogger("airbyte")


def chunks(data, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(data), n):
yield data[i: i + n]
yield data[i : i + n]


class Status(str, Enum):
Expand Down Expand Up @@ -61,7 +60,7 @@ def failed(self) -> bool:
"""Tell if the job previously failed"""

@abstractmethod
def update_job(self, batch = None):
def update_job(self, batch=None):
"""Method to retrieve job's status, separated because of retry handler"""

@abstractmethod
Expand All @@ -70,8 +69,8 @@ def get_result(self) -> Any:


class ParentAsyncJob(AsyncJob):
""" Group of async jobs
"""
"""Group of async jobs"""

def __init__(self, api, jobs: List[AsyncJob]):
self._api = api
self._jobs = jobs
Expand Down Expand Up @@ -129,7 +128,7 @@ def get_result(self) -> Any:
for job in self._jobs:
yield from job.get_result()

def split_job(self) -> 'AsyncJob':
def split_job(self) -> "AsyncJob":
"""Split existing job in few smaller ones grouped by ParentAsyncJob class"""
raise RuntimeError("Splitting of ParentAsyncJob is not allowed.")

Expand All @@ -156,7 +155,7 @@ def __init__(self, api, edge_object: Any, params: Mapping[str, Any], key: Option

def split_job(self) -> ParentAsyncJob:
"""Split existing job in few smaller ones grouped by ParentAsyncJob class.
TODO: use some cache to avoid expensive queries across different streams.
TODO: use some cache to avoid expensive queries across different streams.
"""
campaign_params = dict(copy.deepcopy(self._params))
# get campaigns from attribution window as well (28 day + 1 current day)
Expand All @@ -177,8 +176,11 @@ def start(self, batch=None):

if batch is not None:
self._edge_object.get_insights(
params=self._params, is_async=True, batch=batch,
success=self._batch_success_handler, failure=self._batch_failure_handler,
params=self._params,
is_async=True,
batch=batch,
success=self._batch_success_handler,
failure=self._batch_failure_handler,
)
else:
self._job = self._edge_object.get_insights(params=self._params, is_async=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

import logging
import time
from typing import Tuple, Iterator, List, TYPE_CHECKING
from typing import TYPE_CHECKING, Iterator, List, Tuple

from facebook_business.api import FacebookAdsApiBatch

from .async_job import AsyncJob

if TYPE_CHECKING:
Expand Down Expand Up @@ -34,8 +35,8 @@ class InsightAsyncJobManager:
MAX_JOBS_IN_QUEUE = 100
MAX_JOBS_TO_CHECK = 50

def __init__(self, api: 'API', jobs: Iterator[AsyncJob]):
""" Init
def __init__(self, api: "API", jobs: Iterator[AsyncJob]):
"""Init
:param api:
:param jobs:
Expand All @@ -50,10 +51,7 @@ def _start_jobs(self):
self._update_api_throttle_limit()
self._wait_throttle_limit_down()
prev_jobs_count = len(self._running_jobs)
while (
self._get_current_throttle_value() < self.THROTTLE_LIMIT
and len(self._running_jobs) < self.MAX_JOBS_IN_QUEUE
):
while self._get_current_throttle_value() < self.THROTTLE_LIMIT and len(self._running_jobs) < self.MAX_JOBS_IN_QUEUE:
job = next(iter(self._jobs), None)
if not job:
self._empty = True
Expand All @@ -68,7 +66,7 @@ def _start_jobs(self):
)

def completed_jobs(self) -> Iterator[AsyncJob]:
""" Wait until job is ready and return it. If job
"""Wait until job is ready and return it. If job
failed try to restart it for FAILED_JOBS_RESTART_COUNT times. After job
is completed new jobs added according to current throttling limit.
Expand All @@ -87,7 +85,7 @@ def completed_jobs(self) -> Iterator[AsyncJob]:
self._start_jobs()

def _check_jobs_status_and_restart(self) -> List[AsyncJob]:
""" Checks jobs status in advance and restart if some failed.
"""Checks jobs status in advance and restart if some failed.
:return: list of completed jobs
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@

import copy
import logging
from typing import Any, Iterable, List, Mapping, MutableMapping, Optional, Iterator, Union
from typing import (
Any,
Iterable,
Iterator,
List,
Mapping,
MutableMapping,
Optional,
Union,
)

import airbyte_cdk.sources.utils.casing as casing
import pendulum
from airbyte_cdk.models import SyncMode
from airbyte_cdk.sources.streams.core import package_name_from_class
from airbyte_cdk.sources.utils.schema_helpers import ResourceSchemaLoader
from cached_property import cached_property
from source_facebook_marketing.streams.async_job import InsightAsyncJob, AsyncJob
from source_facebook_marketing.streams.async_job import AsyncJob, InsightAsyncJob
from source_facebook_marketing.streams.async_job_manager import InsightAsyncJobManager

from .streams import FBMarketingIncrementalStream
Expand Down Expand Up @@ -57,12 +66,12 @@ class AdsInsights(FBMarketingIncrementalStream):
breakdowns = []

def __init__(
self,
name: str = None,
fields: List[str] = None,
breakdowns: List[str] = None,
action_breakdowns: List[str] = None,
**kwargs,
self,
name: str = None,
fields: List[str] = None,
breakdowns: List[str] = None,
action_breakdowns: List[str] = None,
**kwargs,
):
super().__init__(**kwargs)
self._start_date = self._start_date.date()
Expand All @@ -79,7 +88,7 @@ def __init__(

@property
def name(self) -> str:
""" We override stream name to let the user change it via configuration."""
"""We override stream name to let the user change it via configuration."""
name = self._new_class_name or self.__class__.__name__
return casing.camel_to_snake(name)

Expand All @@ -95,11 +104,11 @@ def _get_campaign_ids(self, params) -> List[str]:
return list(set(row["campaign_id"] for row in result))

def read_records(
self,
sync_mode: SyncMode,
cursor_field: List[str] = None,
stream_slice: Mapping[str, Any] = None,
stream_state: Mapping[str, Any] = None,
self,
sync_mode: SyncMode,
cursor_field: List[str] = None,
stream_slice: Mapping[str, Any] = None,
stream_state: Mapping[str, Any] = None,
) -> Iterable[Mapping[str, Any]]:
"""Waits for current job to finish (slice) and yield its result"""
job = stream_slice["insight_job"]
Expand Down Expand Up @@ -147,7 +156,7 @@ def _advance_cursor(self):
self._cursor_value = ts_start

def _generate_async_jobs(self, params: Mapping) -> Iterator[AsyncJob]:
""" Generator of async jobs
"""Generator of async jobs
:param params:
:return:
Expand Down Expand Up @@ -184,7 +193,7 @@ def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str, Any]]]:
yield {"insight_job": job}

def _get_start_date(self) -> pendulum.Date:
""" Get start date to begin sync with. It is not that trivial as it might seem.
"""Get start date to begin sync with. It is not that trivial as it might seem.
There are few rules:
- don't read data older than start_date
- re-read data within last 28 days
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@
import logging
from abc import ABC
from datetime import datetime
from typing import Any, Iterable, Iterator, List, Mapping, MutableMapping, TYPE_CHECKING, Optional
from typing import (
TYPE_CHECKING,
Any,
Iterable,
Iterator,
List,
Mapping,
MutableMapping,
Optional,
)

import pendulum
import requests
Expand All @@ -16,6 +25,7 @@
from cached_property import cached_property
from facebook_business.adobjects.abstractobject import AbstractObject
from facebook_business.api import FacebookAdsApiBatch, FacebookRequest, FacebookResponse

from .common import deep_merge

if TYPE_CHECKING:
Expand Down Expand Up @@ -53,7 +63,7 @@ class FBMarketingStream(Stream, ABC):

MAX_BATCH_SIZE = 50

def __init__(self, api: 'API', include_deleted: bool = False, **kwargs):
def __init__(self, api: "API", include_deleted: bool = False, **kwargs):
super().__init__(**kwargs)
self._api = api
self._include_deleted = include_deleted if self.enable_deleted else False
Expand Down Expand Up @@ -216,8 +226,7 @@ def __init__(self, fetch_thumbnail_images: bool = False, **kwargs):

@cached_property
def fields(self) -> List[str]:
""" Remove "thumbnail_data_url" field because it is computed field and it's not a field that we can request from Facebook
"""
"""Remove "thumbnail_data_url" field because it is computed field and it's not a field that we can request from Facebook"""
return [f for f in super().fields if f != "thumbnail_data_url"]

def read_records(
Expand Down

1 comment on commit ae503c3

@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 Facebook Marketing(#8385)

Measures

Name Value Name Value Name Value
Duplicated Lines (%) 0.0 Security Rating A Vulnerabilities 0
Lines to Cover 100 Lines of Code 1519 Coverage 50.0
Bugs 1 Quality Gate Status ERROR Code Smells 9
Duplicated Blocks 0 Reliability Rating C Blocker Issues 0
Critical Issues 2 Major Issues 34 Minor Issues 164

Detected Issues

Rule File Description Message
python:S1763 (MAJOR) unit_tests/test_async_job.py:58 All code should be reachable Delete this unreachable code or refactor the code to make it reachable.
flake8:E501 (MAJOR) source_facebook_marketing/source.py:113 line too long (82 > 79 characters) line too long (148 > 140 characters)
python:mypy_no_untyped_def (MINOR) streams/streams.py:66 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api: "API", include_deleted: bool = False, **kw...
python:mypy_override (MINOR) streams/insights_streams.py:96 Check that method override is compatible with base class Signature of "primary_key" incompatible with supertype "FBMarketingStream" . Code line: def primary_key(self) -> Optional[Union[str, List[str], List[List[...
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:48 Check that every function has an annotation Function is missing a return type annotation . Code line: def _start_jobs(self):
python:S1134 (MAJOR) streams/streams.py:91 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/streams.py:76 Check that every function has an annotation Function is missing a type annotation . Code line: def _execute_batch(self, batch):
python:mypy_no_redef (MINOR) streams/streams.py:100 Check that each name is defined once Name "api_batch" already defined on line 94 . Code line: api_batch: FacebookAdsApiBatch = self._api.api.new_bat...
python:mypy_assignment (MINOR) streams/streams.py:117 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Iterable[MutableMapping[str, Any]]", variable has type "Generator[Any, None, None]") . Code line: loaded_records_iter = self.execute_in_batch(loaded_records...
python:mypy_index (MINOR) streams/streams.py:242 Check indexing operations Unsupported target for indexed assignment ("Mapping[str, Any]") . Code line: record["thumbnail_data_url"] = fetch_thumbnail_data_ur...
flake8:E501 (MAJOR) source_facebook_marketing/source.py line too long (82 > 79 characters) line too long (147 > 140 characters)
python:isort_need_format (MINOR) source_facebook_marketing/api.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:black_need_format (MINOR) streams/async_job_manager.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 4 code part(s) should be updated.
python:isort_need_format (MINOR) streams/async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:black_need_format (MINOR) streams/insights_streams.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 4 code part(s) should be updated.
python:isort_need_format (MINOR) streams/insights_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/insights_streams.py:141 Check that attribute exists Module has no attribute "parse" . Code line: self._cursor_value = pendulum.parse(value[self.cursor_field])....
python:mypy_attr_defined (MINOR) streams/insights_streams.py:142 Check that attribute exists Module has no attribute "parse" . Code line: self._completed_slices = set(pendulum.parse(v).date() for v in...
python:mypy_no_any_return (MINOR) streams/insights_streams.py:147 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Iterator[Any]" . Code line: return date_range.range("days", self.time_increment)
python:black_need_format (MINOR) streams/streams.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 2 code part(s) should be updated.
python:isort_need_format (MINOR) streams/streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 2 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/streams.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api: 'API', include_deleted: bool = False, **kw...
python:black_need_format (MINOR) source_facebook_marketing/source.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 3 code part(s) should be updated.
python:isort_need_format (MINOR) source_facebook_marketing/source.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:black_need_format (MINOR) streams/async_job.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 5 code part(s) should be updated.
python:isort_need_format (MINOR) streams/async_job.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
flake8:F401 (MAJOR) source_facebook_marketing/api.py module imported but unused 'datetime.datetime' imported but unused
python:mypy_no_untyped_def (MINOR) source_facebook_marketing/api.py:106 Check that every function has an annotation Function is missing a return type annotation . Code line: def _update_insights_throttle_limit(self, response: FacebookRespon...
python:S1134 (MAJOR) source_facebook_marketing/source.py:178 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:19 Check that every function has an annotation Function is missing a type annotation . Code line: def chunks(data, n):
flake8:E203 (MAJOR) streams/async_job.py:22 whitespace before ‘:’ whitespace before ':'
python:mypy_no_untyped_def (MINOR) streams/async_job.py:40 Check that every function has an annotation Function is missing a type annotation . Code line: def start(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:49 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:74 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, jobs: List[AsyncJob]):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:79 Check that every function has an annotation Function is missing a type annotation . Code line: def start(self, batch=None):
python:S125 (MAJOR) streams/async_job.py:81 Sections of code should not be commented out Remove this commented out code.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:99 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:139 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, edge_object: Any, params: Mapping[str, Any...
python:mypy_attr_defined (MINOR) streams/async_job.py:162 Check that attribute exists Module has no attribute "parse" . Code line: new_start = pendulum.parse(self._params["time_range"]["since"]...
python:mypy_no_untyped_def (MINOR) streams/async_job.py:172 Check that every function has an annotation Function is missing a type annotation . Code line: def start(self, batch=None):
python:mypy_valid_type (MINOR) streams/async_job.py:208 Check that type (annotation) is valid Function is missing a return type annotation [no-untyped-def] def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:244 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:mypy_var_annotated (MINOR) streams/async_job_manager.py:46 Require variable annotation if type can't be inferred Need type annotation for "_running_jobs" (hint: "_running_jobs: List[] = ...") . Code line: self._running_jobs = []
python:S3776 (CRITICAL) streams/async_job_manager.py:87 Cognitive Complexity of functions should not be too high Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
python:S112 (MAJOR) streams/async_job_manager.py:113 "Exception" and "BaseException" should not be raised Replace this generic exception class with a more specific one.
python:mypy_var_annotated (MINOR) streams/insights_streams.py:87 Require variable annotation if type can't be inferred Need type annotation for "_completed_slices" (hint: "_completed_slices: Set[] = ...") . Code line: self._completed_slices = set()
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:139 Check that every function has an annotation Function is missing a return type annotation . Code line: def state(self, value: MutableMapping[str, Any]):
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:149 Check that every function has an annotation Function is missing a return type annotation . Code line: def _advance_cursor(self):
python:mypy_name_defined (MINOR) streams/insights_streams.py:178 Check that name is defined Function is missing a type annotation for one or more arguments [no-untyped-def] def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str...
python:S1134 (MAJOR) streams/insights_streams.py:214 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:227 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_override (MINOR) streams/insights_streams.py:227 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingIncrementalStream" . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py Check that every function has an annotation Function is missing a return type annotation . Code line: def done(self):
flake8:F401 (MAJOR) streams/insights_streams.py module imported but unused 'source_facebook_marketing.streams.async_job.ParentAsyncJob' imported but unused
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
python:mypy_no_untyped_def (MINOR) streams/async_job.py:44 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:63 Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:91 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart(self):
python:S1226 (MINOR) streams/async_job.py:113 Function parameters initial values should not be ignored Introduce a new variable or use its initial value before reassigning 'batch'.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:113 Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py Check that every function has an annotation Function is missing a return type annotation . Code line: def start_jobs(self):
python:mypy_no_any_return (MINOR) streams/async_job_manager.py:144 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Tuple[float, float]" . Code line: return self._api.api.ads_insights_throttle
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:100 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def _get_campaign_ids(self, params) -> List[str]:
python:isort_need_format (MINOR) unit_tests/test_async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) integration_tests/test_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:235 Check that every function has an annotation Function is missing a return type annotation . Code line: def _batch_success_handler(self, response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:240 Check that every function has an annotation Function is missing a return type annotation . Code line: def _batch_failure_handler(self, response: FacebookResponse):
python:S3457 (MAJOR) streams/async_job.py:251 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:268 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S5886 (MAJOR) streams/streams.py Function return types should be consistent with their type hint Return a value of type "str" instead of "NoneType" or update function "fetch_thumbnail_data_url" type hint.
python:S5806 (MAJOR) streams/streams.py Builtins should not be shadowed by local variables Rename this variable; it shadows a builtin.
python:mypy_import (MINOR) streams/streams.py:21 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_no_untyped_def (MINOR) streams/streams.py:223 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, fetch_thumbnail_images: bool = False, **kwargs)...
python:mypy_assignment (MINOR) streams/async_job.py:271 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "DateTime", variable has type "None") . Code line: self._finish_time = pendulum.now() # TODO: is not actual ...
python:mypy_assignment (MINOR) streams/async_job.py:274 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "DateTime", variable has type "None") . Code line: self._finish_time = pendulum.now()
python:mypy_attr_defined (MINOR) streams/async_job.py:276 Check that attribute exists pendulum.duration? has no attribute "in_seconds" . Code line: ...nfo(f"{self.job} has status {job_status} after {self.elapsed_time.in...
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:134 Check that every function has an annotation Function is missing a return type annotation . Code line: def _wait_throttle_limit_down(self):
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:156 Check that every function has an annotation Function is missing a return type annotation . Code line: def _update_api_throttle_limit(self):
python:mypy_var_annotated (MINOR) streams/insights_streams.py:66 Require variable annotation if type can't be inferred Need type annotation for "breakdowns" (hint: "breakdowns: List[] = ...") . Code line: breakdowns = []
python:mypy_name_defined (MINOR) streams/insights_streams.py:68 Check that name is defined Function is missing a type annotation for one or more arguments [no-untyped-def] def init(
python:mypy_no_any_return (MINOR) streams/insights_streams.py:93 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return casing.camel_to_snake(name)
python:mypy_no_any_return (MINOR) streams/insights_streams.py:252 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 schema
python:mypy_var_annotated (MINOR) streams/insights_streams.py:285 Require variable annotation if type can't be inferred Need type annotation for "breakdowns" (hint: "breakdowns: List[] = ...") . Code line: breakdowns = []
python:mypy_no_untyped_def (MINOR) streams/streams.py Check that every function has an annotation Function is missing a return type annotation . Code line: def _extend_record(self, obj: Any, **kwargs):
python:mypy_no_untyped_def (MINOR) streams/streams.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def _extend_record(self, obj: Any, **kwargs):
python:mypy_no_untyped_def (MINOR) streams/streams.py:87 Check that every function has an annotation Function is missing a return type annotation . Code line: def success(response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/streams.py:90 Check that every function has an annotation Function is missing a return type annotation . Code line: def failure(response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/streams.py:131 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_no_untyped_def (MINOR) streams/streams.py:169 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, start_date: datetime, end_date: datetime, **kwa...
python:mypy_no_untyped_def (MINOR) streams/streams.py:174 Check that every function has an annotation Function is missing a return type annotation . Code line: def get_updated_state(self, current_stream_state: MutableMapping[s...
python:mypy_attr_defined (MINOR) streams/streams.py:179 Check that attribute exists Module has no attribute "parse" . Code line: max_cursor = max(pendulum.parse(state_value), pendulum.parse(r...
python:mypy_no_untyped_def (MINOR) streams/streams.py:188 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_override (MINOR) streams/streams.py:188 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingStream" . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_no_any_return (MINOR) streams/streams.py:192 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "MutableMapping[str, Any]" . Code line: return params
python:mypy_attr_defined (MINOR) streams/streams.py:197 Check that attribute exists Module has no attribute "parse" . Code line: ...value = self.start_date if not state_value else pendulum.parse(state...
python:mypy_assignment (MINOR) streams/streams.py:220 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", base class "FBMarketingStream" defined the type as "None") . Code line: entity_prefix = "adcreative"
python:mypy_no_any_return (MINOR) streams/streams.py:246 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Iterator[Any]" . Code line: return self._api.account.get_ad_creatives(params=params)
python:mypy_assignment (MINOR) streams/streams.py:252 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", base class "FBMarketingStream" defined the type as "None") . Code line: entity_prefix = "ad"
python:mypy_no_untyped_def (MINOR) streams/streams.py:255 Check that every function has an annotation Function is missing a return type annotation . Code line: def _read_records(self, params: Mapping[str, Any]):
python:S1763 (MAJOR) unit_tests/test_async_job.py:58 All code should be reachable Delete this unreachable code or refactor the code to make it reachable.
flake8:E501 (MAJOR) source_facebook_marketing/source.py:113 line too long (82 > 79 characters) line too long (148 > 140 characters)
python:mypy_no_untyped_def (MINOR) streams/streams.py:66 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api: "API", include_deleted: bool = False, **kw...
python:mypy_override (MINOR) streams/insights_streams.py:96 Check that method override is compatible with base class Signature of "primary_key" incompatible with supertype "FBMarketingStream" . Code line: def primary_key(self) -> Optional[Union[str, List[str], List[List[...
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:48 Check that every function has an annotation Function is missing a return type annotation . Code line: def _start_jobs(self):
python:S1134 (MAJOR) streams/streams.py:91 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/streams.py:76 Check that every function has an annotation Function is missing a type annotation . Code line: def _execute_batch(self, batch):
python:mypy_no_redef (MINOR) streams/streams.py:100 Check that each name is defined once Name "api_batch" already defined on line 94 . Code line: api_batch: FacebookAdsApiBatch = self._api.api.new_bat...
python:mypy_assignment (MINOR) streams/streams.py:117 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "Iterable[MutableMapping[str, Any]]", variable has type "Generator[Any, None, None]") . Code line: loaded_records_iter = self.execute_in_batch(loaded_records...
python:mypy_index (MINOR) streams/streams.py:242 Check indexing operations Unsupported target for indexed assignment ("Mapping[str, Any]") . Code line: record["thumbnail_data_url"] = fetch_thumbnail_data_ur...
flake8:E501 (MAJOR) source_facebook_marketing/source.py line too long (82 > 79 characters) line too long (147 > 140 characters)
python:isort_need_format (MINOR) source_facebook_marketing/api.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:black_need_format (MINOR) streams/async_job_manager.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 4 code part(s) should be updated.
python:isort_need_format (MINOR) streams/async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:black_need_format (MINOR) streams/insights_streams.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 4 code part(s) should be updated.
python:isort_need_format (MINOR) streams/insights_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_attr_defined (MINOR) streams/insights_streams.py:141 Check that attribute exists Module has no attribute "parse" . Code line: self._cursor_value = pendulum.parse(value[self.cursor_field])....
python:mypy_attr_defined (MINOR) streams/insights_streams.py:142 Check that attribute exists Module has no attribute "parse" . Code line: self._completed_slices = set(pendulum.parse(v).date() for v in...
python:mypy_no_any_return (MINOR) streams/insights_streams.py:147 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Iterator[Any]" . Code line: return date_range.range("days", self.time_increment)
python:black_need_format (MINOR) streams/streams.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 2 code part(s) should be updated.
python:isort_need_format (MINOR) streams/streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 2 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/streams.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api: 'API', include_deleted: bool = False, **kw...
python:black_need_format (MINOR) source_facebook_marketing/source.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 3 code part(s) should be updated.
python:isort_need_format (MINOR) source_facebook_marketing/source.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:black_need_format (MINOR) streams/async_job.py Please run one of the commands: "black --config ./pyproject.toml <path_to_updated_folder>" or "./gradlew format" 5 code part(s) should be updated.
python:isort_need_format (MINOR) streams/async_job.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
flake8:F401 (MAJOR) source_facebook_marketing/api.py module imported but unused 'datetime.datetime' imported but unused
python:mypy_no_untyped_def (MINOR) source_facebook_marketing/api.py:106 Check that every function has an annotation Function is missing a return type annotation . Code line: def _update_insights_throttle_limit(self, response: FacebookRespon...
python:S1134 (MAJOR) source_facebook_marketing/source.py:178 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:19 Check that every function has an annotation Function is missing a type annotation . Code line: def chunks(data, n):
flake8:E203 (MAJOR) streams/async_job.py:22 whitespace before ‘:’ whitespace before ':'
python:mypy_no_untyped_def (MINOR) streams/async_job.py:40 Check that every function has an annotation Function is missing a type annotation . Code line: def start(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:49 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:74 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, jobs: List[AsyncJob]):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:79 Check that every function has an annotation Function is missing a type annotation . Code line: def start(self, batch=None):
python:S125 (MAJOR) streams/async_job.py:81 Sections of code should not be commented out Remove this commented out code.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:99 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:139 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, api, edge_object: Any, params: Mapping[str, Any...
python:mypy_attr_defined (MINOR) streams/async_job.py:162 Check that attribute exists Module has no attribute "parse" . Code line: new_start = pendulum.parse(self._params["time_range"]["since"]...
python:mypy_no_untyped_def (MINOR) streams/async_job.py:172 Check that every function has an annotation Function is missing a type annotation . Code line: def start(self, batch=None):
python:mypy_valid_type (MINOR) streams/async_job.py:208 Check that type (annotation) is valid Function is missing a return type annotation [no-untyped-def] def restart_number(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:244 Check that every function has an annotation Function is missing a return type annotation . Code line: def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
python:mypy_var_annotated (MINOR) streams/async_job_manager.py:46 Require variable annotation if type can't be inferred Need type annotation for "_running_jobs" (hint: "_running_jobs: List[] = ...") . Code line: self._running_jobs = []
python:S3776 (CRITICAL) streams/async_job_manager.py:87 Cognitive Complexity of functions should not be too high Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.
python:S112 (MAJOR) streams/async_job_manager.py:113 "Exception" and "BaseException" should not be raised Replace this generic exception class with a more specific one.
python:mypy_var_annotated (MINOR) streams/insights_streams.py:87 Require variable annotation if type can't be inferred Need type annotation for "_completed_slices" (hint: "_completed_slices: Set[] = ...") . Code line: self._completed_slices = set()
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:139 Check that every function has an annotation Function is missing a return type annotation . Code line: def state(self, value: MutableMapping[str, Any]):
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:149 Check that every function has an annotation Function is missing a return type annotation . Code line: def _advance_cursor(self):
python:mypy_name_defined (MINOR) streams/insights_streams.py:178 Check that name is defined Function is missing a type annotation for one or more arguments [no-untyped-def] def stream_slices(self, **kwargs) -> Iterable[Optional[Mapping[str...
python:S1134 (MAJOR) streams/insights_streams.py:214 Track uses of "FIXME" tags Take the required action to fix the issue indicated by this "FIXME" comment.
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:227 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_override (MINOR) streams/insights_streams.py:227 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingIncrementalStream" . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py Check that every function has an annotation Function is missing a return type annotation . Code line: def done(self):
flake8:F401 (MAJOR) streams/insights_streams.py module imported but unused 'source_facebook_marketing.streams.async_job.ParentAsyncJob' imported but unused
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
flake8:E251 (MAJOR) streams/async_job.py unexpected spaces around keyword / parameter equals unexpected spaces around keyword / parameter equals
python:mypy_no_untyped_def (MINOR) streams/async_job.py:44 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart(self):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:63 Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:91 Check that every function has an annotation Function is missing a return type annotation . Code line: def restart(self):
python:S1226 (MINOR) streams/async_job.py:113 Function parameters initial values should not be ignored Introduce a new variable or use its initial value before reassigning 'batch'.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:113 Check that every function has an annotation Function is missing a type annotation . Code line: def update_job(self, batch=None):
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py Check that every function has an annotation Function is missing a return type annotation . Code line: def start_jobs(self):
python:mypy_no_any_return (MINOR) streams/async_job_manager.py:144 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Tuple[float, float]" . Code line: return self._api.api.ads_insights_throttle
python:mypy_no_untyped_def (MINOR) streams/insights_streams.py:100 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def _get_campaign_ids(self, params) -> List[str]:
python:isort_need_format (MINOR) unit_tests/test_async_job_manager.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:isort_need_format (MINOR) integration_tests/test_streams.py Please run one of the commands: "isort <path_to_updated_folder>" or "./gradlew format" 1 code part(s) should be updated.
python:mypy_no_untyped_def (MINOR) streams/async_job.py:235 Check that every function has an annotation Function is missing a return type annotation . Code line: def _batch_success_handler(self, response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/async_job.py:240 Check that every function has an annotation Function is missing a return type annotation . Code line: def _batch_failure_handler(self, response: FacebookResponse):
python:S3457 (MAJOR) streams/async_job.py:251 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S3457 (MAJOR) streams/async_job.py:268 String formatting should be used correctly Add argument(s) corresponding to the message's replacement field(s).
python:S5886 (MAJOR) streams/streams.py Function return types should be consistent with their type hint Return a value of type "str" instead of "NoneType" or update function "fetch_thumbnail_data_url" type hint.
python:S5806 (MAJOR) streams/streams.py Builtins should not be shadowed by local variables Rename this variable; it shadows a builtin.
python:mypy_import (MINOR) streams/streams.py:21 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_no_untyped_def (MINOR) streams/streams.py:223 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, fetch_thumbnail_images: bool = False, **kwargs)...
python:mypy_assignment (MINOR) streams/async_job.py:271 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "DateTime", variable has type "None") . Code line: self._finish_time = pendulum.now() # TODO: is not actual ...
python:mypy_assignment (MINOR) streams/async_job.py:274 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "DateTime", variable has type "None") . Code line: self._finish_time = pendulum.now()
python:mypy_attr_defined (MINOR) streams/async_job.py:276 Check that attribute exists pendulum.duration? has no attribute "in_seconds" . Code line: ...nfo(f"{self.job} has status {job_status} after {self.elapsed_time.in...
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:134 Check that every function has an annotation Function is missing a return type annotation . Code line: def _wait_throttle_limit_down(self):
python:mypy_no_untyped_def (MINOR) streams/async_job_manager.py:156 Check that every function has an annotation Function is missing a return type annotation . Code line: def _update_api_throttle_limit(self):
python:mypy_var_annotated (MINOR) streams/insights_streams.py:66 Require variable annotation if type can't be inferred Need type annotation for "breakdowns" (hint: "breakdowns: List[] = ...") . Code line: breakdowns = []
python:mypy_name_defined (MINOR) streams/insights_streams.py:68 Check that name is defined Function is missing a type annotation for one or more arguments [no-untyped-def] def init(
python:mypy_no_any_return (MINOR) streams/insights_streams.py:93 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "str" . Code line: return casing.camel_to_snake(name)
python:mypy_no_any_return (MINOR) streams/insights_streams.py:252 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 schema
python:mypy_var_annotated (MINOR) streams/insights_streams.py:285 Require variable annotation if type can't be inferred Need type annotation for "breakdowns" (hint: "breakdowns: List[] = ...") . Code line: breakdowns = []
python:mypy_no_untyped_def (MINOR) streams/streams.py Check that every function has an annotation Function is missing a return type annotation . Code line: def _extend_record(self, obj: Any, **kwargs):
python:mypy_no_untyped_def (MINOR) streams/streams.py Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def _extend_record(self, obj: Any, **kwargs):
python:mypy_no_untyped_def (MINOR) streams/streams.py:87 Check that every function has an annotation Function is missing a return type annotation . Code line: def success(response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/streams.py:90 Check that every function has an annotation Function is missing a return type annotation . Code line: def failure(response: FacebookResponse):
python:mypy_no_untyped_def (MINOR) streams/streams.py:131 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, **kwargs) -> MutableMapping[str, Any]:
python:mypy_no_untyped_def (MINOR) streams/streams.py:169 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def init(self, start_date: datetime, end_date: datetime, **kwa...
python:mypy_no_untyped_def (MINOR) streams/streams.py:174 Check that every function has an annotation Function is missing a return type annotation . Code line: def get_updated_state(self, current_stream_state: MutableMapping[s...
python:mypy_attr_defined (MINOR) streams/streams.py:179 Check that attribute exists Module has no attribute "parse" . Code line: max_cursor = max(pendulum.parse(state_value), pendulum.parse(r...
python:mypy_no_untyped_def (MINOR) streams/streams.py:188 Check that every function has an annotation Function is missing a type annotation for one or more arguments . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_override (MINOR) streams/streams.py:188 Check that method override is compatible with base class Signature of "request_params" incompatible with supertype "FBMarketingStream" . Code line: def request_params(self, stream_state: Mapping[str, Any], **kwargs...
python:mypy_no_any_return (MINOR) streams/streams.py:192 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "MutableMapping[str, Any]" . Code line: return params
python:mypy_attr_defined (MINOR) streams/streams.py:197 Check that attribute exists Module has no attribute "parse" . Code line: ...value = self.start_date if not state_value else pendulum.parse(state...
python:mypy_assignment (MINOR) streams/streams.py:220 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", base class "FBMarketingStream" defined the type as "None") . Code line: entity_prefix = "adcreative"
python:mypy_no_any_return (MINOR) streams/streams.py:246 Reject returning value with "Any" type if return type is not "Any" Returning Any from function declared to return "Iterator[Any]" . Code line: return self._api.account.get_ad_creatives(params=params)
python:mypy_assignment (MINOR) streams/streams.py:252 Check that assigned value is compatible with target Incompatible types in assignment (expression has type "str", base class "FBMarketingStream" defined the type as "None") . Code line: entity_prefix = "ad"
python:mypy_no_untyped_def (MINOR) streams/streams.py:255 Check that every function has an annotation Function is missing a return type annotation . Code line: def _read_records(self, params: Mapping[str, Any]):

Coverage (50.0%)

File Coverage File Coverage
integration_tests/acceptance.py 0.0 integration_tests/conftest.py 0.0
integration_tests/test_streams.py 0.0 main.py 0.0
setup.py 0.0 source_facebook_marketing/init.py 100.0
source_facebook_marketing/api.py 76.7 source_facebook_marketing/source.py 31.7
source_facebook_marketing/streams/init.py 100.0 source_facebook_marketing/streams/async_job.py 72.6
source_facebook_marketing/streams/async_job_manager.py 47.6 source_facebook_marketing/streams/common.py 97.1
source_facebook_marketing/streams/insights_streams.py 43.4 source_facebook_marketing/streams/streams.py 76.6
unit_tests/conftest.py 0.0 unit_tests/test_async_job.py 0.0
unit_tests/test_async_job_manager.py 0.0 unit_tests/test_client.py 0.0
unit_tests/test_deep_merge.py 0.0

Please sign in to comment.