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
17,001
[ 0.027650414034724236, 0.03483910486102104, 0.024295691400766373, -0.006089550442993641, -0.008214903064072132, 0.00211753835901618, 0.006178107112646103, -0.007131389807909727, 0.007912768982350826, 0.020909715443849564, 0.022399544715881348, -0.0292756836861372, 0.023170506581664085, -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": "tree", "annotation": null, "type_comment": null}}], "kwarg": null...
def _AddMembersToElementTree(self, tree): # Convert the members of this class which are XML child nodes. # This uses the class's _children dictionary to find the members which # should become XML child nodes. member_node_names = [values[0] for tag, values in self...
17,002
[ -0.014493693597614765, 0.019911177456378937, 0.058539632707834244, 0.0026220877189189196, -0.044726334512233734, -0.029808996245265007, 0.02116926573216915, -0.047884393483400345, -0.008395815268158913, 0.06146661564707756, 0.027729298919439316, 0.04739656299352646, -0.005767309106886387, ...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "sig_x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "sig_y", "annotation": null, "type_comment": null}}, {"_type": "a...
def calc_bg(sig_x, sig_y, deg, bf=3.): tbg = np.polyval(np.polyfit(sig_x, sig_y, deg), sig_x) sigma2 = ((sig_y - tbg) ** 2).sum() / (len(tbg) - 1. - deg) sigma2p = None while sigma2p != sigma2: sigma2p = sigma2 sigma = sigma2 ** .5 * bf pts = zip(sig_x, sig_y, tbg) pts = ...
17,003
[ 0.023062268272042274, -0.027392271906137466, 0.05012146383523941, 0.010705102235078812, -0.06581606715917587, 0.012703565880656242, 0.008227008394896984, -0.02731233462691307, -0.007027929648756981, 0.03637203574180603, -0.009426086209714413, -0.020757373422384262, -0.016214201226830482, -...
14
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "s_x", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "s_y", "annotation": null, "type_comment": null}}, {"_type": "arg",...
def refl_sects(s_x, s_y, sbg, sigma2, bf=3.): sigma = sigma2 ** .5 * bf sector = [] prev = [] for x, y in zip(s_x, s_y - sbg): if y > sigma: if prev: sector = prev prev = [] sector.append((x, y)) elif sector: sector.appe...
17,004
[ 0.004854918457567692, -0.047129470854997635, 0.0473322868347168, -0.024274591356515884, -0.027329513803124428, 0.012200675904750824, -0.012523914687335491, 0.005609142128378153, -0.005403156392276287, 0.06160549074411392, -0.0007031233981251717, -0.00039751228177919984, -0.014184474013745785...
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": "sector", "annotation": null, "type_comment": null}}, {"_type": "a...
def __init__(self, sector, lambda21=None, I2=.5): tps = np.array(sector).transpose() self.x_ar = tps[0] self.y_ar = tps[1] if self.y_ar[0] < 0.: x1, x2 = self.x_ar[:2] y1, y2 = self.y_ar[:2] self.y_ar[0] = 0. self.x_ar[0] = x1 - y1 * (x2 - ...
17,005
[ 0.004997287876904011, -0.00660950830206275, 0.028008610010147095, -0.006954559125006199, 0.009988626465201378, -0.0007964427932165563, 0.015170338563621044, -0.0023811482824385166, 0.02126227132976055, 0.02075064368546009, -0.00016127779963426292, 0.0002933675714302808, -0.026390440762043, ...
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 calc_deviat(self, x, fixx=False, fixs=None): if fixx: the_x = np.zeros((len(x) / 2, 3)) the_x[:, 0] = self.x0 the_x[:, 1:3] = x.reshape(len(x) / 2, 2) x = the_x.reshape(len(the_x) * 3) elif fixs: the_x = np.zeros((len(self.x0), 3)) ...
17,006
[ 0.009396124631166458, -0.002685956424102187, 0.009200896136462688, -0.014232735149562359, 0.036677632480859756, -0.016021274030208588, 0.017280807718634605, 0.00012172215792816132, 0.01400601863861084, 0.010643063113093376, 0.01866629533469677, -0.0062000565230846405, -0.0662514939904213, ...
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": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def calc_deviat3(self, x): the_x = np.zeros(((len(x) - 1) // 2, 3)) the_x[:, :2] = x[: -1].reshape(len(the_x), 2) if the_x[:, 1].min() <= 0. or the_x[:, 1].max() > self.max_h: return np.inf mulout = the_x[:, 0].min() < self.x_ar[0] or \ the_x[:, 0].max() > self.x_...
17,007
[ 0.02391265518963337, -0.02069932036101818, 0.023821817710995674, 0.002722250297665596, 0.017542758956551552, 0.0033183633349835873, 0.0026370910927653313, 0.004879612009972334, 0.031815413385629654, 0.013750344514846802, 0.007692698854953051, 0.02398078143596649, -0.015669260174036026, 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": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def calc_shape(self, x=None): the_x = self.x_ar shape = np.zeros(len(the_x)) l21 = self.lambda21 I2 = self.I2 sh_func = self.sh_func if x is None: peaks = self.peaks if peaks is None: return shape else: peaks = x...
17,008
[ 0.024830035865306854, 0.009607281535863876, 0.00674991263076663, 0.0037046526558697224, 0.01632174290716648, 0.01839209347963333, -0.0046547455713152885, 0.008437391370534897, 0.043846070766448975, 0.03167921304702759, -0.004679561592638493, -0.007806359324604273, -0.04957498982548714, 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": "x", "annotation": null, "type_comment": null}}], "kwarg": null, "...
def reduce_x(self, x): if len(x) < 6 or not self.red_allow: return x, False, None pcs = len(x) / 3 oxm = x.reshape(pcs, 3) reduced = False sigma2 = None if oxm[:, 2].mean() * 6 < oxm[:, 2].max(): reduced = True self.red_allow -= 1 ...
17,009
[ -0.005668528378009796, -0.019554849714040756, 0.02231043204665184, -0.019456934183835983, -0.03538896143436432, -0.022212518379092216, -0.050271909683942795, -0.006598712410777807, 0.014910922385752201, 0.016813253983855247, -0.012064418755471706, 0.01214834488928318, -0.00639589037746191, ...
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": "sh_type", "annotation": null, "type_comment": null}}, {"_type": "...
def find_bells_pp(self, sh_type, poss, fposs): self.peaks = None nbells = len(poss) self.sh_type = sh_type self.sh_func = _SH_FUNCTIONS[sh_type] if nbells == 0: return [], 0. y_ar = self.y_ar x_ar = self.x_ar area = np.trapz(y_ar, x_ar) ...
17,010
[ 0.03183372691273689, 0.02668592520058155, 0.0322297103703022, -0.046588461846113205, 0.021727507933974266, -0.03946073725819588, 0.05216668173670769, -0.02730572782456875, -0.0189900491386652, 0.021056056022644043, 0.024602701887488365, 0.015314278192818165, 0.01077767089009285, -0.0355008...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "data", "annotation": null, "type_comment": null}}, {"_type": "arg...
def csv_writer(path, data, headers=None, writer_options=None): dirname = os.path.dirname(path) if not os.path.exists(dirname): os.makedirs(dirname) if headers is None: headers, data = data writer_options = writer_options or {} with open(path, 'w') as fp: writer = csv.DictWrit...
17,011
[ 0.030842643231153488, 0.04628848284482956, -0.02238420769572258, -0.051927439868450165, -0.014121909625828266, 0.0030646505765616894, -0.025546927005052567, -0.058841291815042496, 0.00839714240282774, 0.011204362846910954, 0.028660612180829048, -0.013300583697855473, -0.006337697617709637, ...
15
{"_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": "parentHls", "annotatio...
class HlsLoopGateStatus(HlsNetNode): def __init__(self, parentHls:"HlsPipeline", loop_gate: "HlsLoopGate", name:str=None): HlsNetNode.__init__(self, parentHls, name=name) self._loop_gate = loop_gate self._add_output(BIT) def resolve_realization(self): self.assignRealization(IO_...
17,012
[ 0.020755082368850708, 0.01029956340789795, 0.006342191714793444, -0.023133404552936554, 0.008766001090407372, -0.01614139787852764, 0.003989862278103828, -0.016115404665470123, -0.023107411339879036, 0.007706802804023027, 0.0007903371588326991, 0.020586131140589714, -0.012658391147851944, ...
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": "allocator", "annotation": {"_type": "Constant", "_fields": {"kind...
def allocateRtlInstance(self, allocator: "AllocatorArchitecturalElement") -> TimeIndependentRtlResource: op_out = self._outputs[0] try: return allocator.netNodeToRtl[op_out] except KeyError: pass name = self.name status_reg = allocator._reg(name if name ...
17,013
[ 0.05089593306183815, 0.006624096073210239, 0.023174123838543892, -0.027027400210499763, -0.017292089760303497, 0.004976581782102585, 0.012131694704294205, -0.03452971577644348, -0.005259110126644373, 0.013956214301288128, 0.05871141329407692, -0.0008833262836560607, -0.015807965770363808, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "toHls", "annotation": {"_type": "Constant", "_fields": {"kind": nu...
def inset_before_block(cls, toHls: "SsaToHwtHlsNetlist", block: SsaBasicBlock, io: "SsaToHwtHlsNetlistSyncAndIo", to_hls_cache: SsaToHwtHlsNetlistOpCache, nodes: List[HlsNetNode], ): hls = toHls.hls ...
17,014
[ 0.03442270681262016, 0.007416636683046818, -0.047720134258270264, -0.022036872804164886, 0.00960149709135294, 0.027585726231336594, 0.002568821655586362, -0.00463230162858963, 0.016706010326743126, -0.00624741381034255, 0.007391864899545908, -0.01966870203614235, 0.03858434408903122, -0.02...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "obj", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}...
def encode_to_dict(obj): if hasattr(obj, 'to_dict'): # Calling encode_to_dict to ensure object is # nomalized to a base dictionary all the way down. return encode_to_dict(obj.to_dict()) elif isinstance(obj, (list, tuple)): new_lst = [] for o in list(obj): new_...
17,015
[ -0.0007649032049812376, 0.0028230450116097927, 0.03440224379301071, -0.03579011186957359, 0.03772471100091934, -0.025360090658068657, -0.012438219971954823, 0.007570176385343075, 0.01868361607193947, -0.015907883644104004, 0.03078538365662098, -0.04634630307555199, 0.006576590705662966, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "file_name", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs...
def xls_xml(file_name): data = [] excel = xlrd.open_workbook(file_name) table = excel.sheet_by_name('numbers') # print(table.row_values(0)) nrows = table.nrows for i in range(nrows): data.append(table.row_values(i)) output = codecs.open('numbers.xml','w','utf-8') root = etree.Element('root') numbers_xml = e...
17,016
[ 0.032943256199359894, 0.03417619317770004, 0.016763638705015182, -0.03367869183421135, 0.021392567083239555, 0.02366376854479313, 0.00022137467749416828, -0.03804805502295494, 0.04698145017027855, -0.01820206828415394, 0.0215007197111845, -0.04940406605601311, -0.0036312206648290157, -0.01...
17
{"_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": "title", "annotation": ...
class BaseAWSObject(object): def __init__(self, title, template=None, validation=True, **kwargs): self.title = title self.template = template self.do_validation = validation # Cache the keys for validity checks self.propnames = self.props.keys() self.attributes = ['De...
17,017
[ 0.05955396220088005, 0.06457658857107162, 0.02486647106707096, -0.018263066187500954, -0.015583585947751999, 0.025180384516716003, 0.010986988432705402, -0.00740500632673502, 0.010532934218645096, 0.013924326747655869, 0.041952360421419144, -0.003694094717502594, 0.004571372177451849, -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": "title", "annotation": null, "type_comment": null}}, {"_type": "ar...
def __init__(self, title, template=None, validation=True, **kwargs): self.title = title self.template = template self.do_validation = validation # Cache the keys for validity checks self.propnames = self.props.keys() self.attributes = ['DependsOn', 'DeletionPolicy', ...
17,018
[ 0.04604709520936012, 0.021976029500365257, 0.0035162740387022495, -0.0036226625088602304, 0.037034083157777786, 0.01501440815627575, 0.01121715921908617, -0.025533223524689674, 0.056740496307611465, -0.019575471058487892, 0.0027715549804270267, -0.01643292047083378, 0.02311084046959877, -0...
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": "name", "annotation": null, "type_comment": null}}, {"_type": "arg...
def __setattr__(self, name, value): if name in self.__dict__.keys() \ or '_BaseAWSObject__initialized' not in self.__dict__: return dict.__setattr__(self, name, value) elif name in self.attributes: if name == "DependsOn": self.resource[name] = depe...
17,019
[ 0.01999663934111595, 0.03958434984087944, -0.018238242715597153, -0.035290591418743134, 0.044123463332653046, -0.02997451275587082, -0.04637257382273674, -0.02811388485133648, 0.02801165170967579, -0.08832871168851852, 0.028277456760406494, -0.025333166122436523, 0.040749795734882355, -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": "name", "annotation": null, "type_comment": null}}], "kwarg": null...
def __getattr__(self, name): try: if name in self.attributes: return self.resource[name] else: return self.properties.__getitem__(name) except KeyError: # Fall back to the name attribute in the object rather than # in the pr...
17,020
[ 0.06153251975774765, 0.044944752007722855, 0.008640351705253124, -0.02581978030502796, 0.00043841387378051877, 0.002825037809088826, 0.01414650958031416, -0.009290643036365509, 0.02131037972867489, -0.038527119904756546, 0.025883741676807404, -0.029764171689748764, 0.044731542468070984, -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 to_dict(self): if self.do_validation: self._validate_props() self.validate() if self.properties: return encode_to_dict(self.resource) elif hasattr(self, 'resource_type'): d = {} for k, v in self.resource.items(): if...
17,021
[ 0.004950731061398983, 0.05076481029391289, -0.024262281134724617, -0.0446358360350132, 0.029968567192554474, 0.011972633190453053, 0.013483742251992226, -0.026100974529981613, -0.011803558096289635, 0.017076589167118073, 0.02747470885515213, -0.02185296081006527, 0.0575278140604496, 0.0032...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "cls", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "title", "annotation": null, "type_comment": null}}], "kwarg": {"_t...
def _from_dict(cls, title=None, **kwargs): props = {} for prop_name, value in kwargs.items(): try: prop_attrs = cls.props[prop_name] except KeyError: raise AttributeError("Object type %s does not have a " "%s pr...
17,022
[ 0.00928990263491869, 0.07822830975055695, -0.005660034716129303, -0.008103215135633945, 0.027200741693377495, -0.010360248386859894, -0.026735374704003334, -0.03781112655997276, 0.02131384052336216, 0.027596304193139076, 0.011762168258428574, -0.016357675194740295, 0.01938256435096264, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def _validate_props(self): for k, (_, required) in self.props.items(): if required and k not in self.properties: rtype = getattr(self, 'resource_type', "<unknown type>") title = getattr(self, 'title') msg = "Resource %s required in type %s" % (k, rtype...
17,023
[ 0.04635525122284889, 0.002290695207193494, 0.024962062016129494, -0.0197892002761364, 0.02714749611914158, -0.015288010239601135, -0.02738809399306774, 0.0007744253962300718, 0.017413293942809105, -0.0204307958483696, 0.007227970752865076, -0.01532810926437378, 0.0194684024900198, -0.08128...
8
{"_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 AWSHelperFn(object): def getdata(self, data): if isinstance(data, BaseAWSObject): return data.title else: return data def to_dict(self): return encode_to_dict(self.data)
17,024
[ 0.04413781687617302, -0.001626940444111824, -0.02451188489794731, 0.0019169156439602375, 0.01344663742929697, -0.007939674891531467, -0.027652855962514877, -0.017224013805389404, 0.0177783016115427, 0.019810695201158524, -0.02072424441576004, -0.0454927459359169, 0.014052249491214752, -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}}], "kwarg": {"_type": "arg", "_fields": {"arg": "kwargs", "an...
class Tags(AWSHelperFn): def __init__(self, *args, **kwargs): if not args: # Assume kwargs variant tag_dict = kwargs else: if len(args) != 1: raise(TypeError, "Multiple non-kwargs passed to Tags") # Validate single argument passed in i...
17,025
[ 0.02353033423423767, 0.01681019738316536, -0.04315865412354469, -0.007158621214330196, -0.010789663530886173, 0.003234435571357608, 0.003830576781183481, -0.020357482135295868, -0.024377740919589996, 0.03381746634840965, -0.0011805812828242779, -0.030920514836907387, 0.02516602724790573, -...
9
{"_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, *args, **kwargs): if not args: # Assume kwargs variant tag_dict = kwargs else: if len(args) != 1: raise(TypeError, "Multiple non-kwargs passed to Tags") # Validate single argument passed in is a dict if not i...
17,026
[ 0.06705117225646973, -0.0024833239149302244, 0.014982673339545727, -0.025058606639504433, -0.005140665918588638, 0.035054661333560944, 0.03261270374059677, 0.016625860705971718, -0.006276062689721584, 0.0452561154961586, 0.04518765211105347, -0.024168547242879868, -0.022080330178141594, -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": "d", "annotation": null, "type_comment": null}}, {"_type": "arg", ...
def _update(self, d, values): if isinstance(values, list): for v in values: if v.title in d: self.handle_duplicate_key(v.title) d[v.title] = v else: if values.title in d: self.handle_duplicate_key(values.title) ...
17,027
[ 0.02735850214958191, -0.0015988911036401987, 0.0017071986803784966, -0.04410285875201225, 0.014318265952169895, 0.0033412897028028965, 0.016365280374884605, -0.013083559460937977, -0.0019860907923430204, 0.03899073973298073, -0.015184726566076279, -0.0757720023393631, 0.03426852822303772, ...
11
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Dict", "_fields": {"keys": [{"_type": "Constant", "_fields": {"kind": null, "value": "AWSTemplateFormatVersion"}}, {"_type": "Constant", "_fields": {"kind": null, "value": "Transform"}...
class Template(object): props = { 'AWSTemplateFormatVersion': (basestring, False), 'Transform': (basestring, False), 'Description': (basestring, False), 'Parameters': (dict, False), 'Mappings': (dict, False), 'Resources': (dict, False), 'Outputs': (dict, False...
17,028
[ 0.023041650652885437, -0.02510836347937584, -0.025174323469400406, -0.03412275016307831, 0.005804385524243116, -0.0344085730612278, 0.010410517454147339, 0.02075507491827011, 0.008706578053534031, 0.020447267219424248, -0.006161662749946117, -0.032056037336587906, 0.048325907438993454, -0....
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 to_dict(self): t = {} if self.description: t['Description'] = self.description if self.metadata: t['Metadata'] = self.metadata if self.conditions: t['Conditions'] = self.conditions if self.mappings: t['Mappings'] = self.mappings...
17,029
[ 0.02182399481534958, 0.0179823599755764, 0.0025337287224829197, -0.01208309456706047, -0.000024775508791208267, 0.020893685519695282, -0.01584811694920063, -0.010446842759847641, 0.04108690097928047, 0.054067470133304596, -0.0006053860415704548, -0.025873582810163498, -0.009434445761144161, ...
16
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "List", "_fields": {"ctx": {"_type": "Load", "_fields": {}}, "elts": [{"_type": "Constant", "_fields": {"kind": null, "value": "AllowedPattern"}}, {"_type": "Constant", "_fields": {"kin...
class Parameter(AWSDeclaration): STRING_PROPERTIES = ['AllowedPattern', 'MaxLength', 'MinLength'] NUMBER_PROPERTIES = ['MaxValue', 'MinValue'] props = { 'Type': (basestring, True), 'Default': ((basestring, int, float), False), 'NoEcho': (bool, False), 'AllowedValues': (list, ...
17,030
[ -0.01786128617823124, 0.008236429654061794, 0.04631226882338524, -0.11003869771957397, -0.043770741671323776, -0.0264742374420166, 0.011531001888215542, -0.004718297626823187, 0.00048131635412573814, 0.030545387417078018, 0.021497081965208054, -0.03409881889820099, 0.036310888826847076, -0...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "dataset_dir", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "view_id", "annotation": null, "type_comment": null}}, {"_t...
def _preload_files_speaker_independent(dataset_dir, view_id, utterance_types): train_script = path.join(_current_path, 'splits/speaker_independent/train2.scp') test_script = path.join(_current_path, 'splits/speaker_independent/test2.scp') u_list = _gen_utterance_list(utterance_types) with open(train_...
17,031
[ -0.026796357706189156, 0.029317345470190048, 0.012550605461001396, -0.04022713750600815, 0.003686400828883052, 0.03581541031599045, -0.0010092100128531456, -0.003613053122535348, 0.012691868469119072, 0.0508544035255909, -0.010996721684932709, -0.011637834832072258, 0.006796886678785086, 0...
15
{"_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 validate(self): def check_type(t, v): try: t(v) return True except ValueError: return False # Validate the Default parameter value default = self.properties.get('Default') if default: error_str = ("P...
17,032
[ -0.00971837155520916, 0.029707174748182297, -0.011395389214158058, -0.020988764241337776, 0.012030781246721745, -0.0037706864532083273, 0.006150802131742239, -0.03081129863858223, -0.02587399072945118, 0.03595693036913872, -0.025332346558570862, -0.010343346744775772, 0.007286174222826958, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "file", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "unit", "annotation": null, "type_comment": null}}], "kwarg": null...
def read_sentence_labels(file, unit='character'): with open(path.join(_current_path, 'configs', 'labels'), 'r') as f: contents = f.read().splitlines() labels_dict = dict([(line.split(' ', 1)) for line in contents]) sentence = labels_dict[file] parsed_sentence = sentence.replace(' ', '_') ...
17,033
[ -0.043074898421764374, 0.0025440675672143698, 0.030389411374926567, -0.03236425668001175, -0.044050704687833786, -0.021816251799464226, 0.005030051339417696, 0.017285719513893127, 0.02485983818769455, 0.030064141377806664, 0.0004886294482275844, -0.04335369914770126, -0.020526792854070663, ...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "utype", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def _gen_utterance_list(utype): u_list = [] if 'd' in utype: u_list.extend(list(range(1, 31))) if 's' in utype: u_list.extend(list(range(31, 61))) if 't' in utype: u_list.extend(list(range(61, 71))) u_list = ['u' + str(u) + '.' for u in u_list] return u_list
17,034
[ 0.042189884930849075, 0.0461597815155983, 0.03872595354914665, -0.042112041264772415, 0.0035928539000451565, -0.0008057771483436227, 0.03524256497621536, -0.00881064124405384, -0.010245836339890957, 0.04304613545536995, -0.015879586338996887, -0.016200682148337364, -0.017037473618984222, 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": "With", "_fields": {"body": [{"_type": "Assign", "_fields": {"v...
def read_all_sentences_labels(): with open(path.join(_current_path, 'configs', 'labels'), 'r') as f: contents = f.read().splitlines() labels_dict = dict([(line.split(' ', 1)) for line in contents]) parsed_dict = {} for (k,v) in labels_dict.items(): parsed_sentence = v.replace(' ', '_')...
17,035
[ -0.00619092583656311, -0.009720594622194767, -0.011485428549349308, -0.03617069497704506, 0.030769743025302887, -0.0009860660647973418, -0.008247097954154015, 0.018511148169636726, 0.03847898542881012, -0.004781859926879406, 0.03395204618573189, -0.01874645985662937, -0.03354865685105324, ...
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": {"_type": "arg", "_fields": {"arg": "kwargs", "an...
class TestTokenHandler(OsfTestCase): def setUp(self, *args, **kwargs): super(TestTokenHandler, self).setUp(*args, **kwargs) self.payload = { 'user_id': 'abc123', 'field_x': 'xyzert' } self.secret = settings.JWT_SECRET self.encoded_token = jwt.encode(...
17,036
[ 0.00001130619511968689, -0.040775854140520096, 0.020303109660744667, -0.020451540127396584, 0.02400325983762741, -0.03104308433830738, 0.03700149059295654, 0.05050862580537796, -0.009001222439110279, 0.0010284081799909472, 0.02582682855427265, 0.03816772624850273, -0.027777623385190964, -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": {"_type": "arg", "_fields": {"arg": "kwargs", "annotation": null, "type_comment": null}}, "v...
def setUp(self, *args, **kwargs): super(TestTokenHandler, self).setUp(*args, **kwargs) self.payload = { 'user_id': 'abc123', 'field_x': 'xyzert' } self.secret = settings.JWT_SECRET self.encoded_token = jwt.encode( self.payload, sel...
17,037
[ 0.02269754558801651, 0.017498789355158806, -0.002284134039655328, -0.0021071552764624357, 0.017023159191012383, 0.01178015861660242, -0.013184929266571999, 0.04787279665470123, 0.05194330960512161, 0.018173521384596825, 0.0897725522518158, -0.0025025925133377314, -0.05327065289020538, -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": "mock_handler", "annotation": null, "type_comment": null}}], "kwar...
def test_token_process_with_valid_action(self, mock_handler): self.payload['action'] = 'approve_registration_approval' token = TokenHandler.from_payload(self.payload) token.to_response() assert_true( mock_handler.called_with( 'registration', 'a...
17,038
[ 0.009632355533540249, 0.019487567245960236, 0.0006712779868394136, 0.0223599411547184, 0.029144683852791786, -0.025071362033486366, -0.040733225643634796, 0.025975169613957405, 0.050687484443187714, 0.023820888251066208, 0.043778929859399796, -0.021716132760047913, -0.0289713516831398, -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 test_sanction_handler(self): if not self.kind: return approval_token = self.sanction.approval_state[self.user._id]['approval_token'] handler = TokenHandler.from_string(approval_token) with mock_auth(self.user): with mock.patch('website.tokens.handlers.{0}_hand...
17,039
[ 0.0009645525133237243, 0.006575786042958498, 0.013076776638627052, -0.016106000170111656, -0.011113390326499939, 0.014846940524876118, -0.025704778730869293, -0.013151572085916996, 0.05425179377198219, 0.012777593918144703, 0.0454259030520916, -0.05280574411153793, -0.04530124366283417, 0....
13
{"_type": "Module", "_fields": {"body": [{"_type": "ClassDef", "_fields": {"body": [{"_type": "Assign", "_fields": {"value": {"_type": "Constant", "_fields": {"kind": null, "value": null}}, "targets": [{"_type": "Name", "_fields": {"id": "kind", "ctx": {"_type": "Store", "_fields": {}}}}], "type_comment": null}}, {"_ty...
class SanctionTokenHandlerBase(OsfTestCase): kind = None Model = None Factory = None def setUp(self, *args, **kwargs): OsfTestCase.setUp(self, *args, **kwargs) if not self.kind: return self.sanction = self.Factory() self.reg = AbstractNode.objects.get(Q(**{s...
17,040
[ 0.017149021849036217, 0.012101222760975361, -0.006099678575992584, 0.026079269126057625, 0.023981641978025436, 0.0039499178528785706, -0.041805338114500046, 0.0024058311246335506, 0.05372869223356247, 0.012150290422141552, 0.06555391103029251, -0.02553952857851982, -0.034788716584444046, 0...
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": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_sanction_handler_sanction_approved(self): if not self.kind: return approval_token = self.sanction.approval_state[self.user._id]['approval_token'] handler = TokenHandler.from_string(approval_token) self.sanction.state = Sanction.APPROVED self.sanction.save() ...
17,041
[ 0.015521633438766003, 0.02254421077668667, -0.018784774467349052, 0.01697329618036747, 0.019219033420085907, -0.009107017889618874, -0.034914370626211166, 0.006997762713581324, 0.05091989040374756, 0.004668277222663164, 0.035609181970357895, -0.03836362063884735, -0.018635885789990425, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_sanction_handler_no_sanction(self): if not self.kind: return approval_token = self.sanction.approval_state[self.user._id]['approval_token'] handler = TokenHandler.from_string(approval_token) self.Model.delete(self.sanction) with mock_auth(self.user): ...
17,042
[ -0.015093913301825523, -0.00004334767800173722, 0.03892640769481659, -0.038231294602155685, -0.030163001269102097, -0.05729728937149048, 0.012605155818164349, 0.005632288753986359, -0.04548034444451332, 0.03334066644310951, 0.009663332253694534, 0.006584967952221632, 0.003906915429979563, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "options", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "full_system", "annotation": null, "type_comment": null}}, {"_t...
def create_system(options, full_system, system, dma_ports, ruby_system): if buildEnv['PROTOCOL'] != 'Network_test': panic("This script requires the Network_test protocol to be built.") cpu_sequencers = [] # # The Garnet tester protocol does not support fs nor dma # assert(dma_port...
17,043
[ 0.019049104303121567, 0.014391290955245495, -0.0019233450293540955, 0.03008529543876648, 0.015743162482976913, 0.0011744387447834015, -0.0550088956952095, -0.009075975976884365, 0.046381495893001556, 0.017635783180594444, 0.03485371544957161, -0.04783168435096741, -0.032322026789188385, 0....
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": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def test_sanction_handler_sanction_rejected(self): if not self.kind: return approval_token = self.sanction.approval_state[self.user._id]['approval_token'] handler = TokenHandler.from_string(approval_token) self.sanction.state = Sanction.REJECTED self.sanction.save() ...
17,044
[ 0.02313964255154133, 0.008298962377011776, 0.04777216538786888, 0.0008501122938469052, 0.0334031917154789, -0.010823381133377552, 0.036637768149375916, -0.01048126257956028, -0.04275443032383919, -0.028406191617250443, 0.020641140639781952, 0.012461402453482151, -0.0028665373101830482, -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": "table", "annotation": null, "type_comment": null}}, {"_type": "ar...
def autoinc_sql(self, table, column): # To simulate auto-incrementing primary keys in Oracle, we have to # create a sequence and a trigger. sq_name = self._get_sequence_name(table) tr_name = self._get_trigger_name(table) tbl_name = self.quote_name(table) col_name = self.q...
17,045
[ 0.02993067540228367, 0.007405577693134546, 0.004153290763497353, 0.007892216555774212, 0.042670004069805145, -0.016218069940805435, 0.007776579353958368, -0.009506314061582088, -0.009087130427360535, -0.028774308040738106, 0.009915861301124096, 0.047218386083841324, 0.02017863281071186, -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": "field_name", "annotation": null, "type_comment": null}}, {"_type"...
def _convert_field_to_tz(self, field_name, tzname): if not self._tzname_re.match(tzname): raise ValueError("Invalid time zone name: %s" % tzname) # Convert from UTC to local time, returning TIMESTAMP WITH TIME ZONE. result = "(FROM_TZ(%s, '0:00') AT TIME ZONE '%s')" % (field_name, tz...
17,046
[ -0.008791958913207054, 0.011086604557931423, 0.05957041308283806, -0.023117177188396454, 0.013275806792080402, -0.013185427524149418, 0.02675245888531208, 0.017814887687563896, -0.03235601261258125, 0.0038085097912698984, -0.03693526238203049, -0.016921130940318108, 0.008229594677686691, -...
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": "lookup_type", "annotation": null, "type_comment": null}}, {"_type...
def datetime_trunc_sql(self, lookup_type, field_name, tzname): if settings.USE_TZ: field_name = self._convert_field_to_tz(field_name, tzname) # http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions230.htm#i1002084 if lookup_type in ('year', 'month'): sql = "TRUN...
17,047
[ -0.02849493734538555, -0.012063763104379177, 0.02932959981262684, -0.03389111906290054, 0.021060632541775703, -0.017518175765872, 0.000007075245775922667, 0.006473475601524115, -0.027097366750240326, 0.00030799355590716004, -0.012849897146224976, -0.043091800063848495, 0.03414345905184746, ...
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": "lookup_type", "annotation": null, "type_comment": null}}, {"_type...
def datetime_extract_sql(self, lookup_type, field_name, tzname): if settings.USE_TZ: field_name = self._convert_field_to_tz(field_name, tzname) if lookup_type == 'week_day': # TO_CHAR(field, 'D') returns an integer from 1-7, where 1=Sunday. sql = "TO_CHAR(%s, 'D')" % ...
17,048
[ 0.016154654324054718, -0.010909094475209713, -0.02568443864583969, -0.003628527745604515, 0.029947763308882713, -0.04229886457324028, 0.005997912026941776, -0.018996872007846832, 0.03166145086288452, 0.011922678910195827, 0.01793104037642479, -0.0004891589633189142, -0.017063746228814125, ...
17
{"_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}}, {"_type": "ar...
def convert_values(self, value, field): if isinstance(value, Database.LOB): value = value.read() if field and field.get_internal_type() == 'TextField': value = force_text(value) # Oracle stores empty strings as null. We need to undo this in # order to adh...
17,049
[ 0.04493723437190056, 0.01769533008337021, -0.01103757880628109, -0.001035420224070549, -0.0007312655216082931, 0.02176453173160553, -0.02161957323551178, 0.004353941883891821, 0.005430778954178095, -0.04489582031965256, 0.024166706949472427, -0.04535140469670296, 0.026506757363677025, -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": "cursor", "annotation": null, "type_comment": null}}, {"_type": "a...
def last_executed_query(self, cursor, sql, params): # http://cx-oracle.sourceforge.net/html/cursor.html#Cursor.statement # The DB API definition does not define this attribute. statement = cursor.statement if statement and six.PY2 and not isinstance(statement, unicode): state...
17,050
[ 0.08131325989961624, 0.006776105146855116, 0.006648358888924122, 0.03756850212812424, 0.03423599153757095, 0.021239200606942177, -0.0334584079682827, -0.033902741968631744, 0.006259565707296133, -0.044300176203250885, -0.006470624823123217, 0.006148482207208872, 0.02857072465121746, 0.0210...
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": "name", "annotation": null, "type_comment": null}}], "kwarg": null...
def quote_name(self, name): # SQL92 requires delimited (quoted) names to be case-sensitive. When # not quoted, Oracle has case-insensitive behavior for identifiers, but # always defaults to uppercase. # We simplify things by making Oracle identifiers always uppercase. if not nam...
17,051
[ 0.029482915997505188, 0.056164391338825226, 0.015554780140519142, -0.022648753598332405, 0.006952771916985512, 0.0024300813674926758, -0.001606875448487699, 0.01885325089097023, 0.004654007963836193, 0.00880533829331398, 0.007946832105517387, -0.025913337245583534, -0.003360600443556905, -...
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": "style", "annotation": null, "type_comment": null}}, {"_type": "ar...
def sql_flush(self, style, tables, sequences, allow_cascade=False): # Return a list of 'TRUNCATE x;', 'TRUNCATE y;', # 'TRUNCATE z;'... style SQL statements if tables: # Oracle does support TRUNCATE, but it seems to get us into # FK referential trouble, whereas DELETE FRO...
17,052
[ 0.0512581467628479, -0.021249422803521156, 0.05880088359117508, -0.0377136692404747, -0.03980211541056633, 0.005096921231597662, -0.000038908852729946375, 0.012966608628630638, -0.0359293669462204, -0.031286124140024185, 0.004838400054723024, -0.038200296461582184, 0.013382270000874996, -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": "style", "annotation": null, "type_comment": null}}, {"_type": "ar...
def sequence_reset_by_name_sql(self, style, sequences): sql = [] for sequence_info in sequences: sequence_name = self._get_sequence_name(sequence_info['table']) table_name = self.quote_name(sequence_info['table']) column_name = self.quote_name(sequence_info['column'] ...
17,053
[ 0.03785864636301994, -0.013305318541824818, 0.017885159701108932, 0.03998832404613495, 0.034860555082559586, -0.017254527658224106, 0.011568494141101837, 0.012281833216547966, 0.024584341794252396, -0.02081088349223137, -0.014763010665774345, 0.02303360588848591, 0.03140758350491524, -0.06...
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 value_to_db_time(self, value): if value is None: return None if isinstance(value, six.string_types): return datetime.datetime.strptime(value, '%H:%M:%S') # Oracle doesn't support tz-aware times if timezone.is_aware(value): raise ValueError("Oracl...
17,054
[ -0.019537610933184624, 0.015451082028448582, -0.020397312939167023, 0.0032268264330923557, -0.015674840658903122, 0.010192767716944218, -0.014014319516718388, 0.03598971664905548, 0.010846376419067383, -0.058506838977336884, 0.007501782849431038, -0.020185330882668495, 0.06646791845560074, ...
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": "instance", "annotation...
class _UninitializedOperatorsDescriptor(object): def __get__(self, instance, owner): # If connection.operators is looked up before a connection has been # created, transparently initialize connection.operators to avert an # AttributeError. if instance is None: raise Attr...
17,055
[ -0.007297330070286989, 0.0006665000109933317, -0.013351581059396267, -0.0113488445058465, -0.018070675432682037, 0.010456820018589497, -0.012131523340940475, 0.03052447736263275, -0.005199635401368141, -0.0506439283490181, 0.03482921048998833, -0.002897638361901045, 0.056122682988643646, -...
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}}, {"_type": ...
def __get__(self, instance, owner): # If connection.operators is looked up before a connection has been # created, transparently initialize connection.operators to avert an # AttributeError. if instance is None: raise AttributeError("operators not available as class attribute...
17,056
[ 0.02250084839761257, 0.011535369791090488, 0.06779731810092926, 0.0010802126489579678, 0.030223848298192024, -0.035942405462265015, 0.06359191983938217, 0.02153792977333069, -0.02855347841978073, 0.029850471764802933, 0.002167794620618224, -0.015200355090200901, 0.02953604981303215, -0.031...
9
{"_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, *args, **kwargs): super(DatabaseWrapper, self).__init__(*args, **kwargs) self.features = DatabaseFeatures(self) use_returning_into = self.settings_dict["OPTIONS"].get('use_returning_into', True) self.features.can_return_id_from_insert = use_returning_into self...
17,057
[ -0.008872957900166512, -0.039276596158742905, 0.04947229102253914, -0.03678560256958008, 0.015206646174192429, 0.012705997563898563, 0.0792483538389206, -0.0014796308241784573, -0.04309998080134392, 0.006855059415102005, -0.03373461589217186, -0.002910986542701721, 0.03145603463053703, -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 _connect_string(self): settings_dict = self.settings_dict if not settings_dict['HOST'].strip(): settings_dict['HOST'] = 'localhost' if settings_dict['PORT'].strip(): dsn = Database.makedsn(settings_dict['HOST'], int(settings_dict['PO...
17,058
[ 0.009901156648993492, -0.03127468749880791, 0.06808604300022125, 0.0398789681494236, -0.004171205218881369, 0.035339899361133575, 0.03805835172533989, 0.006796134170144796, -0.043146099895238876, -0.010306430980563164, 0.0011402230011299253, 0.020774971693754196, 0.022520767524838448, 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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def init_connection_state(self): cursor = self.create_cursor() # Set the territory first. The territory overrides NLS_DATE_FORMAT # and NLS_TIMESTAMP_FORMAT to the territory default. When all of # these are set in single statement it isn't clear what is supposed # to happen. ...
17,059
[ 0.04074617475271225, 0.015388301573693752, 0.017880694940686226, 0.024211816489696503, 0.023054635152220726, 0.009441050700843334, 0.03767519071698189, 0.02332167699933052, -0.005541123449802399, -0.04958081617951393, 0.051806166768074036, -0.005162814166396856, 0.0011655275011435151, 0.02...
14
{"_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 _commit(self): if self.connection is not None: try: return self.connection.commit() except Database.DatabaseError as e: # cx_Oracle 5.0.4 raises a cx_Oracle.DatabaseError exception # with the following attributes and values: ...
17,060
[ 0.04793106019496918, 0.02421949990093708, 0.042043574154376984, 0.021321933716535568, 0.04093534126877785, -0.00541706383228302, 0.01970576122403145, 0.002645039465278387, 0.0019220908870920539, 0.013437320478260517, 0.007497886195778847, 0.0040490892715752125, 0.020005907863378525, -0.008...
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": "param", "annotation": null, "type_comment": null}}, {"_type": "ar...
def __init__(self, param, cursor, strings_only=False): # With raw SQL queries, datetimes can reach this function # without being converted by DateTimeField.get_db_prep_value. if settings.USE_TZ and (isinstance(param, datetime.datetime) and not isinstance(param, Or...
17,061
[ 0.008015455678105354, 0.007147617172449827, 0.03203771635890007, 0.04061967879533768, 0.061375491321086884, 0.025408392772078514, -0.046043671667575836, 0.012191930785775185, 0.014403714798390865, -0.014307287521660328, 0.01170377153903246, -0.026517298072576523, 0.010649105533957481, 0.01...
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": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def is_usable(self): try: if hasattr(self.connection, 'ping'): # Oracle 10g R2 and higher self.connection.ping() else: # Use a cx_Oracle cursor directly, bypassing Django's utilities. self.connection.cursor().execute("SELECT 1 FROM DUAL"...
17,062
[ 0.03231141343712807, 0.0195810217410326, 0.009714149869978428, -0.03418770059943199, -0.015730269253253937, 0.013144919648766518, -0.008274208754301071, 0.024239012971520424, -0.01722475327551365, 0.03403497859835625, -0.004851620644330978, -0.03996928036212921, 0.008699646219611168, 0.016...
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": "params_list", "annotation": null, "type_comment": null}}], "kwarg...
def _guess_input_sizes(self, params_list): # Try dict handling; if that fails, treat as sequence if hasattr(params_list[0], 'keys'): sizes = {} for params in params_list: for k, value in params.items(): if value.input_size: ...
17,063
[ 0.025190839543938637, 0.004839806351810694, 0.00502407643944025, 0.007907365448772907, 0.02230755053460598, -0.004663665778934956, -0.02568945288658142, 0.007473788224160671, 0.015251080505549908, 0.0014836472691968083, -0.015337795950472355, -0.04058283194899559, 0.05176912620663643, 0.04...
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": "query", "annotation": null, "type_comment": null}}, {"_type": "ar...
def _fix_for_params(self, query, params): # cx_Oracle wants no trailing ';' for SQL statements. For PL/SQL, it # it does want a trailing ';' but not a trailing '/'. However, these # characters must be included in the original query in case the query # is being passed to SQL*Plus. ...
17,064
[ 0.026109829545021057, 0.028023524209856987, 0.04544474184513092, 0.004242572467774153, 0.008358664810657501, -0.017047276720404625, -0.011306194588541985, 0.049096159636974335, -0.024592071771621704, -0.029013367369771004, 0.01375880278646946, -0.0181690976023674, 0.041815321892499924, 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": "query", "annotation": null, "type_comment": null}}, {"_type": "ar...
def execute(self, query, params=None): query, params = self._fix_for_params(query, params) self._guess_input_sizes([params]) try: return self.cursor.execute(query, self._param_generator(params)) except Database.DatabaseError as e: # cx_Oracle <= 4.4.0 wrongly rais...
17,065
[ 0.023462338373064995, 0.00009002086153486744, 0.041748981922864914, 0.0256331879645586, -0.0073894718661904335, -0.0263445395976305, -0.02440671995282173, 0.047292619943618774, -0.021499989554286003, -0.000567241630051285, 0.029484298080205917, -0.06333482265472412, 0.04302451014518738, 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": "query", "annotation": null, "type_comment": null}}, {"_type": "ar...
def executemany(self, query, params=None): if not params: # No params given, nothing to do return None # uniform treatment for sequences and iterables params_iter = iter(params) query, firstparams = self._fix_for_params(query, next(params_iter)) # we build...
17,066
[ 0.010580472648143768, 0.015381455421447754, 0.012566099874675274, -0.00502415094524622, 0.018803371116518974, -0.021092278882861137, -0.010219969786703587, -0.01786492019891739, 0.011936650611460209, 0.008915293030440807, -0.020737498998641968, -0.014523115940392017, 0.021469948813319206, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "row", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "cursor", "annotation": null, "type_comment": null}}], "kwarg": nul...
def _rowfactory(row, cursor): # Cast numeric values as the appropriate Python type based upon the # cursor description, and convert strings to unicode. casted = [] for value, desc in zip(row, cursor.description): if value is not None and desc[1] is Database.NUMBER: precision, scale =...
17,067
[ 0.014936466701328754, 0.015548271127045155, -0.004206155426800251, -0.014103146269917488, -0.0007212435593828559, -0.006719300057739019, -0.027531199157238007, -0.011371123604476452, 0.012816247530281544, 0.03592768684029579, 0.01086480263620615, -0.04907093197107315, -0.007151782512664795, ...
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 __init__(self): self.argument_spec = netapp_utils.na_ontap_host_argument_spec() self.argument_spec.update(dict( state=dict(required=False, choices=['present', 'absent'], default='present'), names=dict(required=True, type='list', aliases=['name']), initiator_group...
17,068
[ 0.025652721524238586, -0.017352649942040443, 0.03719869256019592, -0.055393703281879425, 0.042499955743551254, -0.013533944264054298, 0.005219834391027689, 0.0033497915137559175, 0.005913378670811653, -0.018823975697159767, 0.0014643053291365504, 0.008608936332166195, -0.0038748637307435274,...
9
{"_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 configuration(): host = os.environ.get("WD_HOST", defaults.DRIVER_HOST) port = int(os.environ.get("WD_PORT", str(defaults.DRIVER_PORT))) capabilities = json.loads(os.environ.get("WD_CAPABILITIES", "{}")) return { "host": host, "port": port, "capabilities": capabilities }
17,069
[ 0.030104506760835648, 0.04285692051053047, 0.049439698457717896, -0.021194344386458397, -0.020312968641519547, 0.007622527424246073, 0.018398728221654892, 0.0393589586019516, 0.006699836812913418, 0.03668728470802307, 0.02889261581003666, -0.03630168363451958, -0.016925178468227386, -0.028...
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": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def apply(self): self.autosupport_log() initiators = self.get_initiators() for initiator in self.parameters['names']: present = None if initiator in initiators: present = True cd_action = self.na_helper.get_cd_action(present, self.parameters) ...
17,070
[ 0.0296940878033638, -0.003242457751184702, 0.03692562133073807, -0.022078577429056168, -0.0051410021260380745, -0.00464770058169961, 0.07743500918149948, -0.011049955151975155, 0.031677957624197006, 0.011135282926261425, 0.05819358304142952, -0.028030194342136383, 0.024233106523752213, 0.0...
7
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "session", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "create_window", "annotation": null, "type_comment": null}}], "...
def closed_window(session, create_window): original_handle = session.window_handle new_handle = create_window() session.window_handle = new_handle session.close() assert new_handle not in session.handles, "Unable to close window {}".format(new_handle) yield new_handle session.window_hand...
17,071
[ -0.0035907207056879997, 0.03530263155698776, -0.03401438146829605, -0.010763687081634998, -0.020227821543812752, -0.008311486802995205, 0.02594585344195366, 0.035709448158741, 0.04262533038854599, 0.04242192208766937, -0.0167020782828331, -0.009187272749841213, 0.04282873868942261, 0.01814...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "dialog_type", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "text", "annotation": null, "type_comment": null}}], "kwarg...
def create_dialog(dialog_type, text=None): assert dialog_type in ("alert", "confirm", "prompt"), ( "Invalid dialog type: '%s'" % dialog_type) if text is None: text = "" assert isinstance(text, basestring), "`text` parameter must be a string" # Script completes ...
17,072
[ 0.00011344497033860534, -0.019346415996551514, 0.0236480962485075, -0.003975710831582546, 0.005065061151981354, -0.028306391090154648, -0.02743714116513729, -0.019903628155589104, -0.049391310662031174, 0.030446087941527367, -0.027927488088607788, -0.07471104711294174, 0.009015697054564953, ...
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": "request", "annotation": null, "type_comment": null}}, {"_type": "...
def app_index(self, request, app_label, extra_context=None): app_dict = self._build_app_dict(request, app_label) if not app_dict: raise Http404('The requested admin page does not exist.') # Sort the models alphabetically within each app. app_dict['models'].sort(key=lambda x: ...
17,073
[ 0.023612311109900475, -0.017934080213308334, 0.05863477662205696, -0.04354652389883995, 0.014886897057294846, -0.016658827662467957, -0.026431290432810783, 0.0170883871614933, 0.016658827662467957, -0.0122222900390625, 0.028538813814520836, -0.0019145570695400238, -0.03729107230901718, 0.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}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs...
class CartridgeTest(unittest.TestCase): def setUp(self): self.cart = Cartridge() def tearDown(self): self.cart = None def test_inesprg_1(self): self.cart.set_iNES_prg(1) self.assertEquals(1, self.cart.inespgr) def test_inesprg_2(self): self.cart.set_iNES_prg(2...
17,074
[ 0.028948232531547546, -0.04689723253250122, 0.037320785224437714, -0.0033158448059111834, 0.020384151488542557, -0.01592426374554634, 0.005769809707999229, 0.03701980784535408, 0.028154755011200905, -0.023735908791422844, 0.02889350987970829, -0.007544872350990772, -0.018455183133482933, -...
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_using_org_to_jump(self): self.cart.set_bank_id(0) self.cart.set_org(0xc000) code = [0x4e, 0x45, 0x53, 0x1a] self.cart.append_code(code) self.cart.set_org(0xc000 + 8) self.cart.append_code(code) self.assertEquals( [0x4e, 0x45, 0x53, 0x1a, 0xff,...
17,075
[ -0.036137282848358154, 0.04173867776989937, 0.00031149646383710206, -0.013542617671191692, -0.029046906158328056, -0.002502311719581485, 0.002540718065574765, 0.032119400799274445, -0.005276421085000038, 0.07898678630590439, 0.016095152124762535, 0.008012124337255955, 0.06920206546783447, ...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "all_concepts_list", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "stats_dir", "annotation": null, "type_comment": null...
def gen_phrase_mask(all_concepts_list, stats_dir, save_description): num_vocabulary = len(all_concepts_list) component_vocab_mat = np.zeros((num_vocabulary, num_vocabulary)) all_concepts_dict = dict(list(zip(all_concepts_list, list(range(0, num_vocabulary))))) for phrase in all_concepts_list: fo...
17,076
[ 0.0005204046610742807, 0.060873862355947495, -0.007398913614451885, -0.04879400134086609, -0.009690850973129272, 0.004691731184720993, 0.02374986559152603, -0.00945356860756874, -0.03634743392467499, 0.0114974370226264, 0.02838766947388649, 0.021107396110892296, 0.01376241073012352, 0.0108...
14
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "fn", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "filetype", "annotation": null, "type_comment": null}}], "kwarg": {"...
def move_file(fn, filetype, **opts): (path, filename) = fn.rsplit("/", 1) dest_dir = get_setting('trash_dir', fn) + path if opts['interactive'] and not opts['force']: a = raw_input("Move '%s' to trash? (y/N)> " % fn) if a not in ['y', 'Y', 'yes']: print("%s Not removed" % fn) ...
17,077
[ 0.040376972407102585, 0.05123051628470421, 0.06480861455202103, -0.02496761828660965, -0.010942873544991016, 0.003966791555285454, 0.05252579227089882, 0.010881459340453148, -0.013812586665153503, 0.018748046830296516, 0.029255438596010208, -0.001998749328777194, 0.001919190282933414, -0.0...
9
{"_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 init(): read_config() if not os.path.isdir(get_setting('trash_dir')): print("Created directory %s" % get_setting('trash_dir')) os.mkdir(get_setting('trash_dir')) global db db = sqlite3.connect(os.path.join(get_setting('trash_dir'), '.delayrm.sqlite3')) db.text_factory = str d...
17,078
[ 0.02809891477227211, 0.05208351090550423, 0.034480780363082886, -0.039343155920505524, -0.01584947109222412, 0.00881305430084467, 0.038244444876909256, 0.03284440562129021, -0.0004580391978379339, 0.04937180504202843, 0.04083926975727081, -0.0066682323813438416, 0.033265188336372375, -0.01...
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "background", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "purge", "annotation": null, "type_comment": null}}, {"_type...
def cleanup(background=False, purge=False, explicit=False): cur = db.cursor() if purge: cur.execute("SELECT * FROM files ORDER BY type DESC, LENGTH(trash_location) DESC") else: cur.execute("SELECT * FROM files WHERE purge_ts < ? ORDER BY type DESC, LENGTH(trash_location) DESC", (time.time(),) ) trashdir...
17,079
[ 0.012722569517791271, 0.013669219799339771, -0.023759892210364342, -0.03337203711271286, 0.012129612267017365, 0.023135727271437645, 0.02194981276988983, 0.027067968621850014, 0.028774019330739975, 0.08938047289848328, 0.03497406095266342, -0.016550783067941666, 0.002382230944931507, -0.03...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "dir", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "explicit", "annotation": null, "type_comment": null}}, {"_type": "...
def rmdir_if_empty(dir, explicit=False, background=False): try: os.rmdir (dir) if explicit and not background: print("rmdir %s" % dir) except OSError as e: if e.errno == 39: return False # dir not empty else: print("OSError exception while removing directory: %s" % e) exce...
17,080
[ -0.002396330703049898, -0.0146818021312356, 0.027195820584893227, -0.05741339921951294, -0.034334175288677216, 0.009771445766091347, 0.06350070983171463, -0.044581878930330276, 0.006295328959822655, 0.0053482926450669765, 0.019433407112956047, -0.01745174638926983, 0.04996848851442337, 0.0...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "setting_name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}, {"_typ...
def get_setting(setting_name, path=None, include_source = False): s = None src = None if setting_name in options['default']: s = options['default'][setting_name] src = options['default']['source'] if path: parts = path.split('/') path = '/' for part in parts: ...
17,081
[ 0.05097341537475586, 0.031736161559820175, 0.010925911366939545, -0.010830257087945938, 0.02344607189297676, -0.041110336780548096, 0.007094402797520161, 0.03807063773274422, -0.03736916929483414, 0.025571735575795174, 0.03651890158653259, 0.003717254614457488, 0.04553171619772911, 0.01238...
11
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "id", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}...
def restore_file(id): cur = db.cursor() r = cur.execute("SELECT * FROM files WHERE id = ?", (id,)).fetchone() if not r: print("File with id %s not found." % id) else: d = r['original_location'].rsplit('/', 1)[0] if not os.path.isdir(d): os.makedirs(d) if os.path.isfile(r['origina...
17,082
[ 0.06330404430627823, 0.01580081135034561, 0.008543021976947784, -0.06572330743074417, -0.0009859756100922823, 0.030165184289216995, 0.040220245718955994, 0.015687407925724983, -0.022869594395160675, 0.025087252259254456, -0.0005831589223816991, 0.01793026551604271, 0.046873219311237335, 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 create_config(): config = ConfigParser.RawConfigParser(allow_no_value = True) config.optionxform = str config.add_section('#information') config.set('#information', '; the main config file for DELay.py, an rm wrapper. http://github.com/youvegottabecrazy/DELay') config.set('#information', '; Opti...
17,083
[ 0.05524744838476181, 0.035691455006599426, 0.022917548194527626, -0.07968654483556747, 0.0057293870486319065, 0.018612397834658623, 0.06987316161394119, -0.017338545992970467, -0.013481603935360909, 0.013528783805668354, -0.020511381328105927, 0.05279410257935524, 0.045268937945365906, -0....
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "path", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def create_local_config(path): fn = os.path.join(path, '.delayrc') if os.path.isfile(fn): print("Error: %s already exists." % fn) sys.exit() config = ConfigParser.RawConfigParser(allow_no_value = True) config.optionxform = str config.add_section('#information') config.set('#inf...
17,084
[ 0.007234862074255943, 0.008913791738450527, 0.04292316734790802, -0.01604924350976944, -0.012912295758724213, -0.0183577723801136, 0.05266537889838219, -0.008262102492153645, -0.012768703512847424, 0.031038111075758934, -0.04197324812412262, 0.004349201451987028, 0.031767118722200394, -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": "List", "_fields": {"c...
def get_trash_dirs(): mydirs = [] for x in options: if 'trash_dir' in options[x] and options[x]['trash_dir'] not in mydirs: mydirs.append(options[x]['trash_dir']) cur = db.cursor() cur.execute("SELECT DISTINCT (trash_dir) FROM files") for r in cur.fetchall(): if r['trash_...
17,085
[ 0.04175380989909172, 0.027638886123895645, 0.0068472158163785934, -0.062142033129930496, -0.0004204929282423109, -0.0019163680262863636, 0.034525878727436066, -0.014478594064712524, -0.019115380942821503, 0.020956458523869514, 0.006943815387785435, -0.03404856100678444, 0.04850442707538605, ...
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": "Expr", "_fields": {"value...
def read_config(): if not os.path.isfile(config_file): create_config() global options options = dict() options['default'] = dict() options['rcfiles'] = dict() c = ConfigParser.ConfigParser() c.read(config_file) options['default']['source'] = "%s [%s]" % (config_file, '#main') option...
17,086
[ 0.027192719280719757, 0.015314699150621891, -0.0022539780475199223, -0.03131673485040665, -0.021586637943983078, 0.025173671543598175, 0.03327134624123573, 0.03638583421707153, -0.010288557037711143, -0.014187038876116276, 0.044547948986291885, 0.012350563891232014, 0.016087953001260757, -...
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": "pindexer", "annotation": null, "type_comment": null}}], "kwarg": ...
def __init__(self, pindexer, *args, **kwargs): super(IndexerManager,self).__init__(*args, **kwargs) self.pindexer = pindexer self.src_build = mongo.get_src_build() self.target_db = mongo.get_target_db() self.t0 = time.time() self.prepared = False self.log_folder =...
17,087
[ 0.02817748300731182, 0.009179751388728619, 0.03850843384861946, -0.07520358264446259, -0.05382591113448143, 0.023811286315321922, 0.02557685226202011, -0.03452397882938385, -0.03218579664826393, 0.011583546176552773, 0.044449325650930405, 0.01971946656703949, -0.002099592238664627, -0.0512...
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": "index", "annotation": null, "type_comment": null}}, {"_type": "ar...
def snapshot(self, index, snapshot=None, mode=None, steps=["snapshot","meta"]): # check what to do if type(steps) == str: steps = [steps] if "meta" in steps: assert getattr(btconfig,"BIOTHINGS_ROLE",None) == "master","Hub needs to be master to publish metadata about snaps...
17,088
[ -0.008578096516430378, 0.0033126575872302055, -0.014893360435962677, -0.022497786208987236, -0.04423404112458229, 0.012608768418431282, 0.007430361583828926, -0.020376380532979965, -0.011749327182769775, 0.005056018475443125, 0.019397269934415817, 0.011847238056361675, 0.009366825222969055, ...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "Try", "_fields": {"body": [{"_type": "Assign", "_fields": {"va...
def get_status(): try: res = idxr.get_snapshot_status(btconfig.SNAPSHOT_REPOSITORY, snapshot) assert "snapshots" in res, "Can't find snapshot '%s' in repository '%s'" % (snapshot,btconfig.SNAPSHOT_REPOSITORY) # assuming only one index in the snapshot, so only ...
17,089
[ 0.027098482474684715, 0.025562822818756104, 0.030240677297115326, -0.079948790371418, -0.03182358667254448, 0.013950875028967857, 0.02355465292930603, -0.025279317051172256, -0.03529654070734978, 0.003007825231179595, 0.0516926571726799, 0.01230890117585659, -0.004754637833684683, -0.05008...
13
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "index", "annotation": null, "type_comment": null}}], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": [...
def do(index): def snapshot_launched(f): try: self.logger.info("Snapshot launched: %s" % f.result()) except Exception as e: self.logger.error("Error while lauching snapshot: %s" % e) fut.set_exception(e) ...
17,090
[ 0.0588560625910759, -0.001608023070730269, -0.0039354246109724045, -0.04456520825624466, -0.03080633655190468, 0.004648758098483086, 0.0009445624309591949, 0.021532999351620674, -0.032668258994817734, -0.0038810179103165865, 0.05948476120829582, 0.019949158653616905, -0.024555599316954613, ...
10
{"_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 done(f): nonlocal got_error if None in f.result(): got_error = Exception("Some batches failed") return # compute overall inserted/updated records # returned values looks like [(num,[]),(num,[]),...] ...
17,091
[ 0.023313624784350395, 0.0023667237255722284, -0.005698127672076225, -0.03977832943201065, -0.019678236916661263, 0.01364821009337902, -0.04632946848869324, 0.005732248071581125, 0.0018114896956831217, 0.024976225569844246, 0.04645354300737381, -0.006836512591689825, -0.06456844508647919, -...
10
{"_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 posted(f): try: res = f.result() self.logger.info("Post-index process done for index '%s': %s" % (index_name,res)) except Exception as e: got_error = e self.logger.error("Post-index process failed for ind...
17,092
[ 0.02601182833313942, 0.04860404506325722, 0.015354045666754246, -0.05681110918521881, -0.012196606956422329, -0.012390384450554848, -0.009814279153943062, 0.03136921674013138, -0.019115615636110306, -0.06980562210083008, 0.06365032494068146, 0.0008150069043040276, 0.021429551765322685, -0....
12
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "col_name", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "ids", "annotation": null, "type_comment": null}}, {"_type": "...
def indexer_worker(col_name,ids,pindexer,batch_num,mode="index"): try: if mode == "index": return do_index_worker(col_name,ids,pindexer,batch_num) elif mode == "resume": idxr = pindexer() es_ids = idxr.mexists(ids) missing_ids = [e[0] for e in es_ids i...
17,093
[ 0.05096340551972389, -0.01785152032971382, 0.011952756904065609, -0.07083292305469513, 0.01313489768654108, 0.009248162619769573, -0.011588562279939651, -0.005701739806681871, -0.015785759314894676, 0.045231811702251434, 0.038353901356458664, -0.007092845160514116, 0.011606473475694656, -0...
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": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []...
def iterdot(self): # write graph title yield 'digraph %s {\n' % (self.name,) # write overall graph attributes for attr_name, attr_value in self.attr.iteritems(): yield '%s="%s";' % (attr_name, attr_value) yield '\n' # some reusable patterns cpatt = ...
17,094
[ 0.02598210982978344, 0.00563540356233716, 0.021241871640086174, -0.013354217633605003, -0.0034341237042099237, 0.056373149156570435, 0.02780429646372795, 0.0031729009933769703, -0.03022538684308529, 0.03376782312989235, 0.056933820247650146, 0.0018827153835445642, -0.03626536577939987, -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": "While", "_fields": {"body": [{"_type": "Expr", "_fields": {"va...
def decProcess(): while 1: yield clock.posedge, reset.negedge if reset == ACTIVE_LOW: count.next = 0 else: if enable: if count == -n: count.next = n-1 else: ...
17,095
[ 0.041307829320430756, -0.00494129303842783, -0.0035612357314676046, -0.03587522357702255, -0.007385339587926865, 0.04215902090072632, 0.02420889213681221, -0.004734753631055355, -0.04113258421421051, 0.05112157016992569, 0.04974464327096939, -0.0035330713726580143, -0.03857900947332382, -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": "While", "_fields": {"body": [{"_type": "Expr", "_fields": {"va...
def logic(): while 1: yield clock.posedge, reset.negedge if reset == ACTIVE_LOW: count.next = 0 else: if enable: if count == -n: count.next = n-1 else: coun...
17,096
[ 0.005448467098176479, 0.027814742177724838, 0.009297828190028667, -0.0042733666487038136, 0.025173794478178024, 0.029074642807245255, 0.028129717335104942, 0.01924983598291874, 0.009649147279560566, 0.03854813054203987, 0.05252818763256073, 0.013289534486830235, 0.001583962352015078, -0.03...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "count", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "enable", "annotation": null, "type_comment": null}}, {"_type": "...
def decTask(count, enable, clock, reset, n): def decTaskFunc(cnt, enable, reset, n): if enable: if cnt == -n: cnt.next = n-1 else: cnt.next = cnt - 1 @instance def decTaskGen(): cnt = intbv(0, min=-n, max=n) while 1: ...
17,097
[ 0.014189978130161762, 0.03739900887012482, 0.0009161855559796095, 0.0007816513534635305, 0.006403528153896332, 0.04047751426696777, 0.03254074603319168, -0.002813944825902581, 0.0008447847212664783, 0.030736936256289482, 0.05781814828515053, 0.013095666654407978, -0.0044554127380251884, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "count", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "enable", "annotation": null, "type_comment": null}}, {"_type": "...
def decFunc(count, enable, clock, reset, n): def decFuncFunc(cnt): count_next = intbv(0, min=-n, max=n) if count == -n: count_next[:] = n-1 else: count_next[:] = cnt - 1 return count_next @always(clock.posedge, reset.negedge) def decFuncGen(): ...
17,098
[ -0.0075596775859594345, 0.01247507706284523, 0.04575695842504501, -0.02314869873225689, -0.011156153865158558, 0.018696529790759087, 0.02433251217007637, 0.013407972641289234, -0.004387829918414354, 0.025181768462061882, 0.050929710268974304, 0.03306956961750984, -0.012224160134792328, -0....
9
{"_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 decTaskGen(): cnt = intbv(0, min=-n, max=n) while 1: yield clock.posedge, reset.negedge if reset == ACTIVE_LOW: cnt[:] = 0 count.next = 0 else: # print count decTaskFunc(cnt, enable, reset, n) ...
17,099
[ 0.004294324200600386, 0.04531419277191162, 0.0011643061880022287, -0.01301603578031063, 0.03140300139784813, 0.0292739849537611, 0.01149185374379158, 0.005803385749459267, 0.016088593751192093, 0.01184870582073927, 0.0563705638051033, 0.007022127043455839, 0.003535256953909993, -0.01744342...
10
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [{"_type": "arg", "_fields": {"arg": "count", "annotation": null, "type_comment": null}}, {"_type": "arg", "_fields": {"arg": "enable", "annotation": null, "type_comment": null}}, {"_type": "...
def decTaskFreeVar(count, enable, clock, reset, n): def decTaskFunc(): if enable: if count == -n: count.next = n-1 else: count.next = count - 1 @instance def decTaskGen(): while 1: yield clock.posedge, reset.negedge ...
17,100
[ 0.009447464719414711, 0.015752241015434265, 0.011885312385857105, -0.008529230952262878, -0.004840128589421511, 0.03220285847783089, 0.009738454595208168, 0.021119384095072746, 0.012124570086598396, 0.02375769056379795, 0.05659426003694534, -0.0033399148378521204, -0.008703825064003468, -0...
9
{"_type": "Module", "_fields": {"body": [{"_type": "FunctionDef", "_fields": {"args": {"_type": "arguments", "_fields": {"args": [], "kwarg": null, "vararg": null, "defaults": [], "kwonlyargs": [], "kw_defaults": [], "posonlyargs": []}}, "body": [{"_type": "While", "_fields": {"body": [{"_type": "Expr", "_fields": {"va...
def decTaskGen(): while 1: yield clock.posedge, reset.negedge if reset == ACTIVE_LOW: count.next = 0 else: # print count decTaskFunc()