repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
getCoords
def getCoords(x, y, w, h, pagesize): """ As a stupid programmer I like to use the upper left corner of the document as the 0,0 coords therefore we need to do some fancy calculations """ #~ print pagesize ax, ay = pagesize if x < 0: x = ax + x if y < 0: y = ay + y ...
python
def getCoords(x, y, w, h, pagesize): """ As a stupid programmer I like to use the upper left corner of the document as the 0,0 coords therefore we need to do some fancy calculations """ #~ print pagesize ax, ay = pagesize if x < 0: x = ax + x if y < 0: y = ay + y ...
[ "def", "getCoords", "(", "x", ",", "y", ",", "w", ",", "h", ",", "pagesize", ")", ":", "#~ print pagesize", "ax", ",", "ay", "=", "pagesize", "if", "x", "<", "0", ":", "x", "=", "ax", "+", "x", "if", "y", "<", "0", ":", "y", "=", "ay", "+",...
As a stupid programmer I like to use the upper left corner of the document as the 0,0 coords therefore we need to do some fancy calculations
[ "As", "a", "stupid", "programmer", "I", "like", "to", "use", "the", "upper", "left", "corner", "of", "the", "document", "as", "the", "0", "0", "coords", "therefore", "we", "need", "to", "do", "some", "fancy", "calculations" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L336-L354
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
getFrameDimensions
def getFrameDimensions(data, page_width, page_height): """Calculate dimensions of a frame Returns left, top, width and height of the frame in points. """ box = data.get("-pdf-frame-box", []) if len(box) == 4: return [getSize(x) for x in box] top = getSize(data.get("top", 0)) left = ...
python
def getFrameDimensions(data, page_width, page_height): """Calculate dimensions of a frame Returns left, top, width and height of the frame in points. """ box = data.get("-pdf-frame-box", []) if len(box) == 4: return [getSize(x) for x in box] top = getSize(data.get("top", 0)) left = ...
[ "def", "getFrameDimensions", "(", "data", ",", "page_width", ",", "page_height", ")", ":", "box", "=", "data", ".", "get", "(", "\"-pdf-frame-box\"", ",", "[", "]", ")", "if", "len", "(", "box", ")", "==", "4", ":", "return", "[", "getSize", "(", "x"...
Calculate dimensions of a frame Returns left, top, width and height of the frame in points.
[ "Calculate", "dimensions", "of", "a", "frame" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L372-L407
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
getPos
def getPos(position, pagesize): """ Pair of coordinates """ position = str(position).split() if len(position) != 2: raise Exception("position not defined right way") x, y = [getSize(pos) for pos in position] return getCoords(x, y, None, None, pagesize)
python
def getPos(position, pagesize): """ Pair of coordinates """ position = str(position).split() if len(position) != 2: raise Exception("position not defined right way") x, y = [getSize(pos) for pos in position] return getCoords(x, y, None, None, pagesize)
[ "def", "getPos", "(", "position", ",", "pagesize", ")", ":", "position", "=", "str", "(", "position", ")", ".", "split", "(", ")", "if", "len", "(", "position", ")", "!=", "2", ":", "raise", "Exception", "(", "\"position not defined right way\"", ")", "x...
Pair of coordinates
[ "Pair", "of", "coordinates" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L411-L419
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
pisaTempFile.makeTempFile
def makeTempFile(self): """ Switch to next startegy. If an error occured, stay with the first strategy """ if self.strategy == 0: try: new_delegate = self.STRATEGIES[1]() new_delegate.write(self.getvalue()) self._delega...
python
def makeTempFile(self): """ Switch to next startegy. If an error occured, stay with the first strategy """ if self.strategy == 0: try: new_delegate = self.STRATEGIES[1]() new_delegate.write(self.getvalue()) self._delega...
[ "def", "makeTempFile", "(", "self", ")", ":", "if", "self", ".", "strategy", "==", "0", ":", "try", ":", "new_delegate", "=", "self", ".", "STRATEGIES", "[", "1", "]", "(", ")", "new_delegate", ".", "write", "(", "self", ".", "getvalue", "(", ")", ...
Switch to next startegy. If an error occured, stay with the first strategy
[ "Switch", "to", "next", "startegy", ".", "If", "an", "error", "occured", "stay", "with", "the", "first", "strategy" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L497-L511
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
pisaTempFile.getvalue
def getvalue(self): """ Get value of file. Work around for second strategy. Always returns bytes """ if self.strategy == 0: return self._delegate.getvalue() self._delegate.flush() self._delegate.seek(0) value = self._delegate.read() if...
python
def getvalue(self): """ Get value of file. Work around for second strategy. Always returns bytes """ if self.strategy == 0: return self._delegate.getvalue() self._delegate.flush() self._delegate.seek(0) value = self._delegate.read() if...
[ "def", "getvalue", "(", "self", ")", ":", "if", "self", ".", "strategy", "==", "0", ":", "return", "self", ".", "_delegate", ".", "getvalue", "(", ")", "self", ".", "_delegate", ".", "flush", "(", ")", "self", ".", "_delegate", ".", "seek", "(", "0...
Get value of file. Work around for second strategy. Always returns bytes
[ "Get", "value", "of", "file", ".", "Work", "around", "for", "second", "strategy", ".", "Always", "returns", "bytes" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L529-L542
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
pisaTempFile.write
def write(self, value): """ If capacity != -1 and length of file > capacity it is time to switch """ if self.capacity > 0 and self.strategy == 0: len_value = len(value) if len_value >= self.capacity: needs_new_strategy = True else: ...
python
def write(self, value): """ If capacity != -1 and length of file > capacity it is time to switch """ if self.capacity > 0 and self.strategy == 0: len_value = len(value) if len_value >= self.capacity: needs_new_strategy = True else: ...
[ "def", "write", "(", "self", ",", "value", ")", ":", "if", "self", ".", "capacity", ">", "0", "and", "self", ".", "strategy", "==", "0", ":", "len_value", "=", "len", "(", "value", ")", "if", "len_value", ">=", "self", ".", "capacity", ":", "needs_...
If capacity != -1 and length of file > capacity it is time to switch
[ "If", "capacity", "!", "=", "-", "1", "and", "length", "of", "file", ">", "capacity", "it", "is", "time", "to", "switch" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L544-L563
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/util.py
pisaFileObject.setMimeTypeByName
def setMimeTypeByName(self, name): " Guess the mime type " mimetype = mimetypes.guess_type(name)[0] if mimetype is not None: self.mimetype = mimetypes.guess_type(name)[0].split(";")[0]
python
def setMimeTypeByName(self, name): " Guess the mime type " mimetype = mimetypes.guess_type(name)[0] if mimetype is not None: self.mimetype = mimetypes.guess_type(name)[0].split(";")[0]
[ "def", "setMimeTypeByName", "(", "self", ",", "name", ")", ":", "mimetype", "=", "mimetypes", ".", "guess_type", "(", "name", ")", "[", "0", "]", "if", "mimetype", "is", "not", "None", ":", "self", ".", "mimetype", "=", "mimetypes", ".", "guess_type", ...
Guess the mime type
[ "Guess", "the", "mime", "type" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/util.py#L732-L736
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
_sameFrag
def _sameFrag(f, g): """ returns 1 if two ParaFrags map out the same """ if (hasattr(f, 'cbDefn') or hasattr(g, 'cbDefn') or hasattr(f, 'lineBreak') or hasattr(g, 'lineBreak')): return 0 for a in ('fontName', 'fontSize', 'textColor', 'backColor', 'rise', 'underline', 'strike', 'link'): ...
python
def _sameFrag(f, g): """ returns 1 if two ParaFrags map out the same """ if (hasattr(f, 'cbDefn') or hasattr(g, 'cbDefn') or hasattr(f, 'lineBreak') or hasattr(g, 'lineBreak')): return 0 for a in ('fontName', 'fontSize', 'textColor', 'backColor', 'rise', 'underline', 'strike', 'link'): ...
[ "def", "_sameFrag", "(", "f", ",", "g", ")", ":", "if", "(", "hasattr", "(", "f", ",", "'cbDefn'", ")", "or", "hasattr", "(", "g", ",", "'cbDefn'", ")", "or", "hasattr", "(", "f", ",", "'lineBreak'", ")", "or", "hasattr", "(", "g", ",", "'lineBre...
returns 1 if two ParaFrags map out the same
[ "returns", "1", "if", "two", "ParaFrags", "map", "out", "the", "same" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L417-L426
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
_drawBullet
def _drawBullet(canvas, offset, cur_y, bulletText, style): """ draw a bullet text could be a simple string or a frag list """ tx2 = canvas.beginText(style.bulletIndent, cur_y + getattr(style, "bulletOffsetY", 0)) tx2.setFont(style.bulletFontName, style.bulletFontSize) tx2.setFillColor(hasattr(s...
python
def _drawBullet(canvas, offset, cur_y, bulletText, style): """ draw a bullet text could be a simple string or a frag list """ tx2 = canvas.beginText(style.bulletIndent, cur_y + getattr(style, "bulletOffsetY", 0)) tx2.setFont(style.bulletFontName, style.bulletFontSize) tx2.setFillColor(hasattr(s...
[ "def", "_drawBullet", "(", "canvas", ",", "offset", ",", "cur_y", ",", "bulletText", ",", "style", ")", ":", "tx2", "=", "canvas", ".", "beginText", "(", "style", ".", "bulletIndent", ",", "cur_y", "+", "getattr", "(", "style", ",", "\"bulletOffsetY\"", ...
draw a bullet text could be a simple string or a frag list
[ "draw", "a", "bullet", "text", "could", "be", "a", "simple", "string", "or", "a", "frag", "list" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L536-L570
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
splitLines0
def splitLines0(frags, widths): """ given a list of ParaFrags we return a list of ParaLines each ParaLine has 1) ExtraSpace 2) blankCount 3) [textDefns....] each text definition is a (ParaFrag, start, limit) triplet """ #initialise the algorithm lineNum = 0 maxW = wi...
python
def splitLines0(frags, widths): """ given a list of ParaFrags we return a list of ParaLines each ParaLine has 1) ExtraSpace 2) blankCount 3) [textDefns....] each text definition is a (ParaFrag, start, limit) triplet """ #initialise the algorithm lineNum = 0 maxW = wi...
[ "def", "splitLines0", "(", "frags", ",", "widths", ")", ":", "#initialise the algorithm", "lineNum", "=", "0", "maxW", "=", "widths", "[", "lineNum", "]", "i", "=", "-", "1", "l", "=", "len", "(", "frags", ")", "lim", "=", "start", "=", "0", "text", ...
given a list of ParaFrags we return a list of ParaLines each ParaLine has 1) ExtraSpace 2) blankCount 3) [textDefns....] each text definition is a (ParaFrag, start, limit) triplet
[ "given", "a", "list", "of", "ParaFrags", "we", "return", "a", "list", "of", "ParaLines" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L592-L652
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
cjkFragSplit
def cjkFragSplit(frags, maxWidths, calcBounds, encoding='utf8'): """ This attempts to be wordSplit for frags using the dumb algorithm """ from reportlab.rl_config import _FUZZ U = [] # get a list of single glyphs with their widths etc etc for f in frags: text = f.text if not i...
python
def cjkFragSplit(frags, maxWidths, calcBounds, encoding='utf8'): """ This attempts to be wordSplit for frags using the dumb algorithm """ from reportlab.rl_config import _FUZZ U = [] # get a list of single glyphs with their widths etc etc for f in frags: text = f.text if not i...
[ "def", "cjkFragSplit", "(", "frags", ",", "maxWidths", ",", "calcBounds", ",", "encoding", "=", "'utf8'", ")", ":", "from", "reportlab", ".", "rl_config", "import", "_FUZZ", "U", "=", "[", "]", "# get a list of single glyphs with their widths etc etc", "for", "f",...
This attempts to be wordSplit for frags using the dumb algorithm
[ "This", "attempts", "to", "be", "wordSplit", "for", "frags", "using", "the", "dumb", "algorithm" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L854-L904
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
Paragraph.minWidth
def minWidth(self): """ Attempt to determine a minimum sensible width """ frags = self.frags nFrags = len(frags) if not nFrags: return 0 if nFrags == 1: f = frags[0] fS = f.fontSize fN = f.fontName words = hasattr(f...
python
def minWidth(self): """ Attempt to determine a minimum sensible width """ frags = self.frags nFrags = len(frags) if not nFrags: return 0 if nFrags == 1: f = frags[0] fS = f.fontSize fN = f.fontName words = hasattr(f...
[ "def", "minWidth", "(", "self", ")", ":", "frags", "=", "self", ".", "frags", "nFrags", "=", "len", "(", "frags", ")", "if", "not", "nFrags", ":", "return", "0", "if", "nFrags", "==", "1", ":", "f", "=", "frags", "[", "0", "]", "fS", "=", "f", ...
Attempt to determine a minimum sensible width
[ "Attempt", "to", "determine", "a", "minimum", "sensible", "width" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L1043-L1060
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
Paragraph.breakLinesCJK
def breakLinesCJK(self, width): """Initially, the dumbest possible wrapping algorithm. Cannot handle font variations.""" if self.debug: print (id(self), "breakLinesCJK") if not isinstance(width, (list, tuple)): maxWidths = [width] else: maxWi...
python
def breakLinesCJK(self, width): """Initially, the dumbest possible wrapping algorithm. Cannot handle font variations.""" if self.debug: print (id(self), "breakLinesCJK") if not isinstance(width, (list, tuple)): maxWidths = [width] else: maxWi...
[ "def", "breakLinesCJK", "(", "self", ",", "width", ")", ":", "if", "self", ".", "debug", ":", "print", "(", "id", "(", "self", ")", ",", "\"breakLinesCJK\"", ")", "if", "not", "isinstance", "(", "width", ",", "(", "list", ",", "tuple", ")", ")", ":...
Initially, the dumbest possible wrapping algorithm. Cannot handle font variations.
[ "Initially", "the", "dumbest", "possible", "wrapping", "algorithm", ".", "Cannot", "handle", "font", "variations", "." ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L1409-L1456
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
Paragraph.getPlainText
def getPlainText(self, identify=None): """ Convenience function for templates which want access to the raw text, without XML tags. """ frags = getattr(self, 'frags', None) if frags: plains = [] for frag in frags: if hasattr(frag, '...
python
def getPlainText(self, identify=None): """ Convenience function for templates which want access to the raw text, without XML tags. """ frags = getattr(self, 'frags', None) if frags: plains = [] for frag in frags: if hasattr(frag, '...
[ "def", "getPlainText", "(", "self", ",", "identify", "=", "None", ")", ":", "frags", "=", "getattr", "(", "self", ",", "'frags'", ",", "None", ")", "if", "frags", ":", "plains", "=", "[", "]", "for", "frag", "in", "frags", ":", "if", "hasattr", "("...
Convenience function for templates which want access to the raw text, without XML tags.
[ "Convenience", "function", "for", "templates", "which", "want", "access", "to", "the", "raw", "text", "without", "XML", "tags", "." ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L1657-L1675
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/reportlab_paragraph.py
Paragraph.getActualLineWidths0
def getActualLineWidths0(self): """ Convenience function; tells you how wide each line actually is. For justified styles, this will be the same as the wrap width; for others it might be useful for seeing if paragraphs will fit in spaces. """ assert hasattr(self,...
python
def getActualLineWidths0(self): """ Convenience function; tells you how wide each line actually is. For justified styles, this will be the same as the wrap width; for others it might be useful for seeing if paragraphs will fit in spaces. """ assert hasattr(self,...
[ "def", "getActualLineWidths0", "(", "self", ")", ":", "assert", "hasattr", "(", "self", ",", "'width'", ")", ",", "\"Cannot call this method before wrap()\"", "if", "self", ".", "blPara", ".", "kind", ":", "func", "=", "lambda", "frag", ",", "w", "=", "self"...
Convenience function; tells you how wide each line actually is. For justified styles, this will be the same as the wrap width; for others it might be useful for seeing if paragraphs will fit in spaces.
[ "Convenience", "function", ";", "tells", "you", "how", "wide", "each", "line", "actually", "is", ".", "For", "justified", "styles", "this", "will", "be", "the", "same", "as", "the", "wrap", "width", ";", "for", "others", "it", "might", "be", "useful", "f...
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/reportlab_paragraph.py#L1677-L1690
train
xhtml2pdf/xhtml2pdf
demo/djangoproject/views.py
link_callback
def link_callback(uri, rel): """ Convert HTML URIs to absolute system paths so xhtml2pdf can access those resources """ # use short variable names sUrl = settings.STATIC_URL # Typically /static/ sRoot = settings.STATIC_ROOT # Typically /home/userX/project_static/ mUrl = settings....
python
def link_callback(uri, rel): """ Convert HTML URIs to absolute system paths so xhtml2pdf can access those resources """ # use short variable names sUrl = settings.STATIC_URL # Typically /static/ sRoot = settings.STATIC_ROOT # Typically /home/userX/project_static/ mUrl = settings....
[ "def", "link_callback", "(", "uri", ",", "rel", ")", ":", "# use short variable names", "sUrl", "=", "settings", ".", "STATIC_URL", "# Typically /static/", "sRoot", "=", "settings", ".", "STATIC_ROOT", "# Typically /home/userX/project_static/", "mUrl", "=", "settings", ...
Convert HTML URIs to absolute system paths so xhtml2pdf can access those resources
[ "Convert", "HTML", "URIs", "to", "absolute", "system", "paths", "so", "xhtml2pdf", "can", "access", "those", "resources" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/demo/djangoproject/views.py#L23-L48
train
xhtml2pdf/xhtml2pdf
demo/tgpisa/tgpisa/commands.py
start
def start(): """Start the CherryPy application server.""" setupdir = dirname(dirname(__file__)) curdir = os.getcwd() # First look on the command line for a desired config file, # if it's not on the command line, then look for 'setup.py' # in the current directory. If there, load configuration ...
python
def start(): """Start the CherryPy application server.""" setupdir = dirname(dirname(__file__)) curdir = os.getcwd() # First look on the command line for a desired config file, # if it's not on the command line, then look for 'setup.py' # in the current directory. If there, load configuration ...
[ "def", "start", "(", ")", ":", "setupdir", "=", "dirname", "(", "dirname", "(", "__file__", ")", ")", "curdir", "=", "os", ".", "getcwd", "(", ")", "# First look on the command line for a desired config file,", "# if it's not on the command line, then look for 'setup.py'"...
Start the CherryPy application server.
[ "Start", "the", "CherryPy", "application", "server", "." ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/demo/tgpisa/tgpisa/commands.py#L20-L52
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/w3c/css.py
CSSRuleset.mergeStyles
def mergeStyles(self, styles): " XXX Bugfix for use in PISA " for k, v in six.iteritems(styles): if k in self and self[k]: self[k] = copy.copy(self[k]) self[k].update(v) else: self[k] = v
python
def mergeStyles(self, styles): " XXX Bugfix for use in PISA " for k, v in six.iteritems(styles): if k in self and self[k]: self[k] = copy.copy(self[k]) self[k].update(v) else: self[k] = v
[ "def", "mergeStyles", "(", "self", ",", "styles", ")", ":", "for", "k", ",", "v", "in", "six", ".", "iteritems", "(", "styles", ")", ":", "if", "k", "in", "self", "and", "self", "[", "k", "]", ":", "self", "[", "k", "]", "=", "copy", ".", "co...
XXX Bugfix for use in PISA
[ "XXX", "Bugfix", "for", "use", "in", "PISA" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/w3c/css.py#L697-L704
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/w3c/css.py
CSSBuilder.atPage
def atPage(self, page, pseudopage, declarations): """ This is overriden by xhtml2pdf.context.pisaCSSBuilder """ return self.ruleset([self.selector('*')], declarations)
python
def atPage(self, page, pseudopage, declarations): """ This is overriden by xhtml2pdf.context.pisaCSSBuilder """ return self.ruleset([self.selector('*')], declarations)
[ "def", "atPage", "(", "self", ",", "page", ",", "pseudopage", ",", "declarations", ")", ":", "return", "self", ".", "ruleset", "(", "[", "self", ".", "selector", "(", "'*'", ")", "]", ",", "declarations", ")" ]
This is overriden by xhtml2pdf.context.pisaCSSBuilder
[ "This", "is", "overriden", "by", "xhtml2pdf", ".", "context", ".", "pisaCSSBuilder" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/w3c/css.py#L905-L909
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/xhtml2pdf_reportlab.py
PmlBaseDoc.handle_nextPageTemplate
def handle_nextPageTemplate(self, pt): ''' if pt has also templates for even and odd page convert it to list ''' has_left_template = self._has_template_for_name(pt + '_left') has_right_template = self._has_template_for_name(pt + '_right') if has_left_template and has_rig...
python
def handle_nextPageTemplate(self, pt): ''' if pt has also templates for even and odd page convert it to list ''' has_left_template = self._has_template_for_name(pt + '_left') has_right_template = self._has_template_for_name(pt + '_right') if has_left_template and has_rig...
[ "def", "handle_nextPageTemplate", "(", "self", ",", "pt", ")", ":", "has_left_template", "=", "self", ".", "_has_template_for_name", "(", "pt", "+", "'_left'", ")", "has_right_template", "=", "self", ".", "_has_template_for_name", "(", "pt", "+", "'_right'", ")"...
if pt has also templates for even and odd page convert it to list
[ "if", "pt", "has", "also", "templates", "for", "even", "and", "odd", "page", "convert", "it", "to", "list" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/xhtml2pdf_reportlab.py#L125-L169
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/xhtml2pdf_reportlab.py
PmlImageReader.getRGBData
def getRGBData(self): "Return byte array of RGB data as string" if self._data is None: self._dataA = None if sys.platform[0:4] == 'java': import jarray # TODO: Move to top. from java.awt.image import PixelGrabber width, height = s...
python
def getRGBData(self): "Return byte array of RGB data as string" if self._data is None: self._dataA = None if sys.platform[0:4] == 'java': import jarray # TODO: Move to top. from java.awt.image import PixelGrabber width, height = s...
[ "def", "getRGBData", "(", "self", ")", ":", "if", "self", ".", "_data", "is", "None", ":", "self", ".", "_dataA", "=", "None", "if", "sys", ".", "platform", "[", "0", ":", "4", "]", "==", "'java'", ":", "import", "jarray", "# TODO: Move to top.", "fr...
Return byte array of RGB data as string
[ "Return", "byte", "array", "of", "RGB", "data", "as", "string" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/xhtml2pdf_reportlab.py#L396-L434
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/xhtml2pdf_reportlab.py
PmlImage.wrap
def wrap(self, availWidth, availHeight): " This can be called more than once! Do not overwrite important data like drawWidth " availHeight = self.setMaxHeight(availHeight) # print "image wrap", id(self), availWidth, availHeight, self.drawWidth, self.drawHeight width = min(self.drawWidth,...
python
def wrap(self, availWidth, availHeight): " This can be called more than once! Do not overwrite important data like drawWidth " availHeight = self.setMaxHeight(availHeight) # print "image wrap", id(self), availWidth, availHeight, self.drawWidth, self.drawHeight width = min(self.drawWidth,...
[ "def", "wrap", "(", "self", ",", "availWidth", ",", "availHeight", ")", ":", "availHeight", "=", "self", ".", "setMaxHeight", "(", "availHeight", ")", "# print \"image wrap\", id(self), availWidth, availHeight, self.drawWidth, self.drawHeight", "width", "=", "min", "(", ...
This can be called more than once! Do not overwrite important data like drawWidth
[ "This", "can", "be", "called", "more", "than", "once!", "Do", "not", "overwrite", "important", "data", "like", "drawWidth" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/xhtml2pdf_reportlab.py#L490-L502
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/xhtml2pdf_reportlab.py
PmlTable._normWidth
def _normWidth(self, w, maxw): """ Helper for calculating percentages """ if type(w) == type(""): w = ((maxw / 100.0) * float(w[: - 1])) elif (w is None) or (w == "*"): w = maxw return min(w, maxw)
python
def _normWidth(self, w, maxw): """ Helper for calculating percentages """ if type(w) == type(""): w = ((maxw / 100.0) * float(w[: - 1])) elif (w is None) or (w == "*"): w = maxw return min(w, maxw)
[ "def", "_normWidth", "(", "self", ",", "w", ",", "maxw", ")", ":", "if", "type", "(", "w", ")", "==", "type", "(", "\"\"", ")", ":", "w", "=", "(", "(", "maxw", "/", "100.0", ")", "*", "float", "(", "w", "[", ":", "-", "1", "]", ")", ")",...
Helper for calculating percentages
[ "Helper", "for", "calculating", "percentages" ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/xhtml2pdf_reportlab.py#L707-L715
train
xhtml2pdf/xhtml2pdf
xhtml2pdf/xhtml2pdf_reportlab.py
PmlTableOfContents.wrap
def wrap(self, availWidth, availHeight): """ All table properties should be known by now. """ widths = (availWidth - self.rightColumnWidth, self.rightColumnWidth) # makes an internal table which does all the work. # we draw the LAST RUN's entries! If ...
python
def wrap(self, availWidth, availHeight): """ All table properties should be known by now. """ widths = (availWidth - self.rightColumnWidth, self.rightColumnWidth) # makes an internal table which does all the work. # we draw the LAST RUN's entries! If ...
[ "def", "wrap", "(", "self", ",", "availWidth", ",", "availHeight", ")", ":", "widths", "=", "(", "availWidth", "-", "self", ".", "rightColumnWidth", ",", "self", ".", "rightColumnWidth", ")", "# makes an internal table which does all the work.", "# we draw the LAST RU...
All table properties should be known by now.
[ "All", "table", "properties", "should", "be", "known", "by", "now", "." ]
230357a392f48816532d3c2fa082a680b80ece48
https://github.com/xhtml2pdf/xhtml2pdf/blob/230357a392f48816532d3c2fa082a680b80ece48/xhtml2pdf/xhtml2pdf_reportlab.py#L788-L839
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession._spawn_child
def _spawn_child(self, command, args=None, timeout=shutit_global.shutit_global_object.default_timeout, maxread=2000, searchwindowsize=None, env=None, ignore_sighup=False, echo=...
python
def _spawn_child(self, command, args=None, timeout=shutit_global.shutit_global_object.default_timeout, maxread=2000, searchwindowsize=None, env=None, ignore_sighup=False, echo=...
[ "def", "_spawn_child", "(", "self", ",", "command", ",", "args", "=", "None", ",", "timeout", "=", "shutit_global", ".", "shutit_global_object", ".", "default_timeout", ",", "maxread", "=", "2000", ",", "searchwindowsize", "=", "None", ",", "env", "=", "None...
spawn a child, and manage the delaybefore send setting to 0
[ "spawn", "a", "child", "and", "manage", "the", "delaybefore", "send", "setting", "to", "0" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L149-L186
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.sendline
def sendline(self, sendspec): """Sends line, handling background and newline directives. True means: 'all handled here ok' False means: you'll need to 'expect' the right thing from here. """ assert not sendspec.started, shutit_util.print_debug() shutit = self.shutit shutit.log('Sending in pexpect session...
python
def sendline(self, sendspec): """Sends line, handling background and newline directives. True means: 'all handled here ok' False means: you'll need to 'expect' the right thing from here. """ assert not sendspec.started, shutit_util.print_debug() shutit = self.shutit shutit.log('Sending in pexpect session...
[ "def", "sendline", "(", "self", ",", "sendspec", ")", ":", "assert", "not", "sendspec", ".", "started", ",", "shutit_util", ".", "print_debug", "(", ")", "shutit", "=", "self", ".", "shutit", "shutit", ".", "log", "(", "'Sending in pexpect session ('", "+", ...
Sends line, handling background and newline directives. True means: 'all handled here ok' False means: you'll need to 'expect' the right thing from here.
[ "Sends", "line", "handling", "background", "and", "newline", "directives", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L189-L226
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.wait
def wait(self, cadence=2, sendspec=None): """Does not return until all background commands are completed. """ shutit = self.shutit shutit.log('In wait.', level=logging.DEBUG) if sendspec: cadence = sendspec.wait_cadence shutit.log('Login stack is:\n' + str(self.login_stack), level=logging.DEBUG) while ...
python
def wait(self, cadence=2, sendspec=None): """Does not return until all background commands are completed. """ shutit = self.shutit shutit.log('In wait.', level=logging.DEBUG) if sendspec: cadence = sendspec.wait_cadence shutit.log('Login stack is:\n' + str(self.login_stack), level=logging.DEBUG) while ...
[ "def", "wait", "(", "self", ",", "cadence", "=", "2", ",", "sendspec", "=", "None", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "log", "(", "'In wait.'", ",", "level", "=", "logging", ".", "DEBUG", ")", "if", "sendspec", ":", "ca...
Does not return until all background commands are completed.
[ "Does", "not", "return", "until", "all", "background", "commands", "are", "completed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L271-L299
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.expect
def expect(self, expect, searchwindowsize=None, maxread=None, timeout=None, iteration_n=1): """Handle child expects, with EOF and TIMEOUT handled iteration_n - Number of times this expect has been called for the send. If 1, (the default) t...
python
def expect(self, expect, searchwindowsize=None, maxread=None, timeout=None, iteration_n=1): """Handle child expects, with EOF and TIMEOUT handled iteration_n - Number of times this expect has been called for the send. If 1, (the default) t...
[ "def", "expect", "(", "self", ",", "expect", ",", "searchwindowsize", "=", "None", ",", "maxread", "=", "None", ",", "timeout", "=", "None", ",", "iteration_n", "=", "1", ")", ":", "if", "isinstance", "(", "expect", ",", "str", ")", ":", "expect", "=...
Handle child expects, with EOF and TIMEOUT handled iteration_n - Number of times this expect has been called for the send. If 1, (the default) then it gets added to the pane of output (if applicable to this run)
[ "Handle", "child", "expects", "with", "EOF", "and", "TIMEOUT", "handled" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L585-L627
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.replace_container
def replace_container(self, new_target_image_name, go_home=None): """Replaces a container. Assumes we are in Docker context. """ shutit = self.shutit shutit.log('Replacing container with ' + new_target_image_name + ', please wait...', level=logging.DEBUG) shutit.log(shutit.print_session_state(), level=logging...
python
def replace_container(self, new_target_image_name, go_home=None): """Replaces a container. Assumes we are in Docker context. """ shutit = self.shutit shutit.log('Replacing container with ' + new_target_image_name + ', please wait...', level=logging.DEBUG) shutit.log(shutit.print_session_state(), level=logging...
[ "def", "replace_container", "(", "self", ",", "new_target_image_name", ",", "go_home", "=", "None", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "log", "(", "'Replacing container with '", "+", "new_target_image_name", "+", "', please wait...'", "...
Replaces a container. Assumes we are in Docker context.
[ "Replaces", "a", "container", ".", "Assumes", "we", "are", "in", "Docker", "context", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L630-L668
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.whoami
def whoami(self, note=None, loglevel=logging.DEBUG): """Returns the current user by executing "whoami". @param note: See send() @return: the output of "whoami" @rtype: string """ shutit = self.shutit shutit.handle_note(note) res = self.send_and_get_output(' command whoami',...
python
def whoami(self, note=None, loglevel=logging.DEBUG): """Returns the current user by executing "whoami". @param note: See send() @return: the output of "whoami" @rtype: string """ shutit = self.shutit shutit.handle_note(note) res = self.send_and_get_output(' command whoami',...
[ "def", "whoami", "(", "self", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "handle_note", "(", "note", ")", "res", "=", "self", ".", "send_and_get_output", "(", ...
Returns the current user by executing "whoami". @param note: See send() @return: the output of "whoami" @rtype: string
[ "Returns", "the", "current", "user", "by", "executing", "whoami", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L671-L691
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.check_last_exit_values
def check_last_exit_values(self, send, check_exit=True, expect=None, exit_values=None, retry=0, retbool=False): """Internal function to check the exit...
python
def check_last_exit_values(self, send, check_exit=True, expect=None, exit_values=None, retry=0, retbool=False): """Internal function to check the exit...
[ "def", "check_last_exit_values", "(", "self", ",", "send", ",", "check_exit", "=", "True", ",", "expect", "=", "None", ",", "exit_values", "=", "None", ",", "retry", "=", "0", ",", "retbool", "=", "False", ")", ":", "shutit", "=", "self", ".", "shutit"...
Internal function to check the exit value of the shell. Do not use.
[ "Internal", "function", "to", "check", "the", "exit", "value", "of", "the", "shell", ".", "Do", "not", "use", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L695-L739
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.get_file_perms
def get_file_perms(self, filename, note=None, loglevel=logging.DEBUG): """Returns the permissions of the file on the target as an octal string triplet. @param filename: Filename to get permissions of. @param note: See send() @type filename: ...
python
def get_file_perms(self, filename, note=None, loglevel=logging.DEBUG): """Returns the permissions of the file on the target as an octal string triplet. @param filename: Filename to get permissions of. @param note: See send() @type filename: ...
[ "def", "get_file_perms", "(", "self", ",", "filename", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "handle_note", "(", "note", ")", "cmd", "=", "' command stat -c...
Returns the permissions of the file on the target as an octal string triplet. @param filename: Filename to get permissions of. @param note: See send() @type filename: string @rtype: string
[ "Returns", "the", "permissions", "of", "the", "file", "on", "the", "target", "as", "an", "octal", "string", "triplet", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L956-L981
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.is_user_id_available
def is_user_id_available(self, user_id, note=None, loglevel=logging.DEBUG): """Determine whether the specified user_id available. @param user_id: User id to be checked. @param note: See send() @type user_id: integer @rtype...
python
def is_user_id_available(self, user_id, note=None, loglevel=logging.DEBUG): """Determine whether the specified user_id available. @param user_id: User id to be checked. @param note: See send() @type user_id: integer @rtype...
[ "def", "is_user_id_available", "(", "self", ",", "user_id", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "handle_note", "(", "note", ")", "# v the space is intentional...
Determine whether the specified user_id available. @param user_id: User id to be checked. @param note: See send() @type user_id: integer @rtype: boolean @return: True is the specified user id is not used yet, False if it's already been assigned to a user.
[ "Determine", "whether", "the", "specified", "user_id", "available", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L1011-L1037
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.lsb_release
def lsb_release(self, loglevel=logging.DEBUG): """Get distro information from lsb_release. """ # v the space is intentional, to avoid polluting bash history. shutit = self.shutit d = {} self.send(ShutItSendSpec(self, send=' command lsb_release -a', ...
python
def lsb_release(self, loglevel=logging.DEBUG): """Get distro information from lsb_release. """ # v the space is intentional, to avoid polluting bash history. shutit = self.shutit d = {} self.send(ShutItSendSpec(self, send=' command lsb_release -a', ...
[ "def", "lsb_release", "(", "self", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "# v the space is intentional, to avoid polluting bash history.", "shutit", "=", "self", ".", "shutit", "d", "=", "{", "}", "self", ".", "send", "(", "ShutItSendSp...
Get distro information from lsb_release.
[ "Get", "distro", "information", "from", "lsb_release", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L1115-L1142
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.user_exists
def user_exists(self, user, note=None, loglevel=logging.DEBUG): """Returns true if the specified username exists. @param user: username to check for @param note: See send() @type user: string @rtype: boolean """ shutit = self.shutit shu...
python
def user_exists(self, user, note=None, loglevel=logging.DEBUG): """Returns true if the specified username exists. @param user: username to check for @param note: See send() @type user: string @rtype: boolean """ shutit = self.shutit shu...
[ "def", "user_exists", "(", "self", ",", "user", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "handle_note", "(", "note", ")", "exists", "=", "False", "if", "us...
Returns true if the specified username exists. @param user: username to check for @param note: See send() @type user: string @rtype: boolean
[ "Returns", "true", "if", "the", "specified", "username", "exists", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L1228-L1259
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession.quick_send
def quick_send(self, send, echo=None, loglevel=logging.INFO): """Quick and dirty send that ignores background tasks. Intended for internal use. """ shutit = self.shutit shutit.log('Quick send: ' + send, level=loglevel) res = self.sendline(ShutItSendSpec(self, send=send, ...
python
def quick_send(self, send, echo=None, loglevel=logging.INFO): """Quick and dirty send that ignores background tasks. Intended for internal use. """ shutit = self.shutit shutit.log('Quick send: ' + send, level=loglevel) res = self.sendline(ShutItSendSpec(self, send=send, ...
[ "def", "quick_send", "(", "self", ",", "send", ",", "echo", "=", "None", ",", "loglevel", "=", "logging", ".", "INFO", ")", ":", "shutit", "=", "self", ".", "shutit", "shutit", ".", "log", "(", "'Quick send: '", "+", "send", ",", "level", "=", "logle...
Quick and dirty send that ignores background tasks. Intended for internal use.
[ "Quick", "and", "dirty", "send", "that", "ignores", "background", "tasks", ".", "Intended", "for", "internal", "use", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L2938-L2951
train
ianmiell/shutit
shutit_pexpect.py
ShutItPexpectSession._create_command_file
def _create_command_file(self, expect, send): """Internal function. Do not use. Takes a long command, and puts it in an executable file ready to run. Returns the filename. """ shutit = self.shutit random_id = shutit_util.random_id() fname = shutit_global.shutit_global_object.shutit_state_dir + '/tmp_' + ra...
python
def _create_command_file(self, expect, send): """Internal function. Do not use. Takes a long command, and puts it in an executable file ready to run. Returns the filename. """ shutit = self.shutit random_id = shutit_util.random_id() fname = shutit_global.shutit_global_object.shutit_state_dir + '/tmp_' + ra...
[ "def", "_create_command_file", "(", "self", ",", "expect", ",", "send", ")", ":", "shutit", "=", "self", ".", "shutit", "random_id", "=", "shutit_util", ".", "random_id", "(", ")", "fname", "=", "shutit_global", ".", "shutit_global_object", ".", "shutit_state_...
Internal function. Do not use. Takes a long command, and puts it in an executable file ready to run. Returns the filename.
[ "Internal", "function", ".", "Do", "not", "use", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_pexpect.py#L3535-L3561
train
ianmiell/shutit
shutit_class.py
check_dependee_order
def check_dependee_order(depender, dependee, dependee_id): """Checks whether run orders are in the appropriate order. """ # If it depends on a module id, then the module id should be higher up # in the run order. shutit_global.shutit_global_object.yield_to_draw() if dependee.run_order > depender.run_order: retu...
python
def check_dependee_order(depender, dependee, dependee_id): """Checks whether run orders are in the appropriate order. """ # If it depends on a module id, then the module id should be higher up # in the run order. shutit_global.shutit_global_object.yield_to_draw() if dependee.run_order > depender.run_order: retu...
[ "def", "check_dependee_order", "(", "depender", ",", "dependee", ",", "dependee_id", ")", ":", "# If it depends on a module id, then the module id should be higher up", "# in the run order.", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", ...
Checks whether run orders are in the appropriate order.
[ "Checks", "whether", "run", "orders", "are", "in", "the", "appropriate", "order", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4869-L4877
train
ianmiell/shutit
shutit_class.py
make_dep_graph
def make_dep_graph(depender): """Returns a digraph string fragment based on the passed-in module """ shutit_global.shutit_global_object.yield_to_draw() digraph = '' for dependee_id in depender.depends_on: digraph = (digraph + '"' + depender.module_id + '"->"' + dependee_id + '";\n') return digraph
python
def make_dep_graph(depender): """Returns a digraph string fragment based on the passed-in module """ shutit_global.shutit_global_object.yield_to_draw() digraph = '' for dependee_id in depender.depends_on: digraph = (digraph + '"' + depender.module_id + '"->"' + dependee_id + '";\n') return digraph
[ "def", "make_dep_graph", "(", "depender", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "digraph", "=", "''", "for", "dependee_id", "in", "depender", ".", "depends_on", ":", "digraph", "=", "(", "digraph", "+", "'\"'",...
Returns a digraph string fragment based on the passed-in module
[ "Returns", "a", "digraph", "string", "fragment", "based", "on", "the", "passed", "-", "in", "module" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4880-L4887
train
ianmiell/shutit
shutit_class.py
LayerConfigParser.get_config_set
def get_config_set(self, section, option): """Returns a set with each value per config file in it. """ values = set() for cp, filename, fp in self.layers: filename = filename # pylint fp = fp # pylint if cp.has_option(section, option): values.add(cp.get(section, option)) return values
python
def get_config_set(self, section, option): """Returns a set with each value per config file in it. """ values = set() for cp, filename, fp in self.layers: filename = filename # pylint fp = fp # pylint if cp.has_option(section, option): values.add(cp.get(section, option)) return values
[ "def", "get_config_set", "(", "self", ",", "section", ",", "option", ")", ":", "values", "=", "set", "(", ")", "for", "cp", ",", "filename", ",", "fp", "in", "self", ".", "layers", ":", "filename", "=", "filename", "# pylint", "fp", "=", "fp", "# pyl...
Returns a set with each value per config file in it.
[ "Returns", "a", "set", "with", "each", "value", "per", "config", "file", "in", "it", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L117-L126
train
ianmiell/shutit
shutit_class.py
LayerConfigParser.reload
def reload(self): """ Re-reads all layers again. In theory this should overwrite all the old values with any newer ones. It assumes we never delete a config item before reload. """ oldlayers = self.layers self.layers = [] for cp, filename, fp in oldlayers: cp = cp # pylint if fp is None: self....
python
def reload(self): """ Re-reads all layers again. In theory this should overwrite all the old values with any newer ones. It assumes we never delete a config item before reload. """ oldlayers = self.layers self.layers = [] for cp, filename, fp in oldlayers: cp = cp # pylint if fp is None: self....
[ "def", "reload", "(", "self", ")", ":", "oldlayers", "=", "self", ".", "layers", "self", ".", "layers", "=", "[", "]", "for", "cp", ",", "filename", ",", "fp", "in", "oldlayers", ":", "cp", "=", "cp", "# pylint", "if", "fp", "is", "None", ":", "s...
Re-reads all layers again. In theory this should overwrite all the old values with any newer ones. It assumes we never delete a config item before reload.
[ "Re", "-", "reads", "all", "layers", "again", ".", "In", "theory", "this", "should", "overwrite", "all", "the", "old", "values", "with", "any", "newer", "ones", ".", "It", "assumes", "we", "never", "delete", "a", "config", "item", "before", "reload", "."...
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L128-L141
train
ianmiell/shutit
shutit_class.py
ShutIt.get_shutit_pexpect_session_environment
def get_shutit_pexpect_session_environment(self, environment_id): """Returns the first shutit_pexpect_session object related to the given environment-id """ if not isinstance(environment_id, str): self.fail('Wrong argument type in get_shutit_pexpect_session_environment') # pragma: no cover for env in shuti...
python
def get_shutit_pexpect_session_environment(self, environment_id): """Returns the first shutit_pexpect_session object related to the given environment-id """ if not isinstance(environment_id, str): self.fail('Wrong argument type in get_shutit_pexpect_session_environment') # pragma: no cover for env in shuti...
[ "def", "get_shutit_pexpect_session_environment", "(", "self", ",", "environment_id", ")", ":", "if", "not", "isinstance", "(", "environment_id", ",", "str", ")", ":", "self", ".", "fail", "(", "'Wrong argument type in get_shutit_pexpect_session_environment'", ")", "# pr...
Returns the first shutit_pexpect_session object related to the given environment-id
[ "Returns", "the", "first", "shutit_pexpect_session", "object", "related", "to", "the", "given", "environment", "-", "id" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L515-L524
train
ianmiell/shutit
shutit_class.py
ShutIt.get_current_shutit_pexpect_session_environment
def get_current_shutit_pexpect_session_environment(self, note=None): """Returns the current environment from the currently-set default pexpect child. """ self.handle_note(note) current_session = self.get_current_shutit_pexpect_session() if current_session is not None: res = current_session.current_enviro...
python
def get_current_shutit_pexpect_session_environment(self, note=None): """Returns the current environment from the currently-set default pexpect child. """ self.handle_note(note) current_session = self.get_current_shutit_pexpect_session() if current_session is not None: res = current_session.current_enviro...
[ "def", "get_current_shutit_pexpect_session_environment", "(", "self", ",", "note", "=", "None", ")", ":", "self", ".", "handle_note", "(", "note", ")", "current_session", "=", "self", ".", "get_current_shutit_pexpect_session", "(", ")", "if", "current_session", "is"...
Returns the current environment from the currently-set default pexpect child.
[ "Returns", "the", "current", "environment", "from", "the", "currently", "-", "set", "default", "pexpect", "child", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L527-L538
train
ianmiell/shutit
shutit_class.py
ShutIt.get_current_shutit_pexpect_session
def get_current_shutit_pexpect_session(self, note=None): """Returns the currently-set default pexpect child. @return: default shutit pexpect child object """ self.handle_note(note) res = self.current_shutit_pexpect_session self.handle_note_after(note) return res
python
def get_current_shutit_pexpect_session(self, note=None): """Returns the currently-set default pexpect child. @return: default shutit pexpect child object """ self.handle_note(note) res = self.current_shutit_pexpect_session self.handle_note_after(note) return res
[ "def", "get_current_shutit_pexpect_session", "(", "self", ",", "note", "=", "None", ")", ":", "self", ".", "handle_note", "(", "note", ")", "res", "=", "self", ".", "current_shutit_pexpect_session", "self", ".", "handle_note_after", "(", "note", ")", "return", ...
Returns the currently-set default pexpect child. @return: default shutit pexpect child object
[ "Returns", "the", "currently", "-", "set", "default", "pexpect", "child", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L541-L549
train
ianmiell/shutit
shutit_class.py
ShutIt.get_shutit_pexpect_sessions
def get_shutit_pexpect_sessions(self, note=None): """Returns all the shutit_pexpect_session keys for this object. @return: list of all shutit_pexpect_session keys (pexpect_session_ids) """ self.handle_note(note) sessions = [] for key in self.shutit_pexpect_sessions: sessions.append(shutit_object.shutit_...
python
def get_shutit_pexpect_sessions(self, note=None): """Returns all the shutit_pexpect_session keys for this object. @return: list of all shutit_pexpect_session keys (pexpect_session_ids) """ self.handle_note(note) sessions = [] for key in self.shutit_pexpect_sessions: sessions.append(shutit_object.shutit_...
[ "def", "get_shutit_pexpect_sessions", "(", "self", ",", "note", "=", "None", ")", ":", "self", ".", "handle_note", "(", "note", ")", "sessions", "=", "[", "]", "for", "key", "in", "self", ".", "shutit_pexpect_sessions", ":", "sessions", ".", "append", "(",...
Returns all the shutit_pexpect_session keys for this object. @return: list of all shutit_pexpect_session keys (pexpect_session_ids)
[ "Returns", "all", "the", "shutit_pexpect_session", "keys", "for", "this", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L552-L562
train
ianmiell/shutit
shutit_class.py
ShutIt.set_default_shutit_pexpect_session
def set_default_shutit_pexpect_session(self, shutit_pexpect_session): """Sets the default pexpect child. @param shutit_pexpect_session: pexpect child to set as default """ assert isinstance(shutit_pexpect_session, ShutItPexpectSession), shutit_util.print_debug() self.current_shutit_pexpect_session = shutit_p...
python
def set_default_shutit_pexpect_session(self, shutit_pexpect_session): """Sets the default pexpect child. @param shutit_pexpect_session: pexpect child to set as default """ assert isinstance(shutit_pexpect_session, ShutItPexpectSession), shutit_util.print_debug() self.current_shutit_pexpect_session = shutit_p...
[ "def", "set_default_shutit_pexpect_session", "(", "self", ",", "shutit_pexpect_session", ")", ":", "assert", "isinstance", "(", "shutit_pexpect_session", ",", "ShutItPexpectSession", ")", ",", "shutit_util", ".", "print_debug", "(", ")", "self", ".", "current_shutit_pex...
Sets the default pexpect child. @param shutit_pexpect_session: pexpect child to set as default
[ "Sets", "the", "default", "pexpect", "child", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L582-L589
train
ianmiell/shutit
shutit_class.py
ShutIt.fail
def fail(self, msg, shutit_pexpect_child=None, throw_exception=False): """Handles a failure, pausing if a pexpect child object is passed in. @param shutit_pexpect_child: pexpect child to work on @param throw_exception: Whether to throw an exception. @type throw_exception: boolean """ shutit_global.shutit_g...
python
def fail(self, msg, shutit_pexpect_child=None, throw_exception=False): """Handles a failure, pausing if a pexpect child object is passed in. @param shutit_pexpect_child: pexpect child to work on @param throw_exception: Whether to throw an exception. @type throw_exception: boolean """ shutit_global.shutit_g...
[ "def", "fail", "(", "self", ",", "msg", ",", "shutit_pexpect_child", "=", "None", ",", "throw_exception", "=", "False", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# Note: we must not default to a child here", "if", "shut...
Handles a failure, pausing if a pexpect child object is passed in. @param shutit_pexpect_child: pexpect child to work on @param throw_exception: Whether to throw an exception. @type throw_exception: boolean
[ "Handles", "a", "failure", "pausing", "if", "a", "pexpect", "child", "object", "is", "passed", "in", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L607-L629
train
ianmiell/shutit
shutit_class.py
ShutIt.get_current_environment
def get_current_environment(self, note=None): """Returns the current environment id from the current shutit_pexpect_session """ shutit_global.shutit_global_object.yield_to_draw() self.handle_note(note) res = self.get_current_shutit_pexpect_session_environment().environment_id self.handle_note_after(note) ...
python
def get_current_environment(self, note=None): """Returns the current environment id from the current shutit_pexpect_session """ shutit_global.shutit_global_object.yield_to_draw() self.handle_note(note) res = self.get_current_shutit_pexpect_session_environment().environment_id self.handle_note_after(note) ...
[ "def", "get_current_environment", "(", "self", ",", "note", "=", "None", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "handle_note", "(", "note", ")", "res", "=", "self", ".", "get_current_shutit_pexpect_se...
Returns the current environment id from the current shutit_pexpect_session
[ "Returns", "the", "current", "environment", "id", "from", "the", "current", "shutit_pexpect_session" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L632-L640
train
ianmiell/shutit
shutit_class.py
ShutIt.handle_note
def handle_note(self, note, command='', training_input=''): """Handle notes and walkthrough option. @param note: See send() """ shutit_global.shutit_global_object.yield_to_draw() if self.build['walkthrough'] and note != None and note != '': assert isinstance(note, str), shutit_util.print_d...
python
def handle_note(self, note, command='', training_input=''): """Handle notes and walkthrough option. @param note: See send() """ shutit_global.shutit_global_object.yield_to_draw() if self.build['walkthrough'] and note != None and note != '': assert isinstance(note, str), shutit_util.print_d...
[ "def", "handle_note", "(", "self", ",", "note", ",", "command", "=", "''", ",", "training_input", "=", "''", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "self", ".", "build", "[", "'walkthrough'", "]", "and...
Handle notes and walkthrough option. @param note: See send()
[ "Handle", "notes", "and", "walkthrough", "option", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L938-L964
train
ianmiell/shutit
shutit_class.py
ShutIt.expect_allow_interrupt
def expect_allow_interrupt(self, shutit_pexpect_child, expect, timeout, iteration_s=1): """This function allows you to interrupt the run at more or less any point by breaking up the timeout into interacti...
python
def expect_allow_interrupt(self, shutit_pexpect_child, expect, timeout, iteration_s=1): """This function allows you to interrupt the run at more or less any point by breaking up the timeout into interacti...
[ "def", "expect_allow_interrupt", "(", "self", ",", "shutit_pexpect_child", ",", "expect", ",", "timeout", ",", "iteration_s", "=", "1", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "shutit_pexpect_session", "=", "self", "...
This function allows you to interrupt the run at more or less any point by breaking up the timeout into interactive chunks.
[ "This", "function", "allows", "you", "to", "interrupt", "the", "run", "at", "more", "or", "less", "any", "point", "by", "breaking", "up", "the", "timeout", "into", "interactive", "chunks", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L978-L1030
train
ianmiell/shutit
shutit_class.py
ShutIt.send_host_file
def send_host_file(self, path, hostfilepath, expect=None, shutit_pexpect_child=None, note=None, user=None, group=None, loglevel=logging.INFO): """Send file fr...
python
def send_host_file(self, path, hostfilepath, expect=None, shutit_pexpect_child=None, note=None, user=None, group=None, loglevel=logging.INFO): """Send file fr...
[ "def", "send_host_file", "(", "self", ",", "path", ",", "hostfilepath", ",", "expect", "=", "None", ",", "shutit_pexpect_child", "=", "None", ",", "note", "=", "None", ",", "user", "=", "None", ",", "group", "=", "None", ",", "loglevel", "=", "logging", ...
Send file from host machine to given path @param path: Path to send file to. @param hostfilepath: Path to file from host to send to target. @param expect: See send() @param shutit_pexpect_child: See send() @param note: See send() @param user: Set ownership to this...
[ "Send", "file", "from", "host", "machine", "to", "given", "path" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1118-L1168
train
ianmiell/shutit
shutit_class.py
ShutIt.send_host_dir
def send_host_dir(self, path, hostfilepath, expect=None, shutit_pexpect_child=None, note=None, user=None, group=None, loglevel=logging.DEBUG): """Send directory and a...
python
def send_host_dir(self, path, hostfilepath, expect=None, shutit_pexpect_child=None, note=None, user=None, group=None, loglevel=logging.DEBUG): """Send directory and a...
[ "def", "send_host_dir", "(", "self", ",", "path", ",", "hostfilepath", ",", "expect", "=", "None", ",", "shutit_pexpect_child", "=", "None", ",", "note", "=", "None", ",", "user", "=", "None", ",", "group", "=", "None", ",", "loglevel", "=", "logging", ...
Send directory and all contents recursively from host machine to given path. It will automatically make directories on the target. @param path: Path to send directory to (places hostfilepath inside path as a subfolder) @param hostfilepath: Path to file from host to send to target @param expect: ...
[ "Send", "directory", "and", "all", "contents", "recursively", "from", "host", "machine", "to", "given", "path", ".", "It", "will", "automatically", "make", "directories", "on", "the", "target", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1171-L1250
train
ianmiell/shutit
shutit_class.py
ShutIt.delete_text
def delete_text(self, text, fname, pattern=None, expect=None, shutit_pexpect_child=None, note=None, before=False, force=False, line_oriented=True, log...
python
def delete_text(self, text, fname, pattern=None, expect=None, shutit_pexpect_child=None, note=None, before=False, force=False, line_oriented=True, log...
[ "def", "delete_text", "(", "self", ",", "text", ",", "fname", ",", "pattern", "=", "None", ",", "expect", "=", "None", ",", "shutit_pexpect_child", "=", "None", ",", "note", "=", "None", ",", "before", "=", "False", ",", "force", "=", "False", ",", "...
Delete a chunk of text from a file. See insert_text.
[ "Delete", "a", "chunk", "of", "text", "from", "a", "file", ".", "See", "insert_text", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1422-L1447
train
ianmiell/shutit
shutit_class.py
ShutIt.get_file
def get_file(self, target_path, host_path, note=None, loglevel=logging.DEBUG): """Copy a file from the target machine to the host machine @param target_path: path to file in the target @param host_path: path to file on the host machine (e.g. copy test) ...
python
def get_file(self, target_path, host_path, note=None, loglevel=logging.DEBUG): """Copy a file from the target machine to the host machine @param target_path: path to file in the target @param host_path: path to file on the host machine (e.g. copy test) ...
[ "def", "get_file", "(", "self", ",", "target_path", ",", "host_path", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "handle_note",...
Copy a file from the target machine to the host machine @param target_path: path to file in the target @param host_path: path to file on the host machine (e.g. copy test) @param note: See send() @type target_path: string @type host_path: string @return: boolean @rtype: s...
[ "Copy", "a", "file", "from", "the", "target", "machine", "to", "the", "host", "machine" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1673-L1707
train
ianmiell/shutit
shutit_class.py
ShutIt.prompt_cfg
def prompt_cfg(self, msg, sec, name, ispass=False): """Prompt for a config value, optionally saving it to the user-level cfg. Only runs if we are in an interactive mode. @param msg: Message to display to user. @param sec: Section of config to add to. @param name: Config item name. @param ispass: If...
python
def prompt_cfg(self, msg, sec, name, ispass=False): """Prompt for a config value, optionally saving it to the user-level cfg. Only runs if we are in an interactive mode. @param msg: Message to display to user. @param sec: Section of config to add to. @param name: Config item name. @param ispass: If...
[ "def", "prompt_cfg", "(", "self", ",", "msg", ",", "sec", ",", "name", ",", "ispass", "=", "False", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfgstr", "=", "'[%s]/%s'", "%", "(", "sec", ",", "name", ")", "...
Prompt for a config value, optionally saving it to the user-level cfg. Only runs if we are in an interactive mode. @param msg: Message to display to user. @param sec: Section of config to add to. @param name: Config item name. @param ispass: If True, hide the input from the terminal. ...
[ "Prompt", "for", "a", "config", "value", "optionally", "saving", "it", "to", "the", "user", "-", "level", "cfg", ".", "Only", "runs", "if", "we", "are", "in", "an", "interactive", "mode", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1710-L1782
train
ianmiell/shutit
shutit_class.py
ShutIt.step_through
def step_through(self, msg='', shutit_pexpect_child=None, level=1, print_input=True, value=True): """Implements a step-through function, using pause_point. """ shutit_global.shutit_global_object.yield_to_draw() shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_chil...
python
def step_through(self, msg='', shutit_pexpect_child=None, level=1, print_input=True, value=True): """Implements a step-through function, using pause_point. """ shutit_global.shutit_global_object.yield_to_draw() shutit_pexpect_child = shutit_pexpect_child or self.get_current_shutit_pexpect_session().pexpect_chil...
[ "def", "step_through", "(", "self", ",", "msg", "=", "''", ",", "shutit_pexpect_child", "=", "None", ",", "level", "=", "1", ",", "print_input", "=", "True", ",", "value", "=", "True", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_...
Implements a step-through function, using pause_point.
[ "Implements", "a", "step", "-", "through", "function", "using", "pause_point", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1785-L1796
train
ianmiell/shutit
shutit_class.py
ShutIt.interact
def interact(self, msg='SHUTIT PAUSE POINT', shutit_pexpect_child=None, print_input=True, level=1, resize=True, color='32', default_msg=None, wait=-1): """Same as pause_point, but sets up the terminal ready for unm...
python
def interact(self, msg='SHUTIT PAUSE POINT', shutit_pexpect_child=None, print_input=True, level=1, resize=True, color='32', default_msg=None, wait=-1): """Same as pause_point, but sets up the terminal ready for unm...
[ "def", "interact", "(", "self", ",", "msg", "=", "'SHUTIT PAUSE POINT'", ",", "shutit_pexpect_child", "=", "None", ",", "print_input", "=", "True", ",", "level", "=", "1", ",", "resize", "=", "True", ",", "color", "=", "'32'", ",", "default_msg", "=", "N...
Same as pause_point, but sets up the terminal ready for unmediated interaction.
[ "Same", "as", "pause_point", "but", "sets", "up", "the", "terminal", "ready", "for", "unmediated", "interaction", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1799-L1819
train
ianmiell/shutit
shutit_class.py
ShutIt.pause_point
def pause_point(self, msg='SHUTIT PAUSE POINT', shutit_pexpect_child=None, print_input=True, level=1, resize=True, color='32', default_msg=None, interact=False, wait=-...
python
def pause_point(self, msg='SHUTIT PAUSE POINT', shutit_pexpect_child=None, print_input=True, level=1, resize=True, color='32', default_msg=None, interact=False, wait=-...
[ "def", "pause_point", "(", "self", ",", "msg", "=", "'SHUTIT PAUSE POINT'", ",", "shutit_pexpect_child", "=", "None", ",", "print_input", "=", "True", ",", "level", "=", "1", ",", "resize", "=", "True", ",", "color", "=", "'32'", ",", "default_msg", "=", ...
Inserts a pause in the build session, which allows the user to try things out before continuing. Ignored if we are not in an interactive mode, or the interactive level is less than the passed-in one. Designed to help debug the build, or drop to on failure so the situation can be debugged. @param msg: ...
[ "Inserts", "a", "pause", "in", "the", "build", "session", "which", "allows", "the", "user", "to", "try", "things", "out", "before", "continuing", ".", "Ignored", "if", "we", "are", "not", "in", "an", "interactive", "mode", "or", "the", "interactive", "leve...
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L1822-L1891
train
ianmiell/shutit
shutit_class.py
ShutIt.login
def login(self, command='su -', user=None, password=None, prompt_prefix=None, expect=None, timeout=shutit_global.shutit_global_object.default_timeout, escape=False, echo=None, note=None, go_home=True, ...
python
def login(self, command='su -', user=None, password=None, prompt_prefix=None, expect=None, timeout=shutit_global.shutit_global_object.default_timeout, escape=False, echo=None, note=None, go_home=True, ...
[ "def", "login", "(", "self", ",", "command", "=", "'su -'", ",", "user", "=", "None", ",", "password", "=", "None", ",", "prompt_prefix", "=", "None", ",", "expect", "=", "None", ",", "timeout", "=", "shutit_global", ".", "shutit_global_object", ".", "de...
Logs user in on default child.
[ "Logs", "user", "in", "on", "default", "child", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2105-L2138
train
ianmiell/shutit
shutit_class.py
ShutIt.logout_all
def logout_all(self, command='exit', note=None, echo=None, timeout=shutit_global.shutit_global_object.default_timeout, nonewline=False, loglevel=logging.DEBUG): """Logs the user out of all pexpect sessions within this Shut...
python
def logout_all(self, command='exit', note=None, echo=None, timeout=shutit_global.shutit_global_object.default_timeout, nonewline=False, loglevel=logging.DEBUG): """Logs the user out of all pexpect sessions within this Shut...
[ "def", "logout_all", "(", "self", ",", "command", "=", "'exit'", ",", "note", "=", "None", ",", "echo", "=", "None", ",", "timeout", "=", "shutit_global", ".", "shutit_global_object", ".", "default_timeout", ",", "nonewline", "=", "False", ",", "loglevel", ...
Logs the user out of all pexpect sessions within this ShutIt object. @param command: Command to run to log out (default=exit) @param note: See send()
[ "Logs", "the", "user", "out", "of", "all", "pexpect", "sessions", "within", "this", "ShutIt", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2141-L2163
train
ianmiell/shutit
shutit_class.py
ShutIt.push_repository
def push_repository(self, repository, docker_executable='docker', shutit_pexpect_child=None, expect=None, note=None, loglevel=logging.INFO): """Pushes the repository. @param repository: ...
python
def push_repository(self, repository, docker_executable='docker', shutit_pexpect_child=None, expect=None, note=None, loglevel=logging.INFO): """Pushes the repository. @param repository: ...
[ "def", "push_repository", "(", "self", ",", "repository", ",", "docker_executable", "=", "'docker'", ",", "shutit_pexpect_child", "=", "None", ",", "expect", "=", "None", ",", "note", "=", "None", ",", "loglevel", "=", "logging", ".", "INFO", ")", ":", "sh...
Pushes the repository. @param repository: Repository to push. @param docker_executable: Defaults to 'docker' @param expect: See send() @param shutit_pexpect_child: See send() @type repository: string @type docker_executable: string
[ "Pushes", "the", "repository", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2301-L2337
train
ianmiell/shutit
shutit_class.py
ShutIt.get_emailer
def get_emailer(self, cfg_section): """Sends an email using the mailer """ shutit_global.shutit_global_object.yield_to_draw() import emailer return emailer.Emailer(cfg_section, self)
python
def get_emailer(self, cfg_section): """Sends an email using the mailer """ shutit_global.shutit_global_object.yield_to_draw() import emailer return emailer.Emailer(cfg_section, self)
[ "def", "get_emailer", "(", "self", ",", "cfg_section", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "import", "emailer", "return", "emailer", ".", "Emailer", "(", "cfg_section", ",", "self", ")" ]
Sends an email using the mailer
[ "Sends", "an", "email", "using", "the", "mailer" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2617-L2622
train
ianmiell/shutit
shutit_class.py
ShutIt.get_shutit_pexpect_session_id
def get_shutit_pexpect_session_id(self, shutit_pexpect_child): """Given a pexpect child object, return the shutit_pexpect_session_id object. """ shutit_global.shutit_global_object.yield_to_draw() if not isinstance(shutit_pexpect_child, pexpect.pty_spawn.spawn): self.fail('Wrong type in get_shutit_pexpect_ses...
python
def get_shutit_pexpect_session_id(self, shutit_pexpect_child): """Given a pexpect child object, return the shutit_pexpect_session_id object. """ shutit_global.shutit_global_object.yield_to_draw() if not isinstance(shutit_pexpect_child, pexpect.pty_spawn.spawn): self.fail('Wrong type in get_shutit_pexpect_ses...
[ "def", "get_shutit_pexpect_session_id", "(", "self", ",", "shutit_pexpect_child", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "not", "isinstance", "(", "shutit_pexpect_child", ",", "pexpect", ".", "pty_spawn", ".", "...
Given a pexpect child object, return the shutit_pexpect_session_id object.
[ "Given", "a", "pexpect", "child", "object", "return", "the", "shutit_pexpect_session_id", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2645-L2654
train
ianmiell/shutit
shutit_class.py
ShutIt.get_shutit_pexpect_session_from_id
def get_shutit_pexpect_session_from_id(self, shutit_pexpect_id): """Get the pexpect session from the given identifier. """ shutit_global.shutit_global_object.yield_to_draw() for key in self.shutit_pexpect_sessions: if self.shutit_pexpect_sessions[key].pexpect_session_id == shutit_pexpect_id: return self....
python
def get_shutit_pexpect_session_from_id(self, shutit_pexpect_id): """Get the pexpect session from the given identifier. """ shutit_global.shutit_global_object.yield_to_draw() for key in self.shutit_pexpect_sessions: if self.shutit_pexpect_sessions[key].pexpect_session_id == shutit_pexpect_id: return self....
[ "def", "get_shutit_pexpect_session_from_id", "(", "self", ",", "shutit_pexpect_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "for", "key", "in", "self", ".", "shutit_pexpect_sessions", ":", "if", "self", ".", "shutit_pe...
Get the pexpect session from the given identifier.
[ "Get", "the", "pexpect", "session", "from", "the", "given", "identifier", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2657-L2664
train
ianmiell/shutit
shutit_class.py
ShutIt.get_commands
def get_commands(self): """Gets command that have been run and have not been redacted. """ shutit_global.shutit_global_object.yield_to_draw() s = '' for c in self.build['shutit_command_history']: if isinstance(c, str): #Ignore commands with leading spaces if c and c[0] != ' ': s += c + '\n' ...
python
def get_commands(self): """Gets command that have been run and have not been redacted. """ shutit_global.shutit_global_object.yield_to_draw() s = '' for c in self.build['shutit_command_history']: if isinstance(c, str): #Ignore commands with leading spaces if c and c[0] != ' ': s += c + '\n' ...
[ "def", "get_commands", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "s", "=", "''", "for", "c", "in", "self", ".", "build", "[", "'shutit_command_history'", "]", ":", "if", "isinstance", "(", "c", ","...
Gets command that have been run and have not been redacted.
[ "Gets", "command", "that", "have", "been", "run", "and", "have", "not", "been", "redacted", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2722-L2732
train
ianmiell/shutit
shutit_class.py
ShutIt.build_report
def build_report(self, msg=''): """Resposible for constructing a report to be output as part of the build. Returns report as a string. """ shutit_global.shutit_global_object.yield_to_draw() s = '\n' s += '################################################################################\n' s += '# COMMAND H...
python
def build_report(self, msg=''): """Resposible for constructing a report to be output as part of the build. Returns report as a string. """ shutit_global.shutit_global_object.yield_to_draw() s = '\n' s += '################################################################################\n' s += '# COMMAND H...
[ "def", "build_report", "(", "self", ",", "msg", "=", "''", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "s", "=", "'\\n'", "s", "+=", "'################################################################################\\n'", "s",...
Resposible for constructing a report to be output as part of the build. Returns report as a string.
[ "Resposible", "for", "constructing", "a", "report", "to", "be", "output", "as", "part", "of", "the", "build", ".", "Returns", "report", "as", "a", "string", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2736-L2763
train
ianmiell/shutit
shutit_class.py
ShutIt.match_string
def match_string(self, string_to_match, regexp): """Get regular expression from the first of the lines passed in in string that matched. Handles first group of regexp as a return value. @param string_to_match: String to match on @param regexp: Regexp to check (per-line) against string @type string_to_matc...
python
def match_string(self, string_to_match, regexp): """Get regular expression from the first of the lines passed in in string that matched. Handles first group of regexp as a return value. @param string_to_match: String to match on @param regexp: Regexp to check (per-line) against string @type string_to_matc...
[ "def", "match_string", "(", "self", ",", "string_to_match", ",", "regexp", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "not", "isinstance", "(", "string_to_match", ",", "str", ")", ":", "return", "None", "lines...
Get regular expression from the first of the lines passed in in string that matched. Handles first group of regexp as a return value. @param string_to_match: String to match on @param regexp: Regexp to check (per-line) against string @type string_to_match: string @type regexp: string Returns None if no...
[ "Get", "regular", "expression", "from", "the", "first", "of", "the", "lines", "passed", "in", "in", "string", "that", "matched", ".", "Handles", "first", "group", "of", "regexp", "as", "a", "return", "value", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2766-L2802
train
ianmiell/shutit
shutit_class.py
ShutIt.is_to_be_built_or_is_installed
def is_to_be_built_or_is_installed(self, shutit_module_obj): """Returns true if this module is configured to be built, or if it is already installed. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg if cfg[shutit_module_obj.module_id]['shutit.core.module.build']: return True return s...
python
def is_to_be_built_or_is_installed(self, shutit_module_obj): """Returns true if this module is configured to be built, or if it is already installed. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg if cfg[shutit_module_obj.module_id]['shutit.core.module.build']: return True return s...
[ "def", "is_to_be_built_or_is_installed", "(", "self", ",", "shutit_module_obj", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "if", "cfg", "[", "shutit_module_obj", ".", "module_id", "]", ...
Returns true if this module is configured to be built, or if it is already installed.
[ "Returns", "true", "if", "this", "module", "is", "configured", "to", "be", "built", "or", "if", "it", "is", "already", "installed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2816-L2823
train
ianmiell/shutit
shutit_class.py
ShutIt.is_installed
def is_installed(self, shutit_module_obj): """Returns true if this module is installed. Uses cache where possible. """ shutit_global.shutit_global_object.yield_to_draw() # Cache first if shutit_module_obj.module_id in self.get_current_shutit_pexpect_session_environment().modules_installed: return True ...
python
def is_installed(self, shutit_module_obj): """Returns true if this module is installed. Uses cache where possible. """ shutit_global.shutit_global_object.yield_to_draw() # Cache first if shutit_module_obj.module_id in self.get_current_shutit_pexpect_session_environment().modules_installed: return True ...
[ "def", "is_installed", "(", "self", ",", "shutit_module_obj", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# Cache first", "if", "shutit_module_obj", ".", "module_id", "in", "self", ".", "get_current_shutit_pexpect_session_env...
Returns true if this module is installed. Uses cache where possible.
[ "Returns", "true", "if", "this", "module", "is", "installed", ".", "Uses", "cache", "where", "possible", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2826-L2845
train
ianmiell/shutit
shutit_class.py
ShutIt.allowed_image
def allowed_image(self, module_id): """Given a module id, determine whether the image is allowed to be built. """ shutit_global.shutit_global_object.yield_to_draw() self.log("In allowed_image: " + module_id,level=logging.DEBUG) cfg = self.cfg if self.build['ignoreimage']: self.log("ignoreimage == true, r...
python
def allowed_image(self, module_id): """Given a module id, determine whether the image is allowed to be built. """ shutit_global.shutit_global_object.yield_to_draw() self.log("In allowed_image: " + module_id,level=logging.DEBUG) cfg = self.cfg if self.build['ignoreimage']: self.log("ignoreimage == true, r...
[ "def", "allowed_image", "(", "self", ",", "module_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "log", "(", "\"In allowed_image: \"", "+", "module_id", ",", "level", "=", "logging", ".", "DEBUG", ")",...
Given a module id, determine whether the image is allowed to be built.
[ "Given", "a", "module", "id", "determine", "whether", "the", "image", "is", "allowed", "to", "be", "built", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2861-L2878
train
ianmiell/shutit
shutit_class.py
ShutIt.print_modules
def print_modules(self): """Returns a string table representing the modules in the ShutIt module map. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg module_string = '' module_string += 'Modules: \n' module_string += ' Run order Build Remove Module ID\n' for module_id i...
python
def print_modules(self): """Returns a string table representing the modules in the ShutIt module map. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg module_string = '' module_string += 'Modules: \n' module_string += ' Run order Build Remove Module ID\n' for module_id i...
[ "def", "print_modules", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "module_string", "=", "''", "module_string", "+=", "'Modules: \\n'", "module_string", "+=", "' Run order...
Returns a string table representing the modules in the ShutIt module map.
[ "Returns", "a", "string", "table", "representing", "the", "modules", "in", "the", "ShutIt", "module", "map", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2881-L2893
train
ianmiell/shutit
shutit_class.py
ShutIt.load_shutit_modules
def load_shutit_modules(self): """Responsible for loading the shutit modules based on the configured module paths. """ shutit_global.shutit_global_object.yield_to_draw() if self.loglevel <= logging.DEBUG: self.log('ShutIt module paths now: ',level=logging.DEBUG) self.log(self.host['shutit_module_path'],...
python
def load_shutit_modules(self): """Responsible for loading the shutit modules based on the configured module paths. """ shutit_global.shutit_global_object.yield_to_draw() if self.loglevel <= logging.DEBUG: self.log('ShutIt module paths now: ',level=logging.DEBUG) self.log(self.host['shutit_module_path'],...
[ "def", "load_shutit_modules", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "self", ".", "loglevel", "<=", "logging", ".", "DEBUG", ":", "self", ".", "log", "(", "'ShutIt module paths now: '", ",", "...
Responsible for loading the shutit modules based on the configured module paths.
[ "Responsible", "for", "loading", "the", "shutit", "modules", "based", "on", "the", "configured", "module", "paths", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2896-L2905
train
ianmiell/shutit
shutit_class.py
ShutIt.get_command
def get_command(self, command): """Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed. """ shutit_global.shutit_global_object.yield_to_draw() if command in ('md5sum','sed','head'): if self.get_current_shutit_pexpect_session_environment().distr...
python
def get_command(self, command): """Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed. """ shutit_global.shutit_global_object.yield_to_draw() if command in ('md5sum','sed','head'): if self.get_current_shutit_pexpect_session_environment().distr...
[ "def", "get_command", "(", "self", ",", "command", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "command", "in", "(", "'md5sum'", ",", "'sed'", ",", "'head'", ")", ":", "if", "self", ".", "get_current_shutit_p...
Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed.
[ "Helper", "function", "for", "osx", "-", "return", "gnu", "utils", "rather", "than", "default", "for", "eg", "head", "and", "md5sum", "where", "possible", "and", "needed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2908-L2916
train
ianmiell/shutit
shutit_class.py
ShutIt.get_send_command
def get_send_command(self, send): """Internal helper function to get command that's really sent """ shutit_global.shutit_global_object.yield_to_draw() if send is None: return send cmd_arr = send.split() if cmd_arr and cmd_arr[0] in ('md5sum','sed','head'): newcmd = self.get_command(cmd_arr[0]) send...
python
def get_send_command(self, send): """Internal helper function to get command that's really sent """ shutit_global.shutit_global_object.yield_to_draw() if send is None: return send cmd_arr = send.split() if cmd_arr and cmd_arr[0] in ('md5sum','sed','head'): newcmd = self.get_command(cmd_arr[0]) send...
[ "def", "get_send_command", "(", "self", ",", "send", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "send", "is", "None", ":", "return", "send", "cmd_arr", "=", "send", ".", "split", "(", ")", "if", "cmd_arr",...
Internal helper function to get command that's really sent
[ "Internal", "helper", "function", "to", "get", "command", "that", "s", "really", "sent" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2919-L2929
train
ianmiell/shutit
shutit_class.py
ShutIt.load_configs
def load_configs(self): """Responsible for loading config files into ShutIt. Recurses down from configured shutit module paths. """ shutit_global.shutit_global_object.yield_to_draw() # Get root default config. # TODO: change default_cnf so it places whatever the values are at this stage of the build. conf...
python
def load_configs(self): """Responsible for loading config files into ShutIt. Recurses down from configured shutit module paths. """ shutit_global.shutit_global_object.yield_to_draw() # Get root default config. # TODO: change default_cnf so it places whatever the values are at this stage of the build. conf...
[ "def", "load_configs", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# Get root default config.", "# TODO: change default_cnf so it places whatever the values are at this stage of the build.", "configs", "=", "[", "(", "'d...
Responsible for loading config files into ShutIt. Recurses down from configured shutit module paths.
[ "Responsible", "for", "loading", "config", "files", "into", "ShutIt", ".", "Recurses", "down", "from", "configured", "shutit", "module", "paths", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L2932-L2974
train
ianmiell/shutit
shutit_class.py
ShutIt.config_collection
def config_collection(self): """Collect core config from config files for all seen modules. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In config_collection',level=logging.DEBUG) cfg = self.cfg for module_id in self.module_ids(): # Default to None so we can interpret as ifneeded s...
python
def config_collection(self): """Collect core config from config files for all seen modules. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In config_collection',level=logging.DEBUG) cfg = self.cfg for module_id in self.module_ids(): # Default to None so we can interpret as ifneeded s...
[ "def", "config_collection", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "log", "(", "'In config_collection'", ",", "level", "=", "logging", ".", "DEBUG", ")", "cfg", "=", "self", ".", "cfg...
Collect core config from config files for all seen modules.
[ "Collect", "core", "config", "from", "config", "files", "for", "all", "seen", "modules", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L3195-L3237
train
ianmiell/shutit
shutit_class.py
ShutIt.print_config
def print_config(self, cfg, hide_password=True, history=False, module_id=None): """Returns a string representing the config of this ShutIt run. """ shutit_global.shutit_global_object.yield_to_draw() cp = self.config_parser s = '' keys1 = list(cfg.keys()) if keys1: keys1.sort() for k in keys1: if m...
python
def print_config(self, cfg, hide_password=True, history=False, module_id=None): """Returns a string representing the config of this ShutIt run. """ shutit_global.shutit_global_object.yield_to_draw() cp = self.config_parser s = '' keys1 = list(cfg.keys()) if keys1: keys1.sort() for k in keys1: if m...
[ "def", "print_config", "(", "self", ",", "cfg", ",", "hide_password", "=", "True", ",", "history", "=", "False", ",", "module_id", "=", "None", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cp", "=", "self", ".", ...
Returns a string representing the config of this ShutIt run.
[ "Returns", "a", "string", "representing", "the", "config", "of", "this", "ShutIt", "run", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L3338-L3379
train
ianmiell/shutit
shutit_class.py
ShutIt.process_args
def process_args(self, args): """Process the args we have. 'args' is always a ShutItInit object. """ shutit_global.shutit_global_object.yield_to_draw() assert isinstance(args,ShutItInit), shutit_util.print_debug() if args.action == 'version': shutit_global.shutit_global_object.shutit_print('ShutIt version...
python
def process_args(self, args): """Process the args we have. 'args' is always a ShutItInit object. """ shutit_global.shutit_global_object.yield_to_draw() assert isinstance(args,ShutItInit), shutit_util.print_debug() if args.action == 'version': shutit_global.shutit_global_object.shutit_print('ShutIt version...
[ "def", "process_args", "(", "self", ",", "args", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "assert", "isinstance", "(", "args", ",", "ShutItInit", ")", ",", "shutit_util", ".", "print_debug", "(", ")", "if", "arg...
Process the args we have. 'args' is always a ShutItInit object.
[ "Process", "the", "args", "we", "have", ".", "args", "is", "always", "a", "ShutItInit", "object", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L3382-L3420
train
ianmiell/shutit
shutit_class.py
ShutIt.check_deps
def check_deps(self): """Dependency checking phase is performed in this method. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: dependencies', level=logging.DEBUG) self.pause_point('\nNow checking for dependencies between modules', print_input=False, level=3) # Get m...
python
def check_deps(self): """Dependency checking phase is performed in this method. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: dependencies', level=logging.DEBUG) self.pause_point('\nNow checking for dependencies between modules', print_input=False, level=3) # Get m...
[ "def", "check_deps", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "self", ".", "log", "(", "'PHASE: dependencies'", ",", "level", "=", "logging", ".", "DEBUG", ")", "se...
Dependency checking phase is performed in this method.
[ "Dependency", "checking", "phase", "is", "performed", "in", "this", "method", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4361-L4409
train
ianmiell/shutit
shutit_class.py
ShutIt.check_conflicts
def check_conflicts(self): """Checks for any conflicts between modules configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now consider conflicts self.log('PHASE: conflicts', level=logging.DEBUG) errs = [] self.pause_point('\nNow checking for conflicts between...
python
def check_conflicts(self): """Checks for any conflicts between modules configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now consider conflicts self.log('PHASE: conflicts', level=logging.DEBUG) errs = [] self.pause_point('\nNow checking for conflicts between...
[ "def", "check_conflicts", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "# Now consider conflicts", "self", ".", "log", "(", "'PHASE: conflicts'", ",", "level", "=", "logging"...
Checks for any conflicts between modules configured to be built.
[ "Checks", "for", "any", "conflicts", "between", "modules", "configured", "to", "be", "built", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4412-L4435
train
ianmiell/shutit
shutit_class.py
ShutIt.do_remove
def do_remove(self, loglevel=logging.DEBUG): """Remove modules by calling remove method on those configured for removal. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now get the run_order keys in order and go. self.log('PHASE: remove', level=loglevel) self.pause_point('\nNow rem...
python
def do_remove(self, loglevel=logging.DEBUG): """Remove modules by calling remove method on those configured for removal. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # Now get the run_order keys in order and go. self.log('PHASE: remove', level=loglevel) self.pause_point('\nNow rem...
[ "def", "do_remove", "(", "self", ",", "loglevel", "=", "logging", ".", "DEBUG", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "# Now get the run_order keys in order and go.", "self", ".", ...
Remove modules by calling remove method on those configured for removal.
[ "Remove", "modules", "by", "calling", "remove", "method", "on", "those", "configured", "for", "removal", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4466-L4493
train
ianmiell/shutit
shutit_class.py
ShutIt.do_build
def do_build(self): """Runs build phase, building any modules that we've determined need building. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: build, repository work', level=logging.DEBUG) module_id_list = self.module_ids() if self.build['deps_only']: module...
python
def do_build(self): """Runs build phase, building any modules that we've determined need building. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg self.log('PHASE: build, repository work', level=logging.DEBUG) module_id_list = self.module_ids() if self.build['deps_only']: module...
[ "def", "do_build", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "self", ".", "log", "(", "'PHASE: build, repository work'", ",", "level", "=", "logging", ".", "DEBUG", ")...
Runs build phase, building any modules that we've determined need building.
[ "Runs", "build", "phase", "building", "any", "modules", "that", "we", "ve", "determined", "need", "building", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4535-L4569
train
ianmiell/shutit
shutit_class.py
ShutIt.stop_all
def stop_all(self, run_order=-1): """Runs stop method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we clean up state before committing run files etc. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so they're stopped in reverse order...
python
def stop_all(self, run_order=-1): """Runs stop method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we clean up state before committing run files etc. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so they're stopped in reverse order...
[ "def", "stop_all", "(", "self", ",", "run_order", "=", "-", "1", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# sort them so they're stopped in reverse order", "for", "module_id", "in", "self", ".", "module_ids", "(", "r...
Runs stop method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we clean up state before committing run files etc.
[ "Runs", "stop", "method", "on", "all", "modules", "less", "than", "the", "passed", "-", "in", "run_order", ".", "Used", "when", "target", "is", "exporting", "itself", "mid", "-", "build", "so", "we", "clean", "up", "state", "before", "committing", "run", ...
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4615-L4627
train
ianmiell/shutit
shutit_class.py
ShutIt.start_all
def start_all(self, run_order=-1): """Runs start method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we can export a clean target and still depended-on modules running if necessary. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so ...
python
def start_all(self, run_order=-1): """Runs start method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we can export a clean target and still depended-on modules running if necessary. """ shutit_global.shutit_global_object.yield_to_draw() # sort them so ...
[ "def", "start_all", "(", "self", ",", "run_order", "=", "-", "1", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# sort them so they're started in order", "for", "module_id", "in", "self", ".", "module_ids", "(", ")", ":...
Runs start method on all modules less than the passed-in run_order. Used when target is exporting itself mid-build, so we can export a clean target and still depended-on modules running if necessary.
[ "Runs", "start", "method", "on", "all", "modules", "less", "than", "the", "passed", "-", "in", "run_order", ".", "Used", "when", "target", "is", "exporting", "itself", "mid", "-", "build", "so", "we", "can", "export", "a", "clean", "target", "and", "stil...
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4631-L4643
train
ianmiell/shutit
shutit_class.py
ShutIt.init_shutit_map
def init_shutit_map(self): """Initializes the module map of shutit based on the modules we have gathered. Checks we have core modules Checks for duplicate module details. Sets up common config. Sets up map of modules. """ shutit_global.shutit_global_object.yield_to_draw() modules = self.shutit_module...
python
def init_shutit_map(self): """Initializes the module map of shutit based on the modules we have gathered. Checks we have core modules Checks for duplicate module details. Sets up common config. Sets up map of modules. """ shutit_global.shutit_global_object.yield_to_draw() modules = self.shutit_module...
[ "def", "init_shutit_map", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "modules", "=", "self", ".", "shutit_modules", "# Have we got anything to process outside of special modules?", "if", "len", "(", "[", "mod", ...
Initializes the module map of shutit based on the modules we have gathered. Checks we have core modules Checks for duplicate module details. Sets up common config. Sets up map of modules.
[ "Initializes", "the", "module", "map", "of", "shutit", "based", "on", "the", "modules", "we", "have", "gathered", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4661-L4700
train
ianmiell/shutit
shutit_class.py
ShutIt.conn_target
def conn_target(self): """Connect to the target. """ shutit_global.shutit_global_object.yield_to_draw() conn_module = None for mod in self.conn_modules: if mod.module_id == self.build['conn_module']: conn_module = mod break if conn_module is None: self.fail('Couldn\'t find conn_module ' + self...
python
def conn_target(self): """Connect to the target. """ shutit_global.shutit_global_object.yield_to_draw() conn_module = None for mod in self.conn_modules: if mod.module_id == self.build['conn_module']: conn_module = mod break if conn_module is None: self.fail('Couldn\'t find conn_module ' + self...
[ "def", "conn_target", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "conn_module", "=", "None", "for", "mod", "in", "self", ".", "conn_modules", ":", "if", "mod", ".", "module_id", "==", "self", ".", "...
Connect to the target.
[ "Connect", "to", "the", "target", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4703-L4717
train
ianmiell/shutit
shutit_class.py
ShutIt.finalize_target
def finalize_target(self): """Finalize the target using the core finalize method. """ shutit_global.shutit_global_object.yield_to_draw() self.pause_point('\nFinalizing the target module (' + self.shutit_main_dir + '/shutit_setup.py)', print_input=False, level=3) # Can assume conn_module exists at this point ...
python
def finalize_target(self): """Finalize the target using the core finalize method. """ shutit_global.shutit_global_object.yield_to_draw() self.pause_point('\nFinalizing the target module (' + self.shutit_main_dir + '/shutit_setup.py)', print_input=False, level=3) # Can assume conn_module exists at this point ...
[ "def", "finalize_target", "(", "self", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "pause_point", "(", "'\\nFinalizing the target module ('", "+", "self", ".", "shutit_main_dir", "+", "'/shutit_setup.py)'", ",",...
Finalize the target using the core finalize method.
[ "Finalize", "the", "target", "using", "the", "core", "finalize", "method", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4720-L4730
train
ianmiell/shutit
shutit_class.py
ShutIt.resolve_dependencies
def resolve_dependencies(self, to_build, depender): """Add any required dependencies. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In resolve_dependencies',level=logging.DEBUG) cfg = self.cfg for dependee_id in depender.depends_on: dependee = self.shutit_map.get(dependee_id) # Don'...
python
def resolve_dependencies(self, to_build, depender): """Add any required dependencies. """ shutit_global.shutit_global_object.yield_to_draw() self.log('In resolve_dependencies',level=logging.DEBUG) cfg = self.cfg for dependee_id in depender.depends_on: dependee = self.shutit_map.get(dependee_id) # Don'...
[ "def", "resolve_dependencies", "(", "self", ",", "to_build", ",", "depender", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "self", ".", "log", "(", "'In resolve_dependencies'", ",", "level", "=", "logging", ".", "DEBUG"...
Add any required dependencies.
[ "Add", "any", "required", "dependencies", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4735-L4748
train
ianmiell/shutit
shutit_class.py
ShutIt.check_dependee_exists
def check_dependee_exists(self, depender, dependee, dependee_id): """Checks whether a depended-on module is available. """ shutit_global.shutit_global_object.yield_to_draw() # If the module id isn't there, there's a problem. if dependee is None: return 'module: \n\n' + dependee_id + '\n\nnot found in paths...
python
def check_dependee_exists(self, depender, dependee, dependee_id): """Checks whether a depended-on module is available. """ shutit_global.shutit_global_object.yield_to_draw() # If the module id isn't there, there's a problem. if dependee is None: return 'module: \n\n' + dependee_id + '\n\nnot found in paths...
[ "def", "check_dependee_exists", "(", "self", ",", "depender", ",", "dependee", ",", "dependee_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "# If the module id isn't there, there's a problem.", "if", "dependee", "is", "None...
Checks whether a depended-on module is available.
[ "Checks", "whether", "a", "depended", "-", "on", "module", "is", "available", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4751-L4758
train
ianmiell/shutit
shutit_class.py
ShutIt.check_dependee_build
def check_dependee_build(self, depender, dependee, dependee_id): """Checks whether a depended on module is configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # If depender is installed or will be installed, so must the dependee if not (cfg[dependee.module_id]['shut...
python
def check_dependee_build(self, depender, dependee, dependee_id): """Checks whether a depended on module is configured to be built. """ shutit_global.shutit_global_object.yield_to_draw() cfg = self.cfg # If depender is installed or will be installed, so must the dependee if not (cfg[dependee.module_id]['shut...
[ "def", "check_dependee_build", "(", "self", ",", "depender", ",", "dependee", ",", "dependee_id", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "cfg", "=", "self", ".", "cfg", "# If depender is installed or will be installed, ...
Checks whether a depended on module is configured to be built.
[ "Checks", "whether", "a", "depended", "on", "module", "is", "configured", "to", "be", "built", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4761-L4770
train
ianmiell/shutit
shutit_class.py
ShutIt.destroy
def destroy(self): """Finish up a session. """ if self.session_type == 'bash': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout() elif self.session_type == 'vagrant': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout()
python
def destroy(self): """Finish up a session. """ if self.session_type == 'bash': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout() elif self.session_type == 'vagrant': # TODO: does this work/handle already being logged out/logged in deep OK? self.logout()
[ "def", "destroy", "(", "self", ")", ":", "if", "self", ".", "session_type", "==", "'bash'", ":", "# TODO: does this work/handle already being logged out/logged in deep OK?", "self", ".", "logout", "(", ")", "elif", "self", ".", "session_type", "==", "'vagrant'", ":"...
Finish up a session.
[ "Finish", "up", "a", "session", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_class.py#L4858-L4866
train
ianmiell/shutit
shutit_module.py
shutit_method_scope
def shutit_method_scope(func): """Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function. """ def wrapper(self, shutit): """Wrapper to call a shutit module method, notifying the ShutIt object. """ ret = func(self, shutit) return ret retu...
python
def shutit_method_scope(func): """Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function. """ def wrapper(self, shutit): """Wrapper to call a shutit module method, notifying the ShutIt object. """ ret = func(self, shutit) return ret retu...
[ "def", "shutit_method_scope", "(", "func", ")", ":", "def", "wrapper", "(", "self", ",", "shutit", ")", ":", "\"\"\"Wrapper to call a shutit module method, notifying the ShutIt object.\n\t\t\"\"\"", "ret", "=", "func", "(", "self", ",", "shutit", ")", "return", "ret",...
Notifies the ShutIt object whenever we call a shutit module method. This allows setting values for the 'scope' of a function.
[ "Notifies", "the", "ShutIt", "object", "whenever", "we", "call", "a", "shutit", "module", "method", ".", "This", "allows", "setting", "values", "for", "the", "scope", "of", "a", "function", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_module.py#L53-L62
train
ianmiell/shutit
shutit_threads.py
managing_thread_main_simple
def managing_thread_main_simple(): """Simpler thread to track whether main thread has been quiet for long enough that a thread dump should be printed. """ import shutit_global last_msg = '' while True: printed_anything = False if shutit_global.shutit_global_object.log_trace_when_idle and time.time() - shutit_...
python
def managing_thread_main_simple(): """Simpler thread to track whether main thread has been quiet for long enough that a thread dump should be printed. """ import shutit_global last_msg = '' while True: printed_anything = False if shutit_global.shutit_global_object.log_trace_when_idle and time.time() - shutit_...
[ "def", "managing_thread_main_simple", "(", ")", ":", "import", "shutit_global", "last_msg", "=", "''", "while", "True", ":", "printed_anything", "=", "False", "if", "shutit_global", ".", "shutit_global_object", ".", "log_trace_when_idle", "and", "time", ".", "time",...
Simpler thread to track whether main thread has been quiet for long enough that a thread dump should be printed.
[ "Simpler", "thread", "to", "track", "whether", "main", "thread", "has", "been", "quiet", "for", "long", "enough", "that", "a", "thread", "dump", "should", "be", "printed", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_threads.py#L138-L172
train
ianmiell/shutit
package_map.py
map_package
def map_package(shutit_pexpect_session, package, install_type): """If package mapping exists, then return it, else return package. """ if package in PACKAGE_MAP.keys(): for itype in PACKAGE_MAP[package].keys(): if itype == install_type: ret = PACKAGE_MAP[package][install_type] if isinstance(ret,str): ...
python
def map_package(shutit_pexpect_session, package, install_type): """If package mapping exists, then return it, else return package. """ if package in PACKAGE_MAP.keys(): for itype in PACKAGE_MAP[package].keys(): if itype == install_type: ret = PACKAGE_MAP[package][install_type] if isinstance(ret,str): ...
[ "def", "map_package", "(", "shutit_pexpect_session", ",", "package", ",", "install_type", ")", ":", "if", "package", "in", "PACKAGE_MAP", ".", "keys", "(", ")", ":", "for", "itype", "in", "PACKAGE_MAP", "[", "package", "]", ".", "keys", "(", ")", ":", "i...
If package mapping exists, then return it, else return package.
[ "If", "package", "mapping", "exists", "then", "return", "it", "else", "return", "package", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/package_map.py#L135-L148
train
ianmiell/shutit
shutit_util.py
is_file_secure
def is_file_secure(file_name): """Returns false if file is considered insecure, true if secure. If file doesn't exist, it's considered secure! """ if not os.path.isfile(file_name): return True file_mode = os.stat(file_name).st_mode if file_mode & (stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat...
python
def is_file_secure(file_name): """Returns false if file is considered insecure, true if secure. If file doesn't exist, it's considered secure! """ if not os.path.isfile(file_name): return True file_mode = os.stat(file_name).st_mode if file_mode & (stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat...
[ "def", "is_file_secure", "(", "file_name", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "file_name", ")", ":", "return", "True", "file_mode", "=", "os", ".", "stat", "(", "file_name", ")", ".", "st_mode", "if", "file_mode", "&", "(", ...
Returns false if file is considered insecure, true if secure. If file doesn't exist, it's considered secure!
[ "Returns", "false", "if", "file", "is", "considered", "insecure", "true", "if", "secure", ".", "If", "file", "doesn", "t", "exist", "it", "s", "considered", "secure!" ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L57-L66
train
ianmiell/shutit
shutit_util.py
random_id
def random_id(size=8, chars=string.ascii_letters + string.digits): """Generates a random string of given size from the given chars. @param size: The size of the random string. @param chars: Constituent pool of characters to draw random characters from. @type size: number @type chars: string @rtype: str...
python
def random_id(size=8, chars=string.ascii_letters + string.digits): """Generates a random string of given size from the given chars. @param size: The size of the random string. @param chars: Constituent pool of characters to draw random characters from. @type size: number @type chars: string @rtype: str...
[ "def", "random_id", "(", "size", "=", "8", ",", "chars", "=", "string", ".", "ascii_letters", "+", "string", ".", "digits", ")", ":", "return", "''", ".", "join", "(", "random", ".", "choice", "(", "chars", ")", "for", "_", "in", "range", "(", "siz...
Generates a random string of given size from the given chars. @param size: The size of the random string. @param chars: Constituent pool of characters to draw random characters from. @type size: number @type chars: string @rtype: string @return: The string of random characters.
[ "Generates", "a", "random", "string", "of", "given", "size", "from", "the", "given", "chars", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L82-L92
train
ianmiell/shutit
shutit_util.py
random_word
def random_word(size=6): """Returns a random word in lower case. """ words = shutit_assets.get_words().splitlines() word = '' while len(word) != size or "'" in word: word = words[int(random.random() * (len(words) - 1))] return word.lower()
python
def random_word(size=6): """Returns a random word in lower case. """ words = shutit_assets.get_words().splitlines() word = '' while len(word) != size or "'" in word: word = words[int(random.random() * (len(words) - 1))] return word.lower()
[ "def", "random_word", "(", "size", "=", "6", ")", ":", "words", "=", "shutit_assets", ".", "get_words", "(", ")", ".", "splitlines", "(", ")", "word", "=", "''", "while", "len", "(", "word", ")", "!=", "size", "or", "\"'\"", "in", "word", ":", "wor...
Returns a random word in lower case.
[ "Returns", "a", "random", "word", "in", "lower", "case", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L95-L102
train
ianmiell/shutit
shutit_util.py
ctrl_c_signal_handler
def ctrl_c_signal_handler(_, frame): """CTRL-c signal handler - enters a pause point if it can. """ global ctrl_c_calls ctrl_c_calls += 1 if ctrl_c_calls > 10: shutit_global.shutit_global_object.handle_exit(exit_code=1) shutit_frame = get_shutit_frame(frame) if in_ctrlc: msg = 'CTRL-C hit twice, quitting' ...
python
def ctrl_c_signal_handler(_, frame): """CTRL-c signal handler - enters a pause point if it can. """ global ctrl_c_calls ctrl_c_calls += 1 if ctrl_c_calls > 10: shutit_global.shutit_global_object.handle_exit(exit_code=1) shutit_frame = get_shutit_frame(frame) if in_ctrlc: msg = 'CTRL-C hit twice, quitting' ...
[ "def", "ctrl_c_signal_handler", "(", "_", ",", "frame", ")", ":", "global", "ctrl_c_calls", "ctrl_c_calls", "+=", "1", "if", "ctrl_c_calls", ">", "10", ":", "shutit_global", ".", "shutit_global_object", ".", "handle_exit", "(", "exit_code", "=", "1", ")", "shu...
CTRL-c signal handler - enters a pause point if it can.
[ "CTRL", "-", "c", "signal", "handler", "-", "enters", "a", "pause", "point", "if", "it", "can", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L145-L182
train
ianmiell/shutit
shutit_util.py
get_input
def get_input(msg, default='', valid=None, boolean=False, ispass=False, color=None): """Gets input from the user, and returns the answer. @param msg: message to send to user @param default: default value if nothing entered @param valid: valid input values (default == empty list == anything allowed) @p...
python
def get_input(msg, default='', valid=None, boolean=False, ispass=False, color=None): """Gets input from the user, and returns the answer. @param msg: message to send to user @param default: default value if nothing entered @param valid: valid input values (default == empty list == anything allowed) @p...
[ "def", "get_input", "(", "msg", ",", "default", "=", "''", ",", "valid", "=", "None", ",", "boolean", "=", "False", ",", "ispass", "=", "False", ",", "color", "=", "None", ")", ":", "# switch off log tracing when in get_input", "log_trace_when_idle_original_valu...
Gets input from the user, and returns the answer. @param msg: message to send to user @param default: default value if nothing entered @param valid: valid input values (default == empty list == anything allowed) @param boolean: whether return value should be boolean @param ispass: True if this is...
[ "Gets", "input", "from", "the", "user", "and", "returns", "the", "answer", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_util.py#L281-L322
train
ianmiell/shutit
shutit_setup.py
ConnDocker.build
def build(self, shutit): """Sets up the target ready for building. """ target_child = self.start_container(shutit, 'target_child') self.setup_host_child(shutit) # TODO: on the host child, check that the image running has bash as its cmd/entrypoint. self.setup_target_child(shutit, target_child) shutit.send...
python
def build(self, shutit): """Sets up the target ready for building. """ target_child = self.start_container(shutit, 'target_child') self.setup_host_child(shutit) # TODO: on the host child, check that the image running has bash as its cmd/entrypoint. self.setup_target_child(shutit, target_child) shutit.send...
[ "def", "build", "(", "self", ",", "shutit", ")", ":", "target_child", "=", "self", ".", "start_container", "(", "shutit", ",", "'target_child'", ")", "self", ".", "setup_host_child", "(", "shutit", ")", "# TODO: on the host child, check that the image running has bash...
Sets up the target ready for building.
[ "Sets", "up", "the", "target", "ready", "for", "building", "." ]
19cd64cdfb23515b106b40213dccff4101617076
https://github.com/ianmiell/shutit/blob/19cd64cdfb23515b106b40213dccff4101617076/shutit_setup.py#L82-L90
train