mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 06:47:41 +03:00
py3: fix some type issues detected by pyre with some type stubs
Summary: The issues were found by pyre with some type stubs generated via pytype: python36 -m pytype edenscm --no-report-errors -j 30 I didn't include the pytype generated stubs because most of them are `Any`. I'm trying to see if we can get something cleaner. Reviewed By: markbt Differential Revision: D19672435 fbshipit-source-id: c57f2ad3a981ddd4a3a267ff1c00e7bdb71e65ca
This commit is contained in:
parent
9266779248
commit
ad0c50a5cb
1
eden/scm/.gitignore
vendored
1
eden/scm/.gitignore
vendored
@ -68,6 +68,7 @@ edenscmnative/traceprof.cpp
|
||||
# Build output
|
||||
build
|
||||
debbuild/
|
||||
.pytype/
|
||||
rpmbuild/
|
||||
|
||||
# Rust libraries and extensions
|
||||
|
@ -855,21 +855,24 @@ class unbundle20(unpackermixin):
|
||||
return params
|
||||
|
||||
def _processallparams(self, paramsblock):
|
||||
# type: (bytes) -> Dict[str, str]
|
||||
# type: (bytes) -> Dict[str, Optional[str]]
|
||||
""""""
|
||||
params = util.sortdict()
|
||||
data = pycompat.decodeutf8(paramsblock)
|
||||
for param in data.split(" "):
|
||||
p = param.split("=", 1)
|
||||
p = [urllibcompat.unquote(i) for i in p]
|
||||
if len(p) < 2:
|
||||
p.append(None)
|
||||
self._processparam(*p)
|
||||
params[p[0]] = p[1]
|
||||
assert len(p) >= 1
|
||||
if len(p) == 1:
|
||||
self._processparam(p[0], None)
|
||||
params[p[0]] = None
|
||||
else:
|
||||
self._processparam(p[0], p[1])
|
||||
params[p[0]] = p[1]
|
||||
return params
|
||||
|
||||
def _processparam(self, name, value):
|
||||
# type: (str, str) -> None
|
||||
# type: (str, Optional[str]) -> None
|
||||
"""process a parameter, applying its effect if needed
|
||||
|
||||
Parameter starting with a lower case letter are advisory and will be
|
||||
|
@ -62,6 +62,12 @@ stringio = util.stringio
|
||||
|
||||
# templates of common command options
|
||||
|
||||
|
||||
def _typedflags(flags):
|
||||
# type: List[Tuple[str, str, Union[str, None, List[str]], str]] -> List[Tuple[str, str, Union[str, None, List[str]], str]]
|
||||
return flags
|
||||
|
||||
|
||||
dryrunopts = [("n", "dry-run", None, _("do not perform actions, just print output"))]
|
||||
|
||||
remoteopts = [
|
||||
@ -95,19 +101,32 @@ formatteropts = [
|
||||
("T", "template", "", _("display with template (EXPERIMENTAL)"), _("TEMPLATE"))
|
||||
]
|
||||
|
||||
templateopts = [
|
||||
("", "style", "", _("display using template map file (DEPRECATED)"), _("STYLE")),
|
||||
("T", "template", "", _("display with template"), _("TEMPLATE")),
|
||||
]
|
||||
templateopts = _typedflags(
|
||||
[
|
||||
(
|
||||
"",
|
||||
"style",
|
||||
"",
|
||||
_("display using template map file (DEPRECATED)"),
|
||||
_("STYLE"),
|
||||
),
|
||||
("T", "template", "", _("display with template"), _("TEMPLATE")),
|
||||
]
|
||||
)
|
||||
|
||||
logopts = [
|
||||
("p", "patch", None, _("show patch")),
|
||||
("g", "git", None, _("use git extended diff format")),
|
||||
("l", "limit", "", _("limit number of changes displayed"), _("NUM")),
|
||||
("M", "no-merges", None, _("do not show merges")),
|
||||
("", "stat", None, _("output diffstat-style summary of changes")),
|
||||
("G", "graph", None, _("show the revision DAG")),
|
||||
] + templateopts
|
||||
logopts = (
|
||||
_typedflags(
|
||||
[
|
||||
("p", "patch", None, _("show patch")),
|
||||
("g", "git", None, _("use git extended diff format")),
|
||||
("l", "limit", "", _("limit number of changes displayed"), _("NUM")),
|
||||
("M", "no-merges", None, _("do not show merges")),
|
||||
("", "stat", None, _("output diffstat-style summary of changes")),
|
||||
("G", "graph", None, _("show the revision DAG")),
|
||||
]
|
||||
)
|
||||
+ templateopts
|
||||
)
|
||||
|
||||
diffopts = [
|
||||
("a", "text", None, _("treat all files as text")),
|
||||
@ -116,36 +135,47 @@ diffopts = [
|
||||
("", "nodates", None, _("omit dates from diff headers")),
|
||||
]
|
||||
|
||||
diffwsopts = [
|
||||
("w", "ignore-all-space", None, _("ignore white space when comparing lines")),
|
||||
(
|
||||
"b",
|
||||
"ignore-space-change",
|
||||
None,
|
||||
_("ignore changes in the amount of white space"),
|
||||
),
|
||||
("B", "ignore-blank-lines", None, _("ignore changes whose lines are all blank")),
|
||||
("Z", "ignore-space-at-eol", None, _("ignore changes in whitespace at EOL")),
|
||||
]
|
||||
diffwsopts = _typedflags(
|
||||
[
|
||||
("w", "ignore-all-space", None, _("ignore white space when comparing lines")),
|
||||
(
|
||||
"b",
|
||||
"ignore-space-change",
|
||||
None,
|
||||
_("ignore changes in the amount of white space"),
|
||||
),
|
||||
(
|
||||
"B",
|
||||
"ignore-blank-lines",
|
||||
None,
|
||||
_("ignore changes whose lines are all blank"),
|
||||
),
|
||||
("Z", "ignore-space-at-eol", None, _("ignore changes in whitespace at EOL")),
|
||||
]
|
||||
)
|
||||
|
||||
diffopts2 = (
|
||||
[
|
||||
("", "noprefix", None, _("omit a/ and b/ prefixes from filenames")),
|
||||
("p", "show-function", None, _("show which function each change is in")),
|
||||
("", "reverse", None, _("produce a diff that undoes the changes")),
|
||||
]
|
||||
_typedflags(
|
||||
[
|
||||
("", "noprefix", None, _("omit a/ and b/ prefixes from filenames")),
|
||||
("p", "show-function", None, _("show which function each change is in")),
|
||||
("", "reverse", None, _("produce a diff that undoes the changes")),
|
||||
]
|
||||
)
|
||||
+ diffwsopts
|
||||
+ [
|
||||
("U", "unified", "", _("number of lines of context to show"), _("NUM")),
|
||||
("", "stat", None, _("output diffstat-style summary of changes")),
|
||||
("", "root", "", _("produce diffs relative to subdirectory"), _("DIR")),
|
||||
(
|
||||
"",
|
||||
"only-files-in-revs",
|
||||
None,
|
||||
_("only show changes for files modified in the requested revisions"),
|
||||
),
|
||||
]
|
||||
+ _typedflags(
|
||||
[
|
||||
("U", "unified", "", _("number of lines of context to show"), _("NUM")),
|
||||
("", "stat", None, _("output diffstat-style summary of changes")),
|
||||
("", "root", "", _("produce diffs relative to subdirectory"), _("DIR")),
|
||||
(
|
||||
"",
|
||||
"only-files-in-revs",
|
||||
None,
|
||||
_("only show changes for files modified in the requested revisions"),
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
|
||||
mergetoolopts = [("t", "tool", "", _("specify merge tool"))]
|
||||
|
@ -1,3 +1,8 @@
|
||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||
#
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2.
|
||||
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name) -> Any: ...
|
||||
|
Loading…
Reference in New Issue
Block a user