Skip to content

Commit

Permalink
chore(internal): replace string concatenation with f-strings (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Nov 30, 2023
1 parent 663a8f6 commit caab767
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/openai/lib/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def common_completion_prefix_validator(df: pd.DataFrame) -> Remediation:
return Remediation(name="common_prefix")

def remove_common_prefix(x: Any, prefix: Any, ws_prefix: Any) -> Any:
x["completion"] = x["completion"].str[len(prefix):]
x["completion"] = x["completion"].str[len(prefix) :]
if ws_prefix:
# keep the single whitespace as prefix
x["completion"] = f" {x['completion']}"
Expand Down Expand Up @@ -623,9 +623,7 @@ def get_outfnames(fname: str, split: bool) -> list[str]:
i = 0
while True:
index_suffix = f" ({i})" if i > 0 else ""
candidate_fnames = [
f"{os.path.splitext(fname)[0]}_prepared{suffix}{index_suffix}.jsonl" for suffix in suffixes
]
candidate_fnames = [f"{os.path.splitext(fname)[0]}_prepared{suffix}{index_suffix}.jsonl" for suffix in suffixes]
if not any(os.path.isfile(f) for f in candidate_fnames):
return candidate_fnames
i += 1
Expand Down

0 comments on commit caab767

Please sign in to comment.