Use stronger pylint configuration
This commit is contained in:
parent
102f27c4ef
commit
692cbc000d
@ -62,9 +62,7 @@ confidence=
|
|||||||
# --disable=W".
|
# --disable=W".
|
||||||
disable=invalid-name,
|
disable=invalid-name,
|
||||||
missing-docstring,
|
missing-docstring,
|
||||||
line-too-long,
|
|
||||||
too-many-lines,
|
too-many-lines,
|
||||||
bad-whitespace,
|
|
||||||
print-statement,
|
print-statement,
|
||||||
parameter-unpacking,
|
parameter-unpacking,
|
||||||
unpacking-in-except,
|
unpacking-in-except,
|
||||||
@ -83,7 +81,6 @@ disable=invalid-name,
|
|||||||
useless-suppression,
|
useless-suppression,
|
||||||
deprecated-pragma,
|
deprecated-pragma,
|
||||||
use-symbolic-message-instead,
|
use-symbolic-message-instead,
|
||||||
cyclic-import,
|
|
||||||
too-many-instance-attributes,
|
too-many-instance-attributes,
|
||||||
too-many-public-methods,
|
too-many-public-methods,
|
||||||
too-many-branches,
|
too-many-branches,
|
||||||
@ -91,7 +88,6 @@ disable=invalid-name,
|
|||||||
too-many-locals,
|
too-many-locals,
|
||||||
too-many-statements,
|
too-many-statements,
|
||||||
no-else-return,
|
no-else-return,
|
||||||
inconsistent-return-statements,
|
|
||||||
no-else-raise,
|
no-else-raise,
|
||||||
unnecessary-pass,
|
unnecessary-pass,
|
||||||
wildcard-import,
|
wildcard-import,
|
||||||
@ -362,7 +358,7 @@ indent-after-paren=4
|
|||||||
indent-string=' '
|
indent-string=' '
|
||||||
|
|
||||||
# Maximum number of characters on a single line.
|
# Maximum number of characters on a single line.
|
||||||
max-line-length=100
|
max-line-length=120
|
||||||
|
|
||||||
# Maximum number of lines in a module.
|
# Maximum number of lines in a module.
|
||||||
max-module-lines=1000
|
max-module-lines=1000
|
||||||
|
@ -15,5 +15,5 @@ else:
|
|||||||
from .exceptions import *
|
from .exceptions import *
|
||||||
from .instaloader import Instaloader
|
from .instaloader import Instaloader
|
||||||
from .instaloadercontext import InstaloaderContext
|
from .instaloadercontext import InstaloaderContext
|
||||||
from .structures import (Highlight, Post, PostSidecarNode, PostComment, PostCommentAnswer, PostLocation, Profile, Story, StoryItem,
|
from .structures import (Highlight, Post, PostSidecarNode, PostComment, PostCommentAnswer, PostLocation, Profile, Story,
|
||||||
load_structure_from_file, save_structure_to_file)
|
StoryItem, load_structure_from_file, save_structure_to_file)
|
||||||
|
@ -21,7 +21,8 @@ import urllib3 # type: ignore
|
|||||||
|
|
||||||
from .exceptions import *
|
from .exceptions import *
|
||||||
from .instaloadercontext import InstaloaderContext
|
from .instaloadercontext import InstaloaderContext
|
||||||
from .structures import Highlight, JsonExportable, Post, PostLocation, Profile, Story, StoryItem, save_structure_to_file, load_structure_from_file
|
from .structures import (Highlight, JsonExportable, Post, PostLocation, Profile, Story, StoryItem,
|
||||||
|
save_structure_to_file, load_structure_from_file)
|
||||||
|
|
||||||
|
|
||||||
def get_default_session_filename(username: str) -> str:
|
def get_default_session_filename(username: str) -> str:
|
||||||
@ -369,7 +370,8 @@ class Instaloader:
|
|||||||
profile_pic_identifier, profile_pic_extension)
|
profile_pic_identifier, profile_pic_extension)
|
||||||
content_length = profile_pic_response.headers.get('Content-Length', None)
|
content_length = profile_pic_response.headers.get('Content-Length', None)
|
||||||
if os.path.isfile(filename) and (not self.context.is_logged_in or
|
if os.path.isfile(filename) and (not self.context.is_logged_in or
|
||||||
content_length is not None and os.path.getsize(filename) >= int(content_length)):
|
(content_length is not None and
|
||||||
|
os.path.getsize(filename) >= int(content_length))):
|
||||||
self.context.log(filename + ' already exists')
|
self.context.log(filename + ' already exists')
|
||||||
return None
|
return None
|
||||||
self.context.write_raw(profile_pic_bytes if profile_pic_bytes else profile_pic_response, filename)
|
self.context.write_raw(profile_pic_bytes if profile_pic_bytes else profile_pic_response, filename)
|
||||||
@ -418,7 +420,8 @@ class Instaloader:
|
|||||||
:raises InvalidArgumentException: If the provided username does not exist.
|
:raises InvalidArgumentException: If the provided username does not exist.
|
||||||
:raises BadCredentialsException: If the provided password is wrong.
|
:raises BadCredentialsException: If the provided password is wrong.
|
||||||
:raises ConnectionException: If connection to Instagram failed.
|
:raises ConnectionException: If connection to Instagram failed.
|
||||||
:raises TwoFactorAuthRequiredException: First step of 2FA login done, now call :meth:`Instaloader.two_factor_login`."""
|
:raises TwoFactorAuthRequiredException: First step of 2FA login done, now call
|
||||||
|
:meth:`Instaloader.two_factor_login`."""
|
||||||
self.context.login(user, passwd)
|
self.context.login(user, passwd)
|
||||||
|
|
||||||
def two_factor_login(self, two_factor_code) -> None:
|
def two_factor_login(self, two_factor_code) -> None:
|
||||||
@ -641,7 +644,8 @@ class Instaloader:
|
|||||||
continue
|
continue
|
||||||
self.context.log("[%3i/%3i] " % (count, totalcount), end="", flush=True)
|
self.context.log("[%3i/%3i] " % (count, totalcount), end="", flush=True)
|
||||||
count += 1
|
count += 1
|
||||||
with self.context.error_catcher('Download highlights \"{}\" from user {}'.format(user_highlight.title, name)):
|
with self.context.error_catcher('Download highlights \"{}\" from user {}'.format(user_highlight.title,
|
||||||
|
name)):
|
||||||
downloaded = self.download_storyitem(item, filename_target
|
downloaded = self.download_storyitem(item, filename_target
|
||||||
if filename_target
|
if filename_target
|
||||||
else Path(name) / Path(user_highlight.title))
|
else Path(name) / Path(user_highlight.title))
|
||||||
|
@ -181,7 +181,8 @@ class InstaloaderContext:
|
|||||||
:raises InvalidArgumentException: If the provided username does not exist.
|
:raises InvalidArgumentException: If the provided username does not exist.
|
||||||
:raises BadCredentialsException: If the provided password is wrong.
|
:raises BadCredentialsException: If the provided password is wrong.
|
||||||
:raises ConnectionException: If connection to Instagram failed.
|
:raises ConnectionException: If connection to Instagram failed.
|
||||||
:raises TwoFactorAuthRequiredException: First step of 2FA login done, now call :meth:`Instaloader.two_factor_login`."""
|
:raises TwoFactorAuthRequiredException: First step of 2FA login done, now call
|
||||||
|
:meth:`Instaloader.two_factor_login`."""
|
||||||
import http.client
|
import http.client
|
||||||
# pylint:disable=protected-access
|
# pylint:disable=protected-access
|
||||||
http.client._MAXHEADERS = 200
|
http.client._MAXHEADERS = 200
|
||||||
|
@ -190,12 +190,16 @@ class Post:
|
|||||||
@property
|
@property
|
||||||
def date_local(self) -> datetime:
|
def date_local(self) -> datetime:
|
||||||
"""Timestamp when the post was created (local time zone)."""
|
"""Timestamp when the post was created (local time zone)."""
|
||||||
return datetime.fromtimestamp(self._node["date"] if "date" in self._node else self._node["taken_at_timestamp"])
|
return datetime.fromtimestamp(self._node["date"]
|
||||||
|
if "date" in self._node
|
||||||
|
else self._node["taken_at_timestamp"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def date_utc(self) -> datetime:
|
def date_utc(self) -> datetime:
|
||||||
"""Timestamp when the post was created (UTC)."""
|
"""Timestamp when the post was created (UTC)."""
|
||||||
return datetime.utcfromtimestamp(self._node["date"] if "date" in self._node else self._node["taken_at_timestamp"])
|
return datetime.utcfromtimestamp(self._node["date"]
|
||||||
|
if "date" in self._node
|
||||||
|
else self._node["taken_at_timestamp"])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def date(self) -> datetime:
|
def date(self) -> datetime:
|
||||||
|
Loading…
Reference in New Issue
Block a user