text stringlengths 81 112k |
|---|
Instantiates a class-based view to provide a view that allows a parent
page to be chosen for a new object, where the assigned model extends
Wagtail's Page model, and there is more than one potential parent for
new instances. The view class used can be overridden by changing the
'choose_p... |
Instantiates a class-based view to provide 'edit' functionality for the
assigned model, or redirect to Wagtail's edit view if the assigned
model extends 'Page'. The view class used can be overridden by changing
the 'edit_view_class' attribute.
def edit_view(self, request, object_id):
"... |
Instantiates a class-based view to provide 'delete confirmation'
functionality for the assigned model, or redirect to Wagtail's delete
confirmation view if the assigned model extends 'Page'. The view class
used can be overridden by changing the 'confirm_delete_view_class'
attribute.
def... |
Instantiates a class-based view that redirects to Wagtail's 'unpublish'
view for models that extend 'Page' (if the user has sufficient
permissions). We do this via our own view so that we can reliably
control redirection of the user back to the index_view once the action
is completed. Th... |
Instantiates a class-based view that redirects to Wagtail's 'copy'
view for models that extend 'Page' (if the user has sufficient
permissions). We do this via our own view so that we can reliably
control redirection of the user back to the index_view once the action
is completed. The vie... |
Utility function that provides a list of templates to try for a given
view, when the template isn't overridden by one of the template
attributes on the class.
def get_templates(self, action='index'):
"""
Utility function that provides a list of templates to try for a given
view,... |
Utilised by Wagtail's 'register_permissions' hook to allow permissions
for a model to be assigned to groups in settings. This is only required
if the model isn't a Page model, and isn't registered as a Snippet
def get_permissions_for_registration(self):
"""
Utilised by Wagtail's 'regist... |
Utilised by Wagtail's 'register_admin_urls' hook to register urls for
our the views that class offers.
def get_admin_urls_for_registration(self):
"""
Utilised by Wagtail's 'register_admin_urls' hook to register urls for
our the views that class offers.
"""
urls = (
... |
Utilised by Wagtail's 'register_menu_item' hook to create a menu
for this group with a SubMenu linking to listing pages for any
associated ModelAdmin instances
def get_menu_item(self):
"""
Utilised by Wagtail's 'register_menu_item' hook to create a menu
for this group with a Sub... |
Utilised by Wagtail's 'register_permissions' hook to allow permissions
for a all models grouped by this class to be assigned to Groups in
settings.
def get_permissions_for_registration(self):
"""
Utilised by Wagtail's 'register_permissions' hook to allow permissions
for a all mo... |
Utilised by Wagtail's 'register_admin_urls' hook to register urls for
used by any associated ModelAdmin instances
def get_admin_urls_for_registration(self):
"""
Utilised by Wagtail's 'register_admin_urls' hook to register urls for
used by any associated ModelAdmin instances
"""
... |
If there aren't any visible items in the submenu, don't bother to show
this menu item
def is_shown(self, request):
"""
If there aren't any visible items in the submenu, don't bother to show
this menu item
"""
for menuitem in self.menu._registered_menu_items:
... |
TEAL interface for the `acscteforwardmodel` function.
def run(configobj=None):
"""
TEAL interface for the `acscteforwardmodel` function.
"""
acscteforwardmodel(configobj['input'],
exec_path=configobj['exec_path'],
time_stamps=configobj['time_stamps'],
... |
TEAL interface for the `acsccd` function.
def run(configobj=None):
"""
TEAL interface for the `acsccd` function.
"""
acsccd(configobj['input'],
exec_path=configobj['exec_path'],
time_stamps=configobj['time_stamps'],
verbose=configobj['verbose'],
quiet=config... |
r"""Calibrate post-SM4 ACS/WFC exposure(s) and use
standalone :ref:`acsdestripe`.
This takes a RAW image and generates a FLT file containing
its calibrated and destriped counterpart.
If CTE correction is performed, FLC will also be present.
Parameters
----------
inputfile : str or list of ... |
TEAL interface for :func:`destripe_plus`.
def run(configobj=None):
"""TEAL interface for :func:`destripe_plus`."""
destripe_plus(
configobj['input'],
suffix=configobj['suffix'],
stat=configobj['stat'],
maxiter=configobj['maxiter'],
sigrej=configobj['sigrej'],
low... |
Command line driver.
def main():
"""Command line driver."""
import argparse
# Parse input parameters
parser = argparse.ArgumentParser(
prog=__taskname__,
description=(
'Run CALACS and standalone acs_destripe script on given post-SM4 '
'ACS/WFC RAW full-frame or ... |
Returns a tuple containing a queryset to implement the search,
and a boolean indicating if the results may contain duplicates.
def get_search_results(self, request, queryset, search_term):
"""
Returns a tuple containing a queryset to implement the search,
and a boolean indicating if the... |
Returns all params except IGNORED_PARAMS
def get_filters_params(self, params=None):
"""
Returns all params except IGNORED_PARAMS
"""
if not params:
params = self.params
lookup_params = params.copy() # a dictionary of the query string
# Remove all the paramet... |
Returns the proper model field name corresponding to the given
field_name to use for ordering. field_name may either be the name of a
proper model field or the name of a method (on the admin or model) or a
callable with the 'admin_order_field' attribute. Returns None if no
proper model f... |
Returns the list of ordering fields for the change list.
First we check the get_ordering() method in model admin, then we check
the object's default ordering. Then, any manually-specified ordering
from the query string overrides anything. Finally, a deterministic
order is guaranteed by e... |
Returns an OrderedDict of ordering field column numbers and asc/desc
def get_ordering_field_columns(self):
"""
Returns an OrderedDict of ordering field column numbers and asc/desc
"""
# We must cope with more than one column having the same underlying
# sort field, so we base t... |
Return a label to display for a field
def get_field_label(self, field_name, field=None):
""" Return a label to display for a field """
label = None
if field is not None:
label = getattr(field, 'verbose_name', None)
if label is None:
label = getattr(field,... |
Return a display value for a field
def get_field_display_value(self, field_name, field=None):
""" Return a display value for a field """
"""
Firstly, check for a 'get_fieldname_display' property/method on
the model, and return the value of that, if present.
"""
val_func... |
Render an image
def get_image_field_display(self, field_name, field):
""" Render an image """
image = getattr(self.instance, field_name)
if image:
fltr, _ = Filter.objects.get_or_create(spec='max-400x400')
rendition = image.get_rendition(fltr)
return renditio... |
Render a link to a document
def get_document_field_display(self, field_name, field):
""" Render a link to a document """
document = getattr(self.instance, field_name)
if document:
return mark_safe(
'<a href="%s">%s <span class="meta">(%s, %s)</span></a>' % (
... |
Return a dictionary containing `label` and `value` values to display
for a field.
def get_dict_for_field(self, field_name):
"""
Return a dictionary containing `label` and `value` values to display
for a field.
"""
try:
field = self.model._meta.get_field(field... |
Return a list of `label`/`value` dictionaries to represent the
fiels named by the model_admin class's `get_inspect_view_fields` method
def get_fields_dict(self):
"""
Return a list of `label`/`value` dictionaries to represent the
fiels named by the model_admin class's `get_inspect_view_f... |
Generates the actual list of data.
def items_for_result(view, result):
"""
Generates the actual list of data.
"""
model_admin = view.model_admin
for field_name in view.list_display:
empty_value_display = model_admin.get_empty_value_display()
row_classes = ['field-%s' % field_name]
... |
Displays the headers and data list together
def result_list(context):
"""
Displays the headers and data list together
"""
view = context['view']
object_list = context['object_list']
headers = list(result_headers(view))
num_sorted_fields = 0
for h in headers:
if h['sortable'] and... |
TEAL interface for the `acssum` function.
def run(configobj=None):
"""
TEAL interface for the `acssum` function.
"""
acssum(configobj['input'],
configobj['output'],
exec_path=configobj['exec_path'],
time_stamps=configobj['time_stamps'],
verbose=configobj['ve... |
Called by :func:`detsat`.
def _detsat_one(filename, ext, sigma=2.0, low_thresh=0.1, h_thresh=0.5,
small_edge=60, line_len=200, line_gap=75,
percentile=(4.5, 93.0), buf=200, plot=False, verbose=False):
"""Called by :func:`detsat`."""
if verbose:
t_beg = time.time()
f... |
Give array shape and desired indices, return indices that are
correctly bounded by the shape.
def _get_valid_indices(shape, ix0, ix1, iy0, iy1):
"""Give array shape and desired indices, return indices that are
correctly bounded by the shape."""
ymax, xmax = shape
if ix0 < 0:
ix0 = 0
if... |
Transform a point from original image coordinates to rotated image
coordinates and back. It assumes the rotation point is the center of an
image.
This works on a simple rotation transformation::
newx = (startx) * np.cos(angle) - (starty) * np.sin(angle)
newy = (startx) * np.sin(angle) + (s... |
Create DQ mask for an image for a given satellite trail.
This mask can be added to existing DQ data using :func:`update_dq`.
.. note::
Unlike :func:`detsat`, multiprocessing is not available for
this function.
Parameters
----------
filename : str
FITS image filename.
... |
Update the given image and DQ extension with the given
satellite trails mask and flag.
Parameters
----------
filename : str
FITS image filename to update.
ext : int, str, or tuple
DQ extension, as accepted by ``astropy.io.fits``, to update.
mask : ndarray
Boolean mask,... |
Multiprocessing worker.
def _satdet_worker(work_queue, done_queue, sigma=2.0, low_thresh=0.1,
h_thresh=0.5, small_edge=60, line_len=200, line_gap=75,
percentile=(4.5, 93.0), buf=200):
"""Multiprocessing worker."""
for fil, chip in iter(work_queue.get, 'STOP'):
try:... |
Find satellite trails in the given images and extensions.
The trails are calculated using Probabilistic Hough Transform.
.. note::
The trail endpoints found here are crude approximations.
Use :func:`make_mask` to create the actual DQ mask for the trail(s)
of interest.
Parameters
... |
Decorator for subscribing a function to a specific event.
:param event: Name of the event to subscribe to.
:type event: str
:return: The outer function.
:rtype: Callable
def on(self, event: str) -> Callable:
""" Decorator for subscribing a function to a specific event.
... |
Adds a function to a event.
:param func: The function to call when event is emitted
:type func: Callable
:param event: Name of the event.
:type event: str
def add_event(self, func: Callable, event: str) -> None:
""" Adds a function to a event.
:param func: The functio... |
Emit an event and run the subscribed functions.
:param event: Name of the event.
:type event: str
.. notes:
Passing in threads=True as a kwarg allows to run emitted events
as separate threads. This can significantly speed up code execution
depending on the c... |
Specifically only emits certain subscribed events.
:param event: Name of the event.
:type event: str
:param func_names: Function(s) to emit.
:type func_names: Union[ str | List[str] ]
def emit_only(self, event: str, func_names: Union[str, List[str]], *args,
**kwargs)... |
Decorator that emits events after the function is completed.
:param event: Name of the event.
:type event: str
:return: Callable
.. note:
This plainly just calls functions without passing params into the
subscribed callables. This is great if you want to do som... |
Removes a subscribed function from a specific event.
:param func_name: The name of the function to be removed.
:type func_name: str
:param event: The name of the event.
:type event: str
:raise EventDoesntExist if there func_name doesn't exist in event.
def remove_event(self, ... |
Returns an Iterable of the functions subscribed to a event.
:param event: Name of the event.
:type event: str
:return: A iterable to do things with.
:rtype: Iterable
def _event_funcs(self, event: str) -> Iterable[Callable]:
""" Returns an Iterable of the functions subscribed t... |
Returns string name of each function subscribed to an event.
:param event: Name of the event.
:type event: str
:return: Names of functions subscribed to a specific event.
:rtype: list
def _event_func_names(self, event: str) -> List[str]:
""" Returns string name of each functio... |
Returns the total amount of subscribed events.
:return: Integer amount events.
:rtype: int
def _subscribed_event_count(self) -> int:
""" Returns the total amount of subscribed events.
:return: Integer amount events.
:rtype: int
"""
event_counter = Counter() # ... |
r"""Remove horizontal stripes from ACS WFC post-SM4 data.
Parameters
----------
input : str or list of str
Input filenames in one of these formats:
* a Python list of filenames
* a partial filename with wildcards ('\*flt.fits')
* filename of an ASN table ('j1234... |
Clean each input image.
Parameters
----------
image : str
Input image name.
output : str
Output image name.
mask : `numpy.ndarray`
Mask array.
maxiter, sigrej, clobber
See :func:`clean`.
dqbits : int, str, or None
Data quality bits to be considere... |
Apply destriping algorithm to input array.
Parameters
----------
image : `StripeArray` object
Arrays are modifed in-place.
stat : str
Statistics for background computations
(see :py:func:`clean` for more details)
mask : `numpy.ndarray`
Mask array. Pixels with zero ... |
Iterative sigma-clipping.
Parameters
----------
InputArr : `numpy.ndarray`
Input image array.
MaxIter, SigRej : see `clean`
Max, Min : float
Max and min values for clipping.
Mask : `numpy.ndarray`
Mask array to indicate pixels to reject, in addition to clipping.
... |
TEAL interface for the `clean` function.
def run(configobj=None):
"""TEAL interface for the `clean` function."""
clean(configobj['input'],
suffix=configobj['suffix'],
stat=configobj['stat'],
maxiter=configobj['maxiter'],
sigrej=configobj['sigrej'],
lower=config... |
Command line driver.
def main():
"""Command line driver."""
import argparse
parser = argparse.ArgumentParser(
prog=__taskname__,
description='Remove horizontal stripes from ACS WFC post-SM4 data.')
parser.add_argument(
'arg0', metavar='input', type=str, help='Input file')
p... |
Get the SCI and ERR data.
def configure_arrays(self):
"""Get the SCI and ERR data."""
self.science = self.hdulist['sci', 1].data
self.err = self.hdulist['err', 1].data
self.dq = self.hdulist['dq', 1].data
if (self.ampstring == 'ABCD'):
self.science = np.concatenate(
... |
Process flatfield.
def ingest_flatfield(self):
"""Process flatfield."""
self.invflat = extract_flatfield(
self.hdulist[0].header, self.hdulist[1])
# If BIAS or DARK, set flatfield to unity
if self.invflat is None:
self.invflat = np.ones_like(self.science)
... |
Process post-flash.
def ingest_flash(self):
"""Process post-flash."""
self.flash = extract_flash(self.hdulist[0].header, self.hdulist[1])
# Set post-flash to zeros
if self.flash is None:
self.flash = np.zeros_like(self.science)
return
# Apply the flash... |
Process dark.
def ingest_dark(self):
"""Process dark."""
self.dark = extract_dark(self.hdulist[0].header, self.hdulist[1])
# If BIAS or DARK, set dark to zeros
if self.dark is None:
self.dark = np.zeros_like(self.science)
return
# Apply the dark subtra... |
Write out the destriped data.
def write_corrected(self, output, clobber=False):
"""Write out the destriped data."""
# un-apply the flatfield if necessary
if self.flatcorr != 'COMPLETE':
self.science = self.science / self.invflat
self.err = self.err / self.invflat
... |
Run the calacs.e executable as from the shell.
By default this will run the calacs given by 'calacs.e'.
Parameters
----------
input_file : str
Name of input file.
exec_path : str, optional
The complete path to a calacs executable.
time_stamps : bool, optional
Set to T... |
TEAL interface for the `calacs` function.
def run(configobj=None):
"""
TEAL interface for the `calacs` function.
"""
calacs(configobj['input_file'],
exec_path=configobj['exec_path'],
time_stamps=configobj['time_stamps'],
temp_files=configobj['temp_files'],
v... |
Return a boolean to indicate whether the supplied user has any
permissions at all on the associated model
def has_any_permissions(self, user):
"""
Return a boolean to indicate whether the supplied user has any
permissions at all on the associated model
"""
for perm in se... |
Identifies possible parent pages for the current user by first looking
at allowed_parent_page_models() on self.model to limit options to the
correct type of page, then checking permissions on those individual
pages to make sure we have permission to add a subpage to it.
def get_valid_parent_pag... |
r"""
Run the acsrej.e executable as from the shell.
Parameters
----------
input : str or list of str
Input filenames in one of these formats:
* a Python list of filenames
* a partial filename with wildcards ('\*flt.fits')
* filename of an ASN table ('j123456... |
TEAL interface for the `acsrej` function.
def run(configobj=None):
"""
TEAL interface for the `acsrej` function.
"""
acsrej(configobj['input'],
configobj['output'],
exec_path=configobj['exec_path'],
time_stamps=configobj['time_stamps'],
verbose=configobj['ve... |
Replace os.fork* with wrappers that use ForkSafeLock to acquire
all locks before forking and release them afterwards.
def monkeypatch_os_fork_functions():
"""
Replace os.fork* with wrappers that use ForkSafeLock to acquire
all locks before forking and release them afterwards.
"""
builtin_functi... |
A Python work-a-like of pthread_atfork.
Any time a fork() is called from Python, all 'prepare' callables will
be called in the order they were registered using this function.
After the fork (successful or not), all 'parent' callables will be called in
the parent process. If the fork succeeded, al... |
Given a list of callables in call_list, call them all in order and save
and return a list of sys.exc_info() tuples for each exception raised.
def _call_atfork_list(call_list):
"""
Given a list of callables in call_list, call them all in order and save
and return a list of sys.exc_info() tuples for each... |
Call all parent after fork callables, release the lock and print
all prepare and parent callback exceptions.
def parent_after_fork_release():
"""
Call all parent after fork callables, release the lock and print
all prepare and parent callback exceptions.
"""
prepare_exceptions = list(_prepare_c... |
Given a list of sys.exc_info tuples, print them all using the traceback
module preceeded by a message and separated by a blank line.
def _print_exception_list(exceptions, message, output_file=None):
"""
Given a list of sys.exc_info tuples, print them all using the traceback
module preceeded by a messag... |
Wraps os.forkpty() to run atfork handlers.
def os_forkpty_wrapper():
"""Wraps os.forkpty() to run atfork handlers."""
pid = None
prepare_to_fork_acquire()
try:
pid, fd = _orig_os_forkpty()
finally:
if pid == 0:
child_after_fork_release()
else:
parent_... |
Wraps an object with a Maybe instance.
>>> maybe("I'm a value")
Something("I'm a value")
>>> maybe(None);
Nothing
Testing for value:
>>> maybe("I'm a value").is_some()
True
>>> maybe("I'm a value").is_none()
False
>>> maybe(None).is_some()
... |
Called after instantiation
def setup(self):
'''Called after instantiation'''
TelnetHandlerBase.setup(self)
# Spawn a greenlet to handle socket input
self.greenlet_ic = eventlet.spawn(self.inputcooker)
# Note that inputcooker exits on EOF
# Sleep for 0.5 second to allow ... |
Put the cooked data in the input queue (no locking needed)
def inputcooker_store_queue(self, char):
"""Put the cooked data in the input queue (no locking needed)"""
if type(char) in [type(()), type([]), type("")]:
for v in char:
self.cookedq.put(v)
else:
... |
Setup the connection.
def setup(self):
'''Setup the connection.'''
log.debug( 'New request from address %s, port %d', self.client_address )
try:
self.transport.load_server_moduli()
except:
log.exception( '(Failed to load moduli -- gex will be unsupporte... |
Translate this class for use in a StreamServer
def streamserver_handle(cls, socket, address):
'''Translate this class for use in a StreamServer'''
request = cls.dummy_request()
request._sock = socket
server = None
cls(request, address, server) |
Request to start a shell on the given channel
def check_channel_shell_request(self, channel):
'''Request to start a shell on the given channel'''
try:
self.channels[channel].start()
except KeyError:
log.error('Requested to start a channel (%r) that was not previously set... |
Request to allocate a PTY terminal.
def check_channel_pty_request(self, channel, term, width, height, pixelwidth,
pixelheight, modes):
'''Request to allocate a PTY terminal.'''
#self.sshterm = term
#print "term: %r, modes: %r" % (term, modes)
log.debug(... |
if py3:
file_size = int(u.getheader("Content-Length")[0])
else:
file_size = int(u.info().getheaders("Content-Length")[0])
def download(url, file_name):
r = requests.get(url, stream=True)
file_size = int(r.headers['Content-length'])
'''
if py3:
file_size = int(u.gethe... |
Request an authentication order. The :py:meth:`collect` method
is used to query the status of the order.
Note that personal number is not needed when authentication is to
be done on the same device, provided that the returned
``autoStartToken`` is used to open the BankID Client.
... |
Request an signing order. The :py:meth:`collect` method
is used to query the status of the order.
Note that personal number is not needed when signing is to be done
on the same device, provided that the returned ``autoStartToken``
is used to open the BankID Client.
Example data... |
Collects the result of a sign or auth order using the
``orderRef`` as reference.
RP should keep on calling collect every two seconds as long as status
indicates pending. RP must abort if status indicates failed. The user
identity is returned when complete.
Example collect resul... |
Cancels an ongoing sign or auth order.
This is typically used if the user cancels the order
in your service or app.
:param order_ref: The UUID string specifying which order to cancel.
:type order_ref: str
:return: Boolean regarding success of cancellation.
:rtype: bool
... |
Called after instantiation
def setup(self):
'''Called after instantiation'''
TelnetHandlerBase.setup(self)
# Spawn a thread to handle socket input
self.thread_ic = threading.Thread(target=self.inputcooker)
self.thread_ic.setDaemon(True)
self.thread_ic.start()
# N... |
Return one character from the input queue
def getc(self, block=True):
"""Return one character from the input queue"""
if not block:
if not len(self.cookedq):
return ''
while not len(self.cookedq):
time.sleep(0.05)
self.IQUEUELOCK.acquire()
... |
Put the cooked data in the input queue (with locking)
def inputcooker_store_queue(self, char):
"""Put the cooked data in the input queue (with locking)"""
self.IQUEUELOCK.acquire()
if type(char) in [type(()), type([]), type("")]:
for v in char:
self.cookedq.append(v)... |
Put data in output queue, rebuild the prompt and entered data
def writemessage(self, text):
"""Put data in output queue, rebuild the prompt and entered data"""
# Need to grab the input queue lock to ensure the entered data doesn't change
# before we're done rebuilding it.
# Note that wr... |
Put data directly into the output queue
def writecooked(self, text):
"""Put data directly into the output queue"""
# Ensure this is the only thread writing
self.OQUEUELOCK.acquire()
TelnetHandlerBase.writecooked(self, text)
self.OQUEUELOCK.release() |
Splits a PKCS12 certificate into Base64-encoded DER certificate and key.
This method splits a potentially password-protected
`PKCS12 <https://en.wikipedia.org/wiki/PKCS_12>`_ certificate
(format ``.p12`` or ``.pfx``) into one certificate and one key part, both in
`pem <https://en.wikipedia.org/wiki/X.5... |
Process chars while not in a part
def process_delimiter(self, char):
'''Process chars while not in a part'''
if char in self.whitespace:
return
if char in self.quote_chars:
# Store the quote type (' or ") and switch to quote processing.
self.inquote = char
... |
Process chars while in a part
def process_part(self, char):
'''Process chars while in a part'''
if char in self.whitespace or char == self.eol_char:
# End of the part.
self.parts.append( ''.join(self.part) )
self.part = []
# Switch back to processing a de... |
Process character while in a quote
def process_quote(self, char):
'''Process character while in a quote'''
if char == self.inquote:
# Quote is finished, switch to part processing.
self.process_char = self.process_part
return
try:
self.part.append(... |
Handle the char after the escape char
def process_escape(self, char):
'''Handle the char after the escape char'''
# Always only run once, switch back to the last processor.
self.process_char = self.last_process_char
if self.part == [] and char in self.whitespace:
# Special c... |
Step through the line and process each character
def process(self, line):
'''Step through the line and process each character'''
self.raw = self.raw + line
try:
if not line[-1] == self.eol_char:
# Should always be here, but add it just in case.
line =... |
Translate this class for use in a StreamServer
def streamserver_handle(cls, sock, address):
'''Translate this class for use in a StreamServer'''
request = cls.false_request()
request._sock = sock
server = None
log.debug("Accepted connection, starting telnet session.")
tr... |
Set the curses structures for this terminal
def setterm(self, term):
"Set the curses structures for this terminal"
log.debug("Setting termtype to %s" % (term, ))
curses.setupterm(term) # This will raise if the termtype is not supported
self.TERM = term
self.ESCSEQ = {}
f... |
Connect incoming connection to a telnet session
def setup(self):
"Connect incoming connection to a telnet session"
try:
self.TERM = self.request.term
except:
pass
self.setterm(self.TERM)
self.sock = self.request._sock
for k in self.DOACK.keys():
... |
End this session
def finish(self):
"End this session"
log.debug("Session disconnected.")
try:
self.sock.shutdown(socket.SHUT_RDWR)
except: pass
self.session_end() |
Negotiate options
def options_handler(self, sock, cmd, opt):
"Negotiate options"
if cmd == NOP:
self.sendcommand(NOP)
elif cmd == WILL or cmd == WONT:
if self.WILLACK.has_key(opt):
self.sendcommand(self.WILLACK[opt], opt)
else:
... |
Send a telnet command (IAC)
def sendcommand(self, cmd, opt=None):
"Send a telnet command (IAC)"
if cmd in [DO, DONT]:
if not self.DOOPTS.has_key(opt):
self.DOOPTS[opt] = None
if (((cmd == DO) and (self.DOOPTS[opt] != True))
or ((cmd == DONT) and (self... |
Echo a recieved character, move cursor etc...
def _readline_echo(self, char, echo):
"""Echo a recieved character, move cursor etc..."""
if self._readline_do_echo(echo):
self.write(char) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.