Search is not available for this dataset
text
stringlengths
75
104k
def parse_cwl_type(cwl_type_string): """ Parses cwl type information from a cwl type string. Examples: - "File[]" -> {'type': 'File', 'isArray': True, 'isOptional': False} - "int?" -> {'type': 'int', 'isArray': False, 'isOptional': True} :param cwl_type_string: The cwl type string to extract ...
def cwl_input_directories(cwl_data, job_data, input_dir=None): """ Searches for Directories and in the cwl data and produces a dictionary containing input file information. :param cwl_data: The cwl data as dictionary :param job_data: The job data as dictionary :param input_dir: TODO :return: Re...
def cwl_output_files(cwl_data, inputs_to_reference, output_dir=None): """ Returns a dictionary containing information about the output files given in cwl_data. :param cwl_data: The cwl data from where to extract the output file information. :param inputs_to_reference: Inputs which are used to resolve i...
def read(self, length=-1): """ Reads from the FIFO. Reads as much data as possible from the FIFO up to the specified length. If the length argument is negative or ommited all data currently available in the FIFO will be read. If there is no data available in the FIFO an ...
def readuntil(self, token, size=0): """ Reads data from the FIFO until a token is encountered. If no token is encountered as much data is read from the FIFO as possible keeping in mind that the FIFO must retain enough data to perform matches for the token across writes. ...
def peekline(self): """ Peeks a line into the FIFO. Perfroms the same function as readline() without removing data from the FIFO. See readline() for further information. """ self.__append() i = self.buf.find(self.eol, self.pos) if i < 0: retu...
def peekuntil(self, token, size=0): """ Peeks for token into the FIFO. Performs the same function as readuntil() without removing data from the FIFO. See readuntil() for further information. """ self.__append() i = self.buf.find(token, self.pos) if i < 0...
def getURL(self, CorpNum, UserID, ToGo): """ :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param UserID: νŒλΉŒνšŒμ› 아이디 :param ToGo: [PLUSFRIEND-ν”ŒλŸ¬μŠ€μΉœκ΅¬κ³„μ •κ΄€λ¦¬, SENDER-λ°œμ‹ λ²ˆν˜Έκ΄€λ¦¬, TEMPLATE-μ•Œλ¦Όν†‘ν…œν”Œλ¦Ώκ΄€λ¦¬, BOX-μΉ΄μΉ΄μ˜€ν†‘μ „μ†‘λ‚΄μš©] :return: 팝빌 URL """ if ToGo == None or ToGo == '': raise PopbillExceptio...
def getPlusFriendMgtURL(self, CorpNum, UserID): """ ν”ŒλŸ¬μŠ€μΉœκ΅¬ 계정관리 νŒμ—… URL :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param UserID: νŒλΉŒνšŒμ› 아이디 :return: 팝빌 URL """ result = self._httpget('/KakaoTalk/?TG=PLUSFRIEND', CorpNum, UserID) return result.url
def getATSTemplateMgtURL(self, CorpNum, UserID): """ μ•Œλ¦Όν†‘ ν…œν”Œλ¦Ώκ΄€λ¦¬ νŒμ—… URL :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param UserID: νŒλΉŒνšŒμ› 아이디 :return: 팝빌 URL """ result = self._httpget('/KakaoTalk/?TG=TEMPLATE', CorpNum, UserID) return result.url
def getSentListURL(self, CorpNum, UserID): """ μΉ΄μΉ΄μ˜€ν†‘ 전솑내역 νŒμ—… URL :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param UserID: νŒλΉŒνšŒμ› 아이디 :return: 팝빌 URL """ result = self._httpget('/KakaoTalk/?TG=BOX', CorpNum, UserID) return result.url
def sendATS_same(self, CorpNum, TemplateCode, Sender, Content, AltContent, AltSendType, SndDT, KakaoMessages, UserID=None, RequestNum=None, ButtonList=None): """ μ•Œλ¦Όν†‘ λŒ€λŸ‰ 전솑 :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param TemplateCode: ν…œν”Œλ¦Ώμ½”λ“œ :param Sender: λ°œμ‹ λ²ˆν˜Έ :param Con...
def sendFTS_same(self, CorpNum, PlusFriendID, Sender, Content, AltContent, AltSendType, SndDT, KakaoMessages, KakaoButtons, AdsYN=False, UserID=None, RequestNum=None): """ μΉœκ΅¬ν†‘ ν…μŠ€νŠΈ λŒ€λŸ‰ 전솑 :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param PlusFriendID: ν”ŒλŸ¬μŠ€μΉœκ΅¬ 아이디 :param Sender: ...
def sendFMS_same(self, CorpNum, PlusFriendID, Sender, Content, AltContent, AltSendType, SndDT, FilePath, ImageURL, KakaoMessages, KakaoButtons, AdsYN=False, UserID=None, RequestNum=None): """ μΉœκ΅¬ν†‘ 이미지 λŒ€λŸ‰ 전솑 :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param PlusFriendID: ν”ŒλŸ¬μŠ€μΉœκ΅¬ 아이디 ...
def cancelReserve(self, CorpNum, ReceiptNum, UserID=None): """ μ˜ˆμ•½μ „μ†‘ μ·¨μ†Œ :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param ReceiptNum: μ ‘μˆ˜λ²ˆν˜Έ :param UserID: νŒλΉŒνšŒμ› 아이디 :return: code (μš”μ²­μ— λŒ€ν•œ μƒνƒœ μ‘λ‹΅μ½”λ“œ), message (μš”μ²­μ— λŒ€ν•œ 응닡 λ©”μ‹œμ§€) """ if ReceiptNum == None or len(ReceiptNum) != 18: ...
def getUnitCost(self, CorpNum, MsgType, UserID=None): """ 전솑단가 확인 :param CorpNum: νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ :param MsgType: μΉ΄μΉ΄μ˜€ν†‘ μœ ν˜• :param UserID: 팝빌 νšŒμ›μ•„μ΄λ”” :return: unitCost """ if MsgType is None or MsgType == "": raise PopbillException(-99999999, "μ „μ†‘μœ ν˜•μ΄ μž…λ ₯되...
def revdocs2reverts(rev_docs, radius=defaults.RADIUS, use_sha1=False, resort=False, verbose=False): """ Converts a sequence of page-partitioned revision documents into a sequence of reverts. :Params: rev_docs : `iterable` ( `dict` ) a page-partitioned sequence of...
def spm_hrf_compat(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp=1, p_u_ratio=6, normalize=True, ): """ SPM HRF function from sum of two gamma PDFs This function is de...
def dspmt(t): """ SPM canonical HRF derivative, HRF derivative values for time values `t` This is the canonical HRF derivative function as used in SPM. It is the numerical difference of the HRF sampled at time `t` minus the values sampled at time `t` -1 """ t = np.asarray(t) return spmt(t)...
def cnvlTc(idxPrc, aryPrfTcChunk, lstHrf, varTr, varNumVol, queOut, varOvsmpl=10, varHrfLen=32, ): """ Convolution of time courses with HRF model. """ # *** prepare hrf time courses for convolution print("------...
def funcHrf(varNumVol, varTr): """Create double gamma function. Source: http://www.jarrodmillman.com/rcsds/lectures/convolution_background.html """ vecX = np.arange(0, varNumVol, 1) # Expected time of peak of HRF [s]: varHrfPeak = 6.0 / varTr # Expected time of undershoot of HRF [s]: ...
def cnvlTcOld(idxPrc, aryPrfTcChunk, varTr, varNumVol, queOut): """ Old version: Convolution of time courses with one canonical HRF model. """ # Create 'canonical' HRF time course model: vecHrf = funcHrf(varNumVol, varTr) # adjust the ...
def dsort(fname, order, has_header=True, frow=0, ofname=None): r""" Sort file data. :param fname: Name of the comma-separated values file to sort :type fname: FileNameExists_ :param order: Sort order :type order: :ref:`CsvColFilter` :param has_header: Flag that indicates whether the com...
async def main() -> None: """Create the aiohttp session and run the example.""" logging.basicConfig(level=logging.INFO) async with ClientSession() as websession: try: # Create a client: client = Client(websession) # Get user data for the client's latitude/longitu...
def call(cls, method, params=None, timeout=600): """ Makes a Call to the LBRY API :param str method: Method to call from the LBRY API. See the full list of methods at https://lbryio.github.io/lbry/cli/ :param dict params: Parameters to give the method selected :param float time...
def getJobState(self, CorpNum, JobID, UserID=None): """ μˆ˜μ§‘ μƒνƒœ 확인 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ JobID : μž‘μ—…μ•„μ΄λ”” UserID : νŒλΉŒνšŒμ› 아이디 return μˆ˜μ§‘ μƒνƒœ 정보 raise PopbillException """ if JobID == No...
def search(self, CorpNum, JobID, Type, TaxType, PurposeType, TaxRegIDType, TaxRegIDYN, TaxRegID, Page, PerPage, Order, UserID=None): """ μˆ˜μ§‘ κ²°κ³Ό 쑰회 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ JobID : μž‘μ—…μ•„μ΄λ”” Type : λ¬Έμ„œν˜•νƒœ λ°°μ—΄, N-μΌλ°˜μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ, M-μˆ˜μ •μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ ...
def summary(self, CorpNum, JobID, Type, TaxType, PurposeType, TaxRegIDType, TaxRegIDYN, TaxRegID, UserID=None): """ μˆ˜μ§‘ κ²°κ³Ό μš”μ•½μ •λ³΄ 쑰회 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ JobID : μž‘μ—…μ•„μ΄λ”” Type : λ¬Έμ„œν˜•νƒœ λ°°μ—΄, N-μΌλ°˜μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ, M-μˆ˜μ •μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ TaxType : κ³Όμ„Έν˜•νƒœ λ°°μ—΄, T-κ³Όμ„Έ, ...
def getTaxinvoice(self, CorpNum, NTSConfirmNum, UserID=None): """ μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ 상세정보 확인 args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ NTSConfirmNum : κ΅­μ„Έμ²­ 승인번호 UserID : νŒλΉŒνšŒμ› 아이디 return μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ 정보객체 raise PopbillException ...
def getXML(self, CorpNum, NTSConfirmNum, UserID=None): """ μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ 상세정보 확인 - XML args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ NTSConfirmNum : κ΅­μ„Έμ²­ 승인번호 UserID : νŒλΉŒνšŒμ› 아이디 return μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ 정보객체 raise PopbillException ...
def getPopUpURL(self, CorpNum, NTSConfirmNum, UserID=None): """ ν™ˆνƒμŠ€ μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ 보기 νŒμ—… URL args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ NTSConfirmNum : κ΅­μ„Έμ²­ 승인 번호 UserID : νŒλΉŒνšŒμ› 아이디 return μ „μžμ„ΈκΈˆκ³„μ‚°μ„œ 보기 νŒμ—… URL λ°˜ν™˜ raise Popbil...
def make_document(self, titlestring): """ This method may be used to create a new document for writing as xml to the OPS subdirectory of the ePub structure. """ #root = etree.XML('''<?xml version="1.0"?>\ #<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/...
def write_document(self, name, document): """ This function will write a document to an XML file. """ with open(name, 'wb') as out: out.write(etree.tostring(document, encoding='utf-8', pretty_print=True...
def format_date_string(self, date_tuple): """ Receives a date_tuple object, and outputs a string for placement in the article content. """ months = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November',...
def has_out_of_flow_tables(self): """ Returns True if the article has out-of-flow tables, indicates separate tables document. This method is used to indicate whether rendering this article's content will result in the creation of out-of-flow HTML tables. This method has ...
def process(self, article): """ Ingests an Article to create navigation structures and parse global metadata. """ if self.article is not None and not self.collection: log.warning('Could not process additional article. Navigation only \ handles one article unless colle...
def map_navigation(self): """ This is a wrapper for depth-first recursive analysis of the article """ #All articles should have titles title_id = 'titlepage-{0}'.format(self.article_doi) title_label = self.article.publisher.nav_title() title_source = 'main.{0}.xht...
def recursive_article_navmap(self, src_element, depth=0, first=True): """ This function recursively traverses the content of an input article to add the correct elements to the NCX file's navMap and Lists. """ if depth > self.nav_depth: self.nav_depth = depth ...
def render_EPUB2(self, location): """ Creates the NCX specified file for EPUB2 """ def make_navlabel(text): """ Creates and returns a navLabel element with the supplied text. """ navlabel = etree.Element('navLabel') navlabel_te...
def funcGauss1D(x, mu, sig): """ Create 1D Gaussian. Source: http://mathworld.wolfram.com/GaussianFunction.html """ arrOut = np.exp(-np.power((x - mu)/sig, 2.)/2) # normalize # arrOut = arrOut/(np.sqrt(2.*np.pi)*sig) # normalize (laternative) arrOut = arrOut/np.sum(arrOut) return arrO...
def funcGauss2D(varSizeX, varSizeY, varPosX, varPosY, varSd): """ Create 2D Gaussian kernel. Source: http://mathworld.wolfram.com/GaussianFunction.html """ varSizeX = int(varSizeX) varSizeY = int(varSizeY) # aryX and aryY are in reversed order, this seems to be necessary: aryY, aryX = sp....
def funcConvPar(aryDm, vecHrf, varNumVol): """ Function for convolution of pixel-wise 'design matrix' with HRF model. """ # In order to avoid an artefact at the end of the time series, we have to # concatenate an empty array to both the design matrix and the HRF mode...
def simulateAR1(n, beta, sigma, c, burnin, varNumCNR, varNumTP, ): """ Simulates an AR(1) model using the parameters beta, c, and sigma. Returns an array with length n n := number of time poi...
def funcNrlTcMotPred(idxPrc, varPixX, varPixY, NrlMdlChunk, varNumTP, aryBoxCar, # aryCond path, varNumNrlMdls, varNumMtDrctn, var...
def funcFindPrf(idxPrc, aryFuncChnk, aryPrfTc, aryMdls, queOut): """ Function for finding best pRF model for voxel time course. This function should be used if there is only one predictor. """ # Number of voxels to be fitted in this c...
def funcFindPrfMltpPrdXVal(idxPrc, aryFuncChnkTrn, aryFuncChnkTst, aryPrfMdlsTrnConv, aryPrfMdlsTstConv, aryMdls, queOut): """ Function for finding be...
def concatenate( fname1, fname2, dfilter1=None, dfilter2=None, has_header1=True, has_header2=True, frow1=0, frow2=0, ofname=None, ocols=None, ): r""" Concatenate two comma-separated values file. Data rows from the second file are appended at the end of the data rows ...
def move_images_to_cache(source, destination): """ Handles the movement of images to the cache. Must be helpful if it finds that the folder for this article already exists. """ if os.path.isdir(destination): log.debug('Cached images for this article already exist') return else: ...
def explicit_images(images, image_destination, rootname, config): """ The method used to handle an explicitly defined image directory by the user as a parsed argument. """ log.info('Explicit image directory specified: {0}'.format(images)) if '*' in images: images = images.replace('*', ro...
def input_relative_images(input_path, image_destination, rootname, config): """ The method used to handle Input-Relative image inclusion. """ log.debug('Looking for input relative images') input_dirname = os.path.dirname(input_path) for path in config.input_relative_images: if '*' in pat...
def image_cache(article_cache, img_dir): """ The method to be used by get_images() for copying images out of the cache. """ log.debug('Looking for image directory in the cache') if os.path.isdir(article_cache): log.info('Cached image directory found: {0}'.format(article_cache)) shuti...
def get_images(output_directory, explicit, input_path, config, parsed_article): """ Main logic controller for the placement of images into the output directory Controlling logic for placement of the appropriate imager files into the EPUB directory. This function interacts with interface arguments as we...
def make_image_cache(img_cache): """ Initiates the image cache if it does not exist """ log.info('Initiating the image cache at {0}'.format(img_cache)) if not os.path.isdir(img_cache): utils.mkdir_p(img_cache) utils.mkdir_p(os.path.join(img_cache, '10.1371')) utils.mkdir_p(os...
def fetch_frontiers_images(doi, output_dir): """ Fetch the images from Frontiers' website. This method may fail to properly locate all the images and should be avoided if the files can be accessed locally. Downloading the images to an appropriate directory in the cache, or to a directory specified b...
def fetch_plos_images(article_doi, output_dir, document): """ Fetch the images for a PLoS article from the internet. PLoS images are known through the inspection of <graphic> and <inline-graphic> elements. The information in these tags are then parsed into appropriate URLs for downloading. """ ...
def save_tc_to_nii(strCsvCnfg, lgcTest=False, lstRat=None, lgcMdlRsp=False, strPathHrf=None, lgcSaveRam=False): """ Save empirical and fitted time courses to nii file format. Parameters ---------- strCsvCnfg : str Absolute file path of config file used for pRF fitting. ...
def pyprf_sim(strPrior, strStmApr, lgcNoise=False, lgcRtnNrl=True, lstRat=None, lgcTest=False): """ Simulate pRF response given pRF parameters and stimulus apertures. Parameters ---------- strPrior : str Absolute file path of config file used for pRF fitting. strStmApr : s...
def get_nearest_by_numeric_key(data: dict, key: int) -> Any: """Return the dict element whose numeric key is closest to a target.""" return data.get(key, data[min(data.keys(), key=lambda k: abs(k - key))])
def resource(self, uri, methods=frozenset({'GET'}), host=None, strict_slashes=None, stream=False, version=None, name=None, **kwargs): """ Create a blueprint resource route from a decorated function. :param uri: endpoint at which the route will be accessible. ...
def add_resource(self, handler, uri, methods=frozenset({'GET'}), host=None, strict_slashes=None, version=None, name=None, **kwargs): """ Create a blueprint resource route from a function. :param uri: endpoint at which the route will be accessible. ...
def _get_db(): """ Returns the connection to the database using the settings. This function should not be called outside of this file. Use db instead. """ from .settings import settings mongo = settings.MONGODB if 'URI' in mongo and mongo['URI']: uri = mongo['URI'] else: ...
def getBetas(idxPrc, aryPrfTc, lstAllMdlInd, aryFuncChnk, aryBstIndChnk, betaSw, queOut): """Calculate voxel betas and R^2 for the best model. Parameters ---------- idxPrc : TODO (?) aryPrfTc : np.array, shape (?)...
def nav_creators(self, article): """ Frontiers method. Given an Article class instance, this is responsible for returning the names for creators of the article. For our purposes, it is sufficient to list only the authors, returning their name, role=aut, and file-as name. ...
def nav_title(self, article): """ Frontiers method. Given an Article class instance, this will return a string representing the title of the article. This is done for PloS by serializing the text in the Article's """ article_title = article.metadata.front.article...
def format_citation(citation, citation_type=None): """ This method may be built to support elements from different Tag Suite versions with the following tag names: citation, element-citation, mixed-citation, and nlm-citation The citation-type attribute is optional, and may also be empty; if it ...
def plos_doi_to_xmlurl(doi_string): """ Attempts to resolve a PLoS DOI into a URL path to the XML file. """ #Create URL to request DOI resolution from http://dx.doi.org doi_url = 'http://dx.doi.org/{0}'.format(doi_string) log.debug('DOI URL: {0}'.format(doi_url)) #Open the page, follow the r...
def doi_input(doi_string, download=True): """ This method accepts a DOI string and attempts to download the appropriate xml file. If successful, it returns a path to that file. As with all URL input types, the success of this method depends on supporting per-publisher conventions and will fail on un...
def url_input(url_string, download=True): """ This method expects a direct URL link to an xml file. It will apply no modifications to the received URL string, so ensure good input. """ log.debug('URL Input - {0}'.format(url_string)) try: open_xml = urllib.request.urlopen(url_string) ...
def frontiersZipInput(zip_path, output_prefix, download=None): """ This method provides support for Frontiers production using base zipfiles as the input for ePub creation. It expects a valid pathname for one of the two zipfiles, and that both zipfiles are present in the same directory. """ log....
def _red_listing_validation(key, listing): """ Raises an RedValidationError, if the given listing does not comply with cwl_job_listing_schema. If listing is None or an empty list, no exception is thrown. :param key: The input key to build an error message if needed. :param listing: The listing to v...
def red_get_mount_connectors(red_data, ignore_outputs): """ Returns a list of mounting connectors :param red_data: The red data to be searched :param ignore_outputs: If outputs should be ignored :return: A list of connectors with active mount option. """ keys = [] batches = red_data.g...
def cleanup(connector_manager, red_data, tmp_dir): """ Invokes the cleanup functions for all inputs. """ for key, arg in red_data['inputs'].items(): val = arg if isinstance(arg, list): for index, i in enumerate(arg): if not isinstance(i, dict): ...
def _execute_connector(connector_command, top_level_argument, *file_contents, listing=None): """ Executes a connector by executing the given connector_command. The content of args will be the content of the files handed to the connector cli. :param connector_command: The connector comma...
def directory_listing_content_check(directory_path, listing): """ Checks if a given listing is present under the given directory path. :param directory_path: The path to the base directory :param listing: The listing to check :return: None if no errors could be found, otherwise ...
def get_cuda_devices(): """ Imports pycuda at runtime and reads GPU information. :return: A list of available cuda GPUs. """ devices = [] try: import pycuda.autoinit import pycuda.driver as cuda for device_id in range(cuda.Device.count()): vram = cuda.Devic...
def match_gpus(available_devices, requirements): """ Determines sufficient GPUs for the given requirements and returns a list of GPUDevices. If there aren't sufficient GPUs a InsufficientGPUException is thrown. :param available_devices: A list of GPUDevices :param requirements: A list of GPURequire...
def get_gpu_requirements(gpus_reqs): """ Extracts the GPU from a dictionary requirements as list of GPURequirements. :param gpus_reqs: A dictionary {'count': <count>} or a list [{min_vram: <min_vram>}, {min_vram: <min_vram>}, ...] :return: A list of GPURequirements """ requirements = [] if...
def set_nvidia_environment_variables(environment, gpu_ids): """ Updates a dictionary containing environment variables to setup Nvidia-GPUs. :param environment: The environment variables to update :param gpu_ids: A list of GPU ids """ if gpu_ids: nvidia_visible_devices = "" for ...
def is_sufficient(self, device): """ Returns whether the device is sufficient for this requirement. :param device: A GPUDevice instance. :type device: GPUDevice :return: True if the requirement is fulfilled otherwise False """ sufficient = True if (self....
def cache_location(): '''Cross-platform placement of cached files''' plat = platform.platform() log.debug('Platform read as: {0}'.format(plat)) if plat.startswith('Windows'): log.debug('Windows platform detected') return os.path.join(os.environ['APPDATA'], 'OpenAccess_EPUB') elif pla...
def load_config_module(): """ If the config.py file exists, import it as a module. If it does not exist, call sys.exit() with a request to run oaepub configure. """ import imp config_path = config_location() try: config = imp.load_source('config', config_path) except IOError: ...
def evaluate_relative_path(working=os.getcwd(), relative=''): """ This function receives two strings representing system paths. The first is the working directory and it should be an absolute path. The second is the relative path and it should not be absolute. This function will render an OS-appropr...
def get_absolute_path(some_path): """ This function will return an appropriate absolute path for the path it is given. If the input is absolute, it will return unmodified; if the input is relative, it will be rendered as relative to the current working directory. """ if os.path.isabs(some_path):...
def get_output_directory(args): """ Determination of the directory for output placement involves possibilities for explicit user instruction (absolute path or relative to execution) and implicit default configuration (absolute path or relative to input) from the system global configuration file. Thi...
def file_root_name(name): """ Returns the root name of a file from a full file path. It will not raise an error if the result is empty, but an warning will be issued. """ base = os.path.basename(name) root = os.path.splitext(base)[0] if not root: warning = 'file_root_name return...
def files_with_ext(extension, directory='.', recursive=False): """ Generator function that will iterate over all files in the specified directory and return a path to the files which possess a matching extension. You should include the period in your extension, and matching is not case sensitive: '...
def epubcheck(epubname, config=None): """ This method takes the name of an epub file as an argument. This name is the input for the java execution of a locally installed epubcheck-.jar. The location of this .jar file is configured in config.py. """ if config is None: config = load_config...
def dir_exists(directory): """ If a directory already exists that will be overwritten by some action, this will ask the user whether or not to continue with the deletion. If the user responds affirmatively, then the directory will be removed. If the user responds negatively, then the process will a...
def get_nearest_by_coordinates( data: list, latitude_key: str, longitude_key: str, target_latitude: float, target_longitude: float) -> Any: """Get the closest dict entry based on latitude/longitude.""" return min( data, key=lambda p: haversine( target_latitude, ...
def haversine(lat1: float, lon1: float, lat2: float, lon2: float) -> float: """Determine the distance between two latitude/longitude pairs.""" lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2]) # haversine formula dlon = lon2 - lon1 dlat = lat2 - lat1 calc_a = sin(dlat / 2)**2 + co...
def in_file(self, fn: str) -> Iterator[InsertionPoint]: """ Returns an iterator over all of the insertion points in a given file. """ logger.debug("finding insertion points in file: %s", fn) yield from self.__file_insertions.get(fn, [])
def at_line(self, line: FileLine) -> Iterator[InsertionPoint]: """ Returns an iterator over all of the insertion points located at a given line. """ logger.debug("finding insertion points at line: %s", str(line)) filename = line.filename # type: str line_num = li...
def getUnitCost(self, CorpNum): """ νœ΄νμ—…μ‘°νšŒ 단가 확인. args CorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ return λ°œν–‰λ‹¨κ°€ by float raise PopbillException """ result = self._httpget('/CloseDown/UnitCost', CorpNum) return float(result.unit...
def checkCorpNum(self, MemberCorpNum, CheckCorpNum): """ νœ΄νμ—…μ‘°νšŒ - 단건 args MemberCorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ CorpNum : μ‘°νšŒν•  μ‚¬μ—…μžλ²ˆν˜Έ MgtKey : λ¬Έμ„œκ΄€λ¦¬λ²ˆν˜Έ return νœ΄νμ—…μ •λ³΄ object raise PopbillException """ ...
def checkCorpNums(self, MemberCorpNum, CorpNumList): """ νœ΄νμ—…μ‘°νšŒ λŒ€λŸ‰ 확인, μ΅œλŒ€ 1000건 args MemberCorpNum : νŒλΉŒνšŒμ› μ‚¬μ—…μžλ²ˆν˜Έ CorpNumList : μ‘°νšŒν•  μ‚¬μ—…μžλ²ˆν˜Έ λ°°μ—΄ return νœ΄νμ—…μ •λ³΄ Object as List raise PopbillException """ if ...
def loadPng(varNumVol, tplPngSize, strPathPng): """Load PNG files. Parameters ---------- varNumVol : float Number of volumes, i.e. number of time points in all runs. tplPngSize : tuple Shape of the stimulus image (i.e. png). strPathPng: str Path to the folder cointaining...
def loadPrsOrd(vecRunLngth, strPathPresOrd, vecVslStim): """Load presentation order of motion directions. Parameters ---------- vecRunLngth : list Number of volumes in every run strPathPresOrd : str Path to the npy vector containing order of presented motion directions. vecVslSt...
def crtPwBoxCarFn(varNumVol, aryPngData, aryPresOrd, vecMtDrctn): """Create pixel-wise boxcar functions. Parameters ---------- input1 : 2d numpy array, shape [n_samples, n_measurements] Description of input 1. input2 : float, positive Description of input 2. Returns ------- ...
def crtGauss2D(varSizeX, varSizeY, varPosX, varPosY, varSd): """Create 2D Gaussian kernel. Parameters ---------- varSizeX : int, positive Width of the visual field. varSizeY : int, positive Height of the visual field.. varPosX : int, positive X position of centre of 2D G...
def cnvlGauss2D(idxPrc, aryBoxCar, aryMdlParamsChnk, tplPngSize, varNumVol, queOut): """Spatially convolve boxcar functions with 2D Gaussian. Parameters ---------- idxPrc : 2d numpy array, shape [n_samples, n_measurements] Description of input 1. aryBoxCar : float, positive ...