code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def make_exam_timed(self): <NEW_LINE> <INDENT> self.q(css="#id_timed_exam").first.click() <NEW_LINE> self.q(css=".action-save").first.click() <NEW_LINE> self.wait_for_ajax()
Makes a timed exam.
625941f50383005118ecfc28
def getQueryProductAttributeDataFrame(self, train_filename, test_filename, attribute_filename, description_filename, header=0): <NEW_LINE> <INDENT> train_query_df = pd.read_csv(train_filename, delimiter=',', low_memory=False, header=header, encoding="ISO-8859-1") <NEW_LINE> test_query_df = pd.read_csv(test_filename, de...
Takes in HomeDepot CSV and process into the following dataframe: 1. train_query_df/test_query_df - id - product_uid - search_term - relevance 2. product_df - product_uid - product_title - product_description 3. attribute_df - product_uid - name - value :param train_filename: :p...
625941f53c8af77a43ae3df0
def im_show(im): <NEW_LINE> <INDENT> plt.clf() <NEW_LINE> plt.imshow(im) <NEW_LINE> plt.show() <NEW_LINE> plt.close()
:param im: numpy.array :return:
625941f5099cdd3c635f12a0
def readField(self, *args): <NEW_LINE> <INDENT> return _osgDB.FieldReader_readField(self, *args)
readField(FieldReader self, Field fieldPtr) -> bool
625941f59c8ee82313fbbdc0
def _calculateModuleVariableInfo(self, moduleObject): <NEW_LINE> <INDENT> assert moduleObject.getLanguageType() == LanguageType.MODULE <NEW_LINE> assert moduleObject.getDeclarationType() == LanguageObject.DECLARATION_TYPES.FIXED_VALUE <NEW_LINE> modName = TokensGenerator.MODULE_NAME_PREFIX + str(self.nextModuleIndex_) ...
Create the VariableInfo for this module.
625941f5283ffb24f3c55f42
def clear_desk_assignment(desk_number): <NEW_LINE> <INDENT> for record in database: <NEW_LINE> <INDENT> if record["desk_number"] == desk_number: <NEW_LINE> <INDENT> del database[database.index(record)]
Delete the record of a given desk number
625941f5566aa707497f4ba8
def set_udl_between_nodes(_udl, _node_from, _node_to, _elements, _load_matrix): <NEW_LINE> <INDENT> _current_node = _node_from * 2 <NEW_LINE> _last_node = _node_to * 2 <NEW_LINE> if _current_node > _last_node: <NEW_LINE> <INDENT> _tmp = _last_node <NEW_LINE> _last_node = _current_node <NEW_LINE> _current_node = _tmp <N...
Applies a Uniformly Distributed Load, between specified nodes, to a load matrix.
625941f5956e5f7376d714b3
def deduce_all_facts(self, facts, base=None): <NEW_LINE> <INDENT> rels = self.rels <NEW_LINE> beta_rules = self.beta_rules <NEW_LINE> if base is None: <NEW_LINE> <INDENT> new_facts = {} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> new_facts = base <NEW_LINE> <DEDENT> def x_new_facts(keys, v): <NEW_LINE> <INDENT> for k...
Deduce all facts from known facts ({} or [] of (k,v)) ********************************************* * This is the workhorse, so keep it *fast*. * ********************************************* base -- previously known facts (must be: fully deduced set) attention: base is modified *in place* /optional/ pr...
625941f5fff4ab517eb2fa89
def isPalindrome(n): <NEW_LINE> <INDENT> return str(n) == str(n)[::-1]
using list indexing
625941f5460517430c3947bb
def iscsi_login(ip_addr, port=3260): <NEW_LINE> <INDENT> return _manage_session(ip_addr, port, True)
Perform an iSCSI login.
625941f56e29344779a62c59
def verify_matches_found(self, top_matches): <NEW_LINE> <INDENT> if top_matches: <NEW_LINE> <INDENT> return {'next': 'continue'} <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return {'next': Next.Failure, 'post': "I'm sorry. I can't seem to find anything to help with that."}
True if at least one path was found, otherwise False.
625941f54f88993c3716c6a8
def __getattr__(self, ext): <NEW_LINE> <INDENT> if ext.startswith('__'): <NEW_LINE> <INDENT> raise AttributeError <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return ContextValue(val=self, ext=ext)
Interpret an unfound attribute lookup as a file extension. A new ContextValue object with that extension is returned.
625941f52c8b7c6e89b35e03
def test_part1_example1(example1): <NEW_LINE> <INDENT> assert aoc201502.part1(example1) == 58 + 43
Test part 1 on example input
625941f5b5575c28eb68e64f
def abacus(first=['3'], second=['5']): <NEW_LINE> <INDENT> nf = len(first) <NEW_LINE> ns = len(second) <NEW_LINE> diff = nf - ns <NEW_LINE> if diff < 0: <NEW_LINE> <INDENT> first = [0] * -diff + first <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> second = [0] * diff + second <NEW_LINE> <DEDENT> first = first[::-1] <NEW...
Return a list containing the digit-by-digit sum of the input lists.
625941f5d8ef3951e3243b86
def checkGlade(self, glade_tree): <NEW_LINE> <INDENT> lang = glade_tree.getroot().get("lang") <NEW_LINE> if lang: <NEW_LINE> <INDENT> lang_str = " for language %s" % lang <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> lang_str = "" <NEW_LINE> <DEDENT> for label in glade_tree.xpath(".//property[@name='label' and ../prope...
Check the validity of Pango markup.
625941f5711fe17d825429a5
def OperationOperandL(e): <NEW_LINE> <INDENT> return Tail(e)
assumes OperationP(e), returns the list of operands
625941f507d97122c4178ee3
def session_relevance_array(self, relevance, **kwargs): <NEW_LINE> <INDENT> rel_result = self.session_relevance_xml(relevance, **kwargs) <NEW_LINE> result = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for item in rel_result.objectify_text(rel_result.text).Query.Result.Answer: <NEW_LINE> <INDENT> result.append(item.text) <NE...
Get Session Relevance Results array
625941f521a7993f00bc8345
def list_of_dict_class_to_pandas_df(classobject, indexname=None): <NEW_LINE> <INDENT> all_keys=[x._possible_args() for x in classobject] <NEW_LINE> all_keys=list(set([j for i in all_keys for j in i])) <NEW_LINE> ans={} <NEW_LINE> for key in all_keys: <NEW_LINE> <INDENT> ans[key]=[] <NEW_LINE> for x in classobject: <NEW...
Takes any classobject which is a list containing objects with some attributes; turns into pd dataframe Optional indexname
625941f5f7d966606f6aa654
def log_sim(num_samp, num_dim, noise=3, indep=False, base=2): <NEW_LINE> <INDENT> sig = np.diag(np.ones(shape=(num_dim))) <NEW_LINE> x = (np.random.multivariate_normal(cov=sig, mean=np.zeros(num_dim), size=num_samp)) <NEW_LINE> gauss_noise = np.random.normal(loc=0, scale=1, size=(num_samp, 1)) <NEW_LINE> if (num_dim ==...
Function for generating a logarithmic simulation. :param num_samp: number of samples for the simulation :param num_dim: number of dimensions for the simulation :param noise: noise level of the simulation, defaults to 1 :param indep: whether to sample x and y independently, defaults to false :param base: the base of th...
625941f592d797404e3047d5
def primitive_disconnect(self, *args): <NEW_LINE> <INDENT> return _iio_swig.iio_math_gen_sptr_primitive_disconnect(self, *args)
primitive_disconnect(iio_math_gen_sptr self, basic_block_sptr block) primitive_disconnect(iio_math_gen_sptr self, basic_block_sptr src, int src_port, basic_block_sptr dst, int dst_port)
625941f5cdde0d52a9e53681
def annotate_text_starter( text, annotations ): <NEW_LINE> <INDENT> new_html_string = '' <NEW_LINE> for c in text: <NEW_LINE> <INDENT> if c == 'z': <NEW_LINE> <INDENT> new_c = '<span style="color:{0};">{1}</span>'.format("red", c) <NEW_LINE> <DEDENT> elif c == '\n': <NEW_LINE> <INDENT> new_c = "<br>" <NEW_LINE> <DEDENT...
this is a letter-by-letter (instead of word-by-word) text-annotater. It makes the 'z' characters in the input text bright red. It also changes the ' ' characters to "<br>" It does not use the annotations dictionary (but you'll want to!) It is not general (but you'll build a general temp...
625941f5c4546d3d9de73083
def threads(): <NEW_LINE> <INDENT> thread_yields = [100, 200, 500, 1000] <NEW_LINE> thread_locks = [2, 4, 8, 16] <NEW_LINE> test_command = 'sysbench --num-threads=64 --test=threads ' <NEW_LINE> test_command += '--thread-yields={0} --thread-locks={1} run ' <NEW_LINE> result = None <NEW_LINE> ret_val = {} <NEW_LINE> for ...
This tests the performance of the processor's scheduler CLI Example:: salt '*' sysbench.threads
625941f5187af65679ca5769
def test_reassign_no_mock(): <NEW_LINE> <INDENT> a = object() <NEW_LINE> shared.new_object = a <NEW_LINE> assert shared.new_object is a
Test actual reassigning.
625941f5ff9c53063f47c838
def plotandsave(auc_records, prauc_records, loss_records, file_path): <NEW_LINE> <INDENT> train_len = len(auc_records) <NEW_LINE> x = np.asarray(list(range(train_len))) + 1 <NEW_LINE> fig = plt.figure() <NEW_LINE> ax1 = fig.add_subplot(111) <NEW_LINE> ax1.plot(x, auc_records, 'r.-', x, prauc_records, 'b.-') <NEW_LINE> ...
plot the training process and save it. :param auc_records: :param prauc_records: :param loss_records: :return:
625941f5009cb60464c639f5
def get_epsilon_by_frame_function(epsilon_final, epsilon_start, epsilon_decay): <NEW_LINE> <INDENT> delta_epsilon = epsilon_start - epsilon_final <NEW_LINE> def epsilon_by_frame(frame_idx): <NEW_LINE> <INDENT> decay_magnitude = math.exp(-1. * frame_idx / epsilon_decay) <NEW_LINE> return epsilon_final + delta_epsilon * ...
Returns a function that gives the epsilon to use in each frame.
625941f5fb3f5b602dac3ce3
def main(self): <NEW_LINE> <INDENT> return self.get_queryset().main()
Return the main candidates
625941f5dd821e528d63b7ec
def _cmd_rstk(self, id): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> kernelUUID = read_string(self.conn) <NEW_LINE> break <NEW_LINE> <DEDENT> except socket.timeout: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> kernel_manager = multiKernelManager.get_kernel(kernelUUID) <NEW_LINE...
Restart a kernel by UUID
625941f5287bf620b61d40a8
def isPalindrome(self, s): <NEW_LINE> <INDENT> s.strip() <NEW_LINE> s = s.replace(' ', '') <NEW_LINE> if not s: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> start = 0 <NEW_LINE> end = len(s) - 1 <NEW_LINE> while start < end: <NEW_LINE> <INDENT> charStart = s[start] <NEW_LINE> charEnd = s[end] <NEW_LINE> if charS...
:type s: str :rtype: bool
625941f596565a6dacc8fd12
def test_interface_unpack(mocker): <NEW_LINE> <INDENT> with CommandRunMock(mocker, Tar().unpack, {'filename': Path('/tmp/package.tar.gz'), 'target': Path('some_target'), 'absolute_names': True, 'directory': Path('/some/directory'), 'overwrite': True, 'verbose': True, 'uncompress': True, 'strip_components': 2}) as call_...
Check argument construction for `tar -xf`
625941f5a17c0f6771cbe697
def removeNode(self, root, value): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if root.val > value: <NEW_LINE> <INDENT> root.left = self.removeNode(root.left, value) <NEW_LINE> <DEDENT> elif root.val < value: <NEW_LINE> <INDENT> root.right = self.removeNode(root.right, value) <N...
一、删除的节点无左右节点,直接return NULL; 二、删除的节点只有一个左节点或者右节点,return delNode->left 或者return delNode->right; 三、删除的节点即有左节点也有右节点,则需要: 1、将delNode备份,temp = delNode; 2、delNode指向后继右节点的最小节点,即delNode = minNode(delNode->right); 3、将delNode的right链接到removeNode(temp->right)上; 4、将delNode的left连接点temp的left上; :param root: :param value...
625941f54c3428357757c96c
def _fetch_img(self): <NEW_LINE> <INDENT> pass
Implement a valid method to fetch captcha img if require_captcha is set. Override and set self.img when called.
625941f5be8e80087fb2127f
def test_func_docstrings(self): <NEW_LINE> <INDENT> for func in self.sq_funcs: <NEW_LINE> <INDENT> self.assertTrue(len(func[1].__doc__) >= 1)
Check functions documentation
625941f591af0d3eaac9c066
def create(jail_type="full", template_id=None, **kwargs): <NEW_LINE> <INDENT> _options = ['full', 'clone', 'base', 'empty', 'template-clone'] <NEW_LINE> if jail_type not in _options: <NEW_LINE> <INDENT> raise SaltInvocationError('Unknown option %s' % (jail_type,)) <NEW_LINE> <DEDENT> if jail_type == 'template-clone': <...
Create a new jail CLI Example: .. code-block:: bash salt '*' iocage.create [<option>] [<property=value>]
625941f550812a4eaa59c963
def command_to_tool(self, cmd: Command) -> CommandLineTool: <NEW_LINE> <INDENT> inputs: List[CliArgument] = [*cmd.named] + ( [] if self.ignore_positionals else [*cmd.positional] ) <NEW_LINE> names = self.choose_variable_names(inputs) <NEW_LINE> hints = [] <NEW_LINE> if cmd.docker_image is not None: <NEW_LINE> <INDENT> ...
Outputs the CWL wrapper to the provided file
625941f5e64d504609d74e88
def test_size(self): <NEW_LINE> <INDENT> self.assertEqual(self.message.get_size(), 8)
[Common/Header] - size 8.
625941f5851cf427c661ab52
def do_update(self, addon): <NEW_LINE> <INDENT> self.update_error.emit( addon, NotImplementedError('An updater is not installed.') )
Begin downloading and installing an update for the provided add-on. This method is not expected to return any information. Instead, the Add-on Manager will await either an ``update_finished`` or ``update_error`` signal. ========= ============ Argument Description ========= ============ addon A :class:`AddonInf...
625941f57c178a314d6efab4
def font_data(self, right, down, field_format, data): <NEW_LINE> <INDENT> reverse = '' <NEW_LINE> if field_format.get(zpl2.ARG_REVERSE_PRINT, False): <NEW_LINE> <INDENT> reverse = self._field_reverse_print() <NEW_LINE> <DEDENT> block = '' <NEW_LINE> if field_format.get(zpl2.ARG_IN_BLOCK, False): <NEW_LINE> <INDENT> blo...
Add a full text in the buffer, with needed formatting commands
625941f54e696a04525c9a97
def fix_tail(self): <NEW_LINE> <INDENT> tail = self.content['tail'] <NEW_LINE> if (len(tail) > 0) and (tail[0] in [' \t\r\n']): <NEW_LINE> <INDENT> tail = ' ' + tail.lstrip() <NEW_LINE> <DEDENT> if (len(tail) > 0) and (tail[-1] in [' \t\r\n']): <NEW_LINE> <INDENT> tail = tail.rstrip() + ' ' <NEW_LINE> <DEDENT> self.con...
Fix tail of the element to include spaces accordingly
625941f51f037a2d8b946845
@application.route("/load_transactions_for_friends") <NEW_LINE> @login_required <NEW_LINE> @cross_origin(supports_credentials=True) <NEW_LINE> def load_user_transactions_for_friends(): <NEW_LINE> <INDENT> fs = get_friends() <NEW_LINE> if fs is None: <NEW_LINE> <INDENT> return redirect(url_for('oauth_authorize', provide...
Gets all transactions for the logged in user and their friends
625941f5293b9510aa2c38d8
def check_image(image): <NEW_LINE> <INDENT> shape = list(image.get_shape()) <NEW_LINE> shape[-1] = 3 <NEW_LINE> image.set_shape(shape) <NEW_LINE> return image
assertion = tf.assert_equal(tf.shape(image)[-1], 3, message="image must have 3 color channels") with tf.control_dependencies([assertion]): image = tf.identity(image) if image.get_shape().ndims not in (3, 4): raise ValueError("image must be either 3 or 4 dimensions")
625941f5379a373c97cfb190
def set_authorized(self, value: bool) -> "ContinuousIntegrationBase": <NEW_LINE> <INDENT> self.authorized = value <NEW_LINE> return self
Sets the value of the :code:`authorized` attribute. :param value: The value to set.
625941f55e10d32532c5f56d
def begin_create_or_update( self, resource_group_name, route_table_name, route_name, route_parameters, **kwargs ): <NEW_LINE> <INDENT> polling = kwargs.pop('polling', True) <NEW_LINE> cls = kwargs.pop('cls', None) <NEW_LINE> lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) <NEW_LINE> cont_tok...
Creates or updates a route in the specified route table. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param route_table_name: The name of the route table. :type route_table_name: str :param route_name: The name of the route. :type route_name: str :param route_parameters: ...
625941f515fb5d323cde1163
def slice_to_spectrum(self, *coords, **kwargs): <NEW_LINE> <INDENT> if 'WAVE' not in self.axes_wcs.wcs.ctype: <NEW_LINE> <INDENT> raise cu.CubeError(2, 'Spectral axis needed to create a spectrum') <NEW_LINE> <DEDENT> axis = 0 if self.axes_wcs.wcs.ctype[-1] == 'WAVE' else 1 <NEW_LINE> pixels = [cu.pixelize(coord, self.a...
For a cube containing a spectral dimension, returns a sunpy spectrum. The given coordinates represent which values to take. If they are None, then the corresponding axis is summed. Parameters ---------- fst_coord: int or None The first coordinate to pick. Keep in mind that depending on the cube, this may be in...
625941f5d268445f265b54b8
def minDepth(self, root): <NEW_LINE> <INDENT> if (root == None): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._minDepth(root)
:type root: TreeNode :rtype: int
625941f58c0ade5d55d3f00a
def Size(self): <NEW_LINE> <INDENT> return sys.getsizeof(self.Headers)
Get the total size in bytes of the object. Returns: int: size.
625941f51d351010ab856163
def process_bind_param(self, value, dialect): <NEW_LINE> <INDENT> logger.debug('Enum::process_bind_param %s %s(%s)' % (type(self).__name__, type(value).__name__, value)) <NEW_LINE> if (self.empty_to_none) and (not value): <NEW_LINE> <INDENT> value = None <NEW_LINE> <DEDENT> if value is None and None not in self.values ...
Process the value going into the database.
625941f54f88993c3716c6a9
def del_active_part(self, offset): <NEW_LINE> <INDENT> self.parts_in_progress.remove(offset)
Deletes an active task from the list. :offset: an offset of the part, type int
625941f566673b3332b926da
def make_connect_wrapper(self, sender): <NEW_LINE> <INDENT> orig_connect = sender.connect <NEW_LINE> trace = dict(messages=[]) <NEW_LINE> def add_trace(type, msg): <NEW_LINE> <INDENT> if msg.strip(): <NEW_LINE> <INDENT> trace['messages'].append((type, msg.strip())) <NEW_LINE> <DEDENT> <DEDENT> def make_send_wrapper(sen...
Make a wrapper function for the ssync_sender.Sender.connect() method that will in turn wrap the HTTConnection.send() and the Sender.readline() so that ssync protocol messages can be captured.
625941f5eab8aa0e5d26e1a3
def interfaces(): <NEW_LINE> <INDENT> ifaces = dict() <NEW_LINE> if salt.utils.which('ip'): <NEW_LINE> <INDENT> cmd1 = subprocess.Popen( 'ip link show', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0] <NEW_LINE> cmd2 = subprocess.Popen( 'ip addr show', shell=True, stdout=subprocess.PIPE, ...
Return a dictionary of information about all the interfaces on the minion
625941f591af0d3eaac9c067
@app.route('/datevst', methods=['POST']) <NEW_LINE> def shared_site(): <NEW_LINE> <INDENT> v_date = request.json['solut'] <NEW_LINE> if isinstance(v_date, str): <NEW_LINE> <INDENT> sep = v_date.split() <NEW_LINE> todaydate = date.today() <NEW_LINE> todaydate = todaydate.strftime("%b-%d-%Y") <NEW_LINE> todaydate = today...
This route is for the script called externalApis.js. The script uses axios requests to log each time some tweets this website using the tweet button.
625941f55fcc89381b1e1d0e
def _getWordCategory(word, words_category_index): <NEW_LINE> <INDENT> if word in words_category_index: <NEW_LINE> <INDENT> return words_category_index[word] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
Retrieves the category of a word :param word: :param words_category_index: :return:
625941f59b70327d1c4e1421
def tearDown(self): <NEW_LINE> <INDENT> shutil.rmtree(self.tmpdir)
Called immediately after each test method has been called.
625941f5adb09d7d5db6cdd5
def detach(self): <NEW_LINE> <INDENT> cmd = self._build_command('unmap', self.build_mapped_device()) <NEW_LINE> retcode = call(cmd, shell=True) <NEW_LINE> if retcode != 0: <NEW_LINE> <INDENT> msg = "detach: error unmapping RBD image from the host (%d)" % retcode <NEW_LINE> raise AttachPersistentDiskException(msg)
Detach the RBD image from the host.
625941f50fa83653e4657600
@raises(ArgumentMissmatchComplaint) <NEW_LINE> def test_expect_received_wrong_arg_mixed_fails(): <NEW_LINE> <INDENT> component = Substitute() <NEW_LINE> component.method('John', age=12) <NEW_LINE> expect_that(component.method.was_called_with('Johannes', age=12))
Substitute - Verify (mixed): Method was called with wrong arg
625941f53cc13d1c6d3c79c0
def initSection(self, section, repeat, repeats): <NEW_LINE> <INDENT> title = section.getAttribute('title') <NEW_LINE> color = getAttr(section, 'color', False, validator.color, settings.SECTION_COLOR_DEFAULT) <NEW_LINE> sectionTitle = self.makeTitle(title, repeat, repeats) <NEW_LINE> sectionLabel = self.labelAtCurPos(se...
Обработка новой секции Добавляем новую метку для секции и элемент в colormap :type section: xml.dom.minidom.Element :type repeat: int :type repeats: int :rtype: None
625941f5e1aae11d1e74a307
def list( self, resource_group_name, network_watcher_name, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> def internal_paging(next_link=None, raw=False): <NEW_LINE> <INDENT> if not next_link: <NEW_LINE> <INDENT> url = self.list.metadata['url'] <NEW_LINE> path_format_arguments = { 'resourceGrou...
Lists all connection monitors for the specified Network Watcher. :param resource_group_name: The name of the resource group containing Network Watcher. :type resource_group_name: str :param network_watcher_name: The name of the Network Watcher resource. :type network_watcher_name: str :param dict custom_headers: head...
625941f6656771135c3ebec0
def test_setres_modify_3(): <NEW_LINE> <INDENT> args = """-m -n resname -D -c 10:10:10""" <NEW_LINE> exp_rs = 256 <NEW_LINE> user = pwd.getpwuid(os.getuid())[0] <NEW_LINE> _args = args.replace('<USER>',user) <NEW_LINE> results = testutils.run_cmd('setres.py',_args,None) <NEW_LINE> rs = results[0] <NEW...
setres test run: modify_3 Command Output: Command Error/Debug:Cannot use -D while changing start or cycle time
625941f64e4d5625662d4a17
def _load_private_keypair(key, passphrase=None): <NEW_LINE> <INDENT> if isinstance(key, SSHKeyPair): <NEW_LINE> <INDENT> return key <NEW_LINE> <DEDENT> elif key: <NEW_LINE> <INDENT> return SSHLocalKeyPair(*_load_private_key(key, passphrase)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None
Load an SSH key pair This function loads an SSH key pair. The key argument can be either an already loaded :class:`SSHKeyPair`, a reference to a key and optional certificate as described in :func:`_load_private_key`, or ``None``. It returns an :class:`SSHKeyPair` or ``None``.
625941f6a4f1c619b28b0672
def get_xyz_from_pcd(self, point_cloud): <NEW_LINE> <INDENT> num_missing = self.img_dim[0]*self.img_dim[1] - np.asarray(point_cloud.points).shape[0] <NEW_LINE> filled_in_points = np.concatenate([np.asarray(point_cloud.points), np.zeros((num_missing,3))]) <NEW_LINE> xyz_img = np.asarray(filled_in_points).reshape(self.im...
Returns xyz array from point cloud by filling in null values with 0 Args: point_cloud: input point cloud in .pcd format Returns: xyz_img: xyz image corresponding to the point cloud
625941f66fb2d068a760f6f1
def get_os_tuple(self): <NEW_LINE> <INDENT> return self.get_os().get_tuple()
Get the current OS (name,version) tuple. :return: (os_name, os_version) :rtype: ``(str,str)`` :raises xylem.os_support.UnsupportedOsError: if OS was not detected correctly
625941f6fff4ab517eb2fa8a
def get_fitlessness(self): <NEW_LINE> <INDENT> return seq(self.history.values()).where(lambda h: not h[fit_key]).to_list()
Метод получения списка записей истории, у которых еще не посчитана фитнесс-функция
625941f682261d6c526abaf3
def __str__(self): <NEW_LINE> <INDENT> return str(self.value)
String representation of a boolean.
625941f60383005118ecfc29
def tweak_cutoff(self, cutoff): <NEW_LINE> <INDENT> self._cutoff = cutoff <NEW_LINE> self._alpha = 1 - np.exp(-1 * self._dt * self._cutoff) <NEW_LINE> self.reset()
Change the cutoff frequency for the lowpass filter.
625941f6a05bb46b383ece64
def deleteMatches(): <NEW_LINE> <INDENT> conn = connect() <NEW_LINE> cur = conn.cursor() <NEW_LINE> cur.execute("DELETE from matches;") <NEW_LINE> conn.commit() <NEW_LINE> cur.close() <NEW_LINE> conn.close()
Remove all the match records from the database.
625941f6f7d966606f6aa655
def test_text_setter_sets_single_run_text(self): <NEW_LINE> <INDENT> test_text = 'python-pptx was here!!' <NEW_LINE> p_elm = self.pList[2] <NEW_LINE> paragraph = _Paragraph(p_elm) <NEW_LINE> paragraph.text = test_text <NEW_LINE> expected = 1 <NEW_LINE> actual = len(paragraph.runs) <NEW_LINE> msg = "expected run count %...
assignment to _Paragraph.text creates single run containing value
625941f6c432627299f05294
def get_short_name(self): <NEW_LINE> <INDENT> return self.name
Retrive user's short name
625941f629b78933be1e5cee
def delete(self,request,pk=None): <NEW_LINE> <INDENT> return Response({'http_method':'DELETE'})
Handles removing an object.
625941f6e76e3b2f99f3ae4a
def login(): <NEW_LINE> <INDENT> print("login") <NEW_LINE> global loggedIn <NEW_LINE> loggedIn = False <NEW_LINE> global driver <NEW_LINE> global loggedIn <NEW_LINE> loadCookies() <NEW_LINE> checkLoggedIn() <NEW_LINE> if loggedIn: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> driver.get("https://accounts.google.com") ...
login into google account
625941f607f4c71912b11acf
def maxColumnsIn(self,width): <NEW_LINE> <INDENT> if width <= 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return (width+self.hSpace) // (self.iconSize+self.hSpace)
Return the maximum number of icon columns that fit into *width*.
625941f685dfad0860c3b4a7
def from_twitter_date(date_str): <NEW_LINE> <INDENT> return datetime.strptime(date_str, "%a %b %d %H:%M:%S +0000 %Y")
Convert a date in string twitter format to a datetime object
625941f6bf627c535bc13819
def async_close_cover(self, **kwargs): <NEW_LINE> <INDENT> return self.hass.loop.run_in_executor( None, ft.partial(self.close_cover, **kwargs))
Close cover. This method must be run in the event loop and returns a coroutine.
625941f6a05bb46b383ece65
def test_model_acc(self): <NEW_LINE> <INDENT> grouped_df = spark_testing.grouped_data(self.mock_df) <NEW_LINE> output = spark_testing.model_output(grouped_df) <NEW_LINE> state, acc = output.take(1)[0] <NEW_LINE> self.assertEqual(acc, 1.0)
Check the accuracy_score of the model.
625941f6d99f1b3c44c67bcc
def offset(self, offset): <NEW_LINE> <INDENT> self.p += offset * self.cross.normalized()
offset > 0 on the right part
625941f6be7bc26dc91cdc3d
def readFile(abpath_in,verbose=True): <NEW_LINE> <INDENT> if not os.path.exists(abpath_in): <NEW_LINE> <INDENT> raise Exception("\n# <readFile>: Input file not found.") <NEW_LINE> <DEDENT> if verbose: <NEW_LINE> <INDENT> print('\n# <readFile>: Open input file:') <NEW_LINE> print(abpath_in) <NEW_LINE> print('\n# <readFi...
Read in text file and store data <abpath_in>: str, absolute path to input txt.
625941f67047854f462a1a4c
def addNum(self, num): <NEW_LINE> <INDENT> if len(self.small) == 0: <NEW_LINE> <INDENT> heapq.heappush(self.small, -num) <NEW_LINE> return <NEW_LINE> <DEDENT> if num <= -self.small[0]: <NEW_LINE> <INDENT> heapq.heappush(self.small, -num) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> heapq.heappush(self.large, num) <NEW...
:type num: int :rtype: None
625941f6b830903b967e9f4d
def join_guild(user, guild_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.get(username=user) <NEW_LINE> guild = Guilds.objects.get(id=guild_id) <NEW_LINE> membership = GuildMemberships(guild_id=guild, user_id=user, date=timezone.now()) <NEW_LINE> membership.save() <NEW_LINE> return membership <NE...
Adds a user to a given guild ID. Returns the new membership instance if successful.
625941f630bbd722463cc414
def create_optimizer(key, config): <NEW_LINE> <INDENT> model = models.EncoderModel(config=config) <NEW_LINE> init_batch = { "input_ids": jnp.ones((1, config.max_seq_length), jnp.int32), "input_mask": jnp.ones((1, config.max_seq_length), jnp.int32), "type_ids": jnp.ones((1, config.max_seq_length), jnp.int32) } <NEW_LINE...
Creates optimizer for models.EncoderModel.
625941f6c4546d3d9de73084
def cutting_carrot(n: int, h: int): <NEW_LINE> <INDENT> for i in range(1, n): <NEW_LINE> <INDENT> print(h * math.sqrt(i / n), end = ' ')
Solution to cutting carrot
625941f6ad47b63b2c50a5ca
def slot_fullhistory(self, dummy_sender, data): <NEW_LINE> <INDENT> (history) = data <NEW_LINE> if not len(history): <NEW_LINE> <INDENT> self.debug("### history download was empty") <NEW_LINE> return <NEW_LINE> <DEDENT> def get_time_round(date): <NEW_LINE> <INDENT> return int(date / self.timeframe) * self.timeframe <NE...
process the result of the fullhistory request
625941f65fdd1c0f98dc0880
def probability_matrix_seq(peakseq, init, end, nsym, gap, laplace=0.0): <NEW_LINE> <INDENT> pm = np.zeros((nsym, nsym)) + laplace <NEW_LINE> for i in range(init, end - 1): <NEW_LINE> <INDENT> if peakseq[i + 1][1] - peakseq[i][1] < gap: <NEW_LINE> <INDENT> pm[peakseq[i][0] - 1, peakseq[i + 1][0] - 1] += 1.0 <NEW_LINE> <...
Computes the probability matrix of the transitions from a sequence of points Each element of the sequence is the class and the moment of time of the peak This function ignores the times of the peaks The Laplace correction assumes a minimum number of transitions per peak :param peakseq: :param init: :param end: :retu...
625941f64d74a7450ccd4810
def hex(self, *args, **kwargs): <NEW_LINE> <INDENT> pass
Return the data in the buffer as a string of hexadecimal numbers.
625941f6236d856c2ad44e2e
def check_fleet_edges(settings, alien_groups): <NEW_LINE> <INDENT> for alien_column in alien_groups: <NEW_LINE> <INDENT> for alien in alien_column.sprites(): <NEW_LINE> <INDENT> if alien.check_edges(): <NEW_LINE> <INDENT> change_fleet_direction(settings, alien_groups) <NEW_LINE> break
Respond appropriately if any aliens have reached an edge.
625941f69c8ee82313fbbdc2
def main(self): <NEW_LINE> <INDENT> logging.error('Subclass main method... %s' % time.clock())
Subclass this method
625941f6d164cc6175783399
def save(saver, sess, logdir, step): <NEW_LINE> <INDENT> model_name = 'model.ckpt' <NEW_LINE> checkpoint_path = os.path.join(logdir, model_name) <NEW_LINE> if not os.path.exists(logdir): <NEW_LINE> <INDENT> os.makedirs(logdir) <NEW_LINE> <DEDENT> saver.save(sess, checkpoint_path, global_step=step) <NEW_LINE> print('The...
Saves the trained weights. Args: saver: TensorFlow Saver object. sess: TensorFlow session. logdir: path to the snapshots directory. step: current training step.
625941f65fc7496912cc3fc7
def arr_normalize(arr, *args, **kwargs): <NEW_LINE> <INDENT> f_max = arr.max() <NEW_LINE> f_min = arr.min() <NEW_LINE> f_range = f_max - f_min <NEW_LINE> arr_shifted = arr + -f_min <NEW_LINE> arr_norm = arr_shifted / f_range <NEW_LINE> for key, value in kwargs.iteritems(): <NEW_LINE> <INDENT> if key == 'scale': arr_nor...
ARGS arr array to normalize **kargs scale = <f_scale> scale the normalized output by <f_scale> DESC Given an input array, <arr>, normalize all values to range between 0 and 1. If specified in the **kwargs, optionally set the scale with <f_scale>.
625941f691f36d47f21acb44
def dim(p,t): <NEW_LINE> <INDENT> td = 0.445268*t/p[1] <NEW_LINE> sds = dls([p[1]/(p[1]+p[2]),2*p[3]*p[1]],td) <NEW_LINE> sd = [] <NEW_LINE> for i in range(0,len(sds)): <NEW_LINE> <INDENT> sd.append(0.868589*p[0]*sds[i]) <NEW_LINE> <DEDENT> return sd
BLT_DIM(p,t) Boulton (1963) model for unconfined aquifer Syntax: s = blt_dim(p,t) p = vector of the parameters p(1) = a : slope of the late time Jacob's straight line in m p(2) = t0 : intercept with the horizontal axis for s = 0 p(3) = t1 p(4) = phi t = dimensionless time t = ti...
625941f68a349b6b435e87bc
def validate_authorization_request(self): <NEW_LINE> <INDENT> client = self.authenticate_token_endpoint_client() <NEW_LINE> log.debug('Validate authorization request of %r', client) <NEW_LINE> redirect_uri = self.validate_authorization_redirect_uri( self.request, client) <NEW_LINE> response_type = self.request.response...
The client constructs the request URI by adding the following parameters to the query component of the authorization endpoint URI using the "application/x-www-form-urlencoded" format. Per `Section 4.2.1`_. response_type REQUIRED. Value MUST be set to "token". client_id REQUIRED. The client identifier as d...
625941f68a43f66fc4b546a8
def _default_observation(self, obs_spec, agent_index): <NEW_LINE> <INDENT> response_observation = dummy_observation.Builder(obs_spec).build() <NEW_LINE> features_ = self._features[agent_index] <NEW_LINE> observation = features_.transform_obs(response_observation) <NEW_LINE> if 'feature_minimap' in observation: <NEW_LIN...
Returns a mock observation from an SC2Env.
625941f6566aa707497f4baa
def CollectFiles(self,oPath, bSubDirs=False): <NEW_LINE> <INDENT> aFiles=oPath.GetFileList(bSubDirs=bSubDirs,bFullPath=True) <NEW_LINE> for uFile in aFiles: <NEW_LINE> <INDENT> oFile=cFileName(u'').ImportFullPath(uFnFullName=uFile) <NEW_LINE> if oFile.string.endswith(".py") or oFile.string.endswith(".txt"): <NEW_LINE> ...
adds all files in a folder to the list of sources
625941f6d10714528d600335
def get(self, request): <NEW_LINE> <INDENT> base_uri = generate_base_uri(request) <NEW_LINE> response_data = {} <NEW_LINE> response_data['name'] = "Open edX API" <NEW_LINE> response_data['description'] = "Machine interface for interactions with Open edX." <NEW_LINE> response_data['documentation'] = "http://docs.openedx...
GET /api/
625941f621bff66bcd684f97
def _get_model_par_seq(self, par_seq, name): <NEW_LINE> <INDENT> logger = getCLogger('INIT') <NEW_LINE> logger.info("Converting sequence of model parameter names/indices.") <NEW_LINE> par_seq = e13.split_seq(par_seq) <NEW_LINE> for i, par_idx in enumerate(par_seq): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if isinst...
Converts a provided sequence `par_seq` of model parameter names and indices to a list of indices, removes duplicates and checks if every provided name/index is valid. Parameters ---------- par_seq : 1D array_like of {int, str} A sequence of integers and strings determining which model parameters need to be use...
625941f655399d3f05588d03
def check_litigant(self, source, ustr): <NEW_LINE> <INDENT> ret = None <NEW_LINE> return ret
当事人
625941f6460517430c3947bd
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
625941f6e5267d203edce2df
@public <NEW_LINE> def pointer_from_inthandle(ihandle): <NEW_LINE> <INDENT> return pointer_from_edict(edict_from_inthandle(ihandle))
Returns a BaseEntity pointer from the given handle in int form
625941f60fa83653e4657601
def test_table_jobs_per_user(self): <NEW_LINE> <INDENT> t = get_table_jobs_per_user(self.users[0]) <NEW_LINE> self.assertEqual(len([row.id for row in t]), 4) <NEW_LINE> self.assertEqual([row.narticles for row in t], [8, 6, 4, 2]) <NEW_LINE> self.assertIsNotNone(t)
Is the sets per user table correct
625941f6f9cc0f698b140c40
def update(self, accelerometer, gyroscope, magnetometer=None): <NEW_LINE> <INDENT> if magnetometer is None: <NEW_LINE> <INDENT> return self._madgwick_imu(accelerometer, gyroscope) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._madgwick_ahrs(accelerometer, gyroscope, magnetometer)
Update the rotation of the device using data from an accelerometer, gyroscope and optionally a magnetometer
625941f6004d5f362079a978
def defragment6(packets): <NEW_LINE> <INDENT> lst = [x for x in packets if IPv6ExtHdrFragment in x] <NEW_LINE> if not lst: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> id = lst[0][IPv6ExtHdrFragment].id <NEW_LINE> llen = len(lst) <NEW_LINE> lst = [x for x in lst if x[IPv6ExtHdrFragment].id == id] <NEW_LINE> if len...
Performs defragmentation of a list of IPv6 packets. Packets are reordered. Crap is dropped. What lacks is completed by 'X' characters.
625941f63eb6a72ae02ecb3a
def addICT(self, ICTnumber, ICTcentre): <NEW_LINE> <INDENT> if ICTnumber in self.dict: <NEW_LINE> <INDENT> preexistingICT = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> preexistingICT = False <NEW_LINE> <DEDENT> if type(ICTnumber) == tuple and len(ICTnumber) == 2: <NEW_LINE> <INDENT> if type(ICTcentre) == tuple a...
Adds or updates the coordinates of an ICT to the dictionary. Args: ICTnumber: tuple of length 2 in the format (G1_electronNo, G2_electronNo) ICTcentre: tuple of length 4 in the format (G1_centre, G1_length, G2_centre, G2_length)
625941f6507cdc57c6307335
def raw_info(self): <NEW_LINE> <INDENT> from os import linesep <NEW_LINE> from . import display_unicode <NEW_LINE> if (self.has_ilst_atom()): <NEW_LINE> <INDENT> comment_lines = [u"M4A:"] <NEW_LINE> for atom in self.ilst_atom(): <NEW_LINE> <INDENT> if (hasattr(atom, "raw_info_lines")): <NEW_LINE> <INDENT> comment_lines...
returns a Unicode string of low-level MetaData information whereas __unicode__ is meant to contain complete information at a very high level raw_info() should be more developer-specific and with very little adjustment or reordering to the data itself
625941f663b5f9789fde7730
def delete(self, compute_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.manager.delete(server=compute_id) <NEW_LINE> <DEDENT> except nova_exceptions.NotFound: <NEW_LINE> <INDENT> LOG.warning("Nova instance with id: %s not found. " "Assuming already deleted.", compute_id) <NEW_LINE> <DEDENT> except Exception as ...
Delete a virtual machine. :param compute_id: virtual machine UUID
625941f6b830903b967e9f4e