Add "end-of-file-fixer" to pre-commit hooks

pull/2001/head
derekpierre 2020-05-19 14:28:29 -04:00
parent 3155b966c7
commit c1d93d8941
75 changed files with 46 additions and 84 deletions

View File

@ -1,3 +1,3 @@
[bandit]
exclude: tests, examples, demo, scripts, setup.py
skips: B504,B610,B611,B703
skips: B504,B610,B611,B703

View File

@ -21,4 +21,3 @@ values =
[bumpversion:file:nucypher/__about__.py]
[bumpversion:file:docs/source/conf.py]

2
.github/labeler.yml vendored
View File

@ -15,4 +15,4 @@ Dependencies:
- Pipfile.lock
- setup.py
- dev-requirements.txt
- requirements.txt
- requirements.txt

2
.gitignore vendored
View File

@ -46,4 +46,4 @@ finnegans-wake.txt
# Sphinx
docs/build
docs/source/modules.rst
docs/source/api/
docs/source/api/

View File

@ -21,6 +21,7 @@ repos:
- id: check-executables-have-shebangs
- id: check-added-large-files
- id: check-symlinks
- id: end-of-file-fixer
# Syntax
- id: check-yaml
@ -52,4 +53,4 @@ repos:
# rev: stable
# hooks:
# - id: black
# language_version: python3.6
# language_version: python3.6

View File

@ -74,4 +74,3 @@ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.ht
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@ -1707,4 +1707,3 @@ class Ec2Inventory(object):
if __name__ == '__main__':
# Run the script
Ec2Inventory()

View File

@ -15,4 +15,3 @@
- name: Rename Configuration File (if existing)
command: mv {{ old }} {{ new }}
when: configuration_file.stat.exists

View File

@ -14,4 +14,4 @@ ec2_tag_Type: "${EC2_TAG_TYPE}"
aws_pem_path: "${AWS_PEM_PATH}"
git_repo: "${GIT_REPOSITORY_URL}"
git_version: "${GIT_VERSION}"
nucypher_role: 'seednodes'
nucypher_role: 'seednodes'

View File

@ -2,4 +2,4 @@
hosts: "{{ play_hosts }}"
remote_user: "{{default_user}}"
- import_playbook: include/check_running_ursula.yml
- import_playbook: include/check_running_ursula.yml

View File

@ -28,4 +28,4 @@
- "last committed period: {{status_data.json.last_committed_period}}"
- "balances:"
- " ETH: {{status_data.json.balances.eth}}"
- " NU: {{status_data.json.balances.nu}}"
- " NU: {{status_data.json.balances.nu}}"

View File

@ -22,4 +22,4 @@
- name: "wait a few seconds Ursula to startup"
pause:
seconds: 15
seconds: 15

View File

@ -47,4 +47,3 @@
- name: "wait a few seconds for the docker daemon to startup (you can ctrl-C this...)"
pause:
seconds: 10

View File

@ -7,4 +7,3 @@
- name: "create nucypher user as {{default_user}}"
user:
name: nucypher

View File

@ -26,4 +26,4 @@
state: stopped
- import_playbook: run_geth.yml
- import_playbook: run_ursula.yml
- import_playbook: run_ursula.yml

View File

@ -8,4 +8,4 @@
- import_playbook: include/run_geth.yml
- import_playbook: include/init_ursula.yml
- import_playbook: include/run_ursula.yml
- import_playbook: include/check_running_ursula.yml
- import_playbook: include/check_running_ursula.yml

View File

@ -3,4 +3,4 @@
remote_user: "{{default_user}}"
- import_playbook: include/update_existing_ursula.yml
- import_playbook: include/check_running_ursula.yml
- import_playbook: include/check_running_ursula.yml

View File

@ -18,4 +18,3 @@ geth --datadir ./chaindata \
--identity "NuCypherTestnet" \
--networkid 112358 \
init custom_genesis.json \

View File

@ -7,4 +7,4 @@ bootnode --genkey ./bootnode/bootnode.key --verbosity 6
bootnode --nodekey ./bootnode/bootnode.key --writeaddress
# Run Bootnode
bootnode --nodekey ./bootnode/bootnode.key --verbosity 6
bootnode --nodekey ./bootnode/bootnode.key --verbosity 6

