Skip to content

Commit

Permalink
Merge pull request #1086 from stevenhua0320/lint-check-8
Browse files Browse the repository at this point in the history
Fix import not used and E501 issues.
  • Loading branch information
sbillinge authored Jul 5, 2024
2 parents 883b977 + c97dec0 commit d366186
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
19 changes: 8 additions & 11 deletions regolith/builders/grantreportbuilder.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
"""Builder for Grant Reports"""

from datetime import date
import time

# from habanero import Crossref
from nameparser import HumanName
import dateutil.parser as date_parser

from regolith.builders.basebuilder import LatexBuilderBase
from regolith.dates import month_to_int, get_dates, get_due_date, is_current, is_after, is_before
from regolith.dates import get_dates, is_current
from regolith.fsclient import _id_key
from regolith.sorters import position_key
from regolith.tools import (
all_docs_from_collection,
filter_grants,
filter_presentations,
fuzzy_retrieval,
filter_publications,
get_formatted_crossref_reference,
)


Expand Down Expand Up @@ -105,7 +100,8 @@ def latex(self):
# # if projectum was finished during reporting period or is still current
# # some projectum don't have an "end date", but all projecta have a deliverable
# # due_date
# if (rp_start_date <= due_date <= rp_end_date and prum['status'] is "finished") or is_current(prum):
# if (rp_start_date <= due_date <= rp_end_date and \
# prum['status'] is "finished") or is_current(prum):
# grant_prums.append(prum)
# Get people associated with grant

Expand All @@ -116,7 +112,7 @@ def latex(self):
grant_prum_collaborators = list(
set([collab for prum in grant_prums for collab in prum.get("collaborators", [])])
)
grant_prum_group_members = list(
list(
set([grp_mbr for prum in grant_prums for grp_mbr in prum.get("group_members", [])])
)
grant_people = grant_prum_leads
Expand Down Expand Up @@ -158,14 +154,15 @@ def latex(self):
# person = prsn
# for education in person['education']:
# edu_dates = get_dates(education)
# if 'phd' in education['degree'].lower() and 'columbia' in education['institution'].lower() and \
# rp_start_date.year <= edu_dates.get('end_date', edu_dates['date']).year <= rp_end_date.year:
# if 'phd' in education['degree'].lower() and 'columbia' in \
# education['institution'].lower() and rp_start_date.year <= edu_dates.get(\
# 'end_date', edu_dates['date']).year <= rp_end_date.year:
# defended_theses.append(id)

# Products
# need rg-db-public's citation.yml
# publications = filter_publications(self.gtx["citations"],
## set(grant_people),
# set(grant_people),
# since=rp_start_date,
# before=rp_end_date)
publications = [publ for publ in self.gtx["citations"] if grant_id in publ.get("grant", "")]
Expand Down
6 changes: 0 additions & 6 deletions regolith/builders/preslistbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,16 @@
absent both database files, it will still build but using the string name given
in the presentations.yml. The presentations are output in a ./_build directory."""

from copy import deepcopy

from regolith.builders.basebuilder import LatexBuilderBase
from regolith.fsclient import _id_key
from regolith.sorters import position_key
from regolith.tools import (
all_docs_from_collection,
fuzzy_retrieval,
get_person_contact,
number_suffix,
group_member_ids,
latex_safe,
filter_presentations,
)
from regolith.stylers import sentencecase, month_fullnames
from regolith.dates import get_dates


class PresListBuilder(LatexBuilderBase):
Expand Down
2 changes: 0 additions & 2 deletions regolith/builders/proposalreviewbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from regolith.fsclient import _id_key
from regolith.tools import (
all_docs_from_collection,
filter_grants,
fuzzy_retrieval,
dereference_institution,
)

Expand Down
2 changes: 0 additions & 2 deletions regolith/builders/readinglistsbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def construct_global_ctx(self):
gtx = self.gtx
rc = self.rc
self.cr = Crossref()
cr = self.cr
rc.verbose = True
gtx["people"] = sorted(
all_docs_from_collection(rc.client, "people"),
Expand All @@ -38,7 +37,6 @@ def construct_global_ctx(self):

def latex(self):
"""Render latex template"""
rc = self.rc

# build the collection of formatted references so that we only go
# and fetch the formatted references once per doi
Expand Down
6 changes: 4 additions & 2 deletions regolith/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,16 @@ def get_dates(thing, date_field_prefix=None):
if not thing.get(datenames[1]): # prefix_month
if thing.get("begin_year"):
print(
f"WARNING: both year and begin_year specified in {thing.get('_id', '(no id)')}. Year info will be used"
f"WARNING: both year and begin_year specified in {thing.get('_id', '(no id)')}. "
"Year info will be used"
)
begin_date = datetime.date(thing[datenames[2]], 1, 1)
end_date = datetime.date(thing[datenames[2]], 12, 31)
elif not thing.get(datenames[0]): # prfix_day
if thing.get("begin_year"):
print(
f"WARNING: both year and begin_year specified in {thing.get('_id', '(no id)')}. Year info will be used"
f"WARNING: both year and begin_year specified in {thing.get('_id', '(no id)')}. "
"Year info will be used"
)
begin_date = datetime.date(thing[datenames[2]], month_to_int(thing[datenames[1]]), 1)
end_date = datetime.date(
Expand Down

0 comments on commit d366186

Please sign in to comment.