Generates profile data from the inputed string data.
        
        :param      strdata | <str>
        
        :return     <XViewProfile>
509681
def fromString(strdata):
        
        if strdata:
            try:
                xprofile = ElementTree.fromstring(nativestring(strdata))
            except ExpatError, err:
                logger.exception(str(err))
                return XViewProfile()
            
            return XViewProfile.fromXml(xprofile)
        
        logger.warning('Blank profile data provided.')
        return XViewProfile()
488560
function(id, profileKey, workDir) {
    console.log("Generating preprocessor string content");

    if( !profiles.hasOwnProperty("definitions") ) {
         throw("\"profiles\" dictionary is badly formed, no \"definitions\" key");
    }
    if ( !profiles.definitions.hasOwnProperty(profileKey) ) {
        throw("\"" + profileKey + "\" is not a registred SGE profile");
    }
    var string = _preprocessorDump(id, workDir, profiles.definitions[profileKey]);
    //string += _preprocessorDump(id, profiles.definitions[profileKey]);
    console.log(string);

    return string;
}
663348
def parseProfileLine(fp):
    '''
    
    '''
    nextLine = fp.readline()
    if nextLine == None or nextLine == '':
        return (None, None)
    else:
        pieces = nextLine.strip('\n').split(',')
        return (pieces[0], int(pieces[1]))
871866
def runprofilerandshow(funcname, profilepath, argv='', *args, **kwargs):
    '''
    
    '''
    functionprofiler.runprofile(funcname+'(\''+argv+'\')', profilepath, *args, **kwargs)
    print 'Showing profile (windows should open in the background)'; sys.stdout.flush();
    functionprofiler.browseprofilegui(profilepath)
136901
def __pad(strdata):
    
    if request.args.get('callback'):
        return "%s(%s);" % (request.args.get('callback'), strdata)
    else:
        return strdata
1029391
protected function doString($strData)
    {
        list($type, $openDelimiter, $closeDelimiter, $pos, $interpolation, $fancyDelim, $split) = $strData;
        $balanced = $openDelimiter !== $closeDelimiter;
        $template = '/(?<!\\\\)((?:\\\\\\\\)*)(%s)/';
        $patterns = array();
        $patterns['term'] = sprintf($template, preg_quote($closeDelimiter, '/'));
        if ($balanced) {
            // for nesting balanced delims
            $patterns['nest'] = sprintf($template, preg_quote($openDelimiter, '/'));
        }
        if ($interpolation) {
            $patterns['interp'] = sprintf($template, preg_quote('#{', '/'));
        }
        $nestingLevel = 0;
        $break = false;
        while (!$break) {
            list($name, $index, $matches) = $this->getNextNamed($patterns);

            if ($name === null) {
                // special case, no matches, record the rest of the string and break
                // immediately
                $this->recordStringRange($pos, strlen($this->string()), $type, $split);
                $this->terminate();
                break;
            } elseif ($name === 'nest') {
                // nestable opener
                $nestingLevel++;
                $this->pos($index + strlen($matches[0]));
            } elseif ($name === 'term') {
                // terminator, may be nested
                if ($nestingLevel === 0) {
                    // wasn't nested, real terminator.
                    if ($fancyDelim) {
                        // matches[1] is either empty or a sequence of backslashes
                        $this->recordStringRange($pos, $index + strlen($matches[1]), $type, $split);
                        $this->record($matches[2], 'DELIMITER');
                    } else {
                        $this->recordStringRange($pos, $index + strlen($matches[0]), $type, $split);
                    }
                    $break = true;
                } else {
                    // pop a nesting level
                    $nestingLevel--;
                }
                $this->pos($index + strlen($matches[0]));
            } elseif ($name === 'interp') {
                // interpolation - temporarily break string highlighting, then
                // do interpolation, then resume.
                $this->recordStringRange($pos, $index + strlen($matches[1]), $type, $split);
                $this->record($matches[2], 'DELIMITER');
                $this->pos($index + strlen($matches[0]));

                $this->interpolate();
                if (($c = $this->peek()) === '}') {
                    $this->record($this->get(), 'DELIMITER');
                }
                $pos = $this->pos();
            } else {
                assert(0);
            }
            if ($break) {
                break;
            }
        }
        if ($type === 'REGEX' && $this->scan('/[iomx]+/')) {
            $this->record($this->match(), 'KEYWORD');
        }
    }
