Search is not available for this dataset
text
stringlengths
75
104k
def Mx(mt, x): """ Return the Mx """ n = len(mt.Cx) sum1 = 0 for j in range(x, n): k = mt.Cx[j] sum1 += k return sum1
def nEx(mt, x, n): """ nEx : Returns the EPV of a pure endowment (deferred capital). Pure endowment benefits are conditional on the survival of the policyholder. (v^n * npx) """ return mt.Dx[x + n] / mt.Dx[x]
def Axn(mt, x, n): """ (A^1)x:n : Returns the EPV (net single premium) of a term insurance. """ return (mt.Mx[x] - mt.Mx[x + n]) / mt.Dx[x]
def AExn(mt, x, n): """ AExn : Returns the EPV of a endowment insurance. An endowment insurance provides a combination of a term insurance and a pure endowment """ return (mt.Mx[x] - mt.Mx[x + n]) / mt.Dx[x] + mt.Dx[x + n] / mt.Dx[x]
def tAx(mt, x, t): """ n/Ax : Returns the EPV (net single premium) of a deferred whole life insurance. """ return mt.Mx[x + t] / mt.Dx[x]
def qAx(mt, x, q): """ This function evaluates the APV of a geometrically increasing annual annuity-due """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return Ax(mtj, x)
def aaxn(mt, x, n, m=1): """ Γ€xn : Return the actuarial present value of a (immediate) temporal (term certain) annuity: n-year temporary life annuity-anticipatory. Payable 'm' per year at the beginning of the period """ if m == 1: return (mt.Nx[x] - mt.Nx[x + n]) / mt.Dx[x] else: r...
def aax(mt, x, m=1): """ Γ€x : Returns the actuarial present value of an (immediate) annuity of 1 per time period (whole life annuity-anticipatory). Payable 'm' per year at the beginning of the period """ return mt.Nx[x] / mt.Dx[x] - (float(m - 1) / float(m * 2))
def ax(mt, x, m=1): """ ax : Returns the actuarial present value of an (immediate) annuity of 1 per time period (whole life annuity-late). Payable 'm' per year at the ends of the period """ return (mt.Nx[x] / mt.Dx[x] - 1) + (float(m - 1) / float(m * 2))
def taax(mt, x, t, m=1): """ n/Γ€x : Return the actuarial present value of a deferred annuity (deferred n years): n-year deferred whole life annuity-anticipatory. Payable 'm' per year at the beginning of the period """ return mt.Nx[x + t] / mt.Dx[x] - ((float(m - 1) / float(m * 2)) * (1 - nEx(mt, x, t)...
def Iaaxn(mt, x, n, *args): """ during a term certain, IAn """ return (Sx(mt, x) - Sx(nt, x + n) - n * Nx(nt, x + n)) / Dx(nt, x)
def Iaxn(mt, x, n, *args): """ during a term certain, IAn """ return (Sx(mt, x + 1) - Sx(mt, x + n + 1) - n * Nx(mt, x + n + 1)) / Dx(mt, x)
def Iaax(mt, x, *args): """ (IΓ€)x : Returns the present value of annuity-certain at the beginning of the first year and increasing linerly. Arithmetically increasing annuity-anticipatory """ return Sx(mt, x) / Dx(mt, x)
def Iax(mt, x, *args): """ (Ia)x : Returns the present value of annuity-certain at the end of the first year and increasing linerly. Arithmetically increasing annuity-late """ return Sx(mt, x + 1) / Dx(mt, x)
def Itaax(mt, x, t): """ deffered t years """ return (Sx(mt, x) - Sx(mt, x + t)) / Dx(mt, x)
def Itax(mt, x, t): """ deffered t years """ return (Sx(mt, x + 1) - Sx(mt, x + t + 1)) / Dx(mt, x)
def qax(mt, x, q, m=1): """ geometrica """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return ax(mtj, x, m)
def qaax(mt, x, q, m=1): """ geometrica """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return aax(mtj, x, m)
def qaxn(mt, x, n, q, m=1): """ geometrica """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return axn(mtj, x, n, m)
def qaaxn(mt, x, n, q, m = 1): """ geometrica """ #i = float(nt[1]) q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return aaxn(mtj, x, n, m)
def qtax(mt, x, t, q, m=1): """ geometrica """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return tax(mtj, x, t) + ((float(m - 1) / float(m * 2)) * (1 - nEx(mt, x, t)))
def qtaax(mt, x, t, q, m=1): """ geometrica """ q = float(q) j = (mt.i - q) / (1 + q) mtj = Actuarial(nt=mt.nt, i=j) return taax(mtj, x, t) - ((float(m - 1) / float(m * 2)) * (1 - nEx(mt, x, t)))
def annuity(mt, x, n, p, m=1 , *args): """Syntax: annuity(nt, x, n, p, m, ['a/g', q], -d) Args: mt = the mortality table x = the age as integer number. n = A integer number (term of insurance in years) or 'w' = whole-life. (Also, 99 years is defined to be whole-life). ...
def _meanvalueattr(self,v): """ find new position of vertex v according to adjacency in prevlayer. position is given by the mean value of adjacent positions. experiments show that meanvalue heuristic performs better than median. """ sug = self.layout if not self.p...
def _medianindex(self,v): """ find new position of vertex v according to adjacency in layer l+dir. position is given by the median value of adjacent positions. median heuristic is proven to achieve at most 3 times the minimum of crossings (while barycenter achieve in theory the o...
def _neighbors(self,v): """ neighbors refer to upper/lower adjacent nodes. Note that v.N() provides neighbors of v in the graph, while this method provides the Vertex and DummyVertex adjacent to v in the upper or lower layer (depending on layout.dirv state). """ a...
def _crossings(self): """ counts (inefficently but at least accurately) the number of crossing edges between layer l and l+dirv. P[i][j] counts the number of crossings from j-th edge of vertex i. The total count of crossings is the sum of flattened P: x = sum(sum(P,[])) ...
def _cc(self): """ implementation of the efficient bilayer cross counting by insert-sort (see Barth & Mutzel paper "Simple and Efficient Bilayer Cross Counting") """ g=self.layout.grx P=[] for v in self: P.extend(sorted([g[x].pos for x in self._neighbo...
def init_all(self,roots=None,inverted_edges=None,optimize=False): """initializes the layout algorithm by computing roots (unless provided), inverted edges (unless provided), vertices ranks and creates all dummy vertices and layers. Parameters: ro...
def draw(self,N=1.5): """compute every node coordinates after converging to optimal ordering by N rounds, and finally perform the edge routing. """ while N>0.5: for (l,mvmt) in self.ordering_step(): pass N = N-1 if N>0: for (...
def rank_all(self,roots,optimize=False): """Computes rank of all vertices. add provided roots to rank 0 vertices, otherwise update ranking from provided roots. The initial rank is based on precedence relationships, optimal ranking may be derived from network flow (simplex). ...
def _rank_init(self,unranked): """Computes rank of provided unranked list of vertices and all their children. A vertex will be asign a rank when all its inward edges have been *scanned*. When a vertex is asigned a rank, its outward edges are marked *scanned*. """ ...
def _rank_optimize(self): """optimize ranking by pushing long edges toward lower layers as much as possible. see other interersting network flow solver to minimize total edge length (http://jgaa.info/accepted/2005/EiglspergerSiebenhallerKaufmann2005.9.3.pdf) """ assert self.dag ...
def setrank(self,v): """set rank value for vertex v and add it to the corresponding layer. The Layer is created if it is the first vertex with this rank. """ assert self.dag r=max([self.grx[x].rank for x in v.N(-1)]+[-1])+1 self.grx[v].rank=r # add it to its la...
def dummyctrl(self,r,ctrl): """creates a DummyVertex at rank r inserted in the ctrl dict of the associated edge and layer. Arguments: r (int): rank value ctrl (dict): the edge's control vertices Returns: DummyVertex : the cr...
def setdummies(self,e): """creates and defines all needed dummy vertices for edge e. """ v0,v1 = e.v r0,r1 = self.grx[v0].rank,self.grx[v1].rank if r0>r1: assert e in self.alt_e v0,v1 = v1,v0 r0,r1 = r1,r0 if (r1-r0)>1: # "d...
def draw_step(self): """iterator that computes all vertices coordinates and edge routing after just one step (one layer after the other from top to bottom to top). Purely inefficient ! Use it only for "animation" or debugging purpose. """ ostep = self.ordering_step() ...
def ordering_step(self,oneway=False): """iterator that computes all vertices ordering in their layers (one layer after the other from top to bottom, to top again unless oneway is True). """ self.dirv=-1 crossings = 0 for l in self.layers: mvmt = ...
def setxy(self): """computes all vertex coordinates (x,y) using an algorithm by Brandes & Kopf. """ self._edge_inverter() self._detect_alignment_conflicts() inf = float('infinity') # initialize vertex coordinates attributes: for l in self.layers: ...
def _detect_alignment_conflicts(self): """mark conflicts between edges: inner edges are edges between dummy nodes type 0 is regular crossing regular (or sharing vertex) type 1 is inner crossing regular (targeted crossings) type 2 is inner crossing inner (avoided by reduce_crossin...
def _coord_vertical_alignment(self): """performs vertical alignment according to current dirvh internal state. """ dirh,dirv = self.dirh,self.dirv g = self.grx for l in self.layers[::-dirv]: if not l.prevlayer(): continue r=None for vk in l[::d...
def draw_edges(self): """Basic edge routing applied only for edges with dummy points. Enhanced edge routing can be performed by using the apropriate *route_with_xxx* functions from :ref:routing_ in the edges' view. """ for e in self.g.E(): if hasattr(e,'view'): ...
def pyprf(strCsvCnfg, lgcTest=False, varRat=None, strPathHrf=None): """ Main function for pRF mapping. Parameters ---------- strCsvCnfg : str Absolute file path of config file. lgcTest : Boolean Whether this is a test (pytest). If yes, absolute path of pyprf libary will ...
def make_request(cls, url, method, params=None, basic_auth=None, timeout=600): """ Makes a cURL POST request to the given URL, specifying the data to be passed in as {"method": method, "params": parameters} :param str url: URL to connect to. :param str method: The API method to call. ...
def load_png(varNumVol, strPathPng, tplVslSpcSze=(200, 200), varStrtIdx=0, varZfill=3): """ Load PNGs with stimulus information for pRF model creation. Parameters ---------- varNumVol : int Number of PNG files. strPathPng : str Parent directory of PNG files. PNG fil...
def load_ev_txt(strPthEv): """Load information from event text file. Parameters ---------- input1 : str Path to event text file Returns ------- aryEvTxt : 2d numpy array, shape [n_measurements, 3] Array with info about conditions: type, onset, duration Notes ----- ...
def adjust_status(info: dict) -> dict: """Apply status mapping to a raw API result.""" modified_info = deepcopy(info) modified_info.update({ 'level': get_nearest_by_numeric_key(STATUS_MAP, int(info['level'])), 'level2': STATUS_MAP[99] if info['level2'] is None else ...
async def status_by_coordinates( self, latitude: float, longitude: float) -> dict: """Return the CDC status for the provided latitude/longitude.""" cdc_data = await self.raw_cdc_data() nearest = await self.nearest_by_coordinates(latitude, longitude) return adjust_status(cdc_d...
async def status_by_state(self, state: str) -> dict: """Return the CDC status for the specified state.""" data = await self.raw_cdc_data() try: info = next((v for k, v in data.items() if state in k)) except StopIteration: return {} return adjust_status(i...
def brief_exception_text(exception, secret_values): """ Returns the Exception class and the message of the exception as string. :param exception: The exception to format :param secret_values: Values to hide in output """ exception_text = _hide_secret_values(str(exception), secret_values) re...
def print_exception(exception, secret_values=None): """ Prints the exception message and the name of the exception class to stderr. :param exception: The exception to print :param secret_values: Values to hide in output """ print(brief_exception_text(exception, secret_values), file=sys.stderr)
def insert(self, **kwargs): """ Saves the Document to the database if it is valid. Returns errors otherwise. """ if self.is_valid: before = self.before_insert() if before: return before try: self._document['_id'...
def update(self, **kwargs): """ Updates the document with the given _id saved in the collection if it is valid. Returns errors otherwise. """ if self.is_valid: if '_id' in self._document: to_update = self.find_one({'_id': self._id}) ...
def delete(self, **kwargs): """ Deletes the document if it is saved in the collection. """ if self.is_valid: if '_id' in self._document: to_delete = self.find_one({'_id': self._id}) if to_delete: before = self.before_delete...
def find_one(cls, filter=None, *args, **kwargs): """ Returns one document dict if one passes the filter. Returns None otherwise. """ return cls.collection.find_one(filter, *args, **kwargs)
def find(cls, *args, **kwargs): """ Returns all document dicts that pass the filter """ return list(cls.collection.find(*args, **kwargs))
def aggregate(cls, pipeline=None, **kwargs): """ Returns the document dicts returned from the Aggregation Pipeline """ return list(cls.collection.aggregate(pipeline or [], **kwargs))
def insert_many(cls, documents, ordered=True): """ Inserts a list of documents into the Collection and returns their _ids """ return cls.collection.insert_many(documents, ordered).inserted_ids
def update_one(cls, filter, update, upsert=False): """ Updates a document that passes the filter with the update value Will upsert a new document if upsert=True and no document is filtered """ return cls.collection.update_one(filter, update, upsert).raw_result
def update_many(cls, filter, update, upsert=False): """ Updates all documents that pass the filter with the update value Will upsert a new document if upsert=True and no document is filtered """ return cls.collection.update_many(filter, update, upsert).raw_result
def replace_one(cls, filter, replacement, upsert=False): """ Replaces a document that passes the filter. Will upsert a new document if upsert=True and no document is filtered """ return cls.collection.replace_one( filter, replacement, upsert ).raw_result
def get(cls, filter=None, **kwargs): """ Returns a Document if any document is filtered, returns None otherwise """ document = cls(cls.find_one(filter, **kwargs)) return document if document.document else None
def documents(cls, filter=None, **kwargs): """ Returns a list of Documents if any document is filtered """ documents = [cls(document) for document in cls.find(filter, **kwargs)] return [document for document in documents if document.document]
def in_file(self, fn: str) -> Iterator[Statement]: """ Returns an iterator over all of the statements belonging to a file. """ yield from self.__file_to_statements.get(fn, [])
def at_line(self, line: FileLine) -> Iterator[Statement]: """ Returns an iterator over all of the statements located at a given line. """ num = line.num for stmt in self.in_file(line.filename): if stmt.location.start.line == num: yield stmt
def funcFindPrfGpu(idxPrc, vecMdlXpos, vecMdlYpos, vecMdlSd, aryFunc, # noqa aryPrfTc, varL2reg, queOut, lgcPrint=True): """ Find best pRF model for voxel time course. Parameters ---------- idxPrc : int Process ID of the process calling this function (for CPU mul...
def wrap(text, width=70, **kwargs): """Wrap multiple paragraphs of text, returning a list of wrapped lines. Reformat the multiple paragraphs 'text' so they fit in lines of no more than 'width' columns, and return a list of wrapped lines. By default, tabs in 'text' are expanded with string.expandtabs(...
def fill(text, width=70, **kwargs): """Fill multiple paragraphs of text, returning a new string. Reformat multiple paragraphs in 'text' to fit in lines of no more than 'width' columns, and return a new string containing the entire wrapped text. As with wrap(), tabs are expanded and other whitespac...
def split(cls, text): """split(text : string) -> [string] Splits 'text' into multiple paragraphs and return a list of each paragraph. """ result = [line.strip('\n') for line in cls.parasep_re.split(text)] if result == ['', '']: result = [''] return re...
def wrap(self, text): """wrap(text : string) -> [string] Reformat the multiple paragraphs in 'text' so they fit in lines of no more than 'self.width' columns, and return a list of wrapped lines. Tabs in 'text' are expanded with string.expandtabs(), and all other whitespace char...
def getSenderNumberMgtURL(self, CorpNum, UserID): """ 팩슀 전솑내역 νŒμ—… URL args CorpNum : νšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ UserID : νšŒμ› νŒλΉŒμ•„μ΄λ”” return 30초 λ³΄μ•ˆ 토큰을 ν¬ν•¨ν•œ url raise PopbillException """ result = self._httpget('/FAX/?T...
def getUnitCost(self, CorpNum): """ 팩슀 전솑 단가 확인 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ return 전솑 단가 by float raise PopbillException """ result = self._httpget('/FAX/UnitCost', CorpNum) return int(result.unitCost)
def getFaxResult(self, CorpNum, ReceiptNum, UserID=None): """ 팩슀 전솑결과 쑰회 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ ReceiptNum : μ „μ†‘μš”μ²­μ‹œ λ°œκΈ‰λ°›μ€ μ ‘μˆ˜λ²ˆν˜Έ UserID : νŒλΉŒνšŒμ› 아이디 return νŒ©μŠ€μ „μ†‘μ •λ³΄ as list raise PopbillException ...
def getFaxResultRN(self, CorpNum, RequestNum, UserID=None): """ 팩슀 전솑결과 쑰회 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ RequestNum : μ „μ†‘μš”μ²­μ‹œ ν• λ‹Ήν•œ μ „μ†‘μš”μ²­λ²ˆν˜Έ UserID : νŒλΉŒνšŒμ› 아이디 return νŒ©μŠ€μ „μ†‘μ •λ³΄ as list raise PopbillException ...
def sendFax(self, CorpNum, SenderNum, ReceiverNum, ReceiverName, FilePath, ReserveDT=None, UserID=None, SenderName=None, adsYN=False, title=None, RequestNum=None): """ 팩슀 단건 전솑 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ SenderNum : λ°œμ‹ μž 번호 ReceiverNum : ...
def sendFax_multi(self, CorpNum, SenderNum, Receiver, FilePath, ReserveDT=None, UserID=None, SenderName=None, adsYN=False, title=None, RequestNum=None): """ 팩슀 전솑 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ SenderNum : λ°œμ‹ μž 번호 (λ™λ³΄μ „μ†‘μš©) Receiver : μˆ˜μ‹ μž...
def resendFax(self, CorpNum, ReceiptNum, SenderNum, SenderName, ReceiverNum, ReceiverName, ReserveDT=None, UserID=None, title=None, RequestNum=None): """ 팩슀 단건 전솑 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ ReceiptNum : 팩슀 μ ‘μˆ˜λ²ˆν˜Έ SenderNum : λ°œμ‹ μž 번호 ...
def resendFaxRN(self, CorpNum, OrgRequestNum, SenderNum, SenderName, ReceiverNum, ReceiverName, ReserveDT=None, UserID=None, title=None, RequestNum=None): """ 팩슀 단건 전솑 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ OrgRequestNum : 원본 팩슀 μ „μ†‘μ‹œ ν• λ‹Ήν•œ μ „μ†‘μš”μ²­λ²ˆν˜Έ R...
def resendFaxRN_multi(self, CorpNum, OrgRequestNum, SenderNum, SenderName, Receiver, ReserveDT=None, UserID=None, title=None, RequestNum=None): """ 팩슀 전솑 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ OrgRequestNum : 원본 팩슀 μ „μ†‘μ‹œ ν• λ‹Ήν•œ μ „μ†‘μš”μ²­λ²ˆν˜Έ SenderNum...
def getPreviewURL(self, CorpNum, ReceiptNum, UserID): """ 팩슀 λ°œμ‹ λ²ˆν˜Έ λͺ©λ‘ 확인 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ UserID : νŒλΉŒνšŒμ› 아이디 return 처리결과. list of SenderNumber raise PopbillException """ return self._httpge...
def prepare_outdir(outdir): """ Creates the output directory if not existing. If outdir is None or if no output_files are provided nothing happens. :param outdir: The output directory to create. """ if outdir: outdir = os.path.expanduser(outdir) if not os.path.isdir(outdir): ...
def requestJob(self, CorpNum, Type, SDate, EDate, UserID=None): """ μˆ˜μ§‘ μš”μ²­ args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ Type : λ¬Έμ„œν˜•νƒœ, SELL-맀좜, BUY-λ§€μž…, SDate : μ‹œμž‘μΌμž, ν‘œμ‹œν˜•μ‹(yyyyMMdd) EDate : μ’…λ£ŒμΌμž, ν‘œμ‹œν˜•μ‹(yyyyMMdd) UserID : νŒλΉŒνšŒμ› 아이디 re...
def search(self, CorpNum, JobID, TradeType, TradeUsage, Page, PerPage, Order, UserID=None): """ μˆ˜μ§‘ κ²°κ³Ό 쑰회 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ JobID : μž‘μ—…μ•„μ΄λ”” TradeType : λ¬Έμ„œν˜•νƒœ λ°°μ—΄, N-일반 ν˜„κΈˆμ˜μˆ˜μ¦, C-μ·¨μ†Œ ν˜„κΈˆμ˜μˆ˜μ¦ TradeUsage : κ±°λž˜κ΅¬λΆ„ λ°°μ—΄, P-μ†Œλ“±κ³΅μ œμš©, C-μ§€μΆœμ¦λΉ™μš© ...
def summary(self, CorpNum, JobID, TradeType, TradeUsage, UserID=None): """ μˆ˜μ§‘ κ²°κ³Ό μš”μ•½μ •λ³΄ 쑰회 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ JobID : μž‘μ—…μ•„μ΄λ”” TradeType : λ¬Έμ„œν˜•νƒœ λ°°μ—΄, N-일반 ν˜„κΈˆμ˜μˆ˜μ¦, C-μ·¨μ†Œ ν˜„κΈˆμ˜μˆ˜μ¦ TradeUsage : κ±°λž˜κ΅¬λΆ„ λ°°μ—΄, P-μ†Œλ“±κ³΅μ œμš©, C-μ§€μΆœμ¦λΉ™μš© UserID :...
def registDeptUser(self, CorpNum, DeptUserID, DeptUserPWD, UserID=None): """ ν™ˆνƒμŠ€ ν˜„κΈˆμ˜μˆ˜μ¦ λΆ€μ„œμ‚¬μš©μž 계정 등둝 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ DeptUserID : ν™ˆνƒμŠ€ λΆ€μ„œμ‚¬μš©μž 계정아이디 DeptUserPWD : ν™ˆνƒμŠ€ λΆ€μ„œμ‚¬μš©μž κ³„μ •λΉ„λ°€λ²ˆν˜Έ UserID : νŒλΉŒνšŒμ› 아이디 return ...
def model_node(**kwargs): """ Decorates a ``schematics.Model`` class to add it as a field of type ``schematic.types.ModelType``. Keyword arguments are passed to ``schematic.types.ModelType``. Example: .. code-block:: python :emphasize-lines: 8,13 from schematics import Model,...
def for_each_file(base_dir, func): """ Calls func(filename) for every file under base_dir. :param base_dir: A directory containing files :param func: The function to call with every file. """ for dir_path, _, file_names in os.walk(base_dir): for filename in file_names: func...
def make_file_read_only(file_path): """ Removes the write permissions for the given file for owner, groups and others. :param file_path: The file whose privileges are revoked. :raise FileNotFoundError: If the given file does not exist. """ old_permissions = os.stat(file_path).st_mode os.chm...
def load_config(strCsvCnfg, lgcTest=False, lgcPrint=True): """ Load py_pRF_mapping config file. Parameters ---------- strCsvCnfg : string Absolute file path of config file. lgcTest : Boolean Whether this is a test (pytest). If yes, absolute path of this function will be ...
async def status_by_coordinates( self, latitude: float, longitude: float) -> dict: """Get symptom data for the location nearest to the user's lat/lon.""" return await self.nearest_by_coordinates(latitude, longitude)
async def status_by_zip(self, zip_code: str) -> dict: """Get symptom data for the provided ZIP code.""" try: location = next(( d for d in await self.user_reports() if d['zip'] == zip_code)) except StopIteration: return {} return aw...
def print_request(request): """ Prints a prepared request to give the user info as to what they're sending :param request.PreparedRequest request: PreparedRequest object to be printed :return: Nothing """ print('{}\n{}\n{}\n\n{}'.format( '-----------START-----------', request.method...
def filter_validate_schemas(get_response, params): """ This filter validates input data against the resource's ``request_schema`` and fill the request's ``validated`` dict. Data from ``request.params`` and ``request.body`` (when the request body is of a form type) will be converted using the schema...
def filter_validate_response(get_response, params): """ This filter process the returned response. It does 2 things: - If the response is a ``sanic.response.HTTPResponse`` and not a :class:`rafter.http.Response`, return it immediately. - It processes, validates and serializes this response when a...
def make_EPUB(parsed_article, output_directory, input_path, image_directory, config_module=None, epub_version=None, batch=False): """ Standard workflow for creating an EPUB document. make_EPUB is used to produce an EPUB fil...
def make_epub_base(location): """ Creates the base structure for an EPUB file in a specified location. This function creates constant components for the structure of the EPUB in a specified directory location. Parameters ---------- location : str A path string to a local directory ...
def epub_zip(outdirect): """ Zips up the input file directory into an EPUB file. """ def recursive_zip(zipf, directory, folder=None): if folder is None: folder = '' for item in os.listdir(directory): if os.path.isfile(os.path.join(directory, item)): ...
def _write_int(fname, data, append=True): """Write data to CSV file with validation.""" # pylint: disable=W0705 data_ex = pexdoc.exh.addex(ValueError, "There is no data to save to file") fos_ex = pexdoc.exh.addex( OSError, "File *[fname]* could not be created: *[reason]*" ) data_ex((len(...
def _input_directory_description(input_identifier, arg_item, input_dir): """ Produces a directory description. A directory description is a dictionary containing the following information. - 'path': An array containing the paths to the specified directories. - 'debugInfo': A field to possibly provid...
def _check_input_directory_listing(base_directory, listing): """ Raises an DirectoryError if files or directories, given in the listing, could not be found in the local filesystem. :param base_directory: The path to the directory to check :param listing: A listing given as dictionary :raise Directo...