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

release: v1.5.0 #208

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
requirements-level: [min, pypi]
python-version: [3.8, 3.9]
requirements-level: [pypi]

steps:
- name: Checkout
Expand Down
10 changes: 10 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changes
=======

Version 1.5.0 (released 2023-11-08):
------------------------------------

- migrate CI to gh-actions
- make custom type checks compatible with jsonschema >= 4.0
- fix the use of deleted deprecated function of click >=8.1
- fix python imports of MutableMapping and MutableSequence
- fix tests not able to import MARC21slimUtils.xsl from remote
- move python support to 3.8 and 3.9

Version 1.4.1 (released 2020-05-06):
------------------------------------

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ recursive-include dojson *.py
recursive-include dojson *.json
recursive-include tests *.py
recursive-include tests *.xml
recursive-include tests *.xsl
recursive-include tests *.xslt
recursive-include .github/workflows *.yml
2 changes: 1 addition & 1 deletion dojson/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
# Do not change the format of this next line. Doing so risks breaking
# setup.py and docs/conf.py

__version__ = "1.4.1"
__version__ = "1.5.0"
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: PyPy',
'Development Status :: 4 - Beta',
],
Expand Down
188 changes: 188 additions & 0 deletions tests/MARC21slimUtils.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- 08/08/08: tmee added corrected chopPunctuation templates for 260c -->
<!-- 08/19/04: ntra added "marc:" prefix to datafield element -->
<!-- 12/14/07: ntra added url encoding template -->
<!-- url encoding -->

<xsl:variable name="ascii">
<xsl:text> !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:text>
</xsl:variable>

<xsl:variable name="latin1">
<xsl:text> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:text>
</xsl:variable>
<!-- Characters that usually don't need to be escaped -->
<xsl:variable name="safe">
<xsl:text>!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:text>
</xsl:variable>

<xsl:variable name="hex">0123456789ABCDEF</xsl:variable>


<xsl:template name="datafield">
<xsl:param name="tag"/>
<xsl:param name="ind1">
<xsl:text> </xsl:text>
</xsl:param>
<xsl:param name="ind2">
<xsl:text> </xsl:text>
</xsl:param>
<xsl:param name="subfields"/>
<xsl:element name="marc:datafield">
<xsl:attribute name="tag">
<xsl:value-of select="$tag"/>
</xsl:attribute>
<xsl:attribute name="ind1">
<xsl:value-of select="$ind1"/>
</xsl:attribute>
<xsl:attribute name="ind2">
<xsl:value-of select="$ind2"/>
</xsl:attribute>
<xsl:copy-of select="$subfields"/>
</xsl:element>
</xsl:template>

<xsl:template name="subfieldSelect">
<xsl:param name="codes">abcdefghijklmnopqrstuvwxyz</xsl:param>
<xsl:param name="delimeter">
<xsl:text> </xsl:text>
</xsl:param>
<xsl:variable name="str">
<xsl:for-each select="marc:subfield">
<xsl:if test="contains($codes, @code)">
<xsl:value-of select="text()"/>
<xsl:value-of select="$delimeter"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/>
</xsl:template>

<xsl:template name="buildSpaces">
<xsl:param name="spaces"/>
<xsl:param name="char">
<xsl:text> </xsl:text>
</xsl:param>
<xsl:if test="$spaces>0">
<xsl:value-of select="$char"/>
<xsl:call-template name="buildSpaces">
<xsl:with-param name="spaces" select="$spaces - 1"/>
<xsl:with-param name="char" select="$char"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

<xsl:template name="chopPunctuation">
<xsl:param name="chopString"/>
<xsl:param name="punctuation">
<xsl:text>.:,;/ </xsl:text>
</xsl:param>
<xsl:variable name="length" select="string-length($chopString)"/>
<xsl:choose>
<xsl:when test="$length=0"/>
<xsl:when test="contains($punctuation, substring($chopString,$length,1))">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
<xsl:with-param name="punctuation" select="$punctuation"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="not($chopString)"/>
<xsl:otherwise>
<xsl:value-of select="$chopString"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="chopPunctuationFront">
<xsl:param name="chopString"/>
<xsl:variable name="length" select="string-length($chopString)"/>
<xsl:choose>
<xsl:when test="$length=0"/>
<xsl:when test="contains('.:,;/[ ', substring($chopString,1,1))">
<xsl:call-template name="chopPunctuationFront">
<xsl:with-param name="chopString" select="substring($chopString,2,$length - 1)"
/>
</xsl:call-template>
</xsl:when>
<xsl:when test="not($chopString)"/>
<xsl:otherwise>
<xsl:value-of select="$chopString"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="chopPunctuationBack">
<xsl:param name="chopString"/>
<xsl:param name="punctuation">
<xsl:text>.:,;/] </xsl:text>
</xsl:param>
<xsl:variable name="length" select="string-length($chopString)"/>
<xsl:choose>
<xsl:when test="$length=0"/>
<xsl:when test="contains($punctuation, substring($chopString,$length,1))">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString" select="substring($chopString,1,$length - 1)"/>
<xsl:with-param name="punctuation" select="$punctuation"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="not($chopString)"/>
<xsl:otherwise>
<xsl:value-of select="$chopString"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<!-- nate added 12/14/2007 for lccn.loc.gov: url encode ampersand, etc. -->
<xsl:template name="url-encode">

<xsl:param name="str"/>

<xsl:if test="$str">
<xsl:variable name="first-char" select="substring($str,1,1)"/>
<xsl:choose>
<xsl:when test="contains($safe,$first-char)">
<xsl:value-of select="$first-char"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="codepoint">
<xsl:choose>
<xsl:when test="contains($ascii,$first-char)">
<xsl:value-of
select="string-length(substring-before($ascii,$first-char)) + 32"
/>
</xsl:when>
<xsl:when test="contains($latin1,$first-char)">
<xsl:value-of
select="string-length(substring-before($latin1,$first-char)) + 160"/>
<!-- was 160 -->
</xsl:when>
<xsl:otherwise>
<xsl:message terminate="no">Warning: string contains a character
that is out of range! Substituting "?".</xsl:message>
<xsl:text>63</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="hex-digit1"
select="substring($hex,floor($codepoint div 16) + 1,1)"/>
<xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
<!-- <xsl:value-of select="concat('%',$hex-digit2)"/> -->
<xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="string-length($str) &gt; 1">
<xsl:call-template name="url-encode">
<xsl:with-param name="str" select="substring($str,2)"/>
</xsl:call-template>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp.
<metaInformation>
<scenarios/><MapperInfo srcSchemaPath="" srcSchemaRoot="" srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
</metaInformation>
-->
2 changes: 1 addition & 1 deletion tests/demo_marc21_to_dc.xslt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="marc">
<xsl:import href="http://www.loc.gov/standards/marcxml/xslt/MARC21slimUtils.xsl"/>
<xsl:import href="MARC21slimUtils.xsl"/>
<xsl:output method="xml" indent="yes"/>
<!--
Fixed 530 Removed type="original" from dc:relation 2010-11-19 tmee
Expand Down
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_groupable_ordered_dict_eq(god):

# switching the comparisons to use __eq__.
assert god == expected
assert not(god != expected)
assert not (god != expected)


def test_groupable_ordered_dict_copy(god):
Expand Down