class documentation

class Server: (source)

View In Hierarchy

Undocumented

Method __init__ Initialize the server with the desired mypy flags.
Method check Check using fine-grained incremental mode.
Method cmd​_check Check a list of files.
Method cmd​_hang Hang for 100 seconds, as a debug hack.
Method cmd​_recheck Check the same list of files we checked most recently.
Method cmd​_run Check a list of files, triggering a restart if needed.
Method cmd​_status Return daemon status.
Method cmd​_stop Stop daemon.
Method cmd​_suggest Suggest a signature for a function.
Method direct​_imports Return the direct imports of module not included in seen.
Method find​_added​_suppressed Find suppressed modules that have been added (and not included in seen).
Method find​_changed Undocumented
Method find​_reachable​_changed​_modules Follow imports within graph from given sources until hitting changed modules.
Method fine​_grained​_increment Perform a fine-grained type checking increment.
Method fine​_grained​_increment​_follow​_imports Like fine_grained_increment, but follow imports.
Method flush​_caches Undocumented
Method following​_imports Are we following imports?
Method increment​_output Undocumented
Method initialize​_fine​_grained Undocumented
Method pretty​_messages Undocumented
Method run​_command Run a specific command from the registry.
Method serve Serve requests, synchronously (no thread or fork).
Method update​_changed Undocumented
Method update​_sources Undocumented
Method update​_stats Undocumented
Instance Variable fine​_grained​_manager Undocumented
Instance Variable formatter Undocumented
Instance Variable fscache Undocumented
Instance Variable fswatcher Undocumented
Instance Variable options Undocumented
Instance Variable options​_snapshot Undocumented
Instance Variable previous​_sources Undocumented
Instance Variable status​_file Undocumented
Instance Variable timeout Undocumented
Method _find​_changed Undocumented
Method _response​_metadata Undocumented
def __init__(self, options, status_file, timeout=None): (source)
Initialize the server with the desired mypy flags.
Parameters
options:OptionsUndocumented
status​_file:strUndocumented
timeout:Optional[int]Undocumented
def check(self, sources, is_tty, terminal_width): (source)

Check using fine-grained incremental mode.

If is_tty is True format the output nicely with colors and summary line (unless disabled in self.options). Also pass the terminal_width to formatter.

Parameters
sources:List[BuildSource]Undocumented
is​_tty:boolUndocumented
terminal​_width:intUndocumented
Returns
Dict[str, Any]Undocumented
def cmd_check(self, files, is_tty, terminal_width): (source)
Check a list of files.
Parameters
files:Sequence[str]Undocumented
is​_tty:boolUndocumented
terminal​_width:intUndocumented
Returns
Dict[str, object]Undocumented
def cmd_hang(self): (source)
Hang for 100 seconds, as a debug hack.
Returns
Dict[str, object]Undocumented
def cmd_recheck(self, is_tty, terminal_width, remove=None, update=None): (source)

Check the same list of files we checked most recently.

If remove/update is given, they modify the previous list; if all are None, stat() is called for each file in the previous list.

Parameters
is​_tty:boolUndocumented
terminal​_width:intUndocumented
remove:Optional[List[str]]Undocumented
update:Optional[List[str]]Undocumented
Returns
Dict[str, object]Undocumented
def cmd_run(self, version, args, is_tty, terminal_width): (source)
Check a list of files, triggering a restart if needed.
Parameters
version:strUndocumented
args:Sequence[str]Undocumented
is​_tty:boolUndocumented
terminal​_width:intUndocumented
Returns
Dict[str, object]Undocumented
def cmd_status(self, fswatcher_dump_file=None): (source)
Return daemon status.
Parameters
fswatcher​_dump​_file:Optional[str]Undocumented
Returns
Dict[str, object]Undocumented
def cmd_stop(self): (source)
Stop daemon.
Returns
Dict[str, object]Undocumented
def cmd_suggest(self, function, callsites, **kwargs): (source)
Suggest a signature for a function.
Parameters
function:strUndocumented
callsites:boolUndocumented
**kwargs:AnyUndocumented
Returns
Dict[str, object]Undocumented
def direct_imports(self, module, graph): (source)
Return the direct imports of module not included in seen.
Parameters
module:Tuple[str, str]Undocumented
graph:mypy.build.GraphUndocumented
Returns
List[BuildSource]Undocumented
def find_added_suppressed(self, graph, seen, search_paths): (source)

