code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def is_winner(self, board, marker): <NEW_LINE> <INDENT> for combo in self.winning_combos: <NEW_LINE> <INDENT> if (board[combo[0]] == board[combo[1]] == board[combo[2]] == marker): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
check if this marker will win the game
625941f0d53ae8145f87a807
def main(): <NEW_LINE> <INDENT> log = clog.get_log() <NEW_LINE> missing_dependencies = [] <NEW_LINE> try: <NEW_LINE> <INDENT> import yaml <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> missing_dependencies.append("PyYAML") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> import filelock <NEW_LINE> <DEDENT> exc...
Install Clownfish
625941f08e7ae83300e4b571
def __len__(self, ): <NEW_LINE> <INDENT> return len(self.coffes)
Defining the length of the polynomial.
625941f0596a89723608a05b
def test_constructor(self): <NEW_LINE> <INDENT> item = menuItem(3, "Veggie Supreme", 12.95) <NEW_LINE> self.assertEquals(item.itemNum,3) <NEW_LINE> self.assertEquals(item.itemDescription, "Veggie Supreme") <NEW_LINE> self.assertEquals(item.itemPrice, 12.95)
Tests if menu item correctly initializes each of the three parameters
625941f016aa5153ce362a1b
def test_x_value_error(self): <NEW_LINE> <INDENT> with self.assertRaisesRegex(ValueError, "x must be >= 0"): <NEW_LINE> <INDENT> r = Rectangle(1, 1, -1)
Send negative number to x
625941f0f8510a7c17cf9ca3
@builds.command('build') <NEW_LINE> @click.argument('project_name', default=active_configuration.get('default_project', 'default')) <NEW_LINE> @click.option('target', '--target', default='debug', help='Select target to build (debug/release)') <NEW_LINE> @click.option('verbose', '--verbose', flag_value=True, help='Verbo...
This builds the selected project with the current settings in BUILDSFILENAME file. Selected project defaults to the currently active project set in the BUILDSFILENAME file.
625941f057b8e32f52483a41
def adjust_widget_padding(self, *args) -> None: <NEW_LINE> <INDENT> self.bg_rectangle.size = (self.bg_rectangle.size[0] - self.bg_padding[0], self.bg_rectangle.size[1]) <NEW_LINE> self.bg_rectangle.pos = (self.bg_rectangle.pos[0] + self.bg_padding[0], self.bg_rectangle.pos[1]) <NEW_LINE> """The following code statemen...
If the value at index of 2 in bg_padding ListProperty is changed the top padding is adjust according to its root widget.
625941f0d10714528d60028d
def Get_draw_pile(self): <NEW_LINE> <INDENT> self.draw_pile = get_a_deck() * self.deck_size <NEW_LINE> self.draw_count = len(self.draw_pile) <NEW_LINE> self.discard_pile = []
Generates the draw_pile for us to play with
625941f08c3a873295158964
def create(self, request, *args, **kwargs): <NEW_LINE> <INDENT> print(request.data["school"]) <NEW_LINE> school=School.objects.get(pk=request.data["school"]) <NEW_LINE> if Student.objects.filter(school=school).count()>=school.max_students: <NEW_LINE> <INDENT> return Response(status=403) <NEW_LINE> <DEDENT> else: <NEW_L...
verify that the POST has the request user as the obj.author
625941f05e10d32532c5f4c7
def test_PATCH_project_detail_with_valid_permissions(self): <NEW_LINE> <INDENT> kwargs = self._setup_user_credentials() <NEW_LINE> user, client = self._create_user(**kwargs) <NEW_LINE> method = 'patch' <NEW_LINE> data = {} <NEW_LINE> su = data.setdefault('SU', {}) <NEW_LINE> su['name'] = 'Test Project 01' <NEW_LINE> ad...
Test that a PATCH to project-detail passes with valid permissions.
625941f0b830903b967e9ea7
def show_possible_matches(my_word): <NEW_LINE> <INDENT> for w in wordlist: <NEW_LINE> <INDENT> if match_with_gaps(my_word, w): <NEW_LINE> <INDENT> print(w, end=' ') <NEW_LINE> <DEDENT> <DEDENT> print("\n")
my_word: string with _ characters, current guess of secret word returns: nothing, but should print out every word in wordlist that matches my_word Keep in mind that in hangman when a letter is guessed, all the positions at which that letter occurs in the secret word are revealed. Therefore, t...
625941f0627d3e7fe0d693f4
def cartesian(self) -> Tuple[np.number, np.number, np.number, np.number]: <NEW_LINE> <INDENT> if self.dimension > 3: <NEW_LINE> <INDENT> raise ValueError("The plane dimension must be <= 3.") <NEW_LINE> <DEDENT> a, b, c = self.normal.set_dimension(3) <NEW_LINE> d = -self.normal.dot(self.point) <NEW_LINE> return a, b, c,...
Return the coefficients of the Cartesian equation of the plane. The equation has the form ax + by + cz + d = 0. Returns ------- tuple Coefficients a, b, c, d. Raises ------ ValueError If the plane dimension is higher than 3. Examples -------- >>> from skspatial.objects import Plane >>> Plane(point=[1, 1], ...
625941f08c3a873295158965
def test_VegasFlow(): <NEW_LINE> <INDENT> for mode in range(4): <NEW_LINE> <INDENT> vegas_instance = instance_and_compile(VegasFlow, mode) <NEW_LINE> _ = vegas_instance.run_integration(n_iter) <NEW_LINE> vegas_instance.freeze_grid() <NEW_LINE> result = vegas_instance.run_integration(n_iter) <NEW_LINE> check_is_one(resu...
Test VegasFlow class, importance sampling algorithm
625941f0d4950a0f3b08c8e9
def get_objective_types(self): <NEW_LINE> <INDENT> return self.objectives.keys()
Get objective's type and objective's key. :return:
625941f00383005118ecfb83
def is_palindrome(value): <NEW_LINE> <INDENT> return value == value[::-1]
Check if a string is a palindrome.
625941f01f037a2d8b94679f
def __init__(self, hass, config_entry): <NEW_LINE> <INDENT> self.hass = hass <NEW_LINE> self.config_entry = config_entry <NEW_LINE> self.name = config_entry.data[CONF_NAME] <NEW_LINE> self.host = config_entry.data[CONF_HOST] <NEW_LINE> self.data = { "routerboard": {}, "resource": {}, "health": {}, "interface": {}, "bri...
Initialize MikrotikController.
625941f0d486a94d0b98e6e9
def __init__(self, bucket=None, project=None, credentials=None, http=None): <NEW_LINE> <INDENT> bucket = bucket or settings['bucket'] <NEW_LINE> project = project or settings['project'] <NEW_LINE> credentials = credentials or settings['credentials'] <NEW_LINE> http = http or settings['http'] <NEW_LINE> if callable(http...
:type bucket_name: string :param bucket_name: name of the bucket :type project: string :param project: the project which the client acts on. :type credentials: OAuth2 credentials :param credentials: (optional) Client init will fail if not passed and no `http` object provided :...
625941f066656f66f7cbc750
def get_obs_pred_sad(raw_data_site, dataset_name, model, out_dir = './out_files/'): <NEW_LINE> <INDENT> G, S, N, E = get_GSNE(raw_data_site) <NEW_LINE> if model == 'ssnt': <NEW_LINE> <INDENT> pred = mete.get_mete_rad(S, N, version = 'untruncated')[0] <NEW_LINE> <DEDENT> elif model == 'asne': <NEW_LINE> <INDENT> pred = ...
Write the observed and predicted RAD to file for a given model. Inputs: raw_data_site - data in the same format as obtained by clean_data_genera(), with four columns site, sp, dbh, and genus, and only for one site. dataset_name - name of the dataset for raw_data_site. model - can take one of three values 'ssnt', ...
625941f0baa26c4b54cb16bc
def __init__(self, n, neighbors, color=None): <NEW_LINE> <INDENT> self.id = n <NEW_LINE> if neighbors is None: <NEW_LINE> <INDENT> self.neighbors = [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.neighbors = list(neighbors) <NEW_LINE> <DEDENT> self.color = color
Node initializer. :param n: int :param neighbors: [int] :param color: int|None
625941f063b5f9789fde7689
def green_led_on(self): <NEW_LINE> <INDENT> cmd = ['green_led_on'] <NEW_LINE> return self.send_cmd(cmd)
Set green led on
625941f03539df3088e2e8ee
def generate_code(type_checked_parse_tree, output_file): <NEW_LINE> <INDENT> compute_offsets(type_checked_parse_tree) <NEW_LINE> string_table = {} <NEW_LINE> declaration = type_checked_parse_tree <NEW_LINE> while declaration is not None: <NEW_LINE> <INDENT> if declaration.kind == NodeType.FUN_DEC: <NEW_LINE> <INDENT> s...
Top-level code generation function.
625941f0167d2b6e31219137
def format_to_text_plain_categories(self, var): <NEW_LINE> <INDENT> resp = "" <NEW_LINE> if var.has_key('kinds'): <NEW_LINE> <INDENT> items = var['kinds'] <NEW_LINE> for item in items: <NEW_LINE> <INDENT> resp += "Category :" + cnv_JSON_category(item, "kind") + "\n" <NEW_LINE> <DEDENT> <DEDENT> if var.has_key('mixins')...
Format JSON categories into HTTP text/plain categories Args: @param var: JSON categories
625941f0a219f33f34628f04
def hash(self, rtdc_ds): <NEW_LINE> <INDENT> super_hash = super(MachineLearningFeature, self).hash(rtdc_ds) <NEW_LINE> hasher = hashlib.md5() <NEW_LINE> hasher.update(obj2bytes(super_hash)) <NEW_LINE> hasher.update(obj2bytes(self.data.info)) <NEW_LINE> return hasher.hexdigest()
Used for identifying an ancillary ML computation The required features, the used configuration keys/values, and the return value of the requirement function are hashed. In addition, the ML model's info dictionary is hashed.
625941f0d8ef3951e3243ae0
def identical_graph_weight_difference(gra1,gra2,ignore_zero_edges=False): <NEW_LINE> <INDENT> if not has_identical_topology(gra1,gra2): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> gra1tw = float( gra1.total_weight() ) <NEW_LINE> gra2tw = float( gra2.total_weight() ) <NEW_LINE> diffs = [] <NEW_LINE> seen_edges ...
Relative weight difference of topologically identical graphs. @type gra1: graph @param gra1: Graph. @type gra2: graph @param gra2: Graph. @rtype: Positive float or False @return: Positive float or False if graphs are not topologically identical @attention: Function is only meaningfull for...
625941f02eb69b55b151ce5b
def process_publication_document(patent_app_document, patent_config): <NEW_LINE> <INDENT> document_number = patent_app_document.findall(patent_config['foreign_key_config']['xml_path'])[0].text <NEW_LINE> table_xml_map = patent_config['table_xml_map'] <NEW_LINE> for table in table_xml_map: <NEW_LINE> <INDENT> table_rows...
Extract various entities from single published document :param patent_app_document: XML element representing a single published application document :param patent_config: dictionary containing parsing configuration :returns tuple containing the table_name and its data
625941f05166f23b2e1a56fc
def update(self, other): <NEW_LINE> <INDENT> if isinstance(other, abc.MutableMapping): <NEW_LINE> <INDENT> for key, value in other.items(): <NEW_LINE> <INDENT> self.c.hincrby(self.key, key, value) <NEW_LINE> <DEDENT> <DEDENT> elif isinstance(other, Iterable): <NEW_LINE> <INDENT> for i in other: <NEW_LINE> <INDENT> self...
adds the values instead of replcing them from other other is also key value pair supporting .items() protocol
625941f0d7e4931a7ee9e4c3
def get_server_configuration(self): <NEW_LINE> <INDENT> request = server_pb2.GetServerConfigurationRequest() <NEW_LINE> return self.stub.GetServerConfiguration(request)
Get the server configuration. Returns: proto: the returned proto message.
625941f091f36d47f21aca9c
def _handle_delete(self, request): <NEW_LINE> <INDENT> response = dns.message.make_response(request) <NEW_LINE> question = request.question[0] <NEW_LINE> requester = request.environ['addr'][0] <NEW_LINE> zone_name = question.name.to_text() <NEW_LINE> if isinstance(zone_name, bytes): <NEW_LINE> <INDENT> zone_name = zone...
Constructs the response to a DELETE and acts accordingly on it. * Decodes the message for zone name * Checks if the master sending the DELETE is in the allowed notify list * Checks if the zone exists (maybe?) * Kicks a call to the backend to delete the zone in question
625941f030dc7b7665901f03
def fput(tallylist,ofile): <NEW_LINE> <INDENT> print("Not implemented. You are welcome to do it yourself!") <NEW_LINE> for tally in tallylist: <NEW_LINE> <INDENT> for e in tally.eints: <NEW_LINE> <INDENT> for i in tally.iints: <NEW_LINE> <INDENT> for j in tally.jints: <NEW_LINE> <INDENT> for k in tally.kints: <NEW_LINE...
Write a meshtal file ofile with the data of tallylist. ProbID and nps MUST match
625941f0462c4b4f79d1dc72
def __iter__(self): <NEW_LINE> <INDENT> self._iter_next_list = self.resource_uris() <NEW_LINE> self._iter_next_list.reverse() <NEW_LINE> return(iter(self._iter_next, None))
Iterator over all the resources in this inventory
625941f0167d2b6e31219138
def get_sql(self, data, etid=None): <NEW_LINE> <INDENT> required_args = [ 'name' ] <NEW_LINE> if etid is not None: <NEW_LINE> <INDENT> sql = render_template("/".join([self.template_path, 'properties.sql']), etid=etid) <NEW_LINE> status, res = self.conn.execute_dict(sql) <NEW_LINE> if not status: <NEW_LINE> <INDENT> ret...
This function will generate sql from model data. Args: data: Contains the data of the selected event trigger node. etid: Event trigger ID Returns:
625941f03c8af77a43ae3d4a
def get_gene_evaluated_conditions(self): <NEW_LINE> <INDENT> return self.gene_evaluated_conditions
Returns: list of EvaluatedCondition gene_evaluated_conditions
625941f07b25080760e399f8
def get_last_day_of_month(year, month): <NEW_LINE> <INDENT> if (month == 12): <NEW_LINE> <INDENT> year += 1 <NEW_LINE> month = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> month += 1 <NEW_LINE> <DEDENT> return date(year, month, 1) - timedelta(1)
>>>
625941f0e8904600ed9f24da
def load(self, track): <NEW_LINE> <INDENT> spotify.Error.maybe_raise(lib.sp_session_player_load( self._session._sp_session, track._sp_track))
Load :class:`Track` for playback.
625941f03cc13d1c6d3c791a
def bisiesto(year): <NEW_LINE> <INDENT> if(esInt(year)): <NEW_LINE> <INDENT> return (((year % 4) == 0) or ((year % 100) != 0 and (year % 400) == 0)) <NEW_LINE> <DEDENT> print("Error: Año debe ser un int.") <NEW_LINE> return False
Entrada: Int Salida: Boolean Funcionamiento: Retorna True si el año insertado es un año bisiesto
625941f15fcc89381b1e1c67
def destroy_blueprint(self, blueprint): <NEW_LINE> <INDENT> self.facility.power_on() <NEW_LINE> infrastructure = PlumberyInfrastructure(self.facility) <NEW_LINE> container = infrastructure.get_container(blueprint) <NEW_LINE> if ('nodes' not in blueprint or not isinstance(blueprint['nodes'], list)): <NEW_LINE> <INDENT> ...
Destroys nodes of a given blueprint :param blueprint: the blueprint to build :type blueprint: ``dict``
625941f0009cb60464c63950
def __init__(self, capacity): <NEW_LINE> <INDENT> self.capacity = capacity <NEW_LINE> self.items = OrderedDict()
:type capacity: int
625941f18e7ae83300e4b572
def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, DatasetFiltersExtended): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__
Returns true if both objects are equal
625941f115fb5d323cde10bc
def find_package_data( where=".", package="", exclude=standard_exclude, exclude_directories=standard_exclude_directories, only_in_packages=True, show_ignored=False): <NEW_LINE> <INDENT> out = {} <NEW_LINE> stack = [(convert_path(where), "", package, only_in_packages)] <NEW_LINE> while stack: <NEW_LINE> <INDENT> where, ...
Return a dictionary suitable for use in ``package_data`` in a distutils ``setup.py`` file. The dictionary looks like:: {"package": [files]} Where ``files`` is a list of all the files in that package that don"t match anything in ``exclude``. If ``only_in_packages`` is true, then top-level directories that are no...
625941f194891a1f4081c04f
def parse_and_normalize_day(date): <NEW_LINE> <INDENT> splits = date.split('-') <NEW_LINE> _, _, day, *rest = splits <NEW_LINE> return int(day) / MONTH_TOTAL_DAYS
Parse day of month from date and normalize to real value in [0, 1]
625941f17b25080760e399f9
def _back_propagate(self, input, tag, learning_rate): <NEW_LINE> <INDENT> if self._is_properly_init: <NEW_LINE> <INDENT> if self._input_shape == len(input): <NEW_LINE> <INDENT> prob_results, pred_index, inter_results = self.predict(input, is_return_inter_values=True) <NEW_LINE> one_hot_tag = np.zeros(self._output_shape...
store the propagation result accumulatively into a temporary updating parameters structure :param input: the input image :param tag: the tag should be the correct class index :return loss
625941f06e29344779a62bb4
@pytest.mark.parametrize('number_of_eth_accounts', [0]) <NEW_LINE> def test_data_import_nexo(rotkehlchen_api_server): <NEW_LINE> <INDENT> rotki = rotkehlchen_api_server.rest_api.rotkehlchen <NEW_LINE> dir_path = Path(__file__).resolve().parent.parent <NEW_LINE> filepath = dir_path / 'data' / 'nexo.csv' <NEW_LINE> json_...
Test that the data import endpoint works successfully for nexo
625941f1b545ff76a89143b9
def save(model, filename, sources=None, format=None, **kw): <NEW_LINE> <INDENT> if sources is None: <NEW_LINE> <INDENT> sources = model.sources <NEW_LINE> <DEDENT> dprintf(2, "writing %d model sources to BBS file %s\n", len(sources), filename) <NEW_LINE> format = format or getattr(model, 'BBS_Format', "Name, Type, Patc...
Exports model to a BBS catalog file
625941f13617ad0b5ed6849a
def _on_tree_delete_item(self, event): <NEW_LINE> <INDENT> wxid = event.GetItem() <NEW_LINE> data = self.control.GetPyData(wxid) <NEW_LINE> if data is not None: <NEW_LINE> <INDENT> populated, node = data <NEW_LINE> self._remove_node(wxid, node) <NEW_LINE> <DEDENT> return
Called when a tree item is being been deleted.
625941f124f1403a92601104
def test_fields(self): <NEW_LINE> <INDENT> fields = self.form.base_fields.keys() <NEW_LINE> expected = ('email', 'password1', 'password2') <NEW_LINE> self.assertCountEqual(fields, expected)
Assert `fields`.
625941f1a79ad161976cc6e9
def SetIamPolicy(self, request, global_params=None): <NEW_LINE> <INDENT> config = self.GetMethodConfig('SetIamPolicy') <NEW_LINE> return self._RunMethod( config, request, global_params=global_params)
Sets the access control policy for an Identity-Aware Proxy protected. resource. Replaces any existing policy. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api Args: request: (IapProjectsIapTunnelSetIamPolicyReque...
625941f16aa9bd52df03734b
def isEscapePossible(self, blocked, source, target): <NEW_LINE> <INDENT> visit = {} <NEW_LINE> q = [] <NEW_LINE> q.append(source) <NEW_LINE> bl = {} <NEW_LINE> for l in blocked: <NEW_LINE> <INDENT> bl[str(l)] = True <NEW_LINE> <DEDENT> directions = [[0,-1], [0,1], [-1,0], [1,0]] <NEW_LINE> dist = 0 <NEW_LINE> while(len...
:type blocked: List[List[int]] :type source: List[int] :type target: List[int] :rtype: bool
625941f1004d5f362079a8d2
def __makeFullParentChildDictionaries(self): <NEW_LINE> <INDENT> fullParentD = {} <NEW_LINE> fullChildD = {} <NEW_LINE> pAtN = self.__enumD["ITEM_LINKED_PARENT"][1] <NEW_LINE> cAtN = self.__enumD["ITEM_LINKED_CHILD"][1] <NEW_LINE> for dObj in self.__containerList: <NEW_LINE> <INDENT> dc = dObj.getObj(self.__enumD["ITEM...
Create a dictionaries of full parent/child relations accross all definnitions as fullParentD[child]=[parent,parent,...] and fullChildD[parent]=[child,child,...] Exclude self parents.
625941f16fece00bbac2dce9
def mount(self): <NEW_LINE> <INDENT> if self._mounter: <NEW_LINE> <INDENT> raise exception.PatronException(_('image already mounted')) <NEW_LINE> <DEDENT> if not self.mount_dir: <NEW_LINE> <INDENT> self.mount_dir = tempfile.mkdtemp(prefix=self.tmp_prefix) <NEW_LINE> self._mkdir = True <NEW_LINE> <DEDENT> imgfmt = "raw"...
Mount a disk image, using the object attributes. The first supported means provided by the mount classes is used. True, or False is returned and the 'errors' attribute contains any diagnostics.
625941f10383005118ecfb84
def getRemote(self): <NEW_LINE> <INDENT> return self.remote
Returns remote's URL
625941f16fb2d068a760f64a
def _random_lattice(n, p): <NEW_LINE> <INDENT> from sage.functions.other import floor <NEW_LINE> from sage.misc.functional import sqrt <NEW_LINE> from sage.misc.prandom import random <NEW_LINE> n = n-1 <NEW_LINE> meets = [[None]*n for _ in range(n)] <NEW_LINE> meets[0][0] = 0 <NEW_LINE> maxs = set([0]) <NEW_LINE> lc_al...
Return a random lattice. INPUT: - ``n`` -- number of elements, a non-negative integer - ``p`` -- a number at least zero and less than one; higher number means more covering relations OUTPUT: A list of lists. Interpreted as a list of lower covers for a poset, it is a lattice with ``0..n-1`` as a linear extension. ...
625941f191af0d3eaac9bfc2
def describe_norsum_header(norsum_file,t0,verbose=False,maxE=10000): <NEW_LINE> <INDENT> if maxE == 10000: <NEW_LINE> <INDENT> print("----\nDefault value of 10 keV for max energy of ") <NEW_LINE> print("crunch boundary is being used\n----") <NEW_LINE> <DEDENT> header_strings = open(norsum_file).readlines()[0:14] <NEW_L...
Read the header of a NORSUM file (from RPIXDR) and return a description including the crunch boundaries and factors for SAMMY input file. Parameters ---------- norsum_file : ascii file An ascii file that has the format of NORSUM files that are produced by the program RPIXDR. t0 : float The time zero [us] ...
625941f1be7bc26dc91cdb98
def __init__(self, graph, t, batch_size, strategy="by_order", node_from=pywrap.NodeFrom.NODE, mask=utils.Mask.NONE): <NEW_LINE> <INDENT> self._graph = graph <NEW_LINE> self._type = t <NEW_LINE> self._batch_size = batch_size <NEW_LINE> self._strategy = strategy <NEW_LINE> self._client = self._graph.get_client() <NEW_LIN...
Create a Base NodeSampler.. Args: graph (`Graph` object): The graph which sample from. t (string): type of node or egde. If t is a type of node, then `NodeSampler` will sample from node source. Else if `t` is a type of edge, then `node_from=EDGE_SRC` indicates that the nodes will be sampled from edges'...
625941f156b00c62f0f14c01
def process_response(self, request, response): <NEW_LINE> <INDENT> path = request.path.lstrip('/') <NEW_LINE> if self.whitelist: <NEW_LINE> <INDENT> if not any(re.match(path) for re in self.whitelist_url_regexes): <NEW_LINE> <INDENT> self._remove_response_caching(response) <NEW_LINE> return response <NEW_LINE> <DEDENT>...
Add the Cache control no-store to anything confidential. You can either whitelist non-confidential pages and treat all others as non- confidential, or specifically blacklist pages as confidential
625941f1f9cc0f698b140b9a
def setEventsCallbacks(self, events): <NEW_LINE> <INDENT> self.onConnectionSuccess = events["onConnectionSuccess"] <NEW_LINE> self.onSendingHeaders = events["onSendingHeaders"] <NEW_LINE> self.onSendingHeadersSuccess = events["onSendingHeadersSuccess"] <NEW_LINE> self.onReadyToSend = events["onReadyToSend"] <NEW_LINE> ...
Establece las llamadas de eventos Deben pasarse las funciones, ej. def connectionSuccess(self): print("Conexion!") events = { "onConnectionSuccess": connectionSuccess, #... } Sender.setEventsCallbacks(events) Parámetros: events -- Diccionario de eventos
625941f17d43ff24873a3249
def test_15807844(self): <NEW_LINE> <INDENT> rurl = self.dc.get_repo_url() <NEW_LINE> self.pkgsend_bulk(rurl, self.example_pkg10) <NEW_LINE> self.image_create() <NEW_LINE> expected = "INDEX ACTION VALUE PACKAGE\n" "basename file bin/example_path pkg:/example_pkg@1.0-0\n" <NEW_LINE> self.pk...
Check that pkg search for temporary sources is successful when there no publishers configured in the image.
625941f1462c4b4f79d1dc73
def _compare_with_latest_github_tag( self, owner, name, version, fuzzy_check=False): <NEW_LINE> <INDENT> request = urlopen(Request( "https://api.github.com/repos/{owner}/{name}/tags".format( owner=quote(owner), name=quote(name)), headers={ 'Authorization': "token {}".format(self.settings.get('github_api_token')) } if s...
This method fetches tags from the `owner/name` repository on GitHub... ... and compares it with `version`. `self.status` will be set according to the previous comparison.
625941f14527f215b584c9f5
def is_test_name_random(self): <NEW_LINE> <INDENT> return "random_name" in self.tags
Check if the name of the tests are randomly generated. Those tests won't have associated test history.
625941f182261d6c526aba4c
def shrinkZeros(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> while not self.digits[-1] and len(self.digits) - 1: <NEW_LINE> <INDENT> self.digits.pop() <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> self.digits = [0]
Функция, убирающая лидирующие нули в числе
625941f173bcbd0ca4b2c619
def evaluate(self, g): <NEW_LINE> <INDENT> error=(len(g)!=self.test) <NEW_LINE> white = 0 <NEW_LINE> black = 0 <NEW_LINE> mask=[] <NEW_LINE> if not error: <NEW_LINE> <INDENT> for i in range(self.test): <NEW_LINE> <INDENT> if (int(g[i])==self.orig[i]): <NEW_LINE> <INDENT> black+=1 <NEW_LINE> mask.append(1) <NEW_LINE> <D...
Evaluate correctness of guess g and return number of black and white points
625941f163d6d428bbe44a95
def handle_close(self): <NEW_LINE> <INDENT> self.msg('closing connection') <NEW_LINE> self.connected = False <NEW_LINE> self.close() <NEW_LINE> self.options = {} <NEW_LINE> self.eof = 1
Close the connection.
625941f171ff763f4b549c3a
def _prep_sample_cnvs(cnv_file, data): <NEW_LINE> <INDENT> import pybedtools <NEW_LINE> sample_name = tz.get_in(["rgnames", "sample"], data) <NEW_LINE> def make_names(name): <NEW_LINE> <INDENT> return re.sub(r"[^\w.]", '.', name) <NEW_LINE> <DEDENT> def matches_sample_name(feat): <NEW_LINE> <INDENT> return (feat.name =...
Convert a multiple sample CNV file into a single BED file for a sample. Handles matching and fixing names where R converts numerical IDs (1234) into strings by adding an X (X1234), and converts other characters into '.'s. http://stat.ethz.ch/R-manual/R-devel/library/base/html/make.names.html
625941f1a4f1c619b28b05cf
def InvS_box(test_string): <NEW_LINE> <INDENT> const = np.array([1, 1, 0, 0, 0, 1, 1, 0]) <NEW_LINE> matrix = np.array([[0, 0, 1, 0, 0, 1, 0, 1], [1, 0, 0, 1, 0, 0, 1, 0], [0, 1, 0, 0, 1, 0, 0, 1], [1, 0, 1, 0, 0, 1, 0, 0], [0, 1, 0, 1, 0, 0, 1, 0], [0, 0, 1, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 1, 0, 0], [0, 1, 0, 0, 1, 0,...
returns the inverse s-box of any given string
625941f156ac1b37e6264768
def puzzle(encoded_message: str): <NEW_LINE> <INDENT> message = '' <NEW_LINE> for i, letter in enumerate(encoded_message): <NEW_LINE> <INDENT> if letter.isalpha(): <NEW_LINE> <INDENT> message += decrypt_letter(letter, i) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> message += letter <NEW_LINE> <DEDENT> <DEDENT> return...
Call decrypt_letter for each letter in the encoded_message :param encoded_message: message encrypted :return: message decrypted
625941f192d797404e304731
def __init__( self, config_entry: ConfigEntry, client: ZwaveClient, info: ZwaveDiscoveryInfo ) -> None: <NEW_LINE> <INDENT> super().__init__(config_entry, client, info) <NEW_LINE> self._last_color: dict[str, int] | None = None <NEW_LINE> self._supported_color_modes.discard(COLOR_MODE_BRIGHTNESS)
Initialize the light.
625941f14e696a04525c99f2
def main(): <NEW_LINE> <INDENT> pass
省略
625941f1442bda511e8be9b4
def head_ops(self, features, labels, mode, train_op_fn, logits=None, logits_input=None): <NEW_LINE> <INDENT> _check_mode_valid(mode) <NEW_LINE> _check_logits_input_not_supported(logits, logits_input) <NEW_LINE> predictions = self._predictions(logits) <NEW_LINE> if (mode == model_fn.ModeKeys.INFER) or (labels is None): ...
See `_Head`.
625941f1ec188e330fd5ad37
def __init__(self, service, conn_info): <NEW_LINE> <INDENT> global kerberos <NEW_LINE> if not kerberos: <NEW_LINE> <INDENT> import kerberos <NEW_LINE> <DEDENT> self._service = service <NEW_LINE> self._conn_info = conn_info <NEW_LINE> self._username = conn_info.username <NEW_LINE> self._password = conn_info.password <NE...
@param service: a string containing the service principal in the form 'type@fqdn' (e.g. 'imap@mail.apple.com').
625941f15fc7496912cc3f21
def _get_next_link(request, marker): <NEW_LINE> <INDENT> params = request.params.copy() <NEW_LINE> params['marker'] = marker <NEW_LINE> return "%s?%s" % (request.path_url, urllib.urlencode(params))
Return href string with proper limit and marker params.
625941f1dd821e528d63b748
def pgConnString(args): <NEW_LINE> <INDENT> port = '' <NEW_LINE> db = '' <NEW_LINE> out = "host='%s' user='%s' password='%s' " % ( args.pgHost , args.pgUser , args.pgPassword ) <NEW_LINE> if args.pgPort: <NEW_LINE> <INDENT> port = "port=%s" % args.pgPort <NEW_LINE> <DEDENT> if args.pgDb: <NEW_LINE> <INDENT> db = "dbnam...
connect_str = "dbname='testpython' user='matt' host='localhost' " + "password='myOwnPassword'"
625941f15510c4643540f979
def allPathsSourceTarget(self, graph): <NEW_LINE> <INDENT> N = len(graph) -1 <NEW_LINE> paths = [[0]] <NEW_LINE> ans = [] <NEW_LINE> while paths: <NEW_LINE> <INDENT> path = paths.pop() <NEW_LINE> for n in graph[path[-1]]: <NEW_LINE> <INDENT> if n == N: <NEW_LINE> <INDENT> ans.append(path + [n]) <NEW_LINE> <DEDENT> else...
:type graph: List[List[int]] :rtype: List[List[int]]
625941f13eb6a72ae02eca91
def _try_su_psql(interactive, dsn): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _execute_su_psql(r'\q', interactive=interactive, dsn=dsn, stderr=subprocess.STDOUT) <NEW_LINE> return True <NEW_LINE> <DEDENT> except subprocess.CalledProcessError: <NEW_LINE> <INDENT> LOGGER.debug('Failed to run "psql" in a subprocess as ...
Try to run psql in a subprocess as a different UNIX user. :return: True if successful, False otherwise
625941f12c8b7c6e89b35d60
def read(self): <NEW_LINE> <INDENT> (up, upx, ut, utx) = struct.unpack(">HBHB", self.bus.readfrom_mem(self.addr, 0xF7, 6)) <NEW_LINE> up = (up << 4) + (upx >> 4) <NEW_LINE> ut = (ut << 4) + (utx >> 4) <NEW_LINE> dt1, dt2, dt3, dp1, dp2, dp3, dp4, dp5, dp6, dp7, dp8, dp9 = self.trim <NEW_LINE> v1 = ((ut / 16384.0) - (dt...
Read temperature (in C), pressure (in Pa) and barometric altitude (m).
625941f1a8370b7717052e41
def sanitisePath(path): <NEW_LINE> <INDENT> return os.path.normpath(path)
normalize and remove trailing slashes in paths
625941f16aa9bd52df03734c
def GetSum(self, *args): <NEW_LINE> <INDENT> return _itkLabelStatisticsImageFilterPython.itkLabelStatisticsImageFilterIUS3IUS3_GetSum(self, *args)
GetSum(self, unsigned short label) -> double
625941f1e1aae11d1e74a261
def predict(self, filenames=None, images=None, **kwargs): <NEW_LINE> <INDENT> if images is None and filenames is not None: <NEW_LINE> <INDENT> images = (utils.process_img(file) for file in filenames) <NEW_LINE> <DEDENT> elif filenames is None and images is not None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <N...
Make predictions given image file paths. Arguments: filenames {tuple} -- Iterable containing file names or a generator that yields `filenames, labels`. Returns: {np.ndarray} -- array-like contianing predicted values.
625941f18c0ade5d55d3ef64
def bfun(self, param_coords): <NEW_LINE> <INDENT> xi = param_coords[0] <NEW_LINE> eta = param_coords[1] <NEW_LINE> return numpy.array([[-(xi / 4 - 1 / 4) * (eta - 1) * (eta + xi + 1)], [(xi / 4 + 1 / 4) * (eta - 1) * (eta - xi + 1)], [(xi / 4 + 1 / 4) * (eta + 1) * (eta + xi - 1)], [(xi / 4 - 1 / 4) * (eta + 1) * (xi -...
Evaluate the basis function matrix. :param param_coords: Parametric coordinates within the element where the function is evaluated. :return: array of basis function values.
625941f1e5267d203edce23a
def get_height(self): <NEW_LINE> <INDENT> return self._height
Getter for puzzle height. Returns an integer
625941f185dfad0860c3b401
def p_retorno(p): <NEW_LINE> <INDENT> p[0] = AST.Node("retorno",[p[2]])
retorno : RETORNA factor
625941f15fc7496912cc3f22
def write_line(tmp_file, record, fields, lengths): <NEW_LINE> <INDENT> fmtStr = ' | '.join("{{{0}:{1}s}}".format(col, lengths[col]) for col in fields) <NEW_LINE> tmp = record.copy() <NEW_LINE> out = dict.fromkeys(fields, '') <NEW_LINE> for col in fields: <NEW_LINE> <INDENT> tmp[col] = {i: t for i, t in enumerate(wrap_t...
Write a formatted table of data to stdout.
625941f1925a0f43d254a421
def convert_dataset(self, trans, target_type): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> converted_dataset = self.get_converted_dataset(trans, target_type) <NEW_LINE> <DEDENT> except NoConverterException: <NEW_LINE> <INDENT> return self.conversion_messages.NO_CONVERTER <NEW_LINE> <DEDENT> except ConverterDependencyE...
Converts a dataset to the target_type and returns a message indicating status of the conversion. None is returned to indicate that dataset was converted successfully.
625941f11d351010ab8560bf
def set_ThreadLink(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'ThreadLink', value)
Set the value of the ThreadLink input for this Choreo. ((conditional, string) The link pointing to the thread that is to be closed. Note that a Forum must also be provided when using this parameter. If set, ThreadID and ThreadIdentifier cannot be set.)
625941f176d4e153a657f0d7
def get_message(self) -> str: <NEW_LINE> <INDENT> if self.args.use_irc: <NEW_LINE> <INDENT> return self.ircbot.get_message() <NEW_LINE> <DEDENT> return input("> ")
Returns the next message from the user
625941f1a79ad161976cc6ea
def oh_code_to_member(code): <NEW_LINE> <INDENT> if settings.OH_CLIENT_SECRET and settings.OH_CLIENT_ID and code: <NEW_LINE> <INDENT> data = { 'grant_type': 'authorization_code', 'redirect_uri': '{}/complete'.format(APP_BASE_URL), 'code': code, } <NEW_LINE> req = requests.post( '{}/oauth2/token/'.format(OH_BASE_URL), d...
Exchange code for token, use this to create and return OpenHumansMember. If a matching OpenHumansMember already exists in db, update and return it.
625941f14e4d5625662d4974
def trace(self): <NEW_LINE> <INDENT> return self._trace
The list of executed lines, as (function_name, line_number) pairs
625941f1cb5e8a47e48b8045
def GPs_construction_ca(self, xk, Xtrain, ytrain, ndatplus, H_norm=0.): <NEW_LINE> <INDENT> ndat, multi_hyper, ng, ndim = self.ndat + ndatplus, self.multi_hyper, self.ng, self.ndim <NEW_LINE> cons_model, mistmatch_con = self.cons_model, self.mistmatch_con <NEW_LINE> TR_curvature, Curvature_TR_con = self.TR_curvature, s...
Constructs a GP for every cosntraint
625941f15f7d997b87175042
def __init__(self, size=0): <NEW_LINE> <INDENT> if type(size) is not int: <NEW_LINE> <INDENT> raise TypeError("size must be an integer") <NEW_LINE> <DEDENT> elif size < 0: <NEW_LINE> <INDENT> raise ValueError("size must be >= 0") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.__size = size
Initializes the data.
625941f13346ee7daa2b3316
def forward(self, timeout_forwarding=False, subflow_workitem=None): <NEW_LINE> <INDENT> log.info('forward_workitem %s', self.__unicode__()) <NEW_LINE> if not timeout_forwarding: <NEW_LINE> <INDENT> if self.status != 'complete': <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> if self.has_workitems_to() and not s...
Convenience procedure to forwards workitems to valid destination activities. @type path: string?? @param path: XXX TODO: This is not used, so don't know why it's here. @type timeoutForwarding: bool @param timeoutForwarding: @type: subflow_workitem: WorkItem @param subflow_workitem: a workitem associated with a subflow...
625941f1fff4ab517eb2f9e5
def kill_all(self): <NEW_LINE> <INDENT> for pid in self.children: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.kill(pid, signal.SIGTRAP) <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> <DEDENT> self.join()
kill all workers and reap the monitor
625941f10383005118ecfb85
def inners(query_path, parent_pos): <NEW_LINE> <INDENT> pos = text(int(parent_pos) + 1) <NEW_LINE> if not query_path: <NEW_LINE> <INDENT> def base_case(row): <NEW_LINE> <INDENT> extra = {} <NEW_LINE> for k, e in post_expressions.items(): <NEW_LINE> <INDENT> extra[k] = e(row) <NEW_LINE> <DEDENT> row["0"] = extra <NEW_LI...
:param query_path: :return: ITERATOR OVER TUPLES ROWS AS TUPLES, WHERE row[len(nested_path)] HAS INNER HITS AND row[0] HAS post_expressions
625941f1a05bb46b383ecdc1
def predict(self, new_X: np.array = None) -> np.array: <NEW_LINE> <INDENT> if self.class_subspace_projection_operators_ is None: <NEW_LINE> <INDENT> raise ValueError("Must fit model before transformation") <NEW_LINE> <DEDENT> projection_distance_to_class = {} <NEW_LINE> for c in self.classes_: <NEW_LINE> <INDENT> subsp...
Exposed API to make predictions :param new_X: New set of X values to make predictions with (optional) :return:
625941f129b78933be1e5c4a
def export_template(self, template, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return template.render_to_response(self.queryset) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> messages.error(request, f"There was an error rendering the selected export template ({template.name}): {e}") <NEW_LI...
Render an ExportTemplate using the current queryset. :param template: ExportTemplate instance :param request: The current request
625941f1091ae356686674f9
@toolkit.side_effect_free <NEW_LINE> @validate(schema.powerview_show_schema) <NEW_LINE> def powerview_show(context, data_dict): <NEW_LINE> <INDENT> toolkit.check_access('ckanext_powerview_show', context, data_dict) <NEW_LINE> powerview = PowerView.get(id=data_dict['id']) <NEW_LINE> return powerview.as_dict()
Show an existing powerview. :param id: the id of the powerview to show :type id: string :rtype: dictionary
625941f19b70327d1c4e137d
def conv_forward_naive(x, w, b, conv_param): <NEW_LINE> <INDENT> out = None <NEW_LINE> stride = conv_param['stride'] <NEW_LINE> pad_size = int(conv_param['pad']) <NEW_LINE> N, C, H, W = x.shape <NEW_LINE> F, C, HH, WW = w.shape <NEW_LINE> H_out = 1+(H-HH+2*pad_size)/stride <NEW_LINE> W_out = 1+(W-WW+2*pad_size)/stride ...
A naive implementation of the forward pass for a convolutional layer. The input consists of N data points, each with C channels, height H and width W. We convolve each input with F different filters, where each filter spans all C channels and has height HH and width HH. Input: - x: Input data of shape (N, C, H, W) - ...
625941f12eb69b55b151ce5d
def _partitions(total, length): <NEW_LINE> <INDENT> if length == 0: <NEW_LINE> <INDENT> if total > 0: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> if total == 0: <NEW_LINE> <INDENT> yield [0] * length <NEW_LINE> return <NEW_LINE> <DEDENT> for first in range(total + 1): <NEW_LINE> <INDENT> shorter_partitions ...
Generate all lists of nonnegative integers of length @p length that sum to @p total.
625941f191f36d47f21aca9e
def debug(self, name, component, enable, samplingPercentage): <NEW_LINE> <INDENT> self.send_debug(name, component, enable, samplingPercentage) <NEW_LINE> self.recv_debug()
Enable/disable logging the tuples generated in topology via an internal EventLogger bolt. The component name is optional and if null or empty, the debug flag will apply to the entire topology. The 'samplingPercentage' will limit loggging to a percentage of generated tuples. Parameters: - name - component - enable...
625941f1d7e4931a7ee9e4c5
def handle_message(self, message): <NEW_LINE> <INDENT> result = self.on_message(message[MESSAGE_DATA]) <NEW_LINE> return create_result(False, result)
Handles recieving a raw message and returning a response, this is called before on_message. TODO Handle errors
625941f130dc7b7665901f05
def __init__(self, characters, combinationLength): <NEW_LINE> <INDENT> self.__characters = characters <NEW_LINE> self.__combinationLength = combinationLength <NEW_LINE> self.__it = self.__iterative_backtracking() <NEW_LINE> self.__curr = None <NEW_LINE> self.__last = characters[-combinationLength:]
:type characters: str :type combinationLength: int
625941f1462c4b4f79d1dc74
def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(SigmoidalJansenRit, self).__init__(**kwargs)
Precompute a constant after the base __init__
625941f17b25080760e399fa
def great_circle_distance(pt1, pt2): <NEW_LINE> <INDENT> r = 6371. <NEW_LINE> delta_latitude = math.radians(pt1[0] - pt2[0]) <NEW_LINE> delta_longitude = math.radians(pt1[1] - pt2[1]) <NEW_LINE> latitude1 = math.radians(pt1[0]) <NEW_LINE> latitude2 = math.radians(pt2[0]) <NEW_LINE> a = math.sin(delta_latitude / 2) ** 2...
Return the great-circle distance in kilometers between two points, defined by a tuple (lat, lon). Examples -------- >>> brussels = (50.8503, 4.3517) >>> paris = (48.8566, 2.3522) >>> great_circle_distance(brussels, paris) 263.9754164080347
625941f123e79379d52eeb01