code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def getLut(self): <NEW_LINE> <INDENT> return self._imageItem.lut if self._imageItem else None
Returns the Lookup table of the image item.
625941d130c21e258bdfa620
def list_credentials(self, args): <NEW_LINE> <INDENT> fltr = args.get("filter", "") <NEW_LINE> obj = asset.Credentials(sFilter=fltr) <NEW_LINE> if args.get("output_format") == "json": <NEW_LINE> <INDENT> return R(response=obj.AsJSON()) <NEW_LINE> <DEDENT> elif args.get("output_format") == "text": <NEW_LINE> <INDENT> re...
Lists all Shared Credentials. Optional Arguments: * `filter` - will filter a value match in Credential Name, Username, Domain or Description. (Multiple filter arguments can be provided, delimited by spaces.) Returns: A list of [Credential Objects](restapi/api-response-objects.html#Credential){:target="_blank"}.
625941d1283ffb24f3c55a83
def get_failed_commands(self): <NEW_LINE> <INDENT> if self._failed_commands is None: <NEW_LINE> <INDENT> if not os.path.isdir(self.build_artifact_dir): <NEW_LINE> <INDENT> message = 'Build artifact dir {} does not exist'.format(self.build_artifact_dir) <NEW_LINE> self._logger.error(message) <NEW_LINE> raise RuntimeErro...
:return: a dictionary of atom names (e.g. artifact_0_0) to failed commmands :rtype dict of [str, str]
625941d13317a56b86939dda
def jp_fr_dict_gen(wolfPath, wnjpPath, output=None): <NEW_LINE> <INDENT> if not(output): <NEW_LINE> <INDENT> output = os.path.join(os.path.split(wolfPath)[0], 'wolf-jpwn.dict') <NEW_LINE> <DEDENT> wnjp = jpwn_reader(wnjpPath) <NEW_LINE> wolf = etree.parse(wolfPath) <NEW_LINE> for synset in wolf.iterfind('.//SYNSET'): <...
Remplacer les deux sources en paramètre par des objets de type reader #TODO: Introduire itertools.groupby(data, keyfunc) qui permettra de remplacer uniq
625941d1a934411ee3751816
def render_query(query, engine_type, config=None): <NEW_LINE> <INDENT> metadata = {} <NEW_LINE> if not isinstance(query, PipedQuery): <NEW_LINE> <INDENT> metadata['_source'] = query <NEW_LINE> query = parse_query(query) <NEW_LINE> <DEDENT> analytic = EqlAnalytic(query=query, metadata=metadata) <NEW_LINE> rendered = ren...
Render the full script for an EQL query. :param str|PipedQuery query: The query text or parsed query :param str engine_type: The target scripting engine :param dict config: The configuration for PythonEngine
625941d1e8904600ed9f20b0
def part2(lines): <NEW_LINE> <INDENT> all_numbers = {} <NEW_LINE> d = {} <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> number, _, pos, size = line.split(" ") <NEW_LINE> n = int(number.split("#")[1]) <NEW_LINE> x, y = map(int, pos.split(":")[0].split(",")) <NEW_LINE> w, h = map(int, size.split("\n")[0].split("x")) <...
>>> part2(load_example(__file__, '3')) 3
625941d13346ee7daa2b2eef
def third_party_sign_in(platform_name): <NEW_LINE> <INDENT> data = plugin_manager.call_plug(hook_name="{}_login".format(platform_name), request_argget_all=request.argget.all) <NEW_LINE> if data == "__no_plugin__": <NEW_LINE> <INDENT> data = { "msg": gettext("No login processing plugin for this platform, please install ...
第三方登录回调函数 :param hook_name: 第三方登录钩子名称,如:"wechat_login" :return:
625941d107d97122c4178a10
@bottle.get("/") <NEW_LINE> @bottle.get(r"/<path:re:.*\.(html|js|css|woff2|woff|ttf|jpg)>") <NEW_LINE> def static(path=None): <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> path = "index.html" <NEW_LINE> <DEDENT> return bottle.static_file(path, root=STATIC_ROOT)
Unsafe method used only for dev
625941d130c21e258bdfa621
def toggle_brightness(self): <NEW_LINE> <INDENT> leds = self.led_settings <NEW_LINE> leds['dim_state'] = not leds['dim_state'] <NEW_LINE> sense.low_light = leds['dim_state']
Toggles the SenseHAT between high/low brightness settings.
625941d1adb09d7d5db6c912
def get_reports_as_text(config_reports_map, macro_id, is_from_transform=False): <NEW_LINE> <INDENT> text = "" <NEW_LINE> config_warnings_list = [] <NEW_LINE> config_issues_list = [] <NEW_LINE> main_reports = set(config_reports_map.get(None, [])) <NEW_LINE> conf_keys = list(config_reports_map) <NEW_LINE> conf_keys = sor...
Translate reports into nicely formatted text.
625941d14428ac0f6e5ba976
def find_ruler_width(self): <NEW_LINE> <INDENT> return self.config.getint('FindRuler', 'Width')
Returns width of image used for finding ruler.
625941d1956e5f7376d70ff0
def should_skip_step(execution_plan: ExecutionPlan, instance: DagsterInstance, run_id: str) -> bool: <NEW_LINE> <INDENT> check.inst_param(execution_plan, "execution_plan", ExecutionPlan) <NEW_LINE> check.inst_param(instance, "instance", DagsterInstance) <NEW_LINE> check.str_param(run_id, "run_id") <NEW_LINE> if len(exe...
[INTERNAL] Check if it should skip executing the plan. Primarily used by execution without run-level plan process, e.g. Airflow step execution. Note: this only checks one step at a time. For each Dagster execution step - if none of its inputs come from optional outputs, do not skip - if there is at least one input, wh...
625941d150485f2cf553cf1d
def get_word(self, customization_id, word_name): <NEW_LINE> <INDENT> if customization_id is None: <NEW_LINE> <INDENT> raise ValueError('customization_id must be provided') <NEW_LINE> <DEDENT> if word_name is None: <NEW_LINE> <INDENT> raise ValueError('word_name must be provided') <NEW_LINE> <DEDENT> url = '/v1/customiz...
Lists a custom word from a custom language model. Lists information about a custom word from a custom language model. You must use credentials for the instance of the service that owns a model to query information about its words. :param str customization_id: The GUID of the custom language model from which a word is...
625941d11f5feb6acb0c4cd3
def run_pipieline(params): <NEW_LINE> <INDENT> print('Submitting radiation calculation for cases') <NEW_LINE> procs = run_cases(params) <NEW_LINE> print() <NEW_LINE> print('Submitting analysis for cases') <NEW_LINE> aprocs = {} <NEW_LINE> all_being_analysed = False <NEW_LINE> while not all_being_analysed: <NEW_LINE> <I...
Runs lblnew pipeline for one or more sets of input values. Parameters ---------- params: list-like List of dictionaries. One dictionary for each set of lblnew input values.
625941d17d43ff24873a2e24
def respond(self): <NEW_LINE> <INDENT> for action in self.legal: <NEW_LINE> <INDENT> if isinstance(action, Raise): <NEW_LINE> <INDENT> return Raise(self.pip + self.stack) <NEW_LINE> <DEDENT> return Call() <NEW_LINE> <DEDENT> for action in self.legal: <NEW_LINE> <INDENT> if isinstance(action, Bet): <NEW_LINE> <INDENT> i...
Based on your game state variables (see the __init__), make a decision and return an action. If you return an illegal action, the engine will automatically fold you
625941d1f8510a7c17cf987f
def inventory(self, all=False, ssid=None): <NEW_LINE> <INDENT> if all or self.api_key is None: <NEW_LINE> <INDENT> if ssid is not None: <NEW_LINE> <INDENT> return self._ssid_inventory(self.full_inventory, ssid) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.full_inventory <NEW_LINE> <DEDENT> <DEDENT> else: <...
Returns a node inventory. If an API key is specified, only the nodes provisioned by this key will be returned. :return: { inventory }
625941d1435de62698dfddd0
def dna_properties_batch(seqs): <NEW_LINE> <INDENT> seqs = [str(seq) for seq in seqs] <NEW_LINE> gcs = [GC(seq) for seq in seqs] <NEW_LINE> Tms = melting_temp(seqs) <NEW_LINE> ss_dGs = hybrid_ss_min(seqs) <NEW_LINE> self_hyb_dGs = [r[0] for r in hybrid_min(seqs, seqs)] <NEW_LINE> return [DNAProp(*tup) for tup in zip(se...
Return a list of namedtuple with some DNA properties seqs is a list[Bio.Seq.Seq or str] representing DNA sequences
625941d1091ae356686670e0
def estimate(self, fin): <NEW_LINE> <INDENT> num = get_sample_size(fin) <NEW_LINE> if self.pmin < self.ratio / num: <NEW_LINE> <INDENT> cheb = np.polynomial.chebyshev.Chebyshev.basis(self.degree) <NEW_LINE> cheb_coeffs = np.polynomial.chebyshev.cheb2poly(cheb.coef) <NEW_LINE> shift = (self.ratio + num*self.pmin) / (sel...
Our rate-optimal estimator from a given fingerprint Args: fin: list of tuples (frequency, count) fingerprint of samples, fin[i] is the number of symbols that appeared exactly i times Return: the estimated entropy (bits)
625941d1de87d2750b85ff16
def getInputLayer(self): <NEW_LINE> <INDENT> assert len(self.network.inmodules) == 1 <NEW_LINE> return self.network.inmodules[0]
Returns the input layer.
625941d13617ad0b5ed6807b
def main(): <NEW_LINE> <INDENT> cur, conn = setUpDatabase('finalProjectDatabase.db') <NEW_LINE> temperatures, happy_scores, precipitation, city_names = calculation(cur) <NEW_LINE> visualization1(temperatures, happy_scores, city_names) <NEW_LINE> visualization2(precipitation, happy_scores, city_names) <NEW_LINE> box_and...
The main() function akes in no inputs. It calls the calculations function to return data for temperature, happiness scores, precipitation, and city names, and uses these to call the visualization1() and visualization2() functions. Finally, the box_and_wiskers() function is called on precipitation, temperatures and h...
625941d1287bf620b61d3be6
def setUp(self): <NEW_LINE> <INDENT> self.gtidset1 = "35588520:333217-740055" <NEW_LINE> self.gtidset2 = "35588520:1-740055,76012896:1-502108"
Function: setUp Description: Initialization for unit testing. Arguments:
625941d18c3a87329515853f
def performSetValue(self, quant, value, sweepRate=0.0, options={}): <NEW_LINE> <INDENT> if quant.name == 'Auto-detect': <NEW_LINE> <INDENT> if value: <NEW_LINE> <INDENT> self.auto_detect() <NEW_LINE> <DEDENT> <DEDENT> elif quant.name == 'Scan': <NEW_LINE> <INDENT> self.auto_detect() <NEW_LINE> <DEDENT> else: <NEW_LINE>...
Perform the Set Value instrument operation. This function should return the actual value set by the instrument
625941d1097d151d1a222fdd
def hex_dump(machine, cols=32): <NEW_LINE> <INDENT> return ''.join(s for s in hex_dump_generator(machine.memory, cols))
Returns a hexdump string of memory.
625941d1e76e3b2f99f3a98d
@dog_stats_api.timed('status.service.celery.ping') <NEW_LINE> def celery_ping(_): <NEW_LINE> <INDENT> start = time.time() <NEW_LINE> result = tasks.delayed_ping.apply_async(('ping', 0.1)) <NEW_LINE> task_id = result.id <NEW_LINE> try: <NEW_LINE> <INDENT> value = result.get(timeout=4.0) <NEW_LINE> success = True <NEW_LI...
A Simple view that checks if Celery can process a simple task
625941d1435de62698dfddd1
def symbol_to_path(symbol, base_dir="/home/jill/Downloads/"): <NEW_LINE> <INDENT> return os.path.join(base_dir, "{}.csv".format(str(symbol)))
Return CSV file path given ticker symbol.
625941d11f037a2d8b946381
def write_xml(self, fname, xmltree): <NEW_LINE> <INDENT> tmpfile = "%s.new" % fname <NEW_LINE> datafile = None <NEW_LINE> fd = None <NEW_LINE> i = 0 <NEW_LINE> while datafile is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fd = os.open(tmpfile, os.O_CREAT | os.O_EXCL | os.O_WRONLY) <NEW_LINE> datafile = os.fdopen...
Write changes to xml back to disk.
625941d1aad79263cf390bc5
def test_disable_require_webdriver_without_webdriver(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> seleniumconfig.disable_check_for_selenium_webdriver = True <NEW_LINE> Element(driver=MyDriver(driver=self.driver), locator=None) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> seleniumconfig.disable_check_for_sele...
This test is making sure that it does not matter if driver is a Webdriver or not
625941d115baa723493c40f9
def test_has_description(self): <NEW_LINE> <INDENT> form = forms.CampaignForm({ 'name': factories.campaign_name(), 'description': factories.campaign_description(), 'owner': factories.UserFactory.create().id, }) <NEW_LINE> self.assertTrue(form.is_valid())
Create a CampaignForm and set ``description``.
625941d115baa723493c40fa
def update(self, *args): <NEW_LINE> <INDENT> return _Context.TradeBook_update(self, *args)
int mutrade::TradeBook::update(ExecutionReport &report) Updates the trade in the TradeBook. This method updates the trades which are receieved as executions from the exchange. The user of the API does not need to call this method. It is called by the API automatically when an execution is received.
625941d130dc7b7665901ae9
def visit_ClassDef(self, node): <NEW_LINE> <INDENT> name = ast.Name(node.name, ast.Store(), lineno=node.lineno) <NEW_LINE> name.first_line, name.first_col = name.uid = node.uid <NEW_LINE> name.first_col += 1 <NEW_LINE> name.last_line = name.first_line <NEW_LINE> name.last_col = name.first_col + len(node.name) <NEW_LINE...
Visit ClassDef. Create special function call
625941d1091ae356686670e1
def _set_changelog(self): <NEW_LINE> <INDENT> release = '{0} ({1}-{2}) trusty; urgency=low'.format(self.name, self.version, self.revision) <NEW_LINE> user_msg = '' <NEW_LINE> if not self.automode: <NEW_LINE> <INDENT> self.feedback.input('Enter an optional changelog message: ', 'changelog_msg', default=None) <NEW_LINE...
Set the next changelog entry prior to building.
625941d150812a4eaa59c4a4
def test_delete_volume_metadata_with_metatype(self): <NEW_LINE> <INDENT> test_meta1 = {'fake_key1': 'fake_value1', 'fake_key2': 'fake_value2'} <NEW_LINE> test_meta2 = {'fake_key1': 'fake_value1'} <NEW_LINE> FAKE_METADATA_TYPE = enum.Enum('METADATA_TYPES', 'fake_type') <NEW_LINE> volume = tests_utils.create_volume(self....
Test delete volume metadata with different metadata type.
625941d1711fe17d825424ee
def createBackup(config): <NEW_LINE> <INDENT> xmlFilepath = config['xmlFilepath'] <NEW_LINE> if os.path.isfile(xmlFilepath): <NEW_LINE> <INDENT> backupDir = config["rssBackupDir"] <NEW_LINE> try: <NEW_LINE> <INDENT> os.makedirs(backupDir) <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> if not os.path.isdir(back...
Create a backup of the XML file. Return the location of the backup file so that we can restore it upon a write failure.
625941d126238365f5f0eff2
def factory(self, datapointer, group, content_type, can_write): <NEW_LINE> <INDENT> return factory(content_type)(self.factory, create_content, datapointer, group=group, can_write=can_write)
Return contained list slice.
625941d14d74a7450ccd4347
def get_bounding_box(path): <NEW_LINE> <INDENT> shapefile = ogr.Open(path) <NEW_LINE> layer = shapefile.GetLayer(0) <NEW_LINE> countries = [] <NEW_LINE> for i in range(layer.GetFeatureCount()): <NEW_LINE> <INDENT> feature = layer.GetFeature(i) <NEW_LINE> countryCode = feature.GetField("ISO3") <NEW_LINE> countryName = f...
Calculate polygon's bounding box. path = os.path.join(home, "countries", "TM_WORLD_BORDERS-0.3.shp") :return: :rtype:
625941d1e1aae11d1e749e3b
def generate_language_tensor(language): <NEW_LINE> <INDENT> t = torch.zeros(1, n_language) <NEW_LINE> t[0][language_list.index(language)] = 1 <NEW_LINE> return t
Generate the one-hot language tensor
625941d18da39b475bd650f8
def unregister_callback(self, name, callback): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> callbacks = self._callbacks[name] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise MPVError(f"no callbacks registered for event {name!r}") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> callbacks.remove(callback) <NE...
Unregister a previously registered function `callback` for the event `name`.
625941d1462c4b4f79d1d854
def restore(self, name='default', filename=None, level=0): <NEW_LINE> <INDENT> self._update_magic_objects(level=level+1) <NEW_LINE> super(MagicNetwork, self).restore(name=name, filename=filename) <NEW_LINE> self.objects[:] = []
See `Network.store`.
625941d18da39b475bd650f9
def back_method(self): <NEW_LINE> <INDENT> self.root.destroy() <NEW_LINE> Main()
back to main menu
625941d1baa26c4b54cb12a2
def nextPermutation(self, nums): <NEW_LINE> <INDENT> i = len(nums)-1 <NEW_LINE> while i>=0 and nums[i-1] >= nums[i]: <NEW_LINE> <INDENT> i-=1 <NEW_LINE> <DEDENT> if i > 0: <NEW_LINE> <INDENT> tmp = nums[i-1] <NEW_LINE> j = len(nums)-1 <NEW_LINE> while j >= 0 and nums[j] <= tmp: <NEW_LINE> <INDENT> j-=1 <NEW_LINE> <DEDE...
:type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead.
625941d126238365f5f0eff3
def room_four(): <NEW_LINE> <INDENT> background(100) <NEW_LINE> fill(255) <NEW_LINE> rect(0, 300, 960, 240) <NEW_LINE> for x in range(100, 661, 280): <NEW_LINE> <INDENT> fill(255) <NEW_LINE> rect(x, 150, 200, 150) <NEW_LINE> fill(0) <NEW_LINE> line(x, 200, x+200, 200) <NEW_LINE> line(x, 250, x+200, 250)
Draw laboratory storage :return: None
625941d1cb5e8a47e48b7c2d
def convert_collection_to_dict(collection): <NEW_LINE> <INDENT> return OrderedDict((alias, tensor) for tensor in ops.get_collection(collection) for alias in get_tensor_aliases(tensor))
Returns an OrderedDict of Tensors with their aliases as keys. Args: collection: A collection. Returns: An OrderedDict of {alias: tensor}
625941d1d6c5a102081441cf
def _send_req(self, message): <NEW_LINE> <INDENT> s = message.SerializeToString() <NEW_LINE> packed_len = struct.pack('>H', len(s)) <NEW_LINE> self.s.sendall(packed_len + s)
Send a serialized message (protobuf Message interface) to a socket, prepended by its length packed in 2 bytes (big endian).
625941d18a349b6b435e82f7
def compute_security_checksum(**data): <NEW_LINE> <INDENT> secret_key = settings.POSTFINANCE_SECRET_KEY <NEW_LINE> contents = dict([(key.upper(), value) for key, value in data.items()]) <NEW_LINE> hash_string = "" <NEW_LINE> for key, value in sorted(contents.items()): <NEW_LINE> <INDENT> hash_string += "%s=%s%s" % (key...
Used to send a security checksum of parameters to postfinance
625941d1d58c6744b4257de4
def download_now(self, url): <NEW_LINE> <INDENT> self.get_url = url <NEW_LINE> self.infopop() <NEW_LINE> self.add_popup_text('Starting...') <NEW_LINE> ui.delay(self.do_download,2)
To Be Completely honest, I forget.
625941d16e29344779a62795
def test_store_fetch_dispatch(self): <NEW_LINE> <INDENT> ar = self.er.store( 'ga', 'event', '20538abc-a8af-46e0-b292-0999d94468e9', category='user', action='action_name', aip='1', uip='1.2.3.4', ds='web', ua='my-useragent-test') <NEW_LINE> self.assertTrue(ar == None) <NEW_LINE> expected = { 'handler': 'ga', 'etype': 'e...
Checks to see that the EventReporter stores expected data
625941d176d4e153a657ecb5
def build(self, dirname): <NEW_LINE> <INDENT> assert os.path.isdir(dirname) <NEW_LINE> with open(os.path.join(dirname, 'flexx.js')) as f: <NEW_LINE> <INDENT> f.write(self.get_js()) <NEW_LINE> <DEDENT> with open(os.path.join(dirname, 'flexx.css')) as f: <NEW_LINE> <INDENT> f.write(self.get_css())
Create the flexx js library and css file. Place in the given dir.
625941d1be383301e01b5608
def talk_m10_17_x14(text12=_, text13=_): <NEW_LINE> <INDENT> CloseNpcMenu() <NEW_LINE> if NpcMenuDisplay() != 1 and NpcMenuUsageResult() != 0: <NEW_LINE> <INDENT> assert talk_m10_17_x1(text8=text12, flag15=0, z37=-1, z38=0) <NEW_LINE> <DEDENT> elif NpcMenuDisplay() != 1: <NEW_LINE> <INDENT> assert talk_m10_17_x1(text8=...
[Lib] Menu exit: General purpose text12: Conversation ID (at the time of purchase) text13: Conversation ID (when not purchased)
625941d1ac7a0e7691ed424f
def _initialize_session(self): <NEW_LINE> <INDENT> config = tf.ConfigProto() <NEW_LINE> config.gpu_options.allow_growth = True <NEW_LINE> self.sess = tf.Session(config=config) <NEW_LINE> tf_ver = int(tf.__version__.split('.')[1]) <NEW_LINE> if tf_ver <= 0.10: <NEW_LINE> <INDENT> self.sess.run(tf.initialize_all_variable...
Initialize session, variables, saver
625941d1d8ef3951e32436c2
def test_time_slot_add(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('projects_task_time_slot_add', args=[self.task.id])) <NEW_LINE> self.assertEquals(response.status_code, 200)
Test index page with login at /projects/task/view/time/<task_id>add/
625941d166673b3332b92215
def __getattr__(self, _): <NEW_LINE> <INDENT> return None
If we don't have the requested attribute return None.
625941d129b78933be1e582f
def uniquePathsWithObstacles(self, obstacleGrid): <NEW_LINE> <INDENT> if obstacleGrid[0][0] ==1: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> lenX = len(obstacleGrid) <NEW_LINE> lenY = len(obstacleGrid[0]) <NEW_LINE> if obstacleGrid[0][0] ==0 and lenX==1 and lenY==1: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT>...
:type obstacleGrid: List[List[int]] :rtype: int
625941d199cbb53fe6792d6a
def calibrate(self, measurement_mode=constants.I1_SINGLE_EMISSION, color_space=constants.COLOR_SPACE_CIExyY, final_prompt="\nPlease put i1 Pro in measurement position" + "and hit button to start measurement."): <NEW_LINE> <INDENT> if(self.I1_SetOption(constants.I1_MEASUREMENT_MODE, measurement_mode) == constants.eNoErr...
Sets i1 Pro to measurement mode and color space and calibrates i1 Pro for use. Parameters: measurement_mode: *eyeone.constants.I1_SINGLE_EMISSION* or other string defined in eyeone.constants color_space: *eyeone.constants.COLOR_SPACE_CIExyY* or other string defined in eyeone.constants fi...
625941d1be7bc26dc91cd783
def test_outside_range(caplog): <NEW_LINE> <INDENT> from hrmonitor import HRMonitor <NEW_LINE> HRMonitor(get_test_file(32)) <NEW_LINE> assert 'Voltage values outside of typical range' in caplog.text
Test if files with inputs outside the normal range are noted in the logs (test_data32.csv)
625941d1d486a94d0b98e2ca
def test_arguments1(self): <NEW_LINE> <INDENT> decl = rmic.arguments() <NEW_LINE> self.assertEqual(decl['RMIC']['help'], 'The Java RMI stub compiler') <NEW_LINE> self.assertEqual(decl['RMIC']['metavar'], 'PROG') <NEW_LINE> self.assertEqual(decl['RMICFLAGS']['help'], 'General options passed to the Java RMI stub compiler...
Test SConsArguments.rmic.arguments()
625941d185dfad0860c3afdf
def tearDown(self): <NEW_LINE> <INDENT> self.url_font.delete() <NEW_LINE> self.origin.delete()
Final method
625941d1d164cc6175782ed2
def train_net(solver_prototxt, roidb, output_dir, pretrained_model=None, solver_state=None, max_iters=40000): <NEW_LINE> <INDENT> sw = SolverWrapper(solver_prototxt, roidb, output_dir, pretrained_model=pretrained_model, solver_state=solver_state) <NEW_LINE> print('Solving...') <NEW_LINE> model_paths = sw.train_model(ma...
Train *any* object detection network.
625941d1236d856c2ad44960
def getHumanTagName(tagName): <NEW_LINE> <INDENT> return tagName.replace('_', ' ')
Replace _ by a space
625941d12eb69b55b151ca34
def test_update_user_profile(self): <NEW_LINE> <INDENT> payload = {"name": "new_name", "password": "new_password"} <NEW_LINE> self.client.patch(ME_URL, payload) <NEW_LINE> self.active_user.refresh_from_db() <NEW_LINE> assert self.active_user.name == payload["name"] <NEW_LINE> assert self.active_user.check_password(payl...
Test updating user profile for an authenticated user
625941d1a79ad161976cc2ca
def __init__(self, stochastic_round=False, learning_rate=0.001, beta_1=0.9, beta_2=0.999, epsilon=1e-8, name="adam"): <NEW_LINE> <INDENT> super(Adam, self).__init__(name=name) <NEW_LINE> self.beta_1 = beta_1 <NEW_LINE> self.beta_2 = beta_2 <NEW_LINE> self.epsilon = epsilon <NEW_LINE> self.learning_rate = learning_rate ...
Class constructor. Args: stochastic_round (bool): Set this to True for stochastic rounding. If False rounding will be to nearest. If True will perform stochastic rounding using default width. Only affects the gpu backend. le...
625941d185dfad0860c3afe0
def getExamTimetable(self, date, month): <NEW_LINE> <INDENT> session = self.startSession() <NEW_LINE> dateTimeIdx = 0 <NEW_LINE> prayerSlotIdx = 1 <NEW_LINE> locationIdx = 2 <NEW_LINE> examIdx = 3 <NEW_LINE> result = [{ 'id': exam[examIdx].id, 'code': exam[examIdx].moduleCode, 'hour': exam[dateTimeIdx].timeHour, 'minut...
Fetch and Returns [{ id: examId, code: moduleCode, hour: hour, minute: minute, date: date, month: month, location: location, meetingPoint: meetingPoint, prayerSlotId: prayerSlotId }, ] No changes made to database
625941d115fb5d323cde0c95
def _get_end_dates_from_content_dates(qset): <NEW_LINE> <INDENT> end_content_date = list(filter(lambda cd: cd.location.block_type == 'course' and cd.field == 'end', qset)) <NEW_LINE> if not end_content_date: <NEW_LINE> <INDENT> return None, None <NEW_LINE> <DEDENT> end_datetime = end_content_date[0].policy.abs_date <NE...
Get end and cutoff dates from a queryset of ContentDates.
625941d191f36d47f21ac678
def pyflakes_check(codeString, filename='(code)'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> tree = compile(codeString, filename, "exec", _ast.PyCF_ONLY_AST) <NEW_LINE> <DEDENT> except SyntaxError: <NEW_LINE> <INDENT> value = sys.exc_info()[1] <NEW_LINE> return [(value.lineno, value.offset, value.args[0])] <NEW_LINE...
This is a monkey-patch for flake8.pyflakes.check. Return array of errors instead of print them into STDERR.
625941d191af0d3eaac9bb9e
def sparse_equal(sparr_1: sparse.spmatrix, sparr_2: sparse.spmatrix, rtol: float = 1e-05, atol: float = 1e-08): <NEW_LINE> <INDENT> Acsr, Bcsr = sparr_1.tocsr(), sparr_2.tocsr() <NEW_LINE> A_empty = (Acsr.size == 0) <NEW_LINE> B_empty = (Bcsr.size == 0) <NEW_LINE> if A_empty and B_empty: <NEW_LINE> <INDENT> return True...
Test whether two COO sparse matrices are equal.
625941d1a8370b7717052a23
def drsuapi_connect(server, lp, creds): <NEW_LINE> <INDENT> binding_options = "seal" <NEW_LINE> if lp.log_level() >= 9: <NEW_LINE> <INDENT> binding_options += ",print" <NEW_LINE> <DEDENT> binding_string = "ncacn_ip_tcp:%s[%s]" % (server, binding_options) <NEW_LINE> try: <NEW_LINE> <INDENT> drsuapiBind = drsuapi.drsuapi...
Make a DRSUAPI connection to the server. :param server: the name of the server to connect to :param lp: a samba line parameter object :param creds: credential used for the connection :return: A tuple with the drsuapi bind object, the drsuapi handle and the supported extensions. :raise drsException: if the ...
625941d1bf627c535bc13353
def parse_texts_in_dir(directory, save_dir, nested=False): <NEW_LINE> <INDENT> if nested: <NEW_LINE> <INDENT> for subdir in os.listdir(directory): <NEW_LINE> <INDENT> for file in os.listdir(directory+subdir): <NEW_LINE> <INDENT> file_path = directory+subdir+'/'+file <NEW_LINE> new_file_name = save_dir+'/'+subdir+'_'+fi...
Parse and save texts in given (nested) directory.
625941d167a9b606de4a803e
def select_database(path): <NEW_LINE> <INDENT> return pytest.mark.parametrize("load_database", [path], indirect=True)
Decorator to facilitate safe, fast loading of database objects. Use as ``` @select_database("filename.tdb") # matches a file in the pycalphad.test.databases directory def test_name_of_my_test(load_database): dbf = load_database() # equivalent to `dbf = Database("filename.tdb") # ... implement test below ```
625941d1851cf427c661a692
def start(self): <NEW_LINE> <INDENT> if not self.state.start(): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> self.schedule.start = doto.model.now_with_tz() <NEW_LINE> return True
Start the task. This method marks the task as started and also sets the start date
625941d166673b3332b92216
def is_resources_sufficient(order): <NEW_LINE> <INDENT> check = [ True if MENU[order][key] <= resources[key] else False for key, value in MENU[order].items() ] <NEW_LINE> return not False in check[:-1]
Returns True when order can be made, False if ingredients are insufficient.
625941d126068e7796caee64
def count_score(): <NEW_LINE> <INDENT> from itertools import chain <NEW_LINE> c1 = [randint(60, 100) for _ in range(40)] <NEW_LINE> c2 = [randint(60, 100) for _ in range(42)] <NEW_LINE> c3 = [randint(60, 100) for _ in range(36)] <NEW_LINE> c4 = [randint(60, 100) for _ in range(38)] <NEW_LINE> count = 0 <NEW_LINE> for s...
有4个班级 统计每个班级大于90分人数
625941d12eb69b55b151ca35
def start(bot, update): <NEW_LINE> <INDENT> update.message.reply_text('Hola! soy anakena bot puedo realizar operaciones como ' 'print, papel') <NEW_LINE> logger.info(update.message)
Send a message when the command /start is issued.
625941d1ab23a570cc250308
def transform(image, crop_height, crop_width, resize_height=64, resize_width=64, is_crop=True): <NEW_LINE> <INDENT> def center_crop(image, crop_h, crop_w, resize_h=64, resize_w=64): <NEW_LINE> <INDENT> if crop_w is None: <NEW_LINE> <INDENT> crop_w = crop_h <NEW_LINE> <DEDENT> h, w = image.shape[:2] <NEW_LINE> j = int(r...
Transforms an image by first applying an optional center crop, then resizing it. Args: image: Input image. crop_height: The height of the crop. crop_width: The width of the crop. resize_height: The resize height after cropping. resize_width: The resize width after cropping. is_crop: If True, fi...
625941d1442bda511e8be59c
def read_data(path): <NEW_LINE> <INDENT> file = open(path, 'r', encoding='UTF-8') <NEW_LINE> data = json.load(file) <NEW_LINE> return data
Opens .json file and returns it as dictionary.
625941d192d797404e30430f
def caminos_simples_prioritize_minlength_fifo_reachable(grafo, v): <NEW_LINE> <INDENT> reachable = {v} <NEW_LINE> caminos = [] <NEW_LINE> stack = deque([Camino([v])]) <NEW_LINE> while stack: <NEW_LINE> <INDENT> p = stack.popleft() <NEW_LINE> caminos.append(p) <NEW_LINE> u = p.tail() <NEW_LINE> print() <NEW_LINE> for w ...
Via extending a path of minimum length, using fifo queues for speed
625941d138b623060ff0af72
def prepare_words(self): <NEW_LINE> <INDENT> for x in range(constants.STARTING_WORDS): <NEW_LINE> <INDENT> word = (random.choice(constants.LIBRARY)) <NEW_LINE> position = Point(random.randint(0, constants.MAX_X), random.randint(0, constants.MAX_Y / 2)) <NEW_LINE> velocity = Point(0, 1) <NEW_LINE> self.add_word(word, po...
This method will create the original starting words for the game
625941d14c3428357757c4ac
def add_token(self, token, pos): <NEW_LINE> <INDENT> self.tokens[token] = pos
add token to both the tokens dict and the play grid
625941d1dc8b845886cb56ba
def synth(text, model, hp): <NEW_LINE> <INDENT> print("TTS synthesis") <NEW_LINE> model.eval() <NEW_LINE> device = torch.device("cuda" if hp.train.ngpu > 0 else "cpu") <NEW_LINE> model = model.to(device) <NEW_LINE> input = np.asarray(phonemes_to_sequence(text)) <NEW_LINE> text = torch.LongTensor(input) <NEW_LINE> text ...
Decode with E2E-TTS model.
625941d1a4f1c619b28b01bc
def is_timeseries(nc, variable): <NEW_LINE> <INDENT> dims = nc.variables[variable].dimensions <NEW_LINE> cmatrix = coordinate_dimension_matrix(nc) <NEW_LINE> for req in ('x', 'y', 't'): <NEW_LINE> <INDENT> if req not in cmatrix: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> if len(cmatrix['x']) != 0: <N...
Returns true if the variable is a time series feature type. :param netCDF4.Dataset nc: An open netCDF dataset :param str variable: name of the variable to check
625941d15510c4643540f568
def isPalindrome(s): <NEW_LINE> <INDENT> i, j = 0, len(s)-1 <NEW_LINE> while i < j: <NEW_LINE> <INDENT> if not s[i].isalnum(): <NEW_LINE> <INDENT> i += 1 <NEW_LINE> continue <NEW_LINE> <DEDENT> if not s[j].isalnum(): <NEW_LINE> <INDENT> j -= 1 <NEW_LINE> continue <NEW_LINE> <DEDENT> if s[i].lower() == s[j].lower(): <NE...
时间复杂度:O(n) 空间复杂度:O(1) :type s: str :rtype: bool
625941d17c178a314d6ef5e6
def move( self, message: Dict[str, str], bot_handler: Any, last_fen: str, move_san: str ) -> None: <NEW_LINE> <INDENT> last_board = self.validate_board(message, bot_handler, last_fen) <NEW_LINE> if not last_board: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> move = self.validate_move( message, bot_handler, last_board...
Makes a move for a user in a game with another user. Replies to the bot handler. Parameters: - message: The Zulip Bots message object. - bot_handler: The Zulip Bots bot handler object. - last_fen: The FEN string of the board before the move. - move_san: The SAN of the move to make.
625941d13c8af77a43ae3926
@leader.route('/', methods = ['GET', 'POST']) <NEW_LINE> def leaderPage(): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> return render_template('leader-page.html', admin = g.admin) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> name = request.form.get('name') <NEW_LINE> email = request.form.get('em...
公司领导页面 :return:
625941d15fc7496912cc3b03
def _final_sigma(self, position_errors, ra_pi_amp, dec_pi_amp): <NEW_LINE> <INDENT> sigma_A = position_errors/ra_pi_amp <NEW_LINE> sigma_B = position_errors/dec_pi_amp <NEW_LINE> sigma_ra = np.sqrt(1./np.sum(1./sigma_A**2)) <NEW_LINE> sigma_dec = np.sqrt(1./np.sum(1./sigma_B**2)) <NEW_LINE> sigma = np.sqrt(1./(1./sigma...
Assume parallax in RA and DEC are fit independently, then combined. All inputs assumed to be arcsec
625941d12ae34c7f2600d2b6
def parse(self): <NEW_LINE> <INDENT> pass
This is a kind of abstract method that does nothing. Intended to be defined by child objects and called when parsing feeds or other data sources.
625941d1bf627c535bc13354
def __init__(self, download_link=None): <NEW_LINE> <INDENT> self._download_link = None <NEW_LINE> self.download_link = download_link
FileDownloadLinkResp - a model defined in Swagger
625941d1a8ecb033257d3252
def test_txn_list_paginated_by_index (self): <NEW_LINE> <INDENT> response = self.make_paged_request(count=1, start_index=0) <NEW_LINE> self.assertEqual(self.status.OK, response.status) <NEW_LINE> self.assertEqual('B-2', response.head_id) <NEW_LINE> self.assert_valid_paging(response, next_id='t-1') <NEW_LINE> self.asser...
Verifies txn list requests work paginated by count and min_index. Queries the default mock block store: { header_signature: 'B-2', batches: [{ header_signature: 'b-2', transactions: [{ header_signature: 't-2', ... }], ....
625941d16aa9bd52df036f2a
def reset(self): <NEW_LINE> <INDENT> self.pid = os.getpid() <NEW_LINE> self._created_connections = 0 <NEW_LINE> self._available_connections = {} <NEW_LINE> self._in_use_connections = {} <NEW_LINE> self._available_pubsub_connections = [] <NEW_LINE> self._in_use_pubsub_connections = set([]) <NEW_LINE> self._check_lock = ...
Resets the connection pool back to a clean state.
625941d1d58c6744b4257de5
def _get_formatted_text(self, key): <NEW_LINE> <INDENT> text = self._get_text(key) <NEW_LINE> if key == 'weights_info': <NEW_LINE> <INDENT> text = text.replace('a roll of ', '') <NEW_LINE> text = text.replace(' a ', ' ') <NEW_LINE> text = text.replace(' of ', ': ') <NEW_LINE> <DEDENT> return text
:param key: 'weights_info' or 'full_text'
625941d1ad47b63b2c50a104
def p_features_base(p): <NEW_LINE> <INDENT> p[0] = p[1]
features : phoneme | feature
625941d1b57a9660fec33a09
def UpdateTaskDispatch(self,taskid,spider = ''): <NEW_LINE> <INDENT> sql = "update tb_task_landmark set dispatchTime = GETDATE(),Spider = %s where id = %d" <NEW_LINE> logHelper.getLogger().debug(sql) <NEW_LINE> param = (spider,taskid) <NEW_LINE> c = self.dbinstance.ExecNonQuery(sql,param) <NEW_LINE> logHelper.getLogger...
分配任务后,填写分配时间 :param taskid: :return:
625941d171ff763f4b549811
def do_test(self, expected, data, lang='cs'): <NEW_LINE> <INDENT> if not data or self.check is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> result = self.check.check_single( data[0], data[1], MockUnit(None, data[2], lang), ) <NEW_LINE> if expected: <NEW_LINE> <INDENT> self.assertTrue( result, 'Check did not fir...
Performs single check if we have data to test.
625941d1b5575c28eb68e185
def get_bucket_by_name(self, bucket_name): <NEW_LINE> <INDENT> id_ = self.cache.get_bucket_id_or_none_from_bucket_name(bucket_name) <NEW_LINE> if id_ is not None: <NEW_LINE> <INDENT> return Bucket(self, id_, name=bucket_name) <NEW_LINE> <DEDENT> for bucket in self.list_buckets(): <NEW_LINE> <INDENT> if bucket.name == b...
Returns the bucket_id for the given bucket_name. If we don't already know it from the cache, try fetching it from the B2 service.
625941d1d53ae8145f87a3f4
def test_users_add(mocker): <NEW_LINE> <INDENT> mocker.patch('subprocess.call') <NEW_LINE> users.add(user_dict) <NEW_LINE> subprocess.call.assert_called_with([ 'useradd', '-p', password, '-G', 'wheel,dev', 'kevin', ])
Given a user dictionary. `users.add(....)` should utilize `useradd` to create a user with the password and groups.
625941d17d43ff24873a2e26
def lookup (self, symb = None, lib = None): <NEW_LINE> <INDENT> result = None <NEW_LINE> if lib == 'libc': <NEW_LINE> <INDENT> lib = 'libc.so' <NEW_LINE> <DEDENT> if symb: <NEW_LINE> <INDENT> symb = context._encode(symb) <NEW_LINE> <DEDENT> if symb and lib: <NEW_LINE> <INDENT> pretty = '%r in %r' % (symb, lib) <NEW_LIN...
lookup(symb = None, lib = None) -> int Find the address of ``symbol``, which is found in ``lib``. Arguments: symb(str): Named routine to look up If omitted, the base address of the library will be returned. lib(str): Substring to match for the library name. If omitted, the current library is searc...
625941d115fb5d323cde0c96
def searchbykeyword(self): <NEW_LINE> <INDENT> if self.page == None: <NEW_LINE> <INDENT> self.page = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.page <NEW_LINE> <DEDENT> if self.query == None: <NEW_LINE> <INDENT> raise Exception("Query is not defined!") <NEW_LINE> <DEDENT> elif self.query: <NEW_LINE> <INDENT> ...
Ищем по ключевому слову :return: словарь фильмов
625941d13eb6a72ae02ec664
def __iadd__(self,value): <NEW_LINE> <INDENT> if isinstance(value,Event): <NEW_LINE> <INDENT> return self.iconcat(value) <NEW_LINE> <DEDENT> return self.ioffset(value)
Concatenates events or adds offset (in place).
625941d13eb6a72ae02ec665
def first_nb_prime(n): <NEW_LINE> <INDENT> while n: <NEW_LINE> <INDENT> n += 1 <NEW_LINE> if n_is_prime(n): <NEW_LINE> <INDENT> return n
Generates the first prime number larger that a given number n.
625941d145492302aab5e449
def remove(self, message_id, message): <NEW_LINE> <INDENT> return self._fire_batch('remove', message_id, message)
Removes a key. :param message_id: The message id (generated by ZeroMQ) :param message: The message itself.
625941d1091ae356686670e2
def get_locus_files_list(self): <NEW_LINE> <INDENT> if self.locus_files is None: <NEW_LINE> <INDENT> files = self.pc.get_directory_files(self.pc.pc_directory) <NEW_LINE> if isinstance(files, list): <NEW_LINE> <INDENT> self.locus_files = [] <NEW_LINE> for act_file in files: <NEW_LINE> <INDENT> if 'viewlocus' in act_file...
loads the trench book index, scrapes content recursively
625941d15e10d32532c5f0ac
def STOCH(DF,n): <NEW_LINE> <INDENT> df = DF.copy() <NEW_LINE> df['cc-ll'] = df['Close'] - df['Low'].rolling(n).min() <NEW_LINE> df['hh-ll'] = df['High'].rolling(n).max() - df['Low'].rolling(n).min() <NEW_LINE> df['stoch'] = df['cc-ll']/df['hh-ll']*100 <NEW_LINE> return df['stoch']
function to calculate Stochastics
625941d1d486a94d0b98e2cb
def gravitational_force(m1, m2, pos1, pos2): <NEW_LINE> <INDENT> return - ( c.GRAVITATIONAL_CONSTANT * m1 * m2 * (pos1 - pos2) / (euclidean(pos1, pos2) + c.DISTANCE_EPS)**3 )
Newtons law of universal gravity in vectorial form
625941d121bff66bcd684ad7