Setup props from fileheaders.
506955
public function setup_from_fileheaders() {
		$file_headers = array(
			'Requires License'    => 'Requires License',
			'WordPress Available' => 'WordPress Available',
			'Pro Slug'            => 'Pro Slug',
			'Version'             => 'Version',
		);
		if ( 'plugin' === $this->type ) {
			$file_headers['Name']       = 'Plugin Name';
			$file_headers['AuthorName'] = 'Author';
			$file_headers['AuthorURI']  = 'Author URI';
		}
		if ( 'theme' === $this->type ) {
			$file_headers['Name']       = 'Theme Name';
			$file_headers['AuthorName'] = 'Author';
			$file_headers['AuthorURI']  = 'Author URI';
		}
		$file_headers = get_file_data( $this->basefile, $file_headers );

		$this->name       = $file_headers['Name'];
		$this->store_name = $file_headers['AuthorName'];
		$this->author_url = $file_headers['AuthorURI'];
		$this->store_url  = $file_headers['AuthorURI'];

		$this->requires_license    = ( 'yes' === $file_headers['Requires License'] ) ? true : false;
		$this->wordpress_available = ( 'yes' === $file_headers['WordPress Available'] ) ? true : false;
		$this->pro_slug            = ! empty( $file_headers['Pro Slug'] ) ? $file_headers['Pro Slug'] : '';
		$this->version             = $file_headers['Version'];

	}
769450
private void writeHeaders(final YokeRequest request, final FileProps props) {

        MultiMap headers = request.response().headers();

        if (!headers.contains("etag")) {
            headers.set("etag", "\"" + props.size() + "-" + props.lastModifiedTime() + "\"");
        }

        if (!headers.contains("date")) {
            headers.set("date", format(new Date()));
        }

        if (!headers.contains("cache-control")) {
            headers.set("cache-control", "public, max-age=" + maxAge / 1000);
        }

        if (!headers.contains("last-modified")) {
            headers.set("last-modified", format(new Date(props.lastModifiedTime())));
        }
    }
398390
def process_headers(data, filename):
    """"""
    headers = []
    if 'toc' in data:
        for element in PyQuery(data['toc'])('a'):
            headers.append(recurse_while_none(element))
        if None in headers:
            log.info('Unable to index file headers for: %s', filename)
    return headers
1029574
def _populate_header(self, root):
        """"""
        # If this gets more complicated, it should be handled via an XSLT.
        title_stmt = root.xpath(
            'tei:teiHeader/tei:fileDesc/tei:titleStmt',
            namespaces=constants.NAMESPACES)[0]
        # There is no guarantee that a title or author is specified,
        # in which case do nothing.
        try:
            title_stmt[0].text = root.xpath(
                'tei:TEI[1]/tei:teiHeader/tei:fileDesc/tei:titleStmt/'
                'tei:title', namespaces=constants.NAMESPACES)[0].text
        except IndexError:
            pass
        try:
            title_stmt[1].text = root.xpath(
                'tei:TEI[1]/tei:teiHeader/tei:fileDesc/tei:titleStmt/'
                'tei:author', namespaces=constants.NAMESPACES)[0].text
        except IndexError:
            pass
        return root
24678
def setup(self):
        """"""
        if len(self.plugins_tabs) == 0:
            self.close()
            return

        self.list.clear()
        current_path = self.current_path
        filter_text = self.filter_text

        # Get optional line or symbol to define mode and method handler
        trying_for_symbol = ('@' in self.filter_text)

        if trying_for_symbol:
            self.mode = self.SYMBOL_MODE
            self.setup_symbol_list(filter_text, current_path)
        else:
            self.mode = self.FILE_MODE
            self.setup_file_list(filter_text, current_path)

        # Set position according to size
        self.set_dialog_position()
