code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def main(): <NEW_LINE> <INDENT> buildspec_path = os.path.dirname(__file__) <NEW_LINE> input_file = io.open(buildspec_path + '/buildspec.yml') <NEW_LINE> buildspec = yaml.load(input_file, Loader=Loader) <NEW_LINE> buildenv = os.environ <NEW_LINE> try: <NEW_LINE> <INDENT> for var in buildspec['env']['variables']: <NEW_LI... | Entrypoint
Store alongside your buildspec.yml, run from the root of your project | 625941d6fb3f5b602dac38da |
def list_events(db, start=None, end=None): <NEW_LINE> <INDENT> scoped = start and end <NEW_LINE> event_ids = db.lrange("events", 0, -1) <NEW_LINE> events = [] <NEW_LINE> for event_id in event_ids: <NEW_LINE> <INDENT> namespace = "events:%s" % event_id <NEW_LINE> date = int(db.get("%s:date" % namespace)) <NEW_LINE> if n... | returns a list of events, optionally limited to a time frame
both start and end date are ISO-8601-like integers | 625941d6ab23a570cc2503c8 |
def get_bot(): <NEW_LINE> <INDENT> if not _bot: <NEW_LINE> <INDENT> initialize_bot() <NEW_LINE> <DEDENT> return _bot | Gets the already instantiated Telegram client
:return: Telegram client instance
:rtype: telegram.Bot | 625941d68a43f66fc4b542a8 |
def get_url(end): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return url_for(end) <NEW_LINE> <DEDENT> except BuildError: <NEW_LINE> <INDENT> return None | Returns the URL if possible.
URL's that require additional arguments, like /static/<file> cannot be retrieved.
:param end: the endpoint for the url.
:return: the url_for(end) or None, | 625941d6d53ae8145f87a4b2 |
def entrada_usuario(): <NEW_LINE> <INDENT> entrada = input('Deseja ler (r) ou escrever (w) o arquivo? ') <NEW_LINE> if entrada == 'r': <NEW_LINE> <INDENT> read('desafio-ibge.csv') <NEW_LINE> <DEDENT> elif entrada == 'w': <NEW_LINE> <INDENT> write('desafio-ibge.csv', 'desafio-ibge.txt') <NEW_LINE> <DEDENT> else: <NEW_LI... | Somente uma função para pegar a entrada do usuário | 625941d626068e7796caef26 |
def __str__(self): <NEW_LINE> <INDENT> return self.str_data | String identifiying current object | 625941d6bf627c535bc13414 |
def map_plot(ds, var=None, time=0, title_str='No title', projection='kav7', lon_0=0, resolution=None, **kwargs): <NEW_LINE> <INDENT> if isinstance(time, int): <NEW_LINE> <INDENT> res = ds[var].isel(time=time) <NEW_LINE> <DEDENT> elif time is None: <NEW_LINE> <INDENT> res = ds[var] <NEW_LINE> time = None <NEW_LINE> <DED... | Function plotting a projected map for a variable **var** in `xarray.Dataset`_ **ds**.
:param ds: an `xarray.Dataset`_
:param var: variable to plot
:param time: time step or datetime date to plot
:param title_str: Title string
:param projection: for Basemap
:param lon_0: longitude 0 for central
:param resolution: resol... | 625941d657b8e32f524836e1 |
def move(self, reference_item, relative_position): <NEW_LINE> <INDENT> method = getattr(self._conn, "move_%s" % self.datatype) <NEW_LINE> if reference_item: <NEW_LINE> <INDENT> resp = method(self.id, relative_position, reference_item.id) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> resp = method(self.id, {"reference_i... | Moves the item to location relative to the reference_item;
relative_position can have one of 3 values: into, before, after;
conn is LinkClient object | 625941d66fece00bbac2d985 |
def format_transcripts(self, transcripts, **kwargs): <NEW_LINE> <INDENT> return self.format_transcript(transcripts, **kwargs) | Converts a list of transcripts into a JSON string.
:param transcripts:
:return: A JSON string representation of the transcript.'
:rtype str | 625941d663f4b57ef0001359 |
def assets(self, member_name): <NEW_LINE> <INDENT> current = self.somelist.front <NEW_LINE> while (current.name != member_name and current is not None): <NEW_LINE> <INDENT> current = current.next_ <NEW_LINE> <DEDENT> return current.assets | Return the assets of member with name member_name.
:type self: Network
:type member_name: str
Name of the member
:rtype: str
>>> network = Network()
>>> network.load_log("topology1.txt")
>>> member_name = "Sophia"
>>> print(member_name + "'s asset is " + str(network.assets(member_name)))
Sophia's asset is 5 | 625941d666673b3332b922d6 |
def with_comprehensive_theme(theme_dir_name): <NEW_LINE> <INDENT> def _decorator(func): <NEW_LINE> <INDENT> @wraps(func) <NEW_LINE> def _decorated(*args, **kwargs): <NEW_LINE> <INDENT> domain = "{theme_dir_name}.org".format(theme_dir_name=re.sub(r"\.org$", "", theme_dir_name)) <NEW_LINE> site, __ = Site.objects.get_or_... | A decorator to run a test with a comprehensive theming enabled.
Arguments:
theme_dir_name (str): directory name of the site for which we want comprehensive theming enabled. | 625941d6cdde0d52a9e53279 |
def parse_arguments(): <NEW_LINE> <INDENT> global args <NEW_LINE> parser = argparse.ArgumentParser(description='Convert png to json file') <NEW_LINE> parser.add_argument('-i', '--input', action="store", dest="input_filename", type=str, required=True) <NEW_LINE> parser.add_argument('-o', '--output', action="store", dest... | Parse arguments provided
return: None | 625941d676e4537e8c3518b9 |
def list_routes_table_summary( self, resource_group_name, circuit_name, peering_name, device_path, custom_headers=None, raw=False, polling=True, **operation_config): <NEW_LINE> <INDENT> raw_result = self._list_routes_table_summary_initial( resource_group_name=resource_group_name, circuit_name=circuit_name, peering_name... | Gets the currently advertised routes table summary associated with the
express route circuit in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param circuit_name: The name of the express route circuit.
:type circuit_name: str
:param peering_name: The name ... | 625941d63346ee7daa2b2fb1 |
def run_migrations_offline(): <NEW_LINE> <INDENT> url = configuration.get('core', 'SQL_ALCHEMY_CONN') <NEW_LINE> context.configure( url=url, target_metadata=target_metadata, literal_binds=True, compare_type=COMPARE_TYPE) <NEW_LINE> with context.begin_transaction(): <NEW_LINE> <INDENT> context.run_migrations() | Run migrations in 'offline' mode.
This configures the context with just a URL
and not an Engine, though an Engine is acceptable
here as well. By skipping the Engine creation
we don't even need a DBAPI to be available.
Calls to context.execute() here emit the given string to the
script output. | 625941d626068e7796caef27 |
def Execute(self, algorithm, targets): <NEW_LINE> <INDENT> pass | Execute(self: ImmediateExecutionModel, algorithm: QCAlgorithm, targets: Array[IPortfolioTarget])
Immediately submits orders for the specified
portfolio targets.
algorithm: The algorithm instance
targets: The portfolio targets to be ordered | 625941d6236d856c2ad44a21 |
def hypothesis(self, theta, Xtrain): <NEW_LINE> <INDENT> return np.dot(Xtrain, theta) | Return multiplication of two matrices: theta and X features. | 625941d6ad47b63b2c50a1c4 |
def on_running(self, **kwargs): <NEW_LINE> <INDENT> ydatas = kwargs['ydatas'] <NEW_LINE> xdata = kwargs['xdata'] <NEW_LINE> info = kwargs['info'] <NEW_LINE> additional = kwargs['additional'] <NEW_LINE> feed = {} <NEW_LINE> for i, label in enumerate(self.labels): <NEW_LINE> <INDENT> feed[self.d[label]] = ydatas[i] <NEW_... | Feed placeholder and variables with values provided.
:param ydatas: the value to feed in. Must be in the
same order than labels list provided in on_launch.
:param xdata: the xdata to plot in x axis (basically t)
:param info: random text to show. | 625941d6b57a9660fec33acc |
def geocoding(point): <NEW_LINE> <INDENT> return gmaps.geocode(point)[0]['geometry']['location'] | réalise un appel à google maps pour connaitre les coordonnées d'un point | 625941d65fcc89381b1e1906 |
def update_email_flow(self, storefront_oid, email_flow_uuid, email_flow, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.update_email_flow_with_http_info(storefront_oid, email_flow_uuid, email_flow, **kwargs) <NEW_LINE> <DEDEN... | Update email flow # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_email_flow(storefront_oid, email_flow_uuid, email_flow, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int storefron... | 625941d650485f2cf553cfe0 |
def set_signal_handler(self): <NEW_LINE> <INDENT> signal.signal(signal.SIGPWR, self.abort) | Abort the execution upon receiving a signal from perfrunner. | 625941d62ae34c7f2600d376 |
def all_ilvl_parses_df(raidnights): <NEW_LINE> <INDENT> bosses = [] <NEW_LINE> players = set() <NEW_LINE> lockouts = set() <NEW_LINE> for raidnight in raidnights: <NEW_LINE> <INDENT> lockouts.add(raidnight.get_raid_lockout_period()) <NEW_LINE> for fight_name in raidnight.parse_scrapes.keys(): <NEW_LINE> <INDENT> if fig... | Looks through the given raidnights, and returns a dataframe containing all dps players and their ilvl parses for each boss
Parameters:
raidnights (list of RaidnightData objects)
Returns:
pandas dataframe, rows are players, columns are bosses, entries are ilvl parses | 625941d64527f215b584c69a |
def evaluate(self, fields=None, u=None, v=None, w=None): <NEW_LINE> <INDENT> def Arg(p, U, u): <NEW_LINE> <INDENT> u = np.asarray(u, dtype='d') <NEW_LINE> assert u.min() >= U[p] <NEW_LINE> assert u.max() <= U[-p-1] <NEW_LINE> return u <NEW_LINE> <DEDENT> dim = self.dim <NEW_LINE> uvw = [u,v,w][:dim] <NEW_LINE> for i, a... | Parameters
----------
fields : array_like, optional
u, v, w : float or array_like | 625941d65510c4643540f625 |
def currentPage(self): <NEW_LINE> <INDENT> return QWizardPage | QWizard.currentPage() -> QWizardPage | 625941d6b545ff76a891405b |
def batch_dataset_v2_eager_fallback(input_dataset, batch_size, drop_remainder, output_types, output_shapes, name=None, ctx=None): <NEW_LINE> <INDENT> _ctx = ctx if ctx else _context.context() <NEW_LINE> if not isinstance(output_types, (list, tuple)): <NEW_LINE> <INDENT> raise TypeError( "Expected list for 'output_types... | This is the slowpath function for Eager mode.
This is for function batch_dataset_v2 | 625941d6fff4ab517eb2f682 |
def which(N): <NEW_LINE> <INDENT> if N==2: <NEW_LINE> <INDENT> ncvec=[1,2,5,10] <NEW_LINE> <DEDENT> elif N==4: <NEW_LINE> <INDENT> ncvec=[1,2,3,4,5,6,7,8] <NEW_LINE> <DEDENT> elif N==8: <NEW_LINE> <INDENT> ncvec=[1,2,3,4] <NEW_LINE> <DEDENT> elif N==16: <NEW_LINE> <INDENT> ncvec=[1,2,3] <NEW_LINE> <DEDENT> elif N==32: ... | Define lists of accessible cutoffs, for each N. | 625941d6435de62698dfde92 |
def _picture_change(self, xmol, even_operator=(None, None), odd_operator=None): <NEW_LINE> <INDENT> c = lib.param.LIGHT_SPEED <NEW_LINE> v_op, w_op = even_operator <NEW_LINE> if isinstance(v_op, str): <NEW_LINE> <INDENT> v_op = xmol.intor(v_op) <NEW_LINE> <DEDENT> if isinstance(w_op, str): <NEW_LINE> <INDENT> w_op = xm... | Picture change for even_operator + odd_operator
even_operator has two terms at diagonal blocks
[ v 0 ]
[ 0 w ]
odd_operator has the term at off-diagonal blocks
[ 0 p ]
[ p^T 0 ]
v, w, and p can be strings (integral name) or matrices. | 625941d624f1403a92600daa |
def current_flow_closeness_centrality(G, weight='weight', dtype=float, solver='lu'): <NEW_LINE> <INDENT> from networkx.utils import reverse_cuthill_mckee_ordering <NEW_LINE> import numpy as np <NEW_LINE> import scipy <NEW_LINE> if G.is_directed(): <NEW_LINE> <INDENT> raise nx.NetworkXError( "current_flow_closeness_cent... | Compute current-flow closeness centrality for nodes.
A variant of closeness centrality based on effective
resistance between nodes in a network. This metric
is also known as information centrality.
Parameters
----------
G : graph
A NetworkX graph
dtype: data type (float)
Default data type for internal matrices.... | 625941d6d4950a0f3b08c592 |
def click_number_plan_upload_cancel_button(self): <NEW_LINE> <INDENT> number_plan_upload_cancel_button_element = self.wait().until(EC.element_to_be_clickable(self.number_plan_upload_cancel_button_locator), 'number plan upload cancel button locator not found before specified time out') <NEW_LINE> number_plan_upload_canc... | Implementing click number plan upload cancel button functionality
:return: | 625941d6d7e4931a7ee9e163 |
def _handler_command_get(self, params=None, *args, **kwargs): <NEW_LINE> <INDENT> next_state = None <NEW_LINE> result = None <NEW_LINE> result_vals = {} <NEW_LINE> if (params == DriverParameter.ALL): <NEW_LINE> <INDENT> params = [Parameter.MAXRATE] <NEW_LINE> <DEDENT> if ((params == None) or (not isinstance(params, lis... | Handle getting data from command mode
@param params List of the parameters to pass to the state
@retval return (next state, result)
@throw InstrumentProtocolException For invalid parameter | 625941d6cb5e8a47e48b7ced |
def set_stream(self, sname, sfile=None, evmask=0, retain=True, closefd=True): <NEW_LINE> <INDENT> engfile = dict.setdefault(self, sname, EngineClientStream(sname)) <NEW_LINE> engfile.set_file(sfile, evmask, retain, closefd) <NEW_LINE> return engfile | Set stream based on file object or file descriptor.
This method can be used to add a stream or update its
parameters. | 625941d6d486a94d0b98e38c |
def request_rider(self, driver): <NEW_LINE> <INDENT> if self.wait_rd.is_empty(): <NEW_LINE> <INDENT> self.avail_dr.add(driver) <NEW_LINE> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.wait_rd.remove() | Return a rider for the driver, or None if no rider is available.
If this is a new driver, register the driver for future rider requests.
@type self: Dispatcher
@type driver: Driver
@rtype: Rider | None
>>> dis = Dispatcher()
>>> dis2 = Dispatcher()
>>> dis3 = Dispatcher()
>>> rd = Rider("Lola", Location(0, 0), Locat... | 625941d6498bea3a759b9cf4 |
def entropy(self, label_ind, data): <NEW_LINE> <INDENT> val_set, counts = self.count_unique(data[:, label_ind]) <NEW_LINE> total_entries = len(data[:, label_ind]) <NEW_LINE> val_freqs = counts / total_entries <NEW_LINE> return (-val_freqs * np.log2(val_freqs)).sum() | Calculate data entropy under the given label.
label_ind: column index representing the selected label in data
data: dataset (with the last column being the target column) | 625941d60fa83653e46571ff |
def _sort_list(self, name, items): <NEW_LINE> <INDENT> def by_length(word1, word2): <NEW_LINE> <INDENT> return len(word2) - len(word1) <NEW_LINE> <DEDENT> if "lists" not in self._sorted: <NEW_LINE> <INDENT> self._sorted["lists"] = {} <NEW_LINE> <DEDENT> self._sorted["lists"][name] = [] <NEW_LINE> track = {} <NEW_LINE> ... | Sort a simple list by number of words and length. | 625941d623849d37ff7b32d3 |
def testCorrectConfigTypeIndex(self): <NEW_LINE> <INDENT> type_order = ( 'type1', 'donkey-type2', 'kong-type3') <NEW_LINE> for index, config_type in enumerate(type_order): <NEW_LINE> <INDENT> config = '-'.join(['pre-fix', config_type]) <NEW_LINE> self.assertEquals( cbuildbot_config.GetDisplayPosition( config, type_orde... | Test that the correct build suffix index is returned. | 625941d64e4d5625662d461b |
def __init__(self, capacity): <NEW_LINE> <INDENT> self.l = capacity <NEW_LINE> self.history = [] <NEW_LINE> self.map = {} | :type capacity: int | 625941d6009cb60464c635f6 |
def import_from_string(val): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> from django.utils import importlib <NEW_LINE> parts = val.split('.') <NEW_LINE> module_path, class_name = '.'.join(parts[:-1]), parts[-1] <NEW_LINE> module = importlib.import_module(module_path) <NEW_LINE> return getattr(module, class_name) <NEW_... | Attempt to import a class from a string representation. | 625941d6091ae356686671a1 |
def name(self): <NEW_LINE> <INDENT> return 'identifysmallholes' | Returns the algorithm name, used for identifying the algorithm. This
string should be fixed for the algorithm, and must not be localised.
The name should be unique within each provider. Names should contain
lowercase alphanumeric characters only and no spaces or other
formatting characters. | 625941d64e696a04525c9691 |
@user.route('/info', methods=['POST', 'GET']) <NEW_LINE> def info(): <NEW_LINE> <INDENT> g.user = User() <NEW_LINE> form = SettingForm() <NEW_LINE> g.user.is_login() <NEW_LINE> form.username = g.user.username <NEW_LINE> form.password = g.user.password <NEW_LINE> form.email = g.user.email <NEW_LINE> return render_templa... | 显示用户信息方法
| 625941d644b2445a339322da |
def feasibility(self): <NEW_LINE> <INDENT> pass | ROUTINE:
feasibility()
PURPOSE:
Return the feasibility version of the MIP model.
ARGUMENTS:
None.
RETURN VALUE:
A copy of the given model with a cancelled objective function.
EXAMPLE:
feasibility = model.feasibility()
feasibility.optimize() | 625941d629b78933be1e58ee |
def addWord(self, word): <NEW_LINE> <INDENT> node = self.root <NEW_LINE> for c in word: <NEW_LINE> <INDENT> id = ord(c)-ord('a') <NEW_LINE> if node.abc[id] == None: <NEW_LINE> <INDENT> node.abc[id] = Node() <NEW_LINE> <DEDENT> node = node.abc[id] <NEW_LINE> <DEDENT> node.end = True | Adds a word into the data structure.
:type word: str
:rtype: void | 625941d666656f66f7cbc3f2 |
def test_is_http(self): <NEW_LINE> <INDENT> result = app.getProtocolBool('http://www.google.com/') <NEW_LINE> self.assertEqual(True, result) | Returns true that the given URI is http | 625941d6442bda511e8be65b |
def to_dict(self): <NEW_LINE> <INDENT> new_dict = {k: v for k, v in self.__dict__.items()} <NEW_LINE> new_dict['subject'] = self.subject <NEW_LINE> if not self.text and not self.html: <NEW_LINE> <INDENT> new_dict['text'] = ' ' <NEW_LINE> <DEDENT> return new_dict | Convenience method: Return this instance as a dict.
Note:
Most providers follow the same name convention than the
one we use. This method avoids a bit of boilerplate code
in the providers' mapping.
We leave out the recipients and the 'From', as the format often diverge
Returns:
dict | 625941d6a17c0f6771cbe295 |
def test_lan_02(self): <NEW_LINE> <INDENT> search_keyword = "Verify that IPv4 deny src IP to dest IP is workable." <NEW_LINE> print ("e2") | tttt | 625941d6bd1bec0571d90875 |
def read_from(url, force=False): <NEW_LINE> <INDENT> with open_url(url, force) as localfile: <NEW_LINE> <INDENT> return localfile.read() | Read url from cache or remote. | 625941d663b5f9789fde732b |
def test_query_readings_from_database_success(self): <NEW_LINE> <INDENT> self.reading_manager = TemperatureReadingManager('sqlite:///test_readings.sqlite') <NEW_LINE> self.reading_manager.add_reading_to_database("2018-10-01 01:01:01.011", "Test Sensor", 25.1, 22.1, 24.1, "GOOD") <NEW_LINE> self.reading_manager.add_read... | 050A - Find all Temperature in database | 625941d65e10d32532c5f16c |
def test_correctness(self): <NEW_LINE> <INDENT> for i in range(4): <NEW_LINE> <INDENT> asn, prefix = self.asndb_fake.lookup("1.0.0.%d" % i) <NEW_LINE> self.assertEqual(1, asn) <NEW_LINE> self.assertEqual("1.0.0.0/30", prefix) <NEW_LINE> <DEDENT> for i in range(4, 256): <NEW_LINE> <INDENT> asn, prefix = self.asndb_fake.... | Tests if pyasn returns the correct AS number with simple data base | 625941d673bcbd0ca4b2c2bc |
def get_gmix(self): <NEW_LINE> <INDENT> return GMix(self.get_dlist()) | Get a GMix object representing the result | 625941d6eab8aa0e5d26dd9e |
@pytest.mark.tier2 <NEW_LINE> @pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url') <NEW_LINE> def test_positive_delete_key_for_repo_from_product_with_repo(session, module_org, gpg_content): <NEW_LINE> <INDENT> gpg_key = entities.GPGKey(content=gpg_content, organization=mod... | Create gpg key with valid name and valid gpg key then
associate it to repository from custom product that has one repository
then delete the key
:id: 92ba492e-79af-48fe-84cb-763102b42fa7
:expectedresults: gpg key is associated with single repository during
creation but removed from repository after deletion
:Cas... | 625941d6cdde0d52a9e5327a |
def run_server(): <NEW_LINE> <INDENT> if topic_check.topic_exists("TURNSTILE_SUMMARY") is False: <NEW_LINE> <INDENT> logger.fatal( "Ensure that the KSQL Command has run successfully before running the web server!" ) <NEW_LINE> exit(1) <NEW_LINE> <DEDENT> if topic_check.topic_pattern_match("faust.stations.transformed") ... | Runs the Tornado Server and begins Kafka consumption | 625941d656b00c62f0f148a0 |
def popitem(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.statistics.popitem() <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise KeyError('No keys found in mapping.') | Remove and return an item pair from mapping.
Raise KeyError is data is empty. | 625941d6656771135c3ebab6 |
def getGraph(self): <NEW_LINE> <INDENT> return self._graph | Returns the world._graph instance | 625941d632920d7e50b28418 |
@adapter(IProcessStarting) <NEW_LINE> def start_timelogging(unused): <NEW_LINE> <INDENT> from App.config import getConfiguration <NEW_LINE> config = getConfiguration().product_config.get('timelogging') <NEW_LINE> if config is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> global _logfile <NEW_LINE> _logfile = Rot... | start timelogging if configured. | 625941d6379a373c97cfad8b |
def list_roles(self, *, accept_language: str = None, account_id: str = None, service_name: str = None, source_service_name: str = None, policy_type: str = None, **kwargs ) -> DetailedResponse: <NEW_LINE> <INDENT> headers = { 'Accept-Language': accept_language } <NEW_LINE> sdk_headers = get_sdk_headers(service_name=self... | Get roles by filters.
Get roles based on the filters. While managing roles, you may want to retrieve
roles and filter by usages. This can be done through query parameters. Currently,
we only support the following attributes: account_id, service_name,
source_service_name and policy_type. Only roles that match the filte... | 625941d607d97122c4178ad5 |
def set_processor_affinity(self, *args, **kwargs): <NEW_LINE> <INDENT> return _mimo_swig.ofdm_demapper_sptr_set_processor_affinity(self, *args, **kwargs) | set_processor_affinity(ofdm_demapper_sptr self, std::vector< int,std::allocator< int > > const & mask) | 625941d6dd821e528d63b3ee |
def expire(self): <NEW_LINE> <INDENT> past = datetime.datetime.utcnow() - datetime.timedelta(hours=1) <NEW_LINE> past = pytz.timezone("UTC").localize(past) <NEW_LINE> self.eol_datetime = past <NEW_LINE> self.save() | Set a given temporary file as expired | 625941d6796e427e537b080d |
def __init__(self, busName, module): <NEW_LINE> <INDENT> dbus.service.Object.__init__(self, busName, '/') | Constructor | 625941d65fc7496912cc3bc4 |
def testCIMCollectorAttribute(self): <NEW_LINE> <INDENT> pass | Test CIMCollectorAttribute | 625941d697e22403b379d1e1 |
def calculate_model_expectation_mbar(W, b_v, b_h, samples_v, samples_h): <NEW_LINE> <INDENT> num_visible_units = len(b_v) <NEW_LINE> num_hidden_units = len(b_h) <NEW_LINE> assert(num_visible_units == W.shape[0]) <NEW_LINE> assert(num_hidden_units == W.shape[1]) <NEW_LINE> num_samples = samples_v.shape[0] <NEW_LINE> ass... | calcualte the model expection of <v_i*h_j> using MBAR approach | 625941d691f36d47f21ac73a |
def refresh(self, totalPoints, totalExp, newEvents): <NEW_LINE> <INDENT> from debug_utils import LOG_DEBUG <NEW_LINE> LOG_DEBUG('ECOVIEW: BattleLogSource: new events {0}, bp {1}, mp {2}'.format(len(newEvents), totalPoints, totalExp)) <NEW_LINE> for event in newEvents: <NEW_LINE> <INDENT> self._model.battleEvent = event... | @param totalPoints: int
@param newEvents: list()
look ClientEconomics.onEconomicEvents() for parameters of each event | 625941d6dc8b845886cb577c |
def make_row_format(config, genome, args): <NEW_LINE> <INDENT> if args.is_custom_ranges_list(): <NEW_LINE> <INDENT> if args.get_binding_site_list(): <NEW_LINE> <INDENT> return CustomRangesBindingLSiteListRowFormat(config, genome, args) <NEW_LINE> <DEDENT> elif args.get_include_all(): <NEW_LINE> <INDENT> return CustomRa... | Based on config, genome and args create a RowFormat object
:param config: config.Config: system wide configuration
:param genome: str: name of the genome
:param args: SearchArgs: settings used to determine which RowFormat class to create
:return: object with get_headers and make_rows methods | 625941d6004d5f362079a578 |
def __getitem__(self, *args): <NEW_LINE> <INDENT> return _fife.AnimationOverlayMap___getitem__(self, *args) | __getitem__(AnimationOverlayMap self, std::map< int,FIFE::SharedPtr< FIFE::Animation > >::key_type const & key) -> SharedAnimationPointer | 625941d6be8e80087fb20e87 |
def feature_label_encoder(self, data): <NEW_LINE> <INDENT> categorical_columns = [ 'grade', 'sub_grade', 'home_ownership', 'verification_status', 'pymnt_plan', 'loan_status', 'purpose', 'initial_list_status'] <NEW_LINE> category_feaure = data[categorical_columns].apply(LabelEncoder().fit_transform) <NEW_LINE> return ca... | LabelEncoder | 625941d6de87d2750b85ffda |
def month_avg_price(rows): <NEW_LINE> <INDENT> dict = {} <NEW_LINE> tuple= () <NEW_LINE> dictCount = {} <NEW_LINE> with open('mustard_data.csv', 'r') as csv_file: <NEW_LINE> <INDENT> csv_reader = csv.reader(csv_file) <NEW_LINE> next(csv_reader) <NEW_LINE> for line in csv_reader: <NEW_LINE> <INDENT> date =line[0] <NEW_L... | Return a dictionary containing the average price per gallon as a float (values) for each
month of the year (keys).
The dictionary you return should have 12 entries, with full month names as keys, and floats as
values. For example:
{ "January": 3.12, "February": 2.89, ... }
See:
https://docs.python.org/3/libra... | 625941d6fbf16365ca6f640c |
@login_required <NEW_LINE> def my_account_order_history(request, user_id): <NEW_LINE> <INDENT> buyer_id = request.user <NEW_LINE> try: <NEW_LINE> <INDENT> sql = '''SELECT * FROM website_order WHERE buyer_id = %s and paymentType_id IS NOT NULL''' <NEW_LINE> orders = Order.objects.raw(sql, [buyer_id.customer.id]) <NEW_LI... | view order history of current user | 625941d6cad5886f8bd2721f |
def test_opearte_on_same_bin_negative(self): <NEW_LINE> <INDENT> key = ('test', 'demo', 1) <NEW_LINE> policy = {'timeout': 5000} <NEW_LINE> llist = [ {"op": aerospike.OPERATOR_PREPEND, "bin": "name", "val": "ram"}, {"op": aerospike.OPERATOR_APPEND, "bin": "name", "val": "aa"}, {"op": aerospike.OPERATOR_INCR, "bin": "ag... | Invoke operate() on same bin | 625941d6460517430c3943c7 |
def new_url(**kwargs): <NEW_LINE> <INDENT> url_base = "/axapi/v3/web-service/secure" <NEW_LINE> f_dict = {} <NEW_LINE> return url_base.format(**f_dict) | Return the URL for creating a resource | 625941d6a219f33f34628bad |
def __init__(self, parent): <NEW_LINE> <INDENT> Renderable.__init__(self, parent) <NEW_LINE> if parent: <NEW_LINE> <INDENT> self.parent.putChild(self.name, self) <NEW_LINE> <DEDENT> Resource.__init__(self) <NEW_LINE> self.client = None <NEW_LINE> self.config.templateStore.register(self) | Initialize | 625941d64e696a04525c9692 |
def isDirExists(self,dir): <NEW_LINE> <INDENT> result = self.client.listDirectory(dir) <NEW_LINE> if result['OK'] and result['Value']['Successful']: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False | check whether dir on DFC exists | 625941d631939e2706e4d0ae |
def recognize_haproxy_proxy(self, proxy_name): <NEW_LINE> <INDENT> return self.haproxy_proxy_matcher.match(proxy_name) is not None | Checks whether haproxy proxy corresponds to this service.
Args:
proxy_name: A string, name of proxy as it's shown in haproxy stats.
Returns:
True if proxy_name corresponds to this service, False otherwise. | 625941d676d4e153a657ed78 |
def setDropOffFactor(self, factor): <NEW_LINE> <INDENT> raise NotImplementedError() | Exaggerate or diminish the effect of distance on sound. Default is 1.0
Valid range is 0 to 10
Faster drop off, use >1.0
Slower drop off, use <1.0 | 625941d6e5267d203edcdee1 |
def selection_desc(data): <NEW_LINE> <INDENT> for i in range(0, len(data) - 1): <NEW_LINE> <INDENT> greatest = i <NEW_LINE> for j in range(i + 1, len(data)): <NEW_LINE> <INDENT> if data[j] > data[greatest]: <NEW_LINE> <INDENT> greatest = j <NEW_LINE> <DEDENT> <DEDENT> data[i], data[greatest] = data[greatest], data[i] <... | Selection Sort Descending Order | 625941d6099cdd3c635f0ea1 |
def testFilteredLogs1(self): <NEW_LINE> <INDENT> block_id = "test-3" <NEW_LINE> block_dict = {'args': { 'name': 'perl', } } <NEW_LINE> expected_dict = {'name': 'perl'} <NEW_LINE> result = pkg.get_filtered_params_to_log(block_id, block_dict, {}) <NEW_LINE> self.assertDictEqual(expected_dict, result) | Check filtered logs output | 625941d6f548e778e58cd7c5 |
def dump(df, fp): <NEW_LINE> <INDENT> if 'images' in df.columns: <NEW_LINE> <INDENT> del df['images'] <NEW_LINE> <DEDENT> covlist = df.columns <NEW_LINE> mat = ['/NumWaves %s' % len(covlist)] <NEW_LINE> mat.append('/NumPoints %s' % len(df)) <NEW_LINE> mat.append('/Matrix') <NEW_LINE> for row_index, row in df.iterrows()... | Converts a design matrix from pandas DataFrame to a TBSS-ready .mat
file. | 625941d6442bda511e8be65c |
def listUsers(self): <NEW_LINE> <INDENT> return self._client.listUsers() | Returns a list of names of all the users that have been defined. | 625941d62eb69b55b151caf8 |
def curr_occur(text): <NEW_LINE> <INDENT> out_dic = {c:0 for c in curr_lis} <NEW_LINE> for curr in curr_lis: <NEW_LINE> <INDENT> out_dic[curr] += text.count(' '+curr+' ') <NEW_LINE> <DEDENT> for combo in combo_lis: <NEW_LINE> <INDENT> if combo in text: <NEW_LINE> <INDENT> out_dic[combo[:3]] += text.count(combo) <NEW_LI... | Returns a dictionary of {CURR: num},
where num is the count of occurences of curr in the text | 625941d721a7993f00bc7f39 |
def read(self, input, name=None): <NEW_LINE> <INDENT> if isinstance(input, list): <NEW_LINE> <INDENT> outputs = [] <NEW_LINE> shards = len(input) <NEW_LINE> for shard in xrange(shards): <NEW_LINE> <INDENT> format = input[shard].format <NEW_LINE> if type(format) == str: format = Format(format) <NEW_LINE> if format == No... | Add readers for input resource(s). The format of the input resource is
used for selecting an appropriate reader task for the format. | 625941d7aad79263cf390c8a |
def volume_set_metadata(self, volume_id, metadata): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._ci_drv.volumes.set_metadata(volume_id, metadata) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> self.log.error("Set metadata operation failed. Exception: %s", str(e)) <NEW_LINE> raise | Set metadata for volume
Metadata is a dictionary of key-value pairs
Arguments: None
Returns: List of dictionaries. | 625941d7596a897236089d05 |
def ordered(self): <NEW_LINE> <INDENT> if self.date_ordered: <NEW_LINE> <INDENT> return self.date_ordered <NEW_LINE> <DEDENT> return '' | filter '(None)' display in admin table | 625941d78e71fb1e9831d9ef |
def test_folder_add_and_listing(self): <NEW_LINE> <INDENT> browser = self.layer.get_web_browser(smi_settings) <NEW_LINE> browser.login(self.user) <NEW_LINE> self.assertEqual(browser.inspect.title, u"root") <NEW_LINE> self.assertEqual( browser.inspect.tabs, ['Content', 'Preview', 'Add', 'Properties', 'Settings']) <NEW_L... | Create a folder check its tabs and actions and delete it.
| 625941d726068e7796caef28 |
def close(self): <NEW_LINE> <INDENT> self.socket.close() | Closes the current connection with the Daemon. | 625941d7c4546d3d9de72c7c |
def multiqc_flagstat(self, input, output, qc_dir, flagstat_dir): <NEW_LINE> <INDENT> command = "multiqc --module samtools --outdir {qc_dir} " "--filename multiqc_flagstat {flagstat_dir}".format( qc_dir=qc_dir, flagstat_dir=flagstat_dir) <NEW_LINE> run_stage(self.state, "multiqc", command) | Run MultiQC on the flagstat directory | 625941d75166f23b2e1a539f |
def Progress(self, bytes_processed): <NEW_LINE> <INDENT> self._bytes_processed_since_callback += bytes_processed <NEW_LINE> cur_time = time.time() <NEW_LINE> if (self._bytes_processed_since_callback > self._bytes_per_callback or (self._total_bytes_processed + self._bytes_processed_since_callback >= self._total_size and... | Tracks byte processing progress, making a callback if necessary. | 625941d74a966d76dd551257 |
def _formatstatus(self, string): <NEW_LINE> <INDENT> if string.startswith('F'): <NEW_LINE> <INDENT> string = string.replace('FINAL', 'F') <NEW_LINE> string = string.replace('Final', 'F') <NEW_LINE> string = string.replace(' ', '') <NEW_LINE> string = self._red(string) <NEW_LINE> <DEDENT> elif string.startswith('Top ') ... | Handle status here. | 625941d763f4b57ef000135b |
def parse_p(self, html): <NEW_LINE> <INDENT> content = [] <NEW_LINE> select_tag = self.select_tag <NEW_LINE> for component in html.components: <NEW_LINE> <INDENT> result = select_tag(component) <NEW_LINE> if result != None: <NEW_LINE> <INDENT> content += result <NEW_LINE> <DEDENT> <DEDENT> if content == []: <NEW_LINE> ... | Parses a P element and converts it into a format for ReportLab
@param html: the P element to convert
@return: a list containing text that ReportLab can use | 625941d766673b3332b922d8 |
def test_plandefinition_7(base_settings): <NEW_LINE> <INDENT> filename = base_settings["unittest_data_dir"] / "plandefinition-example.json" <NEW_LINE> inst = plandefinition.PlanDefinition.parse_file( filename, content_type="application/json", encoding="utf-8" ) <NEW_LINE> assert "PlanDefinition" == inst.resource_type <... | No. 7 tests collection for PlanDefinition.
Test File: plandefinition-example.json | 625941d7956e5f7376d710b3 |
@freequery.route('/export_report',methods = ['GET','POST']) <NEW_LINE> @login_required <NEW_LINE> def export_report(): <NEW_LINE> <INDENT> exp_dir=cfg.FREE_QUERY_EXP_DIR <NEW_LINE> filters=json.loads(request.values.get("filters","[]")) <NEW_LINE> print('*'*40) <NEW_LINE> print(filters) <NEW_LINE> sorters = [] <NEW_LINE... | export report data to excel | 625941d791af0d3eaac9bc61 |
@pytest.mark.parametrize('catl_kind', catl_keys_catl_kind_arr) <NEW_LINE> @pytest.mark.parametrize('return_type', catl_keys_return_arr) <NEW_LINE> @pytest.mark.parametrize('perf_opt', catl_keys_catl_perf_arr) <NEW_LINE> def test_catl_keys_catl_kind_errors_1(catl_kind, perf_opt, return_type): <NEW_LINE> <INDENT> with py... | Tests the function:
cosmo_utils.mock_catalogues.catl_utils.catl_keys` for input and
output variables.
It verifies if errors are raised when `catl_kind` is incorrect
Parameters
-----------
catl_kind : {'data', 'mocks'} str
Type of catalogue to use. This variable is set to `data` by default.
Options:
... | 625941d70a366e3fb873ea62 |
def expand_fs(): <NEW_LINE> <INDENT> root_disk = get_root_partition() <NEW_LINE> if not root_disk: <NEW_LINE> <INDENT> logger.error('Could not determine which partition is root partition') <NEW_LINE> return RC.E_ROOT_FS_NOT_FOUND <NEW_LINE> <DEDENT> partitions = get_partition_table() <NEW_LINE> try: <NEW_LINE> <INDENT>... | Expands the root filesystem partition to the maximum available size and,
with it, any extended partition container.
Returns:
int: Success code for the operation as defined by members of
:class:`kano_updater.expand_fs.return_codes.RC` | 625941d74428ac0f6e5baa3a |
@task <NEW_LINE> def env_init(c, site_name=SITE_NAME): <NEW_LINE> <INDENT> print(Fore.GREEN + "Initializing new site configuration...") <NEW_LINE> CHARS = string.ascii_letters + string.digits <NEW_LINE> SECRET_KEY = "".join([random.choice(CHARS) for i in range(50)]) <NEW_LINE> print(Fore.BLUE + "Configuring the secret ... | Initialize with this site hostname. | 625941d796565a6dacc8f911 |
def get_elements(search_filter: str, by: By = By.CSS_SELECTOR): <NEW_LINE> <INDENT> security.check_self() <NEW_LINE> return common.browser.find_elements(by, search_filter) | Get all element by its identifier.
:param search_filter: The elements identifier to search by
:param by: element filter type
:return: | 625941d776e4537e8c3518bb |
def gameOfLife(self, board): <NEW_LINE> <INDENT> row = len(board) <NEW_LINE> if row: <NEW_LINE> <INDENT> col = len(board[0]) <NEW_LINE> <DEDENT> for i in range(row): <NEW_LINE> <INDENT> for j in range(col): <NEW_LINE> <INDENT> board[i][j] |= self.checkLive(board, i, j) << 1 <NEW_LINE> <DEDENT> <DEDENT> for i in range(r... | :type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead. | 625941d7d10714528d5fff2c |
def find_by_name(self, student_name): <NEW_LINE> <INDENT> student_name = student_name.lower() <NEW_LINE> result = [] <NEW_LINE> for e in self.__student_repository.get_all(): <NEW_LINE> <INDENT> name = e.name <NEW_LINE> name = name.lower() <NEW_LINE> if re.search(student_name, name): <NEW_LINE> <INDENT> result.append(e)... | finds all students which name matches/partially or fully, the student_name string | 625941d7e8904600ed9f2176 |
def make_env(env_id, seed, horizon=None): <NEW_LINE> <INDENT> benchmark = get_benchmark(env_id) <NEW_LINE> if benchmark == 'mujoco': <NEW_LINE> <INDENT> make_env_ = make_mujoco_env <NEW_LINE> <DEDENT> elif benchmark == 'ale': <NEW_LINE> <INDENT> make_env_ = make_ale_env <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rai... | Create an environment | 625941d7fbf16365ca6f640d |
def get_ftp_config(self, callback=None): <NEW_LINE> <INDENT> return self.execute_command('getFtpConfig', callback=callback) | Get ftp settings using the array of parameters | 625941d730c21e258bdfa6e5 |
def get_keyword(self, localize=None): <NEW_LINE> <INDENT> raise NotImplementedError( 'operation get_keyword(...) not yet implemented') | Retrieves the keyword for this stereotype, localized if indicated. | 625941d7d164cc6175782f95 |
def t500731_x9(flag1=75000120, flag2=75000121, z1=75000121, z2=75000121, flag3=1810): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> call = t500731_x20(actionbutton1=6830, flag9=1815, flag10=6000, flag11=6000, flag12=6000, flag13=6000) <NEW_LINE> if call.Done(): <NEW_LINE> <INDENT> call = t500731_x0(flag3=flag3) <... | State 0 | 625941d71d351010ab855d62 |
def build_offset_mapping_with_special_tokens(self, offset_mapping_0, offset_mapping_1=None): <NEW_LINE> <INDENT> if offset_mapping_1 is None: <NEW_LINE> <INDENT> return [(0, 0)] + offset_mapping_0 + [(0, 0)] <NEW_LINE> <DEDENT> return [(0, 0)] + offset_mapping_0 + [(0, 0) ] + offset_mapping_1 + [(0, 0)] | Build offset map from a pair of offset map by concatenating and adding offsets of special tokens.
A BERT offset_mapping has the following format:
- single sequence: ``(0,0) X (0,0)``
- pair of sequences: ``(0,0) A (0,0) B (0,0)``
Args:
offset_mapping_ids_0 (List[tuple]):
List of wordpiece off... | 625941d771ff763f4b5498d6 |
def apply_finite_diff(order, x_list, y_list, x0): <NEW_LINE> <INDENT> N = len(x_list) - 1 <NEW_LINE> if len(x_list) != len(y_list): <NEW_LINE> <INDENT> raise ValueError("x_list and y_list not equal in length.") <NEW_LINE> <DEDENT> delta = finite_diff_weights(order, x_list, x0) <NEW_LINE> derivative = 0 <NEW_LINE> for n... | Calculates the finite difference approxiamtion of
the derivative of requested order at x0 from points
provided in x_list and y_list.
Parameters
==========
order: int
order of derivative to approximate. 0 corresponds to interpolation.
x_list: sequence
Strictly monotonically increasing sequence of values for
... | 625941d71d351010ab855d63 |
def p_suite_star2_1(p): <NEW_LINE> <INDENT> p[0] = [p[1]] | suite_star2 : assignment | 625941d79b70327d1c4e101d |
def ignore(val): <NEW_LINE> <INDENT> return IgnoreVal() | dont populate this attribute | 625941d78a349b6b435e83bb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.