当前位置: 首页>>代码示例>>Python>>正文


Python setup.name_uniquely函数代码示例

本文整理汇总了Python中mrjob.setup.name_uniquely函数的典型用法代码示例。如果您正苦于以下问题:Python name_uniquely函数的具体用法?Python name_uniquely怎么用?Python name_uniquely使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了name_uniquely函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_dont_use_names_taken

 def test_dont_use_names_taken(self):
     self.assertEqual(name_uniquely('foo.py'), 'foo.py')
     self.assertEqual(
         name_uniquely('foo.py', names_taken=['foo.py']),
         'foo-1.py')
     self.assertEqual(
         name_uniquely('foo.py', names_taken=['foo.py', 'foo-1.py']),
         'foo-2.py')
开发者ID:anirudhreddy92,项目名称:mrjob,代码行数:8,代码来源:test_setup.py

示例2: test_unhide

 def test_unhide(self):
     self.assertEqual(
         name_uniquely('.emacs', unhide=True), 'emacs')
     self.assertEqual(
         name_uniquely('._foo', unhide=True), 'foo')
     self.assertEqual(
         name_uniquely('_.bar', unhide=True), '1.bar')
     self.assertEqual(
         name_uniquely('_', unhide=True), '1')
开发者ID:Affirm,项目名称:mrjob,代码行数:9,代码来源:test_setup.py

示例3: test_auto_names_with_no_extension

 def test_auto_names_with_no_extension(self):
     self.assertEqual(
         name_uniquely(
             'foo', names_taken=['foo']),
         'foo-1')
     self.assertEqual(
         name_uniquely(
             '', names_taken=['_']),
         '_-1')
开发者ID:anirudhreddy92,项目名称:mrjob,代码行数:9,代码来源:test_setup.py

示例4: test_dont_used_proposed_names_taken

    def test_dont_used_proposed_names_taken(self):
        self.assertEqual(name_uniquely("foo.py", proposed_name="bar.py"), "bar.py")
        self.assertEqual(name_uniquely("foo.py", names_taken=["bar.py"], proposed_name="bar.py"), "bar-1.py")
        self.assertEqual(
            name_uniquely("foo.py", names_taken=["bar.py", "bar-1.py"], proposed_name="bar.py"), "bar-2.py"
        )

        # doesn't matter if path is taken
        self.assertEqual(name_uniquely("foo.py", names_taken=["foo.py"], proposed_name="bar.py"), "bar.py")
开发者ID:irskep,项目名称:mrjob,代码行数:9,代码来源:test_setup.py

示例5: test_initial_dot_isnt_extension

    def test_initial_dot_isnt_extension(self):
        self.assertEqual(
            name_uniquely(
                '.emacs', names_taken=['.emacs']),
            '.emacs-1')  # not '-1.emacs'

        self.assertEqual(
            name_uniquely(
                '.mrjob.conf', names_taken=['.mrjob.conf']),
            '.mrjob-1.conf')  # not '-1.mrjob.conf'
开发者ID:anirudhreddy92,项目名称:mrjob,代码行数:10,代码来源:test_setup.py

示例6: test_unhide_affects_proposed_name

 def test_unhide_affects_proposed_name(self):
     # these options aren't used together in practice, but of course
     # the proposed name is the one we care about if it's given
     self.assertEqual(
         name_uniquely(
             'foo.py', proposed_name='.hidden.foo.py', unhide=True),
         'hidden.foo.py')
开发者ID:Affirm,项目名称:mrjob,代码行数:7,代码来源:test_setup.py

示例7: test_dont_used_proposed_names_taken

    def test_dont_used_proposed_names_taken(self):
        self.assertEqual(
            name_uniquely('foo.py', proposed_name='bar.py'),
            'bar.py')
        self.assertEqual(
            name_uniquely('foo.py', names_taken=['bar.py'],
                          proposed_name='bar.py'),
            'bar-1.py')
        self.assertEqual(
            name_uniquely('foo.py', names_taken=['bar.py', 'bar-1.py'],
                          proposed_name='bar.py'),
            'bar-2.py')

        # doesn't matter if path is taken
        self.assertEqual(
            name_uniquely(
                'foo.py', names_taken=['foo.py'], proposed_name='bar.py'),
            'bar.py')
开发者ID:anirudhreddy92,项目名称:mrjob,代码行数:18,代码来源:test_setup.py

示例8: _dir_archive_path

    def _dir_archive_path(self, dir_path):
        """Assign a path for the archive of *dir_path* but don't
        actually create anything."""
        if dir_path not in self._dir_to_archive_path:
            # we can check local paths now
            if not (is_uri(dir_path) or os.path.isdir(dir_path)):
                raise OSError('%s is not a directory!' % dir_path)

            name = name_uniquely(
                dir_path, names_taken=self._dir_archive_names_taken)
            self._dir_archive_names_taken.add(name)

            self._dir_to_archive_path[dir_path] = os.path.join(
                self._get_local_tmp_dir(), 'archives', name + '.tar.gz')

        return self._dir_to_archive_path[dir_path]
开发者ID:okomestudio,项目名称:mrjob,代码行数:16,代码来源:runner.py

示例9: test_strip_trailing_slash

 def test_strip_trailing_slash(self):
     self.assertEqual(
         name_uniquely('s3://bucket/archive-dir/'), 'archive-dir')
开发者ID:Affirm,项目名称:mrjob,代码行数:3,代码来源:test_setup.py

示例10: test_auto_names_preserve_full_extension

 def test_auto_names_preserve_full_extension(self):
     self.assertEqual(name_uniquely("foo.tar.gz", names_taken=["foo.tar.gz"]), "foo-1.tar.gz")
开发者ID:irskep,项目名称:mrjob,代码行数:2,代码来源:test_setup.py

示例11: test_use_basename_by_default

 def test_use_basename_by_default(self):
     self.assertEqual(name_uniquely("foo/bar.py"), "bar.py")
     self.assertEqual(name_uniquely("foo/bar/"), "_")
开发者ID:irskep,项目名称:mrjob,代码行数:3,代码来源:test_setup.py

示例12: test_dont_use_names_taken

 def test_dont_use_names_taken(self):
     self.assertEqual(name_uniquely("foo.py"), "foo.py")
     self.assertEqual(name_uniquely("foo.py", names_taken=["foo.py"]), "foo-1.py")
     self.assertEqual(name_uniquely("foo.py", names_taken=["foo.py", "foo-1.py"]), "foo-2.py")
开发者ID:irskep,项目名称:mrjob,代码行数:4,代码来源:test_setup.py

示例13: test_no_empty_names

 def test_no_empty_names(self):
     self.assertEqual(name_uniquely(""), "_")
开发者ID:irskep,项目名称:mrjob,代码行数:2,代码来源:test_setup.py

示例14: test_empty_proposed_name_same_as_none

 def test_empty_proposed_name_same_as_none(self):
     self.assertEqual(name_uniquely("foo.py", proposed_name=None), "foo.py")
     self.assertEqual(name_uniquely("foo.py", proposed_name=""), "foo.py")
开发者ID:irskep,项目名称:mrjob,代码行数:3,代码来源:test_setup.py

示例15: test_strip_trailing_os_sep

 def test_strip_trailing_os_sep(self):
     self.assertEqual(
         name_uniquely(os.path.join('foo', 'bar', '')), 'bar')
开发者ID:Affirm,项目名称:mrjob,代码行数:3,代码来源:test_setup.py


注:本文中的mrjob.setup.name_uniquely函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。