output
stringlengths
1
928k
instruction
stringlengths
7
928k
system
stringlengths
0
104k
Convert the list elements to XML.
Given the following Python 3 function, write the documentation def convert_list_elements(self): #I have yet to gather many examples of this element, and may have to #write a recursive method for the processing of lists depending on how #PLoS produces their XML, for now this method is ignorant of...
You are a Python code architect, reviewing and designing scalable and efficient code
This method converts the XML elements in the def - list element to a list of elements which are in turn of two parts.
Can you generate the documentation for the following Python 3 function def convert_def_list_elements(self): for def_list in self.main.getroot().findall('.//def-list'): #Remove the attributes, excepting id remove_all_attributes(def_list, exclude=['id']) #Modify the def-list el...
You are a Python code analyst, evaluating scripts for potential improvements.
Convert all the ref - list elements in the article to the appropriate format.
Can you generate a brief explanation for the following Python 3 code def convert_ref_list_elements(self): #TODO: Handle nested ref-lists for ref_list in self.main.getroot().findall('.//ref-list'): remove_all_attributes(ref_list) ref_list.tag = 'div' ref_list.attrib['c...
You are a Python code generator, capable of creating scripts from specifications.
def convert_table_wrap_elements(self): """ Responsible for the correct conversion of JPTS 3.0 <table-wrap> elements to EPUB content. The 'id' attribute is treated as mandatory by this method. """ for table_wrap in self.main.getroot().findall('.//table-wrap'): ...
Can you create a Python 3 function that converts JPTS 3. 0 <table - wrap > elements to EPUB content.
You are a Python code architect, reviewing and designing scalable and efficient code
def convert_graphic_elements(self): """ This is a method for the odd special cases where <graphic> elements are standalone, or rather, not a part of a standard graphical element such as a figure or a table. This method should always be employed after the standard cases have alrea...
Can you create a Python 3 function that converts all graphic elements in the main XML file into a single image.
As a python code expert, you are capable of creating scripts from specifications.
과금정보 확인 args CorpNum : 회원 사업자번호 MsgType : 문자전송 유형 UserID : 팝빌 회원아이디 return 과금정보 객체 raise PopbillException
Here you have a function in Python 3, explain what it does def getChargeInfo(self, CorpNum, MsgType, UserID=None): if MsgType == None or MsgType == "": raise PopbillException(-99999999, "전송유형이 입력되지 않았습니다.") return self._httpget('/Message/ChargeInfo?Type=' + MsgType, CorpNum, UserID)
You are a Python code architect, reviewing and designing scalable and efficient code
멀티 문자메시지 다량 전송 args CorpNum : 팝빌회원 사업자번호 Sender : 발신자번호 (동보전송용) Subject : 장문 메시지 제목 (동보전송용) Contents : 장문 문자 내용 (동보전송용) Messages : 개별전송정보 배열 FilePath : 전송하고자 하는 파일 경로 reserveDT : 예약전송시간 (형...
Make a summary of the following Python 3 code def sendMMS_Multi(self, CorpNum, Sender, Subject, Contents, Messages, FilePath, reserveDT, adsYN=False, UserID=None, RequestNum=None): """ 멀티 문자메시지 다량 전송 args CorpNum : 팝빌회원 사업자번호 Sender : 발신자번호 ...
As a Python code composer, you craft elegant and concise scripts.
문자 메시지 전송 args MsgType : 문자 전송 유형(단문:SMS, 장문:LMS, 단/장문:XMS) CorpNum : 팝빌회원 사업자번호 Sender : 발신자번호 (동보전송용) Subject : 장문 메시지 제목 (동보전송용) Contents : 장문 문자 내용 (동보전송용) Messages : 개별전송정보 배열 reserve...
Here you have a function in Python 3, explain what it does def sendMessage(self, MsgType, CorpNum, Sender, SenderName, Subject, Contents, Messages, reserveDT, adsYN=False, UserID=None, RequestNum=None): """ 문자 메시지 전송 args MsgType : 문자 전송 유형(단문:SMS, 장문:LMS, 단/장...
You are a Python code architect, reviewing and designing scalable and efficient code
def cancelReserveRN(self, CorpNum, RequestNum, UserID=None): """ 문자 예약전송 취소 args CorpNum : 팝빌회원 사업자번호 RequestNum : 전송요청시 할당한 전송요청번호 UserID : 팝빌회원 아이디 return 처리결과. consist of code and message raise ...
Write a Python 3 script for canceling a reserve request.
You are a Python code architect, reviewing and designing scalable and efficient code
문자 관련 팝빌 URL args CorpNum : 팝빌회원 사업자번호 UserID : 팝빌회원 아이디 TOGO : BOX (전송내역조회 팝업) return 팝빌 URL raise PopbillException
Here you have a function in Python 3, explain what it does def getURL(self, CorpNum, UserID, ToGo): if ToGo == None or ToGo == '': raise PopbillException(-99999999, "TOGO값이 입력되지 않았습니다.") result = self._httpget('/Message/?TG=' + ToGo, CorpNum, UserID) return result.url
You are a Python code analyst, evaluating scripts for potential improvements.
전송내역 요약정보 확인 args CorpNum : 팝빌회원 사업자번호 reciptNumList : 문자전송 접수번호 배열 UserID : 팝빌회원 아이디 return 전송정보 as list raise PopbillException
Given the following Python 3 function, write the documentation def getStates(self, Corpnum, reciptNumList, UserID=None): if reciptNumList == None or len(reciptNumList) < 1: raise PopbillException(-99999999, "접수번호가 입력되지 않았습니다.") postData = self._stringtify(reciptNumList) retur...
You are a Python code analyst, evaluating scripts for potential improvements.
Create 1D Gaussian. Source : http://mathworld. wolfram. com / GaussianFunction. html
Can you tell what is the following Python 3 function doing def funcGauss1D(x, mu, sig): arrOut = np.exp(-np.power((x - mu)/sig, 2.)/2) # normalize arrOut = arrOut/(np.sqrt(2.*np.pi)*sig) return arrOut
As a Python code translator, you convert algorithms and pseudocode into Python.
Convert user_path to absolute path.
Can you generate a brief explanation for the following Python 3 code def absolute_path(user_path): if os.path.abspath(user_path): return unix_path_coercion(user_path) else: try: openaccess_epub.utils.evaluate_relative_path(relative=user_path) except: raise Validat...
You are a Python code analyst, evaluating scripts for potential improvements.
def configure(default=None, dev=None): """ The inner control loops for user interaction during quickstart configuration. """ cache_loc = openaccess_epub.utils.cache_location() config_loc = openaccess_epub.utils.config_location() #Make the cache directory openaccess_epub.utils.mkdir_p(ca...
Write a Python 3 script for configuring the quickstart base control loops for user interaction during quickstart configuration.
As a Python code translator, you convert algorithms and pseudocode into Python.
Check if a MgtKey is in the list of items in the CorpNum.
Here you have a function in Python 3, explain what it does def checkMgtKeyInUse(self, CorpNum, MgtKeyType, MgtKey): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillException(-9999999...
You are a Python code generator, capable of creating scripts from specifications.
def register(self, CorpNum, taxinvoice, writeSpecification=False, UserID=None): """ 임시저장 args CorpNum : 회원 사업자 번호 taxinvoice : 등록할 세금계산서 object. Made with Taxinvoice(...) writeSpecification : 등록시 거래명세서 동시 작성 여부 UserID : 팝빌 회원아이디 ...
Implement a function in Python 3 to register a new Taxinvoice.
As a Python code analyst, you investigate and solve complex coding mysteries
Update a Taxinvoice in the given CorpNum.
Here you have a function in Python 3, explain what it does def update(self, CorpNum, MgtKeyType, MgtKey, taxinvoice, writeSpecification=False, UserID=None): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": ...
You are a Python code analyst, evaluating scripts for potential improvements.
Get information about a particular Tax item.
Given the following Python 3 function, write the documentation def getInfo(self, CorpNum, MgtKeyType, MgtKey): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillException(-99999999, "관...
You are a Python code analyst, evaluating scripts for potential improvements.
Get the details of a particular Tax item.
How would you explain what the following Python 3 function does def getDetailInfo(self, CorpNum, MgtKeyType, MgtKey): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillException(-99999...
As a Python code composer, you craft elegant and concise scripts.
Delete a Tax entry.
Given the following Python 3 function, write the documentation def delete(self, CorpNum, MgtKeyType, MgtKey, UserID=None): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillException(-...
You are a Python code generator, capable of creating scripts from specifications.
def send(self, CorpNum, MgtKeyType, MgtKey, Memo=None, EmailSubject=None, UserID=None): """ 승인요청 args CorpNum : 회원 사업자 번호 MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE'] MgtKey : 파트너 관리번호 Memo : 처리 메모 UserID : 팝빌 회원...
Write a Python 3 script for sending an email to a tax invoice.
As a Python code composer, you craft elegant and concise scripts.
승인요청 취소 args CorpNum : 회원 사업자 번호 MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE'] MgtKey : 파트너 관리번호 Memo : 처리 메모 UserID : 팝빌 회원아이디 return 처리결과. consist of code and message raise ...
Explain what the following Python 3 code does def cancelSend(self, CorpNum, MgtKeyType, MgtKey, Memo=None, UserID=None): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillException(-99...
You are a Python code architect, reviewing and designing scalable and efficient code
def issue(self, CorpNum, MgtKeyType, MgtKey, Memo=None, EmailSubject=None, ForceIssue=False, UserID=None): """ 발행 args CorpNum : 회원 사업자 번호 MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE'] MgtKey : 파트너 관리번호 Memo : 처리 메모 ...
Can you write a function in Python 3 where it issues a new message in the specified MgtKey.
As a Python code composer, you craft elegant and concise scripts.
국세청 즉시전송 args CorpNum : 회원 사업자 번호 MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE'] MgtKey : 파트너 관리번호 UserID : 팝빌 회원아이디 return 처리결과. consist of code and message raise PopbillException
Can you generate a brief explanation for the following Python 3 code def sendToNTS(self, CorpNum, MgtKeyType, MgtKey, UserID=None): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillEx...
As a Python code translator, you convert algorithms and pseudocode into Python.
첨부파일 목록 확인 args CorpNum : 회원 사업자 번호 MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE'] MgtKey : 파트너 관리번호 return 첩부파일 정보 목록 as List raise PopbillException
Explain what the following Python 3 code does def getFiles(self, CorpNum, MgtKeyType, MgtKey): if MgtKeyType not in self.__MgtKeyTypes: raise PopbillException(-99999999, "관리번호 형태가 올바르지 않습니다.") if MgtKey == None or MgtKey == "": raise PopbillException(-99999999, "관리번호가 입력되지 않았습니다....
As a Python code composer, you craft elegant and concise scripts.
def deleteFile(self, CorpNum, MgtKeyType, MgtKey, FileID, UserID=None): """ 첨부파일 삭제 args CorpNum : 회원 사업자 번호 MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE'] MgtKey : 파트너 관리번호 UserID : 팝빌 회원아이디 return 처리결...
Write a Python 3 script for deleting a file from a Taxinvoice.
You are a Python code analyst, evaluating scripts for potential improvements.
Get the URL of a particular Tax item.
Here you have a function in Python 3, explain what it does def getMassPrintURL(self, CorpNum, MgtKeyType, MgtKeyList, UserID=None): if MgtKeyList == None or len(MgtKeyList) < 1: raise PopbillException(-99999999, "관리번호가 입력되지 않았습니다.") postData = self._stringtify(MgtKeyList) Result = ...
As a Python code analyst, you investigate and solve complex coding mysteries
목록 조회 args CorpNum : 팝빌회원 사업자번호 MgtKeyType : 세금계산서유형, SELL-매출, BUY-매입, TRUSTEE-위수탁 DType : 일자유형, R-등록일시, W-작성일자, I-발행일시 중 택 1 SDate : 시작일자, 표시형식(yyyyMMdd) EDate : 종료일자, 표시형식(yyyyMMdd) State : 상태코드, 2,3번째 자리에 와일드카...
Make a summary of the following Python 3 code def search(self, CorpNum, MgtKeyType, DType, SDate, EDate, State, Type, TaxType, LateOnly, TaxRegIDYN, TaxRegIDType, TaxRegID, Page, PerPage, Order, UserID=None, QString=None, InterOPYN=None, IssueType=None): """ 목록 조회 args ...
You are a Python code analyst, evaluating scripts for potential improvements.
def attachStatement(self, CorpNum, MgtKeyType, MgtKey, ItemCode, StmtMgtKey, UserID=None): """ 전자명세서 첨부 args CorpNum : 팝빌회원 사업자번호 MgtKeyType : 세금계산서 유형, SELL-매출, BUY-매입, TRUSTEE-위수탁 MgtKey : 세금계산서 문서관리번호 StmtCode : 명세서 종류코드, 121-명세서, 12...
Create a Python 3 function for attaching a statement to a CorpNum.
You are a Python code architect, reviewing and designing scalable and efficient code
Assign a new MgtKey to a CorpNum.
How would you explain what the following Python 3 function does def assignMgtKey(self, CorpNum, MgtKeyType, ItemKey, MgtKey, UserID=None): if MgtKeyType == None or MgtKeyType == '': raise PopbillException(-99999999, "세금계산서 발행유형이 입력되지 않았습니다.") if ItemKey == None or ItemKey == '': ...
As a Python code composer, you craft elegant and concise scripts.
Get the URL of the Seal.
Explain what the following Python 3 code does def getSealURL(self, CorpNum, UserID): result = self._httpget('/?TG=SEAL', CorpNum, UserID) return result.url
You are a Python code generator, capable of creating scripts from specifications.
def getTaxCertURL(self, CorpNum, UserID): """ 공인인증서 등록 URL args CorpNum : 회원 사업자번호 UserID : 회원 팝빌아이디 return 30초 보안 토큰을 포함한 url raise PopbillException """ result = self._httpget('/?TG=CERT', CorpN...
Create a Python 3 function for getting Tax Cert URL.
As a python code expert, you are capable of creating scripts from specifications.
Returns the function that encloses a given location.
Can you tell what is the following Python 3 function doing def encloses(self, location: FileLocation ) -> Optional[FunctionDesc]: """ Returns the function, if any, that encloses a given location. """ for func in self.in_file(location.filename): ...
You are a Python code generator, capable of creating scripts from specifications.
def in_file(self, filename: str) -> Iterator[FunctionDesc]: """ Returns an iterator over all of the functions definitions that are contained within a given file. """ yield from self.__filename_to_functions.get(filename, [])
Write a Python 3 function that can return an iterator over all functions that are contained within a given file.
You are a Python code analyst, evaluating scripts for potential improvements.
def model_creation_opt(dicCnfg, aryMdlParams, strPathHrf=None, varRat=None, lgcPrint=True): """ Create or load pRF model time courses. Parameters ---------- dicCnfg : dict Dictionary containing config parameters. aryMdlParams : numpy arrays x, y and sigma ...
Write a Python 3 function for creating or load pRF model time courses.
You are a Python code analyst, evaluating scripts for potential improvements.
returns the entry text of the specified date
Make a summary of the following Python 3 code def get_entry(journal_location, date): if not isinstance(date, datetime.date): return None try: with open(build_journal_path(journal_location, date), "r") as entry_file: return entry_file.read() except IOError: return None
You are a Python code analyst, evaluating scripts for potential improvements.
def spmt(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp=1, p_u_ratio=6): """Normalized SPM HRF function from sum of two gamma PDFs Parameters ---------- t : array-like vector of times at which to sample HRF Returns ------- hrf : array vector length ``len(...
Can you write a function in Python 3 where it normalizes SPM HRF function from sum of two gamma PDFs Parameters ---------- t : array-like vector of times at which to sample HRF Returns ------- hrf : array vector length ``len(t)`` of samples from HRF at times `t` Notes ----- [1] This is the canonical HRF function as use...
As a Python code analyst, you investigate and solve complex coding mysteries
def ddspmt(t, peak_delay=6, under_delay=16, peak_disp=1, under_disp=1, p_u_ratio=6): """ SPM canonical HRF dispersion derivative, values for time values `t` Parameters ---------- t : array-like vector of times at which to sample HRF Returns ------- hrf : array ve...
Write a Python 3 function that can compute the canonical HRF dispersion derivative function for the given time values t.
You are a Python code generator, capable of creating scripts from specifications.
Create a boxcar for the given set of conditions.
Can you tell what is the following Python 3 function doing def create_boxcar(aryCnd, aryOns, aryDrt, varTr, varNumVol, aryExclCnd=None, varTmpOvsmpl=1000.): """ Creation of condition time courses in temporally upsampled space. Parameters ---------- aryCnd : np.array 1D ar...
You are a Python code architect, reviewing and designing scalable and efficient code
Convolution of time courses with HRF model.
Can you generate the documentation for the following Python 3 function def cnvl_tc(idxPrc, aryPrfTcChunk, lstHrf, varTr, varNumVol, varTmpOvsmpl, queOut, varHrfLen=32., dctPrm=None): """Convolution of time courses with HRF model. Parameters ---------- idxPrc : int, positive Process ...
As a Python code analyst, you investigate and solve complex coding mysteries
Creates a dictionary with the summarized information in job_data input_files and input_directories.
Here you have a function in Python 3, explain what it does def create_inputs_to_reference(job_data, input_files, input_directories): return {**deepcopy(job_data), **deepcopy(input_files), **deepcopy(input_directories)}
You are a Python code analyst, evaluating scripts for potential improvements.
def _partition_all_internal(s, sep): """ Uses str.partition() to split every occurrence of sep in s. The returned list does not contain empty strings. :param s: The string to split. :param sep: A separator string. :return: A list of parts split by sep """ parts = list(s.partition(sep)) ...
Write a Python 3 script to use str.partition() to split every occurrence of sep in s. The returned list does not contain empty strings. :param s: The string to split. :param sep: A separator string. :return: A list of parts split by sep
As a python code expert, you are capable of creating scripts from specifications.
def partition_all(s, sep): """ Uses str.partition() to split every occurrence of sep in s. The returned list does not contain empty strings. If sep is a list, all separators are evaluated. :param s: The string to split. :param sep: A separator string or a list of separator strings. :return: A l...
Implement a function in Python 3 to use str. partition to split every occurrence of sep in s.
You are a Python code analyst, evaluating scripts for potential improvements.
def split_input_references(to_split): """ Returns the given string in normal strings and unresolved input references. An input reference is identified as something of the following form $(...). Example: split_input_reference("a$(b)cde()$(fg)") == ["a", "$(b)", "cde()", "$(fg)"] :param to_split...
Create a Python 3 function to split a string into normal strings and unresolved input references.
You are a Python code analyst, evaluating scripts for potential improvements.
def split_all(reference, sep): """ Splits a given string at a given separator or list of separators. :param reference: The reference to split. :param sep: Separator string or list of separator strings. :return: A list of split strings """ parts = partition_all(reference, sep) return [p ...
Implement a function in Python 3 to split a given string at a given separator or list of separators.
As a Python code composer, you craft elegant and concise scripts.
def _resolve_file(attributes, input_file, input_identifier, input_reference): """ Returns the attributes in demand of the input file. :param attributes: A list of attributes to get from the input_file. :param input_file: The file from which to get the attributes. :param input_identifier: The input ...
Can you implement a function in Python 3 that resolves the file attributes in demand of the input file.
As a Python code translator, you convert algorithms and pseudocode into Python.
Resolves the attributes in demand of the input directory.
Given the following Python 3 function, write the documentation def _resolve_directory(attributes, input_directory, input_identifier, input_reference): if input_directory['isArray']: raise InvalidInputReference('Input References to Arrays of input directories are currently not supported.\n' ...
You are a Python code generator, capable of creating scripts from specifications.
Resolves a given input reference by a string extracted from inputs_to_reference.
How would you explain what the following Python 3 function does def resolve_input_reference(reference, inputs_to_reference): if not reference.startswith('{}inputs.'.format(INPUT_REFERENCE_START)): raise InvalidInputReference('An input reference must have the following form' ...
As a Python code composer, you craft elegant and concise scripts.
def resolve_input_references(to_resolve, inputs_to_reference): """ Resolves input references given in the string to_resolve by using the inputs_to_reference. See http://www.commonwl.org/user_guide/06-params/index.html for more information. Example: "$(inputs.my_file.nameroot).md" -> "filename.md" ...
Write a Python 3 function that can resolve input references given in the string to_resolve by using inputs_to_reference.
You are a Python code analyst, evaluating scripts for potential improvements.
Returns a dictionnary containing all the passed data and an item which holds the result of validation errors.
Can you tell what is the following Python 3 function doing def data(self): res = {'error_list': self.error_list} res.update(super(ValidationErrors, self).data) return res
As a python code expert, you are capable of creating scripts from specifications.
def circDiff(length, ary1, ary2): """calculate the circular difference between two paired arrays. This function will return the difference between pairs of numbers; however the difference that is output will be minimal in the sense that if we assume an array with length = 4: [0, 1, 2, 3], the difference...
Write a Python 3 function that can calculate the circular difference between two arrays
As a python code expert, you are capable of creating scripts from specifications.
팝빌 회원 잔여포인트 확인 args CorpNum : 팝빌회원 사업자번호 TOGO : "CHRG" return URL raise PopbillException
Make a summary of the following Python 3 code def getPartnerURL(self, CorpNum, TOGO): try: return linkhub.getPartnerURL(self._getToken(CorpNum), TOGO) except LinkhubException as LE: raise PopbillException(LE.code, LE.message)
As a python code expert, you are capable of creating scripts from specifications.
팝빌 로그인 URL args CorpNum : 회원 사업자번호 UserID : 회원 팝빌아이디 return 30초 보안 토큰을 포함한 url raise PopbillException
Given the following Python 3 function, write the documentation def getAccessURL(self, CorpNum, UserID): result = self._httpget('/?TG=LOGIN', CorpNum, UserID) return result.url
You are a Python code analyst, evaluating scripts for potential improvements.
팝빌 연동회원 포인트 충전 URL args CorpNum : 회원 사업자번호 UserID : 회원 팝빌아이디 return 30초 보안 토큰을 포함한 url raise PopbillException
Here you have a function in Python 3, explain what it does def getChargeURL(self, CorpNum, UserID): result = self._httpget('/?TG=CHRG', CorpNum, UserID) return result.url
As a python code expert, you are capable of creating scripts from specifications.
Check if a user is a member of the room.
Given the following Python 3 function, write the documentation def checkIsMember(self, CorpNum): if CorpNum == None or CorpNum == '': raise PopbillException(-99999999, "사업자번호가 입력되지 않았습니다.") return self._httpget('/Join?CorpNum=' + CorpNum + '&LID=' + self.__linkID, None, None)
You are a Python code analyst, evaluating scripts for potential improvements.
전용 정보 팝빌 회원가입 정보.
Can you generate a brief explanation for the following Python 3 code def joinMember(self, JoinInfo): JoinInfo.LinkID = self.__linkID postData = self._stringtify(JoinInfo) return self._httppost('/Join', postData)
As a Python code translator, you convert algorithms and pseudocode into Python.
registContact - Regist a new contact
Can you tell what is the following Python 3 function doing def registContact(self, CorpNum, ContactInfo, UserID=None): postData = self._stringtify(ContactInfo) return self._httppost('/IDs/New', postData, CorpNum, UserID)
As a Python code translator, you convert algorithms and pseudocode into Python.
Validate a string into a Django template.
Given the following Python 3 function, write the documentation def TemplateValidator(value): try: Template(value) except Exception as e: raise ValidationError( _("Cannot compile template (%(exception)s)"), params={"exception": e} )
As a Python code analyst, you investigate and solve complex coding mysteries
r Merge two comma - separated values files into one.
Given the following Python 3 function, write the documentation def merge( fname1, fname2, dfilter1=None, dfilter2=None, has_header1=True, has_header2=True, frow1=0, frow2=0, ofname=None, ocols=None, ): r""" Merge two comma-separated values files. Data columns from th...
You are a Python code architect, reviewing and designing scalable and efficient code
Function for optimizing given pRF paramaters using brute - force grid search.
Here you have a function in Python 3, explain what it does def pyprf_opt_brute(strCsvCnfg, objNspc, lgcTest=False, strPathHrf=None, varRat=None): """ Function for optimizing given pRF paramaters using brute-force grid search. Parameters ---------- strCsvCnfg : str Absolu...
As a Python code analyst, you investigate and solve complex coding mysteries
Scrapes the given URL to obtain the documentation for the LBRY API and returns the contents as JSON
Can you generate the documentation for the following Python 3 function def get_lbry_api_function_docs(url=LBRY_API_RAW_JSON_URL): try: # Grab the page content docs_page = urlopen(url) # Read the contents of the actual url we grabbed and decode them into UTF-8 contents = docs_page.r...
As a Python code composer, you craft elegant and concise scripts.
Generates the body for the given function and returns the string containing the function definition
Can you generate a brief explanation for the following Python 3 code def generate_method_definition(func): indent = 4 # initial definition method_definition = (" " * indent) + "def " + func["name"] # Here we just create a queue and put all the parameters # into the queue in the order that they wer...
You are a Python code generator, capable of creating scripts from specifications.
Generates the actual functions for lbryd_api. py based on the given url and writes the generated file to write_file.
Given the following Python 3 function, write the documentation def generate_lbryd_wrapper(url=LBRY_API_RAW_JSON_URL, read_file=__LBRYD_BASE_FPATH__, write_file=LBRYD_FPATH): functions = get_lbry_api_function_docs(url) # Open the actual file for appending with open(write_file, 'w') as lbry_file: l...
As a Python code translator, you convert algorithms and pseudocode into Python.
def load_nii(strPathIn, varSzeThr=5000.0): """ Load nii file. Parameters ---------- strPathIn : str Path to nii file to load. varSzeThr : float If the nii file is larger than this threshold (in MB), the file is loaded volume-by-volume in order to prevent memory overflow....
Write a Python 3 script for loading nii file and return array containing nii data.
As a python code expert, you are capable of creating scripts from specifications.
def load_res_prm(lstFunc, lstFlsMsk=None): """Load result parameters from multiple nii files, with optional mask. Parameters ---------- lstFunc : list, list of str with file names of 3D or 4D nii files lstFlsMsk : list, optional list of str with paths to 3D nii files that can act as...
Can you implement a function in Python 3 that loads result parameters from multiple nii files with optional mask.
As a python code expert, you are capable of creating scripts from specifications.
def export_nii(ary2dNii, lstNiiNames, aryLgcMsk, aryLgcVar, tplNiiShp, aryAff, hdrMsk, outFormat='3D'): """ Export nii file(s). Parameters ---------- ary2dNii : numpy array Numpy array with results to be exported to nii. lstNiiNames : list List that contains strin...
Write a Python 3 function for exporting nii file(s). Parameters ---------- ary2dNii : numpy array Numpy array with results to be exported to nii. lstNiiNames : list List that contains strings with the complete file names. aryLgcMsk : numpy array If the nii file is larger than this threshold (in MB), the file is loaded ...
You are a Python code analyst, evaluating scripts for potential improvements.
def joinRes(lstPrfRes, varPar, idxPos, inFormat='1D'): """Join results from different processing units (here cores). Parameters ---------- lstPrfRes : list Output of results from parallelization. varPar : integer, positive Number of cores that were used during parallelization id...
How would you code a function in Python 3 to join results from different processing units.
You are a Python code architect, reviewing and designing scalable and efficient code
Compare results for different exponents and create winner nii.
Explain what the following Python 3 code does def cmp_res_R2(lstRat, lstNiiNames, strPathOut, strPathMdl, lgcSveMdlTc=True, lgcDel=False, strNmeExt=''): """"Compare results for different exponents and create winner nii. Parameters ---------- lstRat : list List of floats containin...
You are a Python code analyst, evaluating scripts for potential improvements.
Remap coordinates from cartesian to polar
Can you generate a brief explanation for the following Python 3 code def map_crt_to_pol(aryXCrds, aryYrds): aryRad = np.sqrt(aryXCrds**2+aryYrds**2) aryTht = np.arctan2(aryYrds, aryXCrds) return aryTht, aryRad
You are a Python code generator, capable of creating scripts from specifications.
def find_near_pol_ang(aryEmpPlrAng, aryExpPlrAng): """Return index of nearest expected polar angle. Parameters ---------- aryEmpPlrAng : 1D numpy array Empirically found polar angle estimates aryExpPlrAng : 1D numpy array Theoretically expected polar angle estimates Returns ...
Write a Python 3 script for returning index of nearest expected polar angle.
You are a Python code analyst, evaluating scripts for potential improvements.
Remap values in an array from one range to another.
Here you have a function in Python 3, explain what it does def rmp_rng(aryVls, varNewMin, varNewMax, varOldThrMin=None, varOldAbsMax=None): """Remap values in an array from one range to another. Parameters ---------- aryVls : 1D numpy array Array with values that need to be remapped...
You are a Python code generator, capable of creating scripts from specifications.
def process(self, checksum, revision=None): """ Process a new revision and detect a revert if it occurred. Note that you can pass whatever you like as `revision` and it will be returned in the case that a revert occurs. :Parameters: checksum : str An...
Can you implement a function in Python 3 that processes a new revision and detect a revert if it occurred.
You are a Python code generator, capable of creating scripts from specifications.
def funcSmthSpt(aryFuncChnk, varSdSmthSpt): """Apply spatial smoothing to the input data. Parameters ---------- aryFuncChnk : np.array TODO varSdSmthSpt : float (?) Extent of smoothing. Returns ------- aryFuncChnk : np.array Smoothed data. """ varNdim = a...
Create a Python 3 function to apply spatial smoothing to the input data.
As a Python code translator, you convert algorithms and pseudocode into Python.
Apply temporal smoothing to fMRI data & pRF time course models.
Make a summary of the following Python 3 code def funcSmthTmp(aryFuncChnk, varSdSmthTmp): # For the filtering to perform well at the ends of the time series, we # set the method to 'nearest' and place a volume with mean intensity # (over time) at the beginning and at the end. aryFuncChnkMean = np.mean(a...
As a python code expert, you are capable of creating scripts from specifications.
Prepare pRF time courses and pRF model time courses.
Can you tell what is the following Python 3 function doing def prep_models(aryPrfTc, varSdSmthTmp=2.0, lgcPrint=True): if lgcPrint: print('------Prepare pRF time course models') # Define temporal smoothing of pRF time course models def funcSmthTmp(aryPrfTc, varSdSmthTmp, lgcPrint=True): """...
As a python code expert, you are capable of creating scripts from specifications.
def prep_func(strPathNiiMask, lstPathNiiFunc, varAvgThr=100., varVarThr=0.0001, strPrePro='demean'): """ Load & prepare functional data. Parameters ---------- strPathNiiMask: str Path to mask used to restrict pRF model finding. Only voxels with a value greater than zer...
Implement a function in Python 3 to load & prepare functional data for a specific nii file.
You are a Python code analyst, evaluating scripts for potential improvements.
what s the value of a style at the current stack level
Make a summary of the following Python 3 code def get(self,style): level = len(self.stack) -1 while level >= 0: if style in self.stack[level]: return self.stack[level][style] else: level = level - 1 return None
As a Python code analyst, you investigate and solve complex coding mysteries
converts a value to the attribute s type
Here you have a function in Python 3, explain what it does def enforce_type(self, attr, val): if not attr in self.types: return utfstr(val) elif self.types[attr] == 'int': return int(float(val)) elif self.types[attr] == 'float': return float(val) else:...
You are a Python code generator, capable of creating scripts from specifications.
def push(self, style={}): """push a new level on the stack with a style dictionnary containing style:value pairs""" _style = {} for attr in style: if attr in self.cmds and not style[attr] in self.cmds[attr]: print 'WARNING: ESC/POS PRINTING: ignoring invalid value: '+...
Write a Python 3 function that can push a new level on the stack with a style dictionnary containing style : value pairs
As a Python code composer, you craft elegant and concise scripts.
overrides style values at the current stack level
How would you explain what the following Python 3 function does def set(self, style={}): _style = {} for attr in style: if attr in self.cmds and not style[attr] in self.cmds[attr]: print 'WARNING: ESC/POS PRINTING: ignoring invalid value: '+utfstr(style[attr])+' for style: '+...
You are a Python code architect, reviewing and designing scalable and efficient code
def to_escpos(self): """ converts the current style to an escpos command string """ cmd = '' ordered_cmds = self.cmds.keys() ordered_cmds.sort(lambda x,y: cmp(self.cmds[x]['_order'], self.cmds[y]['_order'])) for style in ordered_cmds: cmd += self.cmds[style][self.get(...
Write a Python 3 script to convert the current style to an escpos command string
As a python code expert, you are capable of creating scripts from specifications.
starts an inline entity with an optional style definition
Can you generate the documentation for the following Python 3 function def start_inline(self,stylestack=None): self.stack.append('inline') if self.dirty: self.escpos._raw(' ') if stylestack: self.style(stylestack)
As a Python code composer, you craft elegant and concise scripts.
starts a block entity with an optional style definition
Can you generate the documentation for the following Python 3 function def start_block(self,stylestack=None): if self.dirty: self.escpos._raw('\n') self.dirty = False self.stack.append('block') if stylestack: self.style(stylestack)
You are a Python code generator, capable of creating scripts from specifications.
Ends the entity definition.
Can you generate the documentation for the following Python 3 function def end_entity(self): if self.stack[-1] == 'block' and self.dirty: self.escpos._raw('\n') self.dirty = False if len(self.stack) > 1: self.stack = self.stack[:-1]
You are a Python code generator, capable of creating scripts from specifications.
def pre(self,text): """ puts a string of text in the entity keeping the whitespace intact """ if text: self.escpos.text(text) self.dirty = True
Can you implement a function in Python 3 that puts a string of text in the entity keeping the whitespace intact
You are a Python code generator, capable of creating scripts from specifications.
puts text in the entity. Whitespace and newlines are stripped to single spaces.
Explain what the following Python 3 code does def text(self,text): if text: text = utfstr(text) text = text.strip() text = re.sub('\s+',' ',text) if text: self.dirty = True self.escpos.text(text)
As a python code expert, you are capable of creating scripts from specifications.
def _check_image_size(self, size): """ Check and fix the size of the image to 32 bits """ if size % 32 == 0: return (0, 0) else: image_border = 32 - (size % 32) if (image_border % 2) == 0: return (image_border / 2, image_border / 2) ...
Write a Python 3 function that can check and fix the size of the image to 32 bits
As a Python code composer, you craft elegant and concise scripts.
def _convert_image(self, im): """ Parse image and prepare it to a printable format """ pixels = [] pix_line = "" im_left = "" im_right = "" switch = 0 img_size = [ 0, 0 ] if im.size[0] > 512: print "WARNING: Image is wider than 512 and ...
Implement a Python 3 function for parsing image and prepare it to a printable format
As a python code expert, you are capable of creating scripts from specifications.
Open image file and print it in printable image
How would you explain what the following Python 3 function does def image(self,path_img): im_open = Image.open(path_img) im = im_open.convert("RGB") # Convert the RGB image in printable image pix_line, img_size = self._convert_image(im) self._print_image(pix_line, img_size)
As a python code expert, you are capable of creating scripts from specifications.
def qr(self,text): """ Print QR Code for the provided string """ qr_code = qrcode.QRCode(version=4, box_size=4, border=1) qr_code.add_data(text) qr_code.make(fit=True) qr_img = qr_code.make_image() im = qr_img._img.convert("RGB") # Convert the RGB image in printab...
How would you implement a function in Python 3 that prints QR Code for the provided string
As a python code expert, you are capable of creating scripts from specifications.
Prints an xml based receipt definition
Here you have a function in Python 3, explain what it does def receipt(self,xml): def strclean(string): if not string: string = '' string = string.strip() string = re.sub('\s+',' ',string) return string def format_value(value, decimals=3,...
You are a Python code generator, capable of creating scripts from specifications.
Print Unicode encoded alpha - numeric text.
Given the following Python 3 function, write the documentation def text(self,txt): if not txt: return try: txt = txt.decode('utf-8') except: try: txt = txt.decode('utf-16') except: pass self.extra_chars = 0 ...
You are a Python code generator, capable of creating scripts from specifications.
def cut(self, mode=''): """ Cut paper """ # Fix the size between last line and cut # TODO: handle this with a line feed self._raw("\n\n\n\n\n\n") if mode.upper() == "PART": self._raw(PAPER_PART_CUT) else: # DEFAULT MODE: FULL CUT self._raw(PAPER_FU...
Write a Python 3 function for cutting the log entry for a given entry.
You are a Python code architect, reviewing and designing scalable and efficient code
Send pulse to kick the cash drawer
Given the following Python 3 function, write the documentation def cashdraw(self, pin): if pin == 2: self._raw(CD_KICK_2) elif pin == 5: self._raw(CD_KICK_5) else: raise CashDrawerError()
You are a Python code analyst, evaluating scripts for potential improvements.
Open USB tree and set is as escpos device
How would you explain what the following Python 3 function does def open(self): self.device = usb.core.find(idVendor=self.idVendor, idProduct=self.idProduct) if self.device is None: raise NoDeviceError() try: if self.device.is_kernel_driver_active(self.interface)...
You are a Python code generator, capable of creating scripts from specifications.
Print any command sent in raw format
Can you generate the documentation for the following Python 3 function def _raw(self, msg): if len(msg) != self.device.write(self.out_ep, msg, self.interface): self.device.write(self.out_ep, self.errorText, self.interface) raise TicketNotPrinted()
You are a Python code analyst, evaluating scripts for potential improvements.
Open the device and set it as escpos device
Explain what the following Python 3 code does def open(self): self.device = serial.Serial(port=self.devfile, baudrate=self.baudrate, bytesize=self.bytesize, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=self.timeout, dsrdtr=True) if self.device is not None: print "Serial ...
As a python code expert, you are capable of creating scripts from specifications.
def open(self): """ Open TCP socket and set it as escpos device """ self.device = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.device.connect((self.host, self.port)) if self.device is None: print "Could not open socket for %s" % self.host
Write a Python 3 script for opening TCP socket and set it as escpos device
As a python code expert, you are capable of creating scripts from specifications.
def _pinyin_generator(chars, format): """Generate pinyin for chars, if char is not chinese character, itself will be returned. Chars must be unicode list. """ for char in chars: key = "%X" % ord(char) pinyin = pinyin_dict.get(key, char) tone = pinyin_tone.get(key, 0) ...
Write a Python 3 function that can generate a list of Pinyin characters for a given set of characters.
As a Python code translator, you convert algorithms and pseudocode into Python.
Return pinyin of string
Can you tell what is the following Python 3 function doing def get(s, delimiter='', format="diacritical"): return delimiter.join(_pinyin_generator(u(s), format=format))
You are a Python code generator, capable of creating scripts from specifications.