View File

@ -4,4 +4,4 @@
"enode://4f7a27820107c235bb0f8086ee1c2bad62174450ec2eec12cb29e3fa7ecb9f332710373c1d11a3115aa72f2dabbae27b73eac51f06d3df558dd9fb51007da653@52.91.112.249:30303",
"enode://6b58a9437aa88f254b75110019c54807cf1d7da9729f2c022a2463bae86b639288909fe00ffac0599e616676eea2de3c503bacaf4be835a02195bea0b349ca80@54.88.246.77:30303",
"enode://562051180eca42514e44b4428ed20a3cb626654631f53bbfa549de7d3b7e418376e8f784c232429d7ff01bd0597e3ce7327699bb574d39ac3b2ac1729ed0dd44@54.224.110.32:30303"
]
]

View File

@ -16,4 +16,4 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@ -5,4 +5,4 @@
.. automodule:: {{ qualname }}
{%- for option in automodule_options %}
:{{ option }}:
{%- endfor %}
{%- endfor %}

View File

@ -50,4 +50,4 @@ Module contents
---------------
{{ automodule(pkgname, automodule_options) }}
{% endif %}
{% endif %}

View File

@ -113,4 +113,3 @@ The result is printed in the console:
---------------------❤︎ (81 BPM) Retrieval time: 1483.04 ms
----------------❤︎ (76 BPM) Retrieval time: 1687.72 ms
---------------❤︎ (75 BPM) Retrieval time: 1563.65 ms

View File

@ -247,4 +247,3 @@ Label the pull request as "Release Candidate" and wait for all checks to pass.
7. Monitor the triggered deployment build on CircleCI for manual approval.
8. Merge the pull request

View File

@ -130,4 +130,3 @@ A summary of deployed contract addresses, transactions, and gas usage will be di
Generated registry /Users/david/nucypher/contract_registry.json
Saved deployment receipts to /Users/david/nucypher/deployment-receipts-0x53Ec-1565690714.json

View File

@ -11,4 +11,4 @@ The NuCypher Network provides cryptographic infrastructure for privacy-preservin
getting_started
cli_guide
character_control_guide
character_control_guide

View File

@ -311,4 +311,3 @@ Systemd Method:
.. code::
$ sudo systemctl start ursula

View File

@ -10,4 +10,4 @@ To be a node on the NuCypher network, operations are divided into two roles “S
:maxdepth: 1
staking_guide
ursula_configuration_guide
ursula_configuration_guide

View File

@ -1,3 +1,3 @@
========
Releases
========
========

View File

