typing: enable pyre

Summary:
The Mercurial codebase contains over 500 errors, let's ignore them for now, we
can go back to them later to fix them.

Besides the manual change to .pyre_configuration.local, the changes were
generated with:
  pyre --output=json check | pyre-upgrade fixme

Reviewed By: singhsrb

Differential Revision: D18803908

fbshipit-source-id: 724db7bd864c0de47a97ef2092bdee9f2cda531f
This commit is contained in:
Xavier Deguillard 2019-12-04 10:53:06 -08:00 committed by Facebook Github Bot
parent 1866de92b3
commit ff36d65b5d
144 changed files with 373 additions and 2 deletions

View File

@ -33,6 +33,7 @@ def _fixsyspath():
sys.path.insert(0, depspath)
# Make sure "edenscmnative" can be imported. Error early.
# pyre-fixme[21]: Could not find `edenscmnative`.
import edenscmnative
edenscmnative.__name__

View File

@ -31,6 +31,7 @@ These imports will not be delayed:
from __future__ import absolute_import
# pyre-fixme[21]: Could not find `__builtin__`.
import __builtin__ as builtins
import contextlib
import sys

View File

@ -46,6 +46,8 @@ class _lazyloaderex(importlib.util.LazyLoader):
the ignore list.
"""
# pyre-fixme[15]: `exec_module` overrides method defined in `LazyLoader`
# inconsistently.
def exec_module(self, module):
"""Make the module load lazily."""
if _deactivated or module.__name__ in ignore:
@ -56,8 +58,11 @@ class _lazyloaderex(importlib.util.LazyLoader):
# This is 3.6+ because with Python 3.5 it isn't possible to lazily load
# extensions. See the discussion in https://python.org/sf/26186 for more.
# pyre-fixme[6]: Expected `Loader` for 1st param but got `Type[ExtensionFileLoader]`.
_extensions_loader = _lazyloaderex.factory(importlib.machinery.ExtensionFileLoader)
# pyre-fixme[6]: Expected `Loader` for 1st param but got `Type[SourcelessFileLoader]`.
_bytecode_loader = _lazyloaderex.factory(importlib.machinery.SourcelessFileLoader)
# pyre-fixme[6]: Expected `Loader` for 1st param but got `Type[SourceFileLoader]`.
_source_loader = _lazyloaderex.factory(importlib.machinery.SourceFileLoader)

View File

@ -46,6 +46,8 @@ from edenscm.mercurial import (
)
from edenscm.mercurial.i18n import _, _n
from edenscm.mercurial.pycompat import range
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import linelog

View File

@ -113,6 +113,7 @@ def _openlogfile(ui, vfs):
def wrapui(ui):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class blackboxui(ui.__class__):
@property
def _bbvfs(self):

View File

@ -3,5 +3,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative.clindex import * # noqa: F401, F403
from edenscmnative.clindex import __doc__ # noqa: F401

View File

@ -225,6 +225,7 @@ def reposetup(ui, repo):
if synccheckout:
extensions.wrapfunction(localrepo.dirstate.dirstate, "loginfo", _sendlocation)
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class commitcloudrepo(repo.__class__):
def transaction(self, *args, **kwargs):
def finalize(tr):

View File

@ -80,6 +80,7 @@ def cloud(ui, repo, **opts):
pass
# pyre-fixme[16]: Callable `cloud` has no attribute `subcommand`.
subcmd = cloud.subcommand(
categories=[
("Connect to a cloud workspace", ["authenticate", "join", "leave", "rejoin"]),

View File

@ -27,6 +27,7 @@ demandimport.ignore.extend(["bzrlib.transactions", "bzrlib.urlutils", "ElementPa
try:
# bazaar imports
# pyre-fixme[21]: Could not find `bzrlib`.
import bzrlib.bzrdir
import bzrlib.errors
import bzrlib.revision

View File

@ -26,6 +26,7 @@ pickle = util.pickle
propertycache = util.propertycache
try:
# pyre-fixme[18]: Global name `unicode` is undefined.
unicode
except NameError:
unicode = str

View File

@ -24,6 +24,7 @@ from . import common
try:
# pyre-fixme[18]: Global name `unicode` is undefined.
unicode
except NameError:
unicode = str
@ -34,14 +35,21 @@ NoRepo = common.NoRepo
# The naming drift of ElementTree is fun!
try:
# pyre-fixme[21]: Could not find `ElementTree`.
import xml.etree.cElementTree.ElementTree as ElementTree
# pyre-fixme[21]: Could not find `XMLParser`.
import xml.etree.cElementTree.XMLParser as XMLParser
except ImportError:
try:
# pyre-fixme[21]: Could not find `ElementTree`.
import xml.etree.ElementTree.ElementTree as ElementTree
# pyre-fixme[21]: Could not find `XMLParser`.
import xml.etree.ElementTree.XMLParser as XMLParser
except ImportError:
try:
# pyre-fixme[21]: Could not find `elementtree`.
import elementtree.cElementTree.ElementTree as ElementTree
import elementtree.cElementTree.XMLParser as XMLParser
except ImportError:

View File

@ -12,6 +12,8 @@ import functools
import os
import pprint
import re
# pyre-fixme[21]: Could not find `dom`.
import xml.dom.minidom
from edenscm.mercurial import error, node as nodemod, pycompat

View File

@ -11,6 +11,8 @@ from __future__ import absolute_import
import os
import re
import tempfile
# pyre-fixme[21]: Could not find `dom`.
import xml.dom.minidom
from edenscm.mercurial import encoding, error, progress, pycompat, util, vfs as vfsmod
@ -41,6 +43,7 @@ NoRepo = common.NoRepo
# these bindings.
try:
# pyre-fixme[21]: Could not find `svn`.
import svn
import svn.client
import svn.core

View File

@ -21,6 +21,7 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import
# pyre-fixme[21]: Could not find `svn`.
import svn.client
import svn.core
import svn.ra
@ -41,6 +42,7 @@ svn_config = None
def _create_auth_baton(pool):
"""Create a Subversion authentication baton. """
# pyre-fixme[21]: Could not find `svn`.
import svn.client
# Give the client context baton a suite of authentication
@ -68,6 +70,7 @@ def _create_auth_baton(pool):
return svn.core.svn_auth_open(providers, pool)
# pyre-fixme[11]: Annotation `SubversionException` is not defined as a type.
class NotBranchError(SubversionException):
pass

View File

@ -35,6 +35,7 @@
"""
# pyre-fixme[21]: Could not find `anydbm`.
import anydbm
import collections
import json
@ -58,6 +59,7 @@ from edenscm.mercurial.i18n import _
try:
# pyre-fixme[21]: Could not find `gdbm`.
import gdbm
gdbm.open

