code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_endpoint(name, tags=None, region=None, key=None, keyid=None, profile=None): <NEW_LINE> <INDENT> endpoint = False <NEW_LINE> res = __salt__['boto_rds.exists'](name, tags, region, key, keyid, profile) <NEW_LINE> if res.get('exists'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> conn = _get_conn(region=region, key...
Return the endpoint of an RDS instance. CLI example:: salt myminion boto_rds.get_endpoint myrds
625941e5b545ff76a8914236
def compute_color_histograms(cloud, nbins=32, using_hsv=False): <NEW_LINE> <INDENT> point_colors_list = [] <NEW_LINE> for point in pc2.read_points(cloud, skip_nans=True): <NEW_LINE> <INDENT> rgb_list = float_to_rgb(point[3]) <NEW_LINE> if using_hsv: <NEW_LINE> <INDENT> point_colors_list.append(rgb_to_hsv(rgb_list) * 25...
Compute the normalized color historgram features from the provided point cloud, with the option of converting the RGB data to HSV values. :param cloud: Point cloud :param nbins: Integer of the number of histogram bins :param using_hsv: Optional boolean of whether to convert RGB values to HSV :return: Normalized histor...
625941e563f4b57ef000152e
def apply(self, x, ts): <NEW_LINE> <INDENT> return self._fn(x, self._prior)
:param number x: The new reading from the measurement. :param int ts: The timestamp of the new reading. :returns: Number value of the streaming computation. Apply the computation to the value recieved from the stream.
625941e596565a6dacc8faeb
def node_link_data(self): <NEW_LINE> <INDENT> data = { 'directed': True, 'multigraph': False, 'graph': {}, 'links': [], 'nodes': [], } <NEW_LINE> node_to_number = {} <NEW_LINE> for node in self.adjacency_map.keys(): <NEW_LINE> <INDENT> node_to_number[node] = len(data['nodes']) <NEW_LINE> data['nodes'].append({'id': nod...
Returns the graph as a dictionary in a format that can be serialized.
625941e5851cf427c661a92d
def _makelang(alphabet, size): <NEW_LINE> <INDENT> def helper(size): <NEW_LINE> <INDENT> if size < 2: <NEW_LINE> <INDENT> for char in alphabet: <NEW_LINE> <INDENT> yield char <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> for char in alphabet: <NEW_LINE> <INDENT> for tail in helper(size-1): <NEW_LINE> <INDENT> ...
generate all strings of given size using alphabet
625941e5a79ad161976cc567
def create_pcap(token, time, name): <NEW_LINE> <INDENT> uri = 'https://loaclhost/v1/capture/rolling/start?' <NEW_LINE> headers = {'X-Requested-With': 'XMLHttpRequest', 'Content-Type': 'application/json'} <NEW_LINE> start_time = '' <NEW_LINE> end_time = '' <NEW_LINE> payload = {"startTime": start_time, "endTime": end_ti...
Create PCAP for previous 24 hours.
625941e523849d37ff7b34ad
def round_sum(a, b, c): <NEW_LINE> <INDENT> return round10(a) + round10(b) + round10(c)
For this problem, we'll round an int value up to the next multiple of 10 if its rightmost digit is 5 or more, so 15 rounds up to 20. Alternately, round down to the previous multiple of 10 if its rightmost digit is less than 5, so 12 rounds down to 10. Given 3 ints, a b c, return the sum of their rounded values. To avoi...
625941e52eb69b55b151ccd6
def test_ofType(self): <NEW_LINE> <INDENT> MESSAGE = MessageType("mymessage", [], "A message!") <NEW_LINE> logger = MemoryLogger() <NEW_LINE> MESSAGE().write(logger) <NEW_LINE> Message.new(x=2).write(logger) <NEW_LINE> MESSAGE().write(logger) <NEW_LINE> logged = LoggedMessage.ofType(logger.messages, MESSAGE) <NEW_LINE>...
L{LoggedMessage.ofType} returns a list of L{LoggedMessage} created by the specified L{MessageType}.
625941e5a17c0f6771cbe470
def movingaverage(self, interval): <NEW_LINE> <INDENT> interval = self.TD(interval) <NEW_LINE> _data = [] <NEW_LINE> if self.data == []: <NEW_LINE> <INDENT> return timeseries() <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> i = len(self.data) - 1 <NEW_LINE> while i >= 0: <NEW_LINE> <INDENT> endTime = self.data[i][0] <NEW...
averages timeseries based on a given interval of type timedelta. This differs from rollingaverage because it looks backwards. returns a timeseries object
625941e521a7993f00bc8118
def render_GET(self, request): <NEW_LINE> <INDENT> args = request.args <NEW_LINE> peer_id = args.get('peer_id', [None])[0] <NEW_LINE> if peer_id is None: <NEW_LINE> <INDENT> return self._encode_failure('Peer ID not given') <NEW_LINE> <DEDENT> if len(peer_id) != 20: <NEW_LINE> <INDENT> return self._encode_failure('Inval...
Renders the response to peers
625941e5099cdd3c635f107a
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: <NEW_LINE> <INDENT> if(len(nums2)!=0): <NEW_LINE> <INDENT> j=0 <NEW_LINE> i=0 <NEW_LINE> while i<m+n: <NEW_LINE> <INDENT> if nums2[j]<nums1[i]: <NEW_LINE> <INDENT> nums1.insert(i,nums2[j]) <NEW_LINE> j=j+1 <NEW_LINE> if j==len(nums2): <NEW_LIN...
Do not return anything, modify nums1 in-place instead.
625941e5956e5f7376d7128d
@pytest.mark.bdb <NEW_LINE> def test_cant_spend_same_input_twice_in_tx(b, genesis_block): <NEW_LINE> <INDENT> from bigchaindb.models import Transaction <NEW_LINE> from bigchaindb.common.exceptions import DoubleSpend <NEW_LINE> tx_create = Transaction.create([b.me], [([b.me], 100)]) <NEW_LINE> tx_create_signed = tx_crea...
Recreate duplicated fulfillments bug https://github.com/bigchaindb/bigchaindb/issues/1099
625941e5f7d966606f6aa42a
def tai_from_iso(strings, validate=True, strip=False): <NEW_LINE> <INDENT> (day, sec) = day_sec_from_iso(strings, validate, strip) <NEW_LINE> return tai_from_day(day) + sec
Elapsed seconds TAI from January 1, 2000 given an ISO date or date-time string. Works for individual strings or bytestrings and also for arrays of bytestrings.
625941e5462c4b4f79d1daf1
def build_access_request_data(registration, event, generate_code): <NEW_LINE> <INDENT> from indico_cern_access.plugin import CERNAccessPlugin <NEW_LINE> start_dt, end_dt = get_access_dates(get_last_request(event)) <NEW_LINE> tz = timezone('Europe/Zurich') <NEW_LINE> title = do_truncate(None, str_to_ascii(remove_accents...
Return a dictionary with data required by ADaMS API.
625941e5293b9510aa2c36b3
def exit(self, event, data): <NEW_LINE> <INDENT> self._quit()
Close the program and save the path to config
625941e5baa26c4b54cb153d
def addObserver(self, observer): <NEW_LINE> <INDENT> self.observers.append(observer) <NEW_LINE> self.observers = self.observers
Observable.addObserver(observer) Add a method which will be called when this observer's notify() is executed.
625941e5090684286d50f10c
def ping(requestor_info): <NEW_LINE> <INDENT> pass
Used to determine if this node is still online
625941e5fb3f5b602dac3ab9
def _handleRemoveData(self): <NEW_LINE> <INDENT> allData = self.panel.profile.getDataPieces(self.left) <NEW_LINE> remainingData = [allData[i] for i in range(len(allData)) if not self.listView.selectionModel().isRowSelected(i,QtCore.QModelIndex())] <NEW_LINE> self.panel.profile.setDataPieces(self.left,remainingData)
Handle a click on the remove button.
625941e5507cdc57c6307106
def update(self, current, values=[]): <NEW_LINE> <INDENT> for k, v in values: <NEW_LINE> <INDENT> if k not in self.l.keys(): <NEW_LINE> <INDENT> raise KeyError('Name is not known to progplot instance.') <NEW_LINE> <DEDENT> self.y[k][current] = v <NEW_LINE> self.l[k].data_source.data['x'] = self.x[:current] <NEW_LINE> s...
Parameters ---------- current: int index of current step values: list of tuples (name, value_for_last_step)
625941e58a43f66fc4b54482
def list_procs(self, sort=True): <NEW_LINE> <INDENT> seen = set() <NEW_LINE> for method, handler in self.METHODS.iteritems(): <NEW_LINE> <INDENT> if method not in self.methods: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> procs = self.cache.setdefault(method, handler(self)) <NEW_LINE> logging.debug( "Listed {} proc...
Uses a few methods to list the procs.
625941e56e29344779a62a31
def fireEvent(self, event_type, event_value, listeners=None): <NEW_LINE> <INDENT> if listeners is None: <NEW_LINE> <INDENT> listeners = self._listeners <NEW_LINE> <DEDENT> if listeners is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not isinstance(listeners, Sequence): <NEW_LINE> <INDENT> listeners = listene...
sends an event to all listeners or a specific one
625941e5eab8aa0e5d26df7b
def check_topology(self, *args, **kwargs): <NEW_LINE> <INDENT> return _ieee802_11_swig.sync_short_sptr_check_topology(self, *args, **kwargs)
check_topology(sync_short_sptr self, int ninputs, int noutputs) -> bool
625941e53539df3088e2e76c
def subanagrams(word): <NEW_LINE> <INDENT> subs = [] <NEW_LINE> if '?' in word: <NEW_LINE> <INDENT> for letter in ALPHABET: <NEW_LINE> <INDENT> subs += subanagrams(word.replace('?', letter, 1)) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> for subset in powerset(word): <NEW_LINE> <INDENT> subs += anagram(''.jo...
Returns every word that can be made with the combination of any of the letters inside the word. Example: "MOCK" -> ["MOCK", "MOC", "MO", "OM"]
625941e5d268445f265b5290
def render_sections(self, template, context): <NEW_LINE> <INDENT> while 1: <NEW_LINE> <INDENT> match = self.section_re.search(template) <NEW_LINE> if match is None: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> section, section_name, inner = match.group(0, 1, 2) <NEW_LINE> section_name = section_name.strip() <NEW_LINE>...
Expands sections.
625941e524f1403a92600f84
def datasources(self): <NEW_LINE> <INDENT> r = self.client.get("/admin/data_sources") <NEW_LINE> data_sources = r.json()["data_sources"] <NEW_LINE> return list(map(lambda name: DataSource(name, self.client), data_sources))
Retrieves all data sources. Returns: list[DataSources]: A list of DataSources
625941e5bf627c535bc135f1
def find_pair(read_id, pairs_list): <NEW_LINE> <INDENT> for i, pair in enumerate(pairs_list): <NEW_LINE> <INDENT> if pair[0] == read_id: <NEW_LINE> <INDENT> return -1, 'R1' <NEW_LINE> <DEDENT> if pair[1] == read_id: <NEW_LINE> <INDENT> return i, pair[0] <NEW_LINE> <DEDENT> <DEDENT> return -1, None
If the read_id is an R2 read corresponding to an R1 id in the list, return that id
625941e55510c4643540f7fb
def __init__(self, string, case_insensitive=False): <NEW_LINE> <INDENT> self.string = string <NEW_LINE> self.case_insensitive = case_insensitive <NEW_LINE> self.N = len(string) - 1 <NEW_LINE> self.nodes = [Node()] <NEW_LINE> self.edges = {} <NEW_LINE> self.active = Suffix(0, 0, -1) <NEW_LINE> self.root = self.active <N...
string the string for which to construct a suffix tree
625941e5187af65679ca5542
def conv2d(self, x, W): <NEW_LINE> <INDENT> return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')
畳み込み計算を行う関数
625941e5167d2b6e31218fb6
def remove_whitespace(tokens): <NEW_LINE> <INDENT> return [token for token in tokens if token.type != 'S']
Remove any top-level whitespace in a token list. Whitespace tokens inside recursive :class:`~.token_data.ContainerToken` are preserved. :param tokens: A list of :class:`~.token_data.Token` or :class:`~.token_data.ContainerToken`. :return: A new sub-sequence of the list.
625941e5377c676e912725c9
def clear(self): <NEW_LINE> <INDENT> self._children.clear()
Remove existing value/children
625941e5d486a94d0b98e568
@import_config_cmd.command( name="teamocil", short_help="Convert and import a teamocil config." ) <NEW_LINE> @click.argument( "configfile", type=ConfigPath(exists=True, config_dir=get_teamocil_dir), nargs=1 ) <NEW_LINE> def command_import_teamocil(configfile): <NEW_LINE> <INDENT> import_config(configfile, config.import...
Convert a teamocil config from CONFIGFILE to tmuxp format and import it into tmuxp.
625941e5287bf620b61d3e83
def generate_moves(self): <NEW_LINE> <INDENT> moves = [] <NEW_LINE> list_x = range(0, self._board.get_size()[0]) <NEW_LINE> list_y = range(0, self._board.get_size()[1]) <NEW_LINE> logging.info("Generating moves for %s", self._figure) <NEW_LINE> for x_index, y_index in itertools.product(list_x, list_y): <NEW_LINE> <INDE...
Generate moves for figure.
625941e529b78933be1e5ac9
def _build_critic(self): <NEW_LINE> <INDENT> inputs = Input(shape=(4,)) <NEW_LINE> x = Dense(20, activation='relu')(inputs) <NEW_LINE> x = Dense(20, activation='relu')(x) <NEW_LINE> x = Dense(1, activation='linear')(x) <NEW_LINE> model = Model(inputs=inputs, outputs=x) <NEW_LINE> return model
critic model.
625941e5b57a9660fec33cac
def acquireData(self): <NEW_LINE> <INDENT> tlife = 0. <NEW_LINE> ni = 0 <NEW_LINE> ts = time.time() <NEW_LINE> ibufw = -1 <NEW_LINE> while self.ACTIVE.value: <NEW_LINE> <INDENT> ibufw = (ibufw + 1) % self.NBuffers <NEW_LINE> while ibufw==self.ibufr.value: <NEW_LINE> <INDENT> if not self.ACTIVE.value: <NEW_LINE> <INDENT...
Procucer Thread - collects and stores data in buffers - provides all acquired data to manageDataBufer - count number of events and calculate life time Arg: funtion handling data acquisition from device Communicates with consumer via multiprocessing.Queue()
625941e5e1aae11d1e74a0dd
def test_clean_up_exec(): <NEW_LINE> <INDENT> make_me_a_file() <NEW_LINE> obj = clean_up.Clean_up("rm") <NEW_LINE> result = obj.run("temp.txt") <NEW_LINE> if os.path.isfile("temp.txt"): <NEW_LINE> <INDENT> return False
Run clean_up on test data and compare output to precomputed target this often does not produce the same result twice. So we may have to disable this test
625941e59b70327d1c4e11f9
def setUp(self): <NEW_LINE> <INDENT> ftintitle.FtInTitlePlugin()
Set up configuration
625941e592d797404e3045ae
def _get_shutdown_threshold_pct(self): <NEW_LINE> <INDENT> return self.__shutdown_threshold_pct
Getter method for shutdown_threshold_pct, mapped from YANG variable /network_instances/network_instance/protocols/protocol/bgp/global/afi_safis/afi_safi/l3vpn_ipv6_multicast/prefix_limit/state/shutdown_threshold_pct (oc-types:percentage) YANG Description: Threshold on number of prefixes that can be received fr...
625941e531939e2706e4d286
def save(self, commit=True): <NEW_LINE> <INDENT> user = super().save(commit=False) <NEW_LINE> user.set_password(self.cleaned_data["password1"]) <NEW_LINE> try: <NEW_LINE> <INDENT> if commit: <NEW_LINE> <INDENT> user.save() <NEW_LINE> <DEDENT> Profile.objects.create(user=user) <NEW_LINE> <DEDENT> except Exception as e: ...
override user create form to create profile after register!
625941e54c3428357757c747
def deregister_backend(self, backend): <NEW_LINE> <INDENT> query = "DELETE FROM mysql_servers WHERE hostgroup_id={hostgroup_id}" " AND hostname='{hostname}'" " AND port={port}" "".format(hostgroup_id=int(backend.hostgroup_id), hostname=pymysql.escape_string(backend.hostname)...
Deregister a Galera node from ProxySQL :param backend: Galera node. :type backend: ProxySQLMySQLBackend
625941e5adb09d7d5db6cbaf
def menuImport(self, context): <NEW_LINE> <INDENT> self.layout.operator(import_ldraw.LDRImporterOps.bl_idname, text="LDraw (.ldr/.dat)")
Import menu listing label.
625941e571ff763f4b549ab4
def populate_nicks(*args): <NEW_LINE> <INDENT> global colored_nicks <NEW_LINE> colored_nicks = {} <NEW_LINE> buffers = w.infolist_get('buffer', '', '') <NEW_LINE> while w.infolist_next(buffers): <NEW_LINE> <INDENT> buffer_ptr = w.infolist_pointer(buffers, 'pointer') <NEW_LINE> my_nick = w.buffer_get_string(buffer_ptr, ...
Fills entire dict with all nicks weechat can see and what color it has assigned to it.
625941e57047854f462a1827
def pn_traceback(i_mtxScrMtrx: Iterable[Iterable[float]], i_tplStrtPos: Tuple, i_iLenTMLG1: int, i_iLenTMLG2: int, i_mtxSM: Iterable[Iterable[float]]) -> (str, str): <NEW_LINE> <INDENT> lstSeq1 = list(map(str, range(i_iLenTMLG1))) <NEW_LINE> lstSeq2 = list(map(str, range(i_iLenTMLG2))) <NEW_LINE> arrAlgSeq1 = [] <NEW_L...
Find the optimal path according to the scoring matrix. This function traces a path from a position of the maximum value in the scoring matrix. Each move corresponds to a match or gap in one of the sequences being aligned. Three possible moves are allowed: upper-left diagonal, up, or left. Each of these moves represent ...
625941e56fb2d068a760f4c6
def contains(self, point): <NEW_LINE> <INDENT> return bool()
Determines if the specified point is within the bound box. point : The point you want to check to see if it's in the bounding box. Returns true if the point is within the bounding box.
625941e58da39b475bd6539b
@pytest.fixture <NEW_LINE> def long_ll(): <NEW_LINE> <INDENT> return LL([11, 12, 13, 14, 15, 16])
fixture for long array
625941e53317a56b8693a070
def close(self): <NEW_LINE> <INDENT> klass = type(self).__name__ <NEW_LINE> qu = self.que <NEW_LINE> logger.debug('{0}: closing, que size = {1}, output count = {2}'.format(klass, None if qu is None else qu.qsize(), self.count)) <NEW_LINE> self.__call__() <NEW_LINE> self.try_next('close') <NEW_LINE> logger.debug('{0}: c...
To exit this filter thread. Try to close the next filter in chain after the thread is done.
625941e523e79379d52ee981
def test_30_receive_function(self): <NEW_LINE> <INDENT> count_diff = self.call_and_compare_count(self.charun.datagramReceived, [marshal.dumps(charun_tac.test_initial.func_code), ("localhost", 30000)]) <NEW_LINE> self.assertEqual(*count_diff) <NEW_LINE> id, ref = self.charun.datagramReceived('{"122": "erre"}', ("localho...
test function reception: a serialized function string gets integrated and applied. nothing is written to the DB and finally a modified functionality is observed.
625941e594891a1f4081becd
def register_chat_member_handler(self, callback, func=None, pass_bot=False, **kwargs): <NEW_LINE> <INDENT> handler_dict = self._build_handler_dict(callback, func=func, pass_bot=pass_bot, **kwargs) <NEW_LINE> self.add_chat_member_handler(handler_dict)
Registers chat member handler. :param pass_bot: :param callback: function to be called :param func: :return: decorated function
625941e563d6d428bbe44913
def populate_image_data(): <NEW_LINE> <INDENT> urls_in_db = set([video.thumbnail_url for video in Video.query.join(ImageAnalysis).all()]) <NEW_LINE> all_urls = set([video.thumbnail_url for video in Video.query.filter(Video.video_status.is_(None)).filter(Video.video_title.isnot(None)).all()]) <NEW_LINE> thumbnail_urls =...
Populate the image_analyses table for videos with thumbnail images.
625941e5ec188e330fd5abb9
def sync_cmdb(self): <NEW_LINE> <INDENT> redis_info_list = self.get_redis_all() <NEW_LINE> if not redis_info_list: return False <NEW_LINE> with DBContext('w') as session: <NEW_LINE> <INDENT> for data in redis_info_list: <NEW_LINE> <INDENT> for redis in data: <NEW_LINE> <INDENT> ins_log.read_log('info', 'redis信息:{}'.for...
入库 :return:
625941e5ac7a0e7691ed44e7
def slice_stream_item(self, si, trimmed=False): <NEW_LINE> <INDENT> return self.slice_html(si.body.clean_html, trimmed=trimmed)
Returns the text corresponding to this range. The text is sliced from the ``clean_html`` of the given stream item.
625941e55510c4643540f7fc
def update_finished(self): <NEW_LINE> <INDENT> finished_batches = self.is_finished.view(-1).nonzero() <NEW_LINE> for b in finished_batches.view(-1): <NEW_LINE> <INDENT> b_orig = self.original_batch_idx[b] <NEW_LINE> self.scores[b_orig].append(self.topk_scores[b, 0]) <NEW_LINE> self.predictions[b_orig].append(self.alive...
Finalize scores and predictions.
625941e557b8e32f524838c0
def update_possible_solution(self): <NEW_LINE> <INDENT> for solution in self._positive_data: <NEW_LINE> <INDENT> if solution.is_in_possible_solution: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> solution.is_in_possible_solution = True <NEW_LINE> new_solution = solution.deep_copy() <NEW_LIN...
Search all of solutions in self._positive_data, add it to self._possible_solution_list if not exist.
625941e576d4e153a657ef55
def as_thumbnail(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return sorl_thumbnail.backend.get_thumbnail(self.file.file, "64x64", crop='center') <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> return self.file
convert to thumbnail
625941e53d592f4c4ed1d484
def user_login(): <NEW_LINE> <INDENT> pay_load = {"email": USER_INFORMATION['email'], "password": USER_INFORMATION['password']} <NEW_LINE> pay_load = json.dumps(pay_load) <NEW_LINE> r = requests.post(HOST_URL + "/v1/authenticate", pay_load) <NEW_LINE> if r.status_code == requests.codes.ok: <NEW_LINE> <INDENT> resp = r....
The login function that takes 'email' and 'password' from 'USER_INFORMATION' The call returns a token that is placed in USER_INFORMATION
625941e5d53ae8145f87a68a
def print_elapsed_time(t0): <NEW_LINE> <INDENT> elapsed_time = time.time() - t0 <NEW_LINE> if elapsed_time < 60: <NEW_LINE> <INDENT> print("{:2.1f} sec.".format(elapsed_time)) <NEW_LINE> <DEDENT> elif 60 < elapsed_time < 3600: <NEW_LINE> <INDENT> print("{:2.1f} min.".format(elapsed_time / 60)) <NEW_LINE> <DEDENT> else:...
Given a start time (time.time() object), computes and prints time elapsed since then. Keyword arguments ================= :param t0: output of time.time() Start time to compute elapsed time from (no default) :return: Pandas data frame concatenating all read files
625941e532920d7e50b285f6
def set_winner(candidateid, raceid): <NEW_LINE> <INDENT> import models <NEW_LINE> if candidateid: <NEW_LINE> <INDENT> r = models.OverrideRace.update(nyt_called=True).where( models.OverrideRace.race_unique_id==raceid ) <NEW_LINE> nc = models.OverrideCandidate .update(nyt_winner=False) .wher...
Handles setting a winner. Sets a race to called and a candidate as the winner and other candidates as not winners. If the candidateid is null, will reset the race to be uncalled and remove the previous winner.
625941e5097d151d1a22327a
def evaluate_refsample(self): <NEW_LINE> <INDENT> for refstring, bibcode in self.refmap.items(): <NEW_LINE> <INDENT> if self.resolver.make_bibcode(refstring) != bibcode: <NEW_LINE> <INDENT> print(refstring) <NEW_LINE> print(self.resolver.make_bibcode(refstring)) <NEW_LINE> print(bibcode) <NEW_LINE> print()
A convenience method to look at failed test cases. Rename to test_refsample() to use.
625941e53617ad0b5ed68319
def get_upcoming_events(): <NEW_LINE> <INDENT> redis_instance = app.extensions['redis']['REDIS'] <NEW_LINE> now_seconds = get_current_timestamp() <NEW_LINE> upcoming_events = redis_instance.zrangebyscore(app.config['REDIS_KEY_EVENT_START'], now_seconds, '+inf') <NEW_LINE> pipe = redis_instance.pipeline() <NEW_LINE> for...
Get events with start time in future sorted oldes first
625941e5379a373c97cfaf69
def parseCompare(node): <NEW_LINE> <INDENT> left=parse(node.left) <NEW_LINE> opMapping={ast.Lt:'<',ast.LtE:'<=',ast.Gt:'>',ast.GtE:'>=',ast.Eq:'==='} <NEW_LINE> ops=[opMapping[type(op)] for op in node.ops] <NEW_LINE> comparators=[parse(comp) for comp in node.comparators] <NEW_LINE> comps=[left]+comparators <NEW_LINE> g...
Notice python support 0<x<1 compare so...
625941e5046cf37aa974d166
@use_field_name_or_array('face') <NEW_LINE> def _calc_net_active_face_flux_at_cell(grid, unit_flux_at_faces, out=None): <NEW_LINE> <INDENT> if out is None: <NEW_LINE> <INDENT> out = grid.empty(at='cell') <NEW_LINE> <DEDENT> total_flux = unit_flux_at_faces * grid.width_of_face <NEW_LINE> out = np.zeros(grid.number_of_ce...
Calculate net face fluxes at cells, ignoring values on inactive faces. Given a flux per unit width across each face in the grid, calculate the net outflux (or influx, if negative) at each cell. Same as `_calc_net_face_flux_at_cell` except that flux values on inactive faces are ignored. Construction:: _calc_net_a...
625941e5d18da76e235328fd
def __init__(self, globalScope): <NEW_LINE> <INDENT> self.globalScope = globalScope
:type globalScope: GlobalScope
625941e5fb3f5b602dac3aba
def __rpow__(self, expr): <NEW_LINE> <INDENT> from supriya.tools import synthdeftools <NEW_LINE> return UGenMethodMixin._compute_binary_op( expr, self, synthdeftools.BinaryOperator.POWER, )
Raises `expr` to the power of ugen graph. .. container:: example **Example 1:** :: >>> expr = 1.5 >>> ugen_graph = ugentools.SinOsc.ar() >>> result = expr ** ugen_graph >>> result BinaryOpUGen.ar() :: >>> graph(result) # doctest: +SKIP .. doctest...
625941e58c3a8732951587e2
def right(self): <NEW_LINE> <INDENT> return self.x2
Get the rightmost coordinate. :return: Rightmost coordinate.
625941e55fdd1c0f98dc0658
def test_host_operation(): <NEW_LINE> <INDENT> db_manager = DatabaseManager() <NEW_LINE> start_length = db_manager.get_relation_length('host') <NEW_LINE> db_manager.operate_on_host_relation('INSERT', host='101.101.101.101:101', type='Crawler') <NEW_LINE> if db_manager.get_relation('host')[-1]['host'] == '101.101.101.10...
Test host relation basic operations. :return: None
625941e567a9b606de4a82d9
def get_service_dependencies_for(self, service): <NEW_LINE> <INDENT> dependants = self.get_calculation_dependants_for(service) <NEW_LINE> dependencies = self.get_calculation_dependencies_for(service) <NEW_LINE> return { "dependencies": dependencies.values(), "dependants": dependants.values(), }
Calculate the dependencies for the given service.
625941e5e5267d203edce0ba
def ListTemplates(self, headers=None, query_params=None, content_type="application/json"): <NEW_LINE> <INDENT> uri = self.client.base_url + "/templates" <NEW_LINE> resp = self.client.get(uri, None, headers, query_params, content_type) <NEW_LINE> try: <NEW_LINE> <INDENT> if resp.status_code == 200: <NEW_LINE> <INDENT> r...
List all the templates available to the ZeroRobot It is method for GET /templates
625941e5be7bc26dc91cda1b
def execute_cmd(self, host_to_ssh='', cmd_to_execute='', local_host=True): <NEW_LINE> <INDENT> cmd_status = False <NEW_LINE> if local_host: <NEW_LINE> <INDENT> ssh_cmd_execute = subprocess.Popen(['%s' % cmd_to_execute], shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) <NEW_LINE> <D...
This method ssh into the passwordless accessible host and execute any command :param host_to_ssh: Host Ip or FDN :param cmd_to_execute: Command to be executed in the host :param local_host: "True" if cmd_to_execute should be done on local host, else "False" :return: "True" if ssh and cmd execution is successful, else "...
625941e5f9cc0f698b140a1a
def crawllinks(url, linkpos, reps): <NEW_LINE> <INDENT> html = urllib.request.urlopen(url).read() <NEW_LINE> soup = BeautifulSoup(html, 'lxml') <NEW_LINE> tags = soup('a') <NEW_LINE> index = linkpos - 1 <NEW_LINE> new_url = tags[index]['href'] <NEW_LINE> reps -= 1 <NEW_LINE> return crawllinks(new_url, linkpos, reps) if...
Will crawl
625941e567a9b606de4a82da
def is_infinite(self): <NEW_LINE> <INDENT> return math.isinf(self)
Return True if the argument is either positive or negative infinity and False otherwise.
625941e5a05bb46b383ecc40
def print_sentence_to_conll(fout, tokens, labels): <NEW_LINE> <INDENT> for label_column in labels: <NEW_LINE> <INDENT> assert len(label_column) == len(tokens) <NEW_LINE> <DEDENT> for i in range(len(tokens)): <NEW_LINE> <INDENT> fout.write(tokens[i].ljust(15)) <NEW_LINE> for label_column in labels: <NEW_LINE> <INDENT> f...
Print a labeled sentence into CoNLL format. Args: fout: tokens: labels: Returns:
625941e5ab23a570cc2505a9
def add(self, **kwargs): <NEW_LINE> <INDENT> if 'delivery_number' not in kwargs: <NEW_LINE> <INDENT> kwargs['delivery_number'] = self.next_delivery_number( kwargs.get('municipality_id') ) <NEW_LINE> <DEDENT> scan_job = ScanJob(**kwargs) <NEW_LINE> self.session.add(scan_job) <NEW_LINE> self.session.flush() <NEW_LINE> re...
Adds a new scan job.
625941e5baa26c4b54cb153e
@frontend.route('/<subdir>', methods=['GET', 'POST']) <NEW_LINE> def show_subdir(subdir): <NEW_LINE> <INDENT> error_msg = None <NEW_LINE> report_dir = ReportDirectory(report_dir_path(subdir)) <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> action = request.args.get('action', '') <NEW_LINE> if action == 'upl...
Show all the reports in a subdirectory
625941e585dfad0860c3b27e
def test_endpointType(self): <NEW_LINE> <INDENT> self.assertIsInstance(self.makeEndpoint(), SSL4ClientEndpoint)
L{Agent._getEndpoint} return a L{SSL4ClientEndpoint} when passed a scheme of C{'https'}.
625941e550485f2cf553d1be
def is_root(): <NEW_LINE> <INDENT> return os.geteuid() == 0
Check that current process is running as `root`.
625941e5851cf427c661a92e
def test_tile_case_insensitive(self): <NEW_LINE> <INDENT> self.assertEqual( Word(string='ABC', valid_tiles=set(['C', 'Ab'])).tiles, ['Ab', 'C'], )
An unmatching tile's case appears in the tile list.
625941e566673b3332b924b4
def _aligned_o(o, ilen, alignment): <NEW_LINE> <INDENT> for i in range(ilen): <NEW_LINE> <INDENT> if (i, o) in alignment: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
A function that checks if a given 'english' word is aligned to any foreign word in a given foreign sentence
625941e51d351010ab855f3e
def open(self, uri: str): <NEW_LINE> <INDENT> self._spotify_iface.OpenUri(uri)
Plays the specified `uri` in spotify
625941e5b7558d58953c532e
def LengthLimit(n): <NEW_LINE> <INDENT> return SimpleValidator((), (lambda s: len(s)<=n,),)
A wxValidator that does not allow more than n characters
625941e55fcc89381b1e1ae4
def detach_disk(self, cloud_server_id, volume_name): <NEW_LINE> <INDENT> path = self._get_path("%s/detach/%s" % (str(cloud_server_id), volume_name)) <NEW_LINE> return self.post(path)
卸载云硬盘 cloud_server_id: 云主机id volume_name: 云硬盘名
625941e5ec188e330fd5abba
def get_recipe(self): <NEW_LINE> <INDENT> if self.exponent == 1: <NEW_LINE> <INDENT> return [(self.value_idx, self.dimension)], [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [], [(self.value_idx, self.dimension, self.exponent)]
for evaluation the input value has to be either copied or exponentiated :return: copy_recipe, scalar_recipe
625941e54f6381625f114e5f
def lookup(self, unit): <NEW_LINE> <INDENT> if not isinstance(unit, Id): <NEW_LINE> <INDENT> unit = unit.id <NEW_LINE> <DEDENT> return self.units[unit.idd]
lookup topology of a unit
625941e5004d5f362079a754
def setEditable(self): <NEW_LINE> <INDENT> return bool()
bool KSelectAction.setEditable()
625941e5a79ad161976cc568
def get_field_names(self, measurement): <NEW_LINE> <INDENT> fields = self.query_db('SHOW FIELD KEYS FROM %s' % measurement) <NEW_LINE> return [v['fieldKey'] for v in fields]
Get Field names (columns) for Measurement. :param measurement: :return list of field names:
625941e5796e427e537b09ec
def test_third_check_digit(self): <NEW_LINE> <INDENT> check_digit = generate_check_digit('09-01-28') <NEW_LINE> self.assertEqual(check_digit % 10, 0) <NEW_LINE> self.assertEqual(verify_check_digit(check_digit), True)
Tests digit for 09-01-28 (Payment example)
625941e54527f215b584c876
def count_gender(data_list): <NEW_LINE> <INDENT> male = 0 <NEW_LINE> female = 0 <NEW_LINE> male = column_to_list(data_list, -2).count('Male') <NEW_LINE> female = column_to_list(data_list, -2).count('Female') <NEW_LINE> return [male, female]
função que recebe uma lista como parametro, contabiliza e retornar o número de genero masculi e femenino da lista fazendo uso da função da tarefa anterior que retorna uma lista de lista de uma coluna
625941e57cff6e4e81117da9
def __iter_scaffolds(self, row: pd.Series, header: List[str]) -> None: <NEW_LINE> <INDENT> scaffold_name = row[0] <NEW_LINE> scaffold_size = int(row[1]) <NEW_LINE> num_bins = math.ceil(scaffold_size / 400) <NEW_LINE> final_bin_label = int((scaffold_size % 400) / 2) <NEW_LINE> if final_bin_label != 0: <NEW_LINE> <INDENT...
Given a scaffold, create bins and append to the bin dataframe.
625941e510dbd63aa1bd2fc5
def find_connectable_ip(host: Union[str, bytes, bytearray, None], port: Optional[int] = None) -> Optional[str]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> addrinfos = socket.getaddrinfo(host, None) <NEW_LINE> <DEDENT> except socket.gaierror: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> ip = None <NEW_LINE> for...
Resolve a hostname to an IP, preferring IPv4 addresses. We prefer IPv4 so that we don't change behavior from previous IPv4-only implementations, and because some drivers (e.g., FirefoxDriver) do not support IPv6 connections. If the optional port number is provided, only IPs that listen on the given port are considere...
625941e55fc7496912cc3da1
def reduceData(rootdir, names=None, channels=['sw','lw']): <NEW_LINE> <INDENT> from glob import glob as gb <NEW_LINE> from fifipy.fit import computeSpectra <NEW_LINE> from fifipy.calib import computeAllWaves <NEW_LINE> from fifipy.io import saveSlopeFits, readData <NEW_LINE> import numpy as np <NEW_LINE> import os <NEW...
Reduction of wavelength calibration data taken in the lab Parameters ---------- rootdir : TYPE string DESCRIPTION. directory where raw data exists Returns ------- None.
625941e56aa9bd52df0371ca
def __init__(self, name_space="", logger=None): <NEW_LINE> <INDENT> self.logger = logger <NEW_LINE> self._name_space = name_space <NEW_LINE> self._reload_key = "%s-reload-settings" % self._name_space <NEW_LINE> self._previous_state = {} <NEW_LINE> self._current_state = {} <NEW_LINE> self.__project_settings = None <NEW_...
Summary Parameters ---------- name_space : str, optional Description logger : None, optional Description
625941e5bde94217f3683210
def gatk_indel_cutoff(in_file, data): <NEW_LINE> <INDENT> filters = ["ReadPosRankSum < -20.0"] <NEW_LINE> variantcaller = utils.get_in(data, ("config", "algorithm", "variantcaller")) <NEW_LINE> if not (vcfutils.is_gvcf_file(in_file) and variantcaller in ["gatk-haplotype", "haplotyper"]): <NEW_LINE> <INDENT> filters += ...
Perform cutoff-based soft filtering on GATK indels using best-practice recommendations.
625941e5b5575c28eb68e427
def checkIfPrerequisite(self, n, prerequisites, queries): <NEW_LINE> <INDENT> graph = collections.defaultdict(list) <NEW_LINE> for u, v in prerequisites: <NEW_LINE> <INDENT> graph[u].append(v) <NEW_LINE> <DEDENT> memo = {} <NEW_LINE> def bfs(i): <NEW_LINE> <INDENT> if i in memo: <NEW_LINE> <INDENT> return memo[i] <NEW_...
:type n: int :type prerequisites: List[List[int]] :type queries: List[List[int]] :rtype: List[bool]
625941e5460517430c39459e
def load_from_json(self, filepath): <NEW_LINE> <INDENT> records_by_entry_lower = {} <NEW_LINE> inserted = [] <NEW_LINE> with open(filepath, 'r') as f: <NEW_LINE> <INDENT> data = json.load(f) <NEW_LINE> for entry_data in data.get('entries', []): <NEW_LINE> <INDENT> entry = entry_data['entry'] <NEW_LINE> entry_lower = en...
Load entries from json data in filepath (str). The file should contain data dumped by ``dump_to_json``. If you're trying to create fixtures, use a fixtures file handled by ``initialize``.
625941e5aad79263cf390e6a
def check_not_clicked(self): <NEW_LINE> <INDENT> if not self.player_hist_board[self.row][self.col - 10]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Check if the player clicked the square previously Args: self only Returns:True/False True means not clicked in the past. False means clicked.
625941e53eb6a72ae02ec90b
def variable_summaries(var, prefix): <NEW_LINE> <INDENT> with tf.name_scope(prefix): <NEW_LINE> <INDENT> mean = tf.reduce_mean(var) <NEW_LINE> tf.summary.scalar('mean', mean) <NEW_LINE> with tf.name_scope('stddev'): <NEW_LINE> <INDENT> stddev = tf.sqrt(tf.reduce_mean(tf.square(var - mean))) <NEW_LINE> <DEDENT> tf.summa...
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
625941e5fbf16365ca6f65f0
def store_json_data(data): <NEW_LINE> <INDENT> conn = get_connection() <NEW_LINE> conn.set('JSON_DATA', data)
Store the data in the cache for later use.
625941e5cb5e8a47e48b7ec7
def __init__(self, lvl, character): <NEW_LINE> <INDENT> riddle = riddlegen() <NEW_LINE> self.char = character <NEW_LINE> self.answer = riddle[0] <NEW_LINE> self.riddle = riddle[1] <NEW_LINE> self.riddleguess = 3 <NEW_LINE> riches = [] <NEW_LINE> while not riches: <NEW_LINE> <INDENT> treasure = pq_treasuregen(lvl + 2) <...
Initialize puzzle encounter based on dungeon level.
625941e566656f66f7cbc5d0
def evalDetectionStrictMatching(self, toponymsPredictedWoExcluded): <NEW_LINE> <INDENT> answer = Answer() <NEW_LINE> for topoPred in toponymsPredictedWoExcluded: <NEW_LINE> <INDENT> if topoPred.getStartOffset() in self.mapIndexesAnnotated: <NEW_LINE> <INDENT> annotation = self.mapIndexesAnnotated[ topoPred.getStartOffs...
Apply a strict matching to compute the TP, FP, FN given the toponyms references and toponyms predicted :param toponymsPredicted: the list of toponyms predicted by the system to compare against the toponyms of reference :return: an Answer containing the lists of ExcludedToponyms, TPs, FPs and FNs resulting from the comp...
625941e59b70327d1c4e11fa
def __len__(self): <NEW_LINE> <INDENT> return int(np.floor(len(self.trajectoryIndexes) / self.batch_size))
Denotes the number of batches per epoch
625941e5fb3f5b602dac3abb
def getNameElements(self, nameList): <NEW_LINE> <INDENT> elements = "" <NEW_LINE> for name in nameList: <NEW_LINE> <INDENT> if isinstance(name, types.StringType): <NEW_LINE> <INDENT> name = (self.defaultNameSpace, name) <NEW_LINE> <DEDENT> if not name[0]: <NEW_LINE> <INDENT> tag = name[1] <NEW_LINE> <DEDENT> else: <N...
@param nameList:
625941e5eab8aa0e5d26df7d
def reset(self): <NEW_LINE> <INDENT> self.points = 0 <NEW_LINE> self.round = 1 <NEW_LINE> self._reset_snake() <NEW_LINE> self._reset_fruit()
Reset environment to initial state
625941e54e696a04525c9871