code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def getMessagesByRoomId(roomId): <NEW_LINE> <INDENT> connect = sqlite3.connect(db_path) <NEW_LINE> cursor = connect.cursor() <NEW_LINE> sql = 'SELECT * FROM Message WHERE roomId="{}"'.format(roomId) <NEW_LINE> messageList = cursor.execute(sql).fetchall() <NEW_LINE> return messageList
Description : TODO
625941eebe7bc26dc91cdb4d
def getCurrentPotentialEnergy(self, time_series=False): <NEW_LINE> <INDENT> return self.getPotentialEnergy(time_series, block=False)
Get the current potential energy. Parameters ---------- time_series : bool Whether to return a list of time series records. Returns ------- energy : :class:`Energy <BioSimSpace.Types.Energy>` The potential energy.
625941ee9b70327d1c4e132f
def get_output(self, packet: GameTickPacket) -> SimpleControllerState: <NEW_LINE> <INDENT> self.boost_pad_tracker.update_boost_status(packet) <NEW_LINE> if self.active_sequence is not None and not self.active_sequence.done: <NEW_LINE> <INDENT> controls = self.active_sequence.tick(packet) <NEW_LINE> if controls is not N...
This function will be called by the framework many times per second. This is where you can see the motion of the ball, etc. and return controls to drive your car.
625941eed18da76e23532a35
def create_unpacked_kdbg(volume_path, target_dir): <NEW_LINE> <INDENT> src_path = find_pkg_file(volume_path) <NEW_LINE> pkg_path = os.path.join(target_dir, "debug_kit.pkg") <NEW_LINE> shutil.copy(src_path, pkg_path) <NEW_LINE> sys.stderr.write("Package file copied from %s to %s.\n" % (src_path, pkg_path)) <NEW_LINE> ru...
Search 'volume_path' for the debug kit file and unpack it into temp. Arguments: volume_path: Where the debug kit DMG is mounted. target_dir: Temp directory where the contents will be unpacked into. Raises: IOError or OSError on failure. Returns: Nothing.
625941ee3cc13d1c6d3c78cf
def button_area(control_store): <NEW_LINE> <INDENT> row_layout = Layout( width='100%', padding='10px' ) <NEW_LINE> row1 = HBox([make_test_selector(return_button=True)], layout=row_layout) <NEW_LINE> row2 = VBox(make_unit_chooser(return_button=True, width='100%'), layout=row_layout) <NEW_LINE> row3 = HBox([ run_buttons(...
Displays all control buttons :param control_store: :return:
625941eebaa26c4b54cb1672
def fprop(self, input): <NEW_LINE> <INDENT> return self.embedding[input]
Propogate the input through the layer.
625941ee656771135c3ebdcd
def load(file, encoding='utf-8'): <NEW_LINE> <INDENT> read = getattr(file, 'read', None) <NEW_LINE> if not callable(read): <NEW_LINE> <INDENT> raise TypeError('file must be a readable file object that implements ' 'read() method') <NEW_LINE> <DEDENT> return load(read(), encoding=encoding)
Similar to :func:`loads()` except it reads the passed ``file`` object instead of a string.
625941eebd1bec0571d90b87
def split_args(stringP): <NEW_LINE> <INDENT> returnValue = [] <NEW_LINE> rawSplit = stringP.split() <NEW_LINE> compensateElement=False <NEW_LINE> elementStr = '' <NEW_LINE> for element in rawSplit: <NEW_LINE> <INDENT> if "'" in element : <NEW_LINE> <INDENT> if element.count("'") % 2 != 0 : <NEW_LINE> <INDENT> if compen...
Split arguments respecting aggregate strings.
625941ee4e696a04525c99a5
def xrange(self, stream, start='-', stop='+', count=None): <NEW_LINE> <INDENT> if count is not None: <NEW_LINE> <INDENT> extra = ['COUNT', count] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> extra = [] <NEW_LINE> <DEDENT> fut = self.execute(b'XRANGE', stream, start, stop, *extra) <NEW_LINE> return wait_convert(fut, pa...
Retrieve messages from a stream.
625941ee8da39b475bd654d3
def _init_from_2d(self, polyhedron): <NEW_LINE> <INDENT> assert polyhedron.ambient_dim() == 2, "Requires polyhedron in 2d" <NEW_LINE> self.dimension = 2 <NEW_LINE> self._init_points(polyhedron) <NEW_LINE> self._init_lines_arrows(polyhedron) <NEW_LINE> self._init_area_2d(polyhedron)
Internal function: Initialize from polyhedron in 2-dimensional space. The polyhedron could be lower dimensional. TESTS:: sage: p = Polyhedron(vertices = [[0,0],[0,1],[1,0],[1,1]]) sage: proj = p.projection() sage: [proj.coordinates_of([i]) for i in proj.points] [[[0, 0]], [[0, 1]], [[1, 0]], [[1, 1]...
625941ee76d4e153a657f08b
@task(pre=[setup]) <NEW_LINE> def test_all(): <NEW_LINE> <INDENT> for name in test_names(): <NEW_LINE> <INDENT> test(name=name)
Runs all test sets.
625941ee6e29344779a62b68
def props_to_sql(props,date_type = 'int'): <NEW_LINE> <INDENT> for k,v in props.items(): <NEW_LINE> <INDENT> locals()[k] = v <NEW_LINE> <DEDENT> fields = props.pop('fields') <NEW_LINE> view = props.pop('view') <NEW_LINE> DATE_NAME = props.pop('DATE_NAME') <NEW_LINE> if fields == '': <NEW_LINE> <INDENT> fields = '*' <NE...
parser jaqs origin filter str --->>> dict
625941ee379a373c97cfb09f
def handle_extinction(self, species, player): <NEW_LINE> <INDENT> if species.population < MIN_POP: <NEW_LINE> <INDENT> player.species.remove(species) <NEW_LINE> self.deal_cards(player, EXTINCTION_CARD_AMOUNT)
Removes the given species from the player in exchange for TraitCards if the species went extinct in an attack. :param species: a Species harmed in an attack :param player: the PlayerState of the player owning the given Species
625941ee090684286d50f246
@bp.route('/<int:image_id>/', methods=['GET']) <NEW_LINE> @jwt_required <NEW_LINE> def get_annotation(image_id): <NEW_LINE> <INDENT> image = Image.query.filter_by(id=image_id).first() <NEW_LINE> if image is None: <NEW_LINE> <INDENT> abort(400, 'Invalid image id') <NEW_LINE> <DEDENT> maybe_get_project(image.project_id) ...
Get all annotations for specific image Args: image_id -- id of image to get annotations for Returns: annotations JSON data and HTTP status code
625941eecc0a2c11143dd3e9
def check(self, mod, schema_name): <NEW_LINE> <INDENT> v = self.asdlmod.Check() <NEW_LINE> v.visit(mod) <NEW_LINE> for t in v.types: <NEW_LINE> <INDENT> if t not in mod.types and not t in self.asdlmod.builtin_types: <NEW_LINE> <INDENT> v.errors += 1 <NEW_LINE> uses = ", ".join(v.types[t]) <NEW_LINE> print(("Undefined t...
Check the validity of an ASDL parse.
625941eea17c0f6771cbe5a7
def sortedArrayToBST(self, nums): <NEW_LINE> <INDENT> if not nums: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> n = len(nums) <NEW_LINE> if n == 1: <NEW_LINE> <INDENT> return TreeNode(nums[0]) <NEW_LINE> <DEDENT> mid = n // 2 <NEW_LINE> root = TreeNode(nums[mid]) <NEW_LINE> root.right = self.sortedArrayToBST(num...
:type nums: List[int] :rtype: TreeNode
625941eee64d504609d74d98
def __init__(self, win, radius, game, center, idnum, color='red', name=''): <NEW_LINE> <INDENT> EventHandler.__init__(self) <NEW_LINE> self._win = win <NEW_LINE> self._radius = radius <NEW_LINE> self._center = center <NEW_LINE> self._color = color <NEW_LINE> self._game = game <NEW_LINE> self._name = name <NEW_LINE> sel...
Initializes a player
625941ee5fcc89381b1e1c1b
def velAccel(self): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> for x in self.quotes: <NEW_LINE> <INDENT> if(i >= len(self.quotes)-(1+self.aveDays)): <NEW_LINE> <INDENT> x.append(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> vel = (x[ADJCLOSE] - self.quotes[i+self.aveDays][ADJCLOSE]) / self.quotes[i+1][ADJCLOSE] <NEW_LINE>...
Add price velocity and accel
625941ee435de62698dfe1a5
def train_op_fn(): <NEW_LINE> <INDENT> features, labels = get_inputs() <NEW_LINE> n_hidden = 16 <NEW_LINE> x = tf.layers.dense(features, n_hidden) <NEW_LINE> x = tf.layers.batch_normalization( x, training=True, scale=False) <NEW_LINE> x = tf.nn.relu(x) <NEW_LINE> x = tf.layers.dense(x, 1) <NEW_LINE> x = tf.squeeze(x, a...
Better yet?
625941ee442bda511e8be968
def get_stock_start(ticker, times, start, end): <NEW_LINE> <INDENT> for i in range(times): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> asset = yf.Ticker(ticker) <NEW_LINE> hist = asset.history(start=start, end=end) <NEW_LINE> return True, hist <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> print(f"Failed to retrie...
Try up to `times` to get data for ticker from yfinance. After each failure sleep for 5 seconds before trying again.
625941ee498bea3a759ba005
def SetMarker(self, pos): <NEW_LINE> <INDENT> if self.IsFull(): <NEW_LINE> <INDENT> pending = self.pop(0) <NEW_LINE> pending.p1 = pos <NEW_LINE> pending.p2 = None <NEW_LINE> pending.Refresh() <NEW_LINE> self.append(pending) <NEW_LINE> <DEDENT> elif self.IsPending(): <NEW_LINE> <INDENT> pending = self[-1] <NEW_LINE> pen...
Set a marker to calibrated position pos, possibly completing a marker pair
625941ee009cb60464c63905
def test_date_no_end_date(self): <NEW_LINE> <INDENT> event = EventFactory.build(start_date=date(2012, 5, 5)) <NEW_LINE> eq_(event.date, '{may} 5, 2012'.format(may=MAY))
If the event has no end date, just display the start date.
625941ee23849d37ff7b35e3
def test_two_past_questions(self): <NEW_LINE> <INDENT> create_question(question_text="Past question 1.", days=-30) <NEW_LINE> create_question(question_text="Past question 2.", days=-5) <NEW_LINE> response = self.client.get(reverse('polls:index')) <NEW_LINE> self.assertQuerysetEqual( response.context['latest_question_li...
:return:
625941eeadb09d7d5db6cce4
def gestion_attaquer(self, index): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not self.liste_personnages[int(index[0])].est_mort(): <NEW_LINE> <INDENT> force_attaque = Util.saisir_objet_entier("Entrer la force de l'attaque? (entre 0 À 101)") <NEW_LINE> if self.liste_personnages[int(index[0])].valider_energie_coura...
Reçoit l'indice du personnage sélectionné ou -1 si aucun personnage n'est sélectionné. Si le personnage sélectionné n'est pas mort, on saisit avec validation la force de l'attaque (> 0 et <= energie_max). Lorsque la force saisie est valide, on attaque le personnage sélectionné sinon on affiche un message adéquat. S'i...
625941ee3d592f4c4ed1d5b6
def main(): <NEW_LINE> <INDENT> dictionary = eval(input()) <NEW_LINE> print_dictionary(dictionary)
input dict
625941ee6fb2d068a760f5fe
def safe_setting(self, name_hyphen, default=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.setting(name_hyphen) <NEW_LINE> <DEDENT> except UserFeedback: <NEW_LINE> <INDENT> return default
Retrieves the setting value, but returns a default value rather than raising an error if the setting does not exist.
625941eecc0a2c11143dd3ea
def __init__(self, max_buffer_size: int, normalize_reward_on_first_batch_sample: False) -> None: <NEW_LINE> <INDENT> self.reward_norm = None if normalize_reward_on_first_batch_sample else 1.0 <NEW_LINE> self.max_buffer_size = max_buffer_size <NEW_LINE> self._data: List[Experience] = [] <NEW_LINE> self._buffer_index: in...
Create the experience buffer :param max_buffer_size: Maximum number of experiences to store in the buffer
625941ee07f4c71912b119dd
def flush_updates(function): <NEW_LINE> <INDENT> @functools.wraps(function) <NEW_LINE> def wrap(*args, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return function(*args, **kwargs) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> queue_flush() <NEW_LINE> <DEDENT> <DEDENT> return wrap
Decorator that flushes ElasticSearch updates.
625941ee7d43ff24873a31fd
def compound_bprop_bn(self, delta_out, grad_gamma, grad_beta, delta_in, x, xsum, xvar, gamma, eps, threads=None, repeat=1): <NEW_LINE> <INDENT> assert xsum.dtype.type is np.float32, "xsum should be fp32" <NEW_LINE> K = x.shape[0] <NEW_LINE> N = x.shape[1] <NEW_LINE> if threads is None: <NEW_LINE> <INDENT> if N <= 8192:...
delta_out (Tensor): Delta buffer (where to write the output deltas) grad_gamma (Tensor): Gradient w.r.t. gamma grad_beta (Tensor): Gradient w.r.t. beta delta_in (Tensor): Delta buffer (where to get the input deltas) x (Tensor): feedforward input xsum (Tensor): Batch sum over PQN dimension xvar (Tensor): Batch variance ...
625941ee498bea3a759ba006
def _handler_runthrough(self, handler): <NEW_LINE> <INDENT> logger = logging.getLogger() <NEW_LINE> logger.disabled = True <NEW_LINE> old_handlers = self._handlers <NEW_LINE> self._handlers = [] <NEW_LINE> try: <NEW_LINE> <INDENT> handler = self.attach_handler(handler) <NEW_LINE> self.run_all() <NEW_LINE> <DEDENT> fina...
Runs protocol on a virtualized handler.
625941ee8a43f66fc4b545b7
def __init__(self, low=0., high=1.): <NEW_LINE> <INDENT> self.low = low <NEW_LINE> self.high = high
:param low: The lower boundry for the uniform distribution :param high: The upper boundry for the uniform distribution
625941ee6fece00bbac2dc9d
def tdoa_function_3D(pinger_pos, hydrophone_pos, is_polar): <NEW_LINE> <INDENT> if (is_polar): <NEW_LINE> <INDENT> pinger_distance = np.sqrt(pinger_pos[0]**2 + global_vars.depth_sensor_reading()**2) <NEW_LINE> delta_z = global_vars.depth_sensor_reading() - hydrophone_pos.z <NEW_LINE> delta_phi = pinger_pos[1] - hydroph...
@brief calculates the time difference of arrival (TDOA) of the sound signal between the given hydrophone and hydrophone 0, given a specified pinger position @param pinger_pos The position of the pinger. a numpy array with the XY plane position of the pinger position relative to ...
625941ee097d151d1a2233af
def data_info(labels, mode_label, logger, config, hidden_test=False): <NEW_LINE> <INDENT> zeros, zeros_index, ones, ones_index, indices = util.count_classes_gender(labels) <NEW_LINE> zeros_index_f, zeros_index_m = zeros_index <NEW_LINE> ones_index_f, ones_index_m = ones_index <NEW_LINE> if mode_label == 'train' and con...
Log the number of ones and zeros in the current set. If class_weights is selected, determine the balance of the dataset Inputs: labels: The labels for the current set of data mode_label: Set to training or validation logger: To record important information config: Config file for state information Out...
625941eedd821e528d63b6fd
def query(self, query='*'): <NEW_LINE> <INDENT> return EntityQuery(self.entities, query)
Returns a new result container with all entities matching this additional query.
625941eecb5e8a47e48b7ff9
def get_resource_quota_spec(self): <NEW_LINE> <INDENT> self.log.info("Dummy get_resource_quota_spec(); override for quotas") <NEW_LINE> return None
An implementation should override this by returning an appropriate kubernetes.client.V1ResourceQuotaSpec.
625941eecb5e8a47e48b7ffa
def count_bits(n): <NEW_LINE> <INDENT> binary = '{0:100b}'.format(n) <NEW_LINE> bit_count = 0 <NEW_LINE> for digit in binary: <NEW_LINE> <INDENT> if digit == '1': <NEW_LINE> <INDENT> bit_count += 1 <NEW_LINE> <DEDENT> <DEDENT> return bit_count
.
625941ee5166f23b2e1a56b1
def patch_sensitivity(fwd, labels): <NEW_LINE> <INDENT> if not fwd['surf_ori']: <NEW_LINE> <INDENT> raise RuntimeError('Forward operator must be in surface orientation.') <NEW_LINE> <DEDENT> if not isinstance(labels, list): <NEW_LINE> <INDENT> labels = [labels] <NEW_LINE> <DEDENT> gain = fwd['sol']['data'] <NEW_LINE> n...
Compute cancellation indices for cortical sources. Parameters ---------- fwd : Forward The forward operator, which must be in surface orientation. labels : Label | list of Label Simultaneously active cortical patches. Returns ------- sensitivity : dict ci -> np.array of cancellation index for each label ...
625941ee6fece00bbac2dc9e
def testCheckSyntax(self): <NEW_LINE> <INDENT> self.assertEquals(self.pparser.checkSyntax(), None)
Check that application can handle correctly a whole file block
625941ee60cbc95b062c6a9c
def _create_embeddings(embedding_layer, images, labels, images_placeholder, phase_train_placeholder, sess): <NEW_LINE> <INDENT> emb_array = None <NEW_LINE> label_array = None <NEW_LINE> try: <NEW_LINE> <INDENT> i = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> batch_images, batch_labels = sess.run([images, labels]) <NEW...
Uses model to generate embeddings from :param images. :param embedding_layer: :param images: :param labels: :param images_placeholder: :param phase_train_placeholder: :param sess: :return: (tuple): image embeddings and labels
625941ee4527f215b584c9aa
def _sample_proportional(self, batch_size: int) -> list: <NEW_LINE> <INDENT> indices = [] <NEW_LINE> p_total = self.sum_tree.sum(0, len(self.buffer)) <NEW_LINE> segment = p_total / batch_size <NEW_LINE> i = 0 <NEW_LINE> while len(indices) < batch_size: <NEW_LINE> <INDENT> a = segment * i <NEW_LINE> b = segment * (i + 1...
Sample indices based on proportional.
625941ee44b2445a339325ea
def apply_adaptation(self, target_illuminant, adaptation='bradford'): <NEW_LINE> <INDENT> logger.debug(" \- Original illuminant: %s", self.illuminant) <NEW_LINE> logger.debug(" \- Target illuminant: %s", target_illuminant) <NEW_LINE> if self.illuminant != target_illuminant: <NEW_LINE> <INDENT> logger.debug(" \* Appl...
This applies an adaptation matrix to change the XYZ color's illuminant. You'll most likely only need this during RGB conversions.
625941eed4950a0f3b08c89f
def __find_isolated_nodes(self): <NEW_LINE> <INDENT> isolated = [] <NEW_LINE> for vertex in self.__graph_dict: <NEW_LINE> <INDENT> if not self.__graph_dict[vertex]: <NEW_LINE> <INDENT> isolated.append(vertex) <NEW_LINE> <DEDENT> <DEDENT> return isolated
returns a list of isolated nodes.
625941ee167d2b6e312190ed
def getName(self): <NEW_LINE> <INDENT> return self.mName
Return the name of the created menu object
625941ee442bda511e8be969
def sample(self, assign_result, bboxes, gt_bboxes, gt_labels=None, img_meta=None, **kwargs): <NEW_LINE> <INDENT> bboxes = bboxes[:, :4] <NEW_LINE> gt_flags = bboxes.new_zeros((bboxes.shape[0], ), dtype=torch.uint8) <NEW_LINE> if self.add_gt_as_proposals: <NEW_LINE> <INDENT> bboxes = torch.cat([gt_bboxes, bboxes], dim=0...
Sample positive and negative bboxes. This is a simple implementation of bbox sampling given candidates, assigning results and ground truth bboxes. Args: assign_result (:obj:`AssignResult`): Bbox assigning results. bboxes (Tensor): Boxes to be sampled from. gt_bboxes (Tensor): Ground truth bboxes. gt_l...
625941ee377c676e912726ff
def CmdList(config, options, args): <NEW_LINE> <INDENT> if len(args): <NEW_LINE> <INDENT> raise error.Error('list command takes no arguments') <NEW_LINE> <DEDENT> if options.all: <NEW_LINE> <INDENT> iterator = source_package.SourcePackageIterator() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> iterator = installed_pack...
List installed packages
625941ee1f037a2d8b946755
def fold_headers(headers): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return dict((k.lower(), v) for k, v in headers.items()) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> header_dict = collections.defaultdict(list) <NEW_LINE> for header, value in headers: <NEW_LINE> <INDENT>...
Turn a list of headers into a folded dict.
625941ee66673b3332b925e9
def new_point_process(name, doc=None): <NEW_LINE> <INDENT> h("obfunc new_%s() { return new %s($1) }" % (name, name)) <NEW_LINE> class someclass(Wrapper): <NEW_LINE> <INDENT> __doc__ = doc <NEW_LINE> def __init__(self, section, position=0.5): <NEW_LINE> <INDENT> assert 0 <= position <= 1 <NEW_LINE> section.push() <NEW_L...
Returns a Python-wrapped hoc class where the object needs to be associated with a section. doc - specify a docstring for the new pointprocess class
625941eec432627299f051a2
def read_csv(data, **kwargs): <NEW_LINE> <INDENT> return pd.read_csv(StringIO(data), delim_whitespace=True, **kwargs)
Read CSV from a string.
625941ee0a50d4780f6673ef
def invert_maxpooling(variable, guided=True): <NEW_LINE> <INDENT> assert variable.creator is not None <NEW_LINE> assert variable.creator.label == 'MaxPooling2D', 'variable.creator should be MaxPooling2D.' <NEW_LINE> v = variable <NEW_LINE> bottom_blob = v.creator.inputs[0] <NEW_LINE> kw, kh = v.creator.kw, v.creator.kh...
Max pooling後の~chainer.Variableから、Max pooling前の状態を復元する Args: variable (~chainer.Variable): Max pooling後の中間層 guided (bool): guided backpropagation を行う場合はTrue、行わない場合はFalse. Returns: data (ndarray): 復元されたMax pooling前の中間層のデータ(返されるのは~chainer.Variableではないことに注意)
625941eec4546d3d9de72f92
def _set_selected(self, value): <NEW_LINE> <INDENT> self.raiseNotImplementedError()
This is the environment implementation of :attr:`BaseObject.selected`. **value** will be a **boolean** representing the object's selection state. The value will have been normalized with :func:`normalizers.normalizeBoolean`. Subclasses must override this method if they implement object selection.
625941eec432627299f051a3
def net_fn(x): <NEW_LINE> <INDENT> net = hk.Sequential([ hk.Linear(1024), jax.nn.relu, hk.Linear(1024), jax.nn.relu, hk.Linear(1024), jax.nn.relu, hk.Linear(1024), jax.nn.relu, hk.Linear(NUM_ACTIONS), jax.nn.log_softmax, ]) <NEW_LINE> return net(x)
Haiku module for our network.
625941ee76e4537e8c351bd0
def get_identity(self, address: str) -> Optional[IdentityEntry]: <NEW_LINE> <INDENT> pass
Map address to an identity.
625941ee7cff6e4e81117ede
def analyze_rst(*packages): <NEW_LINE> <INDENT> fields = 'count_code count_doc count_comment count_total'.split() <NEW_LINE> headers = ["name"] + fields <NEW_LINE> rows = [] <NEW_LINE> total_sums = [0] * len(fields) <NEW_LINE> for package in packages: <NEW_LINE> <INDENT> sums = [0] * len(fields) <NEW_LINE> for name, fi...
Example: >>> from lino.utils.code import analyze_rst >>> print analyze_rst('lino')
625941eed486a94d0b98e69f
def ucs_manager_connect(self, ucsm_ip): <NEW_LINE> <INDENT> if not self.ucsmsdk: <NEW_LINE> <INDENT> self.ucsmsdk = self._import_ucsmsdk() <NEW_LINE> <DEDENT> credentials = self.ucsm_conf.get_credentials_for_ucsm_ip( ucsm_ip) <NEW_LINE> handle = self.ucsmsdk.UcsHandle() <NEW_LINE> try: <NEW_LINE> <INDENT> handle.Login(...
Connects to a UCS Manager.
625941ee71ff763f4b549bee
def test_sphere(self): <NEW_LINE> <INDENT> s = ihm.model.Sphere(asym_unit='foo', seq_id_range=(1, 5), x=1.0, y=2.0, z=3.0, radius=4.0) <NEW_LINE> self.assertEqual(s.asym_unit, 'foo') <NEW_LINE> self.assertEqual(s.seq_id_range, (1, 5))
Test Sphere class
625941ee66673b3332b925ea
def create_module(self, spec): <NEW_LINE> <INDENT> mod = types.ModuleType(spec.name) <NEW_LINE> mod.__file__ = self.get_filename(spec.name) <NEW_LINE> mod.__loader__ = self <NEW_LINE> mod.__package__ = spec.parent or "" <NEW_LINE> return mod
Create a xonsh module with the appropriate attributes.
625941eed10714528d600242
def delete_firewall_group(self, firewall_group, ignore_missing=True): <NEW_LINE> <INDENT> self._delete(_firewall_group.FirewallGroup, firewall_group, ignore_missing=ignore_missing)
Delete a firewall group :param firewall_group: The value can be either the ID of a firewall group or a :class:`~SDK.openstack.network.v2.firewall_group.FirewallGroup` instance. :param bool ignore_missing: When set to ``False`` :class:`~SDK.openstack.exceptions.ResourceNotFound` will be ...
625941ee5f7d997b87174ff5
def _qemu_io(img, cmd): <NEW_LINE> <INDENT> logging.info("Run qemu-io %s", img.image_filename) <NEW_LINE> try: <NEW_LINE> <INDENT> QemuIOSystem(test, params, img.image_filename).cmd_output(cmd, 120) <NEW_LINE> <DEDENT> except process.CmdError: <NEW_LINE> <INDENT> test.fail("qemu-io to '%s' failed." % img.image_filename...
Run qemu-io cmd to a given img.
625941ee38b623060ff0b345
def __iadd__(self, listener): <NEW_LINE> <INDENT> if listener in self.listeners: <NEW_LINE> <INDENT> raise ValueError("Listener already registered to event"); <NEW_LINE> <DEDENT> self.listeners.append(listener); <NEW_LINE> return self;
Add new event listener. @param listener: callable; will be called whenever the event fires. @return: self. @raise ValueError: if the listener has already been registered for this event.
625941eeff9c53063f47c749
def contains_resource(self, resource_name): <NEW_LINE> <INDENT> return File(self.source_folder.child(resource_name)).exists
Returns True if the given resource name exists as a file in this node's source folder.
625941ee26068e7796caf240
def test_valid_temp_target_unit_is_valid_unit(self): <NEW_LINE> <INDENT> self.assertTrue(valid_temp_target_unit("Fahrenheit", False)) <NEW_LINE> self.assertTrue(valid_temp_target_unit("Celsius", False)) <NEW_LINE> self.assertTrue(valid_temp_target_unit("Kelvin", False)) <NEW_LINE> self.assertTrue(valid_temp_target_unit...
Test for valid_temp_target_unit is valid unit?
625941eed4950a0f3b08c8a0
def clear_notifications(self): <NEW_LINE> <INDENT> self.get_icon().exclamation_icon.clear_notifications()
Clear all notifications from the exclamation icon.
625941eeb545ff76a891436e
def faceDetectorCNN(filename, required_size=(224, 224)): <NEW_LINE> <INDENT> image = image_exif(filename) <NEW_LINE> pixels = asarray(image) <NEW_LINE> detector = MTCNN() <NEW_LINE> results = detector.detect_faces(pixels) <NEW_LINE> facesList = [] <NEW_LINE> boundingBoxes = [] <NEW_LINE> centralCoordinates = [] <NEW_LI...
Face Detection MTCNN for CNN
625941eed6c5a102081445a8
def test_growToFullCoreFromThirdCore(self): <NEW_LINE> <INDENT> self.assertFalse(self.r.core.isFullCore) <NEW_LINE> self.assertEqual(self.r.core.symmetry, geometry.THIRD_CORE + geometry.PERIODIC) <NEW_LINE> initialNumBlocks = len(self.r.core.getBlocks()) <NEW_LINE> changer = geometryConverters.ThirdCoreHexToFullCoreCha...
Test that a hex core can be converted from a third core to a full core geometry.
625941ee7b180e01f3dc4d4a
def core_subgraph(self, edge_list): <NEW_LINE> <INDENT> A = self._alphabet <NEW_LINE> core = [] <NEW_LINE> outgoing = {} <NEW_LINE> for e in edge_list: <NEW_LINE> <INDENT> v = self.initial_vertex(e) <NEW_LINE> vv = self.terminal_vertex(e) <NEW_LINE> if v in outgoing.keys(): <NEW_LINE> <INDENT> outgoing[v].append(e) <NE...
Core subgraph (the list of edges that belong to at least one loop) of the subgraph of ``self`` spanned by ``edge_list``. INPUT: - ``edge_list`` -- (default None) list of edge OUTPUT: Core subgraph (the list of edges that belong to at least one loop) of the subgraph of ``self`` spanned by ``edge_list``. EXAMPLES::...
625941ee0c0af96317bb8740
def record_edge(self, left, right, parent, child): <NEW_LINE> <INDENT> if child not in self.edge_buffer: <NEW_LINE> <INDENT> self.edge_buffer[child] = [tskit.Edge(left, right, parent, child)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> last = self.edge_buffer[child][-1] <NEW_LINE> if last.right == left: <NEW_LINE> <I...
Adds an edge to the output list.
625941ee187af65679ca5679
def get_players(league, week, team): <NEW_LINE> <INDENT> team_data = "/%d/team?&week=%d" % (team, week) <NEW_LINE> return cleanup(*parse_url(league, team_data, ParsePlayers()))
Get the players on a team Input: league -- league number week -- week number team -- team number The team information created here consists of two items. The first is an ordered list of player ids representing how those players are placed on a roster. The second is a dictionary keyed on player id's whos...
625941eed268445f265b53c8
def __init__( self, name, x: int = None, y: int = None, w: int = None, h: int = None, **kwargs ): <NEW_LINE> <INDENT> super().__init__(name, x=x, y=y, w=w, h=h, kwargs=kwargs) <NEW_LINE> self._fill_style = kwargs.get("fill_style", FillStyle.Empty) <NEW_LINE> self._background_colour = kwargs.get("background_colour", (12...
Constructor for Renderable
625941ee5fc7496912cc3ed6
@loglevel_command() <NEW_LINE> def download_dependencies(): <NEW_LINE> <INDENT> cpo.lib.dependency_manager.dependency_manager.download_dependencies_if_required()
Download dependencies
625941ee956e5f7376d713c4
def remove_ex_comment(line): <NEW_LINE> <INDENT> if line.startswith('#') and '#ex' in line: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return line
If a line ends with '#ex' and is only a comment, returns an empty string, otherwise return the string.
625941ee5e10d32532c5f47e
def histogram_stepped(ph, new_fig=True, subplot=False, color='b', alpha=0.7, **kwargs): <NEW_LINE> <INDENT> fig, ax = cm.get_figure(new_fig=new_fig, subplot=subplot) <NEW_LINE> hist_data = analysis.histogram_stepped(ph) <NEW_LINE> ax.fill_between(hist_data[0][:-1], 0, hist_data[1], color=color, alpha=alpha) <NEW_LINE> ...
Extracts and plots the stepped histogram of a persistent homology array.
625941ee21bff66bcd684ea6
def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/RunKeeper/FitnessActivities/RetrieveActivites')
Create a new instance of the RetrieveActivites Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
625941ee63f4b57ef0001662
def runop(self, op, nodes=None, local_only=False): <NEW_LINE> <INDENT> if not nodes or self.run_on_all(op): <NEW_LINE> <INDENT> nodes = self.nodes <NEW_LINE> <DEDENT> self.last_op = op <NEW_LINE> self.set_rscenv(op) <NEW_LINE> real_op = (op == "probe" and "monitor" or op) <NEW_LINE> cmd = self.exec_cmd(real_op) <NEW_LI...
Execute an operation.
625941ee435de62698dfe1a6
@cache('step') <NEW_LINE> def porous_pavement_flexibility_and_adaptability_counter(): <NEW_LINE> <INDENT> return functions.if_then_else(porous_pavement_flexibility_and_adaptability() == 0, 0, 1)
Real Name: Porous Pavement Flexibility and Adaptability Counter Original Eqn: IF THEN ELSE( Porous Pavement Flexibility and Adaptability = 0 , 0 , 1 ) Units: Binary Limits: (None, None) Type: component
625941ee23e79379d52eeab6
def letterCombinations(self,digits): <NEW_LINE> <INDENT> mapper = {'2': 'abc','3': 'def', '4': 'ghi', '5': 'jkl', '6': 'mno', '7': 'pqrs', '8': 'tuv', '9': 'wxyz'} <NEW_LINE> ans = itertools.product(*[[c for c in mapper[i]] for i in digits]) <NEW_LINE> return [''.join(a) for a in ans]
:type digits: str :rtype: List[str]
625941ee0c0af96317bb8741
def calc_open_volume_pre(self, instrument, order): <NEW_LINE> <INDENT> return order.position.calc_open_volume()
计算order的理论开仓数(基于策略)
625941eea4f1c619b28b0585
def __le__(self, that): <NEW_LINE> <INDENT> if isinstance(that, PriorityDict): <NEW_LINE> <INDENT> that = that._dict <NEW_LINE> <DEDENT> _dict = self._dict <NEW_LINE> return (len(_dict) <= len(that) and all(_dict[key] <= that[key] if key in that else False for key in _dict))
Compare two mappings for less than equal.
625941eecc40096d61595ea7
def populate_facts(self, connection, ansible_facts, data=None): <NEW_LINE> <INDENT> if not data: <NEW_LINE> <INDENT> data = self.get_device_data(connection) <NEW_LINE> <DEDENT> config = data.split("interface ") <NEW_LINE> objs = [] <NEW_LINE> for conf in config: <NEW_LINE> <INDENT> if conf: <NEW_LINE> <INDENT> obj = se...
Populate the facts for l2_interfaces :param connection: the device connection :param ansible_facts: Facts dictionary :param data: previously collected configuration :rtype: dictionary :returns: facts
625941ee56ac1b37e626471e
def move_down( self, distance ): <NEW_LINE> <INDENT> self.position[1] -= distance
Move the camera down by the amount distance
625941eee1aae11d1e74a216
def terminate_server(self, server_id): <NEW_LINE> <INDENT> return self.call_api('v1/servers/%s' % server_id, type='DELETE')
Terminated server by ID Link: https://api.cherryservers.com/doc/#operation/terminate-server
625941ee30bbd722463cc322
def g_wedge(T, S, g): <NEW_LINE> <INDENT> if isinstance(S, (WedgeArray)): <NEW_LINE> <INDENT> S = wedgearray2tensor(S) <NEW_LINE> <DEDENT> if isinstance(T, (WedgeArray)): <NEW_LINE> <INDENT> T = wedgearray2tensor(T) <NEW_LINE> <DEDENT> g_t = g_tensor(T, S, g) <NEW_LINE> if (len(T.type_pq) == 1 and T.type_pq[0] != 1) or...
The scalar product in the space of differential forms. The result is a skew-symmetric form of (0, p-1). Examples: ========= >>> from sympy import symbols >>> from sympy.tensor.arraypy import Arraypy >>> from sympy.tensor.tensor_fields import g_wedge >>> l, m, n = symbols('l, m, n') >>> X_w=Arraypy([1,3,1]).to_tenso...
625941ee0a366e3fb873ed78
@blueprint.route('/music/purchase', methods=['POST']) <NEW_LINE> @jwt_check <NEW_LINE> def _post_music_purchase(): <NEW_LINE> <INDENT> json_form = request.get_json(force=True, silent=True) <NEW_LINE> tx_hash = json_form.get('tx_hash') <NEW_LINE> requester = request.user['address'] <NEW_LINE> if not txhash_validation(tx...
Receive txHash from client. This hash is about music purchase. For simplify and security, only accept txHash (any of other extra information is not received) That is, no contract address and price are given. (After mined, automatically saved the information) See works/update_payments.py
625941ee8a349b6b435e86cc
def openDefaultWindow(self, *args, **kw): <NEW_LINE> <INDENT> startDirect = kw.get('startDirect', True) <NEW_LINE> if 'startDirect' in kw: <NEW_LINE> <INDENT> del kw['startDirect'] <NEW_LINE> <DEDENT> self.openMainWindow(*args, **kw) <NEW_LINE> if startDirect: <NEW_LINE> <INDENT> self.__doStartDirect() <NEW_LINE> <DEDE...
Creates the main window for the first time, without being too particular about the kind of graphics API that is chosen. The suggested window type from the load-display config variable is tried first; if that fails, the first window type that can be successfully opened at all is accepted. This is intended to be called ...
625941ee10dbd63aa1bd30fb
def password_window(self): <NEW_LINE> <INDENT> self.update_dict_active_images() <NEW_LINE> zamok_paint = tk.Label(self.frameMain, bg='black', image=self.active_images.get('zamok_img')) <NEW_LINE> zamok_paint.place(x=0, y=0) <NEW_LINE> entry_password = ttk.Entry(self.frameMain, width=20, show="*", font="Arial 25") <NEW_...
Окно ввода пароля и вход в систему
625941ee94891a1f4081c005
def setup(bot: BOTCBot): <NEW_LINE> <INDENT> bot.add_cog(EffectManagement(bot))
Set the cog up.
625941ee293b9510aa2c37ea
def makeApple(Point): <NEW_LINE> <INDENT> apple = cmds.duplicate('apple1') <NEW_LINE> cmds.scale( 0.1, 0.1, 0.1, apple) <NEW_LINE> cmds.move(Point[0],Point[1]-0.8,Point[2],apple) <NEW_LINE> return 'apple*'
calculate the vector from the start point to the end point for each branch Point : the current point in the tree generation return : return the name of the created apple
625941ee4e4d5625662d4929
def generateJson(): <NEW_LINE> <INDENT> pass
Generate this object's Summarizer json.
625941ee4527f215b584c9ab
def calc_capacite_thermique(masse_volumique, chaleur_specifique): <NEW_LINE> <INDENT> return masse_volumique * chaleur_specifique
Return float Calcule la capacité thermique d'un matériaux en fonction de ses caractéristiques. La capacité thermique d’un matériau est le produit de sa masse volumique par sa chaleur spécifique. C = ρ * c où : ρ : masse volumique (kg/m3) c : chaleur spécifique (Wh/kg.°C)
625941ee21bff66bcd684ea7
def update_attrs(self, screen_id: int) -> typing.Sequence[bytes]: <NEW_LINE> <INDENT> seq = list() <NEW_LINE> seq.extend(commands.CommandGenerator.generate_set_screen_attrs_commands( screen_id, **self.attrs)) <NEW_LINE> return seq
Obtain a request sequence that will update the attributes of the screen :param screen_id: id of the screen :return: request sequence
625941ee31939e2706e4d3bb
def max_pool_backward_naive(dout, cache): <NEW_LINE> <INDENT> dx = None <NEW_LINE> x, pool_param = cache <NEW_LINE> N,C,H,W=x.shape <NEW_LINE> HH,WW,stride = pool_param['pool_height'],pool_param['pool_width'],pool_param['stride'] <NEW_LINE> H1 = int(1 + (H - HH) / stride) <NEW_LINE> W1 = int(1 + (W - WW) / stride) <NEW...
A naive implementation of the backward pass for a max-pooling layer. Inputs: - dout: Upstream derivatives - cache: A tuple of (x, pool_param) as in the forward pass. Returns: - dx: Gradient with respect to x
625941ee236d856c2ad44d3b
def _send_reminders(self, matches_queryset, title): <NEW_LINE> <INDENT> users = models.TgUser.objects.filter(event_notifications=True) <NEW_LINE> for match in matches_queryset: <NEW_LINE> <INDENT> for user in users: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> match.users_for_text_translation.get(chat_id=user.chat_id) ...
Отправка уведомлений о матче пользователям :param matches_queryset: :return:
625941eea17c0f6771cbe5a8
def distribute(self, value, dist_prob): <NEW_LINE> <INDENT> value_prob = self.values[value] <NEW_LINE> non_value_prob = sum([p for v, p in self.values.iteritems() if v != value]) <NEW_LINE> self.set(value, (1.0 - dist_prob) * value_prob) <NEW_LINE> for v in self.values: <NEW_LINE> <INDENT> if v != value: <NEW_LINE> <IN...
This function distributes a portion of probability mass assigned to the ``value`` to other values with a weight ``prob``.
625941ee4c3428357757c87e
def get_Value(self, attrId): <NEW_LINE> <INDENT> return super(IGraphicAttributes2, self).get_Value(attrId)
Method IGraphicAttributes.get_Value (from IGraphicAttributes) INPUT attrId : long OUTPUT val : VARIANT*
625941eebd1bec0571d90b88
def get_media_requests(self, item, info): <NEW_LINE> <INDENT> print(item['image_path']) <NEW_LINE> yield scrapy.Request(item['image_path'])
发起下载的请求 :return:
625941eeb5575c28eb68e55f
def diffWaysToCompute(self, input): <NEW_LINE> <INDENT> if input.isdigit(): <NEW_LINE> <INDENT> return [int(input)] <NEW_LINE> <DEDENT> res = [] <NEW_LINE> for i in range(len(input)): <NEW_LINE> <INDENT> if input[i] in "+-*": <NEW_LINE> <INDENT> xs = self.diffWaysToCompute(input[:i]) <NEW_LINE> ys = self.diffWaysToComp...
:type input: str :rtype: List[int]
625941ee8e05c05ec3eea8d3
def appendRawFullPNList( self, aRawFullPNList ): <NEW_LINE> <INDENT> OsogoPluginWindow.appendRawFullPNList( self, aRawFullPNList ) <NEW_LINE> aFullPNList = map( self.supplementFullPN, aRawFullPNList ) <NEW_LINE> self.addTraceToPlot( aFullPNList )
overwrites superclass method aRawFullPNList -- a RawFullPNList to append (RawFullPNList) Returns None
625941ee2eb69b55b151ce11
def delete_page(self): <NEW_LINE> <INDENT> self.__return_405()
This method can be implemented in the subclass
625941ee92d797404e3046e6
def download_archive(): <NEW_LINE> <INDENT> app_path = get_app_path() <NEW_LINE> config = hookenv.config() <NEW_LINE> call('rm /tmp/dokuwiki.zip || true', shell=True) <NEW_LINE> cmd = ('wget -q -O /tmp/dokuwiki.tgz ' 'http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz') <NEW_LINE> hookenv.log("Downloading Do...
Downloads dokuwiki http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
625941ee01c39578d7e75395
def parsenumber(v, strict=False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return int(v) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return long(v) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return float(v) ...
Attempt to parse the value as a number, trying :func:`int`, :func:`long`, :func:`float` and :func:`complex` in that order. If all fail, return the value as-is. .. versionadded:: 0.4 .. versionchanged:: 0.7 Set ``strict=True`` to get an exception if parsing fails. .. deprecated:: 0.24 Use :func:`numparser` instead.
625941ee8c0ade5d55d3ef19
def test_is_periodic(case_data): <NEW_LINE> <INDENT> assert case_data.edge.is_periodic() == case_data.is_periodic
Test :meth:`.Edge.is_periodic`. Parameters ---------- case_data : :class:`.CaseData` A test case. Holds the edge to test and the truth about its periodicity. Returns ------- None : :class:`NoneType`
625941ee656771135c3ebdcf