python-libdiscid-0.4.1/0000775000175000017500000000000012261620352016726 5ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/docs/0000775000175000017500000000000012261620352017656 5ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/docs/api.compat.rst0000664000175000017500000000041512225541632022446 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-0.4.1/docs/api.rst0000664000175000017500000000055312225541632021167 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-0.4.1/docs/changelog.rst0000664000175000017500000000007612225541632022345 0ustar sebastiansebastian00000000000000Change log ---------- .. include:: ../changelog :literal: python-libdiscid-0.4.1/docs/conf.py0000664000175000017500000001345012225541632021163 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-0.4.1/docs/index.rst0000664000175000017500000000100212225541632021513 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-0.4.1/docs/installation.rst0000664000175000017500000000524312225541632023120 0ustar sebastiansebastian00000000000000Installation ------------ Dependencies ^^^^^^^^^^^^ `python-libdiscid` depends on the following components: * :musicbrainz:`libdiscid` * `Cython`__ (>= 0.15) 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. On Debian based systems, the dependencies are only an `apt-get` away:: apt-get install cython libdiscid0-dev `Cython` is also available via `PyPI`__:: pip install cython .. __: http://www.cython.org/ .. __: https://pypi.python.org/pypi/Cython/ Known supported distributions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `python-libdiscid` is available in some distributions: * `Debian `_ * `Ubuntu `_ * `Arch `_ 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.2, 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.2')) 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-0.4.1/docs/license.rst0000664000175000017500000000010412225541632022030 0ustar sebastiansebastian00000000000000.. _license: License ------- .. include:: ../LICENSE :literal: python-libdiscid-0.4.1/docs/misc.rst0000664000175000017500000000210312225541632021342 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.5.0, that is: * retrieval of the disc's Media Catalogue Number and retrieving the :musicbrainz:`International Standard Recording Code ` of the tracks if you're using `libdiscid` 0.4.0 and above. * selective reading support if you're using `libdiscid` 0.5.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-0.4.1/docs/usage.rst0000664000175000017500000000472012225541632021522 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: %s" % (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: %s" % (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: %s" % (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: %s" % (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: %s" % (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-0.4.1/libdiscid/0000775000175000017500000000000012261620352020654 5ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/libdiscid/compat/0000775000175000017500000000000012261620352022137 5ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/libdiscid/compat/__init__.py0000664000175000017500000000000012163307621024240 0ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/libdiscid/compat/discid.py0000664000175000017500000001344412225542046023761 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-0.4.1/libdiscid/tests/0000775000175000017500000000000012261620352022016 5ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/libdiscid/tests/__init__.py0000664000175000017500000000000012131544633024120 0ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/libdiscid/tests/common.py0000664000175000017500000000411212225545572023670 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 """ # as long as Python 3.2 is supported, hack around the missing u try: u = unicode except NameError: u = str 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 = u('TqvKjMu7dMliSfmVEBtrL7sBSno-') freedb_id = u('b60d770f') toc = u(' ').join(map(u, [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-0.4.1/libdiscid/tests/test_compat_discid.py0000664000175000017500000001231012225546021026226 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 """ try: import unittest2 as unittest except ImportError: import unittest import libdiscid from libdiscid.compat import discid from libdiscid.compat.discid import DiscError, TOCError # as long as Python 3.2 is supported, hack around the missing u try: u = unicode except NameError: u = str 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, u('/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-0.4.1/libdiscid/tests/test_libdiscid.py0000664000175000017500000001276512225545763025404 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 """ try: import unittest2 as unittest except ImportError: import unittest import libdiscid import libdiscid.tests.common from libdiscid import DiscError # as long as Python 3.2 is supported, hack around the missing u try: u = unicode except NameError: u = str 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, u('/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, u('')) # MCN is not available if one calls put if libdiscid.FEATURES_MAPPING[libdiscid.FEATURE_MCN] in libdiscid.FEATURES: self.assertEqual(disc.mcn, u('')) 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-0.4.1/libdiscid/__init__.py0000664000175000017500000002223212261620201022757 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 retrive 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 offets. 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-0.4.1/libdiscid/_discid.c0000664000175000017500000111072112261615772022433 0ustar sebastiansebastian00000000000000/* Generated by Cython 0.19.2 on Fri Jan 3 21:22:16 2014 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 0 #else #include "pyconfig.h" #ifdef PYLONG_BITS_IN_DIGIT #define CYTHON_USE_PYLONG_INTERNALS 1 #else #define CYTHON_USE_PYLONG_INTERNALS 0 #endif #endif #endif #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 < 0x02040000 #error Cython requires Python 2.4+. #else #include /* For offsetof */ #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 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_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ (PyErr_Format(PyExc_TypeError, \ "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ (PyObject*)0)) #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ !PyComplex_Check(o)) #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #define __Pyx_PyIndex_Check PyIndex_Check #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif #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, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #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) #endif #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_VERSION_HEX < 0x02060000 #define Py_TPFLAGS_HAVE_VERSION_TAG 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_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 #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_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #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_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #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_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #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 #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 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) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef CYTHON_INLINE #if 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 #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 #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is a quiet NaN. */ float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #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 #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #define __PYX_HAVE__libdiscid___discid #define __PYX_HAVE_API__libdiscid___discid #include "string.h" #include "discid-wrapper.h" #include "stdio.h" #include "pythread.h" #include "limits.h" #include "stdlib.h" #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #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 typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ #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 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(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_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) #define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) #define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) #define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((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 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_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #if CYTHON_COMPILING_IN_CPYTHON #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 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params() { PyObject* sys = NULL; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); 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 == NULL) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (ascii_chars_b == NULL || strncmp(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 '%s' is not a superset of ascii.", default_encoding_c); goto bad; } } Py_XDECREF(sys); Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return 0; bad: Py_XDECREF(sys); 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() { PyObject* sys = NULL; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (sys == NULL) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); if (default_encoding == NULL) goto bad; default_encoding_c = PyBytes_AS_STRING(default_encoding); __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(sys); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(sys); Py_XDECREF(default_encoding); return -1; } #endif #endif #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #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 int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "_discid.pyx", "type.pxd", "bool.pxd", "complex.pxd", }; /*--- Type declarations ---*/ struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__; struct __pyx_obj_9libdiscid_7_discid_DiscId; struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__; /* "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":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":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":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":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":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":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":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; #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); /*proto*/ #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 /* CYTHON_REFNANNY */ #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) #if CYTHON_COMPILING_IN_CPYTHON 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 static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*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)); #include 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); /*proto*/ static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ #if CYTHON_COMPILING_IN_CPYTHON 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 static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) { PyObject *method, *result = NULL; if (unlikely(!args)) return NULL; method = __Pyx_PyObject_GetAttrStr(obj, method_name); if (unlikely(!method)) goto bad; result = PyObject_Call(method, args, NULL); Py_DECREF(method); bad: Py_DECREF(args); return result; } #define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \ __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3)) #define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \ __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2)) #define __Pyx_PyObject_CallMethod1(obj, name, arg1) \ __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1)) #define __Pyx_PyObject_CallMethod0(obj, name) \ __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple)) #define __Pyx_Generator_USED #include #include typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD __pyx_generator_body_t body; PyObject *closure; PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; PyObject *gi_weakreflist; PyObject *classobj; PyObject *yieldfrom; int resume_label; char is_running; // using T_BOOL for property below requires char value } __pyx_GeneratorObject; static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, PyObject *closure); static int __pyx_Generator_init(void); static int __Pyx_Generator_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 static int __Pyx_check_binary_version(void); #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 static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ typedef struct { int code_line; PyCodeObject* code_object; } __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); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'libc.string' */ /* Module declarations from 'libdiscid.cdiscid' */ /* Module declarations from 'cpython.version' */ /* 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 'libc.stdio' */ /* Module declarations from 'cpython.object' */ /* Module declarations from 'cpython.sequence' */ /* Module declarations from 'cpython.mapping' */ /* Module declarations from 'cpython.iterator' */ /* Module declarations from '__builtin__' */ /* Module declarations from 'cpython.type' */ static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; /* 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___pyx_scope_struct_2___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_3_genexpr = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct____get__ = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid_DiscId = 0; static PyTypeObject *__pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_4___get__ = 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 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___pyx_scope_struct_2___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_3_genexpr(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_tp_new_9libdiscid_7_discid___pyx_scope_struct____get__(PyTypeObject *t, PyObject *a, PyObject *k); /*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_4___get__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_1[] = "Failed to allocate DiscId object"; static char __pyx_k_3[] = "read is not available with this version of libdiscid and/or platform"; static char __pyx_k_6[] = "Failed to allocate memory to store offsets"; static char __pyx_k_8[] = " The MusicBrainz :musicbrainz:`Disc ID`.\n "; static char __pyx_k_9[] = " The :musicbrainz:`FreeDB` Disc ID (without category).\n "; static char __pyx_k_10[] = " 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 "; static char __pyx_k_11[] = " The web service URL for info about the CD\n\n With this url you can retrive information about the CD in XML from the\n MusicBrainz web service.\n "; static char __pyx_k_12[] = " Number of the first audio track.\n "; static char __pyx_k_13[] = " Number of the last audio track.\n "; static char __pyx_k_14[] = " Total sector count.\n "; static char __pyx_k_15[] = " 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 "; static char __pyx_k_16[] = " 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 "; static char __pyx_k_17[] = " Media Catalogue Number of the disc.\n "; static char __pyx_k_18[] = " 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 "; static char __pyx_k_19[] = " The device the data was read from.\n\n If it is ``None``, :func:`libdiscid.put` was called to create the instance.\n "; static char __pyx_k_20[] = " String representing the CD's Table of Contents (TOC).\n "; static char __pyx_k_21[] = "libdiscid.exceptions"; static char __pyx_k_23[] = "/home/sebastian/development/python-libdiscid/libdiscid/_discid.pyx"; static char __pyx_k_24[] = "libdiscid._discid"; static char __pyx_k__args[] = "args"; static char __pyx_k__last[] = "last"; static char __pyx_k__send[] = "send"; static char __pyx_k__close[] = "close"; static char __pyx_k__first[] = "first"; static char __pyx_k__items[] = "items"; static char __pyx_k__range[] = "range"; static char __pyx_k__throw[] = "throw"; static char __pyx_k__device[] = "device"; static char __pyx_k__offsets[] = "offsets"; static char __pyx_k__sectors[] = "sectors"; static char __pyx_k__FEATURES[] = "FEATURES"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__features[] = "features"; static char __pyx_k__DiscError[] = "DiscError"; static char __pyx_k__enumerate[] = "enumerate"; static char __pyx_k____import__[] = "__import__"; static char __pyx_k__last_track[] = "last_track"; static char __pyx_k__FEATURE_MCN[] = "FEATURE_MCN"; static char __pyx_k__MemoryError[] = "MemoryError"; static char __pyx_k__first_track[] = "first_track"; static char __pyx_k__FEATURE_ISRC[] = "FEATURE_ISRC"; static char __pyx_k__FEATURE_READ[] = "FEATURE_READ"; static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k__default_device[] = "default_device"; static char __pyx_k__FEATURES_MAPPING[] = "FEATURES_MAPPING"; static char __pyx_k____discid_version__[] = "__discid_version__"; static char __pyx_k__NotImplementedError[] = "NotImplementedError"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_n_s_21; static PyObject *__pyx_kp_s_23; static PyObject *__pyx_n_s_24; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_6; static PyObject *__pyx_n_s__DiscError; 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_n_s__MemoryError; static PyObject *__pyx_n_s__NotImplementedError; static PyObject *__pyx_n_s____discid_version__; static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; 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__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__items; static PyObject *__pyx_n_s__last; static PyObject *__pyx_n_s__last_track; static PyObject *__pyx_n_s__offsets; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__sectors; static PyObject *__pyx_n_s__send; static PyObject *__pyx_n_s__throw; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static unsigned int __pyx_k_5; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_7; static PyObject *__pyx_k_codeobj_22; /* "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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyBoolObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = ((PyBoolObject *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(((PyObject *)__pyx_r)); __pyx_t_1 = ((PyObject *)__Pyx_decode_c_string(__pyx_v_s, 0, strlen(__pyx_v_s), NULL, NULL, PyUnicode_DecodeUTF8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (!(likely(PyUnicode_CheckExact(((PyObject *)__pyx_t_1)))||(PyErr_Format(PyExc_TypeError, "Expected unicode, got %.200s", Py_TYPE(((PyObject *)__pyx_t_1))->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __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: */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "libdiscid/_discid.pyx":57 * raise MemoryError('Failed to allocate DiscId object') * * self._have_read = False # <<<<<<<<<<<<<< * self._device = None * */ __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->_have_read); __Pyx_DECREF(((PyObject *)__pyx_v_self->_have_read)); __pyx_v_self->_have_read = ((PyBoolObject *)__pyx_t_2); __pyx_t_2 = 0; /* "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(((PyObject *)__pyx_v_self->_device)); __pyx_v_self->_device = ((PyObject*)Py_None); __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; } /* 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)); __Pyx_RefNannyFinishContext(); } /* "libdiscid/_discid.pyx":60 * self._device = None * * def __dealloc__(self): # <<<<<<<<<<<<<< * if self._c_discid is not NULL: * cdiscid.discid_free(self._c_discid) */ 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); goto __pyx_L3; } __pyx_L3:; __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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __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 = PyObject_Call(__pyx_builtin_NotImplementedError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__DiscError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = ((PyObject *)((struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *)__pyx_v_self->__pyx_vtab)->_get_error_msg(__pyx_v_self)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; /* "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_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); if (!(likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->_have_read); __Pyx_DECREF(((PyObject *)__pyx_v_self->_have_read)); __pyx_v_self->_have_read = ((PyBoolObject *)__pyx_t_4); __pyx_t_4 = 0; __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_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; } /* 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; 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}; /* "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. * */ 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_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __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_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_features == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_features = __pyx_k_5; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("read", 0, 0, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __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); 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; char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__default_device); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(PyUnicode_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected unicode, got %.200s", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF_SET(__pyx_v_device, ((PyObject*)__pyx_t_4)); __pyx_t_4 = 0; goto __pyx_L3; } __pyx_L3:; /* "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(((PyObject *)__pyx_v_device) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "encode"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_4 = ((PyObject *)PyUnicode_AsUTF8String(__pyx_v_device)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __pyx_v_py_byte_device = ((PyObject *)__pyx_t_4); __pyx_t_4 = 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_5 = __Pyx_PyObject_AsString(__pyx_v_py_byte_device); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_cdevice = __pyx_t_5; /* "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_4 = ((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_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_ret = __pyx_t_4; __pyx_t_4 = 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(((PyObject *)__pyx_v_device)); __Pyx_GIVEREF(((PyObject *)__pyx_v_device)); __Pyx_GOTREF(__pyx_v_self->_device); __Pyx_DECREF(((PyObject *)__pyx_v_self->_device)); __pyx_v_self->_device = __pyx_v_device; __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_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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__DiscError); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_9libdiscid_7_discid_DiscId *)__pyx_v_self->__pyx_vtab)->_get_error_msg(__pyx_v_self)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "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(((PyObject *)__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_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_have_read); __Pyx_DECREF(((PyObject *)__pyx_v_self->_have_read)); __pyx_v_self->_have_read = ((PyBoolObject *)__pyx_t_3); __pyx_t_3 = 0; __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_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; } /* 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 offets.\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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 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_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "put") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __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_AsInt(values[0]); if (unlikely((__pyx_v_first == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_last = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_last == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_sectors = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_sectors == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __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); __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 offets. * */ 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __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 = PyObject_Call(__pyx_builtin_MemoryError, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; /* "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 (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_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; } for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_4)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} #else __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_4)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} #else __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} #endif } else { __pyx_t_6 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_6)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} } 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 = PyNumber_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L5;} __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_AsInt(__pyx_v_v); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5;} __pyx_t_6 = PyNumber_Add(__pyx_v_i, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5;} __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_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; (__pyx_v_coffsets[__pyx_t_8]) = __pyx_t_7; } __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_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L5;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L4; } /* "libdiscid/_discid.pyx":121 * return self._put(first, last, coffsets) * finally: * free(coffsets) # <<<<<<<<<<<<<< * * cdef unicode _get_error_msg(self): */ /*finally:*/ { int __pyx_why; PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb; int __pyx_exc_lineno; __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; __pyx_why = 0; goto __pyx_L6; __pyx_L4: __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; __pyx_exc_lineno = 0; __pyx_why = 3; goto __pyx_L6; __pyx_L5: { __pyx_why = 4; __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; __Pyx_ErrFetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb); __pyx_exc_lineno = __pyx_lineno; goto __pyx_L6; } __pyx_L6:; free(__pyx_v_coffsets); switch (__pyx_why) { case 3: goto __pyx_L0; case 4: { __Pyx_ErrRestore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb); __pyx_lineno = __pyx_exc_lineno; __pyx_exc_type = 0; __pyx_exc_value = 0; __pyx_exc_tb = 0; goto __pyx_L1_error; } } } __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_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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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(((PyObject *)__pyx_r)); __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(discid_get_error_msg(__pyx_v_self->_c_discid))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":130 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_id(self._c_discid)) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(discid_get_id(__pyx_v_self->_c_discid))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":137 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_freedb_id(self._c_discid)) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(discid_get_freedb_id(__pyx_v_self->_c_discid))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":147 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_submission_url(self._c_discid)) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(discid_get_submission_url(__pyx_v_self->_c_discid))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":157 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return _to_unicode(cdiscid.discid_get_webservice_url(self._c_discid)) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(discid_get_webservice_url(__pyx_v_self->_c_discid))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":164 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_first_track_num(self._c_discid) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = PyInt_FromLong(discid_get_first_track_num(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":171 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_last_track_num(self._c_discid) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = PyInt_FromLong(discid_get_last_track_num(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":178 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return cdiscid.discid_get_sectors(self._c_discid) * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = PyInt_FromLong(discid_get_sectors(__pyx_v_self->_c_discid)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___2generator(__pyx_GeneratorObject *__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 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_RefNannyFinishContext(); return NULL; } __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___2generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.track_offsets.__get__.genexpr", __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; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_offsets_7__get___2generator(__pyx_GeneratorObject *__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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __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)) * */ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_track); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyInt_FromLong(discid_get_track_offset(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_c_discid, __pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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_generator->resume_label = -1; __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* "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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_RefNannyFinishContext(); return NULL; } __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_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___2generator1(__pyx_GeneratorObject *__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 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_RefNannyFinishContext(); return NULL; } __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___2generator1, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.track_lengths.__get__.genexpr", __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; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_13track_lengths_7__get___2generator1(__pyx_GeneratorObject *__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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __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)) * */ __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_cur_scope->__pyx_v_track); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyInt_FromLong(discid_get_track_length(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self->_c_discid, __pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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_generator->resume_label = -1; __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* "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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_RefNannyFinishContext(); return NULL; } __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_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":207 * """ * * def __get__(self): # <<<<<<<<<<<<<< * if not _has_feature(cdiscid.DISCID_FEATURE_MCN): * return None */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __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; goto __pyx_L3; } __pyx_L3:; /* "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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(wrap_get_mcn(__pyx_v_self->_c_discid))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___2generator2(__pyx_GeneratorObject *__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 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_RefNannyFinishContext(); return NULL; } __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_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___2generator2, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("libdiscid._discid.DiscId.track_isrcs.__get__.genexpr", __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; } static PyObject *__pyx_gb_9libdiscid_7_discid_6DiscId_11track_isrcs_7__get___2generator2(__pyx_GeneratorObject *__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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __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_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __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":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_AsInt(__pyx_cur_scope->__pyx_v_track); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; 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_generator->resume_label = -1; __Pyx_Generator_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return NULL; } /* "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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_RefNannyFinishContext(); return NULL; } __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_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __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; goto __pyx_L3; } __pyx_L3:; /* "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_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __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_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; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":232 * """ * * def __get__(self): # <<<<<<<<<<<<<< * return self._device * */ 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(((PyObject *)__pyx_v_self->_device)); __pyx_r = ((PyObject *)__pyx_v_self->_device); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* 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)); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":239 * """ * * def __get__(self): # <<<<<<<<<<<<<< * assert self._have_read * */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 __pyx_t_1 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->_have_read)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(__pyx_v_tocstr)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; goto __pyx_L3; } __pyx_L3:; /* "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; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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; Py_ssize_t __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); PyObject *__pyx_t_5 = NULL; 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __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_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__FEATURES_MAPPING); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __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_CPYTHON 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_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __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_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); 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_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_f, __pyx_t_5); __pyx_t_5 = 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_AsInt(__pyx_v_f); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__has_feature(__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "libdiscid/_discid.pyx":258 * if _has_feature(f): * res.append(s) * return res # <<<<<<<<<<<<<< * * def default_device(): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(((PyObject *)__pyx_v_res)); __pyx_r = ((PyObject *)__pyx_v_res); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __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; } /* 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 = {__Pyx_NAMESTR("default_device"), (PyCFunction)__pyx_pw_9libdiscid_7_discid_1default_device, METH_NOARGS, __Pyx_DOCSTR(__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); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* "libdiscid/_discid.pyx":260 * return res * * def default_device(): # <<<<<<<<<<<<<< * """ The default device on this platform. * """ */ 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(discid_get_default_device())); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __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_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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *p; PyObject *o; if (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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_2___get__ *)o); p->__pyx_v_self = 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 ((__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) { 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* tmp; 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 PyMethodDef __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_2___get__[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_2___get__ = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_2___get__, /*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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *p; PyObject *o; if (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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_1_genexpr *)o); p->__pyx_outer_scope = 0; p->__pyx_v_track = 0; p->__pyx_t_0 = 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 ((__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) { 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* tmp; 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 PyMethodDef __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_1_genexpr[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_1_genexpr = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_1_genexpr, /*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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *p; PyObject *o; if (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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_3_genexpr *)o); p->__pyx_outer_scope = 0; p->__pyx_v_track = 0; p->__pyx_t_0 = 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 ((__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) { 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* tmp; 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 PyMethodDef __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_3_genexpr[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_3_genexpr = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_3_genexpr, /*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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *p; PyObject *o; if (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)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_5_genexpr *)o); p->__pyx_outer_scope = 0; p->__pyx_v_track = 0; p->__pyx_t_0 = 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 ((__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) { 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* tmp; 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 PyMethodDef __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_5_genexpr[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_5_genexpr, /*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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *p; PyObject *o; if (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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)o); p->__pyx_v_self = 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 ((__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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *p = (struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct____get__ *)o; PyObject* tmp; 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 PyMethodDef __pyx_methods_9libdiscid_7_discid___pyx_scope_struct____get__[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__ = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __pyx_methods_9libdiscid_7_discid___pyx_scope_struct____get__, /*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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 0, /*tp_finalize*/ #endif }; 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; o = (*t->tp_alloc)(t, 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)) { Py_DECREF(o); o = 0; } return o; } 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; 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); if (PyErr_Occurred()) PyErr_WriteUnraisable(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; } if (p->_device) { e = (*v)(p->_device, a); if (e) return e; } return 0; } static int __pyx_tp_clear_9libdiscid_7_discid_DiscId(PyObject *o) { struct __pyx_obj_9libdiscid_7_discid_DiscId *p = (struct __pyx_obj_9libdiscid_7_discid_DiscId *)o; PyObject* tmp; tmp = ((PyObject*)p->_have_read); p->_have_read = ((PyBoolObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->_device); p->_device = ((PyObject*)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[] = { {__Pyx_NAMESTR("read"), (PyCFunction)__pyx_pw_9libdiscid_7_discid_6DiscId_5read, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_9libdiscid_7_discid_6DiscId_4read)}, {__Pyx_NAMESTR("put"), (PyCFunction)__pyx_pw_9libdiscid_7_discid_6DiscId_7put, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__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, __Pyx_DOCSTR(__pyx_k_8), 0}, {(char *)"freedb_id", __pyx_getprop_9libdiscid_7_discid_6DiscId_freedb_id, 0, __Pyx_DOCSTR(__pyx_k_9), 0}, {(char *)"submission_url", __pyx_getprop_9libdiscid_7_discid_6DiscId_submission_url, 0, __Pyx_DOCSTR(__pyx_k_10), 0}, {(char *)"webservice_url", __pyx_getprop_9libdiscid_7_discid_6DiscId_webservice_url, 0, __Pyx_DOCSTR(__pyx_k_11), 0}, {(char *)"first_track", __pyx_getprop_9libdiscid_7_discid_6DiscId_first_track, 0, __Pyx_DOCSTR(__pyx_k_12), 0}, {(char *)"last_track", __pyx_getprop_9libdiscid_7_discid_6DiscId_last_track, 0, __Pyx_DOCSTR(__pyx_k_13), 0}, {(char *)"sectors", __pyx_getprop_9libdiscid_7_discid_6DiscId_sectors, 0, __Pyx_DOCSTR(__pyx_k_14), 0}, {(char *)"track_offsets", __pyx_getprop_9libdiscid_7_discid_6DiscId_track_offsets, 0, __Pyx_DOCSTR(__pyx_k_15), 0}, {(char *)"track_lengths", __pyx_getprop_9libdiscid_7_discid_6DiscId_track_lengths, 0, __Pyx_DOCSTR(__pyx_k_16), 0}, {(char *)"mcn", __pyx_getprop_9libdiscid_7_discid_6DiscId_mcn, 0, __Pyx_DOCSTR(__pyx_k_17), 0}, {(char *)"track_isrcs", __pyx_getprop_9libdiscid_7_discid_6DiscId_track_isrcs, 0, __Pyx_DOCSTR(__pyx_k_18), 0}, {(char *)"device", __pyx_getprop_9libdiscid_7_discid_6DiscId_device, 0, __Pyx_DOCSTR(__pyx_k_19), 0}, {(char *)"toc", __pyx_getprop_9libdiscid_7_discid_6DiscId_toc, 0, __Pyx_DOCSTR(__pyx_k_20), 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid_DiscId = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __Pyx_DOCSTR(" 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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 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) { struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *p; PyObject *o; if (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__)); PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } p = ((struct __pyx_obj_9libdiscid_7_discid___pyx_scope_struct_4___get__ *)o); p->__pyx_v_self = 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 ((__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) { 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* tmp; 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 PyMethodDef __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_4___get__[] = { {0, 0, 0, 0} }; static PyTypeObject __pyx_type_9libdiscid_7_discid___pyx_scope_struct_4___get__ = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("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*/ #else 0, /*reserved*/ #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*/ __pyx_methods_9libdiscid_7_discid___pyx_scope_struct_4___get__, /*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*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 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 __Pyx_NAMESTR("_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_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0}, {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, {&__pyx_n_s__DiscError, __pyx_k__DiscError, sizeof(__pyx_k__DiscError), 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_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____discid_version__, __pyx_k____discid_version__, sizeof(__pyx_k____discid_version__), 0, 0, 1, 1}, {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 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____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 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__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__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__offsets, __pyx_k__offsets, sizeof(__pyx_k__offsets), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__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__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_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __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_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); /* "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_k_tuple_4 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "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_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_6)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); /* "libdiscid/_discid.pyx":260 * return res * * def default_device(): # <<<<<<<<<<<<<< * """ The default device on this platform. * """ */ __pyx_k_codeobj_22 = (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_23, __pyx_n_s__default_device, 260, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __Pyx_CyFunction_USED if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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(__Pyx_NAMESTR("_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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!PyDict_GetItemString(modules, "libdiscid._discid")) { if (unlikely(PyDict_SetItemString(modules, "libdiscid._discid", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_libdiscid___discid) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct_2___get__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_1_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_3_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __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_5_genexpr) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_5_genexpr = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_5_genexpr; if (PyType_Ready(&__pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct____get__ = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct____get__; __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_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_9libdiscid_7_discid_DiscId.tp_dict, __pyx_vtabptr_9libdiscid_7_discid_DiscId) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "DiscId", (PyObject *)&__pyx_type_9libdiscid_7_discid_DiscId) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __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_4___get__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_9libdiscid_7_discid___pyx_scope_struct_4___get__ = &__pyx_type_9libdiscid_7_discid___pyx_scope_struct_4___get__; /*--- 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_filename = __pyx_f[1]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[3]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "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_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__DiscError)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__DiscError)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__DiscError)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_21), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__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_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s__DiscError, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __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_5 = UINT_MAX; /* "libdiscid/_discid.pyx":247 * 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), */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); /* "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_1 = PyInt_FromLong(DISCID_FEATURE_READ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(DISCID_FEATURE_STR_READ)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(DISCID_FEATURE_MCN); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(DISCID_FEATURE_STR_MCN)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(DISCID_FEATURE_ISRC); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(DISCID_FEATURE_STR_ISRC)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_1, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __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, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__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_24); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s__default_device, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s__FEATURES, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(DISCID_FEATURE_READ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s__FEATURE_READ, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(DISCID_FEATURE_MCN); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s__FEATURE_MCN, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __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 = PyInt_FromLong(DISCID_FEATURE_ISRC); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s__FEATURE_ISRC, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __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 = ((PyObject *)__pyx_f_9libdiscid_7_discid__to_unicode(wrap_get_version_string())); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s____discid_version__, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __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_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { __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 */ #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 /* CYTHON_REFNANNY */ 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 '%s' is not defined", PyString_AS_STRING(name)); #endif } return result; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(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; } 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))) { length = strlen(cstring); 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); } } 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, "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static CYTHON_INLINE int __Pyx_CheckKeywordStrings( PyObject *kwdict, const char* function_name, int kw_allowed) { PyObject* key = 0; Py_ssize_t pos = 0; #if CPYTHON_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, "%s() keywords must be strings", function_name); return 0; #endif invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif return 0; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); 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); #else PyErr_Restore(type, value, tb); #endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; #else PyErr_Fetch(type, value, tb); #endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { 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 PY_VERSION_HEX < 0x02050000 if (PyClass_Check(type)) { #else if (PyType_Check(type)) { #endif #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; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else 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; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ 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 *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 = PyEval_CallObject(type, args); 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) { 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); } } bad: Py_XDECREF(owned_instance); return; } #endif static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); if (result) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } 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 } 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, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (Py_TYPE(obj) == type) return 1; } else { if (PyObject_TypeCheck(obj, type)) return 1; } PyErr_Format(PyExc_TypeError, "Argument '%s' has incorrect type (expected %s, got %s)", name, type->tp_name, Py_TYPE(obj)->tp_name); return 0; } static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } 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); } static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON 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 } 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; } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) 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; } 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; } 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_VERSION_HEX >= 0x02050000 { #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; /* try absolute import on failure */ } #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 } } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed long)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #endif #endif static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { switch (Py_SIZE(x)) { case 0: return 0; case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; } } #endif #endif return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); 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; #else PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); #endif *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } static PyObject *__Pyx_Generator_Next(PyObject *self); static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); static PyObject *__Pyx_Generator_Close(PyObject *self); static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); static PyTypeObject *__pyx_GeneratorType = 0; #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) #define __Pyx_Generator_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_ErrFetch(&et, &ev, &tb); if (!et) { Py_XDECREF(tb); Py_XDECREF(ev); Py_INCREF(Py_None); *pvalue = Py_None; return 0; } if (unlikely(et != PyExc_StopIteration) && unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { __Pyx_ErrRestore(et, ev, tb); return -1; } if (likely(et == PyExc_StopIteration)) { if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { if (!ev) { Py_INCREF(Py_None); ev = Py_None; } Py_XDECREF(tb); Py_DECREF(et); *pvalue = ev; return 0; } } PyErr_NormalizeException(&et, &ev, &tb); if (unlikely(!PyObject_IsInstance(ev, 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 = PyObject_GetAttr(ev, __pyx_n_s__args); Py_DECREF(ev); if (likely(args)) { value = PyObject_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_Generator_ExceptionClear(__pyx_GeneratorObject *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_Generator_CheckRunning(__pyx_GeneratorObject *gen) { if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); return 1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { PyObject *retval; 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; } if (value) { #if CYTHON_COMPILING_IN_PYPY #else /* Generators always return to their most recent caller, not * necessarily their creator. */ if (self->exc_traceback) { PyThreadState *tstate = PyThreadState_GET(); PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_XINCREF(tstate->frame); assert(f->f_back == NULL); f->f_back = tstate->frame; } #endif __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); } else { __Pyx_Generator_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 #else /* Don't keep the reference to f_back any longer than necessary. It * may keep a chain of frames alive or it could create a reference * cycle. */ if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_CLEAR(f->f_back); } #endif } else { __Pyx_Generator_ExceptionClear(self); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { PyObject *ret; PyObject *val = NULL; __Pyx_Generator_Undelegate(gen); __Pyx_PyGen_FetchStopIterationValue(&val); ret = __Pyx_Generator_SendEx(gen, val); Py_XDECREF(val); return ret; } static PyObject *__Pyx_Generator_Next(PyObject *self) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Generator_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; ret = Py_TYPE(yf)->tp_iternext(yf); gen->is_running = 0; if (likely(ret)) { return ret; } return __Pyx_Generator_FinishDelegation(gen); } return __Pyx_Generator_SendEx(gen, Py_None); } static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Generator_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Generator_Send(yf, value); } else { if (value == Py_None) ret = PyIter_Next(yf); else ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value); } gen->is_running = 0; if (likely(ret)) { return ret; } return __Pyx_Generator_FinishDelegation(gen); } return __Pyx_Generator_SendEx(gen, value); } static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { PyObject *retval = NULL; int err = 0; if (__Pyx_Generator_CheckExact(yf)) { retval = __Pyx_Generator_Close(yf); if (!retval) return -1; } else { PyObject *meth; gen->is_running = 1; meth = PyObject_GetAttr(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_Close(PyObject *self) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; PyObject *retval, *raised_exception; PyObject *yf = gen->yieldfrom; int err = 0; if (unlikely(__Pyx_Generator_CheckRunning(gen))) return NULL; if (yf) { Py_INCREF(yf); err = __Pyx_Generator_CloseIter(gen, yf); __Pyx_Generator_Undelegate(gen); Py_DECREF(yf); } if (err == 0) #if PY_VERSION_HEX < 0x02050000 PyErr_SetNone(PyExc_StopIteration); #else PyErr_SetNone(PyExc_GeneratorExit); #endif retval = __Pyx_Generator_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 #if PY_VERSION_HEX >= 0x02050000 || raised_exception == PyExc_GeneratorExit || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) #endif || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) { if (raised_exception) PyErr_Clear(); /* ignore these errors */ Py_INCREF(Py_None); return Py_None; } return NULL; } static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) 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_Generator_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; Py_INCREF(yf); #if PY_VERSION_HEX >= 0x02050000 if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { int err = __Pyx_Generator_CloseIter(gen, yf); Py_DECREF(yf); __Pyx_Generator_Undelegate(gen); if (err < 0) return __Pyx_Generator_SendEx(gen, NULL); goto throw_here; } #endif gen->is_running = 1; if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Generator_Throw(yf, args); } else { PyObject *meth = PyObject_GetAttr(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_Generator_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_Generator_FinishDelegation(gen); } return ret; } throw_here: __Pyx_Raise(typ, val, tb, NULL); return __Pyx_Generator_SendEx(gen, NULL); } static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) 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_Generator_clear(PyObject *self) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) 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); return 0; } static void __Pyx_Generator_dealloc(PyObject *self) { __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); PyObject_GC_Track(self); if (gen->resume_label > 0) { Py_TYPE(gen)->tp_del(self); if (self->ob_refcnt > 0) return; /* resurrected. :( */ } PyObject_GC_UnTrack(self); __Pyx_Generator_clear(self); PyObject_GC_Del(gen); } static void __Pyx_Generator_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; if (gen->resume_label <= 0) return ; assert(self->ob_refcnt == 0); self->ob_refcnt = 1; __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); res = __Pyx_Generator_Close(self); if (res == NULL) PyErr_WriteUnraisable(self); else Py_DECREF(res); __Pyx_ErrRestore(error_type, error_value, error_traceback); /* Undo the temporary resurrection; can't use DECREF here, it would * cause a recursive call. */ assert(self->ob_refcnt > 0); if (--self->ob_refcnt == 0) return; /* this is the normal path out */ /* close() resurrected it! Make it look like the original Py_DECREF * never happened. */ { 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); /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so * we need to undo that. */ _Py_DEC_REFTOTAL; #endif /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object * chain, so no more to do there. * If COUNT_ALLOCS, the original decref bumped tp_frees, and * _Py_NewReference bumped tp_allocs: both of those need to be * undone. */ #ifdef COUNT_ALLOCS --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif } static PyMemberDef __pyx_Generator_memberlist[] = { {(char *) "gi_running", #if PY_VERSION_HEX >= 0x02060000 T_BOOL, #else T_BYTE, #endif offsetof(__pyx_GeneratorObject, is_running), READONLY, NULL}, {0, 0, 0, 0, 0} }; static PyMethodDef __pyx_Generator_methods[] = { {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0}, {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0}, {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, {0, 0, 0, 0} }; static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) __Pyx_NAMESTR("generator"), /*tp_name*/ sizeof(__pyx_GeneratorObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #else 0, /*reserved*/ #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_GC, /* tp_flags*/ 0, /*tp_doc*/ (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */ 0, /*tp_iter*/ (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/ __pyx_Generator_methods, /*tp_methods*/ __pyx_Generator_memberlist, /*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*/ 0, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ __Pyx_Generator_del, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) 0, /*tp_finalize*/ #endif }; static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, PyObject *closure) { __pyx_GeneratorObject *gen = PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_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; PyObject_GC_Track(gen); return gen; } static int __pyx_Generator_init(void) { __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; if (PyType_Ready(&__pyx_GeneratorType_type)) { return -1; } __pyx_GeneratorType = &__pyx_GeneratorType_type; return 0; } 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); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #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 #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, "%s.%s 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", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 if (PyErr_Warn(NULL, warning) < 0) goto bad; #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } return (PyTypeObject *)result; bad: Py_XDECREF(py_module); Py_XDECREF(result); return NULL; } #endif 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) / 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, 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); } #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, /*int argcount,*/ 0, /*int kwonlyargcount,*/ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __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, /*int firstlineno,*/ __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; PyObject *py_globals = 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_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } 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 /* Python 3+ has unicode identifiers */ 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(char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, 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 __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 /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else /* PY_VERSION_HEX < 0x03030000 */ if (PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_DATA_SIZE(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ return PyUnicode_AsUTF8AndSize(o, length); #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ #endif /* PY_VERSION_HEX < 0x03030000 */ } else #endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (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_Int(PyObject* x) { PyNumberMethods *m; 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 Py_INCREF(x), x; 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 if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (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 = 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) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */ python-libdiscid-0.4.1/libdiscid/_discid.pyx0000664000175000017500000002052512225541632023023 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 offets. 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 retrive 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-0.4.1/libdiscid/cdiscid.pxd0000664000175000017500000000442112223261007022770 0ustar sebastiansebastian00000000000000# distutils: libraries = discid # 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) ctypedef 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-0.4.1/libdiscid/discid-wrapper.c0000664000175000017500000000574012223261007023737 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-0.4.1/libdiscid/discid-wrapper.h0000664000175000017500000000465212223261007023745 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-0.4.1/libdiscid/discid.py0000664000175000017500000000327412225541632022476 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-0.4.1/libdiscid/exceptions.py0000664000175000017500000000251712213351753023417 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-0.4.1/python_libdiscid.egg-info/0000775000175000017500000000000012261620352023747 5ustar sebastiansebastian00000000000000python-libdiscid-0.4.1/python_libdiscid.egg-info/PKG-INFO0000664000175000017500000000554112261620352025051 0ustar sebastiansebastian00000000000000Metadata-Version: 1.1 Name: python-libdiscid Version: 0.4.1 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.6) and 3 (>= 3.1) are supported. Dependencies ------------ * libdiscid * Cython (>= 0.15) 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. 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: %s" % (disc.id, ) License ------- python-libdiscid is release under the Expat license. Check LICENSE for details. Platform: UNKNOWN Classifier: Development Status :: 4 - Beta 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.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping Classifier: Topic :: Software Development :: Libraries :: Python Modules python-libdiscid-0.4.1/python_libdiscid.egg-info/SOURCES.txt0000664000175000017500000000133512261620352025635 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-0.4.1/python_libdiscid.egg-info/dependency_links.txt0000664000175000017500000000000112261620352030015 0ustar sebastiansebastian00000000000000 python-libdiscid-0.4.1/python_libdiscid.egg-info/top_level.txt0000664000175000017500000000001212261620352026472 0ustar sebastiansebastian00000000000000libdiscid python-libdiscid-0.4.1/LICENSE0000664000175000017500000000210212261617262017734 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-0.4.1/MANIFEST.in0000664000175000017500000000023612225541632020470 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-0.4.1/README.rst0000664000175000017500000000273712225541632020431 0ustar sebastiansebastian00000000000000libdiscid Python bindings ========================= python-libdiscid implements Python bindings for libdiscid using Cython. Both Python 2 (>= 2.6) and 3 (>= 3.1) are supported. Dependencies ------------ * libdiscid * Cython (>= 0.15) 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. 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: %s" % (disc.id, ) License ------- python-libdiscid is release under the Expat license. Check LICENSE for details. python-libdiscid-0.4.1/changelog0000664000175000017500000000603112261617323020604 0ustar sebastiansebastian00000000000000python-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-0.4.1/setup.py0000775000175000017500000000424212261620167020451 0ustar sebastiansebastian00000000000000#!/usr/bin/python import os.path import sys try: from setuptools import setup, Extension have_setuptools = True except ImportError: from distutils.core import setup from distutils.extension import Extension have_setuptools = False try: from Cython.Build import cythonize have_cython = True except ImportError: have_cython = False if have_cython: # if Cython is available, rebuild _discid.c ext = cythonize([ Extension('libdiscid._discid', [ 'libdiscid/_discid.pyx', 'libdiscid/discid-wrapper.c' ] ) ]) else: # ... otherwise use the shipped version of _discid.c ext = [ Extension('libdiscid._discid', [ 'libdiscid/_discid.c', 'libdiscid/discid-wrapper.c' ] ) ] if have_setuptools: tests_require = [] if sys.version_info[0:2] < (2,7): tests_require = ['unittest2'] args = { 'test_suite': 'libdiscid.tests', 'tests_require': tests_require, } if have_cython: # if Cython is available, check if it's new enough args['setup_requires'] = ['cython >= 0.15'] else: args = {} 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='0.4.1', 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 :: 4 - Beta', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping', 'Topic :: Software Development :: Libraries :: Python Modules' ], **args ) python-libdiscid-0.4.1/PKG-INFO0000664000175000017500000000554112261620352020030 0ustar sebastiansebastian00000000000000Metadata-Version: 1.1 Name: python-libdiscid Version: 0.4.1 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.6) and 3 (>= 3.1) are supported. Dependencies ------------ * libdiscid * Cython (>= 0.15) 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. 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: %s" % (disc.id, ) License ------- python-libdiscid is release under the Expat license. Check LICENSE for details. Platform: UNKNOWN Classifier: Development Status :: 4 - Beta 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.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Topic :: Multimedia :: Sound/Audio :: CD Audio :: CD Ripping Classifier: Topic :: Software Development :: Libraries :: Python Modules python-libdiscid-0.4.1/setup.cfg0000664000175000017500000000024412261620352020547 0ustar sebastiansebastian00000000000000[build_sphinx] source-dir = docs build-dir = build all_files = 1 [upload_docs] upload-dir = build/html [egg_info] tag_date = 0 tag_svn_revision = 0 tag_build =