Skip to content

Commit

Permalink
Merge 88f5e0d into 1bba643
Browse files Browse the repository at this point in the history
  • Loading branch information
Wooble committed Sep 13, 2019
2 parents 1bba643 + 88f5e0d commit d72fe25
Show file tree
Hide file tree
Showing 22 changed files with 242 additions and 255 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
@@ -1,4 +1,8 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v1.23.0
hooks:
- id: pyupgrade
- repo: https://github.com/ambv/black
rev: stable
hooks:
Expand Down
13 changes: 6 additions & 7 deletions docs/source/conf.py
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# pycounter documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 13 08:44:21 2014.
Expand Down Expand Up @@ -56,8 +55,8 @@
master_doc = "index"

# General information about the project.
project = u"pycounter"
copyright = u"2014-2019, University of Pittsburgh"
project = "pycounter"
copyright = "2014-2019, University of Pittsburgh"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -98,15 +97,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
("index", "pycounter.tex", u"pycounter Documentation", u"Geoffrey Spear", "manual")
("index", "pycounter.tex", "pycounter Documentation", "Geoffrey Spear", "manual")
]


# -- Options for manual page output ---------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [("index", "pycounter", u"pycounter Documentation", [u"Geoffrey Spear"], 1)]
man_pages = [("index", "pycounter", "pycounter Documentation", ["Geoffrey Spear"], 1)]

# -- Options for Texinfo output -------------------------------------------

Expand All @@ -117,8 +116,8 @@
(
"index",
"pycounter",
u"pycounter Documentation",
u"Geoffrey Spear",
"pycounter Documentation",
"Geoffrey Spear",
"pycounter",
"One line description of project.",
"Miscellaneous",
Expand Down
285 changes: 142 additions & 143 deletions pycounter/constants.py
Expand Up @@ -8,19 +8,19 @@
}

