code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def delete_object(self, object_selected): <NEW_LINE> <INDENT> self.object_list.remove(object_selected)
Delete object
625941f6d99f1b3c44c67be1
def missing_attrs(self, manifest, engine, pkglint_id="001"): <NEW_LINE> <INDENT> if "pkg.renamed" in manifest: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if "pkg.obsolete" in manifest: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> keys = ["org.opensolaris.consolidation", "info.classification"] <NEW_LINE> for key i...
Warn when a package doesn't have an org.opensolaris.consolidation attribute. Warn when a package don't have an info.classification value
625941f6fb3f5b602dac3cfa
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project4.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 sur...
Run administrative tasks.
625941f656ac1b37e6264821
def to_dict(self): <NEW_LINE> <INDENT> out = {} <NEW_LINE> for i, col in enumerate(self.columns): <NEW_LINE> <INDENT> out[col] = [row[i] for row in self.data] <NEW_LINE> <DEDENT> return out
Returns the data represented as a dictionary where each key represents each column, and each value is an array of the column data.
625941f63eb6a72ae02ecb4f
def gaussian_psf(gaussian_stdev,extension_bins,loc=None): <NEW_LINE> <INDENT> if (loc is None): <NEW_LINE> <INDENT> loc = np.mean(extension_bins) <NEW_LINE> <DEDENT> S_q = scipy.stats.norm.pdf(extension_bins,loc=loc,scale=gaussian_stdev) <NEW_LINE> return S_q
returns a gaussian point-spread function Args: gaussian_stdev: the standard deviation extension_bins: where we want the psf loc: the mean of the gaussian. defaults to <extension_bins> Returns: Probability distribution S_q at each point in extension_bins
625941f6090684286d50f350
def serialize(self, buff): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> length = len(self.names) <NEW_LINE> buff.write(_struct_I.pack(length)) <NEW_LINE> for val1 in self.names: <NEW_LINE> <INDENT> _x = val1.data <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <INDENT> _x = _x.encod...
serialize message into buffer :param buff: buffer, ``StringIO``
625941f6a934411ee3751cf5
def test_install_already_installed(self): <NEW_LINE> <INDENT> self.fakes.juju.config["remove-unlisted-plugins"] = "yes" <NEW_LINE> plugin_path = os.path.join(paths.PLUGINS, "plugin.hpi") <NEW_LINE> with open(plugin_path, "w"): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.plugins.install("plugin") <NEW_LINE> comman...
If a plugin is already installed, it doesn't get downloaded.
625941f63317a56b8693a2a7
def get_bots_data(fname, header = False, encoding = 'utf-8'): <NEW_LINE> <INDENT> with open(fname, mode = 'r', encoding = encoding) as f: <NEW_LINE> <INDENT> data = [] <NEW_LINE> if header == True: <NEW_LINE> <INDENT> f.readline() <NEW_LINE> <DEDENT> for row in f.readlines(): <NEW_LINE> <INDENT> bot = row.rstrip('\n') ...
Opens Wikipedia botlist in file fname and returns list of bots as strings. Default assumes no header row. Default assumes utf-8 encoding.
625941f6b7558d58953c5565
def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> thread = threading.Thread(target=self.server.serve_forever) <NEW_LINE> thread.setDaemon(True) <NEW_LINE> thread.start() <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> raise e
Start threading the new Socket Server instance
625941f65510c4643540fa33
def _validate_valueuri(self): <NEW_LINE> <INDENT> if self.valueNodeType == "URI": <NEW_LINE> <INDENT> uri_value = self.valueConstraint <NEW_LINE> if uri_value: <NEW_LINE> <INDENT> if not is_valid_uri_or_prefixed_uri(uri_value): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return True
True if constraint value for value type URI is a valid URI.
625941f621a7993f00bc835c
def test_bad_input(self): <NEW_LINE> <INDENT> with self.assertRaises(ValueError) as ae: <NEW_LINE> <INDENT> output = conv.hdd_to_pmf(None) <NEW_LINE> self.assertEqual(ae.exception.message, 'Hypocentral depth distribution not defined!')
Tests raises value error when no input and no defaults are selected
625941f6498bea3a759ba10d
def getPartName(self): <NEW_LINE> <INDENT> if self.stage == 1: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.src[8].strip()
>>> from music21 import * >>> from music21.musedata import testFiles >>> mdw = MuseDataWork() >>> mdw.addString(testFiles.bach_cantata5_mvmt3) >>> mdw.getParts()[0].getPartName() 'Viola Solo' >>> mdw.getParts()[1].getPartName() 'TENORE'
625941f6b5575c28eb68e666
def find_files(path, ext): <NEW_LINE> <INDENT> needed_files = glob.glob(path + ext) <NEW_LINE> return needed_files
Returns a list of files with specified extension
625941f68da39b475bd655dc
def handleCommand(self, command, message, muted): <NEW_LINE> <INDENT> cmdName = command.data["cmd"] <NEW_LINE> if muted: <NEW_LINE> <INDENT> if cmdName == "unmute": <NEW_LINE> <INDENT> self.commandUnmute(message) <NEW_LINE> <DEDENT> return <NEW_LINE> <DEDENT> if cmdName == "help": <NEW_LINE> <INDENT> self.commandHelp(m...
Handle a command beginning with a slash, e.g. help, integrate
625941f630bbd722463cc42a
def _http_request(self, url, method, **kwargs): <NEW_LINE> <INDENT> kwargs['headers'] = copy.deepcopy(kwargs.get('headers', {})) <NEW_LINE> kwargs['headers'].setdefault('User-Agent', USER_AGENT) <NEW_LINE> if self.api_version: <NEW_LINE> <INDENT> version_string = 'container-infra %s' % self.api_version <NEW_LINE> kwarg...
Send an http request with the specified characteristics. Wrapper around httplib.HTTP(S)Connection.request to handle tasks such as setting headers and error handling.
625941f6287bf620b61d40bf
def gene_summary_service(db, new=False): <NEW_LINE> <INDENT> gene_summary_cache = caches['gene_summary'] <NEW_LINE> if gene_summary_cache.get(db) is None or new is True: <NEW_LINE> <INDENT> logging.info("Init gene summary cache for db {}.".format(db)) <NEW_LINE> gene_summary_cache.set(db, GeneSummaryService(db)) <NEW_L...
Provides a cached variant service to access the given database. :param db: database name
625941f64e4d5625662d4a2d
def read_namespaced_network_policy(self, name, namespace, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> return self.read_namespaced_network_policy_with_http_info(name, namespace, **kwargs)
read_namespaced_network_policy # noqa: E501 read the specified NetworkPolicy # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.read_namespaced_network_policy(name, namespace, async_req=True) >>> result = thread.get(...
625941f67047854f462a1a61
def showProperties(self, formatter=Ascii, omitHelp=False): <NEW_LINE> <INDENT> facilityNames = self.inventory.facilityNames() <NEW_LINE> propertyNames = sorted(self.inventory.propertyNames()) <NEW_LINE> propertiesHelp = [] <NEW_LINE> for name in propertyNames: <NEW_LINE> <INDENT> if name in facilityNames: <NEW_LINE> <I...
print a report describing my properties
625941f64d74a7450ccd4825
def binary_search(a_list, item): <NEW_LINE> <INDENT> left = 0 <NEW_LINE> right = len(a_list) - 1 <NEW_LINE> while left <= right: <NEW_LINE> <INDENT> mid = (left + right) // 2 <NEW_LINE> if a_list[mid] == item: <NEW_LINE> <INDENT> return mid <NEW_LINE> <DEDENT> elif a_list[mid] > item: <NEW_LINE> <INDENT> right = mid - ...
二分法有序查找 :param a_list: :param item: :return:
625941f6796e427e537b0c2b
def coinChange(self, coins, amount): <NEW_LINE> <INDENT> cache = {} <NEW_LINE> return self.dfs(coins, amount, cache)
:type coins: List[int] :type amount: int :rtype: int
625941f64e696a04525c9aae
def SetWindowMinimum(self, *args): <NEW_LINE> <INDENT> return _itkIntensityWindowingImageFilterPython.itkIntensityWindowingImageFilterIUL3ID3_SetWindowMinimum(self, *args)
SetWindowMinimum(self, unsigned long _arg)
625941f63539df3088e2e9ab
def _create(self): <NEW_LINE> <INDENT> pass
Creates the toolkit specific control.
625941f65fdd1c0f98dc0895
def _on_lists_downloaded( self, done_count: int, filter_set: "adblock.FilterSet" ) -> None: <NEW_LINE> <INDENT> self._engine = adblock.Engine(filter_set) <NEW_LINE> self._engine.serialize_to_file(str(self._cache_path)) <NEW_LINE> message.info( f"braveadblock: Filters successfully read from {done_count} sources.")
Install block lists after files have been downloaded.
625941f650485f2cf553d3fc
def fit(self, X, y): <NEW_LINE> <INDENT> rgen = random.RandomState(self.random_state) <NEW_LINE> self.w_ = rgen.normal(loc=0.0, scale=0.01, size=1 + X.shape[1]) <NEW_LINE> self.cost_ = [] <NEW_LINE> for i in range(self.n_iter): <NEW_LINE> <INDENT> net_input = self.net_input(X) <NEW_LINE> output = self.activation(net_in...
Fit training data. Parameters ---------- X : {array-like}, shape = [n_samples, n_features] Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape = [n_samples] Target values. Returns ------- self : object
625941f6627d3e7fe0d694b2
def pairs(student_list, question = None): <NEW_LINE> <INDENT> while len(student_list) >= 2: <NEW_LINE> <INDENT> pair = np.random.choice(student_list, 2, replace=False) <NEW_LINE> print(pair) <NEW_LINE> student_list.remove(pair[0]) <NEW_LINE> student_list.remove(pair[1]) <NEW_LINE> <DEDENT> print(student_list)
:param student_list: a list of students in any given class :return: a student to be called on
625941f615baa723493c45da
def get_form_kwargs(self): <NEW_LINE> <INDENT> kwargs = super().get_form_kwargs() <NEW_LINE> kwargs["requests"] = self.requests <NEW_LINE> kwargs["priorities"] = self.priorities <NEW_LINE> return kwargs
Pass number request and priorities to form.
625941f6a05bb46b383ece7b
def verify_sector_page(self, sector_header): <NEW_LINE> <INDENT> sector_header = sector_header + ' jobs' <NEW_LINE> pstr_header = self.sector_locator.pstr_sector_head.format(sector_header) <NEW_LINE> bln_page_header = self.ui_helper.is_element_displayed(pstr_header) <NEW_LINE> if bln_page_header: <NEW_LINE> <INDENT> se...
Description: | This method will verify header of the sector page :param sector_header: Name of the sector :type sector_header: String :return: boolean
625941f6dd821e528d63b803
def cmd_analog_in(Ano, pin): <NEW_LINE> <INDENT> cmd = "" <NEW_LINE> a = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "A", "B", "C", "D"] <NEW_LINE> cmd = "A" + a[pin] <NEW_LINE> ser.write(cmd) <NEW_LINE> a = ser.read() <NEW_LINE> return (int((1023-0)*int(ord(a))/(255-0)))
Function Name: cmd_analog_in(Ano, pin) Input Args: Ano, pin no
625941f67d43ff24873a3306
def _pool_wrapper(argument_list): <NEW_LINE> <INDENT> return feature.process(*argument_list)
Wrapper function to unpack arguments before calling the real function. Args: argument_list: A list of tuples of arguments to be provided to "feature.process" function Returns: Nothing
625941f621bff66bcd684fac
def get_channel_name(self, group, index): <NEW_LINE> <INDENT> gp_nr, ch_nr = self._validate_channel_selection(None, group, index) <NEW_LINE> grp = self.groups[gp_nr] <NEW_LINE> if grp.data_location == v23c.LOCATION_ORIGINAL_FILE: <NEW_LINE> <INDENT> stream = self._file <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> stre...
Gets channel name. Parameters ---------- group : int 0-based group index index : int 0-based channel index Returns ------- name : str found channel name
625941f676d4e153a657f192
def set_data(self, data_list): <NEW_LINE> <INDENT> if self._count_data != 0: <NEW_LINE> <INDENT> self.clear() <NEW_LINE> <DEDENT> self._data = None <NEW_LINE> self._begin_win = 0 <NEW_LINE> self._current_position, self._count_data, self._select_positon = 0, 0, -1 <NEW_LINE> if data_list is None: <NEW_LINE> <INDENT> ret...
установка данных
625941f69c8ee82313fbbdd8
def read_data(filename="sample_data.csv"): <NEW_LINE> <INDENT> with open(filename, 'r') as f: <NEW_LINE> <INDENT> raw_data = [i.split(",") for i in f.read().split("\n")] <NEW_LINE> bssid = raw_data[0][1:] <NEW_LINE> data = np.array([[float(j) for j in i] for i in raw_data[1:]]) <NEW_LINE> return bssid, data[:,0], data[...
return bssid, point_name, point_loc
625941f6099cdd3c635f12b8
def normalize_blocks_with_unitary_timing(tree): <NEW_LINE> <INDENT> visitor = UnitaryBlockRewriteVisitor() <NEW_LINE> new_tree = visitor.visit(tree) <NEW_LINE> return new_tree
Simplify all gate blocks under the assumption that all gates take the same amount of time. All blocks are transformed into sequential blocks of parallel blocks. No parallel blocks have nested blocks. This step assumes macro expansion has already occurred. Loops are allowed but must be at top level.
625941f67c178a314d6efacb
@register.filter <NEW_LINE> @stringfilter <NEW_LINE> def plusify(value): <NEW_LINE> <INDENT> plusified = value.replace(" ", "+").replace("%20", "+").replace("%2B", "+") <NEW_LINE> return plusified
Replace a string's space (" "/"%20") or encoded plus ("%2B") with a plus sign ("+") for use in Google Maps. Use {{ obj.address|urlencode|plusify }}
625941f63c8af77a43ae3e08
def initialize_operator(self, operator=None, matrix=False, eval_at_once=False): <NEW_LINE> <INDENT> if operator is None: <NEW_LINE> <INDENT> self._operator = lambda nodes, dummy, entry=None: ones((1,nodes.shape[1])) if entry[0] == entry[1] else zeros((1,nodes.shape[1])) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rai...
Provide the operator part of the inner product to evaluate. This function initializes the operator used for quadratures and for building matrices. .. note:: The symbolic Gaussian integral formula can not handle operators at all. :param operator: The operator of the inner product. If ``None`...
625941f6aad79263cf3910ab
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
625941f6fff4ab517eb2faa1
def describe(self): <NEW_LINE> <INDENT> print() <NEW_LINE> print(self.name + " is here!") <NEW_LINE> print(self.description) <NEW_LINE> print()
this method returns the instance description
625941f6b830903b967e9f63
def __init__(self, querystring, executor, resultset=True, info_cb=None, *args, **kwargs): <NEW_LINE> <INDENT> super(SDSQLDatabaseTask,self).__init__(info_cb=info_cb, **kwargs) <NEW_LINE> if not querystring or len(querystring) == 0: <NEW_LINE> <INDENT> raise SDTaskException("No query string has been passed.") <NEW_LINE...
:param querytype: resultset or not :param executor: The function that will be called for this task :param info_cb: this is the callback for logging
625941f66e29344779a62c72
def make_sub_images(df, header_text=None): <NEW_LINE> <INDENT> log.debug("df len is {}".format(len(df))) <NEW_LINE> def init_page(df, header_text=header_text): <NEW_LINE> <INDENT> log.debug("df len is {}".format(len(df))) <NEW_LINE> pad_w = math.floor(W_PADDING * POSTER_WIDTH) <NEW_LINE> next_x = pad_w <NEW_LINE> next_...
return sub image(s) that may or may not be combined into a large image. ex., all 5 star movies are made here, and may be joined with a sub-image of all the 4-star movies. `header_txt`: A label drawn above the image. Blank space is added above the image if header_text exists.
625941f6e5267d203edce2f5
def length_column_vector(a): <NEW_LINE> <INDENT> return ( scipy.sqrt( a[0,0] * a[0,0] + a[1,0] * a[1,0] + a[2,0] * a[2,0] ) )
Compute length of column vector with 3 rows @param a: column vector @type a: scipy array(3,1) @return: length column vector sample: >>> a = scipy.array([-3.0, 0.0, 4.0]) >>> a = scipy.reshape(a,(3,1)) >>> a array([[-3.], [ 0.], [ 4.]]) >>> length_column_vector(a) 5.0
625941f6d6c5a102081446b0
def fourSum(self, nums, target): <NEW_LINE> <INDENT> if len(nums) < 4: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> nums.sort() <NEW_LINE> result = [] <NEW_LINE> n = len(nums) <NEW_LINE> for i in range(n - 3): <NEW_LINE> <INDENT> for j in range(i + 1, n - 2): <NEW_LINE> <INDENT> pairs = self.twoSum(nums, j, target...
:type nums: List[int] :type target: int :rtype: List[List[int]]
625941f694891a1f4081c10d
def linePrint(data, max_len): <NEW_LINE> <INDENT> _domain = " "*max_len if not data["domain"] else data["domain"] <NEW_LINE> if len(data.keys()) == 4: <NEW_LINE> <INDENT> spaceIp = " " * (16 - len(data["ipaddr"][0])) <NEW_LINE> spaceSub = " " * ((max_len + 1) - len(data["target"])) <NEW_LINE> _target = Style.BRIGHT + F...
123.123.123.123 click.domain.com click.virt.s6.exactdomain.com
625941f6ab23a570cc2507e9
def __init__(self, room, speed): <NEW_LINE> <INDENT> self.room = room <NEW_LINE> self.speed = speed <NEW_LINE> rand_pos = room.getRandomPosition() <NEW_LINE> while not room.isPositionInRoom(rand_pos): <NEW_LINE> <INDENT> rand_pos = room.getRandomPosition() <NEW_LINE> <DEDENT> self.room.cleanTileAtPosition(rand_pos) <NE...
Initializes a Robot with the given speed in the specified room. The robot initially has a random direction and a random position in the room. The robot cleans the tile it is on. room: a RectangularRoom object. speed: a float (speed > 0)
625941f6c4546d3d9de7309b
def __init__(self, device_name, printer_class=None, baudrate=9600, printer=None, delay=5): <NEW_LINE> <INDENT> if not printer and not printer_class: <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> gobject.GObject.__init__(self) <NEW_LINE> self._reply = '' <NEW_LINE> self._device_name = device_name <NEW_LINE> se...
@param device_name: @param printer_class: @param delay:
625941f6a79ad161976cc7a6
def test_view_rename_get(self): <NEW_LINE> <INDENT> url = "/cluster/%s/%s/rename/" <NEW_LINE> args = (cluster.slug, vm.hostname) <NEW_LINE> template = 'ganeti/virtual_machine/rename.html' <NEW_LINE> users =[superuser, cluster_admin, vm_admin, vm_modify] <NEW_LINE> denied = [cluster_migrate] <NEW_LINE> self.assert_stand...
VM rename GET requests should have the standard responses.
625941f6cad5886f8bd27638
def create_classify_table(self, key, mask, data_offset=0, is_add=1): <NEW_LINE> <INDENT> r = self.vapi.classify_add_del_table( is_add, binascii.unhexlify(mask), match_n_vectors=(len(mask) - 1) // 32 + 1, miss_next_index=0, current_data_flag=1, current_data_offset=data_offset) <NEW_LINE> self.assertIsNotNone(r, msg='No ...
Create Classify Table :param str key: key for classify table (ex, ACL name). :param str mask: mask value for interested traffic. :param int match_n_vectors: :param int is_add: option to configure classify table. - create(1) or delete(0)
625941f623e79379d52eebbb
def read_data(self): <NEW_LINE> <INDENT> with sock_lock: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> raw_msglen = self.recvall(4) <NEW_LINE> if not raw_msglen: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> msglen = struct.unpack('>I', raw_msglen)[0] <NEW_LINE> data = self.recvall(msglen) <NEW_LINE> <DEDENT> except OS...
Прием сообщения.
625941f615fb5d323cde117a
def execute_on_traces(self, traces): <NEW_LINE> <INDENT> self.ensure_one() <NEW_LINE> new_traces = self.env['marketing.trace'] <NEW_LINE> if self.validity_duration: <NEW_LINE> <INDENT> duration = relativedelta(**{self.validity_duration_type: self.validity_duration_number}) <NEW_LINE> invalid_traces = traces.filtered( l...
Execute current activity on given traces. :param traces: record set of traces on which the activity should run
625941f6596a89723608a118
def _getdata(): <NEW_LINE> <INDENT> LOG.warning('Downloading and processing Neurosynth database.') <NEW_LINE> os.makedirs('data', exist_ok=True) <NEW_LINE> from neurosynth.base.dataset import download <NEW_LINE> download(path='data', unpack=True) <NEW_LINE> data = Dataset('data/database.txt') <NEW_LINE> data.add_featur...
Downloads data from neurosynth and returns it as a Dataset. Also pickles the dataset for future use.
625941f6091ae356686675b4
def test03(self): <NEW_LINE> <INDENT> body = self.doc.addObject("PartDesign::Body", "Body") <NEW_LINE> sketch = self.doc.addObject("Sketcher::SketchObject", "Sketch") <NEW_LINE> body.addObject(sketch) <NEW_LINE> TestSketcherApp.CreateSlotPlateSet(sketch) <NEW_LINE> self.doc.recompute() <NEW_LINE> pad = self.doc.addObje...
Check that isValidBaseObject ignores sketches.
625941f626238365f5f0f4d7
def getValues(self, fx, address, count=1): <NEW_LINE> <INDENT> _logger.debug("get values[%d] %d:%d" % (fx, address, count)) <NEW_LINE> result = self.__get_callbacks[self.decode(fx)](address, count) <NEW_LINE> return self.__extract_result(self.decode(fx), result)
Get `count` values from datastore :param fx: The function we are working with :param address: The starting address :param count: The number of values to retrieve :returns: The requested values from a:a+c
625941f6e64d504609d74ea0
def create_test_conversation(members): <NEW_LINE> <INDENT> conversation = ConversationFactory.create( name = 'twitter', members = members ) <NEW_LINE> message = ConversationMessageFactory( body = u'Just a test message with german umlaute üäöß', sent_by = members[0], conversation=conversation ) <NEW_LINE> return message...
Creating a test conversation with anything necessary
625941f676d4e153a657f193
def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.initWidget()
Initialise setup of widget.
625941f63346ee7daa2b33d3
def setSignallevel(self, siglevel): <NEW_LINE> <INDENT> self.siglevel = siglevel
Sets signal level.
625941f676e4537e8c351cd9
def call(self, x, mask=None): <NEW_LINE> <INDENT> atom_features = x[0] <NEW_LINE> membership = x[2] <NEW_LINE> mol_features = graph_gather(atom_features, membership, self.batch_size) <NEW_LINE> return self.activation(mol_features)
Execute this layer on input tensors. This layer is meant to be executed on a Graph. So x is expected to be a list of placeholders, with the first placeholder the list of atom_features (learned or input) at this level, the second the deg_slice, the third the membership, and the remaining the deg_adj_lists. Visually x...
625941f6aad79263cf3910ac
def pool_max(inputs, ksize, stride, padding, data_format="NHWC"): <NEW_LINE> <INDENT> if data_format == "NHWC": <NEW_LINE> <INDENT> ksizes = [1, ksize, ksize, 1] <NEW_LINE> strides = [1, stride, stride, 1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ksizes = [1, 1, ksize, ksize] <NEW_LINE> strides = [1, 1, stride, st...
max pooling, NHWC
625941f67d847024c06be922
def test_new(self): <NEW_LINE> <INDENT> environ = {'REMOTE_USER': 'test_admin'} <NEW_LINE> response = self.app.get('/tag/new', extra_environ=environ, status=200) <NEW_LINE> eq_(response.html.form['action'], u'/tag/') <NEW_LINE> eq_(response.html.form['method'], u'post') <NEW_LINE> assert_true(response.html.find('select...
controllers.tag.Controller.new is working properly
625941f69f2886367277aee8
@app.route("/sell", methods=["GET", "POST"]) <NEW_LINE> @login_required <NEW_LINE> def sell(): <NEW_LINE> <INDENT> price="" <NEW_LINE> name="" <NEW_LINE> symbol="" <NEW_LINE> userCash="" <NEW_LINE> shares="" <NEW_LINE> success=False <NEW_LINE> portfolio=db.execute("SELECT * FROM purchase WHERE owner_id=:owner_id",owner...
Sell shares of stock
625941f64e696a04525c9aaf
def date_en_francais( date ): <NEW_LINE> <INDENT> if isinstance( date, datetime.date ): <NEW_LINE> <INDENT> date_fr = '{} {} {}'.format(date.day, MOIS2[int(date.month)], date.year) <NEW_LINE> if date.day == 1: <NEW_LINE> <INDENT> date_fr = '1er {} {}'.format(MOIS2[int(date.month)], date.year) <NEW_LINE> <DEDENT> return...
Retourne la date écrite en français. :param date: (datetime.date|datetime.datetime) Objet date. :returns: (str)
625941f6442bda511e8bea6f
def get_start_datetime(): <NEW_LINE> <INDENT> pass
Returns start_datetime
625941f61f5feb6acb0c51aa
def play(strategy0, strategy1, score0=0, score1=0, dice=six_sided, goal=GOAL_SCORE, say=silence): <NEW_LINE> <INDENT> player = 0 <NEW_LINE> while score0 < goal and score1 < goal: <NEW_LINE> <INDENT> if player == 0: <NEW_LINE> <INDENT> score0 += take_turn(strategy0(score0, score1), score1, dice) <NEW_LINE> <DEDENT> else...
Simulate a game and return the final scores of both players, with Player 0's score first, and Player 1's score second. A strategy is a function that takes two total scores as arguments (the current player's score, and the opponent's score), and returns a number of dice that the current player will roll this turn. str...
625941f6ec188e330fd5adf1
def get_row(self, grid, pos): <NEW_LINE> <INDENT> ri, ci = pos <NEW_LINE> return grid[ri]
It is a private method to get the row
625941f682261d6c526abb0a
def test_calibration(self): <NEW_LINE> <INDENT> pdx = PlantDetection() <NEW_LINE> pdx.params.parameters['H'] = [160, 20] <NEW_LINE> pdx.params.save() <NEW_LINE> pd = PlantDetection(calibration_img="plant_detection/p2c_test_calibration.jpg", from_file=True, text_output=False, save=False, debug=True) <NEW_LINE> pd.calibr...
Load calibration input from file
625941f68e71fb1e9831de07
def backpropagation(self, reward: int, move_sequence: dict): <NEW_LINE> <INDENT> self.root["reward"] += reward <NEW_LINE> self.root["visits"] += 1 <NEW_LINE> current_node = self.root <NEW_LINE> all_actions = move_sequence["actions"] <NEW_LINE> while len(all_actions) > 0: <NEW_LINE> <INDENT> selected_action = all_action...
Updates information (reward, visits) in the tree nodes corresponding to selected move sequence. Args: reward: reward for certain move sequence move_sequence: keys are states & actions, values are lists of states & actions from exploration phase
625941f68c3a873295158a24
def search(self,keyword) : <NEW_LINE> <INDENT> begin = "# BEGIN " <NEW_LINE> end = "# END " <NEW_LINE> self.begin = self.input.find(begin+keyword) <NEW_LINE> if self.begin == -1 : <NEW_LINE> <INDENT> utils.abort("Cannot find "+begin+keyword) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> self.begin += len(begin+keyword...
Search for the given keyword. The beginning and the end of the interesting section are saved in self.begin and self.end.
625941f626238365f5f0f4d8
def set_likelihoods_map(self, likelihoods_map): <NEW_LINE> <INDENT> if not hasattr(self, "_likelihoods"): <NEW_LINE> <INDENT> self._likelihoods = {} <NEW_LINE> <DEDENT> for item in likelihoods_map.items(): <NEW_LINE> <INDENT> self._likelihoods[item[0]] = self.__likelihoods_map_to_list(self.__validate_likelihoods(item[0...
Set all likelihoods, based on the provided mapping. likelihoods_map should be a dictionary whose keys are the labels for each group of methods, and whose values should be a dictionary whose keys are the method names in question, and whose values should be equal to the chance of that method being selected, as an integer...
625941f63617ad0b5ed68557
def get_range(chr, bp1, ref, alt): <NEW_LINE> <INDENT> start = get_single_location(chr, bp1) <NEW_LINE> if len(ref) == len(alt): <NEW_LINE> <INDENT> end = start <NEW_LINE> <DEDENT> elif len(ref) > len(alt): <NEW_LINE> <INDENT> end = start + len(ref) - len(alt) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> end = start -...
Get (start, end) tuple in single location format
625941f623849d37ff7b36eb
def get_dialect(self): <NEW_LINE> <INDENT> return self.dialect
! @brief Get dialect. @return FormRepresentation attribute 'dialect'.
625941f66aa9bd52df037409
def _is_pytz_zone(tz): <NEW_LINE> <INDENT> return isinstance(tz, _PYTZ_BASE_CLASSES)
Checks if a zone is a pytz zone.
625941f673bcbd0ca4b2c6d7
def GetHeaderGuardCPPVariable(filename): <NEW_LINE> <INDENT> filename = re.sub(r'_flymake\.h$', '.h', filename) <NEW_LINE> filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename) <NEW_LINE> filename = filename.replace('C++', 'cpp').replace('c++', 'cpp') <NEW_LINE> fileinfo = FileInfo(filename) <NEW_LINE> file_path_...
Returns the CPP variable that should be used as a header guard. Args: filename: The name of a C++ header file. Returns: The CPP variable that should be used as a header guard in the named file.
625941f61d351010ab85617b
def build_successors_table(tokens): <NEW_LINE> <INDENT> table = {} <NEW_LINE> prev = '.' <NEW_LINE> for word in tokens: <NEW_LINE> <INDENT> if prev not in table: <NEW_LINE> <INDENT> table[prev] = [] <NEW_LINE> <DEDENT> "*** YOUR CODE HERE ***" <NEW_LINE> table[prev].append(word) <NEW_LINE> prev = word <NEW_LINE> <DEDEN...
Return a dictionary: keys are words; values are lists of successors. >>> text = ['We', 'came', 'to', 'investigate', ',', 'catch', 'bad', 'guys', 'and', 'to', 'eat', 'pie', '.'] >>> table = build_successors_table(text) >>> sorted(table) [',', '.', 'We', 'and', 'bad', 'came', 'catch', 'eat', 'guys', 'investigate', 'pie'...
625941f6cc40096d61595fae
def test_too_long(self): <NEW_LINE> <INDENT> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> Weblate().get_object("a/b/c/d")
Test listing projects.
625941f67b180e01f3dc4e50
def __init__(self, sock, host, port, method, url, data, callback, timeout=5): <NEW_LINE> <INDENT> self.sock = sock <NEW_LINE> self.callback = callback <NEW_LINE> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self.method = method <NEW_LINE> self.url = url <NEW_LINE> self.data = data <NEW_LINE> self.timeout = t...
sock: 请求的客户端socket对象 host: 请求的主机名 port: 请求的端口 port: 请求的端口 method: 请求方式 url: 请求的URL data: 请求时请求体中的数据 callback: 请求完成后的回调函数 timeout: 请求的超时时间
625941f60fa83653e4657618
def maybe_download(filename, work_directory): <NEW_LINE> <INDENT> if not os.path.exists(work_directory): <NEW_LINE> <INDENT> os.mkdir(work_directory) <NEW_LINE> <DEDENT> filepath = os.path.join(work_directory, filename) <NEW_LINE> if not os.path.exists(filepath): <NEW_LINE> <INDENT> with urllib.request.urlopen(SOURCE_U...
Download the data from Yann's website, unless it's already here.
625941f629b78933be1e5d05
def create_pooling_block(n_channels: int) -> nn.Sequential: <NEW_LINE> <INDENT> return nn.Sequential( nn.Conv2d(n_channels, n_channels, 3, padding=1), nn.MaxPool2d(5, stride=1, padding=2) )
Constructs a pooling block for use in Chained Residual Pooling. We use the improved architecture described in the IEEE paper, with the conv layer before the max-pool layer. :param n_channels: the number of channels in the input and output tensors :return: the constructed pooling block
625941f601c39578d7e7549c
def parse_line(self, line): <NEW_LINE> <INDENT> super().parse_line(line) <NEW_LINE> self.id_code = line[7:11].strip() <NEW_LINE> self.chain_id = line[12].strip() <NEW_LINE> self.seq_begin = int(line[14:18]) <NEW_LINE> self.ins_begin = line[18].strip() <NEW_LINE> self.seq_end = int(line[20:24]) <NEW_LINE> self.ins_end =...
Parse DBREF line. :param str line: line to parse
625941f6293b9510aa2c38f1
def add(self, stat, timestamp, text): <NEW_LINE> <INDENT> pix = utils.safe_gtk_pixbuf_load(gui.theme.image_theme.status_icons[stat]) <NEW_LINE> date_text = time.strftime('%c', time.localtime(timestamp)) <NEW_LINE> self.model.append((pix, date_text, text))
add a row to the widget
625941f6be383301e01b5ada
def ModifyAccountPrivilege(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("ModifyAccountPrivilege", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.ModifyAccountPr...
This API is used to modify instance account permissions. :param request: Request instance for ModifyAccountPrivilege. :type request: :class:`tencentcloud.sqlserver.v20180328.models.ModifyAccountPrivilegeRequest` :rtype: :class:`tencentcloud.sqlserver.v20180328.models.ModifyAccountPrivilegeResponse`
625941f63d592f4c4ed1d6bc
def on_request(event): <NEW_LINE> <INDENT> event.request.session = Session(event.request)
Decorate request with session @param event: @return:
625941f60a50d4780f6674f9
@sync_performer <NEW_LINE> def perform_func(dispatcher, intent): <NEW_LINE> <INDENT> return intent.func()
Performer for :class:`Func`.
625941f630bbd722463cc42b
def transform(self, X): <NEW_LINE> <INDENT> check_is_fitted(self, 'fills_') <NEW_LINE> X, _ = validate_is_pd(X, self.cols) <NEW_LINE> cols = self.cols if self.cols is not None else X.columns.values <NEW_LINE> modes = self.fills_ <NEW_LINE> if isinstance(modes, int): <NEW_LINE> <INDENT> X[cols] = X[cols].fillna(modes) <...
Transform a dataframe given the fit imputer. Parameters ---------- X : Pandas ``DataFrame``, shape=(n_samples, n_features) The Pandas frame to transform. Returns ------- X : pd.DataFrame or np.ndarray The imputed matrix
625941f6adb09d7d5db6cded
def visit_infix5(self, ctx): <NEW_LINE> <INDENT> return self.visit_expr_core(ctx.expr_infix5().expr_core())
Expression infix5.
625941f6d53ae8145f87a8c3
def test_create_non_protected_prop(self): <NEW_LINE> <INDENT> self.set_property_protections() <NEW_LINE> request = unit_test_utils.get_fake_request(roles=['admin']) <NEW_LINE> image = {'name': 'image-1'} <NEW_LINE> extra_props = {'x_all_permitted_1': '1'} <NEW_LINE> created_image = self.controller.create(request, image...
Verify property marked with special char '@' is creatable by an unknown role
625941f6cc40096d61595faf
def PretrainedWord2Vec(corpus,embedding_model='text8_emb'): <NEW_LINE> <INDENT> _vec = [] <NEW_LINE> for row in corpus: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> sentence_split = word_tokenize(str(row)) <NEW_LINE> sentence_embedding = vs.query(sentence_split, embedding_model).mean().values <NEW_LINE> _vec.append(sen...
Convert documents to vector using pretraining embedding models
625941f6e5267d203edce2f6
def query_op_traceback(self, op_name): <NEW_LINE> <INDENT> for op_log_proto in self._graph_tracebacks: <NEW_LINE> <INDENT> for log_entry in op_log_proto.log_entries: <NEW_LINE> <INDENT> if log_entry.name == op_name: <NEW_LINE> <INDENT> return self._code_def_to_traceback(log_entry.code_def, op_log_proto.id_to_string) <N...
Query the traceback of an op. Args: op_name: Name of the op to query. Returns: The traceback of the op, as a list of 3-tuples: (filename, lineno, function_name) Raises: ValueError: If the op cannot be found in the tracebacks received by the server so far.
625941f6187af65679ca5782
def edit_entry(request, entry_id): <NEW_LINE> <INDENT> entry = Entry.objects.get(id=entry_id) <NEW_LINE> topic = entry.topic <NEW_LINE> if topic.owner != request.user: <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> if request.method != 'POST': <NEW_LINE> <INDENT> form = EntryForm(instance=entry) <NEW_LINE> <DEDE...
Edit an existing entry.
625941f6925a0f43d254a4df
def get_ref_count(self): <NEW_LINE> <INDENT> return deuce.metadata_driver.get_block_ref_count( self.vault_id, self.metadata_block_id)
Returns the number of references to this block
625941f68da39b475bd655de
def getTimeMS(): <NEW_LINE> <INDENT> dt = datetime.datetime.now() <NEW_LINE> return dt.microsecond + (dt.second * 1000000) + (dt.minute * 1000000 * 60) + (dt.hour * 1000000 * 60 * 60)
Function for timing the code to run
625941f630bbd722463cc42c
def _get_ee_pos(self): <NEW_LINE> <INDENT> from_frame = '/base_link' <NEW_LINE> to_frame = '/wrist_roll_link' <NEW_LINE> try: <NEW_LINE> <INDENT> t = self._tf_listener.getLatestCommonTime(from_frame, to_frame) <NEW_LINE> (position, rotation) = self._tf_listener.lookupTransform( from_frame, to_frame, t) <NEW_LINE> <DEDE...
Get 3DOF pose of end effector Returns: Point: location of wrist of end effector (could change to be finger tips)
625941f6c432627299f052ac
def palette(self, label_im): <NEW_LINE> <INDENT> if label_im.ndim == 3: <NEW_LINE> <INDENT> label_im = label_im[0] <NEW_LINE> <DEDENT> label = Image.fromarray(label_im, mode='P') <NEW_LINE> label.palette = copy.copy(self.palette) <NEW_LINE> return label
Transfer the PRAGUEdata color palette to an output mask for visualization.
625941f6097d151d1a2234b7
def monitor(url): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> answer = requests.get(url) <NEW_LINE> return True, answer.status_code, answer.elapsed.total_seconds() <NEW_LINE> <DEDENT> except requests.exceptions.Timeout: <NEW_LINE> <INDENT> return False, -1, -1
This function is doing the monitoring. It will query the url specified in parameter and return a tuple indicating if the site is online, the status code and the response time In case the site is down we will return False, -1, -1 :param url: url to query :type url: string :return A tuple like (is online?, status code...
625941f6c432627299f052ad
def run_episode(agent, env, max_steps): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> t = 0 <NEW_LINE> env.reset() <NEW_LINE> s = env.state <NEW_LINE> while not env.is_terminal() and t < max_steps: <NEW_LINE> <INDENT> actions = env.actions <NEW_LINE> a = agent.choose(s, actions) <NEW_LINE> r, sp = env.do(a) <NEW_LINE> agent....
Run an episode in a policy evaluation experiment.
625941f64d74a7450ccd4827
def format_response(self,raw_response): <NEW_LINE> <INDENT> date_pattern = "" <NEW_LINE> date_pattern += r"[\d]{2,2}:[\d]{1,2}:[\d]{1,2}" <NEW_LINE> date_pattern += r"[\s]*,[\s]*" <NEW_LINE> date_pattern += r"[\d]{2,2}:[\d]{1,2}:[\d]{1,2}" <NEW_LINE> adj_response = re.findall(date_pattern,raw_response) <NEW_LINE> resul...
DateRangeInput.format_response(raw_response) -> list Method returns a list of len-2 (a,b) lists. Method expects raw response in "[HH:MM:SS, HH:MM:SS],[HH:MM:SS, HH:MM:SS] ..." format; method is indifferent to the type of bracket and whitespace separators.
625941f6e76e3b2f99f3ae62
def csv_extract(file, directory, header=None): <NEW_LINE> <INDENT> initial_dir = os.getcwd() <NEW_LINE> os.chdir(directory) <NEW_LINE> with open(file, newline='') as csvfile: <NEW_LINE> <INDENT> reader = csv.DictReader(csvfile, fieldnames=header) <NEW_LINE> for row in reader: <NEW_LINE> <INDENT> new_key = row[header[0]...
Converts a given CSV file into a pandas dataframe. :param file: Name of the CSV file :param directory: Name of the directory containing the CSV file :param header: Sequence containing all columns from the CSV to be included in the output. If None, the CSV's first line will be used. :return: pandas dataframe
625941f694891a1f4081c10e
def get_project(self, name): <NEW_LINE> <INDENT> if self._cache is None: <NEW_LINE> <INDENT> result = self._get_project(name) <NEW_LINE> <DEDENT> elif name in self._cache: <NEW_LINE> <INDENT> result = self._cache[name] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result = self._get_project(name) <NEW_LINE> self._cache...
For a given project, get a dictionary mapping available versions to Distribution instances. This calls _get_project to do all the work, and just implements a caching layer on top.
625941f67d43ff24873a3307
@pytest.fixture() <NEW_LINE> def gui_window(): <NEW_LINE> <INDENT> app = UBitToolWindow() <NEW_LINE> app.wait_visibility() <NEW_LINE> yield app <NEW_LINE> if app: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> app.winfo_exists() <NEW_LINE> <DEDENT> except tkinter.TclError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> els...
Fixture to create and destroy GUI window.
625941f6d8ef3951e3243b9f
def is_empty(self): <NEW_LINE> <INDENT> return self.__list == []
队列是否为空
625941f63346ee7daa2b33d4
def __init__(self): <NEW_LINE> <INDENT> self.config = None
Constructor
625941f6d7e4931a7ee9e582
def test_saveload_array(): <NEW_LINE> <INDENT> a = array([1, Inf]) <NEW_LINE> b = [Inf, 0] <NEW_LINE> saveObjects([a, b], 'temp_objects.pkl', True) <NEW_LINE> loadedObjs = loadObjects('temp_objects.pkl') <NEW_LINE> assert a[0] == loadedObjs[0][0] <NEW_LINE> assert a[1] == loadedObjs[0][1] <NEW_LINE> assert b[0] == load...
Test pickling for saving and loading array
625941f6377c676e91272808
def pathInZigZagTree( label): <NEW_LINE> <INDENT> pass
:type label: int :rtype: List[int]
625941f666673b3332b926f3