Ejemplo n.º 1
0
    def handle_deprecations(func_names):
        called = 0
        deprecated = lambda: add(called, 1) and called == 0 and logger.warn(
            'Depreciation: use function names ending in numerals instead')
        deprecated_func_names = 'install', 'setup', 'serve', 'start'

        frozenset(func_name for func_name in deprecated_func_names
                  if binary_search(func_names, func_name) > -1 and deprecated()
                  ) and next((func_name for func_name in func_names
                              if str.isdigit(func_name[1])), False) and deprecated()
Ejemplo n.º 2
0
    def handle_deprecations(func_names):
        called = 0
        deprecated = (
            lambda: add(called, 1) and called == 0 and root_logger.warn(
                "Depreciation: use function names ending in numerals instead"))
        deprecated_func_names = "install", "setup", "serve", "start"

        frozenset(func_name for func_name in deprecated_func_names
                  if binary_search(func_names, func_name) > -1
                  and deprecated()) and next(
                      (func_name for func_name in func_names
                       if str.isdigit(func_name[1])), False) and deprecated()
Ejemplo n.º 3
0
 def test_binary_search(self):
     self.assertTrue(binary_search(self.a, 5))
     self.assertEqual(binary_search(self.a, 15), -1)