code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def bandand(self): <NEW_LINE> <INDENT> return self.bandbool(Vips.OperationBoolean.AND) | AND image bands together. | 625941d476e4537e8c35186b |
def motorStateChanged(self, state): <NEW_LINE> <INDENT> pass | Callback to take into account a motor state update
To be extended by derivated classes
Arguments:
state -- the motor state | 625941d4ab23a570cc25037b |
def odm(self, path: pd.DataFrame): <NEW_LINE> <INDENT> mvs = { key: self.__mvs[key] for key in list(path) } <NEW_LINE> return util.list_to_dummy(mvs) | Internal method that returns the outer design matrix showing which manifest variables belong to which latent variables in the model. | 625941d4009cb60464c635a8 |
def _two_step_orthogonalization( nfolds: int, tsize: int, df_folds: list, fold_combinations: tuple, nuisance_estim: list, ensemble_weights: np.array, in_ensemble_weights=False, ) -> tuple: <NEW_LINE> <INDENT> orthogonalized_target_and_treatment = [] <NEW_LINE> for cbn in fold_combinations: <NEW_LINE> <INDENT> linear_fo... | orthogonalize features with an ensemble of estimators using precomputed
set of ensemble weights (following Chernozhukov et al., 2017) | 625941d4656771135c3eba68 |
def api_info(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> response = requests.get(API_INFO, timeout=10) <NEW_LINE> response_json = json.loads(response.content) <NEW_LINE> if response.status_code == 200 and response_json.get('criteriaVersion'): <NEW_LINE> <INDENT> print(f"[NOTICE] SSL Labs v{response_json.get('engine... | Checks if API is up, exists if not Up
:return: None | 625941d48e05c05ec3eea56e |
def disable_account(self): <NEW_LINE> <INDENT> from website import mailchimp_utils <NEW_LINE> mailchimp_utils.unsubscribe_mailchimp( list_name=settings.MAILCHIMP_GENERAL_LIST, user_id=self._id, username=self.username ) <NEW_LINE> self.is_disabled = True | Disables user account, making is_disabled true, while also unsubscribing user
from mailchimp emails. | 625941d4b5575c28eb68e1f9 |
def map_value_to_context(self, entity_values, **kwargs): <NEW_LINE> <INDENT> context = {} <NEW_LINE> for kmap in self._map: <NEW_LINE> <INDENT> kval = kmap.map_entity_to_context(entity_values, context_extra_values=kwargs) <NEW_LINE> context.update(kval) <NEW_LINE> <DEDENT> return context | Map data from entity values to view context for rendering.
Values defined in the supplied entity take priority, and the keyword
arguments provide values when the entity does not. | 625941d49c8ee82313fbb96d |
def updateHand(hand, word): <NEW_LINE> <INDENT> h=hand.copy() <NEW_LINE> for w in word: <NEW_LINE> <INDENT> h[w]=h.get(w,0)-1 <NEW_LINE> <DEDENT> return h | Assumes that 'hand' has all the letters in word.
In other words, this assumes that however many times
a letter appears in 'word', 'hand' has at least as
many of that letter in it.
Updates the hand: uses up the letters in the given word
and returns the new hand, without those letters in it.
Has no side effects: does ... | 625941d4d4950a0f3b08c546 |
def __init__(self, capacity, state_shape, device): <NEW_LINE> <INDENT> self.capacity = capacity <NEW_LINE> self.s = torch.empty((self.capacity, *state_shape), device=device) <NEW_LINE> self.a = torch.empty((self.capacity, 1), dtype=torch.long, device=device) <NEW_LINE> self.r = torch.empty((self.capacity, 1), device=de... | Parameters
----------
capacity : int
memory size
s : torch.empty
store state, shape: (capacity, *state_shape)
a : torch.empty
store action, shape: (capacity, 1)
r : torch.empty
store reward, shape: (capacity, 1)
s_ : torch.empty
store next state, shape: (capacity, *state_shape)
save_idx : int
in... | 625941d43d592f4c4ed1d262 |
def highlight(string, is_tty=stdout.isatty()): <NEW_LINE> <INDENT> return ('\033[32;1m' + string + '\033[0m') if is_tty else string | Green text. | 625941d41f037a2d8b9463f6 |
def process_directory(self, source, source_filter, target_format, download_attachments): <NEW_LINE> <INDENT> if not os.path.isdir(source): <NEW_LINE> <INDENT> raise Exception("Source '%s' is not a directory" % source) <NEW_LINE> <DEDENT> ext = source_filter <NEW_LINE> if source_filter == 'todoist': <NEW_LINE> <INDENT> ... | Process all files in a directory that match source_filter | 625941d497e22403b379d192 |
def test_apply_patch(self): <NEW_LINE> <INDENT> testdir = os.path.dirname(os.path.abspath(__file__)) <NEW_LINE> tmpdir = self.test_prefix <NEW_LINE> path = ft.extract_file(os.path.join(testdir, 'sandbox', 'sources', 'toy', 'toy-0.0.tar.gz'), tmpdir) <NEW_LINE> toy_patch_fn = 'toy-0.0_fix-silly-typo-in-printf-statement.... | Test apply_patch | 625941d41b99ca400220aca9 |
def cdfout(data, file): <NEW_LINE> <INDENT> f = open(file, "w") <NEW_LINE> data.sort() <NEW_LINE> for j in range(len(data)): <NEW_LINE> <INDENT> y = old_div(float(j), float(len(data))) <NEW_LINE> out = str(data[j]) + ' ' + str(y) + '\n' <NEW_LINE> f.write(out) <NEW_LINE> <DEDENT> f.close() | spits out the cdf for data to file | 625941d494891a1f4081bca2 |
def test_not_logout_and_not_failed_logins(self): <NEW_LINE> <INDENT> p = self._make_one() <NEW_LINE> environ = self._make_environ('/somewhere') <NEW_LINE> app = p.challenge(environ, '401 Unauthorized', [('app', '1')], [('forget', '1')]) <NEW_LINE> came_from = 'http://example.org/somewhere' <NEW_LINE> redirect = '/login... | Do not modify the challenger unless it's handling a logout or a
failed login. | 625941d44e4d5625662d45ce |
def setDumpLanguage(self, dumpLanguage): <NEW_LINE> <INDENT> self.dumpLanguage = dumpLanguage | Assign the specified dump language. | 625941d444b2445a3393228d |
def pop(self): <NEW_LINE> <INDENT> return None | Removes and returns the item at the front of the queue.
Precondition: the queue is not empty.
Raises: KeyError if queue is empty.
Postcondition: the top item is removed from the queue. | 625941d44f88993c3716c25e |
def GetNeighbours(dataset, labels, referencePoint, k): <NEW_LINE> <INDENT> distances = [] <NEW_LINE> for index in range(len(dataset)): <NEW_LINE> <INDENT> distances.append( [CalculateEuclideanDistance( referencePoint, dataset[index]), DateToSeason(labels[index])]) <NEW_LINE> <DEDENT> distances.sort(key=itemgetter(0)) <... | Receive the k closest points to a given reference point by calculating the using the enclidean distance.
Arguments:
dataset {nparray} -- Numpy array containing the position points.
labels {nparray} -- Numpy array containing all the labels of the points within the dataset.
referencePoint {list} -- Reference... | 625941d4f9cc0f698b1407f2 |
@task() <NEW_LINE> @task_logging <NEW_LINE> def generate_reports(report_template_id=None, data_set=None, taskname="", username=None, levelno=20): <NEW_LINE> <INDENT> logger = logging.getLogger(taskname) <NEW_LINE> report_template = ReportTemplate.objects.get(pk=report_template_id) <NEW_LINE> formats = [] <NEW_LINE> if ... | Import a waterbalance configuration from dbf.
This function is provided for convenience only. It allows us to test the
waterbalance configuration import without the need of a
ConfigurationToValidate. | 625941d4462c4b4f79d1d8c8 |
def get_template_resources_filepaths(root_path, template): <NEW_LINE> <INDENT> paths = [Path(root_path, config.paths.templates, f) or ' ' for f in template.styles_names] <NEW_LINE> paths.append(get_template_filepath(root_path, template.name, template.type)) <NEW_LINE> return paths | :return: list of file paths of resources (css & html) related with given email | 625941d4627d3e7fe0d69049 |
def plot_map(map, map_shape, data_shape): <NEW_LINE> <INDENT> map_2D = np.zeros([0,map_shape[1]*data_shape[1]]) <NEW_LINE> for i in range(map_shape[0]): <NEW_LINE> <INDENT> line = np.zeros([data_shape[0],0]) <NEW_LINE> for j in range(map_shape[1]): <NEW_LINE> <INDENT> neuron = np.reshape(map[map_shape[1]*i+j],data_shap... | affiche la carte
map -- liste des neurones à afficher
map_shape -- taille la carte des vecteurs de la forme (ligne, colonne)
data_shape -- taille des neurones de la forme (ligne, colonne) | 625941d43317a56b86939e4d |
def _read_dzt_markers(self, interpolate=True): <NEW_LINE> <INDENT> self._markers0 = self.data[0, :].copy() - self.data[0, 0] <NEW_LINE> self._markers1 = self.data[1, :].copy() <NEW_LINE> self._marker_idx, *_ = self._markers1.nonzero() <NEW_LINE> dtype = str(self._markers1.dtype) <NEW_LINE> if "int" not in dtype: <NEW_L... | Read dzt markers.
Parameters
----------
interpolate : bool
If True, interpolate the first n missing points with second
order polynomial. | 625941d4a8ecb033257d32c4 |
def __with_normal_field(context): <NEW_LINE> <INDENT> context['site_statistics'] = site_statistics() <NEW_LINE> return context | 增加网站footer的展示数据
:param context:
:return: | 625941d4d8ef3951e3243736 |
def list_main(argv_unused): <NEW_LINE> <INDENT> print("edx_lint knows about these files:") <NEW_LINE> for filename in pkg_resources.resource_listdir("edx_lint", "files"): <NEW_LINE> <INDENT> print(filename) <NEW_LINE> <DEDENT> return 0 | list
List the FILENAMEs that edx_lint can provide. | 625941d4b7558d58953c510a |
def get_event_data(gadget_id): <NEW_LINE> <INDENT> all_events = [] <NEW_LINE> events = GadgetWiring.objects.filter(idResource=gadget_id, wiring='out') <NEW_LINE> for e in events: <NEW_LINE> <INDENT> event_data = {} <NEW_LINE> event_data['friendcode'] = e.friendcode <NEW_LINE> all_events.append(event_data) <NEW_LINE> <D... | Gets the events of the given gadget. | 625941d4d164cc6175782f46 |
def query_by_values(self, dataframe_name, instance_vals, column_name=None, columns=None, time_last=None, training_window=None, include_cutoff_time=True): <NEW_LINE> <INDENT> dataframe = self[dataframe_name] <NEW_LINE> if not column_name: <NEW_LINE> <INDENT> column_name = dataframe.ww.index <NEW_LINE> <DEDENT> instance_... | Query instances that have column with given value
Args:
dataframe_name (str): The id of the dataframe to query
instance_vals (pd.Dataframe, pd.Series, list[str] or str) :
Instance(s) to match.
column_name (str) : Column to query on. If None, query on index.
columns (list[str]) : Columns to retu... | 625941d463f4b57ef000130e |
def testCourse(self): <NEW_LINE> <INDENT> model = swagger_client.models.course.Course() | Test Course | 625941d4460517430c39437a |
def test_interface(self): <NEW_LINE> <INDENT> verify.verifyObject(iwokkel.IPubSubResource, self.resource) | Do instances of L{pubsub.PubSubResource} provide L{iwokkel.IPubSubResource}? | 625941d4a8ecb033257d32c5 |
def read_class_list(self, class_list): <NEW_LINE> <INDENT> with open(class_list) as f: <NEW_LINE> <INDENT> lines = f.readlines() <NEW_LINE> self.images = [] <NEW_LINE> self.labels = [] <NEW_LINE> self.locatn = [] <NEW_LINE> self.images_PPlDtct = [] <NEW_LINE> for l in lines: <NEW_LINE> <INDENT> items = l.split() <NEW_L... | Scan the image file and get the image paths and labels | 625941d48c0ade5d55d3ebb4 |
def y_dot(t,y,x,nu,F): <NEW_LINE> <INDENT> return -(nu*y)+x-(x**3)+(F*np.cos(t)) | y_dot(t,y,x,nu,F)
Describes the differential equation for velocity as given in CW 12. | 625941d48a349b6b435e836c |
def __parse_virtfs(self, conf): <NEW_LINE> <INDENT> self.virtfs = [] <NEW_LINE> if 'virtfs' in conf: <NEW_LINE> <INDENT> virtfs = conf['virtfs'] <NEW_LINE> if type(virtfs) is not list: <NEW_LINE> <INDENT> raise CloubedConfigurationException( "format of virtfs section of domain {domain} is " "no... | Parses the virtfs section of parameters over the conf dictionary
given in parameter and raises appropriate exception if a problem is
found. | 625941d4099cdd3c635f0e53 |
def remove_all_dummy_indices(self, labels=None): <NEW_LINE> <INDENT> orig_shape = self.shape <NEW_LINE> for i, x in enumerate(self.labels): <NEW_LINE> <INDENT> if labels != None: <NEW_LINE> <INDENT> if x in labels and orig_shape[i] == 1: <NEW_LINE> <INDENT> self.move_index(x, 0) <NEW_LINE> self.data = self.data[0] <NEW... | Removes all dummy indices (i.e. indices with dimension 1)
which have labels specified by the labels argument. None
for the labels argument implies all labels. | 625941d4d58c6744b4257e57 |
def setEndTime(self, endTime): <NEW_LINE> <INDENT> self.endTime = endTime | :param endTime: (Optional) 查询截止时间,UTC时间,格式为:yyyy-MM-dd'T'HH:mm:ss'Z',示例:2020-12-07T16:20:00Z,开始时间和结束时间跨度 不能超过4个小时 | 625941d4f8510a7c17cf98f5 |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pro1.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are you sure it... | Run administrative tasks. | 625941d429b78933be1e58a2 |
@cbook.deprecated("3.2", alternative="os.path.exists") <NEW_LINE> def validate_path_exists(s): <NEW_LINE> <INDENT> if s is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if os.path.exists(s): <NEW_LINE> <INDENT> return s <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise RuntimeError('"%s" should be a path ... | If s is a path, return s, else False | 625941d4442bda511e8be60e |
def testMaskErrorIfIncorrectDtype(self): <NEW_LINE> <INDENT> mask = tf.constant(0, shape=(4, 4), dtype=tf.int32) <NEW_LINE> x = tf.constant(0.0, shape=(2, 8, 8, 6)) <NEW_LINE> with self.assertRaises(TypeError) as cm: <NEW_LINE> <INDENT> snt.Conv2D(output_channels=4, kernel_shape=(4, 4), mask=mask)(x) <NEW_LINE> <DEDENT... | Errors are thrown when a Tensor with incorrect dtype is used. | 625941d463b5f9789fde72de |
def tweepy_to_twarc(self, tweet): <NEW_LINE> <INDENT> tw = dict() <NEW_LINE> tw['id'] = tweet.id <NEW_LINE> tw['id_str'] = str(tweet.id) <NEW_LINE> tw['user'] = dict() <NEW_LINE> tw['user']['screen_name'] = tweet.user.screen_name <NEW_LINE> return tw | Convert tweepy status object to a dictionary
:param tweet: tweet to make into dict
:return: dict representation of tweet | 625941d4cc0a2c11143dd089 |
def _ReadExtents(file_obj, extents, block_size, max_length=-1): <NEW_LINE> <INDENT> data = array.array('B') <NEW_LINE> if max_length < 0: <NEW_LINE> <INDENT> max_length = sys.maxsize <NEW_LINE> <DEDENT> for ex in extents: <NEW_LINE> <INDENT> if max_length == 0: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> read_length ... | Reads data from file as defined by extent sequence.
This tries to be efficient by not copying data as it is read in chunks.
Args:
file_obj: file object
extents: sequence of block extents (offset and length)
block_size: size of each block
max_length: maximum length to read (optional)
Returns:
A character ar... | 625941d4be383301e01b567c |
def move_right(self): <NEW_LINE> <INDENT> self._x += self.block_size <NEW_LINE> self.shape_grid_update() | Moves the shape 1 step to the right. | 625941d492d797404e304383 |
@task <NEW_LINE> def shutdown(): <NEW_LINE> <INDENT> run_commands('python manage.py supervisor shutdown') | Shutdown supervisor | 625941d4442bda511e8be60f |
def peak_correlations_for_gene(base_gene_id, counts): <NEW_LINE> <INDENT> counts = counts.loc[counts['result'].str.contains("'"+base_gene_id+"'"),].pivot(index = 'barcode', columns = "result") <NEW_LINE> return counts.corr() | Return correlation matrix for all alternate transcripts for a given gene.
Parameters
----------
base_gene_id : string
The gene name/symbol for the gene of interest
counts : dataframe
counts matrix from seperate_into_peaks() or filtered counts from select_alt_transcripts()
Returns
-------
correlation matrix | 625941d4167d2b6e31218d8e |
def add_path(self, nodes, t=None): <NEW_LINE> <INDENT> nlist = list(nodes) <NEW_LINE> interaction = zip(nlist[:-1], nlist[1:]) <NEW_LINE> self.add_interactions_from(interaction, t) | Add a path at time t.
Parameters
----------
nodes : iterable container
A container of nodes.
t : snapshot id (default=None)
See Also
--------
add_path, add_cycle
Examples
--------
>>> import dynetx as dn
>>> G = dn.DynDiGraph()
>>> G.add_path([0,1,2,3], t=0) | 625941d4d10714528d5ffedd |
def is_configured(): <NEW_LINE> <INDENT> return _CONFIG.is_configured | Return whether ``structlog`` has been configured.
If ``False``, ``structlog`` is running with builtin defaults.
:rtype: bool
.. versionadded: 18.1 | 625941d4de87d2750b85ff8c |
def caa_rec(rdatas): <NEW_LINE> <INDENT> rschema = OrderedDict(( ('flags', lambda flag: ['critical'] if int(flag) > 0 else []), ('tag', lambda tag: RFC.validate(tag, RFC.COO_TAGS)), ('value', lambda val: str(val).strip('"')) )) <NEW_LINE> res = _data2rec_group(rschema, rdatas, 'tag') <NEW_LINE> for tag in ('issue', 'is... | Validate and parse DNS record data for a CAA record
:param rdata: DNS record data
:return: dict w/fields | 625941d407d97122c4178a87 |
def serialize(self, outputStream): <NEW_LINE> <INDENT> self.supplyType.serialize(outputStream) <NEW_LINE> outputStream.write_float(self.quantity); | serialize the class | 625941d430bbd722463cbfc0 |
def KButil_Slice_FeatureSets_by_Genomes(self, params, context=None): <NEW_LINE> <INDENT> return self._client.run_job('kb_SetUtilities.KButil_Slice_FeatureSets_by_Genomes', [params], self._service_ver, context) | :param params: instance of type
"KButil_Slice_FeatureSets_by_Genomes_Params"
(KButil_Slice_FeatureSets_by_Genomes() ** ** Method for Slicing a
FeatureSet or FeatureSets by a Genome, Genomes, or GenomeSet) ->
structure: parameter "workspace_name" of type "workspace_name" (**
The workspace object refs are... | 625941d4283ffb24f3c55af8 |
def handle_request(self): <NEW_LINE> <INDENT> request = self.read_json() <NEW_LINE> if 'method' not in request: <NEW_LINE> <INDENT> raise ValueError("Received a bad request: {0}" .format(request)) <NEW_LINE> <DEDENT> method_name = request['method'] <NEW_LINE> request_id = request.get('id', None) <NEW_LINE> params = req... | Handle a single JSON-RPC request.
Read a request, call the appropriate handler method, and
return the encoded result. Errors in the handler method are
caught and encoded as error objects. Errors in the decoding
phase are not caught, as we can not respond with an error
response to them. | 625941d4d10714528d5ffede |
@bot.message_handler(commands=['start']) <NEW_LINE> def handle_start(message): <NEW_LINE> <INDENT> user_state = user_state_db.get(str(message.from_user.id)) <NEW_LINE> if user_state is None: <NEW_LINE> <INDENT> user_data = { '_id': str(message.from_user.id), 'firstname': message.from_user.first_name, 'state': State.STA... | Handles the 'start' command
Serves as initializer and as the ending point after working with book | 625941d40383005118ecf7db |
def plotPath(path, env): <NEW_LINE> <INDENT> mapping = {0: '←', 1: '↓', 2: '→', 3: '↑'} <NEW_LINE> path = np.array([mapping[i] for i in path]) <NEW_LINE> env2img(env, labels=convV2mat(path, env), char_lab=True) | Use this function to plot the grid with the path (action) for each state
(cell).
Args:
path (array): path array.
env (object): OpenAI Gym environment. | 625941d4a219f33f34628b60 |
def run(self, env, controller, planner): <NEW_LINE> <INDENT> done = False <NEW_LINE> curr_x, info = env.reset() <NEW_LINE> history_x, history_u, history_g = [], [], [] <NEW_LINE> step_count = 0 <NEW_LINE> score = 0. <NEW_LINE> while not done: <NEW_LINE> <INDENT> logger.debug("Step = {}".format(step_count)) <NEW_LINE> g... | Returns:
history_x (numpy.ndarray): history of the state,
shape(episode length, state_size)
history_u (numpy.ndarray): history of the state,
shape(episode length, input_size) | 625941d4f9cc0f698b1407f3 |
def instantiateNewCmd(self): <NEW_LINE> <INDENT> return QadGRIPINSERTREMOVEVERTEXCommandClass(self.plugIn) | istanzia un nuovo comando dello stesso tipo | 625941d4283ffb24f3c55af9 |
def test_get_last_statement(self): <NEW_LINE> <INDENT> self.chatbot.recent_statements.append( (Statement("Test statement 1"), Statement("Test response 1"), ) ) <NEW_LINE> self.chatbot.recent_statements.append( (Statement("Test statement 2"), Statement("Test response 2"), ) ) <NEW_LINE> last_statement = self.chatbot.get... | Make sure that the get last statement method
returns the last statement that was issued. | 625941d424f1403a92600d5e |
def set_nins(self, nins): <NEW_LINE> <INDENT> self._mongo_doc['norEduPersonNIN'] = nins | Set the user's National Identification Numbers,
given as a list of strings.
This removes any previous list
that the user might have had.
:param nins: the National Identification Numbers to set
:type nins: list | 625941d460cbc95b062c673c |
def correlation(x, y): <NEW_LINE> <INDENT> stddev_x = standard_deviation(x) <NEW_LINE> stddev_y = standard_deviation(y) <NEW_LINE> if stddev_x > 0 and stddev_y > 0: <NEW_LINE> <INDENT> return covariance(x, y) / stddev_x / stddev_y <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0 | 返回x和y的相关系数 | 625941d4507cdc57c6306ed7 |
def show_sprite(self, sprite_name, sprite_frame, offset_x=0, offset_y=0): <NEW_LINE> <INDENT> self.sprite = None <NEW_LINE> self.sprite_name = sprite_name <NEW_LINE> self.sprite_frame = sprite_frame <NEW_LINE> self.offset_x = offset_x <NEW_LINE> self.offset_y = offset_y <NEW_LINE> if self.wads is not None: <NEW_LINE> <... | Shows a sprite. | 625941d4fbf16365ca6f63be |
def path_delay(self, gate_list): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> delays = [self.delays[gate] for gate in gate_list] <NEW_LINE> delays = sum(delays) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> print('Error in gate list received for calculating path delay') <NEW_LINE> <DEDENT> return delays | Calculate path delay of gatelist.
Returns path delay. | 625941d40fa83653e46571b3 |
def __init__(self, topology): <NEW_LINE> <INDENT> n_calphas = len([ atm.index for atm in topology.atoms if atm.name == "CA" ]) <NEW_LINE> assert (n_calphas == topology.n_residues), " number of C-alpha is not equal to number of residues! check for missing or non-standard amino acids." <NEW_LINE> self._ref_topology = to... | Calpha representation mapping
Maps an all-atom representation to just the C-alpha's of the backbone.
Holds default assignment of .
Parameters
----------
topology : mdtraj.Topology object | 625941d4656771135c3eba69 |
def test_list_too_long(self): <NEW_LINE> <INDENT> result = get_triangle_type([1, 1, 1, 1]) <NEW_LINE> self.assertEqual(result, 'invalid') | Triangle test | 625941d4adb09d7d5db6c988 |
def visit_comprehension(self, node, parent, assign_ctx=None): <NEW_LINE> <INDENT> newnode = new.Comprehension() <NEW_LINE> newnode.parent = parent <NEW_LINE> newnode.target = self.visit(node.target, newnode, 'Assign') <NEW_LINE> newnode.iter = self.visit(node.iter, newnode, None) <NEW_LINE> newnode.ifs = [self.visit(ch... | visit a Comprehension node by returning a fresh instance of it | 625941d492d797404e304384 |
def version(semverVersion=None): <NEW_LINE> <INDENT> _chdir("source") <NEW_LINE> if not semverVersion: <NEW_LINE> <INDENT> semverVersion = prompt("Enter new semantic version:") <NEW_LINE> if not semverVersion: <NEW_LINE> <INDENT> print("Error: Need a valid version!") <NEW_LINE> return <NEW_LINE> <DEDENT> <DEDENT> local... | Update __version__ strings | 625941d46fb2d068a760f298 |
def schema_of_json(json, options=None): <NEW_LINE> <INDENT> if isinstance(json, str): <NEW_LINE> <INDENT> col = _create_column_from_literal(json) <NEW_LINE> <DEDENT> elif isinstance(json, Column): <NEW_LINE> <INDENT> col = _to_java_column(json) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise TypeError("schema argum... | Parses a JSON string and infers its schema in DDL format.
.. versionadded:: 2.4.0
Parameters
----------
json : :class:`Column` or str
a JSON string or a foldable string column containing a JSON string.
options : dict, optional
options to control parsing. accepts the same options as the JSON datasource
..... | 625941d48e05c05ec3eea56f |
def __init__(self, session): <NEW_LINE> <INDENT> logger.debug("Starting iam wrapper") <NEW_LINE> self.iam_client = session.client(service_name="iam") <NEW_LINE> self.iam_resource = session.resource(service_name="iam") | This function creates the initial client and resource objects
:param session: a boto3 session object for connecting to aws
:return: a wrapper.Iam object for running wrapper commands | 625941d426068e7796caeedb |
def test_pdist_seuclidean_iris_nonC(self): <NEW_LINE> <INDENT> eps = 1e-05 <NEW_LINE> X = eo['iris'] <NEW_LINE> Y_right = eo['pdist-seuclidean-iris'] <NEW_LINE> Y_test2 = pdist(X, 'test_sqeuclidean') <NEW_LINE> self.assertTrue(within_tol(Y_test2, Y_right, eps)) | Tests pdist(X, 'test_seuclidean') [the non-C implementation] on the Iris data set. | 625941d4925a0f43d254a071 |
def get(self, i_key): <NEW_LINE> <INDENT> return self.data.get(i_key) | str/list: Returns the data associated with ``i_key`` or ``None`` if ``i_key`` is not present | 625941d4be7bc26dc91cd7f7 |
@pytest.fixture() <NEW_LINE> def data_store_path(tmp_path): <NEW_LINE> <INDENT> return tmp_path / "test_data_source.json" | Get the path to use as the source of the data store.
Returns:
pathlib.Path: The path to use as the data store. | 625941d4aad79263cf390c3c |
def get_calibration_mean_df(ports_stream_df, use_default_mean=False): <NEW_LINE> <INDENT> if use_default_mean: <NEW_LINE> <INDENT> return np.full((1, ports_stream_df.shape[1]), default_mean) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.array(ports_stream_df.mean()).reshape((1, ports_stream_df.shape[1])) | function for calibration that finds the mean of the of the dataframe to be used by the classify action
function as a base reference value
:param ports_stream_df: PANDAS DATAFRAME
:param use_default_mean: BOOLEAN - use default calibration mean (default=842.6)
:return: NUMPY FLOAT ARRAY - size of number of columns (ports... | 625941d43cc13d1c6d3c7573 |
def create_app(): <NEW_LINE> <INDENT> git_clone_dir = config['cloning']['temporary_clone_path'] <NEW_LINE> if not os.path.exists(git_clone_dir): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.makedirs(git_clone_dir) <NEW_LINE> <DEDENT> except PermissionError: <NEW_LINE> <INDENT> logger.error(f"Gitalizer needs to have ... | Create a new app. | 625941d46fece00bbac2d93a |
def __setitem__(self, op_name, op_code): <NEW_LINE> <INDENT> if self.debug: <NEW_LINE> <INDENT> logging.info("WormOS: loading operation %s, with opcode %s" % (op_name, op_code)) <NEW_LINE> <DEDENT> self.op_codes[op_code] = op_name <NEW_LINE> self.literals.append(op_code) <NEW_LINE> self.op_codes_to_func[op_code] = geta... | provides a standard python api for adding entries like
self[key]=value. in this case, key=op_name, and value=op_code | 625941d40a366e3fb873ea15 |
def get_state(self): <NEW_LINE> <INDENT> return self.options['state'] | The state of the load balancing virtual server.
Default value: ENABLED | 625941d491af0d3eaac9bc14 |
def __init__(self, name, format=None, size=None, dmUuid=None, uuid=None, target=None, exists=False, parents=None, sysfsPath=''): <NEW_LINE> <INDENT> StorageDevice.__init__(self, name, format=format, size=size, exists=exists, uuid=uuid, parents=parents, sysfsPath=sysfsPath) <NEW_LINE> self.target = target <NEW_LINE> sel... | :param name: the device name (generally a device node's basename)
:type name: str
:keyword exists: does this device exist?
:type exists: bool
:keyword size: the device's size
:type size: :class:`~.size.Size`
:keyword parents: a list of parent devices
:type parents: list of :class:`StorageDevice`
:keyword format: this d... | 625941d4cc0a2c11143dd08a |
def SingleStokes(datapath, stokes, slicenumber=1024): <NEW_LINE> <INDENT> basepath='/Users/jhamer/Research/Data' <NEW_LINE> prefix=basepath+'/'+str(datapath) <NEW_LINE> filen=datapath[0:18] <NEW_LINE> data=fits.getdata(prefix+'/'+str(filen)+'_'+SliceNumber(slicenumber)+'.fts.gz') <NEW_LINE> stokesindex=StokesIndex(stok... | NAME: SingleStokes
PURPOSE: Returns an array of the pixel values for an element of the stokes vector for a horizontal slice of the solar disk.
INPUTS: datapath - The final directory in which the FITS files are located
stokes - The element of the stokes profile: I, Q, U, or V
slicenum... | 625941d47cff6e4e81117b7f |
def add_timeout_callback(self, callback, timeout_milliseconds, cleanup=None): <NEW_LINE> <INDENT> if callback in self._timeout_callbacks: <NEW_LINE> <INDENT> raise ValueError("Callback added as a timeout twice") <NEW_LINE> <DEDENT> handle = self._loop.call_later(timeout_milliseconds / 1000.0, self._wrap_timeout(callbac... | Adds a callback to be run once after timeout_milliseconds.
Returns a callable that removes the callback if called. | 625941d48da39b475bd6516e |
def competition(self, jarvis, compId): <NEW_LINE> <INDENT> jarvis.spinner_start('Fetching ') <NEW_LINE> r = fetch("/competitions/{}/standings".format(compId)) <NEW_LINE> if r is None: <NEW_LINE> <INDENT> jarvis.spinner_stop("Error in fetching data - try again later.", Fore.YELLOW) <NEW_LINE> return <NEW_LINE> <DEDENT> ... | Fetches details of a competition and outputs
the competition's current standings | 625941d4cdde0d52a9e5322d |
@login_required <NEW_LINE> def set_share_to(request, share_id): <NEW_LINE> <INDENT> share = get_object_or_404(Share, pk=share_id) <NEW_LINE> post = json.loads(request.raw_post_data) <NEW_LINE> try: <NEW_LINE> <INDENT> operation = post.has_key("operation") and post["operation"] or None <NEW_LINE> groups_id = post.has_ke... | http method: POST
type: json
@param operation: update or add or delete(change the users)
@param groups: a list of group id (type json)
@return: success or failed(a dictionary) | 625941d4dc8b845886cb572f |
def do_disconnect(self, line=None): <NEW_LINE> <INDENT> self.client.disconnect() | Disconnect from the server. | 625941d4046cf37aa974cf40 |
def _update_fallback_values(setup_base: SETUP_CONFIG) -> None: <NEW_LINE> <INDENT> if 'long_description' not in setup_base and 'description' in setup_base: <NEW_LINE> <INDENT> setup_base['long_description'] = setup_base['description'] <NEW_LINE> <DEDENT> for key, value in FALLBACK_VALUES.items(): <NEW_LINE> <INDENT> if... | Update ``setup_base`` with fallback values. | 625941d423e79379d52ee75b |
def __init__(self, rewrite_package_urls=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._rewrite_package_urls = None ... | BowerAttributes - a model defined in OpenAPI | 625941d485dfad0860c3b055 |
def __str__(self): <NEW_LINE> <INDENT> bits = ["url={!r}".format(self.url), "type={!r}".format(self.get_type())] <NEW_LINE> bits = "({})".format(", ".join(bits)) <NEW_LINE> cls = "{c.__module__}.{c.__name__}".format(c=self.__class__) <NEW_LINE> return "{cls}{bits}".format(cls=cls, bits=bits) | Show object info.
Returns:
:obj:`str` | 625941d4796e427e537b07c1 |
def is_num(string): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> float(string) <NEW_LINE> return True <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return False | Check if something is a number | 625941d476e4537e8c35186d |
def query(url, baserequests): <NEW_LINE> <INDENT> url = url + "futureloan/mvc/api/member/list" <NEW_LINE> return baserequests.post(url) | 查询接口
:param url:环境数据,比如:http://jy001:8081/
:param baserequests:Baserequests的实例
:return:响应 | 625941d48a43f66fc4b5425d |
def __cleanup(self, setup_params, project_name): <NEW_LINE> <INDENT> project_api_obj = setup_params["project_api_obj"] <NEW_LINE> if project_api_obj.does_project_exist(project_name): <NEW_LINE> <INDENT> project_api_obj.delete_a_project(project_name) <NEW_LINE> logger.info("Project : {}, successfully deleted".format(pro... | Performs common clean up task of deleting the specified project.
:param setup_params: Dictionary containing the OcpBase
:param project_name:
:return: | 625941d423849d37ff7b3288 |
def set_user_default(self): <NEW_LINE> <INDENT> self.__user = {} <NEW_LINE> self.__user['frame_size'] = (400, 360) <NEW_LINE> self.__user['msg_size'] = (300, 300) <NEW_LINE> self.__user['interval'] = 30 <NEW_LINE> self.__user['text'] = 'Text ..' <NEW_LINE> self.__user['sound'] = 'sounds/pv-bell.mp3' | Set the default dictionairy. | 625941d45fdd1c0f98dc042d |
def _get_actions(self): <NEW_LINE> <INDENT> self.action_edit = self.dlg_cf.findChild(QAction, "actionEdit") <NEW_LINE> self.action_copy_paste = self.dlg_cf.findChild(QAction, "actionCopyPaste") <NEW_LINE> self.action_rotation = self.dlg_cf.findChild(QAction, "actionRotation") <NEW_LINE> self.action_catalog = self.dlg_c... | Sets class variables for actions | 625941d494891a1f4081bca3 |
def close(self): <NEW_LINE> <INDENT> print("PGPooledTransaction - shutting down connection pool") <NEW_LINE> for name, conn in self.pool.iteritems(): <NEW_LINE> <INDENT> conn.close() <NEW_LINE> print("PGPooledTransaction - connection %s closed" % name) | close all pooled connections | 625941d463f4b57ef000130f |
def getAuth(self): <NEW_LINE> <INDENT> return (self.access_key, self.screct_key) | Get auth pair | 625941d4a934411ee375188d |
def take_game_input(self): <NEW_LINE> <INDENT> open_pop_up = False <NEW_LINE> self.__class__._keys_pressed = pygame.key.get_pressed() <NEW_LINE> current_events = pygame.event.get() <NEW_LINE> player_keys = self._player.get_keys() <NEW_LINE> for event in current_events: <NEW_LINE> <INDENT> if event.type == loc.QUIT: <NE... | Retrieves input from the user and translates it into the information
that is needed to run the game.
Output:
* direction: Int
- The direction in which the player should be moving.
1 -> right, -1 -> left, 0 -> no movement.
* jump: Bool
- Whether or not the player should jump.
* ope... | 625941d4d4950a0f3b08c548 |
@detect_batch_decorator <NEW_LINE> def pdf_extraction(pdf, cloud=None, batch=False, api_key=None, version=None, **kwargs): <NEW_LINE> <INDENT> pdf = pdf_preprocess(pdf, batch=batch) <NEW_LINE> url_params = {"batch": batch, "api_key": api_key, "version": version} <NEW_LINE> results = api_handler(pdf, cloud=cloud, api="p... | Given a pdf, returns the text and metadata associated with the given pdf.
PDFs may be provided as base64 encoded data or as a filepath.
Base64 image data and formatted table is optionally returned by setting
`images=True` or `tables=True`.
Example usage:
.. code-block:: python
>>> from indicoio import pdf_extract... | 625941d415baa723493c4171 |
def test_nearest_pandevice_from_firewall_in_pano_dg_fw_ao_chain(self): <NEW_LINE> <INDENT> ret_val = self.firewall.nearest_pandevice() <NEW_LINE> self.assertEqual(self.panorama, ret_val) | Runs nearest_pandevice() on the firewall.
This should return the Panorama PanDevice. | 625941d4be8e80087fb20e3b |
def test_two_args_present(self): <NEW_LINE> <INDENT> self.assertTrue(arg_parser.arg_cond_req_or(self.args_array4, self.opt_con_req_dict3)) | Function: test_two_args_present
Description: Test with two arguments are present.
Arguments: | 625941d47d43ff24873a2e9a |
def _set_hours(self): <NEW_LINE> <INDENT> for session_time in self.filtered('duration'): <NEW_LINE> <INDENT> session_time.duration = session_time.hours / 24 | Changing the duration field in hours fills de duration in
days.
:return: a float field | 625941d43d592f4c4ed1d265 |
def oneTrial(): <NEW_LINE> <INDENT> balls = ['r', 'r', 'r', 'g', 'g', 'g'] <NEW_LINE> chosenBalls = [] <NEW_LINE> for t in range(3): <NEW_LINE> <INDENT> ball = random.choice(balls) <NEW_LINE> balls.remove(ball) <NEW_LINE> chosenBalls.append(ball) <NEW_LINE> <DEDENT> if chosenBalls[0] == chosenBalls[1] and chosenBalls[1... | Simulates one trial of drawing 3 balls out of a bucket containing
3 red and 3 green balls. Balls are not replaced once
drawn. Returns True if all three balls are the same color,
False otherwise. | 625941d41b99ca400220acab |
def deliver_fields(schema, data, access=None): <NEW_LINE> <INDENT> def _(data, field_name, field_schema, prefix): <NEW_LINE> <INDENT> if ('access' in field_schema and data.get(field_name) is not None and access not in field_schema['access']): <NEW_LINE> <INDENT> del data[field_name] <NEW_LINE> <DEDENT> <DEDENT> data = ... | Prepare the data for consumption.
Consider access allowed and will call `deliver`
in the schema if present. | 625941d4d268445f265b5068 |
def create_satellite(self, name, distributor_version='sat-5.6'): <NEW_LINE> <INDENT> distributor = self._retr(self.con.registerConsumer, lambda res: 'uuid' in res, 1, True, self.portal_login, name=name, type={'id': '9', 'label': 'satellite', 'manifest': True}, facts={'distributor_version': distributor_version, 'system.... | Create new Satellite5 distributor on portal | 625941d494891a1f4081bca4 |
def make_degrees_of_freedom_from_nodes(self, dirs): <NEW_LINE> <INDENT> if not ( (type(dirs) is int) or (hasattr(dirs,'__iter__') and type(dirs[0]) is int) ): <NEW_LINE> <INDENT> raise ValueError('dirs must be int or iterable of ints') <NEW_LINE> <DEDENT> id = -1 <NEW_LINE> for k, node in enumerate(self.nodes): <NEW_LI... | Loops over all nodes and adds between 1 and 3 DOFs per node (depending
on which directions to convert to DOFs as specified in 'dirs'). Helper
function to avoid doing this task manually for the common case of
using all nodes as DOFs.
Parameters
----------
dirs : int or iterable of ints
Directions to turn into degree ... | 625941d4187af65679ca5319 |
def create_station(self, folder, options): <NEW_LINE> <INDENT> s = {} <NEW_LINE> path, name = os.path.split(folder) <NEW_LINE> if self.station_exists(name): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self._info('Creating station for folder ' + folder) <NEW_LINE> d = dict(path=folder, name=name) <NEW_LINE> for i in ... | Create a station definition for a folder given the specified options. | 625941d4ff9c53063f47c3ed |
def safe_log(self, msg): <NEW_LINE> <INDENT> self.emit(SIGNAL('log'), msg) | A version of the log() method that can be called from other
threads. | 625941d41f5feb6acb0c4d48 |
def run(self, synchronous=True, **kwargs): <NEW_LINE> <INDENT> kwargs = kwargs.copy() <NEW_LINE> kwargs.update(self._server_config.get_client_kwargs()) <NEW_LINE> if 'data' in kwargs: <NEW_LINE> <INDENT> if 'job_template_id' not in kwargs['data'] and 'feature' not in kwargs['data']: <NEW_LINE> <INDENT> raise KeyError('... | Helper to run existing job template
:param synchronous: What should happen if the server returns an HTTP
202 (accepted) status code? Wait for the task to complete if
``True``. Immediately return the server's response otherwise.
:param kwargs: Arguments to pass to requests.
'data' supports next fields:
... | 625941d44f88993c3716c260 |
def test_output_admin_owner_change_owner_to_member(user_1, user_2, private_channel_1): <NEW_LINE> <INDENT> admin_userpermission_change(user_1["token"], user_2["u_id"], OWNER) <NEW_LINE> admin_userpermission_change(user_1["token"], user_2["u_id"], MEMBER) <NEW_LINE> with pytest.raises(AccessError): <NEW_LINE> <INDENT> c... | Test whether an owner successfully change another owner to a member
| 625941d48c3a8732951585b5 |
def get_regex(bands_list): <NEW_LINE> <INDENT> return re.compile('(' + ')|('.join(bands_list) + ')', flags=re.IGNORECASE) | Makes a regex which match all bands in bands_list. | 625941d44f88993c3716c261 |
def decompress_polynomial_from_hdu(hdu): <NEW_LINE> <INDENT> raw_bytes = to_native_endianness(hdu.data.field(0)) <NEW_LINE> chunk_array = ppc.decode_chunk_array(raw_bytes) <NEW_LINE> return ppc.decompress_polycomp(chunk_array) | Decompress data in a PyFits HDU object using polynomial (de)compression.
| 625941d424f1403a92600d5f |
@when('card broker receives request for player discard') <NEW_LINE> def send_player_discard_request(context): <NEW_LINE> <INDENT> player_id = int(context.table.rows[0]['player id']) <NEW_LINE> card_slot = int(context.table.rows[0]['card slot']) <NEW_LINE> game_id = int(context.table.rows[0]['game id']) <NEW_LINE> reque... | sends request for player to discard card | 625941d4a8370b7717052a99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.