1100279
function loadComponentFile (meta, key, filepath, messages) {
  const ext = path.extname(filepath).slice(1)
  const loader = fileLoaders[ext] || fileLoaders.DEFAULT

  return loader(meta, key, filepath, messages)
}
49773
def setup(api=None):
    
    global tmp_dir_object

    tmp_dir_object = tempfile.TemporaryDirectory()

    dir_name = tmp_dir_object.name

    dir_a = os.path.join(dir_name, "a")
    os.mkdir(dir_a)
    dir_b = os.path.join(dir_name, "b")
    os.mkdir(dir_b)

    # populate directory a with text files
    file_list = [
            ["hi.txt", """Hi World!"""],
            ["hi.html", """<strong>Hi World!</strong>"""],
            ["hello.html", """
                <img src='/static/b/smile.png'</img>
                pop-up
                <script src='/static/a/hi.js'></script>"""],
            ["hi.js", """alert('Hi World')""" ]
    ]

    for f in file_list:
        with open(os.path.join(dir_a, f[0]), mode="wt") as fo:
            fo.write(f[1])

    # populate directory b with binary file
    image = b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\n\x00\x00\x00\n\x08\x02\x00\x00\x00\x02PX\xea\x00\x00\x006IDAT\x18\xd3c\xfc\xff\xff?\x03n\xc0\xc4\x80\x170100022222\xc2\x85\x90\xb9\x04t3\x92`7\xb2\x15D\xeb\xc6\xe34\xa8n4c\xe1F\x120\x1c\x00\xc6z\x12\x1c\x8cT\xf2\x1e\x00\x00\x00\x00IEND\xaeB`\x82'

    with open(os.path.join(dir_b, "smile.png"), mode="wb") as fo:
            fo.write(image)
679192
function setup(subject) {
        context.subject = subject;
        context.subjectType = null;
        context.subjectConstructor = null;
        context.isSet = false;
    }