710658
function makeAttributesString(node, profile) {
		var attrQuote = profile.attributeQuote();
		var cursor = profile.cursor();
		
		return node.attributeList().map(function(a) {
			var isBoolean = profile.isBoolean(a.name, a.value);
			var attrName = profile.attributeName(a.name);
			var attrValue = isBoolean ? attrName : a.value;
			if (isBoolean && profile.allowCompactBoolean()) {
				return ' ' + attrName;
			}
			return ' ' + attrName + '=' + attrQuote + (attrValue || cursor) + attrQuote;
		}).join('');
	}
707362
function prepareProfileDir(profilesDir, nick) {
  var nick = nick || '.tmp';
  // Just in case `nick` has any funny business...
  nick = nick.replace(/[^\w\d.]/g, '-').replace('..', '-');
  var profileDir = path.join(profilesDir, util.format('vox-%s', nick));
  debug('Ensuring directory at %s', profileDir);
  mkdirp.sync(profileDir, 0700);
  return profileDir;
}
1284987
def fromString( cls, strdata ):
        
        if ( not strdata ):
            return None
            
        from xml.etree import ElementTree
        
        xelem = ElementTree.fromstring(str(strdata))
        output = cls(xelem.get('name'), xelem.get('colorGroups').split(','))
        
        for xcolor in xelem:
            colorName = xcolor.get('name')
            
            for xcolorval in xcolor:
                color = QColor( int(xcolorval.get('red')),
                                int(xcolorval.get('green')),
                                int(xcolorval.get('blue')),
                                int(xcolorval.get('alpha')) )
                
                output.setColor(colorName, color, xcolorval.get('group'))
        
        return output
1354585
def load_profiles_from_file(self, fqfn):
        
        if self.args.verbose:
            print('Loading profiles from File: {}{}{}'.format(c.Style.BRIGHT, c.Fore.MAGENTA, fqfn))
        with open(fqfn, 'r+') as fh:
            data = json.load(fh)
            for profile in data:
                # force update old profiles
                self.profile_update(profile)
                if self.args.action == 'validate':
                    self.validate(profile)
            fh.seek(0)
            fh.write(json.dumps(data, indent=2, sort_keys=True))
            fh.truncate()

        for d in data:
            if d.get('profile_name') in self.profiles:
                self.handle_error(
                    'Found a duplicate profile name ({}).'.format(d.get('profile_name'))
                )
            self.profiles.setdefault(
                d.get('profile_name'),
                {'data': d, 'ij_filename': d.get('install_json'), 'fqfn': fqfn},
            )
936062
def profile(length=25):
    

    from werkzeug.contrib.profiler import ProfilerMiddleware
    app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length])
    app.run()
106770
def __fetch_heatmap_data_from_profile(self):
        """"""
        # Read lines from file.
        with open(self.pyfile.path, "r") as file_to_read:
            for line in file_to_read:
                # Remove return char from the end of the line and add a
                # space in the beginning for better visibility.
                self.pyfile.lines.append("  " + line.strip("\n"))

        # Total number of lines in file.
        self.pyfile.length = len(self.pyfile.lines)

        # Fetch line profiles.
        line_profiles = self.__get_line_profile_data()

        # Creating an array of data points. As the profile keys are 1 indexed
        # we should range from 1 to line_count + 1 and not 0 to line_count.
        arr = []
        for line_num in range(1, self.pyfile.length + 1):
            if line_num in line_profiles:
                # line_profiles[i] will have multiple entries if line i is
                # invoked from multiple places in the code. Here we sum over
                # each invocation to get the total time spent on that line.
                line_times = [
                    ltime for _, ltime in line_profiles[line_num].values()
                ]
                arr.append([sum(line_times)])
            else:
                arr.append([0.0])

        # Create nd-array from list of data points.
        self.pyfile.data = np.array(arr)