METRICS = {
u"JR1": u"FT Article Requests",
u"JR1 GOA": u"Gold Open Access Article Requests",
u"BR1": u"Book Title Requests",
u"BR2": u"Book Section Requests",
u"DB1": [
u"Regular Searches",
u"Searches-federated and automated",
u"Result Clicks",
u"Record Views",
"JR1": "FT Article Requests",
"JR1 GOA": "Gold Open Access Article Requests",
"BR1": "Book Title Requests",
"BR2": "Book Section Requests",
"DB1": [
"Regular Searches",
"Searches-federated and automated",
"Result Clicks",
"Record Views",
],
u"DB2": [
u"Access denied: concurrent/simultaneous user license exceeded",
u"Access denied: content item not licensed",
"DB2": [
"Access denied: concurrent/simultaneous user license exceeded",
"Access denied: content item not licensed",
],
}

Expand All @@ -34,165 +34,164 @@
}

CODES = {
u"Database": u"DB",
u"Journal": u"JR",
u"Book": u"BR",
u"Title": u"TR",
u"Platform": u"PR",
u"Multimedia": u"MR",
u"Consortium": u"CR",
"Database": "DB",
"Journal": "JR",
"Book": "BR",
"Title": "TR",
"Platform": "PR",
"Multimedia": "MR",
"Consortium": "CR",
}

# from http://www.niso.org/workrooms/sushi/registry/
# Not all of these are actually supported by pycounter
REPORT_DESCRIPTIONS = {
u"BR1": u"Number of Successful Title Requests by Month and Title",
u"BR2": u"Number of Successful Section Requests by Month and Title",
u"BR3": u"Access Denied to Content Items by Month, Title, and Category",
u"BR4": u"Access Denied to Content Items by Month, Platform, and Category",
u"BR5": u"Total Searches by Month and Title",
u"CR1": u"Number of Successful Full-text Journal Article or Book Chapter "
u"Requests by Month",
u"CR2": u"Total Searches by Month and Database",
u"CR3": u"Number of Successful Multimedia Full Content Unit Requests "
u"by Month and Collection",
u"DB1": u"Total Searches, Result Clicks and Record Views by Month and " u"Database",
u"DB2": u"Access Denied by Month, Database and Category",
u"JR1": u"Number of Successful Full-Text Article Requests by Month and " u"Journal",
u"JR1GOA": u"Number of Successful Gold Open Access Full-Text Article "
u"Requests by Month and Journal",
u"JR1a": u"Number of Successful Full-Text Article Requests from an "
u"Archive by Month and Journal",
u"JR2": u"Access Denied to Full Text Articles by Month, Journal, and " u"Category",
u"JR3": u"Number of Successful Item Requests and Turnaways by Month, "
u"Journal, and Page-Type",
u"JR3mobile": u"Number of Successful Item Requests by Month, Journal, "
u"and Page-Type for usage on a mobile device",
u"JR4": u"Total Searches Run by Month and Collection",
u"JR5": u"Number of Successful Full-Text Article Requests by "
u"Year-of-Publication (YOP) and Journal",
u"MR1": u"Number of Successful Multimedia Full Content Unit Requests "
u"by Month and Collection",
u"MR2": u"Number of Successful Multimedia Full Content Unit Requests by "
u"Month, Collection, and Item Type",
u"PR1": u"Total Searches, Result Clicks, and Record Views by Month and "
u"Platform",
u"TR1": u"Number of Successful Requests for Journal Full-Text Articles "
u"and Book Sections by Month and Title",
u"TR1mobile": u"Number of Successful Requests for Journal Full-Text "
u"Articles and Book Sections by Month and Title "
u"(formatted for normal browsers/delivered to mobile "
u"devices AND formatted for mobile devices/delivered "
u"to mobile devices)",
u"TR2": u"Access Denied to Full-Text Items by Month, Title, and Category",
u"TR3": u"Number of Successful Item Requests by Month, Title, and " u"Page-Type",
u"TR3mobile": u"Number of Successful Item Requests by Month, Title, "
u"and Page-Type (formatted for normal browsers/delivered "
u"to mobile devices and for mobile devices/delivered to "
u"mobile devices)",
u"TR_J1": u'Journal Requests (Excluding "OA_Gold")',
"BR1": "Number of Successful Title Requests by Month and Title",
"BR2": "Number of Successful Section Requests by Month and Title",
"BR3": "Access Denied to Content Items by Month, Title, and Category",
"BR4": "Access Denied to Content Items by Month, Platform, and Category",
"BR5": "Total Searches by Month and Title",
"CR1": "Number of Successful Full-text Journal Article or Book Chapter "
"Requests by Month",
"CR2": "Total Searches by Month and Database",
"CR3": "Number of Successful Multimedia Full Content Unit Requests "
"by Month and Collection",
"DB1": "Total Searches, Result Clicks and Record Views by Month and " "Database",
"DB2": "Access Denied by Month, Database and Category",
"JR1": "Number of Successful Full-Text Article Requests by Month and " "Journal",
"JR1GOA": "Number of Successful Gold Open Access Full-Text Article "
"Requests by Month and Journal",
"JR1a": "Number of Successful Full-Text Article Requests from an "
"Archive by Month and Journal",
"JR2": "Access Denied to Full Text Articles by Month, Journal, and " "Category",
"JR3": "Number of Successful Item Requests and Turnaways by Month, "
"Journal, and Page-Type",
"JR3mobile": "Number of Successful Item Requests by Month, Journal, "
"and Page-Type for usage on a mobile device",
"JR4": "Total Searches Run by Month and Collection",
"JR5": "Number of Successful Full-Text Article Requests by "
"Year-of-Publication (YOP) and Journal",
"MR1": "Number of Successful Multimedia Full Content Unit Requests "
"by Month and Collection",
"MR2": "Number of Successful Multimedia Full Content Unit Requests by "
"Month, Collection, and Item Type",
"PR1": "Total Searches, Result Clicks, and Record Views by Month and " "Platform",
"TR1": "Number of Successful Requests for Journal Full-Text Articles "
"and Book Sections by Month and Title",
"TR1mobile": "Number of Successful Requests for Journal Full-Text "
"Articles and Book Sections by Month and Title "
"(formatted for normal browsers/delivered to mobile "
"devices AND formatted for mobile devices/delivered "
"to mobile devices)",
"TR2": "Access Denied to Full-Text Items by Month, Title, and Category",
"TR3": "Number of Successful Item Requests by Month, Title, and " "Page-Type",
"TR3mobile": "Number of Successful Item Requests by Month, Title, "
"and Page-Type (formatted for normal browsers/delivered "
"to mobile devices and for mobile devices/delivered to "
"mobile devices)",
"TR_J1": 'Journal Requests (Excluding "OA_Gold")',
}

HEADER_FIELDS = {
"JR1": (
u"Journal",
u"Publisher",
u"Platform",
u"Journal DOI",
u"Proprietary Identifier",
u"Print ISSN",
u"Online ISSN",
u"Reporting Period Total",
u"Reporting Period HTML",
u"Reporting Period PDF",
"Journal",
"Publisher",
"Platform",
"Journal DOI",
"Proprietary Identifier",
"Print ISSN",
"Online ISSN",
"Reporting Period Total",
"Reporting Period HTML",
"Reporting Period PDF",
),
"JR2": (
u"Journal",
u"Publisher",
u"Platform",
u"Journal DOI",
u"Proprietary Identifier",
u"Print ISSN",
u"Online ISSN",
u"Reporting Period Total",
u"Reporting Period HTML",
u"Reporting Period PDF",
"Journal",
"Publisher",
"Platform",
"Journal DOI",
"Proprietary Identifier",
"Print ISSN",
"Online ISSN",
"Reporting Period Total",
"Reporting Period HTML",
"Reporting Period PDF",
),
"JR3": (
u"Journal",
u"Publisher",
u"Platform",
u"Journal DOI",
u"Proprietary Identifier",
u"Print ISSN",
u"Online ISSN",
u"Reporting Period Total",
u"Reporting Period HTML",
u"Reporting Period PDF",
"Journal",
"Publisher",
"Platform",
"Journal DOI",
"Proprietary Identifier",
"Print ISSN",
"Online ISSN",
"Reporting Period Total",
"Reporting Period HTML",
"Reporting Period PDF",
),
"BR1": (
u"",
u"Publisher",
u"Platform",
u"Book DOI",
u"Proprietary Identifier",
u"ISBN",
u"ISSN",
u"Reporting Period Total",
"",
"Publisher",
"Platform",
"Book DOI",
"Proprietary Identifier",
"ISBN",
"ISSN",
"Reporting Period Total",
),
"BR2": (
u"",
u"Publisher",
u"Platform",
u"Book DOI",
u"Proprietary Identifier",
u"ISBN",
u"ISSN",
u"Reporting Period Total",
"",
"Publisher",
"Platform",
"Book DOI",
"Proprietary Identifier",
"ISBN",
"ISSN",
"Reporting Period Total",
),
"BR3": (
u"",
u"Publisher",
u"Platform",
u"Book DOI",
u"Proprietary Identifier",
u"ISBN",
u"ISSN",
u"Reporting Period Total",
"",
"Publisher",
"Platform",
"Book DOI",
"Proprietary Identifier",
"ISBN",
"ISSN",
"Reporting Period Total",
),
"DB1": (
u"Database",
u"Publisher",
u"Platform",
u"User Activity",
u"Reporting Period Total",
"Database",
"Publisher",
"Platform",
"User Activity",
"Reporting Period Total",
),
"DB2": (
u"Database",
u"Publisher",
u"Platform",
u"Access denied category",
u"Reporting Period Total",
"Database",
"Publisher",
"Platform",
"Access denied category",
"Reporting Period Total",
),
"PR1": (u"Platform", u"Publisher", u"User Activity", u"Reporting Period Total"),
"PR1": ("Platform", "Publisher", "User Activity", "Reporting Period Total"),
# FIXME: this is outputting counter 5 reports in 4 format for... reasons.
"TR_J1": (
u"Journal",
u"Publisher",
u"Platform",
u"Journal DOI",
u"Proprietary Identifier",
u"Print ISSN",
u"Online ISSN",
u"Reporting Period Total",
u"Reporting Period HTML",
u"Reporting Period PDF",
"Journal",
"Publisher",
"Platform",
"Journal DOI",
"Proprietary Identifier",
"Print ISSN",
"Online ISSN",
"Reporting Period Total",
"Reporting Period HTML",
"Reporting Period PDF",
),
}

TOTAL_TEXT = {
"JR1": u"Total for all journals",
"BR1": u"Total for all titles",
"BR2": u"Total for all titles",
"DB2": u"Total for all databases",
"JR1": "Total for all journals",
"BR1": "Total for all titles",
"BR2": "Total for all titles",
"DB2": "Total for all databases",
}
4 changes: 2 additions & 2 deletions pycounter/exceptions.py
Expand Up @@ -17,7 +17,7 @@ class SushiException(PycounterException):
"""Base class for SUSHI-related exceptions."""

def __init__(self, message, raw=None, xml=None):
super(SushiException, self).__init__(message)
super().__init__(message)
self.raw = raw
self.xml = xml

Expand Down Expand Up @@ -59,7 +59,7 @@ class Sushi5Error(SushiException):
"""

def __init__(self, message, severity, code):
super(Sushi5Error, self).__init__(message)
super().__init__(message)
self.message = message
self.severity = severity
self.code = code
Expand Down

0 comments on commit d72fe25

Please sign in to comment.