code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def execute(self, context): <NEW_LINE> <INDENT> if not (0x00 <= self.object_id <= 0xff): <NEW_LINE> <INDENT> return self.do_exception(ModbusExceptions.IllegalValue) <NEW_LINE> <DEDENT> if not (0x00 <= self.read_code <= 0x04): <NEW_LINE> <INDENT> return self.do_exception(ModbusExceptions.IllegalValue) <NEW_LINE> <DEDENT...
Run a read exception status request against the store :param context: The datastore to request from :returns: The populated response
625941d08da39b475bd650f2
def get_annotation(self, name, id, **query_props): <NEW_LINE> <INDENT> resp = self._mexe("annotations/%s/%s" % (name,id), method="GET", query_props=query_props) <NEW_LINE> return Annotation.from_dict(self, resp)
Get a specific annotation event by ID
625941d04e696a04525c95c9
def is_int(number_float): <NEW_LINE> <INDENT> return number_float == int(number_float)
return whether the float can be expressed as an int
625941d023e79379d52ee6e1
def seeing_at_pointing(zenith_seeing, altitude): <NEW_LINE> <INDENT> X = altitude_to_airmass(altitude) <NEW_LINE> return zenith_seeing * (X**(3. / 5.))
Convert zenith seeing to seeing at current altitude by multiplying by X^3/5
625941d0dd821e528d63b326
def test_sysinfo_json(self): <NEW_LINE> <INDENT> j = json.loads('{"name": "sysinfo", "data": {"totalram": 1040621568, "mem_unit": 1}}') <NEW_LINE> c1 = wassail.check.memory.physical_size(1*1024*1024*1024) <NEW_LINE> r1 = c1.check(j) <NEW_LINE> self.assertEqual(r1.issue, wassail.issue_t.YES) <NEW_LINE> c2 = wassail.chec...
sysinfo json input
625941d0adb09d7d5db6c90d
def __init__(self, graph=None, mapping=None, attribute=None, title="Plot", root=None, showAxes=False): <NEW_LINE> <INDENT> self.og = graph <NEW_LINE> self._setGraphData() <NEW_LINE> self.attribute = attribute <NEW_LINE> self.title = title <NEW_LINE> self._setRoot(root) <NEW_LINE> self.showAxes = showAxes
constructor for GraphViewer This function is the constructor for the GraphViewer graph: A NetworkX graph containing the vascular structure. If not None this has precedence over fname. mapping: A dictionary with keys equal to edge labels and values correpsonding to color to draw the edge (and related items wit...
625941d0be383301e01b5602
def get_chain_by_id(db, pcid): <NEW_LINE> <INDENT> meta, conn = db <NEW_LINE> tbl_pc = meta.tables[__table_proxychains] <NEW_LINE> with conn.begin(): <NEW_LINE> <INDENT> sel = sql.select([tbl_pc.c.pcid, tbl_pc.c.description, ]). where(sql.and_(tbl_pc.c.deleted==False, tbl_pc.c.pcid==pcid)) <NEW_LINE> ent...
return a chain
625941d030dc7b7665901ae4
def noiseReset(fx): <NEW_LINE> <INDENT> sfxNodes = getNodeNames(fx, 0) <NEW_LINE> lib.printInfo("Recompiling material") <NEW_LINE> materials = getMaterials() <NEW_LINE> for mat in materials: <NEW_LINE> <INDENT> stateId = getId(mat, sfxNodes.stateNodeName) <NEW_LINE> cmds.shaderfx(sfxnode=mat, edit_bool=(stateId, "value...
Turn off and reset noise parameters to their defaults Args: fx (MNPR_FX): MNPR_FX object coming from the caller
625941d0baa26c4b54cb129d
@use_fallback_value(0) <NEW_LINE> def parse_rank_points(r): <NEW_LINE> <INDENT> return int(r.get("wedPunt", 0))
Used to parse the amount of points collected based on one's W/L/D.
625941d0507cdc57c6306e5a
def meth6(self): <NEW_LINE> <INDENT> print (self.bla) <NEW_LINE> try: <NEW_LINE> <INDENT> print (self.blip) <NEW_LINE> <DEDENT> except UndefinedName: <NEW_LINE> <INDENT> print (self.blip) <NEW_LINE> <DEDENT> print (self.blip)
test TRY/EXCEPT sub-block re-enabling
625941d031939e2706e4cfe7
def energy_n(molecule): <NEW_LINE> <INDENT> en = 0 <NEW_LINE> for i in range(len(molecule)): <NEW_LINE> <INDENT> for j in range(i+1,len(molecule)): <NEW_LINE> <INDENT> atomi = molecule[i] <NEW_LINE> atomj = molecule[j] <NEW_LINE> Ri = np.asarray(atomi.R) <NEW_LINE> Rj = np.asarray(atomj.R) <NEW_LINE> en += atomi.Z * at...
Compute nuclear energy (classical nucleus-nucleus repulsion) INPUT: MOLECULE: molecule, as a collection of atoms OUTPUT: ENERGY_N: Nuclear energy
625941d007f4c71912b11601
def test_prf_average_compat(): <NEW_LINE> <INDENT> y_true = [1, 2, 3, 3] <NEW_LINE> y_pred = [1, 2, 3, 1] <NEW_LINE> for metric in [precision_score, recall_score, f1_score, partial(fbeta_score, beta=2)]: <NEW_LINE> <INDENT> score = assert_warns(DeprecationWarning, metric, y_true, y_pred) <NEW_LINE> score_weighted = ass...
Ensure warning if f1_score et al.'s average is implicit for multiclass
625941d07cff6e4e81117b04
def Output_to_Python(self): <NEW_LINE> <INDENT> parg, bindex = self.pargs <NEW_LINE> return f'print({parg.name}[{bindex}], end=" ")'
Syntax conversion for printing a parg.
625941d0004d5f362079a4b1
def assertEqualItems(self, expected, actual): <NEW_LINE> <INDENT> v = current_version() <NEW_LINE> if v >= (3, 2): <NEW_LINE> <INDENT> self.assertCountEqual(expected, actual) <NEW_LINE> <DEDENT> if (2, 7) <= v < (3, 0): <NEW_LINE> <INDENT> self.assertItemsEqual(expected, actual) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN...
Assert that two sequences contain the same elements, regardless of the ordering. `assertItemsEqual()` is a 2.7 unittest function. In 3.2 it's called `assertCountEqual()`. This override is made to work for all versions, also 3.0-3.1.
625941d030bbd722463cbf44
def New(*args, **kargs): <NEW_LINE> <INDENT> obj = itkSignedDanielssonDistanceMapImageFilterIF3IF3.__New_orig__() <NEW_LINE> import itkTemplate <NEW_LINE> itkTemplate.New(obj, *args, **kargs) <NEW_LINE> return obj
New() -> itkSignedDanielssonDistanceMapImageFilterIF3IF3 Create a new object of the class itkSignedDanielssonDistanceMapImageFilterIF3IF3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new obje...
625941d0d18da76e23532655
def optimize_graph(graph, output_node_names, output_graph, tf_version, quantization_dtype=None, skip_op_check=False, strip_debug_ops=False): <NEW_LINE> <INDENT> for output in output_node_names: <NEW_LINE> <INDENT> graph.add_to_collection('train_op', graph.get_operation_by_name(output)) <NEW_LINE> <DEDENT> graph_def = g...
Takes a Python Graph object and optimizes the graph. Args: graph: The frozen graph to optimize. output_node_names: List of output node names. output_graph: The location of the output graph. tf_version: Tensorflow version of the input graph. quantization_dtype: An optional numpy dtype to quantize weights to f...
625941d06e29344779a6278f
def tearDown(self): <NEW_LINE> <INDENT> self.client.drop_database("test_db_flaskr") <NEW_LINE> app.config.from_object('config.DevelopmentConfig')
Destroy Blank Database After each Test
625941d076d4e153a657ecaf
def __init__(self, functions): <NEW_LINE> <INDENT> super(FunctionsPlot, self).__init__() <NEW_LINE> self.functions = functions
Implements 1d-function plots :param functions: dict which maps label of curve to x, y coordinates of points :type functions: dict[str, tuple(array, array)]
625941d073bcbd0ca4b2c1f4
def get_train_data(self): <NEW_LINE> <INDENT> imgs = [] <NEW_LINE> labels = [] <NEW_LINE> filepath = os.path.join(self.dataDir, "train") <NEW_LINE> for dirpath, dirnames, filenames in os.walk(filepath): <NEW_LINE> <INDENT> for i, dirname in enumerate(sorted(dirnames)): <NEW_LINE> <INDENT> for sub_dirpath, sub_dirname, ...
# return: training images path and labels as list
625941d099fddb7c1c9de50f
def autoincrement_tag(last_tag): <NEW_LINE> <INDENT> tokens = last_tag.split('.') <NEW_LINE> r = int(tokens[-1]) + 1 <NEW_LINE> if len(tokens) > 1: <NEW_LINE> <INDENT> return '%s.%s' % ('.'.join(tokens[0:-1]), r) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return str(r)
autoincrement_tag('1') => 2 autoincrement_tag('1.2') => 1.3 autoincrement_tag('1.2.3') => 1.2.4
625941d09f2886367277aa0b
def get_project_root(self): <NEW_LINE> <INDENT> return self.remove_trailing_slash(cdir)
Return the project root and strip trailng slash
625941d0cc0a2c11143dd00f
def _get_action(p_network, obs_n, index=None, device='cpu'): <NEW_LINE> <INDENT> if index is None: <NEW_LINE> <INDENT> p_input = obs_n <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p_input = obs_n[index] <NEW_LINE> <DEDENT> p = p_network(p_input) <NEW_LINE> num_act = p.size()[1] <NEW_LINE> act_pdtype = SoftCategoricalP...
Return the action computed by p_network. Parameters ---------- p_network : torch.nn.Module The model which is used to compute action taken by the agent. obs_n : list Each element is a tensor with size [batch_size, num_local_observation]. index : index, optional The index of the current agent, which is used...
625941d06fb2d068a760f21c
def build_response(self): <NEW_LINE> <INDENT> final_response = { 'version' : '1.0', 'response' : { 'outputSpeech': { 'type' : 'SSML', 'ssml' : '<speak>' + self.speech_text + '</speak>' }, 'shouldEndSession' : self.end_session } } <NEW_LINE> if self.reprompt_text: <NEW_LINE> <INDENT> final_response['response']['reprompt...
Build Alexa response and return
625941d04f88993c3716c1e5
def test_capture_server(self): <NEW_LINE> <INDENT> job_hist_duration = "12:00:00" <NEW_LINE> attr_list = {"job_history_enable": "True", "job_history_duration": job_hist_duration} <NEW_LINE> self.server.manager(MGR_CMD_SET, SERVER, attr_list) <NEW_LINE> num_daemon_logs = 2 <NEW_LINE> num_acct_logs = 5 <NEW_LINE> with PB...
Test the 'capture_server' interface of PBSSnapUtils
625941d023849d37ff7b320d
def calc_w_correl(self, f1, f2): <NEW_LINE> <INDENT> if len(f1) != len(f2): <NEW_LINE> <INDENT> err = "calc_w_correl(): data sizes not equal({} and {})".format( len(f1), len(f2)) <NEW_LINE> self.log.error(err) <NEW_LINE> raise SSAErrorDataRange(err) <NEW_LINE> <DEDENT> self.log.debug("calc_w_correl(): f1:{}".format(f1)...
calculate omega-correlation of array-like f1, f2 Vectors should have the same size. @param f1 - vector a @param f2 - vector b
625941d06e29344779a62790
def forwardStep(self,pt,step): <NEW_LINE> <INDENT> print("Integrator.forwardStep needs to be defined") <NEW_LINE> return Point()
The "forwards step" method, overwritten in the actual integrators.
625941d0be7bc26dc91cd77d
def __init__(self, task): <NEW_LINE> <INDENT> self.task = task <NEW_LINE> self.status = None <NEW_LINE> self.execution_timeout = None <NEW_LINE> self.spawner_handle = None <NEW_LINE> self.spawning_result = None <NEW_LINE> self.dependencies = []
Instantiates a new RuntimeTask. :param task: The task to keep additional information about :type task: :class:`avocado.core.nrunner.Task`
625941d07d847024c06be43b
def fill_random_numbers(self): <NEW_LINE> <INDENT> i = 0 <NEW_LINE> j = 0 <NEW_LINE> while i < self.tableWidget.columnCount(): <NEW_LINE> <INDENT> while j <= self.tableWidget.rowCount(): <NEW_LINE> <INDENT> random_num = randint(0, 101) <NEW_LINE> self.tableWidget.setItem(i, j, QTableWidgetItem(str(random_num))) <NEW_LI...
заполняем таблицу случайными числами :return:
625941d0566aa707497f46e6
def __capture_process_booking_state_machine(self, event: Dict = None): <NEW_LINE> <INDENT> logger.debug("Capturing input from process booking state machine") <NEW_LINE> logger.debug(event) <NEW_LINE> customer_id = event.get("customerId", "UNDEFINED") <NEW_LINE> booking_id = event.get("bookingId", "UNDEFINED") <NEW_LINE...
Captures process booking state machine input for annotation and metadata Parameters ---------- event : dict Process Booking State Machine
625941d0d10714528d5ffe63
def get_standard_flat(debug=False): <NEW_LINE> <INDENT> warnings.warn(f'\nUsing flat map from Sept2021. Update if changed\n') <NEW_LINE> dmfits_file = '/darkdata/kkdavis/mec/Sept2021sci/dm_data/dm00disp00/dm00disp00_11:25:17.842164902.fits' <NEW_LINE> from astropy.io import fits <NEW_LINE> hdul = fits.open(dmfits_file)...
Load a standard SCExAO DM flat map from a fits file
625941d0f548e778e58cd6fc
def print(self, *values, file=sys.stdout, **kwargs): <NEW_LINE> <INDENT> orig_fileno = None <NEW_LINE> if file is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> file.fileno() <NEW_LINE> <DEDENT> except io.UnsupportedOperation: <NEW_LINE> <INDENT> orig_fileno = file.fileno <NEW_LINE> file.fileno = lambda: None <...
Highlights and prints the values to a stream, or to `sys.stdout` by default. It calls :func:`prompt_toolkit.print_formatted_text` internally and takes the same keyword arguments as it (compatible with the builtin :func:`print`). Default values of keyword-only arguments:: print(*values, sep=' ', end='\n', file=sys...
625941d007d97122c4178a0b
def variance(self, weighted=False): <NEW_LINE> <INDENT> posterior_particles = self.posterior_particles() <NEW_LINE> posterior_weights = self.posterior_weights() <NEW_LINE> expected_value = self.expectation(weighted) <NEW_LINE> if weighted: <NEW_LINE> <INDENT> modified_weights = (posterior_weights / posterior_weights.su...
The variance of the posterior # from https://statweb.stanford.edu/~owen/mc/Ch-var-is.pdf :param weighted: :return:
625941d097e22403b379d118
def load(self, mdl_file): <NEW_LINE> <INDENT> import dill as pickle <NEW_LINE> mdl_file_e = op.expanduser(mdl_file) <NEW_LINE> sv = pickle.load(open(mdl_file_e, "rb")) <NEW_LINE> self.mdl = sv['mdl'] <NEW_LINE> self.modelparams.update(sv['modelparams']) <NEW_LINE> logger.debug("loaded model from path: " + mdl_file_e)
load model from file. fv_type is not set with this function. It is expected to set it before.
625941d01f037a2d8b94637c
def extend(self, handler): <NEW_LINE> <INDENT> uuid = LENSE.OBJECTS.getattr(handler, 'uuid') <NEW_LINE> for k,v in { 'manifest': self.get_manifest(uuid) }.iteritems(): <NEW_LINE> <INDENT> self.log('Extending handler {0} attributes -> {1}={2}'.format(uuid,k,v), level='debug', method='extend') <NEW_LINE> LENSE.OBJECTS.se...
Construct extended handler attributes. :param user: The handler object to extend :type user: APIHandler :rtype: APIHandler
625941d0fff4ab517eb2f5bb
def test_get_an_action_line(chart): <NEW_LINE> <INDENT> chart.infile = open(chart.infilename) <NEW_LINE> chart.compile_iso_date() <NEW_LINE> chart._get_a_line() <NEW_LINE> while len(chart.curr_line) == 10: <NEW_LINE> <INDENT> chart._get_a_line() <NEW_LINE> <DEDENT> assert chart.curr_line == 'action: Y, time: 23:45'
Get second input line that starts with a date
625941d056b00c62f0f147d8
def img_wrapper(name, id): <NEW_LINE> <INDENT> ii = vtk_utils.image_wrapper(os.path.join(params.dti_path, name), id) <NEW_LINE> return ii
Helper function to load vtk nifti files
625941d023849d37ff7b320e
def drawrects(rects, drawrect, isCan=False, makecopy=False): <NEW_LINE> <INDENT> if not isCan: <NEW_LINE> <INDENT> rects = rect2canrects(rects) <NEW_LINE> <DEDENT> elif makecopy: <NEW_LINE> <INDENT> rects = rects[:] <NEW_LINE> <DEDENT> def key(rect): <NEW_LINE> <INDENT> (i,j,k,x1,x2,y) = rect <NEW_LINE> return (x1,j) <...
Draws rectangles from a list of rectangles (computing their y offsets) using drawrect Arguments: rects: list of rectangles corresponding to tasks - each rectangle is a tuple (i,j,k,x1,x2,y) -- i: task number (obs. task number tasks is the idle task) -- j: machine number -- k: configuration number -- x1: initial time o...
625941d0046cf37aa974cec6
def setDescription(self, description): <NEW_LINE> <INDENT> return _DataModel.AuxSource_setDescription(self, description)
setDescription(AuxSource self, std::string const & description)
625941d032920d7e50b2834f
def gaussfit(x, y): <NEW_LINE> <INDENT> def gauss(x, *p): <NEW_LINE> <INDENT> A, mu, sigma = p <NEW_LINE> return A * np.exp(-(x - mu)**2 / (2. * sigma**2)) <NEW_LINE> <DEDENT> A_guess = max(y) <NEW_LINE> peakpos = np.where(y == A_guess)[0] <NEW_LINE> mu_guess = x[peakpos] <NEW_LINE> halfmax = np.where(y > A_guess / 3.0...
Attempt to fit a 1D gaussian to the input data. y = Gaussian(x) Returns array with [Peak, mu, sigma]
625941d00383005118ecf761
def create_dummy_translations(in_po, out_po, verbose): <NEW_LINE> <INDENT> pofile = polib.pofile(in_po) <NEW_LINE> for entry in pofile: <NEW_LINE> <INDENT> entry.msgstr = entry.msgid[::-1] <NEW_LINE> if verbose: <NEW_LINE> <INDENT> print ('Setting translation of "%s" to "%s"' %(entry.msgid, entry.msgstr)) <NEW_LINE> <D...
Take the input po file and set the translations to be the reverse of the original string and write the results to a new po_file Args: in_po : the source .po out_po : the po file where the dummy translations are to be written verbose: let the user know what's going on...
625941d0596a897236089c3f
def _env_for_arch(self, arch): <NEW_LINE> <INDENT> env = {} <NEW_LINE> env['MORPH_ARCH'] = arch <NEW_LINE> if arch == 'x86_32': <NEW_LINE> <INDENT> cpu = 'i686' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cpu = arch <NEW_LINE> <DEDENT> if arch.startswith('arm'): <NEW_LINE> <INDENT> abi = 'eabi' <NEW_LINE> <DEDENT> el...
Set build environment variables specific to the target machine These are entirely controlled by the 'arch' field in the system morphology, which is passed to the morphologies as MORPH_ARCH to do what they like with.
625941d04e696a04525c95ca
def fetch_smith_2009(data_dir=None, url=None, resume=True, verbose=1): <NEW_LINE> <INDENT> if url is None: <NEW_LINE> <INDENT> url = "http://www.fmrib.ox.ac.uk/analysis/brainmap+rsns/" <NEW_LINE> <DEDENT> files = [('rsn20.nii.gz', url + 'rsn20.nii.gz', {}), ('PNAS_Smith09_rsn10.nii.gz', url + 'PNAS_Smith09_rsn10.nii.gz...
Download and load the Smith ICA and BrainMap atlas (dated 2009) Parameters ---------- data_dir: string, optional Path of the data directory. Use to forec data storage in a non- standard location. Default: None (meaning: default) url: string, optional Download URL of the dataset. Overwrite the default URL. ...
625941d0ab23a570cc250301
def __str__(self): <NEW_LINE> <INDENT> return "Diary entry for {}, plan {}".format(self.datetime, self.plan.pk)
Return a more human-readable representation
625941d076d4e153a657ecb0
def __init__(self, name, coap_server=None, visible=True, observable=True, allow_children=True): <NEW_LINE> <INDENT> self._attributes = {} <NEW_LINE> self.name = name <NEW_LINE> self.path = None <NEW_LINE> self._visible = visible <NEW_LINE> self._observable = observable <NEW_LINE> if self._observable: <NEW_LINE> <INDENT...
Initialize a new Resource. :param name: the name of the resource. :param coap_server: the server that own the resource :param visible: if the resource is visible :param observable: if the resource is observable :param allow_children: if the resource could has children
625941d0a934411ee3751812
def show_menu(): <NEW_LINE> <INDENT> print('*' * 6 + '菜单' + '*' * 6) <NEW_LINE> for (index, menu) in enumerate(Menus): <NEW_LINE> <INDENT> print(' ' * 3 + '(' + str(index + 1) + '): ' + menu + ' ' * 3)
Show the main menu for user to select the option.
625941d0cc40096d61595acf
@register.simple_tag <NEW_LINE> def archives(): <NEW_LINE> <INDENT> return Post.objects.dates('created_time', 'month', order='DESC')
归档模版标签 created_time:Post 的创建时间 month:精度 order='DESC':表明降序排列(即离当前越近的时间越排在前面) :return:
625941d0956e5f7376d70feb
def parse_literal_number(lexer): <NEW_LINE> <INDENT> token, tag = lexer.get_next_token() <NEW_LINE> if tag != 'INT': <NEW_LINE> <INDENT> raise ParseError('Expected an integer literal') <NEW_LINE> <DEDENT> return get_integer_value(token, 0, 0xffffffff)
Parse one LiteralNumber operand.
625941d07b180e01f3dc497b
def test_storing_averaging_sensor(self): <NEW_LINE> <INDENT> sc = cchrc.sensors.SensorContainer() <NEW_LINE> smp_sensor = MyTestSensor('X1', 'Y1') <NEW_LINE> avg_sensor = cchrc.sensors.AveragingSensor(smp_sensor) <NEW_LINE> sc.put(avg_sensor, 'Z1', interval=900) <NEW_LINE> self.assertTrue(75 in sc._SensorContainer__sbs...
Ensure an averaging sensor is stored properly
625941d076e4537e8c3517f2
def _compute_reward(self, is_trapped, collision): <NEW_LINE> <INDENT> state_reward = self._compute_free_energy(self.state) if self.done else 0 <NEW_LINE> collision_penalty = self.collision_penalty if collision else 0 <NEW_LINE> actual_trap_penalty = -floor(len(self.seq) * self.trap_penalty) if is_trapped else 0 <NEW_LI...
Computes the reward for a given time step For every timestep, we compute the reward using the following function: .. code-block:: python reward_t = state_reward + collision_penalty + actual_trap_penalty The :code:`state_reward` is only computed at the end of the episode (Gibbs fre...
625941d0bd1bec0571d907ae
def populate(function, times): <NEW_LINE> <INDENT> for t in range(times): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> function() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass
Esegue la funzione data "times" volte
625941d030bbd722463cbf45
def effective_adapting_responses( xez: ArrayLike, Y_o: FloatingOrArrayLike, E_o: FloatingOrArrayLike ) -> NDArray: <NEW_LINE> <INDENT> xez = as_float_array(xez) <NEW_LINE> Y_o = as_float_array(Y_o) <NEW_LINE> E_o = as_float_array(E_o) <NEW_LINE> RGB_o = ( (Y_o[..., np.newaxis] * E_o[..., np.newaxis]) / (100 * np.pi) ) ...
Derive the effective adapting responses in the fundamental primary system of the test or reference field. Parameters ---------- xez Intermediate values :math:`\xi`, :math:`\eta`, :math:`\zeta`. Y_o Luminance factor :math:`Y_o` of achromatic background as percentage normalised to domain [18, 100] in **'Refe...
625941d05fc7496912cc3afd
def schedule_list(bart_api_key): <NEW_LINE> <INDENT> url = urls.schedule_list(bart_api_key) <NEW_LINE> soup, encoding = _make_request(url) <NEW_LINE> new_schedules = [] <NEW_LINE> for sched in soup.find_all('schedule'): <NEW_LINE> <INDENT> new_schedules.append(schedules.schedule(sched, encoding)) <NEW_LINE> <DEDENT> re...
List bart schedules bart_api_key : Use api key for request
625941d026068e7796caee5f
def initialize_weights(training_points): <NEW_LINE> <INDENT> result={} <NEW_LINE> weight=make_fraction(1,len(training_points)) <NEW_LINE> for point in training_points: <NEW_LINE> <INDENT> result[point]=weight <NEW_LINE> <DEDENT> return result
Assigns every training point a weight equal to 1/N, where N is the number of training points. Returns a dictionary mapping points to weights.
625941d099cbb53fe6792d65
def generate_callback_handler(self, c_function): <NEW_LINE> <INDENT> c_callback_type = c_function.c_ret_type <NEW_LINE> dart_callback_type = self.type_map[c_callback_type] <NEW_LINE> c_arguments = list() <NEW_LINE> dart_handle_arguments_array = list() <NEW_LINE> if c_callback_type in self.callback_arg_exceptions: <NEW_...
Generates a C GLFW callback handler for a glfwSet*Callback function. Args: c_function: A CFunction object. Returns: A C handler function for a GLFW callback.
625941d0f9cc0f698b14077a
def Directions_Task_Tbl(): <NEW_LINE> <INDENT> layout = [ [ sg.Text( "First select a .xlsx file with program,\n" + "project and task information\n" + "in the following schema:\n" + "\n(see: test_task_list.xlsx for example)\n", text_color=ACCENT_COLOR, font=("current 16"), ) ], [sg.Image(TASK_LIST_PIC)], [sg.T("")], [sg...
Instruction prompt for importing task list
625941d0d53ae8145f87a3ee
def update_server(self, server_id, name=None, meta=None, access_ip_v4=None, access_ip_v6=None, disk_config=None): <NEW_LINE> <INDENT> post_body = {} <NEW_LINE> if meta is not None: <NEW_LINE> <INDENT> post_body['metadata'] = meta <NEW_LINE> <DEDENT> if name is not None: <NEW_LINE> <INDENT> post_body['name'] = name <NEW...
Updates the properties of an existing server. server_id: The id of an existing server. name: The name of the server. personality: A list of files to be injected into the server. access_ip_v4: The IPv4 access address for the server. access_ip_v6: The IPv6 access address for the server.
625941d0e8904600ed9f20ad
def __str__(self): <NEW_LINE> <INDENT> return '{} GPSIESRawTrack({}) title={} time={} distance={} public={}'.format( id(self), self.track_id, self.title, self.time, self.distance, self.public)
Self speaking. Returns: str()
625941d0d7e4931a7ee9e09d
def fetch_popular_shows(self): <NEW_LINE> <INDENT> popular_shows = [] <NEW_LINE> data = getURL(self.url, session=self.session, params=self.params, headers={'Referer': 'http://akas.imdb.com/'}) <NEW_LINE> if not data: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> with bs4_parser(data) as soup: <NEW_LINE> <INDENT> ...
Get popular show information from IMDB
625941d097e22403b379d119
def repatching(y_predict_rgb, patch_noise,h): <NEW_LINE> <INDENT> noise = [-100.,-100.,-100.] <NEW_LINE> p_n = patch_to_vector(patch_noise) <NEW_LINE> i=0 <NEW_LINE> for n in range(p_n.shape[0]): <NEW_LINE> <INDENT> if (p_n[n]-noise).any() == False: <NEW_LINE> <INDENT> p_n[n] = y_predict_rgb[i] <NEW_LINE> i=i+1 <NEW_LI...
(np.array)*(np.array)*(int) => (np.array) y_predict_rgb: Predicted value of RGB three channels at noise patch_noise: Patch with noise (including y_train) h: patch width and height
625941d050485f2cf553cf19
def stop(self, channel=1, immediate=False, wait=True): <NEW_LINE> <INDENT> if wait: <NEW_LINE> <INDENT> self.resume_end_of_move_messages() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.suspend_end_of_move_messages() <NEW_LINE> <DEDENT> stopmsg = Message(message.MGMSG_MOT_MOVE_STOP, param1=channel, param2=int(immed...
Stops the motor on the specified channel. If immediate is True, then the motor stops immediately, otherwise it stops in a profiled manner, i.e. decelerates accoding to max acceleration from current velocity down to zero If wait is True, then this method returns only when MGMSG_MOT_MOVE_STOPPED is read, and controller ...
625941d0d4950a0f3b08c4cd
def all_scores(self): <NEW_LINE> <INDENT> if not self.child_history: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return [self.child_history[i].get('score') for i in xrange(0, len(self.child_history))]
None if not available
625941d02c8b7c6e89b3593f
def signal_unbind(self, signal_handler): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> handlers = self._signals[ signal_handler.signal_name] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> signal_handler.function = None <NEW_LINE> try: <NEW_LINE> <INDENT> handl...
Removes a signal binding. This requires the SignalHandler that has been originally returned by signal_bind().
625941d015fb5d323cde0c90
def test_get_organism_list_handle_names_with_spaces(self): <NEW_LINE> <INDENT> self.assertEqual(get_organism_list("Xenopus tropicalis"), ["xenopus_tropicalis"]) <NEW_LINE> self.assertEqual(get_organism_list("Homo sapiens,Mus musculus"), ["homo_sapiens","mus_musculus"])
get_organism_list: handle names with spaces
625941d00c0af96317bb8367
def test_disallow_fallback_packages(self): <NEW_LINE> <INDENT> self.request.locator = MagicMock() <NEW_LINE> version = "1.1" <NEW_LINE> name = "foo" <NEW_LINE> filename = "%s-%s.tar.gz" % (name, version) <NEW_LINE> url = "http://pypi.python.org/pypi/%s/%s" % (name, filename) <NEW_LINE> wheelname = "%s-%s.whl" % (name, ...
Disallow fetch fallback packages
625941d09c8ee82313fbb8f5
def save_data_to_file(data, filename=None): <NEW_LINE> <INDENT> pass
Required method: use this to save data in your file format. This gets called by the editor when the user chooses to save a file. "data" holds the data, and "filename" is the file name. Note, that the filename may be different than what you passed in if the user chooses to "save as/write to" instead of "save" D...
625941d007f4c71912b11602
def air_price(browser, air_list, number): <NEW_LINE> <INDENT> price_line = [] <NEW_LINE> for air in air_list: <NEW_LINE> <INDENT> if air.get_attribute("flightnumbertext") == number: <NEW_LINE> <INDENT> price_line.append(air) <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> all_price = [] <NEW_LINE> price_list = price_line...
对应航线选择最便宜的价格 :param air_list: :param number: :return:
625941d05e10d32532c5f0a6
def has_3_or_more_mongo_nodes(env): <NEW_LINE> <INDENT> return len(env.get_nodes_by_role('mongo')) >= 3
Env has 3 nodes with mongo roles
625941d08a43f66fc4b541e4
def parse_coinc_reg(cr): <NEW_LINE> <INDENT> return np.array([(cr & 1 << i) > 0 for i in range(16)])
Parse the integer coincidence register into an array of booleans. Parameters ---------- cr : int The coincidence register from the VME data. Returns ------- np.array The 16 boolean coincidence register bits.
625941d0d486a94d0b98e2c5
def __init__(self, text=""): <NEW_LINE> <INDENT> super().__init__(text=text)
You know, it's just paragraph with text :)
625941d0435de62698dfddcd
def validate_devices(self, json_config): <NEW_LINE> <INDENT> devices = json_config.keys() <NEW_LINE> try: <NEW_LINE> <INDENT> objectstore = json_config['type'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> if {'data', 'journal'}.issubset(set(devices)): <NEW_LINE> <INDENT> logger.warning( '"type" key not foun...
``json_config`` is the loaded dictionary coming from the JSON file. It is usually mixed with other non-device items, but for sakes of comparison it doesn't really matter. This method is just making sure that the keys needed exist
625941d0a934411ee3751813
def _killall(self): <NEW_LINE> <INDENT> for process in self._processes.values(): <NEW_LINE> <INDENT> logger.info("process: sending SIGTERM to pid={}".format(process.pid)) <NEW_LINE> process.terminate()
Sends a stop (SIGTERM) signal to all worker processes.
625941d05f7d997b87174c18
def get_enrollments(course, base=None, access_token=None): <NEW_LINE> <INDENT> return contact_server(get_all_pages, 'api/v1/courses/{}/enrollments'.format(course), {}, base, access_token)
Lists all enrollments in a given course. Parameters: course: course ID base: optional string, containing the base url of canvas server access_token: optional access token, if different from global one Returns a list of dicts, one for each enrollment
625941d04527f215b584c5d6
def collect_by_prob(prob_name: str): <NEW_LINE> <INDENT> fdb = FileDB() <NEW_LINE> usdb = UserSolvedDB() <NEW_LINE> mdb = ModificationDB() <NEW_LINE> adb = AcceptanceDB() <NEW_LINE> udb = UserDB() <NEW_LINE> classifier = build_mod_classifier_ex(adb, udb) <NEW_LINE> where = {'problem_id': prob_name} <NEW_LINE> ms_fixdat...
問題ごとの集計を行う 問題における中央値や平均の算出も行う 並列実行のため,独立に実行できるようにしたい
625941d082261d6c526ab620
def list(self, dataset_list_query=DatasetListQuery()): <NEW_LINE> <INDENT> listing = self._client.request('GET', '/data', params=dataset_list_query.query_parameters()) <NEW_LINE> return PagedList.from_response( [DatasetSummary(item) for item in listing.get('items', [])], listing)
Get the list of saved datasets, optionally filtering by name :param DatasetListQuery dataset_list_query: query options to limit results of the request :return: a `list` of DatasetSummary objects representing the dataset stored :rtype: list
625941d023e79379d52ee6e3
def heat1d(dt, u_m, u_p, full_soln = False): <NEW_LINE> <INDENT> k = 0.1 <NEW_LINE> mesh_size = 41 <NEW_LINE> deltax = 2/mesh_size <NEW_LINE> C = k*dt/(deltax**2) <NEW_LINE> if u_m.size != u_p.size: <NEW_LINE> <INDENT> raise ValueError('Boundary conditions must be same length') <NEW_LINE> <DEDENT> dt_max = deltax**2/(2...
This function calculates the solution to the heat equation: du/dy = k d^2u/dx^2 where u has domain [-1,1] Parameters ---------- dt : float timestep for problem u_m : np.array Array size [N] specifying left boundary condition u_p : np.array Array size [N] specifying right boundary condition full_soln : bool...
625941d08da39b475bd650f4
def get(self, *args): <NEW_LINE> <INDENT> return self.__mediainfo.get(*args)
Method for geting mediainfo keys; similar to dict.get()
625941d0004d5f362079a4b2
def __init__(self, scr): <NEW_LINE> <INDENT> self.screen = scr <NEW_LINE> self.x, self.y = 1, 1 <NEW_LINE> self.last_screen_dimensions = { "width": int(self.screen.get_width()), "height": int(self.screen.get_height()) } <NEW_LINE> self.saved_positions = {}
Automatically sets the cursor position to x:1, y:1
625941d0dd821e528d63b328
def _run_cmd(self, cmd): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> proc = subprocess.Popen( cmd, shell=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE, ) <NEW_LINE> data = proc.communicate() <NEW_LINE> return data[0] <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> return ''
Cleanly execute the command string
625941d0e5267d203edcde1c
def start_fd_client(self, i, o): <NEW_LINE> <INDENT> self.server = RepceClient(i, o) <NEW_LINE> rv = self.server.__version__() <NEW_LINE> exrv = {'proto': repce.repce_version, 'object': Server.version()} <NEW_LINE> da0 = (rv, exrv) <NEW_LINE> da1 = ({}, {}) <NEW_LINE> for i in range(2): <NEW_LINE> <INDENT> for k, v in ...
set up RePCe client, handshake with server It's cut out as a separate method to let subclasses hook into client startup
625941d0d7e4931a7ee9e09e
def _process_text(image, run_params, session=None): <NEW_LINE> <INDENT> if image.ndim != 1: <NEW_LINE> <INDENT> raise ValueError('The text input should be a 1D numpy array. ' 'Shape of the received input: %s' % str(image.shape)) <NEW_LINE> <DEDENT> if not session: <NEW_LINE> <INDENT> session = utils.restore_model(run_p...
Generates the masked embedding and does a forward pass of the image. Args: image: float numpy array with shape (num_words,), text to be masked. run_params: RunParams with model_type, model_path, image_placeholder_shape, activations, tensor_names, input, first_layer, logits. session: tf.Session, (default No...
625941d0be8e80087fb20dc2
def test_transform_album_album_based_on_artist_album_match(self): <NEW_LINE> <INDENT> album = Album(artist='Artist', album='Album', totaltracks=1, totalseconds=60) <NEW_LINE> transform = Transform(1, cond_artist=True, pattern_artist='Artist', cond_album=True, change_album=True, pattern_album='Album', to_album='Album 2'...
Given an album, transform its album based on matching both the artist and album. Will match the tested album.
625941d029b78933be1e582a
def fair_obj(preds, dtrain): <NEW_LINE> <INDENT> x = preds -dtrain.get_label() <NEW_LINE> c = 1 <NEW_LINE> den = abs(x) + c <NEW_LINE> grad = c*x / den <NEW_LINE> hess = c*c / den ** 2 <NEW_LINE> return grad, hess
y = c * abs(x) - c * np.log(abs(abs(x) + c))
625941d0a4f1c619b28b01b7
def viterbi(A, pobs, pi, dtype=np.float32): <NEW_LINE> <INDENT> T,N = pobs.shape[0], pobs.shape[1] <NEW_LINE> v = np.zeros((N)) <NEW_LINE> psi = np.zeros((T,N), dtype = int) <NEW_LINE> v = pi * pobs[0,:] <NEW_LINE> v /= v.sum() <NEW_LINE> psi[0] = 0.0 <NEW_LINE> for t in range(1,T): <NEW_LINE> <INDENT> vA = np...
Estimate the hidden pathway of maximum likelihood using the Viterbi algorithm. Parameters ---------- A : ndarray((N,N), dtype = float) transition matrix of the hidden states pobs : ndarray((T,N), dtype = float) pobs[t,i] is the observation probability for observation at time t given hidden state i pi : ndarray...
625941d0460517430c394303
def set_health_to(self, new_health): <NEW_LINE> <INDENT> was_enraged = self.health < self.calculate_max_health() <NEW_LINE> diff = new_health - (self.base_health + self.health_delta) <NEW_LINE> for player in self.game.players: <NEW_LINE> <INDENT> for aura in player.object_auras: <NEW_LINE> <INDENT> if aura.match(self) ...
Sets the amount of total health this :class:`Character` has. This will adjust its actual health if necessary :param new_health: An integer specifying what this character's new health should be
625941d0cc40096d61595ad0
def mcl2rawcafe(mcl_dump, path_output_file, species_ids): <NEW_LINE> <INDENT> sps_header = "\t".join(sp_id for sp_id in species_ids) <NEW_LINE> species_ids_dict_0 = dict((sp_id, 0) for sp_id in species_ids) <NEW_LINE> with open(path_output_file, "w") as output_file: <NEW_LINE> <INDENT> output_file.write("Desc\tFamily I...
[str] mcl_dump: path to mcl's dump file [str] path_output_file: path to output .txt file [str] species_ids: unique species identifiers (separated by white spaces, enclosed within double quotes) (e.g., "ENSBTA ENSCJA ENSCAF ENSECA ENSP00 ENSMMU ENSMUS ENSNLE ENSPTR ENSPAN ENSPPY ENSRNO")
625941d0187af65679ca529f
def StartAuth(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
StartAuth is the beginning of the authentication flow. The client sends a username they would like to authenticate as, and the server returns a nonce to hash the password with.
625941d07cff6e4e81117b06
def readLabelDictionary(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> jsonObject = open(globalvars.labelsFileName, "r").read() <NEW_LINE> <DEDENT> except IOError as jsonReadException: <NEW_LINE> <INDENT> print_error(jsonReadException) <NEW_LINE> print_error(errorcodes.ERROR_CANNOT_READ_LABELS_FILE["message"]) <NEW_LI...
readLabelDictionary() Arguments: None This function reads the JSON file containing entity labels to populate the label dictionary.
625941d0004d5f362079a4b3
def _emit(self, task): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.tasks[task.id][1](task) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass
push out task to execute() thread
625941d0f8510a7c17cf987c
def unkline(self, irc, msg, args, nick): <NEW_LINE> <INDENT> channels = [] <NEW_LINE> ops = [] <NEW_LINE> nick = nick.lower() <NEW_LINE> for channel in irc.state.channels: <NEW_LINE> <INDENT> if msg.nick in irc.state.channels[channel].ops: <NEW_LINE> <INDENT> chan = self.getChan(irc, channel) <NEW_LINE> if len(chan.kli...
<nick> request unkline of <nick>, klined recently from your channel
625941d02ae34c7f2600d2b1
def get_event_random_dates(): <NEW_LINE> <INDENT> rand_date_shift = random.randint(1, TOTAL_DAYS) <NEW_LINE> start = MIN_DATE + timedelta(days=rand_date_shift) <NEW_LINE> return start, start + timedelta(days=1)
Each event duration is strictly 1 day. Generating random threshold between desired date and MIN_DATE
625941d076e4537e8c3517f3
def apply_threshold(self, threshold): <NEW_LINE> <INDENT> with torch.no_grad(): <NEW_LINE> <INDENT> new_relu_slopes = super().apply_threshold(threshold) <NEW_LINE> self.coefficients_vect.data = self.iterative_relu_slopes_to_coefficients(new_relu_slopes) .view(-1)
Applies a threshold to the activations, eliminating the relu slopes smaller than a threshold and updates the B-spline coefficients. Operations performed: . [a] = L[c], [a] -> sparsification -> [a_hat]; . [c_hat] = f([a], c_{-L}, c_{-L+1}). This uses a well-conditioned iterative method to convert from the deepReLU rep...
625941d073bcbd0ca4b2c1f6
def __init__(self, filename_dict, directory, num=None, sort=True, sparse=False): <NEW_LINE> <INDENT> if sparse: <NEW_LINE> <INDENT> l_sorted = dict() <NEW_LINE> for k, v in filename_dict.items(): <NEW_LINE> <INDENT> if v not in l_sorted.values(): <NEW_LINE> <INDENT> l_sorted[k] = v <NEW_LINE> <DEDENT> <DEDENT> if sort:...
:param filename_dict: {dict} Dictionary containing file names as keys and ages as values :param directory: {str} path of the folder containing all files given in ``filename_dict`` :param num: {int} number of files to select (for test purposes) :param sort: {bool} whether the images should be selected according to their...
625941d0e1aae11d1e749e38
def minHitPr(moves) : <NEW_LINE> <INDENT> wp = [(prHit(b if not e else reverseBoard(b)),b,e) for b,e in moves] <NEW_LINE> mp = min(wp)[0] <NEW_LINE> return [(b,e) for p,b,e in wp if p == mp]
Prefer moves which lower the probability of getting hit
625941d0a17c0f6771cbe1d0
def overlap_edges(data, length): <NEW_LINE> <INDENT> records = list(SeqIO.parse(data, "fasta")) <NEW_LINE> for record_1 in records: <NEW_LINE> <INDENT> for record_2 in records: <NEW_LINE> <INDENT> name_1, seq_1 = record_1.id, record_1.seq <NEW_LINE> name_2, seq_2 = record_2.id, record_2.seq <NEW_LINE> if seq_1 == seq_2...
Takes FASTA file as input and returns names of sequences that have overalped edges at specified length.
625941d029b78933be1e582b
def get_contins(cur,cell): <NEW_LINE> <INDENT> sql = ("select CON_Number " "from contin " "where CON_AlternateName like '%s'" %cell) <NEW_LINE> cur.execute(sql) <NEW_LINE> return [a[0] for a in cur.fetchall()]
Returns list of all contin names Parameters: ----------- cur : MySQLdb cursors cell : str Cell name
625941d066673b3332b92211
def start(self, connection: Connection): <NEW_LINE> <INDENT> self._conn = connection <NEW_LINE> self.listening_for_events = True <NEW_LINE> self._thread = threading.Thread(target=self._run_thread, daemon=True, name="Event Stream Handler Thread") <NEW_LINE> self._thread.start()
Start listening for events. Automatically called by the :class:`anki_vector.robot.Robot` class. :param connection: A reference to the connection from the SDK to the robot. :param loop: The loop to run the event task on.
625941d0ac7a0e7691ed424b
def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(ThresholdsComb, self).__init__(**kwargs) <NEW_LINE> self.lst_observations = None <NEW_LINE> self.th_max = None <NEW_LINE> self.th_min = None
Creates an analytic comb to impose threshold boundaries on observation values. This comb implements expertise analytics, which means that the results produced by this comb are usually based on domain knowledge of an expert. In this case, the domain knowledge is incorporated in form of known minimum and maximum values ...
625941d0167d2b6e31218d16
def serve_file(load, fnd): <NEW_LINE> <INDENT> if 'env' in load: <NEW_LINE> <INDENT> load.pop('env') <NEW_LINE> <DEDENT> ret = {'data': '', 'dest': ''} <NEW_LINE> if not all(x in load for x in ('path', 'loc', 'saltenv')): <NEW_LINE> <INDENT> return ret <NEW_LINE> <DEDENT> if not fnd['path']: <NEW_LINE> <INDENT> return ...
Return a chunk from a file based on the data received
625941d0ff9c53063f47c373
def getZenRootNode(self): <NEW_LINE> <INDENT> return self.getDmdRoot(self.dmdRootName)
Return the root node for our zProperties.
625941d00fa83653e465713b
def b64d(b): <NEW_LINE> <INDENT> if b.endswith("="): <NEW_LINE> <INDENT> cb = b.split("=")[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cb = b <NEW_LINE> <DEDENT> if not _b64_re.match(cb): <NEW_LINE> <INDENT> raise BadSyntax(cb, "base64-encoded data contains illegal characters") <NEW_LINE> <DEDENT> if cb == b: <NEW...
Decode some base64-encoded bytes. Raises BadSyntax if the string contains invalid characters or padding.
625941d0be7bc26dc91cd77f