pep8 work, closes #307
This commit is contained in:
parent
13cc6aa7e5
commit
6f697526f2
30 changed files with 190 additions and 362 deletions
|
|
@ -13,7 +13,6 @@
|
|||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
class Mock(object):
|
||||
|
|
@ -42,12 +41,12 @@ for mod_name in MOCK_MODULES:
|
|||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
|
|
@ -62,7 +61,7 @@ templates_path = ['_templates']
|
|||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
# source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
|
@ -82,13 +81,13 @@ release = '0.7.2'
|
|||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
# language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
# today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
|
|
@ -96,24 +95,24 @@ exclude_patterns = []
|
|||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
# default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
# add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
# add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
# show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
# modindex_common_prefix = []
|
||||
|
||||
|
||||
# -- Options for HTML output --------------------------------------------------
|
||||
|
|
@ -125,26 +124,26 @@ html_theme = 'default'
|
|||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
# html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
# html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
# html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
# html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
# html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
# html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
|
|
@ -153,44 +152,44 @@ html_static_path = ['_static']
|
|||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
# html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
# html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
# html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
# html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
# html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
# html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
# html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
# html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
# html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
# html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
# html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'glymurdoc'
|
||||
|
|
@ -199,13 +198,13 @@ htmlhelp_basename = 'glymurdoc'
|
|||
# -- Options for LaTeX output -------------------------------------------------
|
||||
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
# 'preamble': '',
|
||||
latex_elements = {}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
|
|
@ -216,23 +215,23 @@ latex_documents = [('index', 'glymur.tex', u'glymur Documentation',
|
|||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
# latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
# latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
# latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
# latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
# latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
# latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output -------------------------------------------
|
||||
|
|
@ -245,7 +244,7 @@ man_pages = [
|
|||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
# man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -----------------------------------------------
|
||||
|
|
@ -258,13 +257,13 @@ texinfo_documents = [('index', 'glymur', u'glymur Documentation',
|
|||
'One line description of project.', 'Miscellaneous'), ]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
# texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
# texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
# texinfo_show_urls = 'footnote'
|
||||
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
|
|
|
|||
|
|
@ -1,21 +1,25 @@
|
|||
"""glymur - read, write, and interrogate JPEG 2000 files
|
||||
"""
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from glymur import version
|
||||
__version__ = version.version
|
||||
|
||||
from .jp2k import Jp2k
|
||||
from .jp2box import (
|
||||
get_printoptions, set_printoptions,
|
||||
get_parseoptions, set_parseoptions
|
||||
)
|
||||
from .jp2box import (get_printoptions,
|
||||
set_printoptions,
|
||||
get_parseoptions,
|
||||
set_parseoptions)
|
||||
|
||||
from . import data
|
||||
|
||||
|
||||
def runtests():
|
||||
"""Discover and run all tests for the glymur package.
|
||||
"""
|
||||
suite = unittest.defaultTestLoader.discover(__path__[0])
|
||||
unittest.TextTestRunner(verbosity=2).run(suite)
|
||||
|
||||
|
||||
__all__ = [__version__, Jp2k, get_printoptions, set_printoptions,
|
||||
get_parseoptions, set_parseoptions, data, runtests]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@
|
|||
Part of glymur.
|
||||
"""
|
||||
from collections import OrderedDict
|
||||
import pprint
|
||||
import re
|
||||
import struct
|
||||
import sys
|
||||
import warnings
|
||||
|
|
|
|||
|
|
@ -6,16 +6,13 @@ codestreams.
|
|||
|
||||
# The number of lines in the module is long and that's ok. It would not help
|
||||
# matters to move anything out to another file.
|
||||
# pylint: disable=C0302
|
||||
|
||||
# "Too many instance attributes", "Too many arguments"
|
||||
# Some segments just have a lot of information.
|
||||
# It doesn't make sense to subclass just for that.
|
||||
# pylint: disable=R0902,R0913
|
||||
|
||||
# "Too few public methods" Some segments don't define any new methods from
|
||||
# the base Segment class.
|
||||
# pylint: disable=R0903
|
||||
|
||||
import math
|
||||
import struct
|
||||
|
|
@ -31,16 +28,15 @@ from .core import (LRCP, RLCP, RPCL, PCRL, CPRL,
|
|||
from .lib import openjp2 as opj2
|
||||
|
||||
_factory = lambda x: '{0} (invalid)'.format(x)
|
||||
_PROGRESSION_ORDER_DISPLAY = _Keydefaultdict(_factory,
|
||||
{ LRCP: 'LRCP',
|
||||
RLCP: 'RLCP',
|
||||
RPCL: 'RPCL',
|
||||
PCRL: 'PCRL',
|
||||
CPRL: 'CPRL'})
|
||||
_PROGRESSION_ORDER_DISPLAY = _Keydefaultdict(_factory, {LRCP: 'LRCP',
|
||||
RLCP: 'RLCP',
|
||||
RPCL: 'RPCL',
|
||||
PCRL: 'PCRL',
|
||||
CPRL: 'CPRL'})
|
||||
|
||||
_WAVELET_TRANSFORM_DISPLAY = _Keydefaultdict(_factory,
|
||||
{ WAVELET_XFORM_9X7_IRREVERSIBLE: '9-7 irreversible',
|
||||
WAVELET_XFORM_5X3_REVERSIBLE: '5-3 reversible'})
|
||||
_keysvalues = {WAVELET_XFORM_9X7_IRREVERSIBLE: '9-7 irreversible',
|
||||
WAVELET_XFORM_5X3_REVERSIBLE: '5-3 reversible'}
|
||||
_WAVELET_TRANSFORM_DISPLAY = _Keydefaultdict(_factory, _keysvalues)
|
||||
|
||||
_NO_PROFILE = 0
|
||||
_PROFILE_0 = 1
|
||||
|
|
@ -51,12 +47,11 @@ _PROFILE_4 = 4
|
|||
_KNOWN_PROFILES = [_NO_PROFILE, _PROFILE_0, _PROFILE_1, _PROFILE_3, _PROFILE_4]
|
||||
|
||||
# How to display the codestream profile.
|
||||
_CAPABILITIES_DISPLAY = _Keydefaultdict(_factory,
|
||||
{ _NO_PROFILE: 'no profile',
|
||||
_PROFILE_0: '0',
|
||||
_PROFILE_1: '1',
|
||||
_PROFILE_3: 'Cinema 2K',
|
||||
_PROFILE_4: 'Cinema 4K'})
|
||||
_CAPABILITIES_DISPLAY = _Keydefaultdict(_factory, {_NO_PROFILE: 'no profile',
|
||||
_PROFILE_0: '0',
|
||||
_PROFILE_1: '1',
|
||||
_PROFILE_3: 'Cinema 2K',
|
||||
_PROFILE_4: 'Cinema 4K'})
|
||||
|
||||
# Need a catch-all list of valid markers.
|
||||
# See table A-1 in ISO/IEC FCD15444-1.
|
||||
|
|
@ -298,7 +293,6 @@ class Codestream(object):
|
|||
msg += ''.join(strs)
|
||||
return msg
|
||||
|
||||
# pylint: disable=R0201
|
||||
def _parse_cme_segment(self, fptr):
|
||||
"""Parse the CME marker segment.
|
||||
|
||||
|
|
@ -694,7 +688,7 @@ class Codestream(object):
|
|||
try:
|
||||
num_tiles_x = (xysiz[0] - xyosiz[0]) / (xytsiz[0] - xytosiz[0])
|
||||
num_tiles_y = (xysiz[1] - xyosiz[1]) / (xytsiz[1] - xytosiz[1])
|
||||
except ZeroDivisionError as err:
|
||||
except ZeroDivisionError:
|
||||
warnings.warn("Invalid tile dimensions.")
|
||||
else:
|
||||
numtiles = math.ceil(num_tiles_x) * math.ceil(num_tiles_y)
|
||||
|
|
@ -828,7 +822,6 @@ class Codestream(object):
|
|||
|
||||
return TLMsegment(length, offset, ztlm, ttlm, ptlm)
|
||||
|
||||
# pylint: disable=W0613
|
||||
def _parse_reserved_marker(self, fptr):
|
||||
"""Marker range between 0xff30 and 0xff39.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ Entry point for console script jp2dump.
|
|||
"""
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
|
||||
from . import Jp2k, set_printoptions, lib
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""Core definitions to be shared amongst the modules.
|
||||
"""
|
||||
import collections
|
||||
import copy
|
||||
import lxml.etree as ET
|
||||
|
||||
|
||||
class _Keydefaultdict(collections.defaultdict):
|
||||
|
|
|
|||
|
|
@ -43,4 +43,3 @@ def jpxfile():
|
|||
"""
|
||||
filename = pkg_resources.resource_filename(__name__, "heliov.jpx")
|
||||
return filename
|
||||
|
||||
|
|
|
|||
193
glymur/jp2box.py
193
glymur/jp2box.py
|
|
@ -11,8 +11,6 @@ References
|
|||
Extensions
|
||||
"""
|
||||
|
||||
# pylint: disable=C0302,R0903,R0913,W0142
|
||||
|
||||
from collections import OrderedDict
|
||||
import datetime
|
||||
import io
|
||||
|
|
@ -22,7 +20,7 @@ import pprint
|
|||
import struct
|
||||
import sys
|
||||
import textwrap
|
||||
import uuid
|
||||
from uuid import UUID
|
||||
import warnings
|
||||
|
||||
import lxml.etree as ET
|
||||
|
|
@ -44,11 +42,13 @@ _METHOD_DISPLAY = {
|
|||
VENDOR_COLOR_METHOD: 'vendor color method'}
|
||||
|
||||
_factory = lambda x: '{0} (invalid)'.format(x)
|
||||
_APPROX_DISPLAY = _Keydefaultdict(_factory,
|
||||
{1: 'accurately represents correct colorspace definition',
|
||||
2: 'approximates correct colorspace definition, exceptional quality',
|
||||
3: 'approximates correct colorspace definition, reasonable quality',
|
||||
4: 'approximates correct colorspace definition, poor quality'})
|
||||
_keysvalues = {1: 'accurately represents correct colorspace definition',
|
||||
2: ('approximates correct colorspace definition, '
|
||||
'exceptional quality'),
|
||||
3: ('approximates correct colorspace definition, '
|
||||
'reasonable quality'),
|
||||
4: 'approximates correct colorspace definition, poor quality'}
|
||||
_APPROX_DISPLAY = _Keydefaultdict(_factory, _keysvalues)
|
||||
|
||||
|
||||
class Jp2kBox(object):
|
||||
|
|
@ -1983,7 +1983,6 @@ class PaletteBox(Jp2kBox):
|
|||
*bps_signed)
|
||||
fptr.write(write_buffer)
|
||||
|
||||
bps = self.bits_per_component
|
||||
# All components are the same. Writing is straightforward.
|
||||
if self.bits_per_component[0] <= 8:
|
||||
write_buffer = memoryview(self.palette.astype(np.uint8))
|
||||
|
|
@ -2023,13 +2022,10 @@ class PaletteBox(Jp2kBox):
|
|||
# Ok the palette has the same datatype for all columns. We should
|
||||
# be able to efficiently read it.
|
||||
if bps[0] <= 8:
|
||||
nbytes_per_row = ncols
|
||||
dtype = np.uint8
|
||||
elif bps[0] <= 16:
|
||||
nbytes_per_row = 2 * ncols
|
||||
dtype = np.uint16
|
||||
elif bps[0] <= 32:
|
||||
nbytes_per_row = 3 * ncols
|
||||
dtype = np.uint32
|
||||
|
||||
palette = np.frombuffer(read_buffer[3 + ncols:], dtype=dtype)
|
||||
|
|
@ -2073,80 +2069,80 @@ _READER_REQUIREMENTS_DISPLAY = {
|
|||
7: 'JPEG codestream as defined in ISO/IEC 10918-1',
|
||||
8: 'Deprecated - does not contain opacity',
|
||||
9: 'Non-premultiplied opacity channel',
|
||||
10: 'Premultiplied opacity channel',
|
||||
11: 'Chroma-key based opacity',
|
||||
12: 'Deprecated - codestream is contiguous',
|
||||
13: 'Fragmented codestream where all fragments are in file and in order',
|
||||
14: 'Fragmented codestream where all fragments are in file '
|
||||
+ 'but are out of order',
|
||||
15: 'Fragmented codestream where not all fragments are within the file '
|
||||
+ 'but are all in locally accessible files',
|
||||
16: 'Fragmented codestream where some fragments may be accessible '
|
||||
+ 'only through a URL specified network connection',
|
||||
17: 'Compositing required to produce rendered result from multiple '
|
||||
+ 'compositing layers',
|
||||
18: 'Deprecated - support for compositing is not required',
|
||||
19: 'Deprecated - contains multiple, discrete layers that should not '
|
||||
+ 'be combined through either animation or compositing',
|
||||
20: 'Deprecated - compositing layers each contain only a single '
|
||||
+ 'codestream',
|
||||
21: 'At least one compositing layer consists of multiple codestreams',
|
||||
22: 'Deprecated - all compositing layers are in the same colourspace',
|
||||
23: 'Colourspace transformations are required to combine compositing '
|
||||
+ 'layers; not all compositing layers are in the same colourspace',
|
||||
24: 'Deprecated - rendered result created without using animation',
|
||||
25: 'Deprecated - animated, but first layer covers entire area and is '
|
||||
+ 'opaque',
|
||||
26: 'First animation layer does not cover entire rendered result',
|
||||
27: 'Deprecated - animated, and no layer is reused',
|
||||
28: 'Reuse of animation layers',
|
||||
29: 'Deprecated - animated, but layers are reused',
|
||||
30: 'Some animated frames are non-persistent',
|
||||
31: 'Deprecated - rendered result created without using scaling',
|
||||
32: 'Rendered result involves scaling within a layer',
|
||||
33: 'Rendered result involves scaling between layers',
|
||||
34: 'ROI metadata',
|
||||
35: 'IPR metadata',
|
||||
36: 'Content metadata',
|
||||
37: 'History metadata',
|
||||
38: 'Creation metadata',
|
||||
39: 'JPX digital signatures',
|
||||
40: 'JPX checksums',
|
||||
41: 'Desires Graphics Arts Reproduction specified',
|
||||
42: 'Deprecated - compositing layer uses palettized colour',
|
||||
43: 'Deprecated - compositing layer uses restricted ICC profile',
|
||||
44: 'Compositing layer uses Any ICC profile',
|
||||
45: 'Deprecated - compositing layer uses sRGB enumerated colourspace',
|
||||
46: 'Deprecated - compositing layer uses sRGB-grey enumerated colourspace',
|
||||
47: 'BiLevel 1 enumerated colourspace',
|
||||
48: 'BiLevel 2 enumerated colourspace',
|
||||
49: 'YCbCr 1 enumerated colourspace',
|
||||
50: 'YCbCr 2 enumerated colourspace',
|
||||
51: 'YCbCr 3 enumerated colourspace',
|
||||
52: 'PhotoYCC enumerated colourspace',
|
||||
53: 'YCCK enumerated colourspace',
|
||||
54: 'CMY enumerated colourspace',
|
||||
55: 'CMYK enumerated colorspace',
|
||||
56: 'CIELab enumerated colourspace with default parameters',
|
||||
57: 'CIELab enumerated colourspace with non-default parameters',
|
||||
58: 'CIEJab enumerated colourspace with default parameters',
|
||||
59: 'CIEJab enumerated colourspace with non-default parameters',
|
||||
60: 'e-sRGB enumerated colorspace',
|
||||
61: 'ROMM_RGB enumerated colorspace',
|
||||
62: 'Non-square samples',
|
||||
63: 'Deprecated - compositing layers have labels',
|
||||
64: 'Deprecated - codestreams have labels',
|
||||
65: 'Deprecated - compositing layers have different colour spaces',
|
||||
66: 'Deprecated - compositing layers have different metadata',
|
||||
67: 'GIS metadata XML box',
|
||||
68: 'JPSEC extensions in codestream as specified by ISO/IEC 15444-8',
|
||||
69: 'JP3D extensions in codestream as specified by ISO/IEC 15444-10',
|
||||
70: 'Deprecated - compositing layer uses sYCC enumerated colour space',
|
||||
71: 'e-sYCC enumerated colourspace',
|
||||
72: 'JPEG 2000 Part 2 codestream as restricted by baseline conformance '
|
||||
+ 'requirements in M.9.2.3',
|
||||
73: 'YPbPr(1125/60) enumerated colourspace',
|
||||
74: 'YPbPr(1250/50) enumerated colourspace'}
|
||||
10: 'Premultiplied opacity channel',
|
||||
11: 'Chroma-key based opacity',
|
||||
12: 'Deprecated - codestream is contiguous',
|
||||
13: 'Fragmented codestream where all fragments are in file and in order',
|
||||
14: ('Fragmented codestream where all fragments are in file '
|
||||
'but are out of order'),
|
||||
15: ('Fragmented codestream where not all fragments are within the file '
|
||||
'but are all in locally accessible files'),
|
||||
16: ('Fragmented codestream where some fragments may be accessible '
|
||||
'only through a URL specified network connection'),
|
||||
17: ('Compositing required to produce rendered result from multiple '
|
||||
'compositing layers'),
|
||||
18: 'Deprecated - support for compositing is not required',
|
||||
19: ('Deprecated - contains multiple, discrete layers that should not '
|
||||
'be combined through either animation or compositing'),
|
||||
20: ('Deprecated - compositing layers each contain only a single '
|
||||
'codestream'),
|
||||
21: 'At least one compositing layer consists of multiple codestreams',
|
||||
22: 'Deprecated - all compositing layers are in the same colourspace',
|
||||
23: ('Colourspace transformations are required to combine compositing '
|
||||
'layers; not all compositing layers are in the same colourspace'),
|
||||
24: 'Deprecated - rendered result created without using animation',
|
||||
25: ('Deprecated - animated, but first layer covers entire area and is '
|
||||
'opaque'),
|
||||
26: 'First animation layer does not cover entire rendered result',
|
||||
27: 'Deprecated - animated, and no layer is reused',
|
||||
28: 'Reuse of animation layers',
|
||||
29: 'Deprecated - animated, but layers are reused',
|
||||
30: 'Some animated frames are non-persistent',
|
||||
31: 'Deprecated - rendered result created without using scaling',
|
||||
32: 'Rendered result involves scaling within a layer',
|
||||
33: 'Rendered result involves scaling between layers',
|
||||
34: 'ROI metadata',
|
||||
35: 'IPR metadata',
|
||||
36: 'Content metadata',
|
||||
37: 'History metadata',
|
||||
38: 'Creation metadata',
|
||||
39: 'JPX digital signatures',
|
||||
40: 'JPX checksums',
|
||||
41: 'Desires Graphics Arts Reproduction specified',
|
||||
42: 'Deprecated - compositing layer uses palettized colour',
|
||||
43: 'Deprecated - compositing layer uses restricted ICC profile',
|
||||
44: 'Compositing layer uses Any ICC profile',
|
||||
45: 'Deprecated - compositing layer uses sRGB enumerated colourspace',
|
||||
46: 'Deprecated - compositing layer uses sRGB-grey enumerated colourspace',
|
||||
47: 'BiLevel 1 enumerated colourspace',
|
||||
48: 'BiLevel 2 enumerated colourspace',
|
||||
49: 'YCbCr 1 enumerated colourspace',
|
||||
50: 'YCbCr 2 enumerated colourspace',
|
||||
51: 'YCbCr 3 enumerated colourspace',
|
||||
52: 'PhotoYCC enumerated colourspace',
|
||||
53: 'YCCK enumerated colourspace',
|
||||
54: 'CMY enumerated colourspace',
|
||||
55: 'CMYK enumerated colorspace',
|
||||
56: 'CIELab enumerated colourspace with default parameters',
|
||||
57: 'CIELab enumerated colourspace with non-default parameters',
|
||||
58: 'CIEJab enumerated colourspace with default parameters',
|
||||
59: 'CIEJab enumerated colourspace with non-default parameters',
|
||||
60: 'e-sRGB enumerated colorspace',
|
||||
61: 'ROMM_RGB enumerated colorspace',
|
||||
62: 'Non-square samples',
|
||||
63: 'Deprecated - compositing layers have labels',
|
||||
64: 'Deprecated - codestreams have labels',
|
||||
65: 'Deprecated - compositing layers have different colour spaces',
|
||||
66: 'Deprecated - compositing layers have different metadata',
|
||||
67: 'GIS metadata XML box',
|
||||
68: 'JPSEC extensions in codestream as specified by ISO/IEC 15444-8',
|
||||
69: 'JP3D extensions in codestream as specified by ISO/IEC 15444-10',
|
||||
70: 'Deprecated - compositing layer uses sYCC enumerated colour space',
|
||||
71: 'e-sYCC enumerated colourspace',
|
||||
72: ('JPEG 2000 Part 2 codestream as restricted by baseline conformance '
|
||||
'requirements in M.9.2.3'),
|
||||
73: 'YPbPr(1125/60) enumerated colourspace',
|
||||
74: 'YPbPr(1250/50) enumerated colourspace'}
|
||||
|
||||
|
||||
class ReaderRequirementsBox(Jp2kBox):
|
||||
|
|
@ -2209,7 +2205,8 @@ class ReaderRequirementsBox(Jp2kBox):
|
|||
if _printoptions['short'] is True:
|
||||
return msg
|
||||
|
||||
msg += '\n Fully Understands Aspect Mask: 0x{0:x}'.format(self.fuam)
|
||||
msg += '\n Fully Understands Aspect Mask: 0x{0:x}'
|
||||
msg = msg.format(self.fuam)
|
||||
msg += '\n Display Completely Mask: 0x{0:x}'.format(self.dcm)
|
||||
|
||||
msg += '\n Standard Features and Masks:'
|
||||
|
|
@ -2265,8 +2262,8 @@ class ReaderRequirementsBox(Jp2kBox):
|
|||
standard_flag, standard_mask = data
|
||||
|
||||
nflags = len(standard_flag)
|
||||
vendor_offset = 1 + 2 * mask_length + 2 \
|
||||
+ (2 + mask_length) * nflags
|
||||
vendor_offset = (1 + 2 * mask_length + 2
|
||||
+ (2 + mask_length) * nflags)
|
||||
data = _parse_vendor_features(read_buffer[vendor_offset:],
|
||||
mask_length)
|
||||
vendor_feature, vendor_mask = data
|
||||
|
|
@ -2323,8 +2320,8 @@ def _parse_rreq3(read_buffer, length, offset):
|
|||
read_buffer = read_buffer[9 + num_standard_features * 10:]
|
||||
for j in range(num_vendor_features):
|
||||
uslice = slice(j * entry_length, (j + 1) * entry_length)
|
||||
ubuffer = read_buffer[slice]
|
||||
vendor_feature.append(uuid.UUID(bytes=ubuffer[0:16]))
|
||||
ubuffer = read_buffer[uslice]
|
||||
vendor_feature.append(UUID(bytes=ubuffer[0:16]))
|
||||
|
||||
lst = struct.unpack('>BBB', ubuffer[16:])
|
||||
vmask = lst[0] << 16 | lst[1] << 8 | lst[2]
|
||||
|
|
@ -2392,7 +2389,7 @@ def _parse_vendor_features(read_buffer, mask_length):
|
|||
for j in range(num_vendor_features):
|
||||
uslice = slice(2 + j * entry_length, 2 + (j + 1) * entry_length)
|
||||
ubuffer = read_buffer[uslice]
|
||||
vendor_feature.append(uuid.UUID(bytes=ubuffer[0:16]))
|
||||
vendor_feature.append(UUID(bytes=ubuffer[0:16]))
|
||||
|
||||
vmask = struct.unpack('>' + mask_format, ubuffer[16:])
|
||||
vendor_mask.append(vmask)
|
||||
|
|
@ -2944,7 +2941,7 @@ class UUIDListBox(Jp2kBox):
|
|||
ulst = []
|
||||
for j in range(num_uuids):
|
||||
uuid_buffer = read_buffer[2 + j * 16:2 + (j + 1) * 16]
|
||||
ulst.append(uuid.UUID(bytes=uuid_buffer))
|
||||
ulst.append(UUID(bytes=uuid_buffer))
|
||||
|
||||
return cls(ulst, length=length, offset=offset)
|
||||
|
||||
|
|
@ -3202,7 +3199,7 @@ class UUIDBox(Jp2kBox):
|
|||
"""
|
||||
Private function for parsing UUID payloads if possible.
|
||||
"""
|
||||
if self.uuid == uuid.UUID('be7acfcb-97a9-42e8-9c71-999491e3afac'):
|
||||
if self.uuid == UUID('be7acfcb-97a9-42e8-9c71-999491e3afac'):
|
||||
self.data = _uuid_io.xml(self.raw_data)
|
||||
elif self.uuid.bytes == b'JpgTiffExif->JP2':
|
||||
self.data = _uuid_io.tiff_header(self.raw_data)
|
||||
|
|
@ -3220,7 +3217,7 @@ class UUIDBox(Jp2kBox):
|
|||
return msg
|
||||
|
||||
msg = '{0}\n UUID: {1}'.format(msg, self.uuid)
|
||||
if self.uuid == uuid.UUID('be7acfcb-97a9-42e8-9c71-999491e3afac'):
|
||||
if self.uuid == UUID('be7acfcb-97a9-42e8-9c71-999491e3afac'):
|
||||
msg += ' (XMP)'
|
||||
elif self.uuid.bytes == b'JpgTiffExif->JP2':
|
||||
msg += ' (EXIF)'
|
||||
|
|
@ -3228,11 +3225,11 @@ class UUIDBox(Jp2kBox):
|
|||
msg += ' (unknown)'
|
||||
|
||||
if (((_printoptions['xml'] is False) and
|
||||
(self.uuid == uuid.UUID('be7acfcb-97a9-42e8-9c71-999491e3afac')))):
|
||||
(self.uuid == UUID('be7acfcb-97a9-42e8-9c71-999491e3afac')))):
|
||||
# If it's an XMP UUID, don't print the XML contents.
|
||||
return msg
|
||||
|
||||
if self.uuid == uuid.UUID('be7acfcb-97a9-42e8-9c71-999491e3afac'):
|
||||
if self.uuid == UUID('be7acfcb-97a9-42e8-9c71-999491e3afac'):
|
||||
line = '\n UUID Data:\n{0}'
|
||||
xmlstring = ET.tostring(self.data,
|
||||
encoding='utf-8',
|
||||
|
|
@ -3275,7 +3272,7 @@ class UUIDBox(Jp2kBox):
|
|||
"""
|
||||
num_bytes = offset + length - fptr.tell()
|
||||
read_buffer = fptr.read(num_bytes)
|
||||
the_uuid = uuid.UUID(bytes=read_buffer[0:16])
|
||||
the_uuid = UUID(bytes=read_buffer[0:16])
|
||||
return cls(the_uuid, read_buffer[16:], length=length, offset=offset)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,12 @@ License: MIT
|
|||
import sys
|
||||
|
||||
# Exitstack not found in contextlib in 2.7
|
||||
# pylint: disable=E0611
|
||||
if sys.hexversion >= 0x03030000:
|
||||
from contextlib import ExitStack
|
||||
from itertools import compress, filterfalse
|
||||
from itertools import filterfalse
|
||||
else:
|
||||
from contextlib2 import ExitStack
|
||||
from itertools import compress, ifilterfalse as filterfalse
|
||||
from itertools import ifilterfalse as filterfalse
|
||||
|
||||
from collections import Counter
|
||||
import ctypes
|
||||
|
|
@ -517,12 +516,12 @@ class Jp2k(Jp2kBox):
|
|||
# set image offset and reference grid
|
||||
image.contents.x0 = self._cparams.image_offset_x0
|
||||
image.contents.y0 = self._cparams.image_offset_y0
|
||||
image.contents.x1 = image.contents.x0 \
|
||||
+ (numcols - 1) * self._cparams.subsampling_dx \
|
||||
+ 1
|
||||
image.contents.y1 = image.contents.y0 \
|
||||
+ (numrows - 1) * self._cparams.subsampling_dy \
|
||||
+ 1
|
||||
image.contents.x1 = (image.contents.x0
|
||||
+ (numcols - 1) * self._cparams.subsampling_dx
|
||||
+ 1)
|
||||
image.contents.y1 = (image.contents.y0
|
||||
+ (numrows - 1) * self._cparams.subsampling_dy
|
||||
+ 1)
|
||||
|
||||
# Stage the image data to the openjpeg data structure.
|
||||
for k in range(0, numlayers):
|
||||
|
|
@ -832,7 +831,7 @@ class Jp2k(Jp2kBox):
|
|||
raise IOError(msg)
|
||||
|
||||
# Find the first codestream in the file.
|
||||
jp2c = [box for box in self.box if box.box_id == 'jp2c']
|
||||
jp2c = [_box for _box in self.box if _box.box_id == 'jp2c']
|
||||
offset = jp2c[0].offset
|
||||
|
||||
# Ready to write the codestream.
|
||||
|
|
@ -1435,7 +1434,6 @@ class Jp2k(Jp2kBox):
|
|||
codestream = Codestream(fptr, self.length,
|
||||
header_only=header_only)
|
||||
else:
|
||||
ftyp = self.box[1]
|
||||
box = [x for x in self.box if x.box_id == 'jp2c']
|
||||
fptr.seek(box[0].offset)
|
||||
read_buffer = fptr.read(8)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
"""
|
||||
Configure glymur to use installed libraries if possible.
|
||||
"""
|
||||
# configparser is new in python3 (pylint/python-2.7)
|
||||
# pylint: disable=F0401
|
||||
|
||||
import ctypes
|
||||
from ctypes.util import find_library
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
Wraps individual functions in openjp2 library.
|
||||
"""
|
||||
|
||||
# pylint: disable=C0302,R0903,W0201
|
||||
|
||||
import ctypes
|
||||
import re
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""Wraps library calls to openjpeg.
|
||||
"""
|
||||
|
||||
# pylint: disable=R0903
|
||||
|
||||
import ctypes
|
||||
import sys
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
"""
|
||||
Tests for libopenjp2 wrapping functions.
|
||||
"""
|
||||
# R0904: Seems like pylint is fooled in this situation
|
||||
# W0142: using kwargs is ok in this context
|
||||
# pylint: disable=R0904,W0142
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
|
|
@ -21,8 +16,8 @@ from glymur.lib import openjp2
|
|||
@unittest.skipIf(openjp2.OPENJP2 is None,
|
||||
"Missing openjp2 library.")
|
||||
@unittest.skipIf(re.match(r'''(1|2.0)''',
|
||||
glymur.version.openjpeg_version) is not None,
|
||||
"Not to be run until 2.1.0")
|
||||
glymur.version.openjpeg_version) is not None,
|
||||
"Not to be run until 2.1.0")
|
||||
class TestOpenJP2(unittest.TestCase):
|
||||
"""Test openjp2 library functionality.
|
||||
|
||||
|
|
@ -152,6 +147,7 @@ class TestOpenJP2(unittest.TestCase):
|
|||
xtx5_setup(tfile.name)
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
def tile_encoder(**kwargs):
|
||||
"""Fixture used by many tests."""
|
||||
num_tiles = ((kwargs['image_width'] / kwargs['tile_width']) *
|
||||
|
|
@ -215,7 +211,7 @@ def tile_encoder(**kwargs):
|
|||
openjp2.setup_encoder(codec, l_param, l_image)
|
||||
|
||||
stream = openjp2.stream_create_default_file_stream(kwargs['filename'],
|
||||
False)
|
||||
False)
|
||||
openjp2.start_compress(codec, l_image, stream)
|
||||
|
||||
for j in np.arange(num_tiles):
|
||||
|
|
@ -226,13 +222,14 @@ def tile_encoder(**kwargs):
|
|||
openjp2.destroy_codec(codec)
|
||||
openjp2.image_destroy(l_image)
|
||||
|
||||
|
||||
def tile_decoder(**kwargs):
|
||||
"""Fixture called with various configurations by many tests.
|
||||
|
||||
Reads a tile. That's all it does.
|
||||
"""
|
||||
stream = openjp2.stream_create_default_file_stream(kwargs['filename'],
|
||||
True)
|
||||
True)
|
||||
dparam = openjp2.set_default_decoder_parameters()
|
||||
|
||||
dparam.decod_format = kwargs['codec_format']
|
||||
|
|
@ -270,6 +267,7 @@ def tile_decoder(**kwargs):
|
|||
openjp2.stream_destroy(stream)
|
||||
openjp2.image_destroy(image)
|
||||
|
||||
|
||||
def ttx0_setup(filename):
|
||||
"""Runs tests tte0, tte0."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -283,6 +281,7 @@ def ttx0_setup(filename):
|
|||
'tile_width': 100}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx2_setup(filename):
|
||||
"""Runs tests rta2, tte2, ttd2."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -296,6 +295,7 @@ def xtx2_setup(filename):
|
|||
'tile_width': 128}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx3_setup(filename):
|
||||
"""Runs tests tte3, rta3."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -309,6 +309,7 @@ def xtx3_setup(filename):
|
|||
'tile_width': 128}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx4_setup(filename):
|
||||
"""Runs tests rta4, tte4."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -322,6 +323,7 @@ def xtx4_setup(filename):
|
|||
'tile_width': 128}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
|
||||
def xtx5_setup(filename):
|
||||
"""Runs tests rta5, tte5."""
|
||||
kwargs = {'filename': filename,
|
||||
|
|
@ -334,6 +336,3 @@ def xtx5_setup(filename):
|
|||
'tile_height': 256,
|
||||
'tile_width': 256}
|
||||
tile_encoder(**kwargs)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""
|
||||
Tests for OpenJPEG module.
|
||||
"""
|
||||
# pylint: disable=E1101,R0904
|
||||
|
||||
import ctypes
|
||||
import re
|
||||
import sys
|
||||
|
|
@ -10,6 +8,7 @@ import unittest
|
|||
|
||||
import glymur
|
||||
|
||||
|
||||
@unittest.skipIf(glymur.lib.openjpeg.OPENJPEG is None,
|
||||
"Missing openjpeg library.")
|
||||
class TestOpenJPEG(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ else:
|
|||
import glymur
|
||||
from . import fixtures
|
||||
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03000000, "do not care about 2.7 here")
|
||||
@unittest.skipIf(re.match('0|1|2.0', glymur.version.openjpeg_version),
|
||||
"Requires openjpeg 2.1.0 or higher")
|
||||
|
|
@ -72,6 +73,3 @@ class TestPrintingOpenjp2(unittest.TestCase):
|
|||
|
||||
expected = fixtures.default_image_type
|
||||
self.assertRegex(actual, expected)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,6 @@ try:
|
|||
|
||||
# The whole point of trying to import PIL is to determine if it's there
|
||||
# or not. We won't use it directly.
|
||||
# pylint: disable=F0401,W0611
|
||||
import PIL
|
||||
|
||||
NO_READ_BACKEND = False
|
||||
|
|
|
|||
|
|
@ -1,12 +1,6 @@
|
|||
"""
|
||||
Test suite for openjpeg's callback functions.
|
||||
"""
|
||||
# R0904: Seems like pylint is fooled in this situation
|
||||
# pylint: disable=R0904
|
||||
|
||||
# 'mock' most certainly is in unittest (Python 3.3)
|
||||
# pylint: disable=E0611,F0401
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
|
@ -99,8 +93,6 @@ class TestCallbacks(unittest.TestCase):
|
|||
[0-9]+\.[0-9]+\ss""",
|
||||
re.VERBOSE)
|
||||
|
||||
# assertRegex in Python 3.3 (python2.7/pylint issue)
|
||||
# pylint: disable=E1101
|
||||
if sys.hexversion <= 0x03020000:
|
||||
self.assertRegexpMatches(actual, regex)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
"""These tests are for edge cases where OPENJPEG does not exist, but
|
||||
OPENJP2 may be present in some form or other.
|
||||
"""
|
||||
# unittest doesn't work well with R0904.
|
||||
# pylint: disable=R0904
|
||||
|
||||
# tempfile.TemporaryDirectory, unittest.assertWarns introduced in 3.2
|
||||
# pylint: disable=E1101
|
||||
|
||||
# unittest.mock only in Python 3.3 (python2.7/pylint import issue)
|
||||
# pylint: disable=E0611,F0401
|
||||
|
||||
import contextlib
|
||||
import ctypes
|
||||
import imp
|
||||
|
|
@ -98,7 +89,6 @@ class TestSuite(unittest.TestCase):
|
|||
|
||||
# Need to reliably recover the location of the openjp2 library,
|
||||
# so using '_name' appears to be the only way to do it.
|
||||
# pylint: disable=W0212
|
||||
libloc = glymur.lib.openjp2.OPENJP2._name
|
||||
line = 'openjp2: {0}\n'.format(libloc)
|
||||
tfile.write(line)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
"""
|
||||
Test suite for warnings issued by glymur.
|
||||
"""
|
||||
|
||||
# unittest doesn't work well with R0904.
|
||||
# pylint: disable=R0904
|
||||
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
"""
|
||||
ICC profile tests.
|
||||
"""
|
||||
|
||||
# unittest doesn't work well with R0904.
|
||||
# pylint: disable=R0904
|
||||
|
||||
import datetime
|
||||
import unittest
|
||||
|
||||
|
|
@ -64,11 +60,6 @@ class TestICC(unittest.TestCase):
|
|||
"""invalid ICC header data should cause UserWarning"""
|
||||
jfile = opj_data_file('input/nonregression/orb-blue10-lin-jp2.jp2')
|
||||
|
||||
# assertWarns in Python 3.3 (python2.7/pylint issue)
|
||||
# pylint: disable=E1101
|
||||
regex = 'ICC profile header is corrupt'
|
||||
with self.assertWarnsRegex(UserWarning, regex):
|
||||
Jp2k(jfile)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -1,18 +1,6 @@
|
|||
"""
|
||||
Test suite specifically targeting JP2 box layout.
|
||||
"""
|
||||
# E1103: return value from read may be list or np array
|
||||
# pylint: disable=E1103
|
||||
|
||||
# R0902: More than 7 instance attributes are just fine for testing.
|
||||
# pylint: disable=R0902
|
||||
|
||||
# R0904: Seems like pylint is fooled in this situation
|
||||
# pylint: disable=R0904
|
||||
|
||||
# W0613: load_tests doesn't need to use ignore or loader arguments.
|
||||
# pylint: disable=W0613
|
||||
|
||||
import doctest
|
||||
import os
|
||||
import re
|
||||
|
|
@ -20,7 +8,6 @@ import shutil
|
|||
import struct
|
||||
import sys
|
||||
import tempfile
|
||||
import uuid
|
||||
from uuid import UUID
|
||||
import unittest
|
||||
|
||||
|
|
@ -642,7 +629,7 @@ class TestAppend(unittest.TestCase):
|
|||
jp2 = Jp2k(tfile.name)
|
||||
|
||||
# Make a UUID box. Only XMP UUID boxes can currently be appended.
|
||||
uuid_instance = uuid.UUID('00000000-0000-0000-0000-000000000000')
|
||||
uuid_instance = UUID('00000000-0000-0000-0000-000000000000')
|
||||
data = b'0123456789'
|
||||
uuidbox = glymur.jp2box.UUIDBox(uuid_instance, data)
|
||||
with self.assertRaises(IOError):
|
||||
|
|
@ -1234,8 +1221,8 @@ class TestRepr(MetadataBase):
|
|||
|
||||
def test_uuidlist_box(self):
|
||||
"""Verify __repr__ method on ulst box."""
|
||||
uuid1 = uuid.UUID('00000000-0000-0000-0000-000000000001')
|
||||
uuid2 = uuid.UUID('00000000-0000-0000-0000-000000000002')
|
||||
uuid1 = UUID('00000000-0000-0000-0000-000000000001')
|
||||
uuid2 = UUID('00000000-0000-0000-0000-000000000002')
|
||||
uuids = [uuid1, uuid2]
|
||||
ulst = glymur.jp2box.UUIDListBox(ulst=uuids)
|
||||
newbox = eval(repr(ulst))
|
||||
|
|
@ -1289,7 +1276,7 @@ class TestRepr(MetadataBase):
|
|||
|
||||
def test_uuid_box_generic(self):
|
||||
"""Verify uuid repr method."""
|
||||
uuid_instance = uuid.UUID('00000000-0000-0000-0000-000000000000')
|
||||
uuid_instance = UUID('00000000-0000-0000-0000-000000000000')
|
||||
data = b'0123456789'
|
||||
box = glymur.jp2box.UUIDBox(the_uuid=uuid_instance, raw_data=data)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test suite for printing.
|
||||
"""
|
||||
# C0302: don't care too much about having too many lines in a test module
|
||||
# pylint: disable=C0302
|
||||
|
||||
# E061: unittest.mock introduced in 3.3 (python-2.7/pylint issue)
|
||||
# pylint: disable=E0611,F0401
|
||||
|
||||
# R0904: Not too many methods in unittest.
|
||||
# pylint: disable=R0904
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import struct
|
||||
|
|
|
|||
|
|
@ -2,18 +2,6 @@
|
|||
"""
|
||||
Test suite specifically targeting JP2 box layout.
|
||||
"""
|
||||
# E1103: return value from read may be list or np array
|
||||
# pylint: disable=E1103
|
||||
|
||||
# R0902: More than 7 instance attributes are just fine for testing.
|
||||
# pylint: disable=R0902
|
||||
|
||||
# R0904: Seems like pylint is fooled in this situation
|
||||
# pylint: disable=R0904
|
||||
|
||||
# W0613: load_tests doesn't need to use ignore or loader arguments.
|
||||
# pylint: disable=W0613
|
||||
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
"""
|
||||
Tests for general glymur functionality.
|
||||
"""
|
||||
# E1101: assertWarns introduced in python 3.2
|
||||
# pylint: disable=E1101
|
||||
|
||||
# R0904: Not too many methods in unittest.
|
||||
# pylint: disable=R0904
|
||||
|
||||
# E0611: unittest.mock is unknown to python2.7/pylint
|
||||
# pylint: disable=E0611,F0401
|
||||
|
||||
import doctest
|
||||
import os
|
||||
import re
|
||||
|
|
@ -47,10 +38,6 @@ from . import fixtures
|
|||
|
||||
# Doc tests should be run as well.
|
||||
def load_tests(loader, tests, ignore):
|
||||
# W0613: "loader" and "ignore" are necessary for the protocol
|
||||
# They are unused here, however.
|
||||
# pylint: disable=W0613
|
||||
|
||||
"""Should run doc tests as well"""
|
||||
if os.name == "nt":
|
||||
# Can't do it on windows, temporary file issue.
|
||||
|
|
|
|||
|
|
@ -2,31 +2,6 @@
|
|||
The tests defined here roughly correspond to what is in the OpenJPEG test
|
||||
suite.
|
||||
"""
|
||||
|
||||
# Some test names correspond with openjpeg tests. Long names are ok in this
|
||||
# case.
|
||||
# pylint: disable=C0103
|
||||
|
||||
# All of these tests correspond to tests in openjpeg, so no docstring is really
|
||||
# needed.
|
||||
# pylint: disable=C0111
|
||||
|
||||
# This module is very long, cannot be helped.
|
||||
# pylint: disable=C0302
|
||||
|
||||
# unittest fools pylint with "too many public methods"
|
||||
# pylint: disable=R0904
|
||||
|
||||
# Some tests use numpy test infrastructure, which means the tests never
|
||||
# reference "self", so pylint claims it should be a function. No, no, no.
|
||||
# pylint: disable=R0201
|
||||
|
||||
# Many tests are pretty long and that can't be helped.
|
||||
# pylint: disable=R0915
|
||||
|
||||
# asserWarns introduced in python 3.2 (python2.7/pylint issue)
|
||||
# pylint: disable=E1101
|
||||
|
||||
import re
|
||||
import sys
|
||||
import unittest
|
||||
|
|
|
|||
|
|
@ -2,31 +2,6 @@
|
|||
The tests defined here roughly correspond to what is in the OpenJPEG test
|
||||
suite.
|
||||
"""
|
||||
|
||||
# Some test names correspond with openjpeg tests. Long names are ok in this
|
||||
# case.
|
||||
# pylint: disable=C0103
|
||||
|
||||
# All of these tests correspond to tests in openjpeg, so no docstring is really
|
||||
# needed.
|
||||
# pylint: disable=C0111
|
||||
|
||||
# This module is very long, cannot be helped.
|
||||
# pylint: disable=C0302
|
||||
|
||||
# unittest fools pylint with "too many public methods"
|
||||
# pylint: disable=R0904
|
||||
|
||||
# Some tests use numpy test infrastructure, which means the tests never
|
||||
# reference "self", so pylint claims it should be a function. No, no, no.
|
||||
# pylint: disable=R0201
|
||||
|
||||
# Many tests are pretty long and that can't be helped.
|
||||
# pylint: disable=R0915
|
||||
|
||||
# asserWarns introduced in python 3.2 (python2.7/pylint issue)
|
||||
# pylint: disable=E1101
|
||||
|
||||
import re
|
||||
import sys
|
||||
import unittest
|
||||
|
|
|
|||
|
|
@ -2,12 +2,6 @@
|
|||
The tests here do not correspond directly to the OpenJPEG test suite, but
|
||||
seem like logical negative tests to add.
|
||||
"""
|
||||
# E1101: assertWarns introduced in python 3.2
|
||||
# pylint: disable=E1101
|
||||
|
||||
# R0904: Not too many methods in unittest.
|
||||
# pylint: disable=R0904
|
||||
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
The tests defined here roughly correspond to what is in the OpenJPEG test
|
||||
suite.
|
||||
"""
|
||||
# C0103: method names longer that 30 chars are ok in tests, IMHO
|
||||
# R0904: Seems like pylint is fooled in this situation
|
||||
# pylint: disable=R0904,C0103
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test suite for printing.
|
||||
"""
|
||||
# C0302: don't care too much about having too many lines in a test module
|
||||
# pylint: disable=C0302
|
||||
|
||||
# E061: unittest.mock introduced in 3.3 (python-2.7/pylint issue)
|
||||
# pylint: disable=E0611,F0401
|
||||
|
||||
# R0904: Not too many methods in unittest.
|
||||
# pylint: disable=R0904
|
||||
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
|
|
@ -106,7 +97,7 @@ class TestPrinting(unittest.TestCase):
|
|||
data = glymur.Jp2k(self.jp2file)[::2, ::2]
|
||||
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
|
||||
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile2:
|
||||
j = glymur.Jp2k(tfile.name, data=data)
|
||||
glymur.Jp2k(tfile.name, data=data)
|
||||
|
||||
# Offset of the codestream is where we start.
|
||||
wbuffer = tfile.read(77)
|
||||
|
|
|
|||
6
setup.py
6
setup.py
|
|
@ -1,4 +1,4 @@
|
|||
from setuptools import setup, find_packages
|
||||
from setuptools import setup
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
|
@ -11,7 +11,9 @@ kwargs = {'name': 'Glymur',
|
|||
'url': 'https://github.com/quintusdias/glymur',
|
||||
'packages': ['glymur', 'glymur.data', 'glymur.test', 'glymur.lib',
|
||||
'glymur.lib.test'],
|
||||
'package_data': {'glymur': ['data/*.jp2', 'data/*.j2k', 'data/*.jpx']},
|
||||
'package_data': {'glymur': ['data/*.jp2',
|
||||
'data/*.j2k',
|
||||
'data/*.jpx']},
|
||||
'entry_points': {
|
||||
'console_scripts': ['jp2dump=glymur.command_line:main'],
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue