Constructor of Profile has no fault-tolerance, make sure you pass the right parameters @param {Object} options - path: {node_path} path to save the profiles
194726
function Profile(options) {
  this.path = node_path.resolve(profile.resolveHomePath(options.path));
  this.schema = options.schema;
  this.context = options.context || null;
  this.raw_data = {};
  this.codec = this._get_codec(options.codec);

  this.options = options;
}
407761
function startline(opt) {

  var options = opt || Object.create(null);

  // file
  var file;
  if (Boolean(options.file)) {
    file = require('path').resolve(String(options.file));
    if (!fs.existsSync(file)) {
      throw new Error('file does not exist');
    }
    if (!fs.statSync(file).isFile()) {
      throw new Error('path is not a file');
    }
  } else {
    throw new Error('"file" is required');
  }

  // clean
  var my = {
    file: file,
    encoding: options.encoding,
    flag: String(options.flag || 'r'),
    mode: Number(options.mode) || 444,
    autoClose: options.autoClose === false ? false : true,
    start: Number(options.start) || 0,
    end: Number(options.end),
    rc4: options.rc4,
    autokey: options.autokey,
    lodash: Boolean(options.autokey),
  };

  return new Startline(my);
}
839291
def make_profile(data, out_dir, args):
    
    safe_dirs(out_dir)
    main_table = []
    header = ['id', 'ann']
    n = len(data[0])
    bar = ProgressBar(maxval=n)
    bar.start()
    bar.update(0)
    for itern, c in enumerate(data[0]):
        bar.update(itern)
        logger.debug("creating cluser: {}".format(c))
        safe_dirs(os.path.join(out_dir, c))
        valid, ann, pos_structure = _single_cluster(c, data, os.path.join(out_dir, c, "maps.tsv"), args)
        data[0][c].update({'profile': pos_structure})
        loci = data[0][c]['loci']
        data[0][c]['precursor'] = {"seq": precursor_sequence(loci[0][0:5], args.ref)}
        data[0][c]['precursor']["colors"] = _parse(data[0][c]['profile'], data[0][c]['precursor']["seq"])
        data[0][c]['precursor'].update(run_rnafold(data[0][c]['precursor']['seq']))

    return data
199611
def profile(self, value):
        
        if value not in VALID_PROFILES:
            raise TypeError('Profile option must be one of: ' + ', '.join(VALID_PROFILES))

        self._body['profile'] = value
221807
def save(path, params = {})
            options =
            {
                delinearize: true,
                recompile: true,
                decrypt: false
            }
            options.update(params)

            if self.frozen? # incompatible flags with frozen doc (signed)
                options[:recompile] =
                options[:rebuild_xrefs] =
                options[:noindent] =
                options[:obfuscate] = false
            end

            if path.respond_to?(:write)
                fd = path
            else
                path = File.expand_path(path)
                fd = File.open(path, 'w').binmode
                close = true
            end

            load_all_objects unless loaded?

            intents_as_pdfa1 if options[:intent] =~ /pdf[\/-]?A1?/i
            self.delinearize! if options[:delinearize] and self.linearized?
            compile(options) if options[:recompile]

            fd.write output(options)
            fd.close if close

            self
        end
1001019
def saveProfile( self ):
        
        manager = self.parent()
        prof    = manager.currentProfile()
        
        # save the current profile
        save_prof = manager.viewWidget().saveProfile()
        prof.setXmlElement(save_prof.xmlElement())
411995
function save_config(path, config) {
	debug.assert(path).is('string');
	debug.assert(config).is('object');
	return $Q.fcall(function stringify_json() {
		return JSON.stringify(config, null, 2);
	}).then(function write_to_file(data) {
		return FS.writeFile(path, data, {'encoding':'utf8'});
	});
}
332297
function init(options) {
  var debug = require('../debug').spawn('init');

  function sourceMapInit(file, encoding, callback) {
    // pass through if file is null or already has a source map
    if (file.isNull() || file.sourceMap) {
      this.push(file);
      return callback();
    }

    if (file.isStream()) {
      return callback(new Error(utils.PLUGIN_NAME + '-init: Streaming not supported'));
    }

    if (options === undefined) {
      options = {};
    }
    debug(function() {
      return options;
    });

    var fileContent = file.contents.toString();
    var sourceMap, preExistingComment;
    var internals = initInternals(options, file, fileContent);

    if (options.loadMaps) {
      var result = internals.loadMaps();
      sourceMap = result.map;
      fileContent = result.content;
      preExistingComment = result.preExistingComment;
    }

    if (!sourceMap && options.identityMap) {
      debug(function() { return '**identityMap option is deprecated, update to use sourcemap.identityMap stream**'; });
      debug(function() {
        return 'identityMap';
      });
      var fileType = path.extname(file.path);
      var source = unixStylePath(file.relative);
      var generator = new SourceMapGenerator({ file: source });

      if (fileType === '.js') {
        var tokenizer = acorn.tokenizer(fileContent, { locations: true });
        while (true) {
          var token = tokenizer.getToken();
          if (token.type.label === 'eof') {
            break;
          }
          var mapping = {
            original: token.loc.start,
            generated: token.loc.start,
            source: source,
          };
          if (token.type.label === 'name') {
            mapping.name = token.value;
          }
          generator.addMapping(mapping);
        }
        generator.setSourceContent(source, fileContent);
        sourceMap = generator.toJSON();
      } else if (fileType === '.css') {
        debug('css');
        var ast = css.parse(fileContent, { silent: true });
        debug(function() {
          return ast;
        });
        var registerTokens = function(ast) {
          if (ast.position) {
            generator.addMapping({ original: ast.position.start, generated: ast.position.start, source: source });
          }

          function logAst(key, ast) {
            debug(function() {
              return 'key: ' + key;
            });
            debug(function() {
              return ast[key];
            });
          }

          for (var key in ast) {
            logAst(key, ast);
            if (key !== 'position') {
              if (Object.prototype.toString.call(ast[key]) === '[object Object]') {
                registerTokens(ast[key]);
              } else if (Array.isArray(ast[key])) {
                debug(function() {
                  return '@@@@ ast[key] isArray @@@@';
                });
                for (var i = 0; i < ast[key].length; i++) {
                  registerTokens(ast[key][i]);
                }
              }
            }
          }
        };
        registerTokens(ast);
        generator.setSourceContent(source, fileContent);
        sourceMap = generator.toJSON();
      }
    }

    if (!sourceMap) {
      // Make an empty source map
      sourceMap = {
        version: 3,
        names: [],
        mappings: '',
        sources: [unixStylePath(file.relative)],
        sourcesContent: [fileContent],
      };
    } else if (preExistingComment !== null && typeof preExistingComment !== 'undefined') {
      sourceMap.preExistingComment = preExistingComment;
    }

    sourceMap.file = unixStylePath(file.relative);
    file.sourceMap = sourceMap;

    this.push(file);
    callback();
  }

  return through.obj(sourceMapInit);
}
489289
function createWriteStream (path, options) {
    // build meta data
    var metadata = {}
    // get content type for file
    var contentType = mimeTypes.lookup(path)
    // set content type if found
    if (contentType) {
        metadata.contentType = contentType
    }
    // make sure bucket exists
    return this.bucketExists().then(() => {
        // create file write stream
        return this.bucket.file(path).createWriteStream({
            gzip: this.defaultGzip,
            metadata: metadata,
            public: this.defaultPublic,
            resumable: false,
        })
    })
}
551928
def save_firefox_profile(self, remove_old=False):
        """"""
        self.logger.info("Saving profile from %s to %s" % (self._profile.path, self._profile_path))

        if remove_old:
            if os.path.exists(self._profile_path):
                try:
                    shutil.rmtree(self._profile_path)
                except OSError:
                    pass

            shutil.copytree(os.path.join(self._profile.path), self._profile_path,
                            ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
        else:
            for item in os.listdir(self._profile.path):
                if item in ["parent.lock", "lock", ".parentlock"]:
                    continue
                s = os.path.join(self._profile.path, item)
                d = os.path.join(self._profile_path, item)
                if os.path.isdir(s):
                    shutil.copytree(s, d,
                                    ignore=shutil.ignore_patterns("parent.lock", "lock", ".parentlock"))
                else:
                    shutil.copy2(s, d)

        with open(os.path.join(self._profile_path, self._LOCAL_STORAGE_FILE), 'w') as f:
            f.write(dumps(self.get_local_storage()))
958732
function(path, callback, opts) {

		if (!callback) callback = function() { };

		var fallbacks = [];
		if (path.each) {
			if (path.length==0) return;
			fallbacks = path;
			path      = fallbacks.shift()+"";
		}

		//Stuff that will make us not want to load files.
		if (this.failedFiles.contains(path)) return;

		opts = opts || {};
		var file = this.worldPath+path+'.js';
		if (opts.rootPath) file = path+'.js';

		var my = this;
		var err;
		var handleData = function(e,raw) {
			data = false;
			if (!raw) {
				err = e;
				my.failedFiles.push(path);
				/* Continue down our list of fallbacks. */
				if (fallbacks.length>0) {
					my.loadFile(fallbacks, callback, opts);
				} else {
					log_error("File not found: "+file);
				}
			} else {
				try { eval('data='+raw); }
				catch (e) { log_error(e); }
			} callback(err, data);
			return data;
		};

		if (opts.sync) {
			try {
				var data = fs.readFileSync(file);
			} catch (e) {
				this.failedFiles.push(path);
				/* Continue down our list of fallbacks. */
				if (fallbacks.length>0) {
					return this.loadFile(fallbacks, callback, opts);
				} else return e;
			} return handleData(false,data);
		} else {
			fs.readFile(file, handleData);
		}
	}
1011848
function verifyProfile(profile, profileKey) {
    if (!profile.file && !profile.url) {
        throw new Error(`[${profileKey}] Must specify a file or url in the configuration.`);
    }
    if (!profile.output) {
        throw new Error(`[${profileKey}] Must specify an output file path in the configuration.`);
    }
    if (!profile.generator) {
        throw new Error(`[${profileKey}] Must specify a generator in the configuration.`);
    }
    if (profile.generator.toLowerCase() === 'core') {
        throw new Error(`[${profileKey}] Invalid generator ${profile.generator}. This name is reserved.`);
    }
    if (profile.generator.match(/^[\w-]+-language$/i)) {
        throw new Error(`[${profileKey}] Invalid generator ${profile.generator}. The -language suffix is reserved for language helper packages.`);
    }
    profile.debug = profile.debug || {};
    profile.filters = profile.filters || {};
    profile.transforms = profile.transforms || {};
    profile.options = profile.options || {};
}
229712
private void generateDefaultProfile(final DaoManager storage, final String profileSourcePath) throws SQLException, IOException{
        Profile profile = storage.getProfilesDao().getProfile(DEFAULT_PROFILE_SID);

        if (profile == null) {
            if(logger.isDebugEnabled()) {
                logger.debug("default profile does not exist, will create one from default Plan");
            }
            JsonNode jsonNode = JsonLoader.fromPath(profileSourcePath);
            profile = new Profile(DEFAULT_PROFILE_SID, jsonNode.toString(), new Date(), new Date());
            storage.getProfilesDao().addProfile(profile);
        } else {
            if(logger.isDebugEnabled()){
                logger.debug("default profile already exists, will not override it.");
            }
        }
    }
868493
def cli(ctx, profile):
    
    if ctx.obj is None:
        ctx.obj = {}
    ctx.obj['profile'] = profile
    pass
718320
function ConfigReader(path) {
  const self = this;
  const fs = require('fs');
  const util = require('util');
  const yaml = require('js-yaml');
  const _ = require('lodash');
  const allowedEnvironmentVars = {
    token: 'CF_API_KEY',
    email: 'CF_API_EMAIL',
    domain: 'CF_API_DOMAIN'
  };

  const homePath = process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'];


  path = path ? path.replace('~', homePath) : false;
  self.readConfig = readConfig;

  function readConfig(account) {
    let config = {};
    //Load allowed environment variables
    const envConfig = _.fromPairs(
      _.filter(_.map(allowedEnvironmentVars, function (envVar, key) {
          if (process.env[envVar]) {
            return [key, process.env[envVar]];
          } else {
            return false;
          }
        }
      ), function (value) {
        return value !== false;
      })
    );
    if (path && fs.existsSync(path)) {
      try {
        const ymlConfig = yaml.safeLoad(fs.readFileSync(path, 'utf8'));
        if (ymlConfig !== undefined) {
          if (ymlConfig.defaults.account || account) {
            account = (account) ? account : ymlConfig.defaults.account;
            if (ymlConfig.accounts[account] !== undefined) {
              config = ymlConfig.accounts[account];
            } else {
              console.log(util.format('Unable to find account %s', account));
              console.log('Available accounts: ');
              _.each(ymlConfig.accounts, function (acc, name) {
                console.log(util.format(' - %s', name));
              });
              return false;
            }
          } else {
            config = ymlConfig.defaults;
          }
        } else {
          throw new Error(util.format('Unable to parse file: %s', path));
        }
      } catch (error) {
        throw new Error(util.format('Invalid config file: %s message: ', path, error.message));
      }
    }
    return _.extend(config, envConfig);
  }
}
182424
function(attributes, options){
      var t = this;
      t.fileWatchers = {};

      // Instance level constants (can be overridden in sub-classes)
      t.CONST = t.CONST || CONST;

      // Call parent constructor
      TreeProbe.prototype.initialize.apply(t, arguments);

      // Assume callback responsibility.
      options.asyncInit = true;
      var callback = options.callback;

      // Set the root path from the Server's DB
      t.rootPath = Path.join(UI.Server.currentServer.get('siteDbPath'), t.CONST.objectClass);

      // Build the full path to the directory, possibly routed to an app DB
      var path = t.get('path'),
          parts = path.replace(/^[\\\/]/,'').split('/'),
          appName = parts[0] === 'app' ? parts[1] : null;
      if (appName && UI.Server.currentServer.apps[appName]) {

        // Build the dirPath from the module DB
        var appDef = UI.Server.currentServer.apps[appName];
        parts.splice(0,2);
        t.dirPath = Path.join(appDef.moduleDir, 'site_db', t.CONST.objectClass, parts.join('/'));
      }
      else {

        // Normal path - under the site_db/Page directory
        t.dirPath = Path.join(t.rootPath, path);
      }

      // Go straight to sync (no stat/watch) if the path is the app directory
      if (t.get('path') === '/app') {
        return t.sync(callback);
      }

      // Watch the directory and synchronize objects in it.
      // This is called after the FS.stat (below)
      var watchSync = function() {
        t.dirWatcher = FS.watch(t.dirPath, {persistent:false}, function(type){
          t.sync();
        });

        // Synchronize this object with the directory.
        t.sync(callback);
      }

      // Make sure the directory exists
      FS.stat(t.dirPath, function(error, stat) {

        // Create the directory if it doesn't exist
        if (error && error.code == 'ENOENT') {
          FileProbe.mkdir_r(t.dirPath, '0777', function(error) {
            if (error) {
              return callback(error);
            }
            // Created
            return watchSync();
          });
          return;
        }

        // Other error than directory doesn't exist
        if (error) {
          return callback(error);
        }

        // This shouldn't happen
        if (!stat.isDirectory()) {
          return callback({err: 'Not a directory: ' + t.dirPath});
        }

        // Continue
        return watchSync();
      });
    }
996975
function(profiles) {
			profiles = utils.parseJSON(profiles);
			var snippets = {};
			Object.keys(profiles).forEach(function(syntax) {
				var options = profiles[syntax];
				if (!(syntax in snippets)) {
					snippets[syntax] = {};
				}
				snippets[syntax].profile = normalizeProfile(options);
			});

			this.loadSnippets(snippets);
		}