@ -137,4 +137,3 @@ policy_info = {
filename = POLICY_FILENAME
with open(filename, 'w') as f:
json.dump(policy_info, f)

View File

@ -9,4 +9,4 @@ ignore_missing_imports=True
warn_return_any = False
no_implicit_optional = False
strict_optional = False
warn_no_return = False
warn_no_return = False

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1 @@
# Registry for NuCypher Testnet 1 ("Miranda")

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"BENEFICIARY_ADDRESS": ["ALLOCATION_CONTRACT_ADDRESS", [{"constant": true, "inputs": [], "name": "linker", "outputs": [{"name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"name": "_value", "type": "uint256"}], "name": "withdrawTokens", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "getLockedTokens", "outputs": [{"name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"name": "_value", "type": "uint256"}, {"name": "_duration", "type": "uint256"}], "name": "initialDeposit", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "owner", "outputs": [{"name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "isOwner", "outputs": [{"name": "", "type": "bool"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "endLockTimestamp", "outputs": [{"name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "lockedValue", "outputs": [{"name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "withdrawETH", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"name": "newOwner", "type": "address"}], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "token", "outputs": [{"name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"inputs": [{"name": "_linker", "type": "address"}, {"name": "_token", "type": "address"}], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}, {"payable": true, "stateMutability": "payable", "type": "fallback"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "sender", "type": "address"}, {"indexed": false, "name": "value", "type": "uint256"}, {"indexed": false, "name": "duration", "type": "uint256"}], "name": "TokensDeposited", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "owner", "type": "address"}, {"indexed": false, "name": "value", "type": "uint256"}], "name": "TokensWithdrawn", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "owner", "type": "address"}, {"indexed": false, "name": "value", "type": "uint256"}], "name": "ETHWithdrawn", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "previousOwner", "type": "address"}, {"indexed": true, "name": "newOwner", "type": "address"}], "name": "OwnershipTransferred", "type": "event"}]]}
{"BENEFICIARY_ADDRESS": ["ALLOCATION_CONTRACT_ADDRESS", [{"constant": true, "inputs": [], "name": "linker", "outputs": [{"name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"name": "_value", "type": "uint256"}], "name": "withdrawTokens", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "getLockedTokens", "outputs": [{"name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [{"name": "_value", "type": "uint256"}, {"name": "_duration", "type": "uint256"}], "name": "initialDeposit", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [], "name": "renounceOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "owner", "outputs": [{"name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "isOwner", "outputs": [{"name": "", "type": "bool"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "endLockTimestamp", "outputs": [{"name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": true, "inputs": [], "name": "lockedValue", "outputs": [{"name": "", "type": "uint256"}], "payable": false, "stateMutability": "view", "type": "function"}, {"constant": false, "inputs": [], "name": "withdrawETH", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": false, "inputs": [{"name": "newOwner", "type": "address"}], "name": "transferOwnership", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function"}, {"constant": true, "inputs": [], "name": "token", "outputs": [{"name": "", "type": "address"}], "payable": false, "stateMutability": "view", "type": "function"}, {"inputs": [{"name": "_linker", "type": "address"}, {"name": "_token", "type": "address"}], "payable": false, "stateMutability": "nonpayable", "type": "constructor"}, {"payable": true, "stateMutability": "payable", "type": "fallback"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "sender", "type": "address"}, {"indexed": false, "name": "value", "type": "uint256"}, {"indexed": false, "name": "duration", "type": "uint256"}], "name": "TokensDeposited", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "owner", "type": "address"}, {"indexed": false, "name": "value", "type": "uint256"}], "name": "TokensWithdrawn", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "owner", "type": "address"}, {"indexed": false, "name": "value", "type": "uint256"}], "name": "ETHWithdrawn", "type": "event"}, {"anonymous": false, "inputs": [{"indexed": true, "name": "previousOwner", "type": "address"}, {"indexed": true, "name": "newOwner", "type": "address"}], "name": "OwnershipTransferred", "type": "event"}]]}

View File

@ -88,4 +88,4 @@ def save_receipt(actor_method):
receipt = actor_method(self, *args, **kwargs)
self._saved_receipts.append((datetime.utcnow(), receipt))
return receipt
return wrapped
return wrapped

View File

@ -75,4 +75,4 @@ class ContractEvents:
def __iter__(self):
for event_name in self.names:
yield self[event_name]
yield self[event_name]

View File

@ -160,6 +160,3 @@ class Authorization:
with open(filepath, 'rb') as file:
data = file.read()
return cls.deserialize(data=data)

View File

@ -57,4 +57,4 @@ library Address {
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
}

View File

@ -520,4 +520,4 @@ class Character(Learner):
interface=self.interface)
self.controller = controller
return controller
return controller

View File

@ -32,5 +32,3 @@ class TreasureMap(BaseField, fields.Field):
return True
except InvalidNativeDataTypes as e:
raise InvalidInputData(f"Could not parse {self.name}: {e}")

View File

@ -205,4 +205,4 @@ option_middleware = wrap_option(
process_middleware,
mock_networking=click.option('-Z', '--mock-networking', help="Use in-memory transport instead of networking", count=True),
)
option_signer_uri = click.option('--signer', 'signer_uri', '-S', default=None, type=str)
option_signer_uri = click.option('--signer', 'signer_uri', '-S', default=None, type=str)

View File

@ -64,4 +64,4 @@ Unsigned TX hash: ... {proposal.digest.hex()}
emitter.echo(info)
if contract or registry:
paint_decoded_transaction(emitter, proposal, contract, registry)
paint_decoded_transaction(emitter, proposal, contract, registry)

View File

