code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def __init__( self, in_features: int, out_features: int, bias: bool = True, *, h_neurons: Union[Sequence[float], Sequence[int]] = (), h_bias: Union[bool, Sequence[bool]] = True, h_dropouts: Union[float, Sequence[float]] = 0.0, h_normalizers: Union[float, None, Sequence[Optional[float]]] = 0.1, h_activation_funcs: Union... | Parameters
----------
in_features
Size of input.
out_features
Size of output.
bias
Enable ``bias`` in input layer.
h_neurons
Number of neurons in hidden layers.
Can be a tuple of floats. In that case,
all these numbers will be used to calculate the neuron numbers.
e.g. (0.5, 0.4, ...) will b... | 625941c8435de62698dfdcb5 |
def get_dir_ID(current_OS): <NEW_LINE> <INDENT> print("Make sure you are in the folder or directory above where you files are stored.") <NEW_LINE> print("Choose an identifier (a piece of text) that is present in all folders that contain cell data.") <NEW_LINE> print("Based on the identifier, the code will enable you to... | gets folder identifier for finding text or csv files
then finds if the folders matching that identifier
returns "empty" if there are no folders matching
the identifier in the current directory | 625941c8e64d504609d748a9 |
def p_idStartFunction(p): <NEW_LINE> <INDENT> global localDirectory <NEW_LINE> localDirectory = {} <NEW_LINE> jumpStack.append(len(quadruples)) <NEW_LINE> Settings.memoryMap[1] = copy.deepcopy(resetMemoryMap) <NEW_LINE> if(debugParser): <NEW_LINE> <INDENT> print("Resetting Settings.memoryMap") <NEW_LINE> <DEDENT> globa... | idStartFunction : ID | 625941c826068e7796caed46 |
def url_get( url, params=None, bind=None, json=True, throw=True, timeout=None, allow_redirects=True, headers=None, verify_keys=False ): <NEW_LINE> <INDENT> curl = PycURLRunner(url, params, bind, timeout, allow_redirects, headers, verify_keys) <NEW_LINE> return curl(json, throw) | Fetch a URL using GET with parameters, returning whatever came back. | 625941c8dc8b845886cb559d |
def togglesafemode(self,event=None): <NEW_LINE> <INDENT> if self.scope is not None and self.scope.ready: <NEW_LINE> <INDENT> self.scope.set_safe(bool(self.safemode.get())) <NEW_LINE> self.messages.log('Safe Mode changed to '+str(bool(self.safemode.get()))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.messages.log... | Handle a change in the state of the "Safe Mode" radio buttons. | 625941c8bf627c535bc13238 |
def assert_edgecolors_equal(self, edgecolors): <NEW_LINE> <INDENT> np.testing.assert_equal( self.edgecolors, self._parse_expected_attr("edgecolors", edgecolors)) | Assert that the given edgecolors are equivalent to the plotted
:attr:`~plotchecker.BarPlotChecker.edgecolors`.
Parameters
----------
edgecolors : single color, or list of expected edge colors
Each color can be either a matplotlib color name (e.g. ``'r'`` or
``'red'``), a hexcode (e.g. ``"#FF0000"``), a 3-tuple... | 625941c8ad47b63b2c509fe8 |
def __repr__(self): <NEW_LINE> <INDENT> output = str(self) <NEW_LINE> return output | Returns a terminal representation of the block - same as __str__ | 625941c8d4950a0f3b08c3b9 |
def getValue(self): <NEW_LINE> <INDENT> return self.cashBalance | Return the total portfolio value. | 625941c850812a4eaa59c38c |
def setIoTime(self, ioTime): <NEW_LINE> <INDENT> self.__ioTime = float(ioTime) <NEW_LINE> return self | Set IO time used in connection with file handling.
ioTime: IO time in seconds (float).
Returns: Reference to object itself. | 625941c86fece00bbac2d7a6 |
def identity_block(x,kernel_size,out_filters,stage,block): <NEW_LINE> <INDENT> conv_name_base = 'res'+str(stage) + block <NEW_LINE> bn_name_base = 'bn' + str(stage) + block <NEW_LINE> f1,f2,f3 = out_filters <NEW_LINE> with tf.variable_scope("id_block_stage"+str(stage)): <NEW_LINE> <INDENT> x_shortcut = x <NEW_LINE> x =... | x_shortcut和输入x一样
1*1 -> kernel_size*kernel_size -> 1*1
Parameters:
x-输入
kernel_size-卷积核大小
out_filters:输出的维度,卷积核的个数
stage:第几块
training:
identity_block(x,3,[64,64,256],stage=2,block='b') | 625941c8aad79263cf390aa9 |
def triangleNumber(self, nums): <NEW_LINE> <INDENT> nums.sort() <NEW_LINE> n = len(nums) <NEW_LINE> res = 0 <NEW_LINE> for i in range(n-2): <NEW_LINE> <INDENT> num_i = nums[i] <NEW_LINE> for j in range(i+1, n-1): <NEW_LINE> <INDENT> num_j = nums[j] <NEW_LINE> l = j + 1 <NEW_LINE> r = n - 1 <NEW_LINE> while l < r: <NEW_... | Inputs:
nums: list[int]
Outputs:
res: int | 625941c810dbd63aa1bd2c0d |
def plot_axvline(self, *args, **kwargs): <NEW_LINE> <INDENT> self.axes.axvline(*args, **kwargs) <NEW_LINE> self.UpdatePlot() | ''#最常用的绘图命令plot | 625941c86fece00bbac2d7a7 |
def get_combined_kern_dict(fonts): <NEW_LINE> <INDENT> combined_pairs = set(itertools.chain.from_iterable( font.kerning.keys() for font in fonts)) <NEW_LINE> c_kerning = {} <NEW_LINE> for font in fonts: <NEW_LINE> <INDENT> for pair in combined_pairs: <NEW_LINE> <INDENT> value = font.kerning.get(pair, None) <NEW_LINE> c... | Returns a sorted, combined kerning dictionary for a
number of fonts. If a specific pair is not kerned,
kerning value is None. | 625941c850485f2cf553ce03 |
def log(*s): <NEW_LINE> <INDENT> if DEBUG: <NEW_LINE> <INDENT> print(*s) | Silly little shorthand logger, to avoid
cluttering up output.
Don't use anything like this in real code.
Use the logging module instead. | 625941c83539df3088e2e3b4 |
def on_action_set_modality(self, content): <NEW_LINE> <INDENT> self.set_modality(content['modality']) | Handle the 'set-modality' action from the Enaml widget.
| 625941c8a8370b7717052909 |
def test_modify_profile(self): <NEW_LINE> <INDENT> pass | Test case for modify_profile
Modify monitoring profile. # noqa: E501 | 625941c873bcbd0ca4b2c0e0 |
def get_page_by_uri_or_404(self, uri): <NEW_LINE> <INDENT> uri_frags = uri.strip('/').split('/') <NEW_LINE> slug = uri_frags[-1] <NEW_LINE> pages = Page.objects.filter(slug=slug) <NEW_LINE> for page in pages: <NEW_LINE> <INDENT> frags = [p.slug for p in page.get_ancestors()] <NEW_LINE> frags.append(page.slug) <NEW_LINE... | Retrieve a page based on a full URI (eg. /foo/bar/baz/ in
http://example.com/foo/bar/baz/). The fragments of the URI must match
an existing hierarchy of pages where each is represented by its slug. | 625941c855399d3f0558871d |
def get_user(self, user_id): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.get(pk=user_id) <NEW_LINE> if user.is_active: <NEW_LINE> <INDENT> return user <NEW_LINE> <DEDENT> return None <NEW_LINE> <DEDENT> except User.DoesNotExist: <NEW_LINE> <INDENT> return None | Used bu the django auth system to retrieve an user | 625941c84428ac0f6e5ba85b |
def get_enabled(self): <NEW_LINE> <INDENT> if self._cacheExpiration <= YAPI.GetTickCount(): <NEW_LINE> <INDENT> if self.load(YAPI.DefaultCacheValidity) != YAPI.SUCCESS: <NEW_LINE> <INDENT> return YDisplay.ENABLED_INVALID <NEW_LINE> <DEDENT> <DEDENT> return self._enabled | Returns true if the screen is powered, false otherwise.
@return either YDisplay.ENABLED_FALSE or YDisplay.ENABLED_TRUE, according to true if the screen is
powered, false otherwise
On failure, throws an exception or returns YDisplay.ENABLED_INVALID. | 625941c8442bda511e8be483 |
def __init__(self, service_name=None, url=None, database_name=None, collection_name=None, index=None, doc_type=None): <NEW_LINE> <INDENT> self.name = str(service_name).lower() <NEW_LINE> if self.name == 'mongo': <NEW_LINE> <INDENT> self.service = MongoService(__database_name__=database_name, __collection_name__=collect... | :param service_name: Mongo or Elasticsearch
:param url: For Mongo url=localhost
:param database_name: for Mongo Service
:param collection_name: for Mongo Service
:param index: for Elasticsearch
:param doc_type: for ElasticSearch | 625941c83346ee7daa2b2dd4 |
def main(): <NEW_LINE> <INDENT> na_elementsw_account = ElementSWAccount() <NEW_LINE> na_elementsw_account.apply() | Main function | 625941c8a219f33f346289d5 |
def ReadGitTree(sha1, objdir): <NEW_LINE> <INDENT> objtype, _, data = ReadGitObj(sha1, objdir) <NEW_LINE> assert(objtype == 'tree') <NEW_LINE> s = 0 <NEW_LINE> entries = [] <NEW_LINE> while s < len(data): <NEW_LINE> <INDENT> s1 = data.find(' ', s) <NEW_LINE> s2 = data.find('\0', s) <NEW_LINE> mode = data[s:s1] <NEW_LIN... | Returns a sorted list of tupled (mode, fname, sha1) | 625941c856ac1b37e626423b |
def _ls(task, path, long_, completed): <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> path = '.' <NEW_LINE> <DEDENT> if path.startswith('/'): <NEW_LINE> <INDENT> path = path[1:] <NEW_LINE> <DEDENT> dcos_client = mesos.DCOSClient() <NEW_LINE> task_obj = mesos.get_master(dcos_client).task( fltr=task, completed=... | List files in a task's sandbox.
:param task: task pattern to match
:type task: str
:param path: file path to read
:type path: str
:param long_: whether to use a long listing format
:type long_: bool
:param completed: If True, include completed tasks
:type completed: bool
:returns: process return code
:rtype: int | 625941c8377c676e91272213 |
def test_issue_296(self): <NEW_LINE> <INDENT> wrp = self.dlg.wrapper_object() <NEW_LINE> orig = wrp.element_info._element.FindAll <NEW_LINE> wrp.element_info._element.FindAll = mock.Mock(side_effect=ValueError("Mocked value error"), return_value=[]) <NEW_LINE> self.assertEqual([], wrp.descendants()) <NEW_LINE> exceptio... | Test handling of disappered descendants | 625941c84a966d76dd551078 |
def is_breakable(self): <NEW_LINE> <INDENT> return self.pred_links != 0 or self.succ_links != 0 | Return True iff breaking the changeset will do any good. | 625941c89b70327d1c4e0e3e |
def _do_actions(self): <NEW_LINE> <INDENT> expand_elements_text = ( 'Show More', 'Show All', ) <NEW_LINE> for guess_text in expand_elements_text: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> elem = self.driver.find_element_by_xpath( f'//*[contains(text(), "{guess_text}")]') <NEW_LINE> self._click_element(elem) <NEW_LIN... | Make some actions on a page like clicking tabs or open
collapsed elements. | 625941c8796e427e537b062f |
@click.command() <NEW_LINE> @click.argument('spreadsheet_id', required=True) <NEW_LINE> def get_usage(spreadsheet_id: str): <NEW_LINE> <INDENT> service = get_service() <NEW_LINE> spreadsheet = service.spreadsheets().get(spreadsheetId=spreadsheet_id, includeGridData=True).execute() <NEW_LINE> for sheet in spreadsheet['s... | Find formulas used in a given Google spreadsheet. | 625941c838b623060ff0ae57 |
@pytest.fixture <NEW_LINE> def app(): <NEW_LINE> <INDENT> return create_app("test") | The app with Testing config variables | 625941c891f36d47f21ac55c |
def p_atom6(p): <NEW_LINE> <INDENT> info = p[2] <NEW_LINE> if isinstance(info, GeneratorInfo): <NEW_LINE> <INDENT> if isinstance(info.elt, tuple): <NEW_LINE> <INDENT> key, value = info.elt <NEW_LINE> generators = info.generators <NEW_LINE> node = ast.DictComp(key=key, value=value, generators=generators) <NEW_LINE> <DED... | atom : LBRACE dictorsetmaker RBRACE | 625941c81f5feb6acb0c4bbc |
def t111112_x12(): <NEW_LINE> <INDENT> assert t111112_x1() <NEW_LINE> ClearTalkProgressData() <NEW_LINE> return 0 | State 0,2 | 625941c81f5feb6acb0c4bbb |
@app.teardown_request <NEW_LINE> def return_connections(*args, **kwargs): <NEW_LINE> <INDENT> g.cursor.close() <NEW_LINE> pg_pool.putconn(g.conn) | Return the connection to the Postgres connection pool. | 625941c8c4546d3d9de72a9d |
def load_credentials_confidential_key(self, path, key_name): <NEW_LINE> <INDENT> secret_key_file = open(path, "rb").read() <NEW_LINE> o = AES.new(self.hashed_master_key, AES.MODE_ECB) <NEW_LINE> secret = o.decrypt(secret_key_file) <NEW_LINE> secret = secret[:-16] <NEW_LINE> secret = secret[:16] <NEW_LINE> setattr(self,... | Read and decrypt an instance of ConfidentialKey | 625941c8eab8aa0e5d26dbc2 |
def lr_fit(modelpath,x,y,k=0): <NEW_LINE> <INDENT> x['intercept'] = 1 <NEW_LINE> logit = sm.Logit(y, x) <NEW_LINE> result = logit.fit() <NEW_LINE> df = result.params.drop('intercept') <NEW_LINE> if any(np.asarray(df) < 0): <NEW_LINE> <INDENT> print ('系数出现负数,执行第{}次剔除'.format(k)) <NEW_LINE> k=k+1 <NEW_LINE> loc = list(df... | :param x: train_data
:param y: train_target
:return: logisticReg model,筛选完变量后的数据 | 625941c8711fe17d825423d7 |
def _get(self, item): <NEW_LINE> <INDENT> return None | Implementation on how to get the value of a single key
Default implementation returns None | 625941c83eb6a72ae02ec545 |
def check_tardev_xml(vm_name, set_tar_devs, set_sources, find=True): <NEW_LINE> <INDENT> vmxml = vm_xml.VMXML.new_from_dumpxml(vm_name) <NEW_LINE> iface_devices = vmxml.get_devices(device_type="interface") <NEW_LINE> get_tar_devs = [] <NEW_LINE> get_sources = [] <NEW_LINE> for iface_dev in iface_devices: <NEW_LINE> <IN... | Check if the xml involve the xml with given dev
param vm_name: name of vm
param set_tar_devs: setting target dev list of interface
param set_sources: setting source list of interface
param find: check if find devs is pass | 625941c8d7e4931a7ee9df87 |
def __init__(self,xSquares,ySquares,caterpillarDrawer,miscDrawer,textPrinter,scorePrinter, bonusObjDrawer, grid,obstaclePositionTuples=[]): <NEW_LINE> <INDENT> self.grid = grid <NEW_LINE> self.caterpillarDrawer = caterpillarDrawer <NEW_LINE> self.miscDrawer = miscDrawer <NEW_LINE> self.textPrinter = textPrinter <NEW_LI... | Initialize variables for a Caterpillar instance.
caterpillarDrawer and miscDrawer are turtle.Turtle() objects.
Some initial values need to be tweaked, or added in
game difficulty modes/settings | 625941c821a7993f00bc7d58 |
def __alignMarkerGenes(self, markerSeqs, markerStats, bReportHitStats, hmmModelFiles, alignOutputDir, bKeepUnmaskedAlign=False, bReportProgress=True): <NEW_LINE> <INDENT> if bReportProgress: <NEW_LINE> <INDENT> self.logger.info(" Aligning %d marker genes with %d threads:" % (len(hmmModelFiles), self.totalThreads)) <NE... | Align marker genes with HMMs in parallel. | 625941c8cdde0d52a9e5309d |
def ConstPointer(self): <NEW_LINE> <INDENT> pass | ConstPointer(self: StringHolder) -> IntPtr
C++ pointer used to access the ON_wString,managed plug-ins should
never need this. | 625941c856b00c62f0f146c3 |
def test_resolve_against_assigns_query_string(self): <NEW_LINE> <INDENT> wrapper = UrlPathWrapper("/foo/bar/baz.html?asd=123") <NEW_LINE> wrapper.resolve_against("and/one/two/three.html?def=456") <NEW_LINE> self.assertEqual(wrapper.query_string, "def=456") | Tests that resolve_against results in the proper value being set for query_string when the resolution
path contains a query string.
:return: None | 625941c8566aa707497f45d4 |
def slow_text_finder(lst): <NEW_LINE> <INDENT> return [n for n in lst if n.endswith('_slow_Text.csv')] | list -> list
Takes a list of filenames and returns those ones that end with '_slow_Text.csv' | 625941c86e29344779a6267d |
def loadImgPrincipal(self, event): <NEW_LINE> <INDENT> wx.GetApp().TopWindow.cargarImg( self.bitmap_1.GetBitmap() ) <NEW_LINE> self.Close() | Carga la imagen de esta ventana como principal, y luego cierra esta. | 625941c8be8e80087fb20cae |
def end_soql_query(line): <NEW_LINE> <INDENT> global soql_flag <NEW_LINE> end_flag = ( soql_flag and ( '])' in line or '];' in line or ')];' in line or '].' in line ) ) <NEW_LINE> if end_flag: <NEW_LINE> <INDENT> soql_flag = False <NEW_LINE> <DEDENT> return end_flag | @brief Ends a soql query.
@param line The line
@return { description_of_the_return_value } | 625941c871ff763f4b5496f4 |
def setUp(self): <NEW_LINE> <INDENT> cfg.CONF.set_override('never_cache_ssh_connection', False, 'ml2_cisco') <NEW_LINE> super(TestCiscoNexusBaremetalReplay, self).setUp() | Sets up mock ncclient, and switch and credentials dictionaries. | 625941c8be383301e01b54f1 |
def __init__(self): <NEW_LINE> <INDENT> self.__shell = Shell(AcaoQuandoOcorrerErro.REPETIR_E_IGNORAR, 10) <NEW_LINE> self.__arquitetura = platform.processor() | Método construtor. | 625941c8d18da76e23532540 |
def main(): <NEW_LINE> <INDENT> print(hello.hello_world()) | Basic example of using local module
| 625941c885dfad0860c3aec5 |
def installFlow(flowid, sw, src_ip, src_mac, dst_ip, dst_mac, outport, revoutport): <NEW_LINE> <INDENT> _send_msg(OFPFC_ADD, flowid, sw, src_ip, src_mac, dst_ip, dst_mac, outport, revoutport) | Construct a new add-flow message and send to the OpenFlow manager.
Installs the forward and reverse path
flowid: the flow id
sw: an instance of Switch
src_ip: the source host's IP address as a string
src_mac: the source host's MAC address as a string
dst_ip: the destination host's IP address as a string
dst_mac: the de... | 625941c876e4537e8c3516dc |
def get_location_id(self, location): <NEW_LINE> <INDENT> split = location.split(',') <NEW_LINE> if len(split) == 3: <NEW_LINE> <INDENT> location_dict = {'city': split[0], 'region': split[1], 'country': split[2]} <NEW_LINE> <DEDENT> elif len(split) == 2: <NEW_LINE> <INDENT> location_dict = {'city': split[0], 'region': N... | Takes a string formatted either:
'city, region, country' or
'city, country'
and returns a valid location_id
:param location: the location string
:return int location_id: | 625941c80a50d4780f666efc |
def upload_file(path, destination_frame=None, header=0, sep=None, col_names=None, col_types=None, na_strings=None): <NEW_LINE> <INDENT> coltype = U(None, "unknown", "uuid", "string", "float", "real", "double", "int", "numeric", "categorical", "factor", "enum", "time") <NEW_LINE> natype = U(str, [str]) <NEW_LINE> assert... | Upload a dataset from the provided local path to the H2O cluster.
Does a single-threaded push to H2O. Also see :meth:`import_file`.
:param path: A path specifying the location of the data to upload.
:param destination_frame: The unique hex key assigned to the imported file. If none is given, a key will
be automa... | 625941c8187af65679ca5189 |
@patch('urllib.request.urlopen') <NEW_LINE> def test_get(mock_urlopen): <NEW_LINE> <INDENT> configure_mock_urlopen(mock_urlopen, graphql_response_ok) <NEW_LINE> base_headers = { 'Xpto': 'abc', } <NEW_LINE> extra_headers = { 'Extra': '123', 'Accept': extra_accept_header, } <NEW_LINE> variables = {'repoOwner': 'owner', '... | Test if HTTP method GET request works | 625941c88c3a873295158424 |
def send_notification_email(self): <NEW_LINE> <INDENT> email_subject = render_to_string('contacts/notification-subject.txt', { 'contact': self, }) <NEW_LINE> email_body = render_to_string('contacts/notification-body.txt', { 'contact': self, }) <NEW_LINE> try: <NEW_LINE> <INDENT> send_mail( email_subject, email_body, se... | Sends a notification email to the list of recipients defined in
settings.NOTIFICATIONS informing them that a new contact has arrived.
SERVER_EMAIL is defined in settings and contacts the "from"
address for email sent from the webserver.
MANAGERS needs to be defined in settings and should be a list
containing the emai... | 625941c8f7d966606f6aa06e |
def _get_signed_query_params(credentials, expiration, string_to_sign): <NEW_LINE> <INDENT> if not hasattr(credentials, 'sign_blob'): <NEW_LINE> <INDENT> auth_uri = ('http://google-cloud-python.readthedocs.io/en/latest/' 'google-cloud-auth.html#setting-up-a-service-account') <NEW_LINE> raise AttributeError('you need a p... | Gets query parameters for creating a signed URL.
:type credentials: :class:`oauth2client.client.AssertionCredentials`
:param credentials: The credentials used to create a private key
for signing text.
:type expiration: int or long
:param expiration: When the signed URL should expire.
:type string... | 625941c8ec188e330fd5a80b |
def __init__(self, fname_list, cine_base_path, cine_hash, i_disk_dict=None, cache_path=None): <NEW_LINE> <INDENT> self.db = db.LFmongodb(i_disk_dict=i_disk_dict) <NEW_LINE> self._cinehash = cine_hash <NEW_LINE> self._h5_backends = [] <NEW_LINE> cine_md = self.db.get_movie_md(self._cinehash) <NEW_LINE> self.frame_rate =... | Parameters
----------
fname_list : list of tuples (FilePath, frame_in, frame_out)
data about the files to be open
cine_base_path : string
base path (chroot style) of the cine files
i_disk_dict : dict, None
dictionary to convert disk number -> path | 625941c815fb5d323cde0b79 |
def test_remove(init_dll): <NEW_LINE> <INDENT> init_dll.remove(2) <NEW_LINE> assert init_dll.head.next.val == 1 <NEW_LINE> assert init_dll.tail.prev.val == 3 | Remove node from dll. | 625941c8d99f1b3c44c675fa |
def add_table_to_test(self, format_string, data, headings, caption=""): <NEW_LINE> <INDENT> self.doc.append(NoEscape(r'\begin{figure}[htbp]')) <NEW_LINE> self.doc.append(NoEscape(r'\centering')) <NEW_LINE> self.doc.append(NoEscape(r'\caption{'+caption+'}')) <NEW_LINE> table = Tabular(format_string) <NEW_LINE> table.add... | Adds a figure to the current section of the report
Adds a pdf image in the form of a figure to the current section of the report.
The image name specifies the image, without the pdf extension.
Args:
image_name (str): The name of the image to be placed into the report.
caption (str): The caption to be place... | 625941c85166f23b2e1a51c4 |
def createdirs(self): <NEW_LINE> <INDENT> dir = os.path.dirname(self.path) <NEW_LINE> if len(dir) > 0 and not os.path.exists(dir): <NEW_LINE> <INDENT> os.makedirs(dir) | Create any intermediate directories that don't exist | 625941c8e64d504609d748aa |
def GetPointer(self): <NEW_LINE> <INDENT> return _itkBayesianClassifierImageFilterPython.itkBayesianClassifierImageFilterVIF2UCDD_GetPointer(self) | GetPointer(self) -> itkBayesianClassifierImageFilterVIF2UCDD | 625941c85fc7496912cc39e8 |
def submit_user(form): <NEW_LINE> <INDENT> name = form.name.data <NEW_LINE> email = form.email.data <NEW_LINE> username = form.username.data <NEW_LINE> password = sha256_crypt.encrypt(str(form.password.data)) <NEW_LINE> cur = mysql.connection.cursor() <NEW_LINE> query = ("INSERT INTO users(name, email, username, passwo... | Helper function to submit user registration to the Database. | 625941c8a79ad161976cc1b0 |
def flatten_cluster(cluster): <NEW_LINE> <INDENT> for station in cluster.stations: <NEW_LINE> <INDENT> station.z = [0.] * len(station.z) <NEW_LINE> for detector in station.detectors: <NEW_LINE> <INDENT> detector.z = [0.] * len(detector.z) | Set the altitudes for all detectors in a cluster object to z=0
Modify the given cluster by setting the z coordinates of the stations
and detectors to 0.
:param cluster: :class:`BaseCluster` object. | 625941c8596a897236089b2c |
def show(self, prefix=''): <NEW_LINE> <INDENT> outstr = '' <NEW_LINE> outstr += prefix + 'header: \n' <NEW_LINE> outstr += self.header.show(prefix + ' ') <NEW_LINE> outstr += prefix + 'type: ' + str(self.type) + '\n' <NEW_LINE> outstr += prefix + 'code: ' + str(self.code) + '\n' <NEW_LINE> outstr += prefix + 'data: ' ... | Generate string showing basic members of structure
| 625941c8cc40096d615959bc |
def test_create_node_also_creates_author(self): <NEW_LINE> <INDENT> self.assertEqual(get_user_model().objects.filter(username=self.remote_username).exists(), True) | Test creation of Author Object | 625941c807d97122c41788f4 |
def load_model(self, strategy_name, path=''): <NEW_LINE> <INDENT> import IPython <NEW_LINE> IPython.embed() <NEW_LINE> pkl_path = path + 'data/models/' + strategy_name + '_' + self.__class__.__name__ <NEW_LINE> return joblib.load(pkl_path + '.pkl') | Loads the model from a pickled file | 625941c8097d151d1a222ec5 |
def process_cmd_args(self): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=description) <NEW_LINE> parser.add_argument("-d", "--dimension", nargs=2, type=int, default=self.maze_dimension, help="Maze dimension") <NEW_LINE> parser.add_argument("--start-cell", nargs=2, type=int, default=self.maze_start_c... | Process command line arguments if YAML configuration file doesn't exist | 625941c87cff6e4e811179f1 |
def add_literal_level(self, level): <NEW_LINE> <INDENT> self.s_levels.append(set()) <NEW_LINE> for a_node in self.a_levels[level-1]: <NEW_LINE> <INDENT> for s_node in a_node.effnodes: <NEW_LINE> <INDENT> self.s_levels[level].add(s_node) <NEW_LINE> a_node.children.add(s_node) <NEW_LINE> s_node.parents.add(a_node) | add an S (literal) level to the Planning Graph
:param level: int
the level number alternates S0, A0, S1, A1, S2, .... etc the level number is also used as the
index for the node set lists self.a_levels[] and self.s_levels[]
:return:
adds S nodes to the current level in self.s_levels[level] | 625941c867a9b606de4a7f25 |
@command('quiet') <NEW_LINE> def quiet(bot, trigger): <NEW_LINE> <INDENT> if not trigger.isop: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> text = trigger.group().split() <NEW_LINE> argc = len(text) <NEW_LINE> if argc < 2: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> opt = text[1] <NEW_LINE> quietmask = opt <NEW_LI... | This gives admins the ability to quiet a user.
The bot must be a Channel Operator for this command to work | 625941c89c8ee82313fbb7e0 |
def evolve_to_time(self,solution,tend=None): <NEW_LINE> <INDENT> if not self._is_set_up: <NEW_LINE> <INDENT> self.setup(solution) <NEW_LINE> <DEDENT> if tend == None: <NEW_LINE> <INDENT> take_one_step = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> take_one_step = False <NEW_LINE> <DEDENT> tstart = solution.t <NEW... | Evolve solution from solution.t to tend. If tend is not specified,
take a single step.
This method contains the machinery to evolve the solution object in
``solution`` to the requested end time tend if given, or one
step if not.
:Input:
- *solution* - (:class:`Solution`) Solution to be evolved
- *tend* - (float)... | 625941c84e4d5625662d4444 |
def delete(self, key): <NEW_LINE> <INDENT> index = self._bucket_index(key) <NEW_LINE> bucket = self.buckets[index] <NEW_LINE> entry = bucket.find(lambda key_value: key_value[0] == key) <NEW_LINE> if entry is not None: <NEW_LINE> <INDENT> bucket.delete(entry) <NEW_LINE> self.size -= 1 <NEW_LINE> print("DELETED, updated ... | Delete the given key and its associated value, or raise KeyError.
Best case running time: O(1) if its the first element in the bucket
Worst case running time: O(m), m = # of items in bucket, if its the last element in the bucket
or does not exist | 625941c830dc7b76659019d2 |
def __repr__(self): <NEW_LINE> <INDENT> return '<Twilio.Numbers.V2.BundlePage>' | Provide a friendly representation
:returns: Machine friendly representation
:rtype: str | 625941c8656771135c3eb8d9 |
@APP.route('/<repo:repo>/dropgroup/<int:groupid>', methods=['POST']) <NEW_LINE> @APP.route('/fork/<username>/<repo:repo>/dropgroup/<int:groupid>', methods=['POST']) <NEW_LINE> @login_required <NEW_LINE> def remove_group_project(repo, groupid, username=None): <NEW_LINE> <INDENT> if not pagure.APP.config.get('ENABLE_USER... | Remove the specified group from the project.
| 625941c8d486a94d0b98e1b0 |
def put(self, request, pk=None): <NEW_LINE> <INDENT> dealership_employee = DealershipEmployee.objects.get(pk=pk) <NEW_LINE> dealership_employee.dealership_id = request.data["dealershipId"] <NEW_LINE> dealership_employee.employee_id = request.data["employeeId"] <NEW_LINE> dealership_employee.save() <NEW_LINE> return Res... | Handle PUT requests for an individual dealership employee
Returns:
Response -- Empty body with 204 status code | 625941c826068e7796caed48 |
def __init__(self, n_neighbors=5, metric=None, regression=False, weights=None): <NEW_LINE> <INDENT> self.n_neighbors = n_neighbors <NEW_LINE> if weights == "none": <NEW_LINE> <INDENT> weights = None <NEW_LINE> <DEDENT> if metric is None: <NEW_LINE> <INDENT> metric = l2_distance_squared <NEW_LINE> <DEDENT> self.metric =... | Initializes the KNN algorithm.
:param n_neighbors: The number of neighbors to use.
:param metric: The metric to use. Any distance measure is accepted, even non-metrics. The function must accept a
1D vector as its first parameter, and a 2D matrix as the second parameter. It should calculate the rowwise distance
between ... | 625941c80383005118ecf64e |
def __init__(self) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.command_name = "CreateFolder" <NEW_LINE> self.command_parameter_metadata = self.__command_parameter_metadata <NEW_LINE> self.command_metadata = self.__command_metadata <NEW_LINE> self.parameter_input_metadata = self.__parameter_input_met... | Initialize a new instance of the command. | 625941c897e22403b379d004 |
def load_dataset(self): <NEW_LINE> <INDENT> current_dir = os.path.dirname(__file__) <NEW_LINE> if self.split == TRAINVAL: <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> elif self.split == INFERENCE: <NEW_LINE> <INDENT> return self.load_inference_dataset() <NEW_LINE> <DEDENT> images_path = os.path.j... | Create the dataset loader object
Returns:
tf.data.Dataset: dataset object | 625941c845492302aab5e32e |
def save_setting(self): <NEW_LINE> <INDENT> settings = QSettings("config.ini", QSettings.IniFormat) <NEW_LINE> settings.setValue("bussiness",self.comboBox_12.currentText()) <NEW_LINE> settings.setValue("env", self.comboBox_10.currentText()) <NEW_LINE> settings.setValue("communicate", self.comboBox_6.currentText()) <NEW... | 保存配置信息
:return: | 625941c82c8b7c6e89b3582c |
@_auto_convert <NEW_LINE> @_dispatch <NEW_LINE> def mll(mean: _PandasOrScalar, variance: _PandasOrScalar, data: _Pandas): <NEW_LINE> <INDENT> return ( 0.5 * np.log(2 * np.pi * variance) + 0.5 * (mean - data) ** 2 / variance ).mean() | Mean log loss.
Args:
mean (tensor): Mean of prediction.
variance (tensor): Variance of prediction.
data (tensor): Reference data.
Returns:
tensor: Mean log loss. | 625941c8462c4b4f79d1d73c |
def admin_activitieProject_list(self): <NEW_LINE> <INDENT> server = "admin/activitieProject/list" <NEW_LINE> data = {"type":"3"} <NEW_LINE> r = request2DKApi(server, data).send() <NEW_LINE> print(r) | 1.1.5 获取所有未生效的活动
:return: | 625941c801c39578d7e74ea6 |
def test_categories(self): <NEW_LINE> <INDENT> self.assertEqual(self.category.name,'Madera') <NEW_LINE> self.assertEqual(self.category.description,'Artesanías de madera') | Random generate. | 625941c87b25080760e394c5 |
def revenue_company(request, year): <NEW_LINE> <INDENT> queryset = CompanyYearData.objects.filter(year=year) <NEW_LINE> nasscom_members = queryset.exclude( company__nasscom_membership_number__exact='N/A' ).aggregate(count=Count('revenue'), revenue=Sum('revenue')) <NEW_LINE> nasscom_members['revenue'] = nasscom_members[... | Return JSON string with revenue for nasscom and non-nasscom companies | 625941c87d847024c06be326 |
@task(default=True) <NEW_LINE> def check(input_params, cluster): <NEW_LINE> <INDENT> m = re.search("^(ssh|sudo)?$", input_params) <NEW_LINE> if not m: <NEW_LINE> <INDENT> raise AttributeError("The given input_params '%s' doesn't match the requirements!" % input_params) <NEW_LINE> <DEDENT> method = input_params if input... | Check if ssh access or sudo access is working on the target machine
Can support multiple backends
input_params parameter is a string, with the following fields:
ssh|sudo
If no parameter is given, ssh access is tested. | 625941c8de87d2750b85fdfd |
def put_password_user(self): <NEW_LINE> <INDENT> params = self.request.params <NEW_LINE> matricula = params['url'] <NEW_LINE> email_user = params['email'] <NEW_LINE> user_obj = Utils.create_user_obj() <NEW_LINE> user = { 'nome': Utils.retorna_usuario_autenticado(matricula=matricula).results[0].nome, 'orgao': Utils.reto... | Edita um doc de user apartir do id | 625941c8cb5e8a47e48b7b17 |
def tune_bins(data_df): <NEW_LINE> <INDENT> bins_dict = {} <NEW_LINE> tune_df, remaining_df = train_tune_test(data_df) <NEW_LINE> data_subset_dict = create_fold_regression(data_df) <NEW_LINE> training_set, test_set = train_test_r(data_subset_dict, num = 1) <NEW_LINE> for n in [4, 6, 10]: <NEW_LINE> <INDENT> f_tree = CA... | do five fold cross validatiaon with the training and test set for unpruning tree | 625941c826238365f5f0eed8 |
def close(self): <NEW_LINE> <INDENT> if self.channel is not None: <NEW_LINE> <INDENT> self.channel.close() <NEW_LINE> self.channel = None | close scp channel | 625941c8a8370b771705290c |
def gmc_rec(i): <NEW_LINE> <INDENT> nonlocal N, n, N_arr, Dij, bs_arr <NEW_LINE> if i == n-1: <NEW_LINE> <INDENT> sentinel = 's' <NEW_LINE> last_cand = next(next_cand(N, N_arr[i], Dij, bs_arr, i), sentinel) <NEW_LINE> if last_cand is not sentinel: <NEW_LINE> <INDENT> bs_arr[i, :] = last_cand <NEW_LINE> return True <NEW... | Recursive portion of gen_multi_correlated | 625941c8d486a94d0b98e1b1 |
def testReprioritizeNonExistentJob(self): <NEW_LINE> <INDENT> dq = ResizableDispatchQueue(None, 1) <NEW_LINE> self.assertRaises(KeyError, dq.reprioritize, Job('x', 1), 10) | Reprioritizing a non-existent job must raise C{KeyError}. | 625941c894891a1f4081bb14 |
def getRapData(self): <NEW_LINE> <INDENT> self.driver.get("https://www.roblox.com/catalog/?Category=2&Subcategory=2&SortType=2&SortAggregation=3&Direction=2") <NEW_LINE> time.sleep(5) <NEW_LINE> items = [] <NEW_LINE> for x in range(5): <NEW_LINE> <INDENT> catalogHtml = self.driver.page_source <NEW_LINE> pageItems = re.... | Gathers data from the ROBLOX Catalog, returns a list containing lists of items on the respective page based on bestselling in the past week. | 625941c8956e5f7376d70ed9 |
def post(self): <NEW_LINE> <INDENT> user_status, calling_user = has_admin_privileges() <NEW_LINE> if user_status == "no_auth_token": <NEW_LINE> <INDENT> return (bad_request, 400, headers) <NEW_LINE> <DEDENT> if user_status == "not_logged_in": <NEW_LINE> <INDENT> return (unauthorized, 401, headers) <NEW_LINE> <DEDENT> t... | Only method needed | 625941c84428ac0f6e5ba85d |
def model_callbacks(early_stopping_patience, model_checkpoint_dir, reducelr_factor, reducelr_patience): <NEW_LINE> <INDENT> early_stopping = EarlyStopping(monitor='val_accuracy', mode='max', verbose=1, patience=early_stopping_patience, restore_best_weights=True, min_delta=0.002) <NEW_LINE> model_checkpoint = ModelCheck... | Initializes the model callbacks. | 625941c8d8ef3951e32435a9 |
def icx_transfer_call(icon_integrate_test_base: IconIntegrateTestBase, from_: KeyWallet, to_: str, value: int = 0, icon_service: IconService = None) -> dict: <NEW_LINE> <INDENT> transaction = TransactionBuilder() .from_(from_.get_address()) .to(to_) .step_limit(100_000_000_000) .nid(3) ... | Sends the transaction sending ICX by using SDK
:param icon_integrate_test_base: IconIntegrateTestBase
:param from_: wallet address making a transaction
:param to_: wallet address to receive coin or SCORE address to receive a transaction
:param value: amount of ICX to be sent (Optional)
:param icon_service: IconService... | 625941c8627d3e7fe0d68ebb |
def affine_forward(x, w, b): <NEW_LINE> <INDENT> out = None <NEW_LINE> N = x.shape[0] <NEW_LINE> input = x.reshape(N,-1) <NEW_LINE> z = input.dot(w) + b <NEW_LINE> out = z <NEW_LINE> cache = (x, w, b) <NEW_LINE> return out, cache | Computes the forward pass for an affine (fully-connected) layer.
The input x has shape (N, d_1, ..., d_k) and contains a minibatch of N
examples, where each example x[i] has shape (d_1, ..., d_k). We will
reshape each input into a vector of dimension D = d_1 * ... * d_k, and
then transform it to an output vector of di... | 625941c85510c4643540f452 |
def exportCircuit(self,filename): <NEW_LINE> <INDENT> import json, os <NEW_LINE> powerList=[] <NEW_LINE> resList=[] <NEW_LINE> for pow in self.list_pow: <NEW_LINE> <INDENT> powerList.append(pow.toDict()) <NEW_LINE> <DEDENT> for res in self.list_res: <NEW_LINE> <INDENT> resList.append(res.toDict()) <NEW_LINE> <DEDENT> c... | Función para exportar un circuito a un archivo txt
Autor: Ignacio Vargas
Entrada: Nombre del archivo
| 625941c8167d2b6e31218c02 |
def sl(c, s, l): <NEW_LINE> <INDENT> return (c - s)/l | This accountancy function computes straight line
depreciation for an asset purchase for cash with
a known life span and salvage value.
c = historical cost or price paid (1000)
s = the expected salvage proceeds at disposal
l = expected useful life of the fixed asset
Example: sl(1000, 350, 10) | 625941c88a349b6b435e81df |
def _ensure_array_list(arrays): <NEW_LINE> <INDENT> return [numpy.array(arr, ndmin=1) if not isinstance(arr, numpy.ndarray) else arr for arr in arrays] | Ensures that every element in a list is an instance of a numpy array. | 625941c89b70327d1c4e0e40 |
def _store_at_least_class(self, var_name, obj): <NEW_LINE> <INDENT> self._convert_to_class_and_object(var_name, obj, may_create_new_objects=False) | Stores at minimum the class of ``obj``. If ``obj`` is an instance
(rather than a class), ``obj`` will be stored as well. | 625941c863f4b57ef0001187 |
def nll ( self , dataset , silent = True , args = () , **kwargs ) : <NEW_LINE> <INDENT> return self.pdf.nll ( dataset , silent = silent , args = args , **kwargs ) | Get NLL object from the pdf
>>> model.fitTo ( dataset , ... )
>>> nll, sf = model.nll ( dataset )
- see RooAbsPdf::createNLL | 625941c80a366e3fb873e885 |
def on_process_parse(self, process): <NEW_LINE> <INDENT> self.emit_null_row(process) <NEW_LINE> self.set_id(process) | On process parse event handler.
| 625941c8a934411ee37516ff |
def serialize_numpy(self, buff, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self <NEW_LINE> buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) <NEW_LINE> _x = self.header.frame_id <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <IND... | serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module | 625941c85f7d997b87174b03 |
def check_blacklist(package, cloud_version): <NEW_LINE> <INDENT> for start in _BLACKLIST[cloud_version]: <NEW_LINE> <INDENT> if package.startswith(start): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False | Check whether a package's name starts with any of the patterns in the black
list for a given SUSE OpenStack Cloud version. | 625941c8f8510a7c17cf9768 |
def __init__(self, net, max_epochs, criterion=None): <NEW_LINE> <INDENT> self.net = net <NEW_LINE> self.max_epochs = max_epochs <NEW_LINE> self.epoch_counter = 0 <NEW_LINE> self.use_cuda = torch.cuda.is_available() <NEW_LINE> self.criterion=criterion | The classifier used for training and launching predictions. Based on CarvanaClassifier.
Args:
net (nn.Module): The neural net module containing the definition of your model
max_epochs (int): The maximum number of epochs on which the model will train
criterion (int): loss function selection | 625941c8f548e778e58cd5e9 |
def get_frame_from_image(image: Image) -> np.ndarray: <NEW_LINE> <INDENT> image_width = image.size[0] <NEW_LINE> image_height = image.size[1] <NEW_LINE> image_data = list(image.getdata()) <NEW_LINE> frame: typing.MutableSequence[ typing.Sequence[typing.Tuple[int, int, int]]] = [] <NEW_LINE> for y in range(image_height)... | Get numpy array of rows from flat Pillow list of pixels | 625941c8eab8aa0e5d26dbc4 |
def inorderSuccessor(self, root, p): <NEW_LINE> <INDENT> if p.right: <NEW_LINE> <INDENT> successor = p.right <NEW_LINE> while successor.left: <NEW_LINE> <INDENT> successor = successor.left <NEW_LINE> <DEDENT> return successor <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> node = root <NEW_LINE> successor = None <NEW_LIN... | Two cases:
1. p has right child, return left-most child of p.right
2. p has not right child, Ok, read the code to save the verbose
explanation.
:type root: TreeNode
:type p: TreeNode
:rtype: TreeNode | 625941c8cdde0d52a9e5309e |
def browse_criteria(crit_node, mode=0): <NEW_LINE> <INDENT> rs = list() <NEW_LINE> if crit_node.get_type() == oscap.oval.OVAL_NODETYPE_CRITERIA: <NEW_LINE> <INDENT> for c in crit_node.get_subnodes(): <NEW_LINE> <INDENT> rs.append(browse_criteria(c, mode)) <NEW_LINE> <DEDENT> <DEDENT> elif crit_node.get_type() == oscap.... | Browse recursively criteria of an oval test and build a representation of it
First list item is the operator, and the next ones are the tests
If the item is a list, it's a criteria (else a criterion, or string for an
extended defintion , or None for OVAL_NODETYPE_UNKNOWN
Ex: [operator, "extended def", [operator, test_... | 625941c8cdde0d52a9e5309f |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.