def execCommand(args, following_args): success = False for result in itertools.islice( registry_access.search(query=args.query, keywords=args.kw, registry=args.registry), args.limit): success = True if args.type == 'both' or args.type == result['type']: print(formatResult(result, args.plain, short=args.short)) for repo in filter(lambda s: 'type' in s and s['type'] == 'registry', settings.get('sources') or []): count = 0 print('') print('additional results from %s:' % repo['url']) for result in itertools.islice( registry_access.search(query=args.query, keywords=args.kw, registry=repo['url']), args.limit): success = True if args.type == 'both' or args.type == result['type']: print( formatResult(result, args.plain, indent=' ', short=args.short)) # exit status: success if we found something, otherwise fail return 0 if success else 1
def _getYottaClientUUID(): import uuid current_uuid = settings.get('uuid') if current_uuid is None: current_uuid = u'%s' % uuid.uuid4() settings.set('uuid', current_uuid) return current_uuid
def deauthorize(registry=None): registry = registry or Registry_Base_URL if _isPublicRegistry(registry): if settings.get('keys'): settings.set('keys', dict()) else: sources = [s for s in _getSources() if not _sourceMatches(s, registry)] settings.set('sources', sources)
def getMaxCachedModules(): global _max_cached_modules if _max_cached_modules is None: _max_cached_modules = settings.get('maxCachedModules') if _max_cached_modules is None: # arbitrary default value _max_cached_modules = 400 return _max_cached_modules
def getMaxCachedModules(): global _max_cached_modules if _max_cached_modules is None: _max_cached_modules = settings.get('maxCachedModules') if _max_cached_modules is None: # arbitrary default value _max_cached_modules = 200 return _max_cached_modules
def execCommand(args, following_args): success = False for result in itertools.islice(registry_access.search(query=args.query, keywords=args.kw, registry=args.registry), args.limit): success= True if args.type == 'both' or args.type == result['type']: print(formatResult(result, args.plain, short=args.short)) for repo in filter(lambda s: 'type' in s and s['type'] == 'registry', settings.get('sources') or []) : count = 0 print('') print('additional results from %s:' % repo['url']) for result in itertools.islice(registry_access.search(query=args.query, keywords=args.kw, registry=repo['url']), args.limit): success= True if args.type == 'both' or args.type == result['type']: print(formatResult(result, args.plain, indent=' ', short=args.short)) # exit status: success if we found something, otherwise fail return 0 if success else 1
def _getSources(): sources = settings.get('sources') if sources is None: sources = [] return sources
def test_envvars(self): testval = str(random.randint(1,100000)) os.environ['YOTTA_SETTINGS_TEST_VARIABLE'] = testval self.assertEqual(settings.get('settings.TEST.Variable'), testval)
def test_envvars(self): testval = str(random.randint(1, 100000)) os.environ['YOTTA_SETTINGS_TEST_VARIABLE'] = testval self.assertEqual(settings.get('settings.TEST.Variable'), testval)