output stringlengths 1 928k | instruction stringlengths 7 928k | system stringlengths 0 104k |
|---|---|---|
creates and defines all needed dummy vertices for edge e.
| Here you have a function in Python 3, explain what it does
def setdummies(self,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:
# "dummy vertices" are sto... | You are a Python code analyst, evaluating scripts for potential improvements. |
iterator that computes all vertices ordering in the layers. | Can you generate a brief explanation for the following Python 3 code
def ordering_step(self,oneway=False):
self.dirv=-1
crossings = 0
for l in self.layers:
mvmt = l.order()
crossings += mvmt
yield (l,mvmt)
if oneway or (crossings == 0):
ret... | As a python code expert, you are capable of creating scripts from specifications. |
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:
... | Write a Python 3 script to
compute all vertex coordinates using Brandes & Kopf. | As a Python code translator, you convert algorithms and pseudocode into Python. |
detect conflicts between dummy nodes and regular crossings | Can you generate a brief explanation for the following Python 3 code
def _detect_alignment_conflicts(self):
curvh = self.dirvh # save current dirvh value
self.dirvh=0
self.conflicts = []
for L in self.layers:
last = len(L)-1
prev = L.prevlayer()
if not... | You are a Python code analyst, evaluating scripts for potential improvements. |
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... | How would you implement a function in Python 3 that
performs vertical alignment according to current dirvh internal state. | As a python code expert, you are capable of creating scripts from specifications. |
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.
... | Can you implement a function in Python 3 that
makes a cURL POST request to the given URL and returns the JSON response. | As a Python code composer, you craft elegant and concise scripts. |
Load PNGs with stimulus information for pRF model creation. | Can you generate a brief explanation for the following Python 3 code
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... | As a Python code analyst, you investigate and solve complex coding mysteries |
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
-----
... | Implement a Python 3 function for
loading information from event text file. | As a Python code analyst, you investigate and solve complex coding mysteries |
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
... | Implement a Python 3 function for
applying status mapping to a raw API result. | You are a Python code analyst, evaluating scripts for potential improvements. |
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... | Create a Python 3 function for
returning the status of the CDC for the provided latitude and longitude. | You are a Python code generator, capable of creating scripts from specifications. |
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... | Implement a Python 3 function for
returning the CDC status for the specified state. | As a Python code composer, you craft elegant and concise scripts. |
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... | Can you create a Python 3 function that
returns the exception class and message of the exception as string. | As a Python code composer, you craft elegant and concise scripts. |
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) | Create a Python 3 function to
print the exception message and the name of the exception class to stderr. | You are a Python code architect, reviewing and designing scalable and efficient code |
Inserts the document into the database if it is valid. Returns errors otherwise. | Given the following Python 3 function, write the documentation
def insert(self, **kwargs):
if self.is_valid:
before = self.before_insert()
if before:
return before
try:
self._document['_id'] = self.insert_one(self._document)
s... | You are a Python code architect, reviewing and designing scalable and efficient code |
Updates the document with the given _id saved in the collection if it is valid. Returns errors otherwise. | Make a summary of the following Python 3 code
def update(self, **kwargs):
if self.is_valid:
if '_id' in self._document:
to_update = self.find_one({'_id': self._id})
if to_update:
before = self.before_update(old=to_update)
if be... | You are a Python code generator, capable of creating scripts from specifications. |
Deletes the document if it is saved in the collection. | Here you have a function in Python 3, explain what it does
def delete(self, **kwargs):
if self.is_valid:
if '_id' in self._document:
to_delete = self.find_one({'_id': self._id})
if to_delete:
before = self.before_delete()
if be... | You are a Python code architect, reviewing and designing scalable and efficient code |
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) | Create a Python 3 function for
returning one document dict if one passes the filter. | As a Python code analyst, you investigate and solve complex coding mysteries |
Returns all document dicts that pass the filter
| Can you tell what is the following Python 3 function doing
def find(cls, *args, **kwargs):
return list(cls.collection.find(*args, **kwargs)) | You are a Python code generator, capable of creating scripts from specifications. |
Returns the document dicts returned from the Aggregation Pipeline
| Can you tell what is the following Python 3 function doing
def aggregate(cls, pipeline=None, **kwargs):
return list(cls.collection.aggregate(pipeline or [], **kwargs)) | As a python code expert, you are capable of creating scripts from specifications. |
Inserts a list of documents into the Collection and returns their _ids
| Here you have a function in Python 3, explain what it does
def insert_many(cls, documents, ordered=True):
return cls.collection.insert_many(documents, ordered).inserted_ids | You are a Python code generator, capable of creating scripts from specifications. |
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 | Write a Python 3 script for
updating all the documents that pass the filter with the update value Will upsert a new document if upsert = True | As a python code expert, you are capable of creating scripts from specifications. |
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 | How would you implement a function in Python 3 that
replaces a single entry in the cache with a new value. | As a Python code translator, you convert algorithms and pseudocode into Python. |
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 | Can you implement a function in Python 3 that
returns a Document if any document is filtered returns None otherwise | As a Python code translator, you convert algorithms and pseudocode into Python. |
Returns a list of Documents if any document is filtered by the filter keyword arguments. | Here you have a function in Python 3, explain what it does
def documents(cls, filter=None, **kwargs):
documents = [cls(document) for document in cls.find(filter, **kwargs)]
return [document for document in documents if document.document] | You are a Python code architect, reviewing and designing scalable and efficient code |
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, []) | Write a Python 3 script to
return an iterator over all of the statements belonging to a file. | As a python code expert, you are capable of creating scripts from specifications. |
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 | How would you code a function in Python 3 to
return an iterator over all of the statements located at a given line. | You are a Python code analyst, evaluating scripts for potential improvements. |
This function returns a list of objects containing the best pRF model for the given voxel time course. | Can you generate the documentation for the following Python 3 function
def funcFindPrfGpu(idxPrc, vecMdlXpos, vecMdlYpos, vecMdlSd, aryFunc, # noqa
aryPrfTc, varL2reg, queOut, lgcPrint=True):
"""
Find best pRF model for voxel time course.
Parameters
----------
idxPrc : int
... | As a python code expert, you are capable of creating scripts from specifications. |
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(... | Create a Python 3 function to
wrap multiple paragraphs of text returning a list of wrapped lines. | As a python code expert, you are capable of creating scripts from specifications. |
Fill multiple paragraphs of text returning a new string. | Explain what the following Python 3 code does
def fill(text, width=70, **kwargs):
w = ParagraphWrapper(width=width, **kwargs)
return w.fill(text) | As a Python code translator, you convert algorithms and pseudocode into Python. |
Splits text into multiple paragraphs and returns a list of each
paragraph. | Can you generate the documentation for the following Python 3 function
def split(cls, text):
result = [line.strip('\n') for line in cls.parasep_re.split(text)]
if result == ['', '']:
result = ['']
return result | As a python code expert, you are capable of creating scripts from specifications. |
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... | How would you implement a function in Python 3 that
wraps multiple paragraphs in text and return a list of wrapped lines. | You are a Python code generator, capable of creating scripts from specifications. |
def getSenderNumberMgtURL(self, CorpNum, UserID):
""" 팩스 전송내역 팝업 URL
args
CorpNum : 회원 사업자번호
UserID : 회원 팝빌아이디
return
30초 보안 토큰을 포함한 url
raise
PopbillException
"""
result = self._httpget('/FAX/?T... | Write a Python 3 script for
getting the URL of the sender number MGT. | As a Python code analyst, you investigate and solve complex coding mysteries |
Get UnitCost of a user. | Here you have a function in Python 3, explain what it does
def getUnitCost(self, CorpNum):
result = self._httpget('/FAX/UnitCost', CorpNum)
return int(result.unitCost) | As a python code expert, you are capable of creating scripts from specifications. |
Get the list of Fax Result | Can you tell what is the following Python 3 function doing
def getFaxResultRN(self, CorpNum, RequestNum, UserID=None):
if RequestNum == None or RequestNum == '':
raise PopbillException(-99999999, "요청번호가 입력되지 않았습니다.")
return self._httpget('/FAX/Get/' + RequestNum, CorpNum, UserID) | You are a Python code generator, capable of creating scripts from specifications. |
팩스 단건 전송
args
CorpNum : 팝빌회원 사업자번호
SenderNum : 발신자 번호
ReceiverNum : 수신자 번호
ReceiverName : 수신자 명
FilePath : 발신 파일경로
ReserveDT : 예약시간(형식 yyyyMMddHHmmss)
UserID : 팝빌회원 아이디
SenderName ... | Can you generate the documentation for the following Python 3 function
def sendFax(self, CorpNum, SenderNum, ReceiverNum, ReceiverName, FilePath, ReserveDT=None, UserID=None,
SenderName=None, adsYN=False, title=None, RequestNum=None):
""" 팩스 단건 전송
args
CorpNum : 팝빌회원 ... | As a Python code composer, you craft elegant and concise scripts. |
def sendFax_multi(self, CorpNum, SenderNum, Receiver, FilePath, ReserveDT=None, UserID=None, SenderName=None,
adsYN=False, title=None, RequestNum=None):
""" 팩스 전송
args
CorpNum : 팝빌회원 사업자번호
SenderNum : 발신자 번호 (동보전송용)
Receiver : 수신자... | Implement a Python 3 function for
sending anFax message to the AFIP. | You are a Python code architect, reviewing and designing scalable and efficient code |
Resend anFaxRN to a specific sender. | Explain what the following Python 3 code does
def resendFaxRN(self, CorpNum, OrgRequestNum, SenderNum, SenderName, ReceiverNum, ReceiverName, ReserveDT=None,
UserID=None, title=None, RequestNum=None):
""" 팩스 단건 전송
args
CorpNum : 팝빌회원 사업자번호
OrgReque... | As a Python code translator, you convert algorithms and pseudocode into Python. |
def getPreviewURL(self, CorpNum, ReceiptNum, UserID):
""" 팩스 발신번호 목록 확인
args
CorpNum : 팝빌회원 사업자번호
UserID : 팝빌회원 아이디
return
처리결과. list of SenderNumber
raise
PopbillException
"""
return self._httpge... | Can you implement a function in Python 3 that
gets URL of a preview of a given receipt. | You are a Python code analyst, evaluating scripts for potential improvements. |
Creates the output directory if not existing. | Can you tell what is the following Python 3 function doing
def prepare_outdir(outdir):
if outdir:
outdir = os.path.expanduser(outdir)
if not os.path.isdir(outdir):
try:
os.makedirs(outdir)
except os.error as e:
raise JobExecutionError('Failed t... | As a python code expert, you are capable of creating scripts from specifications. |
Request a job from the Cashbill. | Make a summary of the following Python 3 code
def requestJob(self, CorpNum, Type, SDate, EDate, UserID=None):
if Type == None or Type == '':
raise PopbillException(-99999999, "문서형태이 입력되지 않았습니다.")
if SDate == None or SDate == '':
raise PopbillException(-99999999, "시작일자가 입력되지 않았습... | You are a Python code generator, capable of creating scripts from specifications. |
수집 결과 요약정보 조회
args
CorpNum : 팝빌회원 사업자번호
JobID : 작업아이디
TradeType : 문서형태 배열, N-일반 현금영수증, C-취소 현금영수증
TradeUsage : 거래구분 배열, P-소등공제용, C-지출증빙용
UserID : 팝빌회원 아이디
return
수집 결과 요약정보
raise
... | How would you explain what the following Python 3 function does
def summary(self, CorpNum, JobID, TradeType, TradeUsage, UserID=None):
if JobID == None or len(JobID) != 18:
raise PopbillException(-99999999, "작업아이디(jobID)가 올바르지 않습니다.")
uri = '/HomeTax/Cashbill/' + JobID + '/Summary'
... | As a Python code composer, you craft elegant and concise scripts. |
A simple decorator for creating a schematics. Model class to add it as a field
of type schematics. types. ModelType. | How would you explain what the following Python 3 function does
def model_node(**kwargs):
kwargs.setdefault('default', {})
def decorator(model):
return types.ModelType(model, **kwargs)
return decorator | As a Python code composer, you craft elegant and concise scripts. |
Calls func for every file under base_dir. | Explain what the following Python 3 code does
def for_each_file(base_dir, func):
for dir_path, _, file_names in os.walk(base_dir):
for filename in file_names:
func(os.path.join(dir_path, filename)) | As a Python code analyst, you investigate and solve complex coding mysteries |
Removes the write permissions for the given file. | Given the following Python 3 function, write the documentation
def make_file_read_only(file_path):
old_permissions = os.stat(file_path).st_mode
os.chmod(file_path, old_permissions & ~WRITE_PERMISSIONS) | As a Python code analyst, you investigate and solve complex coding mysteries |
Load the config file and return a dictionary with the ROI information. | Can you generate the documentation for the following Python 3 function
def load_config(strCsvCnfg, lgcTest=False, lgcPrint=True):
# Dictionary with config information:
dicCnfg = {}
# Open file with parameter configuration:
# fleConfig = open(strCsvCnfg, 'r')
with open(strCsvCnfg, 'r') as fleConfig... | As a Python code analyst, you investigate and solve complex coding mysteries |
Get the status of the user from the given latitude and longitude. | Can you generate a brief explanation for the following Python 3 code
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) | You are a Python code analyst, evaluating scripts for potential improvements. |
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... | Can you write a function in Python 3 where it
gets symptom data for the provided ZIP code. | You are a Python code generator, capable of creating scripts from specifications. |
Prints a request to give the user info as to what they re sending
| Can you generate a brief explanation for the following Python 3 code
def print_request(request):
print('{}\n{}\n{}\n\n{}'.format(
'-----------START-----------',
request.method + ' ' + request.url,
'\n'.join('{}: {}'.format(k, v) for k, v in request.headers.items()),
request.body,
... | As a Python code analyst, you investigate and solve complex coding mysteries |
This function creates an EPUB file from an OpenAccess_EPUB article. | Make a summary of the following Python 3 code
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.... | As a Python code analyst, you investigate and solve complex coding mysteries |
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 ... | Create a Python 3 function to
create the base structure for an EPUB file in a specified location. | You are a Python code architect, reviewing and designing scalable and efficient code |
Zips the input file directory into an EPUB file. | Given the following Python 3 function, write the documentation
def epub_zip(outdirect):
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)):
zipf.w... | You are a Python code generator, capable of creating scripts from specifications. |
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(... | Write a Python 3 script to
write data to CSV file with validation. | You are a Python code architect, reviewing and designing scalable and efficient code |
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... | How would you implement a function in Python 3 that
generates a directory description from a given input directory. | As a python code expert, you are capable of creating scripts from specifications. |
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... | Create a Python 3 function to
check that the given directory listing is well - formed and if not raises an exception. | You are a Python code analyst, evaluating scripts for potential improvements. |
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 ... | Can you implement a function in Python 3 that
parses cwl type string into a dictionary containing information about the cwl type string. | As a Python code analyst, you investigate and solve complex coding mysteries |
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... | Write a Python 3 script for
searching for Directories and in the cwl data and produces a dictionary containing the input file information. | As a Python code translator, you convert algorithms and pseudocode into Python. |
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... | Create a Python 3 function to
return a dictionary containing information about the output files given in cwl_data. | As a Python code analyst, you investigate and solve complex coding mysteries |
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 ... | Create a Python 3 function to
read from the FIFO and returns the data. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Reads data from the FIFO until a token is encountered. | Explain what the following Python 3 code does
def readuntil(self, token, size=0):
self.__append()
i = self.buf.find(token, self.pos)
if i < 0:
index = max(len(token) - 1, size)
newpos = max(len(self.buf) - index, self.pos)
data = self.buf[self.pos:newpos]
... | As a Python code translator, you convert algorithms and pseudocode into Python. |
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... | Create a Python 3 function for
reading a line into the FIFO. | You are a Python code architect, reviewing and designing scalable and efficient code |
Reads the next size bytes from the FIFO. | Explain what the following Python 3 code does
def peekuntil(self, token, size=0):
self.__append()
i = self.buf.find(token, self.pos)
if i < 0:
index = max(len(token) - 1, size)
newpos = max(len(self.buf) - index, self.pos)
return False, self.buf[self.pos:newp... | As a Python code analyst, you investigate and solve complex coding mysteries |
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... | Write a Python 3 script to
get URL from Akamai. | As a Python code analyst, you investigate and solve complex coding mysteries |
def getPlusFriendMgtURL(self, CorpNum, UserID):
"""
플러스친구 계정관리 팝업 URL
:param CorpNum: 팝빌회원 사업자번호
:param UserID: 팝빌회원 아이디
:return: 팝빌 URL
"""
result = self._httpget('/KakaoTalk/?TG=PLUSFRIEND', CorpNum, UserID)
return result.url | Implement a function in Python 3 to
get Plus Friend Mgt URL. | You are a Python code generator, capable of creating scripts from specifications. |
Get A TG URL | How would you explain what the following Python 3 function does
def getATSTemplateMgtURL(self, CorpNum, UserID):
result = self._httpget('/KakaoTalk/?TG=TEMPLATE', CorpNum, UserID)
return result.url | As a Python code composer, you craft elegant and concise scripts. |
def getSentListURL(self, CorpNum, UserID):
"""
카카오톡 전송내역 팝업 URL
:param CorpNum: 팝빌회원 사업자번호
:param UserID: 팝빌회원 아이디
:return: 팝빌 URL
"""
result = self._httpget('/KakaoTalk/?TG=BOX', CorpNum, UserID)
return result.url | Can you implement a function in Python 3 that
gets the URL of the list of items. | As a Python code composer, you craft elegant and concise scripts. |
전송 발신 번호 가 작성 발신 번호 | Given the following Python 3 function, write the documentation
def sendATS_same(self, CorpNum, TemplateCode, Sender, Content, AltContent, AltSendType, SndDT, KakaoMessages,
UserID=None, RequestNum=None, ButtonList=None):
"""
알림톡 대량 전송
:param CorpNum: 팝빌회원 사업자번호
:param T... | You are a Python code architect, reviewing and designing scalable and efficient code |
친구톡 텍스트 대량 전송
:param CorpNum: 팝빌회원 사업자번호
:param PlusFriendID: 플러스친구 아이디
:param Sender: 발신번호
:param Content: [동보] 친구톡 내용
:param AltContent: [동보] 대체문자 내용
:param AltSendType: 대체문자 유형 [공백-미전송, C-알림톡내용, A-대체문자내용]
:param SndDT: 예약일시 [작성형식 : yyyyMMddHHmmss]
:para... | Explain what the following Python 3 code does
def sendFTS_same(self, CorpNum, PlusFriendID, Sender, Content, AltContent, AltSendType, SndDT,
KakaoMessages, KakaoButtons, AdsYN=False, UserID=None, RequestNum=None):
"""
친구톡 텍스트 대량 전송
:param CorpNum: 팝빌회원 사업자번호
:param P... | As a Python code composer, you craft elegant and concise scripts. |
def getUnitCost(self, CorpNum, MsgType, UserID=None):
"""
전송단가 확인
:param CorpNum: 팝빌회원 사업자번호
:param MsgType: 카카오톡 유형
:param UserID: 팝빌 회원아이디
:return: unitCost
"""
if MsgType is None or MsgType == "":
raise PopbillException(-99999999, "전송유형이 입력되... | How would you implement a function in Python 3 that
gets UnitCost of a user. | As a Python code composer, you craft elegant and concise scripts. |
Takes a sequence of page - partitioned revision documents and returns a sequence of reverts. | Make a summary of the following Python 3 code
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... | As a Python code translator, you convert algorithms and pseudocode into Python. |
This function is designed to be partially compatible with SPMs SPM HRF function from sum of two gamma PDFs at times t. | Here you have a function in Python 3, explain what it does
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 f... | As a python code expert, you are capable of creating scripts from specifications. |
SPM canonical HRF derivative values for time values t | Given the following Python 3 function, write the documentation
def dspmt(t):
t = np.asarray(t)
return spmt(t) - spmt(t - 1) | You are a Python code generator, capable of creating scripts from specifications. |
convolves the time courses in a single hrf or pixel time courses in a single pixel time courses | Here you have a function in Python 3, explain what it does
def cnvlTc(idxPrc,
aryPrfTcChunk,
lstHrf,
varTr,
varNumVol,
queOut,
varOvsmpl=10,
varHrfLen=32,
):
"""
Convolution of time courses with HRF model.
"""
# ***... | As a Python code translator, you convert algorithms and pseudocode into Python. |
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]:
... | Can you write a function in Python 3 where it
creates double gamma function. | You are a Python code analyst, evaluating scripts for potential improvements. |
This function is used to create a new time course model for a given time series. | Can you generate a brief explanation for the following Python 3 code
def cnvlTcOld(idxPrc,
aryPrfTcChunk,
varTr,
varNumVol,
queOut):
"""
Old version:
Convolution of time courses with one canonical HRF model.
"""
# Create 'canonical' HRF time co... | As a Python code analyst, you investigate and solve complex coding mysteries |
Create the aiohttp session and run the example. | Can you generate the documentation for the following Python 3 function
async def main() -> None:
logging.basicConfig(level=logging.INFO)
async with ClientSession() as websession:
try:
# Create a client:
client = Client(websession)
# Get user data for the client's lat... | As a Python code composer, you craft elegant and concise scripts. |
Makes a call to the LBRY API | Can you generate the documentation for the following Python 3 function
def call(cls, method, params=None, timeout=600):
params = [] if params is None else params
return cls.make_request(SERVER_ADDRESS, method, params, timeout=timeout) | As a Python code composer, you craft elegant and concise scripts. |
def getJobState(self, CorpNum, JobID, UserID=None):
""" 수집 상태 확인
args
CorpNum : 팝빌회원 사업자번호
JobID : 작업아이디
UserID : 팝빌회원 아이디
return
수집 상태 정보
raise
PopbillException
"""
if JobID == No... | How would you code a function in Python 3 to
get the state of a job. | You are a Python code analyst, evaluating scripts for potential improvements. |
def search(self, CorpNum, JobID, Type, TaxType, PurposeType, TaxRegIDType, TaxRegIDYN, TaxRegID, Page, PerPage,
Order, UserID=None):
""" 수집 결과 조회
args
CorpNum : 팝빌회원 사업자번호
JobID : 작업아이디
Type : 문서형태 배열, N-일반전자세금계산서, M-수정전자세금계산서
... | Can you create a Python 3 function that
searches Tax in Aleph | You are a Python code generator, capable of creating scripts from specifications. |
전자세금계산서 상세정보 확인
args
CorpNum : 팝빌회원 사업자번호
NTSConfirmNum : 국세청 승인번호
UserID : 팝빌회원 아이디
return
전자세금계산서 정보객체
raise
PopbillException | How would you explain what the following Python 3 function does
def getTaxinvoice(self, CorpNum, NTSConfirmNum, UserID=None):
if NTSConfirmNum == None or len(NTSConfirmNum) != 24:
raise PopbillException(-99999999, "국세청승인번호(NTSConfirmNum)가 올바르지 않습니다.")
return self._httpget('/HomeTax/Taxinvoi... | As a python code expert, you are capable of creating scripts from specifications. |
This method creates a new document for writing as xml
to the OPS subdirectory of the ePub structure. | Make a summary of the following Python 3 code
def make_document(self, titlestring):
#root = etree.XML('''<?xml version="1.0"?>\
#<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'>\
#<html xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www... | As a Python code translator, you convert algorithms and pseudocode into Python. |
This function will write a document to an XML file. | Explain what the following Python 3 code does
def write_document(self, name, document):
with open(name, 'wb') as out:
out.write(etree.tostring(document,
encoding='utf-8',
pretty_print=True)) | As a Python code analyst, you investigate and solve complex coding mysteries |
Formats a date_tuple object and returns a string that can be used to place the article content in the article. | How would you explain what the following Python 3 function does
def format_date_string(self, date_tuple):
months = ['', 'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December']
date_string = ''
if date_tuple.seaso... | As a Python code analyst, you investigate and solve complex coding mysteries |
Returns True if the article has out - of - flow HTML tables False otherwise. | Given the following Python 3 function, write the documentation
def has_out_of_flow_tables(self):
if self.article.body is None:
return False
for table_wrap in self.article.body.findall('.//table-wrap'):
graphic = table_wrap.xpath('./graphic | ./alternatives/graphic')
t... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Processes an article and creates the internal mapping. | Can you generate a brief explanation for the following Python 3 code
def process(self, article):
if self.article is not None and not self.collection:
log.warning('Could not process additional article. Navigation only \
handles one article unless collection mode is set.')
return False
... | As a python code expert, you are capable of creating scripts from specifications. |
This function recursively traverses the content of an article and adds the correct elements to the NCX file s navMap and Lists. | Given the following Python 3 function, write the documentation
def recursive_article_navmap(self, src_element, depth=0, first=True):
if depth > self.nav_depth:
self.nav_depth = depth
navpoints = []
tagnames = ['sec', 'fig', 'table-wrap']
for child in src_element:
... | As a python code expert, you are capable of creating scripts from specifications. |
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... | Can you implement a function in Python 3 that
creates the NCX element for EPUB2. | As a Python code composer, you craft elegant and concise scripts. |
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... | Write a Python 3 script to
create 1D Gaussian. Source : http://mathworld. wolfram. com / GaussianFunction. html | As a Python code composer, you craft elegant and concise scripts. |
Create 2D Gaussian kernel. Source : mathworld. wolfram. com / GaussianFunction. html
| Can you generate the documentation for the following Python 3 function
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 ... | You are a Python code analyst, evaluating scripts for potential improvements. |
Function for convolution of pixel - wise design matrix with HRF model. | Make a summary of the following Python 3 code
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 ar... | As a Python code translator, you convert algorithms and pseudocode into Python. |
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... | Create a Python 3 function for
simulating an AR1 model using the parameters beta c and sigma. | As a Python code translator, you convert algorithms and pseudocode into Python. |
This function is used to create neural time courses for every motion direction. | Can you generate a brief explanation for the following Python 3 code
def funcNrlTcMotPred(idxPrc,
varPixX,
varPixY,
NrlMdlChunk,
varNumTP,
aryBoxCar, # aryCond
path,
varNum... | As a Python code composer, you craft elegant and concise scripts. |
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... | Can you implement a function in Python 3 that
functions for finding best pRF model for voxel time course. This function should be used if there is only one predictor. | As a Python code translator, you convert algorithms and pseudocode into Python. |
This function finds the best pRF model for voxel time course. | How would you explain what the following Python 3 function does
def funcFindPrfMltpPrdXVal(idxPrc,
aryFuncChnkTrn,
aryFuncChnkTst,
aryPrfMdlsTrnConv,
aryPrfMdlsTstConv,
aryMdls,
... | You are a Python code generator, capable of creating scripts from specifications. |
Handles the movement of images to the cache. | Explain what the following Python 3 code does
def move_images_to_cache(source, destination):
if os.path.isdir(destination):
log.debug('Cached images for this article already exist')
return
else:
log.debug('Cache location: {0}'.format(destination))
try:
shutil.copytree... | As a Python code analyst, you investigate and solve complex coding mysteries |
This method is used by get_images to copy images out of the cache. | Here you have a function in Python 3, explain what it does
def image_cache(article_cache, img_dir):
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))
shutil.copytree(article_cache, img_dir)
... | You are a Python code analyst, evaluating scripts for potential improvements. |
Create the image cache if it does not exist | Make a summary of the following Python 3 code
def make_image_cache(img_cache):
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.path.join(img_cache,... | You are a Python code architect, reviewing and designing scalable and efficient code |
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... | How would you implement a function in Python 3 that
fetches the images from Frontiers website and store them in output_dir. | As a Python code translator, you convert algorithms and pseudocode into Python. |
Fetch the images for a PLoS article from the internet. | Can you tell what is the following Python 3 function doing
def fetch_plos_images(article_doi, output_dir, document):
log.info('Processing images for {0}...'.format(article_doi))
#A dict of URLs for PLoS subjournals
journal_urls = {'pgen': 'http://www.plosgenetics.org/article/{0}',
'pcbi... | As a Python code translator, you convert algorithms and pseudocode into Python. |
Save empirical and fitted time courses to nii file format. | Explain what the following Python 3 code does
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 fil... | As a Python code analyst, you investigate and solve complex coding mysteries |
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... | Can you write a function in Python 3 where it
simulates pRF response given pRF parameters and stimulus apertures. | You are a Python code analyst, evaluating scripts for potential improvements. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.