Skip to content

Commit

Permalink
typo fixes in comments & docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
klinga committed Apr 1, 2024
1 parent ec5077b commit cf1d29f
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion nightshift/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def config_local_env_variables(
) -> None:
"""
Sets up environment variables to run NighShift locally.
Requires a valid config.yaml file in the nighshift/config directory
Requires a valid config.yaml file in the nightshift/config directory
Args:
config_file: path to config file that includes environmental
Expand Down
6 changes: 3 additions & 3 deletions nightshift/comms/sierra_search_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def _determine_bpl_bib_status(self) -> str:
return "staff_deleted"
except KeyError:
pass
# if bib orignated from Worldcat asssume full bib
# if bib originated from Worldcat assume full bib
if "ss_marc_tag_003" in data and data["ss_marc_tag_003"] == "OCoLC":
return "staff_enhanced"

Expand Down Expand Up @@ -201,7 +201,7 @@ class NypPlatform(PlatformSession):
def __init__(self) -> None:
"""
Authenticates and opens a session with NYPL Platform.
Relies on credentials stored in evironmental variables.
Relies on credentials stored in environment variables.
"""
client_id, client_secret, oauth_server, target = self._get_credentials()
token = self._get_token(client_id, client_secret, oauth_server)
Expand Down Expand Up @@ -236,7 +236,7 @@ def _get_token(
Obtains an access token for NYPL Platform
Args:
client_id: NYPL Platfrom client id
client_id: NYPL Platform client id
client_secret: NYPL Platform client secret
oauth_server: NYPL Platform authorization server
Expand Down
2 changes: 1 addition & 1 deletion nightshift/comms/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def output_file(self, local_file_path: str, remote_file_name_base: str) -> str:
Appends stream to a file in SFTP/Drive load directory
Args:
local_file_path: path to a local file to be transfered to SFTP
local_file_path: path to a local file to be transferred to SFTP
remote_file_name_base: file name base for the file on SFTP
Returns:
Expand Down
4 changes: 2 additions & 2 deletions nightshift/comms/worldcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _create_worldcat_session(
self, access_token: WorldcatAccessToken
) -> MetadataSession:
"""
Opens a session with MetatadaAPI service
Opens a session with MetadataAPI service
Args:
access_token: `WorldcatAccessToken` instance
Expand Down Expand Up @@ -234,7 +234,7 @@ def get_brief_bibs(
self, resources: list[Resource], rotten_apples: dict[int, list[str]] = {}
) -> Iterator[tuple[Resource, BriefBibResponse]]:
"""
Performes WorldCat queries for each resource in the passed library batch.
Performs WorldCat queries for each resource in the passed library batch.
Resources must belong to the same library.
Args:
Expand Down
6 changes: 3 additions & 3 deletions nightshift/config/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ POSTGRES_HOST: postgres_host
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres_password
POSTGRES_PORT: postgres_port
POSTGRES_DB: postgred_db_name
POSTGRES_DB: postgres_db_name
WCNYP_KEY: nypl_worldcat_key
WCNYP_SECRET: nypl_worldcat_secret
WCBPL_KEY: bpl_worldcat_key
WCBPL_SECRET: bpl_worlcat_secret
WCBPL_SECRET: bpl_worldcat_secret
LOGGLY_TOKEN: loggly_token
LOG_HANDLERS: "loggly,file,console"
SFTP_HOST: sftp_host
SFTP_USER: sftp_user
SFTP_PASSW: sfpt_password
SFTP_PASSW: sftp_password
SFTP_NS_SRC: "/NSDROP/sierra_dumps/nightshift"
SFTP_NS_DST: "/NSDROP/load"
NYPL_PLATFORM_CLIENT: nypl_platform_client
Expand Down
12 changes: 6 additions & 6 deletions nightshift/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
queryDays:
record as string;
all numbers indicate days since bib was created, example: '15' means 15 days after
bib created date
all numbers indicate days since bib was created, example: '15' means 15 days
after bib created date
to indicate an individual period record the starting and ending age in days separated
by hyphen, example: '15-30' which means query should happen between 15th and 30th day
since bib was created
to indicate an individual period record the starting and ending age in days
separated by hyphen, example: '15-30' which means query should happen between
15th and 30th day since bib was created
separate individual periods with a comma, example: '15-30,30-60'
multiple time periods will trigger as many query attemps, one in each period
multiple time periods will trigger as many query attempts, one in each period
"""