694986
public void process(ProjectFile file, Props props, DirectoryEntry rootDir) throws MPXJException
   {
      try
      {
         //MPPUtility.fileDump("c:\\temp\\props.txt", props.toString().getBytes());
         ProjectProperties ph = file.getProjectProperties();
         ph.setStartDate(props.getTimestamp(Props.PROJECT_START_DATE));
         ph.setFinishDate(props.getTimestamp(Props.PROJECT_FINISH_DATE));
         ph.setScheduleFrom(ScheduleFrom.getInstance(1 - props.getShort(Props.SCHEDULE_FROM)));
         ph.setDefaultCalendarName(props.getUnicodeString(Props.DEFAULT_CALENDAR_NAME));
         ph.setDefaultStartTime(props.getTime(Props.START_TIME));
         ph.setDefaultEndTime(props.getTime(Props.END_TIME));
         ph.setStatusDate(props.getTimestamp(Props.STATUS_DATE));
         ph.setHyperlinkBase(props.getUnicodeString(Props.HYPERLINK_BASE));

         //ph.setDefaultDurationIsFixed();
         ph.setDefaultDurationUnits(MPPUtility.getDurationTimeUnits(props.getShort(Props.DURATION_UNITS)));
         ph.setMinutesPerDay(Integer.valueOf(props.getInt(Props.MINUTES_PER_DAY)));
         ph.setMinutesPerWeek(Integer.valueOf(props.getInt(Props.MINUTES_PER_WEEK)));
         ph.setDefaultOvertimeRate(new Rate(props.getDouble(Props.OVERTIME_RATE), TimeUnit.HOURS));
         ph.setDefaultStandardRate(new Rate(props.getDouble(Props.STANDARD_RATE), TimeUnit.HOURS));
         ph.setDefaultWorkUnits(MPPUtility.getWorkTimeUnits(props.getShort(Props.WORK_UNITS)));
         ph.setSplitInProgressTasks(props.getBoolean(Props.SPLIT_TASKS));
         ph.setUpdatingTaskStatusUpdatesResourceStatus(props.getBoolean(Props.TASK_UPDATES_RESOURCE));
         ph.setCriticalSlackLimit(Integer.valueOf(props.getInt(Props.CRITICAL_SLACK_LIMIT)));

         ph.setCurrencyDigits(Integer.valueOf(props.getShort(Props.CURRENCY_DIGITS)));
         ph.setCurrencySymbol(props.getUnicodeString(Props.CURRENCY_SYMBOL));
         ph.setCurrencyCode(props.getUnicodeString(Props.CURRENCY_CODE));
         //ph.setDecimalSeparator();
         ph.setDefaultTaskType(TaskType.getInstance(props.getShort(Props.DEFAULT_TASK_TYPE)));
         ph.setSymbolPosition(MPPUtility.getSymbolPosition(props.getShort(Props.CURRENCY_PLACEMENT)));
         //ph.setThousandsSeparator();
         ph.setWeekStartDay(Day.getInstance(props.getShort(Props.WEEK_START_DAY) + 1));
         ph.setFiscalYearStartMonth(Integer.valueOf(props.getShort(Props.FISCAL_YEAR_START_MONTH)));
         ph.setFiscalYearStart(props.getShort(Props.FISCAL_YEAR_START) == 1);
         ph.setDaysPerMonth(Integer.valueOf(props.getShort(Props.DAYS_PER_MONTH)));
         ph.setEditableActualCosts(props.getBoolean(Props.EDITABLE_ACTUAL_COSTS));
         ph.setHonorConstraints(!props.getBoolean(Props.HONOR_CONSTRAINTS));

         PropertySet ps = new PropertySet(new DocumentInputStream(((DocumentEntry) rootDir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME))));
         SummaryInformation summaryInformation = new SummaryInformation(ps);
         ph.setProjectTitle(summaryInformation.getTitle());
         ph.setSubject(summaryInformation.getSubject());
         ph.setAuthor(summaryInformation.getAuthor());
         ph.setKeywords(summaryInformation.getKeywords());
         ph.setComments(summaryInformation.getComments());
         ph.setTemplate(summaryInformation.getTemplate());
         ph.setLastAuthor(summaryInformation.getLastAuthor());
         ph.setRevision(NumberHelper.parseInteger(summaryInformation.getRevNumber()));
         ph.setCreationDate(summaryInformation.getCreateDateTime());
         ph.setLastSaved(summaryInformation.getLastSaveDateTime());
         ph.setShortApplicationName(summaryInformation.getApplicationName());
         ph.setEditingTime(Integer.valueOf((int) summaryInformation.getEditTime()));
         ph.setLastPrinted(summaryInformation.getLastPrinted());

         try
         {
            ps = new PropertySet(new DocumentInputStream(((DocumentEntry) rootDir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME))));
         }

         catch (RuntimeException ex)
         {
            // I have one example MPP file which has a corrupt document summary property set.
            // Microsoft Project opens the file successfully, apparently by just ignoring
            // the corrupt data. We'll do the same here. I have raised a bug with POI
            // to see if they want to make the library more robust in the face of bad data.
            // https://bz.apache.org/bugzilla/show_bug.cgi?id=61550
            ps = null;
         }

         DocumentSummaryInformation documentSummaryInformation = ps == null ? new DocumentSummaryInformation() : new DocumentSummaryInformation(ps);
         ph.setCategory(documentSummaryInformation.getCategory());
         ph.setPresentationFormat(documentSummaryInformation.getPresentationFormat());
         ph.setManager(documentSummaryInformation.getManager());
         ph.setCompany(documentSummaryInformation.getCompany());
         ph.setContentType(documentSummaryInformation.getContentType());
         ph.setContentStatus(documentSummaryInformation.getContentStatus());
         ph.setLanguage(documentSummaryInformation.getLanguage());
         ph.setDocumentVersion(documentSummaryInformation.getDocumentVersion());

         Map<String, Object> customPropertiesMap = new HashMap<String, Object>();
         CustomProperties customProperties = documentSummaryInformation.getCustomProperties();
         if (customProperties != null)
         {
            for (CustomProperty property : customProperties.properties())
            {
               customPropertiesMap.put(property.getName(), property.getValue());
            }
         }
         ph.setCustomProperties(customPropertiesMap);

         ph.setCalculateMultipleCriticalPaths(props.getBoolean(Props.CALCULATE_MULTIPLE_CRITICAL_PATHS));

         ph.setBaselineDate(props.getTimestamp(Props.BASELINE_DATE));
         ph.setBaselineDate(1, props.getTimestamp(Props.BASELINE1_DATE));
         ph.setBaselineDate(2, props.getTimestamp(Props.BASELINE2_DATE));
         ph.setBaselineDate(3, props.getTimestamp(Props.BASELINE3_DATE));
         ph.setBaselineDate(4, props.getTimestamp(Props.BASELINE4_DATE));
         ph.setBaselineDate(5, props.getTimestamp(Props.BASELINE5_DATE));
         ph.setBaselineDate(6, props.getTimestamp(Props.BASELINE6_DATE));
         ph.setBaselineDate(7, props.getTimestamp(Props.BASELINE7_DATE));
         ph.setBaselineDate(8, props.getTimestamp(Props.BASELINE8_DATE));
         ph.setBaselineDate(9, props.getTimestamp(Props.BASELINE9_DATE));
         ph.setBaselineDate(10, props.getTimestamp(Props.BASELINE10_DATE));
      }

      catch (Exception ex)
      {
         throw new MPXJException(MPXJException.READ_ERROR, ex);
      }
   }
