Help us read the pkginfo without accessing __init__
515227
def read_pkginfo(filename):
    
    COMMENT_CHAR = '#'
    OPTION_CHAR =  '='
    options = {}
    f = open(filename)
    for line in f:
        if COMMENT_CHAR in line:
            line, comment = line.split(COMMENT_CHAR, 1)
        if OPTION_CHAR in line:
            option, value = line.split(OPTION_CHAR, 1)
            option = option.strip()
            value = value.strip()
            options[option] = value
    f.close()
    return options
599794
def initializing_reader(key)
      ck = convert_key(key)
      regular_writer(ck, self.class.new) unless key?(ck)
      regular_reader(ck)
    end
1106831
def init():
    '''  '''
    globals()["sock"] = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    globals()["sockfd"] = globals()["sock"].fileno()
751397
def save_pkl(self, filename):
        
        with open(filename, 'wb') as fout:
            pickle.dump(self, fout)
987253
def read(cls, iprot):
        '''
        
        '''

        init_kwds = {}

        iprot.read_struct_begin()
        while True:
            ifield_name, ifield_type, _ifield_id = iprot.read_field_begin()
            if ifield_type == 0:  # STOP
                break
            elif ifield_name == 'dbf':
                init_kwds['dbf'] = pastpy.gen.database.impl.dbf.dbf_database_configuration.DbfDatabaseConfiguration.read(iprot)
            elif ifield_name == 'dummy':
                init_kwds['dummy'] = pastpy.gen.database.impl.dummy.dummy_database_configuration.DummyDatabaseConfiguration.read(iprot)
            elif ifield_name == 'online':
                init_kwds['online'] = pastpy.gen.database.impl.online.online_database_configuration.OnlineDatabaseConfiguration.read(iprot)
            iprot.read_field_end()
        iprot.read_struct_end()

        return cls(**init_kwds)
235146
def pkginfo(name, version, arch, repoid, install_date=None, install_date_time_t=None):
    '''
    
    '''
    pkginfo_tuple = collections.namedtuple(
        'PkgInfo',
        ('name', 'version', 'arch', 'repoid', 'install_date',
         'install_date_time_t')
    )
    return pkginfo_tuple(name, version, arch, repoid, install_date,
                         install_date_time_t)
196750
def read_init(key):
    
    filename = os.path.join("traces", "__init__.py")
    result = None
    with open(filename) as stream:
        for line in stream:
            if key in line:
                result = line.split('=')[-1].strip().replace("'", "")

    # throw error if version isn't in __init__ file
    if result is None:
        raise ValueError('must define %s in %s' % (key, filename))

    return result
723695
def _loader(app, init_func, entry_points=None, modules=None):
    
    if entry_points:
        for entry_point in entry_points:
            for ep in pkg_resources.iter_entry_points(entry_point):
                try:
                    init_func(ep.load())
                except Exception:
                    app.logger.error(
                        'Failed to initialize entry point: {0}'.format(ep))
                    raise
    if modules:
        for m in modules:
            try:
                init_func(m)
            except Exception:
                app.logger.error('Failed to initialize module: {0}'.format(m))
                raise
512400
def init(opts=None):
    '''
    
    '''
    if opts is None:
        opts = __opts__
    try:
        DETAILS[_worker_name()] = SSHConnection(
            host=opts['proxy']['host'],
            username=opts['proxy']['username'],
            password=opts['proxy']['password'],
            key_accept=opts['proxy'].get('key_accept', False),
            ssh_args=opts['proxy'].get('ssh_args', ''),
            prompt='{0}.*(#|>) '.format(opts['proxy']['prompt_name']))
        DETAILS[_worker_name()].sendline('no cli session paging enable')

    except TerminalException as e:
        log.error(e)
        return False
    DETAILS['initialized'] = True
855742
def peek(self):
        
        try:
            self._fetch()
            pkt = self.pkt_queue[0]
            return pkt
        except IndexError:
            raise StopIteration()
728019
def util_raw_input(prompt='', default=None, ispass=False, use_readline=True):
	
	if use_readline:
		try:
			readline.read_init_file('/etc/inputrc')
		except IOError:
			pass
		readline.parse_and_bind('tab: complete')
	prompt = '\r\n' + prompt
	if ispass:
		prompt += '\r\nInput Secret: '
	sanitize_terminal()
	if shutit_global.shutit_global_object.interactive == 0:
		return default
	## See: https//github.com/ianmiell/shutit/issues/299 - python3 made input == python 2's raw_input
	#if not shutit_global.shutit_global_object.ispy3:
	#	input = raw_input
	#try:
	#	input
	#except NameError:
	#	shutit_global.shutit_global_object.shutit_print('input not available, printing debug')
	#	print_debug()
	#	sys.exit(1)
	if not shutit_global.shutit_global_object.determine_interactive():
		return default
	while True:
		try:
			if ispass:
				return getpass.getpass(prompt=prompt)
			else:
				return input(prompt).strip() or default
		except KeyboardInterrupt:
			continue
		except IOError:
			msg = 'Problems getting raw input, assuming no controlling terminal.'
	if ispass:
		return getpass.getpass(prompt=prompt)
	else:
		return input(prompt).strip() or default
	shutit_global.shutit_global_object.set_noninteractive(msg=msg)
	return default
1065766
def read_config_info(ini_file):
    
    try:
        config = RawConfigParser()
        config.optionxform = lambda option: option
        config.read(ini_file)
        the_stuff = {}
        for section in config.sections():
            the_stuff[section] = {}
            for option in config.options(section):
                the_stuff[section][option] = config.get(section, option)

        return the_stuff
    except Exception as wtf:
        logging.error('Exception caught in read_config_info(): {}'.format(wtf))
        traceback.print_exc(file=sys.stdout)
        return sys.exit(1)
1074391
def pkt_check(*args, func=None):
    """"""
    func = func or inspect.stack()[2][3]
    for var in args:
        dict_check(var, func=func)
        dict_check(var.get('frame'), func=func)
        enum_check(var.get('protocol'), func=func)
        real_check(var.get('timestamp'), func=func)
        ip_check(var.get('src'), var.get('dst'), func=func)
        bool_check(var.get('syn'), var.get('fin'), func=func)
        int_check(var.get('srcport'), var.get('dstport'), var.get('index'), func=func)
94636
def load(pkginfo, hash=None):
    
    node, pkgroot, info = _load(pkginfo, hash)
    for subnode_name in info.subpath:
        node = node[subnode_name]

    return node
1011973
def _initialize_if_needed():
    """"""
    global IS_INITIALIZED, TENSOR_SPACE_IMPLS
    if not IS_INITIALIZED:
        # pkg_resources has long import time
        from pkg_resources import iter_entry_points
        for entry_point in iter_entry_points(group='odl.space', name=None):
            try:
                module = entry_point.load()
            except ImportError:
                pass
            else:
                TENSOR_SPACE_IMPLS.update(module.tensor_space_impls())
        IS_INITIALIZED = True
1370742
def _has_init_name(self, cls):
        
        args = inspect.signature(cls.__init__)
        return self.name_param_name in args.parameters
559692
def get_input(context, conf):
    
    name = conf['name']['value']
    prompt = conf['prompt']['value']
    default = conf['default']['value'] or conf['debug']['value']

    if context.submodule or context.inputs:
        value = context.inputs.get(name, default)
    elif not context.test:
        # we skip user interaction during tests
        raw = raw_input("%s (default=%s) " % (encode(prompt), encode(default)))
        value = raw or default
    else:
        value = default

    return value