code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def load_words_from_text_to_sql(filename='', sqlConString='', numOfLines=0, printDebugMsg=False, startFrom=1): <NEW_LINE> <INDENT> fileWithWords = open(filename, 'r', encoding='utf-8') <NEW_LINE> listOfWords = fileWithWords.readlines() <NEW_LINE> lineIndex = 0 <NEW_LINE> readLine = 0 <NEW_LINE> engine = create_engine('... | :type fileName: str | 625941cdd4950a0f3b08c459 |
def __init__(self, token): <NEW_LINE> <INDENT> self.start_time = datetime.now() <NEW_LINE> self.chat = Chat('MokuBot') <NEW_LINE> try: <NEW_LINE> <INDENT> self.updater = Updater(token) <NEW_LINE> <DEDENT> except InvalidToken: <NEW_LINE> <INDENT> print("The token you are using is invalid.") <NEW_LINE> print("Please ask ... | Constructor
Keyword arguments:
token -- Telegram Bot token | 625941cd2c8b7c6e89b358cb |
def __len__( self ) : <NEW_LINE> <INDENT> return( len( self.coefficients ) ) | Returns the number of Legendre coefficients in the instance (e.g., for Legendre series it is lMax + 1). | 625941cd091ae35668667068 |
def savePatterns(self, outFile): <NEW_LINE> <INDENT> self._oFile = outFile <NEW_LINE> writer = open(self._oFile, 'w+') <NEW_LINE> for x, y in self._finalPatterns.items(): <NEW_LINE> <INDENT> pat = "" <NEW_LINE> for i in x: <NEW_LINE> <INDENT> pat += str(i) + " " <NEW_LINE> <DEDENT> patternsAndSupport = pat + ": " + str... | Complete set of frequent patterns will be loaded in to a output file
:param outFile: name of the output file
:type outFile: file | 625941cd3c8af77a43ae38ab |
def sinaUrlShortToLong(self, short_url=0): <NEW_LINE> <INDENT> if short_url: <NEW_LINE> <INDENT> self.short_url = short_url <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> url = "http://api.t.sina.com.cn/short_url/expand.json?source=3271760578&url_short=" + self.short_url <NEW_LINE> request = Request(url) <NEW_LINE> respo... | :return: return sina long url or None (if try except ) | 625941cd5fcc89381b1e17c9 |
def eneg_diff(data): <NEW_LINE> <INDENT> d = sorted([ elt_data[elt]['electronegativity'] for elt in data['pair']]) <NEW_LINE> return abs(d[0] - d[1]) | $\Delta$ Electronegativity | 625941cda219f33f34628a74 |
def test_headsign_display_info_departures(self): <NEW_LINE> <INDENT> response = self.query_region('stop_points/stop_point:stopB/departures?from_datetime=20120615T000000') <NEW_LINE> assert 'error' not in response <NEW_LINE> departures = get_not_null(response, 'departures') <NEW_LINE> assert len(departures) == 4 <NEW_LI... | test basic print of headsign in display informations for departures | 625941cd7b25080760e39563 |
@manager.command <NEW_LINE> def seed_theatres(): <NEW_LINE> <INDENT> with open('pars/concert/theatre_urls.txt', 'r') as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> url = f.readline().strip() <NEW_LINE> bs = BeautifulSoup(main_func.fetch_content(url), 'html.parser') <NEW_LINE> if main_func.... | Add seed data to the database. | 625941cdfff4ab517eb2f546 |
def compute_full_data(self): <NEW_LINE> <INDENT> r <NEW_LINE> for B in self._manin.reps(): <NEW_LINE> <INDENT> if not self._dict.has_key(B): <NEW_LINE> <INDENT> self._dict[B] = self._compute_image_from_gens(B) | Compute the values of self on all coset reps from its values on our generating set. | 625941cd7047854f462a1514 |
def df_percent_missing_vals(df: pd.DataFrame) -> pd.Series: <NEW_LINE> <INDENT> return (df.isnull().sum() / df.shape[0]) * 100 | return Series containing the percent of NaNs of each column | 625941cda8ecb033257d31d7 |
def update_target_marker(self, lat, lng): <NEW_LINE> <INDENT> if self._target_marker: <NEW_LINE> <INDENT> self.remove_marker(self._target_marker) <NEW_LINE> <DEDENT> self._target_marker = MapMarker(source="target.png", lat=lat, lon=lng) <NEW_LINE> self.add_marker(self._target_marker) <NEW_LINE> self.app.root.lat_text =... | update_target_locmarker(float, float)
updates the target location marker
lat - Latitude coordinates
lng - Longitude coords | 625941cdc4546d3d9de72b3f |
def getSites(page): <NEW_LINE> <INDENT> headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0'} <NEW_LINE> try: <NEW_LINE> <INDENT> html = requests.get(page, headers=headers) <NEW_LINE> bs = BeautifulSoup(html.content, 'html.parser') <NEW_LINE> <DEDENT> except Exception ... | Get all top site domains | 625941cd283ffb24f3c55a0c |
def write_lyric(text, file): <NEW_LINE> <INDENT> with open(file, 'w') as f: <NEW_LINE> <INDENT> for x in text: <NEW_LINE> <INDENT> if x.strip() != '': <NEW_LINE> <INDENT> f.write(x + ';' + '\n') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> f.write('\n') | 写入纯歌词文件 | 625941cdfbf16365ca6f62cf |
def get(self, request, number): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> order = ecommerce_api_client(request.user).orders(number).get() <NEW_LINE> return JsonResponse(order) <NEW_LINE> <DEDENT> except exceptions.HttpNotFoundError: <NEW_LINE> <INDENT> return JsonResponse(status=404) | HTTP handler. | 625941cd15fb5d323cde0c1a |
def test_terminator_fasta(self): <NEW_LINE> <INDENT> expected = "%s\n%s" % (self.match.get_fasta_header(), self.match.terminator_region) <NEW_LINE> self.assertMultiLineEqual(self.match.terminator_fasta(), expected) | Test FeatureMatch terminator DNA FASTA output | 625941cd046cf37aa974ce52 |
def write(l): <NEW_LINE> <INDENT> fin = open("singleScore.txt", "w") <NEW_LINE> for item in l: <NEW_LINE> <INDENT> fin.write(str(item)+"\n") | writes the scores from the list "l" to the
singleScores.txt file | 625941cd435de62698dfdd57 |
def directivity(frequency, radius): <NEW_LINE> <INDENT> k = 2.0 * pi * frequency / c <NEW_LINE> return 2.0 * k * radius * 0.58 ** 2 | The directivity of a circular loop antenna.
:param frequency: The operating frequency (Hz).
:param radius: The radius of the loop antenna (m).
:return: The directivity. | 625941cd67a9b606de4a7fc4 |
def write_summary(self, mode, epoch, images=None): <NEW_LINE> <INDENT> with self.summary_writers[mode].as_default(): <NEW_LINE> <INDENT> for key in self.scalars: <NEW_LINE> <INDENT> if isinstance(self.scalars[key], list): <NEW_LINE> <INDENT> for index in range(len(self.scalars[key])): <NEW_LINE> <INDENT> tf.summary.sca... | Write statistics. | 625941cd1f5feb6acb0c4c5b |
def get_paragraph_language(document, i): <NEW_LINE> <INDENT> lines = document.body <NEW_LINE> first_nonempty_line = find_nonempty_line(lines, find_beginning_of_layout(lines, i) + 1) <NEW_LINE> words = lines[first_nonempty_line].split() <NEW_LINE> if len(words) > 1 and words[0] == "\\lang": <NEW_LINE> <INDENT> re... | Return the language of the paragraph in which line i of the document
body is. If the first thing in the paragraph is a \lang command, that
is the paragraph's langauge; otherwise, the paragraph's language is the
document's language. | 625941cd4f6381625f114b45 |
def compute_partials(self, inputs, partials): <NEW_LINE> <INDENT> J = partials <NEW_LINE> J['y', 'x1'] = np.array([3.0]) <NEW_LINE> self.lin_count += 1 | Intentionally left out derivative. | 625941cd66656f66f7cbc2b6 |
def get_prefixes(self): <NEW_LINE> <INDENT> intent = self.context.get_intent() <NEW_LINE> if "attempt" in intent: <NEW_LINE> <INDENT> return ["can", "do"] | Return a list of prefixes appropriate for the Context's intent. | 625941cd91af0d3eaac9bb24 |
def wraps(wrapped, assigned=WRAPPER_ASSIGNMENTS, updated=WRAPPER_UPDATES): <NEW_LINE> <INDENT> return partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated) | Decorator form of ``update_wrapper``.
This is very useful for writing closure based decorators
rather than manually using ``update_wrapper`` on the closure.
WARNING!!: This function modifies the function it is applied to! | 625941cda4f1c619b28b0144 |
def pages(self, individual): <NEW_LINE> <INDENT> pages = [] <NEW_LINE> if individual.parent_family() is not None: <NEW_LINE> <INDENT> return [individual.parent_family().xref()] <NEW_LINE> <DEDENT> for f in individual.families(): <NEW_LINE> <INDENT> if f is not None: <NEW_LINE> <INDENT> pages.append(f.xref()) <NEW_LINE>... | Return list of xrefs of families in which a person can be found | 625941cd99fddb7c1c9de49c |
def reflect_xz(t): <NEW_LINE> <INDENT> args = [Shape.wrap(t)] <NEW_LINE> return Shape(stdlib.reflect_xz( args[0].ptr)) | Reflects a shape about the plane X=Z
| 625941cd009cb60464c634bc |
def inject_indexes(seq, missing=None): <NEW_LINE> <INDENT> first = True <NEW_LINE> prev_item = None <NEW_LINE> prev_idx = missing <NEW_LINE> idx = 0 <NEW_LINE> for item in seq: <NEW_LINE> <INDENT> if first: <NEW_LINE> <INDENT> prev_idx = missing <NEW_LINE> prev_item = item <NEW_LINE> first = False <NEW_LINE> continue <... | Iteriere über eine Sequenz und generiere 4-Tupel:
- das Listenelement
- voriger Index (für das erste Element: None)
- aktuellen Index (für das erste Element: 0)
- nächster Index (für das letzte Element: None)
>>> list(inject_indexes('ABC'))
[('A', None, 0, 1), ('B', 0, 1, 2), ('C', 1, 2, None)]
>>> list(inject_indexe... | 625941cd57b8e32f524835a6 |
def test(self, x_test_v): <NEW_LINE> <INDENT> self.model.cleargrads() <NEW_LINE> y_test_v = self.model.predict(x_test_v) <NEW_LINE> y_test = y_test_v.data <NEW_LINE> return y_test | テスト用のメソッド
:param x_test_v:
:return: | 625941cd4c3428357757c433 |
def connect(self): <NEW_LINE> <INDENT> raise Exception("DbConnector-connect: DbConnector is abstract and " "should not be called directly") | Establish a connection with the database.
returns: The connection object. | 625941cd44b2445a339321a1 |
def validate(expr): <NEW_LINE> <INDENT> if not expr: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> s = [] <NEW_LINE> expr = expr.split() <NEW_LINE> for e in expr: <NEW_LINE> <INDENT> if e == '(' or e == ')': <NEW_LINE> <INDENT> s.append(e) <NEW_LINE> <DEDENT> <DEDENT> if not parenthesis.paren_checker(''.join(s))... | this function checks whetherthe input expression is validate or not | 625941cd379a373c97cfac50 |
def cvar_norm(series, p = .01): <NEW_LINE> <INDENT> def _cvar_norm(series, p): <NEW_LINE> <INDENT> pdf = scipy.stats.norm.pdf <NEW_LINE> series_rets = log_returns(series) <NEW_LINE> mu, sigma = series_rets.mean(), series_rets.std() <NEW_LINE> var = lambda alpha: scipy.stats.distributions.norm.ppf(1 - alpha) <NEW_LINE> ... | CVaR (Conditional Value at Risk), fitting the normal distribution
to pthe historical time series using
:ARGS:
series: :class:`pandas.Series` or :class:`pandas.DataFrame` of
the asset prices
p: :class:`float` of the desired percentile, defaults to .01
or the 1% CVaR
:RETURNS:
:class:`floa... | 625941cda17c0f6771cbe15b |
def count_module(object): <NEW_LINE> <INDENT> name = object.__name__ <NEW_LINE> try: <NEW_LINE> <INDENT> all = object.__all__ <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> all = None <NEW_LINE> <DEDENT> classes, cdict = [], {} <NEW_LINE> for key, value in inspect.getmembers(object, inspect.isclass): <N... | Reference: pydoc.HTMLDoc.docmodule
:param object(object): module
:return: | 625941cd9f2886367277a998 |
def get_ii_constraints(ii, state_space): <NEW_LINE> <INDENT> constraints = collections.defaultdict(dict) <NEW_LINE> ild_nt.add_op_deciders(ii.ipattern, state_space, constraints) <NEW_LINE> for name,binding in list(ii.prebindings.items()): <NEW_LINE> <INDENT> if binding.is_constant(): <NEW_LINE> <INDENT> val = int(bindi... | returns constraints[xed_operand_name][xed_operand_val] = True
where xed_operand_name and xed_operand_val correspond to operands
encountered in ii (both operand deciders and constant prebindings) | 625941cd7d43ff24873a2dab |
def score_samples(self, X): <NEW_LINE> <INDENT> check_is_fitted(self) <NEW_LINE> X = self._validate_data(X, dtype=[np.float64, np.float32], reset=False) <NEW_LINE> Xr = X - self.mean_ <NEW_LINE> n_features = X.shape[1] <NEW_LINE> precision = self.get_precision() <NEW_LINE> log_like = -0.5 * (Xr * (np.dot(Xr, precision)... | Return the log-likelihood of each sample.
See. "Pattern Recognition and Machine Learning"
by C. Bishop, 12.2.1 p. 574
or http://www.miketipping.com/papers/met-mppca.pdf
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data.
Returns
-------
ll : ndarray of shape (n_samples,)
Log-likel... | 625941cd5166f23b2e1a5264 |
def serialize(self, root): <NEW_LINE> <INDENT> def dfs(node, string): <NEW_LINE> <INDENT> if not node: <NEW_LINE> <INDENT> string += 'None,' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> string += f"{node.val}," <NEW_LINE> string = dfs(node.left, string) <NEW_LINE> string = dfs(node.right, string) <NEW_LINE> <DEDENT> r... | Encodes a tree to a single string.
:type root: TreeNode
:rtype: str | 625941cd187af65679ca522a |
def vars_for_template(self): <NEW_LINE> <INDENT> players = self.group.create_players() <NEW_LINE> Final_Page_Var = {} <NEW_LINE> for playernum, player in players.items(): <NEW_LINE> <INDENT> string = 'promise%s' % (playernum) <NEW_LINE> Final_Page_Var[string] = player.promise <NEW_LINE> <DEDENT> for playernum, player i... | tells django the python variables that it will be using | 625941cdbe8e80087fb20d4e |
def __init__(self, tree): <NEW_LINE> <INDENT> super(Phase2OTHits, self).__init__(tree, "ph2_isBarrel", Phase2OTHit) | Constructor.
Arguments:
tree -- TTree object | 625941cda17c0f6771cbe15c |
def on_closing(self): <NEW_LINE> <INDENT> self.destroy() | Turn the blue LED off and close the port before closing | 625941cde1aae11d1e749dc2 |
def _get_filename(self, email_messages): <NEW_LINE> <INDENT> if self._fname is None: <NEW_LINE> <INDENT> uid = os.path.split(os.path.split(os.path.split(email_messages[0].body)[0])[0])[1] <NEW_LINE> topic = re.search('(?<=Code: ).+(?=\.)', email_messages[0].body) <NEW_LINE> timestamp = datetime.datetime.now().strftime(... | Return a unique file name. | 625941cdf8510a7c17cf9808 |
def remove_arg(self, pos): <NEW_LINE> <INDENT> self._args.pop(pos) | Remove the command line argument at position `pos` | 625941cdd268445f265b4f7a |
def add_customer_product(product_name, product_price, customer_id): <NEW_LINE> <INDENT> with sqlite3.connect('../db.db') as conn: <NEW_LINE> <INDENT> c = conn.cursor() <NEW_LINE> c.execute("INSERT INTO Product VALUES (?, ?, ?, ?)", (None, product_name, product_price, customer_id)) <NEW_LINE> conn.commit() | purpose: Adds a new product in database and assign to active user
author: Aaron Barfoot
args:
----------------------
product_name -- (text) Name of product
product_price -- (integer) Price of product
customer_id -- (integer) Customer ID of customer that added product
----------------------
returns: n/a | 625941cd07d97122c4178997 |
def providerExpressionBasedUpdate( self, layer, dictProperties, layerId, features ): <NEW_LINE> <INDENT> for feature in features: <NEW_LINE> <INDENT> self.expressionBasedUpdate( layer, dictProperties, feature.id() ) | SLOT for expressions that make sense only after new features are saved
to the provider. | 625941cddd821e528d63b2b4 |
def get_uid(vobject_component): <NEW_LINE> <INDENT> return (vobject_component.uid.value if hasattr(vobject_component, "uid") else None) | UID value of an item if defined. | 625941cd3eb6a72ae02ec5e9 |
def _radar_transformation(radar_data, height=None): <NEW_LINE> <INDENT> ELEVATION_FOV_SR = 20 <NEW_LINE> ELEVATION_FOV_FR = 14 <NEW_LINE> num_points = radar_data.shape[1] <NEW_LINE> radar_xyz_endpoint = radar_data[0:3,:].copy() <NEW_LINE> RADAR_HEIGHT = 0.5 <NEW_LINE> if height: <NEW_LINE> <INDENT> radar_data[2, :] = n... | Transforms the given radar data with height z = 0 and another height as input using extrinsic radar matrix to vehicle's co-sy
This function appends the distance to the radar point.
Parameters:
:param radar_data: [numpy array] with radar parameter (e.g. velocity) in rows and radar points for one timestep in columns
... | 625941cd29b78933be1e57b7 |
def get_required_forms(self): <NEW_LINE> <INDENT> return [nested_form for nested_form in self.nested_forms if self.form_is_required(nested_form)] | Checks which forms are required based on the params and returns a list of only the required forms
:rtype: list of NestedFormConfig | 625941cdac7a0e7691ed41d8 |
def shutdown(ctx): <NEW_LINE> <INDENT> ctx.obj['restserver'].shutdown() <NEW_LINE> ctx.obj['wsserver'].shutdown() | Shutdown servers. | 625941cd8e7ae83300e4b0d8 |
def master_clean(self, path_data, path_layout): <NEW_LINE> <INDENT> df_pre, layout_pre = self.initial_clean(path_data, path_layout) <NEW_LINE> df_grid, layout_grid = self.grid_extend(df_pre, layout_pre) <NEW_LINE> df, layout = self.numericlist_extend(df_grid, layout_grid) <NEW_LINE> layout.sort_values(['Start', 'Questi... | Runs all the functions. | 625941cd4e696a04525c9557 |
def startup(self, callback): <NEW_LINE> <INDENT> self.__startup_callback = callback <NEW_LINE> return self | Register a callback to be called during component startup.
Callback receives a single argument with the Component instance.
:param callback: A callback to execute on startup.
:type callback: function
:rtype: Component | 625941cd91f36d47f21ac5fe |
def __init__(self, pedido): <NEW_LINE> <INDENT> self.__pedido = pedido | Cria o comando concluir e insere o pedido na qual o comando irá agir. | 625941cd3617ad0b5ed68003 |
def get_game_mean_feature_by_attribute(df_game, field): <NEW_LINE> <INDENT> reg_list = field.split(' ') <NEW_LINE> reg_list = [int(i) for i in reg_list if i != ''] <NEW_LINE> game_feature_dim = 30 <NEW_LINE> if len(reg_list) == 0: <NEW_LINE> <INDENT> res = [0 for _ in range(game_feature_dim)] <NEW_LINE> <DEDENT> else: ... | :param df_game: game
:param field: login/pay.. list
:return: list | 625941cd3539df3088e2e456 |
def combine_count_files(files, out_file=None, ext=".fpkm"): <NEW_LINE> <INDENT> assert all([file_exists(x) for x in files]), "Some count files in %s do not exist." % files <NEW_LINE> for f in files: <NEW_LINE> <INDENT> assert file_exists(f), "%s does not exist or is empty." % f <NEW_LINE> <DEDENT> col_names = [o... | combine a set of count files into a single combined file | 625941cd4f88993c3716c172 |
def block_run_control(msg): <NEW_LINE> <INDENT> if msg.command in ['open_run', 'close_run']: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return msg | Block open and close run messages | 625941cd004d5f362079a43e |
@require_GET <NEW_LINE> def contributors(request): <NEW_LINE> <INDENT> return render_readouts(request, CONTRIBUTOR_READOUTS, 'contributors.html', locale=settings.WIKI_DEFAULT_LANGUAGE) | Render aggregate data about the articles in the default locale. | 625941cd7d43ff24873a2dac |
def train_step(loss): <NEW_LINE> <INDENT> del loss <NEW_LINE> features, labels = dequeue_fn() <NEW_LINE> estimator_spec = _call_model_fn_with_tpu( model_fn, features, labels, mode, run_config, params) <NEW_LINE> loss, train_op = estimator_spec.loss, estimator_spec.train_op <NEW_LINE> with ops.control_dependencies([trai... | Training step function for use inside a while loop. | 625941cd38b623060ff0aef9 |
def create_recipe(ingredients=None, **params): <NEW_LINE> <INDENT> defaults = { 'name': 'Test Recipe', 'description': 'Recipe used for testing' } <NEW_LINE> defaults.update(params) <NEW_LINE> recipe = Recipe.objects.create(**defaults) <NEW_LINE> if ingredients is None: <NEW_LINE> <INDENT> ingredients = ['Ingredient1', ... | Creates a new recipe for testing | 625941cd56ac1b37e62642db |
def _update_canvas(self): <NEW_LINE> <INDENT> frequency = float(self.frequency.text()) <NEW_LINE> radius = self.radius.text().split(',') <NEW_LINE> mu_r = self.mu_r.text().split(',') <NEW_LINE> eps_r = self.eps_r.text().split(',') <NEW_LINE> number_of_modes = int(self.number_of_modes.text()) <NEW_LINE> nr = len(radius)... | Update the figure when the user changes an input value.
:return: | 625941cd004d5f362079a43f |
def module_imports_on_top_of_file( logical_line, indent_level, checker_state, noqa): <NEW_LINE> <INDENT> def is_string_literal(line): <NEW_LINE> <INDENT> if line[0] in 'uUbB': <NEW_LINE> <INDENT> line = line[1:] <NEW_LINE> <DEDENT> if line and line[0] in 'rR': <NEW_LINE> <INDENT> line = line[1:] <NEW_LINE> <DEDENT> ret... | Place imports at the top of the file.
Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.
Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimpor... | 625941cddc8b845886cb5640 |
def slotHighlighted(self, _name, _exec): <NEW_LINE> <INDENT> pass | void KOpenWithDialog.slotHighlighted(QString _name, QString _exec) | 625941cdd53ae8145f87a37c |
def byte( self, *args, **kwargs ): <NEW_LINE> <INDENT> raise NBTFormatError( "A TAG_Byte cannot be created here." ) | Write a TAG_Byte with the given value.
value is expected to be an int in the range [-128, 127]. | 625941cdbaa26c4b54cb122b |
def step_j(r, log): <NEW_LINE> <INDENT> V_V_ = r.V_V.as_sym_mat3() <NEW_LINE> tx0, ty0, tz0 = 0, 0, 0 <NEW_LINE> if(V_V_[0] != 0): tx0 = random.normalvariate(0,V_V_[0]**0.5) <NEW_LINE> if(V_V_[1] != 0): ty0 = random.normalvariate(0,V_V_[1]**0.5) <NEW_LINE> if(V_V_[2] != 0): tz0 = random.normalvariate(0,V_V_[2]**0.5) <N... | Generate shifts from group translation. | 625941cd8a349b6b435e827f |
def get_ip_addresses(self, ip_set_id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.get_ip_addresses_with_http_info(ip_set_id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.get_ip_addresses_with_http_... | Get all IPAddresses in a IPSet # noqa: E501
List all IP addresses in a IPSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_ip_addresses(ip_set_id, async_req=True)
>>> result = thread.get()
:param async_req... | 625941cddd821e528d63b2b5 |
def top_pop(args=None, data_params=None, web_params=None): <NEW_LINE> <INDENT> df = get_mongo_data(web_params) <NEW_LINE> toppop = df[df['avg_rating'] >= 3.5].sort_values('num_ratings', ascending=False) <NEW_LINE> toppop = toppop[:web_params["num_recs"]] <NEW_LINE> notes = generate_notes(toppop, web_params) <NEW_LINE> ... | A simple top popular which takes climbs over 3.5/4 stars and returns those climbs with the
most number of reviews.
:param: args Command line arguments
:param: data_params Data params for running the project from the command line
:param: web_params Params from the website
:return: di... | 625941cd71ff763f4b549797 |
def refresh_all(self): <NEW_LINE> <INDENT> self.__tree.refresh_all() | Refresh all nodes | 625941cd167d2b6e31218ca2 |
def plot_mean_profile(self,itime=None,field=None): <NEW_LINE> <INDENT> params = self.iplot.kwargs <NEW_LINE> if itime is None: <NEW_LINE> <INDENT> itime = params['time'] <NEW_LINE> <DEDENT> xr = params['xlim'] <NEW_LINE> yr = params['ylim'] <NEW_LINE> self._print_mean_info() <NEW_LINE> z = self.z <NEW_LINE> if field is... | Plot the mean profile averaged over the xlim and ylim
specified by the interactive widgets. | 625941cd099cdd3c635f0d67 |
def _print_message(self, number: int): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assert type(number) is int, "number must be an integer" <NEW_LINE> assert number in range(len(self._convo)), "number must be in range({0})".format(len(self._convo)) <NEW_LINE> <DEDENT> except AssertionError as e: <NEW_LINE> <INDENT> rai... | Helper method used to prettily print to the screen the person, message and date
corresponding to the passed parameter number
Parameter:
number: The message number to print, must be 0 <= num < len(self) | 625941cd6aa9bd52df036eb0 |
def _render_on_subplot(self, subplot): <NEW_LINE> <INDENT> options = self.options() <NEW_LINE> opts = {} <NEW_LINE> opts['color'] = options['rgbcolor'] <NEW_LINE> opts['verticalalignment'] = options['vertical_alignment'] <NEW_LINE> opts['horizontalalignment'] = options['horizontal_alignment'] <NEW_LINE> if 'background_... | TESTS::
sage: t1 = text("Hello",(1,1), vertical_alignment="top", fontsize=30, rgbcolor='black')
sage: t2 = text("World", (1,1), horizontal_alignment="left", fontsize=20, zorder=-1)
sage: t1 + t2 # render the sum
Graphics object consisting of 2 graphics primitives | 625941cdbaa26c4b54cb122c |
def copy_file_as(source, destination): <NEW_LINE> <INDENT> copy_with_overwrite(source, destination) | Copies the source file to the destination
:param source: a string, the source file path
:param destination: a string, the destination path
:return: None | 625941cd925a0f43d2549f83 |
def imgcat(data, filename=None, width=None, height=None, preserve_aspect_ratio=True, pixels_per_line=24, fp=None): <NEW_LINE> <INDENT> if fp is None: <NEW_LINE> <INDENT> fp = sys.stdout if IS_PY_2 else sys.stdout.buffer <NEW_LINE> <DEDENT> buf = to_content_buf(data) <NEW_LINE> if len(buf) == 0: <NEW_LINE> <I... | Print image on terminal (iTerm2).
Follows the file-transfer protocol of iTerm2 described at
https://www.iterm2.com/documentation-images.html.
Args:
data: the content of image in buffer interface, numpy array, etc.
width: the width for displaying image, in number of characters (columns)
height: the height ... | 625941cd0c0af96317bb82f4 |
def __error_by_order(self, order_params): <NEW_LINE> <INDENT> products = [element['product'] for element in order_params['basket']] <NEW_LINE> prices_products = [[element['price'], element['product']] for element in order_params['basket']] <NEW_LINE> quantity_products = [[element['quantity'], element['product']] for el... | Проверить наличие доступных остатков во всей сети.
Проверить наличие доступных остатков для данных параметров заказа.
А при создании заказа надо еще и зараезрвировать их чтобы они не ушли под другой заказ.
Проверить что цены на позиции в заказе установлены верно(не продаем товары за рубль хотя его реальная стомость... | 625941cd236d856c2ad448e7 |
def getDataTierList(DB): <NEW_LINE> <INDENT> table = "%s.%s" % (DB, "MV_DATATIER") <NEW_LINE> query = 'select COLLNAME from %s' % (table) <NEW_LINE> try: <NEW_LINE> <INDENT> cursor = connections[DB].cursor() <NEW_LINE> cursor.execute(query) <NEW_LINE> data = {} <NEW_LINE> data = utility.genericTranslateInList(cursor) ... | Query the memorized view MV_DATATIER to get a list of
the DataTier present on the database | 625941cd711fe17d82542478 |
def OnSelectWidget(self, e): <NEW_LINE> <INDENT> self.widgets_edit.Enable() <NEW_LINE> self.widgets_del.Enable() | ... | 625941cdc4546d3d9de72b40 |
def max_output_buffer(self, i): <NEW_LINE> <INDENT> return _ccsds_swig.rs_encode_sptr_max_output_buffer(self, i) | max_output_buffer(rs_encode_sptr self, int i) -> long | 625941cd3c8af77a43ae38ad |
def __onImport(self, e): <NEW_LINE> <INDENT> self.behavior.importClicked() | Triggered when File>Import is clicked.
@type e: C{wx.CommandEvent} | 625941cdbde94217f3682efd |
def testDestroyStatus(self): <NEW_LINE> <INDENT> self._AddHandler('http://twitter.com/statuses/destroy/103208352.json', curry(self._OpenTestData, 'status-destroy.json')) <NEW_LINE> status = self._api.DestroyStatus(103208352) <NEW_LINE> self.assertEqual(103208352, status.id) | Test the twitter.Api DestroyStatus method | 625941cd23e79379d52ee670 |
def countplot(self, x=None, y=None, *args, **kwargs): <NEW_LINE> <INDENT> if x is None and y is None: <NEW_LINE> <INDENT> x = self._maybe_target_name(x, key='x') <NEW_LINE> <DEDENT> return self._module.countplot(x, y, data=self._df, *args, **kwargs) | Call ``seaborn.countplot`` using automatic mapping.
- ``data``: ``ModelFrame``
- ``y``: ``ModelFrame.target_name`` | 625941cd5fcc89381b1e17cb |
def main(): <NEW_LINE> <INDENT> """""""""""""""""""""""""""""" <NEW_LINE> """""""""""""'""""""""""""""""""" <NEW_LINE> train_X, test_X, train_y, test_y = get_data() <NEW_LINE> x_size = train_X.shape[1] <NEW_LINE> h_size = 185 <NEW_LINE> y_size = train_y.shape[1] <NEW_LINE> global X <NEW_LINE> X = tf.placeholder("float"... | CLASSIFICATION | 625941cdff9c53063f47c300 |
def read_data(folder_path, file_name): <NEW_LINE> <INDENT> file_path = Path(folder_path).joinpath(file_name).absolute() <NEW_LINE> print(file_path) <NEW_LINE> words_ = [] <NEW_LINE> pos_ = [] <NEW_LINE> constituents_ = [] <NEW_LINE> bio_ = [] <NEW_LINE> sentences = [] <NEW_LINE> pos = [] <NEW_LINE> constituents = [] <N... | Read data from txt files, save as csv (to use for torchtext dataset) | 625941cd377c676e912722b5 |
@pytest.fixture <NEW_LINE> def fixture_a(): <NEW_LINE> <INDENT> print('\nfixture_a setup') <NEW_LINE> yield <NEW_LINE> print('\nfixture_a teardown') | A message prefix. | 625941cd9b70327d1c4e0ee1 |
def error(msg, files): <NEW_LINE> <INDENT> import sys <NEW_LINE> prefix = "checkstyle: error: " <NEW_LINE> text = prefix + "%s: %i: %s\n" % (files.filename(), files.filelineno(), msg) <NEW_LINE> sys.stderr.write(text) | Handling error messages for each broken rule. | 625941cdbd1bec0571d9073c |
def get(self, **url_params): <NEW_LINE> <INDENT> if url_params: <NEW_LINE> <INDENT> self.http_method_args["params"].update(url_params) <NEW_LINE> <DEDENT> return self.http_method("GET") | Makes the HTTP GET to the url. | 625941cd2eb69b55b151c9bc |
def whenImported(moduleName, hook): <NEW_LINE> <INDENT> if '.' in moduleName: <NEW_LINE> <INDENT> splitpos = moduleName.rindex('.') <NEW_LINE> sub_hook = SubModuleLoadHook(moduleName[:splitpos], moduleName[splitpos + 1:], _setModuleHook, moduleName, hook) <NEW_LINE> if moduleName[:splitpos] not in postLoadHooks.keys():... | Call 'hook(module)' when module named 'moduleName' is first used
'hook' must accept one argument: the module object named by 'moduleName',
which must be a fully qualified (i.e. absolute) module name. The hook
should not raise any exceptions, or it may prevent later hooks from
running.
If the module has already been ... | 625941cd2eb69b55b151c9bb |
def colliding(self, x, y, radius): <NEW_LINE> <INDENT> return not (y + radius < self.bottom or y - radius > self.top or x + radius < self.left or x - radius > self.right) | A function to determine if an agent is colliding with the shelter, this is called in the
move() function when an agent is moving
Method Arguments:
* x: The x position value of the agent that is moving
* y: The y position value of the agent that is moving
Output:
* Returns whether or not the agent's x and y positions... | 625941cdd6c5a10208144158 |
def __onUsername(self, ev): <NEW_LINE> <INDENT> self.__onConnect() | Called when the user presses enter in the username field.
Behaves as if they had pushed the *Connect* button. | 625941cd8da39b475bd65081 |
def asses(player_one_card,player_two_card): <NEW_LINE> <INDENT> pass | if player_one_card[0] in "JQK":
player_one_point = 10
if player_two_card[0] in "JQK":
player_two_point = 10 | 625941cd5fc7496912cc3a8a |
def _check_play_button(self, mouse_pos): <NEW_LINE> <INDENT> button_clicked = self.play_button.rect.collidepoint(mouse_pos) <NEW_LINE> if button_clicked and not self.stats.game_active: <NEW_LINE> <INDENT> self.settings.initialize_dynamic_settings() <NEW_LINE> self.stats.reset_stats() <NEW_LINE> self.stats.game_active =... | Start a new game when the player clicks Play. | 625941cd94891a1f4081bbb6 |
def computequadpoints(self, order): <NEW_LINE> <INDENT> if order not in AVAILABLEORDERS: <NEW_LINE> <INDENT> neighbor = find_nearest(AVAILABLEORDERS, order) <NEW_LINE> raise ValueError( "Order not available. Next closest would be" "%i.", AVAILABLEORDERS[neighbor], ) <NEW_LINE> <DEDENT> filename = "data/" + str(order) +... | Quadrature points for icoslerp quadrature. Read from file. | 625941cd3317a56b86939d65 |
def get_tweets_from_hashtag(twitter, hashtag, tries=10, count=100): <NEW_LINE> <INDENT> max_id = float("inf") <NEW_LINE> tweets = [] <NEW_LINE> for n in range(1,tries+1): <NEW_LINE> <INDENT> results = [] <NEW_LINE> try: <NEW_LINE> <INDENT> results.append(twitter.search(q=hashtag, count=count, max_id=max_id)) <NEW_LINE>... | Returns tweets that contain a given hashtag using the given tries and count | 625941cd8e7ae83300e4b0d9 |
def set_AccessTokenSecret(self, value): <NEW_LINE> <INDENT> super(EditPhotoPostWithURLInputSet, self)._set_input('AccessTokenSecret', value) | Set the value of the AccessTokenSecret input for this Choreo. ((required, string) The Access Token Secret retrieved during the OAuth process.) | 625941cd6fece00bbac2d84b |
def testTargetOsForHooksInDepsFile(self): <NEW_LINE> <INDENT> write( 'DEPS', 'hooks = [\n' ' {\n' ' "name": "a",\n' ' "pattern": ".",\n' ' "action": [ "python", "do_a" ],\n' ' },\n' ']\n' '\n' 'hooks_os = {\n' ' "blorp": [' ' {\n' ' "name": "b",\n' ' "pattern": ".",\n' ' "action": [ "pytho... | Verifies that specifying a target_os value in a DEPS file runs the right
entries in hooks_os. | 625941cd97e22403b379d0a6 |
def __init__(self, blockNum=1, key='bloomfilter'): <NEW_LINE> <INDENT> self.server = redis_client() <NEW_LINE> self.bit_size = 1 << 31 <NEW_LINE> self.seeds = [5, 7, 11, 13, 31, 37, 61] <NEW_LINE> self.key = key <NEW_LINE> self.blockNum = blockNum <NEW_LINE> self.hashfunc = [] <NEW_LINE> for seed in self.seeds: <NEW_LI... | :param blockNum: one blockNum for about 90,000,000; if you have more strings for filtering, increase it.
:param key: the key's name in Redis | 625941cd30dc7b7665901a73 |
def flip_up_down(image, positions, objects): <NEW_LINE> <INDENT> image = np.flipud(image) <NEW_LINE> for y_pos in range(0, num_joints_max*num_objects_max*2, 2): <NEW_LINE> <INDENT> positions[y_pos] = np.absolute(image.shape[0] - positions[y_pos]) <NEW_LINE> <DEDENT> for o in range(0, num_objects_max): <NEW_LINE> <INDEN... | Flips frame up-down
Args:
image: image frame
positions: joint position annotations in frame
objects: object presence in frame
Returns:
image: flipped image frame
positions: flipped positions
objects: flipped objects | 625941cd56ac1b37e62642dc |
def prioritize_parcels(parcels, fieldnames, scrnames, field_weight, soilind): <NEW_LINE> <INDENT> arcpy.AddField_management(parcels, 'pri_scr', 'DOUBLE') <NEW_LINE> total_weight = np.sum(field_weight) <NEW_LINE> namelist = list() <NEW_LINE> soillist = list() <NEW_LINE> for k in range(len(fieldnames)): <NEW_LINE> <INDEN... | Updates "parcels". | 625941cdd18da76e235325e3 |
def stringify_suffixes(expanded_list): <NEW_LINE> <INDENT> sentence_set = set() <NEW_LINE> for sentence in expanded_list: <NEW_LINE> <INDENT> sentence_text = " ".join(conjunct.name for conjunct in sentence) <NEW_LINE> sentence_set.add(sentence_text) <NEW_LINE> <DEDENT> return sentence_set | Convert the current rule suffixes to string form.
:param expanded_list: List of rule suffixes to convert.
:return: Set of suffixes, after converting each to a string. | 625941cd91af0d3eaac9bb26 |
def is_factor(n, potential_factor): <NEW_LINE> <INDENT> return n % potential_factor == 0 | Returns whether potential_factor is or is not a true factor of n | 625941cdcc40096d61595a5d |
def get_function_name(ea): <NEW_LINE> <INDENT> return get_symbol_name(ea, ea, allow_dummy=True) | Return name of a function, as IDA sees it. This includes allowing
dummy names, e.g. `sub_abc123`. | 625941cd0fa83653e46570c8 |
def _update(self, session, params): <NEW_LINE> <INDENT> filter_params = [ self._construct_dict_for_update(obj) for obj in params ] <NEW_LINE> body = { 'redis_config': filter_params } <NEW_LINE> uri = self.base_path % self._uri.attributes <NEW_LINE> response = session.put( uri, json=body) <NEW_LINE> return self._transla... | Update parameters of the instance
| 625941cd3346ee7daa2b2e78 |
def setup(self): <NEW_LINE> <INDENT> parser = self._parser.add_parser( "stop", help="Stop the Demo-Proxy standalone application.") <NEW_LINE> parser.set_defaults(work=self.run) | Extend the parser configuration in order to expose this command. | 625941cdd8ef3951e324364a |
def test_main(self): <NEW_LINE> <INDENT> predictor = FDictClassPredictor(); <NEW_LINE> args = ['', '--delim=,', self.AMODELIN_FILENAME, self.FDICT_FILENAME, self.IDX_FILENAME, self.OUT_FILENAME]; <NEW_LINE> predictor.main(args); <NEW_LINE> ifs = open(self.OUT_FILENAME); <NEW_LINE> reader = csv.reader(ifs, delimiter=' '... | Test that the main function works as expected. | 625941cdb5575c28eb68e10d |
def compute_clustering_accuracy(label1, label2): <NEW_LINE> <INDENT> uniq1,uniq2 = np.unique(label1),np.unique(label2) <NEW_LINE> entries1,entries2 = {},{} <NEW_LINE> for label in uniq1: entries1[label] = set(np.flatnonzero((label1==label))) <NEW_LINE> for label in uniq2: entries2[label] = set(np.flatnonzero((label2==l... | From clustering_on_transcript_compatibility_counts, see github for MIT license | 625941cd4c3428357757c434 |
def outOfGamutClipping(I): <NEW_LINE> <INDENT> I[I > 1] = 1 <NEW_LINE> I[I < 0] = 0 <NEW_LINE> return I | Clips out-of-gamut pixels. | 625941cd0c0af96317bb82f5 |
def pyro_service_process(auto_start=False, *args, **kwargs): <NEW_LINE> <INDENT> logger.debug(f'Setting up Pyro service process.') <NEW_LINE> service_process = Process(target=pyro_service, args=args, kwargs=kwargs) <NEW_LINE> if auto_start: <NEW_LINE> <INDENT> logger.info("Auto-starting pyro service") <NEW_LINE> servic... | Start a pyro service in a separate process. | 625941cd23e79379d52ee671 |
def _get_output_filename(self, root): <NEW_LINE> <INDENT> return os.path.join(self.output_path, "".join([root, self.OUTPUT_EXT])) | Output File | 625941cd63b5f9789fde71f3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.