300325
def initializeProfile(self):
        

        LOGGER.debug("> Building '{0}' profile.".format(self.__file))

        sections_file_parser = SectionsFileParser(self.__file)
        sections_file_parser.parse()

        if sections_file_parser.sections:
            fileStructureParsingError = lambda attribute: foundations.exceptions.FileStructureParsingError(
                "{0} | No '{1}' attribute found, '{2}' file structure seems invalid!".format(
                    self.__class__.__name__, attribute, self.__file))

            self.__directory = os.path.dirname(self.__file)
            self.__name = sections_file_parser.get_value("Name", "Component", default=None)
            if self.__name is None:
                raise fileStructureParsingError("Name")

            self.__title = sections_file_parser.get_value("Title", "Component", default=None)
            if self.__title is None:
                self.__title = self.__name

            self.__package = sections_file_parser.get_value("Module", "Component", default=None)
            if self.__package is None:
                raise fileStructureParsingError("Module")

            self.__attribute = sections_file_parser.get_value("Object", "Component", default=None)
            if self.__attribute is None:
                raise fileStructureParsingError("Object")

            self.__require = sections_file_parser.get_value("Require", "Component", default=None)
            self.__require = list() if self.__require is None else self.__require.split("|")

            self.__version = sections_file_parser.get_value("Version", "Component", default=None)
            if self.__version is None:
                raise fileStructureParsingError("Version")

            self.__author = sections_file_parser.get_value("Author", "Informations", default=None)

            self.__email = sections_file_parser.get_value("Email", "Informations", default=None)

            self.__url = sections_file_parser.get_value("Url", "Informations", default=None)

            self.__description = sections_file_parser.get_value("Description", "Informations", default=None)

            return True
        else:
            raise foundations.exceptions.FileStructureParsingError(
                "{0} | No sections found, '{1}' file structure seems invalid!".format(self.__class__.__name__,
                                                                                      self.__file))
716915
def load( filename ):
        
        try:
            f = open(filename, 'r')
            
        except IOError:
            logger.exception('Could not load the file: %s' % filename)
            return False
        
        strdata = f.read()
        f.close()
        
        return XViewProfile.fromString(strdata)
867966
function redrawProfilerCanvas() {
			updateProfilerConfig();
			var width;
			var height;
			s.height = s.fontSize * 3 + s.padding * 2;
			if (s.align === "vertical") {
				width = s.width;
				height = (s.height + s.margin) * Object.keys(profilerData).length - s.margin;
			} else {
				width = (s.width + s.margin) * Object.keys(profilerData).length - s.margin;
				height = s.height;
			}
			profilerCanvas.width = width;
			profilerCanvas.height = height;
			if (s.expand) {
				profilerCanvas.style.width = width * 1.5 + "px";
				profilerCanvas.style.height = height * 1.5 + "px";
			} else {
				profilerCanvas.style.width = width + "px";
				profilerCanvas.style.height = height + "px";
			}
			profilerCanvasContext.font = s.fontSize + "px sans-serif";
		}
591180
def do_profile(self,args):
        
        parser = CommandArgumentParser("profile")
        parser.add_argument(dest="profile",help="Profile name")
        parser.add_argument('-v','--verbose',dest="verbose",action='store_true',help='verbose')
        args = vars(parser.parse_args(args))

        profile = args['profile']
        verbose = args['verbose']
        if verbose:
            print "Selecting profile '{}'".format(profile)

        selectedProfile = {}
        if profile in Config.config['profiles']:
            selectedProfile = Config.config['profiles'][profile]

        selectedProfile['name'] = profile
        Config.config['selectedProfile'] = selectedProfile

        awsProfile = profile
        if 'awsProfile' in selectedProfile:
            awsProfile = selectedProfile['awsProfile']
        AwsConnectionFactory.resetInstance(profile=awsProfile)
106447
public void generateProfile() {
        File directory = new File(arglist.get(0));
        String lang = arglist.get(1);
        File file = searchFile(directory, lang + "wiki-.*-abstract\\.xml.*");
        if (file == null) {
            System.err.println("Not Found text file : lang = " + lang);
            return;
        }

        try(FileOutputStream outputStream = new FileOutputStream(new File(lang))) {
            LangProfile profile = GenProfile.load(lang, file);
            profile.omitLessFreq();
            new LangProfileWriter().write(profile, outputStream);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }