"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "client/pyre.py" between
pyre-check-0.0.53.tar.gz and pyre-check-0.0.54.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

pyre.py  (pyre-check-0.0.53):pyre.py  (pyre-check-0.0.54)
skipping to change at line 99 skipping to change at line 99
should_log_statistics = True should_log_statistics = True
# Having this as a fails-by-default helps flag unexpected exit # Having this as a fails-by-default helps flag unexpected exit
# from exception flows. # from exception flows.
exit_code = ExitCode.FAILURE exit_code = ExitCode.FAILURE
try: try:
original_directory = os.getcwd() original_directory = os.getcwd()
configuration = configuration_module.Configuration.from_arguments( configuration = configuration_module.Configuration.from_arguments(
command_arguments.CommandArguments.from_arguments(arguments), Path(" .") command_arguments.CommandArguments.from_arguments(arguments), Path(" .")
) )
if configuration is None:
raise commands.ClientException(
"Cannot locate a `.pyre_configuration` file in the current direc
tory "
"or any parent directories."
)
if arguments.version: if arguments.version:
try: try:
binary_version = configuration.get_binary_version() if configuration is not None:
if binary_version: binary_version = configuration.get_binary_version()
log.stdout.write(f"Binary version: {binary_version}\n") if binary_version:
log.stdout.write(f"Binary version: {binary_version}\n")
except Exception: except Exception:
pass pass
log.stdout.write(f"Client version: {__version__}\n") log.stdout.write(f"Client version: {__version__}\n")
exit_code = ExitCode.SUCCESS exit_code = ExitCode.SUCCESS
else: else:
if configuration is None:
raise commands.ClientException(
"Cannot locate a `.pyre_configuration` file in the current d
irectory "
"or any parent directories."
)
command = arguments.command(arguments, original_directory, configura tion) command = arguments.command(arguments, original_directory, configura tion)
log.start_logging_to_directory( log.start_logging_to_directory(
arguments.noninteractive, command.configuration.log_directory arguments.noninteractive, command.configuration.log_directory
) )
exit_code = command.run().exit_code() exit_code = command.run().exit_code()
except analysis_directory.NotWithinLocalConfigurationException as error: except analysis_directory.NotWithinLocalConfigurationException as error:
if arguments.command == commands.Persistent.from_arguments: if arguments.command == commands.Persistent.from_arguments:
try: try:
commands.Persistent.run_null_server(timeout=3600 * 12) commands.Persistent.run_null_server(timeout=3600 * 12)
exit_code = ExitCode.SUCCESS exit_code = ExitCode.SUCCESS
skipping to change at line 139 skipping to change at line 140
exit_code = ExitCode.SUCCESS exit_code = ExitCode.SUCCESS
elif not command: elif not command:
client_exception_message = str(error) client_exception_message = str(error)
exit_code = ExitCode.FAILURE exit_code = ExitCode.FAILURE
else: else:
should_log_statistics = False should_log_statistics = False
assert isinstance(command, Command) assert isinstance(command, Command)
raise FailedOutsideLocalConfigurationException( raise FailedOutsideLocalConfigurationException(
exit_code, command, str(error) exit_code, command, str(error)
) )
except (buck.BuckException, EnvironmentException) as error: except (
buck.BuckException,
configuration_module.InvalidConfiguration,
EnvironmentException,
) as error:
if arguments.command == commands.Persistent.from_arguments: if arguments.command == commands.Persistent.from_arguments:
try: try:
commands.Persistent.run_null_server(timeout=3600 * 12) commands.Persistent.run_null_server(timeout=3600 * 12)
exit_code = ExitCode.SUCCESS exit_code = ExitCode.SUCCESS
except Exception as error: except Exception as error:
client_exception_message = str(error) client_exception_message = str(error)
exit_code = ExitCode.FAILURE exit_code = ExitCode.FAILURE
except KeyboardInterrupt: except KeyboardInterrupt:
LOG.warning("Interrupted by user") LOG.warning("Interrupted by user")
exit_code = ExitCode.SUCCESS exit_code = ExitCode.SUCCESS
else: else:
client_exception_message = str(error) client_exception_message = str(error)
exit_code = ( exit_code = ExitCode.FAILURE
ExitCode.BUCK_ERROR if isinstance(error, buck.BuckException):
if isinstance(error, buck.BuckException) exit_code = ExitCode.BUCK_ERROR
else ExitCode.FAILURE elif isinstance(error, configuration_module.InvalidConfiguration):
) exit_code = ExitCode.CONFIGURATION_ERROR
except commands.ClientException as error: except commands.ClientException as error:
client_exception_message = str(error) client_exception_message = str(error)
exit_code = ExitCode.FAILURE exit_code = ExitCode.FAILURE
except Exception: except Exception:
client_exception_message = traceback.format_exc() client_exception_message = traceback.format_exc()
exit_code = ExitCode.FAILURE exit_code = ExitCode.FAILURE
except KeyboardInterrupt: except KeyboardInterrupt:
LOG.warning("Interrupted by user") LOG.warning("Interrupted by user")
LOG.debug(traceback.format_exc()) LOG.debug(traceback.format_exc())
exit_code = ExitCode.SUCCESS exit_code = ExitCode.SUCCESS
skipping to change at line 258 skipping to change at line 263
for command in commands.COMMANDS: for command in commands.COMMANDS:
command.add_subparser(parsed_commands) command.add_subparser(parsed_commands)
arguments = parser.parse_args(argv) arguments = parser.parse_args(argv)
log.initialize(arguments.noninteractive) log.initialize(arguments.noninteractive)
if not hasattr(arguments, "command"): if not hasattr(arguments, "command"):
_set_default_command(arguments) _set_default_command(arguments)
# Special-case `pyre init` because it is not a `Command` like the others.
if arguments.command == commands.Initialize.from_arguments:
return arguments.command().run().exit_code()
return _run_pyre_with_retry(arguments) return _run_pyre_with_retry(arguments)
if __name__ == "__main__": if __name__ == "__main__":
try: try:
os.getcwd() os.getcwd()
except FileNotFoundError: except FileNotFoundError:
LOG.error( LOG.error(
"Pyre could not determine the current working directory. " "Pyre could not determine the current working directory. "
"Has it been removed?\nExiting." "Has it been removed?\nExiting."
) )
 End of changes. 6 change blocks. 
15 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)