Reformat everything

This commit is contained in:
Henrique Gemignani Passos Lima
2018-06-05 23:21:54 -03:00
parent 8bfb3d9514
commit 6edf2ada36
16 changed files with 78 additions and 29 deletions
+64
View File
@@ -0,0 +1,64 @@
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=CVS,randomize_window_ui,manage_game_window_ui,mainwindow_ui,data_editor_ui
# Pickle collected data for later comparisons.
persistent=yes
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
# Use multiple processes to speed up Pylint.
jobs=1
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
# confidence=
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time. See also the "--disable" option for examples.
#enable=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=
fixme,
missing-docstring,
no-name-in-module,
consider-iterating-dictionary,
[FORMAT]
# Maximum number of characters on a single line.
max-line-length=120
-1
View File
@@ -1,4 +1,3 @@
import argparse
import multiprocessing
from randovania import cli
-3
View File
@@ -1,9 +1,6 @@
import multiprocessing
import os
from argparse import ArgumentParser
from typing import BinaryIO
from randovania import get_data_path
from randovania.games.prime import binary_data
from randovania.games.prime.claris_randomizer import has_randomizer_binary, apply_seed
from randovania.interface_common.options import value_parsers, options_validation, Options
+1 -2
View File
@@ -1,9 +1,8 @@
import json
import os
from functools import partial
from typing import List, Callable, TypeVar, BinaryIO, Dict, TextIO
import os
from randovania import get_data_path
from randovania.binary_file import BinarySource, BinaryWriter
-1
View File
@@ -87,4 +87,3 @@ class Random:
def sample(self) -> float:
return self._internal_sample().value / MBIG.value
@@ -50,4 +50,3 @@ def apply_seed(randomizer_config: RandomizerConfiguration,
except Exception:
process.kill()
raise
+5 -3
View File
@@ -16,8 +16,9 @@ def _disc_unpack_process(output_pipe, iso: str, game_files_path: str):
disc, is_wii = nod.open_disc_from_image(iso)
data_partition = disc.get_data_partition()
if not data_partition:
raise RuntimeError("Could not find a data partition in '{}'.\nIs it a valid Metroid Prime 2 ISO?".format(
iso))
raise RuntimeError(
"Could not find a data partition in '{}'.\nIs it a valid Metroid Prime 2 ISO?".format(
iso))
context = nod.ExtractionContext()
context.set_progress_callback(progress_callback)
@@ -26,6 +27,7 @@ def _disc_unpack_process(output_pipe, iso: str, game_files_path: str):
except RuntimeError as e:
return True, str(e), 0
output_pipe.send(_helper())
@@ -41,6 +43,7 @@ def _disc_pack_process(status_queue, iso: str, game_files_path: str):
except RuntimeError as e:
return True, str(e), 0
status_queue.send(_helper())
@@ -49,7 +52,6 @@ def _shared_process_code(target,
game_files_path: str,
on_finish_message: str,
progress_update: Callable[[str, int], None]):
receiving_pipe, output_pipe = multiprocessing.Pipe(False)
process = multiprocessing.Process(
target=target,
+1 -4
View File
@@ -1,12 +1,9 @@
import os
from typing import List, Dict
from typing import Dict
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow, QRadioButton
from randovania import get_data_path
from randovania.games.prime import binary_data
from randovania.games.prime.log_parser import parse_log
from randovania.gui.data_editor_ui import Ui_DataEditorWindow
from randovania.resolver.data_reader import WorldReader, read_resource_database, read_dock_weakness_database
from randovania.resolver.game_description import World, Area
+1 -1
View File
@@ -7,7 +7,7 @@ from typing import Optional, Callable
from PyQt5 import QtCore
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtGui import QIntValidator
from PyQt5.QtWidgets import QMainWindow, QFileDialog, QMessageBox
from PyQt5.QtWidgets import QMainWindow, QFileDialog
from randovania.games.prime import binary_data
from randovania.games.prime.claris_randomizer import apply_seed
+2 -4
View File
@@ -1,13 +1,10 @@
import os
from typing import Dict, Iterable, BinaryIO
from typing import Dict, Iterable
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QMainWindow
from randovania import get_data_path
from randovania.games.prime import binary_data
from randovania.games.prime.log_parser import parse_log
from randovania.gui import application_options
from randovania.gui.randomize_window_ui import Ui_RandomizeWindow
from randovania.resolver.data_reader import read_resource_database
@@ -24,6 +21,7 @@ def _persist_bool_option(attribute_name: str):
options = application_options()
setattr(options, attribute_name, value)
options.save_to_disk()
return callback
+1 -1
View File
@@ -2,10 +2,10 @@ from functools import partial
from typing import List, Callable, TypeVar, Tuple, Dict, Iterable
from randovania.games.prime.log_parser import Elevator
from randovania.resolver.dock import DockWeakness, DockType, DockWeaknessDatabase
from randovania.resolver.game_description import World, Area, GameDescription
from randovania.resolver.node import GenericNode, DockNode, TeleporterNode, PickupNode, EventNode, Node, \
is_resource_node
from randovania.resolver.dock import DockWeakness, DockType, DockWeaknessDatabase
from randovania.resolver.requirements import IndividualRequirement, RequirementList, RequirementSet
from randovania.resolver.resources import SimpleResourceInfo, DamageReduction, DamageResourceInfo, PickupIndex, \
ResourceGain, PickupEntry, find_resource_info_with_long_name, ResourceType, ResourceDatabase
-2
View File
@@ -38,7 +38,6 @@ def run_resolver(data: Dict,
randomizer_log: RandomizerLog,
resolver_config: ResolverConfiguration,
verbose=True) -> Optional[State]:
game_description = data_reader.decode_data(data, randomizer_log.elevators)
game_patches = GamePatches(randomizer_log.pickup_mapping)
@@ -154,7 +153,6 @@ def search_seed_with_options(data: Dict,
options: Options,
seed_report: Callable[[int], None],
start_on_seed: Optional[int] = None) -> Tuple[int, int]:
randomizer_config = RandomizerConfiguration.from_options(options)
resolver_config = ResolverConfiguration.from_options(options)
cpu_count = options.cpu_usage.num_cpu_for_count(multiprocessing.cpu_count())
+1 -1
View File
@@ -6,5 +6,5 @@ class GamePatches(NamedTuple):
Currently we support:
* Swapping pickup locations
"""
pickup_mapping: List[int]
+1 -3
View File
@@ -1,9 +1,9 @@
from typing import Dict, Set
from randovania.resolver.game_description import GameDescription
from randovania.resolver.game_patches import GamePatches
from randovania.resolver.node import Node
from randovania.resolver.requirements import RequirementSet
from randovania.resolver.game_patches import GamePatches
from randovania.resolver.resources import CurrentResources
@@ -36,5 +36,3 @@ def build_static_resources(difficulty_level: int,
for difficulty in game.resource_database.difficulty:
static_resources[difficulty] = difficulty_level
return static_resources
-1
View File
@@ -2,7 +2,6 @@ from typing import Set, Optional
from randovania.resolver import debug
from randovania.resolver.game_description import GameDescription
from randovania.resolver.requirements import RequirementSet
from randovania.resolver.game_patches import GamePatches
from randovania.resolver.logic import build_static_resources, \
Logic
+1 -1
View File
@@ -2,9 +2,9 @@ import copy
from typing import Optional
from randovania.resolver.game_description import GameDescription
from randovania.resolver.node import ResourceNode, Node
from randovania.resolver.game_patches import GamePatches
from randovania.resolver.logic import Logic
from randovania.resolver.node import ResourceNode, Node
from randovania.resolver.resources import ResourceInfo, CurrentResources, ResourceGain, ResourceType, ResourceDatabase