Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDL-6737 added pylint and resolved the errors #87

Conversation

namrata270998
Copy link
Contributor

Description of change

  • Added pylint in the circleci and fixed its corresponding errors

Manual QA steps

Risks

Rollback steps

  • revert this branch

except InvalidDateRangeEnd as ex:
LOGGER.warn("Bing reported that the requested report date range ended outside of "
except InvalidDateRangeEnd as ex: # pylint: disable=unused-variable
LOGGER.warn("Bing reported that the requested report date range ended outside of " # pylint: disable=deprecated-method
Copy link
Contributor

Choose a reason for hiding this comment

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

Put deprecated-method in config.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

singer.write_bookmark(STATE, state_key, 'request_id', None)
singer.write_state(STATE)
return False


def get_report_request_id(client, account_id, report_stream, report_name,
def get_report_request_id(client, account_id, report_stream, report_name, # pylint: disable=too-many-arguments
Copy link
Contributor

Choose a reason for hiding this comment

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

Put too-many-arguments in config.yml and removed this from other places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


report_request = client.factory.create('{}Request'.format(report_name))
report_request = client.factory.create(f'{report_name}Request'.format(report_name)) # pylint: disable=consider-using-f-string
Copy link
Contributor

Choose a reason for hiding this comment

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

.format is not required if you are using f-stream. Please check the usage of f-stream

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

tap_bing_ads/__init__.py Outdated Show resolved Hide resolved
@dbshah1212 dbshah1212 self-requested a review October 14, 2021 07:39
@singer-io singer-io deleted a comment from namrata270998 Oct 14, 2021
@@ -102,7 +101,7 @@ def set_options(self, **kwargs):

def create_sdk_client(service, account_id):
LOGGER.info('Creating SOAP client with OAuth refresh credentials for service: %s, account_id %s',
service, account_id)
str(service), account_id)

Choose a reason for hiding this comment

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

Why we have added str?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We didn't need that, so removed it

'Error polling {} for account {} with request id {}'
.format(report_name, account_id, request_id))
LOGGER.warn('Error polling %s for account %s with request id %s',
report_name, str(account_id), str(request_id))

Choose a reason for hiding this comment

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

Need to remove str from here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

LOGGER.info('Generating report timed out: %s - from %s to %s',
report_name,
str(start_date),
str(end_date))

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link

@umangagrawal-crest umangagrawal-crest left a comment

Choose a reason for hiding this comment

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

@namrata270998 Remove str from the files, if not required

@@ -358,7 +357,7 @@ def discover_core_objects():
return core_object_streams

def get_report_schema(client, report_name):
column_obj_name = '{}Column'.format(report_name)
column_obj_name = '{}Column'.format(report_name) # pylint: disable=consider-using-f-string

Choose a reason for hiding this comment

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

We can disable consider-using-f-string directly into the config.yml command and remove all the disabled comments in the code because it is present at multiple places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

raise Exception('Non-200 ({}) response downloading report: {}'.format(
response.status_code, report_name))

raise Exception('Non-200 ({}) response downloading report: {}'.format(response.status_code, report_name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Reverte this change if it is not throwing any pylint error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -864,8 +855,7 @@ def build_report_request(client, account_id, report_stream, report_name,
report_columns = client.factory.create(
'ArrayOf{}Column'.format(report_name)
)
getattr(report_columns, '{}Column'.format(report_name)) \
.append(selected_fields)
getattr(report_columns, '{}Column'.format(report_name)).append(selected_fields)
Copy link
Contributor

Choose a reason for hiding this comment

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

revert this change if it is not throwing any pylint error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@namrata270998 namrata270998 changed the title added pylint and resolved the errors TDL-6737 added pylint and resolved the errors Dec 17, 2021
log_args = list(map(lambda arg: str(arg).replace('\n', '\\n'), args)) + list(map(lambda kv: '{}={}'.format(*kv), kwargs.items()))
LOGGER.info('Calling: %s(%s) for account: %s',
service_method.name,
','.join(log_args),
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the difference between what was before and the changes done?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have removed format and used %s instead, as pylint was throwing error for format

@namrata270998 namrata270998 merged commit 9791d73 into TDL-10048-Improve-BingAds-Reliability Dec 22, 2021
KrisPersonal pushed a commit that referenced this pull request Dec 29, 2021
* TDL-16888 Added code comments (#88)

* Added code comments

* Updated code comments

* UPdated comment

* TDL 7402 Add retry logic for 500 errors (#90)

* Initial commit for backoff error handling

* Added usage of error handling function

* Added detail comment for unittest cases

* Added coverage report to artifact

* added backoff for Expection(408)

* Updated backoff for async method

* updated backoof for poll_report

* Updated max_time

* Updated unittest cases

* removed Exception from backoff

* Updated backoff

* resolved unittest case errro

* Updated typo in comments

* Added test cases for Exception with error code 408

* Added comment for 408 error

* Added comments

* Updated unit test cases for 400 error

* Updated unit test case for create sdk client

* Merged elif condition

* Updated unit test cases

* Tdl 9721 missing top level breadcrumb for all streams (#91)

* TDL-9721: Updated metadata creation method and added top level breadcrum and un commented the breadcrum test case code.

* TDL-9721: Added top level breadcrumb.

* TDL-9721: Commented the code wich uncommented by mistake and failing tests

* TDL-9721: Removed unused changes

* TDL-9721: Updated automatic fields for report streams

* TDL-9721: Optimized the code of making replication key automatic

* TDL-9721: Added Unit tests with coverage

* TDL-9721: Added pip install nose

* TDL-9721: Updated file name

* TDL-9721: Updated config.yml

* TDL-9721: Added missing fieldExclusion

* TDL-9721: Added code comment

* TDL-9721: Updated the primary key of account stream as earlier.

* TDL-9721: Updated primary key for account stream in tests to make it same as catalog.

* TDL-9721: Updated primary key in catalog for account stream.

* TDL-9721: Updated the replication keys and test cases.

* TDL-9721: Updated replication key for discover mode only as other test using replication key.

* TDL-6737 added pylint and resolved the errors (#87)

* added pylint and resolved the errors

* added pylint in the setup.py

* corrected the pylint command

* added package name

* replaced dev with test in pip install

* resolved the comments

* removed f-string

* Added covergae report to artifact

* removed unittest case report

* removed config file changes

* revert back config.yml file changes

* Added back pylint in circleci

* resolved pylint error

* resolved comments

* removed str

* removed logger statements

* added consider-using-f-string in config.yml

* resolved comments

* resolved pylint errors

* pylint fixtures

Co-authored-by: prijendev <prijen.khokhani@crestdatasys.com>

* TDL-15251: Add required fields for age_gender_audience_report (#86)

* added required fields for age_gender_audience_report

* Added coverage report to artifact

* revert back coverage report changes

* revert back config.yml file changes

* resolved comments

* added missing assertions

* resolved cci failures

Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com>

* Tdl 7402 add retry logic for 500 errors (#96)

* Initial commit for backoff error handling

* Added usage of error handling function

* Added detail comment for unittest cases

* Added coverage report to artifact

* added backoff for Expection(408)

* Updated backoff for async method

* updated backoof for poll_report

* Updated max_time

* Updated unittest cases

* removed Exception from backoff

* Updated backoff

* resolved unittest case errro

* Updated typo in comments

* Added test cases for Exception with error code 408

* Added comment for 408 error

* Added comments

* Updated unit test cases for 400 error

* Updated unit test case for create sdk client

* Merged elif condition

* Updated unit test cases

* Tdl 15861 implement request timeout (#93)

* TDL-15861 implement request timeout

* added omment

* removed unused imports

* added comment

* resolved confilcts with the base

* resolved conflicts

* resolved conflicts

* resolved comments

* updated unittests

* added timeout for get calls

* corrected a typo in comment

* resolved comments

* resolved comments

Co-authored-by: prijendev <prijen.khokhani@crestdatasys.com>

Co-authored-by: prijendev <prijen.khokhani@crestdatasys.com>

* TDL-9902 removed the automatic fields from ad ext report (#85)

* TDL-9902 removed the automatic fields from ad ext report

* Added coverage report in artifact

* revert back config.yml file

* resolved comments

Co-authored-by: namrata270998 <namrata.brahmbhatt@crestdatasys.com>

Co-authored-by: prijendev <88327452+prijendev@users.noreply.github.com>
Co-authored-by: dbshah1212 <35164219+dbshah1212@users.noreply.github.com>
Co-authored-by: prijendev <prijen.khokhani@crestdatasys.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants