code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def test_create_connection(self): <NEW_LINE> <INDENT> api = 'the api instance' <NEW_LINE> class example(self.cls): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> for klass in (self.cls, example): <NEW_LINE> <INDENT> o = klass(api, shared_instance=True) <NEW_LINE> e = raises(NotImplementedError, o.create_connection) <NEW_...
Test the `ipalib.backend.Connectible.create_connection` method.
625941db91af0d3eaac9bcec
def get_branching_fraction(self, daughters): <NEW_LINE> <INDENT> _t = HepTranslator() <NEW_LINE> daughters = map(_t.translate_pdg_to_evtgen, daughters) <NEW_LINE> branching_fraction, branching_fraction_error_plus, branching_fraction_error_minus = sanedecayrescaling.check_sanity.find_decay_in_reference(self.ref_file, da...
get the branching fraction for a specific decay if available returns: - branching_fraction: float - branching_fraction_error_plus: float - branching_fraction_error_minus: float
625941dbe8904600ed9f2201
def __init__(self, name=None): <NEW_LINE> <INDENT> self.bronhoudercode = None <NEW_LINE> self.name = name <NEW_LINE> self.shortName = None <NEW_LINE> self.telNrProblemIT = None <NEW_LINE> self.telNrDamage = None <NEW_LINE> self.contactPerson = None <NEW_LINE> self.themes = []
Company which represents the netowner. The netowner provide all information, including contactpersons rasters with positions of pipeline, pdf's with accompanying letters additional drawings etcetera...
625941db0fa83653e465728a
def __init__ (self, packed=None, **kwargs): <NEW_LINE> <INDENT> self._sizeof_hdr = 8 <NEW_LINE> if packed is not None: <NEW_LINE> <INDENT> self.from_string (packed) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.flags = 0x87 <NEW_LINE> self.tag = 0xFF <NEW_LINE> self.dst_cpu = 0 <NEW_LINE> self.dst_port...
Constructs a new :py:class:`SDPMessage` object with either default values or those provided. :param packed: encoded packet data :type packed: string or None :param kwargs: keyword arguments providing initial values .. note:: If neither ``packed`` nor ``kwargs`` are provided than internal default values will...
625941db57b8e32f5248376d
def summaryRanges(self, nums): <NEW_LINE> <INDENT> ans = [] <NEW_LINE> p1, p2, n = 0, 1, len(nums) <NEW_LINE> while p1 < n: <NEW_LINE> <INDENT> while p2 < n and nums[p2] == nums[p2 - 1] + 1: <NEW_LINE> <INDENT> p2 += 1 <NEW_LINE> <DEDENT> if p2 == p1 + 1: <NEW_LINE> <INDENT> ans.append(str(nums[p1])) <NEW_LINE> <DEDENT...
:type nums: List[int] :rtype: List[str]
625941db6e29344779a628e1
def publish_poops_to_cost_map(self, poops): <NEW_LINE> <INDENT> NUM_POOPS = 30 <NEW_LINE> poops_with_z = [(p[0], p[1], 0) for p in poops] <NEW_LINE> unused_poops = [(25, 25, 25)] * (NUM_POOPS - len(poops)) <NEW_LINE> poop_positions = poops_with_z + unused_poops <NEW_LINE> point_cloud = PointCloud() <NEW_LINE> point_clo...
Always publishes 30 poops. Keeps unused ones at map position 25, 25.
625941dbd18da76e235327a9
def search(self, word): <NEW_LINE> <INDENT> word = word.strip() <NEW_LINE> if word: <NEW_LINE> <INDENT> cur = self.root <NEW_LINE> for w in word: <NEW_LINE> <INDENT> if w not in cur.next: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> cur = cur.next[w] <NEW_LINE> <DEDENT> return False if cur.end == 0 else True
Returns if the word is in the trie.
625941dba4f1c619b28b0304
def conjugation_tab_8(basein,tense,theclass,pada,dbg=False): <NEW_LINE> <INDENT> err0="conjugation_tab_8(%s,%s,%s,%s)"%(basein,tense,theclass,pada) <NEW_LINE> if dbg: <NEW_LINE> <INDENT> print(err0) <NEW_LINE> <DEDENT> endings = conj_endings(tense,theclass,pada,dbg=dbg) <NEW_LINE> strengths = conj_endings(tense,theclas...
from gram2.el.
625941db66673b3332b92362
def delete(name, wait=False, region=None, key=None, keyid=None, profile=None): <NEW_LINE> <INDENT> conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) <NEW_LINE> try: <NEW_LINE> <INDENT> conn.delete_cache_cluster(name) <NEW_LINE> if not wait: <NEW_LINE> <INDENT> log.info('Deleted cache cluster {0}.'....
Delete a cache cluster. CLI example:: salt myminion boto_elasticache.delete myelasticache
625941dbd18da76e235327aa
def unique_sc(score, fastas): <NEW_LINE> <INDENT> tags = get_tags(fastas) <NEW_LINE> with open(score, 'r') as f: <NEW_LINE> <INDENT> top = f.readline() <NEW_LINE> sys.stdout.write(top) <NEW_LINE> header = top.split() <NEW_LINE> d_index = header.index('description') <NEW_LINE> for line in f: <NEW_LINE> <INDENT> if (not ...
use tags to populate a unique score file from the composite score file
625941db498bea3a759b9d80
def _composition_(self, right, homset): <NEW_LINE> <INDENT> raise NotImplementedError
Composition operator function inherited from morphism class. EXAMPLES:: sage: E = EllipticCurve(j=GF(7)(0)) sage: phi = EllipticCurveIsogeny(E, [E(0), E((0,1)), E((0,-1))]) sage: phi._composition_(phi, phi.parent()) Traceback (most recent call last): ... NotImplementedError The following shou...
625941dba934411ee3751965
def get_attachment_type(self, path): <NEW_LINE> <INDENT> return self.config['ATTACHMENT_TYPES'].get( posixpath.splitext(path)[1].lower())
Gets the attachment type for a path.
625941dbab23a570cc250455
def adaboost(): <NEW_LINE> <INDENT> data = datasets.load_digits() <NEW_LINE> y = data.target <NEW_LINE> digit_one, digit_two = 1, 8 <NEW_LINE> idx = np.append( np.where(y == digit_one)[0], np.where(y == digit_two)[0]) <NEW_LINE> y = data.target[idx] <NEW_LINE> y[y == digit_one] = -1 <NEW_LINE> y[y == digit_two] = 1 <NE...
Classifies dataset samples using Adaboost
625941db85dfad0860c3b12d
def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME, obj=None): <NEW_LINE> <INDENT> def decorator(view_func): <NEW_LINE> <INDENT> @wraps(view_func, assigned=available_attrs(view_func)) <NEW_LINE> def _wrapped_view(request, *args, **kwargs): <NEW_LINE> <INDENT> if test_func(request.us...
Decorator for views that checks that the user passes the given test, redirecting to the log-in page if necessary. The test should be a callable that takes the user object and returns True if the user passes.
625941db5510c4643540f6af
def __setstate__(self, d: Dict[str, Any]) -> None: <NEW_LINE> <INDENT> self.__init__() <NEW_LINE> self.from_dict(d)
Initializes the object with the provided dictionary of arguments for unpickling. :param d: A dictionary of arguments.
625941db8a349b6b435e8444
def get_box_coords(self): <NEW_LINE> <INDENT> last = len(self.data['ci_ids']) - 2 <NEW_LINE> start = [] <NEW_LINE> end = [] <NEW_LINE> for i, current in enumerate(self.data['ci_ids']): <NEW_LINE> <INDENT> if i < last: <NEW_LINE> <INDENT> next = self.data['ci_ids'][i+1] <NEW_LINE> if (next - current) > 1: <NEW_LINE> <IN...
Get coords used in box annotation
625941db6fece00bbac2da12
def __repr__(self): <NEW_LINE> <INDENT> return "<Bet '%d', '%s'>" % (self.amount, self.outcome)
The type representation of an :class:'Bet' object. Create a Bet object and get its representation. >>> Bet(50, Outcome('Split 1-2', 17)) <Bet '50', 'Split 1-2 (17:1)'> :return string: Type representation of the :class:'Bet'.
625941db8e71fb1e9831da79
@app.route('/encrypt', methods=['POST']) <NEW_LINE> def encrypt(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> text = request.form['text'] <NEW_LINE> key = request.form['key'] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return jsonify({'error': 'no data'}) <NEW_LINE> <DEDENT> if 0 < len(text) < 200 and 0 < len(key...
only for api call
625941db187af65679ca53f0
def display_antonym(word): <NEW_LINE> <INDENT> antonym = {} <NEW_LINE> antonym = list(get_antonyms(word)) <NEW_LINE> if antonym: <NEW_LINE> <INDENT> window['output'].print( "Antonym of",word.capitalize()+ ": "+str(antonym[0]) + "\n") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> display_error("No Antonyms are available...
Displays the antonym of the word :param word: string, input word
625941db97e22403b379d26c
def _set_long(self,value): <NEW_LINE> <INDENT> if value and len(value) < 2: <NEW_LINE> <INDENT> raise ValueError("Long names must be more than one character length: '{}'".format(value)) <NEW_LINE> <DEDENT> self._set_name(value,'long')
set long name
625941dbd6c5a1020814431e
def commit(self, author, email, committer, msg): <NEW_LINE> <INDENT> msg = '-m {0}'.format(msg) <NEW_LINE> _git('commit', [msg], username=author, email=email)
Commits all of the changes detailed by the CommitInfo object
625941db07d97122c4178b62
def _get_gauss_params(self): <NEW_LINE> <INDENT> means = np.zeros((3, self.patchSize*self.patchSize)) <NEW_LINE> covs = np.zeros((3, self.patchSize*self.patchSize, self.patchSize*self.patchSize)) <NEW_LINE> path_mean = self.path_folder+'{}_means{}_indep'.format(self.netname, self.patchSize) <NEW_LINE> path_cov = self.p...
Returns the mean and covariance for the gaussian model on the whole patch (i.e., window to sample plus padding around it)
625941db167d2b6e31218e66
def testGridRead(self): <NEW_LINE> <INDENT> self.setupConfig() <NEW_LINE> rodir = self.createTestRo(testbase, "testro", "RO for Minim creation test", "ro-testMkMinim") <NEW_LINE> rouri = ro_manifest.getRoUri(rodir) <NEW_LINE> gridname = "TestMkMinim.csv" <NEW_LINE> griduri = ro_manifest.getComponentUri(rodir...
Basic test that Minim test file can be read
625941db6fb2d068a760f372
def decr(self, n=1): <NEW_LINE> <INDENT> return _structural.SwigPyIterator_decr(self, n)
decr(SwigPyIterator self, size_t n=1) -> SwigPyIterator decr(SwigPyIterator self) -> SwigPyIterator
625941db2c8b7c6e89b35a91
def agg_assume(self): <NEW_LINE> <INDENT> self.all().update(detract=0)
update objects field detract for futhure possibility aggregation
625941dbb7558d58953c51e1
def all_fixtures(self, filters=None): <NEW_LINE> <INDENT> url = "{0}/fixtures".format(self.base_url) <NEW_LINE> return self._request(url=url, filters=filters)
Return a list of fixtures across a set of competitions. Filters: - timeFrame - league
625941dbbe7bc26dc91cd8cc
def test_diagnosis_get_all_by_pagination(self): <NEW_LINE> <INDENT> res = self.client().post('/api/v1/users/', headers={'Content-Type': 'application/json'}, data=json.dumps(self.userPayload)) <NEW_LINE> self.assertEqual(res.status_code, 201) <NEW_LINE> api_token = json.loads(res.data).get('jwt_token') <NEW_LINE> res = ...
Test Diagnosis Get All by pagination
625941dbbd1bec0571d90900
def get_topic_type(topic): <NEW_LINE> <INDENT> topic_type, real_topic, rest = _get_topic_type(topic) <NEW_LINE> if topic_type: <NEW_LINE> <INDENT> return topic_type, real_topic, rest <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None, None, None
Get the topic type (nearly identical to rostopic.get_topic_type, except it doesn't return a fn) :returns: topic type, real topic name, and rest of name referenced if the  topic points to a field within a topic, e.g. /rosout/msg, ``str, str, str``
625941db1d351010ab855ded
@pytest.fixture <NEW_LINE> def bk_category_initialized(bk_category): <NEW_LINE> <INDENT> bk_category.initialize_grid_elements() <NEW_LINE> return bk_category
Returns bk_category object (the same as from bk_category fixture), but with grid elements initialized.
625941db1b99ca400220ad84
def compute(): <NEW_LINE> <INDENT> n = 20 <NEW_LINE> return int(factorial(2*n) / (factorial(n) * factorial(2*n - n)))
Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. How many such routes are there through a 20×20 grid?
625941db4a966d76dd5512e3
def plot_data(self, plot_options): <NEW_LINE> <INDENT> data = plot_options['data'][0] <NEW_LINE> sample_rate = plot_options['sample_rate'] <NEW_LINE> plot_range = plot_options['plot_range'] <NEW_LINE> n = len(data) <NEW_LINE> if plot_range == 'all' or len(plot_range) != 2 or plot_range[1] <= plot_range[0]: <NEW_LINE> <...
Plots waveform in datadict. :param DictType plot_options: Dictionary of plot options. Must contain: * Data at plot_options['data'][0] * sample_rate at plot_options['sample_rate'] * plot_range at plot_options['plot_range']. This can be [start,stop], or 'all' for 0:n.
625941dbe76e3b2f99f3aad9
def run(self): <NEW_LINE> <INDENT> page = self.get_page_from_url(self.url) <NEW_LINE> data = self.get_data_from_page(page) <NEW_LINE> self.save_data(data)
程序入口,主干逻辑
625941dbfff4ab517eb2f70f
def cleanCounties(filename,newfilename): <NEW_LINE> <INDENT> with open(filename, "rb") as infile, open(newfilename, "wb") as outfile: <NEW_LINE> <INDENT> outfile.write('<?xml version="1.0" encoding="UTF-8"?>\n') <NEW_LINE> outfile.write('<osm>\n ') <NEW_LINE> for element in getElement(infile): <NEW_LINE> <INDENT> if e...
Create a new xml file with all tag keys of street names and postcode updated
625941dbadb09d7d5db6ca60
def show_histograms(self, n_samples=1000): <NEW_LINE> <INDENT> ps = self.gen(n_samples) <NEW_LINE> util.plot.plot_hist_marginals(ps, lims=get_disp_lims()) <NEW_LINE> plt.show()
Generates samples and plots their histograms.
625941dbbaa26c4b54cb13ee
def trailingZeroes(self, n): <NEW_LINE> <INDENT> count=0 <NEW_LINE> while(n>=5): <NEW_LINE> <INDENT> count+=n/5 <NEW_LINE> n=n/5 <NEW_LINE> <DEDENT> return count
:type n: int :rtype: int
625941dbff9c53063f47c4c4
@primitive("changesize") <NEW_LINE> def tscheme_changesize(x,y,z): <NEW_LINE> <INDENT> turtle.shapesize(x, y, z)
changes gif size
625941db29b78933be1e5979
def testCase903(self): <NEW_LINE> <INDENT> assert self.configdata.data[0]['precision'] == "zip"
Access: rfc4627: Chapter 8, Example 2
625941dbb830903b967e9bda
def _write(self, data): <NEW_LINE> <INDENT> return self._driver.write(data)
Writes data to the driver.
625941db187af65679ca53f1
def filter(missingno, strain, threshhold, passlist): <NEW_LINE> <INDENT> if missingno <= threshhold: <NEW_LINE> <INDENT> passlist.append(strain)
determines which strains pass the cutoff, and appends them to a list that is created outside this function within the process function
625941db7c178a314d6ef735
def plan_trajectory(self, position): <NEW_LINE> <INDENT> prepregrasp = [-1.51, -1.65, -2.37, -1.62, 0.53, 1.96, -2.37] <NEW_LINE> angle_counter = -0.2 <NEW_LINE> while (angle_counter < math.pi): <NEW_LINE> <INDENT> angle_counter += 0.2 <NEW_LINE> offset_angle_counter = angle_counter + self.orbit_start_angle <NEW_LINE> ...
Create a trajectory from the current position to the grasp position. An intermediate pre-grasp in front of the object is inserted between current and goal position. :param position: geometry_msgs.msg.PointStamped :return: None or ([Float[7], ..., Float[7]]
625941db462c4b4f79d1d9a2
def get_model_across_splits(self, model_id): <NEW_LINE> <INDENT> model_cfg = list(self.collection.find({'_id':ObjectId(model_id)})) <NEW_LINE> if len(model_cfg) > 1: <NEW_LINE> <INDENT> raise ValueError("There is more than one model config for '%s'!"%model_id) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> model_cfg = m...
Finds the IDs of all models that have been trained with the same config and sklearn parameters as model_id, but that have been trained on a different temporal split than model_id. Args: model_id (str): The MongoDB ID for a single (sklearn) models. Returns ([ObjectId]): A list of MongoDB IDs, corresponding to all m...
625941dbf7d966606f6aa2d9
def get_gh_repository_url(owner: str, repo: str) -> str: <NEW_LINE> <INDENT> return '{}://{}/{}/{}'.format( DEFAULT_HTTP_PROTO, DEFAULT_GH_URL, owner, repo )
Return assembled GitHub Repository URL.
625941dbd486a94d0b98e419
def flatten_vector_list(list): <NEW_LINE> <INDENT> if not list: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> result = [] <NEW_LINE> for vec in list: <NEW_LINE> <INDENT> result.extend([i for i in vec]) <NEW_LINE> <DEDENT> return result
flatten a list of vetcors to use in foreach_set and the like
625941dba934411ee3751966
def save_changes(self): <NEW_LINE> <INDENT> text = self.window.editor.get_text() <NEW_LINE> req_name = self.window.name_entry.get() <NEW_LINE> old_name = self.note_name <NEW_LINE> if not req_name: <NEW_LINE> <INDENT> req_name = old_name <NEW_LINE> <DEDENT> new_name = self.note_store.save_text(req_name, text, old_name) ...
Save (and possibly rename) the current note; mark it as unchanged.
625941db30bbd722463cc09a
def get_media_id_by_tag(self, tag): <NEW_LINE> <INDENT> if self.login_status: <NEW_LINE> <INDENT> if tag.startswith('l:'): <NEW_LINE> <INDENT> tag = tag.replace('l:', '') <NEW_LINE> self.by_location = True <NEW_LINE> log_string = "Get Media by location: %s" % (tag) <NEW_LINE> self.write_log(log_string) <NEW_LINE> if se...
Get media ID set, by your hashtag or location
625941db21bff66bcd684c22
def test_msrp_attribute_is_working_properly(self): <NEW_LINE> <INDENT> test_value = 145 <NEW_LINE> g = Good(**self.kwargs) <NEW_LINE> self.assertNotEqual( g.msrp, test_value ) <NEW_LINE> g.msrp = test_value <NEW_LINE> self.assertEqual( g.msrp, test_value )
testing if the msrp attribute value can be properly changed
625941db7d43ff24873a2f73
def getAction(self, gameState): <NEW_LINE> <INDENT> legal_moves = gameState.getLegalActions() <NEW_LINE> scores = [] <NEW_LINE> ghost_num = len(gameState.getGhostStates()) <NEW_LINE> for action in legal_moves: <NEW_LINE> <INDENT> child_state = gameState.generateSuccessor(0, action) <NEW_LINE> if ghost_num != 0: <NEW_LI...
Returns the minimax action from the current gameState using self.depth and self.evaluationFunction. Terminal states can be found by one of the following: pacman won, pacman lost or there are no legal moves. Here are some method calls that might be useful when implementing minimax. gameState.getLegalActions(agentIndex...
625941db96565a6dacc8f99c
def appendTailLine(self,line): <NEW_LINE> <INDENT> if len(self.lastLines)>10*self.logTail: <NEW_LINE> <INDENT> self.lastLines=self.lastLines[-self.logTail:] <NEW_LINE> self.writeTailLog() <NEW_LINE> <DEDENT> self.lastLines.append(line+"\n")
Append lines to the tail of the log
625941dbd8ef3951e3243810
def send_mail(self, cr, uid, ids, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = {} <NEW_LINE> <DEDENT> ir_attachment_obj = self.pool.get('ir.attachment') <NEW_LINE> active_ids = context.get('active_ids') <NEW_LINE> is_log = context.get('mail_compose_log', False) <NEW_LINE> for wiz...
Process the wizard content and proceed with sending the related email(s), rendering any template patterns on the fly if needed.
625941db56b00c62f0f1492d
def test_intersect(): <NEW_LINE> <INDENT> assert Range(0, 10).intersect(Range(11, 20)) is None <NEW_LINE> assert Range(0, 10).intersect(Range(10, 20)) is None <NEW_LINE> assert Range(0, 10).intersect(Range(9, 20)) == Range(9, 10) <NEW_LINE> assert Range(100, 1000).intersect(Range(2000, 2500)) is None <NEW_LINE> assert ...
Test range intersect.
625941dbd7e4931a7ee9e1f0
def jsonrpc(self, commands: str): <NEW_LINE> <INDENT> self._req_id += 1 <NEW_LINE> return { "jsonrpc": "2.0", "method": "cli", "params": [commands], "id": self._req_id, }
This function generates the JSON-RPC payload required by EXOS. Parameters ---------- commands: List[str] Returns ------- dict - payload to be used to post the JSON-RPC reuqest.
625941db32920d7e50b284a4
def get_most_common_n_grams(words, num_results=50, len_ngram=2): <NEW_LINE> <INDENT> ngrams = {} <NEW_LINE> for word in words: <NEW_LINE> <INDENT> w_ngrams = get_n_grams(word, len_ngram) <NEW_LINE> for ngram in w_ngrams: <NEW_LINE> <INDENT> ngrams[ngram] = ngrams.get(ngram, 0) + 1 <NEW_LINE> <DEDENT> <DEDENT> sorted_li...
Calculates the 50 (default) most common bigrams (default) from a list of pages, where each page is a list of WordData objects. @param words: (list of str) List containing the words from which to extract the bigrams @param num_results: (int) Number of n-grams returned. @param len_ngram: (int) length of n-gra...
625941dbcdde0d52a9e53307
def n_ifelsestmt(self, node, preprocess=False): <NEW_LINE> <INDENT> else_suite = node[3] <NEW_LINE> n = else_suite[0] <NEW_LINE> old_stmts = None <NEW_LINE> else_suite_index = 1 <NEW_LINE> if len(n) and n[0] == "suite_stmts": <NEW_LINE> <INDENT> n = n[0] <NEW_LINE> <DEDENT> len_n = len(n) <NEW_LINE> if len_n == 1 == le...
Transformation involving if..else statments. For example if ... else if .. into: if .. elif ... [else ...] where appropriate.
625941dbb545ff76a89140e7
def setPowerLEDPulse(self, pulse): <NEW_LINE> <INDENT> pulse_mask = PMC_LED_NONE <NEW_LINE> if pulse: pulse_mask = PMC_LED_POWER_BLUE <NEW_LINE> status_field = "{0:02X}".format(pulse_mask & 0x001) <NEW_LINE> self.__processor.transceiveCommand(_PMC_COMMAND_LED_PULSE, status_field)
Turn power LED pulsing on or off. Args: pulse (bool): If ``True``, pulsing is turned on. Raises: PMCCommandRejectedException: If the PMC refused the command with an ERR packet. PMCCommandTimeoutError: If the response timeout was reached before receiving a response. PMCUnexpectedRespons...
625941db4e4d5625662d46a7
def __init__(self): <NEW_LINE> <INDENT> super(JobItem, self).__init__('job_item')
Toll Outlet Portal job_item table initialiser.
625941db8e05c05ec3eea649
def build_stages(args) -> typing.Iterable[hpccm.Stage]: <NEW_LINE> <INDENT> stages = collections.OrderedDict() <NEW_LINE> if args.llvm is not None and args.tsan is not None: <NEW_LINE> <INDENT> add_tsan_compiler_build_stage(input_args=args, output_stages=stages) <NEW_LINE> <DEDENT> if args.oneapi is not None: <NEW_LINE...
Define and sequence the stages for the recipe corresponding to *args*.
625941db01c39578d7e7510e
def clearBit(self, set, i): <NEW_LINE> <INDENT> return set & ~(1 << i)
Sets the i'th bit to zero
625941db31939e2706e4d138
def deserialize(self, data: str) -> TreeNode: <NEW_LINE> <INDENT> return self.dict_to_node(json.loads(data))
Decodes your encoded data to tree.
625941db10dbd63aa1bd2e74
def move_to_end(self, key, last=True): <NEW_LINE> <INDENT> link = self.__map[key] <NEW_LINE> link_prev = link.prev <NEW_LINE> link_next = link.next <NEW_LINE> link_prev.next = link_next <NEW_LINE> link_next.prev = link_prev <NEW_LINE> root = self.__root <NEW_LINE> if last: <NEW_LINE> <INDENT> last = root.prev <NEW_LINE...
Move an existing element to the end (or beginning if last==False). Raises KeyError if the element does not exist. When last=True, acts like a fast version of self[key]=self.pop(key).
625941db507cdc57c6306fb3
def gyisland(self,dae): <NEW_LINE> <INDENT> if self.system.Bus.islanded_buses: <NEW_LINE> <INDENT> a = self.system.Bus.islanded_buses <NEW_LINE> v = [self.system.Bus.n + item for item in a] <NEW_LINE> dae.set_jac(Gy, 1e-6, a, a) <NEW_LINE> dae.set_jac(Gy, 1e-6, v, v)
Reset gy(x) for islanded buses and areas
625941dbdd821e528d63b47a
def action_callback(self, state): <NEW_LINE> <INDENT> new_state = self.discretize_state(state) <NEW_LINE> x = self.discretize_state(state)[0] <NEW_LINE> y = self.discretize_state(state)[1] <NEW_LINE> gravity = self.discretize_state(state)[2] <NEW_LINE> if self.last_action == None: <NEW_LINE> <INDENT> answer = npr.rand(...
Implement this function to learn things and take actions. Return 0 if you don't want to jump and 1 if you do.
625941db15fb5d323cde0de5
def run_check(function): <NEW_LINE> <INDENT> @wraps(function) <NEW_LINE> def helper(*args, **kwargs): <NEW_LINE> <INDENT> if not all_data.running: <NEW_LINE> <INDENT> return render_template("home.html", running=all_data.running, ip="0.0.0.0") <NEW_LINE> <DEDENT> elif all_data.publish: <NEW_LINE> <INDENT> return redirec...
The wrapper function for checking if the application is running or not. If server is not running, we return the home page that displays that the server is not currently running. Also, if there is a poll that is currently going on, we redirect to the page of the live result data. :param function: The function on which ...
625941db8c0ade5d55d3ec8f
def getCrop(self, dpt, xstart, xend, ystart, yend, zstart, zend, thresh_z=True, background=0): <NEW_LINE> <INDENT> if len(dpt.shape) == 2: <NEW_LINE> <INDENT> cropped = dpt[max(ystart, 0):min(yend, dpt.shape[0]), max(xstart, 0):min(xend, dpt.shape[1])].copy() <NEW_LINE> cropped = numpy.pad(cropped, ((abs(ystart)-max(ys...
Crop patch from image :param dpt: depth image to crop from :param xstart: start x :param xend: end x :param ystart: start y :param yend: end y :param zstart: start z :param zend: end z :param thresh_z: threshold z values :return: cropped image
625941db7d847024c06be591
def _index_range(self, version, symbol, from_version=None, **kwargs): <NEW_LINE> <INDENT> from_index = None <NEW_LINE> if from_version: <NEW_LINE> <INDENT> from_index = from_version['up_to'] <NEW_LINE> <DEDENT> return from_index, None
Tuple describing range to read from the ndarray - closed:open
625941db0a50d4780f667167
def draw(self): <NEW_LINE> <INDENT> pass
This method is used to draw the object onto the game screen
625941db7d43ff24873a2f74
def reset(self, V0, dt, t0=0): <NEW_LINE> <INDENT> self.V = np.array(V0, dtype='float64') <NEW_LINE> self.dt = dt <NEW_LINE> self.t = t0 <NEW_LINE> self.t_list = [] <NEW_LINE> self.V_list = []
Reset the integration parameters; see __init__ for more info.
625941db956e5f7376d7113e
def hash_of_files(_str): <NEW_LINE> <INDENT> if os.path.isdir(_str): <NEW_LINE> <INDENT> for p in os.listdir(_str): <NEW_LINE> <INDENT> hash_of_files(_str+"/"+p) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> _hash = hashlib.sha256( open(_str , 'rb').read() ).hexdigest() <NEW_LINE> if hash_dic.get(_hash) is Non...
Calculates hash values of only files and stores on a dictionary
625941db4527f215b584c727
def __init__(self, devname=None): <NEW_LINE> <INDENT> if devname is None: <NEW_LINE> <INDENT> devname = EGFilament.DEVICES.LI <NEW_LINE> <DEDENT> if devname not in EGFilament.DEVICES.ALL: <NEW_LINE> <INDENT> raise NotImplementedError(devname) <NEW_LINE> <DEDENT> super().__init__(devname, properties=EGFilament._properti...
.
625941db435de62698dfdf1f
def ifft_eager_fallback(input, name=None, ctx=None): <NEW_LINE> <INDENT> _ctx = ctx if ctx else _context.context() <NEW_LINE> _attr_Tcomplex, (input,) = _execute.args_to_matching_eager([input], _ctx, _dtypes.complex64) <NEW_LINE> _inputs_flat = [input] <NEW_LINE> _attrs = ("Tcomplex", _attr_Tcomplex) <NEW_LINE> _result...
This is the slowpath function for Eager mode. This is for function ifft
625941db7c178a314d6ef736
def remove_subtree(block_id): <NEW_LINE> <INDENT> encoded_block_id = LocMapperStore.encode_key_for_mongo(block_id) <NEW_LINE> for child in new_blocks[encoded_block_id]['fields'].get('children', []): <NEW_LINE> <INDENT> remove_subtree(child) <NEW_LINE> <DEDENT> del new_blocks[encoded_block_id]
Remove the subtree rooted at block_id
625941db442bda511e8be6e7
def declared_metaclass(self, context=None): <NEW_LINE> <INDENT> for base in self.bases: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for baseobj in base.infer(context=context): <NEW_LINE> <INDENT> if isinstance(baseobj, ClassDef) and baseobj.hide: <NEW_LINE> <INDENT> self._metaclass = baseobj._metaclass <NEW_LINE> self...
Return the explicit declared metaclass for the current class. An explicit declared metaclass is defined either by passing the ``metaclass`` keyword argument in the class definition line (Python 3) or (Python 2) by having a ``__metaclass__`` class attribute, or if there are no explicit bases but there is a global ``__m...
625941db8da39b475bd65249
def call_rest_api(endpoint, query): <NEW_LINE> <INDENT> print('call_rest_api() : endpoint=' + endpoint) <NEW_LINE> if query is not None: <NEW_LINE> <INDENT> pprint(query.__str__()) <NEW_LINE> <DEDENT> response = requests.get(endpoint, params=query) <NEW_LINE> if response.status_code != 200: <NEW_LINE> <INDENT> return 5...
Call REST API endpoint :param endpoint:e.g. 'http://127.0.0.1:9500/wind_deg_to_wind_rose' :param query: e.g. query = {'wind_deg': wind_deg} :return:
625941db2eb69b55b151cb85
@app.route("/api/v1.0/precipitation") <NEW_LINE> def precipitation (): <NEW_LINE> <INDENT> last_date = session.query(Measurement.date).order_by(Measurement.date.desc()).first() <NEW_LINE> dt_last_date = dt.fromisoformat(last_date[0]) <NEW_LINE> last_year_date = dt_last_date - timedelta(days=365) <NEW_LINE> results = se...
Return a percipitation value for each day for the last 12 months
625941db7cff6e4e81117c58
def updateVariables(self): <NEW_LINE> <INDENT> curTime = datetime.datetime.now() <NEW_LINE> curTimeDic = {"Day": curTime.day, "Hour": curTime.hour, "Weekday": int(curTime.weekday())} <NEW_LINE> """Search through XML to set the variables""" <NEW_LINE> for curCur in self.XMLroot: <NEW_LINE> <INDENT> if curCur.tag == "for...
initiate current time and dictionary for quick access
625941db7b180e01f3dc4acb
def __init__(self, x = 0.0, y = 0.0, heading = 0.0, turning = 2*math.pi/10, distance = 1.0): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.heading = heading <NEW_LINE> self.turning = turning <NEW_LINE> self.distance = distance <NEW_LINE> self.turning_noise = 0.0 <NEW_LINE> self.distance_noise ...
This function is called when you create a new robot. It sets some of the attributes of the robot, either to their default values or to the values specified when it is created.
625941db3eb6a72ae02ec7b6
def get_email(self): <NEW_LINE> <INDENT> return f"{self.ucid}@njit.edu"
Returns the generated email address for a given AuthUser
625941dbaad79263cf390d18
def evaluate(self, tokens): <NEW_LINE> <INDENT> words = self._words(tokens) <NEW_LINE> prefices = (('spell',), ('how', 'do', 'you', 'spell')) <NEW_LINE> match = None <NEW_LINE> for prefix in prefices: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> (start, end, score) = fuzzy_list_range(words, prefix) <NEW_LINE> LOG.debug...
@see Service.evaluate()
625941db046cf37aa974d018
def generateBuildObj(self,url): <NEW_LINE> <INDENT> self.log.info("Generate build data object") <NEW_LINE> buildobj = self.jenkins.getBuildData(url) <NEW_LINE> build = dict() <NEW_LINE> build["stagelst"] = list() <NEW_LINE> build["id"] = buildobj['id'] <NEW_LINE> build["name"] = buildobj[...
Get current instance build data
625941dbac7a0e7691ed439a
def load_raw_data(self): <NEW_LINE> <INDENT> if not self.gui.get_sensor_info(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> table = self.gui.rawTable <NEW_LINE> row_number = table.rowCount() <NEW_LINE> if row_number < 1: <NEW_LINE> <INDENT> self.gui.popup_error_message(self.gui.tr("Please define at least 1 mea...
Read raw data from table
625941dbd10714528d5fffb9
def readShortVideo(video_path, video_category, video_name, downsample_factor=12, rescale_factor=1): <NEW_LINE> <INDENT> filepath = video_path + '/' + video_category <NEW_LINE> filename = [file for file in os.listdir(filepath) if file.startswith(video_name)] <NEW_LINE> video = os.path.join(filepath,filename[0]) <NEW_LIN...
@param video_path: video directory @param video_category: video category (see csv files) @param video_name: video name (unique, see csv files) @param downsample_factor: number of frames between each sampled frame (e.g., downsample_factor = 12 equals 2fps) @param rescale_factor: float of scale factor (rescale the image ...
625941db4e696a04525c971f
def removeDuplicates(self, nums): <NEW_LINE> <INDENT> k = 0 <NEW_LINE> total = 0 <NEW_LINE> val = nums[0] if nums else 0 <NEW_LINE> for i, num in enumerate(nums): <NEW_LINE> <INDENT> if num == val and total < 2: <NEW_LINE> <INDENT> nums[i], nums[k] = nums[k], nums[i] <NEW_LINE> k += 1 <NEW_LINE> total += 1 <NEW_LINE> <...
:type nums: List[int] :rtype: int
625941dbd53ae8145f87a53e
def saved(self, user): <NEW_LINE> <INDENT> return self.filter(states__state=EntryState.STATE_SAVED, states__user=user)
Get all entries that have been saved.
625941db24f1403a92600e37
def server_exists(s_name, ip=None, s_state=None, **connection_args): <NEW_LINE> <INDENT> server = _server_get(s_name, **connection_args) <NEW_LINE> if server is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if ip is not None and ip != server.get_ipaddress(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DED...
Checks if a server exists CLI Example: .. code-block:: bash salt '*' netscaler.server_exists 'serverName'
625941dbd18da76e235327ab
def pc_work_time(self): <NEW_LINE> <INDENT> return _blocks_swig3.float_to_int_sptr_pc_work_time(self)
pc_work_time(float_to_int_sptr self) -> float
625941db8e7ae83300e4b2a0
def linear_scale(series): <NEW_LINE> <INDENT> min_val = series.min() <NEW_LINE> max_val = series.max() <NEW_LINE> scale = (max_val - min_val) <NEW_LINE> return (series.apply(lambda x:((x - min_val) / scale)) , max_val, min_val)
Scales the series on the range [0,1] :param series: a pandas series :return: a pandas series scaled on the range [0,1] the maximum of the series the minimum of the series
625941db8c0ade5d55d3ec90
def train_step(input_var: torch.LongTensor, lengths: torch.Tensor, target_var: torch.LongTensor, mask: torch.BoolTensor, max_target_len: int, batch_size: int, clip: float, teacher_forcing_ratio: float, sos_token: int, encoder: models.Encoder, decoder: models.Decoder, encoder_opt: torch.optim.Optimizer, decoder_opt: tor...
Function implementing single training step of a model. Parameters ---------- input_var: torch.LongTensor Tensor of inputs. lengths: torch.Tensor Tensor of lengths of input sequences. target_var: torch.LongTensor Tensor of target values. mask: torch.Tensor Binary tensor describing the padding od the tar...
625941db5e10d32532c5f1f9
def flush(self): <NEW_LINE> <INDENT> if not self.readonly: <NEW_LINE> <INDENT> self.expunge()
Equivalent to expunge()
625941db283ffb24f3c55bd2
def execute_command(filename:str,metric:str,algorithm:int,backbone:str,pool:list,counter:int,k:int,m:int,number_of_cores:int,merge:bool=False): <NEW_LINE> <INDENT> proc = None <NEW_LINE> if k == 0 and m == 0: <NEW_LINE> <INDENT> if merge: <NEW_LINE> <INDENT> proc = subprocess.Popen(["python", "../../code/main.py", "-fp...
Description: Run thesis for specific input file with specific arguments Args: filename(String): The name of specific file metric(string): The name of PCI metric algoprithm(int): An integer that match to an algorithm (1-->MILCOM,2-->NEW,3-->ROBUST) backbone(string): Backbone has two values, CDS or MCDS ...
625941dbcb5e8a47e48b7d79
def shutdown(exiting_interpreter=False): <NEW_LINE> <INDENT> if exiting_interpreter and global_worker.mode == SCRIPT_MODE: <NEW_LINE> <INDENT> time.sleep(0.5) <NEW_LINE> <DEDENT> disconnect() <NEW_LINE> global _global_node <NEW_LINE> if _global_node is not None: <NEW_LINE> <INDENT> _global_node.kill_all_processes(check...
Disconnect the worker, and terminate processes started by ray.init(). This will automatically run at the end when a Python process that uses Ray exits. It is ok to run this twice in a row. The primary use case for this function is to cleanup state between tests. Note that this will clear any remote function definitio...
625941db442bda511e8be6e8
def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super().get_context_data(**kwargs) <NEW_LINE> build_date = getenv('BUILD_TIMESTAMP') <NEW_LINE> if build_date: <NEW_LINE> <INDENT> build_date = datetime.fromtimestamp(float(build_date), timezone.utc) <NEW_LINE> <DEDENT> context.update({ 'build_date': b...
Loads app build date from file.
625941dbc432627299f04f1b
def _stof(self, fstr): <NEW_LINE> <INDENT> return float(fstr.replace(',', '.'))
Convert string with ',' string float to float
625941dbbf627c535bc134a2
def test_rsp_none(self): <NEW_LINE> <INDENT> self.ae = ae = AE() <NEW_LINE> ae.acse_timeout = 5 <NEW_LINE> ae.dimse_timeout = 5 <NEW_LINE> ae.network_timeout = 5 <NEW_LINE> ae.add_supported_context(Verification) <NEW_LINE> scp = ae.start_server(("localhost", 11112), block=False) <NEW_LINE> ae.add_requested_context(Veri...
Test no response from peer
625941db1b99ca400220ad85
def _parsetime(s): <NEW_LINE> <INDENT> if '.' in s: <NEW_LINE> <INDENT> time, microsecond = s.split('.') <NEW_LINE> microsecond = int(microsecond) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> time, microsecond = s, 0 <NEW_LINE> <DEDENT> hour, minute, second = [int(i) for i in time.split(':')] <NEW_LINE> return hour, m...
Parse an isoformat time string into a (hour, minute, second, microsecond) tuple.
625941dbfbf16365ca6f649b
def to_geojson(self, data, options=None): <NEW_LINE> <INDENT> def _build_feature(obj): <NEW_LINE> <INDENT> f = { "type": "Feature", "properties": {} } <NEW_LINE> for key, value in obj.items(): <NEW_LINE> <INDENT> if key == 'location': <NEW_LINE> <INDENT> f['geometry'] = value <NEW_LINE> <DEDENT> if key in ['id', 'geome...
Given some Python data, produces GeoJSON output.
625941db97e22403b379d26e
def open_new_experiment(self): <NEW_LINE> <INDENT> self.splash.show()
Opens the splash screen to run a new experiment, in paralel to the current one :return: None
625941dbd4950a0f3b08c61f
def mkdir_p(path): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.makedirs(os.path.abspath(path)) <NEW_LINE> <DEDENT> except OSError as exc: <NEW_LINE> <INDENT> if exc.errno == errno.EEXIST and os.path.isdir(path): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise <NEW_LINE> <DEDENT> <DEDENT...
mkdir -p path
625941db71ff763f4b549963
def addStrings(self, num1, num2): <NEW_LINE> <INDENT> carry,i,j = 0, len(num1)-1 , len(num2)-1 <NEW_LINE> res = [] <NEW_LINE> while i >= 0 or j >= 0: <NEW_LINE> <INDENT> tmp = carry <NEW_LINE> if i >= 0 : <NEW_LINE> <INDENT> tmp += int(num1[i]) <NEW_LINE> i -= 1 <NEW_LINE> <DEDENT> if j >= 0: <NEW_LINE> <INDENT> tmp +=...
:type num1: str :type num2: str :rtype: str
625941db6fb2d068a760f374
def doubleSize(self): <NEW_LINE> <INDENT> oldArray = self.array <NEW_LINE> self.size = self.size * 2 <NEW_LINE> self.array = [None] * self.size <NEW_LINE> for keyVal in oldArray: <NEW_LINE> <INDENT> if keyVal is not None: <NEW_LINE> <INDENT> self.insert(keyVal.value)
Method to double size of array when load factor >= 0.8
625941db187af65679ca53f2
def stopRecording(self): <NEW_LINE> <INDENT> self._recorder.stop_recording() <NEW_LINE> self._logger.info('Recording stop')
CORBA Method implementation. Sends signal to stop recording, releases all components, and destroys monitors
625941db66673b3332b92365
def start(): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> ui.print_menu(title='Accounting manager', list_options=['Show table', 'Add new item', 'Remove item', 'Update item', 'Highest profit in year ***', 'Average profit ***'], exit_message="Back to MainMenu") <NEW_LINE> user_input = ui.get_inputs(list_titles=["P...
Creates a submenu for accounting.py
625941db7b25080760e3972b