@ -128,4 +128,4 @@ def paint_known_nodes(emitter, ursula) -> None:
elif node.checksum_address in seednode_addresses:
node_type = 'seednode'
row_template += ' ({})'.format(node_type)
emitter.echo(row_template.format(node.rest_url().ljust(20), node), color=color_index[node_type])
emitter.echo(row_template.format(node.rest_url().ljust(20), node), color=color_index[node_type])

View File

@ -214,4 +214,4 @@ def paint_min_rate(emitter, registry, policy_agent, staker_address):
Minimum acceptable fee rate (set by staker for their associated worker):
~ Previously set ....... {prettify_eth_amount(raw_minimum)}
~ Effective ............ {prettify_eth_amount(minimum)}"""
emitter.echo(rate_payload)
emitter.echo(rate_payload)

View File

@ -49,4 +49,4 @@ def paint_receipt_summary(emitter, receipt, chain_name: str = None, transaction_
except ValueError as e:
emitter.log.info("Failed Etherscan URL construction: " + str(e))
else:
emitter.echo(f" See {url}\n")
emitter.echo(f" See {url}\n")

View File

@ -226,4 +226,4 @@ class JSONRPCLineReceiver(LineReceiver):
def lineReceived(self, line):
line = line.strip(self.delimiter)
if line:
self.rpc_controller.handle_request(control_request=line)
self.rpc_controller.handle_request(control_request=line)

View File

@ -23,4 +23,3 @@ from nucypher.crypto.constants import CAPSULE_LENGTH, PUBLIC_KEY_LENGTH
key_splitter = BytestringSplitter((UmbralPublicKey, PUBLIC_KEY_LENGTH))
capsule_splitter = BytestringSplitter((Capsule, CAPSULE_LENGTH, {"params": default_params()}))

View File

@ -28,4 +28,4 @@ class ThreadedSession:
return self.session
def __exit__(self, exc_type, exc_val, exc_tb):
self.session.remove()
self.session.remove()

View File

@ -259,4 +259,4 @@
}
}
}

View File

@ -154,4 +154,4 @@
{%- endfor %}
</table>
</div>
</html>
</html>

View File

@ -233,4 +233,4 @@ class AvailabilityTracker:
elif response.status_code == 400:
self.record(False, reason={'failed': f"{ursula_or_sprout.checksum_address} reported unavailability."})
else:
self.record(None, reason={"error": f"{ursula_or_sprout.checksum_address} returned {response.status_code} from 'ping' endpoint."})
self.record(None, reason={"error": f"{ursula_or_sprout.checksum_address} returned {response.status_code} from 'ping' endpoint."})

View File

@ -2,4 +2,3 @@
addopts = -v --runslow --junitxml=./reports/pytest-results.xml --strict-markers --durations=0 --cov=nucypher --cov-report xml:reports/coverage.xml
markers =
slow: marks tests as slow (skipped by default, use '--runslow' to include these tests)

View File

@ -5,4 +5,4 @@ mkdir $LOGDIR
docker exec -it circleursula1 cat /root/.cache/nucypher/log/nucypher.log > $LOGDIR/ursula-1.txt
docker exec -it circleursula2 cat /root/.cache/nucypher/log/nucypher.log > $LOGDIR/ursula-2.txt
docker exec -it circleursula3 cat /root/.cache/nucypher/log/nucypher.log > $LOGDIR/ursula-3.txt
docker exec -it circleursula4 cat /root/.cache/nucypher/log/nucypher.log > $LOGDIR/ursula-4.txt
docker exec -it circleursula4 cat /root/.cache/nucypher/log/nucypher.log > $LOGDIR/ursula-4.txt

View File

@ -25,4 +25,3 @@ pipenv lock --clear --pre --requirements --dev > dev-$PREFIX.txt
echo "building $PREFIX.txt"
pipenv lock --clear --pre --requirements > $PREFIX.txt

View File

@ -29,4 +29,4 @@ sleep 1
# Connect Node #3 to the local Fleet
echo "Starting Ursula #3..."
nucypher ursula run --debug --dev --federated-only --teacher localhost:11500 --rest-port 11502 > /tmp/ursulas-logs/ursula-11502.txt 2>&1 &
nucypher ursula run --debug --dev --federated-only --teacher localhost:11500 --rest-port 11502 > /tmp/ursulas-logs/ursula-11502.txt 2>&1 &

View File

@ -78,4 +78,3 @@ def spin_up_federated_ursulas(quantity: int = FLEET_POPULATION):
if __name__ == "__main__":
spin_up_federated_ursulas()

View File

@ -199,4 +199,3 @@ def test_validate_cfrag(testerchain, reencryption_validator, mock_ursula_reencry
# Evaluation must fail since Bob precomputed wrong values
with pytest.raises(TransactionFailed):
_ = reencryption_validator.functions.validateCFrag(*args).call()

View File

@ -86,6 +86,3 @@ def test_trustee_proposes_multisig_management_operations(testerchain, test_regis
contract_function, params = proposal.decode_transaction_data(registry=test_registry)
assert list(params.values()) == [evicted_owner] # The owner to remove is the only parameter in the call

View File

@ -153,4 +153,3 @@ def test_activate_network(testerchain, token_economics, test_registry):
assert not staking_escrow_deployer.ready_to_activate
with pytest.raises(StakingEscrowDeployer.ContractDeploymentError):
staking_escrow_deployer.activate()

View File

@ -64,6 +64,3 @@ def test_multisig_deployer_and_agent(testerchain,
assert multisig_agent.get_owner(i) == owner
assert multisig_agent.is_owner(owner)
assert multisig_agent.owners == tuple(owners)

View File

@ -124,4 +124,3 @@ def test_individual_allocation_registry(get_random_checksum_address,
allocation_registry = IndividualAllocationRegistry.from_allocation_file(filepath=tempfile_path,
network=TEMPORARY_DOMAIN)
assert registry_data == allocation_registry.read()

View File

@ -75,4 +75,3 @@ def test_bob_rpc_character_control_retrieve(bob_rpc_controller, retrieve_control
request_data = {'method': method_name, 'params': params}
response = bob_rpc_controller.send(request_data)
assert 'jsonrpc' in response.data

View File

@ -296,4 +296,3 @@ def test_manual_deployment_of_idle_network(click_runner):
result = click_runner.invoke(deploy, command, input=user_input, catch_exceptions=False)
assert result.exit_code == 0
assert list(new_registry.enrolled_names) == deployed_contracts

View File

@ -65,6 +65,3 @@ def test_deploy_multisig_contract(click_runner,
assert agent.owners == multisig_owners
assert agent.threshold == MULTISIG_THRESHOLD
assert agent.nonce == 0

View File

@ -207,4 +207,3 @@ def test_ursula_destroy_configuration(custom_filepath, click_runner):
if preexisting_live_configuration_file:
file_still_exists = os.path.isfile(os.path.join(DEFAULT_CONFIG_ROOT, UrsulaConfiguration.generate_filename()))
assert file_still_exists, 'WARNING: Test command deleted live non-test files'

View File

@ -187,4 +187,3 @@ def test_configuration_preservation():
finally:
shutil.rmtree(restorable_item.filepath, ignore_errors=True)

View File

@ -126,4 +126,4 @@ NO = 'N\n'
CLI_TEST_ENV = {NUCYPHER_ENVVAR_KEYRING_PASSWORD: INSECURE_DEVELOPMENT_PASSWORD}
FEE_RATE_RANGE = (5, 10, 15)
FEE_RATE_RANGE = (5, 10, 15)

View File

@ -75,4 +75,3 @@ def test_message_kit_serialization_via_enrico(enacted_federated_policy, federate
# Confirm
assert message_kit_bytes == the_same_message_kit.to_bytes()

View File

@ -995,4 +995,4 @@ def highperf_mocked_bob(fleet_of_highperf_mocked_ursulas):
with mock_cert_storage, mock_verify_node, mock_record_fleet_state:
bob = config.produce(known_nodes=list(fleet_of_highperf_mocked_ursulas)[:1])
return bob
return bob

View File

@ -52,4 +52,4 @@ class MockBlockchain(TesterBlockchain):
_compiler = None
def __init__(self):
super().__init__(mock_backend=True)
super().__init__(mock_backend=True)