query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Set initial value from editor version using edit format option
def setInitDefault(self, editText): if editText in TimeFormat.timeStampStrings: self.initDefault = TimeFormat.timeStampStrings[0] else: TextFormat.setInitDefault(self, editText)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setInitDefault(self, editText):\n if editText in DateFormat.dateStampStrings:\n self.initDefault = DateFormat.dateStampStrings[0]\n else:\n TextFormat.setInitDefault(self, editText)", "def getEditInitDefault(self):\n if self.initDefault in DateFormat.dateStampString...
[ "0.62972623", "0.62713385", "0.62475604", "0.6216652", "0.60933644", "0.60778177", "0.6009081", "0.5782725", "0.561945", "0.5530775", "0.54974884", "0.549157", "0.54463965", "0.54128057", "0.5395345", "0.5382154", "0.53760034", "0.5361667", "0.53412473", "0.52998084", "0.5289...
0.6084278
5
Return initial value in edit format, found in edit format option
def getEditInitDefault(self): if self.initDefault in TimeFormat.timeStampStrings: return TimeFormat.timeStampStrings[1] return TextFormat.getEditInitDefault(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEditInitDefault(self):\n return self.formatEditText(self.initDefault)[0]", "def getEditInitDefault(self):\n if self.initDefault in DateFormat.dateStampStrings:\n return DateFormat.dateStampStrings[1]\n return TextFormat.getEditInitDefault(self)", "def format(self) -> pulu...
[ "0.7327655", "0.69168735", "0.6163817", "0.5962609", "0.59190995", "0.5825621", "0.5639453", "0.55958575", "0.5588548", "0.55880916", "0.55728984", "0.5547174", "0.55372924", "0.5518307", "0.55125266", "0.54999983", "0.54888153", "0.54888153", "0.54887563", "0.5471209", "0.54...
0.6777391
2
Return a list of choices for setting the init default
def initDefaultChoices(self): choices = [entry[0] for entry in self.getEditChoices()] choices.insert(0, TimeFormat.timeStampStrings[1]) return choices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initDefaultChoices(self):\n return []", "def initDefaultChoices(self):\n return [entry[0] for entry in self.getEditChoices()]", "def initDefaultChoices(self):\n return [text for text in self.formatList]", "def initDefaultChoices(self):\n choices = [entry[0] for entry in self.g...
[ "0.8791058", "0.83096915", "0.8089902", "0.7565213", "0.699929", "0.699929", "0.680488", "0.67091656", "0.66209406", "0.65692645", "0.6532258", "0.6486172", "0.64289325", "0.6406578", "0.63146526", "0.62376446", "0.62375015", "0.62119025", "0.61605716", "0.6160515", "0.608993...
0.7451019
4
Return conditional comparison value with realtime adjustments, used for date and time types' 'now' value
def adjustedCompareValue(self, value): if value.startswith('now'): return repr(GenTime()) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjustedCompareValue(self, value):\n if value.startswith('now'):\n return repr(GenDate())\n return value", "def condition(self):\n HH = str(time.localtime().tm_hour)\n MM = str(time.localtime().tm_min)\n return eval(self._cond_str)", "def get_state_by_time(pyth...
[ "0.68978775", "0.6119225", "0.6032928", "0.6031085", "0.5851345", "0.5813949", "0.5813949", "0.5806566", "0.56923884", "0.5676319", "0.5638131", "0.55917704", "0.55903226", "0.55771613", "0.55758727", "0.5568553", "0.54968023", "0.54886967", "0.54710984", "0.54660606", "0.544...
0.71401125
0
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): ChoiceFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Return formatted text, properly escaped if not in titleMode
def formatOutput(self, storedText, titleMode, internal=False): if storedText not in self.formatList: try: storedText = GenBoolean(storedText).boolStr(self.format) except GenBooleanError: storedText = _errorStr return TextFormat.formatOutput(self, storedText, titleMode, internal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatOutput(self, storedText, titleMode, internal=False):\n prefix = self.prefix\n suffix = self.suffix\n if titleMode:\n if self.html:\n storedText = self.removeMarkup(storedText)\n if globalref.docRef.formHtml:\n prefix = self.removeMa...
[ "0.67517006", "0.6623557", "0.64947814", "0.6347113", "0.6307539", "0.621596", "0.6210496", "0.60684896", "0.60674477", "0.60663515", "0.60421175", "0.6019259", "0.59935653", "0.59802073", "0.59790826", "0.5948588", "0.5939195", "0.590317", "0.5872387", "0.58521676", "0.58387...
0.595393
15
Return tuple of text in edit format and bool validity, using edit format option
def formatEditText(self, storedText): if storedText in self.formatList: return (storedText, True) try: return (GenBoolean(storedText).boolStr(self.format), True) except GenBooleanError: return (storedText, not storedText)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)", "def storedText(self, editText):\n try:\n return (repr(GenBoolean(editText)), True)\n except GenBooleanError:\...
[ "0.74416876", "0.7370665", "0.71592844", "0.71025413", "0.71025413", "0.7028924", "0.68846506", "0.6550997", "0.64535177", "0.6392951", "0.63109875", "0.6300976", "0.6188802", "0.6026202", "0.5835225", "0.5771935", "0.5735613", "0.5613498", "0.5609731", "0.56050605", "0.55478...
0.70363986
5
Return tuple of stored text from edited text and bool validity, using edit format option
def storedText(self, editText): try: return (repr(GenBoolean(editText)), True) except GenBooleanError: if editText in self.formatList: return (editText, True) return (editText, not editText and not self.isRequired)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storedText(self, editText):\n if editText in self.formatList:\n return (editText, True)\n return (editText, not editText and not self.isRequired)", "def formatEditText(self, storedText):\n return (storedText, True)", "def formatEditText(self, storedText):\n return (s...
[ "0.78716373", "0.75691116", "0.75691116", "0.7379154", "0.73117137", "0.7183602", "0.7152062", "0.7089976", "0.6903923", "0.6863199", "0.68065554", "0.6748621", "0.6604557", "0.62711895", "0.61224514", "0.6009547", "0.5690611", "0.5690611", "0.5690611", "0.5690611", "0.569061...
0.76830506
1
Return value to be compared for sorting and conditionals
def sortValue(self, data): storedText = data.get(self.name, '') try: return repr(GenBoolean(storedText)) except GenBooleanError: return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, value: int, /) -> None:", "def compare(self) -> int:", "def compareFunction( self, first, second ):\n for ascending,column in self.sortOrder:\n aValue,bValue = column.get(first),column.get(second)\n diff = cmp(aValue,bValue)\n if diff:\n ...
[ "0.68654275", "0.68611443", "0.66724616", "0.6351402", "0.6351402", "0.63162804", "0.6138383", "0.6053028", "0.6039845", "0.5910521", "0.58821", "0.58723485", "0.5849007", "0.5812883", "0.5799768", "0.57915914", "0.5790346", "0.57894623", "0.5771585", "0.5759572", "0.5746019"...
0.5488403
47
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): TextFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Return the next value for a new node, increment format if increment is True
def nextValue(self, increment=True): try: prefix, numText, suffix = UniqueIDFormat.formatRe.\ match(self.format).groups() except AttributeError: self.format = UniqueIDFormat.defaultFormat return self.nextValue(increment) value = self.format if increment: pattern = u'%%s%%0.%dd%%s' % len(numText) num = int(numText) + 1 self.format = pattern % (prefix, num, suffix) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutate(self, node, _):\n new_node = ast.Num(n=node.n + 1)\n return new_node", "def next(self):\n with self.atomicfile.locked():\n curr = self.atomicfile.read_atomic().decode(\"utf8\")\n curr = self.initial if not curr else int(curr)\n self.atomicfile.writ...
[ "0.66704005", "0.63615674", "0.63538784", "0.6263111", "0.6259454", "0.625471", "0.62121814", "0.6187122", "0.615829", "0.61369663", "0.6088049", "0.60810864", "0.6007773", "0.5959815", "0.59519273", "0.5947382", "0.5939667", "0.58915627", "0.58673847", "0.5866701", "0.583965...
0.6884581
0
Return value to be compared for sorting and conditionals
def sortValue(self, data): storedText = data.get(self.name, '') try: return int(UniqueIDFormat.formatRe.match(storedText).group(2)) except AttributeError: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, value: int, /) -> None:", "def compare(self) -> int:", "def compareFunction( self, first, second ):\n for ascending,column in self.sortOrder:\n aValue,bValue = column.get(first),column.get(second)\n diff = cmp(aValue,bValue)\n if diff:\n ...
[ "0.6866802", "0.6862163", "0.6673221", "0.63514173", "0.63514173", "0.63162124", "0.6138884", "0.6054708", "0.60404193", "0.5911979", "0.5881882", "0.5874233", "0.58493686", "0.58137196", "0.5800126", "0.57923204", "0.57919735", "0.5789459", "0.57723606", "0.576029", "0.57464...
0.0
-1
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): TextFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Called by base init, after class change or format text change
def initFormat(self): self.html = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initFormat(self):\n pass", "def init_text(self):\n d = self.declaration\n if d.text:\n self.set_text(d.text)\n if d.text_color:\n self.set_text_color(d.text_color)\n if d.text_alignment:\n self.set_text_alignment(d.text_alignment)\n i...
[ "0.7095915", "0.70883477", "0.6957401", "0.6811701", "0.6811701", "0.6811701", "0.6811701", "0.6811701", "0.6811701", "0.6811701", "0.6811701", "0.6811701", "0.6801035", "0.67764556", "0.67764556", "0.6772573", "0.67218834", "0.6665987", "0.6530844", "0.6495981", "0.6490198",...
0.6494592
21
Return formatted text for this field
def outputText(self, item, titleMode, internal=False): if self.useFileInfo: item = globalref.docRef.fileInfoItem altText = '' if self.linkAltField: field = item.nodeFormat().findField(self.linkAltField) if field: altText = field.outputText(item, titleMode, internal) storedText = item.data.get(self.name, '') if storedText: return self.formatOutput(storedText, titleMode, altText, internal) return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_text(self):\n\n return \"{}{}{}\".format(self.get_text(),\n Message.format_performers(self.get_performers()),\n Message.format_keywords(self.get_keywords())).strip()", "def formatted(self) -> str:\r\n ...", "def format(self) -> str:", "def text(self) -> str:", ...
[ "0.75734353", "0.7379207", "0.7205578", "0.68481845", "0.67844886", "0.67808527", "0.67703915", "0.67703915", "0.67655444", "0.6745665", "0.6687435", "0.66469747", "0.6644202", "0.66413474", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65741307", "...
0.0
-1
Return formatted text, properly escaped and with a link reference if not in titleMode
def formatOutput(self, storedText, titleMode, altText='', internal=False): if titleMode: return TextFormat.formatOutput(self, storedText, titleMode, internal) paths = storedText.split('\n') results = [] for url in paths: path = url if not URLFormat.hasMethodRe.match(path): path = u'%s%s' % (self.URLMethod, path) path = u'<a href="%s">%s</a>' % (escape(path, treedoc.escDict), altText or url) results.append(TextFormat.formatOutput(self, path, titleMode, internal)) return u'<br />'.join(results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputText(self, item, titleMode, internal=False):\n if self.useFileInfo:\n item = globalref.docRef.fileInfoItem\n altText = ''\n if self.linkAltField:\n field = item.nodeFormat().findField(self.linkAltField)\n if field:\n altText = field.out...
[ "0.6451654", "0.6356785", "0.6355241", "0.6344087", "0.622849", "0.6197949", "0.61366516", "0.6077827", "0.6039847", "0.603759", "0.6030842", "0.6006238", "0.5959275", "0.5883406", "0.58804315", "0.5844024", "0.5833735", "0.5794162", "0.5784406", "0.577917", "0.57081777", "...
0.60614115
8
Return what we need to write into an XSL file for this type
def xslText(self): return u'<xsl:for-each select = "./%s">%s<xsl:choose>'\ '<xsl:when test="contains(., \':\')"><a href="{.}">'\ '<xsl:value-of select="."/></a></xsl:when><xsl:otherwise>'\ '<a href="%s{.}"><xsl:value-of select="."/></a>'\ '</xsl:otherwise></xsl:choose>%s</xsl:for-each>' % \ (self.name, xslEscape(self.prefix), self.URLMethod, xslEscape(self.suffix))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)", "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)...
[ "0.6364573", "0.6153296", "0.58370924", "0.583494", "0.5813206", "0.5642924", "0.5630074", "0.56008315", "0.5582877", "0.55446607", "0.5526882", "0.5517534", "0.551431", "0.55121994", "0.54558533", "0.54547614", "0.54296464", "0.5400794", "0.5307159", "0.5298352", "0.5290552"...
0.4823362
68
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): URLFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): URLFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): URLFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): URLFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.7352181", "0.6755271", "0.671636", "0.6705414", "0.66772985", "0.65812147", "0.6522757", "0.6522757", "0.65198946", "0.6471234", "0.6269759", "0.6264971", "0.61534846", "0.6090959", "0.6031979", "0.6028283", "0.6011439", "0.60043883", "0.59848917", "0.5941512", "0.5920574"...
0.0
-1
Return formatted text, properly escaped and with a link reference if not in titleMode
def formatOutput(self, storedText, titleMode, altText='', internal=False): if titleMode or not internal: return TextFormat.formatOutput(self, storedText, titleMode, internal) paths = storedText.split('\n') results = [] for url in paths: # add prefix/suffix within the executable path: url = TextFormat.formatOutput(self, url, titleMode, internal) path = url if not URLFormat.hasMethodRe.match(path): path = u'%s%s' % (self.URLMethod, path) results.append(u'<a href="%s">%s</a>' % (escape(path, treedoc.escDict), altText or url)) return u'<br />'.join(results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputText(self, item, titleMode, internal=False):\n if self.useFileInfo:\n item = globalref.docRef.fileInfoItem\n altText = ''\n if self.linkAltField:\n field = item.nodeFormat().findField(self.linkAltField)\n if field:\n altText = field.out...
[ "0.64514065", "0.63557965", "0.6355717", "0.6343572", "0.62287307", "0.61965793", "0.61361015", "0.607787", "0.60609573", "0.6039025", "0.6030655", "0.6005965", "0.5958118", "0.58831125", "0.58806616", "0.5844087", "0.58333874", "0.57946926", "0.5783884", "0.5778737", "0.5708...
0.6036914
10
Return what we need to write into an XSL file for this type
def xslText(self): return TextFormat.xslText(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)", "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)...
[ "0.6366979", "0.61544836", "0.58340883", "0.5812942", "0.5640789", "0.5632317", "0.5603479", "0.55815554", "0.55431604", "0.55276537", "0.55154866", "0.5513102", "0.5510308", "0.5458654", "0.5451725", "0.54285127", "0.54037434", "0.5307067", "0.5298246", "0.52886873", "0.5272...
0.5839131
2
Any format, prefix, suffix, html info in attrs dict
def __init__(self, name, attrs={}): TextFormat.__init__(self, name, attrs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_attrs(attrs):\n html = \"\"\n for a in attrs.items():\n if a[1]:\n html = html + \"%s=\\\"%s\\\" \"%(a)\n return html", "def attr(*attrs: ATTRIBUTE) -> str:\n return PyHTML.attr(*attrs)", "def attrs(context):\n result = \"\"\n for key, value in context.flatten().ite...
[ "0.735201", "0.6754294", "0.67166066", "0.67071074", "0.66780305", "0.65807486", "0.6522693", "0.6522693", "0.65187657", "0.6471306", "0.6269984", "0.62653935", "0.6153201", "0.6090701", "0.60323846", "0.60278016", "0.6011661", "0.60042846", "0.59841794", "0.5941162", "0.5920...
0.0
-1
Called by base init, after class change or format text change
def initFormat(self): self.html = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initFormat(self):\n pass", "def init_text(self):\n d = self.declaration\n if d.text:\n self.set_text(d.text)\n if d.text_color:\n self.set_text_color(d.text_color)\n if d.text_alignment:\n self.set_text_alignment(d.text_alignment)\n i...
[ "0.70964426", "0.708642", "0.6957156", "0.6810953", "0.6810953", "0.6810953", "0.6810953", "0.6810953", "0.6810953", "0.6810953", "0.6810953", "0.6810953", "0.6798828", "0.6774329", "0.6774329", "0.67712367", "0.6720732", "0.6666233", "0.65283895", "0.6494219", "0.64904994", ...
0.6495605
19
Return formatted text, properly escaped and with a link to the picture if not in titleMode
def formatOutput(self, storedText, titleMode, internal=False): if titleMode: return TextFormat.formatOutput(self, storedText, titleMode, internal) paths = storedText.split('\n') results = ['<img src="%s">' % escape(url, treedoc.escDict) for url in paths] return u'<br />'.join(results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image(self, src, title, text):\n src = escape_link(src)\n text = escape(text, quote=True)\n if title:\n title = escape(title, quote=True)\n html = '<img src=\"%s\" alt=\"%s\" title=\"%s\"' % (src, text, title)\n else:\n html = '<img src=\"%s\" alt=\"...
[ "0.625808", "0.6189183", "0.59681433", "0.59475166", "0.5911793", "0.58762133", "0.5813121", "0.5810856", "0.5802654", "0.58000255", "0.5753115", "0.57340395", "0.572571", "0.5709024", "0.5676528", "0.567329", "0.5668774", "0.5666511", "0.56526905", "0.56396496", "0.56106", ...
0.68930674
0
Return name enclosed with { } separators
def sepName(self, englishOnly=False): name = englishOnly and self.enName or self.name return u'{*%s%s*}' % (self.parentLevel * '*', name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_name():\n def _extract_name(quoted_name):\n return e.String(quoted_name.subexpression.name)\n yield (\"(λ &[name] . str)\", _extract_name)", "def _extract_name(line: str) -> str:\n tokens = line[19:-2].split(\" {\")\n name = tokens[0]\n return name", "def format_na...
[ "0.70919734", "0.69829744", "0.68450254", "0.67303866", "0.6666624", "0.66044873", "0.65953267", "0.65891093", "0.65593725", "0.623893", "0.6218805", "0.61895317", "0.61869186", "0.6163495", "0.6100971", "0.6099947", "0.6092239", "0.607046", "0.60489154", "0.6042493", "0.6029...
0.0
-1
Return formatted text for this field
def outputText(self, item, titleMode, internal=False): for num in range(self.parentLevel): item = item.parent if not item: return '' field = item.nodeFormat().findField(self.name) if not field: return '' return field.outputText(item, titleMode, internal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_text(self):\n\n return \"{}{}{}\".format(self.get_text(),\n Message.format_performers(self.get_performers()),\n Message.format_keywords(self.get_keywords())).strip()", "def formatted(self) -> str:\r\n ...", "def format(self) -> str:", "def text(self) -> str:", ...
[ "0.75734353", "0.7379207", "0.7205578", "0.68481845", "0.67844886", "0.67808527", "0.67703915", "0.67703915", "0.67655444", "0.6745665", "0.6687435", "0.66469747", "0.6644202", "0.66413474", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65741307", "...
0.0
-1
Return what we need to write into an XSL file for this type
def xslText(self): return u'<xsl:value-of select="%s%s"/>' % (self.parentLevel * '../', self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)", "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)...
[ "0.6366979", "0.61544836", "0.5839131", "0.58340883", "0.5812942", "0.5640789", "0.5603479", "0.55815554", "0.55431604", "0.55276537", "0.55154866", "0.5513102", "0.5510308", "0.5458654", "0.5451725", "0.54285127", "0.54037434", "0.5307067", "0.5298246", "0.52886873", "0.5272...
0.5632317
6
Return XSL file test for data existance
def xslTestText(self): return u'normalize-space(%s%s)' % (self.parentLevel * '../', self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)\n newdom = transform(dom)\n except IOError:\n print \"Xml or Xsl file not found...
[ "0.5755427", "0.5572019", "0.5549192", "0.5519365", "0.5482828", "0.5464173", "0.5427079", "0.54160964", "0.536601", "0.5338898", "0.52344614", "0.5227911", "0.51953274", "0.5182521", "0.51584786", "0.51524824", "0.51514745", "0.51503146", "0.511027", "0.5074203", "0.5046354"...
0.0
-1
Return name enclosed with {? } separators
def sepName(self, englishOnly=False): name = englishOnly and self.enName or self.name return u'{*?%s*}' % (name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qname(uri, name):\n if not uri or not name or name[0] in ('{', '.', '/', '['):\n return name\n else:\n return '{%s}%s' % (uri, name)", "def extract_name():\n def _extract_name(quoted_name):\n return e.String(quoted_name.subexpression.name)\n yield (\"(λ &[name...
[ "0.61448735", "0.61404973", "0.5836852", "0.5794541", "0.57860225", "0.57392246", "0.5660936", "0.56530035", "0.5644217", "0.55994993", "0.55715615", "0.55315167", "0.55184275", "0.54926336", "0.5441188", "0.5408375", "0.5391947", "0.53832364", "0.5359637", "0.5346842", "0.53...
0.54990566
13
Return formatted text for this field
def outputText(self, item, titleMode, internal=False): field = None while not field: item = item.parent if item: field = item.nodeFormat().findField(self.name) else: return '' return field.outputText(item, titleMode, internal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_text(self):\n\n return \"{}{}{}\".format(self.get_text(),\n Message.format_performers(self.get_performers()),\n Message.format_keywords(self.get_keywords())).strip()", "def formatted(self) -> str:\r\n ...", "def format(self) -> str:", "def text(self) -> str:", ...
[ "0.75734353", "0.7379207", "0.7205578", "0.68481845", "0.67844886", "0.67808527", "0.67703915", "0.67703915", "0.67655444", "0.6745665", "0.6687435", "0.66469747", "0.6644202", "0.66413474", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65741307", "...
0.613794
90
Return what we need to write into an XSL file for this type
def xslText(self): return u'<xsl:value-of select="ancestor::*/%s"/>' % self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)", "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)...
[ "0.6366979", "0.61544836", "0.5839131", "0.58340883", "0.5812942", "0.5640789", "0.5632317", "0.5603479", "0.55815554", "0.55431604", "0.55276537", "0.55154866", "0.5513102", "0.5510308", "0.5451725", "0.54285127", "0.54037434", "0.5307067", "0.5298246", "0.52886873", "0.5272...
0.5458654
14
Return XSL file test for data existance
def xslTestText(self): return u'normalize-space(ancestor::*/%s)' % self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)\n newdom = transform(dom)\n except IOError:\n print \"Xml or Xsl file not found...
[ "0.5755427", "0.5572019", "0.5549192", "0.5519365", "0.5482828", "0.5464173", "0.5427079", "0.54160964", "0.536601", "0.5338898", "0.52344614", "0.5227911", "0.51953274", "0.5182521", "0.51584786", "0.51524824", "0.51514745", "0.51503146", "0.511027", "0.5074203", "0.5046354"...
0.47780943
54
Return name enclosed with {? } separators
def sepName(self, englishOnly=False): name = englishOnly and self.enName or self.name return u'{*&%s*}' % (name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qname(uri, name):\n if not uri or not name or name[0] in ('{', '.', '/', '['):\n return name\n else:\n return '{%s}%s' % (uri, name)", "def extract_name():\n def _extract_name(quoted_name):\n return e.String(quoted_name.subexpression.name)\n yield (\"(λ &[name...
[ "0.61448735", "0.61404973", "0.5836852", "0.5794541", "0.57860225", "0.57392246", "0.56530035", "0.5644217", "0.55994993", "0.55715615", "0.55315167", "0.55184275", "0.54990566", "0.54926336", "0.5441188", "0.5408375", "0.5391947", "0.53832364", "0.5359637", "0.5346842", "0.5...
0.5660936
6
Return formatted text for this field
def outputText(self, item, titleMode, internal=False): result = [] for child in item.childList: field = child.nodeFormat().findField(self.name) if field: text = field.outputText(child, titleMode, internal) if text: result.append(text) return globalref.docRef.childFieldSep.join(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_text(self):\n\n return \"{}{}{}\".format(self.get_text(),\n Message.format_performers(self.get_performers()),\n Message.format_keywords(self.get_keywords())).strip()", "def formatted(self) -> str:\r\n ...", "def format(self) -> str:", "def text(self) -> str:", ...
[ "0.75734353", "0.7379207", "0.7205578", "0.68481845", "0.67844886", "0.67808527", "0.67703915", "0.67703915", "0.67655444", "0.6745665", "0.6687435", "0.66469747", "0.6644202", "0.66413474", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65741307", "...
0.0
-1
Return what we need to write into an XSL file for this type
def xslText(self): return u'<xsl:value-of select="child::*/%s"/>' % self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, f):\n tree = f.build_etree(lxml=True)\n return self.xslt(tree)", "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)...
[ "0.6366979", "0.61544836", "0.5839131", "0.58340883", "0.5812942", "0.5640789", "0.5632317", "0.55815554", "0.55431604", "0.55276537", "0.55154866", "0.5513102", "0.5510308", "0.5458654", "0.5451725", "0.54285127", "0.54037434", "0.5307067", "0.5298246", "0.52886873", "0.5272...
0.5603479
7
Return XSL file test for data existance
def xslTestText(self): return u'normalize-space(child::*/%s)' % self.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self):\n try:\n f = StringIO.StringIO(self.content)\n dom = XTree.parse(f)\n xslt = XTree.parse(self.stylesheet)\n transform = XTree.XSLT(xslt)\n newdom = transform(dom)\n except IOError:\n print \"Xml or Xsl file not found...
[ "0.5755427", "0.5572019", "0.5549192", "0.5519365", "0.5482828", "0.5464173", "0.5427079", "0.54160964", "0.536601", "0.5338898", "0.52344614", "0.5227911", "0.51953274", "0.5182521", "0.51584786", "0.51524824", "0.51514745", "0.51503146", "0.511027", "0.5074203", "0.5046354"...
0.47550705
60
Return name enclosed with {? } separators
def sepName(self, englishOnly=False): name = englishOnly and self.enName or self.name return u'{*#%s*}' % (name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qname(uri, name):\n if not uri or not name or name[0] in ('{', '.', '/', '['):\n return name\n else:\n return '{%s}%s' % (uri, name)", "def extract_name():\n def _extract_name(quoted_name):\n return e.String(quoted_name.subexpression.name)\n yield (\"(λ &[name...
[ "0.61448735", "0.61404973", "0.5836852", "0.5794541", "0.57860225", "0.57392246", "0.5660936", "0.56530035", "0.5644217", "0.55994993", "0.55715615", "0.55315167", "0.55184275", "0.54990566", "0.54926336", "0.5441188", "0.5408375", "0.5391947", "0.53832364", "0.5359637", "0.5...
0.5159675
35
Return formatted text for this field
def outputText(self, item, titleMode, internal=False): return repr(len(item.descendLevelList(-self.parentLevel)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_text(self):\n\n return \"{}{}{}\".format(self.get_text(),\n Message.format_performers(self.get_performers()),\n Message.format_keywords(self.get_keywords())).strip()", "def formatted(self) -> str:\r\n ...", "def format(self) -> str:", "def text(self) -> str:", ...
[ "0.75734353", "0.7379207", "0.7205578", "0.68481845", "0.67844886", "0.67808527", "0.67703915", "0.67703915", "0.67655444", "0.6745665", "0.6687435", "0.66469747", "0.6644202", "0.66413474", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65842545", "0.65741307", "...
0.0
-1
Returns the statistics of this bot in the current trained status
def get_stats(self): stats = "\n\nBOT STATS: This bot currently knowns " if self.intents: categoryqty = 0 patternqty = 0 responseqty = 0 for intent in self.intents['intents']: categoryqty += 1 patternqty += len(intent['patterns']) responseqty += len(intent['responses']) stats += str(categoryqty) stats += " Categories with in total " stats += str(patternqty) stats += " Input Patterns and " stats += str(responseqty) stats += " possible Responses" stats += "\n\n" return stats
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stats(self):\n return self.stats", "def get_stats(self):\n return utils.csv_to_dict(wait(self.proto.stat()))", "def get_stats(self):\n return self.manager.get_stats(self)", "def statistics(self):\n return self.get_statistics()", "def get_statistics(self):\n train_...
[ "0.71037495", "0.7084966", "0.6931377", "0.6927751", "0.6916035", "0.6905006", "0.6834757", "0.67052895", "0.6688532", "0.66650486", "0.66525644", "0.6650676", "0.66471237", "0.6636821", "0.66244614", "0.6586594", "0.6574154", "0.6523172", "0.64859945", "0.64738023", "0.64588...
0.69746816
2
Interpolates between two vectors that are nonzero and don't both lie on a line going through origin. First normalizes v2 to have the same norm as v1. Then interpolates between the two vectors on the hypersphere.
def interpolate_hypersphere(v1, v2, num_steps): v1_norm = tf.norm(v1) v2_norm = tf.norm(v2) v2_normalized = v2 * (v1_norm / v2_norm) vectors = [] for step in range(num_steps): interpolated = v1 + (v2_normalized - v1) * step / (num_steps - 1) interpolated_norm = tf.norm(interpolated) interpolated_normalized = interpolated * (v1_norm / interpolated_norm) vectors.append(interpolated_normalized) return tf.stack(vectors)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersectionOfTwoLines(p1, v1, p2, v2):\n # if we transform multiple points in one go\n if len(v1.shape) == 2:\n a1 = np.einsum('ij,ij->i', v1, v1)\n a2 = np.einsum('ij,ij->i', v1, v2)\n b1 = -np.einsum('ij,ij->i', v2, v1)\n b2 = -np.einsum('ij,ij->i', v2, v2)\n c1 = -n...
[ "0.6572107", "0.6260578", "0.60963017", "0.60499376", "0.59216046", "0.588906", "0.584281", "0.58285564", "0.5783416", "0.5775993", "0.57329005", "0.5730922", "0.5719066", "0.57099354", "0.56855845", "0.56546366", "0.565153", "0.56246614", "0.5574889", "0.5566318", "0.5547199...
0.6959037
0
Simple way to display an image.
def display_image(image): image = tf.constant(image) image = tf.image.convert_image_dtype(image, tf.uint8) return PIL.Image.fromarray(image.numpy())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_image(file_location):\n img = Image.open(file_location)\n img.show()", "def display(self):\n display(self.image)", "def display(self, image):\n raise NotImplementedError()", "def showimage(image):\n mplt.figure()\n mplt.imshow(image)\n mplt.show()", "def showImage(self...
[ "0.8048858", "0.8006258", "0.77966094", "0.77039", "0.7659002", "0.7594677", "0.7467195", "0.738566", "0.73560387", "0.7331477", "0.7289763", "0.72389597", "0.71857244", "0.71550286", "0.71386063", "0.71089727", "0.7097741", "0.70939577", "0.7092677", "0.70303416", "0.7018979...
0.68926775
29
Given a set of images, show an animation.
def animate(images): images = np.array(images) converted_images = np.clip(images * 255, 0, 255).astype(np.uint8) imageio.mimsave('./animation.gif', converted_images) return embed.embed_file('./animation.gif')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_images(images):\n for name, img in images:\n cv2.imshow(name, img)\n\n cv2.waitKey(0)", "def display_images(filenames):\n for filename in filenames:\n display(Image(filename))", "def display_frames_as_gif(frames):\n fig=e.cube.show_layout(frames[0]) \n print(\"Drawn\")\n ...
[ "0.6905455", "0.6872684", "0.68629754", "0.6797282", "0.66781235", "0.6561315", "0.6522247", "0.6522247", "0.6522247", "0.6437156", "0.6422651", "0.6395544", "0.6391225", "0.63497686", "0.63120157", "0.62429947", "0.62429947", "0.62429947", "0.62429947", "0.62429947", "0.6242...
0.76514333
0
funkce vyhodnoti stav herniho pole
def vyhodnot(pole): if "xxx" in pole: return("x") elif "ooo" in pole: return("o") elif "-" not in pole: return("!") else: return("-")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pohyb(seznam_tahu, seznam_ovoce, tah,radky, sloupce):\n\n x= seznam_tahu [len(seznam_tahu)-1][0] # [x,y] souradnice noveho tahu\n y= seznam_tahu [len(seznam_tahu)-1][1]\n\n if tah == \"s\": #sever\n y -= 1\n elif tah == \"j\": ...
[ "0.67957395", "0.6756377", "0.66102165", "0.66102165", "0.66102165", "0.66102165", "0.66102165", "0.65488034", "0.65488034", "0.65488034", "0.65488034", "0.65488034", "0.65488034", "0.64633155", "0.64178115", "0.6141689", "0.5936104", "0.59326565", "0.5909775", "0.58873224", ...
0.0
-1
Validates that the provided parameters are compatible with the appropriate authentication method.
def validate_params(aws_default_region, aws_role_arn, aws_role_session_name, aws_access_key_id, aws_secret_access_key): if not aws_default_region: raise DemistoException('You must specify AWS default region.') if bool(aws_access_key_id) != bool(aws_secret_access_key): raise DemistoException('You must provide Access Key id and Secret key id to configure the instance with ' 'credentials.') if bool(aws_role_arn) != bool(aws_role_session_name): raise DemistoException('Role session name is required when using role ARN.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authentication_validation(username, password, access_token):\n if bool(username) is not bool(password):\n raise Exception(\"Basic authentication requires a username AND\" \" password.\")\n if (username and access_token) or (password and access_token):\n raise Exception(\n \"Canno...
[ "0.643579", "0.64004403", "0.6304516", "0.62984145", "0.60860974", "0.60807675", "0.60113746", "0.59970665", "0.5887357", "0.5852719", "0.58483523", "0.58416337", "0.5830815", "0.5830815", "0.578916", "0.5777185", "0.5774363", "0.5750672", "0.5682198", "0.5681004", "0.5663475...
0.0
-1
Extract the session token from the secret_key field.
def extract_session_from_secret(secret_key, session_token): if secret_key and '@@@' in secret_key and not session_token: return secret_key.split('@@@')[0], secret_key.split('@@@')[1] else: return secret_key, session_token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_token(self):\n token = self._session.token\n return token", "def _shib_get_token(self): # pragma: no cover\n\n shibCookie = None\n for cookie in self._session.cookies:\n if \"shibsession\" in cookie.name:\n shibCookie = cookie\n break\...
[ "0.6786535", "0.6588912", "0.6564999", "0.6549351", "0.65473354", "0.6426423", "0.64007133", "0.6390965", "0.6321878", "0.63127387", "0.6308861", "0.63074374", "0.62886924", "0.62571794", "0.6218154", "0.6218154", "0.61798644", "0.61466336", "0.61005646", "0.6099376", "0.6099...
0.7777419
0
Parse command line arguments
def parse_args(): parser = argparse.ArgumentParser( description='Farm') parser.add_argument( '-s', '--source', help='Harvest source (AMQP host such as amqp://guest:guest@localhost:5672)', required=True) parser.add_argument( '-q', '--queue', help='Queue name to harvest from', required=True) parser.add_argument( '-a', '--add', help='Harvester instance (file)', required=True, type=argparse.FileType('rb')) return vars(parser.parse_args())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args():\n parser = argparse.ArgumentParser(\n description=\"Reads datapacket pcds, interpolates quaternions and generates scans from dataset in config file\")\n parser.add_argument(\"--visualization\", \"-v\", action=\"store_true\", help=\"if generated clouds ...
[ "0.84956664", "0.77526116", "0.7492404", "0.74425805", "0.74166906", "0.7415034", "0.7406717", "0.7405937", "0.7394592", "0.739314", "0.7353777", "0.73531276", "0.73295814", "0.7326098", "0.73121136", "0.7297962", "0.72947985", "0.7294619", "0.7293887", "0.7288054", "0.727713...
0.0
-1
Testing to do a scrap of consumed material.
def test_manufacturing_scrap(self): # Update demo products (self.product_4 | self.product_2).write({ 'tracking': 'lot', }) # Update Bill Of Material to remove product with phantom bom. self.bom_3.bom_line_ids.filtered(lambda x: x.product_id == self.product_5).unlink() # Create Inventory Adjustment For Stick and Stone Tools with lot. lot_product_4 = self.env['stock.production.lot'].create({ 'name': '0000000000001', 'product_id': self.product_4.id, 'company_id': self.env.company.id, }) lot_product_2 = self.env['stock.production.lot'].create({ 'name': '0000000000002', 'product_id': self.product_2.id, 'company_id': self.env.company.id, }) stock_inv_product_4 = self.env['stock.inventory'].create({ 'name': 'Stock Inventory for Stick', 'product_ids': [(4, self.product_4.id)], 'line_ids': [ (0, 0, {'product_id': self.product_4.id, 'product_uom_id': self.product_4.uom_id.id, 'product_qty': 8, 'prod_lot_id': lot_product_4.id, 'location_id': self.stock_location_14.id}), ]}) stock_inv_product_2 = self.env['stock.inventory'].create({ 'name': 'Stock Inventory for Stone Tools', 'product_ids': [(4, self.product_2.id)], 'line_ids': [ (0, 0, {'product_id': self.product_2.id, 'product_uom_id': self.product_2.uom_id.id, 'product_qty': 12, 'prod_lot_id': lot_product_2.id, 'location_id': self.stock_location_14.id}) ]}) (stock_inv_product_4 | stock_inv_product_2)._action_start() stock_inv_product_2.action_validate() stock_inv_product_4.action_validate() #Create Manufacturing order. production_form = Form(self.env['mrp.production']) production_form.product_id = self.product_6 production_form.bom_id = self.bom_3 production_form.product_qty = 12 production_form.product_uom_id = self.product_6.uom_id production_3 = production_form.save() production_3.action_confirm() production_3.action_assign() # Check Manufacturing order's availability. self.assertEqual(production_3.reservation_state, 'assigned', "Production order's availability should be Available.") location_id = production_3.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel')) and production_3.location_src_id.id or production_3.location_dest_id.id, # Scrap Product Wood without lot to check assert raise ?. scrap_id = self.env['stock.scrap'].with_context(active_model='mrp.production', active_id=production_3.id).create({'product_id': self.product_2.id, 'scrap_qty': 1.0, 'product_uom_id': self.product_2.uom_id.id, 'location_id': location_id, 'production_id': production_3.id}) with self.assertRaises(UserError): scrap_id.do_scrap() # Scrap Product Wood with lot. self.env['stock.scrap'].with_context(active_model='mrp.production', active_id=production_3.id).create({'product_id': self.product_2.id, 'scrap_qty': 1.0, 'product_uom_id': self.product_2.uom_id.id, 'location_id': location_id, 'lot_id': lot_product_2.id, 'production_id': production_3.id}) #Check scrap move is created for this production order. #TODO: should check with scrap objects link in between
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_extract_recipe_from_website(self):\n pass", "def _scrape(self):", "def test_JCB_VISUAL_MATERIALS( self ):\n driver = self.driver\n driver.get(self.base_url + \"/record=b5660654~S6\")\n driver.find_element_by_link_text(\"Request\").click()\n self.assertTrue( 'aeon' in...
[ "0.64861304", "0.60452384", "0.60298216", "0.6010472", "0.6002515", "0.6002515", "0.5930737", "0.59229994", "0.5865279", "0.5826006", "0.5802774", "0.5802774", "0.56953853", "0.568463", "0.56727046", "0.56668943", "0.56484073", "0.56198096", "0.56014913", "0.5600095", "0.5565...
0.68666345
0
This test checks a tracked manufactured product will go to location defined in putaway strategy when the production is recorded with product.produce wizard.
def test_putaway_after_manufacturing_3(self): self.laptop.tracking = 'serial' mo_laptop = self.new_mo_laptop() serial = self.env['stock.production.lot'].create({'product_id': self.laptop.id, 'company_id': self.env.company.id}) mo_form = Form(mo_laptop) mo_form.qty_producing = 1 mo_form.lot_producing_id = serial mo_laptop = mo_form.save() mo_laptop.button_mark_done() # We check if the laptop go in the depot and not in the stock move = mo_laptop.move_finished_ids location_dest = move.move_line_ids.location_dest_id self.assertEqual(location_dest.id, self.depot_location.id) self.assertNotEqual(location_dest.id, self.stock_location.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_generate_with_putaway(self):\n nbre_of_lines = 4\n shelf_location = self.env['stock.location'].create({\n 'name': 'shelf1',\n 'usage': 'internal',\n 'location_id': self.location_dest.id,\n })\n\n # Checks a first time without putaway...\n ...
[ "0.68906146", "0.6246047", "0.6090114", "0.6084227", "0.6050358", "0.6022465", "0.5951435", "0.592476", "0.59018815", "0.5867885", "0.58634603", "0.58565384", "0.58413273", "0.58121234", "0.58035403", "0.5710238", "0.5670679", "0.5666164", "0.564475", "0.5602386", "0.5602123"...
0.7612206
0
Make sure a kit is split in the corrects quantity_done by components in case of an immediate transfer.
def test_kit_immediate_transfer(self): picking = self.env['stock.picking'].create({ 'location_id': self.test_supplier.id, 'location_dest_id': self.warehouse_1.wh_input_stock_loc_id.id, 'partner_id': self.test_partner.id, 'picking_type_id': self.env.ref('stock.picking_type_in').id, 'immediate_transfer': True }) move_receipt_1 = self.env['stock.move'].create({ 'name': self.kit_parent.name, 'product_id': self.kit_parent.id, 'quantity_done': 3, 'product_uom': self.kit_parent.uom_id.id, 'picking_id': picking.id, 'picking_type_id': self.env.ref('stock.picking_type_in').id, 'location_id': self.test_supplier.id, 'location_dest_id': self.warehouse_1.wh_input_stock_loc_id.id, }) picking.button_validate() # We check that the picking has the correct quantities after its move were splitted. self.assertEqual(len(picking.move_lines), 7) for move_line in picking.move_lines: self.assertEqual(move_line.quantity_done, self.expected_quantities[move_line.product_id])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_kit_planned_transfer(self):\n picking = self.env['stock.picking'].create({\n 'location_id': self.test_supplier.id,\n 'location_dest_id': self.warehouse_1.wh_input_stock_loc_id.id,\n 'partner_id': self.test_partner.id,\n 'picking_type_id': self.env.ref('st...
[ "0.61881334", "0.60192597", "0.57607996", "0.556063", "0.55559486", "0.553951", "0.5507649", "0.5501214", "0.53878224", "0.5373135", "0.5346838", "0.53159076", "0.53042346", "0.530181", "0.5292941", "0.5262657", "0.5252141", "0.5244603", "0.52374023", "0.5235112", "0.52324265...
0.6650053
0
Make sure a kit is split in the corrects product_qty by components in case of a planned transfer.
def test_kit_planned_transfer(self): picking = self.env['stock.picking'].create({ 'location_id': self.test_supplier.id, 'location_dest_id': self.warehouse_1.wh_input_stock_loc_id.id, 'partner_id': self.test_partner.id, 'picking_type_id': self.env.ref('stock.picking_type_in').id, 'immediate_transfer': False, }) move_receipt_1 = self.env['stock.move'].create({ 'name': self.kit_parent.name, 'product_id': self.kit_parent.id, 'product_uom_qty': 3, 'product_uom': self.kit_parent.uom_id.id, 'picking_id': picking.id, 'picking_type_id': self.env.ref('stock.picking_type_in').id, 'location_id': self.test_supplier.id, 'location_dest_id': self.warehouse_1.wh_input_stock_loc_id.id, }) picking.action_confirm() # We check that the picking has the correct quantities after its move were splitted. self.assertEqual(len(picking.move_lines), 7) for move_line in picking.move_lines: self.assertEqual(move_line.product_qty, self.expected_quantities[move_line.product_id])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_overprocessed_subcontract_qty(self):\n overprocessed_moves = self.env['stock.move']\n for move in self:\n if not move.is_subcontract:\n continue\n # Extra quantity is allowed when components do not need to be register\n if not move._has_track...
[ "0.62997496", "0.6127928", "0.6034478", "0.6018836", "0.59107655", "0.5806491", "0.5761691", "0.5730393", "0.5726534", "0.57250893", "0.5659513", "0.56430745", "0.56031597", "0.5599683", "0.55872136", "0.5580281", "0.55272794", "0.55234873", "0.55033195", "0.54832494", "0.546...
0.6308212
0
Parse all the arguments provided from the CLI.
def get_arguments(): parser = argparse.ArgumentParser(description="DeepLab-ResNet Network") parser.add_argument("--model", type=str, default=MODEL, help="Model Choice (DeeplabMulti/DeeplabVGG/Oracle).") parser.add_argument("--data-dir", type=str, default=DATA_DIRECTORY, help="Path to the directory containing the Cityscapes dataset.") parser.add_argument("--data-list", type=str, default=DATA_LIST_PATH, help="Path to the file listing the images in the dataset.") parser.add_argument("--ignore-label", type=int, default=IGNORE_LABEL, help="The index of the label to ignore during the training.") parser.add_argument("--num-classes", type=int, default=NUM_CLASSES, help="Number of classes to predict (including background).") parser.add_argument("--restore-from", type=str, default=RESTORE_FROM, help="Where restore model parameters from.") parser.add_argument("--gpu", type=int, default=0, help="choose gpu device.") parser.add_argument("--batchsize", type=int, default=4, help="choose gpu device.") parser.add_argument("--set", type=str, default=SET, help="choose evaluation set.") parser.add_argument("--save", type=str, default=SAVE_PATH, help="Path to save result.") parser.add_argument("--input-size", type=str, default=INPUT_SIZE, help="Comma-separated string with height and width of source images.") return parser.parse_args()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_arguments(args):", "def parse_args(self, argv=None):\n self.opts, self.args = self.cli_parser.parse_args(argv)\n self.check_arguments()\n self._post_process_opts_and_args()\n return self.opts, self.args", "def _parse_args(self):\n parser = argparse.ArgumentParser()\...
[ "0.8019148", "0.78268564", "0.7824553", "0.78125226", "0.7683437", "0.7675735", "0.7640287", "0.7633257", "0.76331824", "0.7623657", "0.7609315", "0.7600032", "0.7587876", "0.7581038", "0.75800914", "0.75694513", "0.7566255", "0.75164413", "0.7513215", "0.7509136", "0.750603"...
0.0
-1
Create the model and start the evaluation process.
def main(): args = get_arguments() w, h = map(int, args.input_size.split(',')) config_path = os.path.join(os.path.dirname(args.restore_from),'opts.yaml') with open(config_path, 'r') as stream: config = yaml.load(stream) args.model = config['model'] print('ModelType:%s'%args.model) print('NormType:%s'%config['norm_style']) gpu0 = args.gpu batchsize = args.batchsize model_name = os.path.basename( os.path.dirname(args.restore_from) ) #args.save += model_name if not os.path.exists(args.save): os.makedirs(args.save) confidence_path = os.path.join(args.save, 'submit/confidence') label_path = os.path.join(args.save, 'submit/labelTrainIds') label_invalid_path = os.path.join(args.save, 'submit/labelTrainIds_invalid') for path in [confidence_path, label_path, label_invalid_path]: if not os.path.exists(path): os.makedirs(path) if args.model == 'DeepLab': model = DeeplabMulti(num_classes=args.num_classes, use_se = config['use_se'], train_bn = False, norm_style = config['norm_style']) elif args.model == 'Oracle': model = Res_Deeplab(num_classes=args.num_classes) if args.restore_from == RESTORE_FROM: args.restore_from = RESTORE_FROM_ORC elif args.model == 'DeeplabVGG': model = DeeplabVGG(num_classes=args.num_classes) if args.restore_from == RESTORE_FROM: args.restore_from = RESTORE_FROM_VGG if args.restore_from[:4] == 'http' : saved_state_dict = model_zoo.load_url(args.restore_from) else: saved_state_dict = torch.load(args.restore_from) try: model.load_state_dict(saved_state_dict) except: model = torch.nn.DataParallel(model) model.load_state_dict(saved_state_dict) model.eval() model.cuda(gpu0) testloader = data.DataLoader(DarkZurichDataSet(args.data_dir, args.data_list, crop_size=(h, w), resize_size=(w, h), mean=IMG_MEAN, scale=False, mirror=False, set=args.set), batch_size=batchsize, shuffle=False, pin_memory=True, num_workers=4) scale = 1.25 testloader2 = data.DataLoader(DarkZurichDataSet(args.data_dir, args.data_list, crop_size=(round(h*scale), round(w*scale) ), resize_size=( round(w*scale), round(h*scale)), mean=IMG_MEAN, scale=False, mirror=False, set=args.set), batch_size=batchsize, shuffle=False, pin_memory=True, num_workers=4) if version.parse(torch.__version__) >= version.parse('0.4.0'): interp = nn.Upsample(size=(1080, 1920), mode='bilinear', align_corners=True) else: interp = nn.Upsample(size=(1080, 1920), mode='bilinear') sm = torch.nn.Softmax(dim = 1) log_sm = torch.nn.LogSoftmax(dim = 1) kl_distance = nn.KLDivLoss( reduction = 'none') prior = np.load('./utils/prior_all.npy').transpose((2,0,1))[np.newaxis, :, :, :] prior = torch.from_numpy(prior) for index, img_data in enumerate(zip(testloader, testloader2) ): batch, batch2 = img_data image, _, name = batch image2, _, name2 = batch2 inputs = image.cuda() inputs2 = image2.cuda() print('\r>>>>Extracting feature...%04d/%04d'%(index*batchsize, args.batchsize*len(testloader)), end='') if args.model == 'DeepLab': with torch.no_grad(): output1, output2 = model(inputs) output_batch = interp(sm(0.5* output1 + output2)) heatmap_batch = torch.sum(kl_distance(log_sm(output1), sm(output2)), dim=1) output1, output2 = model(fliplr(inputs)) output1, output2 = fliplr(output1), fliplr(output2) output_batch += interp(sm(0.5 * output1 + output2)) del output1, output2, inputs output1, output2 = model(inputs2) output_batch += interp(sm(0.5* output1 + output2)) output1, output2 = model(fliplr(inputs2)) output1, output2 = fliplr(output1), fliplr(output2) output_batch += interp(sm(0.5 * output1 + output2)) del output1, output2, inputs2 ratio = 0.95 output_batch = output_batch.cpu() / 4 # output_batch = output_batch *(ratio + (1 - ratio) * prior) output_batch = output_batch.data.numpy() heatmap_batch = heatmap_batch.cpu().data.numpy() elif args.model == 'DeeplabVGG' or args.model == 'Oracle': output_batch = model(Variable(image).cuda()) output_batch = interp(output_batch).cpu().data.numpy() output_batch = output_batch.transpose(0,2,3,1) score_batch = np.max(output_batch, axis=3) output_batch = np.asarray(np.argmax(output_batch, axis=3), dtype=np.uint8) threshold = 0.3274 for i in range(output_batch.shape[0]): output_single = output_batch[i,:,:] output_col = colorize_mask(output_single) output = Image.fromarray(output_single) name_tmp = name[i].split('/')[-1] dir_name = name[i].split('/')[-2] save_path = args.save + '/' + dir_name if not os.path.isdir(save_path): os.mkdir(save_path) output.save('%s/%s' % (save_path, name_tmp)) print('%s/%s' % (save_path, name_tmp)) output_col.save('%s/%s_color.png' % (save_path, name_tmp.split('.')[0])) # heatmap_tmp = heatmap_batch[i,:,:]/np.max(heatmap_batch[i,:,:]) # fig = plt.figure() # plt.axis('off') # heatmap = plt.imshow(heatmap_tmp, cmap='viridis') # fig.colorbar(heatmap) # fig.savefig('%s/%s_heatmap.png' % (save_path, name_tmp.split('.')[0])) if args.set == 'test' or args.set == 'val': # label output.save('%s/%s' % (label_path, name_tmp)) # label invalid output_single[score_batch[i, :, :] < threshold] = 255 output = Image.fromarray(output_single) output.save('%s/%s' % (label_invalid_path, name_tmp)) # conficence confidence = score_batch[i, :, :] * 65535 confidence = np.asarray(confidence, dtype=np.uint16) print(confidence.min(), confidence.max()) iio.imwrite('%s/%s' % (confidence_path, name_tmp), confidence) return args.save
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def train_and_eval(self):\n self.__create_indexes()\n model = None\n model = None\n if self.model == 'OMult':\n model = OMult(self.kwargs)\n elif self.model == 'ConvO':\n ...
[ "0.7154538", "0.7110913", "0.70891786", "0.70385206", "0.6866587", "0.68355024", "0.68056273", "0.6790459", "0.6780459", "0.6717746", "0.6706127", "0.6687629", "0.66817534", "0.6587053", "0.6575464", "0.6549759", "0.6510648", "0.64960116", "0.6456182", "0.6450196", "0.6441333...
0.0
-1
creates the object and overides the _class attribute setting it to the class name
def __init__(self,name:str,int,str,dex): super(Warrior, self).__init__(name,int,str,dex) self._class = 'Warrior'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_class(self):\n temp_class = self.temp('separated.class')\n return temp_class.format(**self.__dict__)", "def _class(self, _class):\n\n self.__class = _class", "def _class(self, _class):\n\n self.__class = _class", "def create_instance(self,name):\n print \"INFO : new...
[ "0.74641377", "0.70764786", "0.70764786", "0.69768584", "0.69163984", "0.69163984", "0.6843871", "0.6843871", "0.6836091", "0.67553884", "0.6748268", "0.67406183", "0.6720988", "0.66912264", "0.6678298", "0.66541386", "0.65925103", "0.6580715", "0.65422446", "0.6518123", "0.6...
0.0
-1
the basic attack which scales with lvl and the classes primary attribute(Strength)
def _attack(self,target): damage = self.get_strength() * self.get_lvl() target.receive_damage(damage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_hp_for_higher_level(chosen_class,level):\n #Checks to see if your character is level 4,8,12,etc.\n def upgradedAbilityAt4(level):\n if level % 4 == 0:\n upgraded_ability = raw_input(\"Level \"+str(level)+\"!\\n Which two abilities would you like t...
[ "0.6896016", "0.6808988", "0.67308813", "0.6669321", "0.6659467", "0.64936537", "0.6413358", "0.64063555", "0.6402597", "0.6393012", "0.6375738", "0.6367276", "0.63427234", "0.63154703", "0.63153607", "0.6273395", "0.6247666", "0.6247239", "0.62429374", "0.6231652", "0.621598...
0.65988123
5
ability that deals damage to the target
def ability_1(self,target): damage = (self.get_strength()+2) target.receive_damage(damage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ability_3(self,target):\r\n damage = (self.get_dexterity()+self.get_strength())\r\n target.receive_damage(damage)", "def ability_4(self,target):\r\n damage = (self.get_strength()*3)\r\n target.receive_damage(damage)", "def ability_2(self,target):\r\n damage1 = (self.get_l...
[ "0.7999557", "0.7960427", "0.79067296", "0.7736732", "0.7559663", "0.75042886", "0.73485667", "0.69856614", "0.6954562", "0.68673724", "0.6778077", "0.67357415", "0.66850173", "0.6644636", "0.6638605", "0.662029", "0.6539297", "0.65386426", "0.65321666", "0.65184796", "0.6500...
0.81057763
0
ability that deals damage to the target
def ability_2(self,target): damage1 = (self.get_lvl()+self.get_strength()) target.receive_damage(damage1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ability_1(self,target):\r\n damage = (self.get_strength()+2)\r\n target.receive_damage(damage)", "def ability_3(self,target):\r\n damage = (self.get_dexterity()+self.get_strength())\r\n target.receive_damage(damage)", "def ability_4(self,target):\r\n damage = (self.get_st...
[ "0.81057763", "0.7999557", "0.7960427", "0.7736732", "0.7559663", "0.75042886", "0.73485667", "0.69856614", "0.6954562", "0.68673724", "0.6778077", "0.67357415", "0.66850173", "0.6644636", "0.6638605", "0.662029", "0.6539297", "0.65386426", "0.65321666", "0.65184796", "0.6500...
0.79067296
3
ability that deals damage to the target
def ability_3(self,target): damage = (self.get_dexterity()+self.get_strength()) target.receive_damage(damage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ability_1(self,target):\r\n damage = (self.get_strength()+2)\r\n target.receive_damage(damage)", "def ability_4(self,target):\r\n damage = (self.get_strength()*3)\r\n target.receive_damage(damage)", "def ability_2(self,target):\r\n damage1 = (self.get_lvl()+self.get_stren...
[ "0.81057763", "0.7960427", "0.79067296", "0.7736732", "0.7559663", "0.75042886", "0.73485667", "0.69856614", "0.6954562", "0.68673724", "0.6778077", "0.67357415", "0.66850173", "0.6644636", "0.6638605", "0.662029", "0.6539297", "0.65386426", "0.65321666", "0.65184796", "0.650...
0.7999557
1
ability that deals damage to the target
def ability_4(self,target): damage = (self.get_strength()*3) target.receive_damage(damage)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ability_1(self,target):\r\n damage = (self.get_strength()+2)\r\n target.receive_damage(damage)", "def ability_3(self,target):\r\n damage = (self.get_dexterity()+self.get_strength())\r\n target.receive_damage(damage)", "def ability_2(self,target):\r\n damage1 = (self.get_l...
[ "0.81057763", "0.7999557", "0.79067296", "0.7736732", "0.7559663", "0.75042886", "0.73485667", "0.69856614", "0.6954562", "0.68673724", "0.6778077", "0.67357415", "0.66850173", "0.6644636", "0.6638605", "0.662029", "0.6539297", "0.65386426", "0.65321666", "0.65184796", "0.650...
0.7960427
2
Returns distance matrix for the texts
def tfIdf(texts): vect = TfidfVectorizer(min_df=1) tfidf = vect.fit_transform([tt.lower() for tt in texts]) aa=(tfidf * tfidf.T).A return aa
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __build_distance_matrix(self):\n for i in range(0, len(self.__corpus)):\n doc_i = self.__corpus[i]\n for j in range(i + 1, len(self.__corpus)):\n doc_j = self.__corpus[j]\n distance = doc_i.calc_distance(doc_j)\n self.__distance_matrix.a...
[ "0.7323501", "0.66943216", "0.66371775", "0.6623149", "0.64143485", "0.6409224", "0.64084244", "0.6405972", "0.6359847", "0.6322712", "0.6210911", "0.61276406", "0.60897166", "0.6088725", "0.6085393", "0.60802317", "0.6077521", "0.60503525", "0.60271037", "0.6016799", "0.5983...
0.0
-1
Return the path of the ocamlmerlin binary."
def merlin_bin(): user_settings = sublime.load_settings("Merlin.sublime-settings") merlin_path = user_settings.get('ocamlmerlin_path') if merlin_path: return merlin_path # For Mac OS X, add the path for homebrew if "/usr/local/bin" not in os.environ['PATH'].split(os.pathsep): os.environ['PATH'] += os.pathsep + "/usr/local/bin" opam_process = subprocess.Popen('opam config var bin', stdout=subprocess.PIPE, shell=True) opam_bin_path = opam_process.stdout.read().decode('utf-8').rstrip() + '/ocamlmerlin' if os.path.isfile(opam_bin_path) and os.access(opam_bin_path, os.X_OK): return opam_bin_path else: return 'ocamlmerlin'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bin_dir():\n return os.path.abspath(os.path.join(get_root_dir(), 'bin/'))", "def dir_bin():\n return abspath('bin')", "def binary_location(cmd, USE_PATH=False):\n return os.path.join(BIN_PREFIX, cmd)", "def get_golem_path():\r\n return os.path.abspath(os.path.join(os.path.dirname(__file__...
[ "0.682036", "0.6652295", "0.65895194", "0.6584268", "0.6460019", "0.64083457", "0.63974833", "0.6339136", "0.6329058", "0.63127565", "0.6281566", "0.6236012", "0.6232723", "0.62326777", "0.6230347", "0.61885166", "0.6138241", "0.61246544", "0.6089618", "0.6089618", "0.6089160...
0.7753057
0
Check if the current view is an OCaml source code.
def is_ocaml(view): ocaml = 'source.ocaml' mlfi = 'source.mlfi' location = view.sel()[0].begin() return view.match_selector(location, ocaml) or view.match_selector(location, mlfi)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_non_js_source(self):\n self.view.set_syntax_file(\"Packages/Python/Python.tmLanguage\")\n\n actual = is_js_source(self.view)\n\n self.assertFalse(actual)", "def test_js_source(self):\n actual = is_js_source(self.view)\n\n self.assertTrue(actual)", "def is_authoring_s...
[ "0.67141247", "0.61287296", "0.59936684", "0.59469485", "0.59078604", "0.5851658", "0.5787282", "0.5709476", "0.5676872", "0.5662873", "0.56603956", "0.55736876", "0.5511895", "0.5484196", "0.5424797", "0.54031396", "0.53450185", "0.53424245", "0.52996314", "0.5279858", "0.52...
0.69519085
0
Execute the given function if we are in an OCaml source code only.
def only_ocaml(func): @functools.wraps(func) def wrapper(self, view, *args, **kwargs): if is_ocaml(view): return func(self, view, *args, **kwargs) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_code():\n pass", "def in_function_code(self):\n return self.lscope is not None and self.sscope is None", "def runsource(self, source, filename=\"<input>\", symbol=\"single\"):\n try:\n code = self.compile(source, filename, symbol)\n except (OverflowError, SyntaxError...
[ "0.61175025", "0.59589654", "0.5907236", "0.57341886", "0.57255304", "0.5646994", "0.5632915", "0.55879843", "0.55784357", "0.5551663", "0.55419976", "0.5538157", "0.5525979", "0.54997593", "0.54997593", "0.54997593", "0.54997593", "0.54997593", "0.54997593", "0.54997593", "0...
0.6008382
1
Convert a position returned by Merlin to a Sublime text point. Sublime uses character positions and starts each file at line 0.
def merlin_pos(view, pos): return view.text_point(pos['line'] - 1, pos['col'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_position(tu, file, line, column):\r\n return conf.lib.clang_getLocation(tu, file, line, column)", "def point2pos(self, point):\n row = self._vim.eval('byte2line({})'.format(point))\n col = self._vim.eval('{} - line2byte({})'.format(point, row))\n return (int(row), int(col))",...
[ "0.59632206", "0.5889241", "0.56616706", "0.56562984", "0.54250014", "0.5352155", "0.524134", "0.52322143", "0.5227591", "0.52061164", "0.5179411", "0.5161949", "0.51547635", "0.507839", "0.5063059", "0.5035226", "0.5024355", "0.50153136", "0.5005417", "0.50020736", "0.499957...
0.6376156
0
Replace sequence of whitespaces by a single space
def clean_whitespace(text): return text #return re.sub(r'\r\n|\n', "\t", text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeMultipleSpaces(self) -> None:\n self.text = re.sub('\\s+', ' ', self.text)", "def normalize_whitespace(text):\n return NORMALIZE_WHITESPACE_REGEX.sub(' ', text)", "def replace_whitespace(s, rep=' '):\n s = re.sub(r'\\s+', rep, s)\n return s", "def normalize_space (text):\n return...
[ "0.7690094", "0.7357652", "0.73225224", "0.72260857", "0.7153848", "0.7132321", "0.70644516", "0.7048768", "0.70468843", "0.7003004", "0.6987875", "0.69768345", "0.6918292", "0.6918292", "0.68797535", "0.6837561", "0.6772368", "0.676568", "0.676431", "0.6750295", "0.67097074"...
0.62447345
44
.first_name will return the correct first name
def test_first_name(self): john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a") self.assertEqual(john_starks.first_name, "John")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_name(self) -> str:\n return self.first_name", "def first_name(self, instance):\r\n return instance.user.first_name", "def get_first_name(self):\n return self._first_name", "def firstname(self):\n return self._firstname", "def firstname(self):\n return self._...
[ "0.861615", "0.84696996", "0.8462464", "0.8350101", "0.8350101", "0.83253694", "0.83253694", "0.83253694", "0.83061045", "0.8267587", "0.8145835", "0.8013964", "0.7967768", "0.7967768", "0.7913839", "0.7835207", "0.77401644", "0.77401644", "0.77401644", "0.77401644", "0.77401...
0.0
-1
.last_name will return the correct last name
def test_last_name(self): john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a") self.assertEqual(john_starks.last_name, "Starks")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_last_name(self) -> str:\n return self.last_name", "def last_name(self, instance):\r\n return instance.user.last_name", "def get_last_name(self):\n return self._last_name", "def getLastname(self):\n return self.lastname", "def lastname(self):\n return self._lastnam...
[ "0.86927557", "0.86003095", "0.85996276", "0.8470737", "0.8462683", "0.84567153", "0.84567153", "0.84567153", "0.84567153", "0.84528154", "0.8397316", "0.8331911", "0.8289265", "0.8289265", "0.8289265", "0.8289265", "0.8289265", "0.8217353", "0.82091343", "0.82091343", "0.811...
0.0
-1
.sport will return the correct sport
def test_sport(self): john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a") self.assertEqual(john_starks.sport, "NBA")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sport_lookup(sport):\n sport = sport.title()\n app.sport = sport\n return sport", "def associate_sport(self, database):\n sport = Sport()\n if self.name.lower() in ['indoor_cycling', 'indoor cycling', 'virtual_ride', 'cycling', 'road_biking', 'outdoor_cycling', 'road cycling', 'cross c...
[ "0.7500355", "0.66461325", "0.63443124", "0.61862314", "0.61821485", "0.6069046", "0.5974852", "0.595481", "0.5868784", "0.583944", "0.58001155", "0.56890136", "0.56505454", "0.5541518", "0.5468677", "0.5466211", "0.54574645", "0.5456159", "0.5432092", "0.54250246", "0.542327...
0.58140707
10
.recommendation will return the correct recommendation choice
def test_recommendation(self): john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a") self.assertEqual(john_starks.recommendation, "a")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_recommendation(fav_product,model_knn=model_knn,\n data=csr_matrix(df_product_features.values),\n\n mapper=products_to_idx,\n n_recommendations=6):\n # fit\n model_knn.fit(data)\n # get input movie index\n #print('You have input product:', fav_product)\n idx = fuzzy_matching(mapper,...
[ "0.7014981", "0.6732272", "0.67240196", "0.67228717", "0.6716435", "0.66226876", "0.6558151", "0.6556826", "0.65179765", "0.6490736", "0.64453816", "0.64409184", "0.64403695", "0.6433087", "0.6419716", "0.64082474", "0.6397704", "0.6388307", "0.6380065", "0.63798374", "0.6301...
0.56750447
82
.get_recommendation_display() will return the correct value of the recommendation choice
def test_recommendation_value(self): john_starks = Athlete(first_name="John", last_name="Starks", sport="NBA", recommendation="a") self.assertEqual(john_starks.get_recommendation_display(), "Hire Joe IMMEDIATELY!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n if self.recommend:\n review = 'recommended by {}: {}'.format(self.reviewer, self.comments)\n else:\n review = 'not recommended by {}: {}'.format(self.reviewer, self.comments)\n\n return review", "def handle_recommendation(request):\n ticker = req...
[ "0.64533204", "0.62321275", "0.6155811", "0.6037975", "0.59529597", "0.58630055", "0.57988244", "0.5778563", "0.5745785", "0.5703222", "0.56989217", "0.56337386", "0.56248695", "0.557974", "0.55621016", "0.5547041", "0.55275047", "0.55242544", "0.5524008", "0.55168205", "0.55...
0.6441277
1
Note this initialization command will start spawning traffic and select the specified human demonstrators for imitation learning
def initialize_element(self): init_command = { "StartLearning": True, "AgentID": 1854 } msg = json.dumps(init_command).encode('unicode_escape') self.socket_control.send(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starting_tests(self):\n# disable menus during testing, because their message loop seems to interfere\n# with the natlink message loop which waits for recognitionMimic to\n# finish\n self.testing = 1", "def initMana():\n run(\"chariot-me -i\")", "def starting_tests(self):\n# disable menus during tes...
[ "0.63875884", "0.61016667", "0.60508204", "0.60147184", "0.5999624", "0.5965473", "0.59024185", "0.587887", "0.58662325", "0.5809647", "0.58030933", "0.5800339", "0.5754827", "0.574139", "0.5726314", "0.5693041", "0.56924486", "0.5661824", "0.5648796", "0.5642869", "0.5640304...
0.5699686
15
this reset should block until env is ready again after reset
def reset(self): while True: packet = self.socket_nanomsg.recv() payload = packet[self.header_length:] payload = payload.decode('unicode_escape') dictionary = json.loads(payload) restart = dictionary["Restart"] == "True" if not restart: break return self.observation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _soft_reset(self):\n self._reset_specific_envs(self.episodes_done)\n self._update_other_info()", "def _hard_reset(self):\n self._reset_specific_envs(np.ones_like(self.episodes_done))\n self._update_other_info()", "def soft_reset():", "def reset(self, env):\n self._env = env...
[ "0.7107423", "0.70898026", "0.69635344", "0.683081", "0.67939526", "0.676074", "0.6658018", "0.6602491", "0.6600713", "0.6585621", "0.65487516", "0.65477717", "0.6531425", "0.65132505", "0.6499355", "0.6410681", "0.6381121", "0.6369087", "0.6363661", "0.6357603", "0.6357603",...
0.0
-1
This method is called by pika if the connection to RabbitMQ can't be established.
def on_connection_open_error(self, _unused_connection, err): # LOGGER.error('Connection open failed: %s', err) self.reconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n\n if settings.DEBUG:\n parameters = pika.ConnectionParameters(self._host)\n else:\n credentials = pika.PlainCredentials(\n username=settings.RABBITMQ_USERNAME,\n password=settings.RABBITMQ_PASSWORD\n )\n pa...
[ "0.76508445", "0.73340255", "0.7146357", "0.70382", "0.69546276", "0.68715435", "0.6687028", "0.6670201", "0.6660305", "0.6649513", "0.6638036", "0.66325414", "0.6580405", "0.6532733", "0.6532733", "0.6532733", "0.6495587", "0.6482817", "0.6463216", "0.62942183", "0.6246966",...
0.0
-1
This method is invoked by pika when the connection to RabbitMQ is closed unexpectedly. Since it is unexpected, we will reconnect to RabbitMQ if it disconnects.
def on_connection_closed(self, _unused_connection, reason): self._channel_ctrl = None self._channel_task = None if self._closing: self._connection.ioloop.stop() else: # LOGGER.warning('Connection closed, reconnect necessary: %s', reason) self.reconnect()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_connection_close(self):\n print(\"connection was closed, reconnecting...\")\n self.connect()", "def on_channel_closed(self, *args, **kwargs):\n if not self._normal_close:\n self.log.warning(\n 'Channel closed. Reconnect after 5s. args: %s, kwargs: %s',\n ...
[ "0.72513586", "0.7179087", "0.7149396", "0.70594245", "0.6951189", "0.6929702", "0.69085944", "0.6851485", "0.6758257", "0.6698265", "0.65894914", "0.65487945", "0.654612", "0.652902", "0.65252477", "0.65175503", "0.65148693", "0.650336", "0.6501206", "0.64962", "0.64569867",...
0.6745841
9
Will be invoked if the connection can't be opened or is closed. Indicates that a reconnect is necessary then stops the ioloop.
def reconnect(self): self.should_reconnect = True self.stop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconnect(self):\n # This is the old connection IOLoop instance, stop its ioloop\n self._connection.ioloop.stop()\n\n if not self._closing:\n # Create a new connection\n self._connection = self.connect()\n\n # There is now a new connection, needs a new iolo...
[ "0.7249165", "0.72301304", "0.7075581", "0.6911849", "0.6774475", "0.67738265", "0.67159784", "0.67140543", "0.6647249", "0.66425675", "0.6637142", "0.66236544", "0.66109645", "0.66052055", "0.65366995", "0.65227723", "0.6449884", "0.6439589", "0.6395996", "0.63703144", "0.63...
0.69579345
3
Open a new channel with RabbitMQ by issuing the Channel.Open RPC command. When RabbitMQ responds that the channel is open, the on_channel_open callback will be invoked by pika.
def open_channel(self): # LOGGER.info('Creating a new channel') self._connection.channel(on_open_callback=self.on_channel_task_open) self._connection.channel(on_open_callback=self.on_channel_ctrl_open)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_channel(self):\n logger.info('Creating a new channel')\n self._connection.channel(on_open_callback=self.on_channel_open)", "def open_channel(self):\n self.logger.info('Creating a new channel')\n self._connection.channel(on_open_callback=self.on_channel_open)", "def open_cha...
[ "0.83644223", "0.8340947", "0.8301517", "0.7597217", "0.72027296", "0.716055", "0.7139532", "0.69952625", "0.6950215", "0.6906779", "0.68752795", "0.68152535", "0.6695374", "0.6694395", "0.6605529", "0.65631926", "0.6421272", "0.6414429", "0.6350669", "0.6262175", "0.62492967...
0.7994719
3
This method is invoked by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll declare the exchange to use.
def on_channel_task_open(self, channel): # LOGGER.info('Channel opened') self._channel_task = channel self._channel_task.add_on_close_callback(self.on_channel_closed) channel.queue_declare( queue=self.queue_task, durable=False, exclusive=False ) channel.basic_qos(prefetch_count=self._prefetch_count) self._init_ok_task = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_channel_opened(self, channel):\n self.logger.info('channel opened')\n self._channel = channel\n\n self.logger.info('adding channel close callback')\n self._channel.add_on_close_callback(self.on_channel_closed)\n\n self.setup_exchange()", "def setup_exchange(self, channel...
[ "0.7178235", "0.71312135", "0.6934091", "0.69002146", "0.68959934", "0.6857475", "0.6773806", "0.67432135", "0.67312485", "0.66281015", "0.6605424", "0.6559665", "0.6524245", "0.6497938", "0.6474605", "0.6457484", "0.6354469", "0.6314629", "0.62993664", "0.62993664", "0.62956...
0.6251805
23
This method is invoked by pika when the channel has been opened. The channel object is passed in so we can make use of it. Since the channel is now open, we'll declare the exchange to use.
def on_channel_ctrl_open(self, channel): # LOGGER.info('Channel opened') self._channel_ctrl = channel self._channel_ctrl.add_on_close_callback(self.on_channel_closed) self._channel_ctrl.basic_qos(prefetch_count=1) self.setup_exchange()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_channel_opened(self, channel):\n self.logger.info('channel opened')\n self._channel = channel\n\n self.logger.info('adding channel close callback')\n self._channel.add_on_close_callback(self.on_channel_closed)\n\n self.setup_exchange()", "def setup_exchange(self, channel...
[ "0.7178334", "0.7129195", "0.6935435", "0.69001067", "0.6897367", "0.68561393", "0.67737305", "0.6743625", "0.67313665", "0.66248375", "0.6605752", "0.65603787", "0.65214086", "0.6499043", "0.6474174", "0.6351309", "0.6315634", "0.62992626", "0.62992626", "0.62973344", "0.629...
0.6458262
15
Invoked by pika when RabbitMQ unexpectedly closes the channel. Channels are usually closed if you attempt to do something that violates the protocol, such as redeclare an exchange or queue with different parameters. In this case, we'll close the connection to shutdown the object.
def on_channel_closed(self, channel, reason): LOGGER.warning('Channel %i was closed: %s', channel, reason) self.close_connection()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.closed:\n return\n try:\n self.channel.close(self)\n self.dispose()\n except StopIteration:\n # If the underlying connection for the channel is closed explicitly\n # open will not able to find an appropriate chan...
[ "0.7605382", "0.75265586", "0.74880636", "0.7465269", "0.7393919", "0.73355293", "0.7277174", "0.7258842", "0.7201403", "0.717356", "0.71427494", "0.7117505", "0.71007377", "0.7098356", "0.7082408", "0.70288086", "0.70259273", "0.7009042", "0.69462323", "0.6893637", "0.689099...
0.7185234
9
Setup the exchange on RabbitMQ by invoking the Exchange.Declare RPC command. When it is complete, the on_exchange_declareok method will be invoked by pika.
def setup_exchange(self): LOGGER.info('Declaring exchange: %s', self.topic_ctrl) # Note: using functools.partial is not required, it is demonstrating # how arbitrary data can be passed to the callback when it is called self._channel_ctrl.exchange_declare( exchange=self.topic_ctrl, exchange_type='topic', callback=self.on_exchange_declareok)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_exchange(self):\n self.logger.info('declaring exchange %s', self.exchange)\n self._channel.exchange_declare(self.on_exchange_declareok, self.exchange, self.exchange_type)", "def setup_exchange(self, channel, exchange_name, exchange_type):\n logger.info('Declaring exchange : %s', ex...
[ "0.8383794", "0.7805345", "0.7447871", "0.7392415", "0.7378925", "0.71844965", "0.7098805", "0.7023513", "0.69623685", "0.6839282", "0.67839456", "0.66240335", "0.6450134", "0.63366437", "0.63130057", "0.63098747", "0.63098747", "0.63098747", "0.6276163", "0.61075", "0.609830...
0.75742984
2
Invoked by pika when RabbitMQ has finished the Exchange.Declare RPC command.
def on_exchange_declareok(self, _unused_frame): self._channel_ctrl.queue_declare( '', exclusive=True, auto_delete=True, callback=self.on_queue_declareok )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_exchange_declareok(self, unused_frame):\n self.logger.info('exchange declared')\n self.setup_queue()", "def on_exchange_declareok(self, unused_frame):\n LOGGER.debug('Exchange declared')\n\n for queue in self._handlers.keys():\n self._channel.queue_declare(self.on_qu...
[ "0.715761", "0.6964966", "0.64156866", "0.61320156", "0.6064579", "0.6064579", "0.6064579", "0.6040164", "0.60303724", "0.6024567", "0.6008154", "0.59611946", "0.5960115", "0.5942857", "0.59143645", "0.5890094", "0.58587295", "0.58443904", "0.5769042", "0.57334083", "0.569658...
0.7317034
0
This method sets up the consumer by first calling add_on_cancel_callback so that the object is notified if RabbitMQ cancels the consumer. It then issues the Basic.Consume RPC command which returns the consumer tag that is used to uniquely identify the consumer with RabbitMQ. We keep the value to use it when we want to cancel consuming. The on_message method is passed in as a callback pika will invoke when a message is fully received.
def start_consuming(self): # LOGGER.info('Issuing consumer related RPC commands') if self._init_ok_ctrl and self._init_ok_task: self._channel_ctrl.add_on_cancel_callback(self.on_consumer_ctrl_cancelled) self._channel_task.add_on_cancel_callback(self.on_consumer_task_cancelled) self._consumer_tag_task = self._channel_task.basic_consume( self.queue_task, auto_ack=False, on_message_callback=self.on_message ) self._consumer_tag_ctrl = self._channel_ctrl.basic_consume( self._topic_queue_name, auto_ack=False, on_message_callback=self.on_topic ) self.was_consuming = True self._consuming = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_consuming(self):\n self.logger.debug(\"Issuing consumer related RPC commands\")\n\n self._channel.basic_qos(prefetch_count=self._max_concurrent)\n self._channel.add_on_cancel_callback(self.on_consumer_cancelled)\n\n consume_kwargs = {\"queue\": self._queue_name}\n if PI...
[ "0.75168574", "0.7267859", "0.6537067", "0.65252763", "0.619652", "0.6182665", "0.61760205", "0.6132582", "0.5972022", "0.5946298", "0.5869681", "0.5863082", "0.5817889", "0.5807988", "0.57975596", "0.57532775", "0.5696924", "0.5669013", "0.5662497", "0.5657694", "0.5656697",...
0.71504706
2
Invoked by pika when RabbitMQ sends a Basic.Cancel for a consumer receiving messages.
def on_consumer_task_cancelled(self, method_frame): if self._channel_task: self._channel_task.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_consuming(self):\n if self._channel:\n logger.info('Sending a Basic.Cancel RPC command to RabbitMQ')\n self._channel.basic_cancel(self.on_cancelok, self._consumer_tag)", "def cancel(self):\n def on_cancelok(method_frame):\n \"\"\"Handle cancelok.\n ...
[ "0.7847234", "0.7810346", "0.7453713", "0.71928334", "0.6767319", "0.67397696", "0.67256796", "0.6550659", "0.6513717", "0.6420064", "0.64200187", "0.64027125", "0.6361164", "0.6187015", "0.6158234", "0.61437774", "0.61437774", "0.61342376", "0.6129699", "0.612585", "0.612585...
0.5853428
38
Invoked by pika when RabbitMQ sends a Basic.Cancel for a consumer receiving messages.
def on_consumer_ctrl_cancelled(self, method_frame): if self._channel_ctrl: self._channel_ctrl.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_consuming(self):\n if self._channel:\n logger.info('Sending a Basic.Cancel RPC command to RabbitMQ')\n self._channel.basic_cancel(self.on_cancelok, self._consumer_tag)", "def cancel(self):\n def on_cancelok(method_frame):\n \"\"\"Handle cancelok.\n ...
[ "0.78472316", "0.7810699", "0.7453731", "0.7191473", "0.67671907", "0.6740184", "0.6724212", "0.6550379", "0.6513269", "0.64203066", "0.6419901", "0.64034593", "0.6361006", "0.61860156", "0.61590147", "0.61434734", "0.61434734", "0.61338735", "0.61299396", "0.61258346", "0.61...
0.60483325
25
Tell RabbitMQ that you would like to stop consuming by sending the Basic.Cancel RPC command.
def stop_consuming(self): if self._channel_ctrl: self._channel_ctrl.basic_cancel(self._consumer_tag_ctrl) self._channel_ctrl.close() if self._channel_task: self._channel_task.basic_cancel(self._consumer_tag_task) self._channel_task.close() self._consuming = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_consuming(self):\n if self._channel:\n logger.info('Sending a Basic.Cancel RPC command to RabbitMQ')\n self._channel.basic_cancel(self.on_cancelok, self._consumer_tag)", "def _stop_consuming(self):\n if self._rx_channel and self._rx_channel.is_open:\n logge...
[ "0.8647437", "0.80648834", "0.7330365", "0.7032881", "0.68281984", "0.6754538", "0.66251165", "0.6620288", "0.6522648", "0.64616895", "0.64530724", "0.6451067", "0.6432226", "0.6420512", "0.6420512", "0.6420512", "0.6391846", "0.62892866", "0.6275562", "0.62321556", "0.621953...
0.6646173
6
Run the example consumer by connecting to RabbitMQ and then starting the IOLoop to block and allow the SelectConnection to operate.
def run(self): self._connection = self.connect() self._connection.ioloop.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n try:\n\n self._connection = self.connect()\n self._connection.ioloop.start()\n except (KeyboardInterrupt, SystemExit):\n self.stop()\n except Exception as e:\n logger.warn(\"Exception: %s\", str(e))\n logger.warn(\"Excepti...
[ "0.7256628", "0.63799363", "0.6376809", "0.63610184", "0.6338159", "0.6294446", "0.6242551", "0.61296886", "0.6092963", "0.60882604", "0.5983006", "0.5958778", "0.59122777", "0.58681065", "0.58539355", "0.5847966", "0.5842972", "0.58345944", "0.58326536", "0.58286023", "0.582...
0.61549914
8
Cleanly shutdown the connection to RabbitMQ by stopping the consumer with RabbitMQ. When RabbitMQ confirms the cancellation, on_cancelok will be invoked by pika, which will then closing the channel and connection. The IOLoop is started again because this method is invoked when CTRLC is pressed raising a KeyboardInterrupt exception. This exception stops the IOLoop which needs to be running for pika to communicate with RabbitMQ. All of the commands issued prior to starting the IOLoop will be buffered but not processed.
def stop(self): if not self._closing: self._closing = True if self._consuming: self.stop_consuming() self._connection.ioloop.start() else: self._connection.ioloop.stop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_consuming(self):\n if self._channel:\n logger.info('Sending a Basic.Cancel RPC command to RabbitMQ')\n self._channel.basic_cancel(self.on_cancelok, self._consumer_tag)", "def stop(self):\n logger.info(\"Stopping rabbit consumer for process: %s with consumer id %s\", t...
[ "0.7339839", "0.6967187", "0.6935288", "0.676239", "0.67605835", "0.66537136", "0.6602058", "0.65783286", "0.6539383", "0.6339902", "0.6324922", "0.62800676", "0.6018747", "0.59879136", "0.5950211", "0.59477204", "0.59354734", "0.5933404", "0.5920861", "0.59080935", "0.587486...
0.6696183
5
Initialize variables and operators 1. initialize serial port 2. initialize GPIO pins
def __init__(self, logger): # cwd = os.getcwd() # parent_dir = os.path.dirname(cwd) # self.logger = logger_variable(__name__, parent_dir + '/log_files/SensorData.log') # open serial port self.interrupt_pin = 19 self.serialOpen = Serial('/dev/ttyACM1', 115200) GPIO.setmode(GPIO.BCM) GPIO.setup(self.interrupt_pin, GPIO.OUT, initial=1) self.logger = logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n GPIO.setwarnings(False)\n GPIO.cleanup() # Reset the high and low levels of the GPIO port\n #The following code defines the GPIO used to control the L298N chip. This definition is different for different Raspberry Pi driver boards.\n self.Motor_A_EN = 17\n s...
[ "0.75681484", "0.74892616", "0.74392855", "0.74244773", "0.7285181", "0.711128", "0.7072771", "0.6974982", "0.6920696", "0.689383", "0.6876875", "0.68591636", "0.68544066", "0.6852921", "0.6852614", "0.6843594", "0.6811466", "0.6788002", "0.67217255", "0.6689759", "0.665003",...
0.65110856
33
Get next report ID or False if not available
def next_id(self): try: return Report.objects.filter(id__gt=self.id).order_by("id").first().id except Exception: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextId(self):\r\n \r\n nextId = -1\r\n if self._wizard.currentId() == SOURCE_PAGE_ID:\r\n nextId = TARGET_PAGE_ID\r\n elif self._wizard.currentId() == TARGET_PAGE_ID:\r\n nextId = DATASTORE_PAGE_ID\r\n elif self._wizard.currentId() == DATASTORE_PAGE_ID:\...
[ "0.62095916", "0.6153769", "0.5885677", "0.5764439", "0.573282", "0.56805384", "0.5647685", "0.5569167", "0.5534752", "0.55111814", "0.5475925", "0.5458879", "0.5441728", "0.5426077", "0.5425727", "0.5425234", "0.5410581", "0.5389253", "0.5372817", "0.5361491", "0.5344166", ...
0.8004583
0
Get previous report ID or False if not available
def previous_id(self): try: return Report.objects.filter(id__lt=self.id).order_by("-id").first().id except Exception: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_id(self):\n try:\n return Report.objects.filter(id__gt=self.id).order_by(\"id\").first().id\n except Exception:\n return False", "def get_report_id(self, reports):\n matching_reports = [\n report for report in reports if report.get('title') in [\n ...
[ "0.69261867", "0.6367051", "0.6234315", "0.61751926", "0.600833", "0.5732639", "0.5732639", "0.5496686", "0.54920655", "0.5474516", "0.5460659", "0.5322554", "0.5255835", "0.52374005", "0.519327", "0.5184205", "0.516578", "0.5152253", "0.51465", "0.51069415", "0.5098686", "...
0.76356864
0
Constructs HttpRequest from string containing an entire HTTP request
def deserialize(cls, data: bytes) -> HttpRequest: try: raw = data.decode("utf-8") raw_headers, raw_body = raw.split("\r\n\r\n") header_lines = raw_headers.split("\r\n") method, path, protocol = header_lines[0].split() headers = HttpRequest._parse_headers(header_lines[1:]) if "content-length" in headers: body = raw_body.encode("utf-8") else: body = b"" return HttpRequest(method, path, headers, body) except Exception as err: raise exceptions.HttpRequestParsingException( f"Failed to parse {data.decode('utf-8')}" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_from_text(text):\n lines = text.splitlines()\n match = re.search('^([a-z]+) (.*) (http/[0-9]\\.[0-9])$', lines[0], re.I)\n method, path, version = match.groups()\n headers = {}\n for idx, line in enumerate(lines[1:], start=1):\n if not line:\n break\n hdr, val = ...
[ "0.66163635", "0.64092165", "0.6310418", "0.6307847", "0.62922215", "0.6205955", "0.6139031", "0.61217684", "0.60365695", "0.60207903", "0.5994213", "0.5978753", "0.5958118", "0.5937699", "0.5780297", "0.5706186", "0.5587631", "0.5573185", "0.55512106", "0.5533943", "0.553247...
0.64779276
1
Parses headers to a dictionary from a list of strings
def _parse_headers(raw_headers: List[str]) -> Dict[str, str]: headers: Dict[str, str] = {} for header in raw_headers: name = header[: header.find(":")].strip() value = header[header.find(":") + 1 :].strip() headers[name.lower()] = value return headers
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_headers(headers):\n try:\n return dict(header.split(\":\") for header in headers)\n except:\n raise ValueError(\"Invalid headers %s\" % headers)", "def generate_header_dic(self, header_strings):\n headers = dict()\n\n for header_values in header_string...
[ "0.78225195", "0.74253625", "0.73871934", "0.7215364", "0.7209012", "0.71768695", "0.7095645", "0.70905596", "0.70813763", "0.70813763", "0.70154387", "0.6994542", "0.6965097", "0.69445574", "0.6913696", "0.6835682", "0.6808548", "0.6762677", "0.6754819", "0.6710498", "0.6692...
0.806986
0
Returns HTTP response as raw bytes
def serialize(self) -> bytes: headers = "\r\n".join( f"{header}: {value}" for header, value in self.headers.items() ) return ( f"HTTP/1.0 {self.status} {STATUS_CODES[self.status]}\r\n" f"{headers}\r\n" "\r\n" ).encode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def raw_response(self):\r\n return self._full_response", "def unparsed_response(self) -> bytes:\n return self._unparsed_response", "def get_raw_data(url):\n\n req = requests.get(url, stream=True)\n req.raw.decode_content = True\n return req.raw", "def return_response_string...
[ "0.6890451", "0.6742287", "0.6584883", "0.6479265", "0.64499426", "0.64372015", "0.6330324", "0.62823755", "0.62604046", "0.62554294", "0.61657286", "0.6161668", "0.61603785", "0.615336", "0.6128405", "0.6104145", "0.60856897", "0.6075969", "0.59855884", "0.5960043", "0.59529...
0.58378893
27
Initialize melon order class attributes
def __init__(self, species, qty, order_type, tax, country_code=None): #Define all the attributes needed self.species = species self.qty = qty self.country_code = country_code self.shipped = False self.order_type = order_type self.tax = tax #if the qty exceeds we raise the exception class if self.qty > 100: raise TooManyMelonsError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._order_list = []", "def __init__(self, *args, **kwargs):\n self._orders = None\n super().__init__(*args, **kwargs)", "def __init__(self):\n self.orders = {}", "def __init__(self, order):\n self.order = order\n self.keys = []\n self.v...
[ "0.74250233", "0.6944454", "0.6860201", "0.6591807", "0.65587133", "0.6512998", "0.65046525", "0.649869", "0.64915425", "0.64882565", "0.64488816", "0.64295405", "0.63480777", "0.63372934", "0.6327731", "0.62828344", "0.62793356", "0.6275021", "0.6272606", "0.62568283", "0.62...
0.0
-1
Set shipped to true.
def mark_shipped(self): self.shipped = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_shipped(self):\n\n self.shipped = True\n # moved from DomesticMelonOrder", "def setNewShip(self):\n self._ship = Ship()", "def action_ship_create(self):\n res = super(SaleOrder, self).action_ship_create()\n for sale_order in self:\n if sale_order.invoiced:...
[ "0.8498651", "0.67255795", "0.6544039", "0.63688415", "0.60945463", "0.605988", "0.6033643", "0.598843", "0.5941769", "0.5935463", "0.58800787", "0.58588344", "0.5824456", "0.58200085", "0.5804504", "0.58038855", "0.5789497", "0.57643706", "0.57440627", "0.5726546", "0.567436...
0.85205853
8
Initialize melon order attributes
def __init__(self, species, qty): #Include all arguments in exact order, if default values enter directly super (DomesticMelonOrder, self). __init__(species, qty, "domestic", 0.08)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._order_list = []", "def __init__(self):\n self.orders = {}", "def initialize(self):\n self.muondEdx = []\n self.muondNdx = []\n self.muonmomentum = []\n self.piondEdx = []\n self.piondNdx = []\n self.pionmomentum = []\n s...
[ "0.68216413", "0.6461353", "0.6418837", "0.6366196", "0.62271947", "0.6196553", "0.6189848", "0.618619", "0.6156593", "0.61555725", "0.61342317", "0.6116472", "0.6085777", "0.59540695", "0.5946118", "0.593134", "0.5919386", "0.5895247", "0.5894288", "0.58701146", "0.5856023",...
0.5670754
33
Initialize melon order attributes
def __init__(self, species, qty, country_code): super(InternationalMelonOrder, self).__init__(species, qty, "international", 0.17, country_code)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._order_list = []", "def __init__(self):\n self.orders = {}", "def initialize(self):\n self.muondEdx = []\n self.muondNdx = []\n self.muonmomentum = []\n self.piondEdx = []\n self.piondNdx = []\n self.pionmomentum = []\n s...
[ "0.68216413", "0.6461353", "0.6418837", "0.6366196", "0.62271947", "0.6196553", "0.6189848", "0.618619", "0.6156593", "0.61555725", "0.61342317", "0.6116472", "0.6085777", "0.59540695", "0.5946118", "0.593134", "0.5919386", "0.5895247", "0.5894288", "0.58701146", "0.5856023",...
0.57612264
23
Return the country code.
def get_country_code(self): return self.country_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_code(self):\n return self.__country_code", "def country_code(self):\n return self.__country_code", "def country_code(self):\n return self._plrevgeoloc.countryCode", "def country(self) -> str:\n return pulumi.get(self, \"country\")", "def get_country_code(self):\n ...
[ "0.8740297", "0.8740297", "0.8514241", "0.8449802", "0.83579975", "0.8277011", "0.8177935", "0.8112277", "0.806426", "0.806426", "0.80227566", "0.8021162", "0.80009323", "0.7983514", "0.7848084", "0.7834845", "0.7834845", "0.77554494", "0.77554494", "0.7722244", "0.77020496",...
0.87174577
8
method that takes boolean value for passed = True or False
def mark_inspection(self, passed): self.passed_inspection = passed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def functionWithArg(arg):\n return bool(arg)", "def give_me_a_boolean():\n return True\n pass", "def convert_boolean(cls, param, value):\r\n return True", "def isTrue(*args, **kwargs)->None:\n pass", "def boolean_func(experiment):", "def set_boolean(x):\n\n if x:\n return \"T...
[ "0.75803596", "0.734512", "0.7176815", "0.7096356", "0.7058401", "0.70008546", "0.69879454", "0.6956472", "0.69338465", "0.6895815", "0.68813026", "0.6857039", "0.67971283", "0.6779212", "0.6753107", "0.6710721", "0.6669785", "0.66588914", "0.6656253", "0.6649511", "0.6648595...
0.0
-1