code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def export_ksk(valid_ksks, ds_record_filename, dnskey_record_filename): <NEW_LINE> <INDENT> for this_matched_ksk in valid_ksks: <NEW_LINE> <INDENT> dnskey_record_contents = ". IN DNSKEY {flags} {proto} {alg} {keyas64}".format( flags=this_matched_ksk["f"], proto=this_matched_ksk["p"], alg=this_matc... | Takes a list of KSKs; returns nothing but writes out files | 625941d8a934411ee3751909 |
def track(self, distinct_id, event_name, properties={}, meta={}, import_older=False): <NEW_LINE> <INDENT> all_properties = { 'token': self._token, 'distinct_id': distinct_id, 'time': int(self._now()), 'mp_lib': 'python', '$lib_version': VERSION, } <NEW_LINE> all_properties.update(properties) <NEW_LINE> event = { 'event... | Notes that an event has occurred, along with a distinct_id
representing the source of that event (for example, a user id),
an event name describing the event and a set of properties
describing that event. Properties are provided as a Hash with
string keys and strings, numbers or booleans as values.
import_older can be... | 625941d85f7d997b87174d0f |
def getAliases(self): <NEW_LINE> <INDENT> self.curse.execute("SELECT alias, address FROM alias") <NEW_LINE> result = self.curse.fetchall() <NEW_LINE> if result and len(result) > 0: <NEW_LINE> <INDENT> return result <NEW_LINE> <DEDENT> return None | Get all aliases | 625941d815fb5d323cde0d88 |
def initialize_conditions(segment): <NEW_LINE> <INDENT> alt = segment.altitude <NEW_LINE> v0 = segment.air_speed_start <NEW_LINE> vf = segment.air_speed_end <NEW_LINE> ax = segment.acceleration <NEW_LINE> T0 = segment.pitch_initial <NEW_LINE> Tf = segment.pitch_final <NEW_LINE> if alt is None: <NEW_LINE> <INDENT> ... | Sets the specified conditions which are given for the segment type.
Assumptions:
Constant acceleration and constant altitude
Source:
N/A
Inputs:
segment.altitude [meters]
segment.air_speed_start [meters/second]
segment.air_speed_end [meters/second]
segment.acceleration [me... | 625941d8046cf37aa974cfbc |
def asinh(self, value): <NEW_LINE> <INDENT> return sp.asinh(value_checker(value)) | Verilen değeri kullanarak, sumpy.asinh döndürür
:param value: değer
:return: sympy.asinh | 625941d81b99ca400220ad27 |
def fl_image(self, image_func, apply_to=None): <NEW_LINE> <INDENT> if apply_to is None: <NEW_LINE> <INDENT> apply_to = [] <NEW_LINE> <DEDENT> return self.fl(lambda gf, t: image_func(gf(t)), apply_to) | Modifies the images of a clip by replacing the frame
`get_frame(t)` by another frame, `image_func(get_frame(t))` | 625941d87b25080760e396ce |
def isNoneValue(value): <NEW_LINE> <INDENT> if isinstance(value, str): <NEW_LINE> <INDENT> return value in ("None", "") <NEW_LINE> <DEDENT> elif isListLike(value): <NEW_LINE> <INDENT> return all(isNoneValue(_) for _ in value) <NEW_LINE> <DEDENT> elif isinstance(value, dict): <NEW_LINE> <INDENT> return not any(value) <N... | Returns whether the value is unusable (None or '')
>>> isNoneValue(None)
True
>>> isNoneValue('None')
True
>>> isNoneValue('')
True
>>> isNoneValue([])
True
>>> isNoneValue([2])
False | 625941d80383005118ecf857 |
def session_preparation(self) -> None: <NEW_LINE> <INDENT> self._test_channel_read(pattern=r">") <NEW_LINE> self.set_base_prompt() <NEW_LINE> time.sleep(0.3 * self.global_delay_factor) <NEW_LINE> self.clear_buffer() | Prepare the session after the connection has been established. | 625941d8498bea3a759b9d24 |
def connection_qr_code( request, token ): <NEW_LINE> <INDENT> connections = AgentConnection.objects.filter(token=token, connection_type='Outbound').all() <NEW_LINE> if 0 == len(connections): <NEW_LINE> <INDENT> return render(request, 'indy/form_response.html', {'msg': 'No connection found'}) <NEW_LINE> <DEDENT> connect... | Display a QR code for the given invitation. | 625941d8f9cc0f698b14086f |
def test_list(self): <NEW_LINE> <INDENT> CourseFactory() <NEW_LINE> self.assertEqual(Course.objects.count(), 2) <NEW_LINE> response = self.client.get(self.list_path) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertListEqual(response.json()['results'], [self.serialize_course(self.course)]) <... | Verify the view returns a list of Courses. | 625941d86aa9bd52df03701a |
def validate(schema): <NEW_LINE> <INDENT> def decorator(func): <NEW_LINE> <INDENT> def wrapper(self, req, resp, *args, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> jsonschema.validate(req.media, schema) <NEW_LINE> <DEDENT> except jsonschema.ValidationError as e: <NEW_LINE> <INDENT> raise falcon.HTTPBadReques... | Decorator that validates ``req.media`` using JSON Schema
Args:
schema (dict): A dictionary that follows the JSON Schema specification.
See `json-schema.org <http://json-schema.org/>`_ for more
information on defining a compatible dictionary.
Example:
.. code:: python
from falcon.media... | 625941d8236d856c2ad44a52 |
def execute(self, context, **kwargs): <NEW_LINE> <INDENT> if context.source_entity: <NEW_LINE> <INDENT> if context.source_entity["type"] in ["Version", "PublishedFile"]: <NEW_LINE> <INDENT> return "publishedfile_version" <NEW_LINE> <DEDENT> <DEDENT> if context.project is None: <NEW_LINE> <INDENT> return None <NEW_LINE>... | The default implementation assumes there are three environments, called shot, asset
and project, and switches to these based on entity type. | 625941d8796e427e537b083d |
def connect(self): <NEW_LINE> <INDENT> self.server = xmlrpclib.ServerProxy(self.url) <NEW_LINE> self.token = self.server.login(self.username, self.apikey) | Connect to Magento's xmlrpc | 625941d8a05bb46b383eca96 |
def green_mode(project_dir: str, ignore_globs, bears, bear_settings_obj, op_args_limit, value_to_op_args_limit, project_files, printer=None): <NEW_LINE> <INDENT> from coala_quickstart.green_mode.filename_operations import ( check_filename_prefix_postfix) <NEW_LINE> ignore_globs.append(os.path.join(project_dir, '.git', ... | Runs the green mode of coala-quickstart.
Generates '.project_data.yaml' which contains the files and directory
structure of the project, runs the QuickstartBear which guesses some values
of settings the can take an infinite set of values by parsing the
file_dict and appends to `.project_data.yaml`. Runs some further l... | 625941d82c8b7c6e89b35a35 |
def prepare_expression(self, str_val): <NEW_LINE> <INDENT> str_val = str_val.replace(" ", "").replace("\t", "").replace("\n", "").replace("+", " +").replace("-", " -").replace( "=", " = ") <NEW_LINE> expres = str_val.split("=") <NEW_LINE> index = 0 <NEW_LINE> while index < len(expres): <NEW_LINE> <INDENT> expres[index]... | take the string expression
return a well formatted 2 dimensional tab
format expression [+|-|""][0-9*][*X[^[0-9*]]] | 625941d8aad79263cf390cba |
def register_article(self): <NEW_LINE> <INDENT> raise InternalError("Deprecated") | K-Search 에 게시물을 등록하는 함수였으나,
현재 K-Search 가 작동하지 않아 Deprecated. | 625941d899fddb7c1c9de606 |
def _cleanup(): <NEW_LINE> <INDENT> shutil.rmtree(TMPDIR) | Remove temporary files | 625941d897e22403b379d211 |
def test_reset(self): <NEW_LINE> <INDENT> da = DoubleArray(5) <NEW_LINE> da.shrink(2) <NEW_LINE> self.assertEqual(da.length, 2) <NEW_LINE> self.assertEqual(da.alloc, 5) <NEW_LINE> self.assertEqual(len(da.get_npy_array()), 2) | Tests the reset function. | 625941d80c0af96317bb845e |
def camera_controller_delete(self, camera_controller_id=None, path=None): <NEW_LINE> <INDENT> if path == None: <NEW_LINE> <INDENT> path = [] <NEW_LINE> <DEDENT> if camera_controller_id: <NEW_LINE> <INDENT> path.insert(0, camera_controller_id) <NEW_LINE> path.insert(0, "cameracontroller") <NEW_LINE> location = '/'.join(... | Delete a camera controller. | 625941d88e71fb1e9831da1e |
def _IssueURL(job): <NEW_LINE> <INDENT> if job.use_buildbucket: <NEW_LINE> <INDENT> hostname = app_identity.get_default_version_hostname() <NEW_LINE> job_id = job.buildbucket_job_id <NEW_LINE> return 'https://%s/buildbucket_job_status/%s' % (hostname, job_id) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> config = rietv... | Returns a URL for information about a bisect try job. | 625941d8009cb60464c63626 |
def __init__(self, coord=None): <NEW_LINE> <INDENT> self.coord = coord <NEW_LINE> self.kids = [] | Create an abstract syntax tree node | 625941d850812a4eaa59c596 |
def put_exclusive(self, item): <NEW_LINE> <INDENT> if not self.contains(item): <NEW_LINE> <INDENT> self.put(item) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise queue.Full('Duplicate item in queue') | Adds the item to the queue only if unique in the queue.
Args:
item: The object to add to the queue.
Raises:
queue.Full if a duplicate item is in the queue. | 625941d8adb09d7d5db6ca04 |
def on_click(self, upgrade_icon_sprites, sell_tower_icon_sprite): <NEW_LINE> <INDENT> assert isinstance(upgrade_icon_sprites, pygame.sprite.Group), 'upgrade_icon_sprites must be a pygame.sprite.Group() instance' <NEW_LINE> upgrade_icon_sprites.empty() <NEW_LINE> sell_tower_icon_sprite.empty() <NEW_LINE> various_upgrade... | :param upgrade_icon_sprites: pygame.sprite.Group, contains all three upgrade icons in the game
:return: None, upgrade_icon_sprites is changed here to include the three upgrade sprite
Fills the upgrade_icon_sprite group with the upgrade icon sprites associated with this tower. If upgrade is already at max, show nothing | 625941d8596a897236089d34 |
def copyfile(src: str, dst: str) -> None: <NEW_LINE> <INDENT> if _samefile(src, dst): <NEW_LINE> <INDENT> raise Error("`%s` and `%s` are the same file" % (src, dst)) <NEW_LINE> <DEDENT> for fn in [src, dst]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> st = os.stat(fn) <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <IN... | Copy data from src to dst | 625941d8f9cc0f698b140870 |
def policy_iteration_sync(env, gamma, max_iterations=int(1e3), tol=1e-3): <NEW_LINE> <INDENT> policy = np.zeros(env.nS, dtype='int') <NEW_LINE> value_func = np.zeros(env.nS) <NEW_LINE> return policy, value_func, 0, 0 | Runs policy iteration.
See page 85 of the Sutton & Barto Second Edition book.
You should use the improve_policy() and evaluate_policy_sync() methods to
implement this method.
Parameters
----------
env: gym.core.Environment
The environment to compute value iteration for. Must have nS,
nA, and P as attributes.
gam... | 625941d86fb2d068a760f316 |
def output(x_tensor, num_outputs): <NEW_LINE> <INDENT> print (x_tensor.shape, num_outputs) <NEW_LINE> output_tensor = tf.layers.dense(x_tensor, units=num_outputs, activation=None) <NEW_LINE> print (output_tensor.shape) <NEW_LINE> return output_tensor | Apply a output layer to x_tensor using weight and bias
: x_tensor: A 2-D tensor where the first dimension is batch size.
: num_outputs: The number of output that the new tensor should be.
: return: A 2-D tensor where the second dimension is num_outputs. | 625941d8b5575c28eb68e278 |
def clearMemory(self): <NEW_LINE> <INDENT> self.sendMessage(b'SPIE') <NEW_LINE> self.pause() <NEW_LINE> reply = self.getResponse(timeout=10) <NEW_LINE> if reply.startswith(b'FRMT'): <NEW_LINE> <INDENT> logging.info("BBTK.clearMemory(): " "Starting full format of BBTK memory") <NEW_LINE> <DEDENT> elif reply.startswith(b... | Clear the stored data from a previous run.
This should be done before collecting a further timing data | 625941d84c3428357757c59d |
def test_worker_update_not_exists(self): <NEW_LINE> <INDENT> self.assertRaises(exception.WorkerNotFound, db.worker_update, self.ctxt, 1) | Test worker update when the worker doesn't exist. | 625941d88c0ade5d55d3ec32 |
def wages1(path): <NEW_LINE> <INDENT> import pandas as pd <NEW_LINE> path = os.path.expanduser(path) <NEW_LINE> filename = 'wages1.csv' <NEW_LINE> if not os.path.exists(os.path.join(path, filename)): <NEW_LINE> <INDENT> url = 'http://dustintran.com/data/r/Ecdat/Wages1.csv' <NEW_LINE> maybe_download_and_extract(path, ur... | Wages, Experience and Schooling
a panel of 595 observations from 1976 to 1982
*number of observations* : 3294
*observation* : individuals
*country* : United States
A time serie containing :
exper
experience in years
sex
a factor with levels (male,female)
school
years of schooling
wage
wage (in ... | 625941d83346ee7daa2b2fe3 |
def weight(n,order): <NEW_LINE> <INDENT> y=ones((n,1),'complex') <NEW_LINE> return y | weight function of the numerical integration | 625941d826068e7796caef58 |
def __init__(self): <NEW_LINE> <INDENT> self.actions = [ BotCreate(), BotDelete(), BotList(), ExchangeCreate(), ExchangeDelete(), ExchangeList(), UserCreate(), UserDelete(), UserList() ] <NEW_LINE> self.login = Login() <NEW_LINE> self.parser = None <NEW_LINE> self.subparser = None <NEW_LINE> self.subparsers = [] <NEW_L... | Add new actions here to have them included automatically
Sets up class variables for the parsers, subparsers array has the filled parsers for each action
Set up all the actions in the parsers and then execute the correct action | 625941d8cc0a2c11143dd107 |
def chooser_item_changed(self, index): <NEW_LINE> <INDENT> label_value1 = "" <NEW_LINE> label_value2 = self._("Arguments") <NEW_LINE> state_value2 = False <NEW_LINE> visible_value2 = True <NEW_LINE> state_type = False <NEW_LINE> if index == 0 or index == 1: <NEW_LINE> <INDENT> if index == 0: <NEW_LINE> <INDENT> label_v... | Item type is changed. | 625941d8ec188e330fd5aa11 |
def __init__(self, x, y, w, h, text=''): <NEW_LINE> <INDENT> self.rect = pg.Rect(x, y, w, h) <NEW_LINE> self.colour = self.COLOUR_INACTIVE <NEW_LINE> self.default_text = text <NEW_LINE> self.text = text <NEW_LINE> self.txt_surface = self.fonts.font_small.render(text, True, self.colour) <NEW_LINE> self.active = False <N... | box for user input | 625941d876e4537e8c3518ea |
def test_10_destroy_cpvm(self): <NEW_LINE> <INDENT> list_cpvm_response = list_ssvms( self.apiclient, systemvmtype='consoleproxy', zoneid=self.zone.id ) <NEW_LINE> self.assertEqual( isinstance(list_cpvm_response, list), True, "Check list response returns a valid list" ) <NEW_LINE> cpvm_response = list_cpvm_response[0] <... | Test destroy CPVM
| 625941d84a966d76dd551287 |
def _timeForNewCard(self): <NEW_LINE> <INDENT> if not self.newCount: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if self.deck.qconf['newSpread'] == NEW_CARDS_LAST: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> elif self.deck.qconf['newSpread'] == NEW_CARDS_FIRST: <NEW_LINE> <INDENT> return True <NEW_LIN... | True if it's time to display a new card when distributing. | 625941d80a366e3fb873ea92 |
def test_sample_285(self): <NEW_LINE> <INDENT> self.assertTrue(True) | passed template | 625941d8f8510a7c17cf9973 |
def parseURL(self, urltext): <NEW_LINE> <INDENT> if urltext.upper().find("MOUSER.COM") == -1 and urltext.upper().find("MOUSER.CH") == -1: <NEW_LINE> <INDENT> raise NotMatchingHeader("No Mouse identifier detected") <NEW_LINE> <DEDENT> uag = self.ua.random <NEW_LINE> user_agent = {'user-agent': uag} <NEW_LINE> ... | the urltext is used to fetch the web page content and
harvest the datasheet link from it. it does not work all the
time as there are some ambiguities, but works reasonably well
by parsing simple textual data. | 625941d88e7ae83300e4b243 |
def main(): <NEW_LINE> <INDENT> argument_spec = dict( backup=dict(default=False, type='bool'), config=dict(type='str'), commit=dict(type='bool'), replace=dict(type='str'), rollback=dict(type='int'), commit_comment=dict(type='str'), defaults=dict(default=False, type='bool'), multiline_delimiter=dict(type='str'), diff_re... | main entry point for execution
| 625941d8ac7a0e7691ed433f |
def inverse_kinematics_grad_descent(theta0, goal, angle_tol=1 * DEG, position_tol=1): <NEW_LINE> <INDENT> theta0 = robot.get_theta() <NEW_LINE> p0 = fk(theta0) <NEW_LINE> J = numpy.zeros((6, 6)) <NEW_LINE> theta = theta0 <NEW_LINE> p = p0.copy() <NEW_LINE> delta_p = goal - p <NEW_LINE> fmt = '%10.4f' <NEW_LINE> if (lin... | find angles to put hand at position goal | 625941d8f8510a7c17cf9974 |
def create_grid_map(): <NEW_LINE> <INDENT> grd = {6: (7, 0), 7: (7, 2), 8: (7, 4), 9: (7, 6), 12: (6, 1), 13: (6, 3), 14: (6, 5), 15: (6, 7), 17: (5, 0), 18: (5, 2), 19: (5, 4), 20: (5, 6), 23: (4, 1), 24: (4, 3), 25: (4, 5), 26: (4, 7), 28: (3, 0), 29: (3, 2), 30: (3, 4), 31: (3, 6), 34: (2, 1), 35: (2, 3), 36: (2, 5)... | Maps internal board indices to grid (row, col) coordinates | 625941d8e1aae11d1e749f30 |
def flow_gen(self, gen, mode='fullXY'): <NEW_LINE> <INDENT> if mode == 'fullXY': <NEW_LINE> <INDENT> for imgs,labels in gen: <NEW_LINE> <INDENT> for i in range(imgs.shape[0]): <NEW_LINE> <INDENT> imgs[i][:],labels[i][:] = self.random_transform(self.standardize(imgs[i]),labels[i]); <NEW_LINE> <DEDENT> yield imgs,labels ... | generator in, generator out
| 625941d83eb6a72ae02ec759 |
def canBuild(self, build_type, string, number): <NEW_LINE> <INDENT> return bool() | :param build_type:
:type build_type: buildType
:param string:
:type string: str
:param number:
:type number: int
:rtype: bool | 625941d8cad5886f8bd2724f |
def __getattr__(self, name): <NEW_LINE> <INDENT> if '_children' in self.__dict__: <NEW_LINE> <INDENT> entry = self.__getEntry__(name) <NEW_LINE> if(entry is not None): <NEW_LINE> <INDENT> valstr = entry.attrib["Value"] <NEW_LINE> valstr = str(urllib.unquote_plus(valstr)) <NEW_LINE> return pickle.loads(valstr) <NEW_LINE... | Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance attribute nor is it found in the class tree for self). name is the attribute name. This method should return the (computed) attribute value or raise an AttributeError exception.
Note that if the attribute is fou... | 625941d8ff9c53063f47c469 |
def send_message(self, phone): <NEW_LINE> <INDENT> sender = '+19382385793' <NEW_LINE> try: <NEW_LINE> <INDENT> message = self.client.messages.create(to=phone, from_=sender, body=self.message) <NEW_LINE> with self.lock: <NEW_LINE> <INDENT> self.success.info("[*] Message successfully sent to Recepient {} at {}".format(ph... | Methos used to send messges given
sender's number and recepient. | 625941d80a50d4780f66710a |
def test_sub_dict(sd_file): <NEW_LINE> <INDENT> dat = load_fol_data(sd_file) <NEW_LINE> temp = {} <NEW_LINE> temp[1] = dat[1] <NEW_LINE> temp[2] = dat[2] <NEW_LINE> temp[3] = dat[3] <NEW_LINE> path = os.path.split(sd_file)[0] <NEW_LINE> with open(path+'\\test.pckl','w') as fid: <NEW_LINE> <INDENT> pickle.dump(temp,fid) | Create a subset of the data that is easier to work with, taking the first three slices of the
dictionary
:param sd_file: The full tracked pickle file
:return: None, saves a pickle file as test.pckl | 625941d8eab8aa0e5d26ddcf |
def check_endpoint(value): <NEW_LINE> <INDENT> endpoints = ENDPOINTS.keys() <NEW_LINE> if value not in endpoints: <NEW_LINE> <INDENT> raise UsageError('This endpoint does not exist ({})'.format( ', '.join(sorted(endpoints)) )) <NEW_LINE> <DEDENT> return value | Check if the given endpoint is in the allowed ones. | 625941d8187af65679ca5396 |
def params_required(*args, **kwargs): <NEW_LINE> <INDENT> def wrapper(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def _wrapper(*func_args, **func_kwargs): <NEW_LINE> <INDENT> source = kwargs.get('source', 'query') <NEW_LINE> for param in args: <NEW_LINE> <INDENT> if source == 'query': <NEW_LINE> <INDEN... | source: query, cookie, form, file
validation: None | 625941d896565a6dacc8f941 |
def test_composite_pattern_moves(self): <NEW_LINE> <INDENT> bbox=BoundingBox(radius=0.5) <NEW_LINE> g = Gaussian(size=0.2,aspect_ratio=0.5,orientation=pi/3,x=0,y=0) <NEW_LINE> c = Composite(generators=[g],x=-0.3,y=0.4,xdensity=4,ydensity=4,bounds=bbox) <NEW_LINE> g_moved = g(x=-0.3,y=0.4,xdensity=4,ydensity=4,bounds=bb... | Test that moving a composite pattern yields the correct pattern. | 625941d83c8af77a43ae3a18 |
def example(self): <NEW_LINE> <INDENT> return Semigroups().example("free") | EXAMPLES::
sage: Semigroups().FinitelyGenerated().example()
An example of a semigroup: the free semigroup generated by ('a', 'b', 'c', 'd') | 625941d8baa26c4b54cb1394 |
def __init__(self, user_params): <NEW_LINE> <INDENT> self.ParseParameters( toggle_param_name=self._TOGGLE_PARAM, required_param_names=self._REQUIRED_PARAMS, optional_param_names=self._OPTIONAL_PARAMS, user_params=user_params) <NEW_LINE> if not self.enabled: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> post_cmd = geta... | Initializes the web feature.
Parses the arguments and initializes the web functionality.
Args:
user_params: A dictionary from parameter name (String) to parameter value. | 625941d83617ad0b5ed6816d |
def close(self): <NEW_LINE> <INDENT> if not self.closed: <NEW_LINE> <INDENT> self._speaking = False <NEW_LINE> self._err_check(_espeak.espeak_Cancel()) <NEW_LINE> self._err_check(_espeak.espeak_Terminate()) <NEW_LINE> self._closed = True | Stop speaking. | 625941d876e4537e8c3518eb |
def test_batch_response(self): <NEW_LINE> <INDENT> expected = { 'foo': 'bar', 'baz': 'quux', 'gzzz': 'bzz', '120.23.23.2': 'torproject.org' } <NEW_LINE> control_message = ControlMessage.from_str(BATCH_RESPONSE, 'MAPADDRESS', normalize = True) <NEW_LINE> self.assertEqual(expected, control_message.entries) | Parses a MAPADDRESS reply with multiple address mappings | 625941d83c8af77a43ae3a19 |
def runTest(self): <NEW_LINE> <INDENT> self.assertEqual(problem020(10), 27, "Problem #20 Test Case is wrong.") | The actual test. | 625941d863f4b57ef000138a |
def get_alarms(deployment_id, profile="telemetry"): <NEW_LINE> <INDENT> auth = _auth(profile=profile) <NEW_LINE> try: <NEW_LINE> <INDENT> response = requests.get( _get_telemetry_base(profile) + "/alerts?deployment={0}".format(deployment_id), headers=auth, ) <NEW_LINE> <DEDENT> except requests.exceptions.RequestExceptio... | get all the alarms set up against the current deployment
Returns dictionary of alarm information
CLI Example:
salt myminion telemetry.get_alarms rs-ds033197 profile=telemetry | 625941d8925a0f43d254a0ef |
def energy(self, V, hidden): <NEW_LINE> <INDENT> terms = [] <NEW_LINE> terms.append(self.visible_layer.expected_energy_term(state = V, average=False)) <NEW_LINE> assert len(self.hidden_layers) > 0 <NEW_LINE> terms.append(self.hidden_layers[0].expected_energy_term( state_below = self.visible_layer.upward_state(V), state... | .. todo::
WRITEME
Parameters
----------
V : tensor_like
Theano batch of visible unit observations (must be SAMPLES, not
mean field parameters)
hidden : list
List, one element per hidden layer, of batches of samples (must
be SAMPLES, not mean field parameters)
Returns
-------
rval : tensor_like
... | 625941d82ae34c7f2600d3a8 |
def getScriptPath(self): <NEW_LINE> <INDENT> return self.buffer.getFilename() | Hook to specify the filename to be run by the interpreter.
This defaults to the full pathname of the buffer on the local machine,
but this method can be used as a hook to modify the filename to point
to an arbitrary location. | 625941d8cc40096d61595bc7 |
def __mul__(self, other): <NEW_LINE> <INDENT> if isinstance(other, Matrix): <NEW_LINE> <INDENT> if self.column != other.row: <NEW_LINE> <INDENT> raise MatrixSizeError() <NEW_LINE> <DEDENT> if self.coeff_ring.getCharacteristic() != 0 and ffpack_interface.ENABLE_FFPACK: <NEW_LINE> <INDENT> return ffpac... | multiplication with a Matrix or a scalar | 625941d807d97122c4178b06 |
def normCol(self, *args): <NEW_LINE> <INDENT> return _ndlml.matrix_normCol(self, *args) | normCol(matrix self, unsigned int j) -> double | 625941d8b830903b967e9b80 |
@pytest.mark.skipif(sys.version_info.major >= 3, reason="Test itself is not yet Py3 compatible") <NEW_LINE> def test_log_redact_apitoken(caplog, capsys, monkeypatch): <NEW_LINE> <INDENT> monkeypatch.setenv('_REACTOR_LOGS_LEVEL', 'DEBUG') <NEW_LINE> r = Reactor() <NEW_LINE> message = r._token <NEW_LINE> r.logger.debug('... | Verify that x-nonce is redacted since it is an impersonation token | 625941d8d6c5a102081442c3 |
def node_get_end_line(node): <NEW_LINE> <INDENT> return _lib.cmark_node_get_end_line(node) | Return line on which node ends.
Returns
-------
int
Line number (starts from ``1``). | 625941d860cbc95b062c67ba |
def update_mxCell(cell_obj:ET.ElementTree, cell_id:str=None, parent_id:str=None): <NEW_LINE> <INDENT> cell = next(cell_obj.iter('mxCell')) <NEW_LINE> if cell_id != None: <NEW_LINE> <INDENT> cell.attrib['id']=str(cell_id) <NEW_LINE> <DEDENT> if parent_id != None: <NEW_LINE> <INDENT> cell.attrib['parent']=str(parent_id) ... | Updates mxCell attributes and returns cell
Args:
cell_obj: cell
cell_id: new cell_id
parent_id: new parent_id
Returns:
Same cell with updated mxCell | 625941d87cff6e4e81117bfc |
def _parse_specific_options(self, data): <NEW_LINE> <INDENT> data['compiler_options'] = [] <NEW_LINE> for dic in data['misc']: <NEW_LINE> <INDENT> for k, v in dic.items(): <NEW_LINE> <INDENT> self._libraries(k, v, data) <NEW_LINE> self._compiler_options(k, v, data) <NEW_LINE> self._optimization(k, v, data) <NEW_LINE> s... | Parse all uvision specific setttings. | 625941d8f7d966606f6aa27e |
def print_todo(self): <NEW_LINE> <INDENT> if self.target == 'tags': <NEW_LINE> <INDENT> id_from_feed_id = tag_id_from_feed_id <NEW_LINE> <DEDENT> elif self.target == 'followees': <NEW_LINE> <INDENT> id_from_feed_id = user_id_from_feed_id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> id_from_feed_id = None <NEW_LINE> <D... | dummy. | 625941d831939e2706e4d0de |
def __init__(self, filter="", subscription=None): <NEW_LINE> <INDENT> self.__subscription = subscription <NEW_LINE> self.__regExp = QRegExp() <NEW_LINE> self.__options = [] <NEW_LINE> self.__blockedDomains = [] <NEW_LINE> self.__allowedDomains = [] <NEW_LINE> self.__enabled = True <NEW_LINE> self.__cssRule = False <NEW... | Constructor
@param filter filter string of the rule (string)
@param subscription reference to the subscription object
(AdBlockSubscription) | 625941d821bff66bcd684bc8 |
def plot_topo_image(self, layout=None, sigma=0., vmin=None, vmax=None, colorbar=True, order=None, cmap='RdBu_r', layout_scale=.95, title=None, scalings=None, border='none', fig_facecolor='k', font_color='w', show=True): <NEW_LINE> <INDENT> return plot_topo_image_epochs( self, layout=layout, sigma=sigma, vmin=vmin, vmax... | Plot Event Related Potential / Fields image on topographies
Parameters
----------
layout: instance of Layout
System specific sensor positions.
sigma : float
The standard deviation of the Gaussian smoothing to apply along the
epoch axis to apply in the image. If 0., no smoothing is applied.
vmin : float
... | 625941d8cad5886f8bd27250 |
def test_maybe_date(self): <NEW_LINE> <INDENT> f = dt_lib.maybe_date <NEW_LINE> assert f(None, None, None) is None <NEW_LINE> assert f(2021, None, 1) is None <NEW_LINE> assert f(2021, 12, None) is None <NEW_LINE> assert f(2021, 12, 32) is None <NEW_LINE> assert f(2021, 12, 1) == dt.date(2021, 12, 1) | "Test maybe_date. | 625941d8d164cc6175782fc6 |
def off(self): <NEW_LINE> <INDENT> self.setUp() <NEW_LINE> GPIO.output(self.channel, GPIO.LOW) | turn off an LED | 625941d867a9b606de4a812f |
def __init__(self, structure_obj, pdbdata): <NEW_LINE> <INDENT> self.residues = {} <NEW_LINE> self.pdb_seq = {} <NEW_LINE> self.structure = structure_obj <NEW_LINE> self.pdb_structure = pdbdata <NEW_LINE> resis = Residue.objects.filter(protein_conformation=structure_obj.protein_conformation, protein_segment__isnull=Fal... | Assigns generic numbers based on DB info instead of BLAST search
Residues get fetched and structure gets parsed upon init | 625941d823e79379d52ee7d9 |
def mixed(self): <NEW_LINE> <INDENT> output = {} <NEW_LINE> for key, value in dict.iteritems(self): <NEW_LINE> <INDENT> if len(value) == 1: <NEW_LINE> <INDENT> output[key] = value[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> output[key] = value <NEW_LINE> <DEDENT> <DEDENT> return output | Returns a dictionary where the values are either single
values, or a list of values when a key/value appears more than
once in this dictionary. This is similar to the kind of
dictionary often used to represent the variables in a web
request. | 625941d8eab8aa0e5d26ddd0 |
def write(self): <NEW_LINE> <INDENT> with hts.util.silent(Exception, tb=True): <NEW_LINE> <INDENT> hts.util.write_json(self._favorites, self._path) | Write list of favorites to file. | 625941d8046cf37aa974cfbd |
def __init__(self, parent=None, width=5, height=4, dpi=100): <NEW_LINE> <INDENT> self.fig = Figure(figsize=(width, height), dpi=dpi) <NEW_LINE> self.axes = self.fig.add_subplot(111) <NEW_LINE> self.axes.set_title(' ') <NEW_LINE> self.axes.set_xlabel(' ') <NEW_LINE> self.axes.set_ylabel(' ') <NEW_LINE> self.cbar = self.... | Initialize the parent GraphWindow. | 625941d85e10d32532c5f19e |
def eatenFrames(self): <NEW_LINE> <INDENT> return self.data.job_stats.eaten_frames | Returns the total number of eaten frames under this object.
:rtype: int
:return: Total number of eaten frames | 625941d8fb3f5b602dac390d |
def getID(self): <NEW_LINE> <INDENT> acquisitionyear = self.acquisition_time.tm_year <NEW_LINE> acquisitiondayofyear = self.acquisition_time.tm_yday <NEW_LINE> acquisitionhour = self.acquisition_time.tm_hour <NEW_LINE> acquisitiontime = int(math.floor(self.acquisition_time.tm_min / 5)) <NEW_LINE> return '{granule_id}-{... | getId.
return: string (formatted as {granule-id}-{acquisitionyear}-{acquisitiondayofyear}-{acquisitionhour}-{acquisitiontime as (minutes / 5)}) | 625941d8d99f1b3c44c67803 |
def copy_me(L): <NEW_LINE> <INDENT> newL = L[:] <NEW_LINE> for i in range(len(L)): <NEW_LINE> <INDENT> if(isinstance(L[i], str)): <NEW_LINE> <INDENT> newL[i] = L[i].upper() <NEW_LINE> <DEDENT> elif(type(L[i]) == int) or (type(L[i]) == float): <NEW_LINE> <INDENT> newL[i] = L[i] + 1 <NEW_LINE> <DEDENT> elif(L[i] is True)... | (list) -> list
Takes as input a list, and returns a copy of the list with the following
changes:
Strings have all their letters converted to upper-case
Integers and floats have their value increased by 1
booleans are negated (False becomes True, True becomes False)
Lists are replaced with the word "List"
REQ: The input... | 625941d8090684286d50ef5f |
def _can_adapt(self, adaptee, target_class, *args, **kw): <NEW_LINE> <INDENT> can_adapt = target_class is self.target_class and self.type_system.is_a(adaptee, self.adaptee_class) <NEW_LINE> return can_adapt | Returns True if the factory can produce an appropriate adapter. | 625941d8462c4b4f79d1d947 |
def delete_custom_object_by_token(self, access_token, object_name, object_record_id): <NEW_LINE> <INDENT> if(self._lr_object.is_null_or_whitespace(access_token)): <NEW_LINE> <INDENT> raise Exception(self._lr_object.get_validation_message("access_token")) <NEW_LINE> <DEDENT> if(self._lr_object.is_null_or_whitespace(obje... | This API is used to remove the specified Custom Object data using ObjectRecordId of a specified account.
Args:
access_token: Uniquely generated identifier key by LoginRadius that is activated after successful authentication.
object_name: LoginRadius Custom Object Name
object_record_id: Unique identifier of... | 625941d8e8904600ed9f21a7 |
def line_width(self, *args, **kwargs): <NEW_LINE> <INDENT> return _qtgui_swig.time_raster_sink_b_sptr_line_width(self, *args, **kwargs) | line_width(time_raster_sink_b_sptr self, int which) -> int | 625941d8a934411ee375190b |
def t_LKEY(t): <NEW_LINE> <INDENT> t.value = { "line": t.lineno, "value": t.value } <NEW_LINE> return t | \{ | 625941d8b545ff76a891408d |
def adjust_raster_to_aoi(in_dataset_uri, aoi_datasource_uri, cell_size, out_dataset_uri): <NEW_LINE> <INDENT> out_head, out_tail = os.path.split(out_dataset_uri) <NEW_LINE> _, tail = os.path.split(in_dataset_uri) <NEW_LINE> out_base, _ = os.path.splitext(out_tail) <NEW_LINE> base, _ = os.path.splitext(tail) <NEW_LIN... | Adjust in_dataset_uri to match aoi_dataset_uri's extents, cell size and
projection.
Inputs:
- in_dataset_uri: the uri of the dataset to adjust
- aoi_dataset_uri: uri to the aoi we want to use to adjust
in_dataset_uri
- out_dataset_uri: uri to the adjusted dataset
Returns:
... | 625941d84e4d5625662d464d |
def RemovePage(self, page): <NEW_LINE> <INDENT> if page >= len(self._windows): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> event = FlatNotebookEvent(wxEVT_FLATNOTEBOOK_PAGE_CLOSING, self.GetId()) <NEW_LINE> event.SetSelection(page) <NEW_LINE> event.SetEventObject(self) <NEW_LINE> self.GetEventHandler().Process... | Deletes the specified page, without deleting the associated window.
:param `page`: an integer specifying the page index. | 625941d867a9b606de4a8130 |
def getNBestList(self, n=5, t=None): <NEW_LINE> <INDENT> rlist = [] <NEW_LINE> if not t: t = time() <NEW_LINE> for entity in self.getAllEntities(): <NEW_LINE> <INDENT> karma = self.getKarma(entity, t=t) <NEW_LINE> if karma[1] == 0 and karma [2] == 0: <NEW_LINE> <INDENT> self.delEntity(entity) <NEW_LINE> continue <NEW_L... | Calculate the top N entities with karma for a given time T. T is default
"now"
@type n: integer
@param n: The number of entities you want back
@type t: integer
@param t: The date you want calculated (unixtime)
@rtype: list
@return: A list of the N entities with the best karma inkl n/positive karma and n/negative karm... | 625941d87b25080760e396d0 |
def moveZeroes(self, nums): <NEW_LINE> <INDENT> ok = True <NEW_LINE> for i in str: <NEW_LINE> <INDENT> if str.count(i) > str1.count(i): <NEW_LINE> <INDENT> ok=False <NEW_LINE> <DEDENT> <DEDENT> return ok | :type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead. | 625941d8dd821e528d63b41f |
def update_environment_with_http_info(self, environment_id, body, **kwargs): <NEW_LINE> <INDENT> all_params = ['environment_id', 'body'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_reques... | Update environment by ID # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_environment_with_http_info(environment_id, body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param int environme... | 625941d80383005118ecf85a |
def top_sentences(query, sentences, idfs, n): <NEW_LINE> <INDENT> rank = {} <NEW_LINE> for sentence in sentences: <NEW_LINE> <INDENT> sum = 0 <NEW_LINE> tf = 0 <NEW_LINE> count = len(sentences[sentence]) <NEW_LINE> for word in query: <NEW_LINE> <INDENT> tf += sentences[sentence].count(word) <NEW_LINE> if word in senten... | Given a `query` (a set of words), `sentences` (a dictionary mapping
sentences to a list of their words), and `idfs` (a dictionary mapping words
to their IDF values), return a list of the `n` top sentences that match
the query, ranked according to idf. If there are ties, preference should
be given to sentences that have... | 625941d8167d2b6e31218e0d |
def get_bg_color(image, bits_per_channel=None): <NEW_LINE> <INDENT> assert image.shape[-1] == 3 <NEW_LINE> quantized = quantize(image, bits_per_channel).astype(int) <NEW_LINE> packed = pack_rgb(quantized) <NEW_LINE> unique, counts = np.unique(packed, return_counts=True) <NEW_LINE> packed_mode = unique[counts.argmax()] ... | Obtains the background color from an image or array of RGB colors
by grouping similar colors into bins and finding the most frequent
one.
| 625941d829b78933be1e5920 |
@APP.route('/queries') <NEW_LINE> @APP.route('/query') <NEW_LINE> def show_all_queries(): <NEW_LINE> <INDENT> return jsonify(get_all_queries()) | List all queries from database. | 625941d856ac1b37e6264444 |
def verify_ssh_credentials(): <NEW_LINE> <INDENT> verified = False <NEW_LINE> status = '' <NEW_LINE> cfg = get_config() <NEW_LINE> try: <NEW_LINE> <INDENT> host = get_host_ip() <NEW_LINE> if is_valid_hostname(host): <NEW_LINE> <INDENT> if len(cfg['ssh-hostname']) and len(cfg['ssh-username']): <NEW_LINE> <INDENT> cmd = ... | Verify the ssh credentials have been installed to the VNF.
Attempts to run a stock command - `hostname` on the remote host. | 625941d82c8b7c6e89b35a37 |
def format_lxml_syntax_error(exc, context_lines=5, full_xml=False): <NEW_LINE> <INDENT> lines = exc.full_xml.splitlines() <NEW_LINE> err_line = exc.lineno - 1 <NEW_LINE> err_offset = exc.offset - 1 <NEW_LINE> if full_xml: <NEW_LINE> <INDENT> start_line = 0 <NEW_LINE> end_line = None <NEW_LINE> <DEDENT> else: <NEW_LINE>... | Format a :class:`lxml.etree.XMLSyntaxError`, showing the error's
context_lines.
*exc* should have been augmented with :func:`add_lxml_syntax_error_context`
first.
*name* is just a generic name indicating where the error occurred (for
example the name of a job).
*context_lines* is the number of lines to show around t... | 625941d8796e427e537b083f |
def print_stat(): <NEW_LINE> <INDENT> df = pd.read_csv('intagrated_interpretations_eight.csv') <NEW_LINE> top_prob_li = [] <NEW_LINE> for col in df.columns: <NEW_LINE> <INDENT> print("========", col, "========") <NEW_LINE> c = collections.Counter(df[col]) <NEW_LINE> top_prob = 0 <NEW_LINE> for adj, count in c.most_comm... | 各フレーズの一番一致率の高い形容詞の一致率を集計 | 625941d815baa723493c41ef |
def getAutoPassphrase(self, **kwargs): <NEW_LINE> <INDENT> allParams = [] <NEW_LINE> params = locals() <NEW_LINE> for (key, val) in list(params['kwargs'].items()): <NEW_LINE> <INDENT> if key not in allParams: <NEW_LINE> <INDENT> raise TypeError("Got an unexpected keyword argument '%s' to method getAutoPassphrase" % key... | getAutoPassphrase
Args:
Returns: AutoPassphraseResult | 625941d8dd821e528d63b420 |
def parse_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description='Train a Fast R-CNN network') <NEW_LINE> parser.add_argument('--cfg', dest='cfg_file', help='optional config file', default='cfgs/vgg16.yml', type=str) <NEW_LINE> parser.add_argument('--imdb', dest='imdb_name', help='dataset to train on'... | Parse input arguments | 625941d8bf627c535bc13447 |
def test_ordering_descending(self): <NEW_LINE> <INDENT> response = self.client.get(reverse("search-projects-list") + "?ordering=-name", format="json") <NEW_LINE> self.assertEqual(str(response.data["results"][0]["name"]), "test project3") <NEW_LINE> response = self.client.get(reverse("search-organizations-list") + "?ord... | Assert it's possible to order projects, users and organizations by fields ascending | 625941d855399d3f0558892d |
def update(self, strategy: "SupervisedTemplate", **kwargs): <NEW_LINE> <INDENT> self.update_from_dataset(strategy.experience.dataset) | Update buffer. | 625941d88a349b6b435e83eb |
def img_width(self): <NEW_LINE> <INDENT> return 28 | Returns the width of image in the data set. | 625941d801c39578d7e750b4 |
def __execute_ret(command, host=None, admin_username=None, admin_password=None, module=None): <NEW_LINE> <INDENT> if module: <NEW_LINE> <INDENT> if module == 'ALL': <NEW_LINE> <INDENT> modswitch = '-a ' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> modswitch = '-m {0}'.format(module) <NEW_LINE> <DEDENT> <DEDENT> else: ... | Execute rac commands | 625941d8c432627299f04ebf |
def _parse(self, out): <NEW_LINE> <INDENT> source = None <NEW_LINE> self._uptodate = False <NEW_LINE> for row in out.split("\n"): <NEW_LINE> <INDENT> m = re.match(r"<target>(.*)</target>", row) <NEW_LINE> if m: <NEW_LINE> <INDENT> source = '../%s' % m.group(1) <NEW_LINE> break <NEW_LINE> <DEDENT> elif row.startswith('<... | Parse the uscan output return and update the object's properties
@param out: uscan output
@type out: string
>>> u = Uscan('http://example.com/')
>>> u._parse('<target>virt-viewer_0.4.0.orig.tar.gz</target>')
>>> u.tarball
'../virt-viewer_0.4.0.orig.tar.gz'
>>> u.uptodate
False
>>> u._parse('')
Traceback (most recent ... | 625941d8f9cc0f698b140872 |
def test_openxr_refpage_missing(ckr): <NEW_LINE> <INDENT> ckr.enabled([MessageId.REFPAGE_MISSING]) <NEW_LINE> assert(not ckr.check( "include::../../generated/api/flags/XrEndFrameDescriptionFlags.txt[]").messages) | OpenXR-specific tests of the REFPAGE_MISSING message. | 625941d8adb09d7d5db6ca06 |
def _write_imagesequence(self, imgseq, nixblock, nixgroup): <NEW_LINE> <INDENT> if "nix_name" in imgseq.annotations: <NEW_LINE> <INDENT> nix_name = imgseq.annotations["nix_name"] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> nix_name = f"neo.imagesequence.{self._generate_nix_name()}" <NEW_LINE> imgseq.annotate(nix_name... | Convert the provided ``imgseq`` (ImageSequence) to a list of NIX
DataArray objects and write them to the NIX file. All DataArray objects
created from the same ImageSequence have their metadata section point to
the same object.
:param anasig: The Neo ImageSequence to be written
:param nixblock: NIX Block where the Data... | 625941d8596a897236089d36 |
def classify_paper_with_deposit(taxonomy, rebuild_cache=False, no_cache=False, output_limit=20, spires=False, match_mode='full', with_author_keywords=False, extract_acronyms=False, only_core_tags=False, fast_mode=False): <NEW_LINE> <INDENT> from ..api import ( get_keywords_from_text, get_keywords_from_local_file, ) <NE... | Extract keywords from a pdf file or metadata in a deposit. | 625941d88c0ade5d55d3ec34 |
@register.filter <NEW_LINE> def sec_to_dur(value, arg = ''): <NEW_LINE> <INDENT> if not value: <NEW_LINE> <INDENT> return 'No duration' <NEW_LINE> <DEDENT> secs = int(value) <NEW_LINE> if secs > 0: <NEW_LINE> <INDENT> import math <NEW_LINE> daySecs = 86400 <NEW_LINE> hourSecs = 3600 <NEW_LINE> minSecs = 60 <NEW_LINE> i... | #######################################################
# #
# Seconds-to-Duration Template Tag #
# Dan Ward 2009 (http://d-w.me) #
# #
########################################... | 625941d85fdd1c0f98dc04ac |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.