Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pyre] support Python 3.5 in wrapper scripts #32

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/commands/command.py
Expand Up @@ -48,8 +48,8 @@ def check(self) -> None:


class Command:
_buffer: List[str] = []
_call_client_terminated: bool = False
_buffer = [] # type: List[str]
_call_client_terminated = False # type: bool

def __init__(
self,
Expand Down Expand Up @@ -197,7 +197,7 @@ def _server_string(self, source_directory=None):
return "server{}".format('' if len(source_directory) < 2 else 's')

def _source_directory_string(self):
return f'`{self._source_directory}`'
return '`{}`'.format(self._source_directory)

def on_client_exception(self) -> None:
pass
Expand Down
3 changes: 1 addition & 2 deletions scripts/configuration.py
Expand Up @@ -31,7 +31,7 @@ class InvalidConfiguration(Exception):


class Configuration:
_disabled: bool
_disabled = False # type: bool

def __init__(
self,
Expand All @@ -46,7 +46,6 @@ def __init__(
self.autogenerated = []
self.number_of_workers = None

self._disabled = False
self._version_hash = None
self._binary = None
self._typeshed = None
Expand Down
4 changes: 2 additions & 2 deletions scripts/error.py
Expand Up @@ -5,8 +5,8 @@


class Error:
autogenerated: bool
external: bool
autogenerated = False # type: bool
external = False # type: bool

def __init__(
self, autogenerated: bool = False, external: bool = False, **error
Expand Down
4 changes: 2 additions & 2 deletions scripts/filesystem.py
Expand Up @@ -31,8 +31,8 @@ def __init__(self, source_directories, isolate: bool = False):
self._isolate = isolate

def get_root(self) -> str:
suffix = f"_{str(os.getpid())}" if self._isolate else ''
return f'.pyre/shared_source_directory{suffix}'
suffix = '_{}'.format(str(os.getpid())) if self._isolate else ''
return '.pyre/shared_source_directory{}'.format(suffix)

def prepare(self) -> None:
start = time()
Expand Down
9 changes: 4 additions & 5 deletions scripts/log.py
Expand Up @@ -61,8 +61,8 @@ class TimedStreamHandler(logging.StreamHandler):
THRESHOLD = 0.5
LINE_BREAKING_LEVELS = ['ERROR', 'WARNING', 'SUCCESS']

_terminate: bool = False
_last_update: float = 0.0
_terminate = False # type: bool
_last_update = 0.0 # type: float

def __init__(self) -> None:
super(TimedStreamHandler, self).__init__()
Expand Down Expand Up @@ -172,7 +172,7 @@ def initialize(arguments) -> None:
stream_handler = TimedStreamHandler()
arguments.timed_stream_handler = stream_handler

handlers: List[logging.Handler] = [stream_handler]
handlers = [stream_handler] # type: List[logging.Handler]

if not arguments.noninteractive:
try:
Expand Down Expand Up @@ -204,12 +204,11 @@ def cleanup(arguments) -> None:
class Buffer:
THRESHOLD = 0.1

_flushed: bool
_flushed = False # type: bool

def __init__(self, section, data) -> None:
self._section = section
self._data = data
self._flushed = False
self._lock = threading.RLock()
thread = threading.Thread(target=self._thread)
thread.daemon = True
Expand Down