Execution loop

        :param ifile: Input file object. Unused.
        :type ifile: file

        :return: `None`.
12102
def _execute(self, ifile, process):
        
        if self._protocol_version == 2:
            result = self._read_chunk(ifile)

            if not result:
                return

            metadata, body = result
            action = getattr(metadata, 'action', None)

            if action != 'execute':
                raise RuntimeError('Expected execute action, not {}'.format(action))

        self._record_writer.write_records(self.generate())
        self.finish()
42584
def io_loop(self):
        
        if self._message and self._message.connection:
            return self._connections[self._message.connection].io_loop
1022490
def process_file(self, path, dryrun):
        
        # if dryrun just return file path
        if dryrun:
            return path

        # remove and return file
        if self.__force or raw_input("Remove file '%s'? [y/N]" % path).lower() == "y":
            os.remove(path)
            return path
800502
async def transform(self, file):
		""""""
		path = get_path(self.dest, file)
		await self.loop.run_in_executor(self.exe, write_file, path, file.contents)
		return file
490017
public static void waitFor(File aFile)
   
   {
      if(aFile == null)
         return;
      
      String path =aFile.getAbsolutePath();
   
      long previousSize = IO.getFileSize(path);
      long currentSize = previousSize;
      
      long sleepTime = Config.getPropertyLong("file.monitor.file.wait.time",100).longValue();
      
      while(true)
      {
         try
         {
           Thread.sleep(sleepTime);
         }
         catch(InterruptedException e){}
          
          currentSize = IO.getFileSize(path);
       
          if(currentSize == previousSize )
             return;
          
          previousSize = currentSize;
      }
   }
1259212
def open_file(self, fname, length=None, offset=None, swap=None, block=None, peek=None):
        '''
        
        '''
        if length is None:
            length = self.length
        if offset is None:
            offset = self.offset
        if swap is None:
            swap = self.swap_size

        return binwalk.core.common.BlockFile(fname,
                                             subclass=self.subclass,
                                             length=length,
                                             offset=offset,
                                             swap=swap,
                                             block=block,
                                             peek=peek)
777070
def input_file(self, filename, lines=None, expected=None, line_offset=0):
        """"""
        if self.options.verbose:
            print('checking %s' % filename)
        fchecker = self.checker_class(
            filename, lines=lines, options=self.options)
        return fchecker.check_all(expected=expected, line_offset=line_offset)
125791
public void resetFromFile(String configFile) throws IOException
    {
        IStringBuffer isb = new IStringBuffer();
        String line = null;
        BufferedReader reader = new BufferedReader(new FileReader(configFile));
        while ( (line = reader.readLine()) != null ) {
            line = line.trim();
            if (line.equals("")) continue;
            if (line.charAt(0) == '#') continue;
            
            isb.append(line).append('\n');
            line = null;    //let gc do its work
        }
        
        globalConfig = new JSONObject(isb.toString());
        
        //let gc do its work
        isb = null;
        reader.close();
        reader = null;
    }
474031
public IFile findIFile(File file)
	{
		IPath location = Path.fromOSString(file.getAbsolutePath());
		IFile ifile = project.getFile(location);

		if (ifile == null || !ifile.exists())
		{

			IPath absolutePath = new Path(file.getAbsolutePath());
			// check if the project contains a IFile which maps to the same
			// file system location
			try
			{
				for (IVdmSourceUnit f : getSpecFiles())
				{
					if (f.getFile().getLocation().equals(absolutePath))
						return f.getFile();
				}
			} catch (CoreException e1)
			{
			}

			// project does not contain this file, this means that the file has
			// been include elsewhere and a link will be created to the file
			// instead.
			try
			{
				linkFileToProject(file);
			} catch (CoreException e)
			{
			}

		}
		return ifile;
	}
95312
def ifo(self):
        
        if len(self.ifo_list) == 1:
            return self.ifo_list[0]
        else:
            err = "self.ifo_list must contain only one ifo to access the "
            err += "ifo property. %s." %(str(self.ifo_list),)
            raise TypeError(err)
