Glymur 0.13.6__py3-none-any.whl → 0.13.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
glymur/config.py CHANGED
@@ -1,6 +1,7 @@
1
1
  """
2
2
  Configure glymur to use installed libraries if possible.
3
3
  """
4
+
4
5
  from configparser import ConfigParser, NoOptionError, NoSectionError
5
6
  import ctypes
6
7
  from ctypes.util import find_library
@@ -20,13 +21,13 @@ def glymurrc_fname():
20
21
  """
21
22
 
22
23
  # Current directory.
23
- path = pathlib.Path.cwd() / 'glymurrc'
24
+ path = pathlib.Path.cwd() / "glymurrc"
24
25
  if path.exists():
25
26
  return path
26
27
 
27
28
  confdir_path = get_configdir()
28
29
  if confdir_path is not None:
29
- path = confdir_path / 'glymurrc'
30
+ path = confdir_path / "glymurrc"
30
31
  if path.exists():
31
32
  return path
32
33
 
@@ -54,8 +55,8 @@ def _determine_full_path(libname):
54
55
  return path
55
56
 
56
57
  # No joy on config file. Cygwin? Cygwin is a bit of an odd case.
57
- if platform.system().startswith('CYGWIN'):
58
- g = pathlib.Path('/usr/bin').glob('cygopenjp2*.dll')
58
+ if platform.system().startswith("CYGWIN"):
59
+ g = pathlib.Path("/usr/bin").glob("cygopenjp2*.dll")
59
60
  try:
60
61
  return list(g)[0]
61
62
  except IndexError:
@@ -92,7 +93,7 @@ def read_config_file(libname):
92
93
  parser = ConfigParser()
93
94
  parser.read(filename)
94
95
  try:
95
- path = parser.get('library', libname)
96
+ path = parser.get("library", libname)
96
97
  except (NoOptionError, NoSectionError):
97
98
  path = None
98
99
  else:
@@ -114,23 +115,23 @@ def glymur_config(libname):
114
115
  -------
115
116
  loaded shared library
116
117
  """
117
- if platform.system().startswith('Windows') and libname == 'c':
118
+ if platform.system().startswith("Windows") and libname == "c":
118
119
  return ctypes.cdll.msvcrt
119
120
 
120
121
  path = _determine_full_path(libname)
121
122
 
122
- if path is None or path in ['None', 'none']:
123
+ if path is None or path in ["None", "none"]:
123
124
  # Either could not find a library via ctypes or
124
125
  # user-configuration-file, or we could not find it in any of the
125
126
  # default locations, or possibly the user intentionally does not want
126
127
  # one of the libraries to load.
127
128
  return None
128
129
 
129
- loader = ctypes.windll.LoadLibrary if os.name == 'nt' else ctypes.CDLL
130
+ loader = ctypes.windll.LoadLibrary if os.name == "nt" else ctypes.CDLL
130
131
  try:
131
132
  opj_lib = loader(str(path))
132
133
  except OSError:
133
- msg = f'The {libname} library at {path} could not be loaded.'
134
+ msg = f"The {libname} library at {path} could not be loaded."
134
135
  warnings.warn(msg, UserWarning)
135
136
  opj_lib = None
136
137
 
@@ -143,13 +144,13 @@ def get_configdir():
143
144
  Default is $HOME/.config/glymur. You can override this with the
144
145
  XDG_CONFIG_HOME environment variable.
