Search is not available for this dataset
text stringlengths 75 104k |
|---|
def _validate_rfilter(self, rfilter, letter="d"):
"""Validate that all columns in filter are in header."""
if letter == "d":
pexdoc.exh.addai(
"dfilter",
(
(not self._has_header)
and any([not isinstance(item, int) for it... |
def data(self, filtered=False, no_empty=False):
r"""
Return (filtered) file data.
The returned object is a list, each item is a sub-list corresponding
to a row of data; each item in the sub-lists contains data
corresponding to a particular column
:param filtered: Fi... |
def dsort(self, order):
r"""
Sort rows.
:param order: Sort order
:type order: :ref:`CsvColFilter`
.. [[[cog cog.out(exobj.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. pcsv.csv_file.CsvFile.dsort
:raises:
* Runtim... |
def header(self, filtered=False):
r"""
Return data header.
When the raw (input) data is used the data header is a list of the
comma-separated values file header if the file is loaded with header
(each list item is a column header) or a list of column numbers if the
file ... |
def replace(self, rdata, filtered=False):
r"""
Replace data.
:param rdata: Replacement data
:type rdata: list of lists
:param filtered: Filtering type
:type filtered: :ref:`CsvFiltered`
.. [[[cog cog.out(exobj.get_sphinx_autodoc(width=63)) ]]]
.. Auto... |
def write(self, fname=None, filtered=False, header=True, append=False):
r"""
Write (processed) data to a specified comma-separated values (CSV) file.
:param fname: Name of the comma-separated values file to be
written. If None the file from which the data originated
... |
def model_creation(dicCnfg, varRat=None, strPathHrf=None):
"""
Create or load pRF model time courses.
Parameters
----------
dicCnfg : dict
Dictionary containing config parameters.
varRat : float, default None
Ratio of size suppressive surround to size of center pRF
strPathHr... |
def registIssue(self, CorpNum, cashbill, Memo, UserID=None):
""" νκΈμμμ¦ μ¦μλ°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
cashbill : λ±λ‘ν νκΈμμμ¦ object. made with Cashbill(...)
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consist of code and message
... |
def register(self, CorpNum, cashbill, UserID=None):
""" νκΈμμμ¦ λ±λ‘
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
cashbill : λ±λ‘ν νκΈμμμ¦ object. made with Cashbill(...)
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consist of code and message
r... |
def revokeRegistIssue(self, CorpNum, mgtKey, orgConfirmNum, orgTradeDate, smssendYN=False, memo=None, UserID=None,
isPartCancel=False, cancelType=None, supplyCost=None, tax=None, serviceFee=None,
totalAmount=None):
""" μ·¨μνκΈμμμ¦ μ¦μλ°ν
args
... |
def update(self, CorpNum, MgtKey, cashbill, UserID=None):
""" μμ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : μλ³Έ νκΈμμμ¦ λ¬Έμκ΄λ¦¬λ²νΈ
cashbill : μμ ν νκΈμμμ¦ object. made with Cashbill(...)
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. ... |
def issue(self, CorpNum, MgtKey, Memo=None, UserID=None):
""" λ°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : μλ³Έ νκΈμμμ¦ λ¬Έμκ΄λ¦¬λ²νΈ
Memo : λ°ν λ©λͺ¨
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consist of code and message
... |
def delete(self, CorpNum, MgtKey, UserID=None):
""" μμ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : μλ³Έ νκΈμμμ¦ λ¬Έμκ΄λ¦¬λ²νΈ
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consist of code and message
raise
PopbillException... |
def search(self, CorpNum, DType, SDate, EDate, State, TradeType, TradeUsage, TaxationType, Page, PerPage, Order,
UserID=None, QString=None, TradeOpt=None):
""" λͺ©λ‘ μ‘°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
DType : μΌμμ ν, R-λ±λ‘μΌμ, T-κ±°λμΌμ, I-λ°νμΌμ μ€ ν 1
... |
def getInfo(self, CorpNum, MgtKey):
""" μν/μμ½ μ 보 μ‘°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : λ¬Έμκ΄λ¦¬λ²νΈ
return
λ¬Έμ μν/μμ½ μ 보 object
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... |
def getInfos(self, CorpNum, MgtKeyList):
""" μνμ 보 λ€λ νμΈ, μ΅λ 1000건
args
CorpNum : νμ μ¬μ
μ λ²νΈ
MgtKeyList : λ¬Έμκ΄λ¦¬λ²νΈ λͺ©λ‘
return
μνμ 보 λͺ©λ‘ as List
raise
PopbillException
"""
if MgtKeyList == None ... |
def getDetailInfo(self, CorpNum, MgtKey):
""" μμΈμ 보 μ‘°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : λ¬Έμκ΄λ¦¬λ²νΈ
return
λ¬Έμ μμΈμ 보 object
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... |
def sendEmail(self, CorpNum, MgtKey, ReceiverEmail, UserID=None):
""" μλ¦Όλ©μΌ μ¬μ μ‘
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : λ¬Έμκ΄λ¦¬λ²νΈ
ReceiverEmail : μμ μ μ΄λ©μΌ μ£Όμ
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consist of code and m... |
def getLogs(self, CorpNum, MgtKey):
""" λ¬Έμμ΄λ ₯ μ‘°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : λ¬Έμκ΄λ¦¬λ²νΈ
return
λ¬Έμ μ΄λ ₯ λͺ©λ‘ as List
raise
PopbillException
"""
if MgtKey == None or MgtKey == "":
... |
def getEPrintURL(self, CorpNum, MgtKey, UserID=None):
""" 곡κΈλ°λμμ© μΈμ URL νμΈ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
MgtKey : λ¬Έμκ΄λ¦¬λ²νΈ
UserID : νλΉνμ μμ΄λ
return
νλΉ URL as str
raise
PopbillException
... |
def updateEmailConfig(self, Corpnum, EmailType, SendYN, UserID=None):
""" μλ¦Όλ©μΌ μ μ‘μ€μ μμ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
EmailType: λ©μΌμ μ‘μ ν
SendYN: μ μ‘μ¬λΆ (True-μ μ‘, False-λ―Έμ μ‘)
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consi... |
def list(self, request):
"""
Returns the list of documents found on the collection
"""
pipeline = [{'$match': request.args.pop('match', {})}]
sort = request.args.pop('sort', {})
if sort:
pipeline.append({'$sort': sort})
project = request.args.pop('pr... |
def create(self, request):
"""
Creates a new document based on the given data
"""
document = self.collection(request.json)
document.created_at = datetime.utcnow()
document.updated_at = document.created_at
created = document.insert()
return Response(
... |
def retrieve(self, request, _id):
"""
Returns the document containing the given _id or 404
"""
_id = deserialize(_id)
retrieved = self.collection.find_one({'_id': _id})
if retrieved:
return Response(serialize(retrieved))
else:
return Respo... |
def update(self, request, _id):
"""
Updates the document with the given _id using the given data
"""
_id = deserialize(_id)
to_update = self.collection.find_one({'_id': _id})
if to_update:
document = self.collection(dict(to_update, **request.json))
... |
def delete(self, request, _id):
"""
Deletes the document with the given _id if it exists
"""
_id = deserialize(_id)
to_delete = self.collection.get({'_id': _id})
if to_delete:
deleted = to_delete.delete()
return Response(
response... |
def with_reactor(*dec_args, **dec_kwargs):
"""
Decorator for test functions that require a running reactor.
Can be used like this::
@with_reactor
def test_connect_to_server(self):
...
Or like this::
@with_reactor(timeout=10)
def test_connec... |
def _ensure_reactor_running():
"""
Starts the twisted reactor if it is not running already.
The reactor is started in a new daemon-thread.
Has to perform dirty hacks so that twisted can register
signals even if it is not running in the main-thread.
"""
if not reactor.running:
... |
def _timeoutDeferred(deferred, timeout):
"""
Cancels the given deferred after the given time, if it has not yet callbacked/errbacked it.
"""
delayedCall = reactor.callLater(timeout, deferred.cancel)
def gotResult(result):
if delayedCall.active():
delayedCall.cancel()
retu... |
def find_prf_cpu(idxPrc, aryFuncChnk, aryPrfTc, aryMdlParams, strVersion,
lgcXval, varNumXval, queOut, lgcRstr=None, lgcPrint=True):
"""
Find best fitting pRF model for voxel time course, using the CPU.
Parameters
----------
idxPrc : int
Process ID of the process calling th... |
def check(schema, rev_id, page_id=None, radius=defaults.RADIUS,
before=None, window=None):
"""
Checks the revert status of a revision. With this method, you can
determine whether an edit is a 'reverting' edit, was 'reverted' by another
edit and/or was 'reverted_to' by another edit.
:Para... |
def check_archive(schema, rev_id, namespace=None, title=None, timestamp=None,
radius=defaults.RADIUS,
before=None, window=None):
"""
Checks the revert status of an archived revision (from a deleted page).
With this method, you can determine whether an edit is a 'reverting... |
def _get_json(value):
"""Convert the given value to a JSON object."""
if hasattr(value, 'replace'):
value = value.replace('\n', ' ')
try:
return json.loads(value)
except json.JSONDecodeError:
# Escape double quotes.
if hasattr(value, 'replace'):
value = value.... |
def save_list(key, *values):
"""Convert the given list of parameters to a JSON object.
JSON object is of the form:
{ key: [values[0], values[1], ... ] },
where values represent the given list of parameters.
"""
return json.dumps({key: [_get_json(value) for value in values]}) |
def save_file(key, file_path, *refs):
"""Convert the given parameters to a special JSON object.
JSON object is of the form:
{ key: {"file": file_path}}, or
{ key: {"file": file_path, "refs": [refs[0], refs[1], ... ]}}
"""
if not os.path.isfile(file_path):
return error("Output '{}' set ... |
def save_file_list(key, *files_refs):
"""Convert the given parameters to a special JSON object.
Each parameter is a file-refs specification of the form:
<file-path>:<reference1>,<reference2>, ...,
where the colon ':' and the list of references are optional.
JSON object is of the form:
{ key: {... |
def save_dir(key, dir_path, *refs):
"""Convert the given parameters to a special JSON object.
JSON object is of the form:
{ key: {"dir": dir_path}}, or
{ key: {"dir": dir_path, "refs": [refs[0], refs[1], ... ]}}
"""
if not os.path.isdir(dir_path):
return error(
"Output '{}'... |
def save_dir_list(key, *dirs_refs):
"""Convert the given parameters to a special JSON object.
Each parameter is a dir-refs specification of the form:
<dir-path>:<reference1>,<reference2>, ...,
where the colon ':' and the list of references are optional.
JSON object is of the form:
{ key: {"dir... |
def progress(progress):
"""Convert given progress to a JSON object.
Check that progress can be represented as float between 0 and 1 and
return it in JSON of the form:
{"proc.progress": progress}
"""
if isinstance(progress, int) or isinstance(progress, float):
progress = float(prog... |
def checkrc(rc, *args):
"""Check if ``rc`` (return code) meets requirements.
Check if ``rc`` is 0 or is in ``args`` list that contains
acceptable return codes.
Last argument of ``args`` can optionally be error message that
is printed if ``rc`` doesn't meet requirements.
Output is JSON of the f... |
def export_file(file_path):
"""Prepend the given parameter with ``export``"""
if not os.path.isfile(file_path):
return error("Referenced file does not exist: '{}'.".format(file_path))
return "export {}".format(file_path) |
def import_file(
src,
file_name,
imported_format=ImportedFormat.BOTH,
progress_from=0.0,
progress_to=None,
):
"""Import file to working directory.
:param src: Source file path or URL
:param file_name: Source file name
:param imported_format: Import file format (extracted, compressed... |
def loadNiiData(lstNiiFls,
strPathNiiMask=None,
strPathNiiFunc=None):
"""load nii data.
Parameters
----------
lstNiiFls : list, list of str with nii file names
strPathNiiMask : str, path to nii file with mask (optional)
strPathNiiFunc : str, p... |
def calcR2(predTst, yTest, axis=0):
"""calculate coefficient of determination. Assumes that axis=0 is time
Parameters
----------
predTst : np.array, predicted reponse for yTest
yTest : np.array, acxtually observed response for yTest
Returns
-------
aryFunc : ... |
def calcFstats(predTst, yTest, p, axis=0):
"""calculate coefficient of determination. Assumes that axis=0 is time
Parameters
----------
predTst : np.array, predicted reponse for yTest
yTest : np.array, acxtually observed response for yTest
p: float, number of predictors
... |
def calcMse(predTst, yTest, axis=0):
"""calculate mean squared error. Assumes that axis=0 is time
Parameters
----------
predTst : np.array, predicted reponse for yTest
yTest : np.array, acxtually observed response for yTest
Returns
-------
aryFunc : np.array
... |
def n_day(date_string):
"""
date_string string in format "(number|a) day(s) ago"
"""
today = datetime.date.today()
match = re.match(r'(\d{1,3}|a) days? ago', date_string)
groups = match.groups()
if groups:
decrement = groups[0]
if decrement... |
def detect(checksum_revisions, radius=defaults.RADIUS):
"""
Detects reverts that occur in a sequence of revisions. Note that,
`revision` data meta will simply be returned in the case of a revert.
This function serves as a convenience wrapper around calls to
:class:`mwreverts.Detector`'s :func:`~mw... |
def getChargeInfo(self, CorpNum, ItemCode, UserID=None):
""" κ³ΌκΈμ 보 νμΈ
args
CorpNum : νμ μ¬μ
μλ²νΈ
ItemCode : μ μλͺ
μΈμ μ’
λ₯μ½λ
UserID : νλΉ νμμμ΄λ
return
κ³ΌκΈμ 보 κ°μ²΄
raise
PopbillException
"""
... |
def getUnitCost(self, CorpNum, ItemCode):
""" μ μλͺ
μΈμ λ°νλ¨κ° νμΈ.
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
return
... |
def FAXSend(self, CorpNum, statement, SendNum, ReceiveNum, UserID=None):
""" μ ν©μ€ μ μ‘
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
statement : μ μλͺ
μΈμ κ°μ²΄
SendNum : ν©μ€ λ°μ λ²νΈ
ReceiveNum : ν©μ€ μμ λ²νΈ
UserID : νλΉνμ μμ΄λ
return
... |
def registIssue(self, CorpNum, statement, Memo=None, UserID=None):
""" μ¦μλ°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
statement : λ±λ‘ν μ μλͺ
μΈμ object. made with Statement(...)
Memo : μ¦μλ°νλ©λͺ¨
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬... |
def register(self, CorpNum, statement, UserID=None):
""" μμμ μ₯
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
statement : λ±λ‘ν μ μλͺ
μΈμ object. made with Statement(...)
UserID : νλΉνμ μμ΄λ
return
μ²λ¦¬κ²°κ³Ό. consist of code and message
ra... |
def update(self, CorpNum, ItemCode, MgtKey, Statement, UserID=None):
""" μμμ μ₯
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
M... |
def issue(self, CorpNum, ItemCode, MgtKey, Memo=None, EmailSubject=None, UserID=None):
""" λ°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
... |
def cancel(self, CorpNum, ItemCode, MgtKey, Memo=None, UserID=None):
""" λ°νμ·¨μ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
M... |
def delete(self, CorpNum, ItemCode, MgtKey, UserID=None):
""" μμ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
MgtKey : ννΈλ λ¬Έ... |
def search(self, CorpNum, DType, SDate, EDate, State, ItemCode, Page, PerPage, Order, UserID=None, QString=None):
""" λͺ©λ‘ μ‘°ν
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
DType : μΌμμ ν, R-λ±λ‘μΌμ, W-μμ±μΌμ, I-λ°νμΌμ μ€ ν 1
SDate : μμμΌμ, νμνμ(yyyyMMdd)
EDate : ... |
def getInfo(self, CorpNum, ItemCode, MgtKey):
""" μν/μμ½ μ 보 νμΈ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
MgtKey : ννΈλ λ¬Έμκ΄λ¦¬... |
def getDetailInfo(self, CorpNum, ItemCode, MgtKey):
""" μ μλͺ
μΈμ μμΈμ 보 νμΈ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
MgtKey : ... |
def sendSMS(self, CorpNum, ItemCode, MgtKey, Sender, Receiver, Contents, UserID=None):
""" μλ¦Όλ¬Έμ μ μ‘
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμ... |
def getLogs(self, CorpNum, ItemCode, MgtKey):
""" μ μλͺ
μΈμ λ¬Έμμ΄λ ₯ λͺ©λ‘ νμΈ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
MgtKey : ννΈλ... |
def attachFile(self, CorpNum, ItemCode, MgtKey, FilePath, UserID=None):
""" νμΌ μ²¨λΆ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
... |
def getFiles(self, CorpNum, ItemCode, MgtKey):
""" 첨λΆνμΌ λͺ©λ‘ νμΈ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
MgtKey : ννΈλ λ¬Έμκ΄λ¦¬... |
def deleteFile(self, CorpNum, ItemCode, MgtKey, FileID, UserID=None):
""" 첨λΆνμΌ μμ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
... |
def getMassPrintURL(self, CorpNum, ItemCode, MgtKeyList, UserID=None):
""" λ€λ μΈμ URL νμΈ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : λͺ
μΈμ μ’
λ₯ μ½λ
[121 - κ±°λλͺ
μΈμ], [122 - μ²κ΅¬μ], [123 - 견μ μ],
[124 - λ°μ£Όμ], [125 - μ
κΈν], [126 - μμμ¦]
... |
def attachStatement(self, CorpNum, ItemCode, MgtKey, SubItemCode, SubMgtKey, UserID=None):
""" λ€λ₯Έ μ μλͺ
μΈμ 첨λΆ
args
CorpNum : νλΉνμ μ¬μ
μλ²νΈ
ItemCode : μ μλͺ
μΈμ μ’
λ₯μ½λ, 121-λͺ
μΈμ, 122-μ²κ΅¬μ, 123-견μ μ, 124-λ°μ£Όμ 125-μ
κΈν, 126-μμμ¦
MgtKey : μ μλͺ
μΈμ λ¬Έμκ΄λ¦¬λ²νΈ
... |
def process(self, article):
"""
Ingests an article and processes it for metadata and elements to provide
proper references in the EPUB spine.
This method may only be called once unless the Package was instantiated
in collection mode using ``Package(collection=True)``. It places ... |
def acquire_metadata(self):
"""
Handles the acquisition of metadata for both collection mode and single
mode, uses the metadata methods belonging to the article's publisher
attribute.
"""
#For space economy
publisher = self.article.publisher
if self.colle... |
def file_manifest(self, location):
"""
An iterator through the files in a location which yields item elements
suitable for insertion into the package manifest.
"""
#Maps file extensions to mimetypes
mimetypes = {'.jpg': 'image/jpeg',
'.jpeg': 'image/j... |
def get_contrib_names(self, contrib):
"""
Returns an appropriate Name and File-As-Name for a contrib element.
This code was refactored out of nav_contributors and
package_contributors to provide a single definition point for a common
job. This is a useful utility that may be wel... |
def package_description(self):
"""
Given an Article class instance, this is responsible for returning an
article description. For this method I have taken the approach of
serializing the article's first abstract, if it has one. This results
in 0 or 1 descriptions per article.
... |
def heading_title(self):
"""
Makes the Article Title for the Heading.
Metadata element, content derived from FrontMatter
"""
art_title = self.article.root.xpath('./front/article-meta/title-group/article-title')[0]
article_title = deepcopy(art_title)
article_title... |
def make_heading_authors(self, authors):
"""
Constructs the Authors content for the Heading. This should display
directly after the Article Title.
Metadata element, content derived from FrontMatter
"""
author_element = etree.Element('h3', {'class': 'authors'})
#C... |
def make_heading_affiliations(self, heading_div):
"""
Makes the content for the Author Affiliations, displays after the
Authors segment in the Heading.
Metadata element, content derived from FrontMatter
"""
#Get all of the aff element tuples from the metadata
aff... |
def make_heading_abstracts(self, heading_div):
"""
An article may contain data for various kinds of abstracts. This method
works on those that are included in the Heading. This is displayed
after the Authors and Affiliations.
Metadata element, content derived from FrontMatter
... |
def make_article_info(self):
"""
The Article Info contains the (self) Citation, Editors, Dates,
Copyright, Funding Statement, Competing Interests Statement,
Correspondence, and Footnotes. Maybe more...
This content follows the Heading and precedes the Main segment in the
... |
def make_article_info_citation(self):
"""
Creates a self citation node for the ArticleInfo of the article.
This method uses code from this page as a reference implementation:
https://github.com/PLOS/ambra/blob/master/base/src/main/resources/articleTransform-v3.xsl
"""
ci... |
def make_article_info_dates(self):
"""
Makes the section containing important dates for the article: typically
Received, Accepted, and Published.
"""
dates_div = etree.Element('div', {'id': 'article-dates'})
d = './front/article-meta/history/date'
received = self... |
def make_article_info_copyright(self, article_info_div):
"""
Makes the copyright section for the ArticleInfo. For PLoS, this means
handling the information contained in the metadata <permissions>
element.
"""
perm = self.article.root.xpath('./front/article-meta/permission... |
def make_article_info_funding(self, article_info_div):
"""
Creates the element for declaring Funding in the article info.
"""
funding_group = self.article.root.xpath('./front/article-meta/funding-group')
if funding_group:
funding_div = etree.SubElement(article_info_di... |
def make_article_info_competing_interests(self, article_info_div):
"""
Creates the element for declaring competing interests in the article
info.
"""
#Check for author-notes
con_expr = "./front/article-meta/author-notes/fn[@fn-type='conflict']"
conflict = self.art... |
def make_article_info_correspondences(self, article_info_div):
"""
Articles generally provide a first contact, typically an email address
for one of the authors. This will supply that content.
"""
corresps = self.article.root.xpath('./front/article-meta/author-notes/corresp')
... |
def make_article_info_footnotes_other(self, article_info_div):
"""
This will catch all of the footnotes of type 'other' in the <fn-group>
of the <back> element.
"""
other_fn_expr = "./back/fn-group/fn[@fn-type='other']"
other_fns = self.article.root.xpath(other_fn_expr)
... |
def make_back_matter(self):
"""
The <back> element may have 0 or 1 <label> elements and 0 or 1 <title>
elements. Then it may have any combination of the following: <ack>,
<app-group>, <bio>, <fn-group>, <glossary>, <ref-list>, <notes>, and
<sec>. <sec> is employed here as a catch... |
def move_back_boxed_texts(self):
"""
The only intended use for this function is to patch a problem seen in
at least one PLoS article (journal.pgen.0020002). This will move any
<boxed-text> elements over to the receiving element, which is probably
the main body.
"""
... |
def make_back_acknowledgments(self):
"""
The <ack> is an important piece of back matter information, and will be
including immediately after the main text.
This element should only occur once, optionally, for PLoS, if a need
becomes known, then multiple instances may be supporte... |
def make_back_author_contributions(self, body):
"""
Though this goes in the back of the document with the rest of the back
matter, it is not an element found under <back>.
I don't expect to see more than one of these. Compare this method to
make_article_info_competing_interests(... |
def make_back_glossary(self, body):
"""
Glossaries are a fairly common item in papers for PLoS, but it also
seems that they are rarely incorporated into the PLoS web-site or PDF
formats. They are included in the ePub output however because they are
helpful and because we can.
... |
def make_back_notes(self, body):
"""
The notes element in PLoS articles can be employed for posting notices
of corrections or adjustments in proof. The <notes> element has a very
diverse content model, but PLoS practice appears to be fairly
consistent: a single <sec> containing a... |
def convert_disp_formula_elements(self):
"""
<disp-formula> elements must be converted to conforming elements
"""
for disp in self.main.getroot().findall('.//disp-formula'):
#find label element
label_el = disp.find('label')
graphic_el = disp.find('grap... |
def convert_inline_formula_elements(self):
"""
<inline-formula> elements must be converted to be conforming
These elements may contain <inline-graphic> elements, textual content,
or both.
"""
for inline in self.main.getroot().findall('.//inline-formula'):
#in... |
def convert_disp_quote_elements(self):
"""
Extract or extended quoted passage from another work, usually made
typographically distinct from surrounding text
<disp-quote> elements have a relatively complex content model, but PLoS
appears to employ either <p>s or <list>s.
... |
def convert_boxed_text_elements(self):
"""
Textual material that is part of the body of text but outside the
flow of the narrative text, for example, a sidebar, marginalia, text
insert (whether enclosed in a box or not), caution, tip, note box, etc.
<boxed-text> elements for PLo... |
def convert_supplementary_material_elements(self):
"""
Supplementary material are not, nor are they generally expected to be,
packaged into the epub file. Though this is a technical possibility,
and certain epub reading systems (such as those run on a PC) might be
reasonably capa... |
def fetch_single_representation(self, item_xlink_href):
"""
This function will render a formatted URL for accessing the PLoS' server
SingleRepresentation of an object.
"""
#A dict of URLs for PLoS subjournals
journal_urls = {'pgen': 'http://www.plosgenetics.org/article/{0... |
def convert_fig_elements(self):
"""
Responsible for the correct conversion of JPTS 3.0 <fig> elements to
EPUB xhtml. Aside from translating <fig> to <img>, the content model
must be edited.
"""
for fig in self.main.getroot().findall('.//fig'):
if fig.getparent... |
def convert_verse_group_elements(self):
"""
A song, poem, or verse
Implementorβs Note: No attempt has been made to retain the look or
visual form of the original poetry.
This unusual element, <verse-group> is used to convey poetry and is
recursive in nature (it may cont... |
def convert_fn_elements(self):
"""
<fn> elements may be used in the main text body outside of tables and
figures for purposes such as erratum notes. It appears that PLoS
practice is to not show erratum notes in the web or pdf formats after
the appropriate corrections have been ma... |
def convert_list_elements(self):
"""
A sequence of two or more items, which may or may not be ordered.
The <list> element has an optional <label> element and optional <title>
element, followed by one or more <list-item> elements. This is element
is recursive as the <list-item> e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.