Skip to content

Commit

Permalink
syntax cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard C. Burhans committed Apr 16, 2024
1 parent d93b09d commit 30e8593
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
12 changes: 6 additions & 6 deletions tools/segalign/diagonal_partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def chunks(lst, n):
"""Yield successive n-sized chunks from list."""
for i in range(0, len(lst), n):
yield lst[i : i + n]
yield lst[i: i + n]


if __name__ == "__main__":
Expand All @@ -34,9 +34,9 @@ def chunks(lst, n):
for index, value in enumerate(params):
if value[: len(segment_key)] == segment_key:
segment_index = index
input_file = value[len(segment_key) :]
input_file = value[len(segment_key):]
break
if segment_index == None:
if segment_index is None:
print(f"Error: could not segment key {segment_key} in parameters {params}")
exit(0)

Expand All @@ -62,16 +62,16 @@ def chunks(lst, n):
for index, value in enumerate(params):
if value[: len(output_key)] == output_key:
output_index = index
output_alignment_file = value[len(output_key) :]
output_alignment_file = value[len(output_key):]
output_alignment_file_base, output_format = output_alignment_file.rsplit(
".", 1
)
if value[: len(strand_key)] == strand_key:
strand_index = index
if segment_index == None:
if segment_index is None:
print(f"Error: could not output key {output_key} in parameters {params}")
exit(0)
if strand_index == None:
if strand_index is None:
print(f"Error: could not output key {strand_key} in parameters {params}")
exit(0)

Expand Down
12 changes: 5 additions & 7 deletions tools/segalign/package_output.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/env python

import typing

import argparse
import bashlex
import configparser
import json
import os
import re
import sys
import tarfile
import typing

import bashlex


class PackageFile:
Expand Down Expand Up @@ -152,7 +151,7 @@ def _parse_lines(self) -> None:
self.package_file.add_config("commands.json")

def _parse_line(self, line: str) -> typing.Dict[str, typing.Any]:
## resolve shell redirects
# resolve shell redirects
trees: typing.List[typing.Any] = bashlex.parse(line, strictmode=False) # type: ignore[attr-defined]
positions: typing.List[typing.Tuple[int, int]] = []

Expand All @@ -178,7 +177,6 @@ def _parse_line(self, line: str) -> typing.Dict[str, typing.Any]:

def _parse_processed_line(self, line: str) -> typing.Dict[str, typing.Any]:
argv: typing.List[str] = list(bashlex.split(line)) # type: ignore[attr-defined]
options: typing.Dict[str, typing.Any] = {}
self.executable = argv.pop(0)

parser: argparse.ArgumentParser = argparse.ArgumentParser(add_help=False)
Expand Down Expand Up @@ -280,7 +278,7 @@ def main() -> None:

package_file = PackageFile()
lastz_command_file = "lastz_commands.txt"
foo = bashCommandLineFile(lastz_command_file, config, package_file)
bashCommandLineFile(lastz_command_file, config, package_file)
package_file.close()


Expand Down

0 comments on commit 30e8593

Please sign in to comment.