145
146
  """
146
- if 'XDG_CONFIG_HOME' in os.environ:
147
- return pathlib.Path(os.environ['XDG_CONFIG_HOME']) / 'glymur'
147
+ if "XDG_CONFIG_HOME" in os.environ:
148
+ return pathlib.Path(os.environ["XDG_CONFIG_HOME"]) / "glymur"
148
149
 
149
- if 'HOME' in os.environ and platform.system() != 'Windows':
150
+ if "HOME" in os.environ and platform.system() != "Windows":
150
151
  # HOME is set by WinPython to something unusual, so we don't
151
152
  # necessarily want that.
152
- return pathlib.Path(os.environ['HOME']) / '.config' / 'glymur'
153
+ return pathlib.Path(os.environ["HOME"]) / ".config" / "glymur"
153
154
 
154
155
  # Last stand. Should handle windows... others?
155
- return pathlib.Path.home() / 'glymur'
156
+ return pathlib.Path.home() / "glymur"
glymur/core.py CHANGED
@@ -11,18 +11,14 @@ STD = 0
11
11
  CINEMA2K = 3
12
12
  CINEMA4K = 4
13
13
 
14
- RSIZ = {
15
- 'STD': STD,
16
- 'CINEMA2K': CINEMA2K,
17
- 'CINEMA4K': CINEMA4K
18
- }
14
+ RSIZ = {"STD": STD, "CINEMA2K": CINEMA2K, "CINEMA4K": CINEMA4K}
19
15
 
20
16
  OFF = 0
21
17
  CINEMA2K_24 = 1
22
18
  CINEMA2K_48 = 2
23
19
  CINEMA4K_24 = 3
24
20
 
25
- OPJ_OFF = 0 # Not Digital Cinema
21
+ OPJ_OFF = 0 # Not Digital Cinema
26
22
  OPJ_CINEMA2K_24 = 1 # 2K Digital Cinema at 24 fps
27
23
  OPJ_CINEMA2K_48 = 2 # 2K Digital Cinema at 48 fps
28
24
  OPJ_CINEMA4K_24 = 3 # 4K Digital Cinema at 24 fps
@@ -77,11 +73,11 @@ OPJ_CINEMA_48_COMP = 520833
77
73
 
78
74
 
79
75
  PROGRESSION_ORDER = {
80
- 'LRCP': LRCP,
81
- 'RLCP': RLCP,
82
- 'RPCL': RPCL,
83
- 'PCRL': PCRL,
84
- 'CPRL': CPRL
76
+ "LRCP": LRCP,
77
+ "RLCP": RLCP,
78
+ "RPCL": RPCL,
79
+ "PCRL": PCRL,
80
+ "CPRL": CPRL,
85
81
  }
86
82
 
87
83
  WAVELET_XFORM_9X7_IRREVERSIBLE = 0
@@ -93,7 +89,7 @@ ANY_ICC_PROFILE = 3
93
89
  VENDOR_COLOR_METHOD = 4
94
90
 
95
91
  # Registration values for comment markers.
96
- RCME_BINARY = 0 # binary value comments
92
+ RCME_BINARY = 0 # binary value comments
97
93
  RCME_ISO_8859_1 = 1 # comments in latin-1 codec
98
94
 
99
95
  # enumerated colorspaces
@@ -106,12 +102,12 @@ ROMM_RGB = 21
106
102
 
107
103
 
108
104
  _COLORSPACE_MAP_DISPLAY = {
109
- CMYK: 'CMYK',
110
- SRGB: 'sRGB',
111
- GREYSCALE: 'greyscale',
112
- YCC: 'YCC',
113
- E_SRGB: 'e-sRGB',
114
- ROMM_RGB: 'ROMM-RGB',
105
+ CMYK: "CMYK",
106
+ SRGB: "sRGB",
107
+ GREYSCALE: "greyscale",
108
+ YCC: "YCC",
109
+ E_SRGB: "e-sRGB",
110
+ ROMM_RGB: "ROMM-RGB",
115
111
  }
116
112
 
117
113
  # enumerated color channel types
@@ -122,10 +118,10 @@ _UNSPECIFIED = 65535
122
118
 
123
119
 
124
120
  _COLOR_TYPE_MAP_DISPLAY = {
125
- COLOR: 'color',
126
- OPACITY: 'opacity',
127
- PRE_MULTIPLIED_OPACITY: 'pre-multiplied opacity',
128
- _UNSPECIFIED: 'unspecified',
121
+ COLOR: "color",
122
+ OPACITY: "opacity",
123
+ PRE_MULTIPLIED_OPACITY: "pre-multiplied opacity",
124
+ _UNSPECIFIED: "unspecified",
129
125
  }
130
126
 
131
127
  # color channel definitions.