code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def generate_hint_bot(node_ids, initial_biomass, range_weights, default_ranges, count): <NEW_LINE> <INDENT> serengeti = foodwebs.get_serengeti() <NEW_LINE> promising_ranges = defaultdict(lambda: defaultdict(list)) <NEW_LINE> for param_node_str, weighted_ranges in range_weights.items(): <NEW_LINE> <INDENT> param = param... | Generate node configs based on how a player might explore the parameter space
in Convergence given parameter range hints
generated from `range_weights`.
The parameters are initialBiomass, which is fixed,
X and K, which are variable,
and R, which is fixed at 1.
If a node-parameter pair is present in range_weights
and ... | 625941f266656f66f7cbc778 |
def apply_options(cursor, options): <NEW_LINE> <INDENT> old_options = {} <NEW_LINE> for option, value in options.items(): <NEW_LINE> <INDENT> cursor.execute("SHOW %s" % option) <NEW_LINE> old_value = cursor.fetchall()[0][0] <NEW_LINE> if old_value != value: <NEW_LINE> <INDENT> cursor.execute("SET LOCAL %s TO %%s" % opt... | Applies the given postgresql client options to the given cursor.
Returns a dictionary with the old values if they changed. | 625941f2cc40096d61595f18 |
def test_cron(self): <NEW_LINE> <INDENT> hd = Holder() <NEW_LINE> scheduler = BackgroundScheduler() <NEW_LINE> ds = "year='*', month='*', day=*, week='*', day_of_week='*', hour='*', minute=*, second=*" <NEW_LINE> job = scheduler.add_job(hd.myfunc, 'cron', **common_util.parse_pair(ds, ',')) <NEW_LINE> scheduler.start() ... | Like Java quartz cron.
Second, minute, hour, day, month, week_day, year
year='*', month='*', day=1, week='*', day_of_week='*', hour='*', minute=20, second=0 | 625941f2090684286d50f2ba |
def open_out_file(self, use_dir, version_num): <NEW_LINE> <INDENT> self.write_dict_file(use_dir, version_num) <NEW_LINE> self._file_handle = open(os.path.join(use_dir, self._name), 'ab', buffering=PKG_FILE_BUFSIZ) | Opens the output file for this class and prepares it
to be written via write_entity. | 625941f2046cf37aa974d30c |
def SetInPlace(self, *args): <NEW_LINE> <INDENT> return _itkInPlaceImageFilterAPython.itkInPlaceImageFilterIUS3IF3_SetInPlace(self, *args) | SetInPlace(self, bool _arg) | 625941f2d8ef3951e3243b08 |
def material_to_texture(material, upsize=True): <NEW_LINE> <INDENT> import pyglet <NEW_LINE> if hasattr(material, 'image'): <NEW_LINE> <INDENT> img = material.image <NEW_LINE> <DEDENT> elif hasattr(material, 'baseColorTexture'): <NEW_LINE> <INDENT> img = material.baseColorTexture <NEW_LINE> <DEDENT> else: <NEW_LINE> <I... | Convert a trimesh.visual.texture.Material object into
a pyglet-compatible texture object.
Parameters
--------------
material : trimesh.visual.texture.Material
Material to be converted
upsize: bool
If True, will upscale textures to their nearest power
of two resolution to avoid weirdness
Returns
---------------
... | 625941f2956e5f7376d71436 |
def test_set_overwrite(self): <NEW_LINE> <INDENT> data = self.tmp / 'test_set_overwrite.json' <NEW_LINE> self.set_overwrite(True, data) | Test setting an entry that is already set does not overwrite it. | 625941f24a966d76dd5515e1 |
def monitor( self ): <NEW_LINE> <INDENT> while 1: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> while 1: <NEW_LINE> <INDENT> pbs_job_state = self.monitor_queue.get_nowait() <NEW_LINE> if pbs_job_state is self.STOP_SIGNAL: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.watched.append( pbs_job_state ) <NEW_LINE> <DED... | Watches jobs currently in the PBS queue and deals with state changes
(queued to running) and job completion | 625941f201c39578d7e75406 |
def assemble_4x4(rotations, translations, new_row=[0, 0, 0, 1]): <NEW_LINE> <INDENT> return to_4x4(assemble_3x4(rotations, translations), new_row=new_row) | Given one (or more) 3x3 matrices and one (or more) 3d vectors,
create an array of 4x4 matrices
>>> rots = np.arange(9).reshape(3, 3)
>>> ts = np.array([99, 88, 77])
>>> assemble_4x4(rots, ts)
array([[ 0, 1, 2, 99],
[ 3, 4, 5, 88],
[ 6, 7, 8, 77],
[ 0, 0, 0, 1]])
>>> rots = np.random.rand... | 625941f2a05bb46b383ecde7 |
def __call__(self): <NEW_LINE> <INDENT> self.variable.set(self.value) | Apply the value to the variable | 625941f24428ac0f6e5badc3 |
def convert_case(directory, case, conflict_mode, recursive=False, report_file=None, ignore_symlinks=False): <NEW_LINE> <INDENT> pv.path(directory, "given", False, True) <NEW_LINE> pv.compstr(case, "case", ["lower", "title", "upper"]) <NEW_LINE> pv.compstr(conflict_mode, "conflict mode", ["rename", "skip"]) <NEW_LINE> c... | Convert the case of the file extensions. | 625941f2d53ae8145f87a82f |
def generateSmoothMesh(*args, **kwargs): <NEW_LINE> <INDENT> pass | generateSmoothMesh(parent=kNullObj, options=None) -> MObject
Creates a new polygonal mesh which is a smoothed version of the one
to which the functionset is attached. If an options object is supplied
it will be used to direct the smoothing operation, otherwise the
mesh's Smooth Mesh Preview attributes will be used.
I... | 625941f2bf627c535bc1379a |
def tostr(self): <NEW_LINE> <INDENT> return ' '.join(str(i) for i in reversed(self.coeffs)) | Возвращает строку (из коэффициентов многочлена),
которую требует конструктор на вход, Васильев Максим | 625941f23539df3088e2e916 |
def set_T(T,E='auto',foil_mode='Si'): <NEW_LINE> <INDENT> setting=calc_T(T,E,foil_mode) <NEW_LINE> for m in range(0,len(setting['tot_index'])): <NEW_LINE> <INDENT> if int(setting['tot_index'][m]): <NEW_LINE> <INDENT> caput ('XF:11IDB-BI{Attn:%02d}Cmd:In-Cmd'%(m+1),1) <NEW_LINE> print ('the %s--attenuator is put in.'%(m... | call: set_T(T,E='auto',foil_mode='Si')
function calls calc_T(T,E='auto',foil_mode='Si')
required arument:
T: commanded tranmission (e.g. 1e-3)
optional arguments:
E='auto': get beamline energy from PV (currently: DCM) | E=7894: manual overwrite of energy parameter
foil_mode='Si'|'mix': 'Si': calculating optimal configu... | 625941f2bd1bec0571d90bfa |
def reset(self): <NEW_LINE> <INDENT> pass | forget about all input relations. | 625941f230bbd722463cc394 |
def __str__(self): <NEW_LINE> <INDENT> text = "" <NEW_LINE> if self.value < 0: <NEW_LINE> <INDENT> return "Joker" <NEW_LINE> <DEDENT> elif self.value == 11: <NEW_LINE> <INDENT> text = "J" <NEW_LINE> <DEDENT> elif self.value == 12: <NEW_LINE> <INDENT> text = "Q" <NEW_LINE> <DEDENT> elif self.value == 13: <NEW_LINE> <IND... | Gets the human readable symbol of the card.
:return: The human readable symbol of the card | 625941f2287bf620b61d402b |
def test_011_text_query_condition1(self): <NEW_LINE> <INDENT> report_entry = merge(BASIC_TEXT_REPORT_ENTRY, TWO_CONDITION) <NEW_LINE> query_id = create_query(report_entry) <NEW_LINE> assert query_id != None <NEW_LINE> results = get_data(query_id) <NEW_LINE> close_query(query_id) <NEW_LINE> assert results != None <NEW_L... | Tests TEXT query with condition | 625941f23539df3088e2e917 |
def prep_texts(x, y, remove_stopwords=True, remove_punctuation=True): <NEW_LINE> <INDENT> x_tokens = re.findall(r"\w+(?:[-']\w+)*|'|[-.(]+|\S\w*", x) <NEW_LINE> y_tokens = re.findall(r"\w+(?:[-']\w+)*|'|[-.(]+|\S\w*", y) <NEW_LINE> x_tokens = [i.lower() for i in x_tokens] <NEW_LINE> y_tokens = [i.lower() for i in y_tok... | Preprocess the input text
:param x: First text
:param y: Second text
:param remove_stopwords: Boolean True/False whether or not to remove common words
:param remove_punctuation: Boolean True/False whether or not to remove punctuation marks
:return: Preprocessed token lists | 625941f263b5f9789fde76b1 |
def codesign(subject: Path): <NEW_LINE> <INDENT> command = (CODESIGN_SCRIPT, subject) <NEW_LINE> subprocess.run(command) | Codesign file or directory
NOTE: For DMG it will also notarize. | 625941f20383005118ecfbab |
def emit_posts(): <NEW_LINE> <INDENT> posts = [] <NEW_LINE> all_posts = ( DB.session.query(models.Posts).order_by(desc(models.Posts.datetime)).all() ) <NEW_LINE> DB.session.commit() <NEW_LINE> for post in all_posts: <NEW_LINE> <INDENT> print(post.num_likes) <NEW_LINE> entry = { "id": post.id, "username": post.username,... | Sends post to react | 625941f26e29344779a62bdc |
def lambda_handler(event, context): <NEW_LINE> <INDENT> if event['session']['application']['applicationId'] != os.environ.get("SKILL_ID"): <NEW_LINE> <INDENT> raise ValueError("Invalid Application ID") <NEW_LINE> <DEDENT> if event['request']['type'] == "LaunchRequest": <NEW_LINE> <INDENT> return on_launch() <NEW_LINE> ... | Route the incoming request based on type (LaunchRequest, IntentRequest,
etc.) The JSON body of the request is provided in the event parameter. | 625941f2925a0f43d254a448 |
def reset_table(): <NEW_LINE> <INDENT> h5f = tables.openFile('price_data.h5', 'w') <NEW_LINE> description = { "ticker": tables.StringCol(itemsize=6, dflt='', pos=1), "frequency": tables.StringCol(itemsize=1, dflt='d', pos=2), "date": tables.Time32Col(dflt=0.00, pos=3), "open": tables.Float32Col(dflt=0.00, pos=4), "high... | Creates h5f flatfile for storing price data
Returns
-------
h5f handle : returns a writable file handle for pytables table | 625941f26fece00bbac2dd11 |
def name_unnamed_nodes(self, base_name, index=[0]): <NEW_LINE> <INDENT> if (not self.get_name()): <NEW_LINE> <INDENT> self.set_name(base_name + str(index[0])) <NEW_LINE> index[0] = index[0] + 1 <NEW_LINE> <DEDENT> for child in self.get_children(): <NEW_LINE> <INDENT> child.name_unnamed_nodes(base_name, index) | Traverse the tree in pre-order fashion and uniquely
name the nodes that don't have a name yet | 625941f2b830903b967e9ecf |
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): <NEW_LINE> <INDENT> builder = _get_build_func() <NEW_LINE> if builder: <NEW_LINE> <INDENT> builder() <NEW_LINE> <DEDENT> val = orig_build_wheel(wheel_directory, config_settings=config_settings, metadata_directory=metadata_directory) <NEW_L... | Build a wheel with an optional pre-build step. | 625941f2d6c5a1020814461b |
def getDesktopSize(): <NEW_LINE> <INDENT> width, height = _graphics.getDesktopSize() <NEW_LINE> width = pixelsToPoints(width) <NEW_LINE> height = pixelsToPoints(height) <NEW_LINE> return (width, height) | Return primary monitor desktop size in points. | 625941f29c8ee82313fbbd43 |
def __init(self): <NEW_LINE> <INDENT> print("Please don't try to initialize an object of this ADT.") | Default initialization of the ADT. | 625941f221a7993f00bc82c6 |
def _advance(self): <NEW_LINE> <INDENT> self._prev, self._current = self._current, self._current + self._prev | Replace (prev, current) with (current, current + prev) | 625941f2b7558d58953c54d2 |
def worker_access(request, *args, **kargs): <NEW_LINE> <INDENT> response = __login(request, *args, **kargs) <NEW_LINE> if request.user.is_authenticated(): <NEW_LINE> <INDENT> request.session.set_expiry(0) <NEW_LINE> request.session["touch_emulation"] = True <NEW_LINE> if request.session.has_key("bypass_login"): <NEW_LI... | Wraps django.contrib.auth.views.login, so that some default
session values can be added for workrs. | 625941f2a17c0f6771cbe61a |
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <... | Returns the model properties as a dict | 625941f210dbd63aa1bd316d |
def findComplement(self, num): <NEW_LINE> <INDENT> def change(i): <NEW_LINE> <INDENT> if i == '0': <NEW_LINE> <INDENT> return '1' <NEW_LINE> <DEDENT> return '0' <NEW_LINE> <DEDENT> l = '' <NEW_LINE> print(bin(num)[2:]) <NEW_LINE> for i in bin(num)[2:]: <NEW_LINE> <INDENT> l += change(i) <NEW_LINE> <DEDENT> return int(l... | :type num: int
:rtype: int | 625941f2e64d504609d74e0b |
def disagree_with_marketing(self): <NEW_LINE> <INDENT> self.ew.wait_till_element_is_visible(self.MARKETING_DIALOG, 20) <NEW_LINE> self.ew.wait_and_tap_element(self.DISAGREE_BUTTON, 5) | Clicks on disagree button on marketing dialog | 625941f2f9cc0f698b140bc1 |
def inject_voltage_NEURON(self, voltagetype=None, injparameters=None, neuronsection=None): <NEW_LINE> <INDENT> if voltagetype is None or injparameters is None or neuronsection is None: <NEW_LINE> <INDENT> raise ValueError("voltagetype must be either 'SEClamp' or 'VClamp'. injparameters must be a list such that its elem... | Sets voltage injection parameters to either ``h.SEClamp``, ``h.VClamp``,
**Keyword Arguments:**
+-------------------+--------------------------------------------------------------+
| Keys | Value type |
+===================+===============================... | 625941f2462c4b4f79d1dc9b |
def initialize_model(self, save_location, folder_name, sess): <NEW_LINE> <INDENT> self.initialize_folder(save_location, folder_name) <NEW_LINE> self.initialize_variables(sess) | Setup model variables and saving information. | 625941f2566aa707497f4b2c |
def set_note_id_prefix(self, val): <NEW_LINE> <INDENT> LOG.warning("database is readonly") | Set the naming template for Gramps Note ID values.
The string is expected to be in the form of a simple text string, or
in a format that contains a C/Python style format string using %d,
such as N%d or N%04d. | 625941f21d351010ab8560e6 |
def assertRegex(text, expected_regex, msg=None): <NEW_LINE> <INDENT> if isinstance(expected_regex, (str, bytes)): <NEW_LINE> <INDENT> assert expected_regex, "expected_regex must not be empty." <NEW_LINE> expected_regex = re.compile(expected_regex) <NEW_LINE> <DEDENT> if not expected_regex.search(text): <NEW_LINE> <INDE... | Fail the test unless the text matches the regular expression. | 625941f2460517430c394740 |
def test_no_category_find_shop_sms(self): <NEW_LINE> <INDENT> message = IncomingSMS('94770000000', util.current_time(), 'find') <NEW_LINE> self.assertRaises(QueryCategoryTooShortException, message_parser.parse, message) | make sure a shop find query without a category doesn't proceed | 625941f2a219f33f34628f2c |
def testValue(self): <NEW_LINE> <INDENT> skipped = 0 <NEW_LINE> for rep in range(10): <NEW_LINE> <INDENT> for i in range(10): <NEW_LINE> <INDENT> pos = random.uniform(0, 1) <NEW_LINE> observed = self.mean([pos])[0] <NEW_LINE> expected = self.get_value(pos) <NEW_LINE> if isnan(expected): <NEW_LINE> <INDENT> skipped += 1... | test the value of the function by shuffling all particles | 625941f299fddb7c1c9de959 |
def init_model(self): <NEW_LINE> <INDENT> super(GetKNN, self).init_model() <NEW_LINE> self.users_id_viewed_item = {} <NEW_LINE> if self.k_neighbors is None: <NEW_LINE> <INDENT> self.k_neighbors = int(np.sqrt(len(self.users))) <NEW_LINE> <DEDENT> self.su_matrix = self.compute_similarity(transpose=False) <NEW_LINE> for i... | Method to initialize the model. Compute similarity matrix based on user (user x user) | 625941f2ac7a0e7691ed468c |
def getParentLink(self): <NEW_LINE> <INDENT> return self.base.get("parentLink", []) | The link to the parent | 625941f244b2445a3393265d |
def test_browse_request_1(self): <NEW_LINE> <INDENT> self.test_vrh_template(per_page='14', exp_per_page=14) | Preconditions:
- per_page is an int (as a string when inputted) in the valid range
Postconditions:
- per_page becomes an actual int | 625941f2236d856c2ad44daf |
def __repr__(self) -> str: <NEW_LINE> <INDENT> return "<%s>" % self | String representation. | 625941f2a4f1c619b28b05f6 |
def inplace_reload(method): <NEW_LINE> <INDENT> def wrapped(obj, *args, **kwargs): <NEW_LINE> <INDENT> in_place = True if kwargs.get('inplace') in (True, None) else False <NEW_LINE> api_object = method(obj, *args, **kwargs) <NEW_LINE> if in_place and api_object: <NEW_LINE> <INDENT> obj._data = api_object._data <NEW_LIN... | Executes the wrapped function and reloads the object
with data returned from the server. | 625941f27047854f462a19ce |
def parent_backdrop(node): <NEW_LINE> <INDENT> backdrops = nuke.allNodes(b"BackdropNode") <NEW_LINE> nodes = set() <NEW_LINE> for n in backdrops: <NEW_LINE> <INDENT> nodes = nodes.union(n.getNodes()) <NEW_LINE> <DEDENT> backdrops = set(backdrops) - nodes <NEW_LINE> for n in backdrops: <NEW_LINE> <INDENT> if node in n.g... | Return direct parent backdrop for @node. | 625941f20a50d4780f667463 |
def __sub__(self, other): <NEW_LINE> <INDENT> other = self._coerce(other) <NEW_LINE> if other is NotImplemented: <NEW_LINE> <INDENT> return NotImplemented <NEW_LINE> <DEDENT> return runtime.sub(self, other) | Subtraction. | 625941f2f7d966606f6aa5d7 |
def test_devel_first_sim_test_yo0_lo0_ad_miles_segments_0(self): <NEW_LINE> <INDENT> input_data_list = ["devel", 0, "first sim test", 2, "yo0_lo0", 27, "ad_miles segments 0"] <NEW_LINE> self.simulated_page_input_setter.set_input_data(input_data_list, self.test_case_state.get_is_set(), False) <NEW_LINE> time.sleep(WAITI... | BRANCH: devel
TEST SUITE: first sim test
TEST CASE: yo0_lo0
KPI: ad_miles segments 0 | 625941f24f6381625f115007 |
def __init__(self): <NEW_LINE> <INDENT> self.Data = None <NEW_LINE> self.RequestId = None | :param Data: 历史版本列表
注意:此字段可能返回 null,表示取不到有效值。
:type Data: list of IotModelData
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
| 625941f2ec188e330fd5ad5e |
def make_directory_with_timestamp() -> str: <NEW_LINE> <INDENT> directory = paths.results + '/' + str(datetime.datetime.now()) <NEW_LINE> directory = directory.replace(':', '-').replace(' ', '-')[:-7] <NEW_LINE> os.makedirs(directory) <NEW_LINE> return directory | This function creates a directory named with the current time in the main app directory specified by the current
configuration. This is useful to get unique directory names when saving experiment data, as the time stamp includes
milliseconds.
:return: The path to the directory created. | 625941f266673b3332b9265d |
def __init__(self): <NEW_LINE> <INDENT> self.save = len(sys.argv) > 0 and "save" in sys.argv[1:] <NEW_LINE> self.output_dir = pathjoin(PROJECT_ROOT, "output") <NEW_LINE> if exists(self.output_dir): <NEW_LINE> <INDENT> rmtree(self.output_dir) <NEW_LINE> <DEDENT> makedirs(self.output_dir) <NEW_LINE> self.start_xy = None ... | Creates PathFinder object, loads and displays map | 625941f2d58c6744b4258229 |
def discount_factor(self): <NEW_LINE> <INDENT> numerator = self.curve.discount_factor(self.effective) <NEW_LINE> denominator = 1 + (self.rate * self.accrual_period) <NEW_LINE> discount_factor = numerator / denominator <NEW_LINE> return np.log(discount_factor) | Method for returning the discount factor for a FRA
| 625941f267a9b606de4a8482 |
def updatePed(self,input=None): <NEW_LINE> <INDENT> count = 0 <NEW_LINE> ped = {'pedlist':[]} <NEW_LINE> with open(input,'r') as fin: <NEW_LINE> <INDENT> for line in fin: <NEW_LINE> <INDENT> if line.startswith('#'): continue <NEW_LINE> l = line.strip().split() <NEW_LINE> if l[0] == 'probeset_id': <NEW_LINE> <INDENT> pe... | Collects necessary (additional) pedigree information from the input file | 625941f226068e7796caf2b4 |
def _validate_assembly_ids(self, vcf_info): <NEW_LINE> <INDENT> assembly_chromosome_ids_call = self.wsc.get_object_subset([{ 'included': ['/contigs'], 'ref': vcf_info['assembly_ref'] }]) <NEW_LINE> assembly_chromosomes = assembly_chromosome_ids_call[0]['data']['contigs'].keys() <NEW_LINE> vcf_chromosomes = vcf_info['ch... | All chromosome ids from the vcf should be in assembly
but not all assembly chromosome ids need to be in vcf
:param params:
:return: list of all assembly chromosome ids | 625941f230c21e258bdfaa70 |
@irc <NEW_LINE> def who(bot): <NEW_LINE> <INDENT> server = bot.server <NEW_LINE> player_count = len(server.players) <NEW_LINE> if player_count == 0: <NEW_LINE> <INDENT> bot.me('has no players connected') <NEW_LINE> return <NEW_LINE> <DEDENT> formatted_names = [] <NEW_LINE> for player in list(server.players.values()): <... | Reimplemented here for the purpose of coloring the chat | 625941f2b545ff76a89143e1 |
def test_submit_book(self): <NEW_LINE> <INDENT> self.browser.get(CFG_SITE_SECURE_URL) <NEW_LINE> self.login( username="jekyll", password="j123ekyll") <NEW_LINE> self.find_element_by_link_text_with_timeout("Submit") <NEW_LINE> self.browser.find_element_by_link_text("Submit").click() <NEW_LINE> self.find_element_by_link_... | websubmit - web test submit a book | 625941f2aad79263cf391016 |
def serve_slices(request): <NEW_LINE> <INDENT> sample_ids = request.GET.get('sample_ids').split(',') <NEW_LINE> sample_paths = [ s.audio.path for s in Sample.objects.filter(id__in=sample_ids) ] <NEW_LINE> z = in_memory_zip(sample_paths).getvalue() <NEW_LINE> response = HttpResponse(z, content_type='application/zip') <N... | Returns a zip file containing the requested samples | 625941f2cdde0d52a9e53604 |
def create_n_cryptoki_config( nodes, output_path, masters, instance_id, timeout, cryptoki_database, threshold): <NEW_LINE> <INDENT> for master_id, master_info in iter(masters.items()): <NEW_LINE> <INDENT> index = "" <NEW_LINE> if len(masters) != 1: <NEW_LINE> <INDENT> index = master_id[len(instance_id):] <NEW_LINE> <DE... | Creates one cryptoki config file for each master.
nodes -- dictionary containing the info of the nodes, where the key is the an id, and the value an array containing
the info.
output_path -- where the config files will land
masters -- dictionary of masters information
instance_id -- prefix of the masters name
timeout ... | 625941f2796e427e537b0b97 |
def is_from_parent(cls, attribute_name, value=None): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = getattr(cls, attribute_name) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> for base in cls.__bases__: <NEW_LINE> <IND... | Tests if the current attribute value is shared by a parent of the given
class.
Returns None if the attribute value is None.
:param cls: Child class with the requested attribute
:param attribute_name: Name of the attribute to be tested
:param value: The exact value in the child class (optional)
:return: True if the at... | 625941f2d18da76e23532aaa |
def wx_login_bat(temp): <NEW_LINE> <INDENT> if os.path.exists(WX_QR_CODE_JPG): <NEW_LINE> <INDENT> os.remove(WX_QR_CODE_JPG) <NEW_LINE> <DEDENT> win32api.ShellExecute(0, 'open', 'python.exe', 'mian.py', '', 1) <NEW_LINE> img_path=os.path.join(basedir,'app','static','cache','%s.jpg'%temp) <NEW_LINE> starttime = datetime... | :param temp: 时间戳参数
:return: 图片名称 | 625941f2a219f33f34628f2d |
def drive_upload_file(drive_service, input_filename, parent_folder_ids, mimetype=None): <NEW_LINE> <INDENT> if mimetype is None: <NEW_LINE> <INDENT> mimetype, _enc = mimetypes.guess_type(input_filename) <NEW_LINE> <DEDENT> body = { 'name': os.path.basename(input_filename), 'parents': parent_folder_ids, } <NEW_LINE> if ... | Uploads a file from the local disk (stored at `input_filename`) to
the user's Google Drive, placing it in the directories indicated
with `parent_folder_ids`.
Arguments:
- `drive_service`:
- `input_filename`:
- `parent_folder_ids`: a list of Google Drive folder IDs, where
the file will be stored
- `mimetype`: | 625941f2cc0a2c11143dd45e |
def gaeb_conversion_convert_to_ava(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.gaeb_conversion_convert_to_ava_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.gaeb_conversion_conve... | Converts GAEB files to Dangl.AVA projects # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.gaeb_conversion_convert_to_ava(async_req=True)
>>> result = thread.get()
:param async_req bool
:param file gaeb_file: The i... | 625941f291f36d47f21acac5 |
def annular_khovanov_complex(self, qagrad=None, ring=IntegerRing()): <NEW_LINE> <INDENT> if qagrad is None: <NEW_LINE> <INDENT> return {qa: self._annular_khovanov_complex_cached(qa,ring) for qa in self._enhanced_states()} <NEW_LINE> <DEDENT> return self._annular_khovanov_complex_cached(qagrad,ring) | Return the annular Khovanov complex of the closure of a braid,
as defined in [BG2013]_
INPUT:
- ``qagrad`` -- tuple of quantum and annular grading for which to compute
the chain complex. If not specified all gradings are computed.
- ``ring`` -- (default: ``ZZ``) the coefficient ring.
OUTPUT:
The annular Khovano... | 625941f2d268445f265b543b |
def player_death(the_player): <NEW_LINE> <INDENT> global game_state <NEW_LINE> message('...and You Dead.', colors.brass) <NEW_LINE> the_player.color = colors.dark_red <NEW_LINE> the_player.char = 'F' <NEW_LINE> game_state = 'dead' | Displays player's corpse and a Game Over message | 625941f2eab8aa0e5d26e126 |
def get_environment_variables(self, plan): <NEW_LINE> <INDENT> envs = list() <NEW_LINE> if isinstance(plan, dict): <NEW_LINE> <INDENT> if 'environment' in plan and 'include' in plan['environment']: <NEW_LINE> <INDENT> envs.extend(ProjectUtils.get_list_value(plan['environment']['include'])) <NEW_LINE> <DEDENT> if 'docke... | Get all environment variables depends on selected plan | 625941f207f4c71912b11a51 |
def fold_vertical(array,foldline): <NEW_LINE> <INDENT> chunksize = [foldline,foldline+1] <NEW_LINE> left,_,right = np.array_split(array,chunksize,axis=1) <NEW_LINE> folded = np.bitwise_or(left,np.fliplr(right)) <NEW_LINE> return folded | split by making vertical line | 625941f210dbd63aa1bd316e |
def toOsgr(latlon, lon=None, datum=Datums.WGS84, Osgr=Osgr, name=''): <NEW_LINE> <INDENT> if not isinstance(latlon, _ELLB): <NEW_LINE> <INDENT> latlon = _ELLB(*parseDMS2(latlon, lon), datum=datum) <NEW_LINE> <DEDENT> elif lon is not None: <NEW_LINE> <INDENT> raise ValueError('%s not %s: %r' % ('lon', None, lon)) <NEW_L... | Convert a lat-/longitude point to an OSGR coordinate.
@param latlon: Latitude (C{degrees}) or an (ellipsoidal)
geodetic C{LatLon} point.
@keyword lon: Optional longitude in degrees (scalar or C{None}).
@keyword datum: Optional datum to convert (C{Datum}).
@keyword Osgr: Optional (sub-)class to use for t... | 625941f20a366e3fb873edec |
@commandWrap <NEW_LINE> def dR_scaleRelease(*args, **kwargs): <NEW_LINE> <INDENT> return cmds.dR_scaleRelease(*args, **kwargs) | :rtype: list|str|DagNode|AttrObject|ArrayAttrObject|Components1Base | 625941f2dd821e528d63b770 |
def test_initialization_in_memory(self): <NEW_LINE> <INDENT> df = self.get_in_memory() <NEW_LINE> self.assertEqual(df.filename, '') <NEW_LINE> self.assertEqual(type(df.df), io.BytesIO) <NEW_LINE> self.assertEqual(df.opened_r, True) <NEW_LINE> self.assertEqual(df.opened_w, True) | Tests initialization in-memory | 625941f23317a56b8693a215 |
def escape_opening_brackets(text): <NEW_LINE> <INDENT> return text.replace('[', r'\[') | Replace all occurrences of opening bracket '[' with '\[', except those
between <pre> and </pre>
Blackboard needs all opening brackets to be escaped when uploading a test
or a pool as a text file. (except for those in a <pre></pre> environnment).
This is not the case for closing brackets.
Needed for some types of qu... | 625941f2a17c0f6771cbe61b |
def zero_wake_at_ipk(beamf): <NEW_LINE> <INDENT> beamf_new = deepcopy(beamf) <NEW_LINE> beamf_new.idx_max_refresh() <NEW_LINE> beamf_new.eloss -= beamf_new.eloss[beamf_new.idx_max] <NEW_LINE> return beamf_new | reads GenesisBeam()
shifts the wake pforile so that
at maximum current slice wake is zero
returns GenesisBeam()
allows to account for wake losses without
additional linear undulator tapering | 625941f2442bda511e8be9dc |
def keys(self): <NEW_LINE> <INDENT> return list(self.__dict__.keys()) | Returns all valid keys used for this object | 625941f2e5267d203edce261 |
def get_library_updaters(self): <NEW_LINE> <INDENT> return [] | List of library updater classes
:returns: list of
:class:`~mopidy.backends.base.BaseLibraryUpdateProvider`
subclasses | 625941f2cad5886f8bd275a4 |
def getMachineStateWithName(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> eState = self.oVM.state; <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return (None, '[error getting state: %s]' % (self.oVBoxMgr.xcptToString(),)); <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> self.oTstDrv.processPendingEvents(); <NE... | Gets the current machine state both as a constant number/whatever and
as a human readable string. On error, the constants will be set to
None and the string will be the error message. | 625941f2ab23a570cc250754 |
def rendersymlink( symlink: SymbolicLink, bindings: Sequence[Binding], render: Renderer ) -> SymbolicLink: <NEW_LINE> <INDENT> return SymbolicLink( render(symlink.path, bindings), render(symlink.target, bindings), ) | Render a symbolic link by rendering its path and target. | 625941f2e5267d203edce262 |
def playGame(self, verbose=False): <NEW_LINE> <INDENT> players = [self.player2, None, self.player1] <NEW_LINE> curPlayer = 1 <NEW_LINE> board = self.game.getInitBoard() <NEW_LINE> it = 0 <NEW_LINE> while self.game.getGameEnded(board, curPlayer)==0: <NEW_LINE> <INDENT> it+=1 <NEW_LINE> if verbose: <NEW_LINE> <INDENT> as... | Executes one episode of a game.
Returns:
either
winner: player who won the game (1 if player1, -1 if player2)
or
draw result returned from the game that is neither 1, -1, nor 0. | 625941f2a8ecb033257d3697 |
def __init__(self, filename): <NEW_LINE> <INDENT> logging.Handler.__init__(self) <NEW_LINE> self.filename = None <NEW_LINE> if mpihelper.rank == mpihelper.MASTER: <NEW_LINE> <INDENT> self.filename = filename | Constructor for creating a ResultsHandler object that writes
results posted in the form of log records, to the given file.
Arguments:
filename -- String specifying file location where results can be saved | 625941f21f5feb6acb0c5115 |
def test_unlogin_coupon_returnCart(self): <NEW_LINE> <INDENT> base_url=dom_xml('url') <NEW_LINE> self.driver.get(base_url) <NEW_LINE> self.driver.refresh() <NEW_LINE> data=open_csv('po_data.csv',2) <NEW_LINE> common_catalog(self.driver,'婴幼儿') <NEW_LINE> catalog_add_cart(self.driver,True) <NEW_LINE> wait_by_linkText(sel... | 未登录购物车界面,点击优惠券,跳转到购物车界面 | 625941f2d53ae8145f87a830 |
def get_insert_tags(config_file): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(config_file, "r") as f: <NEW_LINE> <INDENT> configs = json.load(f) <NEW_LINE> <DEDENT> return ( configs["insert_start_tag"], configs["insert_end_tag"], configs["insert_string"] ) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <IND... | Get the insert tags. | 625941f27c178a314d6efa36 |
def is_extension_supported(self, extension): <NEW_LINE> <INDENT> result = False <NEW_LINE> for ext in self.supportedExtensions: <NEW_LINE> <INDENT> if ext == extension: <NEW_LINE> <INDENT> result = True <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> return result | :type extension: basestring
:rtype: bool | 625941f28c3a87329515898f |
def init_trees(self): <NEW_LINE> <INDENT> if len(self.trees) > 0: <NEW_LINE> <INDENT> self.current_tree = self.trees[0] <NEW_LINE> self.vistree = PhyloTreeViewer(self.current_tree, name=self.tree_names[0], phylo_viewer=self, xscale=100.0, stree=self.stree, gene2species=self.gene2species, winsize=self.tree_win_size, col... | Initialize trees | 625941f2d58c6744b425822a |
def scattering_rate(I,delta): <NEW_LINE> <INDENT> Gamma_sc= 0.5*38.11*(I/3.576)/(1 + (I/3.576) + 4*delta**2) <NEW_LINE> return Gamma_sc | Returns a fuction for calculating scattering rate (in MHz) for a beam of intensity
I, transition with saturation parameter I_s=3.576 mW/cm^2 and detuning delta | 625941f2d10714528d6002b7 |
def ThrowNew(self, clazz, msg): <NEW_LINE> <INDENT> return self.functions[0].ThrowNew(self, clazz, encode(msg)) | Constructs an exception object from the specified class with the message specified by
message and causes that exception to be thrown.
:param clazz: a subclass of java.lang.Throwable.
:param msg: the message used to construct the java.lang.Throwable object.
:return: 0 on success; a negative value on failure. | 625941f2e76e3b2f99f3adce |
def afterStart(self, *args): <NEW_LINE> <INDENT> return _yarp.RateThreadWrapper_afterStart(self, *args) | afterStart(RateThreadWrapper self, bool success) | 625941f2d164cc617578331b |
def euler_to_R_zxz(alpha, beta, gamma, R): <NEW_LINE> <INDENT> sin_a = sin(alpha) <NEW_LINE> cos_a = cos(alpha) <NEW_LINE> sin_b = sin(beta) <NEW_LINE> cos_b = cos(beta) <NEW_LINE> sin_g = sin(gamma) <NEW_LINE> cos_g = cos(gamma) <NEW_LINE> R[0, 0] = cos_a * cos_g - sin_a * cos_b * sin_g <NEW_LINE> R[1, 0] = cos_a ... | Generate the z-x-z Euler angle convention rotation matrix.
Rotation matrix
===============
The rotation matrix is defined as the vector of unit vectors::
R = [mux, muy, muz].
According to wikipedia (U{http://en.wikipedia.org/wiki/Euler_angles#Table_of_matrices}), the rotation matrix for the zxz convention is::
... | 625941f2a8370b7717052e6a |
def __init__(self, selectionsceneviewerwidget, parent=None): <NEW_LINE> <INDENT> QtGui.QWidget.__init__(self, parent) <NEW_LINE> self.ui = Ui_SelectionSceneviewerWidgetDlg() <NEW_LINE> self.ui.setupUi(self) <NEW_LINE> self._selectionsceneviewerwidget = selectionsceneviewerwidget <NEW_LINE> self._updateUI() | Initiaise the interactive dialog first calling the QWidget __init__ function. | 625941f232920d7e50b287a2 |
def skip(self): <NEW_LINE> <INDENT> self.pos += 1 <NEW_LINE> return self.get() | Skips to the next token | 625941f2eab8aa0e5d26e127 |
def update_editor ( self ): <NEW_LINE> <INDENT> alpha = self.factory.get_color( self )[3] <NEW_LINE> self._swatch.text = self.str_value <NEW_LINE> if self._slider is not None: <NEW_LINE> <INDENT> self._slider.SetValue( 100 - int( alpha * 100.0 ) ) <NEW_LINE> <DEDENT> set_color( self ) | Updates the editor when the object trait changes externally to the
editor. | 625941f256ac1b37e6264790 |
def uniqueMorseRepresentations(self, words): <NEW_LINE> <INDENT> d = [".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."] <NEW_LINE> result = [] <NEW_LINE> for i in words: <NEW_LINE> <INDENT> outputs = "" <NEW_L... | :type words: List[str]
:rtype: int | 625941f285dfad0860c3b42a |
def check_relation(self, relation): <NEW_LINE> <INDENT> return relation | Check the relation given and return a valid representation
The parent class assumes all relations are valid
:param string relation: The input relation representation
:return: A valid representation or None
:rtype: string | 625941f28a349b6b435e873f |
def __checks_of_type(self, clazz): <NEW_LINE> <INDENT> return [check for check in self.checks if isinstance(check, clazz)] | Filter the list of checks by the class type
:param clazz: the class
:type clazz: tuple[type]
:return:
:rtype: | 625941f2be8e80087fb21204 |
def bind_to_container( self, struct_info: "StructMetadata", name: str, index: int, offset: Optional[int] = None, ) -> None: <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.index = index <NEW_LINE> self.offset = offset <NEW_LINE> if not isinstance(self.__overrideable_attributes__, Mapping): <NEW_LINE> <INDENT> over... | Bind this field to a Struct and apply any predefined defaults.
:param binobj.structures.StructMetadata struct_info:
The metadata object describing the Struct this field will be bound into.
:param str name:
The name of this field.
:param int index:
The index of this field in the container.
:param int offset... | 625941f221bff66bcd684f19 |
def make_memo_line(): <NEW_LINE> <INDENT> line_memory = {} <NEW_LINE> def memo_line(x1, y1, x2, y2): <NEW_LINE> <INDENT> key = (x1, y1, x2, y2) <NEW_LINE> if key not in line_memory: <NEW_LINE> <INDENT> line_memory[key] = LineString([(x1, y1), (x2, y2)]) <NEW_LINE> <DEDENT> return line_memory[key] <NEW_LINE> <DEDENT> re... | Return a function that memorizes line strings to save on construction costs.
| 625941f223e79379d52eeb28 |
def _get_apply_method_name(self, event_class: str) -> str: <NEW_LINE> <INDENT> words = re.findall(word_regexp, event_class) <NEW_LINE> lowered_words = list(map(str.lower, words)) <NEW_LINE> apply_method_name = 'apply_' + '_'.join(lowered_words) <NEW_LINE> return apply_method_name | Gets the apply method name for a given event.
Args:
event_class: Name of the event. Probably the class
name of the event.
Returns:
str: Name of the apply method.
Example:
>>> event = FooEvent(id=1)
>>> Entity._get_apply_method_name(event._class)
'apply_foo_event' | 625941f266656f66f7cbc77a |
@register.inclusion_tag('bob/table_header.html') <NEW_LINE> def table_header(columns=None, url_query=None, sort=None, fugue_icons=False, sort_variable_name='sort'): <NEW_LINE> <INDENT> return { 'columns': columns, 'sort': sort, 'url_query': url_query, 'fugue_icons': fugue_icons, 'sort_variable_name': sort_variable_name... | Render a table header with sorted column options
:param columns: a list of objects of
type :py:class:bob.data_table.DataTableColumn
:param url_query: The query parameters to add to all page links
:param sort: means that the column is now sorted
:param fugue_icons: Whether to use Fugue icons or Bootstra... | 625941f24c3428357757c8f1 |
def get_valid_files(all_references, valid_extensions): <NEW_LINE> <INDENT> return [ref for ref in all_references if ref.extension in valid_extensions] | Given the list of Reference objects all_references, returns a list of
Reference objects that actually represent valid files, i.e. those whose
extension is valid. A Reference has a valid extension if the extension is
found in the collection valid_extensions.
>>> get_valid_files([Reference("/foo", "bar.c")], [".pdf", ".d... | 625941f2d268445f265b543c |
def testToYAMLOrderedDict(self): <NEW_LINE> <INDENT> class Five(validation.Validated): <NEW_LINE> <INDENT> ATTRIBUTES = { 'one': int, 'two': int, 'three': int, 'four': int, 'five': int, } <NEW_LINE> def ToDict(self): <NEW_LINE> <INDENT> return validation.SortedDict(['one', 'two', 'three', 'four', 'five'], super(Five, s... | Tests conversion of validated object to YAML. | 625941f2f548e778e58cdb4d |
def data_load(filename,label): <NEW_LINE> <INDENT> if label==0: <NEW_LINE> <INDENT> fl = (loadmat(filename)["bearing"][0][0][1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> fl = (loadmat(filename)["bearing"][0][0][2]) <NEW_LINE> <DEDENT> fl = fl.reshape(-1,) <NEW_LINE> data=[] <NEW_LINE> lab=[] <NEW_LINE> start,end=0... | This function is mainly used to generate test data and training data.
filename:Data location | 625941f230c21e258bdfaa71 |
def test_np_continuous(): <NEW_LINE> <INDENT> pass | Test transforming a np.array containing only continuous values. | 625941f260cbc95b062c6b10 |
def handle_frame(self, frame, info): <NEW_LINE> <INDENT> return frame | Callback for handling an unhandled IP frame on our virtual network.
:parameters:
frame - The entire frame data. MTU is handled internally by this class.
info - Information read out of the frame headers.
:return:
The frame data to write to the network. Return None to drop the frame. | 625941f2656771135c3ebe43 |
def skh_widzialny(self, skp_okres): <NEW_LINE> <INDENT> if skp_okres in rq_kw.PR_PotrzebujeARok: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif skp_okres in rq_kw.PR_NiePotrzebujeARok: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise RuntimeError('Nieznana wartosc: %s' % re... | SkrARok: | 625941f2e1aae11d1e74a28a |
def check_call(kwargs, expect_checkpoints): <NEW_LINE> <INDENT> checkpoint_record = [] <NEW_LINE> for result in generate_checkpoints(self.engine, self.crypto_factory, **kwargs): <NEW_LINE> <INDENT> manager = managers[result['user_id']] <NEW_LINE> nb = result['content'] <NEW_LINE> manager.mark_trusted_cells(nb, result['... | Call `generate_checkpoints`; check that all expected checkpoints
are found, with the correct content, in the correct order. | 625941f24428ac0f6e5badc5 |
def run(self): <NEW_LINE> <INDENT> logger.info('Running Scanner.') <NEW_LINE> self.rator.begin() <NEW_LINE> loop = asyncio.get_event_loop() <NEW_LINE> while 1: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.standby_data : <NEW_LINE> <INDENT> pen = len(self.standby_data ) <NEW_LINE> logger.info('Start the validati... | 运行本地扫描器 | 625941f267a9b606de4a8483 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.