Skip to content
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

Initial refactoring of process_report #54

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

QuanMPhm
Copy link
Contributor

@QuanMPhm QuanMPhm commented May 23, 2024

Closes #63 . This refactor commit is the first of a few, to lay out initial structure

A new submodule, invoices, is added, containing a base class Invoice which is inherited by all other invoices. Currently, only the lenovo and nonbillable invoice has classes which inherits from Invoice Also created and partially populated an util.py file, containing functions placed above main() in process_report.py After the refactoring process is fully complete,
these utility functions will be completely removed from process_report.py

I can already tell I am breaking several Python conventions, so I am ready.

@QuanMPhm QuanMPhm requested review from larsks, knikolla and naved001 May 23, 2024 18:43
process_report/invoices/lenovo_invoice.py Show resolved Hide resolved
institution_name = institute_map.get(institution_key, "")

if institution_name == "":
print(f"Warning: PI name {pi_uname} does not match any institution!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would encourage the use of the logging module for emitting error and warning messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@knikolla Should this become its own PR, or do I make use of logging in this intial refactor PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@QuanMPhm For the specific invoices that you are refactoring in this PR, make use of logging.

process_report/util.py Show resolved Hide resolved
Copy link
Contributor

@knikolla knikolla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good! Don't see any broken conventions, haha.

process_report/process_report.py Show resolved Hide resolved

@dataclass
class NonbillableInvoice(invoice.Invoice):
""""""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either write a docstring for the class or remove the double quotes.

process_report/process_report.py Outdated Show resolved Hide resolved
This refactor commit is the first of a few, to lay out intial structure

A new submodule, `invoices`, is added, containing a base class `Invoice` which is inherited by all other invoices.
Currently, only the lenovo and nonbillable invoice has classes which inherits from `Invoice`
Also created and partially populated an `util.py` file,
containing functions placed above `main()` in `process_report.py`
After the refactoring process is fully complete,
these utility functions will be completely removed from `process_report.py`
@QuanMPhm QuanMPhm force-pushed the 52.1/initial_refactor branch from 3a82feb to 02c84ed Compare May 30, 2024 18:39
@QuanMPhm QuanMPhm requested a review from knikolla May 30, 2024 18:39
@knikolla knikolla merged commit abe2deb into CCI-MOC:main Jul 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor process_csv_report.py by restructuring code, and refactor Lenovo and nonbillable invoices
4 participants