Skip to content

Commit

Permalink
version
Browse files Browse the repository at this point in the history
  • Loading branch information
dmichaels-harvard committed Apr 25, 2024
1 parent 556f60b commit 0f05f12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions dcicutils/file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def are_files_equal(filea: str, fileb: str) -> bool:

def create_random_file(file: Optional[str] = None,
prefix: Optional[str] = None, suffix: Optional[str] = None,
nbytes: int = 1024, binary: bool = False) -> str:
nbytes: int = 1024, binary: bool = False, line_length: Optional[int] = None) -> str:
if not isinstance(nbytes, int) or nbytes < 0:
nbytes = 0
if not isinstance(file, str) or not file:
Expand All @@ -116,11 +116,13 @@ def create_random_file(file: Optional[str] = None,
if binary is True:
f.write(os.urandom(nbytes))
else:
nchars = 81
nlines = nbytes // nchars
nremainder = nbytes % nchars
if (not isinstance(line_length, int)) or (line_length < 1):
line_length = 80
line_length += 1
nlines = nbytes // line_length
nremainder = nbytes % line_length
for n in range(nlines):
f.write("".join(random.choices(string.ascii_letters + string.digits, k=nchars - 1)))
f.write("".join(random.choices(string.ascii_letters + string.digits, k=line_length - 1)))
f.write("\n")
if nremainder > 1:
f.write("".join(random.choices(string.ascii_letters + string.digits, k=nremainder - 1)))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicutils"
version = "8.8.4.1b10" # TODO: To become 8.8.5
version = "8.8.4.1b11" # TODO: To become 8.8.5
description = "Utility package for interacting with the 4DN Data Portal and other 4DN resources"
authors = ["4DN-DCIC Team <support@4dnucleome.org>"]
license = "MIT"
Expand Down

0 comments on commit 0f05f12

Please sign in to comment.