-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #251 from bespokelabsai/ryanm/raise-on-failed-requ…
…ests Option to raise on failed responses
- Loading branch information
Showing
8 changed files
with
218 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# https://stackoverflow.com/questions/845058/how-to-get-the-line-count-of-a-large-file-cheaply-in-python | ||
# https://stackoverflow.com/a/68385697 | ||
def _file_gen(reader): | ||
b = reader(1024 * 1024) | ||
while b: | ||
yield b | ||
b = reader(1024 * 1024) | ||
|
||
|
||
# Instead of requiring counting lines, we can store metadata file that has the number of requests in each file | ||
def count_lines(filename): | ||
f = open(filename, "rb") | ||
f_gen = _file_gen(f.raw.read) | ||
return sum(buf.count(b"\n") for buf in f_gen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.