content
stringlengths
35
762k
sha1
stringlengths
40
40
id
int64
0
3.66M
def qrGetGuidesColorFromGuidesNode( guidesNode ): """ This method sets the color from the guides node. It returns the color of the root of all the guides. """ return cmds.getAttr( '%s.overrideColorRGB' % guidesNode )[ 0 ]
fbd909e0bbd1dcc12dd5f6c8f74b500d497a4dba
3,623,139
def dbconn_mysql(host=None, user=None, password=None, database=None, port=3306, from_file=False, filename=None): """ Return MySQL database connection and cursor objects. Prompt for missing credentials. DESIGN: Function designed to create a connection to a MySQL database using ...
3d2cbe7a775e03446f5912606aca7ce4cb4f9ba2
3,623,140
def apply_coefficients_for_band(numpyarray, band, regression_coefficients): """ Apply regression coefficients in the form: ETM = c0 + OLI*c1 As per table 2 in http://www.mdpi.com/2072-4292/6/9/7952/htm :param numpyarray: array of measurements to apply coefficients to :param band: name of the coeffic...
679c18885fed81de5ea2fe76f03bcf37b017e437
3,623,141
def append_to_csv(file_name, nda_str, set_id_group): """ Output all doc in set_id to a csv file. Parameters: file_name (Path): filename to store exported csv nda_str (String): ex "12345-23456" set_id_group (String): ex: "7b5489a1-e30f-450f-bd2b-00d05fd52915" """ _logger.info...
37cdf883e74d100a9d71be5743aeabf883474b04
3,623,142
from typing import Callable def _sumprod( func: Callable, values: np.ndarray, mask: np.ndarray, *, skipna: bool = True, min_count: int = 0, ): """ Sum or product for 1D masked array. Parameters ---------- func : np.sum or np.prod values : np.ndarray Numpy array...
0a47863f256cb6a60cb6adad27c036e879a188ff
3,623,143
import tarfile def files_from_archive(tar_archive: tarfile.TarFile): """ Extracts only the actual files from the given tarfile :param tar_archive: the tar archive from which to extract the files :return: List of file object extracted from the tar archive """ file_members = [] # Find the ...
09ead0b2b955afdc5bf96a8e0a8717989c155406
3,623,144
def regular_wl_axis(axis, xlims=None): """ Converts a wavenumber axis ([cm-1]) into a regular (==equally spaced) wavelength axis ([Angstroms]) Parameters ---------- axis : 1D :class:`~numpy:numpy.ndarray` Input axis in cm-1 xlims : tuple of floats (Optional) limits in cm-1 to re...
62952e855aaba730be77c56e0ada6712ea1b62d9
3,623,145
def load_stack_plane(image,c,z,x,y,w,h): """ Load ROI of a Z plane from every time point in OMERO image Inputs: image: OMERO ImageWrapper c: int, channel z: int, plane x: float, x corner of ROI y: float, y corner of ROI width: int, width of ROI height:...
41b65078b83360776757d4a6ea001557482849a9
3,623,146
from typing import Optional def read_file(href: HREF, stac_io: Optional[StacIO] = None) -> STACObject: """Reads a STAC object from a file. This method will return either a Catalog, a Collection, or an Item based on what the file contains. This is a convenience method for :meth:`StacIO.read_stac_obje...
75132349e139af5dc52c2be424b4cdd5d1ae062a
3,623,147
def gcn_encoder(features, hparams, embed_scope, embed_token_fn=common_embed.embed_tokens, adjcency_feature="obj_dom_dist", discretize=True): """Encodes a screen using Graph Convolution Networks. Args: features: the feature dict. hparams: the hyperparameter. ...
5732c937c8f46d74b9ba29fe848b1cbc1d88fa8c
3,623,148
def help(term, arabic_column, english_column): """ show all details of word""" exclude_keys = [arabic_column, english_column] details = {k: term[k] for k in set(list(term.keys())) - set(exclude_keys)} return details
c1118fd1240802a4ba1f7976d21806eb7302276c
3,623,149
def nodify(n): """ Modifies string to contain node#mod_ :param n: string :return: string """ return 'node#mod_{}'.format(n)
b0d09ded891e369d463f44404501d82e5f266941
3,623,150
def calculate_rescue_time_pulse(very_distracting, distracting, neutral, productive, very_productive): """ Per RescueTime API :param very_distracting: integer - number of seconds spent :param distracting: integer - number of seconds spent :param neutral: integer - number of seconds spent :param ...
28144b5e1c7820b12971a0f5a88d56971c798dc7
3,623,151
def load_linux_so(): """ Load the shared object for Linux platforms. The shared object must be in the same folder as this python script. """ shared_name = get_project_root() / "build/libastyle.so" shared = str(pl.Path(shared_name).absolute()) # file_ = {f for f in pl.Path().iterdir() if f.n...
7fda7c73995bb99d86ac82f43e06c4d2c2f75a66
3,623,152
import torch def load_embeddings_from_imgs(det_df, dataset_params, seq_info_dict, cnn_model, return_imgs = False, use_cuda=True): """ Computes embeddings for each detection in det_df with a CNN. Args: det_df: pd.DataFrame with detection coordinates seq_info_dict: dict with sequence meta in...
1d5dbffb904f98cb8e33247ab5619ba2ff74c0bf
3,623,153
def serial_to_usb_widget(serial_into_USBhub_port_displayed): """Function used to create Jupyter widget. It takes the parameter chosen from the widget and returns it such that it can be used as a variable. Args: serial_into_USBhub_port (str) : the port number of the USB Hub that the Serial Adaptor i...
4bbf68ca2ab90da5a1f6ba3cc0a1b6f140b39484
3,623,155
def build_discriminator(input_shape=(256, 256, 3)): """Returns the discriminator network of the GAN. Args: input_shape (tuple, optional): shape of the input image. Defaults to (256, 256, 3). Returns: 'Model' object: GAN discriminator. """ x0 = layers.Input(input_shape) ...
c0d541a6e613f78aabb81e0cb73027961acc7d48
3,623,156
import json def user_list(_request): """ This will return a list of all users in the database """ # We'd really like to do .distinct, but sqlite+django does not support this; # hence the hack with sorted(set(...)) users = sorted( user_id[0] for user_id in set(XBlockState.object...
d9456f0d7348382d4ed8e9ef17443f641cd8d39d
3,623,157
from datetime import datetime def price_dataframe(symbols='sp5002012', start=datetime.datetime(2008, 1, 1), end=datetime.datetime(2009, 12, 31), price_type='actual_close', cleaner=clean_dataframe, ): """Retrieve the prices of a list of equities as a DataFrame (columns = symbols) Argumen...
d6c7cdb8d14d097a3f5eddb46c3a38dde58bb416
3,623,158
def split_nth(string, count): """ Splits string to equally-sized chunks """ return [string[i:i+count] for i in range(0, len(string), count)]
38833ef711ce04f5563b343f477e7792035ec669
3,623,159
def market_EWindex(market: simuldata.Market, name: str="Market EW Index") -> pd.DataFrame: """ Sums all assets to make an index, corresponds to the Equally-Weighed (EW) index. The formula for the weights here is: w_i = c / N for all i and we choose c = N so that \sum_i w_i = N. Thus we...
f6713e7cc5a7dd70c0057de8e7bb252b386f6e70
3,623,160
import six def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'): """ Similar to smart_text, except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don't convert (some) non-string-like objects. """ # Handle the comm...
cf5fdb32b67bb280e6830a9039056793d896354d
3,623,161
def column_hash_values(column0, *other_columns, initial_hash_values=None): """Hash all values in the given columns. Returns a new NumericalColumn[int32] """ columns = [column0] + list(other_columns) buf = Buffer(rmm.device_array(len(column0), dtype=np.int32)) result = NumericalColumn(data=buf, d...
dc8d94e87b16e51979d6b88b6203ae1d09592eff
3,623,162
from typing import Optional def get_service_from_request( request, raise_exception: bool = True ) -> Optional[Service]: """Return the service for the request. Unauthenticated calls will identify the service using ServiceAPIKey. Authenticated calls will check the azp claim of the auth token to see...
ffe03089902dc73ae6459d5f5f02b40ee049509d
3,623,163
from typing import Any def resnet50( sensor: str, bands: str, pretrained: bool = False, progress: bool = True, **kwargs: Any, ) -> ResNet: """ResNet-50 model. If you use this model in your research, please cite the following paper: * https://arxiv.org/pdf/1512.03385.pdf Args: ...
30200f110e4a3ddab4b8f1ca48bf031531b6024a
3,623,164
def divide_graph(graph, distance): """ divide graph with connected components by links whose distance is less than the second argument. """ group = [-1] * NUM_NODE current_group_id = 0 division = [] for i in range(NUM_NODE): current_group = set() if(group[i] != -1): ...
372e88a16a0b3cdbdc5ebebc05a37c0767e360b8
3,623,166
def deduplicate(elements): """Remove duplicate entries in a list of dataset annotations. Parameters ---------- elements: list(vizier.datastore.annotation.base.DatasetAnnotation) List of dataset annotations Returns ------- list(vizier.datastore.annotation.base.DatasetAnnotation) ...
99de9667b46ab9da619d28748d3d74bbec54892a
3,623,167
import select def get_keywords(): """ The get_keywords function retrieves keywords from the database if they are set to active.""" return select(k for k in Keyword if k.active)
bee91f16ec635e41c9576410db8ed55f3f20607d
3,623,168
def parse_spectrum_list2dict(spectrum_list): """ Parse the spectrum list [start, stop, num] to a list """ if spectrum_list[0].unit.physical_type != 'length' and \ spectrum_list[1].unit.physical_type != 'length': raise ValueError('start and end of spectrum need to be a length...
73db559fe9f617d5e0240f444d3fc30d8aed68eb
3,623,169
import io def RDKit_Mol_from_ProDy(prody_instance, removeHs=True): """ Creates an RDKit Mol object from a ProDy AtomGroup instance :return: """ residue_io = io.StringIO() prody.writePDBStream(residue_io, prody_instance) return Chem.MolFromPDBBlock(residue_io.getvalue(), removeHs=removeHs)
dba8495f0e69847d678dfad14c62960ec3794701
3,623,171
def get_cut_rect_x(rect, axis): """ cuts one rect about an x axis """ rects = [rect] llx, lly, urx, ury = rect if llx < axis and urx > axis: rects = [(llx, lly, axis, ury), (axis, lly, urx, ury)] return rects
98ec23d892b974238d0a064c5e9de044598bb788
3,623,172
import inspect def get_class_name(obj, fully_qualified=True, truncate_builtins=True): """Get class name for object. If object is a type, returns name of the type. If object is a bound method or a class method, returns its ``self`` object's class name. If object is an instance of class, returns instan...
41e0233593e76cc81c0afddbce6db644b26c349c
3,623,173
def windShear(u, v, z, top, bottom, unit=None): """ calculate the wind shear between discrete layers <div class=jython> shear = sqrt((u(top)-u(bottom))^2 + (v(top)-v(bottom))^2)/zdiff</pre> </div> """ udiff = layerDiff(u, top, bottom, unit) vdiff = layerDiff(v, top, bottom, unit) zdiff = layerDi...
7164b46c04d114562c0ba3194fabeb3d1a70594d
3,623,174
import requests def check_all_links(links): """ Check that the provided links are valid. Links are considered valid if a HEAD request to the server returns a 200 status code. """ broken_links = [] for link in links: head = requests.head(link) if head.status_code != 200: ...
b6e784da72b4f81af3e393804ef3f776c2f3fc85
3,623,175
def process_currency(curr): """Gets a formatted list of cryptocurrency to show in home.html""" assets = [] for c in curr: assets.append(c['CGname']) data = new_lookup(assets, "usd") final_list = [] i = 1 for name, price in data.items(): final_list.append({"id": i, "name": n...
fdf66c99b3452cd2abafde6c9079589b39c669d4
3,623,176
async def validation_middleware(request: web.Request, handler) -> web.Response: """ Validation middleware for aiohttp web app Usage: .. code-block:: python app.middlewares.append(validation_middleware) """ orig_handler = request.match_info.handler if not hasattr(orig_handler, "_...
5f529e005fc9de9e5c7ce43d8cab628e960cec18
3,623,177
import inspect def register_ranged_hparams(name=None): """Register a RangedHParams set. name defaults to fn name snake-cased.""" def decorator(rhp_fn, registration_name=None): """Registers & returns hp_fn with registration_name or default name.""" rhp_name = registration_name or default_name(rhp_fn) ...
fb0ee544a31bbda610e599f44a6dce4a2cfc0621
3,623,178
import json def get_monitoring_data(): """ 1. Get required arguments 2. Call the worker method 3. Render the response """ # 1. Get required arguments args = Eg001Controller.get_args() try: # 2. Call the worker method to get your monitor data results = Eg001Controll...
63034190afdf72bf0fa4e03416a814aa9ac6c1d8
3,623,179
def calculate_histogram(magnitudes, angles, bin_count=9, is_signed=False): """Calculate the localized histogram of each cell. :param magnitudes: The maginitude of each cell :type: np.ndarray :param angles: The angle of each cell :type: ...
82b7ddccd571031fedceee43f51292cf4e21cc19
3,623,180
def dot_product_mpnn_attention(q, k, v, adjacency_matrix, num_edge_types, ignore_zero=True, name=None): """Dot product attention with edge vectors. Args: q: [batch, length, key_depth] tensor k: [batch, num_edge_types, length, key_depth] v: [batch, num_edge_types, length, ...
5e545f714c72a4136352b531d3980fc56931a7a9
3,623,181
def selective_representer(dumper, data): """Process yml to correctly handle \n.""" return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|' if '\n' in data else None)
4a748fb6b2eb997aee76239f875b5097648f4d88
3,623,182
def optimize_trajectory(target, start, parameters): """ 牛顿迭代法,梯度下降法 :param target: :param start: :param parameters: :return: """ for i in range(max_iter): end_state = generate_last_state(start, parameters) end_state_error = np.array(calc_diff(target, end_state)).reshape(...
1b64c7eaf0f5601bf99ed2531677c86b6aab6a5c
3,623,183
def get_session_monitor(target): """Px means the session is parallel run coordinator.""" return render_page()
0bb186cbec3c72d1bbe9c40bfdd01bf68e57ab86
3,623,184
def _evaluate_embedding_cpu(r, d, r_neighbor, metric="dihedral", epsilon=1e-4): """ Evaluate the final embedding by calculating the stress and correlation Args: r (ndarray): n-dimensional dataset (rows: frame; columns: angle/intramolecular distance) d (ndarray): the final projected embe...
91e7f9c127190e2785775cf388c071a5dea179cf
3,623,185
def encode_type2_user_id(user_id): """Append a type-2 error detection code to the user_id.""" return f"{user_id:04d}-{Type2Code.calculate(user_id):02d}"
0d4b1e3ff919fcbd9bb26d0d5d25ae0e0a1fa5e5
3,623,186
def twitter(request, account_inactive_template='socialregistration/account_inactive.html', extra_context=dict(), client_class=None): """ Actually setup/login an account relating to a twitter user after the oauth process is finished successfully """ client = client_class( request, setting...
f86d054fb976884d7b6b94efed8319970fafcafb
3,623,188
def delete_activator_cd(activatorId, dbsession): """ Args: activatorId ([int]): [The Activator id] list_of_cd ([list]): [A list of CD ids] 1. Logically delete all active CD ids for this activator """ # Inactivates the active activator-cd for this activator (activatorId) cd_l...
78d06cd824d2f67d7bb3459b929d03b39d84dad2
3,623,189
def makeVariables_npv(image): """ Make variables for NPV regression model """ year = ee.Image(image.date().difference(ee.Date('1970-01-01'), 'year')) season = year.multiply(2 * np.pi) return image.select().addBands(ee.Image(1)).addBands( season.sin().rename(['sin'])).addBands( season.cos().rename(['cos...
20e8a988e033371296fcd52e86f6e0654657f9f7
3,623,190
import re def mrg_labeled(tr): """return labeled constituency string.""" if isinstance(tr, nltk.Tree): if tr.label() in WORD_TAGS: return tr.leaves()[0] + ' ' else: s = '(%s ' % (re.split(r'[-=]', tr.label())[0]) for subtr in tr: s += mrg_labeled(subtr) s += ') ' retu...
95540cfcb3d5a2da7b14dcdcdcfb196c8923d3ff
3,623,191
def compute_seen_words(inscription_list): """Computes the set of all words seen in phrases in the game""" return {word for inscription in inscription_list for phrase in inscription['phrases'] for word in phrase.split()}
496fc64ee37a6a6b0b3df0c3e9230d7b7ef46d0f
3,623,193
def replace_previous(user, code, is_alt): """function replace_previous This function changes the previous lesson code Args: user: user model using tutor code: code that user submitted in last lesson is_alt: boolean for if alternate lesson Returns: code: ? string of code ...
22c8ecb38611c9d184d588be8ca29bcd8430bd17
3,623,194
def page_rank_dense_lstsq(datafile, d, datasize, n=None): """ Solve the page rank problem, given the data in 'datafile', the dampening factor 'd', the size 'datasize' of the dataset, and the number 'n' of nodes to include. Have 'n' default to None. Use the method involving least squares.""" data...
2a392f769e3f1ccc0c4a8b999ccaec80ad8c98a1
3,623,196
def resume(request): """ Resume the container """ if request.method != "POST": messages.error(request, "Invalid request method.") return redirect('containers') if 'id' not in request.POST or not request.POST.get('id').isdigit(): messages.error(request, "Invalid POST request."...
6c1a880b2c927d51cdcf146bb9bae952287c7c9d
3,623,197
def TextNodeEnd(builder): """This method is deprecated. Please switch to End.""" return End(builder)
78dd2492d43531cad4e53d6f7fa0f79bd244cf70
3,623,198
def set_item_checked(service, context): """ Fixture for factory function to set whether an item is checked. """ def _set_item_checked(shopping_list, item, checked): request = shopping_list_pb2.SetItemCheckedRequest( shopping_list_id=shopping_list.id, item_id=item.id, ...
6d4619489ef5c8c1648a076f98e9f8ef3cd56d91
3,623,199
def as_singleton_instance(cls): """ This is where the magic happens. This defines a class decorator that returns an *instance* of a class with the name "_<original_name>__class" that has the same member functions, etc as the cls argument. The type of the returned value is not accessible to the ...
3fc00dbfb24cd87401214806ddd93ff2ba15be50
3,623,200
def set_size(width, fraction=1, subplots=(1, 1)): """ Set figure dimensions to avoid scaling in LaTeX. Parameters ---------- width: float or string Document width in points, or string of predined document type fraction: float, optional Fraction of the width which you wish th...
2cbc82e17baceffcb81249d5dde99b6e10c4afa9
3,623,201
def create_keras_model(): """ create model """ model = Sequential() model.add(Conv1D(500, input_shape=(1280, 1), kernel_size=128, strides=128, activation='relu', padding='same')) model.add(De...
043b3db24bb4b24932d1fad50acc72f9354a154d
3,623,203
def ndgrid(*args,**kwargs): """ Same as calling meshgrid with indexing='ij' (see meshgrid for documentation). """ kwargs['indexing'] = 'ij' return meshgrid(*args,**kwargs)
342530125f045d36a7c49baff72904ed90877452
3,623,204
def _wass_gen_loss_fn(gen_images, discriminator: tf.keras.Model, generator: tf.keras.Model): """Calculate the Wasserstein (generator) loss.""" disc_gen_output = discriminator( gen_images, training=TRAINING_KWARG_FOR_SECOND_MODEL) gen_loss = tf.reduce_mean(-disc_gen_output) # Now add...
caaacb970476a38364ffc9e1b82566c6cda1481a
3,623,205
from typing import List def _get_create_repo(request) -> List[str]: """ Retrieves the list of all GIT repositories to be created. Args: request: The pytest requests object from which to retrieve the marks. Returns: The list of GIT repositories to be created. """ names = request.confi...
4ac8cefefb75af3bb86fcc16f5c8b79953b136bf
3,623,206
def read_in_posterior(date): """ read in samples from posterior from inference """ df = pd.read_hdf("results/soc_mob_posterior"+date+".h5", key='samples') return df
f5754628f17de8629e3d197a73645e6fa541722b
3,623,207
def wrap_dtype(func): """ Check the dtype of the `X` array. Convert dtype of X to np.float64 before to pass to cython function and convert to specified dtype at the end. """ @wraps(func) def check_dtype(X, *args, dtype=None, **kwargs): X, dtype = _check_dtype(X, dtype) if dtyp...
2ace06e7f6447e71d3b7f586fde1cf853400d4d1
3,623,208
def dirdiff(HEADING,Nmin,loffset): """ Function to calculate the maximum difference of a [0, 360) direction during specified time averging intervals :param HEADING: time series of a direction in degrees [0, 360) :param Nmin: integer specifying the number of minutes to average ...
e552018dbdfc0dd83f9ac5e25116a9144133d9fc
3,623,209
def update_outputs(region, resource_type, name, outputs): """ update outputs with appropriate results """ element = { "op": "remove", "path": "/%s/%s" % (resource_type, name) } outputs[region].append(element) return outputs
97858e5d183af9974bd31be180dfe05c26048ab3
3,623,210
def generate_inputs_1d_spherical(): """Return inputs that parser will expect for the 1D case with spherical averaging.""" inputs = { 'parent_folder': orm.FolderData().store(), 'parameters': orm.Dict( dict={ 'INPUTPP': { 'plot_num':...
633fb78031eaeaf0067479d5aa600ed8fd462f90
3,623,211
def _check_electrification_scenarios_for_download(es): """Checks the electrification scenarios input to :py:func:`download_demand_data` and :py:func:`download_flexibility_data`. :param set/list es: The input electrification scenarios that will be checked. Can be any of: *'Reference'*, *'Medium'*, *...
ccd1ec8f0b1349267ba1334f7744056bc43e32ec
3,623,212
from typing import Sequence from typing import List def bubble_sort(nums: Sequence) -> List: """Sort a list in non-descending order using bubble sort. Return a new list, leaving the original `nums` intact. """ # Bubble sort compares each element with the next element, and if the previous one ...
0cc60f00fd7fb55098e34745e3bad76be7fcdf5f
3,623,213
def image_to_byte_array(image: Image): """ Converts an image into a byte array """ imgByteArr = BytesIO() image.save(imgByteArr, format=image.format if image.format else 'JPEG') imgByteArr = imgByteArr.getvalue() return imgByteArr
82e6413978ee07d1d2cd434e144c1f1732133dab
3,623,214
import logging def crawling_tweet(): """ Twitter APIを利用して対象ユーザーのツイートを収集する 収集したツイートはGoogle Cloud Text to Speech APIへ連携し、 音声読み上げデータとしてmp3に変換し、保存する :return: """ auth = tweepy.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_token_secret) api = tw...
008bf8a4c08cdce18c1fbea0dc053b8e5a974025
3,623,215
from typing import Optional def is_subject_condition_dataframe( data: SubjectConditionDataFrame, raise_exception: Optional[bool] = True ) -> Optional[bool]: """Check whether dataframe is a :obj:`~biopsykit.utils.datatype_helper.SubjectConditionDataFrame`. Parameters ---------- data : :class:`~pan...
993065496e7fff951986fd2141af7a222060433b
3,623,216
def _update_earned_request(player_id, achievement_id, current_value, max_value): """ Create the DynamoDB update_item parameter request to update earned attribute """ now = ddb.timestamp() return { 'Key': { 'player_id': player_id, 'achievement_id': achievement_id ...
f9c1cd62f537bcd6841ee33d59645fba976c82f9
3,623,217
def mosaic(*rasters): """ Mosaic rasters covering different areas together into one file. Parts of the rasters may overlap each other, in which case we use the value from the last listed raster (the "last" overlap rule). """ # align all rasters, ie resampling to the same dimensions as the first...
fd43edbafc4173129614dcc8ced6aa01390f0d3a
3,623,218
def typing_loop(options, add, atom_type_dict): """ types atoms in ambiguous cases, options should be ordered correctly """ ty = None for option in options: try: ty = atom_type_dict[add + option] break except KeyError: continue if ty !=...
5198375c775cdbf1819998dca4d7c05287ba273d
3,623,219
def enable_func_trace(*args): """ enable_func_trace(enable=True) -> bool """ return _ida_dbg.enable_func_trace(*args)
f2e9944f9651c56ab19fa1b444395d5ccf0df036
3,623,220
def get_exp_or_package_from_repo_name(repo_name): """Helper function to retrieve experiment or InternalPackage DB object based on repository name Useful for tasks that do not have a session or other information""" git_repo = GitRepository.objects.filter(name=repo_name) if git_repo: git_repo = gi...
32403e7b223e55583959e0cd0be556e476be591a
3,623,221
import re def text_to_pronounceable_text(text, symbols_for_base_idx=vowels_and_consonants, captured_alphabet=alpha_numerics, case_sensitive=False, max_word_length=30, ...
d7f60bfc784975b166793edc1e8baee09036c5db
3,623,222
def is_shuffle(s1, s2, s3): """ Runtime: O(n) """ if len(s3) != len(s1) + len(s2): return False i1 = i2 = i3 = 0 while i1 < len(s1) and i2 < len(s2): c = s3[i3] if s1[i1] == c: i1 += 1 elif s2[i2] == c: i2 += 1 else: return False i3 += 1 return True
3b88d117efde1d6b8ea8e0266a9c3ac7ae039458
3,623,223
def header_is_sorted_by_coordinate(header): """Return True if bam header indicates that this file is sorted by coordinate. """ return 'HD' in header and 'SO' in header['HD'] and header['HD']['SO'].lower() == 'coordinate'
b656770806818abe742be32bc14c31a8a8e3e535
3,623,224
def delete( name, endpoint="incidents", id=None, api_url=None, page_id=None, api_key=None, api_version=None, ): """ Remove an entry from an endpoint. endpoint: incidents Request a specific endpoint. page_id Page ID. Can also be specified in the config file. ...
900126d08761793a4f97c1b4acbda224218103da
3,623,225
import re def name_conversion(caffe_layer_name): """ Convert a caffe parameter name to a tensorflow parameter name as defined in the above model """ # beginning & end mapping NAME_MAP = {'bn_conv1/beta': 'conv0/bn/beta', 'bn_conv1/gamma': 'conv0/bn/gamma', 'bn_conv1...
c9025c01eeb8d319a4e76db167f65bac99adf396
3,623,226
def square(x, name=None): """Computes square of x element-wise. I.e., \\(y = x * x = x^2\\). Args: x: An `Output` or `SparseTensor`. Must be one of the following types: `half`, `float32`, `float64`, `int32`, `int64`, `complex64`, `complex128`. name: A name for the operation (optional). Returns:...
666e4b272b454561d2474229ed12ff94b8a629ef
3,623,227
def manually_adjust_data(pnid, sc_entry): """Returns a modified version of sc_entry to fix some issues manually. Args: pnid: string, ProteinNet ID sc_entry: dictionary containing "seq", "ang", "crd" data Returns: If sc_entry must be modified, then it is corrected and returned. ...
90d801a5549b87e15e0c8e45f11de92ab2ad6cea
3,623,228
def get_network_container_hostnames(name): """Returns a list of every container hostname in the specified network.""" for network in get_networks(): if network["Name"] == name: return [get_container_hostname(container) for container in network["Containers"]]
f7b1f176f2c0e5a879930c2189f36f933075664e
3,623,229
def spearmanr_no_pval_vec(X, Y): """Returns spearmans correlation, vectorized version Parameters ---------- X : ndarray (n_samples, n_observations) Y : ndarray (n_samples, 1) Returns ------- R : array (n_observations,) spearmans correlation between each column of X and Y ""...
9a4aeae514d80963ba1d12a574c3aebb8bdc30d4
3,623,230
import json async def surprise_communities(request): """ --- description: This end-point allows to compute surprise_communities Community Discovery algorithm to a network dataset. tags: - surprise_communities produces: - application/json responses: ...
785c2b6e14516b0f5ddd140310fe75fb4759900f
3,623,231
def set_case(words, method="lower", testing=False): """ Perform capitalization on some or all of the strings in `words`. Default method is "lower". Args: words (list): word list generated by `choose_words()` or `find_acrostic()`. method (str): one of {"alter...
92465688c8a7e2e85d2631b8acd8496fab5d0c33
3,623,232
def button(channel, red, blue): """Returns the button for a Combo PWM Mode command.""" return (pf_rc.CHANNEL[channel], PWM_STEP[red], PWM_STEP[blue])
821ce8c5684bb7634281b95960607537de15b4a4
3,623,233
def mini_xception(input_shape, num_classes, regularization = l2(0.01)): """ This function architects the mini_xception model network. This is the best performing model in the facial emotion analysis input_shape: input shape of the image num_classes: number of classes in the output return: Ret...
a7003277cc25e4029cfcf0dea580833f68916af5
3,623,234
def calc_node_size(self): """ calculate minimum node size. """ title_width = self._text_item.boundingRect().width() port_names_width = 0.0 port_height = 0.0 if self._input_items: input_widths = [] for port, text in self._input_items.items(): input_width = port.bo...
9d6b8a37ef13a9698d6523baeacc2da0686c9c4d
3,623,235
def page_osr_vieworder(): """Return everything.""" query = f'SELECT DISTINCT orderdate FROM orderlog' g.cur.execute(query) rows = g.cur.fetchall() return render_template('vieworder.html', dates=rows)
a28ce95ae9930d1da19cd1af817b6376d3dc4f83
3,623,236
def eval_metric_fns(): """Returns a dict from name to metric functions. This can be customized as follows. Care must be taken when handling padded lists. (only takes labels >= 0. def _auc(labels, predictions, features): is_label_valid = tf_reshape(tf.greater_equal(labels, 0.), [-1, 1]) clean_l...
cfa13913bd7132fc558b0e3b4ab71fd8dc9328c7
3,623,237
from typing import List from typing import Dict from typing import Optional from typing import Union def combine_score_weights( weights: List[Dict[str, float]], overrides: Dict[str, Optional[Union[float, int]]] = SimpleFrozenDict(), ) -> Dict[str, float]: """Combine and normalize score weights defined by ...
f75b444a013087350412b1bb65780b42496632af
3,623,238
def calc_ideal_vel(traj_ref, dt): """ Parameters ------------ traj_ref : numpy.ndarray, shape (2, N) these points should follow subseqently dt : float sampling time of system """ # end point and start point diff = traj_ref[:, -1] - traj_ref[:, 0] distance = np.sqrt(n...
45c4ae252c9689d57733ffc4fb0b976999e2b583
3,623,239
def make_rgba(grid2D, levels, colorlist, mask=None, mercator=False): """ Make an rgba (red, green, blue, alpha) grid out of raw data values and provide extent and limits needed to save as an image file Args: grid2D: Mapio Grid2D object of result to mape levels (list): list...
f337ac86909d0941d513648f309602e76dd56374
3,623,241
import binascii def AES_encryption(enc,server=False): """ Performs AES encryption using the globablly declared AES key. """ enc = str(enc) enc = enc + ((16 - len(enc) % 16) * ' ') iv = enc[:16] aes_cipher = None if server: aes_cipher = AES.new(login_server_key, AES.MODE_CBC, iv...
00f89db237a746a6a72cc7f168d14d616aded659
3,623,242
def named_cache_page(cache_timeout): """ Decorator for views that tries getting the page from the cache and populates the cache if the page isn't in the cache yet. The cache is keyed by view name and arguments. """ def wrapper(func): def foo(*args, **kwargs): key = func.__na...
1c946370640bd76c3a4a3d3a6a3c0fe5a76d0215
3,623,243
def get_product(location, product_id, quantity): """ Used by the movement route to get a product from a location. """ product_array = [] db = get_db() b_id = session.get("user_id") if location == "product_factory": # Get product from product table, deduct the quantity ogquantity = d...
cda91efeb3bbc280a609bc560e4a9b9867d6d1ed
3,623,244
def calc_psi_r(qr, r1, r2, r3, r4): """ radial geodesic angle Parameters: qr (float) r1 (float): radial root r2 (float): radial root r3 (float): radial root r4 (float): radial root Returns: psi_r (float) """ kr = ((r1 - r2) * (r3 - r4)) / ((r1 - ...
2d9744361739db19e1c347b902a5844f1a23c655
3,623,245
def mse(tensor_true, tensor_pred): """ Mean squared error Parameters ---------- tensor_true : Tensor tensor_pred : {Tensor, TensorCPD, TensorTKD, TensorTT} Returns ------- float """ tensor_res = residual_tensor(tensor_true, tensor_pred) return np.mean(tensor_res.data ** 2)
afc7bce6515bfc656da3fdb15f5605184bcc10a7
3,623,246