YAPF 0.27.0

This commit is contained in:
Ivan Kravets
2019-05-30 23:42:15 +03:00
parent 1598c8197e
commit 61db0f1d6a
44 changed files with 920 additions and 1000 deletions

View File

@@ -67,11 +67,11 @@ class MiscRPC(object):
html_or_json = json.loads(html_or_json)
assert "items_html" in html_or_json
soup = BeautifulSoup(html_or_json['items_html'], "html.parser")
tweet_nodes = soup.find_all(
"div", attrs={
"class": "tweet",
"data-tweet-id": True
})
tweet_nodes = soup.find_all("div",
attrs={
"class": "tweet",
"data-tweet-id": True
})
result = yield defer.DeferredList(
[self._parse_tweet_node(node, username) for node in tweet_nodes],
consumeErrors=True)
@@ -97,13 +97,14 @@ class MiscRPC(object):
node.get("data-expanded-url")
for node in (quote_text_node or text_node).find_all(
class_="twitter-timeline-link",
attrs={"data-expanded-url": True})
]
attrs={"data-expanded-url": True}
)
] # yapf: disable
# fetch data from iframe card
if (not photos or not urls) and tweet.get("data-card2-type"):
iframe_node = tweet.find(
"div", attrs={"data-full-card-iframe-url": True})
iframe_node = tweet.find("div",
attrs={"data-full-card-iframe-url": True})
if iframe_node:
iframe_card = yield self._fetch_iframe_card(
twitter_url + iframe_node.get("data-full-card-iframe-url"),
@@ -161,8 +162,8 @@ class MiscRPC(object):
url_node = soup.find("a", class_="TwitterCard-container")
text_node = soup.find("div", class_="SummaryCard-content")
if text_node:
text_node.find(
"span", class_="SummaryCard-destination").decompose()
text_node.find("span",
class_="SummaryCard-destination").decompose()
defer.returnValue({
"photo":
photo_node.get("data-src") if photo_node else None,

View File

@@ -54,8 +54,10 @@ class OSRPC(object):
session = helpers.requests_session()
if data:
r = yield session.post(
uri, data=data, headers=headers, timeout=timeout)
r = yield session.post(uri,
data=data,
headers=headers,
timeout=timeout)
else:
r = yield session.get(uri, headers=headers, timeout=timeout)

View File

@@ -29,8 +29,9 @@ from platformio.compat import get_filesystem_encoding
from platformio.ide.projectgenerator import ProjectGenerator
from platformio.managers.platform import PlatformManager
from platformio.project.config import ProjectConfig
from platformio.project.helpers import (
get_project_libdeps_dir, get_project_src_dir, is_platformio_project)
from platformio.project.helpers import (get_project_libdeps_dir,
get_project_src_dir,
is_platformio_project)
class ProjectRPC(object):

View File

@@ -48,8 +48,8 @@ class JSONRPCServerProtocol(WebSocketServerProtocol):
if isinstance(failure.value, JSONRPCDispatchException):
e = failure.value
else:
e = JSONRPCDispatchException(
code=4999, message=failure.getErrorMessage())
e = JSONRPCDispatchException(code=4999,
message=failure.getErrorMessage())
del response["result"]
response['error'] = e.error._data # pylint: disable=protected-access
print(response['error'])