code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def getValidationStatus(self, processName): <NEW_LINE> <INDENT> self.checkAndOpenDb() <NEW_LINE> sql = self.gen.validationStatus(processName) <NEW_LINE> query = QSqlQuery(sql,self.db) <NEW_LINE> if not query.isActive(): <NEW_LINE> <INDENT> raise Exception(self.tr('Problem acquiring status: ') + query.lastError().text()...
Gets the validation status for a specific process processName: process name
625941cc462c4b4f79d1d7c3
def read_image_properties(properties_path): <NEW_LINE> <INDENT> if os.path.exists(properties_path): <NEW_LINE> <INDENT> return pd.read_csv(properties_path) <NEW_LINE> <DEDENT> return None
reads image properties file if it exists Parameter properties_path: str path to properties csv file Returns pandas.Dataframe or None if file is non-existent
625941cca4f1c619b28b012c
def is_wow64(self, proc): <NEW_LINE> <INDENT> return (proc.environ.get("PROCESSOR_ARCHITECTURE") == 'x86' and proc.environ.get("PROCESSOR_ARCHITEW6432") == 'AMD64')
Determine if the proc is Wow64.
625941cc009cb60464c634a4
def set_image(self, image=None): <NEW_LINE> <INDENT> self._timer_running = False <NEW_LINE> self._start_time = None <NEW_LINE> self._stop_time = None <NEW_LINE> self._last_measurement = None
Resets all variable once the time should be measured for a new picture. :param image: we don't use this, but every set_image method of other classes has this parameter
625941cc3c8af77a43ae3893
def publish(topic: str, payload: str, retain: bool = False): <NEW_LINE> <INDENT> topic = f"{this.settings.topic('root')}/{topic}" <NEW_LINE> if this.settings.lowercase_topics: <NEW_LINE> <INDENT> topic = topic.lower() <NEW_LINE> <DEDENT> this.mqtt.publish(topic, payload=payload, qos=this.settings.qos, retain=retain)
Publish the specified payload to the specified MQTT topic.
625941cc6fb2d068a760f190
def _clean_pkglist(pkgs): <NEW_LINE> <INDENT> for name, versions in pkgs.iteritems(): <NEW_LINE> <INDENT> stripped = filter(lambda x: x != '1', versions) <NEW_LINE> if not stripped: <NEW_LINE> <INDENT> pkgs[name] = ['1'] <NEW_LINE> <DEDENT> elif versions != stripped: <NEW_LINE> <INDENT> pkgs[name] = stripped
Go through package list and, if any packages have more than one virtual package marker and no actual package versions, remove all virtual package markers. If there is a mix of actual package versions and virtual package markers, remove the virtual package markers.
625941cc92d797404e30427c
def test_download_from_bucket(): <NEW_LINE> <INDENT> file_name = 'test-weights.h5' <NEW_LINE> asr.utils.download_from_bucket( bucket_name='automatic-speech-recognition', remote_path=file_name, local_path=file_name ) <NEW_LINE> with h5py.File(file_name, mode='r') as store: <NEW_LINE> <INDENT> data = store['data'][:] <NE...
# Before create a store, upload it manually with h5py.File('test-weights.h5', mode='w') as store: store['data'] = np.zeros([100, 10])
625941cc99cbb53fe6792cd9
def is_post_increment_op(self): <NEW_LINE> <INDENT> return False
Is the expression a post increment operator?
625941ccad47b63b2c50a072
def write_run_script(self): <NEW_LINE> <INDENT> with open(Config.runscript_template) as templatefile: <NEW_LINE> <INDENT> template = JinjaTemplate(templatefile.read()) <NEW_LINE> <DEDENT> with open(self.run_script_file, 'w') as run_script_file: <NEW_LINE> <INDENT> run_script_file.write( template.render( application_dir...
Write a script to run this application to a file.
625941cc63d6d428bbe445e2
def do_GET(self): <NEW_LINE> <INDENT> termcolor.cprint(self.requestline, 'green') <NEW_LINE> file_name = self.path.strip('/') <NEW_LINE> try: <NEW_LINE> <INDENT> if file_name == "" or file_name == "index.html": <NEW_LINE> <INDENT> contents = read_html_file(HTML_ASSETS + 'index.html') <NEW_LINE> <DEDENT> else: <NEW_LINE...
This method is called whenever the client invokes the GET method in the HTTP protocol request
625941cc851cf427c661a602
def process_relatie_entiteit(self, parent_django_obj, relation): <NEW_LINE> <INDENT> if isinstance(relation, OneToManyRelation): <NEW_LINE> <INDENT> related_manager, default_kwargs = self.get_related_manager(parent_django_obj, relation) <NEW_LINE> gerelateerde_obj1, gerelateerde_obj2 = self.process_gerelateerde(extra_o...
See StUF 03.01 - 5.2.6 Het vullen van relatie-entiteiten en gerelateerde entiteiten * 9. Mutatiesoort 'W', 'F' of 'C' en verwerkingssoort 'I':Relatie is opgenomen als kerngegeven of omdat gerelateerde
625941cc8da39b475bd65067
def submit(args): <NEW_LINE> <INDENT> def mpi_submit(nworker, nserver, pass_envs): <NEW_LINE> <INDENT> def run(prog): <NEW_LINE> <INDENT> subprocess.check_call(prog, shell=True) <NEW_LINE> <DEDENT> cmd = ' '.join(args.command) <NEW_LINE> pass_envs['DMLC_JOB_CLUSTER'] = 'slurm' <NEW_LINE> if args.slurm_worker_nodes is N...
Submission script with SLURM.
625941cc66673b3332b92184
def initiateModel(self, key, table, username, database): <NEW_LINE> <INDENT> pass
Parameters: - key - table - username - database
625941cc046cf37aa974ce3b
def getPanelDisplayName(self): <NEW_LINE> <INDENT> raise NotImplementedError
Return the display name for this panel
625941cc8e71fb1e9831d89c
def __init__(self, attending, shirt, sleep_arrange, traveling, travel_cost, diet): <NEW_LINE> <INDENT> self.attending = attending <NEW_LINE> self.shirt = shirt <NEW_LINE> self.sleep_arange = sleep_arrange <NEW_LINE> self.traveling = traveling <NEW_LINE> self.travel_cost = travel_cost <NEW_LINE> self.diet = diet
Initializes Acceptance Object
625941cc96565a6dacc8f7be
def split_img_mask(train_data_dir, imgs_train_dir, masks_train_dir): <NEW_LINE> <INDENT> if not os.path.exists(imgs_train_dir): <NEW_LINE> <INDENT> os.makedirs(imgs_train_dir) <NEW_LINE> <DEDENT> if not os.path.exists(masks_train_dir): <NEW_LINE> <INDENT> os.makedirs(masks_train_dir) <NEW_LINE> <DEDENT> count = 0 <NEW_...
:param train_data_dir: :param imgs_train_dir: :param masks_train_dir: :return:
625941cc94891a1f4081bb9c
def test_index_value_regex_requires_index_value_end(self): <NEW_LINE> <INDENT> self.assertRaises( usage.UsageError, self.make_counter, index_field="foo", index_value="foo", index_value_regex="foo")
index-value-regex without a range query is pointless.
625941cccc40096d61595a43
def get_active(): <NEW_LINE> <INDENT> return Predictor.objects.get(is_active=True)
Returns the one active predictors in the database. Args: None. Returns: A single active Predictor.
625941cc32920d7e50b282c3
def register_factory(self, regex, factory): <NEW_LINE> <INDENT> self._factory[re.compile(regex)] = factory
Register a ChannelFactory to create channels matching regex :param str regex: Should match the desired channel name format and the first group should extract the channel name :param ChannelFactory factory: ChannelFactory instance that will have its create_channel() method called with the channel name
625941cc507cdc57c6306dcd
def sample_keys(self): <NEW_LINE> <INDENT> return _BigtableSampleKeysDataset(self)
Retrieves a sampling of row keys from the Bigtable table. This dataset is most often used in conjunction with `tf.data.experimental.parallel_interleave` to construct a set of ranges for scanning in parallel. Returns: A `tf.data.Dataset` returning string row keys.
625941cc57b8e32f5248358e
def createconfig(harpnum, tstart, extent, window_size = None, path = None, dbaddress = None, cadence = None, loadstd = False, std_path = None): <NEW_LINE> <INDENT> if loadstd is True: <NEW_LINE> <INDENT> standards = json.load(std_path) <NEW_LINE> window_size = standards['window_size'] <NEW_LINE> path = ['path'] <NEW_LI...
This function creates a config file. The format for tstart and tend is: '2014-01-01T00:00:00' or '2016.05.18_00:00:00'
625941cc5fc7496912cc3a71
def lod_clear_all(): <NEW_LINE> <INDENT> pass
Remove all levels of detail from this object
625941cc76e4537e8c351766
def test_make_fasta_str_00(): <NEW_LINE> <INDENT> comment = '' <NEW_LINE> seq = '' <NEW_LINE> ref = '>' <NEW_LINE> res = e3.make_fasta_str(comment, seq) <NEW_LINE> assert res == ref
Empty strings.
625941ccd8ef3951e3243630
def test_001b_shifted (self): <NEW_LINE> <INDENT> fft_len = 16 <NEW_LINE> tx_symbols = ( 0, 0, 0, 0, 0, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 6, 1j, 7, 8, 0, 9, 10, 1j, 11, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 14, 0, 15, 16, 17, 0, 0, 0, 0, ) <NEW_LINE> expected_result = tuple(range(18)) <NEW_L...
Same as before, but shifted, because that's the normal mode in OFDM Rx
625941cc07d97122c417897e
def convertRegionName(name): <NEW_LINE> <INDENT> converted = [] <NEW_LINE> nextUpper = False <NEW_LINE> for index, char in enumerate(name): <NEW_LINE> <INDENT> if index == 0: <NEW_LINE> <INDENT> converted.append(char.upper()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if char in (u" ", u"_"): <NEW_LINE> <INDENT> cha...
Converts a (system)name to the format that dotland uses
625941cc99fddb7c1c9de484
def test_invalid_unit_spec_duplicate_entry(): <NEW_LINE> <INDENT> this_dir = get_cwd() <NEW_LINE> path = os.path.join(this_dir, "test_files", "duplicate_entry.txt") <NEW_LINE> with pytest.raises(SyntaxError): <NEW_LINE> <INDENT> up = unit_parser(path)
Tests a unit specification file with the same unit defined twice.
625941cccc40096d61595a44
def setup_cache(): <NEW_LINE> <INDENT> print("adding some key value pairs to the cache... slowly") <NEW_LINE> for key, value in generate_key_val(MAX_PAIRS_INIT): <NEW_LINE> <INDENT> tcp_put(key, value) <NEW_LINE> time.sleep(.01) <NEW_LINE> <DEDENT> print("...done pre-populating the cache")
adds key,value pairs to the cache in anticipation of mixed_workload
625941ccbe7bc26dc91cd6f3
@contextmanager <NEW_LINE> def curses_session(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.environ['ESCDELAY'] = '25' <NEW_LINE> stdscr = curses.initscr() <NEW_LINE> curses.noecho() <NEW_LINE> curses.cbreak() <NEW_LINE> stdscr.keypad(1) <NEW_LINE> try: <NEW_LINE> <INDENT> curses.start_color() <NEW_LINE> curses.us...
Setup terminal and initialize curses. Most of this copied from curses.wrapper in order to convert the wrapper into a context manager.
625941cca79ad161976cc239
def get_members(self): <NEW_LINE> <INDENT> members = self.get_members_json(self.base_uri) <NEW_LINE> members_list = [] <NEW_LINE> for member_json in members: <NEW_LINE> <INDENT> members_list.append(self.create_member(member_json)) <NEW_LINE> <DEDENT> return members_list
Get all members attached to this card. Returns a list of Member objects. Returns: list(Member): The members attached to this card
625941ccd58c6744b4257d53
def execv(self, argv, **kwargs): <NEW_LINE> <INDENT> if type(argv) in (str, str): <NEW_LINE> <INDENT> raise TypeError("Debug.execv expects a list, not a string") <NEW_LINE> <DEDENT> lpCmdLine = self.system.argv_to_cmdline(argv) <NEW_LINE> return self.execl(lpCmdLine, **kwargs)
Starts a new process for debugging. This method uses a list of arguments. To use a command line string instead, use L{execl}. @see: L{attach}, L{detach} @type argv: list( str... ) @param argv: List of command line arguments to pass to the debugee. The first element must be the debugee executable filename. @typ...
625941cc287bf620b61d3b57
def check_bullet_alien_collisions(ai_settings, screen, stats, sb, ship, aliens, bullets): <NEW_LINE> <INDENT> collisions = pygame.sprite.groupcollide(bullets, aliens, True, True) <NEW_LINE> if collisions: <NEW_LINE> <INDENT> for aliens in collisions.values(): <NEW_LINE> <INDENT> stats.score += ai_settings.alien_points ...
Reakcja na kolizję między pociskiem i obcym.
625941cc9f2886367277a980
def __init__( self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> super(StorageErrorError, self).__init__(**kwargs) <NEW_LINE> self.code = code <NEW_LINE> self.message = message
:keyword code: The service error code. :paramtype code: str :keyword message: The service error message. :paramtype message: str
625941ccd4950a0f3b08c442
def test_get_api_version(self): <NEW_LINE> <INDENT> version_ref = (3, 9, 0, 3079) <NEW_LINE> version = self.sentech_api.get_api_version() <NEW_LINE> self.assertTupleEqual(version_ref, version) <NEW_LINE> self.assert_(True)
Test the method `get_api_version`.
625941cc379a373c97cfac38
def is_str_digit(str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> float(str) <NEW_LINE> return True <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return False
Takes in a string value and returns whether or not it can be cast to a float type.
625941cc50812a4eaa59c415
def set_warning(self, warning): <NEW_LINE> <INDENT> self._fields['warnings'].append(str(datetime.datetime.now()) + ": The condition '" + warning + "' was met")
Called when a condition is met. Adds a warning message to self.warnings attributes: warning(str): the name/id of the condition that was met
625941cc01c39578d7e74f2f
def purchase_package( self, msisdn: str, current_profile: str, current_user: User, package_type: str, package_grade: str = None) -> dict: <NEW_LINE> <INDENT> with INConnection( self.host, current_user.mml_username, current_user.mml_password, self.port, self.buffer_size) as in_connection: <NEW_LINE> <INDENT> package_pur...
[summary] Parameters ---------- msisdn : str Mobile number purhasing the package. current_profile : str Current profile of the MSISDN. package_type : str Package type being purchased. package_grade : str Package grade of the package type being purchased. Returns ------- dict Details of MSISDN, ...
625941cc31939e2706e4cf5e
def policy_value_fn(self, board): <NEW_LINE> <INDENT> legalMoves = board.avaliableMove() <NEW_LINE> current_state = board.currentState() <NEW_LINE> act_probs, value = self.policy_value(current_state.reshape(-1, 34, self.board_width, self.board_height)) <NEW_LINE> act_probs = zip(legalMoves, act_probs.flatten()[legalMov...
input: board output: a list of (action, probability) tuples for each available action and the score of the board state
625941cca4f1c619b28b012d
def _grad_cam(self, grad_output, requires_activation): <NEW_LINE> <INDENT> scale = self.input.shape[2] <NEW_LINE> n,f = grad_output.shape <NEW_LINE> grad_output = F.interpolate(grad_output.reshape(n,f,1,1), scale_factor=scale, mode='nearest') <NEW_LINE> grad_input = grad_output / (self.input.shape[2]*self.input.shape[3...
Note that this implementation is only for the global average pooling. If the output size of this layer is not 1, than this implimentation does not work.
625941ccf548e778e58cd671
def setRandomShape(self): <NEW_LINE> <INDENT> self.setShape(random.randint(1, len(Tetrominoe.coordsTable) -1 ))
chooses a random shape
625941cc004d5f362079a427
def is_over(board): <NEW_LINE> <INDENT> for i in range(3): <NEW_LINE> <INDENT> for j in range(3): <NEW_LINE> <INDENT> if board[i][j] == '-': <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return True
Check if every slot is filled
625941cc07d97122c417897f
def _dsopts(self, dsopts): <NEW_LINE> <INDENT> opts = '' <NEW_LINE> fmat = '' <NEW_LINE> if len(dsopts): <NEW_LINE> <INDENT> for key in dsopts: <NEW_LINE> <INDENT> if len(str(dsopts[key])): <NEW_LINE> <INDENT> if key == 'where': <NEW_LINE> <INDENT> if isinstance(dsopts[key], str): <NEW_LINE> <INDENT> opts += 'where=(' ...
:param dsopts: a dictionary containing any of the following SAS data set options(where, drop, keep, obs, firstobs): - where is a string or list of strings - keep are strings or list of strings. - drop are strings or list of strings. - obs is a numbers - either string or int - first obs is a numbers...
625941ccb57a9660fec33977
def resolve_show_me_the_sight_beyond_sight(self, info, **kwargs): <NEW_LINE> <INDENT> the_eye_of_thundera = [ '░░░░░░░▄▄▀▀▀▀▀▀▀▀▀▀▀▀▄▄░░░░░░░', '░░░░░▄▀░░░░░░░░░░░▄▄▄░░▀▄░░░░░', '░░░▄▀░░░░░░░░░▄▄███▀▄██▄░▀▄░░░', '░░█░░░░░░░░▄█████▄▄█████▄░░█▄░', '░█░░░░░░░▄█▀▄████████████▄░░█░', '░█░░░░▄█████████████▄▀████░░█░', '░█░░▄...
Resolve o easter egg e devolve o olho de thundera.
625941cc26238365f5f0ef62
def test_flush_duperecords_pass(self): <NEW_LINE> <INDENT> Dedupe = self.create_Dedupe_class() <NEW_LINE> assert not hasattr(Dedupe, 'duperecords') <NEW_LINE> Dedupe.flush_duperecords()
ensure flush_duperecords pass when class attribute doesn't exist
625941ccbaa26c4b54cb1214
def __bool__(self): <NEW_LINE> <INDENT> return _pmt_swig.pmt_vector_cfloat___bool__(self)
__bool__(pmt_vector_cfloat self) -> bool
625941cc6e29344779a62706
def clean_by_request(self, request): <NEW_LINE> <INDENT> if request not in self.request_map: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for tag, matcher, future in self.request_map[request]: <NEW_LINE> <INDENT> self._timeout_future(tag, matcher, future) <NEW_LINE> if future in self.timeout_map: <NEW_LINE> <INDENT> ...
Remove all futures that were waiting for request `request` since it is done waiting
625941cc3eb6a72ae02ec5d1
def __init__(self, logdir, env_fn, qf_fn, nenv=1, optimizer=torch.optim.RMSprop, buffer_size=100000, frame_stack=1, learning_starts=10000, update_period=1, gamma=0.99, huber_loss=True, exploration_timesteps=1000000, final_eps=0.1, eval_eps=0.05, target_update_period=10000, batch_size=32, gpu=True, eval_num_episodes=1, ...
Init.
625941cc711fe17d82542460
def do_scan(self,args): <NEW_LINE> <INDENT> if not self._interface: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if args: <NEW_LINE> <INDENT> _timeout = int(args) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> _timeout = 2 <NEW_LINE> <DEDENT> self.pp.info("Starting BLE scan...") <NEW_LINE> scanner = btle.Scanner(self....
Perform a BLE scan for devices within range. Optional argument is a timeout for scan time: > scan > scan 3 > scan 20
625941ccc432627299f04d3a
def _get_event(self): <NEW_LINE> <INDENT> return LogEvent.objects.create(type=LOG_EVENT_LOGIN_SUCCESS, username='johndoe', ip_address='10.0.0.56')
Create a new event for testing. :return: The newly created event.
625941cc796e427e537b06ba
def add(self, textline, align): <NEW_LINE> <INDENT> x = self.get_x_coord(textline, align) <NEW_LINE> y0 = textline.y0 <NEW_LINE> y1 = textline.y1 <NEW_LINE> te = TextEdge(x, y0, y1, align=align) <NEW_LINE> self._textedges[align].append(te)
Adds a new text edge to the current dict.
625941cc07f4c71912b11576
def get_identifier(self, item): <NEW_LINE> <INDENT> identifier = [] <NEW_LINE> if item._registry.has_parent(): <NEW_LINE> <INDENT> identifier.append(self.get_identifier(item.get_registry_parent())) <NEW_LINE> <DEDENT> identifier += [ item._registry.registry_id, item.__class__.__name__, item._registry_virtual_child_inde...
Returns an encoded identifier for a form state item. :param item: Form state item
625941ccec188e330fd5a893
def shutdown(self, number_of_iterations): <NEW_LINE> <INDENT> self.display_in_use = True <NEW_LINE> delay = 0.1 <NEW_LINE> sequence1 = [0, 8, 9, 12, 11, 3] <NEW_LINE> sequence2 = [0, 10, 9, 12, 13, 3] <NEW_LINE> counter = 0 <NEW_LINE> while counter < number_of_iterations: <NEW_LINE> <INDENT> for a in range(len(sequence...
goes from top segments to bottom segments
625941cc3c8af77a43ae3894
def applyNoise(self): <NEW_LINE> <INDENT> for point in self.points: <NEW_LINE> <INDENT> oldLat = copy.copy(point['lat']) <NEW_LINE> oldLon = copy.copy(point['lon']) <NEW_LINE> point['lat'] = self.laplace(point['lat'], self.sensitivity) <NEW_LINE> point['lon'] = self.laplace(point['lon'], self.sensitivity) <NEW_LINE> po...
asdfasdf
625941cc30bbd722463cbeba
def __init__(self, feature_label): <NEW_LINE> <INDENT> self.feature_label = feature_label
:param feature_label: The label you like for new feature.
625941ccdc8b845886cb5629
def handle_msg (self, cmsg): <NEW_LINE> <INDENT> self.log.trace ("%r", cmsg) <NEW_LINE> req = cmsg.get_dest() <NEW_LINE> if req == "echo.request": <NEW_LINE> <INDENT> self.process_request (cmsg) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.log.warn ("unknown msg: %s", req)
Got a message, process it.
625941ccd18da76e235325ca
def test_toggle_read_unread(self): <NEW_LINE> <INDENT> user_msg = self._publish_test_notification() <NEW_LINE> self._mark_notification_as_read(user_msg) <NEW_LINE> self._assert_expected_counts(1, read_filter=True) <NEW_LINE> self._assert_expected_counts(0, read_filter=False) <NEW_LINE> self._mark_notification_as_read(u...
Create a test notification and toggle it as read and then back to unread
625941ccbd1bec0571d90723
def test_no_pems_found(self): <NEW_LINE> <INDENT> in_line = '' <NEW_LINE> expected = '' <NEW_LINE> self.assertEqual( redhat_packages.ProcessRedHatPackagesCerts.process( ansible_result(in_line)), expected)
Return empty string if it is given.
625941cccad5886f8bd270cd
def to_pair(value, name): <NEW_LINE> <INDENT> if isinstance(value, Iterable): <NEW_LINE> <INDENT> if len(value) != 2: <NEW_LINE> <INDENT> raise ValueError( "Expected `{}` to have exactly 2 elements, got: ({})".format( name, value ) ) <NEW_LINE> <DEDENT> return value <NEW_LINE> <DEDENT> return tuple(repeat(value, 2))
Make a pair (of type tuple) of given value.
625941cc8e71fb1e9831d89d
def _GetOrCreateConfigEntity(key, config_value='', config_key=''): <NEW_LINE> <INDENT> entity = db.get(key) <NEW_LINE> if entity is not None: return entity <NEW_LINE> return models.Configuration(key_name=key.name(), config_value=config_value, config_key=config_key)
Get a config entity with given key or construct one using arguments.
625941ccd99f1b3c44c67683
def tf_data_transformations(self): <NEW_LINE> <INDENT> self.tf_data = tf.data.TFRecordDataset.list_files( self.data_path, seed=self.seed, shuffle=self.shuffle) <NEW_LINE> self.tf_data = self.tf_data.interleave( tf.data.TFRecordDataset, cycle_length=self.num_parallel_calls, block_length=1) <NEW_LINE> self.tf_data = self...
Loads the raw data and apply preprocessing. This method is also used in calculation of the dataset statistics (i.e., meta-data file).
625941cc7b25080760e3954d
def process(args): <NEW_LINE> <INDENT> if args.library: <NEW_LINE> <INDENT> print('Fetch CVEs..') <NEW_LINE> cves = getCVEsForLib(args.library.lower(), version=args.version.lower(), match_subversion=not args.no_match_subversion, match_unversioned=args.match_unversioned) <NEW_LINE> cves = sorted(set(map(itemgetter(0), c...
Implements the entire pipeline of finding the vulnerable functions of a library. It includes several steps: 1. Fetch known CVEs for the library (see getCVEsForLib()) 2. Fetch references for the CVEs (see getCVEReferences()) 3. Filter out all URLs from those references which might give us a patch (see PatchPattern.te...
625941cc5e10d32532c5f01b
def test_can_show_index_no_news(self): <NEW_LINE> <INDENT> response = self.client.get(reverse("openach:index")) <NEW_LINE> self.assertNotContains(response, "Project News")
Test that news panel isn't shown if there's not news to show.
625941cceab8aa0e5d26dc4c
def get_userid(self) -> int: <NEW_LINE> <INDENT> return self._stat.get('userid', 0)
Return user ID of the file owner
625941cca219f33f34628a5e
def merge(self, intervals): <NEW_LINE> <INDENT> if len(intervals) < 2: <NEW_LINE> <INDENT> return intervals <NEW_LINE> <DEDENT> intervals = sorted(intervals, key=lambda x: x.start) <NEW_LINE> pre_start = intervals[0].start <NEW_LINE> pre_end = intervals[0].end <NEW_LINE> out = [] <NEW_LINE> for it in intervals: <NEW_LI...
:type intervals: List[Interval] :rtype: List[Interval]
625941cc60cbc95b062c6638
def consulta(self, endereco, primeiro=False, bairro=None, uf=None, localidade=None, tipo='LOG', numero=None): <NEW_LINE> <INDENT> result = requests.post(URL_CORREIOS, data={'endereco': endereco, 'tipoCEP': tipo}) <NEW_LINE> dados = [] <NEW_LINE> try: <NEW_LINE> <INDENT> dados = result.json().get('dados') <NEW_LINE> dad...
Consulta site e retorna lista de resultados
625941cc7b25080760e3954e
def notify_data(self, key, value=None): <NEW_LINE> <INDENT> if key in self.notifiers: <NEW_LINE> <INDENT> self.logger.debug("Notifying watchers for key '%s'" % key) <NEW_LINE> if value is None: <NEW_LINE> <INDENT> value = self.get_data(key) <NEW_LINE> <DEDENT> for callback in self.notifiers[key]: <NEW_LINE> <INDENT> ca...
Notifies that a value was modified triggering the registered callback.
625941ccbd1bec0571d90724
def find_toy(*, toy_name: str = None, **kwargs) -> Toy: <NEW_LINE> <INDENT> toys = find_toys(toy_names=[toy_name] if toy_name else None, **kwargs) <NEW_LINE> if not toys: <NEW_LINE> <INDENT> raise ToyNotFoundError <NEW_LINE> <DEDENT> return toys[0]
Find a single toy that matches the criteria given. :param toy_name: A string of toy name that needs to be scanned. Set to ``None`` to scan toy with all kinds of names. :param timeout: Device scanning timeout, in seconds. :param toy_types: List of toy types (subclasses of :class:`Toy`) that needs to be scanned. Set to ...
625941cc236d856c2ad448cf
def cleanup(self, outfile): <NEW_LINE> <INDENT> statement = '''rm -rf %s; rm -rf %s;''' % ( self.tmpdir_fastq, self.tmpdir) <NEW_LINE> return statement
clean up.
625941cc283ffb24f3c559f6
def fill_walk(self): <NEW_LINE> <INDENT> while len(self.x_values) < self.num_points: <NEW_LINE> <INDENT> x_direction = choice([1]) <NEW_LINE> x_distance = choice(list(range(9))) <NEW_LINE> x_step = x_direction * x_distance <NEW_LINE> y_direction = choice([1]) <NEW_LINE> y_distance = choice(list(range(9))) <NEW_LINE> y_...
计算随机漫步包含的所有点
625941cc377c676e9127229d
def applyTransformation(self, M): <NEW_LINE> <INDENT> self.Origin = applyPointTransformation(self.Origin, M) <NEW_LINE> self.Points = applyPointTransformation(self.Points, M) <NEW_LINE> self.oAxis = applyVectorTransformation(self.oAxis, M) <NEW_LINE> self.xAxis = applyVectorTransformation(self.xAxis, M) <NEW_LINE> self...
| Apply affine transformation to the Source and its constitutents. | Input : 4x4 matrix.
625941cc435de62698dfdd41
def _calc_to_point(self, pos, verbose=0): <NEW_LINE> <INDENT> r = self._length(pos, self.source_center) <NEW_LINE> source_vec = (self.source_tip - self.source_bottom)/self._length(self.source_tip, self.source_bottom) <NEW_LINE> point_vec = pos - self.source_center <NEW_LINE> along = np.dot(point_vec, source_vec) <NEW_L...
perform a TG43 calculation pos: an np array of length 3. pos must be in the same units as self.source_center. This is typically cm. doserate = (Sk)*(drc)*G(r,theta)/G(1,90)*g(r)*F(r,theta) This function returns the doserate/(Sk) at pos.
625941cc0383005118ecf6d7
def _runWithHTMLReturnNoPytest(notebook, executable=None, **run_kw): <NEW_LINE> <INDENT> ret = "" <NEW_LINE> executable = executable or [sys.executable, "-m", "pytest", "-v"] <NEW_LINE> ret_tmp = run(notebook, **run_kw) <NEW_LINE> for test in ret_tmp: <NEW_LINE> <INDENT> test = test.to_html() <NEW_LINE> ret += "<p>" + ...
internal method to avoid pytest HTML
625941ccd10714528d5ffdd7
def periodic_feed_job_module(self, job): <NEW_LINE> <INDENT> consumed = False <NEW_LINE> for server_mod in self.modules: <NEW_LINE> <INDENT> consumed |= server_mod.process_periodic_job(job) <NEW_LINE> if consumed: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> return consumed
Feeds job to the modules :param job: :return: True if job was consumed
625941cc3c8af77a43ae3895
def _get_candidate_negatives(self): <NEW_LINE> <INDENT> if self._negatives_buffer.num_items() < self.negative: <NEW_LINE> <INDENT> max_cumsum_value = self._node_counts_cumsum[-1] <NEW_LINE> uniform_numbers = self._np_random.randint(1, max_cumsum_value + 1, self._negatives_buffer_size) <NEW_LINE> cumsum_table_indices = ...
Get candidate negatives of size `self.negative` from the negative examples buffer. Returns ------- numpy.array Array of shape (`self.negative`,) containing indices of negative nodes.
625941cca4f1c619b28b012e
def ast2list(node, order='dfs', _list=None, ignore_flag_order=False, arg_type_only=False, keep_common_args=False, with_flag_head=False, with_prefix=False): <NEW_LINE> <INDENT> if order == 'dfs': <NEW_LINE> <INDENT> if node.is_argument() and node.is_open_vocab() and arg_type_only: <NEW_LINE> <INDENT> token = node.arg_ty...
Linearize the AST.
625941cc5510c4643540f4d9
def test_actions(self): <NEW_LINE> <INDENT> self.assertEqual(len(self.p.actions), self.p.n_actions) <NEW_LINE> self.assertEqual(self.p.actions, [ 'wait', 'hold H', 'hold V', 'ask hold', 'bring top', 'bring joints', 'clear joints', 'bring leg', 'bring screwdriver', 'clear screwdriver', 'bring screws', 'clear screws']) <...
Same note as test_populate_conditions.
625941cc76d4e153a657ec26
def dydt(t, y, params): <NEW_LINE> <INDENT> T = params[0] <NEW_LINE> pa = params[1] <NEW_LINE> pb = params[2] <NEW_LINE> eads_co = params[3] <NEW_LINE> eads_h2 = params[4] <NEW_LINE> eact_coh_form_f = params[5] <NEW_LINE> eact_coh_form_b = params[6] <NEW_LINE> eact_coh_diss = params[7] <NEW_LINE> dydt = np.zeros(4) <N...
Set of ordinary differential equations
625941cc92d797404e30427e
def get_rows(hlines, w, h): <NEW_LINE> <INDENT> if not len(hlines): <NEW_LINE> <INDENT> return [Box(0, 0, w, h)] <NEW_LINE> <DEDENT> rows = [] <NEW_LINE> if hlines[0].x1 > 1: <NEW_LINE> <INDENT> rows.append(Box(0, 0, w, hlines[0].midy)) <NEW_LINE> <DEDENT> for i in range(1, len(hlines)): <NEW_LINE> <INDENT> rows.append...
Get top-left and bottom-right coordinates for each row from a list of vertical lines
625941cc293b9510aa2c338b
def _dup(self, other, deps=True, cleardeps=True, caches=None): <NEW_LINE> <INDENT> changed = True <NEW_LINE> if hasattr(self, 'name'): <NEW_LINE> <INDENT> changed = (self.name != other.name and self.versions != other.versions and self.architecture != other.architecture and self.compiler != other.compiler and self.varia...
Copy the spec other into self. This is an overwriting copy. It does not copy any dependents (parents), but by default copies dependencies. To duplicate an entire DAG, call _dup() on the root of the DAG. Args: other (Spec): spec to be copied onto ``self`` deps (bool or Sequence): if True copies all the depend...
625941cc3d592f4c4ed1d163
def macd_cross_v3_func(data, *args, **kwargs): <NEW_LINE> <INDENT> if (ST.VERBOSE in data.columns): <NEW_LINE> <INDENT> print('Phase macd_cross_func', QA_util_timestamp_to_str()) <NEW_LINE> <DEDENT> code = data.index.get_level_values(level=1)[0] <NEW_LINE> if ('indices' in kwargs.keys()): <NEW_LINE> <INDENT> indices = ...
神一样的指标:MACD A pd.DataFrame wrapper for function macd_cross_np() 此函数只做 np.ndarray 到 pd.DataFrame 的封装,实际计算由 纯 numpy 完成,便于后期改为 Cython 或者 Numba@jit 优化运行速度。 支持QA add_func,第二个参数 默认为 indices= 为已经计算指标 理论上这个函数只计算单一标的,不要尝试传递复杂标的,indices会尝试拆分。
625941cc92d797404e30427f
def get_input_data(self, variable, time_period): <NEW_LINE> <INDENT> input_data = copy.deepcopy(self.input_data) <NEW_LINE> input_data.set_values(InputType.VARIABLE, [variable]) <NEW_LINE> input_data.set_value(InputType.TIME_PERIOD, time_period) <NEW_LINE> if time_period in self.vocab.get_collection_terms(TemporalAvera...
Make a deep copy of self.get_input_data then update variable, time_period and temporal_average_type
625941cc046cf37aa974ce3d
def play_Note(note, channel=1, velocity=100): <NEW_LINE> <INDENT> return midi.play_Note(note, channel, velocity)
Converts a Note object to a `midi on` command. The channel and velocity can be set as Note attributes as well. If that's the case those values take presedence over the ones given here as function arguments. {{{ >>> n = Note("C", 4) >>> n.channel = 9 >>> n.velocity = 50 >>> FluidSynth.play_Note(n) }}}
625941cc66656f66f7cbc29f
def setPlayFileCallback(self, *args): <NEW_LINE> <INDENT> return _AriaPy.ArSoundsQueue_setPlayFileCallback(self, *args)
setPlayFileCallback(self, PlayItemFunctor cb)
625941cc4f6381625f114b2f
def take_measurements(self): <NEW_LINE> <INDENT> self._one_shot_bit = True <NEW_LINE> while self._one_shot_bit: <NEW_LINE> <INDENT> pass
Update the value of ``relative_humidity`` and ``temperature`` by taking a single measurement. Only meaningful if ``data_rate`` is set to ``ONE_SHOT``
625941cc8e71fb1e9831d89e
def test_remotes_file_read(self): <NEW_LINE> <INDENT> pass
Test case for remotes_file_read
625941ccadb09d7d5db6c884
def compile_term(self, tags=True, check=False): <NEW_LINE> <INDENT> type = self.tokenizer.token_type() <NEW_LINE> if (type == grammar.INT_CONST): <NEW_LINE> <INDENT> if check: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> self.vm.writePush(grammar.CONST, self.tokenizer.current_value) <NEW_LINE> <DEDENT> elif (typ...
RUTHI Compiles a term. This routine is faced with a slight difficulty when trying to decide between some of the alternative parsing rules. Specifically, if the current token is an identifier, the routine must distinguish between a variable, an array entry, and a subroutine call. A single look-ahead token, which may be...
625941cc925a0f43d2549f6c
def acquire(self, exclusive=True, block=False, timeout=-1, check_interval=1): <NEW_LINE> <INDENT> ret = True <NEW_LINE> print("acquiring lock group", self.keys) <NEW_LINE> for key in self.keys: <NEW_LINE> <INDENT> lock = lock_dict.setdefault(key, SharableLock(key)) <NEW_LINE> if lock.acquire(exclusive=exclusive, block=...
This function acquires a lock for each key that had been set by set_keys. If any key can not be acquired all locks are released and fails. Parameters ---------- exclusive block timeout check_interval Returns ------- success : bool True if all key locks were acquired
625941cc7d847024c06be3b0
def test_note_edit_route(cl_operator, note): <NEW_LINE> <INDENT> form = cl_operator.get(url_for('storage.note_edit_route', note_id=note.id)).form <NEW_LINE> form['data'] = 'edited ' + form['data'].value <NEW_LINE> form['return_url'] = url_for('storage.note_list_route') <NEW_LINE> response = form.submit() <NEW_LINE> ass...
note edit route test
625941cc8e7ae83300e4b0c1
def construct_bap_id(subscription_id): <NEW_LINE> <INDENT> return ('/subscriptions/{}' '/resourceGroups/{}' '/providers/Microsoft.Network' '/loadBalancers/{}' '/backendAddressPools/{}').format( subscription_id, GROUP_NAME, LB_NAME, ADDRESS_POOL_NAME )
Build the future BackEndId based on components name.
625941ccd18da76e235325cb
def _rec_check_predicates( incoming: JSONDict, *, predicates: JSONDict, start_dict: JSONDict = None, address: Tuple = (), ) -> List[Error]: <NEW_LINE> <INDENT> errors = [] <NEW_LINE> if start_dict is None: <NEW_LINE> <INDENT> start_dict = incoming <NEW_LINE> <DEDENT> for k, v in incoming.items(): <NEW_LINE> <INDENT> if...
Run predicates on input tree with fixed defaults. Parameters ---------- incoming : JSONDict The input `dict`. This is supposed to be the result of :func:`fix_defaults`. predicates : JSONDict A view-by-predicates of the template ``dict``. start_dict : JSONDict The `dict` we start recursion from. address : T...
625941ccb5575c28eb68e0f5
def _value_check_interval(self, value, span=(None, None), clamp=(False, False), exclusive=(False, False)): <NEW_LINE> <INDENT> if span == (None, None): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> if not all(isinstance(x, (float, int, type(None))) for x in span): <NEW_LINE> <INDENT> raise ArgumentException('Ele...
Check if the value is contained inside an interval :param value: The value :type value: int, float :param span: An interval as tuple. Default is ``(None, None)`` :type span: tuple, optional :param clamp: Control if value should be clamped at interval border. Default is ``(False, False)`` :type clamp: tuple, optional :...
625941ccd58c6744b4257d55
def points_of_bounded_height(self, **kwds): <NEW_LINE> <INDENT> if (is_RationalField(self.base_ring())): <NEW_LINE> <INDENT> ftype = False <NEW_LINE> <DEDENT> elif (self.base_ring() in NumberFields()): <NEW_LINE> <INDENT> ftype = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise NotImplementedError("self must be...
Return an iterator of the points in this affine space of absolute height of at most the given bound. Bound check is strict for the rational field. Requires this space to be affine space over a number field. Uses the Doyle-Krumm algorithm 4 (algorithm 5 for imaginary quadratic) for computing algebraic numbers up to a ...
625941ccbe7bc26dc91cd6f5
def imshow(inp, title=None): <NEW_LINE> <INDENT> inp = inp.cpu().numpy() <NEW_LINE> inp = inp.transpose((1, 2, 0)) <NEW_LINE> mean = np.array([0.485, 0.456, 0.406]) <NEW_LINE> std = np.array([0.229, 0.224, 0.225]) <NEW_LINE> inp = std * inp + mean <NEW_LINE> inp = np.clip(inp, 0, 1) <NEW_LINE> plt.figure(figsize = (10,...
Imshow for Tensor.
625941cc5166f23b2e1a524e
def create_model(self, model_input, vocab_size, num_frames, **unused_params): <NEW_LINE> <INDENT> lstm_size = int(FLAGS.lstm_cells) <NEW_LINE> number_of_layers = FLAGS.lstm_layers <NEW_LINE> stacked_lstm = tf.contrib.rnn.MultiRNNCell( [ tf.contrib.rnn.BasicLSTMCell( lstm_size, forget_bias=1.0, state_is_tuple=False) for...
Creates a model which uses a stack of LSTMs to represent the video. Args: model_input: A 'batch_size' x 'max_frames' x 'num_features' matrix of input features. vocab_size: The number of classes in the dataset. num_frames: A vector of length 'batch' which indicates the number of frames for e...
625941cc9f2886367277a982
def aks_k8s_config(): <NEW_LINE> <INDENT> sh_cmd = "echo "'$(terraform output kube_config)'" > OpenInnok8s" <NEW_LINE> print(sh_cmd) <NEW_LINE> tf_command_helper_sys(sh_cmd) <NEW_LINE> sh_cmd = "mkdir ~/.kube/config" <NEW_LINE> print(sh_cmd) <NEW_LINE> tf_command_helper_sys(sh_cmd) <NEW_LINE> sh_cmd = "cp -p /Users/mic...
configure aks k8s kubeconfig :return:
625941cc30bbd722463cbebb
def hincr(self, name, key, amount=1): <NEW_LINE> <INDENT> amount = get_integer('amount', amount) <NEW_LINE> return self.execute_command('hincr', name, key, amount)
Increase the value of ``key`` in hash ``name`` by ``amount``. If no key exists, the value will be initialized as ``amount`` Like **Redis.HINCR** :param string name: the hash name :param string key: the key name :param int amount: increments :return: the integer value of ``key`` in hash ``name`` :rtype...
625941ccd4950a0f3b08c444
def configure(self, device, raw_config): <NEW_LINE> <INDENT> pass
Configure the plugin so that the raw config is applied to the device. This method MUST not synchronize the configuration between the phone and the provisioning server. This method is called only to synchronize the config between the config manager and the plugin. See the synchronize method for more info on the device c...
625941cc462c4b4f79d1d7c6
@property <NEW_LINE> def instantaneous_temperature(snapshot): <NEW_LINE> <INDENT> engine = snapshot.engine <NEW_LINE> try: <NEW_LINE> <INDENT> old_snap = engine.current_snapshot <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> old_snap = None <NEW_LINE> <DEDENT> engine.current_snapshot = snapshot <NEW_LINE> st...
Returns ------- instantaneous_temperature : openmm.unit.Quantity (temperature) instantaneous temperature from the kinetic energy of this snapshot
625941cc4527f215b584c54c
def _get_norms_of_cols(data_frame, method): <NEW_LINE> <INDENT> if method == 'first': <NEW_LINE> <INDENT> norm_vector = data_frame.iloc[0, :].values <NEW_LINE> <DEDENT> elif method == 'mean': <NEW_LINE> <INDENT> norm_vector = np.mean(data_frame.values, axis=0) <NEW_LINE> <DEDENT> elif method == 'last': <NEW_LINE> <INDE...
return a row vector containing the norm of each column
625941cc0383005118ecf6d8
def on_request(self, jwt_user: JWTUser) -> None: <NEW_LINE> <INDENT> pass
just force authentication for each request
625941cc097d151d1a222f4f
def handle_next_turn(self, intent): <NEW_LINE> <INDENT> self.advance_date() <NEW_LINE> return "now in turn" + str(self.turns)
Args: intent: Returns:
625941cc7b180e01f3dc48f2