-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCLC Processing of MARC Records #893
Conversation
59d4bc7
to
da47c85
Compare
da47c85
to
2dfde01
Compare
transformer = Transformer() | ||
for marc_file in marc_file_list: | ||
for marc_file in ast.literal_eval(marc_file_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running the DAG on development, the marc_file_list
was coming in as string instead of as a list, this method call converts the string into a list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to see what this looked like and what it did...I assume something like this?
>>> file_list = "['path/to/file/1.txt', 'path/to/file/two.csv', 'path/to/file/3.txt']"
>>> type(file_list)
<class 'str'>
>>> type(ast.literal_eval(file_list))
<class 'list'>
>>> ast.dump(ast.parse(file_list))
"Module(body=[Expr(value=List(elts=[Constant(value='path/to/file/1.txt'), Constant(value='path/to/file/two.csv'), Constant(value='path/to/fil3/3.txt')], ctx=Load()))], type_ignores=[])"
pretty cool!
https://docs.python.org/3/library/ast.html#ast.List
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No blocking changes, just a suggestion for the changing a variable name which wan't obvious to me at first pass.
codes.append(oclc_code) | ||
return codes | ||
|
||
def divide(self, marc_file): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need a None return type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Updating.
transformer = Transformer() | ||
for marc_file in marc_file_list: | ||
for marc_file in ast.literal_eval(marc_file_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wanted to see what this looked like and what it did...I assume something like this?
>>> file_list = "['path/to/file/1.txt', 'path/to/file/two.csv', 'path/to/file/3.txt']"
>>> type(file_list)
<class 'str'>
>>> type(ast.literal_eval(file_list))
<class 'list'>
>>> ast.dump(ast.parse(file_list))
"Module(body=[Expr(value=List(elts=[Constant(value='path/to/file/1.txt'), Constant(value='path/to/file/two.csv'), Constant(value='path/to/fil3/3.txt')], ctx=Load()))], type_ignores=[])"
pretty cool!
https://docs.python.org/3/library/ast.html#ast.List
transformer = OCLCTransformer() | ||
for marc_file in ast.literal_eval(marc_file_list): | ||
transformer.divide(marc_file) | ||
transformer.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name this variable oclc_transformer
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
0a76a85
to
d6b8b3a
Compare
Fixes #871
TODO: