diff options
author | Christian Clauss <cclauss@me.com> | 2021-02-16 20:32:40 +0100 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2021-02-23 15:19:48 -0800 |
commit | 0d46fb5fac3c7a1268618a3ec0a9956b79fdbeaf (patch) | |
tree | fb3b243dd2b228df37bbe3b94a6c54fcbf21ff12 /fatcat_scholar | |
parent | 537659325664b47b01c24e82cb4a0e850cd129c0 (diff) | |
download | fatcat-scholar-0d46fb5fac3c7a1268618a3ec0a9956b79fdbeaf.tar.gz fatcat-scholar-0d46fb5fac3c7a1268618a3ec0a9956b79fdbeaf.zip |
Revert undesirable changes
Diffstat (limited to 'fatcat_scholar')
-rwxr-xr-x | fatcat_scholar/grobid2json.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/issue_db.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/search.py | 2 | ||||
-rw-r--r-- | fatcat_scholar/web.py | 8 |
4 files changed, 7 insertions, 7 deletions
diff --git a/fatcat_scholar/grobid2json.py b/fatcat_scholar/grobid2json.py index 2c85047..5c44953 100755 --- a/fatcat_scholar/grobid2json.py +++ b/fatcat_scholar/grobid2json.py @@ -223,7 +223,7 @@ def main() -> None: # pragma no cover args = parser.parse_args() for filename in args.teifiles: - content = open(filename).read() + content = open(filename, "r").read() print( json.dumps( teixml2json(content, encumbered=(not args.no_encumbered)), diff --git a/fatcat_scholar/issue_db.py b/fatcat_scholar/issue_db.py index 057869b..3c55b51 100644 --- a/fatcat_scholar/issue_db.py +++ b/fatcat_scholar/issue_db.py @@ -167,7 +167,7 @@ class IssueDB: PRAGMA main.synchronous = OFF; """ ) - with open("schema/issue_db.sql") as fschema: + with open("schema/issue_db.sql", "r") as fschema: self.db.executescript(fschema.read()) def insert_sim_pub(self, pub: SimPubRow, cur: Any = None) -> None: diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index 5b45ba9..be362b7 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -387,7 +387,7 @@ def do_fulltext_search( except elasticsearch.exceptions.TransportError as e: # all other errors logging.warn(f"elasticsearch non-200 status code: {e.info}") - raise OSError(str(e.info)) from e + raise IOError(str(e.info)) from e query_delta = datetime.datetime.now() - query_start # convert from API objects to dicts diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index 43a733a..dce732b 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -106,7 +106,7 @@ async def search(query: FulltextQuery = Depends(FulltextQuery)) -> FulltextHits: sentry_sdk.set_level("warning") sentry_sdk.capture_exception(e) raise HTTPException(status_code=400, detail=f"Query Error: {e}") - except OSError as e: + except IOError as e: sentry_sdk.capture_exception(e) raise HTTPException(status_code=500, detail=f"Backend Error: {e}") @@ -224,7 +224,7 @@ async def web_search( sentry_sdk.capture_exception(e) search_error = dict(type="query", message=str(e)) status_code = 400 - except OSError as e: + except IOError as e: sentry_sdk.capture_exception(e) search_error = dict(type="backend", message=str(e)) status_code = 500 @@ -282,8 +282,8 @@ async def favicon() -> Any: ) -ROBOTS_ALLOW = open("fatcat_scholar/static/robots.allow.txt").read() -ROBOTS_DISALLOW = open("fatcat_scholar/static/robots.disallow.txt").read() +ROBOTS_ALLOW = open("fatcat_scholar/static/robots.allow.txt", "r").read() +ROBOTS_DISALLOW = open("fatcat_scholar/static/robots.disallow.txt", "r").read() @app.get("/robots.txt", include_in_schema=False) |