Find suppressed modules that have been added (and not included in seen).

Args:
seen: reachable modules we've seen before (mutated here!!)

Return suppressed, added modules.

Parameters
graph:mypy.build.GraphUndocumented
seen:Set[str]Undocumented
search​_paths:SearchPathsUndocumented
Returns
List[Tuple[str, str]]Undocumented
def find_changed(self, sources): (source)

Undocumented

Parameters
sources:List[BuildSource]Undocumented
Returns
ChangesAndRemovalsUndocumented
def find_reachable_changed_modules(self, roots, graph, seen, changed_paths): (source)

Follow imports within graph from given sources until hitting changed modules.

If we find a changed module, we can't continue following imports as the imports may have changed.

Args:
roots: modules where to start search from graph: module graph to use for the search seen: modules we've seen before that won't be visited (mutated here!!) changed_paths: which paths have changed (stop search here and return any found)
Return (encountered reachable changed modules,
unchanged files not in sources_set traversed).
Parameters
roots:List[BuildSource]Undocumented
graph:mypy.build.GraphUndocumented
seen:Set[str]Undocumented
changed​_paths:AbstractSet[str]Undocumented
Returns
Tuple[List[Tuple[str, str]], List[BuildSource]]Undocumented
def fine_grained_increment(self, sources, remove=None, update=None): (source)

Perform a fine-grained type checking increment.

If remove and update are None, determine changed paths by using fswatcher. Otherwise, assume that only these files have changes.

Args:
sources: sources passed on the command line remove: paths of files that have been removed update: paths of files that have been changed or created
Parameters
sources:List[BuildSource]Undocumented
remove:Optional[List[str]]Undocumented
update:Optional[List[str]]Undocumented
Returns
List[str]Undocumented
def fine_grained_increment_follow_imports(self, sources): (source)
Like fine_grained_increment, but follow imports.
Parameters
sources:List[BuildSource]Undocumented
Returns
List[str]Undocumented
def flush_caches(self): (source)

Undocumented

def following_imports(self): (source)
Are we following imports?
Returns
boolUndocumented
def increment_output(self, messages, sources, is_tty, terminal_width): (source)

Undocumented

Parameters
messages:List[str]Undocumented
sources:List[BuildSource]Undocumented
is​_tty:boolUndocumented
terminal​_width:intUndocumented
Returns
Dict[str, Any]Undocumented
def initialize_fine_grained(self, sources, is_tty, terminal_width): (source)

Undocumented

Parameters
sources:List[BuildSource]Undocumented
is​_tty:boolUndocumented
terminal​_width:intUndocumented
Returns
Dict[str, Any]Undocumented
def pretty_messages(self, messages, n_sources, is_tty=False, terminal_width=None): (source)

Undocumented

Parameters
messages:List[str]Undocumented
n​_sources:intUndocumented
is​_tty:boolUndocumented
terminal​_width:Optional[int]Undocumented
Returns
List[str]Undocumented
def run_command(self, command, data): (source)
Run a specific command from the registry.
Parameters
command:strUndocumented
data:Dict[str, object]Undocumented
Returns
Dict[str, object]Undocumented
def serve(self): (source)
Serve requests, synchronously (no thread or fork).
def update_changed(self, sources, remove, update): (source)

Undocumented

Parameters
sources:List[BuildSource]Undocumented
remove:List[str]Undocumented
update:List[str]Undocumented
Returns
ChangesAndRemovalsUndocumented
def update_sources(self, sources): (source)

Undocumented

Parameters
sources:List[BuildSource]Undocumented
def update_stats(self, res): (source)

Undocumented

Parameters
res:Dict[str, Any]Undocumented
fine_grained_manager = (source)

Undocumented

formatter = (source)

Undocumented

fscache = (source)

Undocumented

fswatcher = (source)

Undocumented

options = (source)

Undocumented

options_snapshot = (source)

Undocumented

previous_sources = (source)

Undocumented

status_file = (source)

Undocumented

timeout = (source)

Undocumented

def _find_changed(self, sources, changed_paths): (source)

Undocumented

Parameters
sources:List[BuildSource]Undocumented
changed​_paths:AbstractSet[str]Undocumented
Returns
ChangesAndRemovalsUndocumented
def _response_metadata(self): (source)

Undocumented

Returns
Dict[str, str]Undocumented