code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def testTrain(self): <NEW_LINE> <INDENT> def input_fn(): <NEW_LINE> <INDENT> return { 'age': constant_op.constant([1]), 'language': sparse_tensor.SparseTensor( values=['english'], indices=[[0, 0]], dense_shape=[1, 1]) }, constant_op.constant([[1]]) <NEW_LINE> <DEDENT> language = feature_column_lib.sparse_column_with_ha... | Tests that loss goes down with training. | 625941cb5fc7496912cc3a48 |
def printHighestTwenty(toptwenty): <NEW_LINE> <INDENT> print("") <NEW_LINE> print("The highest 20 counts: ") <NEW_LINE> for ele in toptwenty: <NEW_LINE> <INDENT> print("{}: {}".format(ele[KEY],ele[VALUE])) | Printing of the Top 20 most used words | 625941cbe64d504609d7490a |
def Clear(self,isShowAll=False): <NEW_LINE> <INDENT> if self.isBomb and self.state==0: <NEW_LINE> <INDENT> if isShowAll == False: <NEW_LINE> <INDENT> self.root.GameOver() <NEW_LINE> self.Explode() <NEW_LINE> self.bbutton.image.source='gameoverflag.png' <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.MarkNum... | triggered when user click the button and think it's empty or has a number | 625941cb10dbd63aa1bd2c6e |
def list_objects(self, bucket_name, frequency): <NEW_LINE> <INDENT> s3 = self.s3_client(bucket_name) <NEW_LINE> prefix = '{dp}/{freq}'.format(dp=self.deployment_prefix, freq=frequency) <NEW_LINE> res = {'objects': []} <NEW_LINE> try: <NEW_LINE> <INDENT> for obj in s3.Bucket(bucket_name).objects.filter(Prefix=prefix): <... | Fetch the list of objects found on the S3 bucket. | 625941cb4c3428357757c3f2 |
def ListInvoices(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') | Returns all invoices associated with a billing setup, for a given month.
| 625941cb26068e7796caeda8 |
def make_buy_factor_unique(self): <NEW_LINE> <INDENT> factor_dict = {'class': AbuSDBreak, 'xd': self.xd.value, 'poly': self.poly.value} <NEW_LINE> factor_desc_key = u'{}拟合{}天趋势突破参照大盘'.format(self.poly.value, self.xd.value) <NEW_LINE> return factor_dict, factor_desc_key | 对应按钮添加AbuSDBreak策略,构建策略字典对象factor_dict以及唯一策略描述字符串factor_desc_key | 625941cbbf627c535bc13299 |
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <... | Returns the model properties as a dict | 625941cb3eb6a72ae02ec5a6 |
def username(self, template=None): <NEW_LINE> <INDENT> name = self.random.choice(USERNAMES) <NEW_LINE> date = str(self.random.randint(1800, 2070)) <NEW_LINE> templates = { 'Ud': '{U}{d}'.format( U=name.capitalize(), d=date, ), 'U.d': '{U}.{d}'.format( U=name.capitalize(), d=date, ), 'ld': '{l}{d}'.format( l=name, d=dat... | Generate username by template.
:param template: Template ('U_d', 'U.d', 'U-d', 'ld', 'l-d', 'Ud',
'l.d', 'l_d', 'default')
:return: Username.
:Example:
Celloid1873 | 625941cbbe383301e01b5550 |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Demoproject.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 ... | Run administrative tasks. | 625941cb30dc7b7665901a31 |
def get_netconf_client_capabilities_output_session_time(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> get_netconf_client_capabilities = ET.Element("get_netconf_client_capabilities") <NEW_LINE> config = get_netconf_client_capabilities <NEW_LINE> if kwargs.pop('delete_get_netconf_client_ca... | Auto Generated Code
| 625941cbf8510a7c17cf97c7 |
def __createTiles(self, length, width, height): <NEW_LINE> <INDENT> rectangles = [] <NEW_LINE> centrePoints = [] <NEW_LINE> totalHeight = length * height <NEW_LINE> totalWidth = length * width <NEW_LINE> y = length <NEW_LINE> while y < totalHeight + length: <NEW_LINE> <INDENT> x = length <NEW_LINE> while x < totalWidth... | Creates a list of tiles and their centre points. | 625941cb63b5f9789fde71b0 |
def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]: <NEW_LINE> <INDENT> return RootModule(self).update(*args, **kwargs) | Update the submodules, keeping the repository consistent as it will
take the previous state into consideration. For more information, please
see the documentation of RootModule.update | 625941cbab23a570cc25024c |
def cut_vertex_balanced(self): <NEW_LINE> <INDENT> _,cut_vertices=self.blocks_and_cut_vertices() <NEW_LINE> vertices=self.vertices() <NEW_LINE> graph_cc_num=self.connected_components_number() <NEW_LINE> graph_order=self.order() <NEW_LINE> best_v=(False,graph_order) <NEW_LINE> for v in cut_vertices: <NEW_LINE> <INDENT> ... | Returns a cut vertex which cuts the graph into pieces with
smallest maximum size.
:return: a cut-vertex (if one exists) that either results in
components with a minimum of the maximum component order.
If no cut vertex exists, returns ``False``.
EXAMPLES::
sage: graphs.PathGraph(3).cut_vertex_balanced()
... | 625941cb66673b3332b9215b |
def metaclasses(bases): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> metas = [type(base) for base in bases] <NEW_LINE> for k,meta in enumerate(metas): <NEW_LINE> <INDENT> if not any(issubclass(m, meta) for m in metas[k+1:]): <NEW_LINE> <INDENT> ret.append(meta) <NEW_LINE> <DEDENT> <DEDENT> if type in ret: <NEW_LINE> <INDENT... | Returns 'proper' metaclasses for the classes in bases
| 625941cb851cf427c661a5d9 |
def __eprint(self, *args, **kwargs): <NEW_LINE> <INDENT> print(*args, file=sys.stderr, **kwargs) | Default print function: print to sys.stderr.
Follows same format as print(). | 625941cb5166f23b2e1a5223 |
def compute_cost(prediction, Y): <NEW_LINE> <INDENT> cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(logits=prediction,labels=Y)) <NEW_LINE> return cost | Computes the cost
Arguments:
Z3 -- output of forward propagation (output of the last LINEAR unit), of shape (number of examples,10)
Y -- "true" labels vector placeholder, same shape as Z3
Returns:
cost - Tensor of the cost function | 625941cb29b78933be1e5777 |
def parse_info(tab, info): <NEW_LINE> <INDENT> for row in tab: <NEW_LINE> <INDENT> t = re.compile('(\s)+=(\s)+').split(row) <NEW_LINE> for i in range(len(t) - 2): <NEW_LINE> <INDENT> while ' ' in t: <NEW_LINE> <INDENT> t.remove(' ') <NEW_LINE> <DEDENT> <DEDENT> if t[0] == info: <NEW_LINE> <INDENT> return t[1] <NEW_LINE... | Return value associated to an information in info file
e.g. 'task = multilabel.classification'
return 'multilabel' | 625941cbd7e4931a7ee9dfe8 |
def make_icosahedron_mesh(): <NEW_LINE> <INDENT> t = (1 + math.sqrt(5)) / 2 <NEW_LINE> a = t / math.hypot(1, t) <NEW_LINE> b = 1 / math.hypot(1, t) <NEW_LINE> vertices = as_float_array([ ( a, b, 0), (-a, b, 0), ( a, -b, 0), (-a, -b, 0), ( b, 0, a), ( b, 0, -a), (-b, 0, a), (-b, 0, -a), ( 0, a, b), ( 0, -a... | Return a Mesh object representing triangulated icosahedron.
| 625941cb2ae34c7f2600d1fb |
def _load_children(self, data, idict): <NEW_LINE> <INDENT> for item in data.getchildren(): <NEW_LINE> <INDENT> if item.tag in self.ignore: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> elif item.tag in self.containers: <NEW_LINE> <INDENT> self.children.append(self.__class__(item, idict, self)) <NEW_LINE> <DEDENT> el... | load children | 625941cb7cff6e4e81117a50 |
def test_return_single_var(self): <NEW_LINE> <INDENT> def true_func(): <NEW_LINE> <INDENT> return layers.fill_constant(shape=[2, 3], dtype='int32', value=2) <NEW_LINE> <DEDENT> def false_func(): <NEW_LINE> <INDENT> return layers.fill_constant(shape=[3, 2], dtype='int32', value=-1) <NEW_LINE> <DEDENT> main_program = Pro... | pseudocode:
if 0.23 < 0.1:
return 2
else:
return -1 | 625941cb283ffb24f3c559cc |
def test_create_new_placements(self): <NEW_LINE> <INDENT> subv = PartitionedVertex(None, "") <NEW_LINE> pl = Placement(subv, 0, 0, 1) <NEW_LINE> Placements([pl]) | test creating a placements object
:return: | 625941cb16aa5153ce362543 |
def extract(self, myfile): <NEW_LINE> <INDENT> pass | Return a mapping filled with the file metadatas | 625941cba8ecb033257d3198 |
def getVersion(): <NEW_LINE> <INDENT> version_py = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'fast_tools/tool1/version.py') <NEW_LINE> try: <NEW_LINE> <INDENT> version_git = subprocess.check_output(["git", "describe", "--tags"]).rstrip() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> with open(version_p... | Fetch version from git tags, and write to version.py.
Also, when git is not available, use stored version.py. | 625941cb55399d3f0558877e |
def values(self, identifier, start_date, end_date): <NEW_LINE> <INDENT> raise NotImplementedError | Return values in list of dictionaries (datetime, value, unit)
| 625941cbf9cc0f698b1406c6 |
@contextmanager <NEW_LINE> def tempdirfile(dirname=None, keep=False, report=False): <NEW_LINE> <INDENT> tempdirname = None <NEW_LINE> try: <NEW_LINE> <INDENT> tempdirname = tf.mkdtemp(dir=dirname) <NEW_LINE> if report: <NEW_LINE> <INDENT> print(f'created temporary directory {tempdirname}') <NEW_LINE> <DEDENT> tempfilen... | Yields a filename "tempfile" in a temporary directory which is
removed when context is closed. Note that the directory is created,
but the file "tempfile" not. | 625941cb63d6d428bbe445ba |
def iter_record(record: SeqRecord) -> Generator[Tuple, None, None]: <NEW_LINE> <INDENT> for nuc, qual in zip(record, record.letter_annotations["phred_quality"]): <NEW_LINE> <INDENT> prob = 10 ** -(qual / 10) <NEW_LINE> yield nuc, prob | Read nucletide type and error prob base by base from a seq record. | 625941cbab23a570cc25024d |
def set_favorite(self, id, callback): <NEW_LINE> <INDENT> self.log.debug('Solicitando status como favorito: %s' % id) <NEW_LINE> self.protocol.to_fav.append(id) <NEW_LINE> self.__register(self.protocol.mark_favorite, {'id': id}, callback) | Estableciendo status como favorito | 625941cbd18da76e235325a1 |
def completable(self): <NEW_LINE> <INDENT> portal = getToolByName(self, 'portal_url').getPortalObject() <NEW_LINE> wf_tool = getToolByName(portal, 'portal_workflow') <NEW_LINE> tasks = self.getStoryTasks() <NEW_LINE> for task in tasks: <NEW_LINE> <INDENT> review_state = wf_tool.getInfoFor(task, 'review_state') <NEW_LIN... | Test if all tasks in this iteration have completed. | 625941cb5fdd1c0f98dc02fe |
def hasWon(board, player): <NEW_LINE> <INDENT> for i in range(1, 4): <NEW_LINE> <INDENT> if( board[i] == board[(i+3)] and board[i] == board[(i+6)] == player): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> for i in range(1, 8, 3): <NEW_LINE> <INDENT> if( board[i] == board[(i+1)] and board[i] == board[(i+2... | Def the win condition | 625941cb56b00c62f0f14724 |
def get_active_filters(self): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> for i in self.filters.values(): <NEW_LINE> <INDENT> if isinstance(i, self.FilterGroup): <NEW_LINE> <INDENT> for f in i.filters.values(): <NEW_LINE> <INDENT> if f.active: <NEW_LINE> <INDENT> ret.append(f) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> else: <N... | Returns a list of all active filters contained in this manager
| 625941cb15fb5d323cde0bda |
def load_fwhm_map(self, fwhm_map, gain_corrected=None): <NEW_LINE> <INDENT> if gain_corrected is None: <NEW_LINE> <INDENT> gain_corrected = 'nogain' not in fwhm_map <NEW_LINE> if 'gain' not in fwhm_map: <NEW_LINE> <INDENT> raise Exception('Could not determine from the file name ' + 'whether the FWHM map was corrected f... | Sets the '_fwhm_map' and '_gain_corrected' attributes of this
instance based on a path to the fwhm map data file.
Arguments:
fwhm_map: str
A path to an ascii file containing FWHM map data.
Keyword Arguments:
gain_corrected: bool
If True, indicated that the supplied FWHM data was gain
... | 625941cb66673b3332b9215c |
def search(self, **kwargs): <NEW_LINE> <INDENT> return keyword_search(self.tasks, **kwargs) | Search the process list for matching rows based on key-value pairs.
This uses the py:func:`insights.parsers.keyword_search` function for
searching; see its documentation for usage details. If no search
parameters are given, no rows are returned.
Examples:
>>> no_owner_tasks = tasks.search(Owner='')
>>> len(... | 625941cb498bea3a759b9b7a |
def parse_input(filename): <NEW_LINE> <INDENT> lines = [] <NEW_LINE> with open(filename, 'r') as fh: <NEW_LINE> <INDENT> lines = fh.readlines() <NEW_LINE> <DEDENT> numbers = [] <NEW_LINE> boards = [] <NEW_LINE> numbers = list(map(int, lines[0].strip().split(','))) <NEW_LINE> index = 2 <NEW_LINE> while index < len(lines... | Parses the input file to get the numbers called and the boards. | 625941cbd486a94d0b98e210 |
def get_logs(self, name, namespace=None, master=True, replica_type=None, replica_index=None, follow=False, container="pytorch"): <NEW_LINE> <INDENT> if namespace is None: <NEW_LINE> <INDENT> namespace = utils.get_default_target_namespace() <NEW_LINE> <DEDENT> pod_names = self.get_pod_names(name, namespace=namespace, ma... | Get training logs of the PyTorchJob.
By default only get the logs of Pod that has labels 'job-role: master'.
:param container: container name
:param name: PyTorchJob name
:param namespace: defaults to current or default namespace.
:param master: By default get pod with label 'job-role: master' pod if True.
... | 625941cbf7d966606f6aa0cf |
def file_yield(self, input_name): <NEW_LINE> <INDENT> with open( input_name, 'r' ) as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> yield line | 利用yield生成器,迭代的获取这个文件的行信息
:param input_name:
:return: | 625941cb3346ee7daa2b2e36 |
def __init__(self, args): <NEW_LINE> <INDENT> self.data_path = args.dataset_path <NEW_LINE> self.dataset_name = args.dataset_name <NEW_LINE> self.args = args <NEW_LINE> self.indexes_of_folders_indicating_class = args.indexes_of_folders_indicating_class <NEW_LINE> self.labels_as_int = args.labels_as_int <NEW_LINE> self.... | A data provider class inheriting from Pytorch's Dataset class. It takes care of creating task sets for
our few-shot learning model training and evaluation
:param args: Arguments in the form of a Bunch object. Includes all hyperparameters necessary for the
data-provider. For transparency and readability reasons to expli... | 625941cb60cbc95b062c660e |
def getdatatype(self, filename=None): <NEW_LINE> <INDENT> if filename: <NEW_LINE> <INDENT> node = self.getfilenode(filename) <NEW_LINE> if not node is None: <NEW_LINE> <INDENT> return node.get("datatype") <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> filenames = self.getfilenames() <NEW_LINE> if len(filenames)... | Returns the datatype of the stored file. If no filename is given,
the datatype of the first file is given. | 625941cb66656f66f7cbc276 |
def __init__(self, all_dn=set(), delimeter="."): <NEW_LINE> <INDENT> self.delimeter = delimeter <NEW_LINE> self.childs = {} <NEW_LINE> self.parent = {} <NEW_LINE> self.fake_parent = {} <NEW_LINE> self.dn_set = set() <NEW_LINE> self.parent[""] = "" <NEW_LINE> self.childs[""] = [] <NEW_LINE> for dn in all_dn: <NEW_LINE> ... | Create new DnTree object.
all_dn - set of dn to initially add to a tree
delimeter - delimter used to split relative name and parent DN. | 625941cb377c676e91272273 |
def insert(self, word): <NEW_LINE> <INDENT> curr = self.root <NEW_LINE> for c in word: <NEW_LINE> <INDENT> if c not in curr.children: <NEW_LINE> <INDENT> curr.children[c] = TrieNode() <NEW_LINE> <DEDENT> curr = curr.children[c] <NEW_LINE> <DEDENT> curr.isTerminal = True | Inserts a word into the trie.
:type word: str
:rtype: void | 625941cbc4546d3d9de72aff |
def groebnerMultMatrix(polys, poly_type, method): <NEW_LINE> <INDENT> if method == 'Groebner': <NEW_LINE> <INDENT> GB = F4(polys) <NEW_LINE> <DEDENT> elif method == 'Macaulay': <NEW_LINE> <INDENT> GB = Macaulay(polys) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> GB = new_macaulay(polys) <NEW_LINE> <DEDENT> dim = max(g... | Called by the main roots function to calculate the multiplication matrix
if we are using the f4 Groebner or Macaulay implementation. It returns
everything that the roots function needs to proceed with the root finding
calculations.
Parameters
----------
polys : list of Polynomials
Polynomials to find the common roo... | 625941cbad47b63b2c50a04a |
def get_http_referer(request): <NEW_LINE> <INDENT> http_referer = '' <NEW_LINE> if 'HTTP_REFERER' in request.META: <NEW_LINE> <INDENT> http_referer = request.META['HTTP_REFERER'] <NEW_LINE> <DEDENT> return http_referer | Returns http_referer from user request if it exists. | 625941cb287bf620b61d3b2f |
def parse(self, data, mode, **kwargs): <NEW_LINE> <INDENT> results = [] <NEW_LINE> try: <NEW_LINE> <INDENT> torrents = data['Fs'][0]['Cn']['torrents'] <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> return results <NEW_LINE> <DEDENT> for torrent in torrents: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> title ... | Parse search results from data
:param data: response data
:param mode: search mode
:return: search results | 625941cb7cff6e4e81117a51 |
def image_mirror(img): <NEW_LINE> <INDENT> distort_left_right_random = tf.random_uniform([], 0, 1.0, dtype=tf.float32) <NEW_LINE> mirror = tf.less(tf.stack([1.0, distort_left_right_random, 1.0]), 0.5) <NEW_LINE> mirror = tf.boolean_mask([0, 1, 2], mirror) <NEW_LINE> img = tf.reverse(img, mirror) <NEW_LINE> return img | Randomly mirrors the image.
Inputs:
img: img to mirror.
Outputs:
img: img after mirror. | 625941cb2c8b7c6e89b3588c |
def getResolverId(self): <NEW_LINE> <INDENT> return "sql." + self.resolverId | Returns the resolver Id
This should be an Identifier of the resolver, preferable the type
and the name of the resolver. | 625941cb5166f23b2e1a5224 |
def is_finished(self): <NEW_LINE> <INDENT> return self.state in ('w', 'l') | Return True if the game is no longer in progress. | 625941cb63f4b57ef00011e5 |
def Washer(scores): <NEW_LINE> <INDENT> values['payment_amount'] = scores[0]*25 <NEW_LINE> setWashers(values) <NEW_LINE> values2['payment_amount'] = scores[1]*25 <NEW_LINE> setWashers(values2) | calculates pennies to send to washing machine | 625941cb5e10d32532c5eff2 |
def check_global_minima(self,value, t, index): <NEW_LINE> <INDENT> if value < self._global_minima_value: <NEW_LINE> <INDENT> self._global_minima_value = value <NEW_LINE> <DEDENT> elif value == self._global_minima_value: <NEW_LINE> <INDENT> if self._global_minima_t is not None and self._periodicity is None: <NEW_LINE> <... | [summary]
Method that finds the global (gurantueed in this case due to periodicity) minima of the function. Also funds the period.
Args:
value ([float]): [Value of h(t) at t]
t ([gloat]): [Current t]
index ([int]): [Index of current t and h(t)] | 625941cba17c0f6771cbe11b |
@bot.callback("confirm") <NEW_LINE> def confirm(chat, message, data): <NEW_LINE> <INDENT> door = int(r.get('door')) - 1 <NEW_LINE> r.set('door', door) <NEW_LINE> bt = botogram.Buttons() <NEW_LINE> d.execute('UPDATE request SET stage=4 WHERE userid=?', (chat.id, )) <NEW_LINE> dat.commit() <NEW_LINE> d.execute("SELECT id... | confirm the request, and send it to the staff group | 625941cb236d856c2ad448a5 |
def get_unit_price(self): <NEW_LINE> <INDENT> unit_price = float('Inf') <NEW_LINE> if self.amount_for_sale > 0: <NEW_LINE> <INDENT> unit_price = float(self.amount_desired) / float(self.amount_for_sale) <NEW_LINE> <DEDENT> return unit_price | Upper price limit | 625941cb8e7ae83300e4b097 |
def test_basic_checks(qtmodeltester): <NEW_LINE> <INDENT> tree = TreeModel() <NEW_LINE> model = TableModel() <NEW_LINE> model.setSourceModel(tree) <NEW_LINE> qtmodeltester.check(model) | Check the model for basic issues | 625941cb925a0f43d2549f42 |
def __iter__(self): <NEW_LINE> <INDENT> return iter((str(self._galleons) + 'g', str(self._sickles) + 's', str(self._knuts) + 'k')) | Examples:
>>> amt = WizardMoney(2, 5, 10)
>>> for i in amt: print(i)
...
2g
5s
10k | 625941cbbde94217f3682ebc |
def p_DECL_ASSIGNMENT(p): <NEW_LINE> <INDENT> pass | DECL : TYPE VARIABLES equals EXPRESSION | 625941cb50485f2cf553ce65 |
def addTraining(self, left_eye, right_eye, im): <NEW_LINE> <INDENT> true_rect = face_from_eyes(left_eye,right_eye) <NEW_LINE> rects = self.face_detector.detect(im) <NEW_LINE> for pred_rect in rects: <NEW_LINE> <INDENT> if is_success(pred_rect,true_rect): <NEW_LINE> <INDENT> laffine,raffine = self.generateTransforms(pre... | Train an eye detector givin a full image and the eye coordinates. | 625941cb462c4b4f79d1d79c |
def _dz_bar_dphi(self, z_bar): <NEW_LINE> <INDENT> return -self._dz_dphi(z_bar) | almost the same as eq. 11 from Cassan (2008) | 625941cbb5575c28eb68e0cb |
def getCycle(self): <NEW_LINE> <INDENT> return self._cycle | Returns the current cycle of the environment.
Return
------
int: Current cycle. | 625941cb15baa723493c4040 |
def get_interface_details(interface): <NEW_LINE> <INDENT> info = {} <NEW_LINE> info["name"] = interface <NEW_LINE> for_fm = click.confirm( "Is this interface for Farm Monitor(y) or for external access(n)", default=False ) <NEW_LINE> info["is_for_fm"] = for_fm <NEW_LINE> info["state"] = click.prompt( "Should this interf... | Collect all required details for an interface from user.
interface: a string that is the name of the interface
Returns: a dictionary with required info. Keys are 'is_for_fm',
'state', and 'ssid' and 'password' if applicable | 625941cb293b9510aa2c3362 |
def show_fire_map(self, do_print=True): <NEW_LINE> <INDENT> if self.grid_type == '2d': <NEW_LINE> <INDENT> out = '' <NEW_LINE> for x in range(self.xdim): <NEW_LINE> <INDENT> for y in range(self.ydim): <NEW_LINE> <INDENT> out += str(self.view_locale(x, y, fire_state=True)) <NEW_LINE> <DEDENT> out += '\n' <NEW_LINE> <DED... | Display a visual representation of the self.space attribute with fire state layered on if do_print.
Args:
do_print (bool):
Returns:
str: | 625941cb004d5f362079a3fe |
def test_email_sent_when_status_changed(self): <NEW_LINE> <INDENT> with self.can_send_feedback_email_ctx, self.can_send_emails_ctx: <NEW_LINE> <INDENT> feedback_services.create_thread( feconf.ENTITY_TYPE_EXPLORATION, self.exploration.id, self.user_id_a, 'a subject', 'some text') <NEW_LINE> threadlist = feedback_service... | Tests Feedback Thread Status Change Email Handler. | 625941cbbf627c535bc1329a |
def set_password(self, password): <NEW_LINE> <INDENT> if not password: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> validating = password_for_validating(password) <NEW_LINE> if validating != self._data[ATTR_PROTECTED]: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> self._key = password_to_key(password) <N... | Set the password for a exists snapshot. | 625941cb4f88993c3716c133 |
@app.route('/error_handle_test_badrequest') <NEW_LINE> def error_handle_test_badrequest(): <NEW_LINE> <INDENT> raise BadRequest("my BadRequest message") | エラーハンドリング確認用
※register_error_handler(BadRequest)でBadRequest例外を処理する確認 | 625941cbfbf16365ca6f628f |
def least_squares(points: np.ndarray, axis: Optional[Any] = None) -> np.ndarray: <NEW_LINE> <INDENT> x = points[:, 0] <NEW_LINE> y = points[:, 1] <NEW_LINE> X = np.vstack((np.ones(x.shape[0]), x)).T <NEW_LINE> normal_matrix = np.dot(X.T, X) <NEW_LINE> moment_matrix = np.dot(X.T, y) <NEW_LINE> beta_hat = np.dot(n... | Функция для аппроксимации массива точек прямой, основанная на
методе наименьших квадратов.
:param points: Входной массив точек формы [N, 2]
:param axis: Набор осей, на которых рисовать график
:return: Numpy массив формы [N, 2] точек на прямой | 625941cbd4950a0f3b08c41b |
def scatterPlot(X,Y,features=(0,1)): <NEW_LINE> <INDENT> fig = plt.figure() <NEW_LINE> f1,f2 = features[0],features[1] <NEW_LINE> class0 = np.where(Y == 0) <NEW_LINE> class1 = np.where(Y == 1) <NEW_LINE> class2 = np.where(Y == 2) <NEW_LINE> class3 = np.where(Y == 3) <NEW_LINE> if (len(features) == 3): <NEW_LINE> <INDEN... | Plots 2 or 3 features of the dataset in a scatter plot
input:
X : the array containing vectorized examples in its rows
Y : the array containing the class of each example
features : a tuple giving the indices of the features to display
it can have length 2 or 3
a length of 2 will result ... | 625941cbe64d504609d7490b |
@app.route('/13f/') <NEW_LINE> @app.route('/13F/') <NEW_LINE> def institutional_list(): <NEW_LINE> <INDENT> if 'fund' in session and session['fund'] != '': <NEW_LINE> <INDENT> return(redirect('/13F/' + str(session['fund']['cik']))) <NEW_LINE> <DEDENT> params = {} <NEW_LINE> try: <NEW_LINE> <INDENT> page = int(request.a... | 13F list view | 625941cbbaa26c4b54cb11eb |
def create_daemon_set(apps_v1_api: AppsV1Api, namespace, body) -> str: <NEW_LINE> <INDENT> print("Create a daemon-set:") <NEW_LINE> apps_v1_api.create_namespaced_daemon_set(namespace, body) <NEW_LINE> print(f"Daemon-Set created with name '{body['metadata']['name']}'") <NEW_LINE> return body["metadata"]["name"] | Create a daemon-set based on a dict.
:param apps_v1_api: AppsV1Api
:param namespace: namespace name
:param body: dict
:return: str | 625941cb4a966d76dd5510da |
def is_free_cell(self, cell, surrounds): <NEW_LINE> <INDENT> return True | To be implemented by subclasses. | 625941cb091ae3566866702a |
def layout_variables_changed(self): <NEW_LINE> <INDENT> data_source_name = LayoutUtils.get_stdm_data_source_for_layout(self._layout) <NEW_LINE> self.load_data_source_fields(data_source_name) | When the user changes the data source then update the fields. | 625941cb1f037a2d8b9462c9 |
def _register(self, system): <NEW_LINE> <INDENT> pass | Register the router with the system event loop.
:param system: the rest of the system | 625941cbadb09d7d5db6c85b |
def output_multiple(self): <NEW_LINE> <INDENT> return _EnergyBeamforming_swig.tx_packet_source_sptr_output_multiple(self) | output_multiple(tx_packet_source_sptr self) -> int | 625941cbe5267d203edcdd6a |
def show_info(self): <NEW_LINE> <INDENT> header = html_header() <NEW_LINE> footer = html_footer() <NEW_LINE> string = header <NEW_LINE> heading = m.Heading(self.tr('OSM Downloader'), **INFO_STYLE) <NEW_LINE> body = self.tr( 'This tool will fetch building (\'structure\') or road (' '\'highway\') data from the OpenStreet... | Show usage info to the user. | 625941cb99fddb7c1c9de45d |
def cve_match(expected, cve, rh_data_required): <NEW_LINE> <INDENT> not_match = {} <NEW_LINE> for key, value in expected.items(): <NEW_LINE> <INDENT> if not rh_data_required and key in ('redhat_url', 'secondary_url'): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if key == 'cvss3_score' and value: <NEW_LINE> <INDENT... | Checks if expected cve record matches cve record. | 625941cbbe8e80087fb20d0f |
def append(self, s): <NEW_LINE> <INDENT> self.buffer.write(s) | Append content to the SchemaIterator's query buffer. | 625941cbff9c53063f47c2bf |
def main(vis, verbose=False): <NEW_LINE> <INDENT> global app <NEW_LINE> if verbose: <NEW_LINE> <INDENT> print('Setting up app') <NEW_LINE> <DEDENT> app = QApplication.instance() <NEW_LINE> if app is None: <NEW_LINE> <INDENT> app = QApplication(sys.argv) <NEW_LINE> <DEDENT> if verbose: <NEW_LINE> <INDENT> print('Setting... | app must be defined already!!! | 625941cb97e22403b379d065 |
def get_true_output_dict(self): <NEW_LINE> <INDENT> return self.true_dataY | :return: the output data dictionnary. key: varname, value=true value of this data | 625941cb3539df3088e2e416 |
def testBuiltinFunction(self): <NEW_LINE> <INDENT> method = 'len(' <NEW_LINE> (name, argspec, tip) = introspect.getCallTip(method, locals()) <NEW_LINE> self.assertEquals('len', name) <NEW_LINE> if not sys.platform.startswith('java'): <NEW_LINE> <INDENT> self.assertEquals('', argspec) <NEW_LINE> self.assertEquals('len(o... | Builtin types don't work, like they do in PyCrust. This is because they have a null __doc__ string in Jython. | 625941cb07d97122c4178956 |
def __init__(self): <NEW_LINE> <INDENT> pygame.sprite.Sprite.__init__(self) <NEW_LINE> self.image=pygame.image.load('lives.png') <NEW_LINE> self.image = self.image.convert_alpha() <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.rect.left= 20 <NEW_LINE> self.rect.top=10 <NEW_LINE> self.__lives=3 | This initializer loads the lives image, sets up the rect and
starting value of 3 for lives | 625941cb07f4c71912b1154d |
def set_cookie(response, name, value, domain=None, path="/", expires=None, encrypt=True): <NEW_LINE> <INDENT> if expires == 0: <NEW_LINE> <INDENT> timestamp = str(0) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> timestamp = str(int(time.time())) <NEW_LINE> <DEDENT> value = base64.b64encode(value) <NEW_LINE> signature =... | Generates and signs a cookie for the given name/value | 625941cb29b78933be1e5778 |
def test_ssesolve_homodyne(): <NEW_LINE> <INDENT> tol = 0.01 <NEW_LINE> N = 4 <NEW_LINE> gamma = 0.25 <NEW_LINE> ntraj = 25 <NEW_LINE> nsubsteps = 100 <NEW_LINE> a = destroy(N) <NEW_LINE> H = a.dag() * a <NEW_LINE> psi0 = coherent(N, 0.5) <NEW_LINE> sc_ops = [sqrt(gamma) * a] <NEW_LINE> e_ops = [a.dag() * a, a + a.dag(... | Stochastic: smesolve: homodyne | 625941cb8e05c05ec3eea440 |
def forward(self, x, hidden_state=None, transpose=False): <NEW_LINE> <INDENT> if hidden_state is not None: <NEW_LINE> <INDENT> self.h = hidden_state <NEW_LINE> <DEDENT> if transpose: <NEW_LINE> <INDENT> x = x.transpose(1, 0, 2) <NEW_LINE> <DEDENT> T, N, D = x.shape <NEW_LINE> output = np.empty((T, N, self.hidden_dim)) ... | Inputs:
- x: Input data for the entire timeseries, of shape (T, N, D). | 625941cb94891a1f4081bb75 |
def __init__(self, name, symbol, engine): <NEW_LINE> <INDENT> super(SimpleEmaStrategy, self).__init__(name, symbol, engine) | Constructor | 625941cb91f36d47f21ac5be |
def test_change_par2(self): <NEW_LINE> <INDENT> self.gmodel.amplitude[0] = 11 <NEW_LINE> assert_almost_equal( self.gmodel.param_sets, np.array([[11., 10], [3.5, 5.2], [0.4, 0.7]])) <NEW_LINE> np.all(self.gmodel.parameters == [11.0, 10.0, 3.5, 5.2, 0.4, 0.7]) | Test that a change to one single parameter in a set propagates to
param_sets. | 625941cb187af65679ca51ea |
def featMomentum(dFullData, serie='close', lLookback=12): <NEW_LINE> <INDENT> dfPtn = dFullData[serie].shift(lLookback) <NEW_LINE> return dFullData[serie] - dfPtn | @summary: price change in the last n periods | 625941cbad47b63b2c50a04b |
def plot_contour_2d_solution_space(func, fig=None, ax=None, show=True, xmin=-np.ones(2), xmax=np.ones(2), xstar=None, xvisited=None, x1_grid_size=200, x2_grid_size=200, figsize=(12, 8), x1_label=r"$x_1$", x2_label=r"$x_2$", xstar_label=r"$x^*$", title_fontsize=12, label_fontsize=12, legend_fontsize=12, title=""): <NEW_... | Plot points visited during the execution of an optimization algorithm.
TODO | 625941cb167d2b6e31218c62 |
def object_delete(self,reg_obj_id,connection): <NEW_LINE> <INDENT> return connection.object_delete(reg_obj_id) | Remove the object from the registry (allowing
the garbage collector to reap it) | 625941cbb830903b967e99d7 |
def loadImage( path): <NEW_LINE> <INDENT> return context.loadImage_( path) | Attempts to load an image from disk.
Returns 0 if the image could not be loaded, otherwise returns an image ID that can be
passed to the various py80 image functions. | 625941cbcb5e8a47e48b7b77 |
def test_process_pool_map_broken_pool(self): <NEW_LINE> <INDENT> elements = [1, 2, 3] <NEW_LINE> with ProcessPool(max_workers=1, context=mp_context) as pool: <NEW_LINE> <INDENT> future = pool.map(long_function, elements, timeout=1) <NEW_LINE> generator = future.result() <NEW_LINE> pool._context.state = ERROR <NEW_LINE>... | Process Pool Spawn Broken Pool. | 625941cbb57a9660fec3394f |
def interpolate_trace(trace, step, rng=None, x_column=0, select_columns=None, kind="linear", assume_sorted=False,): <NEW_LINE> <INDENT> wtrace=wrap(trace) <NEW_LINE> src_column=utils.get_x_column(trace,x_column=x_column) <NEW_LINE> select_columns=select_columns or list(range(wtrace.shape()[1])) <NEW_LINE> rng_min,rng_m... | Interpolate trace data over a regular grid with the given step.
`rng` specifies interpolation range (by default, whole data range).
`x_column` specifies column index for x-data.
`select_column` specifies which columns to interpolate and keep at the output (by default, all data).
If ``assume_sorted==True``, assume that... | 625941cbb57a9660fec33950 |
def get(self): <NEW_LINE> <INDENT> if not course_explorer.GCB_ENABLE_COURSE_EXPLORER_PAGE.value: <NEW_LINE> <INDENT> self.error(404) <NEW_LINE> return <NEW_LINE> <DEDENT> user = self.initialize_page_and_get_user() <NEW_LINE> if not user: <NEW_LINE> <INDENT> self.redirect('/explorer') <NEW_LINE> return <NEW_LINE> <DEDEN... | Handles GET requests. | 625941cbac7a0e7691ed4199 |
def setUp(self): <NEW_LINE> <INDENT> self.runner = click.testing.CliRunner() <NEW_LINE> self.configure = plugin_manager.load( 'treadmill.cli', 'configure').init() <NEW_LINE> with tempfile.NamedTemporaryFile(delete=False) as f: <NEW_LINE> <INDENT> yaml.dump({ 'memory': '128M', 'cpu': '5%', 'disk': '100M', 'identity_grou... | Setup common test variables | 625941cb26238365f5f0ef3a |
def build_generator(lr_input_size = (512, 512, 3), residual_blocks=16): <NEW_LINE> <INDENT> channels=3 <NEW_LINE> upscaling_factor=4 <NEW_LINE> def residual_block(input): <NEW_LINE> <INDENT> x = Conv2D(64, kernel_size=3, strides=1, padding='same')(input) <NEW_LINE> x = BatchNormalization(momentum=0.8)(x) <NEW_LINE> x =... | Build the generator network according to description in the paper.
:param optimizer: Keras optimizer to use for network
:param int residual_blocks: How many residual blocks to use
:return: the compiled model | 625941cb16aa5153ce362544 |
def test_case_04(self): <NEW_LINE> <INDENT> data = { "data": [ { "dep_id": "T01", "dep_name": "测试大学院", "master_name": "段教授", "slogan": "学以致用" } ] } <NEW_LINE> res = self.send.send_main("post", url=self.url, json=data) <NEW_LINE> count = res['create_success']['count'] <NEW_LINE> self.assertEqual(count, 1, "添加学院失败") <NEW... | 测试学院新增接口 | 625941cb26068e7796caedaa |
def exists(name): <NEW_LINE> <INDENT> contextkey = "nspawn.exists.{}".format(name) <NEW_LINE> if contextkey in __context__: <NEW_LINE> <INDENT> return __context__[contextkey] <NEW_LINE> <DEDENT> __context__[contextkey] = name in list_all() <NEW_LINE> return __context__[contextkey] | Returns true if the named container exists
CLI Example:
.. code-block:: bash
salt myminion nspawn.exists <name> | 625941cb45492302aab5e38f |
def fontAscender(self): <NEW_LINE> <INDENT> font = AppKit.NSFont.fontWithName_size_(self._font, self._fontSize) <NEW_LINE> if font is None: <NEW_LINE> <INDENT> ff = self._fallbackFont or _FALLBACKFONT <NEW_LINE> warnings.warn("font: '%s' is not installed, back to the fallback font: '%s'" % (self._font, ff)) <NEW_LINE> ... | Returns the current font ascender, based on the current `font` and `fontSize`. | 625941cb38b623060ff0aeba |
def test_channel_with_amplitude_damping_channel(): <NEW_LINE> <INDENT> n = 1 <NEW_LINE> for err in np.arange(0.0, 1., 0.01): <NEW_LINE> <INDENT> krauss_1 = np.array([[1., 0.], [0, np.sqrt(1 - err)]]) <NEW_LINE> krauss_2 = np.array([[0, np.sqrt(err)], [0., 0]]) <NEW_LINE> krauss_ops = [krauss_1, krauss_2] <NEW_LINE> kra... | Test channel method of kraus operators with ampltitude damping example. | 625941cb3346ee7daa2b2e37 |
def __eq__(self, other): <NEW_LINE> <INDENT> if self.__class__ is not other.__class__: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self._attrs != other._attrs: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> for attr in self._attrs: <NEW_LINE> <INDENT> if getattr(self, attr, None) != getattr(other, att... | Equality comparison. | 625941cbc432627299f04d12 |
def __init__( self, *, public_ip_address: Optional["SubResource"] = None, subnet: Optional["SubResource"] = None, private_ip_address: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) <NEW_LINE> self.public_ip_address = public_ip_address ... | :keyword public_ip_address:
:paramtype public_ip_address: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource
:keyword subnet:
:paramtype subnet: ~azure.mgmt.compute.v2020_10_01_preview.models.SubResource
:keyword private_ip_address: The private IP address referenced by the cloud service.
:paramtype private_ip_a... | 625941cbe1aae11d1e749d83 |
def create_spf_record(self, name, values, ttl=60): <NEW_LINE> <INDENT> self._halt_if_already_deleted() <NEW_LINE> values = locals() <NEW_LINE> del values['self'] <NEW_LINE> return self._add_record(SPFResourceRecordSet, **values) | Creates a SPF record attached to this hosted zone.
:param str name: The fully qualified name of the record to add.
:param list values: A list of value strings for the record.
:keyword int ttl: The time-to-live of the record (in seconds).
:rtype: tuple
:returns: A tuple in the form of ``(rrset, change_info)``, where
... | 625941cbe8904600ed9f1ff8 |
def update_data_price(self, *args) -> "TransactionReceipt": <NEW_LINE> <INDENT> self.gas_price = GAS_PRICE <NEW_LINE> self._from = env.PROVIDER_ID <NEW_LINE> self.required_confs = 1 <NEW_LINE> return self.timeout_wrapper("updataDataPrice", *args) | Register the dataset hash. | 625941cb0c0af96317bb82b4 |
def get_product_transactions_by_ref(reference): <NEW_LINE> <INDENT> ct = ContentType.objects.get_for_model(reference) <NEW_LINE> return models.ProductTransaction.objects.filter( reference_ct=ct, reference_id=reference.pk, ) | Return item transactions with given reference. | 625941cb56b00c62f0f14725 |
@check_path_existance <NEW_LINE> def write_htk(features, output_file_name, framerate=100, dt=9): <NEW_LINE> <INDENT> sampling_period = 1./framerate <NEW_LINE> pk = dt & 0x3f <NEW_LINE> dt &= ~_K <NEW_LINE> features = numpy.atleast_2d(features) <NEW_LINE> if pk == 0: <NEW_LINE> <INDENT> features = features.reshape(-1, 1... | Write htk feature file
0. WAVEFORM Acoustic waveform
1. LPC Linear prediction coefficients
2. LPREFC LPC Reflection coefficients: -lpcar2rf([1 LPC]);LPREFC(1)=[];
3. LPCEPSTRA LPC Cepstral coefficients
4. LPDELCEP LPC cepstral+delta coefficients (obsolete)
5. ... | 625941cb1d351010ab855be8 |
def pause(self): <NEW_LINE> <INDENT> self.process_callbacks = False <NEW_LINE> self.is_active.emit(self.process_callbacks) | Stops the processing of callbacks. | 625941cb5f7d997b87174b64 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.