code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def build_input_file(s3_location, input_file_location='s3://pv.insight.misc/report_files/'): <NEW_LINE> <INDENT> site_list, size_list = enumerate_files(s3_location, file_size_list=True) <NEW_LINE> site_df = pd.DataFrame() <NEW_LINE> site_df['site'] = site_list <NEW_LINE> site_df['site'] = site_df['site'].apply(lambda x...
Builds a csv input file by looking at the contents of the s3 bucket containing csv files with signals. :param s3_location: aws s3 bucket location of csv files containing signals :param input_file_location: s3 bucket location of report files :return: DataFrame with signals in a given folder
625941c910dbd63aa1bd2c2a
def eye_voltage2gaze(raw, ranges=(-5, 5), screen_x=(0, 1920), screen_y=(0, 1080), ch_mapping={'x': 'UADC002-3705', 'y': 'UADC003-3705', 'p': 'UADC004-3705'}): <NEW_LINE> <INDENT> minvoltage, maxvoltage = ranges <NEW_LINE> maxrange, minrange = 1., 0. <NEW_LINE> screenright, screenleft = screen_x <NEW_LINE> screenbottom,...
Convert analog output of EyeLink 1000+ to gaze coordinates.
625941c931939e2706e4cef2
def modify(select=None, command=None, subtype=None, process="preceding", visibility=True, outlinetitle=None, outlinetitlestart=None, outlinetitleregexp=None, outlinetitleend=None, itemtitle=None, itemtitlestart=None, itemtitleregexp=None, itemtitleend=None, repoutlinetitle=None, repitemtitle=None, repoutlinetitleregexp...
Execute SPSSINC MODIFY OUTPUT command. See SPSSINC_MODIFY_OUTPUT.py for argument definitions.
625941c90a366e3fb873e8a0
def dispersion_relation_ordinary(kx, ky, k, nO): <NEW_LINE> <INDENT> if kx.shape != ky.shape: <NEW_LINE> <INDENT> raise ValueError("kx and ky must have the same length") <NEW_LINE> <DEDENT> delta = (k * nO) ** 2 - (kx ** 2 + ky ** 2) <NEW_LINE> kz = S.sqrt(delta) <NEW_LINE> kz.real = abs(kz.real) <NEW_LINE> kz.imag = -...
Dispersion relation for the ordinary wave. NOTE See eq. 15 in Glytsis, "Three-dimensional (vector) rigorous coupled-wave analysis of anisotropic grating diffraction", JOSA A, 7(8), 1990 Always give positive real or negative imaginary.
625941c9851cf427c661a596
def max_col_num(li, max_width): <NEW_LINE> <INDENT> w = sum(li) <NEW_LINE> num = max_width/w <NEW_LINE> if num == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> return num
Calculates the total number of columns for multi_col option in LabeledColumn.
625941c91d351010ab855ba2
def __init__(self, case, nick, **kwargs): <NEW_LINE> <INDENT> if nick is None: <NEW_LINE> <INDENT> raise ValueError("nick may not be None") <NEW_LINE> <DEDENT> self.nick = nick <NEW_LINE> self.username = kwargs.get("username", None) <NEW_LINE> self.host = kwargs.get("host", None) <NEW_LINE> self.gecos = kwargs.get("gec...
Store the data for a user. Unknown values are stored as None, whereas empty ones are stored as '' or 0, so take care in comparisons involving values from this class. Arguments: :param nick: Nickname of the user, not casemapped. :param case: Casemapping to use for channels member. :key username: Usernam...
625941c96e29344779a62699
def test_load_default_config(self): <NEW_LINE> <INDENT> expected_defaults = { 'casefiles_dir': os.getcwd() + '/casefiles', 'casefiles_entry_point': 'deputy.casefiles', } <NEW_LINE> settings = config.load_config() <NEW_LINE> self.assertEqual(expected_defaults, settings)
Test that the default config loads properly.
625941c95fc7496912cc3a04
def update_positions (self, *args, **kw): <NEW_LINE> <INDENT> for canvas_id, coords in self.objects.items(): <NEW_LINE> <INDENT> _new = [] <NEW_LINE> for i in range(0, len(coords), 2): <NEW_LINE> <INDENT> _new.append(self.canvas.canvasx(coords[i])) <NEW_LINE> _new.append(self.canvas.canvasy(coords[i + 1])) <NEW_LINE> <...
generic event handler; updates positions of all registered canvas items;
625941c98c0ade5d55d3ea41
def from_cfgfile(self, filename, sections=[]): <NEW_LINE> <INDENT> config = ConfigParser.ConfigParser() <NEW_LINE> if isinstance(filename, file): <NEW_LINE> <INDENT> config.readfp(filename) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> config.read(filename) <NEW_LINE> <DEDENT> if sections == []: <NEW_LINE> <INDENT> sec...
reads a config.cfg file and parses it using the ConfigParser module, adds each section as a key to the configuration dict and any subsequent items as key values to a an imbdeded default dict
625941c9566aa707497f45f0
def __getattr__(self, name): <NEW_LINE> <INDENT> if name.startswith("__"): <NEW_LINE> <INDENT> raise AttributeError("No such attribute '%s'" % name) <NEW_LINE> <DEDENT> if name not in self.__handlerCache: <NEW_LINE> <INDENT> def handler(**kwargs): <NEW_LINE> <INDENT> return self.__makerequest(name, **kwargs) <NEW_LINE>...
Handle all FogBugz API calls. Example:: fb.logon(email@example.com, password) response = fb.search(q="assignedto:email")
625941c9f9cc0f698b140683
def load_data(location, output_name): <NEW_LINE> <INDENT> df = pd.read_excel(location, sheet_name=0, header=0) <NEW_LINE> features = list(df.columns) <NEW_LINE> features.remove(output_name) <NEW_LINE> x = df[features].values <NEW_LINE> y = df[output_name].values <NEW_LINE> return x, y
function to load data into a pandas data frame Parameters ---------- location : str the location of the tabular data to be loaded output_name : str the name of the output column Returns ------- x: numpy ndarray the data training feature y: numpy ndarray the data taget column
625941c9435de62698dfdcd3
def g_consensus_fa_of_cluster(self, cid): <NEW_LINE> <INDENT> return op.join(self.cluster_dir(cid), "g_consensus.fa")
Return $cluster_dir(cid)/g_consensus.fa. Whenever this is changed, the ice_pbdagcon.py command needs to be changed accordingly.
625941c94f88993c3716c0ee
def test_issue_248(self): <NEW_LINE> <INDENT> graph = rdflib.Graph() <NEW_LINE> DC = rdflib.Namespace("http://purl.org/dc/terms/") <NEW_LINE> SKOS = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") <NEW_LINE> LCCO = rdflib.Namespace("http://loc.gov/catdir/cpso/lcco/") <NEW_LINE> graph.bind("dc", DC) <NEW_LINE> ...
Ed Summers Thu, 24 May 2007 12:21:17 -0700 As discussed with eikeon in #redfoot it appears that the n3 serializer is ignoring the base option to Graph.serialize...example follows: -- #!/usr/bin/env python from rdflib.Graph import Graph from rdflib.URIRef import URIRef from rdflib import Literal, Namespace, RDF gra...
625941c97d847024c06be341
def load(self, filename=None, **kwargs): <NEW_LINE> <INDENT> super(TOMLSettings, self).load(toml, _dict=self._dict, **kwargs)
Load this dict from a TOML file. Raises the same errors as open() and toml.load().
625941c957b8e32f52483521
def null_empty_field(value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if value[0:2] == '@@' and value[-2:] == '@@': <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> <DEDENT> except: <NEW_LINE> <INDENT> return value
Nullify 'empty' field, defined by leading and trailing @@
625941c9aad79263cf390ac7
def _distance(self, data1, data2): <NEW_LINE> <INDENT> if self.p == 1: <NEW_LINE> <INDENT> return sum(abs(data1 - data2)) <NEW_LINE> <DEDENT> elif self.p == 2: <NEW_LINE> <INDENT> return np.sqrt(sum((data1 - data2)**2)) <NEW_LINE> <DEDENT> raise ValueError("p not recognized: should be 1 or 2")
1: Manhattan, 2: Euclidean
625941c926068e7796caed64
def isGoodResult(name, show, log=True, season=-1): <NEW_LINE> <INDENT> all_show_names = allPossibleShowNames(show, season=season) <NEW_LINE> showNames = map(sanitizeSceneName, all_show_names) + all_show_names <NEW_LINE> for curName in set(showNames): <NEW_LINE> <INDENT> if not show.is_anime: <NEW_LINE> <INDENT> escaped...
Use an automatically-created regex to make sure the result actually is the show it claims to be
625941c94e4d5625662d445f
def slugify(value): <NEW_LINE> <INDENT> import unicodedata <NEW_LINE> v=value <NEW_LINE> value = unicodedata.normalize('NFKD', unicode(value)).encode('ascii', 'ignore') <NEW_LINE> value = unicode(re.sub('[^\w\s-]', '', value).strip().lower()) <NEW_LINE> value = re.sub('[-\s]+', '-', value) <NEW_LINE> value = mark_safe(...
Normalizes string, converts to lowercase, removes non-alpha characters, and converts spaces to hyphens.
625941c9ab23a570cc250209
def _add_resource_url_rules(self, resource, settings): <NEW_LINE> <INDENT> url = '%s/%s' % (self.api_prefix, settings['url']) <NEW_LINE> self.config['URLS'][resource] = settings['url'] <NEW_LINE> self.config['SOURCES'][resource] = settings['datasource'] <NEW_LINE> endpoint = resource + "|resource" <NEW_LINE> self.add_u...
Builds the API url map for one resource. Methods are enabled for each mapped endpoint, as configured in the settings. .. versionadded:: 0.2
625941c9cc0a2c11143dcf17
def simplifyArxiv(cite): <NEW_LINE> <INDENT> if 'journal' in cite and cite['journal'].lower() == 'arxiv': <NEW_LINE> <INDENT> cite = filterByKeys(cite, ['author', 'arxivid', 'title', 'year', 'archiveprefix'], []) <NEW_LINE> cite['journal'] = cite['archiveprefix'] + ":" + cite['arxivid'] <NEW_LINE> cite.pop('arxivid'...
for arxiv
625941c950812a4eaa59c3a9
def last(array): <NEW_LINE> <INDENT> return base_get(array, -1, default=None)
Return the last element of `array`. Args: array (list): List to process. Returns: mixed: Last part of `array`. Example: >>> last([1, 2, 3, 4]) 4 .. versionadded:: 1.0.0
625941c963f4b57ef00011a2
def game_state(self, message=''): <NEW_LINE> <INDENT> state = GameStateForm() <NEW_LINE> state.urlsafe_game_key = self.key.urlsafe() <NEW_LINE> state.user_name = self.user.get().user_name <NEW_LINE> state.misses_remaining = self.misses_remaining <NEW_LINE> state.message = message <NEW_LINE> state.current_solution = lis...
Returns the state of a game
625941c9379a373c97cfabcb
def __init__(self, cb=None): <NEW_LINE> <INDENT> super(SetPaddingCallback, self).__init__() <NEW_LINE> self.padding_cb = cb
Set the padding callback
625941c90383005118ecf66a
def validate_connection_status(value): <NEW_LINE> <INDENT> if value.lower() not in ['planned', 'connected']: <NEW_LINE> <INDENT> raise ValidationError('Invalid connection status ({}); must be either "planned" or "connected".'.format(value))
Custom validator for connection statuses. value must be either "planned" or "connected" (case-insensitive).
625941c97b25080760e394e0
def get_stadium(tree): <NEW_LINE> <INDENT> stadium = tree.find(".//stadium") <NEW_LINE> if stadium is None: <NEW_LINE> <INDENT> raise Exception("Did not find a stadium.") <NEW_LINE> <DEDENT> valid_keys = ("id", "name", "location") <NEW_LINE> return {k: v for k, v in stadium.attrib.items() if k in valid_keys}
Parse game.xml data to find the stadium.
625941c9004d5f362079a3ba
def open_port(self, port, interface=None, subnet=None): <NEW_LINE> <INDENT> args = { 'port': port, 'interface': interface, 'subnet': subnet, } <NEW_LINE> self._port_chk.check(args) <NEW_LINE> return self._client.json('nft.open_port', args)
open port :param port: then port number :param interface: an optional interface to open the port for :param subnet: an optional subnet to open the port for
625941c945492302aab5e34a
def get_global_options(lang: str, comp: T.Type[Compiler], for_machine: MachineChoice, is_cross: bool, properties: Properties) -> T.Dict[str, coredata.UserOption]: <NEW_LINE> <INDENT> description = 'Extra arguments passed to the {}'.format(lang) <NEW_LINE> opts = { lang + '_args': coredata.UserArrayOption( description +...
Retreive options that apply to all compilers for a given language.
625941c9460517430c39420e
def test_update(self) -> None: <NEW_LINE> <INDENT> with tempfile.TemporaryDirectory(".") as directory: <NEW_LINE> <INDENT> path = os.path.join(directory, "tmp.cache") <NEW_LINE> with FileCacheSource(FileSource.from_path("tests/embedding/syntax.pyhp", compiler), path) as source: <NEW_LINE> <INDENT> with self.assertRaise...
test FileCacheSource.update error handling
625941c9ec188e330fd5a827
def find_file (self, name, suffix=None): <NEW_LINE> <INDENT> for path in self.path: <NEW_LINE> <INDENT> test = os.path.join(path, name) <NEW_LINE> if suffix and os.path.exists(test + suffix) and os.path.isfile(test + suffix): <NEW_LINE> <INDENT> return test + suffix <NEW_LINE> <DEDENT> elif os.path.exists(test) and os....
Look for a source file with the given name, and return either the complete path to the actual file or None if the file is not found. The optional argument is a suffix that may be added to the name.
625941c901c39578d7e74ec2
def _parse_enums(self, node): <NEW_LINE> <INDENT> attributes = self._convert_node_attributes(node, int_attributes=('start', 'stop'), renaming={'type': 'type_'}) <NEW_LINE> enums = Enums(**attributes) <NEW_LINE> self.enums_list.append(enums) <NEW_LINE> for enum_node in node: <NEW_LINE> <INDENT> if enum_node.tag == 'enum...
Parse ``<enums>`` tags.
625941c99c8ee82313fbb7fc
def __init__(self, image): <NEW_LINE> <INDENT> r = "\"%s\"" % image <NEW_LINE> g = 'gimp' <NEW_LINE> i = '-i' <NEW_LINE> b = '-b' <NEW_LINE> s = 'elsamuko-lomo-batch' <NEW_LINE> p = '1.5 10 10 0.8 0 0 0 0 0 FALSE FALSE TRUE FALSE 0 0 115' <NEW_LINE> q = 'gimp-quit 0' <NEW_LINE> self.cmd = "%s %s %s '(%s %s %s)' %s '(%s...
Load Gimp batch command
625941c9ac7a0e7691ed4155
def sample(self, features, max_length=30): <NEW_LINE> <INDENT> N = features.shape[0] <NEW_LINE> captions = self._null * np.ones((N, max_length), dtype=np.int32) <NEW_LINE> W_proj, b_proj = self.params['W_proj'], self.params['b_proj'] <NEW_LINE> W_embed = self.params['W_embed'] <NEW_LINE> Wx, Wh, b = self.params['Wx'], ...
Run a test-time forward pass for the model, sampling captions for input feature vectors. At each timestep, we embed the current word, pass it and the previous hidden state to the RNN to get the next hidden state, use the hidden state to get scores for all vocab words, and choose the word with the highest score as the ...
625941c94c3428357757c3af
def __init__( self, *, value: Optional[List["MaintenanceConfiguration"]] = None, **kwargs ): <NEW_LINE> <INDENT> super(MaintenanceConfigurationListResult, self).__init__(**kwargs) <NEW_LINE> self.value = value <NEW_LINE> self.next_link = None
:keyword value: The list of maintenance configurations. :paramtype value: list[~azure.mgmt.containerservice.v2021_09_01.models.MaintenanceConfiguration]
625941c98a349b6b435e81fa
def load(self, west, north, east, south): <NEW_LINE> <INDENT> url = config.osm_api_url + "/api/0.6/map?bbox=${west},${north},${east},${south}" <NEW_LINE> request = Template(url) <NEW_LINE> request = request.substitute(west=west, north=north, east=east, south=south) <NEW_LINE> result = requests.get(request, headers=self...
This function loads all node elements from a given bounding box. The function returns all nodes loaded with this object so far. Args: west (float): longitude of the bounding box in degree north (float): latitude of the bounding box in degree east (float): longitude of the bounding box in degree south (...
625941c93eb6a72ae02ec562
def calculate(self, points, timewindow, meta=None): <NEW_LINE> <INDENT> result = [] <NEW_LINE> if self.round_time: <NEW_LINE> <INDENT> period = self._get_period(timewindow) <NEW_LINE> round_starttimestamp = period.round_timestamp( timestamp=timewindow.start(), normalize=True ) <NEW_LINE> timewindow = timewindow.reduce(...
Do an operation on all points with input timewindow. Return points su as follow: Let fn self aggregation function and input points of the form: [(T0, V0), ..., (Tn, Vn)] then the result is [(T0, fn(V0, V1)), (T2, fn(V2, V3), ...].
625941c9f8510a7c17cf9783
def p_literal_list(p): <NEW_LINE> <INDENT> if len(p) > 2: <NEW_LINE> <INDENT> p[0] = p[3] <NEW_LINE> p[0].append(p[1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = [p[1]] if p[1] else []
literal_list : empty | literal | literal ',' literal_list
625941c9b7558d58953c4f9d
def get_label(self, field_name): <NEW_LINE> <INDENT> return self.size._meta.get_field(field_name).verbose_name
Method to extract verbose name from field name
625941c95f7d997b87174b1e
def angle_to_coord(self, angle): <NEW_LINE> <INDENT> x_pos = self.hand_radius * math.sin(math.radians(angle)) <NEW_LINE> y_pos = self.hand_radius * math.cos(math.radians(angle)) <NEW_LINE> return x_pos, y_pos
determines x, y position for a given angle
625941c98e71fb1e9831d831
def _submitInstance( self, imageName, workDir, endpoint ): <NEW_LINE> <INDENT> endpointsPath = "/Resources/VirtualMachines/CloudEndpoints" <NEW_LINE> driver = gConfig.getValue( "%s/%s/%s" % ( endpointsPath, endpoint, 'driver' ), "" ) <NEW_LINE> if driver == 'Amazon': <NEW_LINE> <INDENT> ami = AmazonImage( imageName, en...
Real backend method to submit a new Instance of a given Image It has the decision logic of sumbission to the multi-endpoint, from the available from a given imageName, first approach: FirstFit It checks wether are free slots by requesting status of sended VM to a cloud endpoint
625941c950812a4eaa59c3aa
def __getitem__(self, name): <NEW_LINE> <INDENT> return self.asElement()[name]
Equivalent to :meth:`asElement().__getitem__()<Element.__getitem__()>`.
625941c991f36d47f21ac579
def set_listitems(self,listitems): <NEW_LINE> <INDENT> FullScreenWrapper2App.set_list_contents(self.view_id, listitems)
sets a list for a ListView. Takes a list of str as input
625941c9d99f1b3c44c67617
def next(self): <NEW_LINE> <INDENT> self.y += 1 <NEW_LINE> return self.m[self.x][self.y - 1]
:rtype: int
625941c91d351010ab855ba3
def do_post(self, url, kwargs): <NEW_LINE> <INDENT> data = json.dumps(kwargs) <NEW_LINE> res = self.session.post( '%s%s' % (self.url, url), data=data, timeout=self.get_timeout('POST'), **self._req_params ) <NEW_LINE> return self._process_request_result(res)
:param url: relative url to resource :param kwargs: parameters for the api call
625941c9167d2b6e31218c1d
def _register(self): <NEW_LINE> <INDENT> self.__log.call() <NEW_LINE> gn_queries = ET.fromstring(self.REGISTER_XML) <NEW_LINE> gn_queries.find("QUERY/CLIENT").text = self._client_id <NEW_LINE> gn_responses = self._get_response(gn_queries) <NEW_LINE> user = gn_responses.find("RESPONSE/USER") <NEW_LINE> self._user_id = u...
Register this client with the Gracenote Web API.
625941c9099cdd3c635f0ce2
def cleanup_version(version): <NEW_LINE> <INDENT> for w in WRONG_IN_VERSION: <NEW_LINE> <INDENT> if version.find(w) != -1: <NEW_LINE> <INDENT> logger.debug("Version indicates development: %s.", version) <NEW_LINE> version = version[:version.find(w)].strip() <NEW_LINE> logger.debug("Removing debug indicators: %r", versi...
Check if the version looks like a development version.
625941c98a43f66fc4b540ed
def test_createNote(): <NEW_LINE> <INDENT> title = "abc" <NEW_LINE> note_content = "Testing" <NEW_LINE> note.createNote(title, note_content) <NEW_LINE> if os.path.exists(note_directory + "\\note.json"): <NEW_LINE> <INDENT> result = json.load(open(note_directory + '\\note.json')) <NEW_LINE> return result <NEW_LINE> <DED...
This function is a unit test of the createNote function. return: :return: the result after running the createNote function.
625941c9a219f33f346289f2
def __init__(self, size=1000): <NEW_LINE> <INDENT> self.memory = deque(maxlen=size) <NEW_LINE> self.experience = namedtuple("Experience", field_names=["state", "action", "reward", "next_state", "done"])
Initialize a ReplayBuffer object.
625941c966673b3332b92118
def searchAsync( self, base="", scope=ldap.SCOPE_BASE, filter="(objectClass=*)", attrList=None, attrsonly=0, sizelimit=0, identStr="" ): <NEW_LINE> <INDENT> searchWorker = SearchWorker( self.lumaConnection, base, scope, filter, attrList, attrsonly, sizelimit, identStr ) <NEW_LINE> searchWorker.workDone.connect(self.sea...
Non-blocking. Listen to LumaConnectionWrapper.searchFinished for the result. Only use the exception passed if ``success`` is False.
625941c967a9b606de4a7f42
def test_new_placeholder_sp_generates_correct_xml(self): <NEW_LINE> <INDENT> expected_xml_tmpl = ( '<p:sp %s>\n <p:nvSpPr>\n <p:cNvPr id="%s" name="%s"/>\n <' 'p:cNvSpPr>\n <a:spLocks noGrp="1"/>\n </p:cNvSpPr>\n ' '<p:nvPr>\n <p:ph%s/>\n </p:nvPr>\n </p:nvSpPr>\n <p:sp' 'Pr/>\n%s</p:sp>\n' ...
CT_Shape._new_placeholder_sp() returns correct XML
625941c93c8af77a43ae3827
def IsValid( self, value ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.__validateValue(value) <NEW_LINE> return True <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return False
Can be used to determine if a given value would be a legal and in-bounds value for the control.
625941c9cdde0d52a9e530ba
def post(self, request): <NEW_LINE> <INDENT> response_data = {'retCode': error_constants.ERR_STATUS_SUCCESS[0], 'retMsg': error_constants.ERR_STATUS_SUCCESS[1]} <NEW_LINE> try: <NEW_LINE> <INDENT> user = request.POST.get('user', 0) <NEW_LINE> day = request.POST.get('day', 0) <NEW_LINE> reason = request.POST.get('reason...
请假申请 --- parameters: - name: token description: 当前用户token required: true type: string paramType: header - name: user description: 请假人名称 required: true type: string paramType: query - name: day description: 请假天数 required: true type: integer ...
625941c9a219f33f346289f3
def get_descriptions(config, exam_lex, lexer): <NEW_LINE> <INDENT> if config.BOOLEAN_STATES[config.config.get('Layout', 'command_description')]: <NEW_LINE> <INDENT> if config.BOOLEAN_STATES[config.config.get('Layout', 'param_description')]: <NEW_LINE> <INDENT> return VSplit([ get_descript(exam_lex), get_vline(), get_pa...
based on the configuration settings determines which windows to include
625941c98a349b6b435e81fb
def printInitialConditionsData(self): <NEW_LINE> <INDENT> if self.postProcessed is False: <NEW_LINE> <INDENT> self.postProcess() <NEW_LINE> <DEDENT> print( "Position - x: {:.2f} m | y: {:.2f} m | z: {:.2f} m".format( self.x(0), self.y(0), self.z(0) ) ) <NEW_LINE> print( "Velocity - Vx: {:.2f} m/s | Vy: {:.2f} m/s | Vz:...
Prints all initial conditions data available about the flight Parameters ---------- None Return ------ None
625941c94e696a04525c94d3
def getMin(self): <NEW_LINE> <INDENT> return self.__minElement
minimum element of stack
625941c9498bea3a759b9b37
def emptyPrinter(self, expr): <NEW_LINE> <INDENT> return render_head_repr(expr, sub_render=self.doprint)
Fallback printer
625941c98e05c05ec3eea3fc
def verify_password(self, password): <NEW_LINE> <INDENT> return check_password_hash(self.password_hash, password)
Check if hashed password matches actual password Verifying of password and hashed value matching Args: password:the plaintext password to compare against the hash Returns: Return `True` if the password matched, `False` otherwise.
625941c9e5267d203edcdd26
def open_utf8(fileName, mode): <NEW_LINE> <INDENT> return codecs_open(fileName, mode, encoding='utf-8')
Open all files in UTF-8
625941c938b623060ff0ae75
def calc_resampled_richness(aa, samplefracs, thresholds): <NEW_LINE> <INDENT> assert aa.shape[1] == 2 <NEW_LINE> matrix = np.zeros((len(samplefracs), len(thresholds))) <NEW_LINE> for i, frac in enumerate(samplefracs): <NEW_LINE> <INDENT> for j, threshold in enumerate(thresholds): <NEW_LINE> <INDENT> dummy = rich(aa, fr...
calculate 2D array, like calc_resampled_richness, of calculated subsampled richness for each fraction in samplefracs and each threshold in thresholds. Returns 2d matrix sith shape = len(samplefracs), len(thresholds) aa must be 2d ndarray
625941c956ac1b37e6264258
def _get_subelements(self, node): <NEW_LINE> <INDENT> items = node.find('rdf:Alt', self.NS) <NEW_LINE> if items is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return items[0].text <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> <DEDENT> for xmlcontainer, container, in...
Gather the sub-elements attached to a node Gather rdf:Bag and and rdf:Seq into set and list respectively. For alternate languages values, take the first language only for simplicity.
625941c9dd821e528d63b231
def cos_term(x, i): <NEW_LINE> <INDENT> n = 2*i <NEW_LINE> return alternate(i, exp_term(x, n))
Term Of The Series For cos(x).
625941c9091ae35668666fe7
def run(self): <NEW_LINE> <INDENT> if self.xsdir is not None: <NEW_LINE> <INDENT> path = self.other_dir if self.code == 'serpent' else None <NEW_LINE> create_library(self.xsdir, self.table_names, self.openmc_dir, path) <NEW_LINE> nuclide = self.nuclides[0][0] <NEW_LINE> f = h5py.File(self.openmc_dir / (nuclide + '.h5')...
Generate inputs, run problem, and plot results.
625941c9187af65679ca51a6
def threshold_ims(self,ims,thresh_value): <NEW_LINE> <INDENT> thresh_ims = np.zeros((ims.shape)) <NEW_LINE> for i in range(len(ims)): <NEW_LINE> <INDENT> thresh_ims[i] = ims[i]>thresh_value <NEW_LINE> plt.figure() <NEW_LINE> plt.hist(ims[i].ravel()) <NEW_LINE> <DEDENT> return thresh_ims
Threshold image to extract overtext thresh_value - normalized brightness value
625941c98a43f66fc4b540ee
def __str__(self): <NEW_LINE> <INDENT> if self.area() == 0: <NEW_LINE> <INDENT> return "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rect_list = [("%s" % ("#") * self.width) for i in range(self.height)] <NEW_LINE> return "\n".join(rect_list)
format rectangle for printing
625941c9a4f1c619b28b00c3
def getActivityInfo(self, component, flags): <NEW_LINE> <INDENT> return self._sysprovider.getComponentInfo(component, flags)
Retrieve all of the information we know about a particular activity class.
625941c95fcc89381b1e1746
def __init__(self, date=None, name=None, relations=None, assigned=None, unassigned=None, capacity=None): <NEW_LINE> <INDENT> self.swagger_types = { 'date': 'date', 'name': 'date', 'relations': 'list[int]', 'assigned': 'int', 'unassigned': 'int', 'capacity': 'int' } <NEW_LINE> self.attribute_map = { 'date': 'date', 'nam...
InlineResponse20042Utilisation - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941c91f5feb6acb0c4bda
def test_deleted_object_lookup(self): <NEW_LINE> <INDENT> m = M16Unique.objects.get(a="What") <NEW_LINE> m.b = "This is the new long text" <NEW_LINE> m.save() <NEW_LINE> m.delete() <NEW_LINE> del m <NEW_LINE> history_entries = M16Unique.versions.filter(a="What") <NEW_LINE> m = history_entries[0] <NEW_LINE> self.assertE...
If we delete an object we should be able to retrieve it.
625941c9d10714528d5ffd6a
def graph_to_dot(graph, dot): <NEW_LINE> <INDENT> nodes = {} <NEW_LINE> for s, o in graph.subject_objects(): <NEW_LINE> <INDENT> for i in s, o: <NEW_LINE> <INDENT> if i not in nodes.keys(): <NEW_LINE> <INDENT> nodes[i] = i.replace( 'http://purl.org/net/bel-epa/ccy#', '') <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> for s, p, ...
Turns graph into dot (graphviz graph drawing format) using pydot.
625941c98c0ade5d55d3ea42
def zeros_matrix(self, rows, cols): <NEW_LINE> <INDENT> M = [] <NEW_LINE> while len(M) < rows: <NEW_LINE> <INDENT> M.append([]) <NEW_LINE> while len(M[-1]) < cols: <NEW_LINE> <INDENT> M[-1].append(self.mmake(0.0)) <NEW_LINE> <DEDENT> <DEDENT> return M
Creates a matrix filled with zeros. :param rows: the number of rows the matrix should have :param cols: the number of columns the matrix should have :return: list of lists that form the matrix
625941c9507cdc57c6306d61
def dumpblocks(enc, fh): <NEW_LINE> <INDENT> for bnum in range(enc.nrblocks()): <NEW_LINE> <INDENT> print("-- blk %d" % bnum) <NEW_LINE> data = enc.readblock(fh, bnum) <NEW_LINE> hexdump(data)
print all decrypted blocks as hexdump to stdout.
625941c9e64d504609d748c8
def __repr__(self): <NEW_LINE> <INDENT> return "SourceCodeLine(line=%r, line_number=%r, filename=%r)" % (self.line, self.line_number, self.filename)
Object representation of SourceCodeLine >>> print SourceCodeLine('public static void', 14, 'mydir/class.java') SourceCodeLine(line='public static void', line_number=14, filename='mydir/class.java') >>> sc = SourceCodeLine('for i in xrange(20)', 243, './dir1/dir2/x.py') >>> repr(sc) == repr(eval(repr(sc))) True
625941c9cad5886f8bd27062
def patch_botocore_session_send(context, http_filter, http_headers): <NEW_LINE> <INDENT> def wrapper(wrapped, instance, args, kwargs): <NEW_LINE> <INDENT> if not hasattr(context, "iopipe") or not hasattr(context.iopipe, "mark"): <NEW_LINE> <INDENT> return wrapped(*args, **kwargs) <NEW_LINE> <DEDENT> id = str(uuid.uuid4...
Monkey patches botocore's session, if available. Overloads the session class' send method to add tracing and metric collection.
625941c9b57a9660fec3390b
def speed_converter(speed, dist='km', time='min'): <NEW_LINE> <INDENT> distance_conversion = {"km" : 1, 'm' : 1000, 'ft' : 3280.84, 'yrd' : 1093.61} <NEW_LINE> time_conversion = {"ms" : 3.6e6, "s" : 3600, "min" : 60, "day" : 0.04166, "hr" : 1} <NEW_LINE> if not isinstance(speed, (int, float)): <NEW_LINE> <INDENT> raise...
Returns *speed* converted into specified *dist*/*time* Parameters: speed : value to be converted dist : unit of distance time : unit of time
625941c9b57a9660fec3390c
@validate('GET', auth=False) <NEW_LINE> def api_practice_create_quest(request): <NEW_LINE> <INDENT> log_request(request) <NEW_LINE> try: <NEW_LINE> <INDENT> quest_type = getp(request.GET.get('quest_type'), nullable=False, para_intro='生成题目类型') <NEW_LINE> <DEDENT> except InvalidHttpParaException as ihpe: <NEW_LINE> <INDE...
功能说明: 创建题目
625941c9d268445f265b4ef6
def ticks_remaining(self): <NEW_LINE> <INDENT> return self.duration
Inherited from TurnListItem
625941c94d74a7450ccd424c
def read_psipred_prediction(filename, first_index=1): <NEW_LINE> <INDENT> file_format = None <NEW_LINE> with open(filename) as f: <NEW_LINE> <INDENT> for line in f: <NEW_LINE> <INDENT> if line.startswith("# PSIPRED HFORMAT"): <NEW_LINE> <INDENT> file_format = "hformat" <NEW_LINE> <DEDENT> elif line.startswith("# PSIPRE...
Read a psipred secondary structure prediction file in horizontal or vertical format (auto-detected). Parameters ---------- filename : str Path to prediction output file first_index : int, optional (default: 1) Index of first position in predicted sequence Returns ------- pred : pandas.DataFrame Table cont...
625941c9507cdc57c6306d62
def add_switch_group_members(self, switch_group_name, switch_names=None, subgroup_names=None): <NEW_LINE> <INDENT> raise NotImplementedError("add_switch_group_members must be " "implemented in subclass")
Add switch names and switch subgroup names to switch group Returns deferred returning tuple containing the added switch_names and subgroup_names
625941c9fff4ab517eb2f4c4
def test___auto_name__attribute_is_True(self): <NEW_LINE> <INDENT> assert SimpleEntity.__auto_name__ is True
testing if the __auto_name__ class attribute is set to True
625941c9091ae35668666fe8
def get_formatted_json(self, user_id, is_interviewer=False, is_candidate=False): <NEW_LINE> <INDENT> result = {} <NEW_LINE> user_json_list = self.get_queryset().filter( user_id=user_id, user__is_interviewer=is_interviewer, user__is_candidate=is_candidate ).values('id', 'slot', 'date') <NEW_LINE> for user_json in user_j...
Get the formated json , like date : [slot1, slot2] for candidate and interviewer
625941c9fb3f5b602dac371b
def make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> return RedirectRequest( url = '0' ) <NEW_LINE> <DEDENT> else : <NEW_LINE> <INDENT> return RedirectRequest( url = '0', )
Test RedirectRequest include_option is a boolean, when False only required params are included, when True both required and optional params are included
625941c9442bda511e8be4a2
def write_file(output_location, solution): <NEW_LINE> <INDENT> with open(output_location, "w") as f: <NEW_LINE> <INDENT> f.write("{}\n".format(len(solution))) <NEW_LINE> for val in solution: <NEW_LINE> <INDENT> L, pizzas = val[0], val[1:] <NEW_LINE> f.write("{} ".format(int(L))) <NEW_LINE> for p in pizzas: <NEW_LINE> <...
Write to output_location containing the solution. Parameters ---------- output_location : str Full path to output location. solution : ?? Could be anything, but usually is a numpy array. Returns ------- None
625941c95166f23b2e1a51e2
def _ScrubUpdateUser(op_args): <NEW_LINE> <INDENT> _ScrubForClass(User, op_args['user_dict'])
Scrub the pwd_hash and salt from the logs.
625941c90a50d4780f666f1a
def sunny(graph, source, sink, tag="weight"): <NEW_LINE> <INDENT> UNDECIDED = 0 <NEW_LINE> FALSE = -1 <NEW_LINE> TRUE = 1 <NEW_LINE> epsilon = 0.2 <NEW_LINE> decision = [] <NEW_LINE> bayesianNetwork,p_conf = generate_bn(graph,source,sink,tag) <NEW_LINE> leaves = bayesianNetwork.successors(sink) <NEW_LINE> for leaf in l...
Decides which nodes to include using logic sampling in sample_bounds, then calculates a trust value between the source and the sink nodes using the TidalTrust algorithm. Specified in *Kuter, Golbeck (2010)*. Args: source (str): Identifier for the start node in graph sink (str): Identifier for the end node in ...
625941c9b5575c28eb68e088
def input(self, event): <NEW_LINE> <INDENT> if not self.switch_animation and not self.fall_animation and not self.refill_animation: <NEW_LINE> <INDENT> if not self.selected: <NEW_LINE> <INDENT> for i, tile in enumerate(self.board): <NEW_LINE> <INDENT> if tile.tile_position.collidepoint(event.pos) and tile.color in self...
a class that detecs user input and act accordingly depending on the user's action @param event: @return:
625941c9a17c0f6771cbe0d9
@api.route('/alola_dex', methods=['GET', 'POST']) <NEW_LINE> def alola_dex(): <NEW_LINE> <INDENT> return jsonify([pokemon.attributes_as_dictionary() for pokemon in AlolaPokemon.query.all()])
[GET] /api/alola_dex
625941c921bff66bcd6849dc
def getIy(self): <NEW_LINE> <INDENT> return self.iy
Return y-pixel index.
625941c907d97122c4178913
def setAzimuthMaxHorizontalUncertainty(self, azimuthMaxHorizontalUncertainty): <NEW_LINE> <INDENT> return _DataModel.OriginUncertainty_setAzimuthMaxHorizontalUncertainty(self, azimuthMaxHorizontalUncertainty)
setAzimuthMaxHorizontalUncertainty(OriginUncertainty self, Seiscomp::Core::Optional< double >::Impl const & azimuthMaxHorizontalUncertainty)
625941c92eb69b55b151c937
def get_message(self, method, args, kwargs, options=None): <NEW_LINE> <INDENT> content = self.headercontent(method, options=options) <NEW_LINE> header = self.header(content) <NEW_LINE> content = self.bodycontent(method, args, kwargs) <NEW_LINE> body = self.body(content) <NEW_LINE> env = self.envelope(header, body) <NEW...
Get a SOAP message for the specified method, args and SOAP headers. This is the entry point for creating an outbound SOAP message. @param method: The method being invoked. @type method: I{service.Method} @param args: A list of args for the method invoked. @type args: list @param kwargs: Named (keyword) args for the m...
625941c9be383301e01b5510
def brpop(self, keys, timeout, callback=None): <NEW_LINE> <INDENT> args = ["BRPOP"] <NEW_LINE> if isinstance(keys, basestring): <NEW_LINE> <INDENT> args.append(keys) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> args.extend(keys) <NEW_LINE> <DEDENT> args.append(timeout) <NEW_LINE> self.send_message(args, callback)
Remove and get the last element in a list, or block until one is available :param keys: string or list of strings :param timeout: Complexity ---------- O(1)
625941c9be8e80087fb20ccc
def set_height_on_tree(tree): <NEW_LINE> <INDENT> N = len(tree) <NEW_LINE> for node in tree.traverse(): <NEW_LINE> <INDENT> if node.has_feature('timestamp'): <NEW_LINE> <INDENT> node.add_features(height=1.0-(node.timestamp +1.0)/N)
Set height on a tree according to http://www.pnas.org/content/suppl/2012/10/04/1202997109.DCSupplemental/sapp.pdf
625941c9b7558d58953c4f9e
def _process_tws(self, fix=False): <NEW_LINE> <INDENT> return list() if fix else []
If "fix" is True remove any trailing white space from changed lines and return a list of lines that were fixed otherwise return a list of changed lines that have tailing white space
625941c9d164cc6175782dd6
def parse_maven_params(confs, chain=False, scratch=False): <NEW_LINE> <INDENT> config = koji.read_config_files(confs) <NEW_LINE> builds = {} <NEW_LINE> for package in config.sections(): <NEW_LINE> <INDENT> buildtype = 'maven' <NEW_LINE> if config.has_option(package, 'type'): <NEW_LINE> <INDENT> buildtype = config.get(p...
Parse .ini files that contain parameters to launch a Maven build. Return a map whose keys are package names and values are config parameters.
625941c9d268445f265b4ef7
def perfusion(x, y): <NEW_LINE> <INDENT> return (np.max(y) - np.min(y)) / np.abs(np.mean(x))
Perfusion x: raw signal y: filtered signal
625941c9462c4b4f79d1d759
def ridge_regression(y, tx, lambda_): <NEW_LINE> <INDENT> xx = np.dot(np.transpose(tx), tx) <NEW_LINE> bxx = xx + lambda_ * np.identity(len(xx)) <NEW_LINE> xy = np.dot(np.transpose(tx), y) <NEW_LINE> w_star = np.linalg.solve(bxx, xy) <NEW_LINE> loss = compute_RMSE(y, tx, w_star) <NEW_LINE> return w_star, loss
Use the Ridge Regression method to find the best weights INPUT: y - Predictions tx - Samples OUTPUT: w - Best weights loss - Minimum loss
625941c9bf627c535bc13258
def fix_BIO(blocks, indices): <NEW_LINE> <INDENT> assert len(indices) > 0, 'Error: fix_BIO() given empty indices' <NEW_LINE> for i in indices: <NEW_LINE> <INDENT> blocks = _fix_BIO_index(blocks, i) <NEW_LINE> <DEDENT> return blocks
Corrects BIO tag sequence errors in given data. Expects output of parse_conll() (or similar) as input. NOTE: Modifies given blocks. Args: blocks (list of lists of lists of strings): parsed CoNLL-style input. indices (list of ints): indices of fields containing BIO tags. Returns: given blocks with fixed BI...
625941c930dc7b76659019f0
def double(): <NEW_LINE> <INDENT> global bet <NEW_LINE> global money <NEW_LINE> money -= bet <NEW_LINE> bet *= 2 <NEW_LINE> print("Total money: {} Bet: {}".format(money, bet)) <NEW_LINE> hit()
Double the bet and add one card(hit)
625941c9d6c5a102081440d3
def _process_html(self) -> None: <NEW_LINE> <INDENT> rows = self.html.xpath("//p") <NEW_LINE> date = rows[0].text_content() <NEW_LINE> date_year = convert_date_string(date) <NEW_LINE> if "P U B L I S H E D  O P I N I O N S" != rows[1].text_content(): <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> for row in rows[2:]...
Process the HTML This is an odd little site, where they just post unpublished and published opinions without links. Fortunately, its easy enough to crawl and the pattern for the URLs is pretty consistent. (i think) The URL looks like this https://www.courts.state.co.us/Courts/Court_of_Appeals/Opinion/[YEAR]/[DOCKET]-...
625941c9283ffb24f3c5598b
@app.route("/api/book/<isbn>") <NEW_LINE> def book_api(isbn): <NEW_LINE> <INDENT> bookInfo = db.execute("SELECT * FROM books WHERE isbn = :isbn", {"isbn": isbn}).fetchone() <NEW_LINE> bookScore = db.execute("SELECT * FROM bookrev WHERE isbn = :isbn", {"isbn": isbn}).fetchall() <NEW_LINE> averageScore = 0 <NEW_LINE> rev...
Return details about a single flight.
625941c9d4950a0f3b08c3d8
def pc_nproduced_avg(self): <NEW_LINE> <INDENT> return _filter_swig.pfb_channelizer_ccf_sptr_pc_nproduced_avg(self)
pc_nproduced_avg(pfb_channelizer_ccf_sptr self) -> float
625941c9ac7a0e7691ed4157
def plot_uncertainty_bounds_s(self, multiplier: float = 200, *args, **kwargs): <NEW_LINE> <INDENT> default_kwargs = { 'marker':'o', 'color':'b', 'mew':0, 'ls':'', 'alpha':.1, 'label':None, } <NEW_LINE> default_kwargs.update(**kwargs) <NEW_LINE> if plt.isinteractive(): <NEW_LINE> <INDENT> was_interactive = True <NEW_LIN...
Plot complex uncertainty bounds plot on smith chart. This function plots the complex uncertainty of a NetworkSet as circles on the smith chart. At each frequency a circle with radii proportional to the complex standard deviation of the set at that frequency is drawn. Due to the fact that the `markersize` argument is i...
625941c907f4c71912b1150b
def _test_config(self, config, config_id): <NEW_LINE> <INDENT> config_id = self._id_prefix + config_id <NEW_LINE> logger.debug('\t[ %s ]: test...', self._pretty_config_id(config_id)) <NEW_LINE> outcome = self._test(config, config_id) <NEW_LINE> logger.debug('\t[ %s ]: test = %r', self._pretty_config_id(config_id), outc...
Test a single configuration and save the result in cache. :param config: The current configuration to test. :param config_id: Unique ID that will be used to save tests to easily identifiable directories. :return: PASS or FAIL
625941c9627d3e7fe0d68ed8