code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def GetArtifactKnowledgeBase(client_obj, allow_uninitialized=False): <NEW_LINE> <INDENT> client_schema = client_obj.Schema <NEW_LINE> kb = client_obj.Get(client_schema.KNOWLEDGE_BASE) <NEW_LINE> if not allow_uninitialized: <NEW_LINE> <INDENT> if not kb: <NEW_LINE> <INDENT> raise artifact_lib.KnowledgeBaseUninitializedE...
This generates an artifact knowledge base from a GRR client. Args: client_obj: A GRRClient object which is opened for reading. allow_uninitialized: If True we accept an uninitialized knowledge_base. Returns: A KnowledgeBase semantic value. Raises: ArtifactProcessingError: If called when the knowledge base ha...
625941b945492302aab5e141
@dbus.service.method(SETTINGS_IFACE, in_signature='a{sa{sv}}', out_signature='o') <NEW_LINE> def SettingsAddConnection(self, connection_settings): <NEW_LINE> <INDENT> NM = dbusmock.get_object(MAIN_OBJ) <NEW_LINE> devices = NM.GetDevices() <NEW_LINE> dev = None <NEW_LINE> auto_connect = False <NEW_LINE> if 'autoconnect'...
Add a connection. connection_settings is a String String Variant Map Map. See https://developer.gnome.org/NetworkManager/0.9/spec.html #type-String_String_Variant_Map_Map If you omit connection uuid or timestamp, this method adds one for you. Note that this automatically associates the connection settings object...
625941b9711fe17d825421f3
def connect(self, nodelist, threshold=15.0): <NEW_LINE> <INDENT> for i, end in enumerate(self.ends): <NEW_LINE> <INDENT> neighbours = [] <NEW_LINE> for node in nodelist: <NEW_LINE> <INDENT> distlist = [sp.dist(end, point) for point in node.pointlist] <NEW_LINE> mindist = min(distlist) <NEW_LINE> if mindist < threshold:...
Connect the wire with nodes. For each end of the wire, check the distance between the end position and every node's vertex position. If the distance is under some threshold, consider this node is a neighbour and store it in a list. After checking with all the nodes in the nodelist, choose the node with least distance ...
625941b96fece00bbac2d5bc
def main(): <NEW_LINE> <INDENT> list1 = [20, 6, 12, -3, 14] <NEW_LINE> result_list = greater_than_10(list1) <NEW_LINE> print(result_list) <NEW_LINE> list2 = [16] <NEW_LINE> result_list = greater_than_10(list2) <NEW_LINE> print(result_list) <NEW_LINE> list3 = [1, 2, 3, 4] <NEW_LINE> result_list = greater_than_10(list3) ...
This program prints a list containing only those numbers from generated list that have a value greater than 10.
625941b94e696a04525c92d3
def visit_next_url(self): <NEW_LINE> <INDENT> url = self.url_follow_queue.popleft() <NEW_LINE> r = self.session.get(url) <NEW_LINE> for m in re.finditer( r"""(https?://[^\s<>]+)|href=['"]([^"']+)|src=['"]([^"']+)""", r.text): <NEW_LINE> <INDENT> for g in m.groups(): <NEW_LINE> <INDENT> if g: <NEW_LINE> <INDENT> logging...
Pop the next url, retrieve it and scan the content for further links.
625941b9cad5886f8bd26e63
def file_contains_header(line): <NEW_LINE> <INDENT> header = get_file_header(line) <NEW_LINE> if header is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> function_gen = parse_functions_with_bodies(line) <NEW_LINE> first_function = None <NEW_LINE> try: <NEW_LINE> <INDENT> first_function = next(function_gen) ...
Return True if the file contains a comment at the start of the the file, where the comment is not associated with a function.
625941b97cff6e4e81117806
def average_daily_use(self, station_name): <NEW_LINE> <INDENT> if self.target_data is None: <NEW_LINE> <INDENT> self.get_targets() <NEW_LINE> <DEDENT> self.current_station = station_name <NEW_LINE> station = self.target_data.query(f'station == "{station_name}"') <NEW_LINE> self.daily_use = (station .groupby([station.in...
Determine the average turnstile use per day for a station. :param str station_name: station name
625941b926068e7796caeb59
def log_out(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> os.remove('token') <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.login_frame_init()
登出操作
625941b99c8ee82313fbb5f5
def save(self, *args, **kwargs): <NEW_LINE> <INDENT> super(Img, self).save(*args, **kwargs) <NEW_LINE> url = self.imgfile.url <NEW_LINE> image = Image.open(url[1:]) <NEW_LINE> width, height = image.size <NEW_LINE> if width/height >= 1: <NEW_LINE> <INDENT> size = (1280,1280) <NEW_LINE> size_m = (700,700) <NEW_LINE> size...
Save Photo after ensuring it is not blank. Resize as needed.
625941b91f037a2d8b94607f
def unpatch(): <NEW_LINE> <INDENT> if not getattr(pymemcache.client, '_datadog_patch', False): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> setattr(pymemcache.client, '_datadog_patch', False) <NEW_LINE> setattr(pymemcache.client.base, 'Client', _Client) <NEW_LINE> setattr(pymemcache, _DD_PIN_NAME, None) <NEW_LINE> se...
Remove pymemcache tracing
625941b97c178a314d6ef2da
def test_10_invalid_http_timeout(self): <NEW_LINE> <INDENT> for invalid_time in ["cats", "0", "-1"]: <NEW_LINE> <INDENT> ret, output, err = self.sysrepo("-T {0}".format(invalid_time), out=True, stderr=True, exit=1) <NEW_LINE> self.assert_("http_timeout" in err, "error message " "did not contain http_timeout: {0}".forma...
We return an error given an invalid http_timeout
625941b9f9cc0f698b140486
def _validate_timing_resolution(self, timing_resolution): <NEW_LINE> <INDENT> if timing_resolution is None: <NEW_LINE> <INDENT> timing_resolution = defaults.timing_resolution <NEW_LINE> <DEDENT> if not isinstance(timing_resolution, datetime.timedelta): <NEW_LINE> <INDENT> raise TypeError( '%s.timing_resolution should b...
validates the given timing_resolution value
625941b9cdde0d52a9e52eb0
def __str__(self): <NEW_LINE> <INDENT> return '\nsrc: {0} dst: {1} payload: {2}'.format(self.src, self.dst, self.payload)
Job: Prints the source address, destination address, and payload of a packet
625941b9ac7a0e7691ed3f5a
def canCompleteCircuit(self, gas, cost): <NEW_LINE> <INDENT> if len(gas) == 1: <NEW_LINE> <INDENT> if gas[0] - cost[0] >= 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> <DEDENT> tank = gas[0] - cost[0] <NEW_LINE> begin = 0 <NEW_LINE> p = 1 <NEW_LINE> while Tr...
:type gas: List[int] :type cost: List[int] :rtype: int
625941b9851cf427c661a393
def make_image(screen, bgcolor, filename): <NEW_LINE> <INDENT> img = Image.new('RGB', screen,bgcolor) <NEW_LINE> draw = ImageDraw.Draw(img) <NEW_LINE> draw.ellipse((20,20,204,204), outline=(225, 225, 225), fill=(255, 255, 255)) <NEW_LINE> del draw <NEW_LINE> img.save("./result/mask_cir01.jpg") <NEW_LINE> img.save("./re...
画像の作成
625941b9d164cc6175782bcf
def recv(timeout=False): <NEW_LINE> <INDENT> global rdx <NEW_LINE> if timeout is False: <NEW_LINE> <INDENT> outmsg = rdx.rpop("jabber_in") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> outmsg = rdx.brpop("jabber_in", timeout) <NEW_LINE> <DEDENT> return outmsg
check for incoming messages, blocking for specified amount of time timeout=False -- No waiting/blocking timeout=0 -- Block forever until a message is received timeout=X -- Where X is a positive integer, block for that number of seconds
625941b9fff4ab517eb2f2ba
def test_simple_case(): <NEW_LINE> <INDENT> b = [2, 3, 4] <NEW_LINE> assert foo() in b
straight forward in pytest
625941b926068e7796caeb5a
def itertuples(self, index=True): <NEW_LINE> <INDENT> arrays = [] <NEW_LINE> if index: <NEW_LINE> <INDENT> arrays.append(self.index) <NEW_LINE> <DEDENT> arrays.extend(self.iloc[:, k] for k in range(len(self.columns))) <NEW_LINE> return zip(*arrays)
Iterate over rows of DataFrame as tuples, with index value as first element of the tuple
625941b9d268445f265b4cf4
def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> if args or kwds: <NEW_LINE> <INDENT> super(FileRemoveRequest, self).__init__(*args, **kwds) <NEW_LINE> if self.file_path is None: <NEW_LINE> <INDENT> self.file_path = '' <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.file_path = ''
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: file_path :param args: complete s...
625941b90383005118ecf465
def poll_lock_server(self): <NEW_LINE> <INDENT> is_locked = True <NEW_LINE> while(is_locked): <NEW_LINE> <INDENT> request_arg = {'file_path': self.file_path, 'client_id': self.client_id} <NEW_LINE> response = requests.get(LOCK_SERVER_ADDR, request_arg) <NEW_LINE> data = response.json() <NEW_LINE> if data['is_locked']: ...
poll lock server until file become unlocked
625941b94428ac0f6e5ba673
def test_forward_backward(self): <NEW_LINE> <INDENT> y = [4., 5., 6., 7.] <NEW_LINE> solver = solvers.forward_backward(accel=acceleration.dummy()) <NEW_LINE> param = {'solver': solver, 'rtol': 1e-6, 'verbosity': 'NONE'} <NEW_LINE> f1 = functions.norm_l2(y=y) <NEW_LINE> f2 = functions.dummy() <NEW_LINE> ret = solvers.so...
Test forward-backward splitting algorithm without acceleration, and with L1-norm, L2-norm, and dummy functions.
625941b9de87d2750b85fc0f
def check2(): <NEW_LINE> <INDENT> g_algo = GraphAlgo() <NEW_LINE> file = '../data/A5' <NEW_LINE> g_algo.load_from_json(file) <NEW_LINE> g_algo.get_graph().remove_edge(13, 14) <NEW_LINE> g_algo.save_to_json(file + "_edited") <NEW_LINE> dist, path = g_algo.shortest_path(1, 7) <NEW_LINE> print(dist, path) <NEW_LINE> dist,...
This function tests the naming, basic testing over A5 json file. :return:
625941b93317a56b86939aea
def open_restaurant(self): <NEW_LINE> <INDENT> print(self.restaurant_name.title() + " is opening") <NEW_LINE> pass
欢迎
625941b999fddb7c1c9de214
def _get_drag_factor(self, brake_angle): <NEW_LINE> <INDENT> return DRAG_FACTOR * (1 + DRAG_GAIN * np.sin(brake_angle)**2)
Map from drag brake angle to drag factor brake_angle: (rad) returns: velocity (m/s)
625941b915fb5d323cde098b
def save_data(users, posts): <NEW_LINE> <INDENT> info_dict = { 'users': [user.convert_to_dict() for user in users], 'posts': [post.convert_to_dict() for post in posts] } <NEW_LINE> with open("data.json", 'w') as file_: <NEW_LINE> <INDENT> json.dump(json.dumps(info_dict), file_)
Saves all information, including users and posts, to the data.json file The passwords are kept "safe"! users => The list of users you want to save. Type: List[User] posts => The list of posts you want to save. Type: List[Post] Returns: None
625941b9462c4b4f79d1d551
@named('show-backup') <NEW_LINE> @arg('server_name', completer=server_completer, help='specifies the server name for the command') <NEW_LINE> @arg('backup_id', completer=backup_completer, help='specifies the backup ID') <NEW_LINE> @expects_obj <NEW_LINE> def show_backup(args): <NEW_LINE> <INDENT> server = get_server(ar...
This method shows a single backup information
625941b921a7993f00bc7b6b
def load_forms( ciks: tp.Union[None, tp.List[str]] = None, types: tp.Union[None, tp.List[str]] = None, facts: tp.Union[None, tp.List[str]] = None, skip_segment: bool = False, min_date: tp.Union[str, datetime.date] = None, max_date: tp.Union[str, datetime.date, None] = None, tail: tp.Union[datetime.timedelta, float, int...
Load SEC Forms (Fundamental data) :param ciks: list of cik (you can get cik from asset id) :param types: list of form types: ['10-K', '10-Q', '10-K/A', '10-Q/A'] :param facts: list of facts for extraction, for example: ['us-gaap:Goodwill'] :param skip_segment: skip facts with segment :param min_date: min form date :par...
625941b9b830903b967e9797
@task(help={ "stack-name": "The name to prefix before the stack.", "subdomain": "The subdomain to configure. (e.g. www)", "cert-arn": "A valid certificate ARN.", "profile": "A valid AWS profile." }) <NEW_LINE> def update_monitoring(c, stack_name, subdomain, profile, cert_arn=None, create=False): <NEW_LINE> <INDENT> act...
Create or update monitoring CloudFormation stack
625941b929b78933be1e553a
def find_sub_sum(X, t): <NEW_LINE> <INDENT> if len(X) == 0: <NEW_LINE> <INDENT> if t == 0: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> Xp = find_sub_sum(X[1:], t) <NEW_LINE> if Xp != None: <NEW_LINE> <INDENT> return Xp <NEW_LINE> <DEDENT> Xp = find_sub...
find subset of X that sums up to t
625941b9be7bc26dc91cd486
def calculate_bld_up_area(bldg_occsolid_list, flr2flr_height): <NEW_LINE> <INDENT> flr_area_list = [] <NEW_LINE> for bldg_occsolid in bldg_occsolid_list: <NEW_LINE> <INDENT> flr_area = calculate_bldg_flr_area(bldg_occsolid, flr2flr_height) <NEW_LINE> flr_area_list.append(flr_area) <NEW_LINE> <DEDENT> return sum(flr_are...
This function calculates the total floor area of all the buildings. Parameters ---------- bldg_occsolid_list : list of OCCsolids The list of OCCsolids that are buildings to be calculated. flr2flr_height : float The floor to floor height the building. Returns ------- total_bldg_flr_area : float ...
625941b9e1aae11d1e749b35
def _read_ifd(self, target, valid_tags, offset=-1): <NEW_LINE> <INDENT> self._reads.seek(self._base + offset, os.SEEK_SET) <NEW_LINE> if not self.big: <NEW_LINE> <INDENT> data = self._reads.read(2) <NEW_LINE> if len(data) == 0: <NEW_LINE> <INDENT> raise StopIteration <NEW_LINE> <DEDENT> count = struct.unpack('%sH' % se...
Read an IFD and any sub-IFDs
625941b976d4e153a657e9b1
def crop_first_frame(self): <NEW_LINE> <INDENT> frame = self.webcam.single_pic_array() <NEW_LINE> crop_inst = images.CropShape(frame, self.no_of_sides) <NEW_LINE> mask, crop, points, _ = crop_inst.begin_crop() <NEW_LINE> return mask, crop, points
Finds the mask, crop and selection points for first frame
625941b9d99f1b3c44c67417
def setSpacing(self, *args): <NEW_LINE> <INDENT> return _osgManipulator.GridConstraint_setSpacing(self, *args)
setSpacing(GridConstraint self, Vec3d spacing)
625941b92c8b7c6e89b35644
def create_menu(self, state): <NEW_LINE> <INDENT> def file_save(): <NEW_LINE> <INDENT> file = tkinter.filedialog.asksaveasfile(mode='w', defaultextension='.txt') <NEW_LINE> if file: <NEW_LINE> <INDENT> file.write(parse.save(self.colorer.countries)) <NEW_LINE> file.close() <NEW_LINE> <DEDENT> <DEDENT> def file_load(): <...
Creates menu. :param state: tkinter.DISABLED or tkinter.ACTIVE :return: None
625941b90c0af96317bb806a
def docify(input_folder, output_path, count=-1, content_column="content", source_column="publication", keywords=[], ignore_source=[], overwrite=False): <NEW_LINE> <INDENT> logging.info("document data requested for '%s' dataset at '%s'...", input_folder, output_path) <NEW_LINE> if not utility.check_output_necessary(outp...
Create a file of documents from all csv files in a folder A count of -1 means output _all_ documents. Input_folder assumes no trailling /
625941b971ff763f4b549510
def match(obj, eng): <NEW_LINE> <INDENT> model = eng.workflow_definition.model(obj) <NEW_LINE> record = get_record_from_model(model) <NEW_LINE> response = list( set(match_by_arxiv_id(record)) | set(match_by_doi(record)) ) <NEW_LINE> if response: <NEW_LINE> <INDENT> obj.extra_data['recid'] = response[0] <NEW_LINE> obj.e...
Return True if the record already exists in INSPIRE. Searches by arXiv identifier and DOI, updates extra_data with the first id returned by the search.
625941b9baa26c4b54cb0fa4
def get(self, who_am_i): <NEW_LINE> <INDENT> self.__check('who_am_i', who_am_i) <NEW_LINE> if who_am_i == 'parent': <NEW_LINE> <INDENT> if not self.__in_queue.empty(): <NEW_LINE> <INDENT> return self.__in_queue.get() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> <DEDENT> if who_am_i == '...
Get value from queue :type who_am_i: str :return:
625941b910dbd63aa1bd2a30
def testBasicAsciiDiff(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> dcA = DataCategory("A", self.__attributeList, self.__rowListAsciiA) <NEW_LINE> dcB = DataCategory("A", self.__attributeList, self.__rowListAsciiB) <NEW_LINE> self.assertEqual(dcA, dcA) <NEW_LINE> self.assertIs(dcA, dcA) <NEW_LINE> self.assertEqu...
Test case - __eq__ and __ne__ methods
625941b9462c4b4f79d1d552
def updatePlots(self): <NEW_LINE> <INDENT> t = self.pip.TPData["time"] <NEW_LINE> rss = self.pip.TPData["Rss"] <NEW_LINE> peak = self.pip.TPData["Rpeak"] <NEW_LINE> self.leftPlot.plot(t, rss, clear=True) <NEW_LINE> self.rightPlot.plot(t, peak, clear=True)
Update the pipette data plots.
625941b9d18da76e23532354
def get_captcha_client_cache_key(client_id): <NEW_LINE> <INDENT> return "captcha:client_id:{0}".format(client_id)
将 client 转换为 cache 存储的 key :param client_id: :return:
625941b93617ad0b5ed67d81
def get_status_message(): <NEW_LINE> <INDENT> global _status_message <NEW_LINE> return _status_message
Get current status message. :returns: Current status message. :rtype: string >>> sublime.status_message("SomePlugin: working hard") >>> sublime.get_status_message() 'SomePlugin: working hard'
625941b976d4e153a657e9b2
def fill_out_mailing_detail(self, mailing_detail=None): <NEW_LINE> <INDENT> if mailing_detail is not None: <NEW_LINE> <INDENT> return self.mailing_detail_field.set_text(mailing_detail)
Fill out mailing detail. :param mailing_detail: :return:
625941b9d6c5a10208143ec9
def filter_and_sort(items, filterfn, keyfn=None, reverse=False) : <NEW_LINE> <INDENT> temp = [i for i in items if filterfn(i)] <NEW_LINE> if keyfn : <NEW_LINE> <INDENT> temp.sort(key=keyfn, reverse=reverse) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> random.shuffle(temp) <NEW_LINE> <DEDENT> return temp
filter some items from a list and sort the rest.
625941b9099cdd3c635f0ade
def test_create_state(self): <NEW_LINE> <INDENT> for state in ('INCOMING', 'FAILED', 'RUNNING'): <NEW_LINE> <INDENT> _ = _JobState(state) <NEW_LINE> <DEDENT> self.assertRaises(InvalidStateError, _JobState, 'garbage')
Check making new _JobState objects
625941b931939e2706e4ccf1
def geometry_types(self, entity, col): <NEW_LINE> <INDENT> col_obj = entity.columns[col] <NEW_LINE> if isinstance(col_obj, GeometryColumn): <NEW_LINE> <INDENT> geometry_type = col_obj.geometry_type() <NEW_LINE> return geometry_type
Check the column geometry type :param entity: :type Entity :param col: :type string :return: geom :rtype string
625941b90383005118ecf466
def register_specific(self, name: str, cmdfunc: SpecificCommandFunction, args: bool = True ) -> None: <NEW_LINE> <INDENT> command = SpecificCommand(name, cmdfunc, args) <NEW_LINE> self.register(command)
Register a function as specific bot command (i. e. @mention of the bot nick after the !command is required). This function will be called by process_commands() when the bot encounters a matching command. name - the name of the command (see register_general() for an explanation) cmdfunc - the function that is called w...
625941b926238365f5f0eceb
def process(img): <NEW_LINE> <INDENT> backproject = cv.CreateImage(cv.GetSize(img), 8, 1) <NEW_LINE> cv.Add(img, backproject, backproject) <NEW_LINE> return backproject
gray = cv.CreateImage(cv.GetSize(img), 8, 1) cv.CvtColor(img, gray, cv.CV_RGB2GRAY) #cv.EqualizeHist(gray, gray) canny = cv.CreateImage(cv.GetSize(img), 8, 1) cv.Canny(gray, canny, THRESHOLD, THRESHOLD*3) combined = cv.CreateImage(cv.GetSize(img), 8, 1) cv.Add(gray, canny, combined)
625941b9796e427e537b0444
def response_load_gateway_by_type_and_id( gateway_type, gateway_id ): <NEW_LINE> <INDENT> if gateway_id == None: <NEW_LINE> <INDENT> return (None, 403, None) <NEW_LINE> <DEDENT> gateway_read_start = storagetypes.get_time() <NEW_LINE> gateway = storage.read_gateway( gateway_id ) <NEW_LINE> if gateway is None: <NEW_LINE>...
Given a gateway's numeric type and ID, load it from the datastore.
625941b9090684286d50eb62
def lengthOfLongestSubstring(self, s): <NEW_LINE> <INDENT> char_idx = {} <NEW_LINE> max_len = 0 <NEW_LINE> start = 0 <NEW_LINE> for idx, ch in enumerate(s): <NEW_LINE> <INDENT> if ch in char_idx and char_idx[ch] >= start: <NEW_LINE> <INDENT> start = char_idx[ch]+1 <NEW_LINE> <DEDENT> char_idx[ch] = idx <NEW_LINE> max_l...
:type s: str :rtype: int
625941b985dfad0860c3acda
def main(args: Optional[List[str]] = None) -> int: <NEW_LINE> <INDENT> parser = get_parser() <NEW_LINE> opts = parser.parse_args(args=args) <NEW_LINE> print(opts) <NEW_LINE> return 0
Run the main program. This function is executed when you type `neo4j-api` or `python -m neo4j_api`. Arguments: args: Arguments passed from the command line. Returns: An exit code.
625941b9b545ff76a8913ca0
def get_count(query, registry_path, verbatim=True, finetuning=True): <NEW_LINE> <INDENT> book = load_workbook(registry_path, read_only=True) <NEW_LINE> table = row_generator(book['Experiments']) <NEW_LINE> count = 0 <NEW_LINE> for row in table: <NEW_LINE> <INDENT> if verbatim: <NEW_LINE> <INDENT> if query in row: count...
Returns the number of rows in which this query appears. If verbatim option is True, then query 'abc' would yield 0 even if 'abcd' is in the log. If verbatim is False, then if any element contains the entry it will be counted. Used primarily to determine the seed number on repeated experiments
625941b93eb6a72ae02ec35b
def SaveOverlappingPairsToFile(OverlappingPairs, JsonFileName): <NEW_LINE> <INDENT> OverlappingGenes = {} <NEW_LINE> for pair in OverlappingPairs: <NEW_LINE> <INDENT> if pair[0] in OverlappingGenes: <NEW_LINE> <INDENT> OverlappingGenes[pair[0]].append(pair[1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> OverlappingGe...
(list, str) -> file Take a list of overlapping gene pairs and save overlapping relationships to a json file
625941b963d6d428bbe44371
def set_training_callback(self): <NEW_LINE> <INDENT> get_config().tk_vars["refreshgraph"].trace("w", self.update_current_session) <NEW_LINE> get_config().tk_vars["istraining"].trace("w", self.remove_current_session)
Add a callback to update analysis when the training graph is updated
625941b9e1aae11d1e749b36
def get_test_augmentation(grayscale=False, height=320, width=640, crop_mode = 0): <NEW_LINE> <INDENT> mea = mean <NEW_LINE> st = std <NEW_LINE> if grayscale: <NEW_LINE> <INDENT> mea = (mean[0] + mean[1] + mean[2]) / 3 <NEW_LINE> st = (std[0] + std[1] + std[2]) / 3 <NEW_LINE> <DEDENT> test_transform = [ albu.Resize(heig...
Add paddings to make image shape divisible by 32
625941b95166f23b2e1a4fdb
def find_shortest_path(node_parent_map, root, destination, splist): <NEW_LINE> <INDENT> if destination == root: <NEW_LINE> <INDENT> splist.append(root) <NEW_LINE> return splist <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> splist.append(destination) <NEW_LINE> return find_shortest_path(node_parent_map,root, node_parent...
After Dijkstra's algorithm creates the graph that contains the shortest path from the root to all nodes, this algorithm will find the shortest path from the destination node back to the root node. :param node_parent_map: the hashmap that maps nodes to their parent node according to the shortest paths from the root...
625941b94d74a7450ccd4044
def poolNames(self): <NEW_LINE> <INDENT> pools = self.pools.keys() <NEW_LINE> pools.remove('__Corpus__') <NEW_LINE> pools = [pool for pool in pools] <NEW_LINE> pools.sort() <NEW_LINE> return pools
Return a sorted list of Pool names. Does not include the system pool '__Corpus__'.
625941b94d74a7450ccd4045
def _c_optimizations_available(): <NEW_LINE> <INDENT> catch = () if _c_optimizations_required() else (ImportError,) <NEW_LINE> try: <NEW_LINE> <INDENT> from zope.container import _zope_container_contained as c_opt <NEW_LINE> return c_opt <NEW_LINE> <DEDENT> except catch: <NEW_LINE> <INDENT> return False
Return the C optimization module, if available, otherwise a false value. If the optimizations are required but not available, this raises the ImportError. This does not say whether they should be used or not.
625941b9566aa707497f43fb
def _add_modify(self, entry): <NEW_LINE> <INDENT> self._add_history(entry_type='MODIFICATION', entry=entry)
Add the passed string as MODIFICATION to the history
625941b9091ae35668666de7
def test_executetimeout( host ): <NEW_LINE> <INDENT> rv = requests.get(host+("?SERVICE=WPS&Request=Execute&Identifier=lzmtest:testlongprocess&Version=1.0.0" "&MAP=france_parts&DATAINPUTS=PARAM1=1&TIMEOUT=3")) <NEW_LINE> assert rv.status_code == 424
Test execute timeout
625941b966673b3332b91f19
def numRollsToTarget(self, d, f, target): <NEW_LINE> <INDENT> history = dict() <NEW_LINE> def recursion(d,f,target, history): <NEW_LINE> <INDENT> ways = 0 <NEW_LINE> if target > d*f or target < d: <NEW_LINE> <INDENT> return ways <NEW_LINE> <DEDENT> if d == 1: <NEW_LINE> <INDENT> ways = 1 <NEW_LINE> <DEDENT> else: <NEW_...
:type d: int :type f: int :type target: int :rtype: int
625941b98e05c05ec3eea1f3
def leibniz(n=10000): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assert isinstance(n, int) <NEW_LINE> <DEDENT> except AssertionError: <NEW_LINE> <INDENT> print("n must be an integer") <NEW_LINE> return False <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> assert n >= 0 <NEW_LINE> <DEDENT> except AssertionError: <NEW_LIN...
>>> leibniz() 3.1415426535898203 >>> leibniz('hi') n must be an integer False >>> leibniz(-12) n must be >= 0 False
625941b930c21e258bdfa31e
def insert_device_tree(self, abs_dtbo): <NEW_LINE> <INDENT> self._client.insert_device_tree(abs_dtbo)
Insert device tree segment. For device tree segments associated with full / partial bitstreams, users can provide the relative or absolute paths of the dtbo files. Parameters ---------- abs_dtbo : str The absolute path to the device tree segment.
625941b901c39578d7e74cc5
def calculate_pricing_for(self, analyse): <NEW_LINE> <INDENT> institute = self.admission.institution <NEW_LINE> analyse_price = institute.analysepricing_set.filter(analyse_type=analyse.type) <NEW_LINE> if analyse_price: <NEW_LINE> <INDENT> return analyse_price[0].price, analyse_price[0].discount_rate <NEW_LINE> <DEDENT...
Get analyse price and discount rate for this admission.institute Args: analyse: Analyse object Returns: tuple, (discounted price, list price, discount rate)
625941b966656f66f7cbc02c
def test_get_all_sales(self): <NEW_LINE> <INDENT> access_token = self.user_token_get() <NEW_LINE> sales= {"sales": "products"} <NEW_LINE> response = self.client().get('/api/v1/sales', data=sales, content_type='application/json', headers=dict(Authorization="Bearer " + access_token)) <NEW_LINE> self.assertEqual(response....
Tests API can get all products)
625941b9656771135c3eb6f4
def input_signature(self): <NEW_LINE> <INDENT> return _ccsds_swig.trunk_tail_sptr_input_signature(self)
input_signature(trunk_tail_sptr self) -> io_signature_sptr
625941b98e05c05ec3eea1f4
def pop(self): <NEW_LINE> <INDENT> if self.r: <NEW_LINE> <INDENT> return self.r.pop()
:rtype: void
625941b97d43ff24873a2b26
def test_di(self): <NEW_LINE> <INDENT> exec_instruction("DI", [(ExprId("PSW", 32), ExprInt(1, 32))], [(ExprId("PSW", 32), ExprInt(0, 32))])
Test DI execution
625941b9293b9510aa2c311b
def _get_param(self, param_name): <NEW_LINE> <INDENT> return self.param_dicts[param_name]['get']()
self.param_dictsの値取得関数'get'に基づいて 指定したパラメータの現在値を取得する. Parameters ----------------------- param_name: str 現在値を取得するパラメータ名 Returns ---------------------- self.param_dicts[param_name]['get'](camera): int, float, str, ...etc param_nameの現在値. 型はパラメータ種類に依存.
625941b9e8904600ed9f1dab
def floor(self): <NEW_LINE> <INDENT> year, month, day, hour, minute, second, microsecond = self.year, self.month, self.day, self.hour, self.minute, self.second, self.microsecond <NEW_LINE> if year is None: <NEW_LINE> <INDENT> raise ValueError("Date has no year") <NEW_LINE> <DEDENT> if month is None: month = 1 <N...
Returns a ``datetime`` version of this object with all unspecified (None) attributes replaced by their lowest values. This method raises an error if the ``adatetime`` object has no year. >>> adt = adatetime(year=2009, month=5) >>> adt.floor() datetime.datetime(2009, 5, 1, 0, 0, 0, 0)
625941b915fb5d323cde098c
def runPickPath(pickpath): <NEW_LINE> <INDENT> initDisplays(pickpath.for_init_displays) <NEW_LINE> pickpath_completed = False <NEW_LINE> remaining_source_bin_tags_and_counts = copy.deepcopy(pickpath.source_bins_in_dict) <NEW_LINE> receive_bin_tag = pickpath.receive_bin.tag <NEW_LINE> correctly_pressed_source_bins = lis...
Function that runs a full pick path. Args: pickpath (dict): keys are displays and values are quantities
625941b9cc40096d615957d5
def get_current_year(): <NEW_LINE> <INDENT> return _get_cal()[0]
Returns the current year.
625941b98e71fb1e9831d62f
def cache_file_write(data): <NEW_LINE> <INDENT> f = None <NEW_LINE> try: <NEW_LINE> <INDENT> with atomicwrites.atomic_write(CACHE_FILE, overwrite=True) as f: <NEW_LINE> <INDENT> json.dump(data, f, indent=2) <NEW_LINE> f.write("\n") <NEW_LINE> <DEDENT> <DEDENT> except OSError as e: <NEW_LINE> <INDENT> util.warn("Failed ...
Write provided `data` to cache file, atomically. If this fails, log the error.
625941b931939e2706e4ccf2
def __init__(self, message, cause=None): <NEW_LINE> <INDENT> super(Exception, self).__init__(message) <NEW_LINE> self.cause = cause
construct the exception, providing a message :argument str message: an explantation of the error condition. :argument Exception cause: the exception representing the underlying cause of the exception. If None, there was no such underlying cause.
625941b932920d7e50b2804f
def planar_flow(z, params): <NEW_LINE> <INDENT> D = z.shape[0] <NEW_LINE> num_params = params.shape[0] <NEW_LINE> assert num_params == get_num_flow_params(PlanarFlow, D) <NEW_LINE> _u = params[:D] <NEW_LINE> w = params[D : (2 * D)] <NEW_LINE> b = params[2 * D] <NEW_LINE> wdotu = np.dot(w, _u) <NEW_LINE> m_wdotu = -1.0 ...
Planar flow operation and log abs det jac. [Insert tex of operation] # Arguments z (np.array): [D,] Input vector. params (np.array): [num_param,] Total parameter vector # Returns out (np.array): [D,] Output of affine flow operation. log_det_jacobian (np.float): Log abs det jac.
625941b9b7558d58953c4d9d
def create(self, project=None): <NEW_LINE> <INDENT> if project is None: <NEW_LINE> <INDENT> project = get_default_project() <NEW_LINE> <DEDENT> if project is None: <NEW_LINE> <INDENT> raise EnvironmentError('Project could not be inferred ' 'from environment.') <NEW_LINE> <DEDENT> query_params = {'project': project} <NE...
Creates current bucket. If the bucket already exists, will raise :class:`gcloud.exceptions.Conflict`. This implements "storage.buckets.insert". :type project: string :param project: Optional. The project to use when creating bucket. If not provided, falls back to default. :rtype: :class:`gcloud.stor...
625941b94527f215b584c2dd
def get_queryset(self): <NEW_LINE> <INDENT> return Question.objects.filter(pub_date__lte=timezone.now()).order_by('-pub_date')[:5]
Return the last five published questions.
625941b9b5575c28eb68de80
def _convert_estimator_io_to_keras(keras_model, features, labels): <NEW_LINE> <INDENT> def _to_ordered_tensor_list(obj, key_order, obj_name, order_name): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> elif isinstance(obj, (list, tuple)): <NEW_LINE> <INDENT> return [_convert_tens...
Converts estimator features and labels to keras input and target tensors. Args: keras_model: a compiled `tf.keras.Model` instance, used to determine the order of the returned lists. features: Dict of tensors or `None`. labels: Dict of tensors, a single tensor, or `None`. Returns: Tuple of ( list of in...
625941b91f5feb6acb0c49d7
def setup_reloader(self): <NEW_LINE> <INDENT> if self.reload: <NEW_LINE> <INDENT> reloader = hupper.start_reloader("wsgiserve.main") <NEW_LINE> reloader.watch_files([self.config])
setup reloader if reload option specified
625941b9498bea3a759b9933
def get_vm_list(self): <NEW_LINE> <INDENT> text = self.run('xe vm-list') <NEW_LINE> self.vm_names = self._parse_vm_uuid(text) <NEW_LINE> return self.vm_names
Return a dict of vm-name to uuid
625941b98a349b6b435e7ff7
def get_rsp(self, service_name, func_name, msg_id): <NEW_LINE> <INDENT> response = self.stub.get_rsp( GetRequest( service_name=service_name, func_name=func_name, msg_id=msg_id, )) <NEW_LINE> return response.payload
Get a response. This is a non-blocking function. :param service_name: The remote service to call. :param func_name: The remote function to call. :param msg_id: The message ID, may be None. :return: The payload of the response.
625941b9cb5e8a47e48b7931
def get_attr(self, key): <NEW_LINE> <INDENT> return self.__dict__[key]
This method gets attribute value of the GtFilter object.
625941b9ec188e330fd5a628
def find_adjacent(overlapping_information: list, existing_nodes: list): <NEW_LINE> <INDENT> result_connections = [] <NEW_LINE> for node in existing_nodes: <NEW_LINE> <INDENT> already_checked = False <NEW_LINE> for c in result_connections: <NEW_LINE> <INDENT> if node in c: <NEW_LINE> <INDENT> already_checked = True <NEW...
Gets a list of directly connected subgraphs and creates the indirect connections. :param overlapping_information: a list of lists each containing direct connections betweeen some subgraphs. :param existing_nodes: a list containing each existing node once. :return: a list of lists each containing all reachable subgraph...
625941b97d847024c06be143
def context_properties(): <NEW_LINE> <INDENT> from . import _data <NEW_LINE> return _data.contextproperties
Returns the list of context properties.
625941b94e696a04525c92d5
def get_hosted_zones_by_domain(Name, region=None, key=None, keyid=None, profile=None): <NEW_LINE> <INDENT> conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile) <NEW_LINE> zones = [z for z in _collect_results(conn.list_hosted_zones, 'HostedZones', {}) if z['Name'] == Name] <NEW_LINE> ret = [] <NEW_LINE...
Find any zones with the given domain name and return detailed info about them. Note that this can return multiple Route53 zones, since a domain name can be used in both public and private zones. Name The domain name associated with the Hosted Zone(s). region Region to connect to. key Secret key to be use...
625941b950485f2cf553cc1b
def third_order_LeviCevita_Tensor(self): <NEW_LINE> <INDENT> e = np.array( [ [ [int((i - j) * (j - k) * (k - i) / 2) for k in range(3)] for j in range(3)] for i in range(3)], dtype=FLOAT) <NEW_LINE> return e
Return a third order Levi_Civita tensor e_ijk. Here, eijk[0, 1, 2] = eijk[1, 2, 0] = eijk[2, 0, 1] = 1 eijk[0, 2, 1] = eijk[2, 1, 0] = eijk[1, 0, 2] = -1
625941b90a50d4780f666d12
def start_cluster(seed_data, cluster): <NEW_LINE> <INDENT> print("=> Starting cassandra cluster SEED nodes") <NEW_LINE> started_nodes = [] <NEW_LINE> for node in seed_data: <NEW_LINE> <INDENT> node_start_cassandra(node['zone'], node['name']) <NEW_LINE> started_nodes.append(node['name']) <NEW_LINE> <DEDENT> print("=> St...
Bring up cassandra on cluster nodes, SEEDs first
625941b99c8ee82313fbb5f7
def hold(name=None, pkgs=None, sources=None, **kwargs): <NEW_LINE> <INDENT> on_redhat_5 = __grains__.get('osmajorrelease', None) == '5' <NEW_LINE> lock_pkg = 'yum-versionlock' if on_redhat_5 else 'yum-plugin-versionlock' <NEW_LINE> if lock_pkg not in list_pkgs(): <NEW_LINE> <INDENT> raise SaltInvocationError( 'Packages...
.. versionadded:: 2014.7.0 Hold packages with ``yum -q versionlock``. name The name of the package to be held. Multiple Package Options: pkgs A list of packages to hold. Must be passed as a python list. The ``name`` parameter will be ignored if this option is passed. Returns a dict containing the chang...
625941b9851cf427c661a395
def addBinary(self, a, b): <NEW_LINE> <INDENT> a = "0b" + a <NEW_LINE> b = "0b" + b <NEW_LINE> a = eval(a) <NEW_LINE> b = eval(b) <NEW_LINE> c = a + b <NEW_LINE> return bin(c).replace("0b", "")
:type a: str :type b: str :rtype: str
625941b9925a0f43d2549cf6
def recvRtspReply(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> reply = self.rtsp_socket.recv(1024) <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> if not reply: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> data = reply.decode('utf-8') <NEW_LINE> ...
接收 RTSP/TCP 回复(循环阻塞)
625941b923e79379d52ee3ea
@APP.post('/_<action>projet/<nom>') <NEW_LINE> @b.auth_basic(a.editeur, _('Réservé aux éditeurs')) <NEW_LINE> @page <NEW_LINE> def projet_action(action, nom): <NEW_LINE> <INDENT> forms = rq.forms.decode() <NEW_LINE> if action == 'recevoir' and forms.action == 'recevoir': <NEW_LINE> <INDENT> return Projet(nom).recevoir(...
Envoi/réception vers un dépôt distant
625941b94428ac0f6e5ba675
def _clean_bug_tracker_info(self): <NEW_LINE> <INDENT> use_hosting = self.cleaned_data['bug_tracker_use_hosting'] <NEW_LINE> plan = self.cleaned_data['bug_tracker_plan'] or self.DEFAULT_PLAN_ID <NEW_LINE> bug_tracker_type = self.cleaned_data['bug_tracker_type'] <NEW_LINE> bug_tracker_url = '' <NEW_LINE> if use_hosting:...
Clean the bug tracker information. This will figure out the defaults for all the bug tracker fields, based on the stored bug tracker settings.
625941b9099cdd3c635f0adf
def get_queryset(self): <NEW_LINE> <INDENT> return Pregunta.objects.order_by('-pub_date')[:5]
Retorna las ultimas 5 preguntas.
625941b94c3428357757c1ae
def load_entity_type(self): <NEW_LINE> <INDENT> fqn = self.fqn.split(".") <NEW_LINE> if len(fqn) < 2: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> self.entity_type = self.edm_api.get_entity_type( self.edm_api.get_entity_type_id(namespace=fqn[0], name=fqn[1])) <NEW_LINE> <DEDENT> except openla...
Calls the API and loads the entity type information into an instance variable.
625941b9eab8aa0e5d26d9e1
def _impl(inputs, in_state_c, in_state_h, attr, params): <NEW_LINE> <INDENT> in_data = inputs[0] <NEW_LINE> in_weight = inputs[3] <NEW_LINE> in_bias = inputs[7] <NEW_LINE> forget_bias = attr.pop('forget_bias') <NEW_LINE> input_shape = attr['_input_shapes'][inputs[0]] <NEW_LINE> weight_shape = attr['_input_shapes'][inpu...
LSTM Block cell. Calculations are described in: https://github.com/tensorflow/tensorflow/blob/ r1.8/tensorflow/contrib/rnn/python/ops/lstm_ops.py#L41-L114 Parameters ---------- inputs : nnvm.Symbol Input data in_state_c: list of nnvm.Symbol Cell state input values for all the layers in_state_h: list of nnvm.Sy...
625941b9be7bc26dc91cd488
def test_get_branch(self): <NEW_LINE> <INDENT> pass
Test case for get_branch Get branch # noqa: E501
625941b9627d3e7fe0d68cd2
def hit_point(self, r): <NEW_LINE> <INDENT> theta = self.slope2rad(self.state[-1][2]) <NEW_LINE> y = self.state[-1][1] <NEW_LINE> m = y * np.cos(math.pi/2 -theta) + np.sqrt((y ** 2) * (np.cos(math.pi/2 - theta)) ** 2 - (y ** 2 - r ** 2)) <NEW_LINE> x = m * np.sin(math.pi / 2 - theta) <NEW_LINE> y = m * np.sin(theta) <N...
Calculate the position where light incident the lens. :param r: float the radius of lens
625941b9e1aae11d1e749b37
def message(words,color,x,y): <NEW_LINE> <INDENT> turtle.color(color) <NEW_LINE> turtle.up() <NEW_LINE> turtle.goto(x,y) <NEW_LINE> turtle.down <NEW_LINE> turtle.hideturtle <NEW_LINE> turtle.write(words,move=False,align="left",font=("Arial",30,"normal")) <NEW_LINE> turtle.up()
signature: str,str,int,int -> NoneType message takes a set of words and the color the user wants them printed in. Then it prints it on turtle at the coordinates inputted. This function always prints the message in Arial font at size 30.
625941b9d7e4931a7ee9dd9f
def _identity_lookup( self, mapper, primary_key_identity, identity_token=None, passive=attributes.PASSIVE_OFF, lazy_loaded_from=None, ): <NEW_LINE> <INDENT> key = mapper.identity_key_from_primary_key( primary_key_identity, identity_token=identity_token ) <NEW_LINE> return loading.get_from_identity(self, mapper, key, pa...
Locate an object in the identity map. Given a primary key identity, constructs an identity key and then looks in the session's identity map. If present, the object may be run through unexpiration rules (e.g. load unloaded attributes, check if was deleted). e.g.:: obj = session._identity_lookup(inspect(SomeClass...
625941b9507cdc57c6306b57
def getHostIpVMK0(netcfg): <NEW_LINE> <INDENT> ipaddr = None <NEW_LINE> for vnic in netcfg: <NEW_LINE> <INDENT> if vnic.device == 'vmk0': <NEW_LINE> <INDENT> ipaddr = vnic.spec.ip.ipAddress <NEW_LINE> <DEDENT> <DEDENT> return ipaddr
GET IP FROM HOST AND VMK0
625941b92c8b7c6e89b35646
def set_activate_port(self, board, port): <NEW_LINE> <INDENT> if (board not in self.boards) or (port not in range(0, self.ports)): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> self.write_read_data('config', short=True) <NEW_LINE> self.write_read_data('interface adsl 0/{}'.format(board), short=True) <NEW_LINE>...
Активировать порт
625941b90c0af96317bb806c