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
16,901
[ 0.019515756517648697, 0.01530089508742094, 0.020464438945055008, -0.023540882393717766, 0.018011417239904404, -0.01325445156544447, -0.03743230551481247, 0.00939873419702053, 0.03277020901441574, 0.04152519255876541, 0.06179989501833916, 0.015436421148478985, 0.03396283835172653, 0.0411999...
23
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "fmt", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cmd", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def get_handler(fmt, cmd, cwd): if cmd not in ['pack','unpack']: print(usage) fail('invalid command; use "pack" or "unpack"') h = None if fmt == 'mdat': load_charmap(cwd) if cmd == 'unpack': h = read_mdat elif cmd == 'pack': h = write_mdat elif fmt == 'rdat': load_charmap(cwd) if cmd == ...
16,902
[ 0.0328841432929039, 0.015938617289066315, 0.048798199743032455, -0.046882618218660355, -0.03367002308368683, -0.028831951320171356, 0.008110521361231804, 0.006686114706099033, -0.005789720918983221, 0.03367002308368683, 0.008006146177649498, -0.009749816730618477, -0.0037359970156103373, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "If", "_fields": {"body": [{"_type": "Assign", "_fields": {"val...
def main(): if len(sys.argv) == 3: a,b = sys.argv[1], sys.argv[2] if (a,b) == ('charmap', 'create'): save_default_charmap(os.getcwd()) return if len(sys.argv) < 3: print(usage) sys.exit(1) fmt = sys.argv[1] cmd = sys.argv[2] args = sys.argv[3:] call(fmt,cmd,args)
16,903
[ 0.009071297943592072, 0.005648691672831774, 0.004944692365825176, -0.03149911016225815, -0.04358675330877304, 0.020991984754800797, -0.029161719605326653, -0.009377384558320045, 0.06615925580263138, 0.04133840650320053, -0.005865735001862049, -0.04603544622659683, 0.005011474713683128, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def handle_args(): parser = argparse.ArgumentParser(description=sys.modules[__name__].__doc__) parser.add_argument('-u', '--api-url', type=str, required=True, help='Base URL of AMY API used for gathering information.') parser.add_argument('-o', '--output', default=sys.stdout, ...
16,904
[ -0.02101873606443405, -0.02237805537879467, -0.010549944825470448, 0.01570318639278412, -0.02284468710422516, -0.01619010604918003, -0.0202376339584589, -0.014110550284385681, 0.005726388189941645, 0.014759778045117855, -0.025989381596446037, -0.04617629572749138, 0.011686092242598534, -0....
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "base_url", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "url", "annotation": null, "type_comment": null}}, {"_type": "...
def fetch_info(base_url, url, tags=None): address = base_url + url if tags: query_params = [('tag', tag) for tag in tags] query = urllib.parse.urlencode(query_params) address = '{address}?{query}'.format(address=address, query=query) return yaml.load(requests.get(address, auth=(AMY_...
16,905
[ -0.023241695016622543, 0.052248142659664154, 0.027199886739253998, -0.0036740147043019533, 0.035380151122808456, 0.023972438648343086, 0.032700758427381516, 0.019202308729290962, -0.02634735405445099, -0.005861169658601284, -0.010950999334454536, 0.01409725472331047, 0.017740821465849876, ...
12
{"_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": "dbname", "annotation":...
class DocumentSFTPTransport(Transport): def __init__( self, dbname, sock, default_window_size=DEFAULT_WINDOW_SIZE, default_max_packet_size=DEFAULT_MAX_PACKET_SIZE, gss_kex=False, gss_deleg_creds=True ): self.dbname = dbname super(DocumentSFTPTransport, self).__init__( ...
16,906
[ 0.03091057948768139, 0.025177164003252983, 0.029830370098352432, -0.011788812465965748, -0.030474340543150902, 0.028542429208755493, -0.012110797688364983, -0.03390192613005638, 0.022040406242012978, 0.06123950704932213, 0.003134162398055196, -0.04545184597373009, 0.014447786845266819, -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": "module", "annotation": null, "type_comment": null}}, {"_type": "a...
def __init__(self, module, subspec='config', options='options'): self._module = module self.argument_spec = InterfacesArgs.argument_spec spec = deepcopy(self.argument_spec) if subspec: if options: facts_argument_spec = spec[subspec][options] else: ...
16,907
[ -0.030869968235492706, -0.010833095759153366, 0.012020880356431007, 0.00030433101346716285, 0.010037093423306942, -0.018631432205438614, 0.016517050564289093, 0.0009988897945731878, 0.02101943828165531, 0.018793119117617607, -0.006436425726860762, 0.003846308682113886, 0.01820855587720871, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def test_set_global_context(): options = FakeOptions() options.tags = [u'production', u'webservers'] options.check_mode = True options.start_at_task = u'Start with くらとみ' expected = frozenset((('tags', (u'production', u'webservers')), ('check_mode', True), ...
16,908
[ -0.022121885791420937, -0.050166789442300797, 0.005843516904860735, 0.005070840939879417, -0.017530551180243492, 0.038976654410362244, 0.002469581551849842, 0.020293300971388817, 0.015781471505761147, -0.001116156461648643, 0.010255968198180199, 0.04396550729870796, -0.027528131380677223, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def get_current_minute(): now = dt.utcnow() current_dt = dt(now.year, now.month, now.day, now.hour, now.minute) current_timestamp = ( time.mktime(dt.timetuple(current_dt))) return int(current_timestamp * 1000)
16,909
[ 0.031842708587646484, -0.011619484052062035, 0.016697464510798454, -0.05104589834809303, 0.04301869869232178, 0.03847290948033333, 0.0486953929066658, -0.006868578493595123, -0.019624508917331696, 0.007068149745464325, -0.019524723291397095, -0.020433882251381874, 0.0282725989818573, 0.030...
9
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "cluster", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"...
class TwitterCassandraConnector(object): cluster = None session = None def create_schema(self): trending_tweets_keyspace = \ """CREATE KEYSPACE IF NOT EXISTS trending WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 1 };""" trending_...
16,910
[ 0.0005377710913307965, -0.07458103448152542, 0.0017628520727157593, 0.017916850745677948, 0.0018526386702433228, 0.04342129826545715, -0.0005823482060804963, 0.026081105694174767, -0.006990707945078611, 0.012221092358231544, -0.026020405814051628, 0.038585469126701355, -0.02199392020702362, ...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def get_current_day(): now = dt.utcnow() current_dt = dt(now.year, now.month, now.day) current_timestamp = ( time.mktime(dt.timetuple(current_dt))) return int(current_timestamp * 1000)
16,911
[ 0.013033850118517876, -0.02740282192826271, -0.006615417543798685, -0.03793058171868324, 0.059577059000730515, 0.024469930678606033, -0.011140603572130203, -0.008486776612699032, -0.030357597395777702, -0.018647925928235054, -0.02077098749577999, -0.016787510365247726, -0.0015745131531730294...
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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __ge__(self, other): l = sort_key(self.sort) r = sort_key(other.sort) if l > r: return 1 if l == r: return self.sort_idx >= other.sort_idx return 0
16,912
[ 0.02959953248500824, 0.026014963164925575, -0.07263583689928055, -0.005521740298718214, 0.029341958463191986, 0.02036980167031288, -0.060143500566482544, 0.004778532311320305, -0.03193916007876396, -0.00570955453440547, 0.012052311562001705, -0.025242241099476814, 0.049840547144412994, 0.0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [], "func": {"_type": "Name", "_fields": {"id": "pyqtSignal", "ctx": {"_type": "Load", "_fields": {}}}}, "keywords": []}}, "targets": [{"_type": "Name", "_fi...
class BooksTableFilter(QObject): return_pressed_signal = pyqtSignal() def eventFilter(self, obj, event): if event.type() == QEvent.KeyPress and event.key() == Qt.Key_Return: self.return_pressed_signal.emit() return True return False
16,913
[ 0.015406633727252483, -0.03147248923778534, -0.021796824410557747, -0.04452931508421898, 0.0663474053144455, 0.02037205547094345, -0.014928166754543781, -0.010239191353321075, -0.026475166901946068, -0.00901112612336874, -0.023519305512309074, -0.011461939662694931, -0.00017593624943401664, ...
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": "other", "annotation": null, "type_comment": null}}], "kwarg": nul...
def __lt__(self, other): l = sort_key(self.sort) r = sort_key(other.sort) if l < r: return 1 if l == r: return self.sort_idx < other.sort_idx return 0
16,914
[ 0.012515462003648281, 0.029799677431583405, -0.031751446425914764, -0.013682498596608639, 0.013873651623725891, 0.025755291804671288, -0.05336174741387367, -0.0228175800293684, -0.022354789078235626, 0.0020196777768433094, 0.008450955152511597, -0.013591953553259373, 0.01514129526913166, 0...
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": "attach_to_Class", "ann...
class WidgetTabFilter(QObject): def __init__(self, attach_to_Class, which_widget, tab_signal): QObject.__init__(self, attach_to_Class) self.tab_signal = tab_signal self.which_widget = which_widget def eventFilter(self, obj, event): if event.type() == QEvent.KeyPress: ...
16,915
[ 0.03903478384017944, 0.03505794703960419, -0.06521241366863251, 0.028474928811192513, 0.013716228306293488, 0.003284269478172064, -0.013281865045428276, 0.034826286137104034, 0.004773170221596956, 0.02762550674378872, -0.01833978481590748, 0.005651549436151981, -0.004925197456032038, 0.035...
10
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "pyqtSignal", "ctx": {...
class WidgetFocusFilter(QObject): focus_entered_signal = pyqtSignal(object) def eventFilter(self, obj, event): if event.type() == QEvent.FocusIn: self.focus_entered_signal.emit(obj) return False
16,916
[ 0.028866639360785484, 0.0234653502702713, -0.061722610145807266, 0.01908380724489689, -0.004734531976282597, 0.051816511899232864, -0.04688587784767151, -0.006230532191693783, -0.008852735161781311, -0.013021363876760006, -0.00026018914650194347, 0.01173267513513565, 0.04728929325938225, 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": "obj", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def eventFilter(self, obj, event): if event.type() == QEvent.KeyPress: if event.key() == Qt.Key_Tab: self.tab_signal.emit(self.which_widget, True) return True if event.key() == Qt.Key_Backtab: self.tab_signal.emit(self.which_widget, False) ...
16,917
[ -0.0002586733317002654, 0.04169806092977524, 0.010804509744048119, -0.01020918507128954, -0.021216358989477158, -0.00856887549161911, -0.039240762591362, -0.0007754262187518179, -0.047448642551898956, 0.01398379635065794, 0.035339485853910446, -0.00762522267177701, 0.019747046753764153, 0....
15
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "object", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Name", "_fields": {"id": "pyqtSignal", "ctx": {...
class Quickview(QDialog, Ui_Quickview): change_quickview_column = pyqtSignal(object) reopen_quickview = pyqtSignal() tab_pressed_signal = pyqtSignal(object, object) def __init__(self, gui, row): self.is_pane = gprefs.get('quickview_is_pane', False) if not self.is_pane: ...
16,918
[ 0.012922823429107666, -0.001986336661502719, -0.007567517925053835, -0.04893150553107262, -0.03688480705022812, -0.029832009226083755, 0.011937184259295464, 0.01456555537879467, -0.008202707394957542, -0.0011095284717157483, -0.00812057126313448, -0.05458250269293785, 0.015343115665018559, ...
14
{"_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": "current_row", "annotation": null, "type_comment": null}}, {"_type...
def books_table_set_search_string(self, current_row, current_col): current = self.books_table.currentItem() if current is None: return if current.column() == 0: self.set_search_text('title:="' + current.text().replace('"', '\\"') + '"') elif current.column() == 1:...
16,919
[ -0.005724492482841015, 0.03838040307164192, 0.010240202769637108, 0.01322771143168211, -0.0242257509380579, -0.02735731191933155, -0.026079634204506874, -0.0027729966677725315, -0.038781244307756424, 0.023837437853217125, 0.01772463135421276, -0.0038111088797450066, 0.0357498936355114, 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": "gui", "annotation": null, "type_comment": null}}, {"_type": "arg"...
def __init__(self, gui, row): self.is_pane = gprefs.get('quickview_is_pane', False) if not self.is_pane: QDialog.__init__(self, gui, flags=Qt.Window) else: QDialog.__init__(self, gui) Ui_Quickview.__init__(self) self.setupUi(self) self.isClosed = ...
16,920
[ 0.005609565414488316, 0.023206016048789024, 0.015639914199709892, -0.023441296070814133, 0.012061184272170067, -0.010420417413115501, 0.02194293588399887, -0.0491858571767807, -0.04410876706242561, -0.011181981302797794, 0.01779458113014698, -0.018141308799386024, -0.0006385059677995741, 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": "mi", "annotation": null, "type_comment": null}}], "kwarg": null, ...
def book_was_changed(self, mi): if self.is_closed or self.current_column is None: return # There is an ordering problem when libraries are changed. The library # view is changed, triggering a book_was_changed signal. Unfortunately # this happens before the library_changed act...
16,921
[ 0.060948505997657776, -0.04230569303035736, -0.005152758210897446, 0.03752888739109039, 0.018089940771460533, 0.005429193843156099, -0.029921382665634155, 0.018808674067258835, 0.002165872370824218, -0.0018147992668673396, 0.0026289019733667374, 0.03613565117120743, 0.043743159621953964, 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": "in_widget", "annotation": null, "type_comment": null}}, {"_type":...
def tab_pressed(self, in_widget, isForward): if isForward: in_widget += 1 if in_widget >= len(self.tab_order_widgets): in_widget = 0 else: in_widget -= 1 if in_widget < 0: in_widget = len(self.tab_order_widgets) - 1 ...
16,922
[ 0.0007633350323885679, 0.058560822159051895, 0.014785287901759148, -0.007570700719952583, -0.011844057589769363, -0.02504662051796913, -0.008210385218262672, 0.0037490795366466045, -0.05629224702715874, 0.0307839997112751, 0.018662964925169945, -0.004563523456454277, -0.00661117397248745, ...
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": "idx", "annotation": null, "type_comment": null}}], "kwarg": null,...
def refresh(self, idx): if self.lock_qv.isChecked(): return bv_row = idx.row() self.current_column = idx.column() key = self.view.model().column_map[self.current_column] book_id = self.view.model().id(bv_row) if self.current_book_id == book_id and self.curre...
16,923
[ 0.03190596029162407, 0.014997271820902824, 0.0011341380886733532, -0.014323375187814236, -0.007829458452761173, -0.04325193539261818, 0.0035348962992429733, 0.0017536638770252466, -0.05219638720154762, 0.021172618493437767, 0.004015813581645489, -0.03197947517037392, 0.005529018584638834, ...
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": "selected_item", "annotation": null, "type_comment": null}}], "kwa...
def fill_in_books_box(self, selected_item): self.current_item = selected_item # Do a bit of fix-up on the items so that the search works. if selected_item.startswith('.'): sv = '.' + selected_item else: sv = selected_item sv = self.current_key + ':"=' + sv...
16,924
[ 0.016824429854750633, 0.031354084610939026, 0.001119579654186964, -0.018756253644824028, 0.024774176999926567, -0.028637824580073357, -0.00030056689865887165, 0.018323056399822235, -0.05676049739122391, -0.029878875240683556, 0.020629536360502243, -0.025663986802101135, 0.01980997435748577, ...
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": "row", "annotation": null, "type_comment": null}}], "kwarg": null,...
def select_book(self, row): book_id = int(self.books_table.item(row, self.title_column).data(Qt.UserRole)) self.view.select_rows([book_id]) modifiers = int(QApplication.keyboardModifiers()) if modifiers in (Qt.CTRL, Qt.SHIFT): em = find_plugin('Edit Metadata') if ...
16,925
[ 0.006474281195551157, 0.02337934821844101, 0.005797232035547495, 0.03414865955710411, -0.02657417394220829, 0.018502479419112206, -0.05547570437192917, 0.01004994660615921, -0.0754486471414566, 0.043309979140758514, -0.006294440012425184, -0.0052365511655807495, 0.026066387072205544, 0.068...
12
{"_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": {"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_commen...
def resizeEvent(self, *args): QDialog.resizeEvent(self, *args) # Do this if we are resizing for the first time to reset state. if self.is_pane and self.height() == 0: self.gui.quickview_splitter.set_sizes() if self.books_table_column_widths is not None: for c,w ...
16,926
[ 0.02575065940618515, 0.03361760452389717, 0.06104560196399689, 0.003862599143758416, 0.0058795372024178505, -0.01962011307477951, -0.027900485321879387, -0.012119347229599953, -0.022147931158542633, 0.00992817897349596, 0.011463768780231476, -0.02941245213150978, 0.000758935755584389, 0.05...
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 save_state(self): if self.is_closed: return self.books_table_column_widths = [] for c in range(0, self.books_table.columnCount()): self.books_table_column_widths.append(self.books_table.columnWidth(c)) gprefs['quickview_dialog_books_table_widths'] = self.books...
16,927
[ -0.03271524980664253, 0.01616404391825199, -0.0045115211978554726, -0.001992275007069111, 0.04230828210711479, -0.04245884716510773, -0.0389958918094635, 0.018841920420527458, 0.04310411587357521, 0.008227207697927952, 0.005237451288849115, -0.09696275740861893, -0.008727293461561203, 0.02...
9
{"_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": "request", "annotation"...
class FlatpageFallbackMiddleware(object): def process_response(self, request, response): if response.status_code != 404: return response # No need to check for a flatpage for non-404 responses. try: return flatpage(request, request.path) # Return the original response...
16,928
[ -0.021287089213728905, -0.02415200136601925, -0.0024040713906288147, 0.013457093387842178, 0.053508780896663666, -0.033671267330646515, -0.020739218220114708, 0.012475489638745785, 0.04602120444178581, 0.04853228107094765, 0.034470245242118835, -0.07327780872583389, 0.02499663643538952, 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": "request", "annotation": null, "type_comment": null}}, {"_type": "...
def process_response(self, request, response): if response.status_code != 404: return response # No need to check for a flatpage for non-404 responses. try: return flatpage(request, request.path) # Return the original response if any errors happened. Because this ...
16,929
[ 0.007517614867538214, -0.00511536980047822, 0.051298145204782486, -0.03758179396390915, -0.037883251905441284, -0.0035766763612627983, 0.017044952139258385, -0.0023849743884056807, 0.026503203436732292, -0.035823289304971695, 0.04232976213097572, -0.06677300482988358, 0.018929066136479378, ...
12
{"_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 TestCursorInstanciator(TestCase, ObjectMaker): def setUp(self): self.database_name = 'test_program_db' c = MongoClient(w=1) db = c.test_program_db self.test_collection = db.test_collection self.clearData() def tearDown(self): self.clearData() def clea...
16,930
[ 0.00814863108098507, 0.00512967212125659, 0.06861735880374908, -0.0421375036239624, -0.026134463027119637, 0.08089786767959595, -0.012088628485798836, -0.0220409594476223, -0.0054206945933401585, 0.04423542693257332, 0.032210756093263626, -0.03663685917854309, 0.015184340998530388, -0.0086...
14
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": "consul.up"}}, "targets": [{"_type": "Name", "_fields": {"id": "CONSUL_CHECK", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment"...
class ConsulCheck(AgentCheck): CONSUL_CHECK = 'consul.up' HEALTH_CHECK = 'consul.check' CONSUL_CATALOG_CHECK = 'consul.catalog' SOURCE_TYPE_NAME = 'consul' MAX_CONFIG_TTL = 300 # seconds MAX_SERVICES = 50 # cap on distinct Consul ServiceIDs to interrogate STATUS_SC = { 'passing':...
16,931
[ 0.025335995480418205, 0.02432405576109886, 0.0482233464717865, -0.014354566112160683, -0.07665763050317764, 0.0163284745067358, 0.03925330191850662, 0.0068961880169808865, 0.05991688370704651, -0.00006632076110690832, 0.05556928366422653, -0.04857315123081207, 0.038878511637449265, -0.0117...
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 test_failure_callbacks(self): self.test_collection.save(self.mkobj_participant()) cursor = CursorInstanciator(self.test_collection.find(), schedule_generator) def failed_callback(exception, item): self.assertEqual('participant', item['object-type']) self.asse...
16,932
[ 0.03125260770320892, -0.0002292752033099532, 0.07187880575656891, -0.033092282712459564, -0.007123272866010666, 0.07507634162902832, 0.013720924034714699, -0.008612534962594509, -0.0004657366662286222, 0.03385881707072258, 0.006488146260380745, -0.022798852995038033, 0.012297363951802254, ...
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, init_config, agentConfig, instances=None): AgentCheck.__init__(self, name, init_config, agentConfig, instances) if instances is not None and len(instances) > 1: raise Exception("Consul check only supports one configured instance.") self._local_config = None ...
16,933
[ 0.005663369782269001, -0.03453300520777702, 0.045523736625909805, -0.015575621277093887, 0.011034086346626282, 0.05033624544739723, -0.06100180745124817, 0.030956141650676727, 0.026403767988085747, 0.01118583232164383, -0.00885545089840889, -0.03349246457219124, 0.0228919368237257, -0.0481...
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": "instance", "annotation": null, "type_comment": null}}, {"_type": ...
def consul_request(self, instance, endpoint): url = urljoin(instance.get('url'), endpoint) try: resp = requests.get(url) except requests.exceptions.Timeout: self.log.exception('Consul request to {0} timed out'.format(url)) raise resp.raise_for_status(...
16,934
[ -0.01562788151204586, -0.025296930223703384, 0.03701221942901611, -0.007330487947911024, 0.002268291311338544, 0.08297392725944519, 0.006031912285834551, 0.007004438433796167, -0.01915820688009262, 0.009685913100838661, 0.010551630519330502, -0.011580372229218483, 0.0010793356923386455, -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": "instance", "annotation": null, "type_comment": null}}], "kwarg": ...
def _is_instance_leader(self, instance): try: agent_url = self._get_agent_url(instance) leader = self._last_known_leader or self._get_cluster_leader(instance) self.log.debug("Consul agent lives at %s . Consul Leader lives at %s" % (agent_url,leader)) return agent_...
16,935
[ -0.0425204262137413, -0.014823537319898605, 0.04787011444568634, -0.031714484095573425, -0.03942997008562088, 0.017924651503562927, 0.04744384437799454, 0.001979490974918008, 0.006735065020620823, 0.029860209673643112, 0.00907422136515379, -0.022912010550498962, -0.027409158647060394, -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": "instance", "annotation": null, "type_comment": null}}], "kwarg": ...
def _get_agent_url(self, instance): self.log.debug("Starting _get_agent_url") local_config = self._get_local_config(instance) agent_addr = local_config.get('Config', {}).get('AdvertiseAddr') agent_port = local_config.get('Config', {}).get('Ports', {}).get('Server') agent_url = "{...
16,936
[ 0.013903601095080376, -0.02759547345340252, 0.022184595465660095, -0.0023996063973754644, -0.020526044070720673, 0.09132619202136993, 0.008698573336005211, 0.01677371934056282, -0.014432926662266254, 0.027477845549583435, 0.02394901216030121, 0.005593200214207172, -0.011586334556341171, -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": "instance", "annotation": null, "type_comment": null}}], "kwarg": ...
def _check_for_leader_change(self, instance): agent_dc = self._get_agent_datacenter(instance) leader = self._get_cluster_leader(instance) if not leader: # A few things could be happening here. # 1. Consul Agent is Down # 2. The cluster is in the midst of ...
16,937
[ 0.004902075510472059, -0.0043154750019311905, 0.0921311154961586, -0.009702685289084911, -0.049388568848371506, 0.05666875094175339, -0.056059956550598145, 0.006243329029530287, 0.01571454480290413, 0.04629385471343994, 0.024440620094537735, -0.05423356965184212, 0.019380003213882446, -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": "services", "annotation": null, "type_comment": null}}, {"_type": ...
def _cull_services_list(self, services, service_whitelist): if service_whitelist: if len(service_whitelist) > self.MAX_SERVICES: self.warning('More than %d services in whitelist. Service list will be truncated.' % self.MAX_SERVICES) services = [s for s in services if s i...
16,938
[ 0.018617574125528336, -0.033507298678159714, -0.0009075796697288752, -0.0347210168838501, -0.00926544051617384, -0.047898534685373306, -0.02179274894297123, 0.014998093247413635, -0.034395914524793625, -0.0038931104354560375, 0.061942990869283676, -0.004825072828680277, 0.005077027715742588,...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "pre_fn", "annotation": null, "type_comment": null}}, {"_type":...
def _validate_args(context, pre_fn, post_fn): try: _ = pickle.dumps(context) except Exception as e: raise ValueError('context passed to make_pool is not picklable: %s' % str(e)) try: _ = pickle.dumps(pre_fn) except pickle.PickleError: raise ValueE...
16,939
[ 0.004801102448254824, 0.014001119881868362, 0.05590393394231796, -0.025765078142285347, -0.03775526583194733, 0.09215100109577179, -0.005385529715567827, -0.009822150692343712, -0.012656308710575104, 0.0497957244515419, 0.026292948052287102, -0.018575992435216904, -0.0075158616527915, -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": "instance", "annotation": null, "type_comment": null}}], "kwarg": ...
def check(self, instance): perform_new_leader_checks = instance.get('new_leader_checks', self.init_config.get('new_leader_checks', False)) if perform_new_leader_checks: self._check_for_leader_change(instance) peers = self.get_peers_in...
16,940
[ -0.0044751293025910854, -0.00022289915068540722, 0.047688987106084824, -0.019523680210113525, 0.010539129376411438, -0.03193744644522667, 0.01676887460052967, 0.03136591240763664, -0.012813843786716461, 0.011110665276646614, 0.0542730875313282, 0.013808316551148891, -0.023844493553042412, ...
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": "host", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, host, jobs, callback, context, pre_fn, post_fn): self.host = host self.jobs = jobs self.requests = multiprocessing.Queue() self.responses = multiprocessing.Queue() self.workers = [] self.discarded_responses = [] self.closed = False self....
16,941
[ -0.019585009664297104, 0.00879898015409708, 0.04814600944519043, -0.02768167108297348, 0.025466224178671837, -0.020201681181788445, 0.016353197395801544, 0.04615895822644234, -0.01657017506659031, 0.006492174230515957, 0.03215824440121651, -0.031336016952991486, -0.023502012714743614, -0.0...
12
{"_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": "host", "annotation": n...
class _ProcessPool(object): def __init__(self, host, jobs, callback, context, pre_fn, post_fn): self.host = host self.jobs = jobs self.requests = multiprocessing.Queue() self.responses = multiprocessing.Queue() self.workers = [] self.discarded_responses = [] ...
16,942
[ -0.004246471915394068, 0.028626080602407455, 0.003323703072965145, 0.021718330681324005, -0.022528285160660744, 0.019138049334287643, -0.02080424129962921, 0.09390835464000702, 0.020271984860301018, 0.027677277103066444, 0.006375493016093969, -0.011304640211164951, -0.006039940752089024, 0...
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 get(self): msg_type, resp = self.responses.get() if msg_type == _MessageType.Error: self._handle_error(resp) elif msg_type == _MessageType.Interrupt: raise KeyboardInterrupt assert msg_type == _MessageType.Response return resp
16,943
[ 0.018160389736294746, 0.009111291728913784, 0.06696954369544983, -0.03418133780360222, 0.039107032120227814, -0.01347102876752615, 0.012699834071099758, 0.07055187225341797, -0.0039834692142903805, 0.019379375502467155, 0.014702452346682549, -0.026568898931145668, -0.010622584261000156, -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 join(self): # TODO: one would think that we could close self.requests in close(), # above, and close self.responses below, but if we do, we get # weird tracebacks in the daemon threads multiprocessing starts up. # Instead, we have to hack the innards of multiprocessing. It # ...
16,944
[ -0.005393401253968477, -0.0071417405270040035, 0.012838358990848064, -0.04415363073348999, -0.017444685101509094, -0.015083459205925465, -0.005390175152570009, 0.023160656914114952, 0.0016064076917245984, 0.010799705050885677, 0.04492780566215515, -0.013715754263103008, -0.0539340116083622, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "requests", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "responses", "annotation": null, "type_comment": null}}, {"_ty...
def _loop(requests, responses, host, worker_num, callback, context, pre_fn, post_fn, should_loop=True): host = host or Host() try: context_after_pre = pre_fn(host, worker_num, context) keep_looping = True while keep_looping: message_type, args = requests.get(block=T...
16,945
[ -0.038210365921258926, -0.025882359594106674, 0.028980497270822525, 0.0042733862064778805, 0.015232509933412075, -0.046386007219552994, 0.016630975529551506, 0.025903873145580292, -0.016405070200562477, -0.00984842050820589, 0.0076700421050190926, -0.03037896193563938, -0.015716593712568283,...
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": "host", "annotation": n...
class _AsyncPool(object): def __init__(self, host, jobs, callback, context, pre_fn, post_fn): self.host = host or Host() self.jobs = jobs self.callback = callback self.context = copy.deepcopy(context) self.msgs = [] self.closed = False self.post_fn = post_fn ...
16,946
[ -0.0022578055504709482, -0.0055038658902049065, 0.0383395291864872, 0.0027623511850833893, -0.02359905280172825, -0.03736318275332451, 0.03591056540608406, -0.00184851314406842, -0.01712181605398655, 0.01932455226778984, 0.06048596650362015, 0.0006876111729070544, -0.02621852420270443, -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": "host", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __init__(self, host, jobs, callback, context, pre_fn, post_fn): self.host = host or Host() self.jobs = jobs self.callback = callback self.context = copy.deepcopy(context) self.msgs = [] self.closed = False self.post_fn = post_fn self.context_after_pre ...
16,947
[ 0.02125825546681881, -0.029102487489581108, 0.05246718227863312, -0.01506816130131483, -0.008994374424219131, 0.008626069873571396, 0.009226987138390541, 0.0063483999110758305, -0.013103872537612915, 0.03768332675099373, 0.050115205347537994, -0.01944904215633869, 0.007172238081693649, -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": "finder_options", "annotation": null, "type_comment": null}}], "kw...
def __init__(self, finder_options): # The rate limiting factors are fetching network resources and executing # javascript. There's not much to be done about the former, and having one # tab per logical core appears close to optimum for the latter. maximum_batch_size = multiprocessing.cpu_count() # ...
16,948
[ 0.033976923674345016, 0.010682052001357079, 0.010796298272907734, -0.06859362870454788, -0.02956700511276722, 0.0018108077347278595, 0.006974751595407724, -0.01374385878443718, 0.02938421070575714, 0.021021364256739616, 0.011430366896092892, -0.035599224269390106, 0.014475037343800068, 0.0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def map_config_to_obj(module): config = get_config(module) configobj = NetworkConfig(indent=3, contents=config) match = re.findall(r'^interface (\S+)', config, re.M) if not match: return list() instances = list() for item in set(match): obj = { 'name': item.lower()...
16,949
[ 0.046832550317049026, 0.07187134027481079, 0.0014935637591406703, -0.041824791580438614, -0.025459440425038338, -0.0004970199661329389, -0.002696677576750517, -0.007246225606650114, 0.0691070556640625, 0.05336266756057739, 0.020121170207858086, -0.01957031711935997, -0.05756918340921402, 0...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}, {"_type": "ar...
def validate_param_values(module, obj, param=None): if param is None: param = module.params for key in obj: # validate the param value (if validator func exists) validator = globals().get('validate_%s' % key) if callable(validator): validator(param.get(key), module)
16,950
[ -0.005092560779303312, 0.027045998722314835, 0.02073771506547928, -0.04147543013095856, -0.05791371315717697, 0.016242297366261482, -0.014772406779229641, -0.006804371252655983, 0.05061325430870056, 0.020688718184828758, -0.017663192003965378, -0.023052792996168137, -0.00690848845988512, 0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "updates", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "modules", "annotation": null, "type_comment": null}}], "kwarg"...
def map_obj_to_commands(updates, modules): commands = list() want, have = updates args = ('speed', 'description', 'mtu') for w in want: name = w['name'] disable = w['disable'] state = w['state'] obj_in_have = search_obj_in_list(name, have) interface = 'interface...
16,951
[ 0.02701277658343315, 0.03758590295910835, -0.016015833243727684, -0.03205397352576256, -0.06134197860956192, -0.02464832179248333, -0.00791869219392538, -0.025719018653035164, 0.04358626529574394, 0.03203166648745537, -0.0016060445923358202, -0.049742769449949265, 0.02177082560956478, 0.02...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": ...
def map_params_to_obj(module): obj = [] aggregate = module.params.get('aggregate') if aggregate: for item in aggregate: for key in item: if item.get(key) is None: item[key] = module.params[key] item['name'] = item['name'].lower() ...
16,952
[ -0.003179806750267744, 0.0017197211273014545, 0.01940557360649109, 0.0010808425722643733, 0.012240797281265259, 0.012590867467224598, -0.03580053895711899, 0.02312798984348774, 0.029172539710998535, -0.005478602834045887, 0.02208944596350193, -0.03855442628264427, 0.005965784192085266, 0.0...
9
{"_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 user_checkHandler(web.RequestHandler): def get(self): self.set_header("Access-Control-Allow-Origin", "*") self.set_header("Access-Control-Allow-Headers", "x-requested-with") self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS') username = self.get_query_arguments("username")[0] client =...
16,953
[ -0.014651448465883732, 0.01994512602686882, -0.027853284031152725, -0.018327252939343452, -0.015259768813848495, 0.011519248597323895, 0.00051529222400859, 0.008484120480716228, 0.011519248597323895, 0.06797651201486588, -0.002986591774970293, -0.007597527001053095, -0.011195674538612366, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "module", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "want", "annotation": null, "type_comment": null}}, {"_type": "a...
def check_declarative_intent_params(module, want, result): failed_conditions = [] have_neighbors = None for w in want: want_state = w.get('state') want_tx_rate = w.get('tx_rate') want_rx_rate = w.get('rx_rate') want_neighbors = w.get('neighbors') if want_state not in...
16,954
[ -0.007546594366431236, -0.014775180257856846, 0.040680669248104095, -0.0013003197964280844, 0.025293933227658272, 0.013282984495162964, -0.005412265658378601, 0.00821930542588234, 0.005831181071698666, -0.048630889505147934, 0.030773470178246498, -0.028253862634301186, -0.010102896019816399,...
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 get(self): self.set_header("Access-Control-Allow-Origin", "*") self.set_header("Access-Control-Allow-Headers", "x-requested-with") self.set_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS') username = self.get_query_arguments("username")[0] client = MongoClient() db_livechat = client.livechat...
16,955
[ 0.02256850339472294, 0.00007756391278235242, 0.0470975898206234, -0.02498655766248703, 0.0006565914954990149, -0.019540490582585335, -0.002461622469127178, -0.011523878201842308, -0.0212941225618124, 0.02333095297217369, -0.027339259162545204, -0.05611627921462059, -0.0015916131669655442, ...
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": "n_samples", "annotation": null, "type_comment": null}}, {"_type":...
def _check_subparams(self, n_samples, n_features): n_subsamples = self.n_subsamples if self.fit_intercept: n_dim = n_features + 1 else: n_dim = n_features if n_subsamples is not None: if n_subsamples > n_samples: raise ValueError("Inv...
16,956
[ 0.01330487709492445, 0.007786445785313845, 0.011364329606294632, 0.01593674346804619, 0.042328186333179474, 0.05967182666063309, -0.04004804417490959, -0.005733710713684559, 0.023322952911257744, -0.045287519693374634, 0.009460167959332466, 0.004341974388808012, 0.0021603747736662626, -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": "context", "annotation": {"_type": "Name", "_fields": {"id": "dict...
def poke(self, context: dict) -> bool: conn = BaseHook.get_connection(self.qubole_conn_id) Qubole.configure(api_token=conn.password, api_url=conn.host) self.log.info('Poking: %s', self.data) status = False try: status = self.sensor_class.check(self.data) # type: i...
16,957
[ 0.02049238607287407, -0.00846216268837452, 0.023645060136914253, -0.009841457940638065, 0.029204845428466797, -0.0020316645968705416, -0.00960181187838316, -0.004627828486263752, -0.008408907800912857, 0.004111258313059807, -0.0059272414073348045, 0.023006005212664604, 0.02087581902742386, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "self", "annotation": null, "type_comment": null}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def __init__(self, *, data, qubole_conn_id: str = "qubole_default", **kwargs) -> None: self.data = data self.qubole_conn_id = qubole_conn_id if 'poke_interval' in kwargs and kwargs['poke_interval'] < 5: raise AirflowException( f"Sorry, poke_interval can't be less tha...
16,958
[ 0.016074521467089653, -0.003409648546949029, 0.05768069997429848, -0.02558376081287861, -0.003569221356883645, -0.02575310319662094, 0.05179278925061226, -0.007034231908619404, 0.00908588245511055, -0.005682747345417738, 0.021597696468234062, 0.004529914818704128, -0.05197515711188316, -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 setUp(self): super(TestPaverRunQuality, self).setUp() # test_no_diff_quality_failures seems to alter the way that paver # executes these lines is subsequent tests. # https://github.com/paver/paver/blob/master/paver/tasks.py#L175-L180 # # The other tests don't appear ...
16,959
[ 0.008709329180419445, 0.009357967413961887, 0.06653954088687897, -0.021513190120458603, -0.01901322789490223, -0.013817360624670982, 0.03921562805771828, -0.03364814445376396, 0.005138436332345009, -0.010580922476947308, 0.01883755624294281, -0.023121275007724762, -0.026850948110222816, -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 setUp(self): super(TestPaverReportViolationsCounts, self).setUp() # Mock the paver @needs decorator self._mock_paver_needs = patch.object(pavelib.quality.run_quality, 'needs').start() self._mock_paver_needs.return_value = 0 # Temporary file infrastructure self.f = t...
16,960
[ 0.02574591152369976, 0.005934134591370821, 0.02704228274524212, -0.023930992931127548, 0.02699042670428753, -0.02559034712612629, 0.04153570160269737, -0.0009957742877304554, 0.04908057302236557, 0.01392301544547081, 0.026575587689876556, -0.022867970168590546, -0.04376545548439026, 0.0417...
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 test_no_diff_quality_failures(self): # Assert nothing is raised _mock_pep8_violations = MagicMock(return_value=(0, [])) with patch('pavelib.quality._get_pep8_violations', _mock_pep8_violations): pavelib.quality.run_quality("") # Assert that _get_pep8_violations (which cal...
16,961
[ -0.03564799949526787, -0.014128238894045353, -0.011830873787403107, -0.005618555471301079, 0.017069309949874878, 0.0015801319386810064, -0.026258768513798714, 0.04113059863448143, 0.04310610890388489, 0.01289631798863411, 0.03999856486916542, -0.02097593992948532, 0.015193683095276356, 0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ErrorClass", "annotation": null, "type_comment": null}}], "kwa...
def test_python_to_javascript(context, ErrorClass): context.eval(""" try { throw_exception(); } catch (exc) { this.exc = exc; } """) assert isinstance(context.exc, ErrorClass) assert context.eval('exc instanceof TestError')
16,962
[ -0.004248195793479681, 0.007765344809740782, -0.010332132689654827, 0.016310473904013634, 0.018400726839900017, 0.02545126900076866, -0.03238267824053764, 0.004283394664525986, 0.02233213558793068, -0.00576714938506484, 0.03558845445513725, -0.00695848511531949, 0.03708304092288017, 0.0081...
8
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ErrorClass", "annotation": null, "type_comment": null}}], "kwa...
def test_property_error(context, ErrorClass): class Test(object): @property def foo(self): raise ErrorClass @foo.setter def foo(self, thing): raise ErrorClass context.test = Test() with pytest.raises(ErrorClass): context.eval('test.foo') wi...
16,963
[ -0.009961246512830257, -0.031093675643205643, -0.006889448035508394, -0.002035895362496376, 0.0021187677048146725, -0.00927064474672079, 0.006569008808583021, 0.025878246873617172, 0.04950236901640892, -0.02541416324675083, 0.02464068867266178, -0.017093786969780922, 0.039822887629270554, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "context", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs":...
def test_cross_context_exception_value(context): def call_context(): context.eval('throw {foo: "bar"}') context2 = Context() context2.expose(call_context) try: context2.eval('call_context()') except JSException as e: assert e.value['foo'] == 'bar'
16,964
[ 0.021969186142086983, 0.027084147557616234, -0.020134925842285156, -0.052868593484163284, 0.025071704760193825, -0.021759556606411934, -0.028907926753163338, -0.026560073718428612, 0.022807704284787178, 0.017032407224178314, 0.07580207288265228, -0.023897778242826462, -0.028383852913975716, ...
9
{"_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": "parser", "annotation":...
class InfileConverterAction(Action): def __call__(self, parser, ns, values, option_string=None): setattr(ns, self.name, values) with open(values, 'r') as f: s = f.read() t = self.converter(s) print(t.rstrip())
16,965
[ 0.03244328126311302, 0.046269528567790985, 0.04440782591700554, -0.05475889518857002, -0.0503900982439518, -0.005594417918473482, -0.004418442025780678, -0.053468115627765656, 0.012678198516368866, 0.008706565015017986, 0.017326250672340393, -0.026063844561576843, -0.03524824604392052, -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": "parser", "annotation": null, "type_comment": null}}, {"_type": "a...
def __call__(self, parser, ns, values, option_string=None): ns.agent_annotations = values agent, ctx = make_agent_ctx(ns.agent_annotations) anno = agent.annotations writer = CustomWriter("{", "}", "[", "]", ": ", ", ", " ", 80) s = writer.write(anno) print(s.rstrip()) ...
16,966
[ -0.0539298914372921, 0.013917391188442707, -0.02524598315358162, 0.017790237441658974, -0.026136530563235283, -0.038334958255290985, -0.021518109366297722, 0.021228164434432983, -0.009702824056148529, -0.0004478624905459583, -0.00022215144417714328, -0.059438858181238174, -0.0108108306303620...
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Post", "value": {"_type": "Name", "_fields": {"id": "models", "ctx": {"_type": "Load", "_fields": {}}}}}}, "ta...
class PostView(generic.DetailView): model = models.Post def get_context_data(self, **kwargs): context = super().get_context_data() context['is_python'] = self._get_is_python() return context def _get_is_python(self): return ('python' in self.object.category.name.lower() ...
16,967
[ -0.026847900822758675, -0.002224687021225691, -0.029646188020706177, 0.004838297143578529, -0.03408822417259216, -0.0527956523001194, -0.04285488650202751, -0.0006726651336066425, -0.009534723125398159, 0.03189655765891075, 0.0021635356824845076, -0.06406707316637039, 0.011956317350268364, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "Category", "value": {"_type": "Name", "_fields": {"id": "models", "ctx": {"_type": "Load", "_fields": {}}}}}},...
class CategoryPosts(generic.DetailView): model = models.Category template_name = 'blog/post_list.html' def get_context_data(self, **kwargs): context = super(CategoryPosts, self).get_context_data(**kwargs) context['post_list'] = self._get_posts() return context def _get_posts(se...
16,968
[ 0.023006843402981758, 0.027055256068706512, 0.009361958131194115, -0.026166580617427826, -0.03673195466399193, 0.014675501734018326, 0.029400374740362167, 0.05346869304776192, 0.03599138930439949, 0.012885807082057, 0.051098886877298355, 0.03369564563035965, 0.02754896506667137, 0.02336478...
10
{"_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": ["vm", "exist_users"]}}, {"_type...
def test(): global vm, exist_users test_util.test_dsc('change unexisted user password test') vm = test_stub.create_vm(vm_name = 'cknewusrvmpswd-c7-32', image_name = "imageName_i_c7_32") vm.check() backup_storage_list = test_lib.lib_get_backup_storage_list_by_vm(vm.vm) for bs in backup_...
16,969
[ 0.04471572861075401, -0.0021535407286137342, 0.03138325735926628, -0.024695375934243202, -0.014176574535667896, -0.005989873316138983, -0.06912974268198013, -0.02294224314391613, 0.02287731133401394, 0.04265958443284035, 0.0016367991920560598, -0.0906435027718544, -0.05021321028470993, -0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "se", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "car", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def query_car_length(se, car): data = se.get("http://carfolio.com/search/results/?"+car+"&offset=0&num=20&makematch=e&modelmatch=e") doc = lxml.html.fromstring(data.content) cars = doc.xpath('//*[@id="content"]/div[2]/ol/li/dl/dt/a') data = se.get("http://carfolio.com"+cars[len(cars)-1].attrib['href']) ...
16,970
[ -0.001648163772188127, 0.001654601888731122, 0.05990045145153999, -0.04066329076886177, -0.04058603197336197, -0.024413425475358963, -0.004925176966935396, 0.027065938338637352, 0.00508613046258688, 0.050320498645305634, 0.0392984040081501, -0.050114478915929794, -0.0467151403427124, 0.014...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"a...
def main(): se = init() carinfo = get_car_name() carlength = query_car_length(se, carinfo[1]) routepoints = get_route_points() routelength = query_route_length(routepoints) cartimes = calculate_cars_on_route(routelength, carlength) print ('a ', carinfo[0], ' can fit on a route from ', routep...
16,971
[ -0.0034803305752575397, -0.0015957471914589405, 0.02309543825685978, -0.02736220322549343, -0.03157177194952965, -0.021436776965856552, -0.016529424116015434, 0.01941206492483616, 0.0011074428912252188, 0.03065664879977703, -0.010798461735248566, -0.070876345038414, -0.04234735667705536, 0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Name", "_fields": {"id": "User", "ctx": {"_type": "Load", "_fields": {}}}}], "func": {"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", ...
class Farticle(models.Model): author = models.ForeignKey(User) topic = models.ForeignKey(Topic) title = models.TextField(max_length=1024) failure_reasons = models.ManyToManyField(FailureReasons) keywords = models.ManyToManyField(Keyword) #Presentations = models.ManyToManyFiel...
16,972
[ 0.0044490802101790905, 0.049053534865379333, 0.049674466252326965, -0.03257669135928154, -0.03885252773761749, -0.017474766820669174, 0.038475535809993744, -0.005782418418675661, 0.013549597933888435, 0.023617547005414963, -0.010400591418147087, 0.018328547477722168, 0.022863559424877167, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "args", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def run(args): options = parser.parse_args(args) env = None if options.datadirs: env = os.environ.copy() env.update({'GETTEXTDATADIRS': options.datadirs}) return subprocess.call(['msgfmt', '--' + options.type, '-d', options.podir, '--template', options.input, ...
16,973
[ -0.01927250437438488, -0.04644223675131798, 0.00619400292634964, -0.03085237555205822, -0.03658093512058258, 0.040284037590026855, 0.019538473337888718, 0.010863800533115864, 0.024264534935355186, -0.023957647383213043, 0.009083855897188187, -0.04914284124970436, 0.0036493982188403606, -0....
9
{"_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 AgentServiceTest(AgentTestCase): def setUp(self): super(AgentServiceTest, self).setUp() self.service = self.start_service('agent') def test_stop(self): # NOTE: Start is already done by the fixture in start_service() self.service.stop()
16,974
[ -0.016829663887619972, 0.03804398328065872, 0.06500635296106339, 0.03970186412334442, -0.012826756574213505, -0.01601163111627102, 0.018051259219646454, -0.03038719668984413, -0.044762760400772095, -0.004360115621238947, -0.02160697616636753, -0.013742953538894653, -0.003449372248724103, -...
9
{"_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 Display(base.Cell): def __init__(self, data): # type: (bytes) -> Display self.data = data escaped = strutils.bytes_to_escaped_str(data) w = urwid.Text(escaped, wrap="any") super(Display, self).__init__(w) def get_data(self): return self.data
16,975
[ 0.04761715233325958, 0.03740484267473221, -0.0392579659819603, -0.03174476698040962, 0.025178274139761925, 0.018490923568606377, 0.01711115427315235, 0.01772550493478775, 0.042057789862155914, 0.023164011538028717, 0.03708256036043167, -0.038291119039058685, 0.047012872993946075, 0.0548282...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "filename", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "callback", "annotation": null, "type_comment": null}}, {"_typ...
def read_file(filename, callback, escaped): # type: (str, Callable[...,None], bool) -> Optional[str] if not filename: return filename = os.path.expanduser(filename) try: with open(filename, "r" if escaped else "rb") as f: d = f.read() except IOError as v: ...
16,976
[ 0.03753512352705002, 0.002832604106515646, -0.015794921666383743, 0.003638156224042177, 0.010720360092818737, -0.012789006344974041, -0.033830415457487106, -0.008091569878160954, -0.012855558656156063, -0.0085518853738904, -0.0026218572165817022, 0.02695341408252716, -0.007808725815266371, ...
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 get_data(self): # type: () -> bytes txt = self._w.get_text()[0].strip() try: return strutils.escaped_str_to_bytes(txt) except ValueError: signals.status_message.send( self, message="Invalid Python-style string encoding."...
16,977
[ 0.031032901257276535, 0.03417573869228363, 0.0274529829621315, 0.020241111516952515, -0.039961885660886765, -0.016432244330644608, 0.017046241089701653, 0.019710367545485497, -0.040815237909555435, 0.015703771263360977, -0.0018393914215266705, -0.025101060047745705, 0.04193916544318199, 0....
12
{"_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 Edit(base.Cell): def __init__(self, data): # type: (bytes) -> Edit data = strutils.bytes_to_escaped_str(data) w = urwid.Edit(edit_text=data, wrap="any", multiline=True) w = urwid.AttrWrap(w, "editfield") super(Edit, self).__init__(w) def get_data(self): ...
16,978
[ 0.01608196087181568, 0.012674764730036259, -0.002131045563146472, 0.015784604474902153, -0.01953871361911297, 0.06903596222400665, -0.026266375556588173, 0.04730425402522087, 0.025597326457500458, -0.00880295317620039, 0.025076955556869507, -0.0015363352140411735, 0.046114835888147354, 0.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": "registration", "annotation": null, "type_comment": null}}], "kwar...
def _unregister(self, registration): disp = self.dispatchers[registration.portstr] disp.unregister(registration.username) registration.username = None if not disp.users: disp = self.dispatchers[registration.portstr] del self.dispatchers[registration.portstr] ...
16,979
[ -0.006366824731230736, 0.013362160883843899, 0.053348083049058914, -0.03758500516414642, -0.01874222233891487, -0.016680702567100525, 0.010257313027977943, -0.007598707918077707, 0.009459102526307106, -0.008931152522563934, 0.030294269323349, 0.007504431065171957, -0.025794124230742455, -0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "hostnames", "annotation": {"_type": "Subscript", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "slice": {"_type": "Name", "_fields": {"id": "str",...
def main(hostnames: Sequence[str]) -> None: master = get_mesos_master() try: mesos_state = block(master.state) except MasterNotAvailableException as e: print(PaastaColors.red("CRITICAL: %s" % e.message)) sys.exit(2) slaves = [ slave for slave in mesos_state.get("...
16,980
[ 0.043820809572935104, 0.0359622947871685, 0.04389268532395363, 0.00038633710937574506, 0.030978845432400703, 0.05366791412234306, -0.010961192660033703, 0.02985277771949768, 0.012829985469579697, 0.01550140231847763, 0.020113488659262657, 0.016507675871253014, 0.058268021792173386, 0.02132...
12
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Expr", "_fields": {"value": {"_type": "Call", "_fields": {"args": [{"_type": "Attribute", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "attr": "IRealm", "value": {"_type": "Name", "_fields": {"id": "portal", "ctx": {"...
class Dispatcher(service.Service): implements(portal.IRealm, checkers.ICredentialsChecker) credentialInterfaces = [credentials.IUsernamePassword, credentials.IUsernameHashedPassword] def __init__(self, portstr): self.portstr = portstr self.users = {} # ...
16,981
[ 0.03460913524031639, 0.006367224268615246, 0.041440512984991074, 0.02987239882349968, 0.005694797728210688, 0.00012626592069864273, 0.026873257011175156, -0.008396404795348644, 0.018816040828824043, 0.030300846323370934, 0.012353605590760708, 0.0023877089843153954, 0.05069976672530174, -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": "portstr", "annotation": null, "type_comment": null}}], "kwarg": n...
def __init__(self, portstr): self.portstr = portstr self.users = {} # there's lots of stuff to set up for a PB connection! self.portal = portal.Portal(self) self.portal.registerChecker(self) self.serverFactory = pb.PBServerFactory(self.portal) self.serverFactory....
16,982
[ 0.02426016516983509, 0.017882952466607094, 0.03601118177175522, 0.0044930363073945045, 0.02012389712035656, 0.039913322776556015, 0.03830787166953087, 0.05712733790278435, 0.015786945819854736, 0.0010326736373826861, 0.03155159205198288, 0.027961624786257744, 0.05467456579208374, 0.0092034...
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": "username", "annotation": null, "type_comment": null}}, {"_type": ...
def register(self, username, password, pfactory): if debug: log.msg("registering username '%s' on pb port %s: %s" % (username, self.portstr, pfactory)) if username in self.users: raise KeyError("username '%s' is already registered on PB port %s" ...
16,983
[ 0.016161896288394928, -0.0038797552697360516, -0.013153238222002983, 0.04821568354964256, -0.01124389749020338, -0.012105351313948631, 0.005512659903615713, 0.005859812721610069, 0.02139490656554699, 0.019440563395619392, 0.03306952863931656, -0.008048804476857185, 0.048498548567295074, 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": "username", "annotation": null, "type_comment": null}}, {"_type": ...
def requestAvatar(self, username, mind, interface): assert interface == pb.IPerspective if username not in self.users: d = defer.succeed(None) # no perspective else: _, afactory = self.users.get(username) d = defer.maybeDeferred(afactory, mind, username) ...
16,984
[ 0.015166052617132664, -0.009018448181450367, 0.06000532582402229, -0.0550166480243206, 0.010936264880001545, 0.040285930037498474, 0.009071393869817257, 0.021907826885581017, -0.051439862698316574, 0.00532106077298522, -0.001529547618702054, -0.011630444787442684, 0.01918993890285492, 0.00...
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": "batch_size", "annotati...
class MakeTFRecordDatasetTest( reader_dataset_ops_test_base.TFRecordDatasetTestBase, parameterized.TestCase): def _read_test(self, batch_size, num_epochs, file_index=None, num_parallel_reads=1, drop_final_batch=False, parser_fn=False): if file_index is None: file_pattern = self.tes...
16,985
[ 0.009412805549800396, 0.012871038168668747, -0.0018264506943523884, 0.0470869280397892, 0.02805519849061966, -0.007511922623962164, 0.021230341866612434, 0.010128499008715153, 0.019982172176241875, 0.021241793408989906, 0.027803273871541023, -0.010283089242875576, 0.05322472006082535, -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": "creds", "annotation": null, "type_comment": null}}], "kwarg": nul...
def requestAvatarId(self, creds): if creds.username in self.users: password, _ = self.users[creds.username] d = defer.maybeDeferred(creds.checkPassword, password) def check(matched): if not matched: log.msg("invalid login from user '%s'" %...
16,986
[ -0.020155636593699455, -0.03669867664575577, 0.045906390994787216, -0.0689917504787445, 0.025133969262242317, -0.009339879266917706, -0.022600745782256126, 0.014769786037504673, -0.03687490150332451, 0.005826410837471485, 0.003923740703612566, -0.010094339028000832, -0.021983962506055832, ...
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 testRead(self): for batch_size in [1, 2]: for num_epochs in [1, 3]: # Basic test: read from file 0. self._read_test(batch_size, num_epochs, 0) # Basic test: read from file 1. self._read_test(batch_size, num_epochs, 1) # Basic test: read from both files. se...
16,987
[ 0.01694852113723755, 0.02990785799920559, 0.06607498973608017, -0.08621926605701447, -0.00022263529535848647, 0.007025150582194328, -0.01457925420254469, -0.00017313208081759512, -0.007824089378118515, 0.0004624890862032771, 0.005339114461094141, 0.010099687613546848, 0.016706084832549095, ...
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": "batch_size", "annotation": null, "type_comment": null}}, {"_type"...
def _read_test(self, batch_size, num_epochs, file_index=None, num_parallel_reads=1, drop_final_batch=False, parser_fn=False): if file_index is None: file_pattern = self.test_filenames else: file_pattern = self.test_filenames[file_index] if parser_fn: fn = lambda x: string...
16,988
[ -0.028896339237689972, -0.0017610411159694195, 0.042635731399059296, -0.10154064744710922, -0.00514681963250041, 0.02453462779521942, -0.018853498622775078, 0.014011998660862446, -0.021568663418293, 0.03609316423535347, 0.005484852474182844, -0.0034730129409581423, -0.02741335704922676, -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 testParserFn(self): for batch_size in [1, 2]: for num_epochs in [1, 3]: for drop_final_batch in [False, True]: self._read_test(batch_size, num_epochs, parser_fn=True, drop_final_batch=drop_final_batch) self._read_test(batch_size, num_epochs, num_parall...
16,989
[ 0.018601736053824425, -0.023489946499466896, 0.07431847602128983, -0.10714246332645416, 0.014775220304727554, 0.006303798872977495, -0.016600003466010094, 0.026763496920466423, -0.02875417098402977, 0.003956463187932968, 0.0026666729245334864, 0.006160028278827667, -0.03452712297439575, -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 testDropFinalBatch(self): for batch_size in [1, 2, 10]: for num_epochs in [1, 3]: # Read from file 0. self._read_test(batch_size, num_epochs, 0, drop_final_batch=True) # Read from both files. self._read_test(batch_size, num_epochs, drop_final_batch=True) # Read fr...
16,990
[ 0.020610004663467407, -0.048140496015548706, 0.018967263400554657, -0.021879926323890686, 0.00945450458675623, -0.005665129981935024, 0.006419509649276733, 0.015215752646327019, -0.02952275425195694, -0.02049349807202816, 0.023907139897346497, 0.018163368105888367, -0.04170933738350868, 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 testShuffle(self): for batch_size in [1, 2]: for num_epochs in [1, 3]: for num_parallel_reads in [1, 2]: # Test that all expected elements are produced self._shuffle_test(batch_size, num_epochs, num_parallel_reads) # Test that elements are produced in a consistent ord...
16,991
[ 0.02820248156785965, -0.0319642648100853, 0.031551118940114975, -0.056448452174663544, 0.0006411199574358761, 0.012416050769388676, 0.0007155265775509179, 0.024745123460888863, -0.044923923909664154, -0.030594365671277046, 0.0028512340504676104, -0.001961072674021125, -0.030224710702896118, ...
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": "batch_size", "annotation": null, "type_comment": null}}, {"_type"...
def _shuffle_test(self, batch_size, num_epochs, num_parallel_reads=1, seed=None): def dataset_fn(): return readers.make_tf_record_dataset( file_pattern=self.test_filenames, num_epochs=num_epochs, batch_size=batch_size, num_parallel_reads=num_paralle...
16,992
[ 0.023265287280082703, -0.03242697939276695, 0.02071535773575306, 0.003367937868461013, 0.02734968811273575, 0.033758360892534256, 0.004733165726065636, -0.0010782196186482906, 0.01054384559392929, -0.005559636279940605, -0.006859987508505583, -0.0023059374652802944, -0.017951052635908127, ...
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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class TestBias(unittest.TestCase): def setUp(self): self.x1 = numpy.random.uniform(-1, 1, (3, 2, 3)).astype(numpy.float32) self.x2 = numpy.random.uniform(-1, 1, (2)).astype(numpy.float32) self.axis = 1 self.y_expected = numpy.copy(self.x1) for i, j, k in numpy.ndindex(self.y...
16,993
[ 0.016658954322338104, -0.03370225429534912, 0.038434501737356186, -0.018520627170801163, -0.05462503805756569, -0.03300562873482704, 0.020033985376358032, 0.005335790105164051, -0.00010631418990669772, -0.010497423820197582, -0.003055242821574211, 0.024045586585998535, -0.04254218935966492, ...
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 setUp(self): self.x1 = numpy.random.uniform(-1, 1, (3, 2, 3)).astype(numpy.float32) self.x2 = numpy.random.uniform(-1, 1, (2)).astype(numpy.float32) self.axis = 1 self.y_expected = numpy.copy(self.x1) for i, j, k in numpy.ndindex(self.y_expected.shape): self.y_exp...
16,994
[ -0.018343986943364143, -0.004918802063912153, 0.018539395183324814, -0.024047475308179855, 0.053297705948352814, 0.023546740412712097, -0.038568779826164246, 0.019614141434431076, 0.03830009326338768, 0.026648852974176407, 0.040547292679548264, -0.04291662201285362, 0.029067035764455795, -...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "fos", "annotation": null, "type_comment": null}}], "kwarg": null,...
def fortios_firewall_ssl(data, fos): login(data) methodlist = ['firewall_ssl_setting'] for method in methodlist: if data[method]: resp = eval(method)(data, fos) break fos.logout() return not resp['status'] == "success", resp['status'] == "success", resp
16,995
[ 0.029405485838651657, -0.045345108956098557, 0.043968405574560165, 0.043968405574560165, 0.04300041124224663, 0.028157848864793777, 0.015713756904006004, -0.012358047999441624, -0.01922004483640194, -0.004380169790238142, -0.03525646775960922, 0.0016966770635917783, 0.00043492476106621325, ...
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 TestBiasInvalidShape(unittest.TestCase): def test_bias_invalid_shape(self): x1 = chainer.Variable(numpy.zeros((3, 2, 3), numpy.float32)) x2 = chainer.Variable(numpy.zeros((2), numpy.float32)) axis = 0 with chainer.using_config('debug', True): with self.assertRaises...
16,996
[ -0.022252140566706657, 0.04781003296375275, 0.06542425602674484, -0.05624709650874138, -0.005905328318476677, -0.04364084079861641, 0.006907538045197725, 0.003140771295875311, -0.006630002986639738, 0.010823865421116352, -0.009269669651985168, -0.00895512942224741, 0.030368497595191002, -0...
14
{"_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": "paths", "annotation": null, "type_comment": null}}, {"_type": "ar...
def run( self , paths = [] , t = "class" ) : builds = HaxeComplete_inst().builds HaxeCreateType.currentType = t view = sublime.active_window().active_view() scopes = view.scope_name(view.sel()[0].end()).split() fn = view.file_name() pack = []; if fn is None : ...
16,997
[ -0.05488603189587593, 0.04576218128204346, 0.03311266750097275, -0.06584417819976807, -0.00840323232114315, -0.026085156947374344, 0.01663970947265625, -0.0076826149597764015, -0.02853883057832718, 0.004100372549146414, -0.002626382280141115, 0.0023420064244419336, 0.05874520540237427, 0.0...
15
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "classpath", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, ...
class HaxeCreateType( sublime_plugin.WindowCommand ): classpath = None currentFile = None currentSrc = None currentType = None def run( self , paths = [] , t = "class" ) : builds = HaxeComplete_inst().builds HaxeCreateType.currentType = t view = sublime.active_window().acti...
16,998
[ -0.005156136583536863, 0.0379302017390728, -0.01713324338197708, 0.023340003564953804, -0.0038064897526055574, 0.006018186919391155, -0.015107426792383194, -0.05030062049627304, 0.030753634870052338, -0.0065192533656954765, 0.02622787281870842, -0.0037579992786049843, 0.0476713664829731, -...
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": "child_tree", "annotation": null, "type_comment": null}}], "kwarg"...
def _ConvertElementTreeToMember(self, child_tree): # Find the element's tag in this class's list of child members if self.__class__._children.has_key(child_tree.tag): member_name = self.__class__._children[child_tree.tag][0] member_class = self.__class__._children[child_tree.tag][1] # If the c...
16,999
[ -0.003238917328417301, 0.02737148106098175, 0.016222428530454636, -0.05231764167547226, 0.00044198695104569197, -0.02954932115972042, -0.00490941945463419, -0.039473339915275574, -0.0004609347670339048, -0.010926319286227226, 0.0308857224881649, -0.008965026587247849, 0.014329193159937859, ...
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": "inp", "annotation": null, "type_comment": null}}], "kwarg": null,...
def on_done( self , inp ) : fn = HaxeCreateType.classpath parts = inp.split(".") pack = [] cl = "${2:ClassName}" while( len(parts) > 0 ): p = parts.pop(0) fn = os.path.join( fn , p ) if isType.match( p ) : cl = p ...
17,000
[ 0.04497130215167999, 0.06898464262485504, -0.01678069308400154, 0.014310135506093502, -0.02120859920978546, -0.014763668179512024, -0.002260201843455434, -0.04926792532205582, -0.005409565754234791, 0.0028927598614245653, 0.009983676485717297, -0.0004781483148690313, 0.052275557070970535, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "element_tree", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlya...
def _ItemAttributeFromElementTree(element_tree): if element_tree.tag.find(GBASE_TEMPLATE % '') == 0: to_return = ItemAttribute('') to_return._HarvestElementTree(element_tree) to_return.name = element_tree.tag[element_tree.tag.index('}')+1:] if to_return.name and to_return.name != '': return to_r...