code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def _recv_from_client(self): <NEW_LINE> <INDENT> command = self._client.recv_from_client() <NEW_LINE> if isinstance(command, MLClientExecutionError): <NEW_LINE> <INDENT> raise command <NEW_LINE> <DEDENT> return command | Receive the command sent from the client | 625941ed99fddb7c1c9de8c0 |
def iter_parts(message, numbers=[]): <NEW_LINE> <INDENT> if message.is_multipart(): <NEW_LINE> <INDENT> for n, part in enumerate(message.get_payload(), 1): <NEW_LINE> <INDENT> yield from iter_parts(part, numbers + [str(n)]) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> yield '.'.join(numbers), message | Yields multipart messages into identifiable parts.
The numbers are the positions in each part of the tree. | 625941ed0fa83653e46574e9 |
def create_antivirus_server(self, antivirus_server, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.create_antivirus_server_with_http_info(antivirus_server, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self... | create_antivirus_server # noqa: E501
Create new antivirus servers. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_antivirus_server(antivirus_server, async_req=True)
>>> result = thread.get()
:param async_... | 625941ed67a9b606de4a83e8 |
def validatePage(self): <NEW_LINE> <INDENT> t = self._edit.text().strip() <NEW_LINE> profile = self.wizard().profile() <NEW_LINE> profile.clear() <NEW_LINE> profile.path = t <NEW_LINE> return bool(t) | @reimp @public | 625941ed287bf620b61d3f92 |
def interp_like(self, other, maintain_m0=True): <NEW_LINE> <INDENT> freq = getattr(other.spec, attrs.FREQNAME) <NEW_LINE> dir = getattr(other.spec, attrs.DIRNAME) <NEW_LINE> return self.interp(freq=freq, dir=dir, maintain_m0=maintain_m0) | Interpolate onto coordinates from other spectra.
Args:
- other (Dataset, DataArray): Spectra defining new spectral basis.
- maintain_m0 (bool): Ensure variance is conserved in interpolated spectra.
Returns:
- dsi (DataArray): Regridded spectra. | 625941ed379a373c97cfb078 |
def model_base(bind_label=None, info=None): <NEW_LINE> <INDENT> Model = type('Model', (BaseModel,), {'__odm_abstract__': True}) <NEW_LINE> info = {} <NEW_LINE> Model.__table_args__ = table_args(info=info) <NEW_LINE> if bind_label: <NEW_LINE> <INDENT> info['bind_label'] = bind_label <NEW_LINE> <DEDENT> return Model | Create a base declarative class
| 625941ed046cf37aa974d274 |
def id_limit(self): <NEW_LINE> <INDENT> if OrderList.order_list == []: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return OrderList.order_list[-1]['orderid'] | This function checks for the ID limit to prevent user input from going beyond | 625941ed3cc13d1c6d3c78a9 |
def test(): <NEW_LINE> <INDENT> from PyQt4 import QtCore <NEW_LINE> import sys <NEW_LINE> def print_log(event): <NEW_LINE> <INDENT> log = event.dict_['data'] <NEW_LINE> print(':'.join([log.logTime, log.logContent])) <NEW_LINE> <DEDENT> app = QtCore.QCoreApplication(sys.argv) <NEW_LINE> eventEngine = EventEngine() <NEW_... | 测试 | 625941ed5fc7496912cc3eaf |
def __init__(self, filename, mode='r'): <NEW_LINE> <INDENT> self.isopen = False <NEW_LINE> if mode in _nxopen_mode: mode = _nxopen_mode[mode] <NEW_LINE> if mode not in _nxopen_mode.values(): <NEW_LINE> <INDENT> raise ValueError("Invalid open mode %s" % str(mode)) <NEW_LINE> <DEDENT> self.filename, self.mode = filename,... | Open the NeXus file returning a handle.
mode can be one of the following:
nxs.ACC_READ 'r' open a file read-only
nxs.ACC_RDWR 'rw' open a file read/write
nxs.ACC_CREATE 'w' open a file write
nxs.ACC_CREATE4 'w4' open a Nexus file with HDF4
nxs.ACC_CREATE5 'w5' open... | 625941eddd821e528d63b6d6 |
def test_get_diff_res_types_resolved(self): <NEW_LINE> <INDENT> base_run_id = self._base_runid <NEW_LINE> new_run_id = self._new_runid <NEW_LINE> cmp_data = CompareData(runIds=[new_run_id], diffType=DiffType.RESOLVED) <NEW_LINE> diff_res = self._cc_client.getCheckerCounts([base_run_id], None, cmp_data, None, 0) <NEW_LI... | Test diff result types for resolved results. | 625941ed442bda511e8be942 |
def deprecated(dies_at): <NEW_LINE> <INDENT> def decorator(view): <NEW_LINE> <INDENT> @wraps(view) <NEW_LINE> def func(*args, **kwargs): <NEW_LINE> <INDENT> message = "Calling deprecated view '%s'. Dies in %s." <NEW_LINE> time_left = dies_at - datetime.utcnow() <NEW_LINE> if time_left < timedelta(days=7): <NEW_LINE> <I... | Mark a flask view as deprecated
Usage:
@deprecated(dies_at=datetime(2015, 8, 1)) | 625941ed01c39578d7e7536d |
def get_name(self): <NEW_LINE> <INDENT> pass | Get student's name in Lastname, Firstname format. | 625941ed6e29344779a62b42 |
def longestCommonPrefix(self, strs): <NEW_LINE> <INDENT> if not strs: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> strs = list(set(strs)) <NEW_LINE> shortest = min(strs, key=len) <NEW_LINE> for x, y in enumerate(shortest): <NEW_LINE> <INDENT> for s in strs: <NEW_LINE> <INDENT> if s[x] != y: <NEW_LINE> <INDENT> ret... | :type strs: List[str]
:rtype: str | 625941ed3d592f4c4ed1d591 |
def itermap(func, initial, n_steps=None, stop_func = None, include_zeroth = False): <NEW_LINE> <INDENT> assert (n_steps is not None) or (stop_func is not None), 'You must either specify a number of steps or a stopping function.' <NEW_LINE> val = initial <NEW_LINE> results = [val] if include_zeroth else [] <NEW_LINE> fo... | Iterively call a function with the output of the previous call.
:param func: A function of the form x_i_plus_1 = f(x_i)
:param n_steps: The number of times to iterate
:param initial: An initial value
:param stop_func: Optionally, a function returning a boolean that, if true, causes the iteration to terminate (after the... | 625941ed50812a4eaa59c84e |
def test_add_member(self): <NEW_LINE> <INDENT> req = webob.Request.blank('/images/%s/members/pattieblack' % UUID2) <NEW_LINE> req.method = 'PUT' <NEW_LINE> res = req.get_response(self.api) <NEW_LINE> self.assertEquals(res.status_int, webob.exc.HTTPUnauthorized.code) | Tests adding image members raises right exception | 625941edd268445f265b53a1 |
def registerPlayer(name, tournament=1, tournament_name="Tournament 1"): <NEW_LINE> <INDENT> if tournamentExists(tournament) == False: <NEW_LINE> <INDENT> createTournament(tournament, tournament_name) <NEW_LINE> <DEDENT> createPlayer(name) <NEW_LINE> query = "SELECT id FROM Players ORDER BY id DESC LIMIT 1" <NEW_LINE> p... | Adds a player to the tournament database.
The database assigns a unique serial id number for the player. (This
should be handled by your SQL database schema, not in your Python code.)
Args:
name: the player's full name (need not be unique). | 625941edbe8e80087fb2116c |
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 | 625941eda4f1c619b28b055e |
def _index_postal_codes(self) -> pd.DataFrame: <NEW_LINE> <INDENT> data_path_unique = self._data_path.replace(".txt", "-index.txt") <NEW_LINE> if os.path.exists(data_path_unique): <NEW_LINE> <INDENT> data_unique = pd.read_csv( data_path_unique, dtype={"postal_code": str} ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ... | Create a dataframe with unique postal codes | 625941ed5e10d32532c5f457 |
def __init__(self, params, name): <NEW_LINE> <INDENT> Configurable.__init__(self, params, tf.contrib.learn.ModeKeys.EVAL) <NEW_LINE> self._name = name <NEW_LINE> self._eos_token = self.params["eos_token"] <NEW_LINE> self._sos_token = self.params["sos_token"] <NEW_LINE> self._separator = self.params["separator"] <NEW_LI... | Initializer | 625941ed26238365f5f0f3a7 |
def new_tile(self): <NEW_LINE> <INDENT> emptylist=[] <NEW_LINE> for dummy_row in range(0,self.height): <NEW_LINE> <INDENT> for dummy_col in range(0,self.width): <NEW_LINE> <INDENT> if self.get_tile(dummy_row,dummy_col)==0: <NEW_LINE> <INDENT> emptylist.append((dummy_row,dummy_col)) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT>... | Create a new tile in a randomly selected empty
square. The tile should be 2 90% of the time and
4 10% of the time. | 625941ed462c4b4f79d1dc01 |
def findfiles(patterns=(), path=None): <NEW_LINE> <INDENT> import os.path <NEW_LINE> from py15sacla.multipattern import MultiPattern <NEW_LINE> from IPython.utils.text import SList <NEW_LINE> if isinstance(path, basestring): <NEW_LINE> <INDENT> path = [path] <NEW_LINE> <DEDENT> mp = MultiPattern(patterns) <NEW_LINE> al... | Return filenames that match all specified patterns.
patterns -- a list of string patterns that must all match in the
the returned files. Can be also a single string with
patterns separated by whitespace characters.
path -- optional list of directories to be searched instead
of ... | 625941eddc8b845886cb5a69 |
def test_same_dim_broadcast(self): <NEW_LINE> <INDENT> self._test_minimum((3, 4, 5), (3, 1, 5)) <NEW_LINE> self._test_minimum((3, 1, 5), (3, 4, 5)) <NEW_LINE> self._test_minimum((3, 4, 5), (1, 4, 1)) <NEW_LINE> self._test_minimum((1, 4, 1), (3, 4, 5)) <NEW_LINE> self._test_minimum((1, 4, 5), (3, 1, 5)) <NEW_LINE> self.... | Test minimum with the same dimension | 625941ed1f5feb6acb0c507b |
def __init__(self, data: pd.DataFrame, params_range: Dict[str, tuple]): <NEW_LINE> <INDENT> self._lgb_train = lgb.Dataset(data=pd.DataFrame(data.iloc[:, 0]), label=data.iloc[:, 1]) <NEW_LINE> self._params_range = params_range <NEW_LINE> self._params_stats = None | Parameters
----------
data
Данные с признаком для которого производится биннинг (I колонка) и target (II колонка)
params_range
OrderedDict with parameters and ranges for binning algorithms
params_range = OrderedDict({"max_depth": (4, 7, 17, 2, 3), "min_child_samples": (40000, 20000, 5000),}) | 625941ed4428ac0f6e5bad29 |
def make_counts(all_counts): <NEW_LINE> <INDENT> europe_countries = { 'Belgium', 'Germany', 'Italy', 'Netherlands', 'Serbia', 'Spain', 'UK', } <NEW_LINE> europe_counts = {x: all_counts[x] for x in europe_countries} <NEW_LINE> world_counts = {x: all_counts[x] for x in all_counts if x not in europe_countries} <NEW_LINE> ... | all_counts should be counts dictionary made by samples_table.make_samples_tsv() | 625941edb830903b967e9e37 |
def test_decorator_match(self, plugin, client, bg_system): <NEW_LINE> <INDENT> client._bg_name = bg_system.name <NEW_LINE> client._bg_version = bg_system.version <NEW_LINE> plugin._validate_system() | Passing a System along with @system args is OK as long as they match | 625941ed82261d6c526ab9da |
def create_words(): <NEW_LINE> <INDENT> if (os.path.isfile(word_file)): <NEW_LINE> <INDENT> return open(word_file).read().strip().split('\n') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> positive = {} <NEW_LINE> neutral = {} <NEW_LINE> negative = {} <NEW_LINE> with open(data_file) as tweets: <NEW_LINE> <INDENT> reader... | if it exists, opens wordfile. Otherwise, creates words and writes to wordfile | 625941ed7b25080760e39988 |
@mark.django_db <NEW_LINE> def test_reset_password(client): <NEW_LINE> <INDENT> url = reverse("accounts:password_reset") <NEW_LINE> assert url == "/accounts/password-reset/" <NEW_LINE> response = client.get(url) <NEW_LINE> assert template_used(response, "conference/accounts/password_reset.html") <NEW_LINE> assert "Djan... | Testing full reset password flow, from getting to the reset password page,
through sending email with unique token, to using that url to change the
password. | 625941ed009cb60464c638df |
def compile_messages(self, locations): <NEW_LINE> <INDENT> for i, (dirpath, f) in enumerate(locations): <NEW_LINE> <INDENT> if self.verbosity > 0: <NEW_LINE> <INDENT> self.stdout.write('processing file %s in %s\n' % (f, dirpath)) <NEW_LINE> <DEDENT> po_path = os.path.join(dirpath, f) <NEW_LINE> if has_bom(po_path): <NE... | Locations is a list of tuples: [(directory, file), ...] | 625941ed97e22403b379d4ce |
def gps_accuracy(gps, posambiguity: int) -> int: <NEW_LINE> <INDENT> pos_a_map = {0: 0, 1: 1 / 600, 2: 1 / 60, 3: 1 / 6, 4: 1} <NEW_LINE> if posambiguity in pos_a_map: <NEW_LINE> <INDENT> degrees = pos_a_map[posambiguity] <NEW_LINE> gps2 = (gps[0], gps[1] + degrees) <NEW_LINE> dist_m = geopy.distance.distance(gps, gps2... | Calculate the GPS accuracy based on APRS posambiguity. | 625941edf8510a7c17cf9c33 |
def response_change(self, request, obj): <NEW_LINE> <INDENT> response = super(PageAdmin, self).response_change(request, obj) <NEW_LINE> return self._maintain_parent(request, response) | Enforce page permissions and maintain the parent ID in the
querystring. | 625941ed090684286d50f220 |
def bitlize(df, label, depth, min_, n_pool): <NEW_LINE> <INDENT> metas = _get_metas(df, depth, min_, label, n_pool) <NEW_LINE> metas = sorted(metas, key = lambda x: x["name"]) <NEW_LINE> fmetas = [[] for i in range(0, 2**depth)] <NEW_LINE> for each in metas: <NEW_LINE> <INDENT> for i, term in enumerate(each["range"]): ... | transform the feature into binary form.
:param df: the original features
:param depth: the depth of training tree.
the result features length is len(df) * 2^(depth)
:param min_: the min sample num of each feature.
:param label: the crition label
:return: the new feature dataframe | 625941ed4d74a7450ccd46f7 |
def serve(self): <NEW_LINE> <INDENT> LOG.info('Start sentry') <NEW_LINE> nova_topic = CONF.nova_sentry_mq_topic <NEW_LINE> glance_topic = CONF.glance_sentry_mq_topic <NEW_LINE> controller_hanler = handler.Handler() <NEW_LINE> LOG.info('Listening on topic: "%s"' % nova_topic) <NEW_LINE> for nova_level in CONF.nova_mq_le... | The default notification topic is:
"topic = '%s.%s' % (topic, priority)"
Example:
"notifications.info" | 625941edcc40096d61595e80 |
def update(self, state): <NEW_LINE> <INDENT> self.state = state.copy() <NEW_LINE> self.state['color index'] = self.state['Spread D-R']*100 <NEW_LINE> self.state['color index'] = pd.cut( self.state['color index'], [-100, -10, -5, -2, -1, -0.5, 0.5, 1, 2, 5, 10, 100], labels=[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0]) <NEW_LINE>... | Update view object. | 625941ed8c0ade5d55d3eef2 |
def descargarImagen(url): <NEW_LINE> <INDENT> urllib.request.urlretrieve(url, 'pokemon.gif') <NEW_LINE> return | Entradas: Una URL
Salidas: N/A
Funcionamiento: Descarga la imagen de la URL y le da el formato .gif | 625941edb7558d58953c543b |
def _handle_listbox_additem(self, context, lhs, rhs): <NEW_LINE> <INDENT> if (isinstance(lhs, str) and lhs.startswith("[") and lhs.endswith("]")): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> lhs = eval(lhs) <NEW_LINE> <DEDENT> except SyntaxError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <DEDENT> if ((context.with_... | Handle AddItem() object method calls like foo.AddItem(bar).
foo is (currently) a ListBox object. | 625941ede1aae11d1e74a1ef |
def LinearizedConv1d(in_channels, out_channels, kernel_size, dropout=0, **kwargs): <NEW_LINE> <INDENT> m = LinearizedConvolution(in_channels, out_channels, kernel_size, **kwargs) <NEW_LINE> std = math.sqrt((4 * (1.0 - dropout)) / (m.kernel_size[0] * in_channels)) <NEW_LINE> m.weight.data.normal_(mean=0, std=std) <NEW_L... | Weight-normalized Conv1d layer optimized for decoding | 625941ed24f1403a92601094 |
def nth_term(n): <NEW_LINE> <INDENT> if n == 1: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 3 + nth_term(n-1) | returns the nth term of a numerical sequence | 625941ed4d74a7450ccd46f8 |
@subclasses_only.parametrize <NEW_LINE> def test_multiple_inheritance_deny_regular_classes(code): <NEW_LINE> <INDENT> class Foo: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> with pytest.raises(DependencyError) as exc_info: <NEW_LINE> <INDENT> code(Foo) <NEW_LINE> <DEDENT> message = str(exc_info.value) <NEW_LINE> assert... | Only `Injector` subclasses are allowed to be used in the inheritance. | 625941ed3346ee7daa2b32a3 |
def add_vertex(self, v) -> None: <NEW_LINE> <INDENT> self._matrix = None <NEW_LINE> if not isinstance(v, Vertex): <NEW_LINE> <INDENT> assert isinstance(v, int) <NEW_LINE> v = Vertex(v) <NEW_LINE> <DEDENT> if v not in self._dict: <NEW_LINE> <INDENT> self._dict[v] = set() | Adds a new vertex to the graph
Parameters:
'v' : a Vertex object or a integer for a Vertex id
If an integer is provided, the method will build a Vertex
with the id field being v. | 625941ede5267d203edce1c8 |
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(S3StorageSettingsForm, self).__init__(*args, **kwargs) <NEW_LINE> can_use_amazon_s3, reason = get_can_use_amazon_s3() <NEW_LINE> if not can_use_amazon_s3: <NEW_LINE> <INDENT> self.disabled_fields['aws_access_key_id'] = True <NEW_LINE> self.disabled_fields['... | Initialize the subform.
If Amazon S3 support isn't available, the form's fields will be
disabled.
Args:
*args (tuple):
Additional positional arguments for the parent class.
**kwargs (dict):
Additional keyword arguments for the parent class. | 625941eda8370b7717052dd0 |
def __init__(self, kind, value, options): <NEW_LINE> <INDENT> logger.debug("Creating SerialConnection: " "kind: %s, value: %s, options: %s", kind, value, options) <NEW_LINE> self.kind = self.validate_kind(kind) <NEW_LINE> self.value = self.validate_value(self.kind, value) <NEW_LINE> self.options = self.validate_options... | Construct a SerialConnection object of the given kind and value.
Args:
kind (str): Connection type string, possibly in need of munging.
value (str): Connection value such as '/dev/ttyS0' or '1.1.1.1:80'
options (dict): Input options dictionary. | 625941ed5166f23b2e1a568b |
def utFillList(self, l_list): <NEW_LINE> <INDENT> p_list = l_list[len(l_list)-1] <NEW_LINE> if len(p_list)<7: <NEW_LINE> <INDENT> k=7-len(p_list) <NEW_LINE> while k>0: <NEW_LINE> <INDENT> k-=1 <NEW_LINE> p_list.append('') <NEW_LINE> <DEDENT> <DEDENT> l_list[len(l_list)-1] = p_list <NEW_LINE> return l_list | fill the last list item from a list with empty spaces | 625941edd99f1b3c44c67ab7 |
def _GuessCommandTelemetry( suite, bisect_bot, metric, rerun_option, use_buildbucket): <NEW_LINE> <INDENT> command = [] <NEW_LINE> if use_buildbucket: <NEW_LINE> <INDENT> test_cmd = 'src/tools/perf/run_benchmark' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> test_cmd = 'tools/perf/run_benchmark' <NEW_LINE> <DEDENT> com... | Returns a command to use given that |suite| is a Telemetry benchmark. | 625941ed0a50d4780f6673c9 |
def remove_duplicate_letters(self, s: str) -> str: <NEW_LINE> <INDENT> nums_map = self.get_num_map(s) <NEW_LINE> in_stack_map = {} <NEW_LINE> stack = [] <NEW_LINE> for ch in s: <NEW_LINE> <INDENT> nums_map[ch] -= 1 <NEW_LINE> if ch in in_stack_map and in_stack_map[ch]: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> w... | 移除重复字符
Args:
s: 字符串
Returns:
字典排序表 | 625941ed2eb69b55b151cdea |
def shortspacingobservatory(nu, uvhole, name, obs='VLA',n_ants = 30, filepath='./'): <NEW_LINE> <INDENT> from astropy import constants as cst <NEW_LINE> import os <NEW_LINE> if obs.lower().strip() == 'vla': <NEW_LINE> <INDENT> d_ant = 25 <NEW_LINE> <DEDENT> elif obs.lower().strip() == 'alma': <NEW_LINE> <INDENT> d_ant ... | Create a short spacing observatory for CASA simobserve
Returns
----------
Keywords
----------
Example
-------
import CASAtools
filepath = '/Users/chris/GDrive-UCB/Berkeley/Research/VLA/VLA2017/Jup_x_20170111/'
name = 'vca.tp'
uvhole = 18000 # [lambda]
nu = 10e9 # [Hz] Observing frequency
CASAtools.shortspac... | 625941ed76e4537e8c351baa |
def translate(self, x, y): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y | Positions the layer at the given coordinates.
The x and y parameters define where to position
the top left corner of the layer,
measured from the top left of the canvas. | 625941ed45492302aab5e7fb |
def send(self, data): <NEW_LINE> <INDENT> self._send(data) | send data to the server | 625941ed66656f66f7cbc6e0 |
@task <NEW_LINE> def restart(): <NEW_LINE> <INDENT> with cd(env.root_dir): <NEW_LINE> <INDENT> run('uwsgi --reload ~/pids/andreyshipilov_uwsgi.pid') <NEW_LINE> run('~/bin/nginx -s reload') | Restarts Apache service. | 625941ed2ae34c7f2600d663 |
def leap(self, n=1): <NEW_LINE> <INDENT> if not self.running: <NEW_LINE> <INDENT> self.start() <NEW_LINE> <DEDENT> self.__cpu.start() <NEW_LINE> self.__clock.limit(None) <NEW_LINE> x = 0 <NEW_LINE> while self.__pause is None and x < n: <NEW_LINE> <INDENT> x += 1 <NEW_LINE> instant = self.__next_instant() <NEW_LINE> if ... | Run a number of simulation instants (default 1). An instant consists of a set of
events with the same date, so this method should go through 'n' different dates. | 625941ed5510c4643540f909 |
def list_outfiles_for_cleanup(self, args): <NEW_LINE> <INDENT> if args.dump_names is None: <NEW_LINE> <INDENT> args = args._replace(dump_names=[self.dumpname]) <NEW_LINE> <DEDENT> multistream_names = [] <NEW_LINE> for dname in args.dump_names: <NEW_LINE> <INDENT> multistream_names.extend([XmlMultiStreamDump.get_dumpnam... | shows all files possible if we don't have checkpoint files. should include temp files
does just the parts we do if there is a limit
expects: args.dump_dir, optional args.dump_names
returns: list of DumpFilename | 625941edb830903b967e9e38 |
def clearItems(self): <NEW_LINE> <INDENT> self.items = {} <NEW_LINE> self.raw_items = [] | Clear all the items | 625941edbe383301e01b59ae |
def getVisible(self): <NEW_LINE> <INDENT> vis = set() <NEW_LINE> for x, y, z in self.all: <NEW_LINE> <INDENT> if (x, y, z) not in self.blocks: <NEW_LINE> <INDENT> newvis = self.whatCanISee((x, y, z)) <NEW_LINE> vis = vis.union(newvis) <NEW_LINE> <DEDENT> <DEDENT> return len(vis) | Return the amount of bits that can be seen
| 625941ed6fece00bbac2dc78 |
def drawPiece4(piece, context, x, y, psize, allwhite=False, allpawns=False, asean=False, variant=None): <NEW_LINE> <INDENT> if asean: <NEW_LINE> <INDENT> drawPiece3(piece, context, x, y, psize, allwhite=allwhite, allpawns=allpawns, asean=True) <NEW_LINE> return <NEW_LINE> <DEDENT> color = WHITE if allwhite else piece.c... | Rendering pieces using .ttf chessfont figurines | 625941edd99f1b3c44c67ab8 |
def nextCity(aset, size): <NEW_LINE> <INDENT> for pos in range(1, number_cities + 1): <NEW_LINE> <INDENT> if (aset & (1 << pos)) > 0: <NEW_LINE> <INDENT> yield pos | returns the bit positions of the cities
in a set of cities
aset: set of cities
m: size of set | 625941edd6c5a10208144582 |
def run(self) -> None: <NEW_LINE> <INDENT> _log.info("Running %s", self.case_id) <NEW_LINE> for query_file in os.listdir(self.queries_dir): <NEW_LINE> <INDENT> if "FIXME" in query_file: <NEW_LINE> <INDENT> _log.info("Skipping FIXME query %s", os.path.basename(query_file)) <NEW_LINE> continue <NEW_LINE> <DEDENT> if quer... | Run the test queries in a test case.
Test files will be skipped if their file name contains the text "FIXME",
or if the query number is listed in the integration test yaml's
skip_numbers for this test case. | 625941ed15fb5d323cde104a |
def extractAndSliceOnsets(self, filename, method="Essentia"): <NEW_LINE> <INDENT> if filename: <NEW_LINE> <INDENT> slices = None <NEW_LINE> audio = self.loadAudio(filename) <NEW_LINE> onsetTimes = None <NEW_LINE> if "Madmom" in method: <NEW_LINE> <INDENT> onsetTimes = self.extractOnsetsMadmom(filename, method=method) <... | Use an onset detector to return beat locations
:param fileName: the file to load and extract beats from
:return:
onsetTimes: the onset times in the file
slices: the segmented audio units
fileName: pass out the filename again | 625941ed56ac1b37e62646f8 |
def get_dblp_country(path_to_persons_file: str, path_to_country_file: str, output_path_country: str = None) -> list: <NEW_LINE> <INDENT> with open(path_to_persons_file, "r", encoding="utf-8") as f: <NEW_LINE> <INDENT> persons = f.readlines() <NEW_LINE> <DEDENT> persons = [json.loads(x) for x in persons] <NEW_LINE> note... | Extract all the countries from the person.json. Is using a country file as support.
:param path_to_persons_file:
:param path_to_country_file:
:param output_path_country:
:return: | 625941ed66673b3332b925c4 |
def __init__(self, configs=None, blocking_mode=False, native=True, offline=False, force_compatibility=False, debug=False): <NEW_LINE> <INDENT> if configs is None: <NEW_LINE> <INDENT> configs = config.Config.get_defaults() <NEW_LINE> <DEDENT> if isinstance(configs, config.Config): <NEW_LINE> <INDENT> configs = [configs]... | Initialize a new EpochClient
:param configs: the list of configurations to use or empty for default (default None)
:param blocking_mode: block the client waiting for transactions (default False)
:param native: build transaction natively (do not use the node internal endpoints) (default True)
:param offline: do not atte... | 625941ed3317a56b8693a17e |
def _lvarx(ins): <NEW_LINE> <INDENT> output = [] <NEW_LINE> l = eval(ins.quad[3]) <NEW_LINE> label = tmp_label() <NEW_LINE> offset = int(ins.quad[1]) <NEW_LINE> tmp = list(ins.quad) <NEW_LINE> tmp[1] = label <NEW_LINE> ins.quad = tmp <NEW_LINE> AT_END.extend(_varx(ins)) <NEW_LINE> output.append('push ix') <NEW_LINE> ou... | Defines a local variable. 1st param is offset of the local variable.
2nd param is the type a list of bytes in hexadecimal. | 625941ed26068e7796caf21a |
def _theme_faders(self, mode_index): <NEW_LINE> <INDENT> for index, fader in enumerate(self.control_surface.fader_elements): <NEW_LINE> <INDENT> if mode_index > 0: <NEW_LINE> <INDENT> fader.set_theme(mode_colors[mode_index], "fill") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if index < 4: <NEW_LINE> <INDENT> fader.s... | Change the fader colors to indicate mode | 625941ed046cf37aa974d275 |
def ks_2samp(data1, data2): <NEW_LINE> <INDENT> data1, data2 = lmap(np.asarray, (data1, data2)) <NEW_LINE> n1 = data1.shape[0] <NEW_LINE> n2 = data2.shape[0] <NEW_LINE> n1 = len(data1) <NEW_LINE> n2 = len(data2) <NEW_LINE> data1 = np.sort(data1) <NEW_LINE> data2 = np.sort(data2) <NEW_LINE> data_all = np.concatenate([da... | Computes the Kolmogorov-Smirnof statistic on 2 samples.
This is a two-sided test for the null hypothesis that 2 independent samples
are drawn from the same continuous distribution.
Parameters
----------
a, b : sequence of 1-D ndarrays
two arrays of sample observations assumed to be drawn from a continuous
dis... | 625941ed15baa723493c44ad |
def simple_test_bboxes(self, x, img_meta, proposals, rcnn_test_cfg, rescale=False): <NEW_LINE> <INDENT> rois = bbox2roi(proposals) <NEW_LINE> if self.feat_from_shared_head: <NEW_LINE> <INDENT> shared_head_feat_ = [self.shared_head(x[0])] <NEW_LINE> roi_feats = self.bbox_roi_extractor(shared_head_feat_[:1], rois) <NEW_L... | Test only det bboxes without augmentation. | 625941edb7558d58953c543c |
def test_rotate(self): <NEW_LINE> <INDENT> handler = log.infoLogger.handlers[0] <NEW_LINE> handler.doRollover() <NEW_LINE> files = glob.glob(os.path.join(settings.LOG_DIR, 'info.log.*')) <NEW_LINE> matches = [re.match('info.log.[0-9]{4}-[0-9]{2}-[0-9]{2}', os.path.basename(f)) for f in files] <NEW_LINE> self.assertTrue... | Force rotation of the log file. | 625941ed29b78933be1e5bd9 |
def test_sdelegator8(self): <NEW_LINE> <INDENT> foo = Foo() <NEW_LINE> sdel = StringifiedDelegator(foo, my_acc=foo.acc, inc=foo.acc) <NEW_LINE> self.assertEqual(foo.i, 0) <NEW_LINE> sdel.acc() <NEW_LINE> sdel.my_acc() <NEW_LINE> sdel.inc() <NEW_LINE> self.assertEqual(foo.i, 3) | test kwargs | 625941ed4f6381625f114f6f |
def covFITC(covfunc, xu=None, hyp=None, x=None, z=None, der=None): <NEW_LINE> <INDENT> if hyp == None: <NEW_LINE> <INDENT> A = [src.Tools.general.feval(covfunc)] <NEW_LINE> return A <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> assert(xu.shape[1]==x.shape[1]) <NEW_LINE> <DEDENT> except AssertionError: <NEW_LINE> <INDENT... | Covariance function to be used together with the FITC approximation.
The function allows for more than one output argument and does not respect the
interface of a proper covariance function. In fact, it wraps a proper
covariance function such that it can be used together with infFITC.m.
Instead of outputing the full c... | 625941ed7b25080760e39989 |
def wordcount(text): <NEW_LINE> <INDENT> wordList = text.split() <NEW_LINE> counters ={} <NEW_LINE> for word in wordList: <NEW_LINE> <INDENT> if word in counters: <NEW_LINE> <INDENT> counters[word] += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> counters[word] = 1 <NEW_LINE> <DEDENT> <DEDENT> for word in counters: <... | prints frequency of each word in text | 625941edf9cc0f698b140b2a |
def compare(version1='', version2=''): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for oper, ret in (('lt', -1), ('eq', 0), ('gt', 1)): <NEW_LINE> <INDENT> cmd = 'dpkg --compare-versions "{0}" {1} ' '"{2}"'.format(version1, oper, version2) <NEW_LINE> if __salt__['cmd.retcode'](cmd) == 0: <NEW_LINE> <I... | Compare two version strings. Return -1 if version1 < version2,
0 if version1 == version2, and 1 if version1 > version2. Return None if
there was a problem making the comparison.
CLI Example::
salt '*' pkg.compare '0.2.4-0ubuntu1' '0.2.4.1-0ubuntu1' | 625941edde87d2750b8602cc |
def calculate(self, time, delta_time): <NEW_LINE> <INDENT> if self._is_on: <NEW_LINE> <INDENT> actual_temperature = self._thermal_process.temperature <NEW_LINE> if actual_temperature < (self._target_temperature-self._hysteresis/2.): <NEW_LINE> <INDENT> self._output_value = self._on_value <NEW_LINE> <DEDENT> elif actual... | AbstractSimulationElement implementation
.. seealso:: :func:`gridsim.core.AbstractSimulationElement.calculate`. | 625941ed21a7993f00bc822d |
def items(self): <NEW_LINE> <INDENT> return Content.objects.visible().only('updated', 'id', 'slug') | Renvoyer la liste des éléments du sitemap | 625941edfbf16365ca6f6702 |
def test_two_past_questions(self): <NEW_LINE> <INDENT> create_question(question_text="Past question 1.", days=-30) <NEW_LINE> create_question(question_text="Past question 2.", days=-5) <NEW_LINE> response = self.client.get(reverse('polls:index')) <NEW_LINE> self.assertQuerysetEqual( response.context['latest_questions']... | The questions index page may display multiple questions. | 625941ed3d592f4c4ed1d592 |
def __should_loop(self): <NEW_LINE> <INDENT> if self.loop: <NEW_LINE> <INDENT> if self.num_of_loops == "inf": <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.current_loop >= self.num_of_loops <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> return False | Verify whether it should loop or not | 625941ed55399d3f05588beb |
@webnotes.whitelist() <NEW_LINE> def get_roles(arg=None): <NEW_LINE> <INDENT> return _get_roles(webnotes.form_dict['uid']) | return all roles except standard | 625941edcdde0d52a9e5356b |
def compute_distances_two_loops(self, X): <NEW_LINE> <INDENT> num_test = X.shape[0] <NEW_LINE> num_train = self.X_train.shape[0] <NEW_LINE> dists = np.zeros((num_test, num_train)) <NEW_LINE> for i in range(num_test): <NEW_LINE> <INDENT> for j in range(num_train): <NEW_LINE> <INDENT> dists[i][j] = np.sqrt(np.dot(X[i] - ... | Compute the distance between each test point in X and each training point
in self.X_train using a nested loop over both the training data and the
test data.
Inputs:
- X: A numpy array of shape (num_test, D) containing test data.
Returns:
- dists: A numpy array of shape (num_test, num_train) where dists[i, j]
is th... | 625941ed07f4c71912b119b8 |
def get_fitarea(center, fitsize, imgshape=None, WCS=None): <NEW_LINE> <INDENT> pixscale = None if WCS is None else utils.get_pixelscale(WCS) <NEW_LINE> if isinstance(center, SkyCoord): <NEW_LINE> <INDENT> center = center.to_pixel(WCS) <NEW_LINE> <DEDENT> fitsize = fitsize.to_value(u.pix, equivalencies=pixscale) <NEW_LI... | fitsize must be integer, same size in x and y is assumed | 625941ed2c8b7c6e89b35cf0 |
def __setstate__(self, state): <NEW_LINE> <INDENT> self.namespace = state['namespace'] <NEW_LINE> self.filename = state['filename'] <NEW_LINE> self.name = state['name'] <NEW_LINE> self.doc = state['doc'] <NEW_LINE> self.attributes = state['attributes'] <NEW_LINE> self.klasses = state['klasses'] <NEW_LINE> self.function... | Sets the state object duting unpickling. | 625941edb5575c28eb68e539 |
def loadSetting(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> f = open(FILENAME,'r',encoding='utf8') <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> print( u'%s无法打开配置文件' % self.name) <NEW_LINE> return <NEW_LINE> <DEDENT> setting = json.load(f) <NEW_LINE> try: <NEW_LINE> <INDENT> self.domain = str(setting[... | 载入配置 | 625941ed9f2886367277adbd |
def get_paper_size(name): <NEW_LINE> <INDENT> m = re.match(r'^a?(\d)$', name) <NEW_LINE> if m: <NEW_LINE> <INDENT> return [math.floor(1000 / 2**((2*int(m.group(1)) - 1) / 4.0) + 0.2), math.floor(1000 / 2**((2*(int(m.group(1)) + 1) - 1) / 4.0) + 0.2)] <NEW_LINE> <DEDENT> m = re.match(r'^b(\d)$', name) <NEW_LINE> if m: <... | Returns paper size for name, [long, short] sides in mm | 625941edd58c6744b4258191 |
def testReadingMutablePack(self): <NEW_LINE> <INDENT> packdir = self.makeTempDir() <NEW_LINE> config = configparser.config() <NEW_LINE> packer = revisionstore.mutabledeltastore(packfilepath=packdir, config=config) <NEW_LINE> packer.add("qwert", self.getFakeHash(), nullid, b"qwertcontent") <NEW_LINE> filename = "filenam... | Tests that the data written into a mutabledatapack can be read out
before it has been finalized. | 625941ed656771135c3ebda9 |
def dtf2d(scale, iy, im, id, ihr, imn, sec): <NEW_LINE> <INDENT> d1, d2, c_retval = ufunc.dtf2d(scale, iy, im, id, ihr, imn, sec) <NEW_LINE> check_errwarn(c_retval, 'dtf2d') <NEW_LINE> return d1, d2 | Wrapper for ERFA function ``eraDtf2d``.
Parameters
----------
scale : const char array
iy : int array
im : int array
id : int array
ihr : int array
imn : int array
sec : double array
Returns
-------
d1 : double array
d2 : double array
Notes
-----
The ERFA documentation is below.
- - - - - - - - -
e r a D t f 2 d
-... | 625941eda8370b7717052dd1 |
def msg(self, msg): <NEW_LINE> <INDENT> time = datetime.datetime.now().strftime("%s") <NEW_LINE> if not self.daemon: <NEW_LINE> <INDENT> print("% 3d: %s" % (self.handler_id, msg)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> f = open('/var/log/noVNC/log','a+') <NEW_LINE> f.write("%s : %d : %s\n" % (time, self.handler_... | Output message with handler_id prefix. | 625941ed4c3428357757c858 |
def _set_iih(self, v, load=False): <NEW_LINE> <INDENT> if hasattr(v, "_utype"): <NEW_LINE> <INDENT> v = v._utype(v) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> t = YANGDynClass( v, base=iih.iih, is_container="container", yang_name="iih", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register... | Setter method for iih, mapped from YANG variable /network_instances/network_instance/protocols/protocol/isis/interfaces/interface/levels/level/packet_counters/iih (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_iih is considered as a private
method. Backends looking to popul... | 625941ed76d4e153a657f066 |
def __flip(self) -> None: <NEW_LINE> <INDENT> if not self.__stack_b: <NEW_LINE> <INDENT> while self.__stack_a: <NEW_LINE> <INDENT> self.__stack_b.append(self.__stack_a.pop()) <NEW_LINE> <DEDENT> <DEDENT> return | Flip items from stack_a into stack_b. | 625941ed3cc13d1c6d3c78ab |
def test_content(response): <NEW_LINE> <INDENT> assert zocalo.__version__ | Sample pytest test function with the pytest fixture as an argument. | 625941ed1d351010ab85604e |
def _loss_fun(pars, x, k, n, S, fixed): <NEW_LINE> <INDENT> yhat = psy_pred(pars, x, S, fixed) <NEW_LINE> ll = binom.logpmf(k, n, yhat) <NEW_LINE> return -ll.sum() | A binomial loss function. Returns negative log likelihood
for k successes in n binomial trials at stimulus level x, fit with
psychometric fun S.
:param pars: the vector of parameters to be fit. Order = (m, w, lam, gam).
:param x: the stimulus level; if S is weibull should be in log units.
:param k: number of success... | 625941ed379a373c97cfb07a |
@timeit <NEW_LINE> def get_domains_from_url(es_server, index_name): <NEW_LINE> <INDENT> es = elasticsearch.Elasticsearch(es_server) <NEW_LINE> cnt_result = es.count(index=index_name) <NEW_LINE> domains_set = set() <NEW_LINE> domain = "" <NEW_LINE> for row in es_iterate_all_documents(es, index_name): <NEW_LINE> <INDENT>... | :TODO
:param es_server:
:param index_name:
:return: | 625941edcc0a2c11143dd3c5 |
def add_to_perf_tail(self, app_scale_recommendations): <NEW_LINE> <INDENT> self.app_performance_tail.append(app_scale_recommendations) <NEW_LINE> self.check_for_flapping() <NEW_LINE> del self.app_performance_tail[:(len(self.app_performance_tail) - 300)] <NEW_LINE> return self.app_performance_tail[::-1] | The app performance tail is the time series list of votes, decisions, timestamps and
checksums (app version) for all participating applications. Upon adding to this list,
it is truncated to hold the last 300 items. It is truncated to keep memory usage
stable as this will be a long running application.
:param app_scale... | 625941ed046cf37aa974d276 |
def main(json_file): <NEW_LINE> <INDENT> json_array = get_json(json_file) <NEW_LINE> if not json_array: <NEW_LINE> <INDENT> print('JSON file not specified') <NEW_LINE> return <NEW_LINE> <DEDENT> print('[*] Importing analysis data from {}'.format(json_file)) <NEW_LINE> import_functions(json_array['functions'], json_arra... | Import analysis data from bnida JSON file | 625941ed236d856c2ad44d16 |
def __init__(self, src_cube, tgt_grid_cube, method, projection=None): <NEW_LINE> <INDENT> if not isinstance(src_cube, iris.cube.Cube): <NEW_LINE> <INDENT> raise TypeError("'src_cube' must be a Cube") <NEW_LINE> <DEDENT> if not isinstance(tgt_grid_cube, iris.cube.Cube): <NEW_LINE> <INDENT> raise TypeError("'tgt_grid_cub... | Create a regridder for conversions between the source
and target grids.
Args:
* src_cube:
The :class:`~iris.cube.Cube` providing the source points.
* tgt_grid_cube:
The :class:`~iris.cube.Cube` providing the target grid.
* method:
Either 'linear' or 'nearest'.
* projection:
The projection in which the... | 625941ed8e7ae83300e4b502 |
def statistical_significance(result_path_regex='../results/*.pkl', eval_measure=ae): <NEW_LINE> <INDENT> result_dict = defaultdict(lambda: []) <NEW_LINE> for result in glob.glob(result_path_regex): <NEW_LINE> <INDENT> with open(result, 'rb') as fin: <NEW_LINE> <INDENT> true_prevalences, estim_prevalences = pickle.load(... | Performs a series of two-tailored t-tests comparing any method with the best one found for the metric-dataset pair.
:param result_path_regex: a regex to search for all methods that have to be submitted to the test
:param eval_measure: the evaluation metric (e.g., ae, or rae) that will be the object of study of the test... | 625941ed0383005118ecfb14 |
def sl_action(self, observation, my_action, weight=1): <NEW_LINE> <INDENT> policy = np.zeros(self.labels_n) <NEW_LINE> k = self.move_lookup[chess.Move.from_uci(my_action)] <NEW_LINE> policy[k] = weight <NEW_LINE> self.moves.append([observation, list(policy)]) <NEW_LINE> return my_action | Logs the action in self.moves. Useful for generating a game using game data.
:param str observation: FEN format observation indicating the game state
:param str my_action: uci format action to take
:param float weight: weight to assign to the taken action when logging it in self.moves
:return str: the action, unmodifi... | 625941eddd821e528d63b6d8 |
def db(name, **kwargs): <NEW_LINE> <INDENT> path = data_path(db_path(name), **kwargs) <NEW_LINE> return sqlite3.connect(path) | Return absolute path to unittest data file. Data files are located in
tests/data/db.
Args:
path (str): Relative path.
Returns:
sqlite.Connection: Sqlite connection to database.
Raises:
TestData404: If path doesn't exist. | 625941ed3eb6a72ae02eca20 |
def refine(vertices, area): <NEW_LINE> <INDENT> res = bool(area > max_area) <NEW_LINE> return res | A function for use with workflow.triangulate.triangulate's refinement_func argument based on a global max area. | 625941edac7a0e7691ed45f6 |
@socketio.on('conectar') <NEW_LINE> def conectar(user_id): <NEW_LINE> <INDENT> print("Alguien se quiere conectar") <NEW_LINE> try: <NEW_LINE> <INDENT> print("Alguien se quiere conectar {}".format(user_id)) <NEW_LINE> usuario = Usuario.get_usuario_por_id(user_id) <NEW_LINE> emit("conectar", {'status':'OK','usuario':usua... | Metodo de conexion, que ademas registra las conexiones activas. | 625941ed6e29344779a62b44 |
def register_effect(self, name: str, path: str) -> None: <NEW_LINE> <INDENT> self._effects[name] = pyglet.media.load(path, streaming=False) | Registers a new sound effect.
Multiple sound effects can be played at once. The audio file is stored in the memory to ease the CPU usage,
hence the sound effects should be as light as possible.
Parameters
----------
name: str
The name of the sound effect.
path: str
The path to the audio file (RIFF/WAV file, u... | 625941ed796e427e537b0aff |
def update(self, tree_index: int, priority): <NEW_LINE> <INDENT> change = priority - self.tree[tree_index] <NEW_LINE> self.tree[tree_index] = priority <NEW_LINE> while tree_index != 0: <NEW_LINE> <INDENT> tree_index = (tree_index - 1) // 2 <NEW_LINE> self.tree[tree_index] += change | Update the leaf priority and propagate the change through tree
:param tree_index: corresponding leaf index in the tree
:param priority: priority value | 625941edbd1bec0571d90b63 |
def __eq__(self, other): <NEW_LINE> <INDENT> return self._verse_offset == other._verse_offset | True if both have equal verse offsets.
| 625941ed097d151d1a22338a |
def get_default_config(self): <NEW_LINE> <INDENT> return { 'path': 'memcached', 'host': 'localhost', 'port': '11211', 'add_port_to_path': False, } | Returns the default collector settings | 625941edbf627c535bc13703 |
def __init__(self, layer_idx, in_channels, out_channels, kernel_size=3, stride=1, padding=1, dilation=1, add_bias=False, wscale_gain=np.sqrt(2.0), wscale_lr_multiplier=1.0, randomize_noise=False): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> if layer_idx % 2 == 0: <NEW_LINE> <INDENT> raise ValueError(f'This block ... | Initializes the class with block settings.
Args:
in_channels: Number of channels of the input tensor fed into this block.
out_channels: Number of channels (kernels) of the output tensor.
kernel_size: Size of the convolutional kernel.
stride: Stride parameter for convolution operation.
padding: Padding parame... | 625941ed1d351010ab85604f |
def get_body(msg, url_prefix=''): <NEW_LINE> <INDENT> result = [] <NEW_LINE> for part in get_text_payloads(msg): <NEW_LINE> <INDENT> result.append(adjust_image_tags(part, msg, url_prefix)) <NEW_LINE> <DEDENT> return result | Returns the mail body as HTML string. All text parts of a multipart
message are returned. | 625941edd268445f265b53a3 |
def calculate(request): <NEW_LINE> <INDENT> log = logging.getLogger('test1') <NEW_LINE> data = json.loads(request.body) <NEW_LINE> t = get_template('xml/mesmer.xml') <NEW_LINE> xml = t.render(Context(data)) <NEW_LINE> filename = ("%s_%s" % (str(time.time()), data.get('title'))).replace(' ', '_') <NEW_LINE> filepath = ... | @param request:
@return: | 625941ede76e3b2f99f3ad36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.