Search is not available for this dataset
id
int64
0
10.8M
vector
listlengths
1.54k
1.54k
ast_depth
int64
3
164
ast_data
stringlengths
297
510k
full_path
stringlengths
0
319
code
stringlengths
60
56.5k
21,701
[ 0.03540225699543953, -0.051476120948791504, -0.0009192164870910347, 0.016073865815997124, 0.022756818681955338, -0.011763486079871655, 0.000878845457918942, 0.014372074045240879, 0.040097713470458984, -0.010216967202723026, 0.027377745136618614, -0.021800337359309196, -0.018011674284934998, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_sending_stream_message(self): # type: () -> Generator[str, Any, None] user_profile = UserProfile.objects.filter(email='hamlet@zulip.com').first() cookies = self._get_cookies(user_profile) cookie_header = self.get_cookie_header(cookies) queue_events_data = self._get_queue...
21,702
[ 0.013917496427893639, 0.029280701652169228, 0.030970755964517593, 0.01506795547902584, -0.018376797437667847, -0.01402948796749115, -0.001558973453938961, -0.021156223490834236, -0.01795937307178974, -0.006200260017067194, 0.007864861749112606, 0.016829276457428932, 0.013581521809101105, -...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": n...
class PixmapItem(QGraphicsPixmapItem): def __init__(self, data, encoding, x0, y0, x1, y1, xsize, ysize): p = QPixmap() p.loadFromData(data, encoding, Qt.ImageConversionFlag.AutoColor) w, h = p.width(), p.height() p = p.copy(x0, y0, min(w, x1-x0), min(h, y1-y0)) if p.width() ...
21,703
[ -0.00021140645549166948, 0.004688919056206942, 0.002207741606980562, 0.023272432386875153, -0.001310213701799512, -0.0061320532113313675, 0.011626088991761208, -0.008020786568522453, -0.048489298671483994, 0.014492101967334747, -0.008263840340077877, 0.01330721378326416, 0.022421743720769882...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, data, encoding, x0, y0, x1, y1, xsize, ysize): p = QPixmap() p.loadFromData(data, encoding, Qt.ImageConversionFlag.AutoColor) w, h = p.width(), p.height() p = p.copy(x0, y0, min(w, x1-x0), min(h, y1-y0)) if p.width() != xsize or p.height() != ysize: ...
21,704
[ -0.02978629432618618, 0.016467219218611717, 0.04402559623122215, -0.03978770971298218, -0.018767787143588066, -0.04802131652832031, -0.028284871950745583, -0.016140297055244446, 0.0013765565818175673, 0.006647428963333368, -0.009813736192882061, 0.01974855549633503, -0.02528202533721924, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "Swis721 BT Roman"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Dutch801 Rm BT Roma...
class FontLoader: font_map = { 'Swis721 BT Roman' : 'Liberation Sans', 'Dutch801 Rm BT Roman' : 'Liberation Serif', 'Courier10 BT Roman' : 'Liberation Mono', } def __init__(self, font_map, dpi): self.face_map = {} self.cache...
21,705
[ -0.000627579283900559, 0.029035260900855064, 0.0013933092122897506, 0.009097122587263584, -0.022815005853772163, -0.030457032844424248, 0.006764526944607496, -0.025303106755018234, -0.028924183920025826, -0.030034944415092468, 0.005117825698107481, -0.0056815361604094505, 0.00481514353305101...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "plot", "annotation": n...
class Plot(PixmapItem): def __init__(self, plot, dpi): img = plot.refobj xsize, ysize = dpi*plot.attrs['xsize']/720, dpi*plot.attrs['ysize']/720 x0, y0, x1, y1 = img.x0, img.y0, img.x1, img.y1 data, encoding = img.data, img.encoding PixmapItem.__init__(self, data, encoding, ...
21,706
[ 0.04165610671043396, 0.008251156657934189, 0.00263825710862875, -0.0193935539573431, 0.008834964595735073, -0.00607160571962595, 0.05030759051442146, -0.010780991986393929, -0.07263686507940292, -0.005699080415070057, -0.0157016608864069, -0.049684859812259674, 0.0006661668885499239, -0.01...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_...
class Style: map = collections.defaultdict(lambda : NULL) def __init__(self, style, dpi): self.fdpi = dpi/720 self.update(style.as_dict()) def update(self, *args, **kwds): if len(args) > 0: kwds = args[0] for attr in kwds: setattr(self, attr, self.__...
21,707
[ -0.018464749678969383, 0.012723103165626526, 0.025807315483689308, -0.03810912370681763, -0.024916578084230423, -0.03827764093875885, -0.013698099181056023, 0.0015753415646031499, -0.0062712738290429115, 0.00214108033105731, -0.00322892377153039, 0.04829242080450058, -0.009792095050215721, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text_style", "annotation": null, "type_comment": null}}], "kwarg"...
def font(self, text_style): device_font = text_style.fontfacename in LIBERATION_FONT_MAP try: if device_font: face = self.font_map[text_style.fontfacename] else: face = self.face_map[text_style.fontfacename] except KeyError: # Bad fontface...
21,708
[ 0.0027428208850324154, 0.0036535230465233326, -0.0005537872784771025, -0.005174931604415178, 0.019864022731781006, -0.03977090120315552, 0.03428525850176811, -0.003200850449502468, -0.04984219744801521, 0.03884948417544365, -0.0489422082901001, -0.019574740901589394, -0.0063909864984452724, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Lambda", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_...
class TextStyle(Style): map = collections.defaultdict(lambda : NULL, fontsize=operator.mul, fontwidth=operator.mul, fontweight=WEIGHT, textcolor=COLOR, textbgcolor=COLOR, wordspace=operator.mul, letterspace=operator.mul, baselineskip=operator.mul, ...
21,709
[ 0.02350778505206108, 0.008313861675560474, 0.0002100613055517897, -0.013847350142896175, 0.008564640767872334, -0.048105914145708084, 0.015286602079868317, 0.009202491492033005, -0.02621183544397354, 0.043788157403469086, -0.01190654095262289, 0.005604360718280077, -0.01710747368633747, 0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "style", "annotation": null, "type_comment": null}}, {"_type": "ar...
def __init__(self, style, font_loader, ruby_tags): self.font_loader = font_loader self.fontstyle = QFont.Style.StyleNormal for attr in ruby_tags: setattr(self, attr, ruby_tags[attr]) Style.__init__(self, style, font_loader.dpi) self.emplinetype = 'none' self...
21,710
[ 0.029783686622977257, -0.0054965210147202015, 0.04261395335197449, 0.024932922795414925, -0.04586396738886833, -0.032451607286930084, 0.026145614683628082, -0.04887143895030022, -0.018723946064710617, 0.0566084086894989, 0.013327471911907196, 0.03742363676428795, -0.008312995545566082, 0.0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tb", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def __init__(self, tb, font_loader, respect_max_y, text_width, logger, opts, ruby_tags, link_activated): self.block_id = tb.id self.bs, self.ts = BlockStyle(tb.style, font_loader.dpi), \ TextStyle(tb.textstyle, font_loader, ruby_tags) self.bs.update(t...
21,711
[ 0.016046147793531418, 0.03023725189268589, 0.04985436424612999, 0.023837342858314514, -0.024556173011660576, -0.00795350968837738, -0.02048666588962078, -0.05068913474678993, 0.022724313661456108, 0.024208351969718933, 0.005121666472405195, 0.018701182678341866, -0.024579361081123352, 0.02...
25
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Pass", "_fields": {}}], "name": "HeightExceeded", "bases": [{"_type": "Name", "_fields": {"id": "Exception", "ctx": {"_type": "Load", "_fields": {}}}}], "keywords": [], "type_params"...
class TextBlock: class HeightExceeded(Exception): pass has_content = property(fget=lambda self: self.peek_index < len(self.lines)-1) XML_ENTITIES = { "apos" : "'", "quot" : '"', "amp" : "&", "lt" : "<", "gt" : ">" } def __init__(...
21,712
[ 0.005077600013464689, 0.020441945642232895, 0.06114167347550392, -0.0132925258949399, -0.026545587927103043, -0.044146183878183365, 0.045066989958286285, -0.016429850831627846, -0.01981053315103054, 0.03428037837147713, -0.002025778405368328, 0.04903962090611458, 0.028124116361141205, -0.0...
24
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tb", "annotation": null, "type_comment": null}}], "kwarg": null, ...
def populate(self, tb): self.create_line() open_containers = collections.deque() self.in_para = False for i in tb.content: if isinstance(i, string_or_bytes): self.process_text(i) elif i is None: if len(open_containers) > 0: ...
21,713
[ 0.047441866248846054, 0.0401342511177063, 0.058184292167425156, 0.0029161302372813225, -0.014811175875365734, 0.009808802045881748, 0.006022443063557148, -0.02049359492957592, 0.00425893347710371, 0.06187267601490021, -0.002103532664477825, 0.03153569996356964, -0.0640857070684433, 0.01011...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def end_line(self): if self.current_line is not None: self.height += self.current_line.finalize(self.current_style.baselineskip, self.current_style.linespace, self.opts.visual_debug) ...
21,714
[ 0.0008721539052203298, 0.04264708235859871, -0.051747310906648636, 0.03838939219713211, -0.01735827513039112, 0.0125625254586339, -0.04227278009057045, -0.018060091882944107, -0.03415509685873985, 0.03520782291889191, 0.025195231661200523, 0.039839815348386765, 0.04987579584121704, -0.0251...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": 255}}, {"_type": "Constant", "_fields": {"kind": null, "valu...
class Link(QGraphicsRectItem): inactive_brush = QBrush(QColor(0xff, 0xff, 0xff, 0xff)) active_brush = QBrush(QColor(0x00, 0x00, 0x00, 0x59)) def __init__(self, parent, start, stop, refobj, slot): QGraphicsRectItem.__init__(self, start, 0, stop-start, parent.height, parent) self.refobj = r...
21,715
[ 0.029770396649837494, 0.04971367120742798, 0.025212569162249565, 0.045533809810876846, -0.004046461544930935, -0.02716910094022751, 0.038508087396621704, -0.016096914187073708, 0.02945913001894951, 0.040909282863140106, 0.018820494413375854, 0.019376326352357864, -0.02499023638665676, 0.01...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "raw", "annotation": null, "type_comment": null}}], "kwarg": null,...
def process_text(self, raw): for ent, rep in TextBlock.XML_ENTITIES.items(): raw = raw.replace('&%s;'%ent, rep) while len(raw) > 0: if self.current_line is None: self.create_line() pos, line_filled = self.current_line.populate(raw, self.current_style) ...
21,716
[ 0.02436080574989319, 0.05972491577267647, 0.031653694808483124, -0.012231580913066864, -0.04058428108692169, -0.0029731313697993755, -0.046930376440286636, 0.0022870241664350033, -0.04820982739329338, 0.06151615083217621, 0.004535664804279804, 0.00796460174024105, 0.014777693897485733, 0.0...
17
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"kind": null, "value": "\\s+"}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "att...
class Line(QGraphicsItem): whitespace = re.compile(r'\s+') def __init__(self, line_length, offset, linespace, align, hyphenate, block_id): QGraphicsItem.__init__(self) self.line_length, self.offset, self.line_space = line_length, offset, linespace self.align, self.hyphenate, self.block...
21,717
[ 0.03718367964029312, 0.0618671253323555, -0.0034336026292294264, 0.03190731257200241, -0.03562115132808685, -0.012647434137761593, -0.034987080842256546, -0.027967019006609917, -0.014991228468716145, 0.013541925698518753, 0.006284087430685759, 0.0309109166264534, 0.04273179545998573, -0.04...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "parent", "annotation": null, "type_comment": null}}, {"_type": "a...
def __init__(self, parent, start, stop, refobj, slot): QGraphicsRectItem.__init__(self, start, 0, stop-start, parent.height, parent) self.refobj = refobj self.slot = slot self.brush = self.__class__.inactive_brush self.setPen(QPen(Qt.PenStyle.NoPen)) self.setCursor(Qt.Cur...
21,718
[ 0.018300948664546013, 0.045348674058914185, 0.0361982025206089, 0.020196083933115005, -0.011987569741904736, -0.04570751637220383, -0.03326018154621124, -0.02680102176964283, -0.02682344987988472, 0.054499149322509766, 0.01035595964640379, -0.0026170245837420225, 0.008337472565472126, -0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "line_length", "annotation": null, "type_comment": null}}, {"_type...
def __init__(self, line_length, offset, linespace, align, hyphenate, block_id): QGraphicsItem.__init__(self) self.line_length, self.offset, self.line_space = line_length, offset, linespace self.align, self.hyphenate, self.block_id = align, hyphenate, block_id self.tokens = collections....
21,719
[ -0.0000862421074998565, 0.05692019313573837, 0.023271383717656136, 0.01199241541326046, 0.016526054590940475, 0.005607054103165865, 0.034193627536296844, 0.004316361621022224, -0.025800881907343864, 0.08177413791418076, -0.004705515224486589, 0.020248956978321075, 0.017875120043754578, 0.0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "phrase", "annotation": null, "type_comment": null}}, {"_type": "a...
def populate(self, phrase, ts, process_space=True): phrase_pos = 0 processed = False matches = self.__class__.whitespace.finditer(phrase) font = QFont(ts.font) if self.valign is not None: font.setPixelSize(font.pixelSize()/1.5) fm = QFontMetrics(font) ...
21,720
[ 0.0039981696754693985, 0.03362170234322548, 0.07920914888381958, -0.025567833334207535, -0.05277200788259506, -0.0030090142972767353, 0.01252184621989727, 0.004285808186978102, -0.00387672265060246, 0.06463548541069031, 0.05149361491203308, 0.02062045782804489, -0.04382326453924179, -0.005...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "baselineskip", "annotation": null, "type_comment": null}}, {"_typ...
def finalize(self, baselineskip, linespace, vdebug): if self.current_link is not None: self.end_link() # We justify if line is small and it doesn't have links in it # If it has links, justification would cause the boundingrect of the link to # be too small if self.cu...
21,721
[ 0.02148190326988697, -0.0045658741146326065, 0.061369482427835464, -0.0024218843318521976, 0.03143440932035446, 0.006617770530283451, -0.017100214958190918, 0.03880184888839722, -0.013519898056983948, 0.09781891852617264, 0.013048123568296432, 0.0057226913049817085, -0.045807380229234695, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def justify(self): delta = self.line_length - self.current_width if self.length_in_space > 0: frac = 1 + float(delta)/self.length_in_space for i in range(len(self.tokens)): if isinstance(self.tokens[i], numbers.Number): self.tokens[i] *= frac ...
21,722
[ 0.07642292976379395, 0.048817362636327744, -0.048687759786844254, -0.019256938248872757, 0.027000753208994865, -0.024559885263442993, -0.006345177069306374, 0.07832378894090652, -0.009666269645094872, 0.06678906083106995, -0.02224862016737461, -0.043352410197257996, -0.024408681318163872, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "phrase", "annotation": null, "type_comment": null}}], "kwarg": nu...
def search(self, phrase): tokens = phrase.lower().split() if len(tokens) < 1: return None words = self.words() matches = [] try: while True: word = next(words) word.highlight = False if tokens[0] in str(word...
21,723
[ 0.01992158219218254, 0.010237479582428932, 0.06081879884004593, -0.01984252780675888, -0.025850623846054077, -0.0004644416621886194, -0.019407732412219048, 0.020672595128417015, -0.05069990083575249, 0.03618033230304718, -0.015665847808122635, -0.005701762158423662, -0.008234781213104725, ...
16
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "painter", "annotation": null, "type_comment": null}}, {"_type": "...
def paint(self, painter, option, widget): x, y = 0, 0+self.height-self.descent if self.vdebug: painter.save() painter.setPen(QPen(Qt.GlobalColor.yellow, 1, Qt.PenStyle.DotLine)) painter.drawRect(self.boundingRect()) painter.restore() painter.save()...
21,724
[ -0.019750934094190598, -0.01405332051217556, 0.023946667090058327, -0.04388831555843353, 0.0177126657217741, 0.030180666595697403, 0.012170008383691311, -0.010191339068114758, 0.032516926527023315, 0.0028607267886400223, 0.04667752608656883, 0.0011509954929351807, 0.01921454817056656, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "rvi_node_url", "annota...
class RVI(SimpleJSONRPCServer): # address is either localhost or the ip address of self. # 0.0.0.0 should work to listen to all addresses, but haven't been tested # Port is either a fixed port (integer) or a tuple with a start and stop # port that should be used as a random interval to pick the port fro...
21,725
[ 0.047607749700546265, -0.04440830275416374, -0.00908642541617155, -0.01262714434415102, -0.003967312164604664, -0.02312132529914379, -0.0258728489279747, 0.050849851220846176, 0.004772506188601255, 0.06441549956798553, -0.041848745197057724, -0.020092517137527466, -0.035876449197530746, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def __unicode__(self): s = '' for tok in self.tokens: if isinstance(tok, numbers.Number): s += ' ' elif isinstance(tok, Word): s += str(tok.string) return s
21,726
[ 0.004954645875841379, -0.0049706632271409035, 0.029322106391191483, -0.029172614216804504, 0.02599053457379341, 0.00030899798730388284, 0.040512774139642715, 0.010651420801877975, 0.023619992658495903, 0.01814211905002594, 0.017597535625100136, 0.014148504473268986, 0.03901783749461174, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "rvi_node_url", "annotation": null, "type_comment": null}}, {"_typ...
def __init__(self, rvi_node_url, address='localhost', port=(20001,59999)): if isinstance(port, tuple) == True: (start_port, stop_port) = port self.rvi_port = random.randint(start_port, stop_port) else: self.rvi_port = port self.rvi_address = address S...
21,727
[ 0.010755853727459908, -0.01112965028733015, -0.009292257949709892, -0.04121234640479088, 0.022764714434742928, 0.05664854869246483, 0.02554449439048767, -0.00883948989212513, 0.04114916920661926, 0.03693738207221031, 0.026934385299682617, -0.016141677275300026, 0.03603184595704079, -0.0836...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "service_name", "annotation": null, "type_comment": null}}, {"_typ...
def register_service(self, service_name, function): # Add a prefixing slash if necessary if service_name[0] != '/': service_name = '/' + service_name # Register service_name within SimpleJSONRPCServer so that # when it gets invoked with the given URL suffic, it will call 'fu...
21,728
[ 0.019880637526512146, -0.007960503920912743, 0.01225599367171526, -0.013528731651604176, 0.024771248921751976, 0.03799358010292053, -0.05538766458630562, 0.02256752736866474, 0.027976663783192635, -0.030121462419629097, -0.003202467691153288, -0.013281255029141903, 0.016474884003400803, 0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "method", "annotation": null, "type_comment": null}}, {"_type": "a...
def _dispatch(self, method, params): if method == 'message': # print "Will dispatch message to: " + params['service_name'] # dict_param = {} # Extract the 'parameters' element from the top level JSON-RPC # 'param'. # Convert 'parameters' from [{'vin':...
21,729
[ -0.020924940705299377, 0.023520028218626976, -0.015942811965942383, -0.021461477503180504, 0.0027223776560276747, 0.07393260300159454, 0.015504823066294193, -0.0013358675641939044, 0.02763712778687477, 0.03309009596705437, 0.0511571541428566, -0.030177466571331024, 0.04029501974582672, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "service_name", "annotation": null, "type_comment": null}}], "kwar...
def unregister_service(self, service_name): if service_name[0] != '/': service_name = '/' + service_name # Check that the service has been previously registered # If not just return if service_name not in self.registered_services: return False ...
21,730
[ 0.0011977042304351926, 0.012315786443650723, -0.0903480276465416, -0.06131277605891228, 0.027656078338623047, -0.010331710800528526, -0.006466392893344164, 0.026736628264188766, -0.0008052745833992958, 0.03629406541585922, 0.055166978389024734, -0.08971893042325974, -0.018497874960303307, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "https?://www\\.criterion\\.com/films/(?P<id>[0-9]+)-.+"}}, "targets": [{"_type": "Name", "_fields": {"id": "_VALID_URL", "ctx": {"_type":...
class CriterionIE(InfoExtractor): _VALID_URL = r'https?://www\.criterion\.com/films/(?P<id>[0-9]+)-.+' _TEST = { 'url': 'http://www.criterion.com/films/184-le-samourai', 'md5': 'bc51beba55685509883a9a7830919ec3', 'info_dict': { 'id': '184', 'ext': 'mp4', ...
21,731
[ 0.01828492246568203, 0.02004150114953518, 0.006772848777472973, 0.01837923564016819, -0.04064888134598732, 0.005599831230938435, 0.03060455061495304, 0.010698624886572361, 0.017011698335409164, -0.020949263125658035, 0.044468555599451065, 0.00766292680054903, 0.034377068281173706, -0.02320...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "tag", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "provider", "annotation": null, "type_comment": null}}], "kwarg": n...
def tagged_vm(tag, provider): ownership_vm = provider.data.cap_and_util.capandu_vm collection = provider.appliance.provider_based_collection(provider) tag_vm = collection.instantiate(ownership_vm, provider) tag_vm.add_tag(tag=tag) yield tag_vm tag_vm.appliance.server.login_admin() tag_vm.rem...
21,732
[ 0.013743439689278603, 0.010463369078934193, -0.05628805607557297, -0.04266924783587456, -0.003789926413446665, -0.015114384703338146, 0.015431628562510014, 0.0026144259609282017, 0.007795125246047974, 0.035327326506376266, 0.05778362974524498, -0.047450557351112366, -0.006690437905490398, ...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}], "kwarg": null,...
def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) final_url = self._search_regex( r'so.addVariable\("videoURL", "(.+?)"\)\;', webpage, 'video url') title = self._og_search_t...
21,733
[ 0.008942007087171078, 0.03270015865564346, 0.016480879858136177, -0.025589359924197197, 0.020202752202749252, 0.04506676271557808, -0.004765304736793041, -0.009078753180801868, 0.025779616087675095, 0.03931153565645218, 0.01750350184738636, -0.02856210246682167, -0.006581650115549564, -0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "serializedATN", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords"...
class HTMLLexer(Lexer): atn = ATNDeserializer().deserialize(serializedATN()) decisionsToDFA = [DFA(ds, i) for i, ds in enumerate(atn.decisionToState)] TAG = 1 SCRIPT = 2 STYLE = 3 ATTVALUE = 4 HTML_COMMENT = 1 HTML_CONDITIONAL_COMMENT = 2 XML_DECLARATION = 3 CDATA = 4 DTD = 5 SCRIPTLET = 6 ...
21,734
[ -0.016077036038041115, -0.004868096671998501, 0.01999722048640251, 0.0021180773619562387, 0.0023470225278288126, 0.009355956688523293, 0.06923515349626541, 0.017244523391127586, -0.02701284922659397, 0.017587270587682724, -0.01722310110926628, -0.01236035954207182, 0.07776101678609848, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "uri", "annotation": null, "type_comment": null}}], "kwarg": null,...
def __init__(self, uri): DBConnector.__init__(self, uri) self.dbname = uri.database() if not QFile.exists(self.dbname): raise ConnectionError(QApplication.translate("DBManagerPlugin", '"{0}" not found').format(self.dbname)) try: self.connection = spatialite_conn...
21,735
[ 0.012499051168560982, 0.02451656386256218, 0.06063191220164299, -0.03833461180329323, 0.0050535318441689014, 0.025081848725676537, 0.01554530207067728, 0.006783404853194952, -0.006945662200450897, 0.027657030150294304, 0.017743628472089767, -0.009170157834887505, 0.05317854508757591, -0.00...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null...
def isValidDatabase(self, path): if not QFile.exists(path): return False try: conn = spatialite_connect(path) except self.connection_error_types(): return False isValid = False try: c = conn.cursor() c.execute("SELECT ...
21,736
[ 0.001312128035351634, 0.06306086480617523, 0.08375129848718643, 0.0015278877690434456, 0.01786799356341362, 0.037580136209726334, -0.0073765916749835014, -0.026740144938230515, -0.0035055677872151136, 0.0015728670405223966, -0.0002466829027980566, -0.054199956357479095, 0.05703364685177803, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _checkGeometryColumnsTable(self): try: c = self._get_cursor() self._execute(c, u"SELECT CheckSpatialMetaData()") v = c.fetchone()[0] self.has_geometry_columns = v == 1 or v == 3 self.has_spatialite4 = v == 3 except Exception: se...
21,737
[ 0.0003658264467958361, 0.0484774075448513, 0.05834251642227173, -0.015690432861447334, 0.04950409382581711, 0.0512896329164505, -0.012286746874451637, -0.006221490446478128, -0.021247925236821175, 0.017386695370078087, -0.008715666830539703, -0.06088691204786301, 0.04713825508952141, 0.013...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "table", "annotation": null, "type_comment": null}}], "kwarg": nul...
def isRasterTable(self, table): if self.has_geometry_columns and self.has_raster: schema, tablename = self.getSchemaTableName(table) if not tablename.endswith("_rasters"): return False sql = u"""SELECT count(*) FROM lay...
21,738
[ 0.002470745239406824, 0.046968623995780945, 0.05023033171892166, 0.015058227814733982, 0.04866471141576767, 0.05914567410945892, -0.03026866726577282, -0.03381305932998657, -0.02831164188683033, 0.031181946396827698, 0.0036041894927620888, -0.02055964432656765, 0.06962663680315018, 0.02478...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "table", "annotation": null, "type_comment": null}}], "kwarg": nul...
def isVectorTable(self, table): if self.has_geometry_columns: schema, tablename = self.getSchemaTableName(table) sql = u"SELECT count(*) FROM geometry_columns WHERE upper(f_table_name) = upper(%s)" % self.quoteString( tablename) c = self._execute(None, sql) ...
21,739
[ -0.015209308825433254, 0.04946662858128548, 0.05291362106800079, 0.00043891838868148625, -0.02779979631304741, -0.02515859156847, 0.009641516022384167, -0.056539684534072876, -0.04745214805006981, -0.0016927211545407772, 0.015075010247528553, 0.0016381622990593314, 0.057121641933918, 0.013...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "view", "annotation": null, "type_comment": null}}, {"_type": "arg...
def createSpatialView(self, view, query): self.createView(view, query) # get type info about the view sql = u"PRAGMA table_info(%s)" % self.quoteString(view) c = self._execute(None, sql) geom_col = None for r in c.fetchall(): if r[2].upper() in ('POINT', 'LIN...
21,740
[ 0.029571810737252235, 0.05157505348324776, 0.026535319164395332, -0.014627283439040184, -0.04554738849401474, 0.034058570861816406, -0.020065777003765106, -0.016100209206342697, -0.01538640633225441, 0.004996616393327713, 0.04772278666496277, -0.02893732115626335, 0.04133255407214165, 0.02...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "view", "annotation": null, "type_comment": null}}], "kwarg": null...
def deleteView(self, view): c = self._get_cursor() sql = u"DROP VIEW %s" % self.quoteId(view) self._execute(c, sql) # update geometry_columns if self.has_geometry_columns: sql = u"DELETE FROM geometry_columns WHERE f_table_name = %s" % self.quoteString(view) ...
21,741
[ 0.01695891283452511, 0.020748550072312355, 0.09175149351358414, 0.013647145591676235, 0.03338438645005226, 0.05138794705271721, -0.028405621647834778, -0.03427344933152199, -0.02327127195894718, 0.029716992750763893, -0.011513389647006989, -0.026849757879972458, 0.03089500404894352, 0.0378...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "table", "annotation": null, "type_comment": null}}, {"_type": "ar...
def isGeometryColumn(self, table, column): c = self._get_cursor() schema, tablename = self.getSchemaTableName(table) sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % ( self.quoteString(tablename), sel...
21,742
[ 0.031032325699925423, 0.04803118854761124, 0.044731657952070236, -0.024245308712124825, -0.0093765240162611, 0.008708263747394085, 0.006489431485533714, 0.011057615280151367, -0.015610137023031712, -0.006421561352908611, 0.02487180382013321, -0.023284684866666794, 0.03596074506640434, 0.02...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "table", "annotation": null, "type_comment": null}}, {"_type": "ar...
def deleteSpatialIndex(self, table, geom_column='geometry'): if self.isRasterTable(table): return False schema, tablename = self.getSchemaTableName(table) try: sql = u"SELECT DiscardSpatialIndex(%s, %s)" % (self.quoteString(tablename), self.quoteString(geom_column)) ...
21,743
[ 0.00782804749906063, 0.03439901024103165, 0.06571120023727417, -0.010877867229282856, 0.01709379069507122, 0.04427260160446167, -0.005465361755341291, -0.014968959614634514, -0.015381240285933018, -0.02676652930676937, -0.005893499590456486, -0.010391587391495705, 0.05877642333507538, 0.03...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "table", "annotation": null, "type_comment": null}}, {"_type": "ar...
def hasSpatialIndex(self, table, geom_column='geometry'): if not self.has_geometry_columns or self.isRasterTable(table): return False c = self._get_cursor() schema, tablename = self.getSchemaTableName(table) sql = u"SELECT spatial_index_enabled FROM geometry_columns WHERE upp...
21,744
[ 0.008218353614211082, 0.03346636891365051, 0.013460073620080948, 0.005843569524586201, -0.022413691505789757, 0.010406356304883957, -0.011841307394206524, 0.009220447391271591, -0.02063482627272606, 0.04309595376253128, 0.0337509848177433, 0.02722848393023014, -0.009825261309742928, -0.013...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "message", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "category", "annotation": null, "type_comment": null}}, {"_type...
def _showwarning(message, category, filename, lineno, file=None, line=None): if file is not None: if _warnings_showwarning is not None: _warnings_showwarning( message, category, filename, lineno, file, line, ) else: if issubclass(category, PipDeprecationWa...
21,745
[ -0.01720338873565197, 0.022603342309594154, 0.08816736936569214, -0.022543607279658318, -0.012030425481498241, -0.029604164883494377, 0.01081782579421997, -0.025733401998877525, 0.019998939707875252, 0.016701623797416687, 0.04477659985423088, -0.033020950853824615, -0.012902542017400265, -...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class GeoAlgorithmTest(unittest.TestCase): def testWrongformat(self): outputs = processing.runalg('qgis:countpointsinpolygon', polygons(), points(), 'NUMPOINTS', getTempFilename('wrongext')) output = outputs['OUTPUT'] s...
21,746
[ -0.03242940828204155, 0.046010129153728485, 0.07379986345767975, -0.0199965238571167, -0.029819590970873833, -0.04086298868060112, 0.0048571620136499405, -0.015441425144672394, 0.0413704514503479, 0.04122546315193176, 0.06273230165243149, -0.017229633405804634, -0.007219288963824511, -0.01...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def testWrongformat(self): outputs = processing.runalg('qgis:countpointsinpolygon', polygons(), points(), 'NUMPOINTS', getTempFilename('wrongext')) output = outputs['OUTPUT'] self.assertTrue(output.endswith('shp')) l...
21,747
[ 0.03599133715033531, -0.035772912204265594, 0.03431675583124161, 0.02538566291332245, 0.012383398599922657, -0.056693028658628464, -0.009610633365809917, -0.057566724717617035, -0.01363933365792036, 0.024948816746473312, 0.005330139771103859, 0.0036858965177088976, 0.009034237824380398, 0....
5
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": 0}}, "targets": [{"_type": "Name", "_fields": {"id": "NONE", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_type"...
class AvahiPublishFlags(object): NONE = 0 UNIQUE = 1 << 0 NO_PROBE = 1 << 1 NO_ANNOUNCE = 1 << 2 ALLOW_MULTIPLE = 1 << 3 NO_REVERSE = 1 << 4 NO_COOKIE = 1 << 5 UPDATE = 1 << 6 USE_WIDE_AREA = 1 << 7 USE_MULTICAST = 1 << 8
21,748
[ 0.00647595152258873, 0.009499255567789078, 0.047275640070438385, -0.000871361349709332, -0.004212946631014347, 0.0062493528239429, 0.0025373089592903852, 0.004710867069661617, 0.031199060380458832, -0.007328678388148546, -0.01422801148146391, -0.015038996934890747, 0.016374735161662102, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _add_service(self): assert not self._group assert not self._group_id try: bus = Gio.bus_get_sync(Gio.BusType.SYSTEM, None) server = Gio.DBusProxy.new_sync( bus, Gio.DBusProxyFlags.NONE, None, self.DBUS_NAME, self.DBUS_PATH_SERVER, self...
21,749
[ -0.006095695775002241, 0.031229523941874504, 0.03057745285332203, 0.01445034984499216, 0.009583109058439732, 0.030321281403303146, -0.008040263317525387, 0.03588717058300972, 0.036539241671562195, -0.0048526860773563385, 0.031136371195316315, -0.01420582365244627, 0.010555392131209373, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _remove_service(self): if self._group: if self._group_id: with ignored(GLib.Error): self._group.disconnect(self._group_id) self._group_id = None with ignored(GLib.Error): self._group.Free() self._group =...
21,750
[ 0.0010503851808607578, 0.007696735672652721, 0.03541472554206848, -0.0018769926391541958, -0.006067877169698477, 0.017317654564976692, 0.0507107712328434, 0.0292037520557642, 0.0025726824533194304, 0.0002209234080510214, 0.015515254810452461, -0.0031846461351960897, -0.0017628204077482224, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _try_update_service(self): if not self._group: return assert self._group_id try: group = self._group # XXX: http://markmail.org/message/b5d5wa2tdcplxpk2 # It's "documented" that Reset() shouldn't be called in this case # but it doe...
21,751
[ 0.031296949833631516, 0.017885562032461166, -0.009799774736166, -0.012476487085223198, -0.0032638090196996927, 0.0043044439516961575, -0.009438056498765945, -0.0023316896986216307, 0.003664481220766902, -0.00776302395388484, -0.020723657682538033, -0.0009056861163116992, 0.010039065033197403...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _add_server(self): assert not self._server_id try: server = Gio.DBusProxy.new_for_bus_sync( Gio.BusType.SYSTEM, Gio.DBusProxyFlags.NONE, None, self.DBUS_NAME, self.DBUS_PATH_SERVER, self.DBUS_INTERFACE_SERVER, None) self._serve...
21,752
[ 0.018081847578287125, 0.03267934173345566, 0.000977945514023304, -0.018785210326313972, 0.016361312940716743, 0.028848715126514435, -0.02934648096561432, 0.028134532272815704, 0.010095968842506409, 0.038284603506326675, 0.040621936321258545, -0.04261299595236778, 0.01059914380311966, -0.01...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _remove_server(self): if self._server: if self._server_id: with ignored(GLib.Error): self._server.disconnect(self._server_id) self._server_id = None self._server = None self._last_server_state = None self._remove_s...
21,753
[ -0.02644277922809124, 0.08026214689016342, 0.04377521201968193, -0.018642045557498932, -0.03254671022295952, 0.05507204309105873, -0.011069070547819138, -0.023288322612643242, -0.014143812470138073, 0.04696383327245712, 0.027718229219317436, -0.06523007899522781, 0.010078320279717445, 0.03...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "grammar_parser", "annotation": null, "type_comment": null}}, {"_t...
def _resolve_cls_refs(self, grammar_parser, model_parser): resolved_classes = {} def _resolve_cls(cls): if cls in resolved_classes: return resolved_classes[cls] metamodel = model_parser.metamodel to_resolve = cls if isinstance(cls, Cla...
21,754
[ 0.04079553484916687, 0.0020429352298378944, 0.014413963072001934, -0.015091591514647007, 0.005366473458707333, 0.03627035394310951, -0.0019223402487114072, -0.010480271652340889, 0.007448171265423298, 0.048513609915971756, 0.013299895450472832, -0.014620697125792503, 0.049616191536188126, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "state", "annotation": null, "type_comment": null}}], "kwarg": nul...
def _server_state_changed(self, state, *args): # protect from calling this twice in a row for the same state # because we have to call this manually on start and can't # be sure if the signal fires as well if state == self._last_server_state: return self._last_server_...
21,755
[ -0.04786740615963936, 0.07660624384880066, -0.003342326730489731, -0.006414508447051048, -0.0011804477544501424, 0.013576227240264416, 0.009730970486998558, -0.0212437491863966, -0.015001673251390457, 0.028876783326268196, -0.003761913860216737, -0.04411986470222473, 0.023887721821665764, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rule", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _has_nonmatch_ref(rule): for r in rule.nodes: if r.root: _determine_rule_type(r._tx_class) result = r._tx_class._tx_type != RULE_MATCH else: result = _has_nonmatch_...
21,756
[ -0.041539259254932404, 0.09025926887989044, 0.023769183084368706, -0.026905078440904617, -0.010333686135709286, 0.04108478128910065, -0.024087317287921906, -0.03604007884860039, -0.016645245254039764, 0.05953657627105713, 0.020201532170176506, -0.048674557358026505, 0.015088658779859543, 0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def _resolve_cls(cls): if cls in resolved_classes: return resolved_classes[cls] metamodel = model_parser.metamodel to_resolve = cls if isinstance(cls, ClassCrossRef): if cls.cls_name not in metamodel: line, col = gram...
21,757
[ -0.03512675687670708, 0.04725879430770874, 0.00448238430544734, -0.012461577542126179, -0.027510670945048332, 0.007646599784493446, -0.005022467114031315, 0.000656414486002177, -0.01591566763818264, 0.04171760007739067, -0.017392504960298538, -0.028950892388820648, -0.009282105602324009, 0...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "rule", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "inh_by", "annotation": null, "type_comment": null}}], "kwarg": nu...
def _add_reffered_classes(rule, inh_by): for r in rule.nodes: if r.root: if hasattr(r, '_tx_class'): _determine_rule_type(r._tx_class) if r._tx_class._tx_type != RU...
21,758
[ 0.014586551114916801, 0.058968327939510345, 0.023618437349796295, -0.01440880261361599, -0.03312802314758301, 0.026173584163188934, -0.005082518793642521, -0.019341345876455307, -0.0012331356992945075, 0.029950756579637527, 0.028795385733246803, -0.06025701016187668, 0.025618117302656174, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def textx_rule_SA(parser, node, children): if len(children) > 2: rule_name, rule_params, rule = children else: rule_name, rule = children rule_params = {} if rule.rule_name.startswith('__asgn') or\ ((isinstance(rule, Match) or isinstance(rule, RuleCrossRef)) and ...
21,759
[ 0.03424593806266785, 0.03973204270005226, -0.021121494472026825, -0.03215700015425682, -0.052033569663763046, -0.03310651704668999, -0.00846653338521719, -0.00015833537327125669, 0.015371636487543583, 0.04907951503992081, -0.0002612822281662375, -0.05937650799751282, 0.007400962989777327, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def rule_params_SA(parser, node, children): params = {} for name, value in children[0].items(): if name not in ['skipws', 'ws']: raise TextXSyntaxError( 'Invalid rule param "{}" at {}.' .format(name, parser.pos_to_linecol(node.position))) if name == '...
21,760
[ 0.024060873314738274, 0.04208048805594444, 0.008541089482605457, -0.0409138984978199, -0.040226444602012634, 0.004163780715316534, -0.008666080422699451, -0.02595657855272293, -0.012842881493270397, 0.020102806389331818, 0.020748596638441086, -0.052496448159217834, -0.001178956707008183, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def rule_name_SA(parser, node, children): rule_name = str(node) if parser.debug: parser.dprint("Creating class: {}".format(rule_name)) # If a class is given by the user use it. Else, create new class. if rule_name in parser.metamodel.user_classes: cls = parser.metamodel.user_classes[r...
21,761
[ 0.027121130377054214, -0.008888579905033112, 0.00866931676864624, -0.02266840822994709, -0.01643909327685833, 0.00715696532279253, -0.000882673601154238, -0.0004532838356681168, 0.004559543449431658, 0.03969220444560051, -0.027750808745622635, -0.09026884287595749, 0.03166380897164345, -0....
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def expression_SA(parser, node, children): if len(children) > 1: if children[0] == '!': return Not(nodes=[children[1]]) else: return And(nodes=[children[1]]) else: return children[0]
21,762
[ 0.029152177274227142, 0.04549785330891609, -0.02229885943233967, -0.03731478750705719, -0.022564807906746864, -0.01147675234824419, 0.0002132072695530951, -0.010576614178717136, 0.022462520748376846, 0.031279776245355606, 0.007103925570845604, -0.05155332386493683, -0.0018143394263461232, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def rule_param_SA(parser, node, children): if len(children) > 1: param_name, param_value = children else: param_name = children[0] param_value = True if param_name.startswith('no'): param_name = param_name[2:] param_value = False if parser.debug: ...
21,763
[ 0.045480359345674515, 0.04010973498225212, 0.03958853706717491, -0.006599977612495422, -0.05225595831871033, 0.05329836159944534, 0.02334069274365902, -0.02345399744808674, 0.03526030853390694, 0.05311707407236099, -0.0034019628074020147, -0.04863022267818451, -0.024496397003531456, -0.016...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def repeat_modifiers_SA(parser, node, children): modifiers = {} for modifier in children: if isinstance(modifier, Match): # Separator modifier.rule_name = 'sep' modifiers['sep'] = modifier elif type(modifier) == tuple: modifiers['multiplicity'] = m...
21,764
[ 0.023762712255120277, 0.04986853525042534, -0.003550591180101037, -0.013495009392499924, -0.027807898819446564, 0.06330828368663788, 0.02939944714307785, 0.007570910267531872, 0.019839100539684296, 0.06825976818799973, 0.013682900927960873, -0.05499686300754547, 0.019562790170311928, -0.01...
18
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def repeatable_expr_SA(parser, node, children): expr = children[0] rule = expr repeat_op = False suppress = False if len(children) > 1: # We can have repeat operator and/or suppression operator if len(children) > 2: repeat_op = children[1] suppress = True ...
21,765
[ 0.013973294757306576, 0.03815906494855881, 0.011727397330105305, -0.009513282217085361, -0.03364608436822891, 0.023624297231435776, -0.021431369706988335, -0.031145934015512466, 0.009052448906004429, 0.058774709701538086, 0.013697854243218899, -0.03381558507680893, 0.02743808552622795, 0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def re_match_SA(parser, node, children): try: to_match = children[0] except: to_match = '' regex = RegExMatch(to_match, ignore_case=parser.metamodel.ignore_case) try: regex.compile() except Exception as e: line, col = parser.pos_to_linecol(node[1].position) ra...
21,766
[ 0.013014250434935093, 0.037566255778074265, 0.021272076293826103, -0.01444855984300375, -0.025838665664196014, -0.005821609403938055, -0.013499383814632893, -0.029951758682727814, -0.0006581608904525638, 0.07812768220901489, 0.0017375183524563909, -0.06614698469638824, 0.015060250647366047, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def str_match_SA(parser, node, children): try: to_match = children[0] except: to_match = '' # Support for autokwd metamodel param. if parser.metamodel.autokwd: match = parser.keyword_regex.match(to_match) if match and match.span() == (0, len(to_match)): regex...
21,767
[ -0.0067815473303198814, -0.028625139966607094, 0.007240903563797474, -0.027585545554757118, -0.03856173902750015, 0.012765265069901943, 0.01445762999355793, -0.003750401083379984, 0.03952880576252937, 0.015545578673481941, 0.012946589849889278, -0.01712914928793907, -0.03099445067346096, -...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"arg...
def step(): GPIO.output(a_pin, False) t1 = time.time() while GPIO.input(b_pin): pass t2 = time.time() time.sleep(0.1) GPIO.output(a_pin, True) time.sleep(0.1) return (t2 - t1) * 1000000
21,768
[ 0.009447292424738407, 0.08120651543140411, 0.0042052618227899075, -0.030066298320889473, -0.03139928728342056, 0.026278918609023094, -0.009680036455392838, -0.017476962879300117, 0.016292084008455276, -0.01928601786494255, -0.009616561233997345, -0.06144442781805992, 0.02092580497264862, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "parser", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}, {"_type": "a...
def obj_ref_SA(parser, node, children): # A reference to some other class instance will be the value of # its "name" attribute. class_name = children[0] if class_name in BASE_TYPE_NAMES: line, col = parser.pos_to_linecol(node.position) raise TextXSemanticError( 'Primitive typ...
21,769
[ -0.02756025642156601, -0.010304609313607216, -0.018746739253401756, -0.03640703484416008, 0.03188386932015419, -0.04039806127548218, 0.015986278653144836, -0.024234401062130928, -0.025209985673427582, 0.022216714918613434, -0.0017668608343228698, 0.00145506183616817, 0.07875626534223557, -...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def toProtocolTreeNode(self): attribs = {} if self._type: attribs["type"] = self._type if self.name: attribs["name"] = self.name if self._from: attribs["from"] = self._from if self.last: attribs["last"] = self.last return s...
21,770
[ 0.01695454679429531, -0.004062958061695099, -0.02032756805419922, -0.048040010035037994, -0.03314249590039253, 0.01710786484181881, 0.0025856641586869955, 0.01133923139423132, -0.025208229199051857, 0.03398575261235237, 0.03329581394791603, -0.016852334141731262, -0.08616537600755692, -0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Global", "_fields": {"names": ["threshold"]}}, {"_type": "Expr...
def calibrate(): global threshold print("Wait! Calibrating") n = 10 maximum = 0 for i in range(1, n): reading = step() if reading > maximum: maximum = reading threshold = maximum * 1.15 print(threshold) print("Calibration Complete")
21,771
[ 0.026206044480204582, 0.05932224169373512, 0.0013916278257966042, 0.09270110726356506, -0.011244150809943676, 0.0006806600722484291, -0.003167153103277087, -0.008450793102383614, -0.00499066524207592, 0.03867260366678238, -0.026569737121462822, -0.029459068551659584, -0.007662792690098286, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "invalid"}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"...
class USZipCodeField(RegexField): default_error_messages = { 'invalid': _('Enter a zip code in the format XXXXX or XXXXX-XXXX.'), } def __init__(self, *args, **kwargs): super(USZipCodeField, self).__init__(r'^\d{5}(?:-\d{4})?$', max_length=None, min_length=None, *args, **kwargs)
21,772
[ 0.028789633885025978, -0.005809652153402567, 0.006396294571459293, 0.0012844629818573594, 0.004917072597891092, 0.01587088592350483, -0.00859778095036745, -0.020904654636979103, 0.006964012980461121, 0.061263129115104675, -0.014256041496992111, -0.00000329875479110342, 0.046477217227220535, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def __str__(self): out = "Presence:\n" if self._type: out += "Type: %s\n" % self._type if self.name: out += "Name: %s\n" % self.name if self._from: out += "From: %s\n" % self._from if self.last: out += "Last seen: %s\n" % self.last...
21,773
[ 0.031039614230394363, -0.007681362330913544, 0.022494295611977577, 0.06195356324315071, 0.01492289174348116, -0.020001910626888275, 0.008487721905112267, -0.007210113108158112, 0.02316451631486416, 0.04683170095086098, -0.022619962692260742, -0.0350399985909462, -0.030997727066278458, 0.00...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "invalid"}}], "values": [{"_type": "Call", "_fields": {"args": [{"_type": "Constant", "_fields": {"...
class USPhoneNumberField(CharField): default_error_messages = { 'invalid': _('Phone numbers must be in XXX-XXX-XXXX format.'), } def clean(self, value): super(USPhoneNumberField, self).clean(value) if value in EMPTY_VALUES: return u'' value = re.sub('(\(|\)|\s+)'...
21,774
[ 0.029354814440011978, -0.029489777982234955, 0.004268257413059473, 0.040714338421821594, 0.009486891329288483, -0.02829759009182453, 0.018703851848840714, 0.004122045822441578, 0.04575302079319954, 0.06293851882219315, 0.008733338676393032, -0.02960224822163582, -0.051376547664403915, -0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul...
def clean(self, value): super(USPhoneNumberField, self).clean(value) if value in EMPTY_VALUES: return u'' value = re.sub('(\(|\)|\s+)', '', smart_unicode(value)) m = phone_digits_re.search(value) if m: return u'%s-%s-%s' % (m.group(1), m.group(2), m.group(...
21,775
[ 0.05182035267353058, -0.03640636429190636, 0.04780782386660576, 0.04323256015777588, 0.02132268063724041, -0.010526773519814014, -0.0008525096345692873, -0.0011759280459955335, 0.020221680402755737, 0.07770606130361557, 0.02060091495513916, -0.03219810500741005, -0.040125295519828796, -0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "value", "annotation": null, "type_comment": null}}], "kwarg": nul...
def clean(self, value): super(USSocialSecurityNumberField, self).clean(value) if value in EMPTY_VALUES: return u'' match = re.match(ssn_re, value) if not match: raise ValidationError(self.error_messages['invalid']) area, group, serial = match.groupdict()['...
21,776
[ -0.017159970477223396, 0.007261721417307854, -0.01754305697977543, -0.022264020517468452, -0.004949124995619059, -0.05593046545982361, 0.0036787462886422873, -0.030173607170581818, -0.02868633344769478, -0.03301294520497322, -0.003918174654245377, -0.030601760372519493, -0.001509807072579860...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "image", "annotation": null, "type_comment": null}}, {"_type": "ar...
def image_to_html(self, image, alt_text, extra_attributes=''): try: rendition = image.get_rendition(self.filter_spec) except SourceImageIOError: # Image file is (probably) missing from /media/original_images - generate a dummy # rendition so that we just output a brok...
21,777
[ -0.018252886831760406, -0.005304439924657345, -0.028550637885928154, -0.06573967635631561, -0.021913224831223488, -0.009870711714029312, 0.011048120446503162, -0.02547595277428627, -0.006460496690124273, 0.08452940732240677, 0.018936149775981903, -0.041727855801582336, -0.02007085457444191, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "params", "annotation": null, "type_comment": null}}], "kwarg": ...
def process(folder, params): context = settings.CONTEXT site = context['site'] node = params['node'] meta = params.get('meta', {}) categories = {} for post in node.walk_pages(): if hasattr(post, 'categories') and post.categories != None: for ca...
21,778
[ 0.04705706238746643, -0.0009531233226880431, -0.04497413709759712, -0.029012145474553108, 0.00943160429596901, -0.02896963618695736, 0.013549627736210823, -0.004540453664958477, 0.001111202291212976, 0.05772672966122627, 0.013634645380079746, -0.03169018775224686, -0.02233828976750374, -0....
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "name", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, name="", meta={}): self.posts = [] self.feed_url = None self.archive_url = None self.name = name for key, value in meta.iteritems(): if not hasattr(Category, key): setattr(Category, key, None) setattr(self, key, value)
21,779
[ -0.003242203500121832, -0.0008787548867985606, -0.01664465107023716, -0.06763540953397751, -0.0021538110449910164, -0.04358164593577385, 0.038688190281391144, 0.018402161076664925, -0.005378784146159887, 0.029406700283288956, -0.023824021220207214, -0.047234512865543365, 0.001237723394297063...
15
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "params", "annotation...
class ResourcePairer(object): @staticmethod def process(folder, params): site = settings.CONTEXT['site'] node = params['node'] # fetch or setup content and pairs content_name = params.get('name', 'media_content') content = site.__dict__.setdefault(content_name, {}) ...
21,780
[ -0.05567513778805733, 0.02379549667239189, -0.03601543977856636, -0.030954064801335335, -0.05023884400725365, -0.05305071920156479, 0.01717587374150753, 0.01992916874587536, -0.02050326019525528, 0.06275168806314468, 0.03404712677001953, -0.028821725398302078, -0.0011825987603515387, -0.01...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "params", "annotation": null, "type_comment": null}}], "kwarg": ...
def process(folder, params): context = settings.CONTEXT site = context['site'] node = params['node'] try: varName = params['variable'] path = params['path'] params['injections'] = { varName: path } except KeyError: pass for...
21,781
[ 0.057470228523015976, 0.010765346698462963, -0.027579104527831078, -0.0251845121383667, 0.024462005123496056, 0.004322136752307415, -0.007854677736759186, 0.016927294433116913, -0.03348301351070404, -0.027579104527831078, 0.0018359405221417546, -0.04227694869041443, 0.023512424901127815, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "key", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __setattr__(self, key, value): parts = key.split('.', 1) if len(parts) == 1: self.__dict__[key] = value else: target = getattr(self, parts[0], None) if target is None: target = RecursiveAttributes() self.__dict__[parts[0]] =...
21,782
[ -0.029000813141465187, -0.0015501325251534581, -0.02105082757771015, -0.06694966554641724, -0.024595625698566437, -0.05511072278022766, 0.04446485638618469, 0.013295863755047321, -0.02826661616563797, 0.04813584312796593, 0.025765754282474518, -0.03636573627591133, -0.007502583786845207, -...
14
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "params", "annotation": null, "type_comment": null}}], "kwarg": ...
def process(folder, params): site = settings.CONTEXT['site'] node = params['node'] # fetch or setup content and pairs content_name = params.get('name', 'media_content') content = site.__dict__.setdefault(content_name, {}) variable = params.get('variable', 'media') ...
21,783
[ 0.045955050736665726, 0.004662253428250551, -0.030198456719517708, -0.01865912601351738, 0.041666992008686066, -0.019427740946412086, -0.04162653908133507, 0.012712477706372738, -0.01303610485047102, -0.024514755234122276, -0.008267661556601524, -0.014654240570962429, 0.050404924899339676, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "key", "annotation": null, "type_comment": null}}], "kwarg": null,...
def __getattr__(self, key): parts = key.split('.', 1) try: if len(parts) == 1: return self.__dict__[key] else: return getattr(self.__dict__[parts[0]], parts[1]) except KeyError: raise AttributeError('Unknown attribute: %s' % (ke...
21,784
[ 0.03371470049023628, 0.019731596112251282, 0.04653342068195343, -0.03937927260994911, -0.012367651797831059, -0.004985348787158728, 0.017581157386302948, -0.039735931903123856, 0.007757318206131458, -0.01747625693678856, 0.028301885351538658, -0.06470201164484024, -0.01656363159418106, -0....
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "values", "annotation":...
class AttributeMapper(RecursiveAttributes): def __init__(self, values, mapping, internal_mapping={}): if values is None: return for tag, name in mapping.iteritems(): value = values.get(tag) if value is None: ...
21,785
[ 0.06438479572534561, 0.015268873423337936, 0.04511543735861778, -0.012011932209134102, -0.017667070031166077, -0.0013372045941650867, 0.040046755224466324, -0.010320627130568027, 0.02934388443827629, 0.009503774344921112, 0.05872965604066849, -0.010571966879069805, -0.010587675496935844, -...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "values", "annotation": null, "type_comment": null}}, {"_type": "a...
def __init__(self, values, mapping, internal_mapping={}): if values is None: return for tag, name in mapping.iteritems(): value = values.get(tag) if value is None: continue if name i...
21,786
[ -0.03565403074026108, 0.00005116460670251399, -0.0014944033464416862, -0.04037081077694893, -0.036645762622356415, -0.028470009565353394, 0.031179135665297508, 0.011108624748885632, -0.013654477894306183, 0.05829457938671112, 0.027357332408428192, -0.017282770946621895, 0.013073951005935669,...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "folder", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "params", "annotation": null, "type_comment": null}}], "kwarg": ...
def process(folder, params): context = settings.CONTEXT site = context['site'] node = params['node'] inclusions = params['include'] for inc_key, info in inclusions.iteritems(): for p in node.walk_pages(): if p.listing: value = get...
21,787
[ 0.01673714444041252, 0.014999724924564362, -0.025042012333869934, -0.01929694414138794, 0.013331802561879158, 0.003686225973069668, -0.008901381865143776, -0.016934052109718323, 0.011519093997776508, 0.017130959779024124, 0.0380842462182045, -0.041674911975860596, -0.0031707913149148226, -...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "f", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}},...
def non_mutating(f): @wraps(f) def wrapper(*args, **kwargs): copied_args = deepcopy(args) copied_kwargs = deepcopy(kwargs) return f(*copied_args, **copied_kwargs) return wrapper
21,788
[ 0.007305626757442951, -0.001237771357409656, 0.011234607547521591, -0.03521277755498886, -0.023243622854351997, -0.00906512700021267, -0.014645418152213097, 0.017424175515770912, -0.0516120046377182, -0.028288662433624268, 0.03416505083441734, -0.015955079346895218, 0.03396005928516388, -0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data_path_of_file", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "target_event_id", "annotation": null, "type_comment"...
def get_specific_id(data_path_of_file, target_event_id): #look for the event with a specific id in the file, and return that file=h5py.File(data_path_of_file , 'r') batchsize = 320 batch_no = 0 while True: info = file["y"][batchsize*batch_no:batchsize*(batch_no+1)] event_ids = i...
21,789
[ 0.013263442553579807, -0.03724374622106552, 0.0009967477526515722, -0.0001407582894898951, -0.03202325478196144, -0.03348753973841667, 0.008451465517282486, 0.00036341833765618503, -0.020128600299358368, 0.030261870473623276, 0.014611008577048779, 0.008090700022876263, -0.007613216061145067,...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "hists", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "zero_center_file", "annotation": null, "type_comment": null}}, {...
def predict_on_hists(hists, zero_center_file, autoencoder_model): #get predicted image of a batch of hists from autoencoder autoencoder = load_model(autoencoder_model) zero_center_image = np.load(zero_center_file) #zero center and add 1 to the end of the dimensions zero_centered_hists = np.subtract(...
21,790
[ -0.005065260920673609, 0.009609253145754337, -0.016396282240748405, -0.028706656768918037, 0.017228206619620323, 0.03397199884057045, 0.0010030480334535241, -0.0014993067597970366, -0.011225713416934013, 0.05930883809924126, 0.014553410932421684, -0.03418261557817459, -0.02895939350128174, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class TreeParser(object): def __init__(self): self.next_id = 0 def size(self): return self.next_id def get_paths(self): return self.paths def get_codes(self): return self.codes def parse(self, tree): self.next_id = 0 self.path = [] self.co...
21,791
[ -0.009620528668165207, 0.002797806868329644, 0.013481829315423965, -0.03222113475203514, 0.044895801693201065, 0.011878407560288906, -0.0031141280196607113, -0.011496640741825104, 0.018684769049286842, 0.05911934748291969, 0.030737698078155518, -0.008344336412847042, 0.007515356410294771, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "node", "annotation": null, "type_comment": null}}], "kwarg": null...
def _parse(self, node): if isinstance(node, tuple): # internal node if len(node) != 2: raise ValueError( 'All internal nodes must have two child nodes') left, right = node self.path.append(self.next_id) self.next_id ...
21,792
[ 0.024833131581544876, 0.005884178448468447, -0.02001626417040825, -0.023335544392466545, 0.03676912933588028, 0.013176536187529564, 0.01889866217970848, -0.021636787801980972, 0.02143562026321888, 0.03283516690135002, 0.04208891838788986, -0.039987824857234955, -0.011360432021319866, -0.04...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tree", "annotation": null, "type_comment": null}}], "kwarg": null...
def parse(self, tree): self.next_id = 0 self.path = [] self.code = [] self.paths = {} self.codes = {} self._parse(tree) assert(len(self.path) == 0) assert(len(self.code) == 0) assert(len(self.paths) == len(self.codes))
21,793
[ 0.00012174269068054855, 0.005995693150907755, 0.031097277998924255, -0.02501552179455757, -0.006919431034475565, 0.019530467689037323, 0.015043738298118114, -0.009541471488773823, -0.04261818900704384, 0.09065258502960205, 0.013299536891281605, -0.016661714762449265, -0.00898493267595768, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "tree", "annotation": null, "type_comment": null}}], "kwarg": null...
def __init__(self, tree): parser = TreeParser() parser.parse(tree) paths = parser.get_paths() codes = parser.get_codes() n_vocab = max(paths.keys()) + 1 self.paths = numpy.concatenate( [paths[i] for i in range(n_vocab) if i in paths]) self.codes = num...
21,794
[ 0.0017518684035167098, 0.02972312830388546, 0.015364957973361015, -0.034871477633714676, 0.02430020272731781, 0.0008008541190065444, -0.002621367108076811, -0.026199370622634888, 0.005668903235346079, 0.042124927043914795, 0.027618026360869408, 0.0026042060926556587, 0.02004423551261425, 0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "in_types", "annotation": null, "type_comment": null}}], "kwarg": ...
def check_type_forward(self, in_types): type_check.expect(in_types.size() == 3) x_type, t_type, w_type = in_types type_check.expect( x_type.dtype == numpy.float32, x_type.ndim == 2, t_type.dtype == numpy.int32, t_type.ndim == 1, x_type...
21,795
[ 0.013628048822283745, 0.010255980305373669, 0.05325422063469887, -0.01849687285721302, -0.014373513869941235, -0.029795339331030846, 0.02574186958372593, 0.02234068140387535, 0.00800793431699276, -0.002993511501699686, -0.0179494209587574, 0.026464039459824562, -0.037855688482522964, -0.03...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "inputs", "annotation": null, "type_comment": null}}, {"_type": "a...
def backward_cpu(self, inputs, grad_outputs): x, t, W = inputs gloss, = grad_outputs gx = numpy.empty_like(x) gW = numpy.zeros_like(W) for i, (ix, it) in enumerate(six.moves.zip(x, t)): gx[i] = self._backward_cpu_one(ix, it, W, gloss, gW) return gx, None, gW
21,796
[ 0.030548429116606712, -0.00772802485153079, 0.048028916120529175, -0.005770258605480194, -0.004285265691578388, -0.0438830591738224, -0.00880085676908493, 0.030063532292842865, 0.02299617789685726, 0.037021785974502563, -0.0029851391445845366, 0.054502274841070175, -0.017419878393411636, -...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _forward_cpu_one(self, x, t, W): begin = self.begins[t] end = self.begins[t + 1] w = W[self.paths[begin:end]] wxy = w.dot(x) * self.codes[begin:end] loss = numpy.logaddexp(0.0, -wxy) # == log(1 + exp(-wxy)) return numpy.sum(loss)
21,797
[ 0.050771310925483704, -0.013095592148602009, 0.05532830208539963, -0.0344996340572834, 0.01716926507651806, -0.02310716174542904, 0.03606466203927994, 0.016087554395198822, 0.023521432653069496, 0.03309571370482445, -0.02989661507308483, 0.030978325754404068, -0.013417803682386875, -0.0506...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "inputs", "annotation": null, "type_comment": null}}], "kwarg": nu...
def forward_gpu(self, inputs): x, t, W = inputs max_length = cuda.reduce( 'T t, raw T begins', 'T out', 'begins[t + 1] - begins[t]', 'max(a, b)', 'out = a', '0', 'binary_hierarchical_softmax_max_length')(t, self.begins) max_length = cuda.to_cpu(max_length)[()]...
21,798
[ 0.030387768521904945, 0.019838519394397736, 0.05830498784780502, 0.008307225070893764, -0.021592609584331512, -0.020876150578260422, 0.009320151060819626, 0.012612159363925457, 0.009950141422450542, 0.0225931815803051, 0.0005948621546849608, 0.037206485867500305, -0.03152422234416008, -0.0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "x", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _backward_cpu_one(self, x, t, W, gloss, gW): begin = self.begins[t] end = self.begins[t + 1] path = self.paths[begin:end] w = W[path] wxy = w.dot(x) * self.codes[begin:end] g = -gloss * self.codes[begin:end] / (1.0 + numpy.exp(wxy)) gx = g.dot(w) gw =...
21,799
[ 0.020368123427033424, 0.005277630873024464, 0.055320825427770615, -0.017242854461073875, 0.00007184522837633267, -0.026439044624567032, 0.05421920120716095, 0.0005253682611510158, 0.00017437436326872557, 0.021230265498161316, -0.03743136301636696, 0.025337418541312218, -0.0035982485860586166...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "inputs", "annotation": null, "type_comment": null}}, {"_type": "a...
def backward_gpu(self, inputs, grad_outputs): x, t, W = inputs gloss, = grad_outputs n_in = x.shape[1] gx = cuda.cupy.zeros_like(x) gW = cuda.cupy.zeros_like(W) cuda.elementwise( '''T wxy, raw T x, raw T w, raw int32 ts, raw int32 paths, raw T cod...
21,800
[ 0.05401664972305298, -0.013904666528105736, 0.0001611000334378332, -0.004153942223638296, 0.019121482968330383, -0.03245106711983681, 0.10129662603139877, 0.007404183503240347, -0.02688509225845337, 0.04526718333363533, 0.00046821704017929733, -0.004975487943738699, -0.03727765008807182, -...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "in_size", "annotation": null, "type_comment": null}}, {"_type": "...
def __init__(self, in_size, tree): # This function object is copied on every forward computation. super(BinaryHierarchicalSoftmax, self).__init__() self._func = BinaryHierarchicalSoftmaxFunction(tree) with self.init_scope(): self.W = variable.Parameter(uniform.Uniform(1), ...