text stringlengths 81 112k |
|---|
Install just the base environment, no distutils patches etc
def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
"""Install just the base environment, no distutils patches etc"""
if sys.executable.startswith(bin_dir):
print 'Please use the *system* python to run this script'
... |
Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
instead of lib/pythonX.Y. If this is such a platform we'll just create a
symlink so lib64 points to lib
def fix_lib64(lib_dir):
"""
Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
instead of lib/pyt... |
If the executable given isn't an absolute path, search $PATH for the interpreter
def resolve_interpreter(exe):
"""
If the executable given isn't an absolute path, search $PATH for the interpreter
"""
if os.path.abspath(exe) != exe:
paths = os.environ.get('PATH', '').split(os.pathsep)
fo... |
Makes the already-existing environment use relative paths, and takes out
the #!-based environment selection in scripts.
def make_environment_relocatable(home_dir):
"""
Makes the already-existing environment use relative paths, and takes out
the #!-based environment selection in scripts.
"""
act... |
<Purpose>
Generate public and private RSA keys, with modulus length 'bits'. In
addition, a keyid identifier for the RSA key is generated. The object
returned conforms to 'securesystemslib.formats.RSAKEY_SCHEMA' and has the
form:
{'keytype': 'rsa',
'scheme': 'rsassa-pss-sha256',
'keyid':... |
<Purpose>
Generate public and private ECDSA keys, with NIST P-256 + SHA256 (for
hashing) being the default scheme. In addition, a keyid identifier for the
ECDSA key is generated. The object returned conforms to
'securesystemslib.formats.ECDSAKEY_SCHEMA' and has the form:
{'keytype': 'ecdsa-sha2-n... |
<Purpose>
Generate public and private ED25519 keys, both of length 32-bytes, although
they are hexlified to 64 bytes. In addition, a keyid identifier generated
for the returned ED25519 object. The object returned conforms to
'securesystemslib.formats.ED25519KEY_SCHEMA' and has the form:
{'keytype... |
<Purpose>
Return a dictionary conformant to 'securesystemslib.formats.KEY_SCHEMA'.
If 'private' is True, include the private key. The dictionary
returned has the form:
{'keytype': keytype,
'scheme' : scheme,
'keyval': {'public': '...',
'private': '...'}}
or if 'private' ... |
<Purpose>
Construct a key dictionary (e.g., securesystemslib.formats.RSAKEY_SCHEMA)
according to the keytype of 'key_metadata'. The dict returned by this
function has the exact format as the dict returned by one of the key
generations functions, like generate_ed25519_key(). The dict returned
has t... |
Return the keyid of 'key_value'.
def _get_keyid(keytype, scheme, key_value, hash_algorithm = 'sha256'):
"""Return the keyid of 'key_value'."""
# 'keyid' will be generated from an object conformant to KEY_SCHEMA,
# which is the format Metadata files (e.g., root.json) store keys.
# 'format_keyval_to_metadata()'... |
<Purpose>
Return a signature dictionary of the form:
{'keyid': 'f30a0870d026980100c0573bd557394f8c1bbd6...',
'sig': '...'}.
The signing process will use the private key in
key_dict['keyval']['private'] and 'data' to generate the signature.
The following signature schemes are supported:
'... |
<Purpose>
Determine whether the private key belonging to 'key_dict' produced
'signature'. verify_signature() will use the public key found in
'key_dict', the 'sig' objects contained in 'signature', and 'data' to
complete the verification.
>>> ed25519_key = generate_ed25519_key()
>>> data = 'Th... |
<Purpose>
Import the private RSA key stored in 'pem', and generate its public key
(which will also be included in the returned rsakey object). In addition,
a keyid identifier for the RSA key is generated. The object returned
conforms to 'securesystemslib.formats.RSAKEY_SCHEMA' and has the form:
{... |
<Purpose>
Generate an RSA key object from 'pem'. In addition, a keyid identifier for
the RSA key is generated. The object returned conforms to
'securesystemslib.formats.RSAKEY_SCHEMA' and has the form:
{'keytype': 'rsa',
'keyid': keyid,
'keyval': {'public': '-----BEGIN PUBLIC KEY----- ...',... |
<Purpose>
Extract only the portion of the pem that includes the header and footer,
with any leading and trailing characters removed. The string returned has
the following form:
'-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----'
or
'-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIV... |
<Purpose>
Return a string containing 'key_object' in encrypted form. Encrypted
strings may be safely saved to a file. The corresponding decrypt_key()
function can be applied to the encrypted string to restore the original key
object. 'key_object' is a key (e.g., RSAKEY_SCHEMA, ED25519KEY_SCHEMA).
... |
<Purpose>
Return a string containing 'encrypted_key' in non-encrypted form. The
decrypt_key() function can be applied to the encrypted string to restore
the original key object, a key (e.g., RSAKEY_SCHEMA, ED25519KEY_SCHEMA).
This function calls pyca_crypto_keys.py to perform the actual decryption.
... |
<Purpose>
Return a string in PEM format (TraditionalOpenSSL), where the private part
of the RSA key is encrypted using the best available encryption for a given
key's backend. This is a curated (by cryptography.io) encryption choice and
the algorithm may change over time.
c.f. cryptography.io/en/la... |
<Purpose>
Checks if a passed PEM formatted string is a PUBLIC key, by looking for the
following pattern:
'-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----'
>>> rsa_key = generate_rsa_key()
>>> public = rsa_key['keyval']['public']
>>> private = rsa_key['keyval']['private']
>>> is_pem... |
<Purpose>
Checks if a passed PEM formatted string is a PRIVATE key, by looking for
the following patterns:
'-----BEGIN RSA PRIVATE KEY----- ... -----END RSA PRIVATE KEY-----'
'-----BEGIN EC PRIVATE KEY----- ... -----END EC PRIVATE KEY-----'
>>> rsa_key = generate_rsa_key()
>>> private = rsa_ke... |
<Purpose>
Import the private ECDSA key stored in 'pem', and generate its public key
(which will also be included in the returned ECDSA key object). In addition,
a keyid identifier for the ECDSA key is generated. The object returned
conforms to:
{'keytype': 'ecdsa-sha2-nistp256',
'scheme': 'e... |
<Purpose>
Generate an ECDSA key object from 'pem'. In addition, a keyid identifier
for the ECDSA key is generated. The object returned conforms to
'securesystemslib.formats.ECDSAKEY_SCHEMA' and has the form:
{'keytype': 'ecdsa-sha2-nistp256',
'scheme': 'ecdsa-sha2-nistp256',
'keyid': keyid,... |
<Purpose>
Import either a public or private ECDSA PEM. In contrast to the other
explicit import functions (import_ecdsakey_from_public_pem and
import_ecdsakey_from_private_pem), this function is useful for when it is
not known whether 'pem' is private or public.
<Arguments>
pem:
A string i... |
If success, return a tuple (args, body)
def parse_func_body(self):
"""If success, return a tuple (args, body)"""
self.save()
self._expected = []
if self.next_is_rc(Tokens.OPAR, False): # do not render right hidden
self.handle_hidden_right() # render hidden after new level
... |
This method provides easier access to all writers inheriting Writer class
:param class_name: name of the parser (name of the parser class which should be used)
:type class_name: str
:return: Writer subclass specified by parser_name
:rtype: Writer subclass
:raise ValueError:
def... |
Retrieve pupil data
def GetPupil(self):
"""Retrieve pupil data
"""
pupil_data = _co.namedtuple('pupil_data', ['ZemaxApertureType',
'ApertureValue',
'entrancePupilDiameter',
... |
Attempt to ping a list of hosts or networks (can be a single host)
:param targets: List - Name(s) or IP(s) of the host(s).
:param filename: String - name of the file containing hosts to ping
:param status: String - if one of ['alive', 'dead', 'noip'] then only
return results that have th... |
def get_results(cmd: list) -> str:
return lines
Get the ping results using fping.
:param cmd: List - the fping command and its options
:return: String - raw string output containing csv fping results
including the newline characters
def get_results(cmd):
"""
... |
Reads the lines of a file into a list, and returns the list
:param filename: String - path and name of the file
:return: List - lines within the file
def read_file(filename):
"""
Reads the lines of a file into a list, and returns the list
:param filename: String - path and name ... |
Open a ROOT file with option 'RECREATE' to create a new file (the file will
be overwritten if it already exists), and using the ZLIB compression algorithm
(with compression level 1) for better compatibility with older ROOT versions
(see https://root.cern.ch/doc/v614/release-notes.html#important-... |
:param data_in:
:type data_in: hepconverter.parsers.ParsedData
:param data_out: filelike object
:type data_out: file
:param args:
:param kwargs:
def write(self, data_in, data_out, *args, **kwargs):
"""
:param data_in:
:type data_in: hepconverter.parsers.P... |
itertools recipe
"s -> (s0,s1), (s1,s2), (s2, s3), ...
def _pairwise(iterable):
"""
itertools recipe
"s -> (s0,s1), (s1,s2), (s2, s3), ...
"""
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b) |
Return an iterator of tuples for slicing, in 'length' chunks.
Parameters
----------
length : int
Length of each chunk.
total_length : int
Length of the object we are slicing
Returns
-------
iterable of tuples
Values defining a slice range resulting in length 'length... |
Save the numeric results of each source into its corresponding target.
Parameters
----------
sources: list
The list of source arrays for saving from; limited to length 1.
targets: list
The list of target arrays for saving to; limited to length 1.
masked: boolean
Uses a maske... |
Count the non-masked elements of the array along the given axis.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the inp... |
Request the minimum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose minimum is to be found.
axis : None, or int, or iterable of ints
Axis or axes along which the operation is per... |
Request the maximum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose maximum is to be found.
axis : None, or int, or iterable of ints
Axis or axes along which the operation is per... |
Request the sum of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
Parameters
----------
a : Array object
The object whose summation is to be found.
axis : None, or int, or iterable of ints
Axis or axes along which the operation is perfo... |
Request the mean of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the input array.
... |
Request the standard deviation of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the ... |
Request the variance of an Array over any number of axes.
.. note:: Currently limited to operating on a single axis.
:param axis: Axis or axes along which the operation is performed.
The default (axis=None) is to perform the operation
over all the dimensions of the input arra... |
A function to generate the top level biggus ufunc wrappers.
def _ufunc_wrapper(ufunc, name=None):
"""
A function to generate the top level biggus ufunc wrappers.
"""
if not isinstance(ufunc, np.ufunc):
raise TypeError('{} is not a ufunc'.format(ufunc))
ufunc_name = ufunc.__name__
# Ge... |
Returns the shape that results from slicing an array of the given
shape by the given keys.
>>> _sliced_shape(shape=(52350, 70, 90, 180),
... keys=(np.newaxis, slice(None, 10), 3,
... slice(None), slice(2, 3)))
(1, 10, 90, 1)
def _sliced_shape(shape, keys):
"""... |
Given keys such as those passed to ``__getitem__`` for an
array of ndim, return a fully expanded tuple of keys.
In all instances, the result of this operation should follow:
array[keys] == array[_full_keys(keys, array.ndim)]
def _full_keys(keys, ndim):
"""
Given keys such as those passed to `... |
Assert that the given array is an Array subclass (or numpy array).
If the given array is a numpy.ndarray an appropriate NumpyArrayAdapter
instance is created, otherwise the passed array must be a subclass of
:class:`Array` else a TypeError will be raised.
def ensure_array(array):
"""
Assert that t... |
Return a human-readable description of the number of bytes required
to store the data of the given array.
For example::
>>> array.nbytes
14000000
>> biggus.size(array)
'13.35 MiB'
Parameters
----------
array : array-like object
The array object must provide... |
Dispatch the given Chunk onto all the registered output queues.
If the chunk is None, it is silently ignored.
def output(self, chunk):
"""
Dispatch the given Chunk onto all the registered output queues.
If the chunk is None, it is silently ignored.
"""
if chunk is not... |
Emit the Chunk instances which cover the underlying Array.
The Array is divided into chunks with a size limit of
MAX_CHUNK_SIZE which are emitted into all registered output
queues.
def run(self):
"""
Emit the Chunk instances which cover the underlying Array.
The Array ... |
Set the given nodes as inputs for this node.
Creates a limited-size queue.Queue for each input node and
registers each queue as an output of its corresponding node.
def add_input_nodes(self, input_nodes):
"""
Set the given nodes as inputs for this node.
Creates a limited-size ... |
Process the input queues in lock-step, and push any results to
the registered output queues.
def run(self):
"""
Process the input queues in lock-step, and push any results to
the registered output queues.
"""
try:
while True:
input_chunks = [... |
Store the incoming chunk at the corresponding position in the
result array.
def process_chunks(self, chunks):
"""
Store the incoming chunk at the corresponding position in the
result array.
"""
chunk, = chunks
if chunk.keys:
self.result[chunk.keys] =... |
Return a key of type int, slice, or tuple that is guaranteed
to be valid for the given dimension size.
Raises IndexError/TypeError for invalid keys.
def _cleanup_new_key(self, key, size, axis):
"""
Return a key of type int, slice, or tuple that is guaranteed
to be valid for the... |
Return a key of type int, slice, or tuple that represents the
combination of new_key with the given indices.
Raises IndexError/TypeError for invalid keys.
def _remap_new_key(self, indices, new_key, axis):
"""
Return a key of type int, slice, or tuple that represents the
combina... |
Apply the transposition to the target iterable.
Parameters
----------
target - iterable
The iterable to transpose. This would be suitable for things
such as a shape as well as a list of ``__getitem__`` keys.
inverse - bool
Whether to map old dimension... |
Given input chunk keys, compute what keys will be needed to put
the result into the result array.
As an example of where this gets used - when we aggregate on a
particular axis, the source keys may be ``(0:2, None:None)``, but for
an aggregation on axis 0, they would result in target va... |
Implements scalarmult(B, e) more efficiently.
def scalarmult_B(e):
"""
Implements scalarmult(B, e) more efficiently.
"""
# scalarmult(B, l) is the identity
e = e % l
P = ident
for i in range(253):
if e & 1:
P = edwards_add(P, Bpow[i])
e = e // 2
assert e == 0... |
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.
def publickey_unsafe(sk):
"""
Not safe to use with secret keys or secret data.
See module docstring. This function should be used for testing only.
"""
h = H(sk)
a = 2 *... |
<Purpose>
Generate a pair of ed25519 public and private keys with PyNaCl. The public
and private keys returned conform to
'securesystemslib.formats.ED25519PULIC_SCHEMA' and
'securesystemslib.formats.ED25519SEED_SCHEMA', respectively, and have the
form:
'\xa2F\x99\xe0\x86\x80%\xc8\xee\x11\xb95T... |
<Purpose>
Return a (signature, scheme) tuple, where the signature scheme is 'ed25519'
and is always generated by PyNaCl (i.e., 'nacl'). The signature returned
conforms to 'securesystemslib.formats.ED25519SIGNATURE_SCHEMA', and has the
form:
'\xae\xd7\x9f\xaf\x95{bP\x9e\xa8YO Z\x86\x9d...'
A s... |
<Purpose>
Determine whether the private key corresponding to 'public_key' produced
'signature'. verify_signature() will use the public key, the 'scheme' and
'sig', and 'data' arguments to complete the verification.
>>> public, private = generate_public_and_private()
>>> data = b'The quick brown fo... |
Cleanly deletes a file in `n` attempts (if necessary)
def _delete_file(fileName, n=10):
"""Cleanly deletes a file in `n` attempts (if necessary)"""
status = False
count = 0
while not status and count < n:
try:
_os.remove(fileName)
except OSError:
count += 1
... |
Initiates link with OpticStudio DDE server
def zDDEInit(self):
"""Initiates link with OpticStudio DDE server"""
self.pyver = _get_python_version()
# do this only one time or when there is no channel
if _PyZDDE.liveCh==0:
try:
_PyZDDE.server = _dde.CreateServe... |
Close the DDE link with Zemax server
def zDDEClose(self):
"""Close the DDE link with Zemax server"""
if _PyZDDE.server and not _PyZDDE.liveCh:
_PyZDDE.server.Shutdown(self.conversation)
_PyZDDE.server = 0
elif _PyZDDE.server and self.connection and _PyZDDE.liveCh == 1:
... |
Set global timeout value, in seconds, for all DDE calls
def setTimeout(self, time):
"""Set global timeout value, in seconds, for all DDE calls"""
self.conversation.SetDDETimeout(round(time))
return self.conversation.GetDDETimeout() |
Send command to DDE client
def _sendDDEcommand(self, cmd, timeout=None):
"""Send command to DDE client"""
reply = self.conversation.Request(cmd, timeout)
if self.pyver > 2:
reply = reply.decode('ascii').rstrip()
return reply |
Update the lens
def zGetUpdate(self):
"""Update the lens"""
status,ret = -998, None
ret = self._sendDDEcommand("GetUpdate")
if ret != None:
status = int(ret) #Note: Zemax returns -1 if GetUpdate fails.
return status |
Loads a zmx file into the DDE server
def zLoadFile(self, fileName, append=None):
"""Loads a zmx file into the DDE server"""
reply = None
if append:
cmd = "LoadFile,{},{}".format(fileName, append)
else:
cmd = "LoadFile,{}".format(fileName)
reply = self._se... |
Copy lens in the Zemax DDE server into LDE
def zPushLens(self, update=None, timeout=None):
"""Copy lens in the Zemax DDE server into LDE"""
reply = None
if update == 1:
reply = self._sendDDEcommand('PushLens,1', timeout)
elif update == 0 or update is None:
reply ... |
Saves the lens currently loaded in the server to a Zemax file
def zSaveFile(self, fileName):
"""Saves the lens currently loaded in the server to a Zemax file """
cmd = "SaveFile,{}".format(fileName)
reply = self._sendDDEcommand(cmd)
return int(float(reply.rstrip())) |
Turn on sync-with-ui
def zSyncWithUI(self):
"""Turn on sync-with-ui"""
if not OpticalSystem._dde_link:
OpticalSystem._dde_link = _get_new_dde_link()
if not self._sync_ui_file:
self._sync_ui_file = _get_sync_ui_filename()
self._sync_ui = True |
Push lens in ZOS COM server to UI
def zPushLens(self, update=None):
"""Push lens in ZOS COM server to UI"""
self.SaveAs(self._sync_ui_file)
OpticalSystem._dde_link.zLoadFile(self._sync_ui_file)
OpticalSystem._dde_link.zPushLens(update) |
Copy lens in UI to headless ZOS COM server
def zGetRefresh(self):
"""Copy lens in UI to headless ZOS COM server"""
OpticalSystem._dde_link.zGetRefresh()
OpticalSystem._dde_link.zSaveFile(self._sync_ui_file)
self._iopticalsystem.LoadFile (self._sync_ui_file, False) |
Saves the current system to the specified file.
@param filename: absolute path (string)
@return: None
@raise: ValueError if path (excluding the zemax file name) is not valid
All future calls to `Save()` will use the same file.
def SaveAs(self, filename):
"""Saves the current... |
Saves the current system
def Save(self):
"""Saves the current system"""
# This method is intercepted to allow ui_sync
if self._file_to_save_on_Save:
self._iopticalsystem.SaveAs(self._file_to_save_on_Save)
else:
self._iopticalsystem.Save() |
Return surface data
def zGetSurfaceData(self, surfNum):
"""Return surface data"""
if self.pMode == 0: # Sequential mode
surf_data = _co.namedtuple('surface_data', ['radius', 'thick', 'material', 'semidia',
'conic', 'comment'])
... |
Sets surface data
def zSetSurfaceData(self, surfNum, radius=None, thick=None, material=None, semidia=None,
conic=None, comment=None):
"""Sets surface data"""
if self.pMode == 0: # Sequential mode
surf = self.pLDE.GetSurfaceAt(surfNum)
if radius is not No... |
Sets the default merit function for Sequential Merit Function Editor
Parameters
----------
ofType : integer
optimization function type (0=RMS, ...)
ofData : integer
optimization function data (0=Wavefront, 1=Spot Radius, ...)
ofRef : integer
... |
<Purpose>
Convert 'datetime_object' (in datetime.datetime()) format) to a Unix/POSIX
timestamp. For example, Python's time.time() returns a Unix timestamp, and
includes the number of microseconds. 'datetime_object' is converted to UTC.
>>> datetime_object = datetime.datetime(1985, 10, 26, 1, 22)
... |
<Purpose>
Convert 'unix_timestamp' (i.e., POSIX time, in UNIX_TIMESTAMP_SCHEMA format)
to a datetime.datetime() object. 'unix_timestamp' is the number of seconds
since the epoch (January 1, 1970.)
>>> datetime_object = unix_timestamp_to_datetime(1445455680)
>>> datetime_object
datetime.datetim... |
<Purpose>
Return the base64 encoding of 'data' with whitespace and '=' signs omitted.
<Arguments>
data:
Binary or buffer of data to convert.
<Exceptions>
securesystemslib.exceptions.FormatError, if the base64 encoding fails or the
argument is invalid.
<Side Effects>
None.
<Returns>... |
<Purpose>
Parse a base64 encoding with whitespace and '=' signs omitted.
<Arguments>
base64_string:
A string holding a base64 value.
<Exceptions>
securesystemslib.exceptions.FormatError, if 'base64_string' cannot be parsed
due to an invalid base64 encoding.
<Side Effects>
None.
<Re... |
<Purpose>
Encode 'object' in canonical JSON form, as specified at
http://wiki.laptop.org/go/Canonical_JSON . It's a restricted
dialect of JSON in which keys are always lexically sorted,
there is no whitespace, floats aren't allowed, and only quote
and backslash get escaped. The result is encoded i... |
Process the error labels of a dependent variable 'value' to ensure uniqueness.
def process_error_labels(value):
""" Process the error labels of a dependent variable 'value' to ensure uniqueness. """
observed_error_labels = {}
for error in value.get('errors', []):
label = error.get(... |
Returns a raw string representation of text
def raw(text):
"""Returns a raw string representation of text"""
new_string = ''
for char in text:
try:
new_string += escape_dict[char]
except KeyError:
new_string += char
return new_string |
Retrieve a function from a library/DLL, and set the data types.
def get_winfunc(libname, funcname, restype=None, argtypes=(), _libcache={}):
"""Retrieve a function from a library/DLL, and set the data types."""
if libname not in _libcache:
_libcache[libname] = windll.LoadLibrary(libname)
func = get... |
Run the main windows message loop.
def WinMSGLoop():
"""Run the main windows message loop."""
LPMSG = POINTER(MSG)
LRESULT = c_ulong
GetMessage = get_winfunc("user32", "GetMessageW", BOOL, (LPMSG, HWND, UINT, UINT))
TranslateMessage = get_winfunc("user32", "TranslateMessage", BOOL, (LPMSG,))
# ... |
Exceptional error is handled in zdde Init() method, so the exception
must be re-raised
def ConnectTo(self, appName, data=None):
"""Exceptional error is handled in zdde Init() method, so the exception
must be re-raised"""
global number_of_apps_communicating
self.ddeServerName = a... |
Request DDE client
timeout in seconds
Note ... handle the exception within this function.
def Request(self, item, timeout=None):
"""Request DDE client
timeout in seconds
Note ... handle the exception within this function.
"""
if not timeout:
timeout =... |
Request updates when DDE data changes.
def advise(self, item, stop=False):
"""Request updates when DDE data changes."""
hszItem = DDE.CreateStringHandle(self._idInst, item, CP_WINUNICODE)
hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_ADVSTOP if stop else XTYP... |
Execute a DDE command.
def execute(self, command):
"""Execute a DDE command."""
pData = c_char_p(command)
cbData = DWORD(len(command) + 1)
hDdeData = DDE.ClientTransaction(pData, cbData, self._hConv, HSZ(), CF_TEXT, XTYP_EXECUTE, TIMEOUT_ASYNC, LPDWORD())
if not hDdeData:
... |
Request data from DDE service.
def request(self, item, timeout=5000):
"""Request data from DDE service."""
hszItem = DDE.CreateStringHandle(self._idInst, item, CP_WINUNICODE)
#hDdeData = DDE.ClientTransaction(LPBYTE(), 0, self._hConv, hszItem, CF_TEXT, XTYP_REQUEST, timeout, LPDWORD())
... |
DdeCallback callback function for processing Dynamic Data Exchange (DDE)
transactions sent by DDEML in response to DDE events
Parameters
----------
wType : transaction type (UINT)
uFmt : clipboard data format (UINT)
hConv : handle to conversation (HCONV)
... |
:param data_in: path to submission.yaml
:param args:
:param kwargs:
:raise ValueError:
def parse(self, data_in, *args, **kwargs):
"""
:param data_in: path to submission.yaml
:param args:
:param kwargs:
:raise ValueError:
"""
if not os.path... |
generate_ai_request
:param predict_rows: list of predict rows to build into the request
:param req_dict: request dictionary to update - for long-running clients
:param req_file: file holding a request dict to update - one-off tests
:param features: features to process in the data
:param ignore_feat... |
get_ml_job
Get an ``MLJob`` by database id.
def get_ml_job():
"""get_ml_job
Get an ``MLJob`` by database id.
"""
parser = argparse.ArgumentParser(
description=("Python client get AI Job by ID"))
parser.add_argument(
"-u",
help="username",
required=False,
... |
Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
Set the amount of comments to
usage:
{% get_molo_comments for object as variable_name %}
{% get_molo_comments for object as variable_name limit amount %}
{% get_mo... |
Get a limited set of comments for a given object.
Defaults to a limit of 5. Setting the limit to -1 disables limiting.
usage:
{% get_comments_content_object for form_object as variable_name %}
def get_comments_content_object(parser, token):
"""
Get a limited set of comments for a given object... |
Flags a comment on GET.
Redirects to whatever is provided in request.REQUEST['next'].
def report(request, comment_id):
"""
Flags a comment on GET.
Redirects to whatever is provided in request.REQUEST['next'].
"""
comment = get_object_or_404(
django_comments.get_model(), pk=comment_id... |
Allows for posting of a Molo Comment, this allows comments to
be set with the "user_name" as "Anonymous"
def post_molo_comment(request, next=None, using=None):
"""
Allows for posting of a Molo Comment, this allows comments to
be set with the "user_name" as "Anonymous"
"""
data = request.POST.co... |
build_ai_client_from_env
Use environment variables to build a client
:param verbose: verbose logging
:param debug: debug internal client calls
:param ca_dir: optional path to CA bundle dir
:param cert_file: optional path to x509 ssl cert file
:param key_file: optional path to x509 ssl key file... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.