code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def federatedSearchSources(): <NEW_LINE> <INDENT> return map(federatedSearchSource, searchers.all) | Wraps the UnitedSearch searchers from searchers.py
into FederatedSearch, so they can be displayed etc | 625941efbe8e80087fb211b4 |
def prep_winner(self, winner): <NEW_LINE> <INDENT> self.winner_image = self.font4.render(winner, True, self.text_color2, self.button_color) <NEW_LINE> self.winner_image_rect = self.winner_image.get_rect() <NEW_LINE> self.winner_image_rect.center = self.rect.center <NEW_LINE> self.winner_image_rect.centery -= 250 | Turn msg into rendered image and center text | 625941ef283ffb24f3c55e76 |
def train_op(batch, hparams, config_name): <NEW_LINE> <INDENT> config = utils.get_module("baseline.models.ae_configs.%s" % config_name) <NEW_LINE> if hparams.raw_audio: <NEW_LINE> <INDENT> x = batch["audio"] <NEW_LINE> x = tf.expand_dims(tf.expand_dims(x, 1), -1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> x = batch[... | Define a training op, including summaries and optimization.
Args:
batch: Dictionary produced by NSynthDataset.
hparams: Hyperparameters dictionary.
config_name: Name of config module.
Returns:
train_op: A complete iteration of training with summaries. | 625941efd268445f265b53e9 |
def jfunc2(k, l, t): <NEW_LINE> <INDENT> return (1. - np.exp(-(k + l) * t)) / (k + l) | J2 function. | 625941efeab8aa0e5d26e0d4 |
def do_help(self, arg): <NEW_LINE> <INDENT> Cmd.do_help(self, arg) | Print help message | 625941efdd821e528d63b71f |
def _active_downloads(self, slot): <NEW_LINE> <INDENT> if slot not in self.downloader.slots: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return len(self.downloader.slots[slot].active) | Return a number of requests in a Downloader for a given slot | 625941ef6fb2d068a760f621 |
@pytest.mark.parametrize( 'x', [[1, 2], (1, 2), memoryview(b'abc')] + ([buffer(b'abc')] if sys.version_info[0] == 2 else [])) <NEW_LINE> def test_from_array_list(x): <NEW_LINE> <INDENT> dx = da.from_array(x, chunks=-1) <NEW_LINE> assert_eq(np.array(x), dx) <NEW_LINE> assert isinstance(dx.dask[dx.name, 0], np.ndarray) <... | Lists, tuples, and memoryviews are automatically converted to ndarray
| 625941ef5e10d32532c5f49f |
@Log(logger) <NEW_LINE> def find_organisation_repos(g: Github, organisation: str, repository_type: str = "all", sort: str = "full_name", direction: str = "asc") -> Union[PaginatedList.PaginatedList, Repository.Repository]: <NEW_LINE> <INDENT> g_organisation = g.get_organization(organisation) <NEW_LINE> return g_organis... | Get repositories for a GitHub organisation.
For accepted string values for ``repository_type``, ``sort``, and ``direction``, see the
`GitHub REST API Reference`__.
Args:
g: A ``github.Github`` class object initialised with a GitHub username and personal access token with the
necessary permissions.
org... | 625941efadb09d7d5db6cd06 |
def test_post_return_form_invalid(self, u_request, invalid_cartview): <NEW_LINE> <INDENT> invalid_cartview.request = u_request <NEW_LINE> response = invalid_cartview.post(u_request) <NEW_LINE> assert response.status_code == 400 | Test that post request handler will return appropriate method if form
is invalid. | 625941ef7047854f462a197e |
def change_uri( self, gid: str, file_index: int, del_uris: List[str], add_uris: List[str], position: Optional[int] = None, ) -> List[int]: <NEW_LINE> <INDENT> return self.call(self.CHANGE_URI, [gid, file_index, del_uris, add_uris, position]) | Remove the URIs in `del_uris` from and appends the URIs in `add_uris` to download denoted by gid.
Original signature:
aria2.changeUri([secret], gid, fileIndex, delUris, addUris[, position])
Arguments:
gid: The download to change URIs of.
file_index: Used to select which file to remove/attach given URIs. ... | 625941ef6aa9bd52df037322 |
def add_router(ip, mac, cursor, sglite_connection): <NEW_LINE> <INDENT> cursor.execute(f"SELECT * FROM Routers WHERE MAC='{mac}' AND IP='{ip}'") <NEW_LINE> row = cursor.fetchone() <NEW_LINE> if row: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cursor.execute(f"INSERT... | Function for adding record to table Routers. The record is MAC address of router and Ip address of device behind him or router himself.
Parameters
-----------
ip : str
IP address of device behind router (or IP address of the router).
mac : str
MAC address of router.
cursor : sqlite3
Cursor to sqlite3 datab... | 625941ef925a0f43d254a3f7 |
def PrintMenu(self): <NEW_LINE> <INDENT> print ('\nContacts Sample\n' '1) List all of your contacts.\n' '2) Create a contact.\n' '3) Query contacts on updated time.\n' '4) Modify a contact.\n' '5) Delete a contact.\n' '6) List all of your contact groups.\n' '7) Query your groups on updated time.\n' '8) Exit.\n') | Displays a menu of options for the user to choose from. | 625941efd10714528d600264 |
def __init__(self, requested, found): <NEW_LINE> <INDENT> self.requested = requested <NEW_LINE> self.found = found <NEW_LINE> super(NoRequestedProtocols, self).__init__( "None of the provided protocols (%s) are in " "the current list of accepted protocols (%s)" % ( self.found, self.requested ) ) | The constructor takes two mandatory parameters, requested
and found. Both should be lists. requested is the protocols
we want and found is the protocols that can be used to
access the stream. | 625941efcdde0d52a9e535b2 |
def encrypt_Sik(message,i,k): <NEW_LINE> <INDENT> result = message[0:i] <NEW_LINE> temp = ord(message[i:i + 1]) <NEW_LINE> if k>0: <NEW_LINE> <INDENT> while(k>0): <NEW_LINE> <INDENT> if temp == 90: <NEW_LINE> <INDENT> temp = 64 <NEW_LINE> <DEDENT> temp = temp + 1 <NEW_LINE> k=k-1 <NEW_LINE> <DEDENT> <DEDENT> elif k<0: ... | This method shifts the letter at index i forward by k
precondition: string message read from the file
postcondition: string message after performing the shift operation
:param message: string on which the operation has to be performed
:param i: index of the string which is to be shifted
:param k: number of times it ha... | 625941efd4950a0f3b08c8c1 |
@typemap <NEW_LINE> def reduce_l1(x, axis=None, keepdims = True, name=''): <NEW_LINE> <INDENT> from cntk.cntk_py import reduce_l1 <NEW_LINE> x = sanitize_input(x) <NEW_LINE> axis = sanitize_multi_axis_reduction_list(axis) <NEW_LINE> return reduce_l1(x, axis, keepdims, name) | Computes the L1 norm of the input tensor's element along the provided axes.
The resulted tensor has the same rank as the input if keepdims equal 1.
If keepdims equal 0, then the resulted tensor have the reduced dimension pruned.
Example:
>>> C.reduce_l1([[[1,2], [3,4]],[[5,6], [7,8]],[[9,10], [11,12]]], 2, False... | 625941ef5f7d997b87175017 |
def set_ExpeditedService(self, value): <NEW_LINE> <INDENT> super(AddBasicListingInputSet, self)._set_input('ExpeditedService', value) | Set the value of the ExpeditedService input for this Choreo. ((optional, boolean) Whether or not the seller is offering expedited shipping service options.) | 625941ef66656f66f7cbc728 |
def _on_channel_closed(self, channel, reply_code, reply_text): <NEW_LINE> <INDENT> if not self._closing: <NEW_LINE> <INDENT> self._connection.close() | Invoked by pika when RabbitMQ unexpectedly closes the channel.
Channels are usually closed if you attempt to do something that
Channels are usually closed if you attempt to do something that
violates the protocol, such as re-declare an exchange or queue with
different parameters. In this case, we'll close the connectio... | 625941eff8510a7c17cf9c7b |
def _trend_alternate_hold(dataframe=None, metadata=None): <NEW_LINE> <INDENT> if metadata['pair'] in('ETH/BTC', 'LTC/BTC'): <NEW_LINE> <INDENT> multi = 20 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> multi = 18 <NEW_LINE> <DEDENT> dataframe['buy'] = np.where(dataframe.index % multi == 0, 1, 0) <NEW_LINE> dataframe['se... | Buy every xth candle - sell every other xth -2 (hold on to pairs a bit) | 625941ef38b623060ff0b368 |
def merge_clusters(clx, mmx, x, y, verbose=False): <NEW_LINE> <INDENT> if verbose: <NEW_LINE> <INDENT> sys.stderr.write(f"Merging clusters At {x} and {y}: There are {len(clx)} members and {len(mmx)} clusters\n") <NEW_LINE> <DEDENT> xc = clx[x] <NEW_LINE> yc = clx[y] <NEW_LINE> if xc == yc: <NEW_LINE> <INDENT> return cl... | Merge the clusters
:param verbose: more output
:type verbose: bool
:param y: second member
:type y: str
:param x: first member
:type x: str
:param mmx: For a cluster ID, a list of the members
:type mmx: Dict[int, Set[str]]
:param clx: For the member of a cluster, the cluster number
:type clx: dict[str, int]
:rtype: dic... | 625941efd10714528d600265 |
def getC(x,p): <NEW_LINE> <INDENT> a = x[0] <NEW_LINE> M = p[0] <NEW_LINE> Cx = np.array([[0,1],[0.7*p0*M**2*S*(an*a**2+bn*np.abs(a)+cn*(2+M/3))/m/g,0]]) <NEW_LINE> return Cx | State-dependent coefficient (SDC) matrix of given h(x,u,p) when u = 0
Parameters
----------
x : ndarray - (n, )
current state
p : ndarray - (n_p, )
current system parameter
Returns
-------
Cx : ndarray - (n, )
SCD matrix | 625941ef26238365f5f0f3f0 |
def filter_by_book_name(book_name=""): <NEW_LINE> <INDENT> connector = instance_connector() <NEW_LINE> connector.connect() <NEW_LINE> books = connector.get_book_by_name(book_name) <NEW_LINE> books = normalize_book(books, connector) <NEW_LINE> connector.desconnect() <NEW_LINE> return books | Filter by the name of the book | 625941efff9c53063f47c76b |
def product(self) -> "Factor": <NEW_LINE> <INDENT> factor = self.factors[0] <NEW_LINE> for other in self.factors[1:]: <NEW_LINE> <INDENT> factor *= other <NEW_LINE> <DEDENT> return factor | Compute the Joint Probability Distribution over the set. | 625941ef3eb6a72ae02eca67 |
def format_counts(self, sortBy="name"): <NEW_LINE> <INDENT> s = "---> Counters (by %s): \n" % sortBy <NEW_LINE> if sortBy == "name": <NEW_LINE> <INDENT> counterNames = sorted(list(self.counters.keys())) <NEW_LINE> <DEDENT> elif sortBy == "count": <NEW_LINE> <INDENT> counterNames = sorted(list(self.counters.keys()), key... | Formats a string to report the counter values recorded in this Profiler.
Parameters
----------
sortBy : {"name","count"}
What to sort list of counts by.
Returns
-------
str | 625941ef9c8ee82313fbbcf2 |
def validate_macs(self, macs): <NEW_LINE> <INDENT> for mac in macs: <NEW_LINE> <INDENT> if not re.match( "[0-9a-f]{2}([-:]?)[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", mac.lower() ): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True | Validate all the macs have a valid format. | 625941ef45492302aab5e844 |
def get_settings(self): <NEW_LINE> <INDENT> return AlgoliaUtils_request(self.client.headers, self.read_hosts, "GET", "/1/indexes/%s/settings" % self.url_index_name, self.client.timeout) | Get settings of this index | 625941ef3eb6a72ae02eca68 |
def test_watch_namespaced_watch_podtemplate(self): <NEW_LINE> <INDENT> pass | Test case for watch_namespaced_watch_podtemplate
watch changes to an object of kind PodTemplate | 625941ef63b5f9789fde7661 |
def affine_bn_relu_forward(x, w, b, gamma, beta, bn_param): <NEW_LINE> <INDENT> a, fc_cache = affine_forward(x, w, b) <NEW_LINE> a_bn, bn_cache = batchnorm_forward(a, gamma, beta, bn_param) <NEW_LINE> out, relu_cache = relu_forward(a_bn) <NEW_LINE> cache = (fc_cache, bn_cache, relu_cache) <NEW_LINE> return our, cache | Convenience layer that performs as an affine with Batch Normalization followed by RELU
Inputs:
- x: Input to the affine layer
- w, b :Weights for the affine layer
- gamma: Scale paremeter of shape (D,)
- beta: Shift paremeter of shape (D, )
- bn_param: Dictionary with the following keys:
-mode: 'train' or 'test',r... | 625941efbe383301e01b59f5 |
def add(isamAppliance, name, uri, description="", attributes=None, properties=None, predefined=False, typeName=None, check_mode=False, force=False): <NEW_LINE> <INDENT> if force is False: <NEW_LINE> <INDENT> ret_obj = search(isamAppliance, name) <NEW_LINE> <DEDENT> if force is True or ret_obj['data'] == {}: <NEW_LINE> ... | Create a new Authentication Mechanism | 625941efd486a94d0b98e6c1 |
def updateNodes(self, imageId, enabledStacks, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError ("not implemented method updateNodes") | Update which nodes have this image available
param:imageId id of image
param:enabledStacks list of enabled stacks
result bool | 625941ef0a366e3fb873ed9a |
def get_dynamic_theta_phase_force(phase_ranges, peak_loc, dx): <NEW_LINE> <INDENT> end_x_val = phase_ranges[-1][0] + peak_loc <NEW_LINE> start_phase_val = phase_ranges[0][1] * 2. * np.pi / 360. <NEW_LINE> end_phase_val = phase_ranges[-1][1] * 2. * np.pi / 360. <NEW_LINE> phase_force = np.ones_like(extended_x) * start_p... | Expects a list of tuples containing times and phases relative to peak_loc and the non-modulated phase preference
(zero degrees). Returns a waveform of phase vs time.
:param phase_ranges: list of tuple (ms, degrees)
:param peak_loc: float (cm)
:param dx: float
:return: :class: 'np.array' | 625941ef96565a6dacc8fc44 |
def set_minimalArea(self, areamin): <NEW_LINE> <INDENT> my_arf = sau.get_arf(self.name) | Define threshold using minimal area.
Extract true energy value from arf file
To be implemented | 625941ef50812a4eaa59c896 |
def load(from_env_file=True) -> None: <NEW_LINE> <INDENT> if from_env_file is True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for k, v in parse(filecontents()): <NEW_LINE> <INDENT> os.environ[k] = v <NEW_LINE> <DEDENT> <DEDENT> except ValueError: <NEW_LINE> <INDENT> raise ValueError(f'Problem parsing {filepath()}, c... | Loads configs from proper env file or directly from environment.
In the latter case, this function doesn't really do much apart from validate
that all the env names are set. | 625941ef07f4c71912b11a00 |
def IsDocumentData(): <NEW_LINE> <INDENT> return scriptcontext.doc.Strings.Count>0 | Verifies the current document contains user data
Returns:
True or False indicating the presence of Script user data | 625941ef3cc13d1c6d3c78f2 |
def test_total_joe_bulk_item_promo(self): <NEW_LINE> <INDENT> joe = Customer('John Doe', 0) <NEW_LINE> cart = [LineItem('banana', 30, .5), LineItem('apple', 10, 1.5)] <NEW_LINE> order = Order(joe, cart, BulkItemPromo()) <NEW_LINE> self.assertEqual(order.total(), 30.0) | test to verify the return of the method
total | 625941eff548e778e58cdafb |
def _checkNetaddrWorksWithPrefixlen(net, prefixlen, version): <NEW_LINE> <INDENT> return (net & _prefixlenToNetmask(prefixlen, version) == net) | Check if a base addess of a network is compatible with a prefixlen | 625941ef8da39b475bd654f6 |
def make_pizza2(size, *toppings): <NEW_LINE> <INDENT> print("\nMaking a " + str(size) + "-inch pizza with the following toppings:") <NEW_LINE> for topping in toppings: <NEW_LINE> <INDENT> print("- " + topping) | show the toppings info | 625941ef30c21e258bdfaa1f |
def get(self, arg): <NEW_LINE> <INDENT> if arg == 'all': <NEW_LINE> <INDENT> tag_list = get_all_tags(myobj.get_children(), 'value') <NEW_LINE> return tag_list <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> range_list = [] <NEW_LINE> tag_list = get_all_tags(myobj.get_children(), 'value') <NEW_LINE> try: <NEW_LINE> <INDEN... | This will list the tags values within opcua server | 625941ef23e79379d52eead7 |
def rotate(self, matrix): <NEW_LINE> <INDENT> lenli = len(matrix[0]) <NEW_LINE> for i in xrange(lenli): <NEW_LINE> <INDENT> for j in xrange(i,lenli): <NEW_LINE> <INDENT> matrix[i][j],matrix[j][i] = matrix[j][i],matrix[i][j] <NEW_LINE> <DEDENT> <DEDENT> for i in xrange(lenli): <NEW_LINE> <INDENT> for j in xrange(lenli/2... | :type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead. | 625941ef009cb60464c63928 |
def handle_read(self, key): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data=self.client_sockets[key].recv(self.client_sockets[key].recv_rate) <NEW_LINE> self.client_sockets[key].buffer+=data <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass | Called when a TCP socket has stuff to be read from it. | 625941ef796e427e537b0b46 |
def __str__(self): <NEW_LINE> <INDENT> return f"{self.full_name} ({self.short_name})" | Return a more human-readable representation | 625941efa8ecb033257d3646 |
def index(request): <NEW_LINE> <INDENT> check_premium_status() <NEW_LINE> return render(request, 'home/index.html') | A view to return the index page and check
premium users to remove when end date is reached | 625941efec188e330fd5ad0e |
def __getitem__(self, key): <NEW_LINE> <INDENT> if key not in self._jdict['properties']: <NEW_LINE> <INDENT> raise AttributeError( 'No property %s found for event %s.' % (key, self.id)) <NEW_LINE> <DEDENT> return self._jdict['properties'][key] | Extract DetailEvent property using the [] operator.
:param key:
Property to extract.
:returns:
Desired property. | 625941ef9b70327d1c4e1353 |
def __init__( self, scope: aws_cdk.core.Construct, id: builtins.str, *, source_arn: builtins.str, description: typing.Optional[builtins.str] = None, event_pattern: typing.Any = None, retention_days: typing.Optional[jsii.Number] = None, ) -> None: <NEW_LINE> <INDENT> props = CfnArchiveProps( source_arn=source_arn, descr... | Create a new ``AWS::Events::Archive``.
:param scope: - scope in which this resource is defined.
:param id: - scoped id of the resource.
:param source_arn: ``AWS::Events::Archive.SourceArn``.
:param description: ``AWS::Events::Archive.Description``.
:param event_pattern: ``AWS::Events::Archive.EventPattern``.
:param re... | 625941efa17c0f6771cbe5ca |
def test_playbook_exit(self, tcex): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tcex.playbook.exit(0) <NEW_LINE> assert False, 'Exit command did not trigger SystemExit' <NEW_LINE> <DEDENT> except SystemExit: <NEW_LINE> <INDENT> pass | Test the create output method of Playbook module.
Args:
tcex (TcEx, fixture): The tcex fixture. | 625941ef596a89723608a034 |
def born(self, i, j): <NEW_LINE> <INDENT> box = self.grid[i][j] <NEW_LINE> box.born() | Born at the given position. | 625941ef82261d6c526aba23 |
def plot_single(ax, ma, average_type, color, label, plot_type='lines'): <NEW_LINE> <INDENT> summary = np.ma.__getattribute__(average_type)(ma, axis=0) <NEW_LINE> x = np.arange(len(summary)) <NEW_LINE> if isinstance(color, np.ndarray): <NEW_LINE> <INDENT> color = pltcolors.to_hex(color, keep_alpha=True) <NEW_LINE> <DEDE... | Adds a line to the plot in the given ax using the specified method
Parameters
----------
ax : matplotlib axis
matplotlib axis
ma : numpy array
numpy array The data on this matrix is summarized according
to the `average_type` argument.
average_type : str
string values are sum mean median min max std
col... | 625941ef3539df3088e2e8c7 |
def getList(webhook): <NEW_LINE> <INDENT> for thisEndpoint in endpoints["endpoint"]: <NEW_LINE> <INDENT> msg = (time.asctime() +"\t" +thisEndpoint["name"] +" Address: " +thisEndpoint["ipv4addr"] +" Location: " +thisEndpoint["location"] +"\n" ) <NEW_LINE> print (time.asctime(), " POSTing msg to Webex Teams -> ... | This method prints out list of endpoints from endpoints.json array | 625941ef4428ac0f6e5bad73 |
def FormatNxBoolean(value): <NEW_LINE> <INDENT> if value: <NEW_LINE> <INDENT> return NX_TRUE <NEW_LINE> <DEDENT> return NX_FALSE | Format boolean value for nxagent.
@type value: bool
@param value: Value
@rtype: str | 625941efa4f1c619b28b05a7 |
def true_obliquity_of_ecliptic(t='now'): <NEW_LINE> <INDENT> T = julian_centuries(t) <NEW_LINE> result = 23.452294 - 0.0130125 * T - 0.00000164 * T ** 2 + 0.000000503 * T ** 3 <NEW_LINE> return Angle(result, u.deg) | Returns the true obliquity of the ecliptic. | 625941efbde94217f3683367 |
def get_average(scores): <NEW_LINE> <INDENT> avg = reduce(lambda sum ,x : sum + x, scores) / len(scores) <NEW_LINE> return round(avg,2) | get_average(scores) -> float<2> | 625941ef090684286d50f26b |
def test___init__(self, mocker): <NEW_LINE> <INDENT> mock_super_init = mocker.patch.object( houdini_toolbox.logging.adapters.logging.LoggerAdapter, "__init__" ) <NEW_LINE> mock_base_logger = mocker.MagicMock(spec=logging.Logger) <NEW_LINE> mock_dialog = mocker.MagicMock(spec=bool) <NEW_LINE> mock_node = mocker.MagicMoc... | Test object initialization. | 625941efdc8b845886cb5ab2 |
def RandomBoolean(): <NEW_LINE> <INDENT> bool = randint(0,2) <NEW_LINE> return bool | Return a random boolean | 625941ef6e29344779a62b8c |
def update_bnodes(VO, tlnum, delta): <NEW_LINE> <INDENT> bnodes = VO.bnodes <NEW_LINE> for i in xrange(tlnum, len(bnodes)+1): <NEW_LINE> <INDENT> bnodes[i-1] += delta | Update VO.bnodes by adding/substracting delta to each bnode
starting with bnode at tlnum and to the end. | 625941ef4f6381625f114fb7 |
def output_edits( *, site: pywikibot.site.APISite, start: datetime.datetime, end: datetime.datetime, prefix: str, ) -> None: <NEW_LINE> <INDENT> changes_page = Page( site, f"{prefix}/{start.strftime('%Y-%m')}", ) <NEW_LINE> if start.date().isoformat() in get_headers(changes_page.text): <NEW_LINE> <INDENT> return <NEW_L... | Write edits to a page. | 625941ef01c39578d7e753b7 |
def create_vertical_plot(self, variable, dim, unit = None, out = None): <NEW_LINE> <INDENT> p_levels = self.obj.level.values <NEW_LINE> if dim== 'latitude': <NEW_LINE> <INDENT> coords = self.obj.latitude.values <NEW_LINE> <DEDENT> if dim == 'longitude': <NEW_LINE> <INDENT> coords = self.obj.latitude.values <NEW_LINE> <... | This function creates a 2D map for any chosen climate variable.
Parameter:
------------
var (numpy.array) : any climate variable for one timestep (2-dimensionsal)
dim (str): 'longitude' or 'latitude' for latitudinal or longitudinal cross section
optional:
unit(str) : unit of climate variable
out (str): name of o... | 625941ef96565a6dacc8fc45 |
@Attribute <NEW_LINE> def frequency(bench, action=['Get', '']): <NEW_LINE> <INDENT> SCPIcore = ':SOUR:FREQ:FIX' <NEW_LINE> return bench, SCPIcore, action | action=['Set','2GHz'] | 625941ef1d351010ab856096 |
def is_valid_component(component): <NEW_LINE> <INDENT> return component.__class__ in [Annotation, Reference, Repeat, Row] | Return whether a component can be in a Pattern. | 625941ef45492302aab5e845 |
def minutes_to_seconds(minutes): <NEW_LINE> <INDENT> return 60 * minutes | A function that converts minutes to seconds
:param minutes: The number of minutes do be converted
:return: The number of seconds in a give number of minutes | 625941efcc0a2c11143dd40d |
def new(self): <NEW_LINE> <INDENT> self.allBalls = [] <NEW_LINE> for i in range(1, 10): <NEW_LINE> <INDENT> if os.name == 'posix': <NEW_LINE> <INDENT> ball = Ball(game=self, allBalls=self.allBalls, color=self.getRandomColor(), radius=min(i * 10, 70), startX=i * 160, startY= i * 140, speed=min(i * 4, 8)) <NEW_LINE> <DED... | Starts a new game. | 625941ef9f2886367277ae04 |
def delete_item(self, item=None): <NEW_LINE> <INDENT> if not item is None: <NEW_LINE> <INDENT> self.item = item <NEW_LINE> <DEDENT> if not self.item is None: <NEW_LINE> <INDENT> self.widget.DeleteItem(self.item) <NEW_LINE> <DEDENT> self.item = None | Delete an item, if arg item is None, delete current item | 625941ef6e29344779a62b8d |
def create_and_setup_new_account(self, starting_balance=50000000, buls_amount=None, trust_limit=None): <NEW_LINE> <INDENT> keypair = paket_stellar.get_keypair() <NEW_LINE> pubkey = keypair.address().decode() <NEW_LINE> seed = keypair.seed().decode() <NEW_LINE> self.create_account(from_pubkey=self.funder_pubkey, new_pub... | Create account. Add trust and send initial amount of BULs (if specified). | 625941ef6fb2d068a760f622 |
def kapur_multithreshold(image, nthrs): <NEW_LINE> <INDENT> hist, _ = np.histogram(image, bins=range(256), density=True) <NEW_LINE> c_hist = hist.cumsum() <NEW_LINE> return _get_thresholds(hist, c_hist, nthrs) | Runs the Kapur's multi-threshold algorithm.
Reference:
Kapur, J. N., P. K. Sahoo, and A. K. C.Wong. ‘‘A New Method for Gray-Level
Picture Thresholding Using the Entropy of the Histogram,’’ Computer Vision,
Graphics, and Image Processing 29, no. 3 (1985): 273–285.
@param image: The input image
@type image: ndarray
@pa... | 625941efbaa26c4b54cb1695 |
def UpdateRequestWithConditionFromFile(ref, args, request): <NEW_LINE> <INDENT> del ref <NEW_LINE> if args.IsSpecified('condition_from_file'): <NEW_LINE> <INDENT> _, messages = util.GetClientAndMessages() <NEW_LINE> condition_message = messages.Expr( description=args.condition_from_file.get('description'), title=args.c... | Python hook to add condition from --condition-from-file to request.
Args:
ref: A resource ref to the parsed resource.
args: Parsed args namespace.
request: The apitools request message to be modified.
Returns:
The modified apitools request message. | 625941ef9f2886367277ae05 |
def solve(self): <NEW_LINE> <INDENT> self.enforce_node_consistency() <NEW_LINE> self.ac3() <NEW_LINE> return self.backtrack(dict()) | Enforce node and arc consistency, and then solve the CSP. | 625941ef60cbc95b062c6abf |
def start(self): <NEW_LINE> <INDENT> pass | システムをスタートします。
多くの場合、ゲームキャンバスのstartメソッド後に呼び出されます。
ゲームの開始は、ターン制のゲームであればキーボードイベントが有効になった瞬間と考えれますので
ここでゲームのキーボードイベントをbindすることになります。
リアルタイム制なゲームであれば、ここで各キャラクターの行動を開始することになるでしょう。
マップにターン数や経過時間という概念があれば、それもここで始めるのが得策です。 | 625941ef60cbc95b062c6ac0 |
def test_add_rel_nofollow(): <NEW_LINE> <INDENT> assert ( linkify('<a href="http://yy.com">http://yy.com</a>') == '<a href="http://yy.com" rel="nofollow">http://yy.com</a>' ) | Verify that rel="nofollow" is added to an existing link | 625941ef82261d6c526aba24 |
def test_addon_layer_removed(self): <NEW_LINE> <INDENT> layers = [l.getName() for l in registered_layers()] <NEW_LINE> self.assertNotIn('IPloneHostingLayer', layers) | Validate that the browserlayer is removed. | 625941ef5fdd1c0f98dc07b1 |
def _load_inventory_rack_plugins(): <NEW_LINE> <INDENT> return load_plugin_by_namespace(I_MANAGER_RACK_HOOK) | Find the inventory rack plugins and return them as
dictonary[name]=plugin class | 625941ef091ae356686674d1 |
def get_tts_audio(self, message, language=None, options=None): <NEW_LINE> <INDENT> voice_id = options.get(CONF_VOICE, self.default_voice) <NEW_LINE> voice_in_dict = self.all_voices.get(voice_id) <NEW_LINE> if language != voice_in_dict.get("LanguageCode"): <NEW_LINE> <INDENT> _LOGGER.error("%s does not support the %s la... | Request TTS file from Polly. | 625941ef1f5feb6acb0c50c6 |
def connect_ports(paths, options, tree=None): <NEW_LINE> <INDENT> cmd_paths, fps = list(zip(*paths)) <NEW_LINE> pathports = [rtctree.path.parse_path(fp) for fp in fps] <NEW_LINE> for ii, p in enumerate(pathports): <NEW_LINE> <INDENT> if not p[1]: <NEW_LINE> <INDENT> if ii == 0: <NEW_LINE> <INDENT> raise rts_exceptions.... | connect_ports
This should raise exception:
>>> connect_ports([
... ('Std0.rtc', '/localhost/local.host_cxt/Std0.rtc'),
... ('Output0.rtc:out', '/localhost/local.host_cxt/Output0.rtc:out')
... ], {})
Traceback (most recent call last):
...
NoSourcePortError: No source port specified.
>>> connect_ports([
... ('St... | 625941ef55399d3f05588c34 |
def __repr__(self): <NEW_LINE> <INDENT> string = self.tab_token <NEW_LINE> string += ' |' + ('-' * self.robot.map.width) + "|" + self.tab_token <NEW_LINE> for y in range(0, self.robot.map.height): <NEW_LINE> <INDENT> temp = self.robot.map.map[y] <NEW_LINE> if self.robot.current.y == y: <NEW_LINE> <INDENT> temp = tem... | Print map to curses screen | 625941ef283ffb24f3c55e78 |
def is_empty(self): <NEW_LINE> <INDENT> return not len(self.__squeue) | judge squeue is or not empty
:return bool | 625941efeab8aa0e5d26e0d6 |
def get_weight(self): <NEW_LINE> <INDENT> return '{0} ounces'.format(self.__weight) | (Bird) -> str
Return Bird object weight | 625941ef097d151d1a2233d3 |
def OpenConferenceDialog(self): <NEW_LINE> <INDENT> self.OpenDialog('CONFERENCE') | Opens create conference dialog.
| 625941efbaa26c4b54cb1696 |
def objFunc_constrained(rhoomega, sumLogPi=0, nDoc=0, gamma=1.0, alpha=1.0, kappa=0.0, startAlphaLogPi=0.0, approx_grad=False, **kwargs): <NEW_LINE> <INDENT> assert not np.any(np.isnan(rhoomega)) <NEW_LINE> assert not np.any(np.isinf(rhoomega)) <NEW_LINE> rho, omega, K = _unpack(rhoomega) <NEW_LINE> g1 = rho * omega <N... | Returns constrained objective function and its gradient.
Args
-------
rhoomega := 1D array, size 2*K
Returns
-------
f := -1 * L(rhoomega),
where L is ELBO objective function (log posterior prob)
g := gradient of f | 625941ef76d4e153a657f0af |
def create_generators(args): <NEW_LINE> <INDENT> common_args = { 'batch_size': args.batch_size, 'image_size': args.image_size, } <NEW_LINE> if args.random_transform: <NEW_LINE> <INDENT> misc_effect = MiscEffect() <NEW_LINE> visual_effect = VisualEffect() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> misc_effect = None ... | Create generators for training and validation.
Args
args: parseargs object containing configuration for generators.
preprocess_image: Function that preprocesses an image for the network. | 625941effb3f5b602dac3c16 |
def test_jobmgr_restart_job_succeeds(self, failure_tester): <NEW_LINE> <INDENT> job = failure_tester.job(job_file="test_job_no_container.yaml") <NEW_LINE> job.create() <NEW_LINE> leader = failure_tester.fw.get_leader_info(failure_tester.jobmgr) <NEW_LINE> assert leader <NEW_LINE> assert 0 != failure_tester.fw.restart(f... | Restart job-manager leader after creating a job and verify that
the job runs to completion. | 625941ef07f4c71912b11a01 |
def test_render_node_calls_self_render(self): <NEW_LINE> <INDENT> delta = 12.1248 <NEW_LINE> context = Context({}) <NEW_LINE> node = Node("NODE") <NEW_LINE> child = Node("CHILD", parent=node) <NEW_LINE> node._render_self = Mock() <NEW_LINE> child._render_self = Mock() <NEW_LINE> node.render(delta, context) <NEW_LINE> n... | - Given: A node tree structure.
- When: Calling render on a node.
- Then: Should handle event self and children. | 625941ef29b78933be1e5c21 |
def get_model(name): <NEW_LINE> <INDENT> name = name.lower() <NEW_LINE> if name == 'randomforestclassifier': <NEW_LINE> <INDENT> return RandomForestClassifier <NEW_LINE> <DEDENT> if name == 'quadraticdiscriminantanalysis': <NEW_LINE> <INDENT> return QuadraticDiscriminantAnalysis <NEW_LINE> <DEDENT> if name == 'multinom... | Get the model constructor specified by the name given.
Args:
name (str): name of model constructor to be called.
Returns:
(callable): model constructor to be called. | 625941efe64d504609d74dbc |
def createPinCode(self, request): <NEW_LINE> <INDENT> self.send_createPinCode(request) <NEW_LINE> return self.recv_createPinCode() | Parameters:
- request | 625941efab23a570cc250704 |
def update_site_forward(apps, schema_editor): <NEW_LINE> <INDENT> Site = apps.get_model("sites", "Site") <NEW_LINE> Site.objects.update_or_create( id=settings.SITE_ID, defaults={ "domain": "example.com", "name": "OCR Receipt Scanner", }, ) | Set site domain and name. | 625941ef26068e7796caf264 |
def cmd_turn_off_feedback_loop(self, timeout=DEF_TIMEOUT): <NEW_LINE> <INDENT> if not self.cmd_turn_off_feedback_state(timeout=timeout/2): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.cmd_turn_off_integral_enable(timeout=timeout/2) | Turn off feedback loop. | 625941efa79ad161976cc6c2 |
def load_test(self): <NEW_LINE> <INDENT> dataset = dict(kl.load_dataset_raw(self._config['test-labeled'], [".txt", ".ann"], suffix="txt", encoding=self._encoding)) <NEW_LINE> dataset_part = kl.load_dataset_raw(self._config['test-unlabeled'], [".xml"], suffix="txt", encoding=self._encoding) <NEW_LINE> for key, value in ... | Set test dataset | 625941ef0a50d4780f667413 |
def make_rctx(self, rupture): <NEW_LINE> <INDENT> ctx = RuptureContext() <NEW_LINE> vars(ctx).update(vars(rupture)) <NEW_LINE> for param in self.REQUIRES_RUPTURE_PARAMETERS: <NEW_LINE> <INDENT> if param == 'mag': <NEW_LINE> <INDENT> value = rupture.mag <NEW_LINE> <DEDENT> elif param == 'strike': <NEW_LINE> <INDENT> val... | Add .REQUIRES_RUPTURE_PARAMETERS to the rupture | 625941ef6aa9bd52df037324 |
def buildTree(self, inorder, postorder): <NEW_LINE> <INDENT> if len(postorder)==0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> value = postorder[-1] <NEW_LINE> rootNode = TreeNode(value) <NEW_LINE> index = inorder.index(value) <NEW_LINE> rootNode.left = self.buildTree(inorder[:index],postorder[0:index]) <NEW_LI... | :type inorder: List[int]
:type postorder: List[int]
:rtype: TreeNode | 625941ef851cf427c661aa86 |
def printDescription(self): <NEW_LINE> <INDENT> printNow("You are in the port of " + self.name) | Prints a description of this port. | 625941ef1f037a2d8b946779 |
def reverse_to(s, t): <NEW_LINE> <INDENT> if s == 'empty': <NEW_LINE> <INDENT> return t <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return reverse_to(rest(s), link(first(s), t)) | >>> reverse(four)
[4, [3, [2, [1, 'empty']]]] | 625941efc432627299f051c7 |
def netflowAddApplication(netflowData): <NEW_LINE> <INDENT> netflowData = netflowConvertProtoStr2Num(netflowData) <NEW_LINE> for lab, row in netflowData.iterrows(): <NEW_LINE> <INDENT> srcApp = appLookup(row['srcport'],row['prot']) <NEW_LINE> dstApp = appLookup(row['dstport'],row['prot']) <NEW_LINE> if dstApp == "unkno... | Adds application data to Netflow records
Input: Netflow records as a PANDAS data frame
Output: Netflow records (with application data) as a PANDAS data frame | 625941efeab8aa0e5d26e0d7 |
def remove_program(self): <NEW_LINE> <INDENT> popup = RemoveProgramDisplay(self) <NEW_LINE> self.wait_window(popup) <NEW_LINE> self.master.load_programs() <NEW_LINE> entries = self.get_todays_time_entries() <NEW_LINE> self.main_time.update_attrs(*self.calculate_timedelta(entries)) <NEW_LINE> self.main_time.update_time(... | Opens a new window where you can remove a program | 625941ef66656f66f7cbc729 |
def on_epoch_end (self, epoch, logs=None): <NEW_LINE> <INDENT> images = WeightWriter.model_weights_to_images (self.model) <NEW_LINE> for name, image in images: <NEW_LINE> <INDENT> save_image (join (self.dir, ".".join ([name, str (epoch).zfill (4), "png"])), image) | Calls model_weights_to_images and writes the images to
self.dir\<layer_name>_<epoch number>.png | 625941ef30c21e258bdfaa20 |
def _get_predict(self, x): <NEW_LINE> <INDENT> fisher_vec = fv.fisher_features(x, self.clusterer) <NEW_LINE> print (fisher_vec.shape) <NEW_LINE> return self.normalize(fisher_vec) | Returns histogram of codewords for given features
x.shape = [n_descriptor, dscpt_dimension] | 625941ef0a50d4780f667414 |
def minimum(x, y, name=None): <NEW_LINE> <INDENT> result = _op_def_lib.apply_op("Minimum", x=x, y=y, name=name) <NEW_LINE> return result | Returns the min of x and y (i.e. x < y ? x : y) element-wise, broadcasts.
Args:
x: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`.
y: A `Tensor`. Must have the same type as `x`.
name: A name for the operation (optional).
Returns:
A `Tensor`. Has the same type as... | 625941eff8510a7c17cf9c7d |
def handlePerformanceSettings(self): <NEW_LINE> <INDENT> import FWCore.ParameterSet.Config as PSetConfig <NEW_LINE> if getattr(self.step.data.application.command, 'silentMemoryCheck', False): <NEW_LINE> <INDENT> self.process.add_(PSetConfig.Service("SimpleMemoryCheck", jobReportOutputOnly=PSetConfig.untracked.bool(True... | _handlePerformanceSettings_
Install the standard performance report services | 625941ef30dc7b7665901edc |
def ROMS_CV(varname, RomsFile, Mask): <NEW_LINE> <INDENT> RomsNC = nc4(RomsFile, 'r') <NEW_LINE> Var = np.ma.array(RomsNC.variables[varname][:], mask = Mask) <NEW_LINE> return Var | Load variable and apply mask | 625941ef5f7d997b8717501a |
def meshgrid(self, args=(), args_y=((), (), ())): <NEW_LINE> <INDENT> if args == (): <NEW_LINE> <INDENT> args = self.meshgrid_args <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.meshgrid_args = args <NEW_LINE> <DEDENT> self.x, self.y, self.testpoints = ipb.meshgrid(args, args_y) <NEW_LINE> self.flag_points_inside(s... | meshgrid computes x, y, pp(points plot), p(points computation) (pp is p by default) | 625941ef711fe17d825428db |
def is_opened(self, dir_path: str, mode: str, encode=None): <NEW_LINE> <INDENT> if encode is None: <NEW_LINE> <INDENT> encode = 'utf_8' <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> with codecs.open(r'{}'.format(dir_path), mode=mode, encoding=encode) as file: <NEW_LINE> <INDENT> for line in file: <NEW_LINE> <INDENT> pas... | ファイルがオープンできるかどうかの検査用メソッド.
:param dir_path: ディレクトリパス.
:param mode: オープンモード.
:param encode: 文字エンコーディング. | 625941effbf16365ca6f674d |
def get_ip_interface_output_interface_ip_address_broadcast(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> get_ip_interface = ET.Element("get_ip_interface") <NEW_LINE> config = get_ip_interface <NEW_LINE> output = ET.SubElement(get_ip_interface, "output") <NEW_LINE> interface = ET.SubEleme... | Auto Generated Code
| 625941ef187af65679ca569d |
def encoder(tparams, layer0_input, filter_shape, pool_size, prefix='cnn_encoder'): <NEW_LINE> <INDENT> conv_out = conv.conv2d(input=layer0_input, filters=tparams[_p(prefix,'W')], filter_shape=filter_shape) <NEW_LINE> conv_out_tanh = tensor.tanh(conv_out + tparams[_p(prefix,'b')].dimshuffle('x', 0, 'x', 'x')) <NEW_LINE>... | filter_shape: (number of filters, num input feature maps, filter height,
filter width)
image_shape: (batch_size, num input feature maps, image height, image width) | 625941ef236d856c2ad44d5f |
def _expandsets(kindpats, ctx, listsubrepos): <NEW_LINE> <INDENT> fset = set() <NEW_LINE> other = [] <NEW_LINE> for kind, pat, source in kindpats: <NEW_LINE> <INDENT> if kind == 'set': <NEW_LINE> <INDENT> if not ctx: <NEW_LINE> <INDENT> raise error.Abort("fileset expression with no context") <NEW_LINE> <DEDENT> s = ctx... | Returns the kindpats list with the 'set' patterns expanded. | 625941ef07d97122c4178e16 |
def _formatter_for_name(self, name): <NEW_LINE> <INDENT> if self._is_xml: <NEW_LINE> <INDENT> return self.XML_FORMATTERS.get(name, XMLFormatter()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.HTML_FORMATTERS.get(name, HTMLFormatter()) | Look up a formatter function based on its name and the tree. | 625941ef627d3e7fe0d693ce |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.