459298
def loop_input(self, on_quit=None):
        
        # Start the init script
        self._run_script(
            self.__session, self._context.get_property(PROP_INIT_FILE)
        )

        # Run the script
        script_file = self._context.get_property(PROP_RUN_FILE)
        if script_file:
            self._run_script(self.__session, script_file)
        else:
            # No script: run the main loop (blocking)
            self._run_loop(self.__session)

        # Nothing more to do
        self._stop_event.set()
        sys.stdout.write("Bye !\n")
        sys.stdout.flush()
        if on_quit is not None:
            # Call a handler if needed
            on_quit()
671197
def _write_file_ifaces(iface, data, **settings):
    '''
    
    '''
    try:
        eth_template = JINJA.get_template('debian_eth.jinja')
        source_template = JINJA.get_template('debian_source.jinja')
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template debian_eth.jinja')
        return ''

    # Read /etc/network/interfaces into a dict
    adapters = _parse_interfaces()
    # Apply supplied settings over on-disk settings
    adapters[iface] = data

    ifcfg = ''
    for adapter in adapters:
        if 'type' in adapters[adapter] and adapters[adapter]['type'] == 'source':
            tmp = source_template.render({'name': adapter, 'data': adapters[adapter]})
        else:
            tmp = eth_template.render({'name': adapter, 'data': adapters[adapter]})
        ifcfg = ifcfg + tmp
        if adapter == iface:
            saved_ifcfg = tmp

    _SEPARATE_FILE = False
    if 'filename' in settings:
        if not settings['filename'].startswith('/'):
            filename = '{0}/{1}'.format(_DEB_NETWORK_DIR, settings['filename'])
        else:
            filename = settings['filename']
        _SEPARATE_FILE = True
    else:
        if 'filename' in adapters[adapter]['data']:
            filename = adapters[adapter]['data']
        else:
            filename = _DEB_NETWORK_FILE

    if not os.path.exists(os.path.dirname(filename)):
        msg = '{0} cannot be written.'
        msg = msg.format(os.path.dirname(filename))
        log.error(msg)
        raise AttributeError(msg)
    with salt.utils.files.flopen(filename, 'w') as fout:
        if _SEPARATE_FILE:
            fout.write(salt.utils.stringutils.to_str(saved_ifcfg))
        else:
            fout.write(salt.utils.stringutils.to_str(ifcfg))

    # Return as an array so the difflib works
    return saved_ifcfg.split('\n')
1192714
def try_opening_file(self):
        ''''''
        if os.path.isfile(self.path):
            self.file = open(self.path, 'r')
            self.file_is_opened = True
370294
def wait_pidfile(rundir, process_type=PROCESS_TYPE, name=None):
    
    # getting it from the start avoids an unneeded time.sleep
    pid = get_pid(rundir, process_type, name)

    while not pid:
        time.sleep(0.1)
        pid = get_pid(rundir, process_type, name)

    return pid
1046379
def load_file(self, file):
        

        if not foundations.common.path_exists(file):
            raise foundations.exceptions.FileExistsError(
                "{0} | '{1}' file doesn't exists!".format(self.__class__.__name__,
                                                          file))

        LOGGER.debug("> Loading '{0}' file.".format(file))
        reader = foundations.io.File(file)
        self.setPlainText(reader.read())
        self.set_file(file)
        self.__set_document_signals()
        self.file_loaded.emit()
        return True
149152
def do_execute(self):
        
        fname = str(self.input.payload)
        if not os.path.exists(fname):
            return "File '" + fname + "' does not exist!"
        if not os.path.isfile(fname):
            return "Location '" + fname + "' is not a file!"
        if self.resolve_option("use_custom_loader"):
            self._loader = self.resolve_option("custom_loader")
        else:
            self._loader = converters.loader_for_file(fname)
        dataset = self._loader.load_file(fname, incremental=bool(self.resolve_option("incremental")))
        if not self.resolve_option("incremental"):
            self._output.append(Token(dataset))
        else:
            self._iterator = self._loader.__iter__()
        return None
515725
def run(self, filename, wait_output=True):
        
        self._pyboard.enter_raw_repl()
        out = None
        if wait_output:
            # Run the file and wait for output to return.
            out = self._pyboard.execfile(filename)
        else:
            # Read the file and run it using lower level pyboard functions that
            # won't wait for it to finish or return output.
            with open(filename, "rb") as infile:
                self._pyboard.exec_raw_no_follow(infile.read())
        self._pyboard.exit_raw_repl()
        return out