Expand Down
2 changes: 1 addition & 1 deletion nightshift/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

def conf_db():
"""
Retrieves db configuation from env variables
Retrieves db configuration from env variables
Returns:
db settings as dictionary
Expand Down
8 changes: 4 additions & 4 deletions nightshift/datastore_transactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def init_db() -> None:
"source_file",
"worldcat_query",
]
), "Database is missing requried tables."
), "Database is missing required tables."

# check both libraries were added
libraries = session.query(Library).all()
Expand Down Expand Up @@ -170,7 +170,7 @@ def add_output_file(session: Session, libraryId: int, file_handle: str) -> Outpu
Args:
session: `sqlalchemy.Session` instance
libaryId: datastore Library record nid
libraryId: datastore Library record nid
file_handle: handle of the out file
Returns:
Expand Down Expand Up @@ -337,7 +337,7 @@ def retrieve_expired_resources(
) -> list[Resource]:
"""
Retrieves resources for a particular category specified by resourceCategoryId that
expired accoring to the schedule from the `constants.RESOURCE_CATEGORIES`
expired according to the schedule from the `constants.RESOURCE_CATEGORIES`
query_days.
Args:
Expand Down Expand Up @@ -389,7 +389,7 @@ def retrieve_open_older_resources(
) -> list[Resource]:
"""
Queries resources with open status that has not been queried in WorldCat
betweeen minAge and maxAge.
between minAge and maxAge.
Args:
session: `sqlalchemy.Session` instance
Expand Down
10 changes: 5 additions & 5 deletions nightshift/manager.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
This module incldues top level processes to be performed by the app
This module includes top level processes to be performed by the app
"""

import logging


