code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def abs(self): <NEW_LINE> <INDENT> return self._unop("abs") | Return new H2OFrame equal to elementwise absolute value of the current frame. | 625941eff7d966606f6aa56e |
def categorize_changes(args, paths, verbose_command=None): <NEW_LINE> <INDENT> mapper = PathMapper(args) <NEW_LINE> commands = { 'sanity': set(), 'units': set(), 'integration': set(), 'windows-integration': set(), 'network-integration': set(), } <NEW_LINE> additional_paths = set() <NEW_LINE> for path in paths: <NEW_LIN... | :type args: TestConfig
:type paths: list[str]
:type verbose_command: str
:rtype paths: dict[str, list[str]] | 625941ef0c0af96317bb874b |
def get_rating_for_user(self, user, ip_address=None, cookies=None): <NEW_LINE> <INDENT> kwargs = self.default_kwargs.copy() <NEW_LINE> if user.is_authenticated(): <NEW_LINE> <INDENT> kwargs['user'] = user <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not ip_address: <NEW_LINE> <INDENT> raise ValueError('``user`` or ... | get_rating_for_user(user, ip_address=None, cookie=None)
Returns the rating for a user or anonymous IP. | 625941ef63f4b57ef000166c |
def __init__(self, sc_type, sc, timestamp, time_unit, value_status, value): <NEW_LINE> <INDENT> self.sc_type = sc_type <NEW_LINE> self.sc = sc <NEW_LINE> self.timestamp = timestamp <NEW_LINE> self.value_status = value_status <NEW_LINE> self.value = value <NEW_LINE> self.time_unit = time_unit | :param timestamp: any length - will be fitted to smallest datatype possible.
not known if
:type value: binary | 625941efe5267d203edce1f9 |
def get_notes(): <NEW_LINE> <INDENT> notes = input("Please enter any additional notes for this task entry (OPTIONAL): ") <NEW_LINE> return notes | Get the optional notes from the task | 625941efaad79263cf390fac |
def breadths_table(self): <NEW_LINE> <INDENT> stations = list(reversed(self.stations)) <NEW_LINE> lines = [self.title_line(stations)] <NEW_LINE> sheer_line = [self._format_label('Sheer')] <NEW_LINE> for s in stations: <NEW_LINE> <INDENT> sheer_line.append(self._format_dimension(self.sheer_breadth[s])) <NEW_LINE> <DEDEN... | Table of half-breadths.
Like write_heights() write one column for each value in the self.station_positions
hash which maps station labels (integer) into positions along the x or length axis. | 625941ef7d847024c06be824 |
def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/OneLogin/Users/CreateUser') | Create a new instance of the CreateUser Choreo. A TembooSession object, containing a valid
set of Temboo credentials, must be supplied. | 625941ef3346ee7daa2b32d4 |
def salt_master(): <NEW_LINE> <INDENT> import salt.cli.daemons <NEW_LINE> if __name__ != '__main__': <NEW_LINE> <INDENT> sys.modules['__main__'] = sys.modules[__name__] <NEW_LINE> <DEDENT> if six.PY2: <NEW_LINE> <INDENT> from salt.utils.versions import warn_until <NEW_LINE> warn_until('Sodium', 'Python 2.7 will reach t... | Start the salt master. | 625941ef30c21e258bdfaa07 |
def put_event_multi_touch(self, count, contacts, scan_time): <NEW_LINE> <INDENT> if not isinstance(count, baseinteger): <NEW_LINE> <INDENT> raise TypeError("count can only be an instance of type baseinteger") <NEW_LINE> <DEDENT> if not isinstance(contacts, list): <NEW_LINE> <INDENT> raise TypeError("contacts can only b... | Sends a multi-touch pointer event. The coordinates are expressed in
pixels and start from [1,1] which corresponds to the top left
corner of the virtual display.
The guest may not understand or may choose to ignore this event.
:py:func:`multi_touch_supported`
in count of type int
Number of contacts in the ev... | 625941efd53ae8145f87a7c8 |
def finalize_upload(folder, upload, success, message=None, upload_callback=None): <NEW_LINE> <INDENT> datafile_path = folder.get_datafile_path(upload.datafile_index) <NEW_LINE> datafile_name = os.path.basename(datafile_path) <NEW_LINE> if success: <NEW_LINE> <INDENT> upload.status = UploadStatus.COMPLETED <NEW_LINE> if... | Finalize upload | 625941efd8ef3951e3243aa1 |
def render_GET(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = parseUriQuery(request.opt.uri_query) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> log.msg("Bad or ambiguous query options!") <NEW_LINE> response = coap.Message(code=coap.BAD_REQUEST, payload="Bad or ambiguous query option... | Return list of endpoints matching params specified in URI query. | 625941effff4ab517eb2f9a3 |
def extract_regimes(cac, window_size, num=3): <NEW_LINE> <INDENT> ez = window_size * 5 <NEW_LINE> found = [] <NEW_LINE> tmp = np.copy(cac) <NEW_LINE> n = len(tmp) <NEW_LINE> for _ in range(num): <NEW_LINE> <INDENT> min_index = np.argmin(tmp) <NEW_LINE> found.append(min_index) <NEW_LINE> ez_start = np.max([0, min_index ... | Given a corrected arc curve extract a given number of regimes. The regimes
are computed with an exclusion zone to avoid very close matches. By default
it sets the exclusion zone to 5 times the window size per the author.
Per the authors:
This exclusion zone is based on an assumption that regimes will have
multiple re... | 625941efaad79263cf390fad |
def __init__(self, forq_haplotype): <NEW_LINE> <INDENT> self.info = forq_haplotype <NEW_LINE> self.length = len(self.info) <NEW_LINE> self.founders = [haplotype_id for position, haplotype_id in self.info] <NEW_LINE> self.founders_set = list(set(self.founders)) <NEW_LINE> self.positions = None <NEW_LINE> self.position_m... | Forqs Haplotype Instance Creation | 625941ef97e22403b379d4ff |
def packages(pkg_list, update=False): <NEW_LINE> <INDENT> pkg_list = [pkg for pkg in pkg_list if not is_installed(pkg)] <NEW_LINE> if pkg_list: <NEW_LINE> <INDENT> install(pkg_list, update) | Require several deb packages to be installed.
Example::
from burlap import require
require.deb.packages([
'foo',
'bar',
'baz',
]) | 625941ef21bff66bcd684eb1 |
def willMount(self, f_3db): <NEW_LINE> <INDENT> pass | C_in -- `C_(i\n) = 1 / (2 pi f_(3db)R_(i\n))`
C_out -- `C_(out) = 1 / (2 pi f_(3db)R_(load))` | 625941ef7cff6e4e81117ee9 |
def load_from_matrix(self, matrix) -> None: <NEW_LINE> <INDENT> dim = len(matrix) <NEW_LINE> self.nodes = [NetworkNode(i, None) for i in range(dim)] <NEW_LINE> for i in range(dim): <NEW_LINE> <INDENT> for j in range(i + 1, dim): <NEW_LINE> <INDENT> if matrix[i][j] == 1: <NEW_LINE> <INDENT> self.nodes[i].connect(self.no... | creates a Network based on the input
adjacency matrix.
Note : This Network implementation
is non-directional as well as non-weighted.
Therefore, when taking in the adjacency matrix
the graph only looks at the top right triangle
of the adjacency matrix. | 625941ef3539df3088e2e8af |
def test_add_child_sub(self, client): <NEW_LINE> <INDENT> root = Node.root() <NEW_LINE> top = root.add("top") <NEW_LINE> sub = top.add("sub") <NEW_LINE> assert root.children().count() == 1 <NEW_LINE> assert top.children().count() == 1 <NEW_LINE> assert isinstance(sub, Node) <NEW_LINE> assert sub.path == "/top/sub" <NEW... | adding a child to a nonroot | 625941efb5575c28eb68e569 |
def __init__(self, molecule, writer, string, periodic_info): <NEW_LINE> <INDENT> self.molecule = molecule <NEW_LINE> self.writer = writer <NEW_LINE> self.string = string <NEW_LINE> self.periodic_info = periodic_info | Initialize a :class:`.CaseData` instance.
Parameters
----------
molecule : :class:`.Molecule`
Molecule to test.
writer : :class:`.PdbWriter`
The writer to test.
string : :class:`str`
The expected output string.
periodic_info : :class:`.PeriodicInfo`
Information about periodic cell. | 625941ef377c676e9127270a |
def get_channel_videos(channel_id, limit, offset, sort): <NEW_LINE> <INDENT> url = "https://api.twitch.tv/kraken/channels/{}/videos".format(channel_id) <NEW_LINE> return kraken_get(url, { "broadcast_type": "archive", "limit": limit, "offset": offset, "sort": sort, }).json() | https://dev.twitch.tv/docs/v5/reference/channels#get-channel-videos | 625941ef23849d37ff7b35ee |
def __doGeneration__(self, generationSpec): <NEW_LINE> <INDENT> assert isinstance(generationSpec, SimpleClusterGenerationSpecification) <NEW_LINE> clusterPlacements = [] <NEW_LINE> clusterSpace = generationSpec.internalSpace <NEW_LINE> pstratSet = generationSpec.pstrats <NEW_LINE> for nc in clusterSpace.keys(): <NEW_LI... | @param generationSpec: Should be of type
SimpleClusterPlacementSpecification | 625941ef99cbb53fe6793148 |
def getRootTag(self): <NEW_LINE> <INDENT> return self._rootTag | Get root tag. | 625941ef7c178a314d6ef9cc |
def appendIntoBox(self,url): <NEW_LINE> <INDENT> self.urlList.append(url) <NEW_LINE> return True | 当box没有满载的时候就可以把url加入进来
:param url:
:return: 是否加入成功 | 625941ef2eb69b55b151ce1b |
def has_associated_data_roots(self): <NEW_LINE> <INDENT> return self._storage_roots.default_path is not None | Some configurations do not have a notion of a project storage and
therefore do not have any storages defined. This flag indicates whether
a configuration has any associated data storages.
:returns: True if the configuration has a data root defined, False
otherwise. | 625941ef1b99ca400220b017 |
def find_message(text): <NEW_LINE> <INDENT> mess = "" <NEW_LINE> for ch in text: <NEW_LINE> <INDENT> if ch != ch.lower(): <NEW_LINE> <INDENT> mess += ch <NEW_LINE> <DEDENT> <DEDENT> return mess | Ever tried to send a secret message to someone without using the postal service?
You could use newspapers to tell your secret.
Even if someone finds your message, it's easy to brush them off and that its paranoia and a bogus conspiracy theory.
One of the simplest ways to hide a secret message is to use capital letters.... | 625941efbd1bec0571d90b93 |
def progress(count, total, host): <NEW_LINE> <INDENT> bar_len = 60 <NEW_LINE> filled_len = int(round(bar_len * count / float(total))) <NEW_LINE> percent = round(100.0 * count / float(total), 0) <NEW_LINE> bar = '=' * filled_len + '-' * (bar_len - filled_len) <NEW_LINE> os.sys.stdout.write(f'\033[K [{bar}] {percent}% ->... | Simple status bar that will show progress.
Rewrite stdout with progress bar.
:param count: Counter of current host/line being processed in from the input file(sys.argv[1]).
:param total: Number of hosts/lines in from the input file(sys.argv[1]).
:param host: Current hostname being processed.
:return: None | 625941ef090684286d50f252 |
@app.route('/showlogin') <NEW_LINE> def showlogin(): <NEW_LINE> <INDENT> if 'google_token' in session: <NEW_LINE> <INDENT> return redirect(url_for('index')) <NEW_LINE> <DEDENT> return render_template('login.html') | Show login page if not already logged in | 625941ef046cf37aa974d2a6 |
def elapseTime(self, gameState): <NEW_LINE> <INDENT> for particle in self.particles: <NEW_LINE> <INDENT> newPosDist = self.getPositionDistribution(gameState, particle) <NEW_LINE> distribution = DiscreteDistribution() <NEW_LINE> for newpos in newPosDist.keys(): <NEW_LINE> <INDENT> distribution[newpos] = newPosDist[newpo... | Sample each particle's next state based on its current state and the
gameState. | 625941ef090684286d50f253 |
def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.register_services() <NEW_LINE> self.invoke_process() <NEW_LINE> self.poll() <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> self.deregister_services() | Run the service:
- register services & checks in Consul
- invoke a subprocess
- poll it (keep it alive in Consul)
- deregister services after subprocess is finished | 625941ef9c8ee82313fbbcdb |
def normalized(self): <NEW_LINE> <INDENT> return VecArray([u.normalized() for u in self._data]) | Retorna um vetor unitário | 625941ef10dbd63aa1bd3106 |
def __init__(self, command, **args): <NEW_LINE> <INDENT> self.command = command <NEW_LINE> if args.get('sequence') is None: <NEW_LINE> <INDENT> self.sequence_number = next_seq() <NEW_LINE> <DEDENT> self.status = SMPP_ESME_ROK <NEW_LINE> self._set_vars(**(args)) | Initialize | 625941ef7c178a314d6ef9cd |
def generate_df_register_courses_output(course_id, assessment_id, weight): <NEW_LINE> <INDENT> w = np.reshape(weight, (-1, len(assessment_id))) <NEW_LINE> c = np.reshape(course_id, (-1, 1)) <NEW_LINE> df = pd.DataFrame(data=np.hstack((c, w)), columns=["course_id"] + assessment_id) <NEW_LINE> df.course_id = df.course_id... | Create a dummy data frame as the expected format stored
in course attribute. Each argument should be a list. | 625941ef94891a1f4081c010 |
def validate_phone(self, value: Text, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> Dict[Text,Any]: <NEW_LINE> <INDENT> if len(value)>7: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> dispatcher.utter_template('utter_wrong_phone', tracker) <NEW_LINE> ret... | Validate cuisine value. | 625941ef1b99ca400220b018 |
def override_native_generic_func(func_name): <NEW_LINE> <INDENT> generic_func_node = get_native_generic_func(func_name) <NEW_LINE> def fdecorate(fdefault): <NEW_LINE> <INDENT> generic_func_node.set_default(fdefault, allow_override=True) <NEW_LINE> def register(key, func=None, override=True): <NEW_LINE> <INDENT> def _do... | Override a generic function defined in C++
Generic function allows registration of further functions
that can be dispatched on current target context.
If no registered dispatch is matched, the fdefault will be called.
Parameters
----------
func_name : string
The name of the generic func to be overridden
Returns
... | 625941ef4f88993c3716c5c5 |
def __init__(self): <NEW_LINE> <INDENT> self.jank = {} <NEW_LINE> self.counter = 0 | Initialize your data structure here. | 625941ef50485f2cf553d300 |
def _SetField(self, args, type_info, value): <NEW_LINE> <INDENT> if hasattr(type_info, "enum"): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> coerced_obj = type_info.enum[value.upper()] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> coerced_obj = type_info.type.FromSerializedString(value) <NEW_LINE> <DEDENT> <... | Sets fields on the arg rdfvalue object. | 625941efbaa26c4b54cb167e |
def rename(self, target, msg="renamed by py lib invocation"): <NEW_LINE> <INDENT> pass | rename this path to target with checkin message msg. | 625941ef21a7993f00bc825e |
def solve(images): <NEW_LINE> <INDENT> width = images[0].width <NEW_LINE> height = images[0].height <NEW_LINE> result = SimpleImage.blank(width, height) <NEW_LINE> for x in range(width): <NEW_LINE> <INDENT> for y in range(height): <NEW_LINE> <INDENT> pixels = [] <NEW_LINE> for image in images: <NEW_LINE> <INDENT> pixel... | Given a list of image objects, compute and display a Ghost solution image
based on these images. There will be at least 3 images and they will all
be the same size.
Input:
images (List[SimpleImage]): list of images to be processed | 625941ef7d43ff24873a3209 |
def received_from_keyboard(self, key_input): <NEW_LINE> <INDENT> self.log_queue.add_message("debug", Global.MSG_KEYBOARD_RECEIVED+" {"+ key_input+"}") <NEW_LINE> self.send_serial_message(key_input) | process keyboard input | 625941efde87d2750b8602fd |
def problem2a(window, circle): <NEW_LINE> <INDENT> circle.attach_to(window) <NEW_LINE> circle2 = rg.Circle(circle.center, circle.radius / 2) <NEW_LINE> circle2.fill_color = 'red' <NEW_LINE> circle2.attach_to(window) <NEW_LINE> circle3 = rg.Circle(rg.Point(circle2.center.x - (2 * circle2.radius), circle2.center.y), circ... | See problem2a_picture.pdf in this project for pictures that may
help you better understand the following specification:
1. Draws four rg.Circle's on the given rg.RoseWindow, as follows:
a. The first rg.Circle is the given rg.Circle.
b. The second rg.Circle is a new rg.Circle whose center
is the sa... | 625941ef23849d37ff7b35ef |
@opcode <NEW_LINE> def UQRSHRN2(cpu_context, instruction): <NEW_LINE> <INDENT> logger.debug("%s instruction not currently implemented.", instruction.mnem) | Unsigned saturating rounded shift right narrow immediate (vector and scalar form) | 625941efa934411ee3751bf9 |
def scale(self, x, y): <NEW_LINE> <INDENT> for item in self.childItems(): <NEW_LINE> <INDENT> if item.zValue() > 0: <NEW_LINE> <INDENT> item.scale(x, y) | Reimplementation to prevent the background pixmaps and page controls
from getting scaled. Scaling these Objects will result in an off
scale value which will distort the re-rendered pdf pages.
These must always be kept at a 1.0 scale.
Detection for these is a zValue check, as these have a value <= 0. | 625941ef15fb5d323cde107c |
def test_ref_coords_from_qry_coord_when_variant_not_in_nucmer_match(self): <NEW_LINE> <INDENT> aln = alignment.Alignment('1\t606\t596\t1201\t606\t606\t100.00\t606\t1700\t1\t1\tref\tqry') <NEW_LINE> snp0 = snp.Snp('127\tA\t.\t77\t75\t77\t1\t0\t606\t1700\t1\t1\tref\tqry') <NEW_LINE> indel = variant.Variant(snp0) <NEW_LIN... | Test ref_coords_from_qry_coord when variant not in nucmer match | 625941ef1f5feb6acb0c50ae |
def __str__(self): <NEW_LINE> <INDENT> return "{}FormsFunctor(n={}, k={}, ep={})".format(self._analytic_type.analytic_space_name(), self._group.n(), self._k, self._ep) | Return the string representation of ``self``.
EXAMPLES::
sage: F = FormsSpaceFunctor(["cusp", "quasi"], group=5, k=10/3, ep=-1)
sage: str(F)
'QuasiCuspFormsFunctor(n=5, k=10/3, ep=-1)'
sage: F
QuasiCuspFormsFunctor(n=5, k=10/3, ep=-1) | 625941ef32920d7e50b28739 |
def test_dumping_solver(capsys): <NEW_LINE> <INDENT> v1 = Variable('foo') <NEW_LINE> v2 = Variable('bar') <NEW_LINE> s = Solver() <NEW_LINE> s.addConstraint(v1 + v2 == 0) <NEW_LINE> s.addConstraint(v1 == 10) <NEW_LINE> s.addConstraint((v2 >= 0) | 'weak') <NEW_LINE> s.updateVariables() <NEW_LINE> s.dump() | Test dumping the solver internal to stdout.
| 625941ef656771135c3ebdda |
def decimal_to_percent(value, decimal_place=2): <NEW_LINE> <INDENT> format_str = '{:.' + str(2) + '%}' <NEW_LINE> return format_str.format(value) | Format a decimal to percentage with two decimal
:param value: the value to be formatted
:param decimal_place default decimal place, default to 2
:return: a string in percentage format, 20.50% etc | 625941efac7a0e7691ed4626 |
def account_get_balance_with_http_info(self, **kwargs): <NEW_LINE> <INDENT> all_params = [] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if key not in all_params: <... | Gets your account balance information
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>>> thread = api.account_get_balance_wit... | 625941efdd821e528d63b709 |
def create_plot(self, offset_left=30, offset_right=10, offset_top=30, offset_bottom=30, fg_color=Colors.WHITE): <NEW_LINE> <INDENT> self._plot["offset_x"] = offset_left <NEW_LINE> self._plot["offset_y"] = offset_top <NEW_LINE> self._plot["width"] = self.width - offset_right - offset_left <NEW_LINE> self._plot["height"]... | Define the plot area (the area that the graph actually exists; does not include the axes labels, titles, tick
labels). The defaults are customized for the PiTFT screen with a PageManger switcher bar
:param offset_left: How much the left side of the plot should be offset from the left side of the graph
:param offset_ri... | 625941ef5166f23b2e1a56bd |
def activate_wireless(self, conn_event=True): <NEW_LINE> <INDENT> logging.debug("Activating wireless.") <NEW_LINE> device_name = self.bt_device.output_device <NEW_LINE> first_run = True <NEW_LINE> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> target_device = self._lookup_sink_output_device(device_name) <NEW_... | Activate the wireless device. If it's a (dis)connect event,
also mute the speakers so we don't blast audio.
:param conn_event:
:return: | 625941ef377c676e9127270b |
def save(self) -> str: <NEW_LINE> <INDENT> logger.debug("Сохраняю базу данных") <NEW_LINE> with open(pjoin(path, f'{self.duty_id}.json'), "w", encoding="utf-8") as file: <NEW_LINE> <INDENT> file.write(json.dumps( DB_defaults.load_user(self), ensure_ascii=False, indent=4 )) <NEW_LINE> <DEDENT> return "ok" | Сохраняет БД пользователя в файл | 625941ef4527f215b584c9b6 |
def test_add_question_failed_bad_request(self): <NEW_LINE> <INDENT> response = self.client().post('/questions', json={}) <NEW_LINE> json_data = response.get_json() <NEW_LINE> self.assertEqual( response.status_code, StatusCode.HTTP_400_BAD_REQUEST.value ) <NEW_LINE> self.assertFalse(json_data.get('success')) | Fail case of add question test case with bad request error.
:return: | 625941ef76d4e153a657f096 |
def setTabShape(self, QTabWidget_TabShape): <NEW_LINE> <INDENT> pass | QTabWidget.setTabShape(QTabWidget.TabShape) | 625941ef76d4e153a657f097 |
def get_init_fn(sess): <NEW_LINE> <INDENT> ck_global_step = 0 <NEW_LINE> if FLAGS.restore_pretrain: <NEW_LINE> <INDENT> ckpt = tf.train.get_checkpoint_state(FLAGS.restore_path) <NEW_LINE> if ckpt and ckpt.model_checkpoint_path: <NEW_LINE> <INDENT> variables_to_restore = get_variables_to_restore() <NEW_LINE> restorer = ... | Returns a function run by the chief worker to warm-start the training.
Note that the init_fn is only run when initializing the model during the very
first global step.
Returns:
An init function run by the supervisor. | 625941ef4d74a7450ccd472a |
def Get(self, request, global_params=None): <NEW_LINE> <INDENT> config = self.GetMethodConfig('Get') <NEW_LINE> return self._RunMethod( config, request, global_params=global_params) | Get the specified group.
Args:
request: (ClouderrorreportingProjectsGroupsGetRequest) input message
global_params: (StandardQueryParameters, default: None) global arguments
Returns:
(ErrorGroup) The response message. | 625941ef66673b3332b925f5 |
def is_allowed_read(self, resource_type, resource_id, context_id): <NEW_LINE> <INDENT> return self._is_allowed(Permission('read', resource_type, resource_id, context_id)) | Whether or not the user is allowed to read a resource of the specified
type in the context. | 625941ef76e4537e8c351bdc |
def handle_actionNew_Theory(self): <NEW_LINE> <INDENT> self.actionNew_Theory.setDisabled(True) <NEW_LINE> if self.cbtheory.currentIndex() == 0: <NEW_LINE> <INDENT> th_name = self.cbtheory.itemText(1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> th_name = self.cbtheory.currentText() <NEW_LINE> <DEDENT> self.cbtheory.se... | Create new theory and do fit | 625941efa4f1c619b28b0590 |
def GOfilter(self,filter_file,results): <NEW_LINE> <INDENT> go_list=self.getFilter(filter_file) <NEW_LINE> if(go_list!=None): self.writefilterlist(go_list,results) | Filter mRNA based on GO-known gene
@param filter_file: GO file
@param results: Path to result repertory | 625941ef57b8e32f52483a03 |
def assert_organization_loaded(self, body, partner_has_marketing_site=True): <NEW_LINE> <INDENT> organization = Organization.objects.get(key=AbstractDataLoader.clean_string(body['short_name'])) <NEW_LINE> if not partner_has_marketing_site: <NEW_LINE> <INDENT> self.assertEqual(organization.name, AbstractDataLoader.clean... | Assert an Organization corresponding to the specified data body was properly loaded into the database. | 625941efe8904600ed9f249b |
def check_name_availability( self, name, custom_headers=None, raw=False, **operation_config): <NEW_LINE> <INDENT> registry_name_check_request = models.RegistryNameCheckRequest(name=name) <NEW_LINE> url = self.check_name_availability.metadata['url'] <NEW_LINE> path_format_arguments = { 'subscriptionId': self._serialize.... | Checks whether the container registry name is available for use. The
name must contain only alphanumeric characters, be globally unique, and
between 5 and 50 characters in length.
:param name: The name of the container registry.
:type name: str
:param dict custom_headers: headers that will be added to the request
:par... | 625941efab23a570cc2506ec |
def model(self) -> "pncursortablemodel.PNCursorTableModel": <NEW_LINE> <INDENT> return self._cursor.model() | Return cursor table model. | 625941ef2ae34c7f2600d695 |
def _set_comm_socket_behavior(self, thesocket): <NEW_LINE> <INDENT> adjusted_socket = thesocket <NEW_LINE> if self.comm_direction == DBDir.DB_TO_GND and self.db_port == DBPort.DB_PORT_TELEMETRY.value: <NEW_LINE> <INDENT> adjusted_socket.setblocking(False) <NEW_LINE> <DEDENT> elif self.comm_direction == DBDir.DB_TO_UAV ... | Set to blocking or non-blocking depending on Module (Telemetry, Communication) and if on drone or ground | 625941ef925a0f43d254a3e1 |
def p_base_data_type(p): <NEW_LINE> <INDENT> p[0] = p[1] | base_data_type : identifier | 625941ef566aa707497f4ac6 |
def send_with_attachment(self, incoming_message, message, attachments): <NEW_LINE> <INDENT> token = SkypeToken.objects.first().access_token <NEW_LINE> headers = {"Authorization": "Bearer {}".format(token)} <NEW_LINE> postback_url = self.get_message_url(incoming_message) <NEW_LINE> reply = self.create_attachment_message... | Send messages with attachments. accepts a list of attachments.
format of attachments.
"attachments": [
{
"contentType": "image/png",
"contentUrl": "http://aka.ms/Fo983c",
"name": "duck-on-a-rock.jpg"
} | 625941efa05bb46b383ecd81 |
def _GoToReferences( self, request_data ): <NEW_LINE> <INDENT> reference = self._GetResponse( '/findusages', self._DefaultParameters( request_data ) ) <NEW_LINE> quickfixes = reference[ 'QuickFixes' ] <NEW_LINE> if quickfixes: <NEW_LINE> <INDENT> if len( quickfixes ) == 1: <NEW_LINE> <INDENT> ref = quickfixes[ 0 ] <NEW... | Jump to references of identifier under cursor | 625941efd486a94d0b98e6ab |
def show_error_message(self, msg): <NEW_LINE> <INDENT> self._timer.stop() <NEW_LINE> self.setVisible(True) <NEW_LINE> self._message = msg <NEW_LINE> self._mode = self.MODE_ERROR <NEW_LINE> self.repaint() | Enables the overlay and displays an
a error message centered in the middle of the overlay.
:param msg: Message to display | 625941ef38b623060ff0b352 |
def testProductVariant(self): <NEW_LINE> <INDENT> pass | Test ProductVariant | 625941ef7b25080760e399ba |
@app.route('/', methods = ['GET']) <NEW_LINE> def main(): <NEW_LINE> <INDENT> return render_template('site.html') | Home page, renders the site's html page. | 625941efb7558d58953c546d |
def add_argument(self, *args, **kwargs): <NEW_LINE> <INDENT> chars = self.prefix_chars <NEW_LINE> if not args or len(args) == 1 and args[0][0] not in chars: <NEW_LINE> <INDENT> if args and 'dest' in kwargs: <NEW_LINE> <INDENT> raise ValueError('dest supplied twice for positional argument') <NEW_LINE> <DEDENT> kwargs = ... | add_argument(dest, ..., name=value, ...)
add_argument(option_string, option_string, ..., name=value, ...) | 625941efd164cc61757832b4 |
def _AttemptToGetLatestCandidate(): <NEW_LINE> <INDENT> self.RefreshManifestCheckout() <NEW_LINE> self.InitializeManifestVariables(self.GetCurrentVersionInfo()) <NEW_LINE> if self.latest_unprocessed: <NEW_LINE> <INDENT> return self.latest_unprocessed <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> logging.info('Found not... | Attempts to acquire latest candidate using manifest repo. | 625941efbe383301e01b59df |
def tostr(self): <NEW_LINE> <INDENT> if len(self.items) != 3: <NEW_LINE> <INDENT> raise InternalError( "Class BracketBase method tostr() has '{0}' items, " "but expecting 3.".format(len(self.items))) <NEW_LINE> <DEDENT> if not self.items[0]: <NEW_LINE> <INDENT> raise InternalError( "Class BracketBase method tostr(). 'I... | :raises InternalError: if the internal items list variable is not the expected size.
:raises InternalError: if the first element of the internal items list is None or is an empty string. | 625941ef5e10d32532c5f48a |
def update(self, data_source_id, update_data): <NEW_LINE> <INDENT> return self._update('/data-sources/%s' % data_source_id, update_data) | Update a Data Source.
:param dict update_data: dict that contains fields that should be
updated with new values.
Fields that can be updated:
* name
* description
* type
* url
* is_public
* is_protected
* credentials - dict with `user` and `password` keyword arguments | 625941ef0c0af96317bb874c |
def shp2grass7(path, name = None, snap = -1): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if not name: <NEW_LINE> <INDENT> name = os.path.splitext(os.path.basename(path))[0] <NEW_LINE> <DEDENT> g.run_command('v.in.ogr', flags = 'o', overwrite = True, input = path, output = name, snap = snap) <NEW_LINE> <DEDENT> except... | Load shapefile into temporary location | 625941ef30bbd722463cc32e |
def get_project(self, project_id): <NEW_LINE> <INDENT> project = self.gl.projects.get(project_id) <NEW_LINE> return project | 获取某项目
:param project_id:
:return: | 625941ef8c3a873295158926 |
def computeSimilarity(signature1, signature2, weights): <NEW_LINE> <INDENT> similarity = 0 <NEW_LINE> for i in range (1, len(signature1) - 1): <NEW_LINE> <INDENT> similarity += abs(signature1[i] - signature2[i]) * weights[i] <NEW_LINE> <DEDENT> return similarity | Returns the similarity between signature1 and signature2,
computed as the absolute value of the difference between the two
signatures, multiplied by the weights and summed. signature1,
signature2, and weights are all lists where the 0th value in
the list is ignored. | 625941ef3eb6a72ae02eca51 |
def WaitForJobCompletion(self, job_id, period=5, retries=-1): <NEW_LINE> <INDENT> while retries != 0: <NEW_LINE> <INDENT> job_result = self.GetJobStatus(job_id) <NEW_LINE> if job_result and job_result["status"] == JOB_STATUS_SUCCESS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif not job_result or job_result[... | Polls cluster for job status until completion.
Completion is defined as any of the following states listed in
L{JOB_STATUS_FINALIZED}.
@type job_id: string
@param job_id: job id to watch
@type period: int
@param period: how often to poll for status (optional, default 5s)
@type retries: int
@param retries: how many ti... | 625941effbf16365ca6f6735 |
def get_oldest_backup(self): <NEW_LINE> <INDENT> years = self._get_backup_year_list() <NEW_LINE> if not years: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> backup_names = self._get_backup_names_for_year(years[0]) <NEW_LINE> backup_name = backup_names[0] <NEW_LINE> backup = self._dbfileopener.open_backup(self, ba... | Obtain the data for the oldest backup according to the starting
time. | 625941efb545ff76a891437b |
def addByteQuantityNode(xmlDom, parentNode, nodeName, byteQuantity): <NEW_LINE> <INDENT> if byteQuantity is None: <NEW_LINE> <INDENT> byteString = None <NEW_LINE> <DEDENT> elif byteQuantity.units == UNIT_KBYTES: <NEW_LINE> <INDENT> byteString = "%s KB" % byteQuantity.quantity <NEW_LINE> <DEDENT> elif byteQuantity.units... | Adds a text node as the next child of a parent, to contain a byte size.
If the ``byteQuantity`` is None, then the node will be created, but will
be empty (i.e. will contain no text node child).
The size in bytes will be normalized. If it is larger than 1.0 GB, it will
be shown in GB ("1.0 GB"). If it is larger than... | 625941ef0c0af96317bb874d |
def delete_jobs(self): <NEW_LINE> <INDENT> jobs = self.get_jobs(self.age) <NEW_LINE> print('Jobs queued for delete: ', jobs) <NEW_LINE> for job in jobs: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> body = k_client.V1DeleteOptions(propagation_policy='Background') <NEW_LINE> self.kube_v1_batch_client.delete_namespaced_jo... | Deletes jobs in the namespace older than age specified
jobs : <List> list of jobs to be deleted | 625941eff548e778e58cdae5 |
def beta_cdf(x, a, b): <NEW_LINE> <INDENT> return reg_incomplete_beta(a, b, x) | Beta distribution cummulative probability density function. | 625941ef596a89723608a01e |
def _convertoptionstypes(self, options): <NEW_LINE> <INDENT> converted = [] <NEW_LINE> for opt, params in options: <NEW_LINE> <INDENT> for i, callback in enumerate(self._command.params(opt)): <NEW_LINE> <INDENT> if type(callback) == str and ':' in callback: <NEW_LINE> <INDENT> callback = callback.rsplit(':', 1)[1] <NEW... | Convert options' parameters to their desired types.
| 625941ef796e427e537b0b30 |
def search_rules(right): <NEW_LINE> <INDENT> for left in grammar.rules: <NEW_LINE> <INDENT> for rule in grammar.rules[left]: <NEW_LINE> <INDENT> if rule == (word or non_terminal): <NEW_LINE> <INDENT> matches.append(left) | Compares rules with given word or non_terminal | 625941ef8e05c05ec3eea8de |
def test_04(self): <NEW_LINE> <INDENT> sleep(2) <NEW_LINE> self.driver(label="2Call").click() <NEW_LINE> self.driver(label=u"Look up numbers").click() <NEW_LINE> phonenumber = '5202141993' <NEW_LINE> for i in phonenumber: <NEW_LINE> <INDENT> self.driver(label=i, name=i, className="Button").click() <NEW_LINE> <DEDENT> s... | 号码查询 | 625941ef23e79379d52eeac2 |
def sliceFixer(num_slices,array_maps): <NEW_LINE> <INDENT> length_maps = len(array_maps[0]) <NEW_LINE> slicedUpMaps = [] <NEW_LINE> if not (length_maps%num_slices == 0 ): <NEW_LINE> <INDENT> raise TypeError('length_maps%num_slices != 0, cannot slice maps') <NEW_LINE> <DEDENT> lowerBound = 0 <NEW_LINE> upperBound = int(... | Slices up the map into different regions
Params:
-------
num_slices: Int, number of slices of the map that are requested
array_maps: An array of maps, contatins all the maps that we wish to make
a linear combination of
Returns:
--------
slicedUpMaps: an array containing each map in array_maps, in sliced up ... | 625941ef56b00c62f0f14bc2 |
def error(self, txt): <NEW_LINE> <INDENT> self.logger.error('\n%s\n' % txt) <NEW_LINE> return False | Error, reject and display the error message | 625941ef07f4c71912b119ea |
def circle(self, xpos=0, ypos=0, size=1.0, flat=1.0, rot=0.0): <NEW_LINE> <INDENT> ang_deg = range(361) <NEW_LINE> ang_rad = [math.radians(ang) for ang in ang_deg] <NEW_LINE> x = [flat*math.sin(ang) for ang in ang_rad] <NEW_LINE> y = [math.cos(ang) for ang in ang_rad] <NEW_LINE> xx = [x[n]*math.cos(rot)-y[n]*math.sin(r... | Create coordinates of rotated oval | 625941ef460517430c3946db |
def agent_init(): <NEW_LINE> <INDENT> global Q,model, prev_obs_states,prev_obs_actions_in_states,pi <NEW_LINE> prev_obs_states=set() <NEW_LINE> prev_obs_actions_in_states=dict() <NEW_LINE> Q=list() <NEW_LINE> for i in range(9): <NEW_LINE> <INDENT> Q.append([{(1,0):0,(-1,0):0,(0,1):0,(0,-1):0}, {(1,0):0,(-1,0):0,(0,1):0... | Hint: Initializes Q, where we store the Q(s,a). Q is a 2d array such that Q[x][y][a] where x and y are
intergers and represent a particular location and a is an action and Q[x][y][a] is the state-action value for
that particular action taken in that particular state
Returns: nothing | 625941ef5fc7496912cc3ee3 |
def show(s): <NEW_LINE> <INDENT> print('input:', s) <NEW_LINE> print('len:', len(s)) <NEW_LINE> print('type:', type(s)) | show | 625941ef15baa723493c44df |
def getConfig(self,config="../_config"): <NEW_LINE> <INDENT> with open(config,'r') as config: <NEW_LINE> <INDENT> self.config = config.read() <NEW_LINE> try: <NEW_LINE> <INDENT> self.ip=self.config.split()[3].split('.') <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass | Gets info from _cofnig File | 625941efd99f1b3c44c67aea |
def move_up_action(self): <NEW_LINE> <INDENT> if self.table_view.selectionModel().hasSelection(): <NEW_LINE> <INDENT> icur = self.table_view.selectionModel().currentIndex() <NEW_LINE> irow = icur.row() <NEW_LINE> icol = icur.column() <NEW_LINE> if irow == 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> select_items =... | Swap rows in order to move selected item up one step | 625941ef004d5f362079a894 |
def _get_account_address(self, bank_account): <NEW_LINE> <INDENT> if bank_account.owner_name: <NEW_LINE> <INDENT> line1_owner = bank_account.owner_name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise exceptions.ValidationError( _('Missing owner name for bank account %s') % bank_account.acc_number) <NEW_LINE> <DEDEN... | Return account address for given bank_account.
First line is mandatory ! | 625941efcc40096d61595eb3 |
def lengthOfLastWord(self, s): <NEW_LINE> <INDENT> n = len(s) <NEW_LINE> while n > 0 and s[n - 1] == ' ': <NEW_LINE> <INDENT> n -= 1 <NEW_LINE> <DEDENT> i = n <NEW_LINE> while i > 0 and s[i - 1] != ' ': <NEW_LINE> <INDENT> i -= 1 <NEW_LINE> <DEDENT> return n - i | :type s: str
:rtype: int | 625941efd486a94d0b98e6ac |
def graph_conv_spline(self, x, L, K, F_out): <NEW_LINE> <INDENT> B, V, F_in = x.get_shape() <NEW_LINE> B, V, F_in = int(B), int(V), int(F_in) <NEW_LINE> lamb, U = graph.fourier(L) <NEW_LINE> U = tf.constant(U.T, dtype=tf.float32) <NEW_LINE> basis = self.bspline_basis(K, lamb, degree=3) <NEW_LINE> basis = tf.constant(ba... | Graph convolution operation. | 625941efaad79263cf390faf |
def __str__(self): <NEW_LINE> <INDENT> return '\n'.join([decoy.__str__() for decoy in self.decoys]) | toString method | 625941ef6aa9bd52df03730d |
def execute(self, node_context): <NEW_LINE> <INDENT> params = node_context.parameters <NEW_LINE> importer_type = params['active_importer'].value <NEW_LINE> parameter_root = params <NEW_LINE> input_list = node_context.input['port1'] <NEW_LINE> output_list = node_context.output['port1'] <NEW_LINE> objects = input_list <N... | Import file(s) into platform as Table(s). | 625941ef31939e2706e4d3c7 |
def _handle_any_slot__new__(self, node, function, args, is_unbound_method, kwargs=None): <NEW_LINE> <INDENT> obj = function.obj <NEW_LINE> if not is_unbound_method or len(args) < 1: <NEW_LINE> <INDENT> return node <NEW_LINE> <DEDENT> type_arg = args[0] <NEW_LINE> if not obj.is_name or not type_arg.is_name: <NEW_LINE> <... | Replace 'exttype.__new__(exttype, ...)' by a call to exttype->tp_new()
| 625941efd7e4931a7ee9e485 |
def post(self, url, body): <NEW_LINE> <INDENT> return self.request(url, 'POST', body=body) | Sends post request to Blazar.
:param url: URL to the wanted Blazar resource.
:type url: str
:param body: Values resource to be created from.
:type body: dict | 625941ef3539df3088e2e8b1 |
def checkout_metadir(self): <NEW_LINE> <INDENT> return self.cloning_metadir() | Produce a metadir suitable for checkouts of this controldir.
:returns: A ControlDirFormat with all component formats
either set appropriately or set to None if that component
should not be created. | 625941ef23849d37ff7b35f0 |
def Title(self): <NEW_LINE> <INDENT> return safe_unicode(self.getBatchID()).encode('utf-8') | Return the BatchID or id as title | 625941ef2c8b7c6e89b35d22 |
def extra_super_categories(self): <NEW_LINE> <INDENT> return [AdditiveSemigroups()] | Implement the fact that a Cartesian product of additive semigroups
is an additive semigroup.
EXAMPLES::
sage: from sage.categories.additive_semigroups import AdditiveSemigroups
sage: C = AdditiveSemigroups().CartesianProducts()
sage: C.extra_super_categories()
[Category of additive semigroups]
sag... | 625941efb5575c28eb68e56b |
def create_joint_sparse_adjaceny(self): <NEW_LINE> <INDENT> n_nodes = self.num_users + self.num_items <NEW_LINE> row_idx = [self.data.user[pair[0]] for pair in self.data.trainingData] <NEW_LINE> col_idx = [self.data.item[pair[1]] for pair in self.data.trainingData] <NEW_LINE> user_np = np.array(row_idx) <NEW_LINE> item... | return a sparse adjacency matrix with the shape (user number + item number, user number + item number) | 625941ef046cf37aa974d2a7 |
def computeQValueFromValues(self, state, action): <NEW_LINE> <INDENT> q = 0 <NEW_LINE> possible_states = self.mdp.getTransitionStatesAndProbs(state, action) <NEW_LINE> for posState in possible_states: <NEW_LINE> <INDENT> T = posState[1] <NEW_LINE> nextState = posState[0] <NEW_LINE> reward = self.mdp.getReward(state, ac... | Compute the Q-value of action in state from the
value function stored in self.values. | 625941efe64d504609d74da5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.