code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _probe(info, path, init_path): <NEW_LINE> <INDENT> with tempfile.NamedTemporaryFile() as temp: <NEW_LINE> <INDENT> if init_path: <NEW_LINE> <INDENT> with open(init_path, 'rb') as init: <NEW_LINE> <INDENT> temp.write(init.read()) <NEW_LINE> <DEDENT> <DEDENT> with open(path, 'rb') as f: <NEW_LINE> <INDENT> temp.write...
Probes the given file to get the frame info. Args: info: The MediaInfo proto to put info into. path: The path to the input file to probe. init_path: If not None, the path to an init segment.
625941ddb5575c28eb68e323
def set_password(self, clave): <NEW_LINE> <INDENT> self.clave_hash = generate_password_hash(f"{clave}{self.salt}")
hash y guarda
625941dd462c4b4f79d1d9f1
def draw_score_board(self): <NEW_LINE> <INDENT> screen.delete("score") <NEW_LINE> player_score = 0 <NEW_LINE> computer_score = 0 <NEW_LINE> for x in range(8): <NEW_LINE> <INDENT> for y in range(8): <NEW_LINE> <INDENT> if self.array[x][y] == 0: <NEW_LINE> <INDENT> player_score += 1 <NEW_LINE> <DEDENT> elif self.array[x]...
METHOD: Draws scoreboard to screen :return:
625941dd0383005118ecf902
@pytest.yield_fixture() <NEW_LINE> def db(app): <NEW_LINE> <INDENT> if not database_exists(str(db_.engine.url)): <NEW_LINE> <INDENT> create_database(str(db_.engine.url)) <NEW_LINE> <DEDENT> db_.create_all() <NEW_LINE> yield db_ <NEW_LINE> db_.session.remove() <NEW_LINE> db_.drop_all()
Database fixture.
625941dd30bbd722463cc0ea
def logout_user(request): <NEW_LINE> <INDENT> logout(request) <NEW_LINE> form = UserForm(request.POST or None) <NEW_LINE> context = { "form": form, } <NEW_LINE> return render(request, 'task/login.html', context)
Logout a user
625941dddd821e528d63b4c8
def conv_forward_naive(x, w, b, conv_param): <NEW_LINE> <INDENT> out = None <NEW_LINE> N, C, H, W = x.shape <NEW_LINE> F, C, HH, WW = w.shape <NEW_LINE> stride, pad = conv_param['stride'], conv_param['pad'] <NEW_LINE> A = 1 + (H + 2 * pad - HH) // stride <NEW_LINE> B = 1 + (W + 2 * pad - WW) // stride <NEW_LINE> xpadde...
A naive implementation of the forward pass for a convolutional layer. The input consists of N data points, each with C channels, height H and width W. We convolve each input with F different filters, where each filter spans all C channels and has height HH and width HH. Input: - x: Input data of shape (N, C, H, W) - ...
625941ddd10714528d600007
@register.simple_tag <NEW_LINE> def render_filtered_args(model_admin,render_html=True): <NEW_LINE> <INDENT> if model_admin.filter_condtions: <NEW_LINE> <INDENT> ele = '' <NEW_LINE> for k,v in model_admin.filter_condtions.items(): <NEW_LINE> <INDENT> ele += '&%s=%s' %(k,v) <NEW_LINE> <DEDENT> if render_html: <NEW_LINE> ...
拼接筛选的字段
625941dd5fdd1c0f98dc0555
def rest_clear_vns_stats(self, vns=None): <NEW_LINE> <INDENT> t = test.Test() <NEW_LINE> c = t.controller('master') <NEW_LINE> if vns is None or vns is "all": <NEW_LINE> <INDENT> url = '/api/v1/data/controller/applications/bcf/info/statistic/segment-counter' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> url = '/api/v1/...
Function to clear the VNS stats Input: vns name Output: given vns counters will be cleared
625941dd9c8ee82313fbba97
def tower_loss_acc(scope, images, labels): <NEW_LINE> <INDENT> with tf.variable_scope("c3d_var") as c3d_scope: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> logits = c3d_model.inference_c3d(images, 0.5) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> c3d_scope.reuse_variables() <NEW_LINE> logits = c3d_model.i...
Calculate the total loss and accuracy on a single tower running the model. Args: scope: unique prefix string identifying the tower, e.g. 'tower_0' images: input images with shape [batch_size, sequence_length, height, width, channel] labels: label ground truth [batch_size] Returns: Tensor of shape []...
625941dd96565a6dacc8f9eb
def min(self): <NEW_LINE> <INDENT> least = self[0] <NEW_LINE> for i in self: <NEW_LINE> <INDENT> if i < least: <NEW_LINE> <INDENT> least = i <NEW_LINE> <DEDENT> <DEDENT> return least
Returns the minimum value in this list.
625941dd23e79379d52ee881
def _search_in_external_id(self, regexp): <NEW_LINE> <INDENT> if self.external_id: <NEW_LINE> <INDENT> match = re.search(regexp, self.external_id) <NEW_LINE> if match: <NEW_LINE> <INDENT> return match.group(CUSTOM_ATTRIBUTE) <NEW_LINE> <DEDENT> <DEDENT> return None
Find a sub-string in the entry's external id.
625941dd5fcc89381b1e19e1
def get_NCBI_ID(query:str='(PCNA[title] OR "proliferating cell nuclear antigen"[title]) AND "Homo Sapiens"[Organism] AND srcdb_refseq[PROP]')->str: <NEW_LINE> <INDENT> handle = Entrez.esearch(db='protein', term=query, retmode='xml', retmax=100000, sort='relevance') <NEW_LINE> res = Entrez.read(handle)['IdList'][0] <NEW...
Get an NCBI accession numer by a valid Entrez query
625941dd99fddb7c1c9de6b1
def eSet(self, *args, **kwargs): <NEW_LINE> <INDENT> return _VISHNU.Process_eSet(self, *args, **kwargs)
eSet(self, EInt _featureID, EJavaObject _newValue)
625941ddcad5886f8bd272fa
def __init__(self, settings, executor): <NEW_LINE> <INDENT> self.process = None <NEW_LINE> self.settings = settings <NEW_LINE> self.required_tools = [] <NEW_LINE> self.executor = executor <NEW_LINE> self.scenario = executor.scenario <NEW_LINE> self.load = executor.get_load() <NEW_LINE> self.script = self.settings.get("...
:type settings: dict :type executor: SeleniumExecutor
625941dd24f1403a92600e85
def confidence_at_time(self, frame_number, n = 1): <NEW_LINE> <INDENT> return float(sorted(self.confidence_history[frame_number])[-n])
class label of nth best guess at a point in time.
625941dd30c21e258bdfa7c0
def comment_parse(comment, comments, task_id=None): <NEW_LINE> <INDENT> author = B(T("Anonymous")) <NEW_LINE> if comment.created_by: <NEW_LINE> <INDENT> utable = s3db.auth_user <NEW_LINE> ptable = s3db.pr_person <NEW_LINE> ltable = s3db.pr_person_user <NEW_LINE> query = (utable.id == comment.created_by) <NEW_LINE> left...
Parse a Comment @param: comment - a gluon.sql.Row: the current comment @param: comments - a gluon.sql.Rows: full list of comments @param: task_id - a reference ID: optional task commented on
625941ddb545ff76a8914136
def new_process(self,job_info): <NEW_LINE> <INDENT> self.job_scheduling_queue.add(Process(**job_info)) <NEW_LINE> print(self.job_scheduling_queue)
New process entering system gets placed on the 'job_scheduling_queue'. - **Args**: - job_info (dict): Contains new job information. - **Returns**: - None
625941dd7b25080760e39779
@utils.arg('--limit', metavar='<NUMBER>', default=20, help='Page limit') <NEW_LINE> @utils.arg('--offset', metavar='<OFFSET>', help='Page offset') <NEW_LINE> @utils.arg('--order-by', metavar='<ORDER_BY>', help='Name of fields order by') <NEW_LINE> @utils.arg('--order', metavar='<ORDER>', choices=['desc', 'asc'], help='...
List all ZoneQuota
625941dd3617ad0b5ed68217
def mayChangeItemsOrder(): <NEW_LINE> <INDENT> pass
May one change order of my list of items ?
625941ddac7a0e7691ed43e8
def _do_db_cleanup(): <NEW_LINE> <INDENT> if DBDRIVER in ["psycopg2", "pgdb"]: <NEW_LINE> <INDENT> server = BioSeqDatabase.open_database(driver=DBDRIVER, host=DBHOST, user=DBUSER, passwd=DBPASSWD, db=TESTDB) <NEW_LINE> server.adaptor.cursor.execute("COMMIT") <NEW_LINE> time.sleep(1) <NEW_LINE> sql = r"DROP OWNED BY " +...
Cleanup everything from TESTDB. Relevant for MySQL and PostgreSQL.
625941dd507cdc57c6307002
def get_resource_pixbuf(*path_list): <NEW_LINE> <INDENT> return get_pixbuf(get_resource(keepnote.IMAGE_DIR, *path_list))
Returns cached pixbuf from resource path
625941dd63f4b57ef0001432
def __setitem__(self, name, value): <NEW_LINE> <INDENT> priority = self.pyre_nameserver.priority.explicit() <NEW_LINE> locator = tracking.here(-1) <NEW_LINE> return self.insert(name=name, value=value, priority=priority, locator=locator)
Store {value} in the map under {name}
625941ddab23a570cc2504a6
def print_first_word_func(words): <NEW_LINE> <INDENT> word = words.pop(0) <NEW_LINE> print(word)
Prints the first word after popping it off.
625941dd50485f2cf553d0bc
def triggerPullDown(self, side=None): <NEW_LINE> <INDENT> return None
Stuff goes here to trigger the pull down servo to pull the toat down, which side right? left? who knows
625941ddb545ff76a8914137
def train_top_model(): <NEW_LINE> <INDENT> train_data = np.load('train.npy') <NEW_LINE> validation_data = np.load('validation.npy') <NEW_LINE> train_labels = initialise_labels(nb_train_samples,train_data_dir) <NEW_LINE> train_unique, train_counts = np.unique(train_labels, return_counts=True) <NEW_LINE> validation_label...
Creates a top model or classifier that contains the fully connected layers to train the weights with the training and validation data and their respective categories. Saves the model in an external h5 file for testing in test_model.py.
625941dd85dfad0860c3b17d
def advance(self, *args, **kwargs): <NEW_LINE> <INDENT> return _gnuradio_core_hier.SwigPyIterator_advance(self, *args, **kwargs)
advance(self, ptrdiff_t n) -> SwigPyIterator
625941dde8904600ed9f2252
def get_queues_on_vhost(self, vhost='%2F'): <NEW_LINE> <INDENT> return json.loads(self._get('/queues/' + self._quote_vhost(vhost)))
List of queues for the virtual host. *Args:* _vhost_ -the name of the virtual host (recoded using urllib.parse.quote)
625941dd507cdc57c6307003
def __init__(self, first_name: str=None, last_name: str=None, username: str=None, date_of_birth: date=None, last_time_online: datetime=None, avatar_base64_png: ByteArray=None): <NEW_LINE> <INDENT> self.swagger_types = { 'first_name': str, 'last_name': str, 'username': str, 'date_of_birth': date, 'last_time_online': dat...
Person - a model defined in Swagger :param first_name: The first_name of this Person. # noqa: E501 :type first_name: str :param last_name: The last_name of this Person. # noqa: E501 :type last_name: str :param username: The username of this Person. # noqa: E501 :type username: str :param date_of_birth: The date_of_...
625941ddadb09d7d5db6caaf
def lookup(self, key, partial=True): <NEW_LINE> <INDENT> if hasattr(self.keychain, "iterkeys"): <NEW_LINE> <INDENT> iterator = self.keychain.iterkeys <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> iterator = self.keychain.keys <NEW_LINE> <DEDENT> for k in iterator(): <NEW_LINE> <INDENT> if key == k or (partial and k.sta...
Lookup key in keychain. Args: key (str): Key to lookup. Yields: str: Yields exact key(s) if found.
625941dd7047854f462a1727
def custom_deeper(game, player): <NEW_LINE> <INDENT> if game.is_loser(player): <NEW_LINE> <INDENT> return float("-inf") <NEW_LINE> <DEDENT> if game.is_winner(player): <NEW_LINE> <INDENT> return float("inf") <NEW_LINE> <DEDENT> own_moves = game.get_legal_moves(player) <NEW_LINE> own_score = 0 <NEW_LINE> for move in own_...
Takes the improved heuristic from class one level deeper by calculating number of possible moves next turn for each possible move
625941dd3617ad0b5ed68218
def __len__(self): <NEW_LINE> <INDENT> return len(self.variable_names)
python.org: Called to implement the built-in function len(). :return: (int) Number of database instance attributes :since: v2.1.0
625941dd96565a6dacc8f9ec
def readRatings(f,sparkContext): <NEW_LINE> <INDENT> return sparkContext.textFile(f).map(lambda x: tuple(x.split(','))).map(lambda inp: (int(inp[0]),int(inp[1]),float(inp[2])))
Read the ratings from a file and store them in an rdd containing tuples of the form: (i,j,rij) where i,j are integers and rij is a floating number. Inputs are: -f: The name of a file that contains the ratings, in form: i,j,rij per line -sparContext: A Spark context The return value ...
625941ddb57a9660fec33baa
def __init__(self, file_name: str, target_items: dict): <NEW_LINE> <INDENT> target_items.update({"Global": (0, 0)}) <NEW_LINE> file_name = os.path.basename(file_name) <NEW_LINE> if ".xml" not in file_name: <NEW_LINE> <INDENT> file_name += ".xml" <NEW_LINE> <DEDENT> if "Default.xml" in file_name or file_name == "default...
Initializes the class by reading the XML file and setting things up for access by the user :param file_name: a GUI profile file_name, either an absolute path or a plain file_name :param target_items: Dictionary with GUI elements as keys and size tuples as values
625941dd4f6381625f114d5d
def test_init(self): <NEW_LINE> <INDENT> nodeA = Node(1, 5, 10) <NEW_LINE> nodeB = Node(2, 6, 8) <NEW_LINE> edge = Edge(nodeA, nodeB) <NEW_LINE> self.assertIs(nodeA, edge.getNodeA()) <NEW_LINE> self.assertIs(nodeB, edge.getNodeB()) <NEW_LINE> self.assertFalse(edge.isDirected()) <NEW_LINE> self.assertFalse(edge.isDirect...
Test du __init__
625941ddec188e330fd5aabb
def cmp_funks( f1: F, f2: F, runs: int, *args, **kwargs ) -> Dict[str, Union[str, float, int]]: <NEW_LINE> <INDENT> f1_time = 0 <NEW_LINE> f2_time = 0 <NEW_LINE> for i in range(runs): <NEW_LINE> <INDENT> r1, f1t = time_funk(f1, *args, **kwargs) <NEW_LINE> f1_time += f1t <NEW_LINE> r2, f2t = time_funk(f2, *args, **kwarg...
:param f1: :param f2: :param runs: :param args: :param kwargs: :return:
625941dd7047854f462a1728
def validate_all( bids_paths, regex_schema, debug=False, ): <NEW_LINE> <INDENT> tracking_schema = deepcopy(regex_schema) <NEW_LINE> paths_list = _get_paths(bids_paths) <NEW_LINE> tracking_paths = deepcopy(paths_list) <NEW_LINE> if debug: <NEW_LINE> <INDENT> itemwise_results = [] <NEW_LINE> <DEDENT> matched = False <NEW...
Validate `bids_paths` based on a `regex_schema` dictionary list, including regexes. Parameters ---------- bids_paths : list or str A string pointing to a BIDS directory for which paths should be validated. regex_schema : list of dict A list of dictionaries as generated by `load_all()`. debug : tuple, optional ...
625941ddd268445f265b5190
def __init__(self): <NEW_LINE> <INDENT> Meal.__init__(self, 'sandwich', 'gin and tonic') <NEW_LINE> self.setName('midday meal')
Initialize wiht a sandwich and a gin and tonic.
625941dd1b99ca400220add4
def _get_color_clip(drawable, clip_percent_black, clip_percent_white): <NEW_LINE> <INDENT> if isinstance(drawable, gimp.Channel): <NEW_LINE> <INDENT> histogram_channel = gimpenums.HISTOGRAM_VALUE <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> histogram_channel = HISTOGRAM_RGB <NEW_LINE> <DEDENT> min_point = 0 <NEW_LINE>...
Determine the black and white points based on the specified clip percentages. For layers and layer groups, use the RGB pseudo-channel of the histogram. For channels and layer masks, use the value channel of the histogram.
625941dd07d97122c4178bb3
def _get_name(self): <NEW_LINE> <INDENT> return self.__name
Getter method for name, mapped from YANG variable /network_instances/network_instance/protocols/protocol/name (leafref) YANG Description: An operator-assigned identifier for the routing or forwarding protocol. For some processes this leaf may be system defined.
625941dd656771135c3ebb94
def render_list_as_hex(self, data): <NEW_LINE> <INDENT> s = '[ ' <NEW_LINE> for c in data: <NEW_LINE> <INDENT> s += '%02x ' % c <NEW_LINE> <DEDENT> s += ']' <NEW_LINE> return s
Convert a list to hex
625941dda8370b7717052bc0
def super_punch(self, player_list): <NEW_LINE> <INDENT> if self.super_punch_state: <NEW_LINE> <INDENT> if time.time()*1000 - self.initial_punch < 200: <NEW_LINE> <INDENT> for player in player_list: <NEW_LINE> <INDENT> if self.facing_right: <NEW_LINE> <INDENT> player.movex = 3 <NEW_LINE> <DEDENT> if not self.facing_righ...
Activate the super punch
625941dd82261d6c526ab7c5
def generateDisplayText(self, title, artist, year, learned): <NEW_LINE> <INDENT> if learned == "n": <NEW_LINE> <INDENT> display_text = "{} by {} ({}) (Learned)".format(title, artist, year) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> display_text = "{} by {} ({})".format(title, artist, year) <NEW_LINE> <DEDENT> return...
Formating text display in the message
625941dd6fb2d068a760f3c3
def radiationExposure(start, stop, step): <NEW_LINE> <INDENT> amount = 0 <NEW_LINE> while start < stop: <NEW_LINE> <INDENT> amount += f(start)*step <NEW_LINE> start += step <NEW_LINE> <DEDENT> return amount
Computes and returns the amount of radiation exposed to between the start and stop times. Calls the function f (defined for you in the grading script) to obtain the value of the function at any point. start: integer, the time at which exposure begins stop: integer, the time at which exposure ends step: float, the wid...
625941dd236d856c2ad44b00
def test_properties_stats_get(self): <NEW_LINE> <INDENT> pass
Test case for properties_stats_get Statistiques sur les biens
625941ddff9c53063f47c514
def lengthOfLongestSubstring(self, s): <NEW_LINE> <INDENT> if len(s) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> letter_positions = dict() <NEW_LINE> intervals = [] <NEW_LINE> for ind, letter in enumerate(s): <NEW_LINE> <INDENT> if letter not in letter_positions: <NEW_LINE> <INDENT> letter_positions[letter] ...
:type s: str :rtype: int
625941dd50485f2cf553d0bd
def macro_china_pmi_yearly(): <NEW_LINE> <INDENT> t = time.time() <NEW_LINE> res = requests.get( JS_CHINA_PMI_YEARLY_URL.format( str(int(round(t * 1000))), str(int(round(t * 1000)) + 90) ) ) <NEW_LINE> json_data = json.loads(res.text[res.text.find("{") : res.text.rfind("}") + 1]) <NEW_LINE> date_list = [item["date"] fo...
中国年度PMI数据, 数据区间从20050201-至今 https://datacenter.jin10.com/reportType/dc_chinese_manufacturing_pmi https://cdn.jin10.com/dc/reports/dc_chinese_manufacturing_pmi_all.js?v=1578817858 :return: pandas.Series
625941ddaad79263cf390d67
def get_alignment(self): <NEW_LINE> <INDENT> i, j = self._sequence_length_2, self._sequence_length_1 <NEW_LINE> while self._traceback[(i, j)]: <NEW_LINE> <INDENT> self._seq_pos_1.append(j-1) <NEW_LINE> self._seq_pos_2.append(i-1) <NEW_LINE> i, j = self._traceback[(i, j)] <NEW_LINE> <DEDENT> self._alignment: str = self....
Reconstructs the tracback an formats the output Starts with the last entry of self._matrix While the tracback has not reached (0, 0) each position is added to a list. After calling the self._format_alignment() method the method returns a formatted string, representing the alignment.
625941dda219f33f34628c88
def __set__(self, instance, value): <NEW_LINE> <INDENT> raise NotImplementedError
Should validate then set.
625941dd9f2886367277abad
def test_region_file_invalid(tmp_path): <NEW_LINE> <INDENT> f = tmp_path / 'src.reg' <NEW_LINE> f.write_text(region_string) <NEW_LINE> with pytest.raises(ValueError) as exc: <NEW_LINE> <INDENT> Region(str(f), True) <NEW_LINE> <DEDENT> emsg = 'unable to read region from: {}'.format(f) <NEW_LINE> assert str(exc.value) ==...
What happens if the file is invalid. Note that the file parser apparently fails if there are spaces, so I use region_string here in case the parser ever gets improved, in which case this test will need a new invalid file.
625941ddd8ef3951e3243860
def get_header_buttons(self, obj=None, context=None): <NEW_LINE> <INDENT> from django.urls.exceptions import NoReverseMatch <NEW_LINE> context = context if context else {} <NEW_LINE> header_buttons = self.header_buttons if self.header_buttons else [] <NEW_LINE> def url_reverse(url): <NEW_LINE> <INDENT> kwargs_list = [ ...
Get header buttons for given page and object
625941dd44b2445a339323b6
def setPolyModelParameters(self, i, param): <NEW_LINE> <INDENT> param_name = param.name <NEW_LINE> if '[' in param.name: <NEW_LINE> <INDENT> if self.current_shell_displayed == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for ishell in range(1, self.current_shell_displayed+1): <NEW_LINE> <...
Standard of multishell poly parameter driver
625941dd377c676e912724c9
def join_path(path_list): <NEW_LINE> <INDENT> relpath = '/'.join(path_list) <NEW_LINE> if relpath == '': <NEW_LINE> <INDENT> return relpath <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> relpath = re.sub('^/','',relpath) <NEW_LINE> <DEDENT> return relpath
将传过来的列表拼接成相对路径 :param path_list: 需要拼接的路径 :return:
625941ddf548e778e58cd8a1
def hasCycle(self, head): <NEW_LINE> <INDENT> if head is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> while head and head.next: <NEW_LINE> <INDENT> temp = head.next <NEW_LINE> while temp: <NEW_LINE> <INDENT> if head == list: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> tem...
:type head: ListNode :rtype: bool
625941dd32920d7e50b284f5
def find_net_using_name(net_name): <NEW_LINE> <INDENT> net_filename = "networks." + net_name + "_net" <NEW_LINE> netlib = importlib.import_module(net_filename) <NEW_LINE> net = None <NEW_LINE> target_net_name = net_name.replace('_', '') + 'net' <NEW_LINE> for name, cls in netlib.__dict__.items(): <NEW_LINE> <INDENT> if...
Import the module "networks/[net_name]_net.py". In the file, the class called DatasetNameNet() will be instantiated. It has to be a subclass of BaseNet, and it is case-insensitive.
625941dddd821e528d63b4c9
def join(self, right, **kwargs): <NEW_LINE> <INDENT> on = kwargs.get("on", None) <NEW_LINE> how = kwargs.get("how", "left") <NEW_LINE> sort = kwargs.get("sort", False) <NEW_LINE> if how in ["left", "inner"]: <NEW_LINE> <INDENT> right = right.to_pandas() <NEW_LINE> def map_func(left, right=right, kwargs=kwargs): <NEW_LI...
Join columns of another DataFrame. Parameters ---------- right : BaseQueryCompiler The query compiler of the right DataFrame to join with. Returns ------- BaseQueryCompiler A new query compiler that contains result of the join. Notes ----- See pd.DataFrame.join for more info on kwargs.
625941dd30dc7b7665901c85
def detection_loss(cls_outputs, box_outputs, labels, params): <NEW_LINE> <INDENT> num_positives_sum = tf.reduce_sum(labels['mean_num_positives']) + 1.0 <NEW_LINE> levels = cls_outputs.keys() <NEW_LINE> cls_losses = [] <NEW_LINE> box_losses = [] <NEW_LINE> for level in levels: <NEW_LINE> <INDENT> cls_targets_at_level = ...
Computes total detection loss. Computes total detection loss including box and class loss from all levels. Args: cls_outputs: an OrderDict with keys representing levels and values representing logits in [batch_size, height, width, num_anchors]. box_outputs: an OrderDict with keys representing levels and values...
625941dd3c8af77a43ae3ac5
def verify_content_type_and_params(required_keys, optional_keys): <NEW_LINE> <INDENT> def decorator(view): <NEW_LINE> <INDENT> @wraps(view) <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> if request.headers.get("Content-Type", None) != "application/json": <NEW_LINE> <INDENT> utils.log("invalid content type...
Decorator enforcing content type and body keys in an endpoint.
625941dddc8b845886cb5858
def version(): <NEW_LINE> <INDENT> print("\r\n \033[1;31m[ cupp.py ] " + __version__ + "\033[1;m\r\n") <NEW_LINE> print(" * Hacked up by Mr. Bee https://github.com/bhikandeshmukh") <NEW_LINE> print(" Take a look ./README.md file for more info about the program\r\n")
Display version
625941dd3346ee7daa2b3090
def test_private_modify_bad_executor(job): <NEW_LINE> <INDENT> exc = pytest.raises(TypeError, job._modify, executor=1) <NEW_LINE> assert str(exc.value) == 'executor must be a string'
Tests that passing an executor of the wrong type raises a TypeError.
625941dd21a7993f00bc8017
def print_epg_encap_missing(concrete_dictionary): <NEW_LINE> <INDENT> for dn,node_ids in concrete_dictionary.iteritems(): <NEW_LINE> <INDENT> logger.debug("DN: {}".format(dn)) <NEW_LINE> logger.debug("Nodes: {}".format(node_ids)) <NEW_LINE> logger.debug("#" * 25)
test print function during debugging
625941dd5f7d997b87174dbd
def log_raise_exception(excont): <NEW_LINE> <INDENT> is_filelog = False <NEW_LINE> for h in logging.getLogger().handlers: <NEW_LINE> <INDENT> fno = getattr(getattr(h, 'stream', None), 'fileno', None) <NEW_LINE> if fno and not os.isatty(fno()): <NEW_LINE> <INDENT> is_filelog = True <NEW_LINE> <DEDENT> <DEDENT> exc = sys...
top-level exception handler Try to some fancy things to cover up we face with an error. Translate some weird sounding but well understood exceptions into human-friendly lingo
625941ddad47b63b2c50a2a0
def test_create_title(self): <NEW_LINE> <INDENT> url = reverse('titleList') <NEW_LINE> data = {'value': 'Foobar', 'font': 'comic'} <NEW_LINE> response = self.client.post(url, data, format='json') <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_201_CREATED) <NEW_LINE> self.assertEqual(Title.objects.count()...
testing POST title name
625941ddeab8aa0e5d26de7b
def internal_link_density(self, node_list): <NEW_LINE> <INDENT> N = len(node_list) <NEW_LINE> n_links = self.number_internal_links(node_list) <NEW_LINE> if self.directed: <NEW_LINE> <INDENT> return float(n_links) / (N * (N - 1)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 2 * float(n_links) / (N * (N - 1))
Return the density of links within an induced subnetwork. **Examples:** >>> r(InteractingNetworks.SmallTestNetwork(). internal_link_density([0,3,5])) 0.6667 >>> r(InteractingNetworks.SmallTestNetwork(). internal_link_density([1,2,3,4])) 0.6667 :arg [int] node_list: list of node indices ...
625941ddbf627c535bc134f1
def set_position(self, top_left, bottom_right): <NEW_LINE> <INDENT> self.top_left = top_left <NEW_LINE> self.bottom_right = bottom_right <NEW_LINE> self.button_height = bottom_right[1] - top_left[1] <NEW_LINE> self.button_width = bottom_right[0] - top_left[0]
Set position of the button
625941dd8c0ade5d55d3ecdf
def by_host(host=None, id_only=False, recursion=False): <NEW_LINE> <INDENT> site = None <NEW_LINE> if not host: <NEW_LINE> <INDENT> request = get_current_request() <NEW_LINE> if request: <NEW_LINE> <INDENT> if hasattr(request, 'site'): <NEW_LINE> <INDENT> if not isinstance(request.site, Site): <NEW_LINE> <INDENT> retur...
Get the current site by looking at the request stored in the thread. Returns the best match found in the `django.contrib.sites` app. If not found, then returns the default set as given in `settings.SITE_ID` Params: - `host`: optional, host to look up - `id_only`: if true, then do not retrieve the full site, just t...
625941ddbde94217f3683110
def simplifyMultipleEnharmonics(pitches, criterion=_dissonanceScore, keyContext=None): <NEW_LINE> <INDENT> oldPitches = [p if isinstance(p, Pitch) else Pitch(p) for p in pitches] <NEW_LINE> if keyContext: <NEW_LINE> <INDENT> oldPitches = [keyContext.asKey('major').tonic] + oldPitches <NEW_LINE> remove_first = True <NEW...
Tries to simplify the enharmonic spelling of a list of pitches, pitch- or pitch-class numbers according to a given criterion. A function can be passed as an argument to `criterion`, that is tried to be minimized in a greedy left-to-right fashion. >>> pitch.simplifyMultipleEnharmonics([11, 3, 6]) [<music21.pitch.Pitch...
625941ddc432627299f04f6a
def get_rmw_implementations(): <NEW_LINE> <INDENT> if __rmw_implementations is None: <NEW_LINE> <INDENT> reload_rmw_implementations() <NEW_LINE> <DEDENT> return __rmw_implementations
Return a list of available rmw implementations by name.
625941ddc4546d3d9de72d59
def add_initiated_action(self, action_id): <NEW_LINE> <INDENT> if not self.initiated_actions: <NEW_LINE> <INDENT> self.initiated_actions = ActionReferenceList() <NEW_LINE> <DEDENT> self.initiated_actions.append(action_id)
Add an initiated Action to the Process Tree node, based on its ID.
625941dde8904600ed9f2253
def scrape_api(self,object_type,p,g): <NEW_LINE> <INDENT> import time <NEW_LINE> from sqlalchemy.exc import IntegrityError <NEW_LINE> lr = self.init_log_rate(1000) <NEW_LINE> extant = set([row.id for row in p.rows]) <NEW_LINE> with p.inserter(cache_size = 1) as ins: <NEW_LINE> <INDENT> for idn, object_id, url, response...
Run the json generator and store the json records in the database.
625941dda4f1c619b28b0355
def test_bad_activation(self): <NEW_LINE> <INDENT> response = self.client.get('/user/confirm/THIS_IS_NO_MD5') <NEW_LINE> self.assertEqual(response.status_code, 404)
GET with a bad activation key
625941dd925a0f43d254a19c
def peakdelta(v, delta, x=None): <NEW_LINE> <INDENT> maxtab = [] <NEW_LINE> mintab = [] <NEW_LINE> if x is None: <NEW_LINE> <INDENT> x = arange(len(v)) <NEW_LINE> <DEDENT> v = asarray(v) <NEW_LINE> if len(v) != len(x): <NEW_LINE> <INDENT> sys.exit('Input vectors v and x must have same length') <NEW_LINE> <DEDENT> if no...
Returns two arrays function [maxtab, mintab]=peakdelta(v, delta, x) %PEAKDET Detect peaks in a vector % [MAXTAB, MINTAB] = peakdelta(V, DELTA) finds the local % maxima and minima ("peaks") in the vector V. % MAXTAB and MINTAB consists of two columns. Column 1 % contains indices in V, and co...
625941dd3cc13d1c6d3c769b
def add_child(self, child_element_tree): <NEW_LINE> <INDENT> child_node = Node(child_element_tree) <NEW_LINE> self.node_list.append(child_node) <NEW_LINE> return child_node
Add a child node to a node list. :param child_element_tree: a node to add as a child. :type child_element_tree: ElementTree :return: Node
625941dd2ae34c7f2600d453
def set_ConsumerSecret(self, value): <NEW_LINE> <INDENT> super(GetMembersInputSet, self)._set_input('ConsumerSecret', value)
Set the value of the ConsumerSecret input for this Choreo. ((required, string) The API Secret (or Consumer Secret) provided by Twitter.)
625941dd4428ac0f6e5bab17
def function(self, args, body): <NEW_LINE> <INDENT> return GnuplotFunction(self.vars, args, body)
Return a function that can be bound to a name in Gnuplot :param args: :type: `iterable of str` Arguments specificatition of the funtion :param body: :type: `str` Body of the function :returns: An unbound GnuplotFunction
625941dd8e71fb1e9831daca
def run_full_tests(version = 3, result_file_name = '/tmp/result-nc3.csv', nb_runs = 50, transform = True): <NEW_LINE> <INDENT> TO_CLEAN = False <NEW_LINE> ROOT_TEMP_DIR = "/tmp/scaled-comp-tempo" <NEW_LINE> if TO_CLEAN: <NEW_LINE> <INDENT> eumetsat.common.utils.delete_all_under(ROOT_TEMP_DIR) <NEW_LINE> <DEDENT> digits...
run the complete tests
625941dd23849d37ff7b33af
def build(self, **kwargs): <NEW_LINE> <INDENT> self.lexer = lex.lex(object=self, **kwargs)
Builds the lexer from the specification. Must be called after the lexer object is created. This method exists separately, because the PLY manual warns against calling lex.lex inside __init__
625941dde5267d203edcdfbc
def _build_assertion_error_message(self): <NEW_LINE> <INDENT> ASSERTION_ERROR_MESSAGE = "Could infer some unexpected facts:\n\n {0}" <NEW_LINE> unexpected_facts_graph = get_empty_graph() <NEW_LINE> for triple in self.unexpected_inferred_facts: <NEW_LINE> <INDENT> unexpected_facts_graph.add(triple) <NEW_LINE> <DEDENT> ...
Method that builds the AssertionError message. All expected and not inferred facts are built in a ``RDFlib.Graphh`` object and then serialized in NT format.
625941dd23849d37ff7b33b0
def custom_locale_negotiator(request): <NEW_LINE> <INDENT> name = '_LOCALE_' <NEW_LINE> locale_name = getattr(request, name, None) or request.params.get(name) or request.cookies.get(name) <NEW_LINE> if locale_name is None: <NEW_LINE> <INDENT> default_locale = request.registry.settings.get('pyramid.default_locale_name',...
Determine the locale from the request object, a URL param, cookies, or the browser's Accept-Language header Fall back to pyramid.default_local_name setting
625941dd73bcbd0ca4b2c399
@pytest.fixture(autouse=True) <NEW_LINE> def mock_get_source_ip(): <NEW_LINE> <INDENT> with patch( "homeassistant.components.network.util.async_get_source_ip", return_value="10.10.10.10", ): <NEW_LINE> <INDENT> yield
Mock network util's async_get_source_ip.
625941ddf7d966606f6aa32b
def __getitem__(self, item: tuple) -> float: <NEW_LINE> <INDENT> (row_key, col_key) = item <NEW_LINE> return self.elements[self.row_keys[row_key], self.column_keys[col_key]]
:param item: (row_key, col_key) :return:
625941dd16aa5153ce36279a
def get_status_code(self): <NEW_LINE> <INDENT> return self._status
Gets the HTTP status string like "200 OK" Returns: self
625941dd91af0d3eaac9bd3e
def random_crop(image, size, seed=0, seed2=0, name=None): <NEW_LINE> <INDENT> _ctx = _context._context <NEW_LINE> if _ctx is None or not _ctx._eager_context.is_eager: <NEW_LINE> <INDENT> if seed is None: <NEW_LINE> <INDENT> seed = 0 <NEW_LINE> <DEDENT> seed = _execute.make_int(seed, "seed") <NEW_LINE> if seed2 is None:...
Randomly crop `image`. `size` is a 1-D int64 tensor with 2 elements representing the crop height and width. The values must be non negative. This Op picks a random location in `image` and crops a `height` by `width` rectangle from that location. The random location is picked so the cropped area will fit inside the ...
625941dd6fb2d068a760f3c4
@bokeh_app.route("/bokeh/bb/<docid>/<typename>/<id>/", methods=['GET', 'OPTIONS']) <NEW_LINE> def _handle_specific_model_get(docid, typename, id): <NEW_LINE> <INDENT> return _handle_specific_model(docid, typename, id, request.method)
Retrieve a specific model with a given id and typename for a given :class:`Document <bokeh.document.Document>`. :param docid: id of the :class:`Document <bokeh.document.Document>` to update or insert into :param typename: the type of objects to find and return :param id: unique id of the object to retrieve :statu...
625941ddfb3f5b602dac39b9
def test_missing_params(self): <NEW_LINE> <INDENT> url = reverse('bulk_beta_modify_access', kwargs={'course_id': text_type(self.course.id)}) <NEW_LINE> response = self.client.post(url) <NEW_LINE> self.assertEqual(response.status_code, 400)
Test missing all query parameters.
625941dd07f4c71912b117a7
def manage_existing_snapshot_get_size(self, snapshot, existing_ref): <NEW_LINE> <INDENT> pass
Return size of snapshot to be managed by manage_existing. When calculating the size, round up to the next GB. :param snapshot: The snapshot to manage. :param existing_ref: Dictionary with keys 'source-id', 'source-name' with driver-specific values to identify a backend storag...
625941dda17c0f6771cbe372
def execute_session(self, to_execute): <NEW_LINE> <INDENT> if self._execution_count is None: <NEW_LINE> <INDENT> self._execution_count = 0 <NEW_LINE> <DEDENT> to_return = self.db_session.execute(to_execute) <NEW_LINE> self._execution_count += 1 <NEW_LINE> return to_return
Execute the given query and return the SQLAlchemy response. :param to_execute: The query to execute. :return: A SQLAlchemy result mapper.
625941dd796e427e537b08ea
def rcp2json(o): <NEW_LINE> <INDENT> geom = {"type": "Point", "coordinates": geo2coordinates(o.rcpuid)} <NEW_LINE> prop = dict() <NEW_LINE> if o.ahpuid: <NEW_LINE> <INDENT> prop = addfield(prop, getfield(o.ahpuid, 'codeid', 'codeicao')) <NEW_LINE> <DEDENT> if o.rwyuid: <NEW_LINE> <INDENT> prop = addfield(prop, getfield...
Runway Center line Position
625941ddf548e778e58cd8a2
def __init__(self, tau, stop, nbrCPUs, scheduler, abortAndRestart, verbose=False, drawing=True): <NEW_LINE> <INDENT> self.verbose = verbose <NEW_LINE> self.system = tau <NEW_LINE> self.m = nbrCPUs <NEW_LINE> self.AR = abortAndRestart <NEW_LINE> if stop is None: <NEW_LINE> <INDENT> fpdit = algorithms.findFirstDIT(tau) <...
stop can be set to None for default value
625941ddbe7bc26dc91cd91d
def set_exposure(self, exposure): <NEW_LINE> <INDENT> self.exposure = exposure <NEW_LINE> self.sb.time_step = self.exposure.m_as('s')
Sets the exposure of the camera.
625941dddd821e528d63b4ca
def plot_algo_fronts(folder): <NEW_LINE> <INDENT> print('\n\tPlotting: ', folder.split('/')[-2]) <NEW_LINE> all_data = np.loadtxt(folder + 'res/all_data_pareto_{}.txt'.format(SWITCH)) <NEW_LINE> all_data_std = np.loadtxt(folder + 'res/all_data_pareto_std_{}.txt'.format(SWITCH)) <NEW_LINE> n_lines = all_data.shape[0] <N...
Plot Pareto fronts of all runs for a given algorithm. Parameters ---------- folder: str Directory of the algorithm (full of directories, one for each run).
625941ddd7e4931a7ee9e241
def get_letter(self, letter, color, background=0, landscape=False): <NEW_LINE> <INDENT> letter_ord = ord(letter) - self.start_letter <NEW_LINE> if letter_ord >= self.letter_count: <NEW_LINE> <INDENT> print('Font does not contain character: ' + letter) <NEW_LINE> return b'', 0, 0 <NEW_LINE> <DEDENT> bytes_per_letter = s...
Convert letter byte data to pixels. Args: letter (string): Letter to return (must exist within font). color (int): RGB565 color value. background (int): RGB565 background color (default: black). landscape (bool): Orientation (default: False = portrait) Returns: (bytearray): Pixel data. (int, in...
625941ddd18da76e235327fc
def normalize_periods(A, B, alpha, T, a, b, outfile = None): <NEW_LINE> <INDENT> nm = T.determinant() <NEW_LINE> newA = A**ZZ(-b*nm) * B**ZZ(-a) <NEW_LINE> new_norm = ZZ((a+b*T).determinant()) <NEW_LINE> new_trace = 2*a + T.trace() <NEW_LINE> newB = B**-new_norm <NEW_LINE> newD = newA**ZZ(-new_norm) * newB**ZZ(new_trac...
alpha = (phi1, theta1) beta = (phi2, theta2) = -n(T) * alpha, where T is the Hecke operator used when computing A and B. T is the new hecke operator.
625941dd99fddb7c1c9de6b3
def display_stats(team_str, team, num_player, num_exp_player, num_not_exp_player, avg_height, guardian_list): <NEW_LINE> <INDENT> print("\n" + team_str) <NEW_LINE> print("-" * len(team_str)) <NEW_LINE> display_total_players(num_player, num_exp_player, num_not_exp_player) <NEW_LINE> display_player_name(team) <NEW_LINE> ...
This function is to display team statistics
625941dd99cbb53fe6792f09
def inputVIN(self): <NEW_LINE> <INDENT> logger.info("Input 车牌号 begin") <NEW_LINE> API().inputStringByResourceId(self.testcase, self.driver, self.logger, PALPPC.resource_id_tv_VIN_tv, PALPPC.input_VIN, 90) <NEW_LINE> logger.debug(PALPPC.input_VIN) <NEW_LINE> logger.info("Input 车牌号 end")
usage : 输入车牌号
625941dd435de62698dfdf70
def __init__(self, request): <NEW_LINE> <INDENT> self._data = {} <NEW_LINE> self.encoding = request.encoding <NEW_LINE> self.request = request
Achilles Transport init for Django requests, it gets a request object and fills its fields from it
625941dd091ae3566866727c
def habit_reacquisition_function(loaded_file, i): <NEW_LINE> <INDENT> (timecode, eventcode) = extract_info_from_file(loaded_file, 500) <NEW_LINE> (left_presses, right_presses, total_presses) = lever_pressing(eventcode, 'LPressOn', 'RPressOn') <NEW_LINE> pressing_across_test = bin_by_time(timecode, eventcode, (5 * 60), ...
:param loaded_file: file output from operant box :param i: number of days analyzing :return: data frame of all analysis extracted from file (one animal)
625941ddcad5886f8bd272fc
def basemap_lcc(x,y,resolution = 'h'): <NEW_LINE> <INDENT> llcrnrlon = np.min(x) <NEW_LINE> llcrnrlat = np.min(y) <NEW_LINE> urcrnrlon = np.max(x) <NEW_LINE> urcrnrlat = np.max(y) <NEW_LINE> def secondlat(lat1, arc): <NEW_LINE> <INDENT> degrees_to_radians = math.pi/180.0 <NEW_LINE> lat2 = (arc-((90-lat1)*degrees_to_rad...
Center a basemap Lambert-Conformal projection to the x, y range of data desired
625941dd24f1403a92600e87
def toExcel( file ): <NEW_LINE> <INDENT> wb = xlrd.open_workbook(file) <NEW_LINE> sh = wb.sheet_by_index(0) <NEW_LINE> name = re.sub('.xlsx', '.txt', file) <NEW_LINE> fh = open(name,"wb") <NEW_LINE> csv_out = unicodecsv.writer(fh, delimiter='\t', encoding='utf-8') <NEW_LINE> for row_number in range (sh.nrows): <NEW_LIN...
Converts an Excel file to a CSV file. If the excel file has multiple worksheets, only the first worksheet is converted. Uses unicodecsv, so it will handle Unicode characters. Uses a recent version of xlrd, so it should handle old .xls and new .xlsx equally well.
625941ddb545ff76a8914138
def tree2str(self, t): <NEW_LINE> <INDENT> if t == None: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> if t.left == None and t.right == None: <NEW_LINE> <INDENT> return str(t.val) <NEW_LINE> <DEDENT> if t.left != None and t.right == None: <NEW_LINE> <INDENT> return str(t.val) + "(" + self.tree2str(t.left) +")" <NEW...
:type t: TreeNode :rtype: str
625941dd1f5feb6acb0c4e6e
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, DriverEldRulesetRestart): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict()
Returns true if both objects are equal
625941dd956e5f7376d7118f