function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def fileConfig(fname, defaults=None, disable_existing_loggers=1): """ Read the logging configuration from a ConfigParser-format file.
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def _resolve(name): """Resolve a dotted name to a global object.""" name = string.split(name, '.') used = name.pop(0) found = __import__(used) for n in name: used = used + '.' + n try: found = getattr(found, n) except AttributeError: __import...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def _strip_spaces(alist): return map(lambda x: string.strip(x), alist)
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def _encoded(s): return s if isinstance(s, str) else s.encode('utf-8')
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def _create_formatters(cp): """Create and return formatters""" flist = cp.get("formatters", "keys") if not len(flist): return {} flist = string.split(flist, ",") flist = _strip_spaces(flist) formatters = {} for form in flist: sectname = "formatter_%s" % form ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def _install_handlers(cp, formatters): """Install and return handlers""" hlist = cp.get("handlers", "keys") if not len(hlist): return {} hlist = string.split(hlist, ",") hlist = _strip_spaces(hlist) handlers = {} fixups = [] #for inter-handler references for hand in hlis...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def _install_loggers(cp, handlers, disable_existing_loggers): """Create and install loggers"""
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def listen(port=DEFAULT_LOGGING_CONFIG_PORT): """ Start up a socket server on the specified port, and listen for new configurations.
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def handle(self): """ Handle a request.
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, handler=None): ThreadingTCPServer.__init__(self, (host, port), handler) logging._acquireLock() self.abort = 0 logging._releaseLock() self.timeout = 1
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def serve_until_stopped(self): import select abort = 0 while not abort: rd, wr, ex = select.select([self.socket.fileno()], [], [], self.timeout) if rd: ...
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def serve(rcvr, hdlr, port): server = rcvr(port=port, handler=hdlr) global _listener logging._acquireLock() _listener = server logging._releaseLock() server.serve_until_stopped()
babyliynfg/cross
[ 75, 39, 75, 4, 1489383147 ]
def get_info(p_display=None, default_root_window=None, p_info=None): if p_display is None: p_display = _p_display if default_root_window is None: default_root_window = _default_root_window if p_info is None: p_info = _p_info libXss.XScreenSaverQueryInfo(p_display, default_root_window, p_info) ...
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def __init__(self, when_idle_wait=5000, when_disabled_wait=120000, idle_threshold=60000): """when_idle_wait is the interval at which you should poll when you are already idle. when_disabled_wait is how often you should poll if information is unavailable (default: 2 minutes). i...
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def __init__(self, when_idle_wait=5000, when_disabled_wait=120000): """when_idle_wait is the interval at which you should poll when you are already idle. when_disabled_wait is how often you should poll if the screensaver is disabled and you are using XSS for your idle threshold.
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def check_idle(self): """Returns a tuple: (state_change, suggested_time_till_next_check, idle_time)
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def add_arguments(self, parser): parser.add_argument('--prediction-type', choices=['TUMOR', 'GLEASON'], type=str, dest='prediction_type', help='the type of the Prediction objects that are going to be reviewed') parser.add_argument('--worklist-file', dest='worklist', type=str,...
crs4/ProMort
[ 3, 5, 3, 11, 1461311365 ]
def _get_predictions_list(self, prediction_type): return Prediction.objects.filter(type=prediction_type, review_required=True).all()
crs4/ProMort
[ 3, 5, 3, 11, 1461311365 ]
def _create_prediction_annotation(self, prediction, reviewer, allow_duplicated): if not allow_duplicated: if self._check_duplicated(prediction, reviewer): return None prev_obj = PredictionReview( label=uuid4().hex, prediction=prediction, sl...
crs4/ProMort
[ 3, 5, 3, 11, 1461311365 ]
def create_worklist_from_file(self, worklist_file, prediction_type, allow_duplicated, report_file=None): raise NotImplementedError()
crs4/ProMort
[ 3, 5, 3, 11, 1461311365 ]
def create(kernel): result = Building() result.template = "object/building/poi/shared_naboo_tuskcattam_medium.iff" result.attribute_template_id = -1 result.stfName("poi_n","base_poi_building")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def create(kernel): result = Tangible() result.template = "object/tangible/component/item/quest_item/shared_momentum_compensator.iff" result.attribute_template_id = -1 result.stfName("craft_item_ingredients_n","momentum_compensator")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def optimize_png(png_file): if os.path.exists(OPTIPNG): process = subprocess.Popen([OPTIPNG, '-quiet', '-o7', png_file]) process.wait()
solus-cold-storage/evopop-gtk-theme
[ 190, 17, 190, 5, 1424038763 ]
def start_inkscape(): process = subprocess.Popen( [INKSCAPE, '--shell'], bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE ) wait_for_prompt(process) return process
solus-cold-storage/evopop-gtk-theme
[ 190, 17, 190, 5, 1424038763 ]
def __init__(self, path, force=False, filter=None): self.stack = [self.ROOT] self.inside = [self.ROOT] self.path = path self.rects = [] self.state = self.ROOT self.chars = "" self.force = force self.filter = filter
solus-cold-storage/evopop-gtk-theme
[ 190, 17, 190, 5, 1424038763 ]
def startElement(self, name, attrs): if self.inside[-1] == self.ROOT: if name == "svg": self.stack.append(self.SVG) self.inside.append(self.SVG) return elif self.inside[-1] == self.SVG: if (name == "g" and ('inkscape:groupmode' in a...
solus-cold-storage/evopop-gtk-theme
[ 190, 17, 190, 5, 1424038763 ]
def characters(self, chars): self.chars += chars.strip()
solus-cold-storage/evopop-gtk-theme
[ 190, 17, 190, 5, 1424038763 ]
def get_example_filepath(fname) -> Path: r"""Return absolute path to an example file if exist. Parameters ---------- fname : str Filename of an existing example file. Returns ------- Filepath Absolute filepath to an example file if exists. Notes ----- A ValueEr...
liam2/larray
[ 8, 5, 8, 228, 1392806323 ]
def enable_signed_values(request): """ Use signed values when running tests it this module. """ tmp = conf.SIGNED_VALUES conf.SIGNED_VALUES = True def fin(): conf.SIGNED_VALUES = tmp request.addfinalizer(fin)
AdvancedClimateSystems/python-modbus
[ 189, 68, 189, 36, 1444769179 ]
def test_response_on_single_bit_value_read_requests(sock, function): """ Validate response of a succesful Read Coils or Read Discrete Inputs request. """ slave_id, starting_address, quantity = (1, 0, 10) req_adu = function(slave_id, starting_address, quantity) assert tcp.send_message(req_adu, s...
AdvancedClimateSystems/python-modbus
[ 189, 68, 189, 36, 1444769179 ]
def test_response_on_multi_bit_value_read_requests(sock, function): """ Validate response of a succesful Read Holding Registers or Read Input Registers request. """ slave_id, starting_address, quantity = (1, 0, 10) req_adu = function(slave_id, starting_address, quantity) assert tcp.send_message...
AdvancedClimateSystems/python-modbus
[ 189, 68, 189, 36, 1444769179 ]
def test_response_single_value_write_request(sock, function, value): """ Validate responde of succesful Read Single Coil and Read Single Register request. """ slave_id, starting_address, value = (1, 0, value) req_adu = function(slave_id, starting_address, value) assert tcp.send_message(req_adu,...
AdvancedClimateSystems/python-modbus
[ 189, 68, 189, 36, 1444769179 ]
def _build_from_url(attrs): if 'url' in attrs and 'content' not in attrs: try: resp = jarr_get(attrs['url'], timeout=conf.crawler.timeout, user_agent=conf.crawler.user_agent) except Exception: return attrs attrs....
jaesivsm/pyAggr3g470r
[ 102, 11, 102, 29, 1402574029 ]
def update(self, filters, attrs, return_objs=False, commit=True): attrs = self._build_from_url(attrs) return super().update(filters, attrs, return_objs, commit)
jaesivsm/pyAggr3g470r
[ 102, 11, 102, 29, 1402574029 ]
def falseMatchDendritevsMPatterns(n_=1000): a_ = 30 theta_ = 10 s_ = 20 # Arrays used for plotting MList = [] errorList = [] print "\n\nn=%d, a=%d, theta=%d, s=%d" % (n_,a_,theta_,s_) error = 0.0 for M_ in range(1, 40): # Number of bits active in At atAfterUnion = numOnBits.subs(n, n_).sub...
numenta/htmresearch
[ 222, 109, 222, 35, 1409632950 ]
def falseMatchvsM(n_=1000): a_ = 200 theta_ = 15 s_ = 25 # Arrays used for plotting MList = [] errorList = [] print "\n\nn=%d, a=%d, theta=%d, s=%d" % (n_,a_,theta_,s_) error = 0.0 for M_ in range(1, 20): # Need this otherwise calculation goes to 0 numSynapsesAfterUnion = numOnBits.subs(n,...
numenta/htmresearch
[ 222, 109, 222, 35, 1409632950 ]
def synapsesvsM(s_ = 25): # Compute number of synapses on a segment as a function of M listofMValues = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] listofSynapses = [] n_=1000 print "\n\nn=%d, s=%d" % (n_,s_) for M_ in listofMValues: numSynapsesAfterUnion = numO...
numenta/htmresearch
[ 222, 109, 222, 35, 1409632950 ]
def __init__( self, pybullet_client, mocap_data, timeStep, useFixedBase=True, arg_parser=None, useComReward=False): self._pybullet_client = pybullet_client self._mocap_data = mocap_data self._arg_parser = arg_parser print("LOADING humanoid!") flags=self._pybullet_client.URDF_MAINTAI...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def initializePose(self, pose, phys_model, initBase, initializeVelocity=True):
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def calcCycleCount(self, simTime, cycleTime): phases = simTime / cycleTime count = math.floor(phases) loop = True #count = (loop) ? count : cMathUtil::Clamp(count, 0, 1); return count
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def setSimTime(self, t): self._simTime = t #print("SetTimeTime time =",t) keyFrameDuration = self._mocap_data.KeyFrameDuraction() cycleTime = self.getCycleTime() #print("self._motion_data.NumFrames()=",self._mocap_data.NumFrames()) self._cycleCount = self.calcCycleCount(t, cycleTime) #print(...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def computePose(self, frameFraction): frameData = self._mocap_data._motion_data['Frames'][self._frame] frameDataNext = self._mocap_data._motion_data['Frames'][self._frameNext] self._poseInterpolator.Slerp(frameFraction, frameData, frameDataNext, self._pybullet_client) #print("self._poseInterpolator.Sle...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def computeAndApplyPDForces(self, desiredPositions, maxForces): dofIndex = 7 scaling = 1 indices = [] forces = [] targetPositions=[] targetVelocities=[] kps = [] kds = []
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def computePDForces(self, desiredPositions, desiredVelocities, maxForces): """Compute torques from the PD controller.""" if desiredVelocities == None: desiredVelocities = [0] * self._totalDofs taus = self._stablePD.computePD(bodyUniqueId=self._sim_model, jointIndic...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def setJointMotors(self, desiredPositions, maxForces): controlMode = self._pybullet_client.POSITION_CONTROL startIndex = 7 chest = 1 neck = 2 rightHip = 3 rightKnee = 4 rightAnkle = 5 rightShoulder = 6 rightElbow = 7 leftHip = 9 leftKnee = 10 leftAnkle = 11 leftShould...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def buildHeadingTrans(self, rootOrn): #align root transform 'forward' with world-space x axis eul = self._pybullet_client.getEulerFromQuaternion(rootOrn) refDir = [1, 0, 0] rotVec = self._pybullet_client.rotateVector(rootOrn, refDir) heading = math.atan2(-rotVec[2], rotVec[0]) heading2 = eul[1] ...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def getState(self): stateVector = [] phase = self.getPhase() #print("phase=",phase) stateVector.append(phase) rootTransPos, rootTransOrn = self.buildOriginTrans() basePos, baseOrn = self._pybullet_client.getBasePositionAndOrientation(self._sim_model) rootPosRel, dummy = self._pybullet_cli...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def terminates(self): #check if any non-allowed body part hits the ground terminates = False pts = self._pybullet_client.getContactPoints() for p in pts: part = -1 #ignore self-collision if (p[1] == p[2]): continue if (p[1] == self._sim_model): part = p[3] i...
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def calcRootAngVelErr(self, vel0, vel1): diff = [vel0[0] - vel1[0], vel0[1] - vel1[1], vel0[2] - vel1[2]] return diff[0] * diff[0] + diff[1] * diff[1] + diff[2] * diff[2]
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def getReward(self, pose): """Compute and return the pose-based reward.""" #from DeepMimic double cSceneImitate::CalcRewardImitate #todo: compensate for ground height in some parts, once we move to non-flat terrain # not values from the paper, but from the published code. pose_w = 0.5 vel_w = 0....
nrz/ylikuutio
[ 17, 2, 17, 1, 1457044218 ]
def __init__(self, parent):
MTG/sms-tools
[ 1480, 707, 1480, 12, 1374853453 ]
def initUI(self): choose_label = "Input file (.wav, mono and 44100 sampling rate):" Label(self.parent, text=choose_label).grid(row=0, column=0, sticky=W, padx=5, pady=(10,2))
MTG/sms-tools
[ 1480, 707, 1480, 12, 1374853453 ]
def browse_file(self):
MTG/sms-tools
[ 1480, 707, 1480, 12, 1374853453 ]
def compute_model(self):
MTG/sms-tools
[ 1480, 707, 1480, 12, 1374853453 ]
def test_uuid_conversion(self): uuid = '089ffb20-5d19-4a8c-bb80-13650627d985' pvm_uuid = uuid_utils.convert_uuid_to_pvm(uuid) self.assertEqual(uuid, pvm_uuid) uuid = '989ffb20-5d19-4a8c-bb80-13650627d985' pvm_uuid = uuid_utils.convert_uuid_to_pvm(uuid) self.assertEqual('...
powervm/pypowervm
[ 27, 13, 27, 7, 1421699339 ]
def make_endpoint(endpoint: str) -> str: endpoint = endpoint return endpoint
googleapis/python-aiplatform
[ 306, 205, 306, 52, 1600875819 ]
def upgrade(): """Create DagCode Table.""" from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class SerializedDagModel(Base): __tablename__ = 'serialized_dag' # There are other columns here, but these are the only ones we need for the SELECT/UPDATE we ar...
apache/airflow
[ 29418, 12033, 29418, 869, 1428948298 ]
def __init__(self, stack_state): super(StackTraceModel, self).__init__( text_view=text_views.StackTraceView()) if (stack_state is not None): self['lines'] = [ {'filename': fn, 'line': ln, 'name': nm, 'code': cd} for fn, ln, nm, cd in traceback.ext...
SylvainA/os-event-catcher
[ 1, 3, 1, 1, 1410295543 ]
def __init__(self, thread_id, stack): super(ThreadModel, self).__init__(text_view=text_views.ThreadView()) self['thread_id'] = thread_id self['stack_trace'] = StackTraceModel(stack)
SylvainA/os-event-catcher
[ 1, 3, 1, 1, 1410295543 ]
def forwards(self, orm): # Adding model 'Accreditation' db.create_table(u'units_accreditation', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('unite', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['units.Unit'])), ('user', ...
ArcaniteSolutions/truffe2
[ 13, 12, 13, 7, 1439638478 ]
def hello(i): print(i)
cr0hn/OMSTD
[ 25, 20, 25, 39, 1415802772 ]
def main(): p = Pool(10) p.map(hello, range(50))
cr0hn/OMSTD
[ 25, 20, 25, 39, 1415802772 ]
def __init__(self, initial_score=10, # the initial score sound_params = {'direction':0.0}, # properties of the score response sound gain_file = 'ding.wav', # sound file per point loss_file = 'xBuzz01.wav', #...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def play_gain(self,task): self.sound(self.gain_file,volume=self.gain_volume,**self.params) self.marker(1) return task.done
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def __init__(self, # general properties rewardlogic, # reward handling logic watcher = None, # optional event watcher focused = True, # whether this task is ...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def run(self): self.pic_params['pos'][0] += self.screen_offset # pre-cache the media files... self.precache_picture(self.pic_on) self.precache_picture(self.pic_off) self.precache_picture(self.pic_tick_on) self.precache_picture(self.pic_tick_off) self.precache_soun...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def oncontrol(self,status): self.control = status
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def false_detection(self): self.marker(self.markerbase+4) self.rewardlogic.score_event(self.false_penalty)
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def correct(self): if self.focused: if ((self.cueobj is not None) and self.cueobj.iscued): self.marker(self.markerbase+5 if self.control else self.markerbase+6) else: self.marker(self.markerbase+7 if self.control else self.markerbase+8) ...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def __init__(self, rewardlogic, focused = True, # whether this task is currently focused markerbase = 1, # markers markerbase..markerbase+6 are used event_interval=lamb...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def run(self): self.pic_params['pos'][0] += self.screen_offset # pre-cache the media files... self.precache_picture(self.pic_on) self.precache_picture(self.pic_off) while True: if not self.focused: self.iscued = False # show the "off" pictu...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def __init__(self, # general properties rewardlogic, # reward handling logic watcher = None, # response event watcher focused = True, # whether this task is ...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def run(self): self.snd_params['direction'] += self.screen_offset # pre-cache the media files... self.precache_sound(self.snd_on) self.precache_sound(self.snd_tick_on) self.precache_sound(self.snd_tick_off) self.precache_sound(self.snd_wrongcue) self.precache_soun...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def oncontrol(self,status): self.control = status
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def false_detection(self): self.marker(self.markerbase+4) self.rewardlogic.score_event(self.false_penalty)
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def correct(self): if self.focused: if ((self.cueobj is not None) and self.cueobj.iscued): self.marker(self.markerbase+5 if self.control else self.markerbase+6) else: self.marker(self.markerbase+7 if self.control else self.markerbase+8) ...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def __init__(self, rewardlogic, focused = True, # whether this task is currently focused markerbase = 1, # markers markerbase..markerbase+6 are used event_interval=lamb...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def run(self): self.snd_params['direction'] += self.screen_offset # pre-cache the media files... self.precache_sound(self.snd_on) while True: self.sleep(self.event_interval()) # play the "on" sound and cue the other items self.iscued = self.focused ...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def __init__(self, # facilities used by this object rewardhandler=None, # a RewardLogic instance that manages the processing of generated rewards/penalties presenter=None, # the presenter on which to output the math problems ...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def run(self): try: if self.presenter is None: self.presenter = TextPresenter(**self.presenter_params)
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def on_digit(self,d): self.input += str(d)
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def __init__(self): LatentModule.__init__(self) self.randseed = 11463 # some initial randseed for the experiment; note that this should be different for each subject (None = random) # block design self.uiblocks = 24 # number of blocks with different UI permutatio...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def run(self): try: # init the randseed if self.randseed is not None: print "WARNING: Randomization of the experiment is currently bypassed." random.seed(self.randseed) self.marker(30000+self.randseed)
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def onspeech(self,phrase,listener): if phrase.lower() == 'roger': self.send_message('comma-roger') self.icon_comma.setScale(self.voice_icon_enlarge_size) self.icon_comma_reset_scale_at = time.time() + self.voice_icon_enlarge_duration taskMgr.doMethodLater(self.voi...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def reset_comma(self,task): if time.time() >= self.icon_comma_reset_scale_at-0.1: self.icon_comma.setScale(0.1) return task.done
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def clear_objects(self): # remove event watchers self.vismonwatcher.destroy() self.audmonwatcher.destroy() # remove buttons self.icon_sysmona.destroy() self.icon_comma.destroy() self.button_comma.destroy() self.button_commv.destroy() self.button_sy...
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def sysmona_false_detection(self): self.marker(702) self.rewardlogic.score_event(self.false_response_penalty)
sccn/SNAP
[ 26, 14, 26, 2, 1355612553 ]
def get_args(): parser = ArgumentParser(description='Run health checks of mongo and mtools systems')
ParsePlatform/flashback
[ 216, 72, 216, 7, 1403303564 ]
def create_inactive_user(email, full_name): """ Create inactive user with basic details. Used when moderators invite new users and when a member of the public requests an account. """ User = get_user_model() user = User.objects.create_user(email) user.is_active = False user.full_nam...
nlhkabu/connect
[ 47, 25, 47, 18, 1433260168 ]
def get_user(email): """ Retrieve a user based on the supplied email address. Return None if no user has registered this email address. """ User = get_user_model() try: user = User.objects.get(email=email) return user except User.DoesNotExist: return None
nlhkabu/connect
[ 47, 25, 47, 18, 1433260168 ]
def test_objectmapper(self): df = pdml.ModelFrame([]) self.assertIs(df.semi_supervised.LabelPropagation, ss.LabelPropagation) self.assertIs(df.semi_supervised.LabelSpreading, ss.LabelSpreading)
sinhrks/expandas
[ 302, 77, 302, 31, 1424488444 ]
def test_Classifications(self, algo): iris = datasets.load_iris() df = pdml.ModelFrame(iris)
sinhrks/expandas
[ 302, 77, 302, 31, 1424488444 ]
def rollback_env_variables(environ, env_var_subfolders): ''' Generate shell code to reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH. This does not cover modifications performed by environment hooks. ''' lines = [] unmodified_environ = copy....
jcicolani/Nomad
[ 6, 3, 6, 1, 1446612331 ]
def _get_workspaces(environ, include_fuerte=False, include_non_existing=False): ''' Based on CMAKE_PREFIX_PATH return all catkin workspaces. :param include_fuerte: The flag if paths starting with '/opt/ros/fuerte' should be considered workspaces, ``bool`` ''' # get all cmake prefix paths env_na...
jcicolani/Nomad
[ 6, 3, 6, 1, 1446612331 ]
def _prefix_env_variable(environ, name, paths, subfolders): ''' Return the prefix to prepend to the environment variable NAME, adding any path in NEW_PATHS_STR without creating duplicate or empty items. ''' value = environ[name] if name in environ else '' environ_paths = [path for path in value.spli...
jcicolani/Nomad
[ 6, 3, 6, 1, 1446612331 ]
def comment(msg): if not IS_WINDOWS: return '# %s' % msg else: return 'REM %s' % msg
jcicolani/Nomad
[ 6, 3, 6, 1, 1446612331 ]
def find_env_hooks(environ, cmake_prefix_path): ''' Generate shell code with found environment hooks for the all workspaces. ''' lines = [] lines.append(comment('found environment hooks in workspaces')) generic_env_hooks = [] generic_env_hooks_workspace = [] specific_env_hooks = [] ...
jcicolani/Nomad
[ 6, 3, 6, 1, 1446612331 ]
def Run(self, options, args): print >> sys.stderr, ('usage: %s <command> [<options>]' % _GetScriptName()) print >> sys.stderr, 'Available commands are:' for command in COMMANDS: print >> sys.stderr, ' %-10s %s' % (command.name, command.description) return 0
ChromiumWebApps/chromium
[ 216, 323, 216, 1, 1392992388 ]
def __init__(self): super(List, self).__init__() self._tests = None
ChromiumWebApps/chromium
[ 216, 323, 216, 1, 1392992388 ]
def ProcessCommandLine(self, parser, options, args): if not args: self._tests = _GetTests() elif len(args) == 1: self._tests = _MatchTestName(args[0]) else: parser.error('Must provide at most one test name.')
ChromiumWebApps/chromium
[ 216, 323, 216, 1, 1392992388 ]