Skip to content

Bump pylint from 2.15.9 to 2.17.4 #380

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

Merged
merged 2 commits into from
May 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ requests = "==2.31.0"

[dev-packages]
pytest = "==7.3.1"
pylint = "==2.15.9"
pylint = "==2.17.4"
tox = "==4.5.2"
tox-pipenv = "==1.10.1"
importlib_metadata = {version = "*", markers="python_version < '3.8'"}
Expand Down
18 changes: 9 additions & 9 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion scraper/src/config/browser_handler.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import builtins
import re
import os
from selenium import webdriver
Expand Down Expand Up @@ -29,7 +30,7 @@ def init(config_original_content, js_render, user_agent):
CHROMEDRIVER_PATH = os.environ.get('CHROMEDRIVER_PATH',
"/usr/bin/chromedriver")
if not os.path.isfile(CHROMEDRIVER_PATH):
raise Exception(
raise builtins.Exception(
f"Env CHROMEDRIVER_PATH='{CHROMEDRIVER_PATH}' is not a path to a file")
driver = webdriver.Chrome(
CHROMEDRIVER_PATH,
Expand Down
27 changes: 15 additions & 12 deletions scraper/src/config/config_validator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@


import builtins


class ConfigValidator:
config = None

Expand All @@ -18,52 +21,52 @@ def validate(self):
# Start urls must be an array
if self.config.start_urls and not isinstance(self.config.start_urls,
list):
raise Exception('start_urls should be list')
raise builtins.Exception('start_urls should be list')

# Stop urls must be an array
if self.config.stop_urls and not isinstance(self.config.stop_urls,
list):
raise Exception('stop_urls should be list')
raise builtins.Exception('stop_urls should be list')

# Custom settings must be a dict
if self.config.custom_settings and not isinstance(self.config.custom_settings,
dict):
raise Exception('custom_settings must be a dictionary')
raise builtins.Exception('custom_settings must be a dictionary')

if self.config.js_render and not isinstance(self.config.js_render,
bool):
raise Exception('js_render should be boolean')
raise builtins.Exception('js_render should be boolean')

# `js_wait` is set to 0s by default unless it is specified
if self.config.js_wait and not isinstance(self.config.js_wait, int):
raise Exception('js_wait should be integer')
raise builtins.Exception('js_wait should be integer')

if self.config.use_anchors and not isinstance(self.config.use_anchors,
bool):
raise Exception('use_anchors should be boolean')
raise builtins.Exception('use_anchors should be boolean')

if self.config.sitemap_alternate_links and not isinstance(
self.config.sitemap_alternate_links, bool):
raise Exception('sitemap_alternate_links should be boolean')
raise builtins.Exception('sitemap_alternate_links should be boolean')

if self.config.sitemap_urls_regexs and not self.config.sitemap_urls:
raise Exception(
raise builtins.Exception(
'You gave an regex to parse sitemap but you didn\'t provide a sitemap url')

if self.config.sitemap_urls_regexs and not self.config.sitemap_urls:
for regex in self.config.sitemap_urls_regex:
if not isinstance(regex, str):
raise Exception(
raise builtins.Exception(
'You gave an bad regex: ' + regex + ' must be a string')

if self.config.force_sitemap_urls_crawling and not self.config.sitemap_urls:
raise Exception(
raise builtins.Exception(
'You want to force the sitemap crawling but you didn\'t provide a sitemap url')

if not self.config.scrape_start_urls and not self.config.scrap_start_urls:
raise Exception(
raise builtins.Exception(
'Please use only the new variable name: scrape_start_urls')

if self.config.nb_hits_max and not isinstance(self.config.nb_hits_max,
int):
raise Exception('nb_hits_max should be integer')
raise builtins.Exception('nb_hits_max should be integer')
3 changes: 2 additions & 1 deletion scraper/src/config/selectors_parser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import builtins
from ..helpers import css_to_xpath


Expand Down Expand Up @@ -27,7 +28,7 @@ def _parse_selectors_set(config_selectors):
# Type
if 'type' in selectors_set[key]:
if selectors_set[key]['type'] not in ['xpath', 'css']:
raise Exception(
raise builtins.Exception(
selectors_set[key][
'type'] + 'is not a good selector type, it should be `xpath` or `css`')
else:
Expand Down
5 changes: 3 additions & 2 deletions scraper/src/config/urls_parser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import builtins
import re
import copy

Expand Down Expand Up @@ -55,11 +56,11 @@ def parse(config_start_urls):
start_url['variables'][match]['url'],
start_url['variables'][match]['js'])
else:
raise Exception(
raise builtins.Exception(
"Bad arguments for variables." + match + " for url " +
start_url['url'])
else:
raise Exception(
raise builtins.Exception(
"Missing " + match + " in variables" + " for url " +
start_url['url'])

Expand Down