text stringlengths 81 112k |
|---|
수정
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
taxinvoice : 수정할 세금계산서 object. Made with Taxinvoice(...)
writeSpecification : 등록시 거래명세서 동시 작성 여부
UserID : 팝빌 회원아이... |
상태정보 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
처리결과. consist of code and message
raise
PopbillException
def getInfo(self, CorpNum, MgtKeyTy... |
상세정보 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
처리결과. consist of code and message
raise
PopbillException
def getDetailInfo(self, CorpNum, Mg... |
삭제
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
UserID : 팝빌 회원아이디
return
처리결과. consist of code and message
raise
PopbillException
def de... |
승인요청
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
Memo : 처리 메모
UserID : 팝빌 회원아이디
return
처리결과. consist of code and message
raise
... |
승인요청 취소
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
Memo : 처리 메모
UserID : 팝빌 회원아이디
return
처리결과. consist of code and message
raise
... |
발행
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
Memo : 처리 메모
EmailSubject : 발행메일 이메일 제목
ForceIssue : 지연발행 세금계산서 강제발행 여부.
UserID : 팝빌 회원아이디
... |
즉시 요청
args
CorpNum : 팝빌회원 사업자번호
taxinvoice : 세금계산서 객체
memo : 메모
UsreID : 팝빌회원 아이디
return
검색결과 정보
raise
PopbillException
def registRequest(self, CorpNum, taxinvoice, memo=None, UserID=None... |
국세청 즉시전송
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
UserID : 팝빌 회원아이디
return
처리결과. consist of code and message
raise
PopbillException
... |
세금계산서 문서이력 목록 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
문서이력 정보 목록 as List
raise
PopbillException
def getLogs(self, CorpNum, MgtKeyType, Mg... |
첨부파일 목록 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
return
첩부파일 정보 목록 as List
raise
PopbillException
def getFiles(self, CorpNum, MgtKeyType, MgtKey)... |
첨부파일 삭제
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKey : 파트너 관리번호
UserID : 팝빌 회원아이디
return
처리결과. consist of code and message
raise
PopbillException
d... |
다량 인쇄 URL 확인
args
CorpNum : 회원 사업자 번호
MgtKeyType : 관리번호 유형 one of ['SELL','BUY','TRUSTEE']
MgtKeyList : 파트너 관리번호 목록
UserID : 팝빌 회원아이디
return
팝빌 URL as str
raise
PopbillException
def getMa... |
목록 조회
args
CorpNum : 팝빌회원 사업자번호
MgtKeyType : 세금계산서유형, SELL-매출, BUY-매입, TRUSTEE-위수탁
DType : 일자유형, R-등록일시, W-작성일자, I-발행일시 중 택 1
SDate : 시작일자, 표시형식(yyyyMMdd)
EDate : 종료일자, 표시형식(yyyyMMdd)
State : 상태코드, 2,3번째 자리에 와일드카... |
전자명세서 첨부
args
CorpNum : 팝빌회원 사업자번호
MgtKeyType : 세금계산서 유형, SELL-매출, BUY-매입, TRUSTEE-위수탁
MgtKey : 세금계산서 문서관리번호
StmtCode : 명세서 종류코드, 121-명세서, 122-청구서, 123-견적서, 124-발주서 125-입금표, 126-영수증
StmtMgtKey : 전자명세서 문서관리번호
User... |
관리번호할당
args
CorpNum : 팝빌회원 사업자번호
MgtKeyType : 세금계산서 유형, SELL-매출, BUY-매입, TRUSTEE-위수탁
ItemKey : 아이템키 (Search API로 조회 가능)
MgtKey : 세금계산서에 할당할 파트너 관리 번호
UserID : 팝빌회원 아이디
return
처리결과. consist of code and... |
팝빌 인감 및 첨부문서 등록 URL
args
CorpNum : 회원 사업자번호
UserID : 회원 팝빌아이디
return
30초 보안 토큰을 포함한 url
raise
PopbillException
def getSealURL(self, CorpNum, UserID):
""" 팝빌 인감 및 첨부문서 등록 URL
args
Cor... |
공인인증서 등록 URL
args
CorpNum : 회원 사업자번호
UserID : 회원 팝빌아이디
return
30초 보안 토큰을 포함한 url
raise
PopbillException
def getTaxCertURL(self, CorpNum, UserID):
""" 공인인증서 등록 URL
args
CorpNum : 회원 사... |
Returns the function, if any, that encloses a given location.
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):
... |
Returns an iterator over all of the functions definitions that are
contained within a given file.
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 f... |
Create or load pRF model time courses.
Parameters
----------
dicCnfg : dict
Dictionary containing config parameters.
aryMdlParams : numpy arrays
x, y and sigma parameters.
strPathHrf : str or None:
Path to npy file with custom hrf parameters. If None, default
paramet... |
Try to load config, to load other journal locations
Otherwise, return default location
Returns journal location
def parse_config(args):
"""
Try to load config, to load other journal locations
Otherwise, return default location
Returns journal location
"""
# Try user config or return d... |
args
entry - list of entries to record
def record_entries(journal_location, entries):
"""
args
entry - list of entries to record
"""
check_journal_dest(journal_location)
current_date = datetime.datetime.today()
date_header = current_date.strftime("%a %H:%M:%S %Y-%m-%d") + "\n"
with ... |
args
date - date object
returns entry text or None if entry doesn't exist
def get_entry(journal_location, date):
"""
args
date - date object
returns entry text or None if entry doesn't exist
"""
if not isinstance(date, datetime.date):
return None
try:
with open(build... |
r"""
Replace data in one file with data from another file.
:param fname1: Name of the input comma-separated values file, the file
that contains the columns to be replaced
:type fname1: FileNameExists_
:param fname2: Name of the replacement comma-separated values file, the
... |
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(t)`` of samples from HRF at times `t`
Notes
-----
[1] This is the canonical HRF functi... |
SPM canonical HRF derivative, HRF derivative values for time values `t`
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 can... |
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
vector length ``len(t)`` of samples from HRF at times `t`
Notes
-----
[1] This is the canonic... |
Creation of condition time courses in temporally upsampled space.
Parameters
----------
aryCnd : np.array
1D array with condition identifiers (every condition has its own int)
aryOns : np.array, same len as aryCnd
1D array with condition onset times in seconds.
aryDrt : np.array, s... |
Convolution of time courses with HRF model.
Parameters
----------
idxPrc : int, positive
Process ID of the process calling this function (for CPU
multi-threading). In GPU version, this parameter is 0 (just one thread
on CPU).
aryPrfTcChunk : np.array
2D array with model ... |
Creates a dictionary with the summarized information in job_data, input_files and input_directories
:param job_data: The job data specifying input parameters other than files and directories.
:param input_files: A dictionary describing the input files.
:param input_directories: A dictionary describing the ... |
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
def _partition_all_internal(s, sep):
"""
Uses str.partition() to split every occurrence... |
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 list of parts split by sep
def partitio... |
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: The string to split
:raise InvalidInputRefer... |
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
def split_all(reference, sep):
"""
Splits a given string at a given separator or list of separator... |
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 identifier of the given file.
:param input_reference: The reference string
:return... |
Returns the attributes in demand of the input directory.
:param attributes: A list of attributes to get from the input directory.
:param input_directory: The directory from which to get the attributes.
:param input_identifier: The input identifier of the given directory.
:param input_reference: The ref... |
Replaces a given input_reference by a string extracted from inputs_to_reference.
:param reference: The input reference to resolve.
:param inputs_to_reference: A dictionary containing information about the given inputs.
:raise InvalidInputReference: If the given input reference could not be resolved.
... |
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"
:param to_resolve: The path to match
:param inputs_to_reference: I... |
Returns a dictionnary containing all the passed data and an item
``error_list`` which holds the result of :attr:`error_list`.
def data(self):
"""
Returns a dictionnary containing all the passed data and an item
``error_list`` which holds the result of :attr:`error_list`.
"""
... |
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 between
0 and 3 will not be 3, but 1... |
팝빌 회원 잔여포인트 확인
args
CorpNum : 팝빌회원 사업자번호
TOGO : "CHRG"
return
URL
raise
PopbillException
def getPartnerURL(self, CorpNum, TOGO):
""" 팝빌 회원 잔여포인트 확인
args
CorpNum : 팝빌회원 사업자번호
... |
팝빌 회원 잔여포인트 확인
args
CorpNum : 확인하고자 하는 회원 사업자번호
return
잔여포인트 by float
raise
PopbillException
def getBalance(self, CorpNum):
""" 팝빌 회원 잔여포인트 확인
args
CorpNum : 확인하고자 하는 회원 사업자번호
return
... |
팝빌 로그인 URL
args
CorpNum : 회원 사업자번호
UserID : 회원 팝빌아이디
return
30초 보안 토큰을 포함한 url
raise
PopbillException
def getAccessURL(self, CorpNum, UserID):
""" 팝빌 로그인 URL
args
CorpNum : 회원 사업자번호
... |
팝빌 연동회원 포인트 충전 URL
args
CorpNum : 회원 사업자번호
UserID : 회원 팝빌아이디
return
30초 보안 토큰을 포함한 url
raise
PopbillException
def getChargeURL(self, CorpNum, UserID):
""" 팝빌 연동회원 포인트 충전 URL
args
Cor... |
회원가입여부 확인
args
CorpNum : 회원 사업자번호
return
회원가입여부 True/False
raise
PopbillException
def checkIsMember(self, CorpNum):
""" 회원가입여부 확인
args
CorpNum : 회원 사업자번호
return
회원가입여부 Tru... |
팝빌 회원가입
args
JoinInfo : 회원가입정보. Reference JoinForm class
return
처리결과. consist of code and message
raise
PopbillException
def joinMember(self, JoinInfo):
""" 팝빌 회원가입
args
JoinInfo : 회원가입정보. Reference ... |
담당자 정보 수정
args
CorpNum : 회원 사업자번호
ContactInfo : 담당자 정보, Reference ContactInfo class
UserID : 회원 아이디
return
처리결과. consist of code and message
raise
PopbillException
def updateContact(self, CorpNum, Conta... |
담당자 정보 수정
args
CorpNum : 회원 사업자번호
CorpInfo : 회사 정보, Reference CorpInfo class
UserID : 회원 아이디
return
처리결과. consist of code and message
raise
PopbillException
def updateCorpInfo(self, CorpNum, CorpInfo, U... |
담당자 추가
args
CorpNum : 회원 사업자번호
ContactInfo : 담당자 정보, Reference ContactInfo class
UserID : 회원 아이디
return
처리결과. consist of code and message
raise
PopbillException
def registContact(self, CorpNum, ContactI... |
Try to compile a string into a Django template
def TemplateValidator(value):
"""Try to compile a string into a Django template"""
try:
Template(value)
except Exception as e:
raise ValidationError(
_("Cannot compile template (%(exception)s)"),
params={"exception": e}... |
r"""
Merge two comma-separated values files.
Data columns from the second file are appended after data columns from the
first file. Empty values in columns are used if the files have different
number of rows
:param fname1: Name of the first comma-separated values file, the file
... |
Function for optimizing given pRF paramaters using brute-force grid search.
Parameters
----------
strCsvCnfg : str
Absolute file path of config file.
objNspc : object
Name space from command line arguments.
lgcTest : Boolean
Whether this is a test (pytest). If yes, absolute ... |
Scrapes the given URL to a page in JSON format to obtain the documentation for the LBRY API
:param str url: URL to the documentation we need to obtain,
pybry.constants.LBRY_API_RAW_JSON_URL by default
:return: List of functions retrieved from the `url` given
:rtype: list
def get_lbry_api_function_doc... |
Generates the body for the given function
:param dict func: dict of a JSON-Formatted function as defined by the API docs
:return: A String containing the definition for the function as it should be written in code
:rtype: str
def generate_method_definition(func):
""" Generates the body for the given f... |
Generates the actual functions for lbryd_api.py based on lbry's documentation
:param str url: URL to the documentation we need to obtain,
pybry.constants.LBRY_API_RAW_JSON_URL by default
:param str read_file: This is the path to the file from which we will be reading
:param str write_file: Path from p... |
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. Default
threshold is 1000 MB.
Returns
... |
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 mask/s
Returns
-------
lstPrmAry : li... |
Export 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 fil... |
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
idxPos : integer, positive
List position index that we e... |
Compare results for different exponents and create winner nii.
Parameters
----------
lstRat : list
List of floats containing the ratios that were tested for surround
suppression.
lstNiiNames : list
List of names of the different pRF maps (e.g. xpos, ypos, SD)
strPathOut : st... |
Remap coordinates from cartesian to polar
Parameters
----------
aryXCrds : 1D numpy array
Array with x coordinate values.
aryYrds : 1D numpy array
Array with y coordinate values.
Returns
-------
aryTht : 1D numpy array
Angle of coordinates
aryRad : 1D numpy arra... |
Remap coordinates from polar to cartesian
Parameters
----------
aryTht : 1D numpy array
Angle of coordinates
aryRad : 1D numpy array
Radius of coordinates.
Returns
-------
aryXCrds : 1D numpy array
Array with x coordinate values.
aryYrds : 1D numpy array
... |
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
-------
aryXCrds : 1D numpy array
Indices of ... |
Remap values in an array from one range to another.
Parameters
----------
aryVls : 1D numpy array
Array with values that need to be remapped.
varNewMin : float
Desired minimum value of new, remapped array.
varNewMax : float
Desired maximum value of new, remapped array.
v... |
Remap x, y, sigma parameters from degrees to pixel.
Parameters
----------
vecX : 1D numpy array
Array with possible x parametrs in degree
vecY : 1D numpy array
Array with possible y parametrs in degree
vecPrfSd : 1D numpy array
Array with possible sd parametrs in degree
... |
Spatially convolve input with 2D Gaussian model.
Parameters
----------
idxPrc : int
Process ID of the process calling this function (for CPU
multi-threading). In GPU version, this parameter is 0 (just one thread
on CPU).
aryMdlParamsChnk : 2d numpy array, shape [n_models, n_mode... |
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
Any identity-machable string-based hash of revision content
... |
pyprf_feature entry point.
def main():
"""pyprf_feature entry point."""
# %% Print Welcome message
strWelcome = 'pyprf_feature ' + __version__
strDec = '=' * len(strWelcome)
print(strDec + '\n' + strWelcome + '\n' + strDec)
# %% Get list of input arguments
# Create parser object:
ob... |
Apply spatial smoothing to the input data.
Parameters
----------
aryFuncChnk : np.array
TODO
varSdSmthSpt : float (?)
Extent of smoothing.
Returns
-------
aryFuncChnk : np.array
Smoothed data.
def funcSmthSpt(aryFuncChnk, varSdSmthSpt):
"""Apply spatial smoothin... |
Apply temporal smoothing to fMRI data & pRF time course models.
Parameters
----------
aryFuncChnk : np.array
TODO
varSdSmthTmp : float (?)
extend of smoothing
Returns
-------
aryFuncChnk : np.array
TODO
def funcSmthTmp(aryFuncChnk, varSdSmthTmp):
"""Apply tempo... |
Prepare pRF model time courses.
Parameters
----------
aryPrfTc : np.array
4D numpy array with pRF time course models, with following dimensions:
`aryPrfTc[x-position, y-position, SD, volume]`.
varSdSmthTmp : float
Extent of temporal smoothing that is applied to functional data a... |
Load & prepare functional data.
Parameters
----------
strPathNiiMask: str
Path to mask used to restrict pRF model finding. Only voxels with
a value greater than zero in the mask are considered.
lstPathNiiFunc : list
List of paths of functional data (nii files).
varAvgThr : f... |
what's the value of a style at the current stack level
def get(self,style):
""" what's the value of a style at the current stack level"""
level = len(self.stack) -1
while level >= 0:
if style in self.stack[level]:
return self.stack[level][style]
else:
... |
converts a value to the attribute's type
def enforce_type(self, attr, val):
"""converts a value to the attribute's type"""
if not attr in self.types:
return utfstr(val)
elif self.types[attr] == 'int':
return int(float(val))
elif self.types[attr] == 'float':
... |
push a new level on the stack with a style dictionnary containing style:value pairs
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.cmd... |
overrides style values at the current stack level
def set(self, style={}):
"""overrides style values at the current stack level"""
_style = {}
for attr in style:
if attr in self.cmds and not style[attr] in self.cmds[attr]:
print 'WARNING: ESC/POS PRINTING: ignoring i... |
converts the current style to an escpos command string
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 ord... |
starts an inline entity with an optional style definition
def start_inline(self,stylestack=None):
""" starts an inline entity with an optional style definition """
self.stack.append('inline')
if self.dirty:
self.escpos._raw(' ')
if stylestack:
self.style(stylesta... |
starts a block entity with an optional style definition
def start_block(self,stylestack=None):
""" starts a block entity with an optional style definition """
if self.dirty:
self.escpos._raw('\n')
self.dirty = False
self.stack.append('block')
if stylestack:
... |
ends the entity definition. (but does not cancel the active style!)
def end_entity(self):
""" ends the entity definition. (but does not cancel the active style!) """
if self.stack[-1] == 'block' and self.dirty:
self.escpos._raw('\n')
self.dirty = False
if len(self.stack)... |
puts a string of text in the entity keeping the whitespace intact
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 |
puts text in the entity. Whitespace and newlines are stripped to single spaces.
def text(self,text):
""" puts text in the entity. Whitespace and newlines are stripped to single spaces. """
if text:
text = utfstr(text)
text = text.strip()
text = re.sub('\s+',' ',text)... |
Check and fix the size of the image to 32 bits
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 ... |
Print formatted image
def _print_image(self, line, size):
""" Print formatted image """
i = 0
cont = 0
buffer = ""
self._raw(S_RASTER_N)
buffer = "%02X%02X%02X%02X" % (((size[0]/size[1])/8), 0, size[1], 0)
self._raw(buffer.decode('hex'))
buffer =... |
Print formatted image
def _raw_print_image(self, line, size, output=None ):
""" Print formatted image """
i = 0
cont = 0
buffer = ""
raw = ""
def __raw(string):
if output:
output(string)
else:
self._raw(string)
... |
Parse image and prepare it to a printable format
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:
... |
Open image file
def image(self,path_img):
""" Open image file """
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) |
Print QR Code for the provided string
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")
... |
Print Barcode
def barcode(self, code, bc, width=255, height=2, pos='below', font='a'):
""" Print Barcode """
# Align Bar Code()
self._raw(TXT_ALIGN_CT)
# Height
if height >=2 or height <=6:
self._raw(BARCODE_HEIGHT)
else:
raise BarcodeSizeError()
... |
Prints an xml based receipt definition
def receipt(self,xml):
"""
Prints an xml based receipt definition
"""
def strclean(string):
if not string:
string = ''
string = string.strip()
string = re.sub('\s+',' ',string)
return... |
Print Utf8 encoded alpha-numeric text
def text(self,txt):
""" Print Utf8 encoded alpha-numeric text """
if not txt:
return
try:
txt = txt.decode('utf-8')
except:
try:
txt = txt.decode('utf-16')
except:
pass
... |
Set text properties
def set(self, align='left', font='a', type='normal', width=1, height=1):
""" Set text properties """
# Align
if align.upper() == "CENTER":
self._raw(TXT_ALIGN_CT)
elif align.upper() == "RIGHT":
self._raw(TXT_ALIGN_RT)
elif align.upper(... |
Cut paper
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._r... |
Send pulse to kick the cash drawer
def cashdraw(self, pin):
""" Send pulse to kick the cash drawer """
if pin == 2:
self._raw(CD_KICK_2)
elif pin == 5:
self._raw(CD_KICK_5)
else:
raise CashDrawerError() |
Hardware operations
def hw(self, hw):
""" Hardware operations """
if hw.upper() == "INIT":
self._raw(HW_INIT)
elif hw.upper() == "SELECT":
self._raw(HW_SELECT)
elif hw.upper() == "RESET":
self._raw(HW_RESET)
else: # DEFAULT: DOES NOTHING
... |
Feed control sequences
def control(self, ctl):
""" Feed control sequences """
if ctl.upper() == "LF":
self._raw(CTL_LF)
elif ctl.upper() == "FF":
self._raw(CTL_FF)
elif ctl.upper() == "CR":
self._raw(CTL_CR)
elif ctl.upper() == "HT":
... |
Search device on USB tree and set is as escpos device
def open(self):
""" Search device on USB tree and set is as escpos device """
self.device = usb.core.find(idVendor=self.idVendor, idProduct=self.idProduct)
if self.device is None:
raise NoDeviceError()
try:
... |
Print any command sent in raw format
def _raw(self, msg):
""" Print any command sent in raw format """
if len(msg) != self.device.write(self.out_ep, msg, self.interface):
self.device.write(self.out_ep, self.errorText, self.interface)
raise TicketNotPrinted() |
Setup serial port and set is as escpos device
def open(self):
""" Setup serial port and set is as escpos device """
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)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.