1130630
public static void loadUserConfigProps() {
        userProps = new Properties();
        try {
            LOG.info("Loading the properties as proj root /src:");
            loadProps(userProps, mRunPropertiesFile);
        } catch (IOException e) {
            LOG.info("context", e);
            try {
                LOG.info("No prop file found, trying load the properties as proj root /src:");
                loadProps(userProps, iRunPropertiesFile);
            } catch (IOException e1) {
                LOG.error("IOException", e1);
            }
        }
    }
627687
def custom_properties(self, props):
        
        fprops = javabridge.make_instance("java/io/File", "(Ljava/lang/String;)V", props)
        javabridge.call(self.jobject, "setCustomPropsFile", "(Ljava/io/File;)V", fprops)
889889
public static synchronized final void init ( Properties props ) throws CIFSException {
        if ( INSTANCE != null ) {
            throw new CIFSException("Singleton context is already initialized");
        }
        Properties p = new Properties();
        try {
            String filename = System.getProperty("jcifs.properties");
            if ( filename != null && filename.length() > 1 ) {

                try ( FileInputStream in = new FileInputStream(filename) ) {
                    p.load(in);
                }
            }

        }
        catch ( IOException ioe ) {
            log.error("Failed to load config", ioe); //$NON-NLS-1$
        }
        p.putAll(System.getProperties());
        if ( props != null ) {
            p.putAll(props);
        }
        INSTANCE = new SingletonContext(p);
    }
1085482
public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
        Properties props = new Properties();
        File extra = new File(baseDir, EXTRA_HEADERS_FILE);
        extra.getParentFile().mkdirs();
        // If the file exist it loads it, if not nothing happens.
        props = Instructions.merge(props, extra);
        if (value != null) {
            props.setProperty(header, value);
        } else {
            props.remove(header);
        }
        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream(extra);
            props.store(fos, "");
        } finally {
            IOUtils.closeQuietly(fos);
        }
    }
218508
function(props) {
        var files = {};
        // Include all template files by default.
        helpers.expand({filter: 'isFile', dot: true}, [pathPrefix + '**']).forEach(function(obj) {
          // Get the source filepath relative to the template root.
          var src = obj.rel.slice(pathPrefix.length);
          // Get the destination filepath.
          var dest = init.renames[src];
          // Create a property for this file, but use src if dest evaulates
          // to false
          var processed = (dest) ? grunt.template.process(dest, {data: props, delimiters: 'init'}) : false;
          processed = (processed === 'false' || processed === '') ? false : processed;
          files[(processed) ? processed : src] = obj.rel;
        });
        // Exclude files with a value of false in rename.json.
        var exclusions = Object.keys(init.renames).filter(function(key) {
          var processed = (init.renames[key]) ? 
            grunt.template.process(init.renames[key], {data: props, delimiters: 'init'}) : false;
          processed = (processed === 'false' || processed === '') ? false : processed;
          return (processed === false);
        }).map(function(key) {
          return pathPrefix + key;
        });
        // Exclude all exclusion files by deleting them from the files object.
        if (exclusions.length > 0) {
          helpers.expand({filter: 'isFile', dot: true}, exclusions).forEach(function(obj) {
            // Get the source filepath relative to the template root.
            var src = obj.rel.slice(pathPrefix.length);
            // And remove that file from the files list.
            delete files[src];
          });
        }
        return files;
      }
769942
def setup(app):
    '''  '''
    app.connect('html-page-context', html_page_context)
    app.connect('build-finished',    build_finished)
    app.sitemap_links = set()
1224672
function loadAttachments (doc, root, prefix) {
  doc.__attachments = doc.__attachments || []
  try {
    fs.statSync(root)
  } catch(e) {
    throw e
    throw new Error("Cannot stat file "+root)
  }
  doc.__attachments.push({root:root, prefix:prefix});
}
1173397
def setup(app):
    """"""
    app.add_config_value('jsdoc_source_root', '..', 'env')
    app.add_config_value('jsdoc_output_root', 'javascript', 'env')
    app.add_config_value('jsdoc_exclude', [], 'env')
    app.connect('builder-inited', generate_docs)