code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def execute_take(item_id): <NEW_LINE> <INDENT> if is_item_in_room(item_id,player.current_room): <NEW_LINE> <INDENT> if inv_weight_limit(item_id): <NEW_LINE> <INDENT> inventory.append(items[item_id]) <NEW_LINE> player.current_room["items"].remove(items[item_id]) <NEW_LINE> player.fear = player.fear + 1 <NEW_LINE> <DEDEN...
This function takes an item_id as an argument and moves this item from the list of items in the current room to the player's inventory. However, if there is no such item in the room, this function prints "You cannot take that."
625941dd3cc13d1c6d3c76a6
def get_result_data(game_id): <NEW_LINE> <INDENT> playlist = get_playlist(game_id) <NEW_LINE> playlist_all_info = [] <NEW_LINE> for song_entry in playlist: <NEW_LINE> <INDENT> song = { 'title': songs_array[song_entry.song]['title'], 'artist': songs_array[song_entry.song]['artist'], 'album_img': songs_array[song_entry.s...
This functions creates the summary of the last game to be shows on the result page
625941dd9b70327d1c4e1103
def create_cloned_volume(self, cloned_volume, src_volume): <NEW_LINE> <INDENT> parent_volume_id = cloned_volume.get('source_volid') <NEW_LINE> snapshot_name = self._generate_snapshot_name() <NEW_LINE> snapshot_id = (six.text_type(parent_volume_id) + "_" + time.strftime("%d%m%Y") + time.strftime("%H%M%S")) <NEW_LINE> sn...
Create a clone of an existing volume. First it will create a snapshot of the source/parent volume, then it creates a clone of this newly created snapshot.
625941dd16aa5153ce3627a4
def getProperNewick(self): <NEW_LINE> <INDENT> if self.ali == None: return self.getNewick() <NEW_LINE> return self.ali.reinterpretNewick(self.getNewick())
Get the proper Newick string for a tree. :returns: A string.
625941dd462c4b4f79d1d9fd
def get_nova_instance_ips(self, srv): <NEW_LINE> <INDENT> return {x['OS-EXT-IPS:type']: x['addr'] for y in srv.addresses.values() for x in y}
Return all nova instance ip addresses as dict Example return: {'floating': '10.109.2.2', 'fixed': '192.168.1.2'} :param srv: nova instance :rtype: dict :return: Dict with server ips
625941dd4e4d5625662d4701
def __load_data__(self, glue_h5grp): <NEW_LINE> <INDENT> self.store = load_dict_from_h5grp(glue_h5grp)
Saves the h5py glue data to the store.
625941dde1aae11d1e749fe7
def data_send_available(self): <NEW_LINE> <INDENT> test_param = request.params.get("test_param") <NEW_LINE> if test_param != "hello": <NEW_LINE> <INDENT> return self._generic_invalid_request( code = WebService.WEB_SERVICE_INVALID_REQUEST_CODE, message = "oh oh ohhh") <NEW_LINE> <DEDENT> test_file = request.params.get("...
Reads test_data field from the POST/GET request, calculates its md5 and returns the result.
625941dd63b5f9789fde7413
def multiple_hot_to_indices(hots): <NEW_LINE> <INDENT> gathered_ints=[] <NEW_LINE> for hot in hots: <NEW_LINE> <INDENT> gathered_ints.append(hot_to_indices(hot)) <NEW_LINE> <DEDENT> return gathered_ints
Convert one-hot encoding to list of indices
625941dd23e79379d52ee88d
def __init__(self, app): <NEW_LINE> <INDENT> self._app = app <NEW_LINE> self.response = self._app.make(Response) <NEW_LINE> self._register_static_files()
ExceptionHandler constructor. Also responsible for loading static files into the container. Arguments: app {masonite.app.App} -- Container object
625941dddd821e528d63b4d4
def recoverTree(self, root): <NEW_LINE> <INDENT> def search(node): <NEW_LINE> <INDENT> if node is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> search(node.left) <NEW_LINE> if self.res1 == None and self.pre.val >= node.val: <NEW_LINE> <INDENT> self.res1 = self.pre <NEW_LINE> <DEDENT> if self.res1 != None and sel...
:type root: TreeNode :rtype: void Do not return anything, modify root in-place instead.
625941dd6e29344779a6293d
def test01_index(self): <NEW_LINE> <INDENT> if common.verbose: <NEW_LINE> <INDENT> print('\n', '-=' * 30) <NEW_LINE> print("Running %s.test01_index..." % self.__class__.__name__) <NEW_LINE> <DEDENT> atom = tb.Int32Atom(shape=(2,)) <NEW_LINE> array1 = self.h5file.create_vlarray( self.h5file.root, 'array1', atom, "t arra...
Checking VLArray.copy() method with indexes.
625941ddfff4ab517eb2f76b
def body(self, features): <NEW_LINE> <INDENT> hparams = self._hparams <NEW_LINE> if self.has_input: <NEW_LINE> <INDENT> inputs = features["inputs"] <NEW_LINE> target_space = features["target_space_id"] <NEW_LINE> encoder_output, encoder_decoder_attention_bias = self.encode( inputs, target_space, hparams, features=featu...
Transformer main model_fn. Args: features: Map of features to the model. Should contain the following: "inputs": Transformer inputs [batch_size, input_length, hidden_dim] "tragets": Target decoder outputs. [batch_size, decoder_length, hidden_dim] "target_space_id" Returns: Final decode...
625941dd44b2445a339323c1
def max_word_value(words): <NEW_LINE> <INDENT> word_values = {calc_word_value(word): word for word in words} <NEW_LINE> return word_values.get(max(word_values.keys()))
Calc the max value of a collection of words Args: words: (list) list of words to compare values Returns: (int) The maximum value of the list of words' values
625941dd956e5f7376d71199
def delete(stream, table_name, connection=None, name=None): <NEW_LINE> <INDENT> _add_toolkit_dependency(stream.topology) <NEW_LINE> if (_generate_hbase_site_xml(stream.topology, connection)): <NEW_LINE> <INDENT> _op = _HBASEDelete(stream, tableName=table_name, schema=HBASEScanOutputSchema, name=name) <NEW_LINE> _op.par...
delete a row which delivers in streams as tuple from a HBASE table. The output streams has to be defined as StreamSchema. Args: stream: contain the input stream. table_name: The name of hbase table, connection(dict|filename|string): Specify the connection to HBASE either with a filename of a HBase configu...
625941ddd4950a0f3b08c678
def update_project(self, project_id: str, *, name: str = None, **kwargs) -> 'DetailedResponse': <NEW_LINE> <INDENT> if project_id is None: <NEW_LINE> <INDENT> raise ValueError('project_id must be provided') <NEW_LINE> <DEDENT> headers = {} <NEW_LINE> if 'headers' in kwargs: <NEW_LINE> <INDENT> headers.update(kwargs.get...
Update a project. Update the specified project's name. :param str project_id: The ID of the project. This information can be found from the deploy page of the Discovery administrative tooling. :param str name: (optional) The new name to give this project. :param dict headers: A `dict` containing the request he...
625941dd435de62698dfdf7a
def get_menu_by_menu_id_list(menu_id_list: List, platform_id: int): <NEW_LINE> <INDENT> menus = Menu.query.filter( Menu.id.in_(menu_id_list), Menu.platform_id == platform_id ).all() <NEW_LINE> return menus
通过菜单ID和平台ID获取菜单列表
625941ddd486a94d0b98e474
@api_view(['GET', 'POST',]) <NEW_LINE> @renderer_classes([JSONRenderer]) <NEW_LINE> def boardAPI(request, *args, **kwargs): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> key = kwargs.get('key') <NEW_LINE> qs = Board.objects.all() <NEW_LINE> if key: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> boar...
API endpoint for Board objects
625941dd2ae34c7f2600d45e
def transform_point_weight(self, points_weight: tf.Tensor, config: Sequence[Any]) -> tf.Tensor: <NEW_LINE> <INDENT> if config[0] == 'gaussian': <NEW_LINE> <INDENT> sigma = config[1] <NEW_LINE> points_weight = 1.0 - tf.math.exp(-(points_weight ** 2) / (2 * sigma ** 2)) <NEW_LINE> <DEDENT> elif config[0] == 'gaussian_no_...
Transform the weight for each point.
625941dd91af0d3eaac9bd49
def with_threshold(self, threshold): <NEW_LINE> <INDENT> self.set_threshold(threshold) <NEW_LINE> return self
レベルアップ経験値閾値を設定 :param threshold: レベルアップ経験値閾値 :type threshold: long :return: this :rtype: DeleteLevelThresholdMasterRequest
625941dd85dfad0860c3b189
def test_new_user_ivalid_email(self): <NEW_LINE> <INDENT> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> get_user_model().objects.create_user(None, 'Test123')
Test creating user with no email raises error
625941ddb545ff76a8914142
def genStars(star_table): <NEW_LINE> <INDENT> stars = [] <NEW_LINE> if 'name' in star_table.colnames: <NEW_LINE> <INDENT> for i in range(0,len(star_table['name'])): <NEW_LINE> <INDENT> star = ephem.FixedBody() <NEW_LINE> star.name = star_table['name'][i] <NEW_LINE> star._ra = ephem.hours(str(":".join([star_table["RA hr...
pyephem_objs = genStars(star_table) given a star_table returned by parseCodex (or initStarTable) returns a list of pyephem objects for every object in the table Inputs star_table - astropy Table that must have the RA and Dec in sexigresimal format with each column for each part of the coordinates separate
625941dda79ad161976cc472
def click_visibly(browser, element): <NEW_LINE> <INDENT> if element.is_displayed(): <NEW_LINE> <INDENT> click_element(browser, element) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> browser.execute_script("arguments[0].style.visibility = 'visible'; " "arguments[0].style.height = '10px'; " "arguments[0].style.width = '1...
Click as the element become visible
625941dd66656f66f7cbc4d9
def get_nowait(self) -> T: <NEW_LINE> <INDENT> return self.get(block=False)
Remove and return an item from the queue without blocking. Only get an item if one is immediately available. Otherwise raise the Empty exception.
625941dd50485f2cf553d0c8
def register(self, args: Optional[DictConfig] = None) -> None: <NEW_LINE> <INDENT> for req_field in ["access_key_id", "secret_access_key"]: <NEW_LINE> <INDENT> if args is not None and req_field not in args: <NEW_LINE> <INDENT> raise Exception( f'Missing IAM "{req_field}" in requester registration args' ) <NEW_LINE> <DE...
Register this requester with the crowd provider by providing any required credentials or such. If no args are provided, assume the registration is already made and try to assert it as such.
625941dd7c178a314d6ef792
def test_submission_validate_valid_body_payload_dictionary(): <NEW_LINE> <INDENT> submission: dict = { "xqueue_body": {"student_response": "5", "grader_payload": {"script_id": "1"}} } <NEW_LINE> process_answer.submission_validate(submission)
Test process_answer.submission_validate function.
625941ddcb5e8a47e48b7dd3
def is_in_console(self, item: int): <NEW_LINE> <INDENT> return item in self._data["console"].keys()
Function that checks whether or not an item is in console data Parameters ---------- item: int ID to check Returns ------- bool whether or not the passed in item is in console report data
625941dde8904600ed9f225e
def panRight(panAmount=0): <NEW_LINE> <INDENT> oldX = viewport[0] <NEW_LINE> if panAmount == 0: <NEW_LINE> <INDENT> oldStart, oldEnd = _getRangeForOffset(oldX) <NEW_LINE> newStart, newEnd = _getRangeForOffset(oldEnd) <NEW_LINE> panAmount = max(0, min(newStart - oldStart, _displaySize[0])) <NEW_LINE> <DEDENT> if len(_li...
Pans the display to the right, limiting the pan to the length of the line being displayed. Arguments: - panAmount: the amount to pan. A value of 0 means the entire width of the physical display. Returns True if a pan actually happened.
625941dd3617ad0b5ed68224
def min(self): <NEW_LINE> <INDENT> cur = self.head.next <NEW_LINE> min_val = cur.val <NEW_LINE> while cur is not self.head: <NEW_LINE> <INDENT> if cur.val < min_val: <NEW_LINE> <INDENT> min_val = cur.val <NEW_LINE> <DEDENT> cur = cur.next <NEW_LINE> <DEDENT> return min_val
Returns the minimum value in this list.
625941dda8ecb033257d33f9
def __del__(self): <NEW_LINE> <INDENT> if sys.platform.startswith('linux') or sys.platform.startswith('freebsd') or sys.platform.startswith('openbsd'): <NEW_LINE> <INDENT> units = 'kilobytes' <NEW_LINE> peak = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss <NEW_LINE> <DEDENT> elif sys....
Destructor. Restore the locale, if changed. At the end of the site generation, the destructor prints the maximum resident set size used of this class, if the logger is set to show debug messages. That is, the maximum number of kilobytes of physical memory that processes used simultaneously.
625941dd31939e2706e4d193
def uamethod(func): <NEW_LINE> <INDENT> def wrapper(parent, *args): <NEW_LINE> <INDENT> result = func(parent, *[arg.Value for arg in args]) <NEW_LINE> return to_variant(result) <NEW_LINE> <DEDENT> return wrapper
Method decorator to automatically convert arguments and output to and from variants
625941dde64d504609d74b6d
@app.route('/') <NEW_LINE> def show_entries(): <NEW_LINE> <INDENT> db = get_db() <NEW_LINE> cur = db.execute('select * from entries order by id desc') <NEW_LINE> entries = cur.fetchall() <NEW_LINE> return render_template('index.html', entries=entries)
Searches the database for entries, then displays them.
625941ddd58c6744b4257f8c
def delete_dir_files(directory, dir=False): <NEW_LINE> <INDENT> if not os.path.exists(directory): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if os.path.isfile(directory): <NEW_LINE> <INDENT> remove(directory) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not dir: <NEW_LINE> <INDENT> for element in listdir(direct...
A function that does rm -rf Positional arguments: directory - the directory to remove
625941dd3eb6a72ae02ec812
def get_queryset(self): <NEW_LINE> <INDENT> return Course.objects.order_by('-course_date_created')[:5]
Return the last five published courses.
625941dd94891a1f4081bdd8
def check_if_full(game): <NEW_LINE> <INDENT> score = 0 <NEW_LINE> for row in game: <NEW_LINE> <INDENT> for piece in row: <NEW_LINE> <INDENT> if piece != 0: <NEW_LINE> <INDENT> score += 1 <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> if score == 9: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> re...
Checks to see if the game board is completly full of inputs game = a list of lists for use in the game board
625941ddcc0a2c11143dd1bf
def __init__(self): <NEW_LINE> <INDENT> consumer_key = 'your_consumer_key' <NEW_LINE> consumer_secret = 'your_cons_secret' <NEW_LINE> access_token = 'your_access_token' <NEW_LINE> access_token_secret = 'your_access_token_secret' <NEW_LINE> try: <NEW_LINE> <INDENT> self.auth = OAuthHandler(consumer_key, consumer_secret)...
Class constructor or initialization method.
625941dd63d6d428bbe4481d
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941dd8c3a8732951586eb
def is_port_in_range(self, port, nmap_port_rule): <NEW_LINE> <INDENT> bret = False <NEW_LINE> ports = nmap_port_rule.split(',') <NEW_LINE> if str(port) in ports: <NEW_LINE> <INDENT> bret = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for nmap_port in ports: <NEW_LINE> <INDENT> if "-" in nmap_port: <NEW_LINE> <IND...
Check port if is in nmap port range
625941dd10dbd63aa1bd2ed0
def list(self, params: dict = None) -> BaseJson: <NEW_LINE> <INDENT> return self.client.get(self.entity)
Retrieves all shape tags known by the system. :param params: Optional query params. :return: JSON response from the request. :rtype: vidispine.typing.BaseJson.
625941dd07d97122c4178bc0
def DisplayData(data): <NEW_LINE> <INDENT> if isinstance(data, list): <NEW_LINE> <INDENT> for item in data: <NEW_LINE> <INDENT> if len(item) == 2: <NEW_LINE> <INDENT> Report(str(item[0].ljust(35, ":") + " " + item[1].rjust(20, ":"))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> Report(str(item)) <NEW_LINE> <DEDENT> <D...
Name: DisplayData Description: Prints lists that has lists of pairs, second usually being a formatted date or prints entire passed list Input: data, either a list of lists, a list, or a string Actions: Checks if the passed var is a list prints the ...
625941dd4d74a7450ccd44f1
def test_regression_for_ticket_15820(self): <NEW_LINE> <INDENT> class CustomConcertForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Concert <NEW_LINE> fields = ['day'] <NEW_LINE> <DEDENT> <DEDENT> class ConcertInline(TabularInline): <NEW_LINE> <INDENT> model = Concert <NEW_LINE> fk_nam...
Ensure that `obj` is passed from `InlineModelAdmin.get_fieldsets()` to `InlineModelAdmin.get_formset()`.
625941dd498bea3a759b9ddc
def dijkstras_plot(G:nx.Graph, s:int = 0, **kw) -> GridBox: <NEW_LINE> <INDENT> nodes, trees, tables = dijkstras(G, s=s, iterations=True) <NEW_LINE> return _graph_iterations_plot(G, nodes=nodes, edges=trees, tables=tables, **kw)
Return plot of Dijkstra's algorithm running on graph G with source s. Args: G (nx.Graph): Networkx graph. s (int): Source vertex to run the algorithm from. (Defaults to 0) Returns: GridBox: Plot of Dijkstra's algorithm running on graph G with source s.
625941ddd18da76e23532807
def interact(): <NEW_LINE> <INDENT> states = [] <NEW_LINE> while True: <NEW_LINE> <INDENT> number_of_players = input("How many supporters from each team? ") <NEW_LINE> if number_of_players.isdigit(): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('Please enter an integer') <NEW_LINE> <DED...
interact() -> None
625941dd32920d7e50b28501
def vw_check_libvirtd_status(self, targetmachine_ip=""): <NEW_LINE> <INDENT> ret, output = self.runcmd_service("status_libvirtd", targetmachine_ip) <NEW_LINE> if ret == 0 and "running" in output: <NEW_LINE> <INDENT> logger.info("Succeeded to check libvirtd is running.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rai...
check the libvirtd status.
625941dddc8b845886cb5864
def _pop_ui_template(self): <NEW_LINE> <INDENT> pm.setUITemplate(self.window_name, popTemplate=True)
Pop the UI template from the UI stack. All elements after this call will not inherit from the window's UI template.
625941ddbf627c535bc134fd
def GetImage(self, *args): <NEW_LINE> <INDENT> return _mc.Window_GetImage(self, *args)
GetImage(self, int id) -> Image Returns an image control in the window.
625941ddc4546d3d9de72d64
def __str__(self): <NEW_LINE> <INDENT> return self.title
Retrun product string representation.
625941ddc4546d3d9de72d65
def hotplug_outofrange_vcpu(): <NEW_LINE> <INDENT> vcpu_device = vm.devices.get_by_qid(vcpu_device_id)[0] <NEW_LINE> vm.devices.remove(vcpu_device) <NEW_LINE> outofrange_vcpu_num = max(vcpu_bus.addr_lengths) <NEW_LINE> vcpu_device.set_param(vcpu_props[0], outofrange_vcpu_num) <NEW_LINE> try: <NEW_LINE> <INDENT> vcpu_de...
Hotplug a vcpu device with out of range property id
625941dd4428ac0f6e5bab22
def main(): <NEW_LINE> <INDENT> print("clind: Command Line Interface... and Dragons!") <NEW_LINE> cli = CLI() <NEW_LINE> cli.run()
Function: main
625941dd55399d3f055889e4
def __init__(self, answer=None, answered_date=None, id=None, poll_id=None, user=None): <NEW_LINE> <INDENT> self._answer = None <NEW_LINE> self._answered_date = None <NEW_LINE> self._id = None <NEW_LINE> self._poll_id = None <NEW_LINE> self._user = None <NEW_LINE> self.discriminator = None <NEW_LINE> self.answer = answe...
PollResponseResource - a model defined in Swagger
625941ddf9cc0f698b140927
def jump(self, nums: List[int]) -> int: <NEW_LINE> <INDENT> n, start, end, step = len(nums), 0, 0, 0 <NEW_LINE> while end < n - 1: <NEW_LINE> <INDENT> step += 1 <NEW_LINE> maxend = end + 1 <NEW_LINE> for i in range(start, end + 1): <NEW_LINE> <INDENT> if i + nums[i] >= n - 1: <NEW_LINE> <INDENT> return step <NEW_LINE> ...
https://leetcode.com/problems/jump-game-ii/discuss/18019/10-lines-C%2B%2B-(16ms)-Python-BFS-Solutions-with-Explanations
625941dd925a0f43d254a1a8
def test_users_new_post(self): <NEW_LINE> <INDENT> with app.test_client() as test_server: <NEW_LINE> <INDENT> resp = test_server.post('/users/new', data={'first_name': 'Zaphod', 'last_name':'Beeblebrox', 'img_url':''}) <NEW_LINE> html = resp.get_data(as_text=True) <NEW_LINE> self.assertEqual(resp.status_code, 302) <NEW...
test to see if /users/new with method = POST redirect properly to users
625941dd15baa723493c42a6
def Status(req, cmd=None): <NEW_LINE> <INDENT> if req.method == 'GET': <NEW_LINE> <INDENT> getFunc(req, "Status")
Status command
625941ddcb5e8a47e48b7dd4
def repositories_to_words(queryset, words=None, return_words=True): <NEW_LINE> <INDENT> if words is None: <NEW_LINE> <INDENT> words = {} <NEW_LINE> <DEDENT> qs = queryset.values('slug', 'description', 'readme') <NEW_LINE> for repository in qs: <NEW_LINE> <INDENT> repository_to_words(repository, words, False, True) <NEW...
Taking a list of repositories and get all words as a dict with each word and its weight
625941dd91f36d47f21ac824
def test_collect_workflow_action_data_get(self): <NEW_LINE> <INDENT> response = self.client.get(reverse('wagtailadmin_pages:collect_workflow_action_data', args=(self.page.id, 'approve', self.page.current_workflow_task_state.id))) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> self.assertTemplateUsed(...
This tests that a GET request to the collect_workflow_action_data view (for the approve action) returns a modal with a form for extra data entry: adding a comment
625941dd4f6381625f114d6a
def quit_application(self): <NEW_LINE> <INDENT> logger.debug("quit_application") <NEW_LINE> self._writeViewSettings() <NEW_LINE> app = QtWidgets.QApplication.instance() <NEW_LINE> app.closeAllWindows() <NEW_LINE> logger.debug("quit_application done")
Closes all windows.
625941dd26068e7796caf011
def form(self, r, **attr): <NEW_LINE> <INDENT> resource = self.resource <NEW_LINE> form = S3XFormsForm(resource.table) <NEW_LINE> response = current.response <NEW_LINE> response.headers["Content-Type"] = "application/xhtml+xml" <NEW_LINE> return form
Generate an XForms form for the current resource @param r: the S3Request @param attr: controller parameters for the request
625941dd596a897236089deb
def event_m20_11_x108(flag1=211000081, z24=802): <NEW_LINE> <INDENT> CompareEventFlag(0, flag1, 1) <NEW_LINE> CompareChrStartUpState(0, z24, 2, 1) <NEW_LINE> assert ConditionGroup(0) <NEW_LINE> return 0
[Condition] Voice frog singing voice_flag flag1: Boss destruction flag z24: Generator ID
625941dd009cb60464c636de
def losc_frame_json(ifo, start_time, end_time): <NEW_LINE> <INDENT> import json <NEW_LINE> try: <NEW_LINE> <INDENT> from urllib.request import urlopen <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> from urllib import urlopen <NEW_LINE> <DEDENT> run = get_run(start_time) <NEW_LINE> run2 = get_run(end_time) ...
Get the information about the public data files in a duration of time Parameters ---------- ifo: str The name of the IFO to find the information about. start_time: int The gps time in GPS seconds end_time: int The end time in GPS seconds Returns ------- info: dict A dictionary containing information a...
625941def7d966606f6aa336
def interpret_dict_as_qos_profile(qos_profile_dict: Dict) -> QoSProfile: <NEW_LINE> <INDENT> new_profile_dict = {} <NEW_LINE> for policy_key, policy_value in qos_profile_dict.items(): <NEW_LINE> <INDENT> if policy_key in _DURATION_KEYS: <NEW_LINE> <INDENT> new_profile_dict[policy_key] = dict_to_duration(policy_value) <...
Sanitize a user provided dict of a QoS profile and verify all keys are valid.
625941dee64d504609d74b6e
def activate(self): <NEW_LINE> <INDENT> key = self.chunker.get_key() <NEW_LINE> if not key: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if config.scanner.feedback_flash: <NEW_LINE> <INDENT> self._flash = self.ACTIVATION_FLASH_COUNT * 2 <NEW_LINE> self._activation_timer.start(self.ACTIVATION_FLASH_INTERVAL, self._on_...
Activates a key and triggers feedback.
625941de94891a1f4081bdd9
def recurse_nrdsets_baseanalysis(aba): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> older_aba = models.AnalysisBaseanalysis.objects.get( analysis=aba.base_analysis, is_complement=True) <NEW_LINE> <DEDENT> except models.AnalysisBaseanalysis.DoesNotExist: <NEW_LINE> <INDENT> old_mzmls = {} <NEW_LINE> old_dsets = {} <NEW_...
Recursively get all old mzmls from what is possibly a chain of growing analyses, each e.g. adding a single set fresh of the MS
625941de73bcbd0ca4b2c3a5
def parse_markdown(fobj): <NEW_LINE> <INDENT> key = None <NEW_LINE> val = "" <NEW_LINE> for line in fobj: <NEW_LINE> <INDENT> if line.startswith("##"): <NEW_LINE> <INDENT> if key is not None: <NEW_LINE> <INDENT> yield key, val.rstrip() <NEW_LINE> <DEDENT> key = line[1:].strip() <NEW_LINE> val = "" <NEW_LINE> <DEDENT> e...
Parse captions to a dict generator
625941de30bbd722463cc0f7
def countHomogenous(self, s): <NEW_LINE> <INDENT> MOD = 10**9+7 <NEW_LINE> result = cnt = 0 <NEW_LINE> for i in xrange(len(s)): <NEW_LINE> <INDENT> if i and s[i-1] == s[i]: <NEW_LINE> <INDENT> cnt += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cnt = 1 <NEW_LINE> <DEDENT> result = (result+cnt)%MOD <NEW_LINE> <DEDENT...
:type s: str :rtype: int
625941de287bf620b61d3d90
def save_obj_perms(self): <NEW_LINE> <INDENT> perms = self.cleaned_data[self.get_obj_perms_field_name()] <NEW_LINE> model_perms = [c[0] for c in self.get_obj_perms_field_choices()] <NEW_LINE> to_remove = set(model_perms) - set(perms) <NEW_LINE> for perm in to_remove: <NEW_LINE> <INDENT> remove_perm(perm, self.group, se...
Saves selected object permissions by creating new ones and removing those which were not selected but already exists. Should be called *after* form is validated.
625941debe383301e01b57af
@grok.subscribe(IUserLoggedInEvent) <NEW_LINE> def updateCustomLangCookieLogginIn(event): <NEW_LINE> <INDENT> request = getRequest() <NEW_LINE> lang = event.object.getProperty('language', None) <NEW_LINE> if lang and request is not None: <NEW_LINE> <INDENT> request.response.setCookie('uLearn_I18N_Custom', lang, path='/...
This subscriber will trigger when a user change his/her profile data. It sets a cookie for the 'language' user profile setting. After this, due to the custom Language Negotiator set for the Blanquerna layer, the site language is forced to the one in the cookie.
625941de76e4537e8c3519a4
def rotateRight(self, head, k): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> start, l = head, 1 <NEW_LINE> end = start <NEW_LINE> while start.next: <NEW_LINE> <INDENT> start = start.next <NEW_LINE> if not start.next: <NEW_LINE> <INDENT> end = start <NEW_LINE> <DEDENT> l += 1 <NEW...
:type head: ListNode :type k: int :rtype: ListNode
625941de9b70327d1c4e1105
def __init__(self, total=None, page=None, per_page=None, items=None): <NEW_LINE> <INDENT> self._total = None <NEW_LINE> self._page = None <NEW_LINE> self._per_page = None <NEW_LINE> self._items = None <NEW_LINE> if total is not None: <NEW_LINE> <INDENT> self.total = total <NEW_LINE> <DEDENT> if page is not None: <NEW_L...
InlineResponse20014Payload - a model defined in Swagger
625941de1f037a2d8b94652c
def solution(n): <NEW_LINE> <INDENT> numerals = {1: 'I', 2: 'II', 3: 'III', 4: 'IV', 5: 'V', 6: 'VI', 7: 'VII', 8: 'VIII', 9: 'IX', 10: 'X', 50: 'L', 100: 'C', 500: 'D', 1000: 'M'} <NEW_LINE> n = str(n) <NEW_LINE> number = "" <NEW_LINE> digit_list = split_digits(n) <NEW_LINE> count = len(digit_list)-1 <NEW_LINE> for it...
Modern Roman numerals are written by expressing each digit separately starting with the left most digit and skipping any digit with a value of zero. In Roman numerals 1990 is rendered: 1000=M, 900=CM : "100 less than 1000", 90=XC : "10 less than 100"; resulting in MCMXC. 2008 is written as 2000=MM, 8=VIII; or MMVIII. 1...
625941de63b5f9789fde7415
def show_job(app_id): <NEW_LINE> <INDENT> cmd = ['dcos', 'job', 'show', app_id] <NEW_LINE> returncode, stdout, stderr = exec_command(cmd) <NEW_LINE> assert returncode == 0 <NEW_LINE> assert stderr == b'' <NEW_LINE> result = json.loads(stdout.decode('utf-8')) <NEW_LINE> assert isinstance(result, dict) <NEW_LINE> assert ...
Show details of a Metronome job. :param app_id: The id for the application :type app_id: str :returns: The requested Metronome job. :rtype: dict
625941de71ff763f4b5499c0
def resnext56_8x8d_svhn(classes=10, **kwargs): <NEW_LINE> <INDENT> return get_resnext_cifar(classes=classes, blocks=56, cardinality=8, bottleneck_width=8, model_name="resnext56_8x8d_svhn", **kwargs)
ResNeXt-56 (8x8d) model for SVHN from 'Aggregated Residual Transformations for Deep Neural Networks,' http://arxiv.org/abs/1611.05431. Parameters: ---------- classes : int, default 10 Number of classification classes. pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Cont...
625941debd1bec0571d9095d
def set_UpdateKey(self, value): <NEW_LINE> <INDENT> super(GetShareInputSet, self)._set_input('UpdateKey', value)
Set the value of the UpdateKey input for this Choreo. ((required, string) The UpdateKey used to retrieve the share. This is returned by the CreateShare Choreo.)
625941de5fdd1c0f98dc0563
def __init__( self, hass, device_id, friendly_name, state_template, icon_template, entity_picture_template, availability_template, on_action, off_action, level_action, level_template, temperature_action, temperature_template, color_action, color_template, white_value_action, white_value_template, effect_action, effect_...
Initialize the light.
625941de0383005118ecf910
def draw_SBM(B, block_size): <NEW_LINE> <INDENT> B = np.array(B) <NEW_LINE> blocks = [] <NEW_LINE> for i in range(len(B)): <NEW_LINE> <INDENT> row = [] <NEW_LINE> for j in range(len(B)): <NEW_LINE> <INDENT> row.append(np.random.uniform(size=[block_size, block_size]) < B[i, j]) <NEW_LINE> <DEDENT> blocks.append(row) <NE...
B is a k x k matrix where k is the number of communities. It expresses the probability of connection between blocks. Each community is the same size (block_size x block_size).
625941defbf16365ca6f64f8
def test_ap_wpa2_psk_ext(dev, apdev): <NEW_LINE> <INDENT> bssid = apdev[0]['bssid'] <NEW_LINE> ssid = "test-wpa2-psk" <NEW_LINE> passphrase = 'qwertyuiop' <NEW_LINE> psk = '602e323e077bc63bd80307ef4745b754b0ae0a925c2638ecd13a794b9527b9e6' <NEW_LINE> params = hostapd.wpa2_params(ssid=ssid) <NEW_LINE> params['wpa_psk'] =...
WPA2-PSK AP using external EAPOL I/O
625941de30bbd722463cc0f8
def get_display_name(self, looker, **kwargs): <NEW_LINE> <INDENT> if self.locks.check_lockstring(looker, "perm(Builder)"): <NEW_LINE> <INDENT> name = "{}(#{})".format(self.location_name, self.id) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> name = self.location_name <NEW_LINE> <DEDENT> name += " {0}".format(self.coord...
Displays the name of the object in a viewer-aware manner. Args: looker (TypedObject): The object or account that is looking at/getting inforamtion for this object. Returns: name (str): A string containing the name of the object, including the DBREF if this user is privileged to control ...
625941dedd821e528d63b4d6
def get_nearest_hits(self, hits, track, x0 = None, r = 0.03): <NEW_LINE> <INDENT> if x0 is None: <NEW_LINE> <INDENT> if len(track) == 0: <NEW_LINE> <INDENT> return hits.index <NEW_LINE> <DEDENT> x0 = hits.loc[track[-1],'x':'z'] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> x0 = pd.DataFrame(x0.reshape((1,-1)), columns=...
Select hits closest to the track or x0 excluding hits, which are already in the track
625941de099cdd3c635f0f89
def __init__(self, connector, path, redfish_version=None): <NEW_LINE> <INDENT> super(PhysicalDriveCollection, self).__init__(connector, path, redfish_version)
A class representing a PhysicalDriveCollection :param connector: A Connector instance :param path: The canonical path to the PhysicalDrive collection resource :param redfish_version: The version of RedFish. Used to construct the object according to schema of the given version.
625941de1b99ca400220ade1
def edit_mode(self): <NEW_LINE> <INDENT> if not self._frame_in_edit_mode: <NEW_LINE> <INDENT> self._frame_in_edit_mode = True <NEW_LINE> self.config(highlightbackground='yellow', cursor='arrow') <NEW_LINE> for label in self.winfo_children(): <NEW_LINE> <INDENT> label.bind('<Button-1>', self._mouse_left_button_click) <N...
Switches edit_mode on/off. When switching edit mode on this function first makes mouse cursor visible when on top of this module and makes background highlight visible by changing it's color to yellow, then appropriate event handlers are bind to left mouse button click (<Button-1>) and mouse motion with left mouse but...
625941deec188e330fd5aac8
def prepare(): <NEW_LINE> <INDENT> if not os.path.exists(LOCAL_DIR): <NEW_LINE> <INDENT> os.makedirs(LOCAL_DIR) <NEW_LINE> <DEDENT> for name in [ TRAIN_IMAGE_URL, TRAIN_LABEL_URL, TEST_IMAGE_URL, TEST_LABEL_URL]: <NEW_LINE> <INDENT> if not os.path.exists(LOCAL_DIR + name): <NEW_LINE> <INDENT> urllib.request.urlretrieve...
This function will be called once to prepare the dataset.
625941defb3f5b602dac39c6
def is_quantity(x): <NEW_LINE> <INDENT> return isinstance(x, Quantity)
Returns True if x is a Quantity, False otherwise.
625941de29b78933be1e59d6
def make(self, begin, end, dst_txt, tag=None): <NEW_LINE> <INDENT> if begin > end: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> ri = rep_t() <NEW_LINE> ri.tag = tag <NEW_LINE> txtl = self.txt[0:begin] if begin <= self.lr_len else self.txt[begin:begin + self.lr_len] <NEW_LINE> txtr = self.txt[end: end + self.lr_l...
生成替换记录对象.将[begin,end)的内容替换为dst_txt
625941de435de62698dfdf7c
def alphabetical(list_of_restaurants): <NEW_LINE> <INDENT> list_of_restaurants.sort() <NEW_LINE> return list_of_restaurants
takes in a list of restaurants and sorts the list by name
625941de26068e7796caf012
def fetch_data(self, document, line): <NEW_LINE> <INDENT> return [col.fetch_data(document, line) for col in self.sources]
Given a line and the document it is in, get the data at that line that corresponds to this schema column.
625941de2ae34c7f2600d460
def __str__(self): <NEW_LINE> <INDENT> result = "" <NEW_LINE> for line in self.board: <NEW_LINE> <INDENT> for i in line: <NEW_LINE> <INDENT> if i is None: <NEW_LINE> <INDENT> result += " " <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result += i + " " <NEW_LINE> <DEDENT> <DEDENT> result += "\n" <NEW_LINE> <DEDENT> ret...
String representation of board :return str:
625941de1f5feb6acb0c4e7a
def iter_rows_raw(self, *args): <NEW_LINE> <INDENT> with open(self.filename) as f: <NEW_LINE> <INDENT> header = self._read_column_names(f) <NEW_LINE> cnt = 0 <NEW_LINE> ids = [0] <NEW_LINE> for a in args: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ids.append(header.index(a)) <NEW_LINE> <DEDENT> except ValueError: <NE...
Yield 1) the index in which each halo appears in the catalog (starting from 0 unless _finder_offset_start is set) 2) the raw halo ID (finder_id) included in the halo stat file without any emulation 3) the rest of the requested parameters :param args: strings for the column names :return: finder_offset_start, finder_id...
625941dea79ad161976cc474
def post_tweet(self, tweet): <NEW_LINE> <INDENT> POST_URL = 'https://api.twitter.com/1.1/statuses/update.json' <NEW_LINE> post_data = { 'status': tweet[:TWEET_CHAR_LIMIT] } <NEW_LINE> response, content = self.twitter_client.request(POST_URL, method='POST', body=urllib.parse.urlencode(post_data)) <NEW_LINE> return respo...
Post a tweet to Twitter @param {String} tweet
625941dea79ad161976cc475
def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.control = libui.uiNewHorizontalSeparator()
Creates a new horizontal separator.
625941dee76e3b2f99f3ab36
def SimulateFusedConv2dBiasActivationInt8(conv_input_scale, conv_input, kernel, padding, strides, side_input_scale, side_input, biases): <NEW_LINE> <INDENT> conv_result = nn_ops.conv2d( NchwVectCToNchw(gen_array_ops.dequantize(conv_input, -128, 127)), OihwVectIToHwio(gen_array_ops.dequantize(kernel, -128, 127)), stride...
Simulates the int8 fused 2-D convolution op using separate float ops. The arguments and return values have the same format, meanings and restrictions as the actual op. Args: conv_input_scale: A scalar 'float'. conv_input: A `Tensor` of type `qint8` in NCHW_VECT_C layout. kernel: A `Tensor` of type `qint8` in...
625941decb5e8a47e48b7dd5
def test_connect_arrays_float_rtype(self): <NEW_LINE> <INDENT> n = 10 <NEW_LINE> nest.Create('iaf_psc_exp_multisynapse', n) <NEW_LINE> sources = np.arange(1, n+1, dtype=np.uint64) <NEW_LINE> targets = np.arange(1, n+1, dtype=np.uint64) <NEW_LINE> weights = np.ones(len(sources)) <NEW_LINE> delays = np.ones(len(sources))...
Raises exception when not using integer value for receptor_type
625941de656771135c3ebba1
def check_availability(self, target): <NEW_LINE> <INDENT> raise NotImplementedError()
Checks the availability of the given target. Returns True if the target is available, false otherwise.
625941deadb09d7d5db6cabd
def find_seed(cards_str): <NEW_LINE> <INDENT> cards = set([int(s) for s in cards_str.split(',')]) <NEW_LINE> results = 0 <NEW_LINE> for idx in range(5000): <NEW_LINE> <INDENT> game = Game.new(4, idx) <NEW_LINE> available_cards = set( [game.players()[0].hand_card] + [game.draw_card()]) <NEW_LINE> if cards.issubset(avail...
Play a game
625941deb57a9660fec33bb8
def get_logbook(self, name): <NEW_LINE> <INDENT> return asyncio.run(self.aget_logbook(name))
Parameters ---------- name : str name of logbook Returns ------- logbook : dict Each element is a logbook dict. Examples -------- >>> cli.get_logbook("TEST') {'TEST': {'owner': 'olog-logs', 'state': 'Active'}}
625941de3d592f4c4ed1d395
def setup_platform(hass, config, add_devices_callback, discovery_info=None): <NEW_LINE> <INDENT> import pyvera as veraApi <NEW_LINE> base_url = config.get('vera_controller_url') <NEW_LINE> if not base_url: <NEW_LINE> <INDENT> _LOGGER.error( "The required parameter 'vera_controller_url'" " was not found in config" ) <NE...
Setup Vera lights.
625941dee64d504609d74b6f
@pf.register_series_method <NEW_LINE> @pf.register_dataframe_method <NEW_LINE> def clean_column_names( object_: Union[List[Union[str, int]], pd.Index, pd.DataFrame], case: str = "snake", basic_cleaning: bool = True, convert_duplicates: bool = True, custom_transformation: Optional[Dict[str, str]] = None, custom_expressi...
Clean messy column names. Inspired by the functions make_clean_names and clean_names from the R package janitor. Do not alter the columns of the original DataFrame, i.e. to change the column names of the dataframe df 'df=df.clean_column_names()' should be used. Parameters ---------- object_: Union[List[Union[str, int...
625941de21bff66bcd684c7f
def collect_powers(operator): <NEW_LINE> <INDENT> new_tensors = [] <NEW_LINE> symbols = {} <NEW_LINE> for tensor in operator.tensors: <NEW_LINE> <INDENT> if tensor.is_field or tensor.name[0] == "$" or tensor.exponent is None: <NEW_LINE> <INDENT> new_tensors.append(tensor) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p...
Collect all the tensors that are equal and return the correspondin powers.
625941debe8e80087fb20f6e
def validate(self, validation, context): <NEW_LINE> <INDENT> TypeType.type_validate(validation, self.type, context)
Validates this node and its subnodes in the given context Args: validation: ValidationState object context: MdlDescription object
625941ded268445f265b519e
def check_version(self, version): <NEW_LINE> <INDENT> return self.run_process(version).splitlines()[1].strip()
Checks version of compiler.
625941decc0a2c11143dd1c0
def ends_block(self, i, lines, new_state, prev_state, stack): <NEW_LINE> <INDENT> if prev_state.context: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> line = lines[i] <NEW_LINE> if g.match_word(line.strip(), 0, 'end'): <NEW_LINE> <INDENT> if self.start_stack: <NEW_LINE> <INDENT> top = self.start_stack.pop() <NEW...
True if line ends the block.
625941de4f6381625f114d6b
def GetCalculateOrientedBoundingBox(self): <NEW_LINE> <INDENT> return _itkLabelGeometryImageFilterPython.itkLabelGeometryImageFilterIUC2IUL2_GetCalculateOrientedBoundingBox(self)
GetCalculateOrientedBoundingBox(self) -> bool
625941de090684286d50f018
def cleanup_pyc(p): <NEW_LINE> <INDENT> for root, dirs, files in os.walk(p): <NEW_LINE> <INDENT> pyc_files = [filename for filename in files if filename.endswith(".pyc")] <NEW_LINE> py_files = set([filename for filename in files if filename.endswith(".py")]) <NEW_LINE> excess_pyc_files = [pyc_filename for pyc_filename ...
Thanks to oddthinking on http://stackoverflow.com/questions/2528283
625941de187af65679ca544f