コード例 #1
0
ファイル: __init__.py プロジェクト: DINKIN/XDM
def _guess_camel_string(mtree, string, options=None, skip_title=False, **kwargs):
    if string and is_camel(string):
        log.info('"%s" is camel cased. Try to detect more properties.' % (string,))
        uncameled_value = from_camel(string)
        camel_tree = _build_filename_mtree(uncameled_value, options=options, name_only=True, skip_title=skip_title, **kwargs)
        if len(camel_tree.matched()) > 0:
            # Title has changed.
            mtree.matched().update(camel_tree.matched())
            return True
    return False
コード例 #2
0
def _guess_camel_string(mtree, string, options=None, skip_title=False, **kwargs):
    if string and is_camel(string):
        log.info('"%s" is camel cased. Try to detect more properties.' % (string,))
        uncameled_value = from_camel(string)
        camel_tree = _build_filename_mtree(uncameled_value, options=options, name_only=True, skip_title=skip_title, **kwargs)
        if len(camel_tree.matched()) > 0:
            # Title has changed.
            mtree.matched().update(camel_tree.matched())
            return True
    return False
コード例 #3
0
ファイル: __init__.py プロジェクト: WebSpider/SickRage
def _guess_camel_string(mtree, string, options=None, skip_title=False, **kwargs):
    if string and is_camel(string):
        log.debug('"%s" is camel cased. Try to detect more properties.' % (string,))
        uncameled_value = from_camel(string)
        merged_options = dict(options)
        if 'type' in mtree.match_tree.info:
            current_type = mtree.match_tree.info.get('type')
            if current_type and current_type != 'unknown':
                merged_options['type'] = current_type
        camel_tree = _build_filename_mtree(uncameled_value, options=merged_options, name_only=True, skip_title=skip_title, **kwargs)
        if len(camel_tree.matched()) > 0:
            mtree.matched().update(camel_tree.matched())
            return True
    return False
コード例 #4
0
def _guess_camel_string(mtree, string, options=None, skip_title=False, **kwargs):
    if string and is_camel(string):
        log.debug('"%s" is camel cased. Try to detect more properties.' % (string,))
        uncameled_value = from_camel(string)
        merged_options = dict(options)
        if 'type' in mtree.match_tree.info:
            current_type = mtree.match_tree.info.get('type')
            if current_type and current_type != 'unknown':
                merged_options['type'] = current_type
        camel_tree = _build_filename_mtree(uncameled_value, options=merged_options, name_only=True, skip_title=skip_title, **kwargs)
        if len(camel_tree.matched()) > 0:
            mtree.matched().update(camel_tree.matched())
            return True
    return False
コード例 #5
0
    def test_camel(self):
        self.assertEqual("", from_camel(""))

        self.assertEqual("Hello world", str_replace("Hello World", 6, 'w'))
        self.assertEqual("Hello *****", str_fill("Hello World", (6, 11), '*'))

        self.assertTrue("This is camel", from_camel("ThisIsCamel"))

        self.assertEqual('camel case', from_camel('camelCase'))
        self.assertEqual('A case', from_camel('ACase'))
        self.assertEqual('MiXedCaSe is not camel case', from_camel('MiXedCaSe is not camelCase'))

        self.assertEqual("This is camel cased title", from_camel("ThisIsCamelCasedTitle"))
        self.assertEqual("This is camel CASED title", from_camel("ThisIsCamelCASEDTitle"))

        self.assertEqual("These are camel CASED title", from_camel("TheseAreCamelCASEDTitle"))

        self.assertEqual("Give a camel case string", from_camel("GiveACamelCaseString"))

        self.assertEqual("Death TO camel case", from_camel("DeathTOCamelCase"))
        self.assertEqual("But i like java too:)", from_camel("ButILikeJavaToo:)"))

        self.assertEqual("Beatdown french DVD rip.mkv", from_camel("BeatdownFrenchDVDRip.mkv"))
        self.assertEqual("DO NOTHING ON UPPER CASE", from_camel("DO NOTHING ON UPPER CASE"))

        self.assertFalse(is_camel("this_is_not_camel"))
        self.assertTrue(is_camel("ThisIsCamel"))

        self.assertEqual("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv", from_camel("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv"))
        self.assertFalse(is_camel("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv"))

        self.assertEqual("A2LiNE", from_camel("A2LiNE"))
コード例 #6
0
ファイル: test_utils.py プロジェクト: Kallehz/Python
    def test_camel(self):
        assert "" == from_camel("")

        assert "Hello world" == str_replace("Hello World", 6, 'w')
        assert "Hello *****" == str_fill("Hello World", (6, 11), '*')

        assert "This is camel" == from_camel("ThisIsCamel")

        assert 'camel case' == from_camel('camelCase')
        assert 'A case' == from_camel('ACase')
        assert 'MiXedCaSe is not camel case' == from_camel('MiXedCaSe is not camelCase')

        assert "This is camel cased title" == from_camel("ThisIsCamelCasedTitle")
        assert "This is camel CASED title" == from_camel("ThisIsCamelCASEDTitle")

        assert "These are camel CASED title" == from_camel("TheseAreCamelCASEDTitle")

        assert "Give a camel case string" == from_camel("GiveACamelCaseString")

        assert "Death TO camel case" == from_camel("DeathTOCamelCase")
        assert "But i like java too:)" == from_camel("ButILikeJavaToo:)")

        assert "Beatdown french DVD rip.mkv" == from_camel("BeatdownFrenchDVDRip.mkv")
        assert "DO NOTHING ON UPPER CASE" == from_camel("DO NOTHING ON UPPER CASE")

        assert not is_camel("this_is_not_camel")
        assert is_camel("ThisIsCamel")

        assert "Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv" == \
               from_camel("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv")
        assert not is_camel("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv")

        assert "A2LiNE" == from_camel("A2LiNE")
コード例 #7
0
ファイル: test_utils.py プロジェクト: Thraxis/SickRage-Old
    def test_camel(self):
        assert "" == from_camel("")

        assert "Hello world" == str_replace("Hello World", 6, 'w')
        assert "Hello *****" == str_fill("Hello World", (6, 11), '*')

        assert "This is camel" == from_camel("ThisIsCamel")

        assert 'camel case' == from_camel('camelCase')
        assert 'A case' == from_camel('ACase')
        assert 'MiXedCaSe is not camel case' == from_camel(
            'MiXedCaSe is not camelCase')

        assert "This is camel cased title" == from_camel(
            "ThisIsCamelCasedTitle")
        assert "This is camel CASED title" == from_camel(
            "ThisIsCamelCASEDTitle")

        assert "These are camel CASED title" == from_camel(
            "TheseAreCamelCASEDTitle")

        assert "Give a camel case string" == from_camel("GiveACamelCaseString")

        assert "Death TO camel case" == from_camel("DeathTOCamelCase")
        assert "But i like java too:)" == from_camel("ButILikeJavaToo:)")

        assert "Beatdown french DVD rip.mkv" == from_camel(
            "BeatdownFrenchDVDRip.mkv")
        assert "DO NOTHING ON UPPER CASE" == from_camel(
            "DO NOTHING ON UPPER CASE")

        assert not is_camel("this_is_not_camel")
        assert is_camel("ThisIsCamel")

        assert "Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv" == \
               from_camel("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv")
        assert not is_camel("Dark.City.(1998).DC.BDRIP.720p.DTS.X264-CHD.mkv")

        assert "A2LiNE" == from_camel("A2LiNE")