code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def remove_log(self): <NEW_LINE> <INDENT> if os.path.exists(self.log_file): <NEW_LINE> <INDENT> os.remove(self.log_file) | Remove the temporary log file generated by some tests. | 625941c763b5f9789fde712d |
def _build_block_array(self, local_array): <NEW_LINE> <INDENT> block = self._init_array() <NEW_LINE> for index in range(self.num_elements): <NEW_LINE> <INDENT> local_block_arrays = local_array(index) <NEW_LINE> for l_index, l_block in enumerate(local_block_arrays): <NEW_LINE> <INDENT> block[index + l_index][index:(inde... | Builds one of the block arrays
Args:
local_array := function to construct local (to element) array
Returns:
one of the block arrays | 625941c72c8b7c6e89b35809 |
def category_unique(self, join_buy_list): <NEW_LINE> <INDENT> img_dirs = [self.itemi+'.jpg'] <NEW_LINE> for i in range(len(join_buy_list)): <NEW_LINE> <INDENT> img_dirs.append(join_buy_list[i][0]+'.jpg') <NEW_LINE> <DEDENT> dc = pd.read_table('dim_items.txt',sep=' ', header=None, names=['item_id','cat_id', 'terms']).ap... | 輸出每種類各一種商品,帶.jpg | 625941c7de87d2750b85fdd9 |
def stddev(sequence): <NEW_LINE> <INDENT> if len(sequence) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return sqrt(variance(sequence)) | Computes the standard deviation of the sequence | 625941c726068e7796caed24 |
def random_key(): <NEW_LINE> <INDENT> code = '' <NEW_LINE> for i in range(16): <NEW_LINE> <INDENT> current = random.randrange(0,16) <NEW_LINE> if current != i and current % 2 == 0: <NEW_LINE> <INDENT> temp = random.randint(0, 9) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> temp = chr(random.randint(65, 90)) <NEW_LINE>... | :return:随机16位密钥 | 625941c7a8370b77170528e7 |
def intersect(self, nums1, nums2): <NEW_LINE> <INDENT> counter1 = defaultdict(lambda: 0) <NEW_LINE> for n in nums1: <NEW_LINE> <INDENT> counter1[n] += 1 <NEW_LINE> <DEDENT> counter2 = defaultdict(lambda: 0) <NEW_LINE> for n in nums2: <NEW_LINE> <INDENT> counter2[n] += 1 <NEW_LINE> <DEDENT> nums = sorted(list(set(nums1)... | :type nums1: List[int]
:type nums2: List[int]
:rtype: List[int] | 625941c7cc0a2c11143dced8 |
def read_mm_header(fh, byteorder, dtype, count, offset_size): <NEW_LINE> <INDENT> return fh.read_record(CONST.FLUOVIEW_MM_HEADER, byteorder=byteorder) | Read mm_header tag from file and return as numpy.rec.array. | 625941c7a79ad161976cc18d |
def __init__(self): <NEW_LINE> <INDENT> self.TaskTemplateName = None <NEW_LINE> self.TaskTemplateInfo = None <NEW_LINE> self.TaskTemplateDescription = None <NEW_LINE> self.Tags = None | :param TaskTemplateName: 任务模板名称
:type TaskTemplateName: str
:param TaskTemplateInfo: 任务模板内容,参数要求与任务一致
:type TaskTemplateInfo: :class:`tencentcloud.batch.v20170312.models.Task`
:param TaskTemplateDescription: 任务模板描述
:type TaskTemplateDescription: str
:param Tags: 标签列表。通过指定该参数可以支持绑定标签到任务模板。每个任务模板最多绑定10个标签。
:type Tags: li... | 625941c745492302aab5e30a |
def set_Units(self, value): <NEW_LINE> <INDENT> super(GetWeatherByAddressInputSet, self)._set_input('Units', value) | Set the value of the Units input for this Choreo. ((optional, string) The unit of temperature in the response. Acceptable inputs: f for Fahrenheit or c for Celsius. Defaults to f. When c is specified, all units measurements returned are changed to metric.) | 625941c782261d6c526ab4e5 |
def link_localtime(timezone, zoneinfo_path, localtime_path): <NEW_LINE> <INDENT> zoneinfo_tz_path = os.path.join(zoneinfo_path, timezone) <NEW_LINE> check_directory_traversal(zoneinfo_path, zoneinfo_tz_path) <NEW_LINE> if not os.path.isfile(zoneinfo_tz_path): <NEW_LINE> <INDENT> raise TimezoneNotLocallyAvailableError( ... | Atomically link a timezone file from zoneinfo to localtime_path.
Since we may be retrieving the timezone file's relative path from an
untrusted source, we also do checks to make sure that no directory
traversal is going on. See `check_directory_traversal` for information
about how that works. | 625941c76fece00bbac2d785 |
def test_domain_range_scale_log_encoding_ACEScc(self): <NEW_LINE> <INDENT> lin_AP1 = 0.18 <NEW_LINE> ACEScc = log_encoding_ACEScc(lin_AP1) <NEW_LINE> d_r = (("reference", 1), ("1", 1), ("100", 100)) <NEW_LINE> for scale, factor in d_r: <NEW_LINE> <INDENT> with domain_range_scale(scale): <NEW_LINE> <INDENT> np.testing.a... | Test :func:`colour.models.rgb.transfer_functions.aces.log_encoding_ACEScc` definition domain and range scale support. | 625941c7090684286d50ed2c |
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, TagCreator): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | 625941c701c39578d7e74e83 |
def ss_wrap(func): <NEW_LINE> <INDENT> def wrapper(self, *args, **kwargs): <NEW_LINE> <INDENT> if not self.savedsearch: <NEW_LINE> <INDENT> self.savedsearch = SavedSearch(self) <NEW_LINE> <DEDENT> return func(self, *args, **kwargs) <NEW_LINE> <DEDENT> return wrapper | ensure that a SavedSearch object exists | 625941c7d53ae8145f87a2b9 |
def get_workdays (date): <NEW_LINE> <INDENT> return sorted (set (get_same_month_dates (date)) - set (get_workfree_dates (date))) | Returns a sorted list of work dates, that are in the same month as the specified date. It does not
overflow weeks.
date: a datetime.date object
return a sorted list of dates | 625941c7c432627299f04c8d |
def minPathSum(self, grid): <NEW_LINE> <INDENT> m = len(grid) <NEW_LINE> n = len(grid[0]) <NEW_LINE> def sumGrid(i,j): <NEW_LINE> <INDENT> if i == m-1 and j == n-1: <NEW_LINE> <INDENT> return grid[-1][-1] <NEW_LINE> <DEDENT> elif i == m-1: <NEW_LINE> <INDENT> return grid[i][j] + sumGrid(i,j+1) <NEW_LINE> <DEDENT> elif ... | :type grid: List[List[int]]
:rtype: int | 625941c771ff763f4b5496d1 |
def _evaluation(self, point, cache): <NEW_LINE> <INDENT> if id(self) not in cache: <NEW_LINE> <INDENT> left = self.expr1._evaluation(point, cache) <NEW_LINE> right = self.expr2._evaluation(point, cache) <NEW_LINE> cache[id(self)] = left * right <NEW_LINE> <DEDENT> return cache[id(self)] | 求 expr1 * expr2 在点point的值
:param point:
:param cache:
:return: | 625941c7187af65679ca5166 |
def validate_schedule(schedule): <NEW_LINE> <INDENT> if not ('run_time' in schedule and isinstance(schedule['run_time'], int)): <NEW_LINE> <INDENT> LOGGER.error('Invalid run_time. Skipping schedule.') <NEW_LINE> return False <NEW_LINE> <DEDENT> if 'patch_name' not in schedule: <NEW_LINE> <INDENT> LOGGER.error('Schedule... | Validate Schedule has requisite parts. | 625941c74e696a04525c9493 |
def on_startup(self): <NEW_LINE> <INDENT> print("Started. Press CTRL+C to end") <NEW_LINE> self.__thing = self.client.create_thing('follow_basic') <NEW_LINE> self.__restore(self.__thing.list_connections()) | Called once at the beginning, before main().
Use this method to create your things, rebind connections, setup hardware, etc. | 625941c76aa9bd52df036deb |
def decode_relative_range(gene, cand, x): <NEW_LINE> <INDENT> start = val_to_index(cand,int(gene.vars[0]) + x) <NEW_LINE> end = val_to_index(cand,start + int(gene.vars[1]), True) <NEW_LINE> return (min(start, end), max(start, end)) | decodes gene as range (P0 + x) and (P0 + x + P1) | 625941c7baa26c4b54cb1168 |
def get_land_slide_obs(from_date, to_date, region_ids=None, location_id=None, group_id=None, observer_ids=None, observer_nick=None, observer_competence=None, output='List', lang_key=1): <NEW_LINE> <INDENT> return _get_general(LandSlideObs, 71, from_date=from_date, to_date=to_date, region_ids=region_ids, location_id=loc... | Gets observations of land slide observations in the LandSlideObs table in regObs.
:param from_date: [date] A query returns [from_date, to_date]
:param to_date: [date] A query returns [from_date, to_date]
:param region_ids: [int or list of ints] If region_ids = None, all regions are selec... | 625941c76e29344779a6265a |
def _dataRef2DebugPath(self, prefix, warpRef, coaddLevel=False): <NEW_LINE> <INDENT> if coaddLevel: <NEW_LINE> <INDENT> keys = warpRef.getButler().getKeys(self.getCoaddDatasetName(self.warpType)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> keys = warpRef.dataId.keys() <NEW_LINE> <DEDENT> keyList = sorted(keys, revers... | Return a path to which to write debugging output.
Creates a hyphen-delimited string of dataId values for simple filenames.
Parameters
----------
prefix : `str`
Prefix for filename.
warpRef : `lsst.daf.persistence.butlerSubset.ButlerDataRef`
Butler dataRef to make the path from.
coaddLevel : `bool`, optional.
... | 625941c71f5feb6acb0c4b99 |
def build_spellchcker(): <NEW_LINE> <INDENT> pass | Build the Solr spell-checker. | 625941c78a43f66fc4b540ae |
def count(self): <NEW_LINE> <INDENT> return self.db.hlen(self.name()) | 获取键值对的总数量
| 625941c738b623060ff0ae36 |
def yield_grid(self): <NEW_LINE> <INDENT> for tile in self: <NEW_LINE> <INDENT> pos = tuple(int((tile[d] - self.rect[0][d]) / self.tilesize[d]) for d in (0, 1)) <NEW_LINE> yield pos, self[tile] | Convert GeoGrid back into a normal grid of points.
Note: I'm pretty sure this is somewhat broken. Good luck! | 625941c7a219f33f346289b3 |
def death(self): <NEW_LINE> <INDENT> self.hero_death = True | Смерть персонажа при столкновении с врагом(враг должен находится над персонажем)
:return: Ничего не возвращает | 625941c74428ac0f6e5ba83a |
def insert_closing_price(price_list): <NEW_LINE> <INDENT> pass | Insert multiple new prices to table.
Args:
:price_list: [(close_price, timestamp, )] | 625941c78a349b6b435e81bb |
def on_pause(self): <NEW_LINE> <INDENT> pass | app pauses exec, resume not guaranteed | 625941c71f037a2d8b946246 |
def cleanup_looping_payload(workdir): <NEW_LINE> <INDENT> for (root, _, files) in os.walk(workdir): <NEW_LINE> <INDENT> for filename in files: <NEW_LINE> <INDENT> if 'pool.root' in filename: <NEW_LINE> <INDENT> path = os.path.join(root, filename) <NEW_LINE> path = os.path.abspath(path) <NEW_LINE> remove(path) | Run a special cleanup for looping payloads.
Remove any root and tmp files.
:param workdir: working directory (string)
:return: | 625941c73eb6a72ae02ec522 |
def __init__(self, api_key=None): <NEW_LINE> <INDENT> self.api_key = api_key <NEW_LINE> self.request_count = 0 <NEW_LINE> self.request_url = 'https://www.googleapis.com/qpxExpress/' + 'v1/trips/search?key={}'.format(api_key) | API Contrstructor
:param api_key: Google API Key | 625941c78da39b475bd64fba |
def user_list(user=None, host=None, port=None, maintenance_db=None, password=None, runas=None): <NEW_LINE> <INDENT> ret = {} <NEW_LINE> ver = version(user=user, host=host, port=port, maintenance_db=maintenance_db, password=password, runas=runas).split('.') <NEW_LINE> if len(ver) >= 2 and int(ver[0]) >= 9 and int(ver[1]... | Return a dict with information about users of a Postgres server.
CLI Example::
salt '*' postgres.user_list | 625941c723849d37ff7b30d8 |
def is_over(self, state_batch): <NEW_LINE> <INDENT> return np.maximum(self.get_iwinner(state_batch) >= 0, (1 - self.has_moves_remaining(state_batch))) | Indicates if each state from the batch represents a finished game.
Args:
state_batch: np.array NCHW: a batch of game states.
Returns:
np.array: a binary vector indicating whether the game at each
state has reached a finished state. | 625941c729b78933be1e56f5 |
def expanded_callback(self, output, inputs=[], state=[], events=[]): <NEW_LINE> <INDENT> self._expanded_callbacks = True <NEW_LINE> return self.callback(output, inputs, state, events) | Form an expanded callback.
This function registers the callback function, and sets an internal flag that mandates that all
callbacks are passed the enhanced arguments. | 625941c71b99ca400220aaf9 |
def paint_text(word: str, x: int, y: int, color=(0, 0, 0)): <NEW_LINE> <INDENT> myfont = pygame.font.SysFont('Comic Sans MS', 30) <NEW_LINE> textsurface = myfont.render(word, False, color) <NEW_LINE> text_pos = (x * width + width // 2 - textsurface.get_width() // 2, y * height + height // 2 - textsurface.get_height() /... | display text on board
:param color: color of text
:param word: string to be displayed
:param x: which column word is in
:param y: which row word is in | 625941c792d797404e3041d2 |
def execute_SMV(self, smv: SMV): <NEW_LINE> <INDENT> t = self.memory[self.sp - smv.k] <NEW_LINE> self.memory[t:t+smv.k] = self.memory[self.sp-smv.k+1:self.sp+1] <NEW_LINE> self.sp = self.sp - smv.k - 1 | (’smv’, k) # Store multiple Values
t = M[sp-k]
M[t:t+k] =M[sp-k+1:sp+1]
sp -= (k+1) | 625941c7d53ae8145f87a2ba |
def test_date_db_populate(self): <NEW_LINE> <INDENT> with app.test_request_context(): <NEW_LINE> <INDENT> schema = TicketSchema() <NEW_LINE> obj = TicketFactory() <NEW_LINE> save_to_db(obj) <NEW_LINE> original_data = { 'data': { 'id': 1 } } <NEW_LINE> data = {} <NEW_LINE> TicketSchema.validate_date(schema, data, origin... | Tickets Validate Date - Tests if validation works on values stored in db and not given in 'data'
:return: | 625941c7009cb60464c633fa |
def jsonify_unknown_exception(exception: Exception): <NEW_LINE> <INDENT> current_app.logger.exception('Unhandled exception has been raised!') <NEW_LINE> return jsonify(DEFAULT_MESSAGE, 500) | Convert any other exception to JSON. | 625941c73617ad0b5ed67f40 |
def cluster_to_address(cluster_num, root): <NEW_LINE> <INDENT> return FAT['bytes per sector'] * (cluster_num * FAT['sectors per cluster']) + root | return real address from cluster number given root address | 625941c7cdde0d52a9e5307a |
def add_entities(devices, action): <NEW_LINE> <INDENT> for device in devices: <NEW_LINE> <INDENT> device.hass = hass <NEW_LINE> hass_devices.append(device) | Mock add devices. | 625941c7a17c0f6771cbe09a |
def getCertificate(self): <NEW_LINE> <INDENT> self._checkCertificateRequest() <NEW_LINE> return self._getCertificate() | Returns new SSL certificate | 625941c7ec188e330fd5a7e9 |
def transcreve(adn): <NEW_LINE> <INDENT> adn = adn.upper() <NEW_LINE> arn = adn.replace('T', 'U') <NEW_LINE> return arn | Substitui T por U no ADN. | 625941c75166f23b2e1a51a1 |
def area(self): <NEW_LINE> <INDENT> vec1 = self.points[1] - self.points[0] <NEW_LINE> vec2 = self.points[2] - self.points[0] <NEW_LINE> return abs(vec1.x*vec2.y - vec1.y*vec2.x) / 2 | Calculates the area of the triangle as the cross product of the respective vectors divided by two. | 625941c77c178a314d6ef4a6 |
def create_virtual_machines(self): <NEW_LINE> <INDENT> for i in range(1, self.n_vm_pairs + 1, 1): <NEW_LINE> <INDENT> frequency = random.randint(1, self.vm_freq_range) <NEW_LINE> vm_1 = net.VirtualMachine(frequency, "vm_" + str((2 * i) - 1), 1) <NEW_LINE> vm_2 = net.VirtualMachine(frequency, "vm_" + str((2 * i)), 1) <N... | Creates a set of virtual machine pairs to allocate inside of a graph topology | 625941c7d4950a0f3b08c398 |
def __sub__(self, other): <NEW_LINE> <INDENT> b = copy.deepcopy(self) <NEW_LINE> b.current -= other.current <NEW_LINE> return b | Support current subtraction | 625941c7d58c6744b4257ca9 |
def get_keywords(self, sentence, maxwords, weight): <NEW_LINE> <INDENT> jieba.analyse.set_stop_words(self.SW_PATH) <NEW_LINE> keywords = jieba.analyse.extract_tags(sentence, topK=maxwords, withWeight=weight) <NEW_LINE> if weight: <NEW_LINE> <INDENT> return keywords <NEW_LINE> <DEDENT> return '/'.join(keywords) | Get keywords from long sentence. | 625941c74e4d5625662d4421 |
def update(self): <NEW_LINE> <INDENT> self.data.update() <NEW_LINE> value = self.data.value <NEW_LINE> if value is None: <NEW_LINE> <INDENT> value = STATE_UNKNOWN <NEW_LINE> <DEDENT> if self._value_template is not None: <NEW_LINE> <INDENT> value = self._value_template.render_with_possible_json_value( str(value), STATE_... | Get the latest data from Influxdb and updates the states. | 625941c74e4d5625662d4422 |
def __init__( self, ws, parent=None, window_flags=Qt.Window, plot=None, model=None, view=None, name=None, ads_observer=None, container=None, window_width=600, window_height=400, batch=False, ): <NEW_LINE> <INDENT> view, model = self.create_table(ws, parent, window_flags, model, view, batch) <NEW_LINE> self.view = view ... | Creates a display for the provided workspace.
:param ws: Workspace to be displayed
:param parent: Parent of the widget
:param window_flags: An optional set of window flags
:param plot: Plotting function that will be used to plot workspaces. This requires Matplotlib directly.
Passed in as parameter to allo... | 625941c757b8e32f524834e3 |
def solve_assignments(self): <NEW_LINE> <INDENT> scaled_valuations = self.valuations * 2 * self.priorities.reshape(-1, 1) <NEW_LINE> c = -1 * scaled_valuations.flatten() <NEW_LINE> G = np.zeros((1, self.n**2)) <NEW_LINE> h = np.zeros((1)) <NEW_LINE> A = np.zeros((2 * self.n, self.n**2)) <NEW_LINE> b = np.ones((2 * self... | Assigns rooms to agents by solving a binary linear program that
maximizes welfare. Uses the glpk binary lienar program solver.
See http://procaccia.info/papers/rent.pdf for details on this
optimization problem.
returns:
self.assignments (ndarray) 1D array of assignments.
self.assign... | 625941c70a50d4780f666eda |
def load_drafts(draft_path): <NEW_LINE> <INDENT> with open(draft_path) as f: <NEW_LINE> <INDENT> drafts = f.read() <NEW_LINE> <DEDENT> return drafts | Load drafts in the provided csv file.
The data is stored in a single string. The newline character '
'
separates unique drafts.
Each draft consists of a draft number, followed by the set string,
followed by a list of cards in the 24 packs in the draft.
:param draft_path: Path to draft csv da... | 625941c78c3a873295158402 |
def process_worker_down(self, worker_id): <NEW_LINE> <INDENT> if self.worker_list.has_key(worker_id): <NEW_LINE> <INDENT> if self.worker_list[worker_id] is not None: <NEW_LINE> <INDENT> del self.worker_list[worker_id] <NEW_LINE> for job_id in self.driver_list.keys(): <NEW_LINE> <INDENT> self.driver_list[job_id][0].faul... | Process worker down event. Remove this worker from worker list. Notify driver to process worker down.
:param worker_id:
:return: | 625941c77b25080760e394a2 |
def build_critic (self): <NEW_LINE> <INDENT> critic_model = Sequential() <NEW_LINE> critic_model.add(Dense(self.critic_h_dim, activation=self.activation, kernel_regularizer=regularizers.l2(1e-3), input_dim = self.dim)) <NEW_LINE> critic_model.add(BatchNormalization()) <NEW_LINE> for _ in range(self.n_layer - 2): <NEW_L... | Build critic.
Use selected feature as the input and predict labels | 625941c756b00c62f0f146a1 |
@_deprecate_positional_args <NEW_LINE> def make_gaussian_quantiles(*, mean=None, cov=1., n_samples=100, n_features=2, n_classes=3, shuffle=True, random_state=None): <NEW_LINE> <INDENT> if n_samples < n_classes: <NEW_LINE> <INDENT> raise ValueError("n_samples must be at least n_classes") <NEW_LINE> <DEDENT> generator = ... | Generate isotropic Gaussian and label samples by quantile
This classification dataset is constructed by taking a multi-dimensional
standard normal distribution and defining classes separated by nested
concentric multi-dimensional spheres such that roughly equal numbers of
samples are in each class (quantiles of the :m... | 625941c763d6d428bbe44538 |
def _get_description(self): <NEW_LINE> <INDENT> return self.__description | Getter method for description, mapped from YANG variable /network_instances/network_instance/mpls/lsps/constrained_path/tunnels/tunnel/config/description (string)
YANG Description: optional text description for the tunnel | 625941c7d268445f265b4eb7 |
def test_lstar_large_array(self): <NEW_LINE> <INDENT> n = self.model.NTIME_MAX.value + 1 <NEW_LINE> X_huge = {key:n*[value] for key, value in self.X.items()} <NEW_LINE> maginput_huge = {key:n*[value] for key, value in self.maginput.items()} <NEW_LINE> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> self.model.m... | Test lstar with array inputs that are longer than NTIME_MAX and
verify that the wrapper returns a ValueError. | 625941c7046cf37aa974cd91 |
def __str__(self): <NEW_LINE> <INDENT> d = {} <NEW_LINE> d["request_id"] = self.request_id <NEW_LINE> d["file_location"] = self.file_location <NEW_LINE> return str(d) | Return a string representation of this structure | 625941c75fcc89381b1e1707 |
def get_ground_node(self): <NEW_LINE> <INDENT> return '0' | Returns the reference node, AKA GND. | 625941c710dbd63aa1bd2bec |
def __init__(self, source: PageSource, title: str = '') -> None: <NEW_LINE> <INDENT> super().__init__(source, title) <NEW_LINE> if not ( self.title(with_ns=False).startswith('Categories for discussion/') and self.namespace() == 4 ): <NEW_LINE> <INDENT> raise ValueError('{} is not a CFD page.'.format(self)) | Initializer. | 625941c715fb5d323cde0b57 |
def create_user(self, email, password=None, first_name=None, last_name=None): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError('Enter a valid email address') <NEW_LINE> <DEDENT> user = self.model(first_name=first_name, last_name=last_name, email=email) <NEW_LINE> if password: <NEW_LINE> <INDENT> u... | Creates and saves a user with the given email, first_nam,
last_name, password. | 625941c7a79ad161976cc18e |
def markerless_stars_symmetry(pprev_typ, pprev_idx, pprev_depth, prev_typ, prev_idx, prev_depth, typ, idx, depth): <NEW_LINE> <INDENT> sandwich = (pprev_typ == typ == markers.markerless and prev_typ == markers.stars) <NEW_LINE> preferred_solution = prev_depth <= depth <NEW_LINE> return not sandwich or preferred_solutio... | Given MARKERLESS, STARS, MARKERLESS want to break these symmetries:
MARKERLESS MARKERLESS
STARS vs. STARS
MARKERLESS MARKERLESS
Here, we don't really care about the distinction, so we'll opt for the
former. | 625941c7596a897236089b0a |
def reconnect(self): <NEW_LINE> <INDENT> if not self.active: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> f, t = self._getEndpoints() <NEW_LINE> if not f: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if lock.acquire(timeout=10): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if t.endswith("*"): <NEW_LINE> <INDENT> t=... | Connects the outputs of channel strip f to the port t. As in all outputs
to one input. If the destination is a client, connect all channnels of src to all of dest. | 625941c75fdd1c0f98dc027c |
def __init__(self, client, logger): <NEW_LINE> <INDENT> self.client = client <NEW_LINE> self.logger = logger | Args:
client: | 625941c7d99f1b3c44c675d9 |
def testAddDeletePDB(self): <NEW_LINE> <INDENT> parm = copy(amoebaparm) <NEW_LINE> PT.addPDB(parm, get_fn('nma.pdb'), 'elem allicodes').execute() <NEW_LINE> self.assertTrue('RESIDUE_ICODE' in parm.flag_list) <NEW_LINE> self.assertTrue('ATOM_ELEMENT' in parm.flag_list) <NEW_LINE> self.assertTrue('RESIDUE_NUMBER' in parm... | Test addPDB and deletePDB for AmoebaParm | 625941c73cc13d1c6d3c73c3 |
def status(): <NEW_LINE> <INDENT> r = requests.get('https://intranet.hbtn.io/status') <NEW_LINE> t = (type(r.text)) <NEW_LINE> c = r.text <NEW_LINE> print('Body response:') <NEW_LINE> print('\t- type:', t) <NEW_LINE> print('\t- content:', c) | beginning with get response | 625941c72eb69b55b151c8f7 |
def collie(request): <NEW_LINE> <INDENT> assert isinstance(request, HttpRequest) <NEW_LINE> import datetime <NEW_LINE> from app.models import FlowQueryLog <NEW_LINE> query = FlowQueryLog.objects.latest('time') <NEW_LINE> lastQueryTime = query.time <NEW_LINE> download = query.download <NEW_LINE> upload = query.upload <N... | Renders the collie page. | 625941c73cc13d1c6d3c73c4 |
def publish(self, mqtt, data, retain=None): <NEW_LINE> <INDENT> topic = self.render_topic(data) <NEW_LINE> payload = self.render_payload(data) <NEW_LINE> retain = retain if retain is not None else self.retain <NEW_LINE> if topic and payload: <NEW_LINE> <INDENT> mqtt.publish(topic, payload, self.qos, retain) | Publish a message.
If either the topic or payload fails to render, nothing is done.
Args:
mqtt (Mqtt): The MQTT client to publish to.
data (dict): Data dictionary with template variables to pass to the
jinja templates.
retain (bool): None to use the class retain flag. Otherwise
the retain fl... | 625941c7656771135c3eb8b6 |
def normalize_data(self): <NEW_LINE> <INDENT> self.normalized_data.clear() <NEW_LINE> for key in self.key_list: <NEW_LINE> <INDENT> temp = self.data_dict[key].copy() <NEW_LINE> temp[1] = temp[1] - temp[1].min() <NEW_LINE> temp[1] = temp[1] / (temp[1].max() - temp[1].min()) <NEW_LINE> self.normalized_data[key] = temp | This method normalizes data for plotting
Returns
-------
None | 625941c745492302aab5e30b |
@predictions.route('/predictions/predict/', methods=['GET', 'POST']) <NEW_LINE> def predict(): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> abort(403) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> predictives_models = [] <NEW_LINE> predicted_grades = {} <NEW_LINE> model_names = ['FM', 'FSTA', 'F... | the main method use to predict | 625941c7851cf427c661a559 |
def testAddOOoDocbookDocument(self): <NEW_LINE> <INDENT> self.assertEqual(len([o for o in self.ws.contentValues() if o.getContent().meta_type == self.doc_type]), 0) <NEW_LINE> self.ws.invokeFactory(type_name = self.doc_type, id = self.doc_id) <NEW_LINE> self.assertEqual(len([o for o in self.ws.contentValues() if o.getC... | Test creation of OOoDocbookDocument instance in root of workspaces.
| 625941c77047854f462a1454 |
def connect(self, timeout=1): <NEW_LINE> <INDENT> if not self.is_connected(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.setDaemon(True) <NEW_LINE> self.start() <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> self.start(daemon=True) <NEW_LINE> <DEDENT> self.wait_connected(timeout) <NEW_LINE> <DEDE... | Establish a connection to the KATCP server on the device.
:param timeout: How many seconds should we wait?
:return: | 625941c7bd1bec0571d90678 |
def isClosed(self): <NEW_LINE> <INDENT> return (self.root is not None) and self.root.isClosed() | Returns True if the tableau is closed. | 625941c766656f66f7cbc1f3 |
def translate(n): <NEW_LINE> <INDENT> if n >= 0: <NEW_LINE> <INDENT> sign = "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sign = "negative " <NEW_LINE> <DEDENT> abs_n = abs(n) <NEW_LINE> thousands, hundreds, tens, ones = get_digits(abs_n) <NEW_LINE> return sign + make_word(thousands, hundreds, tens, ones) | Takes an integer and returns a string with the English translation of that number. | 625941c7956e5f7376d70eb7 |
def do_bisect_list(self, bisect_func): <NEW_LINE> <INDENT> blocks = self._blocks <NEW_LINE> return [bisect_func(blocks, path) for path in self._paths] | Call bisect_dirblock for each path. | 625941c7f548e778e58cd5c6 |
def _insert_documents(self, documents, remove=[]): <NEW_LINE> <INDENT> if remove: <NEW_LINE> <INDENT> self.mongo_outcol.remove({'type': {'$in': remove}}) <NEW_LINE> <DEDENT> self.mongo_outcol.insert_many(documents) | Insert into MongoDB | 625941c756b00c62f0f146a2 |
def test_storage_file_exists(self): <NEW_LINE> <INDENT> remove(F) <NEW_LINE> self.user.save() <NEW_LINE> self.assertTrue(path.isfile(F)) | ... checks proper FileStorage instantiation | 625941c7e76e3b2f99f3a857 |
def get_cutting_sites_in_parallel(seq, recog_sites, cut_poss, process_num=0, max_nt_per_process=1000000): <NEW_LINE> <INDENT> from multiprocessing import Pool <NEW_LINE> if not process_num: <NEW_LINE> <INDENT> p = Pool() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p = Pool(process_num) <NEW_LINE> <DEDENT> results = [... | Do in silico digestion of a sequence and return cutting sites.
Parameters
----------
seq : str
The sequence to run simulation.
recog_sites : List of str
The enzyme recognition sites.
cut_poss : int
The cutting positions of the recognition sites. recog_seq[cut_pos:] are in the right frangment.
For examp... | 625941c76fece00bbac2d786 |
def transport(self, perm): <NEW_LINE> <INDENT> l = sorted([perm(i) for i in self._list]) <NEW_LINE> return SubsetSpeciesStructure(self.parent(), self._labels, l) | Return the transport of this subset along the permutation perm.
EXAMPLES::
sage: F = species.SubsetSpecies()
sage: a = F.structures(["a", "b", "c"])[5]; a
{'a', 'c'}
sage: p = PermutationGroupElement((1,2))
sage: a.transport(p)
{'b', 'c'}
sage: p = PermutationGroupElement((1,3))
sage: ... | 625941c7dc8b845886cb557d |
def is_AvailableDataSources_allowed(self): <NEW_LINE> <INDENT> if self.get_state() in [PyTango.DevState.RUNNING]: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True | AvailableDataSources command State Machine
:returns: True if the operation allowed
:rtype: :obj:`bool` | 625941c79c8ee82313fbb7be |
def sanitize_cmd(cmd): <NEW_LINE> <INDENT> if '"' in cmd: <NEW_LINE> <INDENT> cmd = cmd.replace('"', r'\"') <NEW_LINE> <DEDENT> return cmd | Escape apostrophes in a command line.
:param cmd: command to sanitize
:return: str | 625941c71f037a2d8b946247 |
def complete(statuses, page, func = None): <NEW_LINE> <INDENT> seen = { str(status["id"]): status for status in statuses } <NEW_LINE> count = 0 <NEW_LINE> progress = progress_bar() <NEW_LINE> while len(page) > 0: <NEW_LINE> <INDENT> progress() <NEW_LINE> for item in page: <NEW_LINE> <INDENT> status = item <NEW_LINE> if... | Why aren't we using Mastodon.fetch_remaining(first_page)? It
requires some metadata for the next request to be known. This
is what the documentation says about
Mastodon.fetch_next(previous_page): "Pass in the previous page
in its entirety, or the pagination information dict returned
as a part of that pages last status ... | 625941c7462c4b4f79d1d71a |
def newFileAction(self): <NEW_LINE> <INDENT> self.view.showNewFileSelectDialog() | Is called when user wants to add a new file
by button click | 625941c76fb2d068a760f0e5 |
def build_single_input(statemat_dict): <NEW_LINE> <INDENT> rand_piece=random.choice(list(statemat_dict.keys())) <NEW_LINE> whole_seq=statemat_dict[rand_piece] <NEW_LINE> len_whole_seq=len(whole_seq) <NEW_LINE> rand_start_point=random.choice(range(0,len_whole_seq-len_of_seq,32)) <NEW_LINE> target=whole_seq[rand_start_po... | for LSTM in the paper
build single input to feed into model based on statematrix generated by load_data() | 625941c7cb5e8a47e48b7af5 |
def add_trustline(self, asset_code, issuer, secret=None): <NEW_LINE> <INDENT> self._change_trustline(asset_code, issuer, secret=secret) | Create a trustline to an asset
Args:
asset_code (str): code of the asset. For example: 'BTC', 'TFT', ...
issuer (str): address of the asset issuer
secret (str, optional): Secret to use will use instance property if empty. Defaults to None. | 625941c756ac1b37e626421b |
def show_items(self, items=None, item_type=None): <NEW_LINE> <INDENT> self.__set_items_visible(True, items, item_type=item_type) | Show items (if *items* is None, show all items) | 625941c73539df3088e2e394 |
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, TradeStatus): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.to_dict() == other.to_dict() | Returns true if both objects are equal | 625941c744b2445a339320e0 |
def Shorten(self, long_url): <NEW_LINE> <INDENT> result = None <NEW_LINE> f = requests.get("http://tinyurl.com/api-create.php?url={0}".format( long_url)) <NEW_LINE> try: <NEW_LINE> <INDENT> result = f.read() <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> f.close() <NEW_LINE> <DEDENT> if isinstance(result, bytes): <NE... | Call TinyURL API and returned shortened URL result.
Args:
long_url: URL string to shorten
Returns:
The shortened URL as a string
Note:
long_url is required and no checks are made to ensure completeness | 625941c75510c4643540f430 |
def resources_article_display(request, slug): <NEW_LINE> <INDENT> article = Article.objects.filter(slug=slug).first() <NEW_LINE> context = { 'article' : article, } <NEW_LINE> return render(request, 'education_resources/individual_article.html', context=context) | This method renders the 'individual_article.html' template and passes data
from a single instance of the Article data model into the template.
This is the view model responsible for rendering individual articles. The
query parameter <slug:slug> in the url is passed into the method as the parameter
'slug'. The slug par... | 625941c75fc7496912cc39c7 |
def _on_push_browse_library(self, *args): <NEW_LINE> <INDENT> radios_list = args[0]['navigation']['lists'][0]['items'] <NEW_LINE> self._radios = list() <NEW_LINE> for radio in radios_list: <NEW_LINE> <INDENT> self._radios.append({ 'title': radio['title'], 'uri': radio['uri'] }) | Callback appelée lorsqu'on parcourt la bibliothèque (utilisé pour connaître la liste des webradios) | 625941c7004d5f362079a37d |
def export_step_file(shape, filename, title=None, author=None, organization=None): <NEW_LINE> <INDENT> e = StepFileExporter(shape=shape, filename=filename, title=title) <NEW_LINE> if author is not None: <NEW_LINE> <INDENT> e.metadata["author"] = author <NEW_LINE> <DEDENT> if organization is not None: <NEW_LINE> <INDENT... | Convenience function to export a STEP file in a single call using the
StepFileExporter class with some sensible default values | 625941c7d164cc6175782d97 |
def profile_detail(request, username, template_name='userena/profile_detail.html', extra_context=None): <NEW_LINE> <INDENT> user = get_object_or_404(User, username__iexact=username) <NEW_LINE> profile = user.get_profile() <NEW_LINE> if not extra_context: extra_context = dict() <NEW_LINE> extra_context['profile'] = user... | Detailed view of an user.
:param username:
String of the username of which the profile should be viewed.
:param template_name:
String representing the template name that should be used to display
the profile.
:param extra_context:
Dictionary of variables which should be supplied to the template. The
... | 625941c745492302aab5e30c |
def can_read(f): <NEW_LINE> <INDENT> if not os.path.exists(f): <NEW_LINE> <INDENT> print("%s does not exist" % f, file=sys.stderr) <NEW_LINE> return False <NEW_LINE> <DEDENT> if not os.access(f, os.R_OK): <NEW_LINE> <INDENT> print("%s -- permission denied" % f, file=sys.stderr) <NEW_LINE> return False <NEW_LINE> <DEDEN... | return False and print file name to stderr if can't read
| 625941c782261d6c526ab4e7 |
def set_registry_value(self, regkey, value, overwrite=True, value_type=None): <NEW_LINE> <INDENT> if value_type is None: <NEW_LINE> <INDENT> if type(value) == int: <NEW_LINE> <INDENT> value_type = "REG_DWORD" <NEW_LINE> <DEDENT> elif type(value) == list: <NEW_LINE> <INDENT> value_type = "REG_MULTI_SZ" <NEW_LINE> <DEDEN... | Set a registry value on the specified registry key on the remote machine.
Example:
>>> with c.select(Sensor, 1).lr_session() as lr_session:
... lr_session.set_registry_value('HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\services\\\\ACPI\\\\testvalue', 1)
Args:
regkey (str): The registry key to set.
value (objec... | 625941c7eab8aa0e5d26dba1 |
def handleMatch(self, m): <NEW_LINE> <INDENT> el = m.group(2) <NEW_LINE> shortname = self.emoji_index['aliases'].get(el, el) <NEW_LINE> alias = None if shortname == el else el <NEW_LINE> emoji = self.emoji_index['emoji'].get(shortname, None) <NEW_LINE> if emoji: <NEW_LINE> <INDENT> uc, uc_alt = self._get_unicode(emoji)... | Hanlde emoji pattern matches. | 625941c7090684286d50ed2e |
def _check_dimensionless_vertical_coordinates(self, ds, deprecated_units, version_specific_check, version_specific_dimless_vertical_coord_dict): <NEW_LINE> <INDENT> ret_val = [] <NEW_LINE> z_variables = cfutil.get_z_variables(ds) <NEW_LINE> for name in z_variables: <NEW_LINE> <INDENT> version_specific_check(ds, name, d... | Check the validity of dimensionless coordinates under CF
:param netCDF4.Dataset ds: An open netCDF dataset
:param list deprecated_units: list of string names of deprecated units
:param function version_specific_check: version-specific implementation to check dimensionless vertical coord
:param dict version_specific_di... | 625941c73317a56b86939ca4 |
def test_swagger_schema_for_request_not_found(schema): <NEW_LINE> <INDENT> with pytest.raises(PathNotMatchedError) as excinfo: <NEW_LINE> <INDENT> schema.schema_and_resolver_for_request( request=mock.Mock( path="/does_not_exist", method="GET" ), ) <NEW_LINE> <DEDENT> assert '/does_not_exist' in str(excinfo) <NEW_LINE> ... | Tests that schema_and_resolver_for_request() raises exceptions when
a path is not found. | 625941c74428ac0f6e5ba83b |
@parser_node_rule <NEW_LINE> def p_NTYPE_TEMPLATE_PARM_INDEX_node(psr_val): <NEW_LINE> <INDENT> pass | node : NODE NTYPE_TEMPLATE_PARM_INDEX attr_list | 625941c7a8ecb033257d3117 |
def __init__(self, rpc_type, target_id, target_port, source_id, source_port, key, value, status, info, hop_count): <NEW_LINE> <INDENT> self.rpc = rpc_type <NEW_LINE> self.target_id = target_id <NEW_LINE> self.target_port = target_port <NEW_LINE> self.source_id = source_id <NEW_LINE> self.source_port = source_port <NEW_... | :param rpc_type: int
:param target_id: long
:param target_port: int
:param source_id: long
:param source_port: int
:param key: long
:param value: str
:param status: bool
:param info: dict
:param hop_count: int | 625941c750485f2cf553cde3 |
def test_pages_with_duplicate_urls(self): <NEW_LINE> <INDENT> parent = Page.objects.create(title=u"Parent Page") <NEW_LINE> child = Page.objects.create(title=u"Child Page", parent=parent) <NEW_LINE> parent_1 = Page.objects.create(title=u"Parent Page") <NEW_LINE> child_1 = Page.objects.create(title=u"Child Page", parent... | Test that pages with duplicate title get unique relative urls | 625941c707d97122c41788d3 |
def _add_variable_to_collections(variable, collections_set, collections_name): <NEW_LINE> <INDENT> collections = contrib_utils.get_variable_collections( collections_set, collections_name) or [] <NEW_LINE> variables_list = [variable] <NEW_LINE> if isinstance(variable, tf_variables.PartitionedVariable): <NEW_LINE> <INDEN... | Adds variable (or all its parts) to all collections with that name. | 625941c76fb2d068a760f0e6 |
def shared_gplvm(): <NEW_LINE> <INDENT> pgm = daft.PGM(shape=[4, 3], origin=[0, 0], grid_unit=5, node_unit=1.9, observed_style='shaded', line_width=3) <NEW_LINE> pgm.add_node(daft.Node("t", r"$\mathbf{t}$", 2, 2.5, observed=True)) <NEW_LINE> pgm.add_node(daft.Node("X", r"$\mathbf{X}$", 2, 1.5)) <NEW_LINE> pgm.add_node(... | Plot graphical model of a Shared GP-LVM | 625941c7287bf620b61d3aae |
def EntryToStr(entry): <NEW_LINE> <INDENT> return "(" + str(entry.key) + ", " + str(entry.value) + ")" | EntryToStr: Entry -> String
return the string representation of the entry. | 625941c755399d3f055886fd |
def retrieve_relation(source=None, target=None): <NEW_LINE> <INDENT> with open(relations_filename, 'rb') as relations_file: <NEW_LINE> <INDENT> data = pickle.load(relations_file) <NEW_LINE> if target is None: <NEW_LINE> <INDENT> return source, data[source] <NEW_LINE> <DEDENT> elif source is None: <NEW_LINE> <INDENT> fo... | Retrieves a relation from its source and/or target. | 625941c72ae34c7f2600d17b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.