code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def testV1beta1IngressBackend(self): <NEW_LINE> <INDENT> model = k8sv1beta1.models.v1beta1_ingress_backend.V1beta1IngressBackend() | Test V1beta1IngressBackend | 625941dc73bcbd0ca4b2c378 |
def get_possible_actions(self, board, pos, ammo, bombs): <NEW_LINE> <INDENT> valid_acts = [] <NEW_LINE> x, y = pos <NEW_LINE> dirX = [-1,1, 0,0] <NEW_LINE> dirY = [ 0,0,-1,1] <NEW_LINE> for k in range(0, len(dirX)): <NEW_LINE> <INDENT> newX = x + dirX[k] <NEW_LINE> newY = y + dirY[k] <NEW_LINE> if newX < board.shape[0]... | 0 : Pass
1 : Up
2 : Down
3 : Left
4 : Right
5 : Bomb | 625941dc4e696a04525c974e |
def add(x, y): <NEW_LINE> <INDENT> return x+y | "this function adds two numbers | 625941dc3cc13d1c6d3c767b |
def pc_nproduced_var(self): <NEW_LINE> <INDENT> return _channels_swig.selective_fading_model_sptr_pc_nproduced_var(self) | pc_nproduced_var(selective_fading_model_sptr self) -> float | 625941dc3317a56b86939f54 |
def test_brevet_get_nonexistent_brevet_past(self): <NEW_LINE> <INDENT> url = reverse('register:brevet', args=('LM', 200, '13Mar2001')) <NEW_LINE> response = self.client.get(url) <NEW_LINE> self.assertEqual(response.status_code, 404) | GET request for nonexistent brevet in past fails with 404
| 625941dc8da39b475bd65279 |
def _safe_dict_copy(self, key, val_obj): <NEW_LINE> <INDENT> val = self._plist_dict.get(key) <NEW_LINE> if val is not None: <NEW_LINE> <INDENT> val_obj[key] = val | Safely copy from the source dict into a target but only if the given key exists
:param key: The key to look for in the source dict
:return: None | 625941dc097d151d1a22315a |
def moveout(self, irc, msg, args, channel): <NEW_LINE> <INDENT> self._remove(irc, msg, args, channel, msg.nick) | Move yourself out of the neighborhood. | 625941dc29b78933be1e59aa |
def get_index(self, result_tuple): <NEW_LINE> <INDENT> new = [] <NEW_LINE> for x in result_tuple: <NEW_LINE> <INDENT> if x == 0: <NEW_LINE> <INDENT> new.append(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> new.append(1) <NEW_LINE> <DEDENT> <DEDENT> new.reverse() <NEW_LINE> coeff = 1 <NEW_LINE> total = 0 <NEW_LINE> f... | Takes a tuple like (2.5, 0, 2.5, 0, 0) and makes it into
(1,0,1,0,0), then converts the base two number 10100 into
base ten -- 20. | 625941dc7cff6e4e81117c88 |
def listEncodedIdPrefixes(self): <NEW_LINE> <INDENT> regs = [] <NEW_LINE> enc_ids = self._get_mini_repository().listEncodedIdPrefixes() <NEW_LINE> for enc_id in enc_ids: <NEW_LINE> <INDENT> regs.append(PrefixFormat(enc_id["prefix"], enc_id["format"])) <NEW_LINE> <DEDENT> return regs | Lists all encoded id prefixes.
See: http://franz.com/agraph/support/documentation/v4/encoded-ids.html | 625941dc50812a4eaa59c621 |
def test_pop(self): <NEW_LINE> <INDENT> self.state._pop() <NEW_LINE> self.assertTrue(self.state.done) <NEW_LINE> self.sm.update() <NEW_LINE> self.assertEqual(0, len(self.sm._states)) | Pop trigger | 625941dc3346ee7daa2b3070 |
def get_account_balance(self, imsi): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return int(crdt.PNCounter.from_json(self[imsi]).value()) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise SubscriberNotFound(imsi) | Gets a subscriber's balance as an integer.
Raises:
SubscriberNotFound if the subscriber doesn't exist | 625941dcb830903b967e9c0b |
def record_no_emittion(self, no_emittion): <NEW_LINE> <INDENT> self.no_emittions[no_emittion.event_cls] = no_emittion.reason | Record `no_emittion` in `self.no_emittions`.
:param emittion: :class:`NoEmittion`. | 625941dc4428ac0f6e5baaf6 |
def scale_quadrature(quad_func, order, lower, upper, **kwargs): <NEW_LINE> <INDENT> abscissas, weights = quad_func(order=order, **kwargs) <NEW_LINE> assert numpy.all(abscissas >= 0) and numpy.all(abscissas <= 1) <NEW_LINE> assert numpy.sum(weights) <= 1+1e-10 <NEW_LINE> assert numpy.sum(weights > 0) <NEW_LINE> weights ... | Scale quadrature rule designed for unit interval to an arbitrary interval.
Args:
quad_func (Callable):
Function that creates quadrature abscissas and weights on the unit
interval.
order (int):
The quadrature order passed to the quadrature function.
lower (float):
The new low... | 625941dc099cdd3c635f0f5c |
def test_dues20_notice(self): <NEW_LINE> <INDENT> self.config.add_route('detail', '/detail/') <NEW_LINE> self.config.add_route('make_dues20_invoice_no_pdf', '/') <NEW_LINE> m1 = C3sMember.get_by_id(1) <NEW_LINE> m1.membership_accepted = True <NEW_LINE> from c3smembership.presentation.views.dues_2020 import ( send_dues2... | test the dues20 notice view -- acknowledge incoming payments | 625941dc8c3a8732951586c0 |
def show_trailer(self): <NEW_LINE> <INDENT> webbrowser.open(self.trailer_youtube_url) | To play movie in the web browser. | 625941dce5267d203edcdf9c |
def hist(transform, dimensions, nbins): <NEW_LINE> <INDENT> maximum = np.ones(len(dimensions)) * (-np.inf) <NEW_LINE> minimum = np.ones(len(dimensions)) * np.inf <NEW_LINE> for _, chunk in transform: <NEW_LINE> <INDENT> maximum = np.max( np.vstack(( maximum, np.max(chunk[:, dimensions], axis=0))), axis=0) <NEW_LINE> mi... | Computes the N-dimensional histogram of the transformed data.
Parameters
----------
transform : pyemma.coordinates.transfrom.Transformer object
transform that provides the input data
dimensions : tuple of indices
indices of the dimensions you want to examine
nbins : tuple of ints
number of bins along each ... | 625941dc07f4c71912b11787 |
def update(self, cards): <NEW_LINE> <INDENT> if self.clicked(x_resized=len(self._cards[:-1]), x_moved=-22 * len(self._cards[:-1])): <NEW_LINE> <INDENT> if not cards: <NEW_LINE> <INDENT> return [], self <NEW_LINE> <DEDENT> if self.__previous: <NEW_LINE> <INDENT> prev_cards = self.__previous.show_cards() <NEW_LINE> if ne... | Used to handle mouse click | 625941dc3539df3088e2e64d |
def read_for_training(p, augmentation=False): <NEW_LINE> <INDENT> img = imread(TRAIN + p, mode='RGB') <NEW_LINE> msk = img <NEW_LINE> if mode == 'background': <NEW_LINE> <INDENT> data = {'image': img} <NEW_LINE> <DEDENT> elif mode == 'instance' or mode == 'code': <NEW_LINE> <INDENT> msk = imread(TRAIN_MASK + p.replace(... | Read and preprocess an image with data augmentation (random transform). | 625941dcbe383301e01b5783 |
def list(self, workspace_id, status, gtype): <NEW_LINE> <INDENT> resp = self.client.api.gates(workspace_id, status, gtype) <NEW_LINE> return [self.prepare_model(r) for r in resp] | List all gates of a workspace. | 625941dcbd1bec0571d90931 |
def _rpns_mvct(self, mbic_mvct, macc_mvct, mbnc_mvct, mncn_mvct): <NEW_LINE> <INDENT> return self.cast_from_entity_to_role(mbic_mvct + macc_mvct + mbnc_mvct + mncn_mvct, entity = 'foyer_fiscal', role = VOUS) | Moins values de court terme
'ind'
mbic_mvct (f5hu)
macc_mvct (f5iu)
mncn_mvct (f5ju)
mbnc_mvct (f5kz) | 625941dcf7d966606f6aa30a |
def __init__(self, skipgram_json_path, k=5, sample_pool_size=5000000, freq_power=1): <NEW_LINE> <INDENT> self.k = k <NEW_LINE> self.distribution_sample_size = sample_pool_size <NEW_LINE> self.freq_power = freq_power <NEW_LINE> self.vocab_word_to_idx = {} <NEW_LINE> self.vocab_set = set() <NEW_LINE> assert os.path.isfil... | Args:
skipgram_json_path : The path to a json dictionary containing
the dataset and the frequency dictionary.
{'dataset': dataset, 'freq_dict':frequency dictionary}
sample_pool_size : The number of samples selected according to the frequency
... | 625941dcc432627299f04f4a |
def get_gmap_direction(raw_address): <NEW_LINE> <INDENT> gmap_dir_prefix = "https://www.google.com/maps/dir/?api=1&destination=" <NEW_LINE> gmap_dir_dest = urllib.parse.quote_plus(raw_address) <NEW_LINE> gmap_dir_postfix = "&travelmode=driving" <NEW_LINE> gmap_dir_url = gmap_dir_prefix+gmap_dir_dest+gmap_dir_postfix <N... | https://developers.google.com/maps/documentation/urls/guide | 625941dc31939e2706e4d168 |
def total(self, unit="W", add_unit=True, asarray=False): <NEW_LINE> <INDENT> if asarray: return arrays.plain_array(self["total"], unit=unit, array_unit=self["total"].unit) <NEW_LINE> else: return arrays.array_as_list(self["total"], unit=unit, add_unit=add_unit, array_unit=self["total"].unit) | This function ...
:param unit:
:param add_unit:
:param asarray:
:return: | 625941dcc432627299f04f4b |
def cleanup(self): <NEW_LINE> <INDENT> ema_logging.debug("cleaning up") <NEW_LINE> if self.wb: <NEW_LINE> <INDENT> self.wb.Close(False) <NEW_LINE> del self.wb <NEW_LINE> <DEDENT> if self.xl: <NEW_LINE> <INDENT> self.xl.DisplayAlerts = False <NEW_LINE> self.xl.Quit() <NEW_LINE> del self.xl <NEW_LINE> <DEDENT> self.xl = ... | cleaning up prior to finishing performing experiments. This
will close the workbook and close Excel.
| 625941dcd268445f265b5171 |
def _savingStarted(self): <NEW_LINE> <INDENT> return self._runId >= 0 | Return whether data started being saved. | 625941dcbf627c535bc134d2 |
def testResubmissionWithParentsWorkflow(self): <NEW_LINE> <INDENT> acdcCouchDB = "workqueue_t_acdc" <NEW_LINE> self.testInit.setupCouch(acdcCouchDB, "GroupUser", "ACDC") <NEW_LINE> spec = self.createResubmitSpec(self.testInit.couchUrl, acdcCouchDB, parentage = True) <NEW_LINE> spec.setSpecUrl(os.path.join(self.workDir,... | Test workflow resubmission with parentage via ACDC | 625941dc10dbd63aa1bd2ea5 |
def __init__(self, count=None, data=None, offset=None, total=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._count =... | IpsForNetworkGetOutput - a model defined in OpenAPI | 625941dcc4546d3d9de72d39 |
@app_country.route("/edit/<int:id>", methods=('GET', 'POST')) <NEW_LINE> def edit_country(id): <NEW_LINE> <INDENT> country = Country.query.filter_by(id=id).first() <NEW_LINE> form = CountryForm(obj=country) <NEW_LINE> form.capital.choices += [(i.id, i.name) for i in db.session.query(City).order_by(City.name).all()] <NE... | Edit Country | 625941dc1f037a2d8b946500 |
def __init__(self, frame=-1, obj_type="unset", truncation=-1, occlusion=-1, obs_angle=-10, x1=-1, y1=-1, x2=-1, y2=-1, w=-1, h=-1, l=-1, X=-1000, Y=-1000, Z=-1000, yaw=-10, score=-1000, track_id=-1): <NEW_LINE> <INDENT> self.frame = frame <NEW_LINE> self.track_id = track_id <NEW_LINE> self.obj_type = obj_type <NEW_LINE... | Constructor, initializes the object given the parameters. | 625941dc3cc13d1c6d3c767c |
def get_indices(self, dates): <NEW_LINE> <INDENT> start_date = None <NEW_LINE> end_date = None <NEW_LINE> for date in dates: <NEW_LINE> <INDENT> if '>' in date.operator: <NEW_LINE> <INDENT> start_date = date.value <NEW_LINE> <DEDENT> if '<' in date.operator: <NEW_LINE> <INDENT> end_date = date.value <NEW_LINE> <DEDENT>... | Return the list of indices to use for given dates. | 625941dc4e696a04525c974f |
@app.route(login_path, methods=['GET']) <NEW_LINE> def loginPg(): <NEW_LINE> <INDENT> if request.referrer == '' or request.referrer is None: <NEW_LINE> <INDENT> print("\n>> Error: Landed directly!\n") <NEW_LINE> return redirect(url_for('index')) <NEW_LINE> <DEDENT> state_token = '' <NEW_LINE> for i in range(... | Login Page | 625941dc4a966d76dd551314 |
def interface_tengigabitethernet_priority_tag_enable(**kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> interface = ET.SubElement(config, "interface", xmlns="urn:brocade.com:mgmt:brocade-interface") <NEW_LINE> if kwargs.pop('delete_interface', False) is True: <NEW_LINE> <INDENT> delete_interface = ... | Auto Generated Code
| 625941dc1d351010ab855e1e |
def set_hbox_line_fit(self): <NEW_LINE> <INDENT> self.line_fit_hbox_widgetlist = [] <NEW_LINE> self.line_fit_lineditlist = [] <NEW_LINE> self.line_fit_varybox_list = [] <NEW_LINE> self.line_fit_hbox_list = [] | Initialize the line model/parameter lists.
| 625941dcbe8e80087fb20f41 |
def _perform_axfr_from_minidns(self, zone_name): <NEW_LINE> <INDENT> zone_fn = self._datafiles_path_tpl % zone_name <NEW_LINE> zone_tmp_fn = self._datafiles_tmp_path_tpl % zone_name <NEW_LINE> mdns_hostname, mdns_port = random.choice(self._masters) <NEW_LINE> with lockutils.lock("%s.lock" % zone_name): <NEW_LINE> <INDE... | Instruct axfr-get to request an AXFR from MiniDNS.
:raises: exceptions.Backend on error | 625941dc31939e2706e4d169 |
def mutate(self): <NEW_LINE> <INDENT> if model_random.is_mutating(): <NEW_LINE> <INDENT> if model_random.is_mutating(): <NEW_LINE> <INDENT> cpool = model_constraintpool.ConstraintPool.get_pool() <NEW_LINE> constraints = cpool.get(self, DIRECTION_CONSTRAINT) <NEW_LINE> self.constraint = ka_extensionpoint.create( random.... | Make small random changes in radian and offset. | 625941dcbe8e80087fb20f42 |
def getJSBodyScript(self, dataSplit, defaults = None): <NEW_LINE> <INDENT> if defaults is None: <NEW_LINE> <INDENT> defaults = self.defaults <NEW_LINE> <DEDENT> jsBody = self.getJSBody(dataSplit, defaults) <NEW_LINE> jsBodyScript = self.jsBodyScript.format(jsBody = jsBody) <NEW_LINE> return jsBodyScript | Get the <script>...</script> tag to render the JSON
>>> vfp = vexflow.toMusic21j.VexflowPickler()
>>> print(vfp.getJSBodyScript('{"hi": "hello"}'))
<script>
require(['music21'], function() {
var pickleIn = {"hi": "hello"};
var jpc = new music21.jsonPickle.Converter();
str... | 625941dc460517430c394481 |
def check_path(path): <NEW_LINE> <INDENT> if not os_path_exists(path): <NEW_LINE> <INDENT> os_makedirs(path) | Create path if not exist. | 625941dc462c4b4f79d1d9d3 |
def reset(self): <NEW_LINE> <INDENT> self.curves = {} <NEW_LINE> self.uppers = {} <NEW_LINE> self.lowers = {} <NEW_LINE> self.fills = {} <NEW_LINE> self.timeplot.clear() <NEW_LINE> self.timeplot.legend.items = [] | Deletes all plots and data. | 625941dca79ad161976cc448 |
def tangent_vector(self, lab, p, v, ring=None): <NEW_LINE> <INDENT> p = vector(p) <NEW_LINE> v = vector(v) <NEW_LINE> if p.parent().dimension() != 2 or v.parent().dimension() != 2: <NEW_LINE> <INDENT> raise ValueError("p (={!r}) and v (={!v}) should have two coordinates") <NEW_LINE> <DEDENT> if ring is None: <NEW_LINE>... | Return a tangent vector.
INPUT:
- ``lab`` -- label of a polygon
- ``p`` -- coordinates of a point in the polygon
- ``v`` -- coordinates of a vector in R^2
EXAMPLES::
sage: from flatsurf.geometry.chamanara import chamanara_surface
sage: S = chamanara_surface(1/2)
sage: S.tangent_vector(S.base_label(), ... | 625941dc44b2445a33932397 |
def _id_to_evict(self): <NEW_LINE> <INDENT> return self.__cache_fifo.popleft() | removes and returns the id of the least recently used video,
the id at the bottom of the stack, to evict it | 625941dc4a966d76dd551315 |
def getIterations(self): <NEW_LINE> <INDENT> return(int(self.iterations)) | Returns the number of iterations. | 625941dcab23a570cc250487 |
@app.route("/search", methods=["GET"]) <NEW_LINE> def search(): <NEW_LINE> <INDENT> query_q = request.args.get("q") +"%" <NEW_LINE> queryParsed = re.findall(r'\w+', query_q) <NEW_LINE> if len(queryParsed) == 1: <NEW_LINE> <INDENT> select = "SELECT * FROM places WHERE postal_code LIKE :q OR place_name LIKE :q OR admin_n... | Search for places that match query. | 625941dcd58c6744b4257f61 |
def writeNetShape(netDataPath, shape, nTrue, nModels): <NEW_LINE> <INDENT> netInfoFname = os.path.join(netDataPath, "nnetInfo.txt") <NEW_LINE> if not os.path.exists(netDataPath): <NEW_LINE> <INDENT> os.makedirs(netDataPath ) <NEW_LINE> <DEDENT> with open(netInfoFname, "w" ) as f: <NEW_LINE> <INDENT> f.write("inputShape... | netDataPath= self._getExtraPath("nnetData") | 625941dccc40096d61595c52 |
def launch_bomb(self, fact, state): <NEW_LINE> <INDENT> self.bomb_count += 1 <NEW_LINE> self.command += super(IA, self).bomb(self.find_nearest(fact, 1), fact.factory_id) <NEW_LINE> launch_base = self.factory_dict[self.find_nearest(fact, 1)] <NEW_LINE> if launch_base is not None: <NEW_LINE> <INDENT> launch_base.next_mov... | Launch bomb on fact and set a next move to attack behind if PVP state | 625941dcd53ae8145f87a56e |
def read_pickle_from_file(filename): <NEW_LINE> <INDENT> with tf.io.gfile.GFile(filename, 'rb') as f: <NEW_LINE> <INDENT> if sys.version_info >= (3, 0): <NEW_LINE> <INDENT> data_dict = pickle.load(f, encoding='bytes') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> data_dict = pickle.load(f) <NEW_LINE> <DEDENT> <DEDENT> ... | function reads pickle file | 625941dc796e427e537b08cb |
def __cmp__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, GeoPt): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> other = GeoPt(other) <NEW_LINE> <DEDENT> except datastore_errors.BadValueError: <NEW_LINE> <INDENT> return NotImplemented <NEW_LINE> <DEDENT> <DEDENT> lat_cmp = cmp_compat.cmp(self.lat, other.lat)... | Returns negative, zero, or positive when comparing two `GeoPts`. | 625941dcbd1bec0571d90932 |
def save_file_as(self, file=False): <NEW_LINE> <INDENT> f = file or self.get_file() <NEW_LINE> name_input = self.ui.query_file("Save as:", f.name) <NEW_LINE> if not name_input: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> target_dir, name = helpers.parse_path(name_input) <NEW_LINE> full_path = os.path.join(targ... | Save current file. | 625941dca8ecb033257d33cf |
def step2(self, action): <NEW_LINE> <INDENT> for uid in self.button_uid: <NEW_LINE> <INDENT> p.setJointMotorControl2(uid, BUTTON_GLIDER_IDX, controlMode=p.POSITION_CONTROL, targetPosition=0.1) <NEW_LINE> <DEDENT> for i in range(self._action_repeat): <NEW_LINE> <INDENT> self._kuka.applyAction(action) <NEW_LINE> p.stepSi... | :param action:([float]) | 625941dc460517430c394482 |
def test_association_domain_from_str(self): <NEW_LINE> <INDENT> result = self.df.get_association_domain_from_str('X--Y', 'A') <NEW_LINE> self.assertEqual(result, 'AssocY') <NEW_LINE> result = self.df.get_association_domain_from_str('X_[xxx]--Y_[yyy]', 'A') <NEW_LINE> self.assertEqual(result, 'xxx') | Tests whether correct association domain name is returned given a string. | 625941dc91af0d3eaac9bd1f |
def pre_hook(): <NEW_LINE> <INDENT> pass | A plugin hook called in the first initialization step.
This is called before the database is initialized. | 625941dc3d592f4c4ed1d36a |
def finalize(self): <NEW_LINE> <INDENT> self._logger.debug("") <NEW_LINE> self._logger.debug("%s: Finalize" % self._name) <NEW_LINE> self._logger.debug("") <NEW_LINE> for device in DeviceManager().get_all_devices(): <NEW_LINE> <INDENT> if device.uecommands: <NEW_LINE> <INDENT> device.inject_device_log("i", "ACS_TESTCAS... | Clear all remaining objects created by the test | 625941dc4f6381625f114d3f |
def __contains__(self, token): <NEW_LINE> <INDENT> return token in self._token_to_idx | Checks whether a text token exists in the vocabulary.
Parameters
----------
token : str
A text token.
Returns
-------
bool
Whether the text token exists in the vocabulary (including `unknown_token`). | 625941dca8370b7717052ba2 |
def move_action(self,configuration,stack_idx,conditional): <NEW_LINE> <INDENT> S,B,n,stack_state,lab_state,history_state = configuration <NEW_LINE> newS = S[:] <NEW_LINE> moved_elt = newS[-stack_idx-1] <NEW_LINE> newS[-stack_idx-1] = moved_elt.schedule_movement(True) <NEW_LINE> new_n = n-1 if moved_elt.predicted else ... | This actually schedules a symbol down in the stack for movement
Args:
configuration (tuple) : a configuration
stack_idx (int) : the index in the stack of the element to move (top has index 0)
Returns:
Tuple. A configuration resulting from moving the constituent | 625941dc96565a6dacc8f9ce |
def test_creation_index_page(self): <NEW_LINE> <INDENT> create_problem_level_index(self.options, self.table_names, self.group_name, self.group_dir, self.table_descriptions) <NEW_LINE> expected_file = os.path.join(self.group_dir, '{}_index.html'.format(self.group_name)) <NEW_LINE> self.assertTrue(os.path.isfile(expected... | Tests to see that the index page are correctly created | 625941dc507cdc57c6306fe4 |
def enter_request_context(self, request): <NEW_LINE> <INDENT> context = {} <NEW_LINE> context.update(contexts.course_context_from_url(request.build_absolute_uri())) <NEW_LINE> try: <NEW_LINE> <INDENT> context['user_id'] = request.user.pk <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> context['user_id'] ... | Extract information from the request and add it to the tracking
context. | 625941dc1d351010ab855e1f |
def __init__(self, pre_sec, target_cell, spike_source=None, loc=0.5): <NEW_LINE> <INDENT> Terminal.__init__(self, pre_sec) <NEW_LINE> if spike_source is None: <NEW_LINE> <INDENT> spike_source = pre_sec(loc)._ref_v <NEW_LINE> <DEDENT> self.spike_source = spike_source <NEW_LINE> self.pre_sec = pre_sec | Parameters
----------
pre_sec : :obj: `NEURON Section`
The presynaptic section that is monitored for spikes. The voltage
in this section is monitored to trigger the postsynaptic conductance
as the spike source
spike_source : :obj: `NEURON Section`
Overrides the pre_sec as the spike source for this termi... | 625941dc92d797404e30448f |
def trunc(num): <NEW_LINE> <INDENT> num = str(num) <NEW_LINE> list_nums = [] <NEW_LINE> for i in range(len(num)): <NEW_LINE> <INDENT> list_nums.append(num[:len(num)-i]) <NEW_LINE> list_nums.append(num[i:len(num)]) <NEW_LINE> <DEDENT> for i in range(len(list_nums)): <NEW_LINE> <INDENT> list_nums[i] = int(list_nums[i]) <... | Input: integer
Output: boolean
Takes in an integer and left and right truncates it eg right 3797,379,37,3,
and tests to see if all the numbers are prime. | 625941dc656771135c3ebb75 |
def svo_distance(user_id, hashtag, a=0.45, b=0.45, c=0.1): <NEW_LINE> <INDENT> count_pos, count_neg, count_neut = _USER_TOPIC_DICT[user_id][hashtag][3:6] <NEW_LINE> sentiment = count_pos - count_neg / (count_pos + count_neg) <NEW_LINE> sentiment = 1 / (1 + 10**-sentiment) <NEW_LINE> hashtag_count = count_pos + count_ne... | retuns the sentiment volume objectivity metric
| 625941dc8a349b6b435e8477 |
def accountexecutive_edit(request, username): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if not (user.is_authenticated() and (username == request.user.username or is_event_manager(user) or is_resource_person(user))): <NEW_LINE> <INDENT> raise PermissionDenied() <NEW_LINE> <DEDENT> user = User.objects.get(userna... | view accountexecutive details | 625941dcb7558d58953c5213 |
def test_retrieve_addons_vcs_2(self): <NEW_LINE> <INDENT> self.make_recipe(version='10.0', addons=os.linesep.join(( 'fakevcs http://trunk.example addons-trunk rev', 'fakevcs http://other.example addons-other 76'))) <NEW_LINE> addons_dir = os.path.join(self.buildout_dir, 'addons-trunk') <NEW_LINE> other_dir = os.path.jo... | Two VCS lines in addons. | 625941dc63d6d428bbe447f3 |
def Compiled(self): <NEW_LINE> <INDENT> return self.__args is not None | Checks if the form has already been compiled
@return: Boolean | 625941dc9f2886367277ab8f |
def for_three(): <NEW_LINE> <INDENT> row=7 <NEW_LINE> col=5 <NEW_LINE> for i in range(row): <NEW_LINE> <INDENT> for j in range(col): <NEW_LINE> <INDENT> if ((i==0 or i==3 or i==6) and j%4!=0) or (i==1 or i==5) and j%4==0 or (i==2 or i==4) and j>3 : <NEW_LINE> <INDENT> print("*",end=" ") <NEW_LINE> <DEDENT> else: <NEW_... | We are creating user defined function for numerical pattern of three with "*" symbol | 625941dcb830903b967e9c0c |
@click.command() <NEW_LINE> @click.option( '--message', '-m', default='LGTM', show_default=True, help='画像に乗せる文字列' ) <NEW_LINE> @click.argument('keyword', default='ghibli') <NEW_LINE> def cli(keyword, message): <NEW_LINE> <INDENT> lgtm(keyword, message) | LGTM生成ツール | 625941dcd53ae8145f87a56f |
def register_blueprints(app): <NEW_LINE> <INDENT> for blueprint in app.config.get('BLUEPRINTS', []): <NEW_LINE> <INDENT> app.register_blueprint(blueprint) | Configure blueprints. | 625941dc7c178a314d6ef768 |
def get_word_path(folder_path): <NEW_LINE> <INDENT> all_word_path = [] <NEW_LINE> file_list = os.listdir(folder_path) <NEW_LINE> for file in file_list: <NEW_LINE> <INDENT> if file.find('.docx') + 1: <NEW_LINE> <INDENT> all_word_path.append(floder_path + '/' + file) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pass <NE... | 定义一个获取指定文件夹路径下的word文档绝对路径的函数 | 625941dc94891a1f4081bdae |
def _get_filepath(self, file_name): <NEW_LINE> <INDENT> current_dir = os.path.dirname(os.path.abspath(__file__)) <NEW_LINE> file_path = os.path.join(current_dir, "utils" + os.sep + file_name) <NEW_LINE> return file_path | Assemble and return path for specied file in project library
file_name: name of file in project library/utils
return: relative path to specified file. | 625941dc2c8b7c6e89b35ac3 |
def add_gates(ngates): <NEW_LINE> <INDENT> if ngates == 0: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('Automated in/exclude gates is not implemented!') <NEW_LINE> <DEDENT> return '' | TODO: figure out how to include gates progammatically. | 625941dc2eb69b55b151cbb6 |
def isRunning(self): <NEW_LINE> <INDENT> return self.__status == self.running | boolean running status | 625941dc377c676e912724ab |
def get_qn_url(filename): <NEW_LINE> <INDENT> return urljoin(config.QN_BASE_URL, filename) | 获取文件 URL | 625941dc7d43ff24873a2fa6 |
@register.inclusion_tag('map_list.html') <NEW_LINE> def mapnavlist(user): <NEW_LINE> <INDENT> maplist = [] <NEW_LINE> for map in Map.objects.all(): <NEW_LINE> <INDENT> if map.get_permission(user) > 0: <NEW_LINE> <INDENT> maplist.append(map) <NEW_LINE> <DEDENT> <DEDENT> return {'maps': maplist} | Return list of maps that should appear in the user's nav bar. | 625941dc5f7d997b87174d9e |
@csrf_protect <NEW_LINE> @rendered_with('mammals/grid_block.html') <NEW_LINE> def grid_block(request): <NEW_LINE> <INDENT> default_lat = 41.400 <NEW_LINE> default_lon = -74.0305 <NEW_LINE> default_size = 250.0 <NEW_LINE> if (request.method != 'POST'): <NEW_LINE> <INDENT> return index(request) <NEW_LINE> <DEDENT> select... | "NOT SANDBOX. | 625941dcd486a94d0b98e44b |
def show(self): <NEW_LINE> <INDENT> Gtk.Window.set_auto_startup_notification(False) <NEW_LINE> self.window.show_all() <NEW_LINE> Gtk.Window.set_auto_startup_notification(True) <NEW_LINE> while Gtk.events_pending(): <NEW_LINE> <INDENT> Gtk.main_iteration() | Shows the splash screen | 625941dc56ac1b37e62644cf |
def test_memoryCheckerSucceeds(self): <NEW_LINE> <INDENT> def _gotAvatar(username): <NEW_LINE> <INDENT> self.assertEqual(username, self.admin.username) <NEW_LINE> <DEDENT> return (self.checker .requestAvatarId(self.admin) .addCallback(_gotAvatar)) | Test that the checker works with valid credentials. | 625941dc55399d3f055889b9 |
def getGuarantorSurname(self): <NEW_LINE> <INDENT> return self.getSurname() if self.getPatientAsGuarantor() else self.getField('GuarantorSurname').get(self) | If the patient is the guarantor, all the fields related with the guarantor are going to have the same value as
the current patient fields. | 625941dc596a897236089dc1 |
def ProivinceName_to_Id(cursor,provincename): <NEW_LINE> <INDENT> sql = "select Province_id from province where Province_name=%s" <NEW_LINE> cursor.execute(sql,provincename) <NEW_LINE> result = cursor.fetchall() <NEW_LINE> return result[0][0] | :param cursor:
:param provincename 省份名字:
:return 省份的id: | 625941dcac7a0e7691ed43cb |
def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> start = time.monotonic() <NEW_LINE> try: <NEW_LINE> <INDENT> return func(*args, **kwargs) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> duration = time.monotonic() - start <NEW_LINE> __MEASURE_DURATION[func] = (__MEASURE_DURATION.get(func, 0) + duration) <NEW_LINE> L... | Wrapper function | 625941dc5510c4643540f6e1 |
def __init__(self, text='', func=None, parent=None): <NEW_LINE> <INDENT> super(QLineEdit, self).__init__(parent) <NEW_LINE> self.setText(str(text)) <NEW_LINE> self.setAlignment(QtCore.Qt.AlignCenter) <NEW_LINE> if func is not None: <NEW_LINE> <INDENT> self.returnPressed.connect(func) | Initializes QLineEdit.
Parameters
----------
text : str, optional
The initial text, by default this is an empty string.
func : function, optional
The function that is called when return is pressed.
By default no function is called.
parent : QWidget, optional
The parent widget of the lineedit.
This ... | 625941dc99fddb7c1c9de694 |
def test_field_save_and_load_with_reserved_names(self): <NEW_LINE> <INDENT> start = datetime.datetime.now() <NEW_LINE> end = datetime.datetime.now() + datetime.timedelta(days=1) <NEW_LINE> date_range = DateRange(start=start, end=end) <NEW_LINE> model = NamedDateRange(name='foobar', date_range=date_range) <NEW_LINE> mod... | Test save/load of a composite type with reserved field names | 625941dcadb09d7d5db6ca92 |
def normalize(vector): <NEW_LINE> <INDENT> new = [] <NEW_LINE> max_vector = vector[0] <NEW_LINE> for i in vector: <NEW_LINE> <INDENT> if abs(i) > max_vector: <NEW_LINE> <INDENT> max_vector = abs(i) <NEW_LINE> <DEDENT> <DEDENT> for j in range(len(vector)): <NEW_LINE> <INDENT> total = 0 <NEW_LINE> total += vector[j] * (1... | This function takes a vector as its argument and finds its infinity norm. It is then divided into one and multiplied by the origninal vector. | 625941dca219f33f34628c6a |
def to_x(val): <NEW_LINE> <INDENT> if val == 0: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> elif val == 1: <NEW_LINE> <INDENT> return "x" <NEW_LINE> <DEDENT> elif val == -1: <NEW_LINE> <INDENT> return "-x" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "%ix"%val | assumes integer value returned to x | 625941dc4c3428357757c62b |
def is_valid_cnpj(cnpj_code: str, data_only: bool=True) -> bool: <NEW_LINE> <INDENT> content_length = 47 <NEW_LINE> referer = 'validador_cnpj' <NEW_LINE> payload = { 'acao': 'validar_cnpj', 'txt_cnpj': cnpj_code } <NEW_LINE> r = _data_verification_and_normalize( fordev_request(content_length, referer, payload) ) <NEW_L... | Verifique se o código do CNPJ é válido.
Parameters
----------
cnpj_code
O código CNPJ para verificação. | 625941dc293b9510aa2c3597 |
def get_ber_count(self): <NEW_LINE> <INDENT> return self.__ber_count | Returns the BER count. | 625941dc73bcbd0ca4b2c37a |
def set_calibrator(): <NEW_LINE> <INDENT> processor.set_default_calibrator( "/YSS/SIMULATOR/BatteryVoltage2", "polynomial", [1, 0.1] ) | Set the calibrator to a constant polynomial. | 625941dc3eb6a72ae02ec7e8 |
def _create_list_item(self, doc): <NEW_LINE> <INDENT> data = {} <NEW_LINE> for field in self.response_fields: <NEW_LINE> <INDENT> accessor = self.get_field_accessor(field) <NEW_LINE> if isinstance(accessor, str): <NEW_LINE> <INDENT> value = getattr(doc, accessor, None) <NEW_LINE> if callable(value): <NEW_LINE> <INDENT>... | Gather requested data from a ContentListingObject in a dict | 625941dcaad79263cf390d49 |
def __init__(self, base_url, username, password, log_level="INFO"): <NEW_LINE> <INDENT> self.logger = self.__get_stdout_logger(__name__, log_level) <NEW_LINE> self.logger.info("URL: {0}".format(base_url)) <NEW_LINE> self.__base_url = base_url <NEW_LINE> self.__session_id = self.authenticate(username, password)['session... | :param base_url: Azkaban API base URL, such as https://hostname:port/
:type base_url: str
:param username: Azkaban login username
:type username: str
:param password: Azkaban login password
:type password: str
:param log_level: Log level to output stdout
:type log_level: str | 625941dc63b5f9789fde73ea |
def update_paths(base, scripts_dir, clear_args, extra_args): <NEW_LINE> <INDENT> new_path = os.path.abspath(base) <NEW_LINE> bin_dir = os.path.join(base, 'bin') <NEW_LINE> lib_name = None <NEW_LINE> if scripts_dir == 'auto': <NEW_LINE> <INDENT> if windows: <NEW_LINE> <INDENT> scripts_dir = os.path.join(base, 'Scripts')... | Updates all paths in a virtualenv to a new one. | 625941dc3cc13d1c6d3c767d |
def _generate_ssh_keys(self, data_dir): <NEW_LINE> <INDENT> filename = os.path.join(data_dir, self.config['private_key']) <NEW_LINE> if os.path.exists(filename): <NEW_LINE> <INDENT> c_util.del_file(filename) <NEW_LINE> <DEDENT> c_util.subp(['ssh-keygen', '-m', 'PEM', '-t', 'rsa', '-b', '4096', '-f', filename, '-P', '',... | Generate SSH keys to be used with image. | 625941dcdc8b845886cb583a |
def is_497(self): <NEW_LINE> <INDENT> return self.num == 497 | Verify whether num property is 497 | 625941dc097d151d1a22315c |
def tanh_derivative(Z): <NEW_LINE> <INDENT> return (1 - Z ** 2) | Apply the derivative of the hyperbolic tangent (tanh) function.
Parameters
----------
Z : array, shape = [n_instances, n_features]
The data that was output from the hyperbolic tangent activation
function during the forward pass.
Returns
-------
Z_new : array, shape = [n_instances, n_features]
The transfor... | 625941dc498bea3a759b9db3 |
def __init__(self, configuration, currentTime, queue, runningTasks, completedTasks): <NEW_LINE> <INDENT> self.configuration = configuration <NEW_LINE> self.currentTime = currentTime <NEW_LINE> self.queue = queue <NEW_LINE> self.runningTasks = runningTasks <NEW_LINE> self.completedTasks = completedTasks | @configuration: The static configuration of the system.
@currentTime: The current time, in ticks (time is defined in arbitrary
units).
@queue: The current queue of queries, including queries that currently
have tasks running but have not yet finished.
@runningTasks: A list of RunningTasks, the tasks that are curren... | 625941dc15fb5d323cde0e18 |
def get_nutritional_values(self): <NEW_LINE> <INDENT> nutritional_representation = cache.get(cache_mapper.get_nutrition_cache_by_key(self.pk)) <NEW_LINE> if not nutritional_representation: <NEW_LINE> <INDENT> use_metric = self.user.userprofile.use_metric <NEW_LINE> unit = 'kg' if use_metric else 'lb' <NEW_LINE> result ... | Sums the nutritional info of all items in the plan | 625941dc8c0ade5d55d3ecc1 |
def get_commit_hash_range(d_repo, range): <NEW_LINE> <INDENT> repo = git.Repo(d_repo) <NEW_LINE> return repo.git.log('--pretty=format:%H', '--no-merges', range).splitlines() | Gets all commithashes within a certain range
Usage: get_commithash_range(dir, 'v2.0..v2.1')
get_commithash_range(dir, 'v3.0') | 625941dc3eb6a72ae02ec7e9 |
def create_match_maps(self): <NEW_LINE> <INDENT> kb_ents = self.kb_ents_to_type.keys() <NEW_LINE> kb_ents_to_cand_idxs = {} <NEW_LINE> for ent in kb_ents: <NEW_LINE> <INDENT> kb_ents_to_cand_idxs[ent] = [] <NEW_LINE> for c_idx, cand in enumerate(self.candidate_answers_w): <NEW_LINE> <INDENT> if ent in cand: <NEW_LINE> ... | Create dictionary mapping from each entity in the knowledge base to the set of
indicies in the candidate_answers array that contain that entity. Will be used for
quickly adding the match type features to the candidate answers during fprop. | 625941dc4428ac0f6e5baaf8 |
def seed_authors(self): <NEW_LINE> <INDENT> for i in range(1000): <NEW_LINE> <INDENT> publication = Publication.objects.get(pk = i + 1) <NEW_LINE> num_authors = randint(1, 8) <NEW_LINE> for j in range(num_authors): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> person_id = randint(1, 500) <NEW_LINE> if not (Author... | For each publication a number of authors is randomly chosen.
Each of them follows the model an author has:
* publication - Publication selected
* person - Random person is selected | 625941dcdc8b845886cb583b |
def update_ipv4(self, address): <NEW_LINE> <INDENT> raise NotImplementedError("%s does not support IPv4" % self.__class__.__name__) | Update the IPv4 address of a dynamic DNS domain.
:param address: the new IPv4 address
:type address: :class:`ipaddress.IPv4Address` | 625941dc099cdd3c635f0f5e |
def init_filter(self): <NEW_LINE> <INDENT> print(self.para.sigma_initial_pos ** 2) <NEW_LINE> self.P[0:3, 0:3] = np.diagflat(np.transpose(self.para.sigma_initial_pos ** 2.0)) <NEW_LINE> self.P[3:6, 3:6] = np.diagflat(np.transpose(self.para.sigma_initial_vel ** 2.0)) <NEW_LINE> self.P[6:9, 6:9] = np.diagflat(np.transpos... | initial filiter parameter.
:return: | 625941dc2ae34c7f2600d435 |
def convert_model_from_external_data(model): <NEW_LINE> <INDENT> for tensor in _get_all_tensors(model): <NEW_LINE> <INDENT> if uses_external_data(tensor): <NEW_LINE> <INDENT> if not tensor.HasField("raw_data"): <NEW_LINE> <INDENT> raise ValueError("raw_data field doesn't exist.") <NEW_LINE> <DEDENT> del tensor.external... | call to set all tensors data as embedded data. save_model saves all the tensors data as embedded data after calling this function.
@params
model: ModelProto to be converted. | 625941dccad5886f8bd272dd |
def updateMeta(self, meta): <NEW_LINE> <INDENT> self.meta = meta <NEW_LINE> self.notifyMetaChange() <NEW_LINE> return defer.succeed(None) | Updates the local instance's meta | 625941dc55399d3f055889ba |
def _write(self, record): <NEW_LINE> <INDENT> content = json.dumps(record) <NEW_LINE> self._file.write(content) | Writes a formatted record to the file
:param record: dict | 625941dce8904600ed9f2235 |
def set_seg_minincise(self, minincise=0.2, max_str_z=None): <NEW_LINE> <INDENT> sel = self.segment_data['diff_up'] < minincise <NEW_LINE> self.segment_data.loc[sel, 'elevup'] = (self.segment_data.loc[ sel, 'top_up'] - minincise) <NEW_LINE> sel = self.segment_data['diff_dn'] < minincise <NEW_LINE> self.segment_data.loc[... | Set segment elevation to have the minimum incision from the top.
:param minincise: Desired minimum incision
:param max_str_z: Optional parameter to prevent streams at
high elevations (forces incision to max_str_z)
:return: incisions at the upstream and downstream end of each segment | 625941dc4527f215b584c758 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.