For the sake of profiling.
339292
def get_abbreviations(kb):
    
    return {"%s$$n%i" % (author.get_urn(), i): abbrev
                for author in kb.get_authors()
                for i, abbrev in enumerate(author.get_abbreviations())
                if author.get_urn() is not None}
230701
def profile(func, stream=None):
    
    def wrapper(*args, **kwargs):
        prof = LineProfiler()
        val = prof(func)(*args, **kwargs)
        show_results(prof, stream=stream)
        return val
    return wrapper
199027
def get_profiles(self):
        
        return set(x.profile for x in self.requires if x.profile)
306174
function attachProfiling( scope, watchExp, listener, objectEquality ) {
   const watcherIsFunction = typeof watchExp === 'function';
   const listenerIsFunction = typeof listener === 'function';

   const items = axProfiling.items;
   const context = determineContext( scope );
   if( !( scope.$id in items ) ) {
      items[ scope.$id ] = {
         context,
         watchers: []
      };

      scope.$on( '$destroy', () => {
         detachProfiling( scope );
         delete items[ scope.$id ];
      } );
   }


   if( context.widgetScopeId ) {
      if( !( context.widgetId in axProfiling.widgetIdToScopeId ) ) {
         axProfiling.widgetIdToScopeId[ context.widgetId ] = context.widgetScopeId;
      }
   }

   const profilingEntry = {
      watchFn: {
         type: watcherIsFunction ? 'f' : 's',
         name: watcherIsFunction ? `${functionName( watchExp )}()` : watchExp,
         time: 0,
         count: 0
      },
      listener: {
         type: listenerIsFunction ? 'f' : 's',
         name: listenerIsFunction ? `${functionName( listener )}()` : listener,
         time: 0,
         count: 0
      }
   };
   items[ scope.$id ].watchers.push( profilingEntry );

   const stopWatching = origWatch.call( scope, watchExp, listener, objectEquality );

   const watchEntry = scope.$$watchers[ 0 ];
   watchEntry.get = instrumentFunction( watchEntry.get, profilingEntry.watchFn );
   watchEntry.fn = instrumentFunction( watchEntry.fn, profilingEntry.listener );

   return () => {
      stopWatching();
      detachProfiling( scope );
   };
}
817455
def setCurrentProfile(self, prof):
        
        if prof is None:
            self.clearActive()
            return
        
        # loop through the profiles looking for a match
        profile = None
        blocked = self.signalsBlocked()
        self.blockSignals(True)
        for act in self._profileGroup.actions():
            if prof in (act.profile(), act.profile().name()):
                act.setChecked(True)
                profile = act.profile()
            else:
                act.setChecked(False)
        self.blockSignals(blocked)
        
        # update the current profile
        if profile == self._currentProfile and not self._viewWidget.isEmpty():
            return
        
        self._currentProfile = profile
        if self._viewWidget and profile and not blocked:
            self._viewWidget.restoreProfile(profile)
        
        if not blocked:
            self.loadProfileFinished.emit(profile)
            self.currentProfileChanged.emit(profile)
947505
function (userId, user, fields, modifier) {
    // make sure it is our record
    if (user._id !== userId)
      return false;

    // user can only modify the 'profile' field. sets to multiple
    // sub-keys (eg profile.foo and profile.bar) are merged into entry
    // in the fields list.
    if (fields.length !== 1 || fields[0] !== 'profile')
      return false;

    return true;
  }
1073195
private void onProfileUpdate(ProfileUpdateEvent event) {
        handler.post(() -> listener.onProfileUpdate(event));
        log("Event published " + event.toString());
    }
982661
def setCurrentProfile(self, profile):
        
        try:
            index = self._profiles.index(profile)
        except ValueError:
            index = -1
        
        self._profileCombo.setCurrentIndex(index)
516633
def delete(self):
        """"""
        response = delete_profile(self.profile_id)
        response.raise_if_error()
        super(CustomerProfile, self).delete()
788710
public function recordProfiling()
    {
        if (is_null($this->connection)) {
            return;
        }

        // turn off the profiler so we don't profile the following queries
        self::$profiling = false;

        foreach ($this->queriesProfiling as $query => $info) {
            $time  = $info['sum_time_ms'];
            $time  = Common::forceDotAsSeparatorForDecimalPoint($time);
            $count = $info['count'];

            $queryProfiling = "INSERT INTO " . Common::prefixTable('log_profiling') . "
						(query,count,sum_time_ms) VALUES (?,$count,$time)
						ON DUPLICATE KEY UPDATE count=count+$count,sum_time_ms=sum_time_ms+$time";
            $this->query($queryProfiling, array($query));
        }

        // turn back on profiling
        self::$profiling = true;
    }
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;
}
439539
def removeProfile(self, profile):
        
        if not profile in self._profiles:
            return
        
        index = self._profiles.index(profile)
        self._profiles.remove(profile)
        self._profileCombo.blockSignals(True)
        self._profileCombo.takeItem(index)
        self._profileCombo.blockSignals(False)
1179052
public static void stopProfilerAndReport() {
		profiler.stopCollecting();

		// Write a report file
		try {
			// Get path from property file
			String path = CoreProperties.getLoader().getPropertyAsString(
					VanillaDb.class.getName() + ".PROFILE_OUTPUT_DIR",
					System.getProperty("user.home"));
			File out = new File(path, System.currentTimeMillis()
					+ "_profile.txt");
			FileWriter wrFile = new FileWriter(out);
			BufferedWriter bwrFile = new BufferedWriter(wrFile);

			// Write Profiling Report
			bwrFile.write(profiler.getTopPackages(30));
			bwrFile.newLine();
			bwrFile.write(profiler.getTopMethods(30));
			bwrFile.newLine();
			bwrFile.write(profiler.getTopLines(30));

			/*
			 * I should write a more careful code here. I didn't do it, because
			 * of the same reason above.
			 */
			bwrFile.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
1018215
public void removeProfileByIdentifier(long identifier) {
        int found = getPositionByIdentifier(identifier);
        if (found > -1) {
            mAccountHeaderBuilder.mProfiles.remove(found);
        }

        mAccountHeaderBuilder.updateHeaderAndList();
    }
925534
public final void setProfileId(String profileId) {
        boolean force = false;
        if (Utility.isNullOrEmpty(this.profileId) || !this.profileId.equalsIgnoreCase(profileId)) {
            // Clear out the old profilePicture before requesting for the new one.
            setBlankProfilePicture();
            force = true;
        }

        this.profileId = profileId;
        refreshImage(force);
    }
374459
def __profile_file(self):
        """"""
        self.line_profiler = pprofile.Profile()
        self.line_profiler.runfile(
            open(self.pyfile.path, "r"), {}, self.pyfile.path
        )
1316711
private void updateLocalProfileKeyExpiryTime(String key) {
        if (key == null) return;

        synchronized (PROFILE_EXPIRY_MAP) {
            PROFILE_EXPIRY_MAP.put(key, calculateLocalKeyExpiryTime());
        }
    }