code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def read_frame(self, timeout): <NEW_LINE> <INDENT> return self.transport.read(timeout)
Wait *timeout* milliseconds to return a chip response frame.
625941c47c178a314d6ef433
def delete_basic_info(self, user_id, request): <NEW_LINE> <INDENT> timer = Timer(user_id) <NEW_LINE> req = internal_pb2.DeleteBasicInfoReq() <NEW_LINE> req.ParseFromString(request) <NEW_LINE> defer = DataBase().get_basic_data(basic_view.BASIC_ID) <NEW_LINE> defer.addCallback(self._calc_delete_basic_info, req, timer) <N...
删除basic基础数据
625941c4d6c5a10208144020
def predict(self, u=None, B=None, F=None, Q=None): <NEW_LINE> <INDENT> if B is None: <NEW_LINE> <INDENT> B = self.B <NEW_LINE> <DEDENT> if F is None: <NEW_LINE> <INDENT> F = self.F <NEW_LINE> <DEDENT> if Q is None: <NEW_LINE> <INDENT> Q = self.Q <NEW_LINE> <DEDENT> elif isscalar(Q): <NEW_LINE> <INDENT> Q = eye(self.dim...
Predict next state (prior) using the Kalman filter state propagation equations. Parameters ---------- u : np.array, default 0 Optional control vector. B : np.array(dim_x, dim_u), or None Optional control transition matrix; a value of None will cause the filter to use `self.B`. F : np.array(dim_x, dim_x), or...
625941c41f5feb6acb0c4b29
def degree_centrality_cache_placement(topology, cache_budget, cache_nodes, **kwargs): <NEW_LINE> <INDENT> deg = nx.degree(topology) <NEW_LINE> total_deg = sum(deg.values()) <NEW_LINE> return dict((v, int(cache_budget*deg[v]//total_deg)) for v in cache_nodes)
Places cache budget proportionally to the degree of the node. Parameters ---------- topology : Topology The topology object cache_budget : int The cumulative cache budget cache_nodes : list List of nodes of the topology on which caches can be deployed Returns ------- cache_placement : dict Diction...
625941c4ad47b63b2c509f56
def addon_refresh(): <NEW_LINE> <INDENT> pass
Scan add-on directories for new modules
625941c40383005118ecf5ba
def _update_charge(self): <NEW_LINE> <INDENT> if self.charge_type_combo_box.itemText(0) == "": <NEW_LINE> <INDENT> self.charge_type_combo_box.removeItem(0) <NEW_LINE> <DEDENT> dc_type_string = self.charge_type_combo_box.currentText() <NEW_LINE> if dc_type_string == "SQUARE": <NEW_LINE> <INDENT> dc_type = st.Distributed...
This function is connected to the charge type combobox
625941c4adb09d7d5db6c767
def dfs(g_edges, v): <NEW_LINE> <INDENT> stack = [v] <NEW_LINE> while stack: <NEW_LINE> <INDENT> current = stack.pop() <NEW_LINE> if current not in explored: <NEW_LINE> <INDENT> explored.add(current) <NEW_LINE> scc[s].append(current) <NEW_LINE> <DEDENT> if current not in g_edges or all(i in explored for ...
Iterative version of depth-first search customized for Kosaraju's 2-pass algorithm. Input: A dictionary representation of the graph's adjacency list and a starting vertex. Output: No output.
625941c4498bea3a759b9a86
def __init__AnswerController(self): <NEW_LINE> <INDENT> if self.survey.paper.step: <NEW_LINE> <INDENT> self.answerController = SurveyStepAnswerController(self) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.answerController = SurveyBulkAnswerController(self)
初始化答题控制器
625941c46aa9bd52df036d7a
def search_movie(string, **params): <NEW_LINE> <INDENT> return _client.search_movie(string, **params)
Search movies by string.
625941c4d10714528d5ffcb8
def save_and_send(self) -> None: <NEW_LINE> <INDENT> self._COMObject_appt.Save() <NEW_LINE> self._COMObject_appt.Send()
Each event has the attribute of sending itself, called by event terminal
625941c424f1403a92600b3f
def add(self, irc, msg, args, username, nick): <NEW_LINE> <INDENT> if not nick: <NEW_LINE> <INDENT> nick = msg.nick <NEW_LINE> <DEDENT> channel = msg.args[0] <NEW_LINE> oldname = self.db.getusername(channel, nick) <NEW_LINE> if oldname != username: <NEW_LINE> <INDENT> if self.db.remove(channel, nick): <NEW_LINE> <INDEN...
<username> [nick] Links the callers nick to <username> on LastFM. If [nick] is given that is linked to <username> instead.
625941c43317a56b86939c33
def removeFromStringsInLst(self, string): <NEW_LINE> <INDENT> self.stringsInLst.remove(string.lower())
Function to remove the passed in string from the stringsInLst set :type string: str
625941c499cbb53fe6792bbe
def bad_sample_rank_scatter(df, score, target, cutoff=None, title=None, save_path=None): <NEW_LINE> <INDENT> score_rank = df[score].rank(method='first').astype(int) <NEW_LINE> bad_sample_rank = score_rank.loc[df[target] == 1].values <NEW_LINE> plt.figure(figsize=(16, 5), dpi=400) <NEW_LINE> plt.scatter(x=bad_sample_ran...
绘制坏样本模型分排序的散点图 df: DataFrame score: str 分数的列名 target: str target列名 cutoff: list, default None 切分点,切分的百分比, eg. [0.05, 0.2, 0.5, 0.8, 0.9] title: str, default None 图片标题 save_path: str, default None 图片存储路径
625941c4627d3e7fe0d68e26
def _unique_id_to_constituent_ids(self): <NEW_LINE> <INDENT> mapping = {} <NEW_LINE> for indicator in self: <NEW_LINE> <INDENT> mapping[indicator._unique_id] = ( indicator.template_id, indicator.indicator_group_id, indicator.id, indicator.aggregation_function, ) <NEW_LINE> <DEDENT> return mapping
Get details on an opaque column_id in terms of AssetCentral IDs and aggregation_function.
625941c48da39b475bd64f49
def pop(self) -> int: <NEW_LINE> <INDENT> f = self.arr[0] <NEW_LINE> del self.arr[0] <NEW_LINE> return f
Removes the element from in front of queue and returns
625941c4cad5886f8bd26fb1
def parse_args(self, args=None, namespace=None): <NEW_LINE> <INDENT> args, argv = self.parse_known_args(args, namespace) <NEW_LINE> if argv: <NEW_LINE> <INDENT> for arg in argv: <NEW_LINE> <INDENT> if arg and arg[0] == "-": <NEW_LINE> <INDENT> lines = ["unrecognized arguments: %s" % (" ".join(argv))] <NEW_LINE> for k, ...
allow splitting of positional arguments
625941c4507cdc57c6306cae
def _render_conditions(conditions): <NEW_LINE> <INDENT> if not conditions: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> rendered_conditions = [] <NEW_LINE> for condition in conditions: <NEW_LINE> <INDENT> field = condition.get('field') <NEW_LINE> field_type = condition.get('type') <NEW_LINE> comparators = conditio...
Render the conditions part of a query. Args: conditions: a list of dictionary items to filter a table. Each dict should be formatted as {'field': 'start_time', 'value': {'value': 1, 'negate': False}, 'comparator': '>', 'type': 'FLOAT'} which is represetned as 'start_time > FLOAT('1'...
625941c4090684286d50ecbb
def set_particle(self, coordinates, data, uid): <NEW_LINE> <INDENT> if uid not in self._index_of_uid: <NEW_LINE> <INDENT> self._index_of_uid[uid] = len(self._index_of_uid) <NEW_LINE> <DEDENT> i = self._index_of_uid[uid] * 3 <NEW_LINE> self._coordinates[i:i+3] = coordinates[0:3] <NEW_LINE> index = self._index_of_uid[uid...
set particle coordinates and data Parameters ---------- coordinates : tuple of floats particle coordinates data : DataContainer data of the particle uid : uuid uuid of the particle
625941c4d268445f265b4e46
def _check_delete_rules(self, doc, queryset, cascade_refs, write_concern): <NEW_LINE> <INDENT> delete_rules = doc._meta.get('delete_rules') or {} <NEW_LINE> for rule_entry in delete_rules: <NEW_LINE> <INDENT> document_cls, field_name = rule_entry <NEW_LINE> if document_cls._meta.get('abstract'): <NEW_LINE> <INDENT> con...
Checks the delete rules for documents being deleted in a queryset. Raises an exception if any document has a DENY rule.
625941c4c4546d3d9de72a09
def createPaperCheck(self, userToken=None, data=None): <NEW_LINE> <INDENT> if not userToken: <NEW_LINE> <INDENT> raise HyperwalletException('userToken is required') <NEW_LINE> <DEDENT> if not data: <NEW_LINE> <INDENT> raise HyperwalletException('data is required') <NEW_LINE> <DEDENT> return self.apiClient.doPost( os.pa...
Create a Paper Check. :param userToken: A token identifying the User. **REQUIRED** :param data: A dictionary containing Paper Check information. **REQUIRED** :returns: The Create a Paper Check API response.
625941c4a8370b7717052877
def find_or_create_field_stored_string(fieldmodule: Fieldmodule, name="name", managed=True) -> Field: <NEW_LINE> <INDENT> field = fieldmodule.findFieldByName(name) <NEW_LINE> if field.isValid(): <NEW_LINE> <INDENT> if field.getValueType() == Field.VALUE_TYPE_STRING: <NEW_LINE> <INDENT> return field <NEW_LINE> <DEDENT> ...
Finds or creates a stored string field for defining names on nodes or datapoints. Note can't use Field.castStoredString API as not released. New field is managed by default. :param fieldmodule: Zinc fieldmodule to find or create field in. :param name: Name of field to find or create. :param managed: Managed state of...
625941c494891a1f4081ba80
def generatePixmap(base64_data): <NEW_LINE> <INDENT> import_qt(globals()) <NEW_LINE> binary_data = binascii.a2b_base64(base64_data) <NEW_LINE> arr = QtCore.QByteArray.fromRawData(binary_data) <NEW_LINE> img = QtGui.QImage.fromData(arr) <NEW_LINE> return QtGui.QPixmap(img)
Generates a new pixmap based on the inputed base64 data. :param base64 | <str>
625941c45fdd1c0f98dc020a
def makeUrlList(self): <NEW_LINE> <INDENT> return [self.url.format(i) for i in range(1, 14)]
构造url_list,并返回
625941c4de87d2750b85fd68
def get_manager_remote_debug(self): <NEW_LINE> <INDENT> return self.__manager_remote_debug
Get manager remote debug flag
625941c4498bea3a759b9a87
def convert_award_id_to_guai(award_tuple: tuple) -> tuple: <NEW_LINE> <INDENT> sql = "SELECT generated_unique_award_id FROM awards WHERE id IN %s" <NEW_LINE> values = [award_tuple] <NEW_LINE> with connection.cursor() as cursor: <NEW_LINE> <INDENT> cursor.execute(sql, values) <NEW_LINE> return tuple([row[0] for row in c...
Scafolding code between award PK ids and unique award ids
625941c407d97122c417885f
def __init__(self, subreddit): <NEW_LINE> <INDENT> super(CommentHelper, self).__init__(subreddit._reddit, None) <NEW_LINE> self.subreddit = subreddit
Initialize a CommentHelper instance.
625941c4be383301e01b5460
def error_handler(message_queue, e, queue, count, sending): <NEW_LINE> <INDENT> print("Error encountered during message sending.") <NEW_LINE> print("Sending list length: {}".format(len(sending))) <NEW_LINE> print("Queue: {}".format(queue)) <NEW_LINE> print("Count: {}".format(count)) <NEW_LINE> print("Sending: {}". form...
Error handler called in the event of problems sending the message batch. The aim being to log as many details of the surrounding circumstances, not just the error itself - this will only be called if the Kik API or the Kik servers reject the bundle of messages, which could mean a malformed message or server error. So,...
625941c44428ac0f6e5ba7c9
def upscale(self, input_directory, output_directory, scale_ratio, jobs, image_format, upscaler_exceptions): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.driver_settings['input'] = input_directory <NEW_LINE> self.driver_settings['output'] = output_directory <NEW_LINE> self.driver_settings['scale-ratio'] = scale_rat...
Waifu2x Converter Driver Upscaler This method executes the upscaling of extracted frames. Arguments: input_directory {string} -- source directory path output_directory {string} -- output directory path scale_ratio {int} -- frames' scale ratio threads {int} -- number of threads
625941c4b545ff76a8913dee
def create_file_info_nogui(shape, fname=""): <NEW_LINE> <INDENT> objects = [] <NEW_LINE> solids = shape.Solids <NEW_LINE> if len(solids) != len(shape.Shells): <NEW_LINE> <INDENT> print ("Repairing open shells that are not solids for %s"%(fname)) <NEW_LINE> solids = repair_solids_from_shells(shape) <NEW_LINE> fromShell=...
A no-Gui version of the create_file_info, rather useless now as the color is critical for the program. Using FreeCAD GGUI significantly slows down the program and prevents it from running in a true batch mode. It seems possible to hack Face.Tolerance property (unused so far) and import STEP files saving colors in this ...
625941c44c3428357757c300
def min_noutput_items(self): <NEW_LINE> <INDENT> return _analog_swig.pll_freqdet_cf_sptr_min_noutput_items(self)
min_noutput_items(pll_freqdet_cf_sptr self) -> int
625941c4a8370b7717052878
def db_init(self): <NEW_LINE> <INDENT> raise NotImplementedError
Initialize database. .. warning:: This method has be overwritten
625941c444b2445a3393206e
def read(self): <NEW_LINE> <INDENT> if self.sock is None: <NEW_LINE> <INDENT> self.sock = self._create_socket() <NEW_LINE> <DEDENT> if not self.fh: <NEW_LINE> <INDENT> self.fh = self.sock.makefile() <NEW_LINE> <DEDENT> read = self.fh.readline().rstrip("\r\n") <NEW_LINE> return read
Returns a single line from the file
625941c438b623060ff0adc5
def run_reducer(self, stdin=sys.stdin, stdout=sys.stdout): <NEW_LINE> <INDENT> self.init_hadoop() <NEW_LINE> self.init_reducer() <NEW_LINE> outputs = self._reduce_input(self.internal_reader((line[:-1] for line in stdin)), self.reducer, self.final_reducer) <NEW_LINE> self.writer(outputs, stdout)
Run the reducer on the hadoop node.
625941c4eab8aa0e5d26db2f
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
625941c4d7e4931a7ee9def4
def run_script(self, mount: str, name: str, arg: Any = None) -> Result[Any]: <NEW_LINE> <INDENT> request = Request( method="post", endpoint=f"/_api/foxx/scripts/{name}", params={"mount": mount}, data=arg, ) <NEW_LINE> def response_handler(resp: Response) -> Any: <NEW_LINE> <INDENT> if resp.is_success: <NEW_LINE> <INDEN...
Run a service script. :param mount: Service mount path (e.g "/_admin/aardvark"). :type mount: str :param name: Script name. :type name: str :param arg: Arbitrary value passed into the script as first argument. :type arg: Any :return: Result of the script, if any. :rtype: Any :raise arango.exceptions.FoxxScriptRunError...
625941c4e5267d203edcdc76
def printGrid(self): <NEW_LINE> <INDENT> for row in self.content: <NEW_LINE> <INDENT> print_list = [] <NEW_LINE> for tuble in row: <NEW_LINE> <INDENT> print_list.append(str(tuble[0])+tuble[1]) <NEW_LINE> <DEDENT> print(print_list) <NEW_LINE> <DEDENT> print()
Prints the grid as a list of lists.
625941c4d7e4931a7ee9def5
def getSelection( self ): <NEW_LINE> <INDENT> return {}
Always blank.
625941c4a17c0f6771cbe02a
def serialize_numpy(self, buff, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self <NEW_LINE> buff.write(_get_struct_2db().pack(_x.pos, _x.angle, _x.id)) <NEW_LINE> <DEDENT> except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', se...
serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module
625941c4167d2b6e31218b6e
def test_move_player(): <NEW_LINE> <INDENT> player = Player() <NEW_LINE> player.mass = 100 <NEW_LINE> player.force = np.array([-10.0, 0.0]) <NEW_LINE> player.position = np.array([10.0, 10.0]) <NEW_LINE> player.velocity = np.array([50.0, 50.0]) <NEW_LINE> assert np.any(np.not_equal(player.force, np.zeros(2))) <NEW_LINE>...
Check if the code is able to change the position of a player
625941c42c8b7c6e89b35799
def delete_page(self, page): <NEW_LINE> <INDENT> self.remove_page(page.pageid) <NEW_LINE> page.delete(self.pagedir) <NEW_LINE> self.db.commit()
remove page from database and deleta page data
625941c4796e427e537b059c
def register_via_preregistered_key(self): <NEW_LINE> <INDENT> own_device = Device.get_own_device() <NEW_LINE> r = self.post("register", { "client_device": serialize([own_device], ensure_ascii=False), }) <NEW_LINE> if (r.status_code == 500 or r.status_code == 400) and "Device has no field named 'version'" in r.content: ...
Register this device with a zone, through the central server directly
625941c45166f23b2e1a5131
def smooth(x, window_len=11, window='hanning'): <NEW_LINE> <INDENT> if x.ndim != 1: <NEW_LINE> <INDENT> raise ValueError("smooth only accepts 1 dimension arrays.") <NEW_LINE> <DEDENT> if x.size < window_len: <NEW_LINE> <INDENT> raise ValueError("Input vector needs to be bigger than window size.") <NEW_LINE> <DEDENT> if...
Smooth a 1D array using a window with requested size. This function taken from http://www.scipy.org/Cookbook/SignalSmooth CBH modified it to cutoff the (window_len-1)/2 values at each end of the final 1D array (the reflected part's remnants), so that the final array size is the same as the original array size. This ...
625941c49b70327d1c4e0dac
def verbose_tokens(self): <NEW_LINE> <INDENT> tokens = list(self._tokens) <NEW_LINE> self.verbose_token(7, ToString.time_unit, tokens) <NEW_LINE> self.verbose_token(8, ToString.aob, tokens) <NEW_LINE> self.verbose_token(15, ToString.time_unit, tokens) <NEW_LINE> return tokens
possibility to enrich some cryptic values with their human readable description
625941c45f7d997b87174a6e
def test_unavailable_state(self): <NEW_LINE> <INDENT> plant_name = "some_plant" <NEW_LINE> assert setup_component( self.hass, plant.DOMAIN, {plant.DOMAIN: {plant_name: GOOD_CONFIG}} ) <NEW_LINE> self.hass.states.set( MOISTURE_ENTITY, STATE_UNAVAILABLE, {ATTR_UNIT_OF_MEASUREMENT: "us/cm"} ) <NEW_LINE> self.hass.block_ti...
Test updating the state with unavailable. Make sure that plant processes this correctly.
625941c4462c4b4f79d1d6a8
@blueprint.route('/about/') <NEW_LINE> def about(): <NEW_LINE> <INDENT> return render_template('public/about.html', callback_url=auth_callback_url, auth_id=auth_id, auth_domain=auth_domain)
About page.
625941c45fcc89381b1e1695
def evaluate_word(self): <NEW_LINE> <INDENT> index = 0 <NEW_LINE> text_length = len(self.text) <NEW_LINE> while index < text_length: <NEW_LINE> <INDENT> if self.__should_delete_char(self.text, index): <NEW_LINE> <INDENT> self.delete_char(index) <NEW_LINE> text_length -= 1 <NEW_LINE> index -= 1 <NEW_LINE> <DEDENT> index...
Check in order to see if a word contains any invalid characters, delete any invalid chars
625941c40a366e3fb873e7f0
def generate_mapfiles_meteorological(self, date_start): <NEW_LINE> <INDENT> for c in RASTER_METEROLOGICAL_DATA_RANGE: <NEW_LINE> <INDENT> print('>> Generating %s mapfile' % c) <NEW_LINE> mf = mapfile.MapFileMeteorological( map_class=c, date_start=date_start ) <NEW_LINE> mf.create_files()
:return:
625941c47b25080760e39432
def test_search_groups(self): <NEW_LINE> <INDENT> requesterId = None <NEW_LINE> clientToken = None <NEW_LINE> query = "Hello" <NEW_LINE> start = 0 <NEW_LINE> end = 10 <NEW_LINE> print(self.api.search_groups(query,start,end,requesterId,clientToken)) <NEW_LINE> pass
Test case for search_groups Get list of matching groups
625941c43cc13d1c6d3c7353
def test_ct_para_sharing(self): <NEW_LINE> <INDENT> alg = TestAlgorithm(model=SimpleModelDeterministic( dims=[10], perception_net=nn.Linear(10, 10))) <NEW_LINE> ct0 = ComputationTask("test", algorithm=alg) <NEW_LINE> ct1 = ComputationTask("test", algorithm=alg) <NEW_LINE> batch_size = 10 <NEW_LINE> sensor = np.random.u...
Test case for two CTs sharing parameters
625941c4283ffb24f3c558db
@keras_export('keras.backend.random_normal') <NEW_LINE> def random_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None): <NEW_LINE> <INDENT> if dtype is None: <NEW_LINE> <INDENT> dtype = floatx() <NEW_LINE> <DEDENT> if seed is None: <NEW_LINE> <INDENT> seed = np.random.randint(10e6) <NEW_LINE> <DEDENT> return ran...
Returns a tensor with normal distribution of values. It is an alias to `tf.random.normal`. Arguments: shape: A tuple of integers, the shape of tensor to create. mean: A float, the mean value of the normal distribution to draw samples. Default to 0.0. stddev: A float, the standard deviation of the no...
625941c4de87d2750b85fd69
def int_units_to_num_str(int_val, precision): <NEW_LINE> <INDENT> int_units_str = str(int_val) <NEW_LINE> if len(int_units_str) < precision + 1: <NEW_LINE> <INDENT> int_units_str = ("0" * (precision + 1 - len(int_units_str))) + int_units_str <NEW_LINE> <DEDENT> int_part = int_units_str[:-precision] <NEW_LINE> frac_part...
Converts the amount integer in unit amounts to a string with a floating-point value at the specified precision.
625941c49f2886367277a866
def _get_metadata_from_server_imds_v2(self) -> Union[str, None]: <NEW_LINE> <INDENT> log.debug(f'Trying to get AWS metadata from {self.CLOUD_PROVIDER_METADATA_URL} using IMDSv2') <NEW_LINE> token = self._get_token() <NEW_LINE> if token is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> headers = { 'X-aws-ec2-...
Try to get metadata from server using IMDSv2 :return: String with metadata or None
625941c456ac1b37e62641aa
def get_wars_with_http_info(self, **kwargs): <NEW_LINE> <INDENT> all_params = ['datasource', 'max_war_id', 'user_agent', 'x_user_agent'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request...
List wars Return a list of wars --- This route is cached for up to 3600 seconds This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>...
625941c463f4b57ef00010f5
def post(self, obj, js_body): <NEW_LINE> <INDENT> url = self._build_url(obj) <NEW_LINE> return self._post(url, js_body)
Implements HTTP POST operation
625941c4b830903b967e98e5
def get_ticks_direction(self, minor=False): <NEW_LINE> <INDENT> if minor: <NEW_LINE> <INDENT> return np.array( [tick._tickdir for tick in self.get_minor_ticks()]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.array( [tick._tickdir for tick in self.get_major_ticks()])
Get the tick directions as a numpy array Parameters ---------- minor : bool, default: False True to return the minor tick directions, False to return the major tick directions. Returns ------- numpy array of tick directions
625941c4fb3f5b602dac366a
def test_parent_and_event_id(self, bigcat): <NEW_LINE> <INDENT> for name, df in bigcat._dfs.items(): <NEW_LINE> <INDENT> if name in {"Event", "ID"}: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> assert (df["_parent_id_"].astype(bool)).all() <NEW_LINE> assert (df["_event_id_"].astype(bool)).all()
ensure parent and event ids are in non-event tables
625941c431939e2706e4ce44
def test_format_other_timezone_works(self): <NEW_LINE> <INDENT> cet = timezone(timedelta(hours=1)) <NEW_LINE> out = self.tf.format_data('%F %T', cet) <NEW_LINE> self.assertEqual(list(out)[0][0], '1970-01-01 01:00:00')
Assert that the format returned is correct with a different timezone
625941c492d797404e304162
@app.route('/school/students/program/<program>', methods=['GET']) <NEW_LINE> def get_student_program(program): <NEW_LINE> <INDENT> students = school.get_all_students() <NEW_LINE> student_list = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for student in students: <NEW_LINE> <INDENT> if student.get_program() == program: <NEW_...
shows all students who are in a specified program
625941c4ec188e330fd5a77a
def composer_preprocessor(intermediate): <NEW_LINE> <INDENT> intermediate.ast = filters.wrap_lists(intermediate.ast) <NEW_LINE> intermediate.ast = filters.img64(intermediate.ast) <NEW_LINE> intermediate.ast = filters.untab_verb(intermediate.ast) <NEW_LINE> return intermediate
Performs the following modifications to the intermediate: - [filters.wrap_lists](%/Modules/fitlers.html) is called to warp all consecutive listitem tokens in a list token - Converts images to a base64 encoded string to appear directly in the HTML source - Verbatim blocks have leading whitespace evenly removed to hel...
625941c4a4f1c619b28b0015
def new_board(): <NEW_LINE> <INDENT> show_board = True <NEW_LINE> new_board = True <NEW_LINE> global_param.new_board = True <NEW_LINE> game = Game() <NEW_LINE> game._create_danger_list() <NEW_LINE> game.create_board() <NEW_LINE> game.place_start_finish() <NEW_LINE> game.place_danger() <NEW_LINE> game.save_board() <NEW_...
Create a random new board based on global parameters and save it
625941c45fcc89381b1e1696
def __init__(self,database_name,folder_path, id_experiment,type_init_weigths_function): <NEW_LINE> <INDENT> self.database_name = database_name <NEW_LINE> self.id_experiment = id_experiment <NEW_LINE> self.type_init_weigths_function = type_init_weigths_function <NEW_LINE> self.repo = WeigthsRepo.WeigthsRepo(self.databas...
:rtype : object
625941c499fddb7c1c9de36a
def _moveRight(self): <NEW_LINE> <INDENT> self.changeDirection("right") <NEW_LINE> self._x = self._x + self._speed
moves person towards right
625941c473bcbd0ca4b2c04f
def add_check(self, rule): <NEW_LINE> <INDENT> self.rules.append(rule)
Adds rule to be checked. Allow addition of another rule to the list of rules that will be checked. :return: self :rtype: :class:`.AndChecker`
625941c4435de62698dfdc24
def test_ssl_client_key_cert2(self): <NEW_LINE> <INDENT> mongo = mongo_class.RepSetColl( self.cfg.name, self.cfg.user, self.cfg.japd, host=self.cfg.host, port=self.cfg.port, conf_file=self.conf_file, ssl_client_key=self.ssl_client_key, ssl_client_cert=self.ssl_client_cert, coll=self.coll_name, repset_hosts=self.cfg.rep...
Function: test_ssl_client_key_cert2 Description: Test with both cert and key present. Arguments:
625941c476e4537e8c351649
def partial_update(self, request, pk=None): <NEW_LINE> <INDENT> return Response({'http_method': 'PATCH'})
Update an object replacing only fields required
625941c42eb69b55b151c886
def editing(_self=cmd): <NEW_LINE> <INDENT> _self.help('editing')
SUMMARY PyMOL has a rudimentary, but quite functional molecular structure editing capability. However, you will need to use an external mimizer to "clean-up" your structures after editing. Furthermore, if you are going to modify molecules other than proteins, then you will also need a way of assigning atom types on ...
625941c46fb2d068a760f073
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS, updated=functools.WRAPPER_UPDATES, provides=None, required=_unset, optional=_unset): <NEW_LINE> <INDENT> def decorator(func): <NEW_LINE> <INDENT> sig = WantSignature.from_func( func, wrapped, provides, [] if required is _unset else required, [] if optional is _...
A function decorator for wrapping decorators. This works just like ``six.wraps()`` (which in turn works just like ``functools.wraps()``), but additionally manages dependency injection metadata, allowing decorators to request data independent of the function they wrap. :param wrapped: The function that is being wrappe...
625941c48e71fb1e9831d782
def addVisited(self): <NEW_LINE> <INDENT> if len(self._visitedRooms) == 9: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.getRoomName() not in self._visitedRooms: <NEW_LINE> <INDENT> self._visitedRooms.append(self.getRoomName())
Adds the current room to the visited rooms list, if it has not been visited already.
625941c48c0ade5d55d3e992
def getquerymods(self): <NEW_LINE> <INDENT> result = [] <NEW_LINE> if not self.assemblyPath or not self.spec: <NEW_LINE> <INDENT> return result <NEW_LINE> <DEDENT> for i, placement in enumerate(self.assemblyPath): <NEW_LINE> <INDENT> if i==0 and placement.parent.querymod: <NEW_LINE> <INDENT> result.append(placement.par...
Get a list of all querymods for this assemblyPath and spec
625941c47047854f462a13e4
def _test_case(self, fname, func: callable, a, b, n_nodes, interp_params): <NEW_LINE> <INDENT> k_dense = 10 <NEW_LINE> m = k_dense * n_nodes <NEW_LINE> xs_dense = np.array(sorted([*np.linspace(a, b, m), *self._get_nodes(NodeType.EQ, a, b, n_nodes), *self._get_nodes(NodeType.CHEB, a, b, n_nodes)])) <NEW_LINE> ys_dense =...
Общий метод проверки
625941c4fff4ab517eb2f413
def _createTable(connection): <NEW_LINE> <INDENT> cursor = connection.cursor() <NEW_LINE> cursor.execute("CREATE TABLE entries(id INTEGER PRIMARY KEY, data BLOB)") <NEW_LINE> connection.commit()
Creates the entries table in the database Creates a table called entries with the following fields - id - INTEGER PRIMARY KEY - data - BLOB Args: connection: The connection to the database
625941c4cdde0d52a9e5300a
def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self._device = BtrfsDevice() <NEW_LINE> try: <NEW_LINE> <INDENT> self._mount = Mount(self._device.device()) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> self._device.destroy() <NEW_LINE> raise
Create a btrfs device and mount it ready for use.
625941c4851cf427c661a4e9
def __add_pre_defined_blocks( self, rect: Rect, matrix: List[List] ) -> None: <NEW_LINE> <INDENT> for row_i in range(int(rect.height / con.BLOCK_SIZE.height)): <NEW_LINE> <INDENT> for col_i in range(int(rect.width / con.BLOCK_SIZE.width)): <NEW_LINE> <INDENT> block_x_coord = int(rect.left / con.BLOCK_SIZE.width) + col_...
Get all predefined blocks in a rectangle and add them to matrix
625941c48a349b6b435e814c
@pytest.mark.skipif("not os.isatty(sys.__stdout__.fileno())", reason="not on tty") <NEW_LINE> def test_stty_match(monkeypatch): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> process = subprocess.Popen(["stty", "size"], stdout=subprocess.PIPE) <NEW_LINE> output, err = process.communicate() <NEW_LINE> if process.poll() !=...
Check if stty returns the same results ignoring env This test will fail if stdin and stdout are connected to different terminals with different sizes. Nevertheless, such situations should be pretty rare.
625941c45510c4643540f3c1
def vds(xyz): <NEW_LINE> <INDENT> R=0 <NEW_LINE> cart=xyz.transpose() <NEW_LINE> for i in range(xyz.shape[1]-1): <NEW_LINE> <INDENT> diff=[cart[i][0]-cart[i+1][0],cart[i][1]-cart[i+1][1],cart[i][2]-cart[i+1][2]] <NEW_LINE> dirdiff=pmag.cart2dir(diff) <NEW_LINE> R+=dirdiff[2] <NEW_LINE> <DEDENT> return R
calculate vector difference sum Paramters _________ xyz : Returns ________ R :
625941c4460517430c394162
def MoveL(self, pose, joints, conf_RLF=None): <NEW_LINE> <INDENT> if pose is None: <NEW_LINE> <INDENT> self.addline('G1 ' + self.joints_2_str(joints) + ' F%.1f' % self.SPEED_MM_MIN) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.addline('G1 ' + self.pose_2_str(pose, True) + ' F%.1f' % self.SPEED_MM_MIN)
Add a linear movement
625941c423e79379d52ee53e
def drawstates(self,linewidth=0.5,color='k',antialiased=1,ax=None,zorder=None): <NEW_LINE> <INDENT> if self.resolution is None: <NEW_LINE> <INDENT> raise AttributeError('there are no boundary datasets associated with this Basemap instance') <NEW_LINE> <DEDENT> if not hasattr(self,'statesegs'): <NEW_LINE> <INDENT> self....
Draw state boundaries in Americas. .. tabularcolumns:: |l|L| ============== ==================================================== Keyword Description ============== ==================================================== linewidth state boundary line width (default 0.5) color state boundary...
625941c431939e2706e4ce45
def factorial(n): <NEW_LINE> <INDENT> pass
Computes factorial of n. :param n: non-negative integer :return: n!
625941c47b180e01f3dc47d9
def gpb_from_func_caller(func_caller, worker_manager, max_capital, mode=None, acq=None, options=None, gp_args=None, reporter='default'): <NEW_LINE> <INDENT> if options is None: <NEW_LINE> <INDENT> reporter = get_reporter(reporter) <NEW_LINE> options = load_options(get_all_gp_bandit_args_from_gp_args(gp_args), reporter=...
GP Bandit optimisation from a utils.function_caller.FunctionCaller instance.
625941c415baa723493c3f4d
def check_land_use_period(self, indexstr, ustr): <NEW_LINE> <INDENT> ret = None <NEW_LINE> return ret
土地使用年限
625941c4a4f1c619b28b0016
def test_can_handle_frames_with_invalid_padding(self, frame_factory): <NEW_LINE> <INDENT> c = h2.connection.H2Connection(client_side=False) <NEW_LINE> c.initiate_connection() <NEW_LINE> c.receive_data(frame_factory.preamble()) <NEW_LINE> f = frame_factory.build_headers_frame(self.example_request_headers) <NEW_LINE> c.r...
Frames with invalid padding cause connection teardown.
625941c4ad47b63b2c509f58
def set_points(self, points: Sequence[Sequence[float]]): <NEW_LINE> <INDENT> self._points = points
Set a sprite's position
625941c4c432627299f04c1d
def __init__(self): <NEW_LINE> <INDENT> self.InstanceId = None <NEW_LINE> self.Offset = None <NEW_LINE> self.Limit = None
:param InstanceId: 实例 ID,格式如:cdb-c1nl9rpv。与云数据库控制台页面中显示的实例 ID 相同。 :type InstanceId: str :param Offset: 偏移量,最小值为0。 :type Offset: int :param Limit: 分页大小,默认值为20,最小值为1,最大值为100。 :type Limit: int
625941c41f5feb6acb0c4b2b
def change_levels(self,levels): <NEW_LINE> <INDENT> pass
Adjust intensity of pixels
625941c4aad79263cf390a17
def setWiFi(self, value): <NEW_LINE> <INDENT> self.port.flushInput() <NEW_LINE> self.port.flushOutput() <NEW_LINE> self.port.write("setUserSettings Wifi " + value + "\n") <NEW_LINE> self.readResponseString()
Turn WiFi on/off.
625941c4656771135c3eb845
def pointInCamera1Image(point3D, sensor_width, sensor_height, focal_length, pixel_size, cameracentre=np.array([0, 0, 0])): <NEW_LINE> <INDENT> w, h = sensor_width, sensor_height <NEW_LINE> f = focal_length <NEW_LINE> TL = np.array([-w / 2, h / 2, f]) <NEW_LINE> TR = np.array([w / 2, h / 2, f]) <NEW_LINE> BR = np.array(...
Can camera 1 (at the origin of the coordinate system) see the 3D point in space? Return True/False and the x,y pixel coordinates of the image.
625941c476e4537e8c35164a
def check_encrypted(self): <NEW_LINE> <INDENT> encrypted = Indicator('encrypted', False, name='Encrypted') <NEW_LINE> self.indicators.append(encrypted) <NEW_LINE> if not self.ole: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> encrypted.value = crypto.is_encrypted(self.ole) <NEW_LINE> return encrypted
Check whether this file is encrypted. Might call check_properties. :returns: :py:class:`Indicator` for encryption or None if file was not opened
625941c482261d6c526ab476
def userData(update: Update, context: CallbackContext) -> None: <NEW_LINE> <INDENT> details = [i.strip() for i in update.message.text.split('\n')] <NEW_LINE> username = details[0] <NEW_LINE> type_ = 'ANIME' <NEW_LINE> title = 'english' <NEW_LINE> if len(details) == 3: <NEW_LINE> <INDENT> if details[2].lower() in ['engl...
Using provided details for fetching userData.
625941c44d74a7450ccd419c
def processNextInformation () : <NEW_LINE> <INDENT> data = readFromPipe() <NEW_LINE> return (data['playerLocation'], data['opponentLocation'], data['coins'], data['gameIsOver'])
We read from the pipe
625941c40fa83653e4656f95
def t_ISBN(self,t): <NEW_LINE> <INDENT> return t
([0-9]{2}\-[0-9]{2}\-[0-9A-Fa-f]{5}\-[A-Za-z0-9])
625941c424f1403a92600b41
def start(self): <NEW_LINE> <INDENT> return _lilacsat_swig.encode27_bb_sptr_start(self)
start(encode27_bb_sptr self) -> bool
625941c4cc40096d6159592a
def get_sf_prefilter_btpaths_by_solution(db, db_solution): <NEW_LINE> <INDENT> return (db.session.query(SfPrefilterBacktracePath) .filter(SfPrefilterBacktracePath.solution == db_solution) .all())
Return a list of pyfaf.storage.SfPrefilterBacktracePath objects with the given pyfaf.storage.SfPrefilterSolution or None if not found.
625941c48e71fb1e9831d783
def delete_groupnet_subnet(self, groupnet_subnet_id, groupnet, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.delete_groupnet_subnet_with_http_info(groupnet_subnet_id, groupnet, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
delete_groupnet_subnet # noqa: E501 Delete a network subnet. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.delete_groupnet_subnet(groupnet_subnet_id, groupnet, async_req=True) >>> result = thread.get() :param a...
625941c467a9b606de4a7e94
def followed_vs_desired(foll,des): <NEW_LINE> <INDENT> x_act,y_act,z_act=foll <NEW_LINE> x_ref,y_ref,z_ref=des <NEW_LINE> fig = plt.figure(4) <NEW_LINE> ax = Axes3D(fig) <NEW_LINE> ax = fig.add_subplot(111, projection='3d') <NEW_LINE> ax.plot(x_act , y_act , z_act , label='actuated') <NEW_LINE> ax.plot(x_ref , y_ref , ...
per confrontare effettivamente attuati vs desiderati solo per posizione foll,des liste [[],[],[]]
625941c45fc7496912cc3957
def checkpoint(self): <NEW_LINE> <INDENT> logger.debug("SessionManager.checkpoint()") <NEW_LINE> data = SessionSuspendHelper().suspend(self.state) <NEW_LINE> logger.debug( "Saving %d bytes of checkpoint data to %r", len(data), self.storage.location) <NEW_LINE> try: <NEW_LINE> <INDENT> self.storage.save_checkpoint(data)...
Create a checkpoint of the session. After calling this method you can later reopen the same session with :meth:`SessionManager.open_session()`.
625941c4507cdc57c6306cb0
def generate_account_id(self) -> int: <NEW_LINE> <INDENT> length = 10 <NEW_LINE> accountId = "" <NEW_LINE> for i in range(length): <NEW_LINE> <INDENT> accountId += str(randint(0,9)) <NEW_LINE> <DEDENT> self.check_account_id(int(accountId)) <NEW_LINE> return int(accountId)
Generate a 10 digit random number
625941c496565a6dacc8f6a5
def convert(self, rawDate): <NEW_LINE> <INDENT> clearDate = rawDate.replace(" ","") <NEW_LINE> format = "" <NEW_LINE> if self.isFullDate(): <NEW_LINE> <INDENT> if self.__isISOOrdered: <NEW_LINE> <INDENT> format = "%Y" + self.__dateSeparator + "%m" + self.__dateSeparator + "%d" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE...
Convert to ISO date
625941c48e05c05ec3eea34c
def add_file(self, filename): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> f = open(filename) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise STDERRFileDoesNotExistError( ('Unable to open file (%s). Assume this is because run failed. Will' ' raise exception to kill run now.' % filename)) <NEW_LINE> <DEDENT> data ...
Given STDERR filename for ONE run with a given thread count, add data. Args: filename: (string) Name of file to be parsed. Raises: STDERRFileDoesNotExistError:
625941c4d164cc6175782d27
def finish_initializing(self, builder): <NEW_LINE> <INDENT> self.builder = builder <NEW_LINE> self.ui = builder.get_ui(self, True)
Called while initializing this instance in __new__ finish_initalizing should be called after parsing the ui definition and creating a PreferencesDialog object with it in order to finish initializing the start of the new PerferencesKennyDialog instance. Put your initialization code in here and leave __init__ undefined...
625941c4f8510a7c17cf96d4
def plot(data,names,labels, reduce_by_PCA=True,force_2D=False): <NEW_LINE> <INDENT> if data.shape[1] == 2: <NEW_LINE> <INDENT> plot_2D(data,names,labels, reduce_by_PCA) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not force_2D: <NEW_LINE> <INDENT> plot_3D(data,names,labels, reduce_by_PCA) <NEW_LINE> <DEDENT> else: ...
Plots the data dividing it in clusters and puting a name on each instance. Parameters: data: array of flaots [n_samples,3] Data containing the points to be ploted in 3D or 2D, the 3D version beeing prefered. If the data is not in 3D or 2D it is possibl to reduce it by PCA to be possible the visu...
625941c494891a1f4081ba81