Skip to content

Commit

Permalink
linting feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nealerickson-qtm committed Oct 4, 2023
1 parent 4cfd423 commit 0b7a5dd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pytket/phir/sharding/sharder.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ def _process_command(self, command: Command) -> None:

if self.should_op_create_shard(command.op):
print(
f"Building shard for command: {command} args:{command.args} bits:{command.bits}",
f"Building shard for command: {command}",
)
self._build_shard(command)
else:
self._add_pending_sub_command(command)

def _build_shard(self, command: Command) -> None:
"""
Creates a Shard object given the extant sharding context and the schedulable
Creates a Shard object given the extant sharding context and the primary
Command object passed in, and appends it to the Shard list
"""
# Rollup any sub commands (SQ gates) that interact with the same qubits
Expand All @@ -85,10 +85,11 @@ def _build_shard(self, command: Command) -> None:
bits_written = set(command.bits)
bits_read: set[Bit] = set()

# def filter_to_bits: Callable[[UnitId], bool] = lambda x: isinstance(x, Bit)
for sub_command in all_commands:
bits_written.update(sub_command.bits)
bits_read.update(
set(filter(lambda x: isinstance(x, Bit), sub_command.args)), # type: ignore [misc, arg-type]
set(filter(lambda x: isinstance(x, Bit), sub_command.args)), # type: ignore [misc, arg-type] # noqa: E501
)

# Handle dependency calculations
Expand Down Expand Up @@ -157,7 +158,7 @@ def _add_pending_sub_command(self, command: Command) -> None:
self._pending_commands[key] = []
self._pending_commands[key].append(command)
print(
f"Adding pending command {command} args: {command.args} bits: {command.bits}",
f"Adding pending command {command}",
)

@staticmethod
Expand Down

0 comments on commit 0b7a5dd

Please sign in to comment.