code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def add_suffix_to_extension(inm, fnm, typ): <NEW_LINE> <INDENT> if typ == 'EXTENSION': <NEW_LINE> <INDENT> if fnm.endswith(inm): <NEW_LINE> <INDENT> return inm, fnm, typ <NEW_LINE> <DEDENT> inm = inm.replace('.', os.sep) <NEW_LINE> if os.path.splitext(inm)[1] not in EXTENSION_SUFFIXES: <NEW_LINE> <INDENT> base_name = o... | Take a TOC entry (inm, fnm, typ) and adjust the inm for EXTENSION or DEPENDENCY to include the full library suffix. | 625941f1287bf620b61d4018 |
def on_test_failure(self, message): <NEW_LINE> <INDENT> pass | An abstract handler for posting failed test onto Zafira UI
:param message: error message from failing test | 625941f1851cf427c661aac2 |
def Intersect(*args): <NEW_LINE> <INDENT> args = _get_args(args) <NEW_LINE> sz = len(args) <NEW_LINE> if z3_debug(): <NEW_LINE> <INDENT> _z3_assert(sz > 0, "At least one argument expected.") <NEW_LINE> _z3_assert(all([is_re(a) for a in args]), "All arguments must be regular expressions.") <NEW_LINE> <DEDENT> if sz == 1... | Create intersection of regular expressions.
>>> re = Intersect(Re("a"), Re("b"), Re("c")) | 625941f1ac7a0e7691ed4679 |
def parse(self) -> None: <NEW_LINE> <INDENT> for _ in self.continuous_parse(): <NEW_LINE> <INDENT> pass | Parses all replay data | 625941f1956e5f7376d71424 |
def restoreU( x ): <NEW_LINE> <INDENT> tempU = [[0,0]] <NEW_LINE> length = int( len(x)/2 ) <NEW_LINE> for i in range( length ): <NEW_LINE> <INDENT> tempU.append([x[i*2+1,0],x[i*2,0]]) <NEW_LINE> <DEDENT> U = np.matrix(tempU) <NEW_LINE> return U | @TODO: doc
@TODO: polar system | 625941f15e10d32532c5f4dd |
def start(self, url_dict=None): <NEW_LINE> <INDENT> logging.info("---") <NEW_LINE> logging.info("START watching") <NEW_LINE> logging.info("---") <NEW_LINE> if url_dict is None or len(url_dict) == 0: <NEW_LINE> <INDENT> url_dict = self.get_all_urls() <NEW_LINE> <DEDENT> self.prepare_dirs() <NEW_LINE> self.download_and_s... | !!!WARNING: url_dict must be Pair<<name>,<url>>
1. If url_dict is None we collect all urls from url_dir files to url_dict: ['File name', 'url']
2. Delete old_html_dir
3. Delete old_diff_dir and rename diff_dir to old_diff_dir
4. Rename html_dir to old_html_dir
5. Loop for all url_dict items to download html from sites... | 625941f121bff66bcd684f05 |
def test_showcase_admin_add_no_user(self): <NEW_LINE> <INDENT> context = {'user': None, 'model': None} <NEW_LINE> nosetools.assert_raises(toolkit.NotAuthorized, helpers.call_auth, 'ckanext_showcase_admin_add', context=context) | Calling showcase admin add with no user raises NotAuthorized. | 625941f12eb69b55b151ce70 |
def database_settings(collection_name): <NEW_LINE> <INDENT> client = pymongo.MongoClient(conf.DATABASE['host'], conf.DATABASE['port']) <NEW_LINE> database = client[conf.DATABASE['database']] <NEW_LINE> collection = database[collection_name] <NEW_LINE> return collection | establish connection with MongoDB database
and choose proper collection based on domain
:param collection_name: the proper collection name based on the domain
:return: the collection object for further CURD operation | 625941f15f7d997b87175056 |
def __str__(self): <NEW_LINE> <INDENT> d = {} <NEW_LINE> d["device"] = self.device <NEW_LINE> d["mount"] = self.mount <NEW_LINE> d["total"] = self.total <NEW_LINE> d["used"] = self.used <NEW_LINE> d["available"] = self.available <NEW_LINE> return str(d) | Return a string representation of this structure | 625941f17c178a314d6efa22 |
def testValidateSiteLists(self): <NEW_LINE> <INDENT> from WMCore.WMSpec.WMWorkloadTools import validateSiteLists <NEW_LINE> args = {'SiteWhitelist': ['T1_CH_CERN'], 'SiteBlacklist': ['T2_CH_CERN']} <NEW_LINE> self.assertEqual(validateSiteLists(args), None) <NEW_LINE> args = {'SiteWhitelist': 'T1_US_FNAL', 'SiteBlacklis... | _testValidateSiteLists_
Verify we cannot set a site to the white and blacklist | 625941f121bff66bcd684f06 |
def getMountPoint(self): <NEW_LINE> <INDENT> return self.ramdisk.getMountPoint() | Getter for the mount point name the ramdisk is using
Must be over-ridden to provide OS/Method specific functionality
@author: Roy Nielsen | 625941f10a50d4780f667450 |
def install_reqs(): <NEW_LINE> <INDENT> remove_reqs_readonly() <NEW_LINE> interpreter = sys.executable.split('/')[-1] <NEW_LINE> if not interpreter: <NEW_LINE> <INDENT> error("Python interpreter not found.") <NEW_LINE> return <NEW_LINE> <DEDENT> txt = REQS_TXT <NEW_LINE> args = [ interpreter, "-m", "pip", "install", "-... | Installs the required requirements for the environment.
:return: Pip call, then exit code.
0 if everything is fine, 1 if error ocurred. | 625941f107f4c71912b11a3e |
def hours(m: int) -> int: <NEW_LINE> <INDENT> return mah.floor(m / 60) | Transforma minuto(s) a hora(s)
:param m:
:type m:
:return:
:rtype: | 625941f1cb5e8a47e48b8059 |
def to_bytes(self): <NEW_LINE> <INDENT> pass | Build the command into a byte stream | 625941f132920d7e50b2878e |
def max(*nums): <NEW_LINE> <INDENT> raise ChallengeNotAttempted | =============================
Python Functional Challenge 7
=============================
Write a function that calculates the maximum number in all inputs.
For example, max(10, 8, 2, 1, 3, 0, 22, -5) should return 22
-10000 < n < 10000 | 625941f17d847024c06be87a |
def plot(expr, image_format='png', width=640, height=320): <NEW_LINE> <INDENT> from abjad import abjad_configuration <NEW_LINE> from abjad.tools import systemtools <NEW_LINE> assert image_format in ('pdf', 'png') <NEW_LINE> assert isinstance(width, int) and 0 < width <NEW_LINE> assert isinstance(height, int) and 0 < he... | Plots `expr` with gnuplot and opens resulting image in the default
image viewer.
Returns none. | 625941f1d7e4931a7ee9e4d8 |
def test_failure_to_lookup_router_id_for_host(self): <NEW_LINE> <INDENT> cfg_file = create_tempfile( '[CISCO_CSR_REST:6.6.6.1]\n' 'rest_mgmt = 10.20.30.1\n' 'tunnel_ip = 6.6.6.1\n' 'username = me\n' 'password = secret\n' 'host = ubuntu\n' 'tunnel_if = GigabitEthernet3\n' 'timeout = 5.0\n') <NEW_LINE> cfg.CONF.set_overr... | Fail to get router UUID for router in INI matching host name. | 625941f185dfad0860c3b416 |
def consume(self, h_k): <NEW_LINE> <INDENT> clients = self._mr._clients <NEW_LINE> n_success = sum( x[1] == 1 for x in util.run_script( SCRIPTS, self._mr._map_async, 'lq_consume', clients, h_k=h_k, **self._params)) <NEW_LINE> util.remove_background_thread(h_k, self._client_id) <NEW_LINE> if n_success == 0: <NEW_LINE> <... | Remove item from queue. Return the percentage of servers we've
successfully removed item on.
If the returned value is < 50%, a minority of servers know that the
item was consumed. The the item could get locked again
if this minority of servers is entirely unavailable while another
client is getting items from the qu... | 625941f14a966d76dd5515ce |
def simulate_reads( self, genome: Genome, output_prefix: str, read_length: int = 250 ): <NEW_LINE> <INDENT> temporary_files = list() <NEW_LINE> for amplicon in genome.amplicons: <NEW_LINE> <INDENT> temp_reads = self.simulate_amplicon( amplicon, read_length ) <NEW_LINE> temporary_files.append( temp_reads ) <NEW_LINE> <D... | Initiates the simulation process. Iterates through the amplicons of the genome and simulates reads. Then
collates and returns the reads.
Parameters
----------
genome : Genome
Genome object to simulate
output_prefix : str
Location to place output files. '_1.fastq' and '_2.fastq' will be appended.
read_length : i... | 625941f1e1aae11d1e74a276 |
def __init__(self, *args): <NEW_LINE> <INDENT> _Box2D.b2Mat22_swiginit(self,_Box2D.new_b2Mat22(*args)) | __init__(self) -> b2Mat22
__init__(self, b2Vec2 c1, b2Vec2 c2) -> b2Mat22
__init__(self, float32 a11, float32 a12, float32 a21, float32 a22) -> b2Mat22
__init__(self, float32 angle) -> b2Mat22
Construct this matrix using an angle. This matrix becomes an orthonormal rotation matrix. | 625941f1f548e778e58cdb39 |
def _massage_time_entries(time_entries): <NEW_LINE> <INDENT> for t in time_entries: <NEW_LINE> <INDENT> t["start"] = (iso8601.parse_date(t["start"]) - UTC_OFFSET).date() <NEW_LINE> yield t | Massages time entries to make them more palatable for Shotgun. | 625941f138b623060ff0b3a6 |
def is_absolute(path=""): <NEW_LINE> <INDENT> return path[0] == '/' | @brief Check if the path is absolute - starts with | 625941f167a9b606de4a846f |
def store(self, qiss, qtag, info): <NEW_LINE> <INDENT> self.write(qiss, qtag, info) <NEW_LINE> fname = '{}{}/{}'.format(self.base_url, qiss, qtag) <NEW_LINE> return Created(fname) | :param qiss: OP issuer qoute_plus converted
:param qtag: test instance tag quote_plus converted
:param info: test instance configuration as JSON document
:return: HTTP Created is successful | 625941f1ff9c53063f47c7a9 |
def normalize_dates(values, datemode=0, **kwargs): <NEW_LINE> <INDENT> normal_values = [] <NEW_LINE> normal_types_set = set() <NEW_LINE> for v in values: <NEW_LINE> <INDENT> if v == '': <NEW_LINE> <INDENT> normal_values.append(None) <NEW_LINE> continue <NEW_LINE> <DEDENT> v_tuple = xlrd.xldate_as_tuple(v, datemode) <NE... | Normalize a column of date cells. | 625941f1167d2b6e3121914d |
def tb1_output(self, cl1, tb1): <NEW_LINE> <INDENT> prop_cl1 = 0.667 <NEW_LINE> prop_tb1 = 1.0 - prop_cl1 <NEW_LINE> output = (prop_cl1 * np.dot(self.W_CL1_TB1, cl1) - prop_tb1 * np.dot(self.W_TB1_TB1, tb1)) <NEW_LINE> return noisy_sigmoid(output, self.tb1_slope, self.tb1_bias, self.noise) | Ring attractor state on the protocerebral bridge. | 625941f12ae34c7f2600d6e9 |
def test_get_data_provider(self): <NEW_LINE> <INDENT> pair = SpatialPair(self.foo_layer, self.feature) <NEW_LINE> self.assertEquals(pair.data_provider(), self.foo_layer.dataProvider()) <NEW_LINE> self.assertEquals(pair.dataProvider(), self.foo_layer.dataProvider()) | A valid spatial pair should return the given data provider properly
by both methods `data_provider' and `dataProvider'. The latter is
implemented for naming conventions of Qt. | 625941f1293b9510aa2c3849 |
def test_port_state(self): <NEW_LINE> <INDENT> conf = self.create_config_obj(create_mock_datapath(3)) <NEW_LINE> db_logger = gauge_influx.GaugePortStateInfluxDBLogger(conf, '__name__', mock.Mock()) <NEW_LINE> db_logger._running = True <NEW_LINE> reasons = [ofproto.OFPPR_ADD, ofproto.OFPPR_DELETE, ofproto.OFPPR_MODIFY] ... | Check the update method of the GaugePortStateInfluxDBLogger class | 625941f13c8af77a43ae3d60 |
def namaBesar_(nama_): <NEW_LINE> <INDENT> global nama <NEW_LINE> nama_besar = [] <NEW_LINE> for n in nama: <NEW_LINE> <INDENT> nama_besar += n <NEW_LINE> <DEDENT> nama_besar[0] = nama_besar[0].upper() <NEW_LINE> nama = "" <NEW_LINE> for n in nama_besar: <NEW_LINE> <INDENT> nama += n <NEW_LINE> <DEDENT> return nama | Program untuk membuat nama yang dicantumkan user menjadi kapital pada huruf awalnya | 625941f10a366e3fb873edd9 |
def get_azure_reachability_report( self, resource_group_name, network_watcher_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): <NEW_LINE> <INDENT> raw_result = self._get_azure_reachability_report_initial( resource_group_name=resource_group_name, network_watcher_name=network_watcher_n... | Gets the relative latency score for internet service providers from a
specified location to Azure regions.
:param resource_group_name: The name of the network watcher resource
group.
:type resource_group_name: str
:param network_watcher_name: The name of the network watcher resource.
:type network_watcher_name: str
:... | 625941f1435de62698dfe206 |
def collect_all_arguments_to_dict(func, args, kwargs): <NEW_LINE> <INDENT> arg_names = [arg_name for arg_name in inspect.signature(func).parameters] <NEW_LINE> all_as_kwargs = _MyOrderedDict() <NEW_LINE> for arg_name, arg_val in zip(arg_names, args): <NEW_LINE> <INDENT> all_as_kwargs[arg_name] = arg_val <NEW_LINE> <DED... | :param func:
:param args:
:param kwargs:
:return: dictionary with all method arguments and their values (like kwargs) | 625941f130dc7b7665901f18 |
@vouch_required <NEW_LINE> @never_cache <NEW_LINE> def show(request, id, url=None): <NEW_LINE> <INDENT> group = get_object_or_404(Group, id=id) <NEW_LINE> if not url: <NEW_LINE> <INDENT> redirect(reverse('group', args=[group.id, group.url])) <NEW_LINE> <DEDENT> form = forms.SearchForm(request.GET) <NEW_LINE> limit = fo... | List all users with this group. | 625941f1bf627c535bc13789 |
def CRP_prior(corpus,topic,lambdas): <NEW_LINE> <INDENT> res=np.zeros((len(corpus),len(topic))) <NEW_LINE> for i,docs in enumerate(corpus): <NEW_LINE> <INDENT> p_topic=[] <NEW_LINE> for j in range(len(topic)): <NEW_LINE> <INDENT> temp=[] <NEW_LINE> for x in topic[j]: <NEW_LINE> <INDENT> if x != i: <NEW_LINE> <INDENT> t... | Description
---------
Funcion: Chinese Restaurant Process
Parameter
---------
alpha: concentration parameter
topic: the exist tables
Return
------
p: the probability for a new customer to sit in each of the tables | 625941f13539df3088e2e905 |
def get(self) -> list: <NEW_LINE> <INDENT> return organizer(self.db_wrapper.select_all()) | Get запрос.
Выводит все доступные запросы(будильники). | 625941f1aad79263cf391003 |
def __init__(self): <NEW_LINE> <INDENT> self.WorkflowId = None <NEW_LINE> self.RequestId = None | :param WorkflowId: Workflow ID.
:type WorkflowId: int
:param RequestId: The unique request ID, which is returned for each request. RequestId is required for locating a problem.
:type RequestId: str | 625941f192d797404e304746 |
def names(self): <NEW_LINE> <INDENT> return [field.name for key, field in self.fields.items()] | Return a list of the record’s field names | 625941f163d6d428bbe44aaa |
def test_tcp6(self): <NEW_LINE> <INDENT> self.onePrefix('haproxy:tcp6:8080', TCP6ServerEndpoint) | Test if the parser generates a wrapped TCP6 endpoint. | 625941f17cff6e4e81117f3f |
def show_click(self, screen): <NEW_LINE> <INDENT> Functions.text_display(screen, self.position[0], self.position[1], self.text, self.size, self.color_click) <NEW_LINE> Functions.update_delay(100) <NEW_LINE> Functions.text_display(screen, self.position[0], self.position[1], self.text, self.size, self.color) <NEW_LINE> F... | :param screen: | 625941f115baa723493c4533 |
def _join(self, chan=None): <NEW_LINE> <INDENT> if chan is None: <NEW_LINE> <INDENT> return self.command_error(self._join.__doc__) <NEW_LINE> <DEDENT> if isinstance(self.channel, list): <NEW_LINE> <INDENT> for channel in self.channel: <NEW_LINE> <INDENT> self._part(channel) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE>... | Usage: /JOIN <channel> --> Allows a client to start communicating on the specified channel | 625941f16fece00bbac2dcff |
def __distro(self): <NEW_LINE> <INDENT> if hpccm.config.g_linux_distro == linux_distro.UBUNTU: <NEW_LINE> <INDENT> if not self.__ospackages: <NEW_LINE> <INDENT> self.__ospackages = ['git', 'gzip', 'make', 'tar', 'wget'] <NEW_LINE> if 'Rendering' in self.__edition: <NEW_LINE> <INDENT> self.__ospackages.extend([ 'libxau-... | Based on the Linux distribution, set values accordingly. A user
specified value overrides any defaults. | 625941f1de87d2750b860353 |
def jupyter_config_path(): <NEW_LINE> <INDENT> if os.environ.get('JUPYTER_NO_CONFIG'): <NEW_LINE> <INDENT> return [jupyter_config_dir()] <NEW_LINE> <DEDENT> paths = [] <NEW_LINE> if os.environ.get('JUPYTER_CONFIG_PATH'): <NEW_LINE> <INDENT> paths.extend( p.rstrip(os.sep) for p in os.environ['JUPYTER_CONFIG_PATH'].split... | Return the search path for Jupyter config files as a list.
If the JUPYTER_PREFER_ENV_PATH environment variable is set, the environment-level
directories will have priority over user-level directories. | 625941f1377c676e91272760 |
def seed(seed_state): <NEW_LINE> <INDENT> if not isinstance(seed_state, int): <NEW_LINE> <INDENT> raise ValueError('sd must be int') <NEW_LINE> <DEDENT> seed_state = ctypes.c_int(int(seed_state)) <NEW_LINE> check_call(_LIB.MXRandomSeed(seed_state)) | Seed the random number generators in mxnet.
This seed will affect behavior of functions in this module,
as well as results from executors that contains Random number
such as Dropout operators.
Parameters
----------
seed_state : int
The random number seed to set to all devices.
Notes
-----
The random number gener... | 625941f17047854f462a19bc |
def getUI(self): <NEW_LINE> <INDENT> return [self.value1.value()/32768, self.value2.value()/32768, self.value3.value()/32768] | Set the value of the GUI | 625941f110dbd63aa1bd315b |
def set_http_password(self, input_): <NEW_LINE> <INDENT> endpoint = "/accounts/%s/password.http" % self.username <NEW_LINE> base_url = self.gerrit.get_endpoint_url(endpoint) <NEW_LINE> response = self.gerrit.requester.put( base_url, json=input_, headers=self.gerrit.default_headers ) <NEW_LINE> result = self.gerrit.deco... | Sets/Generates the HTTP password of an account.
.. code-block:: python
input_ = {
"generate": 'true',
"http_password": "the_password"
}
account = gerrit.accounts.get('kevin.shi')
result = account.set_http_password(input_)
:param input_: the HttpPasswordInput entity,
https://gerrit-... | 625941f196565a6dacc8fc83 |
def forward(self, x): <NEW_LINE> <INDENT> x = self.cnn_layers(x) <NEW_LINE> x = x.view(x.size(0), -1) <NEW_LINE> x = dropout(x, training=self.training) <NEW_LINE> x = self.linear_layers(x) <NEW_LINE> return x | [summary]
| 625941f1c4546d3d9de72ff3 |
def attach_volume(self, server_id, volume_id, device='/dev/vdz'): <NEW_LINE> <INDENT> post_body = json.dumps({ 'volumeAttachment': { 'volumeId': volume_id, 'device': device, } }) <NEW_LINE> resp, body = self.post('servers/%s/os-volume_attachments' % server_id, post_body, self.headers) <NEW_LINE> return resp, body | Attaches a volume to a server instance. | 625941f1851cf427c661aac3 |
def get_logger_console_level(self): <NEW_LINE> <INDENT> return self.get_logger_level() | gets logger level specific for the console output.
Note : This is possible to set different logger level between log file
and console. | 625941f18a43f66fc4b54618 |
def __init__(self, trader_id, order_id, recipient_order_id, proposal_id, timestamp): <NEW_LINE> <INDENT> super(Trade, self).__init__(trader_id, timestamp) <NEW_LINE> self._order_id = order_id <NEW_LINE> self._recipient_order_id = recipient_order_id <NEW_LINE> self._proposal_id = proposal_id | Don't use this method directly, use one of the class methods.
:param trader_id: String representing the trader id
:param order_id: A order id to identify the order
:param recipient_order_id: A order id to identify the traded party
:param proposal_id: The ID of the trade proposal
:param timestamp: A timestamp wen this ... | 625941f1a4f1c619b28b05e4 |
def normalize(self, lines): <NEW_LINE> <INDENT> nstring = re.sub('\s+', ' ', ''.join(lines)).strip() <NEW_LINE> ending = self.FORMAT_PROPERTIES.get(self.reftype, dict()).get("ref_ending", "") <NEW_LINE> ending_index = nstring.rfind(ending) <NEW_LINE> if ending_index != -1: <NEW_LINE> <INDENT> nstring = nstring[:ending_... | Normalize the reference item content
Parameters
----------
lines : list
Returns
-------
str
Returned string doesn't contain trailing spaces and
typical ending for the reference of reftype (if found) | 625941f10fa83653e4657571 |
def _remove(self, ids: List[str]) -> None: <NEW_LINE> <INDENT> self._tracks = list(filter(lambda x: x.person.id not in ids, self._tracks)) | Removes specific tracks, based on their ids. | 625941f166673b3332b9264a |
def test_select_bad_column(self, table_data): <NEW_LINE> <INDENT> self.t = table_data.Table(table_data.COLS) <NEW_LINE> self.tc = self.t.columns <NEW_LINE> with pytest.raises(ValueError): <NEW_LINE> <INDENT> self.t['a', 1] | Select column name that does not exist | 625941f166673b3332b9264b |
def split_ioc_module_name(module_name): <NEW_LINE> <INDENT> slash_tokens = module_name.split('/') <NEW_LINE> if len(slash_tokens) <= 1: <NEW_LINE> <INDENT> if module_name.count("-") == 3: <NEW_LINE> <INDENT> tokens = module_name.split("-") <NEW_LINE> err_message = (base_ioc_name_err_message + "\nDid you mean {technical... | Parses the module name and returns split module_name and split type.
Args:
module_name: The ioc module's name.
Returns:
bool: True if the string is dash-separated, false otherwise.
Based on original svn implementation, if both slashes and dashes
appear in the module name, it will default to sl... | 625941f1b545ff76a89143cf |
def create(self): <NEW_LINE> <INDENT> self.keypress_timeout = 1 <NEW_LINE> self.add( npyscreen.TitleText, name="Temperature Management Console", editable=False, rely=0, ) <NEW_LINE> self.label_btn_conn = self.add( npyscreen.TitleText, name="Connect to broker:", editable=False, relx=3, rely=2, ) <NEW_LINE> self.btn_conn... | Create the UI elements | 625941f1046cf37aa974d2fb |
@reg.register_compute("nn.sparse_transpose") <NEW_LINE> def compute_sparse_transpose(attrs, inputs, out_type, target): <NEW_LINE> <INDENT> return topi.nn.sparse_transpose(inputs[0], inputs[1], inputs[2]) | Compute definition of sparse_transpose | 625941f1a934411ee3751c4f |
def _plot_ica_overlay_raw(data, data_cln, times, title, ch_types_used, show): <NEW_LINE> <INDENT> import matplotlib.pyplot as plt <NEW_LINE> assert data.shape == data_cln.shape <NEW_LINE> fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True) <NEW_LINE> plt.suptitle(title) <NEW_LINE> ax1.plot(times, data.T, color='r') <NEW_... | Plot evoked after and before ICA cleaning
Parameters
----------
ica : instance of mne.preprocessing.ICA
The ICA object.
epochs : instance of mne.Epochs
The Epochs to be regarded.
show : bool
If True, all open plots will be shown.
Returns
-------
fig : instance of pyplot.Figure | 625941f1004d5f362079a8e8 |
def init_new_db(self, config, init_db=True): <NEW_LINE> <INDENT> module_dir = _install_module(config.DATABASE_MODULE_PATH, config.lib_dir.module, config.project_dir / 'module') <NEW_LINE> self.normalization = config.TERM_NORMALIZATION <NEW_LINE> self._install_php(config) <NEW_LINE> with connect(self.dsn) as conn: <NEW_... | Set up a new tokenizer for the database.
This copies all necessary data in the project directory to make
sure the tokenizer remains stable even over updates. | 625941f1bde94217f36833a5 |
def _get_variables_dir(export_dir): <NEW_LINE> <INDENT> return os.path.join( tf.compat.as_text(export_dir), tf.compat.as_text(tf.saved_model.VARIABLES_DIRECTORY)) | Return variables sub-directory in the SavedModel. | 625941f11b99ca400220b06e |
def DeleteDocuments(self, document_ids, response): <NEW_LINE> <INDENT> for document_id in document_ids: <NEW_LINE> <INDENT> self.DeleteDocument(document_id, response.add_status()) | Deletes documents for the given document_ids. | 625941f1be7bc26dc91cdbae |
def giveCosmoNames(giveExtra=False): <NEW_LINE> <INDENT> list1 = ['h', 'omega_b', 'omega_cdm' , 'n_s', 'ln10^{10}A_s'] <NEW_LINE> if giveExtra: list1 +=['Omega_k','Omega_Lambda','w0_fld','wa_fld'] <NEW_LINE> return list1 | Define parameters for CLASS soft | 625941f163d6d428bbe44aab |
def check_properties(rho_gas, mu_gas, sigma_gas, rho_oil, mu_oil, sigma_oil, rho, mu, psd_obj): <NEW_LINE> <INDENT> assert psd_obj.rho_gas == rho_gas <NEW_LINE> assert psd_obj.mu_gas == mu_gas <NEW_LINE> assert psd_obj.sigma_gas == sigma_gas <NEW_LINE> assert psd_obj.rho_oil == rho_oil <NEW_LINE> assert psd_obj.mu_oil ... | Check that the given properties match the properties inside the object | 625941f1be383301e01b5a34 |
def stop_node(self, i): <NEW_LINE> <INDENT> self.nodes[i].stop_node() <NEW_LINE> self.nodes[i].wait_until_stopped() | Stop a gauntletd test node | 625941f18e71fb1e9831dd60 |
def p_import_statement(p): <NEW_LINE> <INDENT> p[0] = ASTImport(p[3]) | import_statement : LPAREN IMPORT ID RPAREN | 625941f107d97122c4178e53 |
def get_structure_string(self): <NEW_LINE> <INDENT> data = "" <NEW_LINE> if self._atoms.get_pbc().any(): <NEW_LINE> <INDENT> cellpar = self._atoms.get_cell_lengths_and_angles() <NEW_LINE> str_format = 'CRYST1' + '{:9.3f}' * 3 + '{:7.2f}' * 3 + ' P 1\n' <NEW_LINE> data += str_format.format(*cellpar.tolist()) <NEW_LINE> ... | PDB file format:
CRYST1 16.980 62.517 124.864 90.00 90.00 90.00 P 1
MODEL 1
ATOM 0 Fe MOL 1 15.431 60.277 6.801 1.00 0.00 FE
ATOM 1 Fe MOL 1 1.273 3.392 93.940 1.00 0.00 FE | 625941f14e4d5625662d4989 |
def waterbag_cut_mm2(height_mm, flat_width_mm): <NEW_LINE> <INDENT> r_mm = height_mm / 2 <NEW_LINE> return math.pi * pow(r_mm, 2) + height_mm * (flat_width_mm - math.pi * r_mm) | approximate area of waterbag cut: assume constant circumference (2*flat_width)
and shape of half-circle at either side (total one circle with r=height_mm/2 with rectangle between them | 625941f1293b9510aa2c384a |
def ExecLinkWrapper(self, arch, use_separate_mspdbsrv, *args): <NEW_LINE> <INDENT> env = self._GetEnv(arch) <NEW_LINE> if use_separate_mspdbsrv == 'True': <NEW_LINE> <INDENT> self._UseSeparateMspdbsrv(env, args) <NEW_LINE> <DEDENT> if sys.platform == 'win32': <NEW_LINE> <INDENT> args = list(args) <NEW_LINE> args[0] = a... | Filter diagnostic output from link that looks like:
' Creating library ui.dll.lib and object ui.dll.exp'
This happens when there are exports from the dll or exe. | 625941f10c0af96317bb87a1 |
def majorBusinessIT(): <NEW_LINE> <INDENT> df = returnDataFrame() <NEW_LINE> courseTrack = {} <NEW_LINE> E = ['CNS', 'CSC', 'ECT', 'GAM', 'GPH', 'HCI', 'HIT', 'IPD', 'IS', 'IT', 'PM', 'SE', 'TDC'] <NEW_LINE> CAP = ['IS 577', 'PM 577', 'ECT 589'] <NEW_LINE> fallYearOne = 'Fall 2012-2013' <NEW_LINE> fallOne = ['IS 421',... | defines Business Information Technology major requirements | 625941f1956e5f7376d71425 |
def test_default_rte_components_are_valid(self): <NEW_LINE> <INDENT> for component_id in feconf.ALLOWED_RTE_EXTENSIONS: <NEW_LINE> <INDENT> self.assertTrue(self._is_camel_cased(component_id)) <NEW_LINE> component_dir = os.path.join( feconf.RTE_EXTENSIONS_DIR, component_id) <NEW_LINE> self.assertTrue(os.path.isdir(compo... | Test that the default RTE components are valid. | 625941f126068e7796caf2a2 |
def get_parameter(self): <NEW_LINE> <INDENT> selected_value = [] <NEW_LINE> for opt in self._input.selectedItems(): <NEW_LINE> <INDENT> index = self._input.indexFromItem(opt) <NEW_LINE> selected_value.append(self._parameter.options_list[index.row()]) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self._parameter.value = ... | Obtain list parameter object from the current widget state.
:returns: A ListParameter from the current state of widget | 625941f1e5267d203edce24f |
def check_signature(self, encrypt_text, timestamp, nonce, signature): <NEW_LINE> <INDENT> return self._make_signature(encrypt_text, timestamp, nonce, self._token) == signature | 验证传输的信息的签名是否正确
:param encrypt_text: str
:param timestamp: str
:param nonce: str
:param signature: 签名
:return: boolean | 625941f1187af65679ca56da |
def __init__(self, contents=[], size=10): <NEW_LINE> <INDENT> self.items = [None] * size <NEW_LINE> self.num_items = 0 <NEW_LINE> self.size = size <NEW_LINE> for item in contents: <NEW_LINE> <INDENT> self.append(item) | O(1) if no value is passed
O(N) if a sequence is passed to the constructor
num_items number of actual items (or (mem)locations)
size the space being allocated/initialized (don't mind the 10) | 625941f18a43f66fc4b54619 |
def bland_altman_plot(data1, data2, *args, **kwargs): <NEW_LINE> <INDENT> data1 = np.asarray(data1) <NEW_LINE> data2 = np.asarray(data2) <NEW_LINE> mean = np.mean([data1, data2], axis=0) <NEW_LINE> diff = data1 - data2 <NEW_LINE> md = np.mean(diff) <NEW_LINE> sd = np.std(diff, axis=0) <N... | Based on Neal Fultz' answer on Stack Overflow | 625941f1a17c0f6771cbe609 |
def api_search(request): <NEW_LINE> <INDENT> li, limit = [], 100 <NEW_LINE> q = slugify(request.GET.get('q', '')) <NEW_LINE> if len(q) < 3: <NEW_LINE> <INDENT> return JsonResponse({'items': []}) <NEW_LINE> <DEDENT> def get_obj(x): <NEW_LINE> <INDENT> return {'id': x.stone.id, 'pseu': x.name, 'name': x.stone.name, 'slug... | Search stones by name for the autocomplete input box.
:param request: HttpRequest
:return: JsonResponse | 625941f1dd821e528d63b75e |
def get_job_config(self, jobkey, config_file, use_memoized_env=False): <NEW_LINE> <INDENT> jobname = jobkey.name <NEW_LINE> try: <NEW_LINE> <INDENT> with open(config_file, "r") as fp: <NEW_LINE> <INDENT> logging.debug("Config: %s" % fp.readlines()) <NEW_LINE> <DEDENT> result = get_config( jobname, config_file, self.opt... | Loads a job configuration from a config file. | 625941f1d268445f265b5429 |
def start(self): <NEW_LINE> <INDENT> if self.node is None: <NEW_LINE> <INDENT> raise ValueError("Trying to start a node that does not exist") <NEW_LINE> <DEDENT> self.node.start() | Start self.node | 625941f1b545ff76a89143d0 |
def divideEqual(self, *args): <NEW_LINE> <INDENT> return _MEDCouplingClient.MEDCouplingLinearTime_divideEqual(self, *args) | divideEqual(self, MEDCouplingTimeDiscretization other)
1 | 625941f1ab23a570cc250742 |
def SimultaneousInterpreting(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("SimultaneousInterpreting", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Simultaneou... | 该接口是实时流式识别,可同时返回语音识别文本及翻译文本,当前仅支持中文和英文。该接口可配合同传windows客户端,提供会议现场同传服务。
:param request: Request instance for SimultaneousInterpreting.
:type request: :class:`tencentcloud.aai.v20180522.models.SimultaneousInterpretingRequest`
:rtype: :class:`tencentcloud.aai.v20180522.models.SimultaneousInterpretingResponse` | 625941f1442bda511e8be9ca |
def test_invalid_type(): <NEW_LINE> <INDENT> load_config(sources="wrong") <NEW_LINE> load_and_validate_fails() | tests that a config file with an invalid type
for sources throws an error | 625941f14d74a7450ccd477f |
def get_event_exported_actions(download_url): <NEW_LINE> <INDENT> download_action = NotificationAction( subject='event-export', link=download_url, action_type='download' ) <NEW_LINE> save_to_db(download_action) <NEW_LINE> return [download_action] | Get the actions associated with a notification about an event being successfully exported.
:param download_url: download url of the event.
:return: actions. | 625941f176d4e153a657f0ec |
def LLR(pdf,s0,s1): <NEW_LINE> <INDENT> return stats(LLRjumps(pdf,s0,s1))[0] | This function computes the generalized log likelihood ratio (divided by N)
for s=s1 versus s=s0 where pdf is an empirical distribution and
s is the expectation value of the true distribution.
pdf is a list of pairs (value,probability). | 625941f1711fe17d82542918 |
def _add_test_events(self): <NEW_LINE> <INDENT> now = datetime.now() <NEW_LINE> five_days_ago = now - timedelta(days=5) <NEW_LINE> event_data = {'test_attr': 5, 'test_attr_10': 'nice'} <NEW_LINE> self.hass.pool.block_till_done() <NEW_LINE> recorder._INSTANCE.block_till_done() <NEW_LINE> for event_id in range(5): <NEW_L... | Add a few events for testing. | 625941f1925a0f43d254a437 |
def __init__(self, http=None, https=None): <NEW_LINE> <INDENT> self._http = None <NEW_LINE> self._https = None <NEW_LINE> if http is not None: <NEW_LINE> <INDENT> self.http = http <NEW_LINE> <DEDENT> if https is not None: <NEW_LINE> <INDENT> self.https = https | EnvironmentEndpoints - a model defined in Swagger | 625941f1a8ecb033257d3685 |
def copy_OFDPA_TUNNEL_PORT_TYPE_tp(*args): <NEW_LINE> <INDENT> return _OFDPA_python.copy_OFDPA_TUNNEL_PORT_TYPE_tp(*args) | copy_OFDPA_TUNNEL_PORT_TYPE_tp(OFDPA_TUNNEL_PORT_TYPE_t value) -> OFDPA_TUNNEL_PORT_TYPE_t * | 625941f19f2886367277ae43 |
def remove_vic_config(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> logger.info('Deleting vic export config file: ' + self.export_path) <NEW_LINE> self.tftp_handle.connect() <NEW_LINE> self.tftp_handle.execute_cmd('rm -f ' + self.export_path) <NEW_LINE> self.tftp_handle.disconnect() <NEW_LINE> <DEDENT> except: <N... | Procedure to remove the VIC exported file
Returns:
True: on success
False: on failure | 625941f144b2445a3393264c |
def fetchrows(sql): <NEW_LINE> <INDENT> with db.connection.cursor() as cursor: <NEW_LINE> <INDENT> cursor.execute(sql) <NEW_LINE> results = cursor.fetchall() <NEW_LINE> all_rows = [] <NEW_LINE> for row in results: <NEW_LINE> <INDENT> all_rows.append([x for x in row]) <NEW_LINE> <DEDENT> <DEDENT> return all_rows | Fetch rows from sql query | 625941f156ac1b37e626477e |
def colorize(text, color, bold=False): <NEW_LINE> <INDENT> if getattr(settings, 'IEVV_COLORIZE_USE_COLORS', True) and color: <NEW_LINE> <INDENT> attrs = [] <NEW_LINE> if bold: <NEW_LINE> <INDENT> attrs.append('bold') <NEW_LINE> <DEDENT> return colored(text, color=color, attrs=attrs) <NEW_LINE> <DEDENT> else: <NEW_LINE>... | Colorize a string for stdout/stderr.
Colors are only applied if :setting:`IEVV_COLORIZE_USE_COLORS` is
``True`` or not defined (so it defaults to ``True``).
Examples:
Print blue text::
from ievv_opensource.utils import ievv_colorize
print(ievv_colorize('Test', color=ievv_colorize.COLOR_BLUE))
... | 625941f1d164cc6175783309 |
def _load_projector_together(self, projector_file): <NEW_LINE> <INDENT> hdf5file = bob.io.HDF5File(projector_file) <NEW_LINE> hdf5file.cd('/Projector') <NEW_LINE> self.m_ubm = bob.machine.GMMMachine(hdf5file) <NEW_LINE> self.m_ubm.set_variance_thresholds(self.m_variance_threshold) <NEW_LINE> self.m_gmm_stats = bob.mach... | Load the GMM and the ISV model from the same HDF5 file | 625941f1a05bb46b383ecdd6 |
def get_face_pixel_step(context, face): <NEW_LINE> <INDENT> slot_len = len(context.object.material_slots) <NEW_LINE> if face.material_index < 0 or face.material_index >= slot_len: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> material = context.object.material_slots[face.material_index].material <NEW_LINE> if mat... | Finds the UV space amount for one pixel of a face, if it is textured
:param context:
:param face:
:return: Vector of the pixel translation, None if face is not textured | 625941f150485f2cf553d356 |
def test_bad_map_ts_dict(self): <NEW_LINE> <INDENT> inmap = self.std_map() <NEW_LINE> inmap['schema public'].update({'tsd1': { 'template': 'simple', 'options': "stopwords = 'english'"}}) <NEW_LINE> with pytest.raises(KeyError): <NEW_LINE> <INDENT> self.to_sql(inmap) | Error creating a text search dictionary with a bad map | 625941f15fc7496912cc3f38 |
def get_number_of_colors(image): <NEW_LINE> <INDENT> mode = image.mode <NEW_LINE> if mode == '1': <NEW_LINE> <INDENT> return 2 <NEW_LINE> <DEDENT> elif mode == 'L': <NEW_LINE> <INDENT> return 256 <NEW_LINE> <DEDENT> elif mode == 'P': <NEW_LINE> <INDENT> palmode, paldata = image.palette.getdata() <NEW_LINE> return len(p... | Does what it says on the tin.
This attempts to return the number of POSSIBLE colors in the image, not the
number of colors actually used. In the case of a paletted image, PIL is
often limited to only returning the actual number of colors. But that's
usually what we mean for palettes, so eh.
But full-color images wi... | 625941f11d351010ab8560d5 |
def get_hadoop_dir(target): <NEW_LINE> <INDENT> if not target in HADOOP_DIR_DEFAULTS: <NEW_LINE> <INDENT> raise Fail("Target {0} not defined".format(target)) <NEW_LINE> <DEDENT> hadoop_dir = HADOOP_DIR_DEFAULTS[target] <NEW_LINE> if Script.is_hdp_stack_greater_or_equal("2.2"): <NEW_LINE> <INDENT> hadoop_dir = HADOOP_DI... | Return the hadoop shared directory in the following override order
1. Use default for 2.1 and lower
2. If 2.2 and higher, use /usr/hdp/current/hadoop-client/{target}
3. If 2.2 and higher AND for an upgrade, use /usr/hdp/<version>/hadoop/{target}.
However, if the upgrade has not yet invoked hdp-select, return the curren... | 625941f1596a89723608a073 |
def contact(): <NEW_LINE> <INDENT> return base.render(u'home/contact.html', extra_vars={}) | display contact page | 625941f1fff4ab517eb2f9fb |
def _create_function(model: sbml.Model, function_id: str, arguments: str, formula: str): <NEW_LINE> <INDENT> f = model.createFunctionDefinition() <NEW_LINE> if f.setId(function_id) != sbml.LIBSBML_OPERATION_SUCCESS: <NEW_LINE> <INDENT> raise RuntimeError(f'Unable to generate function with id ' f'{function_id}. Invalid ... | Create a function definition and add it to the SBML model.
Arguments:
model: SBML model to which the function will be added.
function_id: the function id/name
arguments: the arguments of the function (species AND parameters)
formula: the formula of the function | 625941f166656f66f7cbc767 |
def rdcos(x, dist, angle): <NEW_LINE> <INDENT> return x + dist * cos(radians(angle)) | runs dcos(), but converts angle to radians | 625941f12eb69b55b151ce73 |
def test_identity(): <NEW_LINE> <INDENT> env = InvalidActionEnvDiscrete(dim=70, n_invalid_actions=55) <NEW_LINE> model = MaskablePPO( "MlpPolicy", env, gamma=0.4, seed=32, verbose=0, ) <NEW_LINE> model.learn(3000) <NEW_LINE> evaluate_policy(model, env, n_eval_episodes=20, reward_threshold=90, warn=False) | Performance test.
A randomly initialized model cannot solve that task (score ~=6),
nor a model without invalid action masking (score ~=30 after training)
which such a low training budget. | 625941f18c0ade5d55d3ef7b |
def finalise_protocol(self, device=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.logger.debug("%s cleanup", self.name) <NEW_LINE> for port in self.ports: <NEW_LINE> <INDENT> self.logger.debug("clean NBD port %s", port) <NEW_LINE> nbd_cmd = "pkill -f xnbd-server.*%s" % (port) <NEW_LINE> shell = ShellCommand("... | Called by Finalize action to power down and clean up the assigned
device. | 625941f13d592f4c4ed1d618 |
def calc_log_likelihood(self): <NEW_LINE> <INDENT> log_prob_obs_given_sel = ( self.calc_log_prob_observed_given_selected()) <NEW_LINE> log_prob_sel = self.calc_log_prob_selected() <NEW_LINE> log_likelihood = log_prob_obs_given_sel + log_prob_sel <NEW_LINE> return log_likelihood | Returns the log of the likelihood of this current state given
the observed data. | 625941f15f7d997b87175058 |
def finish(self) -> None: <NEW_LINE> <INDENT> self.__flag = False | call stop Minicap Stream.
| 625941f121bff66bcd684f08 |
def gcd(x, y): <NEW_LINE> <INDENT> while x > 0 and y > 0: <NEW_LINE> <INDENT> if x >= y: <NEW_LINE> <INDENT> x = x - y <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> y = y - x <NEW_LINE> <DEDENT> <DEDENT> return x+y | The function returns the greatest common divisor
| 625941f14e4d5625662d498a |
def make_name(self): <NEW_LINE> <INDENT> if self.title: <NEW_LINE> <INDENT> self.name = make_name(self.title_for_name, maxlength=self.__name_length__) | Autogenerates a :attr:`name` from :attr:`title_for_name` | 625941f116aa5153ce362a34 |
def build_tables(): <NEW_LINE> <INDENT> MetaData().create_all(engine) | Builds database postgres schema | 625941f160cbc95b062c6afe |
def clear_all(self): <NEW_LINE> <INDENT> self.num_requests = 0 <NEW_LINE> self.num_failures = 0 <NEW_LINE> self.entries = {} <NEW_LINE> self.errors = {} <NEW_LINE> self.max_requests = None <NEW_LINE> self.last_request_timestamp = None <NEW_LINE> self.start_time = None | Remove all stats entries and errors | 625941f191f36d47f21acab4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.