python-libdiscid-1.0/0000775000175000017500000000000013031177544016572 5ustar sebastiansebastian00000000000000python-libdiscid-1.0/docs/0000775000175000017500000000000013031177544017522 5ustar sebastiansebastian00000000000000python-libdiscid-1.0/docs/api.compat.rst0000664000175000017500000000041512501036702022276 0ustar sebastiansebastian00000000000000libdiscid.compat package ^^^^^^^^^^^^^^^^^^^^^^^^ :mod:`discid` module ~~~~~~~~~~~~~~~~~~~~ The `discid` module provides the same interface as :py:mod:`discid`. Please have a look at its `documentation`__. .. __: https://python-discid.readthedocs.org/en/v1.0.2/api/ python-libdiscid-1.0/docs/api.rst0000664000175000017500000000055312501036702021017 0ustar sebastiansebastian00000000000000libdiscid package ----------------- :mod:`libdiscid` module ^^^^^^^^^^^^^^^^^^^^^^^ .. automodule:: libdiscid :members: Classes ~~~~~~~ .. autoclass:: libdiscid.DiscId :show-inheritance: :members: Exceptions ~~~~~~~~~~ .. autoexception:: libdiscid.DiscError :show-inheritance: :members: Subpackages ^^^^^^^^^^^ .. toctree:: api.compat python-libdiscid-1.0/docs/changelog.rst0000664000175000017500000000007612501036702022175 0ustar sebastiansebastian00000000000000Change log ---------- .. include:: ../changelog :literal: python-libdiscid-1.0/docs/conf.py0000664000175000017500000001345012501036702021013 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # # python-libdiscid documentation build configuration file, created by # sphinx-quickstart on Thu Apr 11 14:36:37 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os import distutils.command.build from distutils.dist import Distribution b = distutils.command.build.build(Distribution()) b.initialize_options() b.finalize_options() sys.path.insert(0, os.path.abspath( os.path.join('../', b.build_lib))) import libdiscid # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #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. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.extlinks' ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. source_encoding = 'UTF-8' # The master toctree document. master_doc = 'index' # General information about the project. project = u'python-libdiscid' copyright = u'2013, Sebastian Ramacher' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = libdiscid.__version__ # The full version, including alpha/beta/rc tags. release = libdiscid.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #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 # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #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 = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. 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 = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #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 # 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 # 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, # so a file named "default.css" will overwrite the builtin "default.css". 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' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. html_show_sourcelink = False # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'python-libdisciddoc' extlinks = { 'musicbrainz': ('http://musicbrainz.org/doc/%s', ''), } intersphinx_mapping = { 'python': ('http://docs.python.org/', None), 'pydiscid': ('https://python-discid.readthedocs.org/en/latest/', None), } python-libdiscid-1.0/docs/index.rst0000664000175000017500000000100212501036702021343 0ustar sebastiansebastian00000000000000python-libdiscid |release| ========================== `python-libdiscid` provides Python bindings for :musicbrainz:`libdiscid`. `libdiscid`'s main purpose is the calculation of :musicbrainz:`identifiers ` for audio discs to use for the MusicBrainz_ database. `python-libdiscid` is released under the :ref:`Expat license `. Contents ^^^^^^^^ .. toctree:: installation usage misc api changelog license Index ^^^^^ * :ref:`genindex` .. _MusicBrainz: http://musicbrainz.org python-libdiscid-1.0/docs/installation.rst0000664000175000017500000000552113031172514022750 0ustar sebastiansebastian00000000000000Installation ------------ Dependencies ^^^^^^^^^^^^ `python-libdiscid` depends on the following components: * :musicbrainz:`libdiscid` * `Cython`__ (>= 0.15) * `pkgconfig`__ Note that `Cython` is only required if one builds `python-libdiscid` from the repository. The released tarballs ship with pre-built C source files for the extension mdoules. If `pkgconfig` is installed, `setup.py` uses `libdiscid`'s `pkg-config` information to set include directories, libraries to link, etc. On Debian based systems, the dependencies are only an `apt-get` away:: apt-get install cython libdiscid-dev python-pkgconfig `Cython` and `pkgconfig` are also available via `PyPI`__:: pip install cython pip install pkgconfig .. __: http://www.cython.org/ .. __: https://github.com/matze/pkgconfig .. __: https://pypi.python.org Known supported distributions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `python-libdiscid` is available in some distributions: * `Debian `_ * `Ubuntu `_ PyPI ^^^^ `python-libdiscid` is available from `PyPI`__:: pip install python-libdiscid You can also download the tarball from `PyPI`__ manually, unpack it and run:: python setup.py install A note for Windows users ~~~~~~~~~~~~~~~~~~~~~~~~ There are eggs available from the same source too. With these eggs, the extension module comes pre-built. However, you still need to fetch `discid.dll` from :musicbrainz:`libdiscid` and copy the DLL to somewhere it can be found, e.g. to ``C:\WINDOWS\system32``. .. __: https://pypi.python.org/pypi/python-libdiscid/ .. __: https://pypi.python.org/pypi/python-libdiscid/ Building python-libdiscid locally ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you just want to try `python-libdiscid` without installing, please note that per default `setuptools` will build the extension module in ``build/lib.*`` and doesn't copy it to ``libdiscid``. There are many possible ways to work with this limitation: * Running:: python setup.py build_ext -i will copy the extension modules to ``libdiscid`` and one can hack right away. * Use `setuptools` ``develop`` command. Please read `setuptools`'s `documentation`__ for further information. * If you build with ``python setup.py build``, It is also possible to put ``build/lib.*`` before the source directory of `python-libdiscid` in ``sys.path``. Assuming that `python-libdiscid` is built on a 64 bit Linux and for `Python` 3.4, one can use the following lines to achieve that:: import sys, os sys.path.insert(0, os.path.abspath('build/lib.linux-x86_64-3.4')) import libdiscid Please note that modification to any file in the ``libdiscid`` directory will only be available after another run of ``python setup.py build``. .. __: http://pythonhosted.org/distribute/setuptools.html#development-mode python-libdiscid-1.0/docs/license.rst0000664000175000017500000000010412501036702021660 0ustar sebastiansebastian00000000000000.. _license: License ------- .. include:: ../LICENSE :literal: python-libdiscid-1.0/docs/misc.rst0000664000175000017500000000220613031174074021202 0ustar sebastiansebastian00000000000000Miscellaneous ------------- Bugs ^^^^ Please report bugs to the project's issue tracker at `GitHub`_. Supported libdiscid features ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `python-libdiscid` supports all the features introduced by `libdiscid` up to version 0.6.0, that is: * retrieval of the disc's Media Catalogue Number and retrieving the :musicbrainz:`International Standard Recording Code ` of the tracks if you are using `libdiscid` 0.4.0 and above. * selective reading support if you are using `libdiscid` 0.5.0 and above. * fuzzy TOC lookup if you are using `libdiscid` 0.6.0 and above. Please note that if `python-libdiscid` was built against versions of `libdiscid` prior to 0.4.0 or 0.5.0, `python-libdiscid` has to be rebuilt against the newer version to detect the features of the newer `libdiscid`. Other Python bindings ^^^^^^^^^^^^^^^^^^^^^ There are other Python bindings available. `python-discid`__ is the most prominent one. For a full list of bindings (including bindings for other languages) check musicbrainz:`libdiscid`. .. _GitHub: https://github.com/sebastinas/python-libdiscid .. __: https://github.com/JonnyJD/python-discid python-libdiscid-1.0/docs/usage.rst0000664000175000017500000000474013031173707021362 0ustar sebastiansebastian00000000000000Usage ----- Disc ID computation from a disc ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :func:`libdiscid.read` provides everything needed to read the information from a disc and compute the disc id:: from libdiscid import read disc = read() print("id: {}".format(disc.id)) If no additional arguments are passed to :func:`libdiscid.read`, it will read from :func:`libdiscid.default_device`. If reading is not supported on your platform, :py:exc:`NotImplementedError` will be raised. If anything goes wrong while reading from the device, :exc:`libdiscid.discid.DiscError` will be raised. To read from a different device than the default one, you can set ``device`` accordingly:: from libdiscid import read disc = read(device=u'/dev/cdrom1') print("id: {}".format(disc.id)) Starting with `libdiscid` 0.5.0, it is possible to explicitly state what should be read. For example, to read the MCN, one would use:: from libdiscid import read, FEATURE_MCN disc = read(features=FEATURE_MCN) # disc.id will be available print("id: {}".format(disc.id)) # if the disc has a MCN and libdiscid is 0.4.0 or later and libdiscid # supports reading the MCN on this platform, disc.mcn will be non-empty. try: print("MCN: {}".format(disc.mcn)) except NotImplementedError: print("MCN reading not supported on this platform/with this libdiscid") If you only want to get the disc id and do not care about the MCN and the ISCRs, you can tell that to :func:`libdiscid.read` by passing ``0`` or :data:`libdiscid.FEATURE_READ` to ``features``:: from libdiscid import read disc = read(features=0) Disc ID computation from data ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :func:`libdiscid.put` can be used to compute the disc ID based on the first and last track, the number of total sectors and track offsets:: from libdiscid import put disc = put(first_track, last_track, num_sectors, offsets) print("id: {}".format(disc.id)) Please note that :attr:`libdiscid.DiscId.mcn` and :attr:`libdiscid.DiscId.track_isrcs` will be empty after a call to :func:`libdiscid.put`. python-discid compat module ^^^^^^^^^^^^^^^^^^^^^^^^^^^ :mod:`libdiscid.compat.discid` provides the same API as :py:mod:`discid` from `python-discid` version 1.0.2. This allows applications to only care about one API and be usable with either of `python-libdiscid` or `python-discid` installed. Just use the following code to import the module:: try: from libdiscid.compat import discid except ImportError: import discid and then use the :py:mod:`discid` interface. python-libdiscid-1.0/libdiscid/0000775000175000017500000000000013031177544020520 5ustar sebastiansebastian00000000000000python-libdiscid-1.0/libdiscid/compat/0000775000175000017500000000000013031177544022003 5ustar sebastiansebastian00000000000000python-libdiscid-1.0/libdiscid/compat/__init__.py0000664000175000017500000000000012576077406024113 0ustar sebastiansebastian00000000000000python-libdiscid-1.0/libdiscid/compat/discid.py0000664000175000017500000001344012576077406023627 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ python-discid compat layer This module provides a compatible layer so that python-libdiscid can be used as a replacement for python-discid. It provides an interface compatible with python-discid version 1.0.2. """ import libdiscid import operator import functools import sys try: unicode except NameError: # 2/3 compat unicode = str _INVERSE_FEATURES= { libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_READ]: libdiscid.FEATURE_READ, libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_MCN]: libdiscid.FEATURE_MCN, libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_ISRC]: libdiscid.FEATURE_ISRC } class _NoneHelper(object): def __getattr__(self, name): if name in ('id', 'freedb_id', 'submission_url', 'toc', 'first_track', 'last_track', 'sectors', 'mcn'): return None return super(_NoneHelper, self).__getattr__(name) def _decode(string, encoding=None): # Let's do the same thing discid is doing. It always accepts both strings and # unicode objects and encodes/decodes them as it sees fit. libdiscid always # wants unicode objects, so let's decode it here on a best effort basis. if not isinstance(string, unicode): if encoding is None: encoding = sys.getfilesystemencoding() or 'ascii' return string.decode(encoding) return string # exceptions defined in discid DiscError = libdiscid.DiscError class TOCError(Exception): pass # classes defined in discid class Track(object): def __init__(self, disc, number): self.disc = disc self.number = number def __str__(self): return str(self.number) @property def offset(self): return self.disc.track_offsets[self.number - self.disc.first_track] @property def sectors(self): return self.disc.track_lengths[self.number - self.disc.first_track] length = sectors @property def seconds(self): return libdiscid.sectors_to_seconds(self.sectors) @property def isrc(self): try: value = self.disc.track_isrcs[self.number - self.disc.first_track] except NotImplementedError: return None return value if value != '' else None class Disc(object): def __init__(self): self.disc = _NoneHelper() self.tracks = [] def read(self, device, features=[]): self.disc = libdiscid.read(device, functools.reduce( operator.or_, ( _INVERSE_FEATURES[feature] for feature in features if feature in FEATURES ), 0)) self.tracks = [ Track(self.disc, numb) for numb in range(self.disc.first_track, self.disc.last_track + 1)] return True def put(self, first, last, disc_sectors, track_offsets): try: self.disc = libdiscid.put(first, last, disc_sectors, track_offsets) except DiscError as disc_error: raise TOCError(str(disc_error)) self.tracks = [ Track(self.disc, num) for num in range(self.disc.first_track, self.disc.last_track + 1)] return True @property def id(self): return self.disc.id @property def freedb_id(self): return self.disc.freedb_id @property def submission_url(self): return self.disc.submission_url @property def toc_string(self): return self.disc.toc @property def first_track_num(self): return self.disc.first_track @property def last_track_num(self): return self.disc.last_track @property def sectors(self): return self.disc.sectors length = sectors @property def seconds(self): return libdiscid.sectors_to_seconds(self.sectors) \ if self.sectors is not None else None @property def mcn(self): try: value = self.disc.mcn except NotImplementedError: return None return value if value != '' else None # functions defined in discid get_default_device = libdiscid.default_device def read(device=None, features=[]): disc = Disc() disc.read(_decode(device) if device is not None else None, map(lambda feature: _decode(feature, 'ascii'), features)) return disc def put(first, last, disc_sectors, track_offsets): disc = Disc() disc.put(first, last, disc_sectors, track_offsets) return disc # constants defined in discid __version__ = '1.1.0 (compat layer from python-libdiscid %s)' % \ (libdiscid.__version__, ) """ This is the version of python-discid this layer is compatible with. """ LIBDISCID_VERSION_STRING = libdiscid.__discid_version__ FEATURES = libdiscid.FEATURES FEATURES_IMPLEMENTED = (libdiscid.FEATURE_READ, libdiscid.FEATURE_MCN, libdiscid.FEATURE_ISRC) __all__ = ( 'read', 'put', 'get_default_device', '__version__', 'LIBDISCID_VERSION_STRING', 'FEATURES', 'FEATURES_IMPLEMENTED', 'Disc', 'DiscError', 'TOCError' ) python-libdiscid-1.0/libdiscid/tests/0000775000175000017500000000000013031177544021662 5ustar sebastiansebastian00000000000000python-libdiscid-1.0/libdiscid/tests/__init__.py0000664000175000017500000000000012576077406023772 0ustar sebastiansebastian00000000000000python-libdiscid-1.0/libdiscid/tests/common.py0000664000175000017500000000377113031171145023523 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Tests for the libdiscid module """ from __future__ import unicode_literals class PutSuccess(object): first = 1 last = 15 sectors = 258725 seconds = 3450 offsets = (150, 17510, 33275, 45910, 57805, 78310, 94650, 109580, 132010, 149160, 165115, 177710, 203325, 215555, 235590) track_seconds = (231, 210, 168, 159, 273, 218, 199, 299, 229, 213, 168, 342, 163, 267, 308) disc_id = 'TqvKjMu7dMliSfmVEBtrL7sBSno-' freedb_id = 'b60d770f' toc = ' '.join(map(str, [first, last, sectors] + list(offsets))) class _PutFail(object): sectors = 200 offsets = (1, 2, 3, 4, 5, 6, 7) class PutFail1(_PutFail): first = 13 last = 1 class PutFail2(_PutFail): first = 0 last = 10 class PutFail2_2(_PutFail): first = 100 last = 200 class PutFail3(_PutFail): first = 0 last = 0 class PutFail3_2(_PutFail): first = 1 last = 100 python-libdiscid-1.0/libdiscid/tests/test_compat_discid.py0000664000175000017500000001210113031171240026053 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Tests for the libdiscid.compat.discid module """ from __future__ import unicode_literals import unittest import libdiscid from libdiscid.compat import discid from libdiscid.compat.discid import DiscError, TOCError class TestCompatDiscID(unittest.TestCase): def test_default_device(self): self.assertIsNotNone(discid.get_default_device()) def test_features(self): self.assertIsNotNone(discid.FEATURES) def test_features_implementes(self): self.assertIsNotNone(discid.FEATURES_IMPLEMENTED) def test_empty_is_none(self): disc = discid.Disc() self.assertIsNone(disc.id) self.assertIsNone(disc.freedb_id) self.assertIsNone(disc.submission_url) self.assertIsNone(disc.toc_string) self.assertIsNone(disc.first_track_num) self.assertIsNone(disc.last_track_num) self.assertIsNone(disc.sectors) self.assertIsNone(disc.seconds) self.assertEqual(len(disc.tracks), 0) @unittest.skipIf(libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_READ] not in libdiscid.FEATURES, 'not available on this platform') def test_read_fail(self): self.assertRaises(DiscError, discid.read, '/does/not/exist') def test_read_None(self): try: discid.read() except (DiscError, NotImplementedError): pass @unittest.skipIf(libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_READ] not in libdiscid.FEATURES, 'not available on this platform') def test_encoded_device(self): self.assertRaises(DiscError, discid.read, '/does/not/exist') @unittest.skipIf(libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_READ] not in libdiscid.FEATURES, 'not available on this platform') def test_byte_device(self): self.assertRaises(DiscError, discid.read, b'/does/not/exist') def test_put(self): testdata = libdiscid.tests.common.PutSuccess disc = discid.put(testdata.first, testdata.last, testdata.sectors, testdata.offsets) self.assertIsNotNone(disc) self.assertEqual(disc.id, testdata.disc_id) self.assertEqual(disc.freedb_id, testdata.freedb_id) self.assertIsNotNone(disc.submission_url) self.assertEqual(disc.toc_string, testdata.toc) self.assertEqual(disc.first_track_num, testdata.first) self.assertEqual(disc.last_track_num, testdata.last) self.assertEqual(disc.sectors, testdata.sectors) self.assertEqual(disc.seconds, testdata.seconds) self.assertEqual(len(disc.tracks), len(testdata.offsets)) for track, offset, sec in zip(disc.tracks, testdata.offsets, testdata.track_seconds): self.assertEqual(track.offset, offset) self.assertEqual(track.seconds, sec) # ISRCs are not available if one calls put for track in disc.tracks: self.assertIsNone(track.isrc) # MCN is not available if one calls put self.assertIsNone(disc.mcn) def test_put_fail_1(self): # !(first < last) testdata = libdiscid.tests.common.PutFail1 self.assertRaises(TOCError, discid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) def test_put_fail_2(self): # !(first >= 1) testdata = libdiscid.tests.common.PutFail2 self.assertRaises(TOCError, discid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) # !(first < 100) testdata = libdiscid.tests.common.PutFail2_2 self.assertRaises(TOCError, discid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) def test_put_fail_3(self): # !(last >= 1) testdata = libdiscid.tests.common.PutFail3 self.assertRaises(TOCError, discid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) # !(last < 100) testdata = libdiscid.tests.common.PutFail3_2 self.assertRaises(TOCError, discid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) if __name__ == '__main__': unittest.main() python-libdiscid-1.0/libdiscid/tests/test_libdiscid.py0000664000175000017500000001255013031171251025211 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Tests for the libdiscid module """ from __future__ import unicode_literals import unittest import libdiscid import libdiscid.tests.common from libdiscid import DiscError class TestLibDiscId(unittest.TestCase): def test_version(self): self.assertIsNotNone(libdiscid.__version__) self.assertIsNotNone(libdiscid.__discid_version__) def test_default_device(self): self.assertIsNotNone(libdiscid.DEFAULT_DEVICE) def test_default_device_2(self): self.assertIsNotNone(libdiscid.default_device()) def test_features(self): self.assertIsNotNone(libdiscid.FEATURES) self.assertIsNotNone(libdiscid.FEATURE_READ) self.assertIsNotNone(libdiscid.FEATURE_MCN) self.assertIsNotNone(libdiscid.FEATURE_ISRC) self.assertIsNotNone(libdiscid.FEATURES_MAPPING) @unittest.skipIf(libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_READ] not in libdiscid.FEATURES, 'not available on this platform') def test_read_fail(self): self.assertRaises(DiscError, libdiscid.read, '/does/not/exist') def test_read_None(self): try: libdiscid.read() except (DiscError, NotImplementedError): pass @unittest.skipIf(libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_READ] in libdiscid.FEATURES, 'available on this platform') def test_read_not_implemented(self): self.assertRaises(NotImplementedError, libdiscid.read) def test_put(self): testdata = libdiscid.tests.common.PutSuccess disc = libdiscid.put(testdata.first, testdata.last, testdata.sectors, testdata.offsets) self.assertIsNotNone(disc) self.assertIsNone(disc.device) self.assertEqual(disc.id, testdata.disc_id) self.assertEqual(disc.freedb_id, testdata.freedb_id) self.assertIsNotNone(disc.submission_url) self.assertEqual(disc.first_track, testdata.first) self.assertEqual(disc.last_track, testdata.last) self.assertEqual(disc.sectors, testdata.sectors) self.assertEqual(disc.pregap, testdata.offsets[0]) self.assertEqual(disc.leadout_track, testdata.sectors) self.assertEqual(disc.toc, testdata.toc) self.assertEqual(len(disc.track_offsets), len(testdata.offsets)) for read_offset, expected_offset in zip(disc.track_offsets, testdata.offsets): self.assertEqual(read_offset, expected_offset) # ISRCs are not available if one calls put if libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_ISRC] in libdiscid.FEATURES: self.assertEqual(len(disc.track_isrcs), 15) for read_isrc in disc.track_isrcs: self.assertEqual(read_isrc, '') # MCN is not available if one calls put if libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_MCN] in libdiscid.FEATURES: self.assertEqual(disc.mcn, '') def test_put_fail_1(self): # !(first < last) testdata = libdiscid.tests.common.PutFail1 self.assertRaises(DiscError, libdiscid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) def test_put_fail_2(self): # !(first >= 1) testdata = libdiscid.tests.common.PutFail2 self.assertRaises(DiscError, libdiscid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) # !(first < 100) testdata = libdiscid.tests.common.PutFail2_2 self.assertRaises(DiscError, libdiscid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) def test_put_fail_3(self): # !(last >= 1) testdata = libdiscid.tests.common.PutFail3 self.assertRaises(DiscError, libdiscid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) # !(last < 100) testdata = libdiscid.tests.common.PutFail3_2 self.assertRaises(DiscError, libdiscid.put, testdata.first, testdata.last, testdata.sectors, testdata.offsets) def test_sectors_to_seconds(self): # there are 75 sectors per second for sectors in range(38): # round down for sectors in the first half self.assertEqual(libdiscid.sectors_to_seconds(sectors), 0) for sectors in range(38, 76): # round up for sectors in the second half self.assertEqual(libdiscid.sectors_to_seconds(sectors), 1) if __name__ == '__main__': unittest.main() python-libdiscid-1.0/libdiscid/__init__.py0000664000175000017500000002223013031164102022612 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Python bindings for libdiscid libdiscid is a library to calculate MusicBrainz Disc IDs. This module provides Python-bindings for libdiscid. >>> disc = libdiscid.read() >>> disc.id is not None True """ from __future__ import division import libdiscid._discid from libdiscid.exceptions import DiscError import re import warnings __version__ = '0.4.1' DEFAULT_DEVICE = libdiscid._discid.default_device() """ The default device to use for :func:`DiscId.read` on this platform. .. deprecated:: 0.2.0 Please use :func:`default_device` instead. """ FEATURES = libdiscid._discid.FEATURES """ List of all available features supported by libdiscid on this platform. """ FEATURE_READ = libdiscid._discid.FEATURE_READ """ Read the TOC of the disc to get the disc ID. This feature is always enabled. """ FEATURE_MCN = libdiscid._discid.FEATURE_MCN """ Read the Media Catalogue Number of the disc. """ FEATURE_ISRC = libdiscid._discid.FEATURE_ISRC """ Read :musicbrainz:`International Standard Recording Codes ` of all the tracks. """ FEATURES_MAPPING = libdiscid._discid.FEATURES_MAPPING """ Mapping between the constants representing a feature and their string representation. """ __discid_version__ = libdiscid._discid.__discid_version__ """ The version of the underlying libdiscid. """ class DiscId(object): """ Disc information Class holding all the information obtained from a disc. """ def __init__(self, cdiscid): self._id = cdiscid.id self._freedb_id = cdiscid.freedb_id self._submission_url = cdiscid.submission_url self._webservice_url = cdiscid.webservice_url self._first_track = cdiscid.first_track self._last_track = cdiscid.last_track self._sectors = cdiscid.sectors self._track_offsets = cdiscid.track_offsets self._track_lengths = cdiscid.track_lengths self._mcn = cdiscid.mcn self._track_isrcs = cdiscid.track_isrcs self._device = cdiscid.device self._toc = cdiscid.toc @property def id(self): """ The MusicBrainz :musicbrainz:`Disc ID`. """ return self._id @property def freedb_id(self): """ The :musicbrainz:`FreeDB` Disc ID (without category). """ return self._freedb_id @property def submission_url(self): """ Disc ID / TOC Submission URL for MusicBrainz With this url you can submit the current TOC as a new MusicBrainz :musicbrainz:`Disc ID`. """ return self._submission_url @property def webservice_url(self): """ The web service URL for info about the CD With this url you can retrieve information about the CD in XML from the MusicBrainz web service. """ warnings.warn('webservice_url is deprecated since it points to the old ' 'webservice. Please use python-musicbrainz-ngs to access ' 'the webservice.', DeprecationWarning) return self._webservice_url @property def first_track(self): """ Number of the first audio track. """ return self._first_track @property def last_track(self): """ Number of the last audio track. """ return self._last_track @property def sectors(self): """ Total sector count. """ return self._sectors @property def leadout_track(self): """ Leadout track. """ return self.sectors @property def track_offsets(self): """ Tuple of all track offsets (in sectors). The first element corresponds to the offset of the track denoted by :attr:`first_track` and so on. """ return self._track_offsets @property def pregap(self): """ Pregap of the first track (in sectors). """ return self.track_offsets[0] @property def track_lengths(self): """ Tuple of all track lengths (in sectors). The first element corresponds to the length of the track denoted by :attr:`first_track` and so on. """ return self._track_lengths @property def mcn(self): """ Media Catalogue Number of the disc. :raises NotImplementedError: reading MCN is not supported on this platform """ if self._mcn is None: raise NotImplementedError('MCN is not available with this version ' 'of libdiscid and/or platform') return self._mcn @property def track_isrcs(self): """ Tuple of :musicbrainz:`ISRCs ` of all tracks. The first element of the list corresponds to the ISRC of the :attr:`first_track` and so on. :raises NotImplementedError: reading ISRCs is not supported on this platform """ if self._track_isrcs is None: raise NotImplementedError('ISRC is not available with this version ' 'of libdiscid and/or platform') return self._track_isrcs @property def device(self): """ The device the data was read from. If it is ``None``, :func:`libdiscid.put` was called to create the instance. """ return self._device @property def toc(self): """ String representing the CD's Table of Contents (TOC). :raises ValueError: extracting TOC string from the submission URL failed """ if self._toc is None: # extract TOC string from submission URL match = re.match(r'.*toc=([0-9+]+)$', self.submission_url) if match is None: raise ValueError('Failed to extract TOC from submission URL') self._toc = match.group(1).replace('+', ' ') return self._toc def read(device=None, features=None): """ Reads the TOC from the device given as string. If *device* is ``None``, :func:`default_device` is used to determine the device. *features* can be any combination of :data:`FEATURE_MCN` and :data:`FEATURE_ISRC` and :data:`FEATURE_READ`. Note that prior to libdiscid version 0.5.0 *features* has no effect and that :data:`FEATURE_READ` is always assumed, even if not given. :param device: device to read from :type device: unicode or None :param features: selected features, possible values are :data:`FEATURE_READ` \ :data:`FEATURE_MCN`, :data:`FEATURE_ISRC` and any of these values combined \ with bitwise or. :type features: integer or None :raises libdiscid.DiscError: reading the disc failed :raises NotImplementedError: reading discs is not supported :raises MemoryError: failed to allocate the internal DiscId object :rtype: :class:`DiscId` object """ disc = libdiscid._discid.DiscId() if features is None: disc.read(device) else: disc.read(device, features) return DiscId(disc) def put(first, last, sectors, offsets): """ Creates a TOC based on the given offsets. Takes the *first* and *last* audio track, as well as the number of *sectors* and a list of *offsets* as in :attr:`track_offsets`. :param first: number of the first audio track :type first: integer :param last: number of the last audio track :type last: integer :param sectors: total number of sectors on the disc :type sectors: integer :param offsets: offsets of each track :type offsets: list or tuple of integers :raises libdiscid.DiscError: operation failed for some reason :raises MemoryError: failed to allocated memory to store the offsets or the \ internal DiscId object :rtype: :class:`DiscId` object """ disc = libdiscid._discid.DiscId() disc.put(first, last, sectors, offsets) return DiscId(disc) def default_device(): """ The default device on this platform. The default device can change during the run-time of the program. This can happen with removable devices for example. :rtype: unicode """ return libdiscid._discid.default_device() def sectors_to_seconds(sectors): """ Convert sectors to seconds rounded to the nearest second. :param sectors: number of sectors :type sectors: integer :rtype: integer """ SECTORS_PER_SECOND = 75 remainder = sectors % SECTORS_PER_SECOND return sectors // SECTORS_PER_SECOND + \ (1 if remainder > SECTORS_PER_SECOND // 2 else 0) __all__ = ( 'read', 'put', 'default_device', 'sectors_to_seconds', '__version__', '__discid_version__', 'FEATURES', 'FEATURES_MAPPING', 'FEATURE_READ', 'FEATURE_MCN', 'FEATURE_ISRC', 'DEFAULT_DEVICE', 'DiscId', 'DiscError' ) python-libdiscid-1.0/libdiscid/_discid.c0000664000175000017500000125262013031171072022260 0ustar sebastiansebastian00000000000000/* Generated by Cython 0.25.2b0 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [ "libdiscid/discid-wrapper.h" ], "libraries": "discid" }, "module_name": "libdiscid._discid" } END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_25_2b0" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef HAVE_LONG_LONG #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000) #define HAVE_LONG_LONG #endif #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 0 #undef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 0 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #undef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #undef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 1 #undef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 0 #undef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 0 #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #elif defined(PYSTON_VERSION) #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #undef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 0 #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #undef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 0 #undef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_PYSTON 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #ifndef CYTHON_USE_TYPE_SLOTS #define CYTHON_USE_TYPE_SLOTS 1 #endif #if PY_MAJOR_VERSION < 3 #undef CYTHON_USE_ASYNC_SLOTS #define CYTHON_USE_ASYNC_SLOTS 0 #elif !defined(CYTHON_USE_ASYNC_SLOTS) #define CYTHON_USE_ASYNC_SLOTS 1 #endif #if PY_VERSION_HEX < 0x02070000 #undef CYTHON_USE_PYLONG_INTERNALS #define CYTHON_USE_PYLONG_INTERNALS 0 #elif !defined(CYTHON_USE_PYLONG_INTERNALS) #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #ifndef CYTHON_USE_PYLIST_INTERNALS #define CYTHON_USE_PYLIST_INTERNALS 1 #endif #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif #if PY_VERSION_HEX < 0x030300F0 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) #define CYTHON_USE_UNICODE_WRITER 1 #endif #ifndef CYTHON_AVOID_BORROWED_REFS #define CYTHON_AVOID_BORROWED_REFS 0 #endif #ifndef CYTHON_ASSUME_SAFE_MACROS #define CYTHON_ASSUME_SAFE_MACROS 1 #endif #ifndef CYTHON_UNPACK_METHODS #define CYTHON_UNPACK_METHODS 1 #endif #ifndef CYTHON_FAST_THREAD_STATE #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL #define CYTHON_FAST_PYCALL 1 #endif #endif #if !defined(CYTHON_FAST_PYCCALL) #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #ifndef METH_FASTCALL #define METH_FASTCALL 0x80 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames); #else #define __Pyx_PyCFunctionFast _PyCFunctionFast #endif #if CYTHON_FAST_PYCCALL #define __Pyx_PyFastCFunction_Check(func)\ ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))))) #else #define __Pyx_PyFastCFunction_Check(func) 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 #define PyUnicode_2BYTE_KIND 2 #define PyUnicode_4BYTE_KIND 4 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check) #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #if CYTHON_COMPILING_IN_PYSTON #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno) #else #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0) #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if CYTHON_USE_ASYNC_SLOTS #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #else typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #endif #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_MAYBE_UNUSED_VAR # if defined(__cplusplus) template void CYTHON_MAYBE_UNUSED_VAR( const T& ) { } # else # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x) # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) #elif defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL) #define __Pyx_truncl trunc #else #define __Pyx_truncl truncl #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__libdiscid___discid #define __PYX_HAVE_API__libdiscid___discid #include #include "discid-wrapper.h" #include #include "pythread.h" #include #include #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "libdiscid/_discid.pyx", "type.pxd", "bool.pxd", "complex.pxd", }; /*--- Type declarations ---*/ struct __pyx_obj_9libdiscid_7_discid_DiscId; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr; /* "libdiscid/_discid.pyx":36 * return s.decode('UTF-8', 'strict') * * cdef class DiscId: # <<<<<<<<<<<<<< * """ Class to calculate MusicBrainz Disc IDs. * */ struct __pyx_obj_9libdiscid_7_discid_DiscId { PyObject_HEAD struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *__pyx_vtab; DiscId *_c_discid; PyBoolObject *_have_read; PyObject *_device; }; /* "libdiscid/_discid.pyx":188 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ { PyObject_HEAD struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self; }; /* "libdiscid/_discid.pyx":189 * * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr { PyObject_HEAD struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *__pyx_outer_scope; PyObject *__pyx_v_track; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; /* "libdiscid/_discid.pyx":199 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ { PyObject_HEAD struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self; }; /* "libdiscid/_discid.pyx":200 * * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr { PyObject_HEAD struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *__pyx_outer_scope; PyObject *__pyx_v_track; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; /* "libdiscid/_discid.pyx":219 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None */ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ { PyObject_HEAD struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self; }; /* "libdiscid/_discid.pyx":222 * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, # <<<<<<<<<<<<<< * track)) for * track in range(self.first_track, self.last_track + 1)) */ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr { PyObject_HEAD struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *__pyx_outer_scope; PyObject *__pyx_v_track; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; /* "libdiscid/_discid.pyx":36 * return s.decode('UTF-8', 'strict') * * cdef class DiscId: # <<<<<<<<<<<<<< * """ Class to calculate MusicBrainz Disc IDs. * */ struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId { PyObject *(*_read)(struct __pyx_obj_9libdiscid_7_discid_DiscId *, char *, unsigned int); PyObject *(*_put)(struct __pyx_obj_9libdiscid_7_discid_DiscId *, int, int, int *); PyObject *(*_get_error_msg)(struct __pyx_obj_9libdiscid_7_discid_DiscId *); }; static struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *__pyx_vtabptr_9libdiscid_7_discid_DiscId; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* ExtTypeTest.proto */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /* IncludeStringH.proto */ #include /* decode_c_string.proto */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* KeywordStringCheck.proto */ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyThreadStateGet.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #endif /* PyErrFetchRestore.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /* PyCFunctionFastCall.proto */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs); #else #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) #endif #endif /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* ArgTypeTest.proto */ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #else #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); #else #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif /* GetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb) static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif /* SwapException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif /* SaveResetException.proto */ #if CYTHON_FAST_THREAD_STATE #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); #else #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb) #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb) #endif /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); /* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__discid_feature(enum discid_feature value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntFromPy.proto */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /* CoroutineBase.proto */ typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD __pyx_coroutine_body_t body; PyObject *closure; PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; PyObject *gi_weakreflist; PyObject *classobj; PyObject *yieldfrom; PyObject *gi_name; PyObject *gi_qualname; PyObject *gi_modulename; int resume_label; char is_running; } __pyx_CoroutineObject; static __pyx_CoroutineObject *__Pyx__Coroutine_New( PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name); static int __Pyx_Coroutine_clear(PyObject *self); #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); #else #define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) #endif /* PatchModuleWithCoroutine.proto */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); /* PatchGeneratorABC.proto */ static int __Pyx_patch_abc(void); /* Generator.proto */ #define __Pyx_Generator_USED static PyTypeObject *__pyx_GeneratorType = 0; #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) #define __Pyx_Generator_New(body, closure, name, qualname, module_name)\ __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name) static PyObject *__Pyx_Generator_Next(PyObject *self); static int __pyx_Generator_init(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* PyIdentifierFromString.proto */ #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) #else #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) #endif #endif /* ModuleImport.proto */ static PyObject *__Pyx_ImportModule(const char *name); /* TypeImport.proto */ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); static PyObject *__pyx_f_9libdiscid_7_discid_6DiscId__read(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, char *__pyx_v_device, unsigned int __pyx_v_features); /* proto*/ static PyObject *__pyx_f_9libdiscid_7_discid_6DiscId__put(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, int __pyx_v_first, int __pyx_v_last, int *__pyx_v_offsets); /* proto*/ static PyObject *__pyx_f_9libdiscid_7_discid_6DiscId__get_error_msg(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto*/ /* Module declarations from 'libc.string' */ /* Module declarations from 'libdiscid.cdiscid' */ /* Module declarations from 'cpython.version' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* Module declarations from 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.ref' */ /* Module declarations from 'cpython.exc' */ /* Module declarations from 'cpython.module' */ /* Module declarations from 'cpython.mem' */ /* Module declarations from 'cpython.tuple' */ /* Module declarations from 'cpython.list' */ /* Module declarations from 'cpython.sequence' */ /* Module declarations from 'cpython.mapping' */ /* Module declarations from 'cpython.iterator' */ /* Module declarations from 'cpython.number' */ /* Module declarations from 'cpython.int' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.bool' */ static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0; /* Module declarations from 'cpython.long' */ /* Module declarations from 'cpython.float' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.complex' */ static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0; /* Module declarations from 'cpython.string' */ /* Module declarations from 'cpython.unicode' */ /* Module declarations from 'cpython.dict' */ /* Module declarations from 'cpython.instance' */ /* Module declarations from 'cpython.function' */ /* Module declarations from 'cpython.method' */ /* Module declarations from 'cpython.weakref' */ /* Module declarations from 'cpython.getargs' */ /* Module declarations from 'cpython.pythread' */ /* Module declarations from 'cpython.pystate' */ /* Module declarations from 'cpython.cobject' */ /* Module declarations from 'cpython.oldbuffer' */ /* Module declarations from 'cpython.set' */ /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.bytes' */ /* Module declarations from 'cpython.pycapsule' */ /* Module declarations from 'cpython' */ /* Module declarations from 'libc' */ /* Module declarations from 'libc.limits' */ /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'libdiscid._discid' */ static PyTypeObject *__pyx_ptype_9libdiscid_7_discid_DiscId = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct____get__ = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_1_genexpr = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_2___get__ = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_3_genexpr = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_4___get__ = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = 0; static PyBoolObject *__pyx_f_9libdiscid_7_discid__has_feature(int); /*proto*/ static PyObject *__pyx_f_9libdiscid_7_discid__to_unicode(char *); /*proto*/ static PyObject *__pyx_f_9libdiscid_7_discid__feature_list(void); /*proto*/ #define __Pyx_MODULE_NAME "libdiscid._discid" int __pyx_module_is_main_libdiscid___discid = 0; /* Implementation of 'libdiscid._discid' */ static PyObject *__pyx_builtin_MemoryError; static PyObject *__pyx_builtin_NotImplementedError; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_range; static const char __pyx_k_args[] = "args"; static const char __pyx_k_last[] = "last"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_send[] = "send"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_close[] = "close"; static const char __pyx_k_first[] = "first"; static const char __pyx_k_items[] = "items"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_device[] = "device"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_genexpr[] = "genexpr"; static const char __pyx_k_offsets[] = "offsets"; static const char __pyx_k_sectors[] = "sectors"; static const char __pyx_k_FEATURES[] = "FEATURES"; static const char __pyx_k_features[] = "features"; static const char __pyx_k_DiscError[] = "DiscError"; static const char __pyx_k_enumerate[] = "enumerate"; static const char __pyx_k_last_track[] = "last_track"; static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__"; static const char __pyx_k_FEATURE_MCN[] = "FEATURE_MCN"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_first_track[] = "first_track"; static const char __pyx_k_FEATURE_ISRC[] = "FEATURE_ISRC"; static const char __pyx_k_FEATURE_READ[] = "FEATURE_READ"; static const char __pyx_k_default_device[] = "default_device"; static const char __pyx_k_discid_version[] = "__discid_version__"; static const char __pyx_k_FEATURES_MAPPING[] = "FEATURES_MAPPING"; static const char __pyx_k_libdiscid__discid[] = "libdiscid._discid"; static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; static const char __pyx_k_libdiscid_exceptions[] = "libdiscid.exceptions"; static const char __pyx_k_DiscId___get___locals_genexpr[] = "DiscId.__get__..genexpr"; static const char __pyx_k_home_sebastian_development_pyth[] = "/home/sebastian/development/python-libdiscid/libdiscid/_discid.pyx"; static const char __pyx_k_read_is_not_available_with_this[] = "read is not available with this version of libdiscid and/or platform"; static const char __pyx_k_Failed_to_allocate_DiscId_object[] = "Failed to allocate DiscId object"; static const char __pyx_k_Failed_to_allocate_memory_to_sto[] = "Failed to allocate memory to store offsets"; static PyObject *__pyx_n_s_DiscError; static PyObject *__pyx_n_s_DiscId___get___locals_genexpr; static PyObject *__pyx_n_s_FEATURES; static PyObject *__pyx_n_s_FEATURES_MAPPING; static PyObject *__pyx_n_s_FEATURE_ISRC; static PyObject *__pyx_n_s_FEATURE_MCN; static PyObject *__pyx_n_s_FEATURE_READ; static PyObject *__pyx_kp_s_Failed_to_allocate_DiscId_object; static PyObject *__pyx_kp_s_Failed_to_allocate_memory_to_sto; static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_n_s_NotImplementedError; static PyObject *__pyx_n_s_args; static PyObject *__pyx_n_s_close; static PyObject *__pyx_n_s_default_device; static PyObject *__pyx_n_s_device; static PyObject *__pyx_n_s_discid_version; static PyObject *__pyx_n_s_enumerate; static PyObject *__pyx_n_s_features; static PyObject *__pyx_n_s_first; static PyObject *__pyx_n_s_first_track; static PyObject *__pyx_n_s_genexpr; static PyObject *__pyx_kp_s_home_sebastian_development_pyth; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_items; static PyObject *__pyx_n_s_last; static PyObject *__pyx_n_s_last_track; static PyObject *__pyx_n_s_libdiscid__discid; static PyObject *__pyx_n_s_libdiscid_exceptions; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_offsets; static PyObject *__pyx_n_s_pyx_vtable; static PyObject *__pyx_n_s_range; static PyObject *__pyx_kp_s_read_is_not_available_with_this; static PyObject *__pyx_n_s_sectors; static PyObject *__pyx_n_s_send; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_throw; static int __pyx_pf_9libdiscid_7_discid_6DiscId___cinit__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static void __pyx_pf_9libdiscid_7_discid_6DiscId_2__dealloc__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_4read(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, PyObject *__pyx_v_device, unsigned int __pyx_v_features); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_6put(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, int __pyx_v_first, int __pyx_v_last, int __pyx_v_sectors, PyObject *__pyx_v_offsets); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_2id___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_9freedb_id___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_14submission_url___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_14webservice_url___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_11first_track___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_10last_track___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_7sectors___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___genexpr(PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_offsets___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___genexpr(PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_lengths___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_3mcn___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___genexpr(PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_11track_isrcs___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_6device___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_3toc___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9libdiscid_7_discid_default_device(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_tp_new_9libdiscid_7_discid_DiscId(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct____get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_2___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_3_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_5_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static unsigned int __pyx_k__3; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__4; static PyObject *__pyx_codeobj__5; /* "libdiscid/_discid.pyx":30 * from libdiscid.exceptions import DiscError * * cdef bool _has_feature(int feature): # <<<<<<<<<<<<<< * return cdiscid.wrap_has_feature(feature) == 1 * */ static PyBoolObject *__pyx_f_9libdiscid_7_discid__has_feature(int __pyx_v_feature) { PyBoolObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_has_feature", 0); /* "libdiscid/_discid.pyx":31 * * cdef bool _has_feature(int feature): * return cdiscid.wrap_has_feature(feature) == 1 # <<<<<<<<<<<<<< * * cdef unicode _to_unicode(char* s): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_1 = __Pyx_PyBool_FromLong((wrap_has_feature(__pyx_v_feature) == 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_4bool_bool)))) __PYX_ERR(0, 31, __pyx_L1_error) __pyx_r = ((PyBoolObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":30 * from libdiscid.exceptions import DiscError * * cdef bool _has_feature(int feature): # <<<<<<<<<<<<<< * return cdiscid.wrap_has_feature(feature) == 1 * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid._has_feature", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":33 * return cdiscid.wrap_has_feature(feature) == 1 * * cdef unicode _to_unicode(char* s): # <<<<<<<<<<<<<< * return s.decode('UTF-8', 'strict') * */ static PyObject *__pyx_f_9libdiscid_7_discid__to_unicode(char *__pyx_v_s) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_to_unicode", 0); /* "libdiscid/_discid.pyx":34 * * cdef unicode _to_unicode(char* s): * return s.decode('UTF-8', 'strict') # <<<<<<<<<<<<<< * * cdef class DiscId: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 34, __pyx_L1_error) __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":33 * return cdiscid.wrap_has_feature(feature) == 1 * * cdef unicode _to_unicode(char* s): # <<<<<<<<<<<<<< * return s.decode('UTF-8', 'strict') * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid._to_unicode", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":52 * cdef unicode _device * * def __cinit__(self): # <<<<<<<<<<<<<< * self._c_discid = cdiscid.discid_new() * if self._c_discid is NULL: */ /* Python wrapper */ static int __pyx_pw_9libdiscid_7_discid_6DiscId_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_9libdiscid_7_discid_6DiscId_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId___cinit__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_9libdiscid_7_discid_6DiscId___cinit__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__cinit__", 0); /* "libdiscid/_discid.pyx":53 * * def __cinit__(self): * self._c_discid = cdiscid.discid_new() # <<<<<<<<<<<<<< * if self._c_discid is NULL: * raise MemoryError('Failed to allocate DiscId object') */ __pyx_v_self->_c_discid = discid_new(); /* "libdiscid/_discid.pyx":54 * def __cinit__(self): * self._c_discid = cdiscid.discid_new() * if self._c_discid is NULL: # <<<<<<<<<<<<<< * raise MemoryError('Failed to allocate DiscId object') * */ __pyx_t_1 = ((__pyx_v_self->_c_discid == NULL) != 0); if (__pyx_t_1) { /* "libdiscid/_discid.pyx":55 * self._c_discid = cdiscid.discid_new() * if self._c_discid is NULL: * raise MemoryError('Failed to allocate DiscId object') # <<<<<<<<<<<<<< * * self._have_read = False */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 55, __pyx_L1_error) /* "libdiscid/_discid.pyx":54 * def __cinit__(self): * self._c_discid = cdiscid.discid_new() * if self._c_discid is NULL: # <<<<<<<<<<<<<< * raise MemoryError('Failed to allocate DiscId object') * */ } /* "libdiscid/_discid.pyx":57 * raise MemoryError('Failed to allocate DiscId object') * * self._have_read = False # <<<<<<<<<<<<<< * self._device = None * */ __Pyx_INCREF(Py_False); __Pyx_GIVEREF(Py_False); __Pyx_GOTREF(__pyx_v_self->_have_read); __Pyx_DECREF(((PyObject *)__pyx_v_self->_have_read)); __pyx_v_self->_have_read = ((PyBoolObject *)Py_False); /* "libdiscid/_discid.pyx":58 * * self._have_read = False * self._device = None # <<<<<<<<<<<<<< * * def __dealloc__(self): */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_device); __Pyx_DECREF(__pyx_v_self->_device); __pyx_v_self->_device = ((PyObject*)Py_None); /* "libdiscid/_discid.pyx":52 * cdef unicode _device * * def __cinit__(self): # <<<<<<<<<<<<<< * self._c_discid = cdiscid.discid_new() * if self._c_discid is NULL: */ /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libdiscid._discid.DiscId.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":60 * self._device = None * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._c_discid is not NULL: * cdiscid.discid_free(self._c_discid) */ /* Python wrapper */ static void __pyx_pw_9libdiscid_7_discid_6DiscId_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_9libdiscid_7_discid_6DiscId_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_9libdiscid_7_discid_6DiscId_2__dealloc__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_9libdiscid_7_discid_6DiscId_2__dealloc__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); /* "libdiscid/_discid.pyx":61 * * def __dealloc__(self): * if self._c_discid is not NULL: # <<<<<<<<<<<<<< * cdiscid.discid_free(self._c_discid) * */ __pyx_t_1 = ((__pyx_v_self->_c_discid != NULL) != 0); if (__pyx_t_1) { /* "libdiscid/_discid.pyx":62 * def __dealloc__(self): * if self._c_discid is not NULL: * cdiscid.discid_free(self._c_discid) # <<<<<<<<<<<<<< * * cdef _read(self, char* device, unsigned int features): */ discid_free(__pyx_v_self->_c_discid); /* "libdiscid/_discid.pyx":61 * * def __dealloc__(self): * if self._c_discid is not NULL: # <<<<<<<<<<<<<< * cdiscid.discid_free(self._c_discid) * */ } /* "libdiscid/_discid.pyx":60 * self._device = None * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._c_discid is not NULL: * cdiscid.discid_free(self._c_discid) */ /* function exit code */ __Pyx_RefNannyFinishContext(); } /* "libdiscid/_discid.pyx":64 * cdiscid.discid_free(self._c_discid) * * cdef _read(self, char* device, unsigned int features): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_READ): * raise NotImplementedError('read is not available with this version of ' */ static PyObject *__pyx_f_9libdiscid_7_discid_6DiscId__read(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, char *__pyx_v_device, unsigned int __pyx_v_features) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("_read", 0); /* "libdiscid/_discid.pyx":65 * * cdef _read(self, char* device, unsigned int features): * if not _has_feature(cdiscid.DISCID_FEATURE_READ): # <<<<<<<<<<<<<< * raise NotImplementedError('read is not available with this version of ' * 'libdiscid and/or platform') */ __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__has_feature(DISCID_FEATURE_READ)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { /* "libdiscid/_discid.pyx":66 * cdef _read(self, char* device, unsigned int features): * if not _has_feature(cdiscid.DISCID_FEATURE_READ): * raise NotImplementedError('read is not available with this version of ' # <<<<<<<<<<<<<< * 'libdiscid and/or platform') * */ __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_NotImplementedError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 66, __pyx_L1_error) /* "libdiscid/_discid.pyx":65 * * cdef _read(self, char* device, unsigned int features): * if not _has_feature(cdiscid.DISCID_FEATURE_READ): # <<<<<<<<<<<<<< * raise NotImplementedError('read is not available with this version of ' * 'libdiscid and/or platform') */ } /* "libdiscid/_discid.pyx":69 * 'libdiscid and/or platform') * * if not cdiscid.wrap_read_sparse(self._c_discid, device, features): # <<<<<<<<<<<<<< * raise DiscError(self._get_error_msg()) * self._have_read = True */ __pyx_t_3 = ((!(wrap_read_sparse(__pyx_v_self->_c_discid, __pyx_v_device, __pyx_v_features) != 0)) != 0); if (__pyx_t_3) { /* "libdiscid/_discid.pyx":70 * * if not cdiscid.wrap_read_sparse(self._c_discid, device, features): * raise DiscError(self._get_error_msg()) # <<<<<<<<<<<<<< * self._have_read = True * */ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DiscError); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = ((struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *)__pyx_v_self->__pyx_vtab)->_get_error_msg(__pyx_v_self); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_6) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_5}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 70, __pyx_L1_error) /* "libdiscid/_discid.pyx":69 * 'libdiscid and/or platform') * * if not cdiscid.wrap_read_sparse(self._c_discid, device, features): # <<<<<<<<<<<<<< * raise DiscError(self._get_error_msg()) * self._have_read = True */ } /* "libdiscid/_discid.pyx":71 * if not cdiscid.wrap_read_sparse(self._c_discid, device, features): * raise DiscError(self._get_error_msg()) * self._have_read = True # <<<<<<<<<<<<<< * * def read(self, unicode device=None, unsigned int features=limits.UINT_MAX): */ __Pyx_INCREF(Py_True); __Pyx_GIVEREF(Py_True); __Pyx_GOTREF(__pyx_v_self->_have_read); __Pyx_DECREF(((PyObject *)__pyx_v_self->_have_read)); __pyx_v_self->_have_read = ((PyBoolObject *)Py_True); /* "libdiscid/_discid.pyx":64 * cdiscid.discid_free(self._c_discid) * * cdef _read(self, char* device, unsigned int features): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_READ): * raise NotImplementedError('read is not available with this version of ' */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("libdiscid._discid.DiscId._read", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":73 * self._have_read = True * * def read(self, unicode device=None, unsigned int features=limits.UINT_MAX): # <<<<<<<<<<<<<< * """ Reads the TOC from the device given as string. * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_5read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9libdiscid_7_discid_6DiscId_4read[] = " Reads the TOC from the device given as string.\n\n If *device* is ``None``, :func:`libdiscid.default_device` is used.\n *features* can be any combination of :data:`FEATURE_MCN` and\n :data:`FEATURE_ISRC` and :data:`FEATURE_READ`. Note that prior to libdiscid\n version 0.5.0 *features* has no effect and that :data:`FEATURE_READ` is\n always assumed, even if not given.\n\n A :exc:`libdiscid.DiscError` exception is raised when reading fails, and\n :py:exc:`NotImplementedError` when libdiscid does not support reading discs\n on the current platform.\n "; static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_5read(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_device = 0; unsigned int __pyx_v_features; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("read (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_device,&__pyx_n_s_features,0}; PyObject* values[2] = {0,0}; values[0] = ((PyObject*)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_device); if (value) { values[0] = value; kw_args--; } } case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_features); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "read") < 0)) __PYX_ERR(0, 73, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_device = ((PyObject*)values[0]); if (values[1]) { __pyx_v_features = __Pyx_PyInt_As_unsigned_int(values[1]); if (unlikely((__pyx_v_features == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 73, __pyx_L3_error) } else { __pyx_v_features = __pyx_k__3; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("read", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 73, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_device), (&PyUnicode_Type), 1, "device", 1))) __PYX_ERR(0, 73, __pyx_L1_error) __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_4read(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self), __pyx_v_device, __pyx_v_features); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_4read(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, PyObject *__pyx_v_device, unsigned int __pyx_v_features) { PyObject *__pyx_v_py_byte_device = NULL; char *__pyx_v_cdevice; CYTHON_UNUSED PyObject *__pyx_v_ret = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; char *__pyx_t_6; __Pyx_RefNannySetupContext("read", 0); __Pyx_INCREF(__pyx_v_device); /* "libdiscid/_discid.pyx":87 * """ * * if device is None: # <<<<<<<<<<<<<< * device = default_device() * */ __pyx_t_1 = (__pyx_v_device == ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* "libdiscid/_discid.pyx":88 * * if device is None: * device = default_device() # <<<<<<<<<<<<<< * * py_byte_device = device.encode('UTF-8') */ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_default_device); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (__pyx_t_5) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(PyUnicode_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 88, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_device, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":87 * """ * * if device is None: # <<<<<<<<<<<<<< * device = default_device() * */ } /* "libdiscid/_discid.pyx":90 * device = default_device() * * py_byte_device = device.encode('UTF-8') # <<<<<<<<<<<<<< * cdef char* cdevice = py_byte_device * ret = self._read(cdevice, features) */ if (unlikely(__pyx_v_device == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode"); __PYX_ERR(0, 90, __pyx_L1_error) } __pyx_t_3 = PyUnicode_AsUTF8String(__pyx_v_device); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_py_byte_device = __pyx_t_3; __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":91 * * py_byte_device = device.encode('UTF-8') * cdef char* cdevice = py_byte_device # <<<<<<<<<<<<<< * ret = self._read(cdevice, features) * self._device = device */ __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_py_byte_device); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 91, __pyx_L1_error) __pyx_v_cdevice = __pyx_t_6; /* "libdiscid/_discid.pyx":92 * py_byte_device = device.encode('UTF-8') * cdef char* cdevice = py_byte_device * ret = self._read(cdevice, features) # <<<<<<<<<<<<<< * self._device = device * */ __pyx_t_3 = ((struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *)__pyx_v_self->__pyx_vtab)->_read(__pyx_v_self, __pyx_v_cdevice, __pyx_v_features); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 92, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_v_ret = __pyx_t_3; __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":93 * cdef char* cdevice = py_byte_device * ret = self._read(cdevice, features) * self._device = device # <<<<<<<<<<<<<< * * cdef _put(self, int first, int last, int* offsets): */ __Pyx_INCREF(__pyx_v_device); __Pyx_GIVEREF(__pyx_v_device); __Pyx_GOTREF(__pyx_v_self->_device); __Pyx_DECREF(__pyx_v_self->_device); __pyx_v_self->_device = __pyx_v_device; /* "libdiscid/_discid.pyx":73 * self._have_read = True * * def read(self, unicode device=None, unsigned int features=limits.UINT_MAX): # <<<<<<<<<<<<<< * """ Reads the TOC from the device given as string. * */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("libdiscid._discid.DiscId.read", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_py_byte_device); __Pyx_XDECREF(__pyx_v_ret); __Pyx_XDECREF(__pyx_v_device); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":95 * self._device = device * * cdef _put(self, int first, int last, int* offsets): # <<<<<<<<<<<<<< * if not cdiscid.discid_put(self._c_discid, first, last, offsets): * raise DiscError(self._get_error_msg()) */ static PyObject *__pyx_f_9libdiscid_7_discid_6DiscId__put(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, int __pyx_v_first, int __pyx_v_last, int *__pyx_v_offsets) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("_put", 0); /* "libdiscid/_discid.pyx":96 * * cdef _put(self, int first, int last, int* offsets): * if not cdiscid.discid_put(self._c_discid, first, last, offsets): # <<<<<<<<<<<<<< * raise DiscError(self._get_error_msg()) * self._device = None */ __pyx_t_1 = ((!(discid_put(__pyx_v_self->_c_discid, __pyx_v_first, __pyx_v_last, __pyx_v_offsets) != 0)) != 0); if (__pyx_t_1) { /* "libdiscid/_discid.pyx":97 * cdef _put(self, int first, int last, int* offsets): * if not cdiscid.discid_put(self._c_discid, first, last, offsets): * raise DiscError(self._get_error_msg()) # <<<<<<<<<<<<<< * self._device = None * self._have_read = True */ __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DiscError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = ((struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *)__pyx_v_self->__pyx_vtab)->_get_error_msg(__pyx_v_self); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 97, __pyx_L1_error) /* "libdiscid/_discid.pyx":96 * * cdef _put(self, int first, int last, int* offsets): * if not cdiscid.discid_put(self._c_discid, first, last, offsets): # <<<<<<<<<<<<<< * raise DiscError(self._get_error_msg()) * self._device = None */ } /* "libdiscid/_discid.pyx":98 * if not cdiscid.discid_put(self._c_discid, first, last, offsets): * raise DiscError(self._get_error_msg()) * self._device = None # <<<<<<<<<<<<<< * self._have_read = True * */ __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_device); __Pyx_DECREF(__pyx_v_self->_device); __pyx_v_self->_device = ((PyObject*)Py_None); /* "libdiscid/_discid.pyx":99 * raise DiscError(self._get_error_msg()) * self._device = None * self._have_read = True # <<<<<<<<<<<<<< * * def put(self, int first, int last, int sectors, offsets): */ __Pyx_INCREF(Py_True); __Pyx_GIVEREF(Py_True); __Pyx_GOTREF(__pyx_v_self->_have_read); __Pyx_DECREF(((PyObject *)__pyx_v_self->_have_read)); __pyx_v_self->_have_read = ((PyBoolObject *)Py_True); /* "libdiscid/_discid.pyx":95 * self._device = device * * cdef _put(self, int first, int last, int* offsets): # <<<<<<<<<<<<<< * if not cdiscid.discid_put(self._c_discid, first, last, offsets): * raise DiscError(self._get_error_msg()) */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("libdiscid._discid.DiscId._put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":101 * self._have_read = True * * def put(self, int first, int last, int sectors, offsets): # <<<<<<<<<<<<<< * """ Creates a TOC based on the given offsets. * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_7put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_9libdiscid_7_discid_6DiscId_6put[] = " Creates a TOC based on the given offsets.\n\n Takes the *first* and *last* audio track, as well as the number of\n *sectors* and a list of *offsets* as in :attr:`DiscId.track_offsets`.\n\n If the operation fails for some reason, a :exc:`libdiscid.DiscError`\n exception is raised.\n "; static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_7put(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_first; int __pyx_v_last; int __pyx_v_sectors; PyObject *__pyx_v_offsets = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_first,&__pyx_n_s_last,&__pyx_n_s_sectors,&__pyx_n_s_offsets,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_first)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_last)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("put", 1, 4, 4, 1); __PYX_ERR(0, 101, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sectors)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("put", 1, 4, 4, 2); __PYX_ERR(0, 101, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_offsets)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("put", 1, 4, 4, 3); __PYX_ERR(0, 101, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "put") < 0)) __PYX_ERR(0, 101, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_first = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_last = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_sectors = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_sectors == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 101, __pyx_L3_error) __pyx_v_offsets = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("put", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 101, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_6put(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self), __pyx_v_first, __pyx_v_last, __pyx_v_sectors, __pyx_v_offsets); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_6put(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self, int __pyx_v_first, int __pyx_v_last, int __pyx_v_sectors, PyObject *__pyx_v_offsets) { int *__pyx_v_coffsets; PyObject *__pyx_v_i = NULL; PyObject *__pyx_v_v = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; int __pyx_t_7; Py_ssize_t __pyx_t_8; int __pyx_t_9; char const *__pyx_t_10; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; PyObject *__pyx_t_16 = NULL; __Pyx_RefNannySetupContext("put", 0); /* "libdiscid/_discid.pyx":111 * """ * * cdef int* coffsets = malloc((len(offsets) + 1) * sizeof(int)) # <<<<<<<<<<<<<< * if coffsets is NULL: * raise MemoryError('Failed to allocate memory to store offsets') */ __pyx_t_1 = PyObject_Length(__pyx_v_offsets); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 111, __pyx_L1_error) __pyx_v_coffsets = ((int *)malloc(((__pyx_t_1 + 1) * (sizeof(int))))); /* "libdiscid/_discid.pyx":112 * * cdef int* coffsets = malloc((len(offsets) + 1) * sizeof(int)) * if coffsets is NULL: # <<<<<<<<<<<<<< * raise MemoryError('Failed to allocate memory to store offsets') * */ __pyx_t_2 = ((__pyx_v_coffsets == NULL) != 0); if (__pyx_t_2) { /* "libdiscid/_discid.pyx":113 * cdef int* coffsets = malloc((len(offsets) + 1) * sizeof(int)) * if coffsets is NULL: * raise MemoryError('Failed to allocate memory to store offsets') # <<<<<<<<<<<<<< * * try: */ __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 113, __pyx_L1_error) /* "libdiscid/_discid.pyx":112 * * cdef int* coffsets = malloc((len(offsets) + 1) * sizeof(int)) * if coffsets is NULL: # <<<<<<<<<<<<<< * raise MemoryError('Failed to allocate memory to store offsets') * */ } /* "libdiscid/_discid.pyx":115 * raise MemoryError('Failed to allocate memory to store offsets') * * try: # <<<<<<<<<<<<<< * coffsets[0] = sectors * for (i, v) in enumerate(offsets): */ /*try:*/ { /* "libdiscid/_discid.pyx":116 * * try: * coffsets[0] = sectors # <<<<<<<<<<<<<< * for (i, v) in enumerate(offsets): * coffsets[i + 1] = v */ (__pyx_v_coffsets[0]) = __pyx_v_sectors; /* "libdiscid/_discid.pyx":117 * try: * coffsets[0] = sectors * for (i, v) in enumerate(offsets): # <<<<<<<<<<<<<< * coffsets[i + 1] = v * return self._put(first, last, coffsets) */ __Pyx_INCREF(__pyx_int_0); __pyx_t_3 = __pyx_int_0; if (likely(PyList_CheckExact(__pyx_v_offsets)) || PyTuple_CheckExact(__pyx_v_offsets)) { __pyx_t_4 = __pyx_v_offsets; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_5 = NULL; } else { __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_offsets); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L5_error) } for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 117, __pyx_L5_error) #else __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); #endif } else { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 117, __pyx_L5_error) #else __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); #endif } } else { __pyx_t_6 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_6)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 117, __pyx_L5_error) } break; } __Pyx_GOTREF(__pyx_t_6); } __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); __pyx_t_6 = 0; __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3); __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; /* "libdiscid/_discid.pyx":118 * coffsets[0] = sectors * for (i, v) in enumerate(offsets): * coffsets[i + 1] = v # <<<<<<<<<<<<<< * return self._put(first, last, coffsets) * finally: */ __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_v); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) __pyx_t_6 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PyIndex_AsSsize_t(__pyx_t_6); if (unlikely((__pyx_t_8 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_coffsets[__pyx_t_8]) = __pyx_t_7; /* "libdiscid/_discid.pyx":117 * try: * coffsets[0] = sectors * for (i, v) in enumerate(offsets): # <<<<<<<<<<<<<< * coffsets[i + 1] = v * return self._put(first, last, coffsets) */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":119 * for (i, v) in enumerate(offsets): * coffsets[i + 1] = v * return self._put(first, last, coffsets) # <<<<<<<<<<<<<< * finally: * free(coffsets) */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = ((struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *)__pyx_v_self->__pyx_vtab)->_put(__pyx_v_self, __pyx_v_first, __pyx_v_last, __pyx_v_coffsets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L4_return; } /* "libdiscid/_discid.pyx":121 * return self._put(first, last, coffsets) * finally: * free(coffsets) # <<<<<<<<<<<<<< * * cdef unicode _get_error_msg(self): */ /*finally:*/ { /*exception exit:*/{ __Pyx_PyThreadState_declare __pyx_L5_error:; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __Pyx_PyThreadState_assign __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_14, &__pyx_t_15, &__pyx_t_16); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13) < 0)) __Pyx_ErrFetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); __Pyx_XGOTREF(__pyx_t_11); __Pyx_XGOTREF(__pyx_t_12); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __pyx_t_7 = __pyx_lineno; __pyx_t_9 = __pyx_clineno; __pyx_t_10 = __pyx_filename; { free(__pyx_v_coffsets); } __Pyx_PyThreadState_assign if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_XGIVEREF(__pyx_t_16); __Pyx_ExceptionReset(__pyx_t_14, __pyx_t_15, __pyx_t_16); } __Pyx_XGIVEREF(__pyx_t_11); __Pyx_XGIVEREF(__pyx_t_12); __Pyx_XGIVEREF(__pyx_t_13); __Pyx_ErrRestore(__pyx_t_11, __pyx_t_12, __pyx_t_13); __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_lineno = __pyx_t_7; __pyx_clineno = __pyx_t_9; __pyx_filename = __pyx_t_10; goto __pyx_L1_error; } __pyx_L4_return: { __pyx_t_16 = __pyx_r; __pyx_r = 0; free(__pyx_v_coffsets); __pyx_r = __pyx_t_16; __pyx_t_16 = 0; goto __pyx_L0; } } /* "libdiscid/_discid.pyx":101 * self._have_read = True * * def put(self, int first, int last, int sectors, offsets): # <<<<<<<<<<<<<< * """ Creates a TOC based on the given offsets. * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("libdiscid._discid.DiscId.put", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_i); __Pyx_XDECREF(__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":123 * free(coffsets) * * cdef unicode _get_error_msg(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_error_msg(self._c_discid)) * */ static PyObject *__pyx_f_9libdiscid_7_discid_6DiscId__get_error_msg(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("_get_error_msg", 0); /* "libdiscid/_discid.pyx":124 * * cdef unicode _get_error_msg(self): * return _to_unicode(cdiscid.discid_get_error_msg(self._c_discid)) # <<<<<<<<<<<<<< * * property id: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(discid_get_error_msg(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":123 * free(coffsets) * * cdef unicode _get_error_msg(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_error_msg(self._c_discid)) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId._get_error_msg", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":130 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_id(self._c_discid)) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_2id_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_2id_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_2id___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_2id___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":131 * * def __get__(self): * return _to_unicode(cdiscid.discid_get_id(self._c_discid)) # <<<<<<<<<<<<<< * * property freedb_id: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(discid_get_id(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":130 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_id(self._c_discid)) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":137 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_freedb_id(self._c_discid)) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_9freedb_id_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_9freedb_id_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_9freedb_id___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_9freedb_id___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":138 * * def __get__(self): * return _to_unicode(cdiscid.discid_get_freedb_id(self._c_discid)) # <<<<<<<<<<<<<< * * property submission_url: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(discid_get_freedb_id(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":137 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_freedb_id(self._c_discid)) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.freedb_id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":147 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_submission_url(self._c_discid)) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_14submission_url_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_14submission_url_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_14submission_url___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_14submission_url___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":148 * * def __get__(self): * return _to_unicode(cdiscid.discid_get_submission_url(self._c_discid)) # <<<<<<<<<<<<<< * * property webservice_url: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(discid_get_submission_url(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":147 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_submission_url(self._c_discid)) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.submission_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":157 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_webservice_url(self._c_discid)) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_14webservice_url_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_14webservice_url_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_14webservice_url___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_14webservice_url___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":158 * * def __get__(self): * return _to_unicode(cdiscid.discid_get_webservice_url(self._c_discid)) # <<<<<<<<<<<<<< * * property first_track: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(discid_get_webservice_url(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":157 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_webservice_url(self._c_discid)) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.webservice_url.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":164 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_first_track_num(self._c_discid) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_11first_track_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_11first_track_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_11first_track___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_11first_track___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":165 * * def __get__(self): * return cdiscid.discid_get_first_track_num(self._c_discid) # <<<<<<<<<<<<<< * * property last_track: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(discid_get_first_track_num(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":164 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_first_track_num(self._c_discid) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.first_track.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":171 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_last_track_num(self._c_discid) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_10last_track_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_10last_track_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_10last_track___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_10last_track___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":172 * * def __get__(self): * return cdiscid.discid_get_last_track_num(self._c_discid) # <<<<<<<<<<<<<< * * property sectors: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(discid_get_last_track_num(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":171 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_last_track_num(self._c_discid) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.last_track.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":178 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_sectors(self._c_discid) * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_7sectors_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_7sectors_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_7sectors___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_7sectors___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":179 * * def __get__(self): * return cdiscid.discid_get_sectors(self._c_discid) # <<<<<<<<<<<<<< * * property track_offsets: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(discid_get_sectors(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":178 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_sectors(self._c_discid) * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.sectors.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":188 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_13track_offsets_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_13track_offsets_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_13track_offsets___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* "libdiscid/_discid.pyx":189 * * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___genexpr(PyObject *__pyx_self) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_1_genexpr(__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 189, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DiscId___get___locals_genexpr, __pyx_n_s_libdiscid__discid); if (unlikely(!gen)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.track_offsets.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 189, __pyx_L1_error) /* "libdiscid/_discid.pyx":190 * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) # <<<<<<<<<<<<<< * * property track_lengths: */ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 190, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_first_track); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 190, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_last_track); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 190, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 190, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 190, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 190, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_track); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_track, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":189 * * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 189, __pyx_L1_error) } __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_track); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_int(discid_get_track_offset(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_c_discid, __pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_2); __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 189, __pyx_L1_error) /* "libdiscid/_discid.pyx":190 * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) # <<<<<<<<<<<<<< * * property track_lengths: */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libdiscid/_discid.pyx":189 * * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":188 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_offsets___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __pyx_cur_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct____get__(__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct____get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 188, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); /* "libdiscid/_discid.pyx":189 * * def __get__(self): * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_pf_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":188 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libdiscid._discid.DiscId.track_offsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":199 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_13track_lengths_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_13track_lengths_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_13track_lengths___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* "libdiscid/_discid.pyx":200 * * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___genexpr(PyObject *__pyx_self) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_3_genexpr(__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_3_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 200, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___2generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DiscId___get___locals_genexpr, __pyx_n_s_libdiscid__discid); if (unlikely(!gen)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.track_lengths.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___2generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 200, __pyx_L1_error) /* "libdiscid/_discid.pyx":201 * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) # <<<<<<<<<<<<<< * * property mcn: */ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 201, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_first_track); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 201, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_last_track); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 201, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 201, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_track); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_track, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":200 * * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 200, __pyx_L1_error) } __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_track); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_int(discid_get_track_length(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_c_discid, __pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_2); __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 200, __pyx_L1_error) /* "libdiscid/_discid.pyx":201 * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) # <<<<<<<<<<<<<< * * property mcn: */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libdiscid/_discid.pyx":200 * * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":199 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_13track_lengths___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __pyx_cur_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_2___get__(__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_2___get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 199, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); /* "libdiscid/_discid.pyx":200 * * def __get__(self): * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) # <<<<<<<<<<<<<< * for track in range(self.first_track, self.last_track + 1)) * */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_pf_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":199 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return tuple(cdiscid.discid_get_track_length(self._c_discid, track) * for track in range(self.first_track, self.last_track + 1)) */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libdiscid._discid.DiscId.track_lengths.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":207 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): * return None */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_3mcn_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_3mcn_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_3mcn___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_3mcn___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":208 * * def __get__(self): * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): # <<<<<<<<<<<<<< * return None * return _to_unicode(cdiscid.wrap_get_mcn(self._c_discid)) */ __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__has_feature(DISCID_FEATURE_MCN)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { /* "libdiscid/_discid.pyx":209 * def __get__(self): * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): * return None # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.wrap_get_mcn(self._c_discid)) * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; /* "libdiscid/_discid.pyx":208 * * def __get__(self): * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): # <<<<<<<<<<<<<< * return None * return _to_unicode(cdiscid.wrap_get_mcn(self._c_discid)) */ } /* "libdiscid/_discid.pyx":210 * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): * return None * return _to_unicode(cdiscid.wrap_get_mcn(self._c_discid)) # <<<<<<<<<<<<<< * * property track_isrcs: */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(wrap_get_mcn(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":207 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): * return None */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.DiscId.mcn.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":219 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_11track_isrcs_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_11track_isrcs_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_11track_isrcs___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___2generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* "libdiscid/_discid.pyx":222 * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, # <<<<<<<<<<<<<< * track)) for * track in range(self.first_track, self.last_track + 1)) */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___genexpr(PyObject *__pyx_self) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_5_genexpr(__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_5_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 222, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___2generator2, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DiscId___get___locals_genexpr, __pyx_n_s_libdiscid__discid); if (unlikely(!gen)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.track_isrcs.__get__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___2generator2(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *__pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 222, __pyx_L1_error) /* "libdiscid/_discid.pyx":224 * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, * track)) for * track in range(self.first_track, self.last_track + 1)) # <<<<<<<<<<<<<< * * property device: */ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 224, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_first_track); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 224, __pyx_L1_error) } __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self), __pyx_n_s_last_track); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 224, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 224, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 224, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_track); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_track, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":222 * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, # <<<<<<<<<<<<<< * track)) for * track in range(self.first_track, self.last_track + 1)) */ if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 222, __pyx_L1_error) } /* "libdiscid/_discid.pyx":223 * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, * track)) for # <<<<<<<<<<<<<< * track in range(self.first_track, self.last_track + 1)) * */ __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_cur_scope->__pyx_v_track); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L1_error) /* "libdiscid/_discid.pyx":222 * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, # <<<<<<<<<<<<<< * track)) for * track in range(self.first_track, self.last_track + 1)) */ __pyx_t_3 = __pyx_f_9libdiscid_7_discid__to_unicode(wrap_get_track_isrc(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_c_discid, __pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; __pyx_cur_scope->__pyx_t_1 = __pyx_t_4; __pyx_cur_scope->__pyx_t_2 = __pyx_t_5; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_2); __pyx_t_4 = __pyx_cur_scope->__pyx_t_1; __pyx_t_5 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 222, __pyx_L1_error) /* "libdiscid/_discid.pyx":223 * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, * track)) for # <<<<<<<<<<<<<< * track in range(self.first_track, self.last_track + 1)) * */ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); /* "libdiscid/_discid.pyx":222 * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, # <<<<<<<<<<<<<< * track)) for * track in range(self.first_track, self.last_track + 1)) */ /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":219 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None */ static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_11track_isrcs___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __pyx_cur_scope = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_4___get__(__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_4___get__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)Py_None); __Pyx_INCREF(Py_None); __PYX_ERR(0, 219, __pyx_L1_error) } else { __Pyx_GOTREF(__pyx_cur_scope); } __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); /* "libdiscid/_discid.pyx":220 * * def __get__(self): * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): # <<<<<<<<<<<<<< * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, */ __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__has_feature(DISCID_FEATURE_ISRC)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 220, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!__pyx_t_2) != 0); if (__pyx_t_3) { /* "libdiscid/_discid.pyx":221 * def __get__(self): * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None # <<<<<<<<<<<<<< * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, * track)) for */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; /* "libdiscid/_discid.pyx":220 * * def __get__(self): * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): # <<<<<<<<<<<<<< * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, */ } /* "libdiscid/_discid.pyx":222 * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None * return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, # <<<<<<<<<<<<<< * track)) for * track in range(self.first_track, self.last_track + 1)) */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_pf_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PySequence_Tuple(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":219 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): * return None */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("libdiscid._discid.DiscId.track_isrcs.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":232 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return self._device * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_6device_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_6device_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_6device___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_6device___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":233 * * def __get__(self): * return self._device # <<<<<<<<<<<<<< * * property toc: */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_device); __pyx_r = __pyx_v_self->_device; goto __pyx_L0; /* "libdiscid/_discid.pyx":232 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return self._device * */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":239 * """ * * def __get__(self): # <<<<<<<<<<<<<< * assert self._have_read * */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_3toc_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_9libdiscid_7_discid_6DiscId_3toc_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_6DiscId_3toc___get__(((struct __pyx_obj_9libdiscid_7_discid_DiscId *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_6DiscId_3toc___get__(struct __pyx_obj_9libdiscid_7_discid_DiscId *__pyx_v_self) { char *__pyx_v_tocstr; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__get__", 0); /* "libdiscid/_discid.pyx":240 * * def __get__(self): * assert self._have_read # <<<<<<<<<<<<<< * * cdef char* tocstr = cdiscid.wrap_get_toc(self._c_discid) */ #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_have_read)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 240, __pyx_L1_error) } } #endif /* "libdiscid/_discid.pyx":242 * assert self._have_read * * cdef char* tocstr = cdiscid.wrap_get_toc(self._c_discid) # <<<<<<<<<<<<<< * if tocstr is not NULL: * return _to_unicode(tocstr) */ __pyx_v_tocstr = wrap_get_toc(__pyx_v_self->_c_discid); /* "libdiscid/_discid.pyx":243 * * cdef char* tocstr = cdiscid.wrap_get_toc(self._c_discid) * if tocstr is not NULL: # <<<<<<<<<<<<<< * return _to_unicode(tocstr) * return None */ __pyx_t_1 = ((__pyx_v_tocstr != NULL) != 0); if (__pyx_t_1) { /* "libdiscid/_discid.pyx":244 * cdef char* tocstr = cdiscid.wrap_get_toc(self._c_discid) * if tocstr is not NULL: * return _to_unicode(tocstr) # <<<<<<<<<<<<<< * return None * */ __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __pyx_f_9libdiscid_7_discid__to_unicode(__pyx_v_tocstr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":243 * * cdef char* tocstr = cdiscid.wrap_get_toc(self._c_discid) * if tocstr is not NULL: # <<<<<<<<<<<<<< * return _to_unicode(tocstr) * return None */ } /* "libdiscid/_discid.pyx":245 * if tocstr is not NULL: * return _to_unicode(tocstr) * return None # <<<<<<<<<<<<<< * * FEATURES_MAPPING = { */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; /* "libdiscid/_discid.pyx":239 * """ * * def __get__(self): # <<<<<<<<<<<<<< * assert self._have_read * */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("libdiscid._discid.DiscId.toc.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":253 * } * * cdef _feature_list(): # <<<<<<<<<<<<<< * res = [] * for f, s in FEATURES_MAPPING.items(): */ static PyObject *__pyx_f_9libdiscid_7_discid__feature_list(void) { PyObject *__pyx_v_res = NULL; PyObject *__pyx_v_f = NULL; PyObject *__pyx_v_s = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); int __pyx_t_9; int __pyx_t_10; int __pyx_t_11; __Pyx_RefNannySetupContext("_feature_list", 0); /* "libdiscid/_discid.pyx":254 * * cdef _feature_list(): * res = [] # <<<<<<<<<<<<<< * for f, s in FEATURES_MAPPING.items(): * if _has_feature(f): */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_res = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* "libdiscid/_discid.pyx":255 * cdef _feature_list(): * res = [] * for f, s in FEATURES_MAPPING.items(): # <<<<<<<<<<<<<< * if _has_feature(f): * res.append(s) */ __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_FEATURES_MAPPING); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_items); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 255, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 255, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 255, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; #if !CYTHON_COMPILING_IN_PYPY Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 255, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 255, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 255, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_6); __pyx_t_6 = 0; /* "libdiscid/_discid.pyx":256 * res = [] * for f, s in FEATURES_MAPPING.items(): * if _has_feature(f): # <<<<<<<<<<<<<< * res.append(s) * return res */ __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_f); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 256, __pyx_L1_error) __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__has_feature(__pyx_t_9)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_10) { /* "libdiscid/_discid.pyx":257 * for f, s in FEATURES_MAPPING.items(): * if _has_feature(f): * res.append(s) # <<<<<<<<<<<<<< * return res * */ __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_res, __pyx_v_s); if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 257, __pyx_L1_error) /* "libdiscid/_discid.pyx":256 * res = [] * for f, s in FEATURES_MAPPING.items(): * if _has_feature(f): # <<<<<<<<<<<<<< * res.append(s) * return res */ } /* "libdiscid/_discid.pyx":255 * cdef _feature_list(): * res = [] * for f, s in FEATURES_MAPPING.items(): # <<<<<<<<<<<<<< * if _has_feature(f): * res.append(s) */ } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":258 * if _has_feature(f): * res.append(s) * return res # <<<<<<<<<<<<<< * * def default_device(): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_res); __pyx_r = __pyx_v_res; goto __pyx_L0; /* "libdiscid/_discid.pyx":253 * } * * cdef _feature_list(): # <<<<<<<<<<<<<< * res = [] * for f, s in FEATURES_MAPPING.items(): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("libdiscid._discid._feature_list", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_res); __Pyx_XDECREF(__pyx_v_f); __Pyx_XDECREF(__pyx_v_s); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":260 * return res * * def default_device(): # <<<<<<<<<<<<<< * """ The default device on this platform. * """ */ /* Python wrapper */ static PyObject *__pyx_pw_9libdiscid_7_discid_1default_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_9libdiscid_7_discid_default_device[] = " The default device on this platform.\n "; static PyMethodDef __pyx_mdef_9libdiscid_7_discid_1default_device = {"default_device", (PyCFunction)__pyx_pw_9libdiscid_7_discid_1default_device, METH_NOARGS, __pyx_doc_9libdiscid_7_discid_default_device}; static PyObject *__pyx_pw_9libdiscid_7_discid_1default_device(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("default_device (wrapper)", 0); __pyx_r = __pyx_pf_9libdiscid_7_discid_default_device(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_9libdiscid_7_discid_default_device(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("default_device", 0); /* "libdiscid/_discid.pyx":264 * """ * * return _to_unicode(cdiscid.discid_get_default_device()) # <<<<<<<<<<<<<< * * FEATURES = _feature_list() */ __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(discid_get_default_device()); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 264, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* "libdiscid/_discid.pyx":260 * return res * * def default_device(): # <<<<<<<<<<<<<< * """ The default device on this platform. * """ */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("libdiscid._discid.default_device", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId __pyx_vtable_9libdiscid_7_discid_DiscId; static PyObject *__pyx_tp_new_9libdiscid_7_discid_DiscId(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_9libdiscid_7_discid_DiscId *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_9libdiscid_7_discid_DiscId *)o); p->__pyx_vtab = __pyx_vtabptr_9libdiscid_7_discid_DiscId; p->_have_read = ((PyBoolObject *)Py_None); Py_INCREF(Py_None); p->_device = ((PyObject*)Py_None); Py_INCREF(Py_None); if (unlikely(__pyx_pw_9libdiscid_7_discid_6DiscId_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; return o; bad: Py_DECREF(o); o = 0; return NULL; } static void __pyx_tp_dealloc_9libdiscid_7_discid_DiscId(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid_DiscId *p = (struct __pyx_obj_9libdiscid_7_discid_DiscId *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_9libdiscid_7_discid_6DiscId_3__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->_have_read); Py_CLEAR(p->_device); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_9libdiscid_7_discid_DiscId(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid_DiscId *p = (struct __pyx_obj_9libdiscid_7_discid_DiscId *)o; if (p->_have_read) { e = (*v)(((PyObject*)p->_have_read), a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid_DiscId(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid_DiscId *p = (struct __pyx_obj_9libdiscid_7_discid_DiscId *)o; tmp = ((PyObject*)p->_have_read); p->_have_read = ((PyBoolObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_id(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_2id_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_freedb_id(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_9freedb_id_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_submission_url(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_14submission_url_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_webservice_url(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_14webservice_url_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_first_track(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_11first_track_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_last_track(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_10last_track_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_sectors(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_7sectors_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_track_offsets(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_13track_offsets_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_track_lengths(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_13track_lengths_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_mcn(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_3mcn_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_track_isrcs(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_11track_isrcs_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_device(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_6device_1__get__(o); } static PyObject *__pyx_getprop_9libdiscid_7_discid_6DiscId_toc(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_9libdiscid_7_discid_6DiscId_3toc_1__get__(o); } static PyMethodDef __pyx_methods_9libdiscid_7_discid_DiscId[] = { {"read", (PyCFunction)__pyx_pw_9libdiscid_7_discid_6DiscId_5read, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9libdiscid_7_discid_6DiscId_4read}, {"put", (PyCFunction)__pyx_pw_9libdiscid_7_discid_6DiscId_7put, METH_VARARGS|METH_KEYWORDS, __pyx_doc_9libdiscid_7_discid_6DiscId_6put}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_9libdiscid_7_discid_DiscId[] = { {(char *)"id", __pyx_getprop_9libdiscid_7_discid_6DiscId_id, 0, (char *)" The MusicBrainz :musicbrainz:`Disc ID`.\n ", 0}, {(char *)"freedb_id", __pyx_getprop_9libdiscid_7_discid_6DiscId_freedb_id, 0, (char *)" The :musicbrainz:`FreeDB` Disc ID (without category).\n ", 0}, {(char *)"submission_url", __pyx_getprop_9libdiscid_7_discid_6DiscId_submission_url, 0, (char *)" Disc ID / TOC Submission URL for MusicBrainz\n\n With this url you can submit the current TOC as a new MusicBrainz\n :musicbrainz:`Disc ID`.\n ", 0}, {(char *)"webservice_url", __pyx_getprop_9libdiscid_7_discid_6DiscId_webservice_url, 0, (char *)" The web service URL for info about the CD\n\n With this url you can retrieve information about the CD in XML from the\n MusicBrainz web service.\n ", 0}, {(char *)"first_track", __pyx_getprop_9libdiscid_7_discid_6DiscId_first_track, 0, (char *)" Number of the first audio track.\n ", 0}, {(char *)"last_track", __pyx_getprop_9libdiscid_7_discid_6DiscId_last_track, 0, (char *)" Number of the last audio track.\n ", 0}, {(char *)"sectors", __pyx_getprop_9libdiscid_7_discid_6DiscId_sectors, 0, (char *)" Total sector count.\n ", 0}, {(char *)"track_offsets", __pyx_getprop_9libdiscid_7_discid_6DiscId_track_offsets, 0, (char *)" Tuple of all track offsets (in sectors).\n\n The first element corresponds to the offset of the track denoted by\n :attr:`first_track` and so on.\n ", 0}, {(char *)"track_lengths", __pyx_getprop_9libdiscid_7_discid_6DiscId_track_lengths, 0, (char *)" Tuple of all track lengths (in sectors).\n\n The first element corresponds to the length of the track denoted by\n :attr:`first_track` and so on.\n ", 0}, {(char *)"mcn", __pyx_getprop_9libdiscid_7_discid_6DiscId_mcn, 0, (char *)" Media Catalogue Number of the disc.\n ", 0}, {(char *)"track_isrcs", __pyx_getprop_9libdiscid_7_discid_6DiscId_track_isrcs, 0, (char *)" Tuple of :musicbrainz:`ISRCs ` of all tracks.\n\n The first element of the list corresponds to the ISRC of the\n :attr:`first_track` and so on.\n ", 0}, {(char *)"device", __pyx_getprop_9libdiscid_7_discid_6DiscId_device, 0, (char *)" The device the data was read from.\n\n If it is ``None``, :func:`libdiscid.put` was called to create the instance.\n ", 0}, {(char *)"toc", __pyx_getprop_9libdiscid_7_discid_6DiscId_toc, 0, (char *)" String representing the CD's Table of Contents (TOC).\n ", 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid_DiscId = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.DiscId", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid_DiscId), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid_DiscId, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ " Class to calculate MusicBrainz Disc IDs.\n\n >>> d = DiscId()\n >>> d.read()\n >>> d.id is not None\n True\n\n Note that all the properties are only set after an successful call to\n :func:`DiscId.read` or :func:`DiscId.put`.\n ", /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid_DiscId, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid_DiscId, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_9libdiscid_7_discid_DiscId, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_9libdiscid_7_discid_DiscId, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid_DiscId, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct____get__[8]; static int __pyx_freecount_9libdiscid_7_discid___pyx_scope_struct____get__ = 0; static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct____get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct____get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__)))) { o = (PyObject*)__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct____get__[--__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct____get__]; memset(o, 0, sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct____get__(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct____get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__)))) { __pyx_freelist_9libdiscid_7_discid___pyx_scope_struct____get__[__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct____get__++] = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct____get__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct____get__(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)o; tmp = ((PyObject*)p->__pyx_v_self); p->__pyx_v_self = ((struct __pyx_obj_9libdiscid_7_discid_DiscId *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__ = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.__pyx_scope_struct____get__", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct____get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct____get__, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct____get__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct____get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_1_genexpr[8]; static int __pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_1_genexpr = 0; static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr)))) { o = (PyObject*)__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_1_genexpr[--__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_1_genexpr]; memset(o, 0, sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_1_genexpr(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_track); Py_CLEAR(p->__pyx_t_0); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr)))) { __pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_1_genexpr[__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } if (p->__pyx_v_track) { e = (*v)(p->__pyx_v_track, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_1_genexpr(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); p->__pyx_outer_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_track); p->__pyx_v_track = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_1_genexpr = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.__pyx_scope_struct_1_genexpr", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_1_genexpr, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_1_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_1_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_2___get__[8]; static int __pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_2___get__ = 0; static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_2___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_2___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__)))) { o = (PyObject*)__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_2___get__[--__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_2___get__]; memset(o, 0, sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_2___get__(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_2___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__)))) { __pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_2___get__[__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_2___get__++] = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_2___get__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_2___get__(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)o; tmp = ((PyObject*)p->__pyx_v_self); p->__pyx_v_self = ((struct __pyx_obj_9libdiscid_7_discid_DiscId *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_2___get__ = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.__pyx_scope_struct_2___get__", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_2___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_2___get__, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_2___get__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_2___get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_3_genexpr[8]; static int __pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_3_genexpr = 0; static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_3_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_3_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr)))) { o = (PyObject*)__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_3_genexpr[--__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_3_genexpr]; memset(o, 0, sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_3_genexpr(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_track); Py_CLEAR(p->__pyx_t_0); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_3_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr)))) { __pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_3_genexpr[__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_3_genexpr++] = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_3_genexpr(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } if (p->__pyx_v_track) { e = (*v)(p->__pyx_v_track, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_3_genexpr(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); p->__pyx_outer_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_track); p->__pyx_v_track = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_3_genexpr = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.__pyx_scope_struct_3_genexpr", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_3_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_3_genexpr, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_3_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_3_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_4___get__[8]; static int __pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_4___get__ = 0; static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_4___get__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_4___get__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__)))) { o = (PyObject*)__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_4___get__[--__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_4___get__]; memset(o, 0, sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_4___get__(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_4___get__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__)))) { __pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_4___get__[__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_4___get__++] = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_4___get__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)o; if (p->__pyx_v_self) { e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_4___get__(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)o; tmp = ((PyObject*)p->__pyx_v_self); p->__pyx_v_self = ((struct __pyx_obj_9libdiscid_7_discid_DiscId *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_4___get__ = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.__pyx_scope_struct_4___get__", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_4___get__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_4___get__, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_4___get__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_4___get__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_5_genexpr[8]; static int __pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = 0; static PyObject *__pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_5_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_5_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr)))) { o = (PyObject*)__pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_5_genexpr[--__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_5_genexpr]; memset(o, 0, sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_5_genexpr(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_track); Py_CLEAR(p->__pyx_t_0); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_5_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr)))) { __pyx_freelist_9libdiscid_7_discid___pyx_scope_struct_5_genexpr[__pyx_freecount_9libdiscid_7_discid___pyx_scope_struct_5_genexpr++] = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_5_genexpr(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } if (p->__pyx_v_track) { e = (*v)(p->__pyx_v_track, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_5_genexpr(PyObject *o) { PyObject* tmp; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); p->__pyx_outer_scope = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_track); p->__pyx_v_track = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = { PyVarObject_HEAD_INIT(0, 0) "libdiscid._discid.__pyx_scope_struct_5_genexpr", /*tp_name*/ sizeof(struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_9libdiscid_7_discid___pyx_scope_struct_5_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_9libdiscid_7_discid___pyx_scope_struct_5_genexpr, /*tp_traverse*/ __pyx_tp_clear_9libdiscid_7_discid___pyx_scope_struct_5_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_9libdiscid_7_discid___pyx_scope_struct_5_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "_discid", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_DiscError, __pyx_k_DiscError, sizeof(__pyx_k_DiscError), 0, 0, 1, 1}, {&__pyx_n_s_DiscId___get___locals_genexpr, __pyx_k_DiscId___get___locals_genexpr, sizeof(__pyx_k_DiscId___get___locals_genexpr), 0, 0, 1, 1}, {&__pyx_n_s_FEATURES, __pyx_k_FEATURES, sizeof(__pyx_k_FEATURES), 0, 0, 1, 1}, {&__pyx_n_s_FEATURES_MAPPING, __pyx_k_FEATURES_MAPPING, sizeof(__pyx_k_FEATURES_MAPPING), 0, 0, 1, 1}, {&__pyx_n_s_FEATURE_ISRC, __pyx_k_FEATURE_ISRC, sizeof(__pyx_k_FEATURE_ISRC), 0, 0, 1, 1}, {&__pyx_n_s_FEATURE_MCN, __pyx_k_FEATURE_MCN, sizeof(__pyx_k_FEATURE_MCN), 0, 0, 1, 1}, {&__pyx_n_s_FEATURE_READ, __pyx_k_FEATURE_READ, sizeof(__pyx_k_FEATURE_READ), 0, 0, 1, 1}, {&__pyx_kp_s_Failed_to_allocate_DiscId_object, __pyx_k_Failed_to_allocate_DiscId_object, sizeof(__pyx_k_Failed_to_allocate_DiscId_object), 0, 0, 1, 0}, {&__pyx_kp_s_Failed_to_allocate_memory_to_sto, __pyx_k_Failed_to_allocate_memory_to_sto, sizeof(__pyx_k_Failed_to_allocate_memory_to_sto), 0, 0, 1, 0}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, {&__pyx_n_s_default_device, __pyx_k_default_device, sizeof(__pyx_k_default_device), 0, 0, 1, 1}, {&__pyx_n_s_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 0, 1, 1}, {&__pyx_n_s_discid_version, __pyx_k_discid_version, sizeof(__pyx_k_discid_version), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, {&__pyx_n_s_features, __pyx_k_features, sizeof(__pyx_k_features), 0, 0, 1, 1}, {&__pyx_n_s_first, __pyx_k_first, sizeof(__pyx_k_first), 0, 0, 1, 1}, {&__pyx_n_s_first_track, __pyx_k_first_track, sizeof(__pyx_k_first_track), 0, 0, 1, 1}, {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1}, {&__pyx_kp_s_home_sebastian_development_pyth, __pyx_k_home_sebastian_development_pyth, sizeof(__pyx_k_home_sebastian_development_pyth), 0, 0, 1, 0}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, {&__pyx_n_s_last, __pyx_k_last, sizeof(__pyx_k_last), 0, 0, 1, 1}, {&__pyx_n_s_last_track, __pyx_k_last_track, sizeof(__pyx_k_last_track), 0, 0, 1, 1}, {&__pyx_n_s_libdiscid__discid, __pyx_k_libdiscid__discid, sizeof(__pyx_k_libdiscid__discid), 0, 0, 1, 1}, {&__pyx_n_s_libdiscid_exceptions, __pyx_k_libdiscid_exceptions, sizeof(__pyx_k_libdiscid_exceptions), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_offsets, __pyx_k_offsets, sizeof(__pyx_k_offsets), 0, 0, 1, 1}, {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_kp_s_read_is_not_available_with_this, __pyx_k_read_is_not_available_with_this, sizeof(__pyx_k_read_is_not_available_with_this), 0, 0, 1, 0}, {&__pyx_n_s_sectors, __pyx_k_sectors, sizeof(__pyx_k_sectors), 0, 0, 1, 1}, {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 55, __pyx_L1_error) __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 66, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 190, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "libdiscid/_discid.pyx":55 * self._c_discid = cdiscid.discid_new() * if self._c_discid is NULL: * raise MemoryError('Failed to allocate DiscId object') # <<<<<<<<<<<<<< * * self._have_read = False */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Failed_to_allocate_DiscId_object); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); /* "libdiscid/_discid.pyx":66 * cdef _read(self, char* device, unsigned int features): * if not _has_feature(cdiscid.DISCID_FEATURE_READ): * raise NotImplementedError('read is not available with this version of ' # <<<<<<<<<<<<<< * 'libdiscid and/or platform') * */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_read_is_not_available_with_this); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "libdiscid/_discid.pyx":113 * cdef int* coffsets = malloc((len(offsets) + 1) * sizeof(int)) * if coffsets is NULL: * raise MemoryError('Failed to allocate memory to store offsets') # <<<<<<<<<<<<<< * * try: */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_allocate_memory_to_sto); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* "libdiscid/_discid.pyx":260 * return res * * def default_device(): # <<<<<<<<<<<<<< * """ The default device on this platform. * """ */ __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_sebastian_development_pyth, __pyx_n_s_default_device, 260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_discid(void); /*proto*/ PyMODINIT_FUNC init_discid(void) #else PyMODINIT_FUNC PyInit__discid(void); /*proto*/ PyMODINIT_FUNC PyInit__discid(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__discid(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_discid", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_libdiscid___discid) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "libdiscid._discid")) { if (unlikely(PyDict_SetItemString(modules, "libdiscid._discid", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_9libdiscid_7_discid_DiscId = &__pyx_vtable_9libdiscid_7_discid_DiscId; __pyx_vtable_9libdiscid_7_discid_DiscId._read = (PyObject *(*)(struct __pyx_obj_9libdiscid_7_discid_DiscId *, char *, unsigned int))__pyx_f_9libdiscid_7_discid_6DiscId__read; __pyx_vtable_9libdiscid_7_discid_DiscId._put = (PyObject *(*)(struct __pyx_obj_9libdiscid_7_discid_DiscId *, int, int, int *))__pyx_f_9libdiscid_7_discid_6DiscId__put; __pyx_vtable_9libdiscid_7_discid_DiscId._get_error_msg = (PyObject *(*)(struct __pyx_obj_9libdiscid_7_discid_DiscId *))__pyx_f_9libdiscid_7_discid_6DiscId__get_error_msg; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid_DiscId) < 0) __PYX_ERR(0, 36, __pyx_L1_error) __pyx_type_9libdiscid_7_discid_DiscId.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_9libdiscid_7_discid_DiscId.tp_dict, __pyx_vtabptr_9libdiscid_7_discid_DiscId) < 0) __PYX_ERR(0, 36, __pyx_L1_error) if (PyObject_SetAttrString(__pyx_m, "DiscId", (PyObject *)&__pyx_type_9libdiscid_7_discid_DiscId) < 0) __PYX_ERR(0, 36, __pyx_L1_error) __pyx_ptype_9libdiscid_7_discid_DiscId = &__pyx_type_9libdiscid_7_discid_DiscId; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__) < 0) __PYX_ERR(0, 188, __pyx_L1_error) __pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__.tp_print = 0; __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct____get__ = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 189, __pyx_L1_error) __pyx_type_9libdiscid_7_discid___pyx_scope_struct_1_genexpr.tp_print = 0; __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_1_genexpr = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_1_genexpr; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct_2___get__) < 0) __PYX_ERR(0, 199, __pyx_L1_error) __pyx_type_9libdiscid_7_discid___pyx_scope_struct_2___get__.tp_print = 0; __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_2___get__ = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_2___get__; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct_3_genexpr) < 0) __PYX_ERR(0, 200, __pyx_L1_error) __pyx_type_9libdiscid_7_discid___pyx_scope_struct_3_genexpr.tp_print = 0; __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_3_genexpr = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_3_genexpr; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct_4___get__) < 0) __PYX_ERR(0, 219, __pyx_L1_error) __pyx_type_9libdiscid_7_discid___pyx_scope_struct_4___get__.tp_print = 0; __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_4___get__ = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_4___get__; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct_5_genexpr) < 0) __PYX_ERR(0, 222, __pyx_L1_error) __pyx_type_9libdiscid_7_discid___pyx_scope_struct_5_genexpr.tp_print = 0; __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_5_genexpr; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY sizeof(PyTypeObject), #else sizeof(PyHeapTypeObject), #endif 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(1, 9, __pyx_L1_error) __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) __PYX_ERR(2, 8, __pyx_L1_error) __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), 0); if (unlikely(!__pyx_ptype_7cpython_7complex_complex)) __PYX_ERR(3, 15, __pyx_L1_error) /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /* "libdiscid/_discid.pyx":28 * from libc.stdlib cimport malloc, free * from cpython cimport bool * from libdiscid.exceptions import DiscError # <<<<<<<<<<<<<< * * cdef bool _has_feature(int feature): */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_DiscError); __Pyx_GIVEREF(__pyx_n_s_DiscError); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_DiscError); __pyx_t_2 = __Pyx_Import(__pyx_n_s_libdiscid_exceptions, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_DiscError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_DiscError, __pyx_t_1) < 0) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":73 * self._have_read = True * * def read(self, unicode device=None, unsigned int features=limits.UINT_MAX): # <<<<<<<<<<<<<< * """ Reads the TOC from the device given as string. * */ __pyx_k__3 = UINT_MAX; /* "libdiscid/_discid.pyx":248 * * FEATURES_MAPPING = { * cdiscid.DISCID_FEATURE_READ: _to_unicode(cdiscid.DISCID_FEATURE_STR_READ), # <<<<<<<<<<<<<< * cdiscid.DISCID_FEATURE_MCN: _to_unicode(cdiscid.DISCID_FEATURE_STR_MCN), * cdiscid.DISCID_FEATURE_ISRC: _to_unicode(cdiscid.DISCID_FEATURE_STR_ISRC) */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyInt_From_enum__discid_feature(DISCID_FEATURE_READ); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_f_9libdiscid_7_discid__to_unicode(DISCID_FEATURE_STR_READ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_3) < 0) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "libdiscid/_discid.pyx":249 * FEATURES_MAPPING = { * cdiscid.DISCID_FEATURE_READ: _to_unicode(cdiscid.DISCID_FEATURE_STR_READ), * cdiscid.DISCID_FEATURE_MCN: _to_unicode(cdiscid.DISCID_FEATURE_STR_MCN), # <<<<<<<<<<<<<< * cdiscid.DISCID_FEATURE_ISRC: _to_unicode(cdiscid.DISCID_FEATURE_STR_ISRC) * } */ __pyx_t_3 = __Pyx_PyInt_From_enum__discid_feature(DISCID_FEATURE_MCN); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __pyx_f_9libdiscid_7_discid__to_unicode(DISCID_FEATURE_STR_MCN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_1) < 0) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "libdiscid/_discid.pyx":250 * cdiscid.DISCID_FEATURE_READ: _to_unicode(cdiscid.DISCID_FEATURE_STR_READ), * cdiscid.DISCID_FEATURE_MCN: _to_unicode(cdiscid.DISCID_FEATURE_STR_MCN), * cdiscid.DISCID_FEATURE_ISRC: _to_unicode(cdiscid.DISCID_FEATURE_STR_ISRC) # <<<<<<<<<<<<<< * } * */ __pyx_t_1 = __Pyx_PyInt_From_enum__discid_feature(DISCID_FEATURE_ISRC); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_f_9libdiscid_7_discid__to_unicode(DISCID_FEATURE_STR_ISRC); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_3) < 0) __PYX_ERR(0, 248, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_FEATURES_MAPPING, __pyx_t_2) < 0) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":260 * return res * * def default_device(): # <<<<<<<<<<<<<< * """ The default device on this platform. * """ */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_9libdiscid_7_discid_1default_device, NULL, __pyx_n_s_libdiscid__discid); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_default_device, __pyx_t_2) < 0) __PYX_ERR(0, 260, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":266 * return _to_unicode(cdiscid.discid_get_default_device()) * * FEATURES = _feature_list() # <<<<<<<<<<<<<< * FEATURE_READ = cdiscid.DISCID_FEATURE_READ * FEATURE_MCN = cdiscid.DISCID_FEATURE_MCN */ __pyx_t_2 = __pyx_f_9libdiscid_7_discid__feature_list(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FEATURES, __pyx_t_2) < 0) __PYX_ERR(0, 266, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":267 * * FEATURES = _feature_list() * FEATURE_READ = cdiscid.DISCID_FEATURE_READ # <<<<<<<<<<<<<< * FEATURE_MCN = cdiscid.DISCID_FEATURE_MCN * FEATURE_ISRC = cdiscid.DISCID_FEATURE_ISRC */ __pyx_t_2 = __Pyx_PyInt_From_enum__discid_feature(DISCID_FEATURE_READ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FEATURE_READ, __pyx_t_2) < 0) __PYX_ERR(0, 267, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":268 * FEATURES = _feature_list() * FEATURE_READ = cdiscid.DISCID_FEATURE_READ * FEATURE_MCN = cdiscid.DISCID_FEATURE_MCN # <<<<<<<<<<<<<< * FEATURE_ISRC = cdiscid.DISCID_FEATURE_ISRC * __discid_version__ = _to_unicode(cdiscid.wrap_get_version_string()) */ __pyx_t_2 = __Pyx_PyInt_From_enum__discid_feature(DISCID_FEATURE_MCN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FEATURE_MCN, __pyx_t_2) < 0) __PYX_ERR(0, 268, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":269 * FEATURE_READ = cdiscid.DISCID_FEATURE_READ * FEATURE_MCN = cdiscid.DISCID_FEATURE_MCN * FEATURE_ISRC = cdiscid.DISCID_FEATURE_ISRC # <<<<<<<<<<<<<< * __discid_version__ = _to_unicode(cdiscid.wrap_get_version_string()) * */ __pyx_t_2 = __Pyx_PyInt_From_enum__discid_feature(DISCID_FEATURE_ISRC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FEATURE_ISRC, __pyx_t_2) < 0) __PYX_ERR(0, 269, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":270 * FEATURE_MCN = cdiscid.DISCID_FEATURE_MCN * FEATURE_ISRC = cdiscid.DISCID_FEATURE_ISRC * __discid_version__ = _to_unicode(cdiscid.wrap_get_version_string()) # <<<<<<<<<<<<<< * */ __pyx_t_2 = __pyx_f_9libdiscid_7_discid__to_unicode(wrap_get_version_string()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_discid_version, __pyx_t_2) < 0) __PYX_ERR(0, 270, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":1 * # -*- coding: utf-8 -*- # <<<<<<<<<<<<<< * * # Copyright 2013 Sebastian Ramacher */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init libdiscid._discid", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init libdiscid._discid"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* ExtTypeTest */ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (likely(PyObject_TypeCheck(obj, type))) return 1; PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", Py_TYPE(obj)->tp_name, type->tp_name); return 0; } /* decode_c_string */ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( const char* cstring, Py_ssize_t start, Py_ssize_t stop, const char* encoding, const char* errors, PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) { Py_ssize_t length; if (unlikely((start < 0) | (stop < 0))) { size_t slen = strlen(cstring); if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) { PyErr_SetString(PyExc_OverflowError, "c-string too long to convert to Python"); return NULL; } length = (Py_ssize_t) slen; if (start < 0) { start += length; if (start < 0) start = 0; } if (stop < 0) stop += length; } length = stop - start; if (unlikely(length <= 0)) return PyUnicode_FromUnicode(NULL, 0); cstring += start; if (decode_func) { return decode_func(cstring, length, errors); } else { return PyUnicode_Decode(cstring, length, encoding, errors); } } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* KeywordStringCheck */ static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; #if CYTHON_COMPILING_IN_PYPY if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) goto invalid_keyword; return 1; #else while (PyDict_Next(kwdict, &pos, &key, 0)) { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) #endif if (unlikely(!PyUnicode_Check(key))) goto invalid_keyword_type; } if ((!kw_allowed) && unlikely(key)) goto invalid_keyword; return 1; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); return 0; #endif invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyErrFetchRestore */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* GetModuleGlobalName */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if !CYTHON_AVOID_BORROWED_REFS result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } /* PyCFunctionFastCall */ #if CYTHON_FAST_PYCCALL static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { PyCFunctionObject *func = (PyCFunctionObject*)func_obj; PyCFunction meth = PyCFunction_GET_FUNCTION(func); PyObject *self = PyCFunction_GET_SELF(func); assert(PyCFunction_Check(func)); assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST))); assert(nargs >= 0); assert(nargs == 0 || args != NULL); /* _PyCFunction_FastCallDict() must not be called with an exception set, because it may clear it (directly or indirectly) and so the caller loses its exception */ assert(!PyErr_Occurred()); return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL); } #endif // CYTHON_FAST_PYCCALL /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL #include "frameobject.h" static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, PyObject *globals) { PyFrameObject *f; PyThreadState *tstate = PyThreadState_GET(); PyObject **fastlocals; Py_ssize_t i; PyObject *result; assert(globals != NULL); /* XXX Perhaps we should create a specialized PyFrame_New() that doesn't take locals, but does take builtins without sanity checking them. */ assert(tstate != NULL); f = PyFrame_New(tstate, co, globals, NULL); if (f == NULL) { return NULL; } fastlocals = f->f_localsplus; for (i = 0; i < na; i++) { Py_INCREF(*args); fastlocals[i] = *args++; } result = PyEval_EvalFrameEx(f,0); ++tstate->recursion_depth; Py_DECREF(f); --tstate->recursion_depth; return result; } #if 1 || PY_VERSION_HEX < 0x030600B1 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) { PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); PyObject *globals = PyFunction_GET_GLOBALS(func); PyObject *argdefs = PyFunction_GET_DEFAULTS(func); PyObject *closure; #if PY_MAJOR_VERSION >= 3 PyObject *kwdefs; #endif PyObject *kwtuple, **k; PyObject **d; Py_ssize_t nd; Py_ssize_t nk; PyObject *result; assert(kwargs == NULL || PyDict_Check(kwargs)); nk = kwargs ? PyDict_Size(kwargs) : 0; if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { return NULL; } if ( #if PY_MAJOR_VERSION >= 3 co->co_kwonlyargcount == 0 && #endif likely(kwargs == NULL || nk == 0) && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { if (argdefs == NULL && co->co_argcount == nargs) { result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); goto done; } else if (nargs == 0 && argdefs != NULL && co->co_argcount == Py_SIZE(argdefs)) { /* function called with no arguments, but all parameters have a default value: use default values as arguments .*/ args = &PyTuple_GET_ITEM(argdefs, 0); result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); goto done; } } if (kwargs != NULL) { Py_ssize_t pos, i; kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { result = NULL; goto done; } k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { Py_INCREF(k[i]); Py_INCREF(k[i+1]); i += 2; } nk = i / 2; } else { kwtuple = NULL; k = NULL; } closure = PyFunction_GET_CLOSURE(func); #if PY_MAJOR_VERSION >= 3 kwdefs = PyFunction_GET_KW_DEFAULTS(func); #endif if (argdefs != NULL) { d = &PyTuple_GET_ITEM(argdefs, 0); nd = Py_SIZE(argdefs); } else { d = NULL; nd = 0; } #if PY_MAJOR_VERSION >= 3 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, kwdefs, closure); #else result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, args, nargs, k, (int)nk, d, (int)nd, closure); #endif Py_XDECREF(kwtuple); done: Py_LeaveRecursiveCall(); return result; } #endif // CPython < 3.6 #endif // CYTHON_FAST_PYCALL /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = PyCFunction_GET_FUNCTION(func); self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); if (unlikely(!args)) return NULL; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, &arg, 1); } #endif #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } } return __Pyx__PyObject_CallOneArg(func, arg); } #else static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_Pack(1, arg); if (unlikely(!args)) return NULL; result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } #endif /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* ArgTypeTest */ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); } static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(PyObject_TypeCheck(obj, type))) return 1; } __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } /* PyObjectCallNoArg */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #if CYTHON_FAST_PYCALL if (PyFunction_Check(func)) { return __Pyx_PyFunction_FastCall(func, NULL, 0); } #endif #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { return __Pyx_PyObject_CallMethO(func, NULL); } } return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); } #endif /* PyIntBinop */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); x = (long)((unsigned long)a + b); if (likely((x^a) >= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); } #endif #if CYTHON_USE_PYLONG_INTERNALS if (likely(PyLong_CheckExact(op1))) { const long b = intval; long a, x; #ifdef HAVE_LONG_LONG const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; #endif const digit* digits = ((PyLongObject*)op1)->ob_digit; const Py_ssize_t size = Py_SIZE(op1); if (likely(__Pyx_sst_abs(size) <= 1)) { a = likely(size) ? digits[0] : 0; if (size == -1) a = -a; } else { switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; #endif } default: return PyLong_Type.tp_as_number->nb_add(op1, op2); } } x = a + b; return PyLong_FromLong(x); #ifdef HAVE_LONG_LONG long_long: llx = lla + llb; return PyLong_FromLongLong(llx); #endif } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; double a = PyFloat_AS_DOUBLE(op1); double result; PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) return PyFloat_FromDouble(result); } return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } #endif /* GetException */ #if CYTHON_FAST_THREAD_STATE static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { #else static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { #endif PyObject *local_type, *local_value, *local_tb; #if CYTHON_FAST_THREAD_STATE PyObject *tmp_type, *tmp_value, *tmp_tb; local_type = tstate->curexc_type; local_value = tstate->curexc_value; local_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(&local_type, &local_value, &local_tb); #endif PyErr_NormalizeException(&local_type, &local_value, &local_tb); #if CYTHON_FAST_THREAD_STATE if (unlikely(tstate->curexc_type)) #else if (unlikely(PyErr_Occurred())) #endif goto bad; #if PY_MAJOR_VERSION >= 3 if (local_tb) { if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) goto bad; } #endif Py_XINCREF(local_tb); Py_XINCREF(local_type); Py_XINCREF(local_value); *type = local_type; *value = local_value; *tb = local_tb; #if CYTHON_FAST_THREAD_STATE tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = local_type; tstate->exc_value = local_value; tstate->exc_traceback = local_tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif return 0; bad: *type = 0; *value = 0; *tb = 0; Py_XDECREF(local_type); Py_XDECREF(local_value); Py_XDECREF(local_tb); return -1; } /* SwapException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #endif /* SaveResetException */ #if CYTHON_FAST_THREAD_STATE static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->exc_type; *value = tstate->exc_value; *tb = tstate->exc_traceback; Py_XINCREF(*type); Py_XINCREF(*value); Py_XINCREF(*tb); } static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = type; tstate->exc_value = value; tstate->exc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } #endif /* None */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_FAST_THREAD_STATE PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } /* UnpackItemEndCheck */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } /* SetVTable */ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); #endif if (!ob) goto bad; if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0) goto bad; Py_DECREF(ob); return 0; bad: Py_XDECREF(ob); return -1; } /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); #else "cannot import name %S", name); #endif } return value; } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; __Pyx_PyFrame_SetLineNumber(py_frame, py_line); PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__discid_feature(enum discid_feature value) { const enum discid_feature neg_one = (enum discid_feature) -1, const_zero = (enum discid_feature) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(enum discid_feature) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(enum discid_feature) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(enum discid_feature) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(enum discid_feature) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(enum discid_feature) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(enum discid_feature), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(unsigned int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (unsigned int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned int) 0; case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0]) case 2: if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; case 3: if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; case 4: if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) >= 4 * PyLong_SHIFT) { return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (unsigned int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(unsigned int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned int) 0; case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) case -2: if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 2: if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case -3: if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 3: if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case -4: if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; case 4: if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned int) - 1 > 4 * PyLong_SHIFT) { return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); } } break; } #endif if (sizeof(unsigned int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else unsigned int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (unsigned int) -1; } } else { unsigned int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (unsigned int) -1; val = __Pyx_PyInt_As_unsigned_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned int"); return (unsigned int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned int"); return (unsigned int) -1; } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); if (!fake_module) return NULL; Py_INCREF(fake_module); cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); if (cached_type) { if (!PyType_Check((PyObject*)cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", type->tp_name); goto bad; } if (cached_type->tp_basicsize != type->tp_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", type->tp_name); goto bad; } } else { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; PyErr_Clear(); if (PyType_Ready(type) < 0) goto bad; if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) goto bad; Py_INCREF(type); cached_type = type; } done: Py_DECREF(fake_module); return cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* PyObjectCallMethod1 */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { PyObject *method, *result = NULL; method = __Pyx_PyObject_GetAttrStr(obj, method_name); if (unlikely(!method)) goto done; #if CYTHON_UNPACK_METHODS if (likely(PyMethod_Check(method))) { PyObject *self = PyMethod_GET_SELF(method); if (likely(self)) { PyObject *args; PyObject *function = PyMethod_GET_FUNCTION(method); #if CYTHON_FAST_PYCALL if (PyFunction_Check(function)) { PyObject *args[2] = {self, arg}; result = __Pyx_PyFunction_FastCall(function, args, 2); goto done; } #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(function)) { PyObject *args[2] = {self, arg}; result = __Pyx_PyCFunction_FastCall(function, args, 2); goto done; } #endif args = PyTuple_New(2); if (unlikely(!args)) goto done; Py_INCREF(self); PyTuple_SET_ITEM(args, 0, self); Py_INCREF(arg); PyTuple_SET_ITEM(args, 1, arg); Py_INCREF(function); Py_DECREF(method); method = NULL; result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); return result; } } #endif result = __Pyx_PyObject_CallOneArg(method, arg); done: Py_XDECREF(method); return result; } /* CoroutineBase */ #include #include static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); static PyObject *__Pyx_Coroutine_Close(PyObject *self); static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&et, &ev, &tb); if (!et) { Py_XDECREF(tb); Py_XDECREF(ev); Py_INCREF(Py_None); *pvalue = Py_None; return 0; } if (likely(et == PyExc_StopIteration)) { if (!ev) { Py_INCREF(Py_None); value = Py_None; } #if PY_VERSION_HEX >= 0x030300A0 else if (Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); } #endif else if (unlikely(PyTuple_Check(ev))) { if (PyTuple_GET_SIZE(ev) >= 1) { #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS value = PyTuple_GET_ITEM(ev, 0); Py_INCREF(value); #else value = PySequence_ITEM(ev, 0); #endif } else { Py_INCREF(Py_None); value = Py_None; } Py_DECREF(ev); } else if (!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { value = ev; } if (likely(value)) { Py_XDECREF(tb); Py_DECREF(et); *pvalue = value; return 0; } } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { __Pyx_ErrRestore(et, ev, tb); return -1; } PyErr_NormalizeException(&et, &ev, &tb); if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { __Pyx_ErrRestore(et, ev, tb); return -1; } Py_XDECREF(tb); Py_DECREF(et); #if PY_VERSION_HEX >= 0x030300A0 value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); #else { PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); Py_DECREF(ev); if (likely(args)) { value = PySequence_GetItem(args, 0); Py_DECREF(args); } if (unlikely(!value)) { __Pyx_ErrRestore(NULL, NULL, NULL); Py_INCREF(Py_None); value = Py_None; } } #endif *pvalue = value; return 0; } #endif static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) { PyObject *exc_type = self->exc_type; PyObject *exc_value = self->exc_value; PyObject *exc_traceback = self->exc_traceback; self->exc_type = NULL; self->exc_value = NULL; self->exc_traceback = NULL; Py_XDECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_traceback); } static CYTHON_INLINE int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) { if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); return 1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { PyObject *retval; __Pyx_PyThreadState_declare assert(!self->is_running); if (unlikely(self->resume_label == 0)) { if (unlikely(value && value != Py_None)) { PyErr_SetString(PyExc_TypeError, "can't send non-None value to a " "just-started generator"); return NULL; } } if (unlikely(self->resume_label == -1)) { PyErr_SetNone(PyExc_StopIteration); return NULL; } __Pyx_PyThreadState_assign if (value) { #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON #else if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_XINCREF(__pyx_tstate->frame); assert(f->f_back == NULL); f->f_back = __pyx_tstate->frame; } #endif __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); } else { __Pyx_Coroutine_ExceptionClear(self); } self->is_running = 1; retval = self->body((PyObject *) self, value); self->is_running = 0; if (retval) { __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON #else if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_CLEAR(f->f_back); } #endif } else { __Pyx_Coroutine_ExceptionClear(self); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) { if (unlikely(!retval && !PyErr_Occurred())) { PyErr_SetNone(PyExc_StopIteration); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { PyObject *ret; PyObject *val = NULL; __Pyx_Coroutine_Undelegate(gen); __Pyx_PyGen_FetchStopIterationValue(&val); ret = __Pyx_Coroutine_SendEx(gen, val); Py_XDECREF(val); return ret; } static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { PyObject *retval; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif { if (value == Py_None) ret = Py_TYPE(yf)->tp_iternext(yf); else ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); } gen->is_running = 0; if (likely(ret)) { return ret; } retval = __Pyx_Coroutine_FinishDelegation(gen); } else { retval = __Pyx_Coroutine_SendEx(gen, value); } return __Pyx_Coroutine_MethodReturn(retval); } static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { PyObject *retval = NULL; int err = 0; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else #endif { PyObject *meth; gen->is_running = 1; meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); if (unlikely(!meth)) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_WriteUnraisable(yf); } PyErr_Clear(); } else { retval = PyObject_CallFunction(meth, NULL); Py_DECREF(meth); if (!retval) err = -1; } gen->is_running = 0; } Py_XDECREF(retval); return err; } static PyObject *__Pyx_Generator_Next(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Generator_Next(yf); } else #endif ret = Py_TYPE(yf)->tp_iternext(yf); gen->is_running = 0; if (likely(ret)) { return ret; } return __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_SendEx(gen, Py_None); } static PyObject *__Pyx_Coroutine_Close(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *retval, *raised_exception; PyObject *yf = gen->yieldfrom; int err = 0; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { Py_INCREF(yf); err = __Pyx_Coroutine_CloseIter(gen, yf); __Pyx_Coroutine_Undelegate(gen); Py_DECREF(yf); } if (err == 0) PyErr_SetNone(PyExc_GeneratorExit); retval = __Pyx_Coroutine_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, "generator ignored GeneratorExit"); return NULL; } raised_exception = PyErr_Occurred(); if (!raised_exception || raised_exception == PyExc_StopIteration || raised_exception == PyExc_GeneratorExit || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) { if (raised_exception) PyErr_Clear(); Py_INCREF(Py_None); return Py_None; } return NULL; } static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; PyObject *yf = gen->yieldfrom; if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) return NULL; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; Py_INCREF(yf); if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { int err = __Pyx_Coroutine_CloseIter(gen, yf); Py_DECREF(yf); __Pyx_Coroutine_Undelegate(gen); if (err < 0) return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); goto throw_here; } gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Coroutine_Throw(yf, args); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { ret = __Pyx_Coroutine_Throw(yf, args); } else #endif { PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); if (unlikely(!meth)) { Py_DECREF(yf); if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { gen->is_running = 0; return NULL; } PyErr_Clear(); __Pyx_Coroutine_Undelegate(gen); gen->is_running = 0; goto throw_here; } ret = PyObject_CallObject(meth, args); Py_DECREF(meth); } gen->is_running = 0; Py_DECREF(yf); if (!ret) { ret = __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_MethodReturn(ret); } throw_here: __Pyx_Raise(typ, val, tb, NULL); return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); } static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_VISIT(gen->closure); Py_VISIT(gen->classobj); Py_VISIT(gen->yieldfrom); Py_VISIT(gen->exc_type); Py_VISIT(gen->exc_value); Py_VISIT(gen->exc_traceback); return 0; } static int __Pyx_Coroutine_clear(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_CLEAR(gen->closure); Py_CLEAR(gen->classobj); Py_CLEAR(gen->yieldfrom); Py_CLEAR(gen->exc_type); Py_CLEAR(gen->exc_value); Py_CLEAR(gen->exc_traceback); Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); return 0; } static void __Pyx_Coroutine_dealloc(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); if (gen->resume_label > 0) { PyObject_GC_Track(self); #if PY_VERSION_HEX >= 0x030400a1 if (PyObject_CallFinalizerFromDealloc(self)) #else Py_TYPE(gen)->tp_del(self); if (self->ob_refcnt > 0) #endif { return; } PyObject_GC_UnTrack(self); } __Pyx_Coroutine_clear(self); PyObject_GC_Del(gen); } static void __Pyx_Coroutine_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __Pyx_PyThreadState_declare if (gen->resume_label <= 0) return ; #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt == 0); self->ob_refcnt = 1; #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); res = __Pyx_Coroutine_Close(self); if (res == NULL) PyErr_WriteUnraisable(self); else Py_DECREF(res); __Pyx_ErrRestore(error_type, error_value, error_traceback); #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt > 0); if (--self->ob_refcnt == 0) { return; } { Py_ssize_t refcnt = self->ob_refcnt; _Py_NewReference(self); self->ob_refcnt = refcnt; } #if CYTHON_COMPILING_IN_CPYTHON assert(PyType_IS_GC(self->ob_type) && _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); _Py_DEC_REFTOTAL; #endif #ifdef COUNT_ALLOCS --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif #endif } static PyObject * __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self) { PyObject *name = self->gi_name; if (unlikely(!name)) name = Py_None; Py_INCREF(name); return name; } static int __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } tmp = self->gi_name; Py_INCREF(value); self->gi_name = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self) { PyObject *name = self->gi_qualname; if (unlikely(!name)) name = Py_None; Py_INCREF(name); return name; } static int __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } tmp = self->gi_qualname; Py_INCREF(value); self->gi_qualname = value; Py_XDECREF(tmp); return 0; } static __pyx_CoroutineObject *__Pyx__Coroutine_New( PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure, PyObject *name, PyObject *qualname, PyObject *module_name) { __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); if (gen == NULL) return NULL; gen->body = body; gen->closure = closure; Py_XINCREF(closure); gen->is_running = 0; gen->resume_label = 0; gen->classobj = NULL; gen->yieldfrom = NULL; gen->exc_type = NULL; gen->exc_value = NULL; gen->exc_traceback = NULL; gen->gi_weakreflist = NULL; Py_XINCREF(qualname); gen->gi_qualname = qualname; Py_XINCREF(name); gen->gi_name = name; Py_XINCREF(module_name); gen->gi_modulename = module_name; PyObject_GC_Track(gen); return gen; } /* PatchModuleWithCoroutine */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) int result; PyObject *globals, *result_obj; globals = PyDict_New(); if (unlikely(!globals)) goto ignore; result = PyDict_SetItemString(globals, "_cython_coroutine_type", #ifdef __Pyx_Coroutine_USED (PyObject*)__pyx_CoroutineType); #else Py_None); #endif if (unlikely(result < 0)) goto ignore; result = PyDict_SetItemString(globals, "_cython_generator_type", #ifdef __Pyx_Generator_USED (PyObject*)__pyx_GeneratorType); #else Py_None); #endif if (unlikely(result < 0)) goto ignore; if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; result_obj = PyRun_String(py_code, Py_file_input, globals, globals); if (unlikely(!result_obj)) goto ignore; Py_DECREF(result_obj); Py_DECREF(globals); return module; ignore: Py_XDECREF(globals); PyErr_WriteUnraisable(module); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { Py_DECREF(module); module = NULL; } #else py_code++; #endif return module; } /* PatchGeneratorABC */ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static PyObject* __Pyx_patch_abc_module(PyObject *module); static PyObject* __Pyx_patch_abc_module(PyObject *module) { module = __Pyx_Coroutine_patch_module( module, "" "if _cython_generator_type is not None:\n" " try: Generator = _module.Generator\n" " except AttributeError: pass\n" " else: Generator.register(_cython_generator_type)\n" "if _cython_coroutine_type is not None:\n" " try: Coroutine = _module.Coroutine\n" " except AttributeError: pass\n" " else: Coroutine.register(_cython_coroutine_type)\n" ); return module; } #endif static int __Pyx_patch_abc(void) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static int abc_patched = 0; if (!abc_patched) { PyObject *module; module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections"); if (!module) { PyErr_WriteUnraisable(NULL); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, ((PY_VERSION_HEX >= 0x03030000) ? "Cython module failed to register with collections.abc module" : "Cython module failed to register with collections module"), 1) < 0)) { return -1; } } else { module = __Pyx_patch_abc_module(module); abc_patched = 1; if (unlikely(!module)) return -1; Py_DECREF(module); } module = PyImport_ImportModule("backports_abc"); if (module) { module = __Pyx_patch_abc_module(module); Py_XDECREF(module); } if (!module) { PyErr_Clear(); } } #else if (0) __Pyx_Coroutine_patch_module(NULL, NULL); #endif return 0; } /* Generator */ static PyMethodDef __pyx_Generator_methods[] = { {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS, (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, {0, 0, 0, 0} }; static PyMemberDef __pyx_Generator_memberlist[] = { {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, {0, 0, 0, 0, 0} }; static PyGetSetDef __pyx_Generator_getsets[] = { {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, (char*) PyDoc_STR("name of the generator"), 0}, {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, (char*) PyDoc_STR("qualified name of the generator"), 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) "generator", sizeof(__pyx_CoroutineObject), 0, (destructor) __Pyx_Coroutine_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, 0, (traverseproc) __Pyx_Coroutine_traverse, 0, 0, offsetof(__pyx_CoroutineObject, gi_weakreflist), 0, (iternextfunc) __Pyx_Generator_Next, __pyx_Generator_methods, __pyx_Generator_memberlist, __pyx_Generator_getsets, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #else __Pyx_Coroutine_del, #endif 0, #if PY_VERSION_HEX >= 0x030400a1 __Pyx_Coroutine_del, #endif }; static int __pyx_Generator_init(void) { __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); if (unlikely(!__pyx_GeneratorType)) { return -1; } return 0; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* ModuleImport */ #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { PyObject *py_name = 0; PyObject *py_module = 0; py_name = __Pyx_PyIdentifier_FromString(name); if (!py_name) goto bad; py_module = PyImport_Import(py_name); Py_DECREF(py_name); return py_module; bad: Py_XDECREF(py_name); return 0; } #endif /* TypeImport */ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; Py_ssize_t basicsize; #ifdef Py_LIMITED_API PyObject *py_basicsize; #endif py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); Py_DECREF(py_name); py_name = 0; Py_DECREF(py_module); py_module = 0; if (!result) goto bad; if (!PyType_Check(result)) { PyErr_Format(PyExc_TypeError, "%.200s.%.200s is not a type object", module_name, class_name); goto bad; } #ifndef Py_LIMITED_API basicsize = ((PyTypeObject *)result)->tp_basicsize; #else py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); if (!py_basicsize) goto bad; basicsize = PyLong_AsSsize_t(py_basicsize); Py_DECREF(py_basicsize); py_basicsize = 0; if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) goto bad; #endif if (!strict && (size_t)basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd", module_name, class_name, basicsize, size); if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd", module_name, class_name, basicsize, size); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { #if CYTHON_USE_TYPE_SLOTS PyNumberMethods *m; #endif const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); #if CYTHON_USE_TYPE_SLOTS m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif #else res = PyNumber_Int(x); #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ python-libdiscid-1.0/libdiscid/_discid.pyx0000664000175000017500000002052313031164102022644 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. cimport cdiscid cimport cpython from libc cimport limits from libc.stdlib cimport malloc, free from cpython cimport bool from libdiscid.exceptions import DiscError cdef bool _has_feature(int feature): return cdiscid.wrap_has_feature(feature) == 1 cdef unicode _to_unicode(char* s): return s.decode('UTF-8', 'strict') cdef class DiscId: """ Class to calculate MusicBrainz Disc IDs. >>> d = DiscId() >>> d.read() >>> d.id is not None True Note that all the properties are only set after an successful call to :func:`DiscId.read` or :func:`DiscId.put`. """ cdef cdiscid.DiscId *_c_discid cdef bool _have_read cdef unicode _device def __cinit__(self): self._c_discid = cdiscid.discid_new() if self._c_discid is NULL: raise MemoryError('Failed to allocate DiscId object') self._have_read = False self._device = None def __dealloc__(self): if self._c_discid is not NULL: cdiscid.discid_free(self._c_discid) cdef _read(self, char* device, unsigned int features): if not _has_feature(cdiscid.DISCID_FEATURE_READ): raise NotImplementedError('read is not available with this version of ' 'libdiscid and/or platform') if not cdiscid.wrap_read_sparse(self._c_discid, device, features): raise DiscError(self._get_error_msg()) self._have_read = True def read(self, unicode device=None, unsigned int features=limits.UINT_MAX): """ Reads the TOC from the device given as string. If *device* is ``None``, :func:`libdiscid.default_device` is used. *features* can be any combination of :data:`FEATURE_MCN` and :data:`FEATURE_ISRC` and :data:`FEATURE_READ`. Note that prior to libdiscid version 0.5.0 *features* has no effect and that :data:`FEATURE_READ` is always assumed, even if not given. A :exc:`libdiscid.DiscError` exception is raised when reading fails, and :py:exc:`NotImplementedError` when libdiscid does not support reading discs on the current platform. """ if device is None: device = default_device() py_byte_device = device.encode('UTF-8') cdef char* cdevice = py_byte_device ret = self._read(cdevice, features) self._device = device cdef _put(self, int first, int last, int* offsets): if not cdiscid.discid_put(self._c_discid, first, last, offsets): raise DiscError(self._get_error_msg()) self._device = None self._have_read = True def put(self, int first, int last, int sectors, offsets): """ Creates a TOC based on the given offsets. Takes the *first* and *last* audio track, as well as the number of *sectors* and a list of *offsets* as in :attr:`DiscId.track_offsets`. If the operation fails for some reason, a :exc:`libdiscid.DiscError` exception is raised. """ cdef int* coffsets = malloc((len(offsets) + 1) * sizeof(int)) if coffsets is NULL: raise MemoryError('Failed to allocate memory to store offsets') try: coffsets[0] = sectors for (i, v) in enumerate(offsets): coffsets[i + 1] = v return self._put(first, last, coffsets) finally: free(coffsets) cdef unicode _get_error_msg(self): return _to_unicode(cdiscid.discid_get_error_msg(self._c_discid)) property id: """ The MusicBrainz :musicbrainz:`Disc ID`. """ def __get__(self): return _to_unicode(cdiscid.discid_get_id(self._c_discid)) property freedb_id: """ The :musicbrainz:`FreeDB` Disc ID (without category). """ def __get__(self): return _to_unicode(cdiscid.discid_get_freedb_id(self._c_discid)) property submission_url: """ Disc ID / TOC Submission URL for MusicBrainz With this url you can submit the current TOC as a new MusicBrainz :musicbrainz:`Disc ID`. """ def __get__(self): return _to_unicode(cdiscid.discid_get_submission_url(self._c_discid)) property webservice_url: """ The web service URL for info about the CD With this url you can retrieve information about the CD in XML from the MusicBrainz web service. """ def __get__(self): return _to_unicode(cdiscid.discid_get_webservice_url(self._c_discid)) property first_track: """ Number of the first audio track. """ def __get__(self): return cdiscid.discid_get_first_track_num(self._c_discid) property last_track: """ Number of the last audio track. """ def __get__(self): return cdiscid.discid_get_last_track_num(self._c_discid) property sectors: """ Total sector count. """ def __get__(self): return cdiscid.discid_get_sectors(self._c_discid) property track_offsets: """ Tuple of all track offsets (in sectors). The first element corresponds to the offset of the track denoted by :attr:`first_track` and so on. """ def __get__(self): return tuple(cdiscid.discid_get_track_offset(self._c_discid, track) for track in range(self.first_track, self.last_track + 1)) property track_lengths: """ Tuple of all track lengths (in sectors). The first element corresponds to the length of the track denoted by :attr:`first_track` and so on. """ def __get__(self): return tuple(cdiscid.discid_get_track_length(self._c_discid, track) for track in range(self.first_track, self.last_track + 1)) property mcn: """ Media Catalogue Number of the disc. """ def __get__(self): if not _has_feature(cdiscid.DISCID_FEATURE_MCN): return None return _to_unicode(cdiscid.wrap_get_mcn(self._c_discid)) property track_isrcs: """ Tuple of :musicbrainz:`ISRCs ` of all tracks. The first element of the list corresponds to the ISRC of the :attr:`first_track` and so on. """ def __get__(self): if not _has_feature(cdiscid.DISCID_FEATURE_ISRC): return None return tuple(_to_unicode(cdiscid.wrap_get_track_isrc(self._c_discid, track)) for track in range(self.first_track, self.last_track + 1)) property device: """ The device the data was read from. If it is ``None``, :func:`libdiscid.put` was called to create the instance. """ def __get__(self): return self._device property toc: """ String representing the CD's Table of Contents (TOC). """ def __get__(self): assert self._have_read cdef char* tocstr = cdiscid.wrap_get_toc(self._c_discid) if tocstr is not NULL: return _to_unicode(tocstr) return None FEATURES_MAPPING = { cdiscid.DISCID_FEATURE_READ: _to_unicode(cdiscid.DISCID_FEATURE_STR_READ), cdiscid.DISCID_FEATURE_MCN: _to_unicode(cdiscid.DISCID_FEATURE_STR_MCN), cdiscid.DISCID_FEATURE_ISRC: _to_unicode(cdiscid.DISCID_FEATURE_STR_ISRC) } cdef _feature_list(): res = [] for f, s in FEATURES_MAPPING.items(): if _has_feature(f): res.append(s) return res def default_device(): """ The default device on this platform. """ return _to_unicode(cdiscid.discid_get_default_device()) FEATURES = _feature_list() FEATURE_READ = cdiscid.DISCID_FEATURE_READ FEATURE_MCN = cdiscid.DISCID_FEATURE_MCN FEATURE_ISRC = cdiscid.DISCID_FEATURE_ISRC __discid_version__ = _to_unicode(cdiscid.wrap_get_version_string()) python-libdiscid-1.0/libdiscid/cdiscid.pxd0000664000175000017500000000435013031164010022621 0ustar sebastiansebastian00000000000000# Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. from libc.string cimport const_char cdef extern from "discid-wrapper.h": ctypedef void* DiscId DiscId* discid_new() void discid_free(DiscId* d) int wrap_read_sparse(DiscId *d, const_char* device, unsigned int features) int discid_put(DiscId *d, int first, int last, int *offsets) char *discid_get_error_msg(DiscId *d) char *discid_get_id(DiscId *d) char *discid_get_freedb_id(DiscId *d) char *discid_get_submission_url(DiscId *d) char *discid_get_webservice_url(DiscId *d) char *discid_get_default_device() int discid_get_first_track_num(DiscId *d) int discid_get_last_track_num(DiscId *d) int discid_get_sectors(DiscId *d) int discid_get_track_offset(DiscId *d, int track_num) int discid_get_track_length(DiscId *d, int track_num) cdef enum discid_feature: DISCID_FEATURE_READ DISCID_FEATURE_MCN DISCID_FEATURE_ISRC char* DISCID_FEATURE_STR_READ char* DISCID_FEATURE_STR_MCN char* DISCID_FEATURE_STR_ISRC int wrap_has_feature(int feature) char* wrap_get_version_string() char* wrap_get_mcn(DiscId *d) char* wrap_get_track_isrc(DiscId *d, int track_num) char* wrap_get_toc(DiscId *d) python-libdiscid-1.0/libdiscid/discid-wrapper.c0000664000175000017500000000573412576077407023624 0ustar sebastiansebastian00000000000000/* Copyright 2013 Sebastian Ramacher * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "discid-wrapper.h" #include #ifndef UNUSED # if defined(__GNUC__) || defined(__CLANG__) # define UNUSED(x) UNUSED_ ## x __attribute__((unused)) # elif defined(__LCLINT__) # define UNUSED(x) /*@unused@*/ x # else # define UNUSED(x) x # endif #endif #ifndef DISCID_FEATURE_LENGTH char* wrap_get_version_string(void) { return "libdiscid < 0.4.0"; } int wrap_has_feature(enum discid_feature feature) { /* except for GNU Hurd, read is available for all platforms */ #ifndef __GNU__ if (feature == DISCID_FEATURE_READ) return 1; else #endif return 0; } char* wrap_get_mcn(DiscId* UNUSED(d)) { return NULL; } char* wrap_get_track_isrc(DiscId* UNUSED(d), int UNUSED(track_num)) { return NULL; } #else char* wrap_get_version_string(void) { return discid_get_version_string(); } int wrap_has_feature(enum discid_feature feature) { return discid_has_feature(feature); } char* wrap_get_mcn(DiscId* d) { return discid_get_mcn(d); } char* wrap_get_track_isrc(DiscId* d, int track_num) { return discid_get_track_isrc(d, track_num); } #endif /* libdiscid < 0.4.0 */ /* discid_read_sparse appeared in 0.5.0 and 0.5.0 finally introduced defines for * the version */ #if !defined(DISCID_VERSION_MAJOR) || \ (DISCID_VERSION_MAJOR == 0 && DISCID_VERSION_MINOR < 5) int wrap_read_sparse(DiscId *d, const char *device, unsigned int UNUSED(features)) { return discid_read(d, device); } #else int wrap_read_sparse(DiscId *d, const char *device, unsigned int features) { return discid_read_sparse(d, device, features); } #endif /* libdiscid < 0.5.0 */ /* discid_get_toc_string appeared in 0.6.0 */ #if !defined(DISCID_VERSION_MAJOR) || \ (DISCID_VERSION_MAJOR == 0 && DISCID_VERSION_MINOR < 6) char* wrap_get_toc(DiscId* d) { return NULL; } # else char* wrap_get_toc(DiscId* d) { return discid_get_toc_string(d); } #endif python-libdiscid-1.0/libdiscid/discid-wrapper.h0000664000175000017500000000464612576077410023624 0ustar sebastiansebastian00000000000000/* Copyright 2013 Sebastian Ramacher * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef DISCID_WRAPPER_H #define DISCID_WRAPPER_H #include #if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) # define INTERNAL __attribute__((visibility("hidden"))) #elif defined(__SUNPRO_C) # define INTERNAL __hidden #else # define INTERNAL #endif /* use the availability of DISCID_FEATURE_LENGTH to detect libdiscid < 0.4.0 */ #ifndef DISCID_FEATURE_LENGTH enum discid_feature { DISCID_FEATURE_READ = 1, DISCID_FEATURE_MCN = 2, DISCID_FEATURE_ISRC = 4 }; #define DISCID_FEATURE_STR_READ "read" #define DISCID_FEATURE_STR_MCN "mcn" #define DISCID_FEATURE_STR_ISRC "isrc" #endif /* libdiscid < 0.4.0 */ int wrap_has_feature(enum discid_feature feature) INTERNAL; char* wrap_get_version_string(void) INTERNAL; /* discid_get_mcn and discid_get_track_isrc were introduced in 0.3.0 but there * is no way to reliable detect if the current platform supports mcn and isrc, * so let's assume they are not available and replace them with placeholders */ char* wrap_get_mcn(DiscId* d) INTERNAL; char* wrap_get_track_isrc(DiscId* d, int track_num) INTERNAL; /* discid_read_sparse appeared in 0.5.0 */ int wrap_read_sparse(DiscId *d, const char *device, unsigned int features) INTERNAL; /* discid_get_toc_string appeared in 0.6.0 */ char* wrap_get_toc(DiscId* d) INTERNAL; #endif python-libdiscid-1.0/libdiscid/discid.py0000664000175000017500000000327013031164102022315 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Module to retain compatbility with the old interface. """ from libdiscid.exceptions import DiscError from libdiscid._discid import DiscId from libdiscid._discid import default_device from libdiscid._discid import FEATURES_MAPPING, FEATURES from libdiscid._discid import FEATURE_READ, FEATURE_MCN, FEATURE_ISRC from libdiscid._discid import __discid_version__ import warnings warnings.warn('libdiscid.discid is deprecated and should not be used in newly ' 'written code. It will be removed sometime in the future.', DeprecationWarning) python-libdiscid-1.0/libdiscid/exceptions.py0000664000175000017500000000251313031164102023236 0ustar sebastiansebastian00000000000000# -*- coding: utf-8 -*- # Copyright 2013 Sebastian Ramacher # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Module containing all the exceptions from libdiscid """ class DiscError(IOError): """ :func:`libdiscid.read` and :func:`libdiscid.put` will raise this exception when an error occurred. """ python-libdiscid-1.0/python_libdiscid.egg-info/0000775000175000017500000000000013031177544023613 5ustar sebastiansebastian00000000000000python-libdiscid-1.0/python_libdiscid.egg-info/PKG-INFO0000664000175000017500000000640313031177544024713 0ustar sebastiansebastian00000000000000Metadata-Version: 1.1 Name: python-libdiscid Version: 1.0 Summary: Python bindings for libdiscid Home-page: https://github.com/sebastinas/python-libdiscid Author: Sebastian Ramacher Author-email: sebastian+dev@ramacher.at License: Expat Description: libdiscid Python bindings ========================= python-libdiscid implements Python bindings for libdiscid using Cython. Both Python 2 (>= 2.7) and 3 (>= 3.4) are supported. Dependencies ------------ * libdiscid * Cython (>= 0.15, optional) * pkgconfig (optional) Note that the tarballs come with pre-built C source for the Cython module. So Cython is only required if one builds python-libdiscid from the git repository or if one wants to change anything in the Cython module. If pkgconfig is installed, setup.py uses libdiscid's pkg-config information to set include directories, libraries to link, etc. Quick installation guide ------------------------ python-libdiscid is available in some distributions: * Debian/Ubuntu: ``apt-get install python-libdiscid`` (Python 2) or ``apt-get install python3-libdiscid`` (Python 3) python-libdiscid can be installed via ``pip``:: pip install python-libdiscid or by running:: python setup.py install If you just want to try it locally, run:: python setup.py build_ext -i and hack right away. You can also run:: python setup.py build but please make sure that ``build/lib.*`` is in ``sys.path`` before the source folder. A note for Windows users ------------------------ There are eggs available from PyPI that don't require the extension module to be built. If these are used, it is still required to drop a working discid.dll in ``C:\WINDOWS\system32`` (or wherever it can be found). Usage ----- :: from libdiscid import read disc = read("/dev/cdrom") print("id: {}".format(disc.id)) License ------- python-libdiscid is released under the Expat license. Check LICENSE for details. Build status ------------ |TravisCI|_ .. |TravisCI| image:: https://travis-ci.org/sebastinas/python-libdiscid.svg?branch=master .. _TravisCI: https://travis-ci.org/sebastinas/python-libdiscid Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping Classifier: Topic :: Software Development :: Libraries :: Python Modules python-libdiscid-1.0/python_libdiscid.egg-info/SOURCES.txt0000664000175000017500000000133513031177544025501 0ustar sebastiansebastian00000000000000LICENSE MANIFEST.in README.rst changelog setup.cfg setup.py docs/api.compat.rst docs/api.rst docs/changelog.rst docs/conf.py docs/index.rst docs/installation.rst docs/license.rst docs/misc.rst docs/usage.rst libdiscid/__init__.py libdiscid/_discid.c libdiscid/_discid.pyx libdiscid/cdiscid.pxd libdiscid/discid-wrapper.c libdiscid/discid-wrapper.h libdiscid/discid.py libdiscid/exceptions.py libdiscid/compat/__init__.py libdiscid/compat/discid.py libdiscid/tests/__init__.py libdiscid/tests/common.py libdiscid/tests/test_compat_discid.py libdiscid/tests/test_libdiscid.py python_libdiscid.egg-info/PKG-INFO python_libdiscid.egg-info/SOURCES.txt python_libdiscid.egg-info/dependency_links.txt python_libdiscid.egg-info/top_level.txtpython-libdiscid-1.0/python_libdiscid.egg-info/dependency_links.txt0000664000175000017500000000000113031177544027661 0ustar sebastiansebastian00000000000000 python-libdiscid-1.0/python_libdiscid.egg-info/top_level.txt0000664000175000017500000000001213031177544026336 0ustar sebastiansebastian00000000000000libdiscid python-libdiscid-1.0/LICENSE0000664000175000017500000000210212576077415017603 0ustar sebastiansebastian00000000000000Copyright (C) 2013 Sebastian Ramacher Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. python-libdiscid-1.0/MANIFEST.in0000664000175000017500000000023612501036702020320 0ustar sebastiansebastian00000000000000include libdiscid/discid-wrapper.h include libdiscid/cdiscid.pxd libdiscid/_discid.pyx include LICENSE README.rst changelog recursive-include docs *.py *.rst python-libdiscid-1.0/README.rst0000664000175000017500000000351013031173474020256 0ustar sebastiansebastian00000000000000libdiscid Python bindings ========================= python-libdiscid implements Python bindings for libdiscid using Cython. Both Python 2 (>= 2.7) and 3 (>= 3.4) are supported. Dependencies ------------ * libdiscid * Cython (>= 0.15, optional) * pkgconfig (optional) Note that the tarballs come with pre-built C source for the Cython module. So Cython is only required if one builds python-libdiscid from the git repository or if one wants to change anything in the Cython module. If pkgconfig is installed, setup.py uses libdiscid's pkg-config information to set include directories, libraries to link, etc. Quick installation guide ------------------------ python-libdiscid is available in some distributions: * Debian/Ubuntu: ``apt-get install python-libdiscid`` (Python 2) or ``apt-get install python3-libdiscid`` (Python 3) python-libdiscid can be installed via ``pip``:: pip install python-libdiscid or by running:: python setup.py install If you just want to try it locally, run:: python setup.py build_ext -i and hack right away. You can also run:: python setup.py build but please make sure that ``build/lib.*`` is in ``sys.path`` before the source folder. A note for Windows users ------------------------ There are eggs available from PyPI that don't require the extension module to be built. If these are used, it is still required to drop a working discid.dll in ``C:\WINDOWS\system32`` (or wherever it can be found). Usage ----- :: from libdiscid import read disc = read("/dev/cdrom") print("id: {}".format(disc.id)) License ------- python-libdiscid is released under the Expat license. Check LICENSE for details. Build status ------------ |TravisCI|_ .. |TravisCI| image:: https://travis-ci.org/sebastinas/python-libdiscid.svg?branch=master .. _TravisCI: https://travis-ci.org/sebastinas/python-libdiscid python-libdiscid-1.0/changelog0000664000175000017500000000672613031175164020453 0ustar sebastiansebastian00000000000000python-libdiscid (1.0) stable; urgency=low * Fix compatibility issues with Cython 0.23. * Add support for Python 3.4, 3.5, and 3.6. * Drop (active) support for Python 2.6, 3.2 and 3.3. This change only affects the test suite. * Fix various spelling mistakes. * Internal changes: - Use pkgconfig to detect discid. - Use Travis-CI. -- Sebastian Ramacher Thu, 29 Dec 2016 12:58:34 +0100 python-libdiscid (0.4.1) unstable; urgency=low [ Sebastian Ramacher ] * Fix typo in test_read_not_implemented test. * Internal changes: - Move test data to common location for deduplication. [ Johannes Dewender ] * libdiscid.compat.discid: Add toc_string property for compatibility with python-discid 1.1.0. -- Sebastian Ramacher Fri, 03 Jan 2014 21:34:17 +0100 python-libdiscid (0.4) unstable; urgency=low * Add support for libdiscid's discid_get_toc_string introduced in 0.6.0. * Add sectors_to_seconds to libdiscid. * Use shipped C source to build libdiscid._discid if Cython is not available. * Internal changes: - Release resources acquired from libdiscid earlier. After a successful read or put all the information is stored in the returned object and no further calls to libdiscid are necessary to access the data. -- Sebastian Ramacher Thu, 03 Oct 2013 15:39:35 +0200 python-libdiscid (0.3.1) unstable; urgency=low * Fix handling of None in libdiscid.compat.discid.read. -- Sebastian Ramacher Mon, 09 Sep 2013 15:36:41 +0200 python-libdiscid (0.3) unstable; urgency=low * The device used to read the data is now stored in DiscId's device property. * Make DiscError available as libdiscid.DiscError. * libdiscid.compat.discid: - Fix features handling. - Try to decode devices with the filesystem's encoding and features with ascii on a best effort basis. - Thanks to Andreas Stührk for the hints. * Internal changes: - Move most of the API documentation from the rst files back to the code. - Name the extension module as libdiscid._discid and move some bits that don't require Cython away. -- Sebastian Ramacher Thu, 04 Jul 2013 02:02:25 +0200 python-libdiscid (0.2.0) unstable; urgency=low * Add libdiscid.compat.discid module that provides the same interface as the discid module from python-discid. This allows devlopers to write applications that work with both python-libdiscid and python-discid without much effort. * Deprecate libdiscid.DEFAULT_DEVICE in favor of libdiscid.default_device. The default device might change one some platforms during the runtime, so it shouldn't be a constant. -- Sebastian Ramacher Sun, 30 Jun 2013 21:39:27 +0200 python-libdiscid (0.1.2) unstable; urgency=low * Fix issues with Cython 0.19. * Don't fail tests if MCN or ISCR is not available on the platform. -- Sebastian Ramacher Thu, 09 May 2013 16:28:29 +0200 python-libdiscid (0.1.1) unstable; urgency=low * Fix issues with symbol names if python-libdiscid was built against a libdiscid version prior to 0.5.0 and then used with 0.5.0. -- Sebastian Ramacher Sat, 13 Apr 2013 00:55:02 +0200 python-libdiscid (0.1) unstable; urgency=low * Initial release. -- Sebastian Ramacher Thu, 11 Apr 2013 21:43:54 +0200 python-libdiscid-1.0/setup.cfg0000664000175000017500000000024413031177544020413 0ustar sebastiansebastian00000000000000[build_sphinx] source-dir = docs build-dir = build all_files = 1 [upload_docs] upload-dir = build/html [egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 python-libdiscid-1.0/setup.py0000775000175000017500000000500713031177442020306 0ustar sebastiansebastian00000000000000#!/usr/bin/python import os.path import sys from setuptools import setup, Extension try: from Cython.Build import cythonize have_cython = True except ImportError: have_cython = False try: import pkgconfig have_pkgconfig = True except ImportError: have_pkgconfig = False if have_pkgconfig and pkgconfig.exists('libdiscid'): flags = pkgconfig.parse('libdiscid') define_macros = flags['define_macros'] include_dirs = flags['include_dirs'] library_dirs = flags['library_dirs'] libraries = list(flags['libraries']) else: define_macros = '' include_dirs = '' library_dirs = '' libraries = 'discid' if have_cython: # if Cython is available, rebuild _discid.c ext = cythonize([ Extension('libdiscid._discid', [ 'libdiscid/_discid.pyx', 'libdiscid/discid-wrapper.c' ], define_macros=define_macros, include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries ) ]) else: # ... otherwise use the shipped version of _discid.c ext = [ Extension('libdiscid._discid', [ 'libdiscid/_discid.c', 'libdiscid/discid-wrapper.c' ], define_macros=define_macros, include_dirs=include_dirs, library_dirs=library_dirs, libraries=libraries ) ] setup_requires = ['pkgconfig'] if have_cython: # if Cython is available, check if it's new enough setup_requires.append('cython >= 0.15') def read(name): f = open(os.path.join(os.path.dirname(__file__), name)) ret = f.read() f.close() return ret setup( name='python-libdiscid', version='1.0', description='Python bindings for libdiscid', long_description=read('README.rst'), author='Sebastian Ramacher', author_email='sebastian+dev@ramacher.at', url='https://github.com/sebastinas/python-libdiscid', license='Expat', ext_modules=ext, packages=[ 'libdiscid', 'libdiscid.tests', 'libdiscid.compat' ], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping', 'Topic :: Software Development :: Libraries :: Python Modules' ], test_suite='libdiscid.tests', setup_requires=setup_requires ) python-libdiscid-1.0/PKG-INFO0000664000175000017500000000640313031177544017672 0ustar sebastiansebastian00000000000000Metadata-Version: 1.1 Name: python-libdiscid Version: 1.0 Summary: Python bindings for libdiscid Home-page: https://github.com/sebastinas/python-libdiscid Author: Sebastian Ramacher Author-email: sebastian+dev@ramacher.at License: Expat Description: libdiscid Python bindings ========================= python-libdiscid implements Python bindings for libdiscid using Cython. Both Python 2 (>= 2.7) and 3 (>= 3.4) are supported. Dependencies ------------ * libdiscid * Cython (>= 0.15, optional) * pkgconfig (optional) Note that the tarballs come with pre-built C source for the Cython module. So Cython is only required if one builds python-libdiscid from the git repository or if one wants to change anything in the Cython module. If pkgconfig is installed, setup.py uses libdiscid's pkg-config information to set include directories, libraries to link, etc. Quick installation guide ------------------------ python-libdiscid is available in some distributions: * Debian/Ubuntu: ``apt-get install python-libdiscid`` (Python 2) or ``apt-get install python3-libdiscid`` (Python 3) python-libdiscid can be installed via ``pip``:: pip install python-libdiscid or by running:: python setup.py install If you just want to try it locally, run:: python setup.py build_ext -i and hack right away. You can also run:: python setup.py build but please make sure that ``build/lib.*`` is in ``sys.path`` before the source folder. A note for Windows users ------------------------ There are eggs available from PyPI that don't require the extension module to be built. If these are used, it is still required to drop a working discid.dll in ``C:\WINDOWS\system32`` (or wherever it can be found). Usage ----- :: from libdiscid import read disc = read("/dev/cdrom") print("id: {}".format(disc.id)) License ------- python-libdiscid is released under the Expat license. Check LICENSE for details. Build status ------------ |TravisCI|_ .. |TravisCI| image:: https://travis-ci.org/sebastinas/python-libdiscid.svg?branch=master .. _TravisCI: https://travis-ci.org/sebastinas/python-libdiscid Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping Classifier: Topic :: Software Development :: Libraries :: Python Modules