View File

@ -17,8 +17,11 @@ import code
import os
import sys
# pyre-fixme[21]: Could not find `bindings`.
import bindings
import edenscm
# pyre-fixme[21]: Could not find `edenscmnative`.
import edenscmnative
from edenscm import hgext, mercurial
from edenscm.mercurial import registrar

View File

@ -16,6 +16,7 @@ originalrecordfilter = cmdutil.recordfilter
def uisetup(ui):
# "editor" is otherwise not allowed as a valid option for "ui.interface"
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class edrecordui(ui.__class__):
def interface(self, feature):
if feature == "chunkselector":

View File

@ -352,6 +352,7 @@ def reposetup(ui, repo):
ui.setconfig("patch", "eol", "auto", "eol")
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class eolrepo(repo.__class__):
def loadeol(self, nodes):
eol = parseeol(self.ui, self, nodes)

View File

@ -36,6 +36,7 @@ import socket
import subprocess
import time
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import bser
from . import capabilities, compat, encoding, load # noqa: F401
@ -85,6 +86,7 @@ if os.name == "nt":
LPDWORD = ctypes.POINTER(wintypes.DWORD)
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
CreateFile = ctypes.windll.kernel32.CreateFileA
CreateFile.argtypes = [
wintypes.LPSTR,
@ -97,10 +99,12 @@ if os.name == "nt":
]
CreateFile.restype = wintypes.HANDLE
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
CloseHandle = ctypes.windll.kernel32.CloseHandle
CloseHandle.argtypes = [wintypes.HANDLE]
CloseHandle.restype = wintypes.BOOL
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
ReadFile = ctypes.windll.kernel32.ReadFile
ReadFile.argtypes = [
wintypes.HANDLE,
@ -111,6 +115,7 @@ if os.name == "nt":
]
ReadFile.restype = wintypes.BOOL
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
WriteFile = ctypes.windll.kernel32.WriteFile
WriteFile.argtypes = [
wintypes.HANDLE,
@ -121,14 +126,17 @@ if os.name == "nt":
]
WriteFile.restype = wintypes.BOOL
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
GetLastError = ctypes.windll.kernel32.GetLastError
GetLastError.argtypes = []
GetLastError.restype = wintypes.DWORD
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
SetLastError = ctypes.windll.kernel32.SetLastError
SetLastError.argtypes = [wintypes.DWORD]
SetLastError.restype = None
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
FormatMessage = ctypes.windll.kernel32.FormatMessageA
FormatMessage.argtypes = [
wintypes.DWORD,
@ -141,8 +149,10 @@ if os.name == "nt":
]
FormatMessage.restype = wintypes.DWORD
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
LocalFree = ctypes.windll.kernel32.LocalFree
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
GetOverlappedResult = ctypes.windll.kernel32.GetOverlappedResult
GetOverlappedResult.argtypes = [
wintypes.HANDLE,
@ -153,7 +163,10 @@ if os.name == "nt":
GetOverlappedResult.restype = wintypes.BOOL
GetOverlappedResultEx = getattr(
ctypes.windll.kernel32, "GetOverlappedResultEx", None
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
ctypes.windll.kernel32,
"GetOverlappedResultEx",
None,
)
if GetOverlappedResultEx is not None:
GetOverlappedResultEx.argtypes = [
@ -165,10 +178,12 @@ if os.name == "nt":
]
GetOverlappedResultEx.restype = wintypes.BOOL
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
WaitForSingleObjectEx = ctypes.windll.kernel32.WaitForSingleObjectEx
WaitForSingleObjectEx.argtypes = [wintypes.HANDLE, wintypes.DWORD, wintypes.BOOL]
WaitForSingleObjectEx.restype = wintypes.DWORD
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
CreateEvent = ctypes.windll.kernel32.CreateEventA
# Skip setting argtypes to avoid conflicts with prompt_toolkit used by
# IPython. Otherwise it can error out like:
@ -187,6 +202,7 @@ if os.name == "nt":
CreateEvent.restype = wintypes.HANDLE
# Windows Vista is the minimum supported client for CancelIoEx.
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
CancelIoEx = ctypes.windll.kernel32.CancelIoEx
CancelIoEx.argtypes = [wintypes.HANDLE, ctypes.POINTER(OVERLAPPED)]
CancelIoEx.restype = wintypes.BOOL

View File

@ -68,4 +68,5 @@ def reraise(tp, value, tb=None):
if PYTHON3:
UNICODE = str
else:
# pyre-fixme[18]: Global name `unicode` is undefined.
UNICODE = unicode # noqa: F821 We handled versioning above

View File

@ -31,6 +31,7 @@ from __future__ import absolute_import, division, print_function
import ctypes
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import bser

View File

@ -62,6 +62,7 @@ if compat.PYTHON3:
long = int
else:
# pyre-fixme[18]: Global name `unicode` is undefined.
STRING_TYPES = (unicode, str)
tobytes = bytes

View File

@ -360,6 +360,7 @@ elif pycompat.isdarwin:
import ctypes.util
F_GETPATH = 50
# pyre-fixme[6]: Expected `str` for 1st param but got `Optional[str]`.
libc = ctypes.CDLL(ctypes.util.find_library("c"), use_errno=True)
getpathfcntl = libc.fcntl
getpathfcntl.argtypes = [ctypes.c_int, ctypes.c_int, ctypes.c_char_p]

View File

@ -18,6 +18,7 @@ from edenscm.mercurial import error, lock as lockmod, pycompat, util, vfs as vfs
if pycompat.iswindows:
CREATE_NO_WINDOW = 0x08000000
# pyre-fixme[16]: Module `subprocess` has no attribute `CREATE_NEW_PROCESS_GROUP`.
_creationflags = CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP
def runbgcommand(script, env, shell=False, stdout=None, stderr=None):

View File

@ -24,6 +24,8 @@ from edenscm.mercurial import (
)
from edenscm.mercurial.i18n import _
from edenscm.mercurial.pycompat import range
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import linelog as linelogmod
from . import error as faerror, revmap as revmapmod

View File

@ -15,6 +15,7 @@ from . import context
try:
# pyre-fixme[18]: Global name `buffer` is undefined.
buffer
except NameError:
buffer = memoryview
@ -127,6 +128,7 @@ def _parseresponse(payload):
def peersetup(ui, peer):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class fastannotatepeer(peer.__class__):
@wireproto.batchable
def getannotate(self, path, lastnode=None):
@ -240,6 +242,7 @@ def _filterfetchpaths(repo, paths):
def localreposetup(ui, repo):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class fastannotaterepo(repo.__class__):
def prefetchfastannotate(self, paths, peer=None):
master = _getmaster(self.ui)

View File

@ -389,6 +389,7 @@ class LocalIteratorThread(Thread):
def stopped(self):
return self._stop.isSet()
# pyre-fixme[15]: `run` overrides method defined in `Thread` inconsistently.
def run(self):
generator = self.generator
match = self.localmatch
@ -503,6 +504,7 @@ class FastLogThread(Thread):
self.finishpath(path)
return
# pyre-fixme[15]: `run` overrides method defined in `Thread` inconsistently.
def run(self):
revs = None
paths = self.paths

View File

@ -46,6 +46,7 @@ def defineactions():
@histedit.action(
["stop", "s"], _("pick changeset, and stop after committing changes")
)
# pyre-fixme[11]: Annotation `histeditaction` is not defined as a type.
class stop(histedit.histeditaction):
def run(self):
parentctx, replacements = super(stop, self).run()
@ -67,6 +68,7 @@ def defineactions():
return super(stop, self).continueclean()
@histedit.action(["exec", "x"], _("execute given command"))
# pyre-fixme[11]: Annotation `histeditaction` is not defined as a type.
class execute(histedit.histeditaction):
def __init__(self, state, command):
self.state = state
@ -162,6 +164,7 @@ def defineactions():
self.cwd = pycompat.getcwd()
@histedit.action(["graft", "g"], _("graft a commit from elsewhere"))
# pyre-fixme[11]: Annotation `histeditaction` is not defined as a type.
class graft(histedit.histeditaction):
def _verifynodeconstraints(self, prev, expected, seen):
if self.node in expected:

View File

@ -798,6 +798,7 @@ def poststatustreestate(wctx, status):
else:
# Remove ignored files from treestate
ignore = dirstate._ignore
# pyre-fixme[21]: Could not find `bindings`.
from bindings import treestate
repo.ui.debug("stop tracking ignored files\n")
@ -828,6 +829,7 @@ class poststatus(object):
def makedirstate(repo, dirstate):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class fsmonitordirstate(dirstate.__class__):
def _fsmonitorinit(self, repo):
self._fs = fsmonitorfilesystem(self._root, self, repo)
@ -1036,6 +1038,7 @@ def reposetup(ui, repo):
# repo.dirstate is not a fsmonitordirstate
makedirstate(repo, dirstate)
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class fsmonitorrepo(repo.__class__):
def status(self, *args, **kwargs):
orig = super(fsmonitorrepo, self).status

View File

@ -54,6 +54,7 @@ from __future__ import absolute_import
import struct
# pyre-fixme[21]: Could not find `bindings`.
from bindings import nodemap as nodemapmod
from edenscm.mercurial import (
error,
@ -162,6 +163,7 @@ def _sqllocalrepowrapper(orig, repo):
return
# This class will effectively extend the `sqllocalrepo` class.
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class globalrevsrepo(repo.__class__):
def commitctx(self, ctx, error=False):
# Assign global revs automatically

View File

@ -67,6 +67,7 @@ def reposetup(ui, repo):
ui.log("hgevents", "Watchman exception: %s\n", ex)
return
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class hgeventsrepo(repo.__class__):
def wlocknostateupdate(self, *args, **kwargs):
return super(hgeventsrepo, self).wlock(*args, **kwargs)

View File

@ -24,12 +24,25 @@ import warnings
from bisect import insort
# local modules
# pyre-fixme[21]: Could not find `compat`.
import compat
# pyre-fixme[21]: Could not find `gitrepo`.
import gitrepo
# pyre-fixme[21]: Could not find `hgrepo`.
import hgrepo
# pyre-fixme[21]: Could not find `overlay`.
import overlay
# pyre-fixme[21]: Could not find `util`.
import util
# pyre-fixme[21]: Could not find `verify`.
import verify
# pyre-fixme[21]: Could not find `bindings`.
from bindings import nodemap as nodemapmod
from edenscm.mercurial import (
bundlerepo,
@ -52,6 +65,8 @@ from edenscm.mercurial import (
from edenscm.mercurial.error import LookupError
from edenscm.mercurial.i18n import _
from edenscm.mercurial.node import hex, nullid
# pyre-fixme[21]: Could not find `git_handler`.
from git_handler import GitHandler
@ -70,6 +85,7 @@ except (AttributeError, ImportError):
try:
from edenscm.mercurial import ignore
# pyre-fixme[16]: Module `mercurial` has no attribute `ignore`.
ignore.readpats
ignoremod = True
except (AttributeError, ImportError):
@ -114,6 +130,7 @@ for _scheme in util.gitschemes:
_oldlocal = hg.schemes["file"]
try:
# pyre-fixme[9]: urlcls has type `Type[urlcls]`; used as `Type[url]`.
urlcls = hgutil.url
except AttributeError:

View File

@ -13,6 +13,7 @@ except AttributeError:
# compat with hg 3.2.1 and earlier, which doesn't have
# hfsignoreclean (This was borrowed wholesale from hg 3.2.2.)
_ignore = [
# pyre-fixme[18]: Global name `unichr` is undefined.
unichr(int(x, 16)).encode("utf-8") # noqa: F821
for x in "200c 200d 200e 200f 202a 202b 202c 202d 202e "
"206a 206b 206c 206d 206e 206f feff".split()

View File

@ -4,11 +4,22 @@ import os
import re
import shutil
# pyre-fixme[21]: Could not find `_ssh`.
import _ssh
# pyre-fixme[21]: Could not find `compat`.
import compat
# pyre-fixme[21]: Could not find `git2hg`.
import git2hg
# pyre-fixme[21]: Could not find `hg2git`.
import hg2git
# pyre-fixme[21]: Could not find `util`.
import util
# pyre-fixme[21]: Could not find `bindings`.
from bindings import nodemap
from dulwich import client, config as dul_config, diff_tree
from dulwich.errors import GitProtocolError, HangupException
@ -29,6 +40,8 @@ from edenscm.mercurial import (
)
from edenscm.mercurial.i18n import _
from edenscm.mercurial.node import bin, hex, nullid, nullrev
# pyre-fixme[21]: Could not find `overlay`.
from overlay import overlayrepo

View File

@ -1,5 +1,7 @@
from edenscm.mercurial import error, util
from edenscm.mercurial.error import RepoError
# pyre-fixme[21]: Could not find `util`.
from util import isgitsshuri

View File

@ -5,8 +5,11 @@
import os
import stat
# pyre-fixme[21]: Could not find `compat`.
import compat
import dulwich.objects as dulobjs
# pyre-fixme[21]: Could not find `util`.
import util
from edenscm.mercurial import util as hgutil
from edenscm.mercurial.i18n import _

View File

@ -1,17 +1,29 @@
# 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.
# pyre-fixme[21]: Could not find `util`.
import util
from edenscm.mercurial import localrepo, util as hgutil
from edenscm.mercurial.node import bin
# pyre-fixme[21]: Could not find `git_handler`.
from git_handler import GitHandler
# pyre-fixme[21]: Could not find `gitrepo`.
from gitrepo import gitrepo
try:
# pyre-fixme[18]: Global name `unicode` is undefined.
unicode
except NameError:
unicode = str
def generate_repo_subclass(baseclass):
# pyre-fixme[11]: Annotation `baseclass` is not defined as a type.
class hgrepo(baseclass):
if hgutil.safehasattr(localrepo.localrepository, "pull"):
# Mercurial < 3.2

View File

@ -10,6 +10,7 @@ from edenscm.mercurial.i18n import _
try:
from collections import OrderedDict
except ImportError:
# pyre-fixme[21]: Could not find `ordereddict`.
from ordereddict import OrderedDict

View File

@ -636,6 +636,7 @@ def executewithsql(repo, action, sqllock=False, *args, **kwargs):
def wraprepo(repo):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class sqllocalrepo(repo.__class__):
def sqlconnect(self):
if self.sqlconn:
@ -1647,6 +1648,7 @@ def wraprepo(repo):
repo.__class__ = sqllocalrepo
# pyre-fixme[11]: Annotation `MySQLConverter` is not defined as a type.
class CustomConverter(mysql.connector.conversion.MySQLConverter):
"""Ensure that all values being returned are returned as python string
(versus the default byte arrays)."""

View File

@ -189,6 +189,7 @@ def convertsink(orig, sink):
sink = orig(sink)
if sink.repotype == "hg":
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class lfssink(sink.__class__):
def putcommit(
self, files, copies, parents, commit, source, revmap, full, cleanp2

View File

@ -29,6 +29,7 @@ this extension.
from __future__ import absolute_import
# pyre-fixme[21]: Could not find `bindings`.
from bindings import lz4
from edenscm.mercurial import error, extensions, localrepo, revlog, util
from edenscm.mercurial.i18n import _

View File

@ -50,6 +50,7 @@ def _handlecommandexception(orig, ui):
def uisetup(ui):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class morecolorsui(ui.__class__):
def traceback(self, exc=None, force=False):
if exc is None:

View File

@ -3,5 +3,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative.patchrmdir import * # noqa: F401, F403
from edenscmnative.patchrmdir import __doc__ # noqa: F401

View File

@ -302,6 +302,8 @@ def _getlogrevs(orig, repo, pats, opts):
# phabstatus code will be able to peek ahead at the revs to be logged.
orig_type = revs.__class__
# pyre-fixme[31]: Expression
# `type($local_edenscm?hgext?phabstatus?_getlogrevs$revs)` is not a valid type.
class wrapped_class(type(revs)):
def __iter__(self):
# The first time __iter__() is called, return a

View File

@ -103,6 +103,7 @@ def uisetup(ui):
global _pid
_pid = ui.configint("progress", "fakedpid") or util.getpid()
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class fileengine(progress._engine.__class__):
def _show(self, now):
super(fileengine, self)._show(now)

View File

@ -822,6 +822,7 @@ def _getmanifest(op, rev):
m = rev.manifest()
else:
store = repo.manifestlog.datastore
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import cstore
m = cstore.treemanifest(store, rev.manifestnode())

View File

@ -15,6 +15,7 @@ from __future__ import absolute_import
import os
import sys
# pyre-fixme[21]: Could not find `memcache`.
import memcache

View File

@ -8,6 +8,7 @@ from __future__ import absolute_import
import os
import struct
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
from edenscm.mercurial.i18n import _
from edenscm.mercurial.node import hex, nullid

View File

@ -10,6 +10,7 @@ import hashlib
import os
import sys
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
from edenscm.hgext import extutil
from edenscm.mercurial import error, filelog, progress, revlog, util

View File

@ -8,6 +8,7 @@ from __future__ import absolute_import
import threading
import traceback
# pyre-fixme[21]: Could not find `bindings`.
from bindings import edenapi
from edenscm.mercurial import error, httpconnection
from edenscm.mercurial.i18n import _

View File

@ -58,6 +58,7 @@ def getlocalkey(file, id):
def peersetup(ui, peer):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class remotefilepeer(peer.__class__):
@wireproto.batchable
def getfile(self, file, node):

View File

@ -8,6 +8,7 @@ from __future__ import absolute_import
import hashlib
import struct
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
from edenscm.mercurial.node import hex, nullid

View File

@ -5,6 +5,7 @@
from __future__ import absolute_import
# pyre-fixme[21]: Could not find `bindings`.
from bindings import lz4

View File

@ -3,6 +3,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
from edenscm.mercurial.node import hex

View File

@ -10,6 +10,7 @@ from __future__ import absolute_import
import collections
import os
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
from edenscm.mercurial import ancestor, error, filelog, mdiff, revlog, util
from edenscm.mercurial.i18n import _

View File

@ -11,6 +11,7 @@ import time
import traceback
from contextlib import contextmanager
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
from edenscm.mercurial import encoding, error, progress, util, vfs
from edenscm.mercurial.i18n import _

View File

@ -21,6 +21,7 @@ requirement = "remotefilelog"
def wraprepo(repo):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class shallowrepository(repo.__class__):
@util.propertycache
def name(self):

View File

@ -8,6 +8,7 @@ from __future__ import absolute_import
def wrapstore(store):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class shallowstore(store.__class__):
def __contains__(self, path):
# Assume it exists

View File

@ -210,6 +210,7 @@ def _buildpackmeta(metadict):
_metaitemtypes = {
# pyre-fixme[18]: Global name `long` is undefined.
constants.METAKEYFLAG: (int, long), # noqa
constants.METAKEYSIZE: (int, long), # noqa
}

View File

@ -28,6 +28,8 @@ import re
import shutil
import sys
import typing
# pyre-fixme[21]: Could not find `UserDict`.
import UserDict
from edenscm.mercurial import (
@ -585,6 +587,7 @@ def updatecmd(orig, ui, repo, node=None, rev=None, **kwargs):
return orig(ui, repo, node=node, rev=rev, **kwargs)
# pyre-fixme[11]: Annotation `DictMixin` is not defined as a type.
class lazyremotenamedict(UserDict.DictMixin):
"""Read-only dict-like Class to lazily resolve remotename entries

View File

@ -43,6 +43,7 @@ def _getcandidatelocation(ui):
def uisetup(ui):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class logtofile(ui.__class__):
@classmethod
def computesamplingfilters(cls, self):

View File

@ -58,6 +58,7 @@ memorytracker = []
def printmemory(sig, currentframe):
try:
# pyre-fixme[21]: Could not find `pympler`.
from pympler import muppy, summary
muppy.get_objects

View File

@ -53,6 +53,7 @@ def snapshot(ui, repo, *args, **opts):
pass
# pyre-fixme[16]: Callable `snapshot` has no attribute `subcommand`.
subcmd = snapshot.subcommand(
categories=[
("Create/restore a snapshot", ["create", "checkout"]),

View File

@ -21,6 +21,7 @@ FORMAT_VERSION = "v1"
def reposetup(ui, repo):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class snapshotrepo(repo.__class__):
@localrepo.storecache("snapshotlist")
def snapshotlist(self):

View File

@ -720,6 +720,7 @@ def _wraprepo(ui, repo):
# metadata parsing expression
metadata_key_value = re.compile(r"(?P<key>.*)\s*[:=]\s*(?P<value>.*)")
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class SparseRepo(repo.__class__):
def readsparseconfig(self, raw, filename=None, warn=True):
"""Takes a string sparse config and returns a SparseConfig

View File

@ -28,6 +28,8 @@ import signal
import socket
import sys
import tempfile
# pyre-fixme[21]: Could not find `reduction`.
from multiprocessing.reduction import recv_handle, send_handle

View File

@ -3,5 +3,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative.traceprof import * # noqa: F403, F401
from edenscmnative.traceprof import __doc__ # noqa: F401

View File

@ -165,6 +165,7 @@ import shutil
import struct
import time
# pyre-fixme[21]: Could not find `bindings`.
from bindings import manifest as rustmanifest, revisionstore
from edenscm.mercurial import (
bundle2,
@ -199,6 +200,8 @@ from edenscm.mercurial.commands import debug as debugcommands
from edenscm.mercurial.i18n import _, _n
from edenscm.mercurial.node import bin, hex, nullid, short
from edenscm.mercurial.pycompat import range
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import cstore
from ..extutil import flock
@ -469,6 +472,7 @@ def clientreposetup(repo):
def wraprepo(repo):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class treerepository(repo.__class__):
def transaction(self, *args, **kwargs):
tr = super(treerepository, self).transaction(*args, **kwargs)
@ -1325,6 +1329,7 @@ def getbundlemanifestlog(orig, self):
return dpack, hpack
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class bundlemanifestlog(wrapmfl.__class__):
def add(
self,

View File

@ -36,6 +36,8 @@ if sys.version_info[0] >= 3:
class hgpathentryfinder(importlib.abc.MetaPathFinder):
"""A sys.meta_path finder that uses a custom module loader."""
# pyre-fixme[15]: `find_spec` overrides method defined in `MetaPathFinder`
# inconsistently.
def find_spec(self, fullname, path, target=None):
# Only handle Mercurial-related modules.
if not fullname.startswith(("mercurial.", "hgext.")):
@ -236,6 +238,8 @@ if sys.version_info[0] >= 3:
# the new transformation mechanisms applied.
BYTECODEHEADER = b"HG\x00\x0a"
# pyre-fixme[13]: Attribute `name` is never initialized.
# pyre-fixme[13]: Attribute `path` is never initialized.
class hgloader(importlib.machinery.SourceFileLoader):
"""Custom module loader that transforms source code.
@ -266,6 +270,8 @@ if sys.version_info[0] >= 3:
``HG`` with 2 binary bytes indicating the transformation version.
"""
# pyre-fixme[15]: `get_data` overrides method defined in `FileLoader`
# inconsistently.
def get_data(self, path):
data = super(hgloader, self).get_data(path)
@ -284,12 +290,16 @@ if sys.version_info[0] >= 3:
return data[4:]
# pyre-fixme[15]: `set_data` overrides method defined in `SourceLoader`
# inconsistently.
def set_data(self, path, data, *args, **kwargs):
if path.endswith(tuple(importlib.machinery.BYTECODE_SUFFIXES)):
data = BYTECODEHEADER + data
return super(hgloader, self).set_data(path, data, *args, **kwargs)
# pyre-fixme[15]: `source_to_code` overrides method defined in
# `InspectLoader` inconsistently.
def source_to_code(self, data, path):
"""Perform token transformation before compilation."""
buf = io.BytesIO(data)

View File

@ -3,6 +3,7 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# pyre-fixme[21]: Could not find `bindings`.
from bindings import blackbox as _blackbox

View File

@ -115,6 +115,7 @@ class branchcache(dict):
for bn, heads in self.iteritems():
yield (bn, heads) + self._branchtip(heads)
# pyre-fixme[15]: `copy` overrides method defined in `dict` inconsistently.
def copy(self):
"""return an deep copy of the branchcache object"""
return branchcache(

View File

@ -51,6 +51,7 @@ class RangeError(IOError):
"""Error raised when an unsatisfiable range is requested."""
# pyre-fixme[11]: Annotation `basehandler` is not defined as a type.
class HTTPRangeHandler(urlreq.basehandler):
"""Handler that enables HTTP Range headers.
@ -216,6 +217,7 @@ class RangeableFileObject(object):
pos += bufsize
# pyre-fixme[11]: Annotation `filehandler` is not defined as a type.
class FileRangeHandler(urlreq.filehandler):
"""FileHandler subclass that adds Range support.
This class handles Range headers exactly like an HTTP
@ -261,6 +263,7 @@ class FileRangeHandler(urlreq.filehandler):
# -- range support modifications start/end here
# pyre-fixme[11]: Annotation `ftphandler` is not defined as a type.
class FTPRangeHandler(urlreq.ftphandler):
def ftp_open(self, req):
host = urllibcompat.gethost(req)
@ -351,6 +354,7 @@ class FTPRangeHandler(urlreq.ftphandler):
return fw
# pyre-fixme[11]: Annotation `ftpwrapper` is not defined as a type.
class ftpwrapper(urlreq.ftpwrapper):
# range support note:
# this ftpwrapper code is copied directly from

View File

@ -18,7 +18,9 @@ from ..pure.bdiff import * # noqa: F403, F401
from . import _bdiff
# pyre-fixme[16]: Module `cffi` has no attribute `_bdiff`.
ffi = _bdiff.ffi
# pyre-fixme[16]: Module `cffi` has no attribute `_bdiff`.
lib = _bdiff.lib

View File

@ -12,6 +12,7 @@ from __future__ import absolute_import
import os
# pyre-fixme[21]: Could not find `cffi`.
import cffi

View File

@ -16,7 +16,9 @@ from ..pure.mpatch import * # noqa: F401, F403
from . import _mpatch
# pyre-fixme[16]: Module `cffi` has no attribute `_mpatch`.
ffi = _mpatch.ffi
# pyre-fixme[16]: Module `cffi` has no attribute `_mpatch`.
lib = _mpatch.lib

View File

@ -12,6 +12,7 @@ from __future__ import absolute_import
import os
# pyre-fixme[21]: Could not find `cffi`.
import cffi

View File

@ -22,7 +22,9 @@ from ..pure.osutil import * # noqa: F401, F403
if pycompat.isdarwin:
from . import _osutil
# pyre-fixme[16]: Module `cffi` has no attribute `_osutil`.
ffi = _osutil.ffi
# pyre-fixme[16]: Module `cffi` has no attribute `_osutil`.
lib = _osutil.lib
listdir_batch_size = 4096

View File

@ -10,6 +10,7 @@
from __future__ import absolute_import
# pyre-fixme[21]: Could not find `cffi`.
import cffi

View File

@ -53,6 +53,7 @@ import socket
import struct
import time
# pyre-fixme[21]: Could not find `bindings`.
from bindings import commands
from . import commandserver, encoding, error, extensions, pycompat, ui as uimod, util
@ -63,6 +64,7 @@ _log = commandserver.log
def _newchgui(srcui, csystem, attachio):
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class chgui(srcui.__class__):
def __init__(self, src=None):
super(chgui, self).__init__(src)
@ -328,6 +330,7 @@ class chgcmdserver(commandserver.server):
_log("setprocname: %r\n" % name)
util.setprocname(name)
# pyre-fixme[16]: `chgcmdserver` has no attribute `setprocname`.
capabilities["setprocname"] = setprocname

View File

@ -463,6 +463,7 @@ w32effects = None
if pycompat.iswindows:
import ctypes
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
_kernel32 = ctypes.windll.kernel32
_WORD = ctypes.c_ushort

View File

@ -21,6 +21,7 @@ import subprocess
import sys
import time
# pyre-fixme[21]: Could not find `bindings`.
import bindings
from ... import hgdemandimport

View File

@ -10,6 +10,7 @@
from __future__ import absolute_import
# pyre-fixme[21]: Could not find `bindings`.
import bindings
from .. import registrar

View File

@ -1477,6 +1477,7 @@ def debuginstall(ui, **opts):
if policy.policy in ("c", "allow"):
err = None
try:
# pyre-fixme[21]: Could not find `edenscmnative`.
from edenscmnative import base85, bdiff, mpatch, osutil
dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes

View File

@ -125,6 +125,7 @@ def debugvisibility(ui, repo):
"""control visibility tracking"""
# pyre-fixme[16]: Callable `debugvisibility` has no attribute `subcommand`.
subcmd = debugvisibility.subcommand()

View File

@ -20,6 +20,8 @@ def doctor(ui, repo, **opts):
"""
if "remotefilelog" in repo.requirements:
from ...hgext.remotefilelog import shallowutil
# pyre-fixme[21]: Could not find `bindings`.
from bindings import revisionstore
if repo.ui.configbool("remotefilelog", "indexedlogdatastore"):

View File

@ -21,6 +21,7 @@ def fs(ui, **opts):
table = {}
# pyre-fixme[16]: Callable `fs` has no attribute `subcommand`.
subcmd = fs.subcommand(
table,
categories=[
@ -192,6 +193,7 @@ def stats(ui, **opts):
"""print statistics for the edenfs daemon"""
# pyre-fixme[16]: Callable `stats` has no attribute `subcommand`.
statscmd = stats.subcommand()

View File

@ -63,6 +63,7 @@ try:
except ImportError:
# I have no idea if wcurses works with crecord...
try:
# pyre-fixme[21]: Could not find `wcurses`.
import wcurses as curses
curses.error

View File

@ -15,6 +15,7 @@ from __future__ import absolute_import
import re
import string
# pyre-fixme[21]: Could not find `bindings`.
from bindings import vlq
from . import error, pycompat, util

View File

@ -24,6 +24,7 @@ import sys
import time
import traceback
# pyre-fixme[21]: Could not find `bindings`.
import bindings
from . import (
@ -90,6 +91,7 @@ class request(object):
if util.safehasattr(signal, "SIGPIPE"):
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class ignoreerrorui(self.ui.__class__):
def _write(self, *args, **kwargs):
try:

View File

@ -38,6 +38,7 @@ if pycompat.ispy3:
# "Unicode Subtleties"), so we need to ignore them in some places for
# sanity.
_ignore = [
# pyre-fixme[18]: Global name `unichr` is undefined.
unichr(int(x, 16)).encode("utf-8")
for x in "200c 200d 200e 200f 202a 202b 202c 202d 202e "
"206a 206b 206c 206d 206e 206f feff".split()

View File

@ -12,6 +12,7 @@ import errno
import os
import stat
# pyre-fixme[21]: Could not find `bindings`.
from bindings import workingcopy
from edenscm.mercurial import registrar

View File

@ -16,6 +16,7 @@ import itertools
import os
import textwrap
# pyre-fixme[21]: Could not find `bindings`.
from bindings import cliparser
from . import (

View File

@ -58,6 +58,7 @@ class _error_logger(object):
self.handler.log_error("HG error: %s", msg)
# pyre-fixme[11]: Annotation `basehttprequesthandler` is not defined as a type.
class _httprequesthandler(httpservermod.basehttprequesthandler):
url_scheme = "http"
@ -282,6 +283,7 @@ class _httprequesthandlerssl(_httprequesthandler):
try:
import threading
# pyre-fixme[16]: Module `threading` has no attribute `activeCount`.
threading.activeCount() # silence pyflakes and bypass demandimport
_mixin = socketserver.ThreadingMixIn
except ImportError:
@ -299,6 +301,7 @@ def openlog(opt, default):
return default
# pyre-fixme[11]: Annotation `httpserver` is not defined as a type.
class MercurialHTTPServer(_mixin, httpservermod.httpserver, object):
# SO_REUSEADDR has broken semantics on windows

View File

@ -59,6 +59,7 @@ from . import _readers
try:
# pyre-fixme[21]: Could not find `httplib`.
import httplib
httplib.HTTPException

View File

@ -42,6 +42,7 @@ import logging
try:
# pyre-fixme[21]: Could not find `httplib`.
import httplib
httplib.HTTPException

View File

@ -166,6 +166,8 @@ LOGFMT = "%(levelname)s:%(name)s:%(lineno)d:%(message)s"
# Subclass BOTH of these because otherwise urllib2 "helpfully"
# reinserts them since it notices we don't include any subclasses of
# them.
# pyre-fixme[11]: Annotation `httphandler` is not defined as a type.
# pyre-fixme[11]: Annotation `httpshandler` is not defined as a type.
class http2handler(urlreq.httphandler, urlreq.httpshandler):
def __init__(self, ui, pwmgr):
global _configuredlogging

View File

@ -68,6 +68,7 @@ def _wraphttpresponse(resp):
"""
origread = resp.read
# pyre-fixme[11]: Annotation `__class__` is not defined as a type.
class readerproxy(resp.__class__):
def read(self, size=None):
try:

View File

@ -27,6 +27,7 @@ else:
module = pycompat.fsencode(__file__)
try:
# pyre-fixme[18]: Global name `unicode` is undefined.
unicode
except NameError:
unicode = str
@ -34,6 +35,7 @@ except NameError:
_languages = None
if (
pycompat.iswindows
# pyre-fixme[16]: Optional type has no attribute `__getitem__`.
and "LANGUAGE" not in encoding.environ
and "LC_ALL" not in encoding.environ
and "LC_MESSAGES" not in encoding.environ
@ -46,6 +48,7 @@ if (
try:
import ctypes
# pyre-fixme[16]: Module `ctypes` has no attribute `windll`.
langid = ctypes.windll.kernel32.GetUserDefaultUILanguage()
_languages = [locale.windows_locale[langid]]
except (ImportError, AttributeError, KeyError):

View File

@ -24,6 +24,7 @@ if __name__ == "__main__":
argv = sys.argv
# PYTHONPATH is not always respected by a "python binary" wrapper.
# Also respect HGPYTHONPATH.
# pyre-fixme[16]: Optional type has no attribute `get`.
sys.path.extend(encoding.environ.get("PYTHONPATH", "").split(pycompat.ospathsep))
sys.path[0:0] = encoding.environ.get("HGPYTHONPATH", "").split(pycompat.ospathsep)

View File

@ -18,6 +18,7 @@ from edenscm.mercurial import encoding, error, pycompat, util
try:
# pyre-fixme[18]: Global name `long` is undefined.
long
except NameError:
long = int

Some files were not shown because too many files have changed in this diff Show More