from nightshift.constants import RESOURCE_CATEGORIES
from nightshift.datastore import session_scope
from nightshift.datastore_transactions import (
add_event,
Expand Down Expand Up @@ -50,7 +50,7 @@ def process_resources() -> None:
5. Downloads full bibliographic records for resources that were successfully matched
6. Manipulates, serializes to MARC21 and outputs to SFTP resources with full bibs
from WorldCat
7. Updates status of resources that were succesfully ouput to SFTP completing the
7. Updates status of resources that were successfully output to SFTP completing the
process.
"""
Expand Down Expand Up @@ -115,7 +115,7 @@ def process_resources() -> None:
if resources:
tasks.get_worldcat_brief_bib_matches(resources)
logger.info(
f"Obtainig WorldCat matches for {len(resources)} "
f"Obtaining WorldCat matches for {len(resources)} "
f"{library} {res_category} older resources completed."
)

Expand All @@ -141,7 +141,7 @@ def process_resources() -> None:
tasks.enhance_and_output_bibs(res_category, resources)

logger.info(
f"Enhancement and serializaiton of {library} {res_category} "
f"Enhancement and serialization of {library} {res_category} "
"complete."
)

Expand Down
8 changes: 4 additions & 4 deletions nightshift/marc/marc_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
This module reads and parses MARC Sierra records (bibliographic and order data)
to be inserted into the DB.
In case of e-resouces only bib informatin is considered.
In case of e-resources only bib information is considered.
Source MARC files for e-resources will have a mix of various formats (ebooks, eaudio,
evideo)
"""
Expand Down Expand Up @@ -69,7 +69,7 @@ def __init__(
marc_target: MARC file or file-like object
library: 'NYP' or 'BPL'
libraryId: `datastore.Library.nid`
resource_categories: a dicitonary of resource categories and
resource_categories: a dictionary of resource categories and
data associated them as namedtuple
hide_utf8_warnings: hides character encoding warnings
Expand Down Expand Up @@ -116,7 +116,7 @@ def __iter__(self) -> Iterator[Resource]:

def _determine_resource_category(self, bib: Bib) -> Optional[str]:
"""
Determies resource category based on bib and order information.
Determines resource category based on bib and order information.
Args:
bib: `bookops_marc.Bib` instance
Expand Down Expand Up @@ -146,7 +146,7 @@ def _determine_resource_category(self, bib: Bib) -> Optional[str]:
# determine particular resource category for print material here
# based it on order information from the 960/961 tags
logger.warning(
f"Unsuppported bib type. Unable to ingest {self.library} bib # "
f"Unsupported bib type. Unable to ingest {self.library} bib # "
f"{bib.sierra_bib_id()}."
)
return None
Expand Down
6 changes: 3 additions & 3 deletions nightshift/marc/marc_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def manipulate(self) -> None:
specs.
Full manipulation happens only if records meets minimum requirements and
a call number can be cosntructed.
a call number can be constructed.
"""

# delete unwanted MARC tags
Expand All @@ -101,7 +101,7 @@ def manipulate(self) -> None:
else:
logger.info(
f"Worldcat record # {self.resource.oclcMatchNumber} is acceptable. "
"Meets minimum requriements."
"Meets minimum requirements."
)

# genre tags
Expand Down Expand Up @@ -382,7 +382,7 @@ def _digits_only_in_tag_001(self) -> None:
def _is_acceptable(self) -> bool:
"""
Checks if full Worldcat record meet minimum criteria and
a valid call number can be construced.
a valid call number can be constructed.
"""
if self._meets_minimum_criteria() and self._add_call_number():
return True
Expand Down
20 changes: 10 additions & 10 deletions nightshift/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

class Tasks:
"""
Handles various operations related to ingetings new files, searching Worldcat,
manipulating results and outputing the results to SFTP.
Handles various operations related to ingesting new files, searching Worldcat,
manipulating results and outputting the results to SFTP.
"""

def __init__(
Expand Down Expand Up @@ -81,7 +81,7 @@ def _create_resource_category_idx(self) -> dict[int, ResCatById]:

def _create_rotten_apples_idx(self) -> dict[int, list[str]]:
"""
Creates a dictionary of forbiddent organization codes which records
Creates a dictionary of forbidden organization codes which records
should be excluded from retrieved from Worldcat results
"""
rotten_apples = retrieve_rotten_apples(self.db_session)
Expand All @@ -91,7 +91,7 @@ def check_resources_sierra_state(self, resources: list[Resource]) -> None:
"""
Checks and updates status & suppression of records using
NYPL Platform & BPL Solr.
This method updates resources in the databse.
This method updates resources in the database.
Args:
resources: list of `nightshift.datastore.Resource`
Expand Down Expand Up @@ -155,7 +155,7 @@ def get_worldcat_brief_bib_matches(self, resources: list[Resource]) -> None:
in the database.
Args:
resources: list of `nigthtshift.datastore.Resource`
resources: list of `nightshift.datastore.Resource`
instances
"""
logger.info(
Expand Down Expand Up @@ -217,7 +217,7 @@ def get_worldcat_full_bibs(self, resources: list[Resource]) -> None:
)

# commit each full bib response in case something
# breaks during this lenthy process;
# breaks during this lengthy process;
# this should save time if process need to be restarted
self.db_session.commit()

Expand Down Expand Up @@ -263,7 +263,7 @@ def isolate_unprocessed_files(self, drive: Drive) -> list[str]:
record handles with handles retrieved from the drive.
Args:
drive: `nightshfit.comms.storage.Drive` client instance
drive: `nightshift.comms.storage.Drive` client instance
Returns:
list of remote unprocessed file handles
Expand All @@ -289,11 +289,11 @@ def manipulate_and_serialize_bibs(
out_fh: str = "temp.mrc",
) -> tuple[Optional[str], list[Resource]]:
"""
Merges Sierra brief bibs data with WroldCat full bib,
Merges Sierra brief bibs data with WorldCat full bib,
and serializes them into MARC21 format
Args:
resource_category: name of resource cateogry ('ebook', etc.)
resource_category: name of resource category ('ebook', etc.)
resources: list of `nightshift.datastore.Resource`
instances
out_fh: path of the file where records are saved
Expand Down Expand Up @@ -363,7 +363,7 @@ def transfer_to_drive(
Args:
resource_category: name of resource category being processed
src_file: temporary local file to be transfered
src_file: temporary local file to be transferred
Returns:
SFTP file handle
Expand Down

0 comments on commit cf1d29f

Please sign in to comment.