code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _clean(p): <NEW_LINE> <INDENT> for d in _torem: <NEW_LINE> <INDENT> p = os.path.basename(p).replace(d, '') <NEW_LINE> <DEDENT> return p
Remove operator symbols from file names
625941e0cc40096d61595cdf
def R(G, n=1): <NEW_LINE> <INDENT> return sum(map(_R, [G]*n)) / n
Computes network robustness in :cite:`Schneider2011`. :param networkx.Graph G: The graph :param int n: The number of iteration, increase to accurate result.
625941e02c8b7c6e89b35b4e
def AppendTo(self, subject, value): <NEW_LINE> <INDENT> if isinstance(value, _ObjectMapper): <NEW_LINE> <INDENT> value.set_value(subject.constructor()) <NEW_LINE> subject.value.append(value.value) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> subject.value.append(value)
Append a value to a sequence. Args: subject: `_ObjectSequence` that is receiving new value. value: Value that is being appended to sequence.
625941e07b25080760e397e7
def neighborhood(self, c, k): <NEW_LINE> <INDENT> nodes=[] <NEW_LINE> distances = [] <NEW_LINE> nodes.append(self.root) <NEW_LINE> while (len(nodes)): <NEW_LINE> <INDENT> curr = nodes[0] <NEW_LINE> nodes.pop(0) <NEW_LINE> if self.allclose(c,curr.c) != True: <NEW_LINE> <INDENT> dist = self.distance(c, curr.c) <NEW_LINE>...
returns a list of k closest nodes to configuration c in terms of distance(q.value, c)
625941e0596a897236089e4c
def setUp(self): <NEW_LINE> <INDENT> self.log = object() <NEW_LINE> self.authenticator = object() <NEW_LINE> self.service_configs = { ServiceType.CLOUD_SERVERS: { 'name': 'cloudServersOpenStack', 'region': 'DFW'} } <NEW_LINE> eff = service_request(ServiceType.CLOUD_SERVERS, 'GET', 'servers') <NEW_LINE> self.svcreq = ef...
Save some common parameters.
625941e05fc7496912cc3d0e
def archive_crashdumps(workflow): <NEW_LINE> <INDENT> import os <NEW_LINE> datestamp = str(datetime.now())[:10] <NEW_LINE> codepath = os.path.split(os.path.abspath(__file__))[0] <NEW_LINE> crashdir = os.path.abspath("%s/crashdumps/%s" % (codepath, datestamp)) <NEW_LINE> if not os.path.isdir(crashdir): <NEW_LINE> <INDEN...
Archive crashdumps by date to Nipype_Code directory
625941e0be383301e01b580f
def run(self): <NEW_LINE> <INDENT> df = pd.read_csv(self.input().open("r")) <NEW_LINE> x_train = df.drop(columns=["target"]) <NEW_LINE> y_train = df["target"] <NEW_LINE> clf, model_name, acc_score = fit_model(self.model, x_train, y_train) <NEW_LINE> with open(self.output().path, "wb") as f: <NEW_LINE> <INDENT> pickle.d...
Calls fit_model method to train the model. Then saves model parameters to output file.
625941e07d847024c06be64f
def min(self): <NEW_LINE> <INDENT> if self.is_empty(): <NEW_LINE> <INDENT> raise Empty("Priotity queue is empty.") <NEW_LINE> <DEDENT> item = self._data[0] <NEW_LINE> return (item._key, item._value)
Return but not remove (k,v) tuple with minimum key. Raise Empty Exception if empty. :return:
625941e08e71fb1e9831db38
def contains(self, key: int) -> bool: <NEW_LINE> <INDENT> index = key % self.bucketsize <NEW_LINE> if key in self.table[index]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
Returns true if this set contains the specified element
625941e04a966d76dd5513a2
def write_text(self, text, encoding=None, errors='strict', linesep=os.linesep, append=False): <NEW_LINE> <INDENT> if isinstance(text, str): <NEW_LINE> <INDENT> if linesep is not None: <NEW_LINE> <INDENT> text = (text.replace(u('\r\n'), u('\n')) .replace(u('\r\x85'), u('\n')) .replace(u('\r'), u('\n')) .replace(u('\x85'...
Write the given text to this file. The default behavior is to overwrite any existing file; to append instead, use the `append=True` keyword argument. There are two differences between :meth:`write_text` and :meth:`write_bytes`: newline handling and Unicode handling. See below. Parameters: `text` - str/unicode - T...
625941e0be7bc26dc91cd989
def test_xpub_to_child_xpub(self): <NEW_LINE> <INDENT> root = "xpub68Gmy5EdvgibQVfPdqkBBCHxA5htiqg55crXYuXoQRKfDBFA1WEjWgP6LHhwBZeNK1VTsfTFUHCdrfp1bgwQ9xv5ski8PX9rL2dZXvgGDnw" <NEW_LINE> child1 = "xpub6ASuArnXKPbfEwhqN6e3mwBcDTgzisQN1wXN9BJcM47sSikHjJf3UFHKkNAWbWMiGj7Wf5uMash7SyYq527Hqck2AxYysAA7xmALppuCkwQ" <NEW_LINE>...
BIP32 test case for getting the child derivation of an wallet_utils.
625941e060cbc95b062c68d3
def h_levelsum(self) -> int: <NEW_LINE> <INDENT> level_sum = 0 <NEW_LINE> for goal in self.problem.goal: <NEW_LINE> <INDENT> is_goal = False <NEW_LINE> for (level, states) in enumerate(self.s_levels): <NEW_LINE> <INDENT> if is_goal: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for s in states...
Level-Sum Heuristic calculates sum of the level costs of the individual goals (admissible if goals independent) per Section 10.3 AIMA text, pg 382 - Iterate each Goal in Problem - Iterate over Levels and associated States in S-Levels object - If Goal return Level Sum - Else: - Iterate o...
625941e0d53ae8145f87a5f9
def connect(self): <NEW_LINE> <INDENT> self.attemptedRetry = True
Record an attempt to reconnect, since this is what we are trying to avoid.
625941e0cad5886f8bd27369
def getReport(self, auditors, guardInfo): <NEW_LINE> <INDENT> for auditorList, guardFile in self.reportCabinet: <NEW_LINE> <INDENT> if compareAuditorLists(auditors, auditorList): <NEW_LINE> <INDENT> report = guardFile.findReport(guardInfo) <NEW_LINE> if report is not None: <NEW_LINE> <INDENT> return report
Fetch an existing audit report if one for this auditor/guard combination is on file.
625941e0cdde0d52a9e533c5
def _inherit_weights(self, child, parent): <NEW_LINE> <INDENT> for i in range(len(child.layers)): <NEW_LINE> <INDENT> if hasattr(child.layers[i], 'W'): <NEW_LINE> <INDENT> child.layers[i].W = parent.layers[i].W.copy() <NEW_LINE> child.layers[i].w0 = parent.layers[i].w0.copy()
Copies the weights from parent to child
625941e0a05bb46b383ecbaf
def RemoveEvens(xlst): <NEW_LINE> <INDENT> for i in xlst: <NEW_LINE> <INDENT> if i % 2 == 0: <NEW_LINE> <INDENT> xlst.remove(i) <NEW_LINE> <DEDENT> <DEDENT> return xlst
Input Parameters:a list of numbers lst Returns: the a new list with all occurrences of evens removed
625941e099cbb53fe6792f76
def resolve_env(env: Environment) -> Environment: <NEW_LINE> <INDENT> return dict(ResolvedEnvironment(env))
Resolve references to other variables among all values in the given environment. Literal variable value: >>> resolve_env({'x': '42'}) {'x': '42'} Value referencing another variable: >>> resolve_env({'x': '{y}', 'y': '42'}) {'x': '42', 'y': '42'} A reference to a missing value yields an empty string, similar to Uni...
625941e0090684286d50f07a
def get_config(self): <NEW_LINE> <INDENT> config = { "calibration_layers": [keras.layers.serialize(layer) for layer in self.calibration_layers], "single_output": self.single_output, } <NEW_LINE> config.update(super(ParallelCombination, self).get_config()) <NEW_LINE> return config
Standard Keras config for serialization.
625941e060cbc95b062c68d4
def build(self, app, location=None): <NEW_LINE> <INDENT> if location is None: <NEW_LINE> <INDENT> location = os.path.abspath(app.config['STATIC_LOCATION']) <NEW_LINE> <DEDENT> if self.built is not None: <NEW_LINE> <INDENT> return self.built <NEW_LINE> <DEDENT> self.built = [] <NEW_LINE> for url_base, src in self.extens...
Build the files for this Builder
625941e07d43ff24873a3033
def update_cdn_purge_url(client, urls): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> req = models.PurgeUrlsCacheRequest() <NEW_LINE> params = { "Urls": urls } <NEW_LINE> req.from_json_string(json.dumps(params)) <NEW_LINE> resp = client.PurgeUrlsCache(req) <NEW_LINE> print(resp.to_json_string()) <NEW_LINE> print("URL:{}...
指定 URL 资源的刷新,支持指定加速区域刷新 默认情况下境内、境外每日刷新 URL 限额为各 10000 条,每次最多可提交 1000 条
625941e0656771135c3ebc03
def test_swim_records(): <NEW_LINE> <INDENT> test_path = tempfile.mkdtemp() <NEW_LINE> x_train, metadata = swim_records(test_path) <NEW_LINE> try: <NEW_LINE> <INDENT> assert x_train.shape == (62, 3) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> shutil.rmtree(test_path) <NEW_LINE> raise()
Test module swim_records.py by downloading swim_records.csv and testing shape of extracted data has 62 rows and 3 columns
625941e0e64d504609d74bd0
def create_hsv_sliders(cam1_window_name): <NEW_LINE> <INDENT> cv2.createTrackbar('H_min', cam1_window_name, 0, 180, nothing) <NEW_LINE> cv2.createTrackbar('S_min', cam1_window_name, 0, 255, nothing) <NEW_LINE> cv2.createTrackbar('V_min', cam1_window_name, 0, 255, nothing) <NEW_LINE> cv2.createTrackbar('H_max', cam1_win...
Add HSV min/max and a switch slider to cam1_window_name. args: cam1_window_name: an openCV window name. The window must already exist! returns: None.
625941e08c3a87329515874f
def selectItem_hist_popup(self, event): <NEW_LINE> <INDENT> self.selectItem_hist() <NEW_LINE> self.popupMenu_hist(event)
# Hacking moment: Uma função que junta duas funções, para assegurar a sequência...
625941e0aad79263cf390dd7
def get_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser( description="Starts firefox with an empty (clean) profile") <NEW_LINE> parser.add_argument("--profile", help="profile name", default="clean") <NEW_LINE> return parser.parse_args()
Configures command line parser and returns parsed parameters
625941e0507cdc57c6307073
def __str__(self): <NEW_LINE> <INDENT> return "[{}] ({}) {}".format( type(self).__name__, self.id, self.__dict__)
string representation of base model
625941e096565a6dacc8fa5b
def reset(self): <NEW_LINE> <INDENT> with open(self.jsonfile) as fd: <NEW_LINE> <INDENT> self.data = json.load(fd) <NEW_LINE> print("loaded data from ", self.jsonfile)
reload the data from the JSON file
625941e031939e2706e4d1f5
def test_rt_metadata(self): <NEW_LINE> <INDENT> img = lena() <NEW_LINE> textdata = "This is some arbitrary metadata for a text field" <NEW_LINE> info = TiffImagePlugin.ImageFileDirectory() <NEW_LINE> info[tag_ids['ImageJMetaDataByteCounts']] = len(textdata) <NEW_LINE> info[tag_ids['ImageJMetaData']] = textdata <NEW_LIN...
Test writing arbitrary metadata into the tiff image directory Use case is ImageJ private tags, one numeric, one arbitrary data. https://github.com/python-pillow/Pillow/issues/291
625941e0627d3e7fe0d691e2
def load_station_config(self, file): <NEW_LINE> <INDENT> self._info('Loading station config file ' + file) <NEW_LINE> stationdef = get_conf_dict(file) <NEW_LINE> if isinstance(stationdef, dict): <NEW_LINE> <INDENT> if 'station' in stationdef: <NEW_LINE> <INDENT> if isinstance(stationdef['station'], dict): <NEW_LINE> <I...
Load station configuration(s) from a config file.
625941e015baa723493c4309
def getPlanetMoonEnabledFlag(self): <NEW_LINE> <INDENT> return self.planetMoonEnabledFlag
Returns the flag that indicates that the planet geocentric longitude movement measurements should be displayed for this planet. Arguments: flag - bool value for the enabled flag.
625941e0596a897236089e4d
def update(request): <NEW_LINE> <INDENT> form = request.form() <NEW_LINE> Weibo.update(form) <NEW_LINE> return redirect('/weibo/index')
用于增加新 weibo 的路由函数
625941e007f4c71912b11815
def __init__(self, tokenizer, max_len, title_max_len, data_dir, data_set_name, path_file=None, is_overwrite=False): <NEW_LINE> <INDENT> self.tokenizer = tokenizer <NEW_LINE> self.content_id = self.tokenizer.convert_tokens_to_ids("[Content]") <NEW_LINE> self.title_id = self.tokenizer.convert_tokens_to_ids("[Title]") <NE...
初始化函数 Args: tokenizer: 分词器 max_len: 数据的最大长度 title_max_len: 生成标题的最大长度 data_dir: 保存缓存文件的路径 data_set_name: 数据集名字 path_file: 原始数据文件 is_overwrite: 是否重新生成缓存文件
625941e024f1403a92600ef4
def default(request): <NEW_LINE> <INDENT> data=json.dumps({'status': 'failed', 'response':'How cool is that'}) <NEW_LINE> return HttpResponse(data, content_type="application/json")
Metodo default pruebas
625941e06e29344779a629a0
def ad_creative_ids_with_text_simhash(self, simhash): <NEW_LINE> <INDENT> cursor = self.get_cursor() <NEW_LINE> ids_with_simhash_query_template = ( 'SELECT ad_creative_id FROM ad_creatives WHERE text_sim_hash = %s') <NEW_LINE> cursor.execute(ids_with_simhash_query_template, (simhash,)) <NEW_LINE> return [row['ad_creati...
Returns list of ad_creative_id with specified body text simhash. Args: simhash: simhash (hex value as string (without leading 0x) to look for. Returns: list of ad_creative_id (str) where ads_creatives.text_sim_hash matches specified simhash.
625941e0283ffb24f3c55c8e
def _add_asset_info(trackable_asset, asset_info, mapped_path_variable): <NEW_LINE> <INDENT> original_path_tensor = trackable_asset.asset_path <NEW_LINE> original_path = tensor_util.constant_value(original_path_tensor) <NEW_LINE> try: <NEW_LINE> <INDENT> original_path = str(original_path.astype(str)) <NEW_LINE> <DEDENT>...
Add `trackable_asset` to `asset_info`.
625941e0f7d966606f6aa399
def brage(request): <NEW_LINE> <INDENT> return render(request, "about/brage.dtl", {'brage': Upload.objects.get(name='brage')})
Presents Brage in all his glory and might!
625941e0d10714528d600078
def test_users_3_update_partial_user(self): <NEW_LINE> <INDENT> r = self.req.POST('/users', auth = ApiAuth(self.user['session_id']), json = { 'username' : 'tempuser', 'password' : 'tempuserpassword', 'email' : 'example@user.test', 'role' : 'guest' }) <NEW_LINE> self.assertOK(r) <NEW_LINE> user_id = (r.json())['user_i...
Do only partial update of the user
625941e066656f66f7cbc53d
def do_say(self, session, line): <NEW_LINE> <INDENT> self.broadcast(session.name + ': ' + line + 'n')
客户端发送消息
625941e026068e7796caf075
def validator_description(self, description): <NEW_LINE> <INDENT> if description is not None and len(description) > constants.DESC_MAX_LENGTH: <NEW_LINE> <INDENT> raise forms.ValidationError({'description': [_(constants.DESC_SIZE)]}) <NEW_LINE> <DEDENT> elif description is not None and len(description) < constants.DESC...
Validating description.
625941e0004d5f362079a6c2
def send_header(self, keyword, value): <NEW_LINE> <INDENT> print("[*] send_header") <NEW_LINE> if self.request_version != 'HTTP/0.9': <NEW_LINE> <INDENT> if not hasattr(self, '_headers_buffer'): <NEW_LINE> <INDENT> self._headers_buffer = [] <NEW_LINE> <DEDENT> self._headers_buffer.append( ("%s: %s\r\n" % (keyword, valu...
Send a MIME header to the headers buffer.
625941e0d164cc61757830e0
def _compute_test_loss(train_gradient_sums, train_hessian_sums, test_gradient_sums, test_hessian_sums, regularization): <NEW_LINE> <INDENT> steps = train_gradient_sums / (train_hessian_sums + regularization) <NEW_LINE> losses = - test_gradient_sums * steps + test_hessian_sums * steps ** 2 / 2. <NEW_LINE> return numpy.s...
Computes optimal loss of second order, given regularization
625941e0fbf16365ca6f655b
def _process_inputs(stype, peak, rolloff, time): <NEW_LINE> <INDENT> coefs = { "absacce": absacce, "relacce": relacce, "reldisp": reldisp, "relvelo": relvelo, "pvelo": pvelo, "pacce": pacce, } <NEW_LINE> meth = { "pos": _posmeth, "neg": _negmeth, "abs": _absmeth, "rms": _rmsmeth, "poss": _possmeth, "negs": _negsmeth, }...
Utility routine for srs
625941e04c3428357757c6b7
def main(): <NEW_LINE> <INDENT> args, dummy_l_log_filename_s = initialise() <NEW_LINE> if not hlib.init_app(args): <NEW_LINE> <INDENT> print('Failed to init app, aborting') <NEW_LINE> return hlib.FAIL_GENERIC <NEW_LINE> <DEDENT> rego_plates = hlib.fetch_rego_plates() <NEW_LINE> all_info = process(rego_plates) <NEW_LINE...
This program tests that data in CSV file matches data in a table.
625941e07b25080760e397e8
def shutdown(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> print(self.data.platform) <NEW_LINE> if self.data.platform == "PYINSTALLER": <NEW_LINE> <INDENT> os._exit(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.data.ui_queue1.put("WebMCP", "shutdown", "") <NEW_LINE> return True <NEW_LINE> <DEDENT> <DEDENT...
If running docker, sends message to WebMCP to shutdown webcontrol. If running as pyinstaller, calls an exit function. TODO: Add option to shutdown RPI completely. :return:
625941e04428ac0f6e5bab86
def predict(self, input_sequence): <NEW_LINE> <INDENT> return self.session.run(self.prediction, feed_dict={self.input_placeholder: input_sequence})
predicts the output based on a zero internal state
625941e0f8510a7c17cf9a90
def get_md_excluded(args): <NEW_LINE> <INDENT> group = JSSConnection.get().MobileDeviceGroup(args.group) <NEW_LINE> _get_exclusions_by_type(group)
Print all mobile device config profiles with group excluded. Args: args: argparser args with properties: group: Name or ID of mobile device group.
625941e076d4e153a657eec3
def _install_button(context, addon, version=None, show_eula=True, show_contrib=True, show_warning=True, src='', collection=None, size='', detailed=False, mobile=False): <NEW_LINE> <INDENT> request = context['request'] <NEW_LINE> app, lang = context['APP'], context['LANG'] <NEW_LINE> show_eula = bool(request.GET.get('eu...
If version isn't given, we use the latest version.
625941e06fece00bbac2dad3
@register.inclusion_tag('templatetags/edit_list.html', takes_context=False) <NEW_LINE> def edit_list(obj): <NEW_LINE> <INDENT> return { 'url': get_admin_url(obj) }
Возвращает ссылку на редактирование в админке
625941e0099cdd3c635f0fea
def deregisterDisconnectedDevice(self, serverId, deviceId): <NEW_LINE> <INDENT> self.send_deregisterDisconnectedDevice(serverId, deviceId) <NEW_LINE> return self.recv_deregisterDisconnectedDevice()
Deregisters a device with the Juzz4 system when it disconnects from the device server. (1) serverId - Server ID. (2) deviceId - Server ID. Parameters: - serverId - deviceId
625941e0f548e778e58cd910
def add_comment(app): <NEW_LINE> <INDENT> app.register_blueprint(comment_blueprint)
to the app.
625941e03539df3088e2e6dc
def extValid(filename, ext): <NEW_LINE> <INDENT> _, fileExtension = os.path.splitext(filename) <NEW_LINE> if fileExtension.lower() == ext.lower(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Check that the file has the specified extension.
625941e0bd1bec0571d909c0
def run(self): <NEW_LINE> <INDENT> if self.first_start: <NEW_LINE> <INDENT> self.first_start = False <NEW_LINE> self.dlg = BDTopoImporterDialog() <NEW_LINE> self.dlg.button_box.accepted.connect(self.importLayers) <NEW_LINE> <DEDENT> self.dlg.show() <NEW_LINE> result = self.dlg.exec_() <NEW_LINE> if result: <NEW_LINE> <...
Run method that performs all the real work
625941e08da39b475bd65309
def get_ecom_server(self, filename): <NEW_LINE> <INDENT> ecomIp = self._parse_from_file(filename, 'EcomServerIp') <NEW_LINE> ecomPort = self._parse_from_file(filename, 'EcomServerPort') <NEW_LINE> if ecomIp is not None and ecomPort is not None: <NEW_LINE> <INDENT> LOG.debug("Ecom IP: %(ecomIp)s Port: %(ecomPort)s.", {'...
Given the file name get the ecomPort and ecomIP from it. :param filename: the path and file name of the emc configuration file :returns: ecomIp - the ecom IP address :returns: ecomPort - the ecom port
625941e0e76e3b2f99f3ab97
def immediate_phrase_of(s, word_id, with_gaps=False): <NEW_LINE> <INDENT> words = dependents_of(s, word_id) <NEW_LINE> words.append(word_id) <NEW_LINE> words.sort() <NEW_LINE> if with_gaps: <NEW_LINE> <INDENT> the_gaps = list(gaps_under(s, word_id)) <NEW_LINE> if the_gaps: <NEW_LINE> <INDENT> indices, gaps = zip(*gaps_...
Return the dependents of word_id in s along with word_id.
625941e085dfad0860c3b1ed
def is_discrete(space): <NEW_LINE> <INDENT> assert_space(space) <NEW_LINE> if isinstance(space, (spaces.Discrete, spaces.MultiDiscrete, spaces.MultiBinary)): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif isinstance(space, spaces.Box): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif isinstance(space...
Checks if a space is discrete. A space is considered to be discrete if it is derived from Discrete, MultiDiscrete or MultiBinary. A Tuple space is discrete if it contains only discrete subspaces. :raises TypeError: If the space is no `gym.Space`.
625941e0bf627c535bc13561
def protect(self, protect=True, **kwargs): <NEW_LINE> <INDENT> url = self._url % {'project_id': self.project_id} <NEW_LINE> action = 'protect' if protect else 'unprotect' <NEW_LINE> url = "%s/%s/%s" % (url, self.name, action) <NEW_LINE> r = self.gitlab._raw_put(url, data=None, content_type=None, **kwargs) <NEW_LINE> ra...
Protects the branch.
625941e0460517430c39450d
def get_stats_dict(_application): <NEW_LINE> <INDENT> stats_mw = _get_stats_mw(_application) <NEW_LINE> rt_hits = stats_mw.route_hits <NEW_LINE> utcnow = datetime.datetime.utcnow().isoformat() <NEW_LINE> return {'route_stats': dict([(rt.pattern, _get_route_stats(rh)) for rt, rh in rt_hits.items() if rh]), 'start_time_u...
This endpoint provides a summary view of endppoint performance, broken down by URL pattern and status code or exception. Add ?format=json to the URL to get machine-readable data.
625941e0656771135c3ebc04
def none(self): <NEW_LINE> <INDENT> super().none() <NEW_LINE> self.id = None <NEW_LINE> self.parent = None <NEW_LINE> self.name = None <NEW_LINE> self.delete = None <NEW_LINE> self.createtime = None <NEW_LINE> self.modtime = None <NEW_LINE> self.icon = None <NEW_LINE> self.tags = None <NEW_LINE> self.type = None
clear
625941e063f4b57ef00014a0
def test_pass(self): <NEW_LINE> <INDENT> cards = self.player1.hand[0:3] <NEW_LINE> self.game.pass_cards(player=self.player1, cards=cards) <NEW_LINE> for card in cards: <NEW_LINE> <INDENT> self.assertIn(card, self.player2.hand)
Make sure we can properly pass cards.
625941e0167d2b6e31218f26
@tf_export("repeat") <NEW_LINE> @dispatch.add_dispatch_support <NEW_LINE> def repeat(input, repeats, axis=None, name=None): <NEW_LINE> <INDENT> if axis is None: <NEW_LINE> <INDENT> input = reshape(input, [-1]) <NEW_LINE> axis = 0 <NEW_LINE> <DEDENT> return repeat_with_axis(input, repeats, axis, name)
Repeat elements of `input`. See also `tf.concat`, `tf.stack`, `tf.tile`. Args: input: An `N`-dimensional Tensor. repeats: An 1-D `int` Tensor. The number of repetitions for each element. repeats is broadcasted to fit the shape of the given axis. `len(repeats)` must equal `input.shape[axis]` if axis is not...
625941e0379a373c97cfaed8
def __getitem__(self, index_or_slice): <NEW_LINE> <INDENT> if isinstance(index_or_slice, slice): <NEW_LINE> <INDENT> start, stop, step = index_or_slice.indices(len(self._ordering)) <NEW_LINE> return map(self.get_hit, xrange(start, stop, step)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.get_hit(index_or_s...
Get an item, or slice of items.
625941e0b830903b967e9c99
def news_detail(request, id): <NEW_LINE> <INDENT> item_id = int(id) <NEW_LINE> if request.LANGUAGE_CODE == 'zh': <NEW_LINE> <INDENT> size = News.objects.all().count() - 1 <NEW_LINE> first = News.objects.all()[0].id <NEW_LINE> last = News.objects.all()[size].id <NEW_LINE> if item_id == first: <NEW_LINE> <INDENT> has_pre...
新闻详情
625941e063d6d428bbe44882
def boundary_nodes(shape): <NEW_LINE> <INDENT> return np.fromiter(boundary_iter(shape), dtype=np.int)
Array of perimeter nodes. .. deprecated:: 0.6 Deprecated due to imprecise terminology. This is really perimeter_iter (see below). An array of the indices of the boundary nodes. Examples -------- >>> from landlab.utils.structured_grid import boundary_nodes >>> boundary_nodes((3, 4)) array([ 0, 1, 2, 3, 4,...
625941e057b8e32f5248382f
def general(cell, mo_coeffs, kpts=None, compact=False): <NEW_LINE> <INDENT> if kpts is not None: <NEW_LINE> <INDENT> assert len(kpts) == 4 <NEW_LINE> <DEDENT> return get_mo_eri(cell, mo_coeffs, kpts)
pyscf-style wrapper to get MO 2-el integrals.
625941e03d592f4c4ed1d3f5
def LocalizeVirtualPath(path, _noderoot=_VIRT_NODEROOT): <NEW_LINE> <INDENT> assert os.path.isabs(path) <NEW_LINE> if _noderoot and path not in _VPATH_WHITELIST: <NEW_LINE> <INDENT> if path.startswith(_VIRT_PATH_PREFIX): <NEW_LINE> <INDENT> return AddNodePrefix(path[len(_VIRT_PATH_PREFIX):], _noderoot=_noderoot) <NEW_L...
Localizes a virtual path. A "virtualized" path consists of a prefix (L{LocalizeVirtualPath}) and a local path. This function adds the node-specific directory to the local path. Virtual paths are meant to be transported via RPC.
625941e092d797404e30451d
def delete_port(self, context, id, l3_port_check=True, nw_gw_port_check=True): <NEW_LINE> <INDENT> if l3_port_check: <NEW_LINE> <INDENT> self.prevent_l3_port_deletion(context, id) <NEW_LINE> <DEDENT> neutron_db_port = self.get_port(context, id) <NEW_LINE> if nw_gw_port_check: <NEW_LINE> <INDENT> self.prevent_network_ga...
Deletes a port on a specified Virtual Network. If the port contains a remote interface attachment, the remote interface is first un-plugged and then the port is deleted. :returns: None :raises: exception.PortInUse :raises: exception.PortNotFound :raises: exception.NetworkNotFound
625941e0507cdc57c6307074
def no_recurrency_list(self): <NEW_LINE> <INDENT> fields_list = [] <NEW_LINE> return fields_list
Permet de définir quels modèles ne doivent pas être liés à des événements récurrents
625941e0d99f1b3c44c6791a
def global_clustering(g): <NEW_LINE> <INDENT> c = _gt.global_clustering(g._Graph__graph) <NEW_LINE> return c
Return the global clustering coefficient. Parameters ---------- g : :class:`~graph_tool.Graph` Graph to be used. Returns ------- c : tuple of floats Global clustering coefficient and standard deviation (jacknife method) See Also -------- local_clustering: local clustering coefficient extended_clustering: ext...
625941e0f9cc0f698b14098a
def __init__(self, attrs, tag): <NEW_LINE> <INDENT> self.tag = tag
@param tag: The XML tag of the vector (see L{indixmltag}). @type tag: L{indixmltag} @param attrs: The attributes of the XML version of the INDI object. @type attrs: DictType
625941e0d4950a0f3b08c6dc
def isType(self): <NEW_LINE> <INDENT> return "assignments"
returns the type of the model object
625941e0283ffb24f3c55c8f
def test_field_context(self): <NEW_LINE> <INDENT> context = self.field.context(self.package) <NEW_LINE> self.assertTrue(context['vcs']) <NEW_LINE> self.assertIn('type', context['vcs']) <NEW_LINE> self.assertIn('url', context['vcs']) <NEW_LINE> self.assertIn('browser', context['vcs']) <NEW_LINE> self.assertIn('full_name...
Tests field context content
625941e026238365f5f0f205
def find_calling_context(skip=2, module='inyoka'): <NEW_LINE> <INDENT> frame = sys._getframe(skip) <NEW_LINE> while frame.f_back is not None: <NEW_LINE> <INDENT> name = frame.f_globals.get('__name__') <NEW_LINE> if name and (name == module or name.startswith(module + '.')): <NEW_LINE> <INDENT> funcname = frame.f_code.c...
Finds the calling context.
625941e1377c676e91272539
def translate_wrapper(log): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> analyze_log(log) <NEW_LINE> <DEDENT> except UnrecognizedException as exception: <NEW_LINE> <INDENT> return { 'unrecognized': str(exception), 'log': ''.join([html.escape(line) for line in log.full_contents]), } <NEW_LINE> <DEDENT> if log.language =...
Translate log given log file.
625941e14e696a04525c97de
def load_list_of_roles(ds, play, current_role_path=None, variable_manager=None, loader=None, collection_search_list=None): <NEW_LINE> <INDENT> from ansible.playbook.role.include import RoleInclude <NEW_LINE> if not isinstance(ds, list): <NEW_LINE> <INDENT> raise AnsibleAssertionError('ds (%s) should be a list but was a...
Loads and returns a list of RoleInclude objects from the ds list of role definitions :param ds: list of roles to load :param play: calling Play object :param current_role_path: path of the owning role, if any :param variable_manager: varmgr to use for templating :param loader: loader to use for DS parsing/services :par...
625941e123e79379d52ee8f1
def tearDown(self): <NEW_LINE> <INDENT> db.session.remove() <NEW_LINE> db.drop_all()
Called after each test function
625941e124f1403a92600ef5
def __init__(self, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self.discriminator = None
OfferStatus - a model defined in OpenAPI
625941e150812a4eaa59c6b0
def enable_creation(self, enable): <NEW_LINE> <INDENT> self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(enable)
Enable the Ok button.
625941e11f037a2d8b94658f
def emails(self, qs, out): <NEW_LINE> <INDENT> out.write(six.u(",\n").join(six.u('%s' % (ent['email'])) for ent in qs).encode(self.encoding)) <NEW_LINE> out.write("\n")
simpler single entry with email only in the format of: my@address.com,
625941e14527f215b584c7e5
def TwosComplement(intdata): <NEW_LINE> <INDENT> for i in range(0,32): <NEW_LINE> <INDENT> if intdata & (1 << i): <NEW_LINE> <INDENT> bitlen = i + 1 <NEW_LINE> <DEDENT> <DEDENT> if intdata & (1 << (bitlen - 1)): <NEW_LINE> <INDENT> for i in range(bitlen,32): <NEW_LINE> <INDENT> intdata |= (1 << i) <NEW_LINE> <DEDENT> <...
Extend the high bit of a twos complement value to make a native int
625941e1566aa707497f48f6
def read_centimetros(self, sql='select * from tbCentimetros', **kwargs): <NEW_LINE> <INDENT> keys = tuple(i for i in kwargs.keys()) <NEW_LINE> if keys: <NEW_LINE> <INDENT> sql += ' where ' <NEW_LINE> for i in keys: <NEW_LINE> <INDENT> sql += i + '=? ' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sql = tira_espacos_ini...
Realiza busca na base de dados. Args: sql (str): SQL query. Defaults to 'select * from tbPerson' kwargs (dict): valores.
625941e1090684286d50f07c
def is_fakes3(s3_url): <NEW_LINE> <INDENT> if s3_url is not None: <NEW_LINE> <INDENT> return urlparse.urlparse(s3_url).scheme in ('fakes3', 'fakes3s') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Return True if s3_url has scheme fakes3://
625941e13346ee7daa2b3100
def add_argument_group(parser: argparse.ArgumentParser, log_file: bool = True) -> None: <NEW_LINE> <INDENT> group = parser.add_argument_group("Logging") <NEW_LINE> if log_file: <NEW_LINE> <INDENT> group.add_argument( "--log-file", default=None, help="Write log-messages to this file. If a log-file is not specified, " "e...
Adds an option-group to an OptionParser object, with options pertaining to logging. Note that 'initialize' expects the config object to have these options.
625941e1d58c6744b4257ff0
def on_draw(self): <NEW_LINE> <INDENT> self.clear() <NEW_LINE> for y, row in enumerate(self.maze): <NEW_LINE> <INDENT> for x, cell in enumerate(row): <NEW_LINE> <INDENT> if cell: self.blit_cell(x, y, (255, 255, 255)) <NEW_LINE> <DEDENT> <DEDENT> self.blit_cell(1, 1, (255, 0, 0)) <NEW_LINE> self.blit_cell((self.maze_siz...
Renders the game.
625941e1090684286d50f07d
def get_faculty_CATS(self, fac, pclass_id=None): <NEW_LINE> <INDENT> if isinstance(fac, int): <NEW_LINE> <INDENT> fac_id = fac <NEW_LINE> <DEDENT> elif isinstance(fac, FacultyData) or isinstance(fac, User): <NEW_LINE> <INDENT> fac_id = fac.id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise RuntimeError('Cannot inte...
Compute faculty workload in CATS, optionally for a specific pclass :param fac: FacultyData instance :return:
625941e1507cdc57c6307075
def c_init_pin(h_session, pin): <NEW_LINE> <INDENT> LOG.info("C_InitPIN: Initializing PIN to %s", pin) <NEW_LINE> pin = AutoCArray(data=pin) <NEW_LINE> ret = C_InitPIN(h_session, pin.array, pin.size.contents) <NEW_LINE> return ret
Initializes the PIN :param int h_session: Session handle :param pin: pin to c_initialize :returns: THe result code
625941e1236d856c2ad44b71
def grab(self, monitor): <NEW_LINE> <INDENT> if isinstance(monitor, tuple): <NEW_LINE> <INDENT> monitor = { "left": monitor[0], "top": monitor[1], "width": monitor[2] - monitor[0], "height": monitor[3] - monitor[1], } <NEW_LINE> <DEDENT> with lock: <NEW_LINE> <INDENT> return self._grab_impl(monitor)
Retrieve screen pixels for a given monitor. Note: *monitor* can be a tuple like the one PIL.Image.grab() accepts. :param monitor: The coordinates and size of the box to capture. See :meth:`monitors <monitors>` for object details. :return :class:`ScreenShot <ScreenShot>`.
625941e1d10714528d600079
def __init__(self, name, schema, description, start, gettoken, end, headline, lextypes, oid=None): <NEW_LINE> <INDENT> super(TSParser, self).__init__(name, schema, description) <NEW_LINE> self._init_own_privs(None, []) <NEW_LINE> self.start = start <NEW_LINE> self.gettoken = gettoken <NEW_LINE> self.end = end <NEW_LINE...
Initialize the parser :param name: parser name (from prsname) :param schema: schema name (from prsnamespace) :param description: comment text (from obj_description()) :param start: startup function (from prsstart) :param gettoken: next-token function (from prstoken) :param end: shutdown function (from prsend) :param h...
625941e1cdde0d52a9e533c8
def scan_err(path=MAIL_ERR_LOG): <NEW_LINE> <INDENT> logs = read_local_errlog(path) <NEW_LINE> new_errs = [x for x in logs if x.get("reported", False) is False] <NEW_LINE> for err in new_errs: <NEW_LINE> <INDENT> txt = str(err) <NEW_LINE> txt = path + "\n\n" + txt <NEW_LINE> msg = MIMEText(txt, "plain", "utf-8") <NEW_L...
查询本地的错误记录, 如果有则把错误记录发送给模块开头定义的错误处理者
625941e115fb5d323cde0ea7
def diff_thres_idxs(l,thres): <NEW_LINE> <INDENT> return [i for i in range(len(l)-1) if np.abs(l[i+1]-l[i])>thres]
Calculates the indexes at which the absolute difference between the current and the next value is more than a threshold
625941e130bbd722463cc15a
def combine(dfa1, dfa2): <NEW_LINE> <INDENT> alphabet1 = set(dfa1.delta[dfa1.init].keys()) <NEW_LINE> alphabet2 = set(dfa2.delta[dfa2.init].keys()) <NEW_LINE> alphabet = alphabet1.intersection(alphabet2) <NEW_LINE> new_dfa = Dfa() <NEW_LINE> new_dfa.delta = { (state1 + "," + state2): { letter : (trans1[letter] + "," + ...
generate a new dfa with each state being the cartesian product of the two dfas, with ',' separating the state names
625941e131939e2706e4d1f7
def loaddata (filename): <NEW_LINE> <INDENT> with open(filename) as f: <NEW_LINE> <INDENT> reader = csv.DictReader(f) <NEW_LINE> rows = [] <NEW_LINE> for row in reader: <NEW_LINE> <INDENT> rows.append(row) <NEW_LINE> <DEDENT> if sorted(reader.fieldnames) != sorted(dataDictionary.keys()): <NEW_LINE> <INDENT> print ('You...
read in datafile for analysis, resulting file is a dictionary of dictionaries where each row of data is a dictionary, the key is the variable name from the top row of data
625941e156b00c62f0f149ee
def _get_instance(instance, url='http://127.0.0.1:8880'): <NEW_LINE> <INDENT> return from_bytes(DoGet(f'{url}/instances/{instance}/file'))
Returns instance as pydicom.dataset.FileDataset from a local dicom server.
625941e176e4537e8c351a08
@app.route('/catalog/<name>/items/') <NEW_LINE> def catalog_items(name): <NEW_LINE> <INDENT> catalogs = session.query(Catalog) <NEW_LINE> catalog = session.query(Catalog).filter(Catalog.name == name).one() <NEW_LINE> items = session.query(CatalogItem).join(Catalog).filter( Catalog.name == name) <NEW_LINE> return render...
This function provides the catalog items information Args: name (string): catalog name
625941e123e79379d52ee8f2
def errors(self): <NEW_LINE> <INDENT> return T.sum(self.output)
:rtype: theano.Variable
625941e13539df3088e2e6dd
@config.g_app.route('/render/<renderID>', methods=['DELETE']) <NEW_LINE> def deleteRenderById(renderID): <NEW_LINE> <INDENT> if renderID not in g_renders: <NEW_LINE> <INDENT> logging.error("id " + renderID + " doesn't exists") <NEW_LINE> abort(make_response("id " + renderID + " doesn't exists", 404)) <NEW_LINE> <DEDENT...
Delete a render from the render array. TODO: needed? TODO: kill the corresponding process?
625941e199fddb7c1c9de722
def _check_submodule_no_git(self): <NEW_LINE> <INDENT> gitmodules_path = os.path.abspath(".gitmodules") <NEW_LINE> if not os.path.isfile(gitmodules_path): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> gitmodules_fileobj = io.StringIO() <NEW_LINE> with io.open(gitmodules_path) as f: <NEW_LINE> <INDENT> for line i...
Like ``_check_submodule_using_git``, but simply parses the .gitmodules file to determine if the supplied path is a git submodule, and does not exec any subprocesses. This can only determine if a path is a submodule--it does not perform updates, etc. This function may need to be updated if the format of the .gitmodule...
625941e14f6381625f114dce
def test_change_default_subclass(): <NEW_LINE> <INDENT> old_default = ExampleComponent.param.default_value <NEW_LINE> ExampleComponent.param.default_value = 199. <NEW_LINE> comp = ExampleSubclass1() <NEW_LINE> assert comp.param == 199. <NEW_LINE> ExampleComponent.param.default_value = old_default
check we can change a default value in subclass
625941e1b57a9660fec33c1c
def to_dict(self) -> DSLDict: <NEW_LINE> <INDENT> _log.debug('%s.to_dict: self.data=%r', self.__class__.__name__, self.data) <NEW_LINE> if not isinstance(self.data, DSLDict): <NEW_LINE> <INDENT> _log.warning('self.data=%r is not an instance of DSLDict', self.data) <NEW_LINE> <DEDENT> if self.wrap_with_key is not None: ...
Get the dict representation of a DSLBase instance.
625941e18c0ade5d55d3ed50
def is_dir(path): <NEW_LINE> <INDENT> git_path = os.path.join( os.path.abspath(os.path.expandvars(os.path.expanduser(path))), ".git" ) <NEW_LINE> return ( os.path.isdir(git_path) and os.path.isdir(os.path.join(git_path, "objects")) and os.path.isdir(os.path.join(git_path, "refs")) and os.path.isfile(os.path.join(git_pa...
Checks if path is a git, doesn't count submodule directories
625941e18a349b6b435e8505
def __set__(self, instance, value): <NEW_LINE> <INDENT> self.validate(value) <NEW_LINE> self.data[instance] = value
Field descriptor __set__ method.
625941e1d6c5a102081443e0
def __codeCoverageHideAnnotations(self): <NEW_LINE> <INDENT> for handle in self.notcoveredMarkers: <NEW_LINE> <INDENT> self.markerDeleteHandle(handle) <NEW_LINE> <DEDENT> self.notcoveredMarkers = [] <NEW_LINE> self.coverageMarkersShown.emit(False) <NEW_LINE> self.showingNotcoveredMarkers = False <NEW_LINE> self.__marke...
Private method to handle the hide code coverage annotations context menu action.
625941e1377c676e9127253a