code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def can_be_overridden(self, user, room=None, explicit_only=False): <NEW_LINE> <INDENT> if not user: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.created_by_user == user: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if not explicit_only: <NEW_LINE> <INDENT> if user.isRBAdmin(): <NEW_LINE> <INDENT>...
Determines if a user can override the blocking The following persons are authorized to override a blocking: - owner (the one who created the blocking) - any users on the blocking's ACL - unless explicitOnly is set: admins and room owners (if a room is given)
625941cc8a43f66fc4b54151
def get(self, object_name): <NEW_LINE> <INDENT> return [self.execute(find_nested_object, object_name)]
This method implements a synchronous (blocking) pull operation. :param object_name: str :return: dynamic
625941cc293b9510aa2c3382
def _make_url(self, cr, uid, res_id, model, context=None): <NEW_LINE> <INDENT> base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default='http://localhost:8069', context=context) <NEW_LINE> if base_url: <NEW_LINE> <INDENT> user = self.pool.get('res.users').browse(cr, uid, uid, context=c...
@param res_id: on which document the message is pushed @param model: name of the document linked with the mail @return url
625941cc23849d37ff7b317b
def exportCertificate(self, certificate, folder): <NEW_LINE> <INDENT> url = self._url + "/sslcertificates/%s/export" % certificate <NEW_LINE> params = { "f" : "json", } <NEW_LINE> return self._get(url=url, param_dict=params, out_folder=folder)
gets the SSL Certificates for a given machine
625941ccaad79263cf390b2c
def extended_euclidean_algorithm(a, b): <NEW_LINE> <INDENT> old_r, r = a, b <NEW_LINE> old_s, s = 1, 0 <NEW_LINE> old_t, t = 0, 1 <NEW_LINE> while r != 0: <NEW_LINE> <INDENT> quotient = old_r // r <NEW_LINE> old_r, r = r, old_r - quotient * r <NEW_LINE> old_s, s = s, old_s - quotient * s <NEW_LINE> old_t, t = t, old_t ...
Returns (gcd, x, y) s.t. a * x + b * y == gcd. This function implements the extended Euclidean algorithm and runs in O(log b) in the worst case, taken from Wikipedia.
625941cc5fcc89381b1e17aa
@app.route('/success/', methods=['GET', 'POST']) <NEW_LINE> def success(): <NEW_LINE> <INDENT> return render_template('success.html')
用于提示相关成功信息的页面 :return:
625941cccb5e8a47e48b7b96
def __init__(self, pilotParams): <NEW_LINE> <INDENT> super(InstallDIRAC, self).__init__(pilotParams) <NEW_LINE> self.installOpts = [] <NEW_LINE> self.pp.rootPath = self.pp.pilotRootPath <NEW_LINE> self.installScriptName = "dirac-install.py" <NEW_LINE> self.installScript = ""
c'tor
625941cce1aae11d1e749da2
@app.route('/users/<int:user_id>/edit', methods=["POST"]) <NEW_LINE> def users_update(user_id): <NEW_LINE> <INDENT> user = User.query.get_or_404(user_id) <NEW_LINE> user.first_name = request.form["first_name"] <NEW_LINE> user.last_name = request.form["last_name"] <NEW_LINE> user.image_url = request.form["image_url"] <N...
Handle form submission for deleting an existing user
625941cc63f4b57ef0001205
def get_plot_coordinates(self): <NEW_LINE> <INDENT> le_x, le_y, le_z = [], [], [] <NEW_LINE> te_x, te_y, te_z = [], [], [] <NEW_LINE> for section in self: <NEW_LINE> <INDENT> x, y, z = section.leading_edge_coordinates <NEW_LINE> le_x.append(x) <NEW_LINE> le_y.append(y) <NEW_LINE> le_z.append(z) <NEW_LINE> x, y, z = sec...
gets x and y coordinate lists for plotting
625941cc6e29344779a626fd
def clear(self): <NEW_LINE> <INDENT> self.entity = [] <NEW_LINE> return self
清空注册进来的内容 :return: RESTful实例对象
625941cccc0a2c11143dcf7c
def test_depend_only_pkgs(self): <NEW_LINE> <INDENT> ebuild = self.get_ebuild() <NEW_LINE> ebuild.add_run_depend('virtual/pkgconfig', False) <NEW_LINE> self.assertTrue('virtual/pkgconfig' in ebuild.depends_external) <NEW_LINE> self.assertFalse('virtual/pkgconfig' in ebuild.rdepends_external)
Test DEPEND only packages
625941cc9c8ee82313fbb861
def normalize_pts(pts, ymax, scaler=2): <NEW_LINE> <INDENT> return [(x * scaler, ymax - (y * scaler)) for x, y in pts]
scales all coordinates and flip y axis due to different origin coordinates (top left vs. bottom left)
625941cc4e696a04525c9537
def asttranmap(map1, map2, **kwargs): <NEW_LINE> <INDENT> return wrapper.starcomm("$ATOOLS_DIR/asttranmap", "asttranmap", map1, map2, **kwargs)
Create a TranMap. Runs the command: $ATOOLS_DIR/asttranmap . Arguments --------- map1 : str The first component Mapping map2 : str The second component Mapping Keyword Arguments ----------------- options : str Options for the TranMap [!] result : str Name of file in which to store the TranMap fmt...
625941ccd268445f265b4f5a
def filteredSched(self, dests = []): <NEW_LINE> <INDENT> if type(dests) is not list: <NEW_LINE> <INDENT> dests = [dests,] <NEW_LINE> <DEDENT> out = [] <NEW_LINE> for departure in self.departures: <NEW_LINE> <INDENT> if departure.getDest() in dests: <NEW_LINE> <INDENT> out.append(departure) <NEW_LINE> <DEDENT> <DEDENT> ...
Returns a new Schedule of departures containing only the given destinations
625941ccb545ff76a8913f02
def clean_sam(inSam, outSam, picardPath=global_tool_paths['picard']): <NEW_LINE> <INDENT> assert inSam.endswith('.sam') and outSam.endswith('.sam') <NEW_LINE> cmdline = "java -Xmx2g -Djava.io.tmpdir=%s -jar %s/CleanSam.jar INPUT=%s OUTPUT=%s QUIET=true VALIDATION_STRINGENCY=SILENT" % ( tempfile.tempdir, picardPath, inS...
Clean sam file. Right now this only soft-clips an alignment that hangs off the end of the reference sequence and sets MAPQ to 0 for unmapped reads.
625941cc956e5f7376d70f59
def get_permission_message(permission_code): <NEW_LINE> <INDENT> default_message = _("Insufficient rights to access this directory.") <NEW_LINE> return { 'suggest': _('Insufficient rights to access suggestion mode.'), 'translate': _('Insufficient rights to access translation mode.'), 'review': _('Insufficient rights to...
Returns a human-readable message when `permission_code` is not met by the current context.
625941cc090684286d50edd1
@register.filter(name='is_checkbox') <NEW_LINE> def is_checkbox(field): <NEW_LINE> <INDENT> return _is_checkbox(field)
returns true if field is a checkbox
625941ccbf627c535bc132bb
@reserve_tools.elapsed_time <NEW_LINE> def analyze_html(cfg, cookies, datetime, res, reserves_list) : <NEW_LINE> <INDENT> _date = str(datetime[0]) + str(datetime[1]).zfill(2) + str(datetime[2]).zfill(2) <NEW_LINE> _time = str(datetime[3]).zfill(2) + ':' + str(datetime[4]).zfill(2) + '-' + str(datetime[5]).zfill(2) + ':...
6件目以降の検索のために、空き予約結果ページからフォームデータを取得するとともに、 空き予約リストに追加する
625941ccbaa26c4b54cb120b
@cache_definition <NEW_LINE> def DefinePartition_S(no: int, ni: int, elem_t: ST_Type, has_valid: bool = False) -> DefineCircuitKind: <NEW_LINE> <INDENT> class _Partition_S(Circuit): <NEW_LINE> <INDENT> name = "Partition_S_no{}_ni{}_tEl{}_v{}".format(str(no), str(ni), cleanName(str(elem_t)), str(has_valid)) <NEW_LINE> b...
Convert a SSeq (no*ni) elem_t to SSeq no (SSeq ni elem_t) I : In(SSeq(no*ni, elem_t).magma_repr()) O : Out(SSeq(no, SSeq(ni, elem_t)).magma_repr()) if has_valid: valid_up : In(Bit) valid_down : Out(Bit)
625941cc38b623060ff0aed9
def abort(self): <NEW_LINE> <INDENT> self._stop = True
Instructs the printer to cancel the job.
625941ccd99f1b3c44c6767a
def onNavGroupTriggered(self, action): <NEW_LINE> <INDENT> if action == self.prevPageAction: <NEW_LINE> <INDENT> self.printPreview.setCurrentPage(self.printPreview.currentPage() - 1) <NEW_LINE> <DEDENT> elif action == self.nextPageAction: <NEW_LINE> <INDENT> self.printPreview.setCurrentPage(self.printPreview.currentPag...
Handles page navigation actions.
625941ccb57a9660fec33970
def finalize(self): <NEW_LINE> <INDENT> self._clean_up_temporary_data() <NEW_LINE> logging.info("Finalizing calculated modes") <NEW_LINE> for ii,mode in enumerate(self.modes): <NEW_LINE> <INDENT> mode.label = self.label <NEW_LINE> self.guess_spurious_mode(mode) <NEW_LINE> if self.store_fields: <NEW_LINE> <INDENT> mode....
Finalize the modes after the solver has finished. Including - Clean up temporary objects - Delete or compress mode vectors is required - Remove debug information if not in debugging mode
625941cc1d351010ab855c07
def player_end_move(self): <NEW_LINE> <INDENT> self.engine.savesnap() <NEW_LINE> self.finished_move = True
End Current Player Turn
625941cc283ffb24f3c559ed
def stop_node(aie, n): <NEW_LINE> <INDENT> manage_node(aie, "stop", n) <NEW_LINE> count = 1 <NEW_LINE> is_stopping = True <NEW_LINE> while is_stopping is True: <NEW_LINE> <INDENT> time.sleep(5) <NEW_LINE> nodes, aie = get_status(aie) <NEW_LINE> if nodes[n] == "STOPPING": <NEW_LINE> <INDENT> msg = "\r [Stopping %s] %s"...
visual status progress of stopping process
625941ccc432627299f04d31
def get_copy_credentials(self): <NEW_LINE> <INDENT> creds = ec2.get_temporary_credentials() <NEW_LINE> if creds is not None: <NEW_LINE> <INDENT> return ("aws_access_key_id={};" "aws_secret_access_key={};" "token={}").format(creds.key_id, creds.secret_key, creds.token) <NEW_LINE> <DEDENT> creds = self.get_credentials() ...
Produce the credentials parameter for the copy command
625941cc6e29344779a626fe
def _2_dim_divided_convolve(filter, mat): <NEW_LINE> <INDENT> result = None <NEW_LINE> if 1 in filter.shape: <NEW_LINE> <INDENT> result = linear_convolve(filter, mat) <NEW_LINE> result = linear_convolve(filter.T, result) <NEW_LINE> <DEDENT> return result
:param filter: 线性卷积核,必须为二维(2 x 1也算二维) 否则返回None :param mat: 图片 :return: 卷积后的图片,(灰度图,彩图都适用) 若不是线性卷积核,返回None
625941ccbe383301e01b5571
def main(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> args = get_args() <NEW_LINE> config_array = [process_config(x) for x in args.config.split(" ")] <NEW_LINE> check_array = args.checkpoint_nb.split(" ") <NEW_LINE> cwd = os.getenv("EXP_PATH") <NEW_LINE> if args.outfile_multiple: <NEW_LINE> <INDENT> outfile = os.pat...
Loads the model from the checkpoint dir as specified in the given config file. Calls the prediction function to save the prediction csv file to the checkpoint dir.
625941cc63f4b57ef0001206
def test_helptext(self): <NEW_LINE> <INDENT> self.assertEqual(MyCrazyExtension.helptext(), "Foo bar")
Test extension help text.
625941cc45492302aab5e3af
def tilfeldig(self): <NEW_LINE> <INDENT> return self.spiller.all_valg[random.randint(0, 2)]
Hoved metode
625941cc91f36d47f21ac5df
def reinforce(env, estimator_policy, estimator_value, num_episodes=5000, discount=1.0): <NEW_LINE> <INDENT> episode_lengths = np.zeros(num_episodes) <NEW_LINE> episode_rewards = np.zeros(num_episodes) <NEW_LINE> Transition = namedtuple('Transition', ['state', 'action', 'reward', 'next_state', 'done']) <NEW_LINE> for i_...
REINFORCE algorithm (Monte Carlo Policy Gradient). Optimize the policy function approximator using policy gradient. :param env: OpenAi env :param estimator_policy: policy function to be optimized :param estimator_value: Value function estimator, used as baseline :param num_episodes: :param discount: :return: epis...
625941cc796e427e537b06b2
def model(x_train, y_train, x_test, y_test): <NEW_LINE> <INDENT> model = Sequential() <NEW_LINE> model.add(Dense(512, input_shape=(784,))) <NEW_LINE> model.add(Activation('relu')) <NEW_LINE> model.add(Dropout({{uniform(0, 1)}})) <NEW_LINE> model.add(Dense({{choice([256, 512, 1024])}})) <NEW_LINE> model.add(Activation({...
Model providing function: Create Keras model with double curly brackets dropped-in as needed. Return value has to be a valid python dictionary with two customary keys: - loss: Specify a numeric evaluation metric to be minimized - status: Just use STATUS_OK and see hyperopt documentation if not feasible The las...
625941ccb7558d58953c5001
def write(json_object, filename): <NEW_LINE> <INDENT> logger.info("Writing JSON object to {}".format(filename)) <NEW_LINE> with open(filename, 'w') as f: <NEW_LINE> <INDENT> dump(json_object, f, indent=4, sort_keys=True)
Write JSON
625941ccd99f1b3c44c6767b
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
625941ccdc8b845886cb5621
def __init__(self, version, sid): <NEW_LINE> <INDENT> super(CredentialContext, self).__init__(version) <NEW_LINE> self._solution = {'sid': sid, } <NEW_LINE> self._uri = '/Credentials/{sid}'.format(**self._solution)
Initialize the CredentialContext :param Version version: Version that contains the resource :param sid: The unique string that identifies the resource :returns: twilio.rest.chat.v2.credential.CredentialContext :rtype: twilio.rest.chat.v2.credential.CredentialContext
625941cc5166f23b2e1a5245
def query_yes_no(question, default="si"): <NEW_LINE> <INDENT> valid = {"si": True, "s": True, "no": False, "n": False} <NEW_LINE> if default is None: <NEW_LINE> <INDENT> prompt = " [s/n] " <NEW_LINE> <DEDENT> elif default == "si": <NEW_LINE> <INDENT> prompt = " [S/n] " <NEW_LINE> <DEDENT> elif default == "no": <NEW_LIN...
Ask a yes/no question via raw_input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits <Enter>. It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "...
625941ccd164cc6175782e3a
def _delete_index_table(self, table_name): <NEW_LINE> <INDENT> endpoint_url = None <NEW_LINE> if 'LOCAL_DYNAMODB_URL' in os.environ: <NEW_LINE> <INDENT> endpoint_url = os.environ['LOCAL_DYNAMODB_URL'] <NEW_LINE> <DEDENT> client = boto3.client('dynamodb', region_name=get_region(), endpoint_url=endpoint_url) <NEW_LINE> c...
Method to delete the S3 index table
625941cc097d151d1a222f46
def subsystem_requested(self, subsystem): <NEW_LINE> <INDENT> if subsystem == 'sftp': <NEW_LINE> <INDENT> return bool(self._sftp_factory) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return bool(self._session_factory)
Return whether starting a subsystem can be requested
625941cc187af65679ca520b
def numbers_to_words(frequency: List[int]) -> List[str]: <NEW_LINE> <INDENT> filtered = [index for (index, value) in enumerate(frequency) if not value == 0] <NEW_LINE> words: List[str] = [] <NEW_LINE> while len(filtered) > 0: <NEW_LINE> <INDENT> current = filtered.pop(0) <NEW_LINE> words.append(common_words[current]) <...
Convert the numbers array back to words. This is intended to only be used for testing/debugging. :param frequency: A list of frequencies of words. An index in the array is the index of the word in the google top words list :return: A list of words
625941cc091ae3566866704a
def make_change(name): <NEW_LINE> <INDENT> if not os.path.exists(name): <NEW_LINE> <INDENT> os.mkdir(name) <NEW_LINE> <DEDENT> os.chdir(name)
Change into the directory NAME, making it if it does not exist
625941cc6aa9bd52df036e90
def open(self): <NEW_LINE> <INDENT> self._line.open() <NEW_LINE> self.lock.lock(2, self.key)
Opens and subsequently locks the serial line for 2 seconds (to give it time to open)
625941cc71ff763f4b549777
def test28_iiif_info_handler(self): <NEW_LINE> <INDENT> c = Config() <NEW_LINE> c.api_version = '2.1' <NEW_LINE> c.klass_name = 'dummy' <NEW_LINE> c.image_dir = os.path.join(os.path.dirname(__file__), '../testimages') <NEW_LINE> c.tile_height = 512 <NEW_LINE> c.tile_width = 512 <NEW_LINE> c.scale_factors = [1, 2] <NEW_...
Test iiif_info_handler().
625941ccbe383301e01b5572
def exp(self): <NEW_LINE> <INDENT> if not self.part_of_degree(0).is_zero(): <NEW_LINE> <INDENT> raise ValueError('Must not have a constant part.') <NEW_LINE> <DEDENT> exp_x = self.parent().one() <NEW_LINE> for d in range(1,self.parent()._variety.dimension()+1): <NEW_LINE> <INDENT> exp_x += self**d / factorial(d) <NEW_L...
Exponentiate ``self``. .. NOTE:: The exponential `\exp(x)` of a rational number `x` is usually not rational. Therefore, the cohomology class must not have a constant (degree zero) part. The coefficients in the Taylor series of `\exp` are rational, so any cohomology class without constant term can ...
625941cc66673b3332b9217d
def get(self, scale, geom_type, tag_value, default=None): <NEW_LINE> <INDENT> level = self.get_level(scale) <NEW_LINE> try: <NEW_LINE> <INDENT> return self.styles[level][geom_type][utils.dict2key(tag_value)] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return default
Returns style or default for given settings. :param scale: metres per pixel or point :param geom_type: one of ``'point'``, ``'line'`` or ``'polygon'`` :param tag_value: dict specifying the tags and values of the style, e.g. ``{'highway':'motorway', ...}`` :param default: default value if no style is found :return...
625941ccbd1bec0571d9071c
def __init__(self, name, dirname=None, **kwargs): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.logger = logging.getLogger('gromacs.manager.%(name)s' % vars()) <NEW_LINE> try: <NEW_LINE> <INDENT> cfg = get_manager_config(find_manager_config(name)) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> logger.error("Fai...
Set up the manager. :Arguments: *name* configuration name (corresponds to a store cfg file) *dirname* directory component under the remote scratch dir (should be different for different jobs); the default is to strip *topdir* from the config file from the full path of the current dire...
625941ccb830903b967e99f8
def iterkeys(self): <NEW_LINE> <INDENT> return self._session.iterkeys()
Returns an iterator over the keys.
625941ccac7a0e7691ed41b9
def write_geometry(data, _unit, geo_file): <NEW_LINE> <INDENT> delta = 100 if _unit == "cm" else 1 <NEW_LINE> xmin = np.min(data[:, 2]) - delta <NEW_LINE> xmax = np.max(data[:, 2]) + delta <NEW_LINE> ymin = np.min(data[:, 3]) - delta <NEW_LINE> ymax = np.max(data[:, 3]) + delta <NEW_LINE> data = ET.Element("geometry") ...
Creates a bounding box around the trajectories :param data: 2D-array :param Unit: Unit of the trajectories (cm or m) :param geo_file: write geometry in this file :returns: geometry file names geometry.xml
625941cc2ae34c7f2600d21e
def unlink_user(self, user, partner): <NEW_LINE> <INDENT> if not partner.users.filter(pk=user.pk).exists(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> partner.users.remove(user) <NEW_LINE> if not user.is_staff and not user.partners.exists(): <NEW_LINE> <INDENT> user.user_permissions.filter( codename='dashboar...
Unlinks a user from a partner, and removes the dashboard permission if she's not linked to any other partners. Returns False if the user was not linked to the partner; True otherwise.
625941ccc4546d3d9de72b20
def ch_info(player_input): <NEW_LINE> <INDENT> response = [] <NEW_LINE> response.append("I am the mining assistant, here to facilitate your ventures by order of the empress. My lieutenant is {admin}, who may be able to handle inquiries beyond my availability.".format(admin=player_input.bot.ADMIN)) <NEW_LINE> response....
Handles responses to !info command, which announces the session administrator and gives a list of commands the bot responds to.
625941cc4428ac0f6e5ba8df
@cli.command('live-profile', cls=ProfilingCommand) <NEW_LINE> @profiler_arguments <NEW_LINE> @profiler_options <NEW_LINE> @live_profiler_options <NEW_LINE> @viewer_options <NEW_LINE> def live_profile(script, argv, timer, interval, spawn, signum, pickle_protocol, mono): <NEW_LINE> <INDENT> filename, code, globals_ = scr...
Profile a Python script continuously.
625941cc30dc7b7665901a53
def test_companies_attribute_is_set_to_None(self): <NEW_LINE> <INDENT> self.assertTrue(self.test_user.companies is not None) <NEW_LINE> with self.assertRaises(TypeError) as cm: <NEW_LINE> <INDENT> self.test_user.companies = None <NEW_LINE> <DEDENT> self.assertEqual( str(cm.exception), "'NoneType' object is not iterable...
testing if a the companies attribute will be an empty list if it is set to None
625941cc3617ad0b5ed67fe4
def reduce(operand, init_value, computation, dimensions): <NEW_LINE> <INDENT> monoid_reducer = _get_monoid_reducer(computation, init_value) <NEW_LINE> if monoid_reducer: <NEW_LINE> <INDENT> return monoid_reducer(operand, dimensions) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> jaxpr, consts = _reduction_jaxpr(computat...
Wraps XLA's `Reduce <https://www.tensorflow.org/xla/operation_semantics#reduce>`_ operator.
625941cc0383005118ecf6cf
def full_dict(self, img_func=None): <NEW_LINE> <INDENT> return [elem.full_dict(img_func) for elem in self.all()]
Devuelve una lista de diccionarios con los datos de los full dicts de los objetos.
625941cc5fc7496912cc3a6a
def NonConstPointer(self): <NEW_LINE> <INDENT> pass
NonConstPointer(self: SimpleArrayBrepPointer) -> IntPtr Gets the non-const pointer (for modification) of this array. Returns: The non-const pointer.
625941cc236d856c2ad448c7
def push_path(self, path): <NEW_LINE> <INDENT> util.raiseNotDefined()
(SearchProcedure, SearchPath) -> None Pushes path into the fringe. :param path: the SearchPath to push into the fringe :return: None
625941cc5510c4643540f4d1
def _build_layout(self, show_head=True, show_control=True, update=True, recurse=False): <NEW_LINE> <INDENT> DBG("build layout") <NEW_LINE> self.setLayout(QtWidgets.QVBoxLayout()) <NEW_LINE> self.layout().setContentsMargins(0, 0, 0, 0) <NEW_LINE> self.layout().setSpacing(0) <NEW_LINE> self.header = self._add_frame() <NE...
build_layout - build layout
625941cc23e79379d52ee651
def update_uvars_from_gui(self, warn=0): <NEW_LINE> <INDENT> if self.set_pdir: <NEW_LINE> <INDENT> pdir = SUBJ.get_def_tool_path('align_test', top_dir='tool_results', prefix='tool', keep_if_missing=self.uvars.val('results_dir')) <NEW_LINE> if self.set_cvar('proc_dir', pdir): <NEW_LINE> <INDENT> print('-- setting proc_d...
set what we can, if warn, report error return 0 on success, 1 on error
625941cc55399d3f055887a1
def __init__(self, adb, suffix='', prefix='temp_file', dir='/data/local/tmp'): <NEW_LINE> <INDENT> if None in (dir, prefix, suffix): <NEW_LINE> <INDENT> m = 'Provided None path component. (dir: %s, prefix: %s, suffix: %s)' % ( dir, prefix, suffix) <NEW_LINE> raise ValueError(m) <NEW_LINE> <DEDENT> self._adb = adb <NEW_...
Find an unused temporary file path on the device. When this object is closed, the file will be deleted on the device. Args: adb: An instance of AdbWrapper suffix: The suffix of the name of the temp file. prefix: The prefix of the name of the temp file. dir: The directory on the device where to place the temp ...
625941cc67a9b606de4a7fa6
def test_create_queue_custom(self): <NEW_LINE> <INDENT> client = fakeredis.FakeStrictRedis(decode_responses=True) <NEW_LINE> client.flushall() <NEW_LINE> queue = RedisSMQ(client=client) <NEW_LINE> queue_name = 'test-queue-2' <NEW_LINE> queue_key = 'rsmq:%s:Q' % queue_name <NEW_LINE> queue.createQueue(qname=queue_name, ...
Test Creating of the Queue
625941ccf548e778e58cd66a
def upload_disconf_files_to_crp(disconf_info_list, crp_url): <NEW_LINE> <INDENT> url = crp_url + "api/deploy/upload" <NEW_LINE> try: <NEW_LINE> <INDENT> res = [] <NEW_LINE> for disconf_info in disconf_info_list: <NEW_LINE> <INDENT> disconf_type = 'disconf' <NEW_LINE> disconf_admin_content = disconf_info.get('disconf_ad...
上传disconf文件到crp :param disconf_info: :param env: :return:
625941cc0fa83653e46570a8
def test_is_position_valid(self): <NEW_LINE> <INDENT> width, height, dirt_amount = (3, 4, 2) <NEW_LINE> room = ps3.EmptyRoom(width, height, dirt_amount) <NEW_LINE> solution_room = test.EmptyRoom(width, height, dirt_amount) <NEW_LINE> for x in [0.0, -0.1, width - 0.1, width, width + 0.1]: <NEW_LINE> <INDENT> for y in [0...
Test is_position_valid this should be refactored as it's mostly a copy of is_position_in_room code
625941cc6fb2d068a760f18a
def MULSUB_QFT_No_Parity(n, qubitnamesa=None, qubitnamesb=None, qubitnamec=None, qubitnamed=None): <NEW_LINE> <INDENT> qna = buildnames(n=n, qubitnames=qubitnamesa, defaultname="a") <NEW_LINE> qnb = buildnames(n=2*n, qubitnames=qubitnamesb, defaultname="b") <NEW_LINE> qnc = buildnames(n=1, qubitnames=qubitnamec, defaul...
a: eigenvalue, which will not be touched (size n); b: inverted power x0, which will be transformed to the first estimate x1 (size 2*n); c: control whether the subtraction is performed (size 1); d: ancilla qubit (size 1); (a, b, c, d) -> (a, b*(2-ab), c, d)
625941ccfb3f5b602dac377f
def remove_file(self, key): <NEW_LINE> <INDENT> path = self._get_file_path(key) <NEW_LINE> if default_storage.exists(path): <NEW_LINE> <INDENT> default_storage.delete(path) <NEW_LINE> return True <NEW_LINE> <DEDENT> return False
Remove the file at the given keyed location. Returns True if the file exists, and was removed. Returns False if the file does not exist, and so was not removed.
625941ccd53ae8145f87a35d
def deleteNode(self, node): <NEW_LINE> <INDENT> node.val, node.next = node.next.val, node.next.next <NEW_LINE> while node.next.next: <NEW_LINE> <INDENT> node.val, node = node.next.val, node.next <NEW_LINE> <DEDENT> node.val, node.next = node.next.val, None
:type node: ListNode :rtype: void Do not return anything, modify node in-place instead.
625941ccb545ff76a8913f03
def compare(ind1, ind2): <NEW_LINE> <INDENT> for key in ind1.keys(): <NEW_LINE> <INDENT> if ind1[key] != ind2[key]: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True
Helper function for comparing to individuals. Returns True if all fields are the same, otherwise False. Parameters ---------- ind1 : object individual 1 ind2 : object individual 2
625941cc9b70327d1c4e0ec2
def get_discr(params, F=0): <NEW_LINE> <INDENT> u1, u2, c1_2, c2_2, r, g = params <NEW_LINE> if F != 0: <NEW_LINE> <INDENT> u1, u2 = corr_u(*params, F) <NEW_LINE> <DEDENT> a, b, c, d = char_poly_coeff(u1, u2, c1_2, c2_2, r, g) <NEW_LINE> d0 = b*b + 12*d - 3*a*c <NEW_LINE> d1 = 27*a*a*d - 9*a*b*c + 2*b*b*b - 72*b*d + 27...
Computes the coefficients of the characteristic polynomial and finds the discriminant of the characteristic polynomial
625941cc67a9b606de4a7fa7
def run_forever(self): <NEW_LINE> <INDENT> while self._timer or self._poll: <NEW_LINE> <INDENT> timeout = self.poll_timers() <NEW_LINE> self.poll_fds(timeout)
Run until there is nothing to be done. You should call this as soon as you're done setting up the initial sockets (and possibly timers).
625941ccd10714528d5ffdd0
def _gethash(self, key): <NEW_LINE> <INDENT> return hash(key) % (len(self._data))
Returns remainder of hash(key) mod _data size
625941cc0c0af96317bb82d5
def _updateProperties(self, properties): <NEW_LINE> <INDENT> addedEditedProperties = list() <NEW_LINE> deletableProperties = list() <NEW_LINE> for prop in properties: <NEW_LINE> <INDENT> state = prop[-1] <NEW_LINE> if state & self._DELETED: <NEW_LINE> <INDENT> deletableProperties.append(prop[0]) <NEW_LINE> <DEDENT> eli...
Converts the data saved in the model back to its internally used representation and stores it.
625941cc94891a1f4081bb96
def __createCertM2Crypto(self): <NEW_LINE> <INDENT> userPubKey = EVP.PKey() <NEW_LINE> userPubKey.assign_rsa(RSA.gen_key(self.bits, 65537, util.quiet_genparam_callback)) <NEW_LINE> userCert = X509.X509() <NEW_LINE> userCert.set_pubkey(userPubKey) <NEW_LINE> userCert.set_version(2) <NEW_LINE> userCert.set_subject(self._...
Create new certificate for user :return: S_OK(tuple)/S_ERROR() -- tuple contain certificate and pulic key as strings
625941cc2eb69b55b151c99c
def script(name, source=None, template=None, onlyif=None, unless=None, cwd='/root', user=None, group=None, shell=None, env=None, stateful=False, **kwargs): <NEW_LINE> <INDENT> if stateful: <NEW_LINE> <INDENT> return _reinterpreted_state( _delegate_to_state( 'cmd.script', name, onlyif=onlyif, unless=unless, cwd=cwd, use...
Download a script from a remote source and execute it. The name can be the source or the source value can be defined. name The command to execute, remember that the command will execute with the path and permissions of the salt-minion. onlyif A command to run as a check, run the named command only if the ...
625941ccf9cc0f698b1406e9
def make_full_name(typ, key, meta): <NEW_LINE> <INDENT> if typ == 'pkg-section': <NEW_LINE> <INDENT> return 'pkg-section-' + key <NEW_LINE> <DEDENT> elif typ == 'pkg-field': <NEW_LINE> <INDENT> section, name = key <NEW_LINE> if section is not None: <NEW_LINE> <INDENT> return '-'.join(('pkg-field',section, name)) <NEW_L...
Return an anchor name for object type
625941cc596a897236089bae
def add_done_callback(self, callback): <NEW_LINE> <INDENT> self.done_callbacks.append(callback) <NEW_LINE> if self._done: <NEW_LINE> <INDENT> def call_cb(): <NEW_LINE> <INDENT> self._retrieved_result = True <NEW_LINE> callback(self) <NEW_LINE> <DEDENT> self.loop.call_from_executor(call_cb)
Add a callback to be run when the future becomes done. (This callback will be called with one argument only: this future object.)
625941cc01c39578d7e74f28
def create_and_get_explore_data_structure(template, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> explore_data_structure = get_by_user_id_and_template_id( user_id=str(request.user.id), template_id=template.id ) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> explore_data_structure = ExploreDataStructure( user=...
Get Data structure from template and user, generate them if no exist Args: template: request: Returns: Explore Data structure
625941cc91af0d3eaac9bb06
def set_project_quotas(self, external_project_id, parsed_project_quotas): <NEW_LINE> <INDENT> project = res.get_or_create_project(external_project_id) <NEW_LINE> self.repo.create_or_update_by_project_id(project.id, parsed_project_quotas) <NEW_LINE> repo.commit()
Create a new database entry, or update existing one :param external_project_id: ID of project whose quotas are to be set :param parsed_project_quotas: quota values to save in database :return: None
625941cc9f2886367277a97a
def addWord(self, word): <NEW_LINE> <INDENT> current = self.root <NEW_LINE> for letter in word: <NEW_LINE> <INDENT> current = current.children[letter] <NEW_LINE> <DEDENT> current.is_word=True
Adds a word into the data structure. :type word: str :rtype: None
625941cce64d504609d7492d
def nio(self): <NEW_LINE> <INDENT> return self._get('nio')
Returns nio version info.
625941cceab8aa0e5d26dc45
def _train_op(self): <NEW_LINE> <INDENT> with tf.control_dependencies(self.ema_update_op): <NEW_LINE> <INDENT> current_signs = self.vars[0] <NEW_LINE> correct_signs = self._sign_func(self.dH_ema[0]) <NEW_LINE> wrong_signs = tf.not_equal(current_signs, correct_signs) <NEW_LINE> magnitudes = tf.abs(self.dH_ema[0]) <NEW_L...
Train op
625941cc5166f23b2e1a5246
def save_polarity_pie_charts(file_score_dict, gui=False, file_path=os.path.join(RESULT_PATH, 'sentiment_analysis'), file_name='polarity_pie_charts.pdf'): <NEW_LINE> <INDENT> pies_data = [t for t in file_score_dict.values()] <NEW_LINE> import loacore.load.file_load as file_load <NEW_LINE> files = file_load.load_database...
Plot polarity pie charts using Matplotlib, and save them into a .pdf file. :param file_score_dict: Data to plot and save. The :obj:`dict` maps ID_Files to a polarity tuple (pos_score, neg_score, obj_score). :type file_score_dict: :obj:`dict` of :obj:`int` : :obj:`tuple` :param gui: Specify if a gui should be used ...
625941ccbe7bc26dc91cd6ed
def login(request): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> form = LoginForm(request.POST) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> user = authenticate( username=form.cleaned_data['username'], password=form.cleaned_data['password'], ) <NEW_LINE> if user is not None: <NEW_LINE> <IN...
Log in a user, redirect to start page if wrong credentials :param request: request to be handled :return: Redirect or render
625941cc99fddb7c1c9de47e
def log_survival(self, y: Tensor) -> Tensor: <NEW_LINE> <INDENT> r <NEW_LINE> x = y <NEW_LINE> for t in self.transforms[::-1]: <NEW_LINE> <INDENT> x = t.f_inv(x) <NEW_LINE> <DEDENT> return self.base_distribution.log_survival(x)
Logarithm of the survival function :math:`\log S(y) = \log(1 - CDF(y))`.
625941ccd58c6744b4257d4d
def queue_to_dict(node=None): <NEW_LINE> <INDENT> if not node: <NEW_LINE> <INDENT> node = mxcube.queue.get_model_root() <NEW_LINE> <DEDENT> return reduce(lambda x, y: x.update(y) or x, queue_to_json_rec(node), {})
Returns the dictionary representation of the queue :param TaskNode node: Node to get representation for, queue root used if nothing is passed. :returns: dictionary on the form: { sampleID_1: [task1, ... taskn] . . . sampleID_n: [task1, .....
625941cc462c4b4f79d1d7be
def execute_request( self, request: Request, handler: Callable[[Optional[Any]], None], error_handler: Optional[Callable[[Any], None]] = None, timeout: float = DEFAULT_SYNC_REQUEST_TIMEOUT ) -> None: <NEW_LINE> <INDENT> if self.transport is None: <NEW_LINE> <INDENT> debug('unable to send', request.method) <NEW_LINE> ret...
Sends a request and waits for response up to timeout (default: 1 second), blocking the current thread.
625941cc50485f2cf553ce87
def test_default(self): <NEW_LINE> <INDENT> fun = sys._getframe().f_code.co_name <NEW_LINE> print("Run: %s.%s() " % (self.__class__.__name__, fun)) <NEW_LINE> old_stdout = sys.stdout <NEW_LINE> old_stderr = sys.stderr <NEW_LINE> sys.stdout = mystdout = StringIO() <NEW_LINE> sys.stderr = mystderr = StringIO() <NEW_LINE>...
test nxsconfig default
625941cc796e427e537b06b3
def testValid(self): <NEW_LINE> <INDENT> verifier = self.ncl.gen_random_64() <NEW_LINE> id = self.ncl.gen_uniq_id() <NEW_LINE> client = nfs_client_id4(self.ncl, verifier, id) <NEW_LINE> cb_program = 0 <NEW_LINE> r_netid = "udp" <NEW_LINE> r_addr = "0002" + "0000" + "00112233" + "00" <NEW_LINE> cb_location = clientaddr4...
Simple SETCLIENTID Covered valid equivalence classes: 10, 20, 30, 40
625941cca17c0f6771cbe13e
def get_dev_examples(self, data_dir): <NEW_LINE> <INDENT> return self._create_examples( self._read_tsv(os.path.join(data_dir, "triples.small.dev.5k.tsv")), "dev")
See base class.
625941cc5e10d32532c5f014
def average( self, shp_fn=None, date_list=None, value_list=None, start=None, end=None, touch_all=False): <NEW_LINE> <INDENT> if date_list is None: <NEW_LINE> <INDENT> date_list = [] <NEW_LINE> <DEDENT> if value_list is None: <NEW_LINE> <INDENT> value_list = [] <NEW_LINE> <DEDENT> datenums = self.datenum_range() <NEW_LI...
Calculate the average value for each time step. Parameters ---------- shp_fn : str, optional Path and file name of the masking shapefile, default is None. date_list : list, optional List containing datetime objects, default is None. value_list : list, optional List containing average values, default is Non...
625941cc566aa707497f4656
def __init__(self, fullFileName, delimiter='\t', quotechar='\x01', dialect='excel'): <NEW_LINE> <INDENT> self.gzipped = False <NEW_LINE> if fullFileName.endswith('.gz'): <NEW_LINE> <INDENT> self.file = gzip.open(fullFileName) <NEW_LINE> self.gzipped = True <NEW_LINE> csvfile = codecs.iterdecode(self.file, 'utf8') <NEW_...
Otevře soubor
625941cccb5e8a47e48b7b98
def is_active(self): <NEW_LINE> <INDENT> return self._active
Checks if the scheduler is running.
625941cce1aae11d1e749da4
def color_element_by_scr_scores(self, element, color_structure=True): <NEW_LINE> <INDENT> element.color_by = "scr-scores" <NEW_LINE> return self.color_element(element, color_structure=color_structure)
Color by CAMPO scores.
625941cc2c8b7c6e89b358ae
def mock_turn_on(service): <NEW_LINE> <INDENT> if service.data and ATTR_ENTITY_ID in service.data: <NEW_LINE> <INDENT> entity_ids = extract_entity_ids(hass, service) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> entity_ids = hass.states.entity_ids(service.domain) <NEW_LINE> <DEDENT> for entity_id in entity_ids: <NEW_LI...
Will fake the component has been turned on.
625941cc15fb5d323cde0bfd
def encode(stream: IO[bytes], value: int): <NEW_LINE> <INDENT> is_signed = value < 0 <NEW_LINE> abs_value = abs(value) <NEW_LINE> if not is_signed and abs_value <= 0x7f: <NEW_LINE> <INDENT> stream.write(bytes([abs_value])) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if is_signed and abs_value <= 0x1F: <NEW_LINE> <IND...
Encode a integer value into a bytes stream :param stream: :param value: The value to be encoded :return: The generated byets
625941ccfbf16365ca6f62b2
def test_fetchxall(self): <NEW_LINE> <INDENT> cursor = self._context.cursor() <NEW_LINE> self._context.rows = len(self.SAMPLES) <NEW_LINE> table = self._create_table(('name varchar(20)',), lambda x, y: y == 0 and self.SAMPLES[x]) <NEW_LINE> procedure = self._create_procedure((), 'select count(*) from {0}; select name f...
test fetchxall method of cursor
625941cc7d847024c06be3a9
def wait(self): <NEW_LINE> <INDENT> pass
Wait for service to complete.
625941cc9c8ee82313fbb863
def p_TwinHeader_Comments(t): <NEW_LINE> <INDENT> t[0] = t[1].setv('comments', t[2])
TwinHeader : TwinHeader Comments
625941cc004d5f362079a421
def params(ws, wa, wc, we, wf): <NEW_LINE> <INDENT> def function(i, maxi, agents=1): <NEW_LINE> <INDENT> def rand(): return np.random.sample((agents, 1)) <NEW_LINE> w = 0.9 - i * ((0.9 - 0.4) / maxi) <NEW_LINE> m = 0.1 - i * ((0.15 - 0.0) / (maxi / 2.0)) <NEW_LINE> m = 0.0 if m < 0.0 else m <NEW_LINE> s = ws * m * rand...
Funkcja zwraca funkcje ktora zwraca zbior parametrow dla zadanego numeru iteracji. Parametry obliczane sa na podstawie wag zadanych w wywolaniu funkcji.
625941cca934411ee3751781
@app.route('/api/sign', methods=['GET', 'POST']) <NEW_LINE> def sign(): <NEW_LINE> <INDENT> filename = request.json['filename'] <NEW_LINE> sign, url = get_sign(filename) <NEW_LINE> return jsonify({'sign': sign, 'url': url})
由于用户上传过来的文件的名字 和 真正保存的名字不同,应该保存在数据库中。 当用户 :return:
625941cc090684286d50edd3
def maxrectangle(matrix): <NEW_LINE> <INDENT> matrix = [[int(v) for v in l] for l in matrix] <NEW_LINE> if not len(matrix) or not len(matrix[0]): return 0 <NEW_LINE> N, M = len(matrix), len(matrix[0]) <NEW_LINE> cumsums = [0]*M <NEW_LINE> maxsum = 0 <NEW_LINE> def largestHistogram(heights): <NEW_LINE> <INDENT> maxsize ...
:type matrix: List[List[str]] :rtype: int
625941ccb545ff76a8913f04
def _pinyin_generator(chars, encoding): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> chars = chars.decode(encoding) <NEW_LINE> <DEDENT> except UnicodeDecodeError as e: <NEW_LINE> <INDENT> logging.error("Incorrect encodings:" + chars + " " + encoding) <NEW_LINE> raise StopIteration <NEW_LINE> <DEDENT> for char in chars...
Generate pinyin for chars, if char is not chinese character, itself will be returned. Args: chars: the chinese character string encoding: the encoding mode of s Return: An iterator which can generate pinyin string of chars
625941cc8a349b6b435e8261
def get_repos_for_project(project_name, uri, source_root, ignored_repos=None, commands=None, proxy=None, command_timeout=None, headers=None, timeout=None): <NEW_LINE> <INDENT> logger = logging.getLogger(__name__) <NEW_LINE> repos = [] <NEW_LINE> for repo_path in get_repos(logger, project_name, uri, headers=headers, tim...
:param project_name: project name :param uri: web application URI :param source_root source root :param ignored_repos: list of ignored repositories :param commands: dictionary of commands - paths to SCM programs :param proxy: dictionary of proxy servers - to be used as environment variables :param command...
625941ccf8510a7c17cf97ea
def quadratic_from_f_ders(x, v, d1, d2): <NEW_LINE> <INDENT> a = d2*0.5 <NEW_LINE> b = d1 - d2*x <NEW_LINE> c = -d1*x + d2*x*x*0.5 + v <NEW_LINE> return [a, b, c]
from sympy import * f, a, b, c, x, v, d1, d2 = symbols('f, a, b, c, x, v, d1, d2') f0 = a*x**2 + b*x + c f1 = diff(f0, x) f2 = diff(f0, x, 2) solve([Eq(f0, v), Eq(f1, d1), Eq(f2, d2)], [a, b, c])
625941cce1aae11d1e749da5