query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
input str > output str
def _call_function(self, svcname, fcallstr): try: argv = json.loads(fcallstr) except Exception as e: raise SearpcError('bad call str: ' + str(e)) service = self.services[svcname] fname = argv[0] fn = service.func_table.get(fname, None) if fn is N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(string):", "def compress(string):", "def _convert(input_string):\n return ''.join([l for l in input_string])", "def encode_fn(s_in):\r\n s_out = s_in.split()\r\n return s_out", "def func2(s):\n return(s+'-'+s)", "def string_reverser(our_string):\\\\\n\\\n # TODO: Write your so...
[ "0.6515497", "0.6515497", "0.6079547", "0.58948666", "0.582403", "0.58064014", "0.57150865", "0.56963557", "0.56930417", "0.56817734", "0.5644455", "0.56086725", "0.55884194", "0.5581903", "0.55768704", "0.5560113", "0.5558583", "0.55510515", "0.5537431", "0.5502038", "0.5500...
0.0
-1
returns the current details of the device
def get_details(): # noqa: E501 running = [] process, running_since = worker.get_current_offsite_process() if process: running.append({'pid' : process.pid, 'running_since':running_since, 'type' : 'offsite'}) return {'device_id' : environment.get_safeplan_id(), 'mode' : environment.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_information(self):\n return self.mycam.devicemgmt.GetDeviceInformation()", "def device_information(self):\n return self._device_information", "def get_device_info(self): # pylint: disable=no-self-use\r\n serial = get_serial_number()\r\n model = get_model()\r\n\r\n ...
[ "0.80045384", "0.7803101", "0.75217736", "0.7475363", "0.74523574", "0.7449998", "0.7438452", "0.7392861", "0.7330447", "0.7272979", "0.7263722", "0.72514516", "0.7246834", "0.7227819", "0.7174147", "0.7153272", "0.7141643", "0.7059342", "0.7041622", "0.7030015", "0.70246345"...
0.0
-1
persist tweet data into cassandra
def persist_data(tweet_data, cassandra_session): try: logger.debug('Start to persist data to cassandra %s \n', tweet_data) parsed = json.loads(tweet_data) unit_id = str(parsed.get('_unit_id')) gender = parsed.get('gender') tweet_text = str(parsed.get('text')) hashtags...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def persist_db(database, tweets):\n log.debug(\"{} tweets to db\".format(len(tweets)))\n\n for tweet in tweets:\n tweet['_id'] = tweet['id_str']\n database.update(tweets)", "def insert_tweets(conn: Connection, fetch_data: Iterable[Dict]) -> None:\n\n s = Session(bind=conn)\n meta = MetaData...
[ "0.7387163", "0.67616653", "0.66996026", "0.66227996", "0.66101587", "0.6543893", "0.6499494", "0.6354981", "0.623357", "0.60689884", "0.6036905", "0.6031254", "0.59903", "0.593716", "0.59077364", "0.5884541", "0.58744943", "0.5866427", "0.58403707", "0.5819588", "0.5809459",...
0.78405553
0
a shutdown hook to be called before the shutdown
def shutdown_hook(consumer, session): try: logger.info('Closing Kafka Consumer') consumer.close() logger.info('Kafka Consumer closed') logger.info('Closing Cassandra Session') session.shutdown() logger.info('Cassandra Session closed') except KafkaError as kafka_er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_shutdown(self) -> None:\n pass", "def shutdown(self):\n ...", "def _shutdown(self):", "def shutdown(self):", "def shutdown(self) -> None:", "def shutdown(self) -> None:", "def __shutdown(self):\n\n pass", "def shutdown(self):\n pass", "def shutdown(self):\n ...
[ "0.855908", "0.8463872", "0.839023", "0.82942384", "0.8168748", "0.8168748", "0.80996776", "0.8064619", "0.8064619", "0.8064619", "0.80090046", "0.79692173", "0.7938058", "0.7879143", "0.7756262", "0.7754289", "0.774551", "0.774551", "0.77298015", "0.76399136", "0.7620521", ...
0.65447503
94
Classification Loss for the inlier confidence
def forward(self, pred, gt, weight=None): num_pos = torch.relu(torch.sum(gt) - 1) + 1 num_neg = torch.relu(torch.sum(1 - gt) - 1) + 1 if weight is not None: loss = nn.BCEWithLogitsLoss(reduction='none')(pred, gt.float()) loss = torch.mean(loss * weight) elif self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classification_loss(self, logit, target):\n return F.cross_entropy(logit, target)", "def compute_loss(self):", "def _classification_loss(self, logits, labels, num_classes):\n labels = tf.to_int64(labels)\n onehot_labels = tf.one_hot(labels, num_classes)\n with tf.name_scope('finetuning_loss...
[ "0.69234955", "0.6506819", "0.6503021", "0.6486506", "0.643339", "0.64326847", "0.63457507", "0.6280465", "0.6254545", "0.622455", "0.62184745", "0.6198931", "0.61780906", "0.6167609", "0.6118298", "0.60983837", "0.6094144", "0.60787", "0.60442567", "0.6043714", "0.60414535",...
0.0
-1
Create an Nbin discrete colormap from a specified input map
def discrete_cmap(N, base_cmap=None): base = plt.get_cmap(base_cmap) color_list = base(np.linspace(0, 1, N)) cmap_name = base.name + str(N) return base.from_list(cmap_name, color_list, N)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discrete_cmap(N, base_cmap=None):\n # see https://gist.github.com/jakevdp/91077b0cae40f8f8244a\n base = plt.cm.get_cmap(base_cmap)\n color_list = base(np.linspace(0, 1, N))\n cmap_name = base.name + str(N)\n return base.from_list(cmap_name, color_list, N)", "def discrete_cmap(N, base_cmap=None...
[ "0.72187954", "0.69491076", "0.6924096", "0.6924096", "0.6924096", "0.6920645", "0.69188344", "0.69188344", "0.69188344", "0.69188344", "0.69142735", "0.69021994", "0.67898613", "0.6699816", "0.6696647", "0.6689399", "0.6646159", "0.6633695", "0.65624946", "0.65356964", "0.64...
0.73025054
0
Plot the Fisher/Mutual informations after the linear layer in a network with structured weights, as a function of population size.
def struct_weight_plot_linear_N( Ns, ks, plot, version=1, sigmaP=1., sigmaS=1., sigmaC=1., fax=None ): # create plot if fax is None: fig, ax = plt.subplots(1, 1, figsize=(8, 8)) else: fig, ax = fax # create data arrays data = np.zeros((Ns.size, ks.size)) # iterate over scal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unstruct_weight_plot_mu(\n Ns, mus, sigma, repetitions, plot, design='lognormal',\n sigmaP=1., sigmaS=1., sigmaC=1., fax=None\n):\n # create plot\n if fax is None:\n fig, ax = plt.subplots(1, 1, figsize=(8, 8))\n else:\n fig, ax = fax\n\n # create data arrays\n data = np.zero...
[ "0.59603125", "0.59365004", "0.5904103", "0.5834417", "0.5816956", "0.57983387", "0.579229", "0.5783281", "0.5781921", "0.5778237", "0.57507354", "0.57455456", "0.57277864", "0.57223123", "0.5704177", "0.5695506", "0.5681954", "0.5680151", "0.56744933", "0.5665076", "0.565048...
0.55968064
26
Plot the Fisher/mutual information after the linear layer in a network with structured weights as a function of weight diversity.
def struct_weight_plot_linear_k( Ns, ks, plot, sigmaP=1., sigmaS=1., sigmaC=1., fax=None ): # create plot if fax is None: fig, ax = plt.subplots(1, 1, figsize=(8, 8)) else: fig, ax = fax # create data arrays data = np.zeros((Ns.size, ks.size)) # iterate over population size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def figure_10_12_b():\n xs = np.arange(-6,6,0.1)\n plt.plot(xs,sigmoid(xs))\n x=2.5\n plt.scatter(x,sigmoid(x))\n plt.plot(xs,logistic_lower_bound(xs,x))\n plt.show()", "def plot_exp1():\n legend = ['unweighted', 'weighted']\n labels = ['Degree','Closeness','Current-flow closeness','Betwe...
[ "0.6012279", "0.59906244", "0.58457255", "0.58409256", "0.5807217", "0.5803653", "0.5803143", "0.57942915", "0.5787997", "0.57624686", "0.57492244", "0.5722159", "0.57183284", "0.57179046", "0.5710551", "0.5687692", "0.56850976", "0.5642021", "0.5640326", "0.56129026", "0.560...
0.0
-1
Plot the Fisher/mutual information after the linear layer in a network of unstructured weights, averaged over many repetitions, as a function of network size.
def unstruct_weight_plot_mu( Ns, mus, sigma, repetitions, plot, design='lognormal', sigmaP=1., sigmaS=1., sigmaC=1., fax=None ): # create plot if fax is None: fig, ax = plt.subplots(1, 1, figsize=(8, 8)) else: fig, ax = fax # create data arrays data = np.zeros((Ns.size, mus....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize(self, network, f):\n import matplotlib\n matplotlib.use('Agg',warn=False)\n import matplotlib.pyplot as plt\n # Convert to a network if it is not.\n if not isinstance(network, NeuralNetwork):\n network = NeuralNetwork(network)\n \n fig = plt...
[ "0.6225357", "0.6089174", "0.59853345", "0.598065", "0.5882383", "0.58234656", "0.58226746", "0.5817316", "0.57622045", "0.57604235", "0.57364094", "0.5720234", "0.56863946", "0.5683019", "0.5672461", "0.5671478", "0.5671478", "0.5671162", "0.5670977", "0.56598586", "0.565555...
0.6197951
1
Plot the Fisher information
def struct_weight_plot_nonlinear_N( N_max, ks, s=1., version=1, colors=colors, sigmaP=1., sigmaC=1., fax=None, linestyle='-' ): # create plot if fax is None: fig, ax = plt.subplots(1, 1, figsize=(8, 8)) else: fig, ax = fax # iterate over diversity values for k_idx, k in enum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n fx = self.fitness_functions(self.archive)\n n = len(fx[0])\n\n if n == 2:\n plt.xlabel(\"F1\")\n plt.ylabel(\"F2\")\n plt.suptitle(\"Pareto Front\")\n plt.scatter(fx[:,0], fx[:,1], label='Archive')\n plt.show()\n e...
[ "0.65808874", "0.626406", "0.6216118", "0.6147911", "0.6034033", "0.60058314", "0.5867466", "0.58415306", "0.57958525", "0.576973", "0.5753587", "0.5752581", "0.5725036", "0.57080835", "0.5699472", "0.5678426", "0.5670183", "0.5648965", "0.56333584", "0.5632139", "0.56261015"...
0.0
-1
Plots the asymptotic coefficients for the.
def plot_asymptotic_coefficients(filename, fax=None): # create plot labels = [1, 2, 3] # create plot if fax is None: fig, ax = plt.subplots(1, 1, figsize=(8, 8)) else: fig, ax = fax coef_file = h5py.File(filename, 'r') sigmaP_vals = list(coef_file) ks = np.arange(1, 26)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fitting_coefficients(self):\n from matplotlib import pyplot as plt\n coeff = self.linear_fit[\"coeff\"]\n order = self.linear_fit[\"order\"]\n\n data = {}\n annotations = {}\n for c, o in zip(coeff, order):\n if len(o) == 0:\n continue\n ...
[ "0.7514957", "0.675888", "0.66593856", "0.66397125", "0.65040374", "0.6465431", "0.64535564", "0.64405936", "0.6402966", "0.63325644", "0.63293165", "0.63066345", "0.6284987", "0.62760645", "0.62508875", "0.62294936", "0.6181468", "0.61633366", "0.6143691", "0.6139784", "0.61...
0.68084884
1
Instantiates all attributes of class
def __init__(self, width, height, x=0, y=0, id=None): self.width = width self.height = height self.x = x self.y = y super().__init__(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **attributes):\n for key, value in attributes.items():\n setattr(self, key, value)", "def __init__(self, **initial_attributes):\n\n for attribute_name, attribute_value in initial_attributes.items():\n setattr(self, attribute_name, attribute_value)", "def _...
[ "0.79193056", "0.7585183", "0.73065215", "0.73065215", "0.7271592", "0.7157682", "0.69732094", "0.69365215", "0.6927331", "0.6908333", "0.68598783", "0.6853418", "0.68459684", "0.6842074", "0.6827085", "0.6827085", "0.6827085", "0.6808668", "0.679812", "0.6767194", "0.6723687...
0.0
-1
Validates proper integer input
def data_validator(self, name, value): if type(value) is not int: raise TypeError("{} must be an integer".format(name)) if name == "height" or name == "width": if value <= 0: raise ValueError("{} must be > 0".format(name)) else: if value < 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_input_integer(display_name, value):\n\n if isinstance(value, int) is False:\n raise ValueError(display_name + \" must be integer.\")", "def _int_validator(arg):\n if arg is None or type(arg) != int:\n raise ValueError('Incorrect value: input should be an int')", ...
[ "0.8119586", "0.8115743", "0.79055846", "0.79055846", "0.79005253", "0.7810342", "0.76803356", "0.7638847", "0.7627674", "0.7587302", "0.754328", "0.75223196", "0.75202715", "0.75014913", "0.7496949", "0.7369781", "0.7343255", "0.72971594", "0.7284696", "0.72270626", "0.70808...
0.0
-1
Prints rectangle instance of s
def display(self): """ Coordinates for position are x-axis (LR) and y-axis (NS) """ for coordY in range(self.y): print() for column in range(self.height): for coordLR in range(self.x): print(" ", end="") for row in range(self.width): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return (\"[Rectangle] \" + \"(\" + str(self.id) +\n \") \" + str(self.x) + \"/\" + str(self.y) +\n \" - \" + str(self.width) + \"/\" +\n str(self.height))", "def __str__(self):\n return('[Rectangle] {}/{}'.format(self.__width, self._...
[ "0.7293729", "0.7285719", "0.7265184", "0.7240309", "0.7238516", "0.7238516", "0.72272694", "0.7224055", "0.7208274", "0.71982694", "0.7195153", "0.7167522", "0.7140672", "0.7095318", "0.7082389", "0.70802146", "0.70721513", "0.7057533", "0.7049687", "0.703881", "0.6838621", ...
0.6150172
51
Updates attribute values after initialization
def update(self, *args, **kwargs): arg_name = ['id', 'width', 'height', 'x', 'y'] """ If args only, sets attribute to correct arg_name """ if len(args) > 0: numArgs = 0 for attr in range(len(args)): setattr(self, arg_name[numArgs], args[numArgs]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_attributes(self):", "def init_attrs(self):\n raise NotImplementedError", "def __setstate__(self,values):\n self.initDefault()\n setter = object.__setattr__\n for value,attr in zip(values,self.persistent):\n setter(self,attr,value)\n if self.dirty_sizeCrc =...
[ "0.76846343", "0.713937", "0.71292776", "0.71108615", "0.69312143", "0.6910569", "0.68315035", "0.67924064", "0.67136467", "0.6650798", "0.66037977", "0.65842414", "0.6581001", "0.6557935", "0.6551683", "0.6551683", "0.6551683", "0.64984643", "0.64853996", "0.64698744", "0.64...
0.0
-1
Returns dictionary representation of rectangle
def to_dictionary(self): dict_rect = {} dict_rect["id"] = self.id dict_rect["width"] = self.width dict_rect["height"] = self.height dict_rect["x"] = self.x dict_rect["y"] = self.y return dict_rect
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangledict(self):\n return rectangledict(self.rectangles)", "def to_dictionary(self):\n rect = {\n \"x\": self.x,\n \"y\": self.y,\n \"id\": self.id,\n \"height\": self.height,\n \"width\": self.width\n }\n return(rect)", ...
[ "0.8616319", "0.8495418", "0.83525425", "0.803204", "0.75788933", "0.75179315", "0.7488455", "0.7485972", "0.7306673", "0.72091526", "0.7196483", "0.71058846", "0.71058846", "0.7100922", "0.7064372", "0.70414615", "0.702352", "0.70173866", "0.696988", "0.6928951", "0.6927132"...
0.82221866
3
Builtin that produces readable output
def __str__(self): return "[{}] ({}) {}/{} - {}/{}".format(self.__class__.__name__, self.id, self.x, self.y, self.width, self.height)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out():\n pass", "def __str__(self):\n buf = io.StringIO()\n args.output.write(buf, self.root, self.headings)\n return buf.getvalue()", "def result_display(self, arg):\n if self.rc.pprint:\n out = stringify_func(arg)\n\n if '\\n' in ...
[ "0.67434996", "0.6675876", "0.6605207", "0.65870297", "0.65870297", "0.638238", "0.61577183", "0.61350363", "0.61334103", "0.6096452", "0.6067716", "0.6067716", "0.6053474", "0.5951303", "0.5938522", "0.59368926", "0.59167856", "0.591246", "0.59110695", "0.5866455", "0.586226...
0.0
-1
Gets private width attribute
def width(self): return self.__width
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def width(self):\n return self['width']", "def width(cls):\n return cls._width", "def get_width(self):\r\n return self._width", "def get_width(self):\r\n return self._width", "def get_width(self):\r\n return self._width", "def get_width ( self ):\n return self.wi...
[ "0.8184137", "0.8125833", "0.80577886", "0.80577886", "0.80577886", "0.8047166", "0.80328876", "0.79736733", "0.79641426", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254", "0.7914254...
0.7985438
17
Sets width attribute with exceptions
def width(self, value): self.data_validator("width", value) self.__width = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def setWidth(*args):", "def set_width(self, width):\n...
[ "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.8103286", "0.7799132", "0.7716915", "0.7691494", "0.76657355", "0.7327156", "0.7322452", "0.72473484", "0.72365016", "0.7209335", "0.720844", ...
0.75207454
15
Gets private height attribute
def height(self): return self.__height
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_height(self):\r\n return self._height", "def get_height(self):\r\n return self._height", "def get_height(self):\r\n return self._height", "def get_height(self):\n return self.__height", "def height(self):\n return self[\"height\"]", "def height(self):\n r...
[ "0.84353715", "0.84353715", "0.84353715", "0.8416901", "0.8364535", "0.8364535", "0.8314108", "0.8293492", "0.82894033", "0.82894033", "0.82894033", "0.82894033", "0.8198311", "0.8197521", "0.8197521", "0.8197521", "0.8197521", "0.8197521", "0.8197521", "0.8197521", "0.819752...
0.83028907
17
Sets height attribute with exceptions
def height(self, value): self.data_validator("height", value) self.__height = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def setHeight(*args):", "def __set_height(s...
[ "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7960046", "0.7648685", "0.748632", "0.7476204", "0.7411756", "0.73983234", "0.736104", "0.7289063", "0.7283877", "0.7271966", "0.72565013", "...
0.74990386
12
Gets private x attribute
def x(self): return self.__x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __getattr__(self, attr): # or does it ?\n return self.X[attr]", "def x(self): # same as 'doc' argument of property function\n print(\"getter of x called\")\n return self._x", "def getX(self):\n return self.__x", "def getX(self):\r\n\t\treturn self._x", "def X(self):\n ...
[ "0.73366225", "0.7178378", "0.71707326", "0.7069233", "0.6975005", "0.696708", "0.69611967", "0.6930691", "0.6737194", "0.67043126", "0.6698892", "0.6680465", "0.6672956", "0.66691214", "0.66135776", "0.6592602", "0.65354145", "0.6494344", "0.6475944", "0.6475944", "0.6475944...
0.6837677
18
Sets x attribute with exceptions
def x(self, value): self.data_validator("x", value) self.__x = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setX(self, x):\n self.x = x\n pass", "def setX(self, x):\r\n\t\tself._x=x", "def SetX(self, x):\r\n\r\n self._x = x", "def test_set_invalid_attribute(test_file):\n md = OSXMetaData(test_file.name)\n with pytest.raises(AttributeError):\n md.invalid_attribute = \"value\"",...
[ "0.67835575", "0.66366565", "0.64998025", "0.6493361", "0.6434212", "0.634093", "0.6330782", "0.62619466", "0.6252019", "0.6252019", "0.6203775", "0.61602134", "0.6144574", "0.6125498", "0.60611314", "0.6059942", "0.6044977", "0.6014536", "0.598419", "0.58552957", "0.58276486...
0.6373731
5
Gets private y attribute
def y(self): return self.__y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getY(self):\n return self.__y", "def get_y(self):\n return self.__y", "def getY(self):\r\n\t\treturn self._y", "def getY(self):\n y = self.getAttribute('y')\n kind = self.getKind()\n self._y = y if kind == 'pie' else None\n return self._y", "def y ( self ) :...
[ "0.841883", "0.8398741", "0.83670765", "0.8316007", "0.82583463", "0.82080144", "0.82080144", "0.8157799", "0.8075069", "0.80740833", "0.80477303", "0.8026044", "0.7950843", "0.7929073", "0.79166466", "0.79166466", "0.79166466", "0.79166466", "0.79166466", "0.79166466", "0.79...
0.8127693
17
Sets y attribute with exceptions
def y(self, value): self.data_validator("y", value) self.__y = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setY(self, y):\n self.y = y\n pass", "def setY(self, y):\r\n\t\tself._y=y", "def set_y(self, y: float):\n self.y = y", "def y(self, value):\n self.validate_input(y=value)\n self.__y = value", "def set_y(self, new_y):\r\n self.y = new_y", "def y(self, value):\...
[ "0.73010266", "0.7284235", "0.7217349", "0.7144914", "0.7122965", "0.71036816", "0.7090068", "0.707471", "0.70422107", "0.70308393", "0.7030658", "0.7030658", "0.68635017", "0.68199414", "0.68199414", "0.67532015", "0.6728125", "0.6710675", "0.6618399", "0.6606974", "0.653372...
0.740591
0
Get a topic. Get properties of a topic.
def get( self, resource_group_name, topic_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_by_topic(cls, topic):\n\t\treturn cls.get_by_key_name(get_hash_key_name(topic))", "def GetTopic(self, topic_id):\n return self._TopicSearchHelper(self.topics, topic_id)", "def get_topic(self):\n return self.topic", "def get_topic(topic_id):\n topic = db_session.query(Topic).filter_by(id=...
[ "0.7348398", "0.7158974", "0.6896128", "0.68686783", "0.67778724", "0.6731667", "0.67195165", "0.66983736", "0.6556635", "0.653462", "0.6495557", "0.6423075", "0.63885456", "0.6309059", "0.6280938", "0.62574023", "0.6133886", "0.60826594", "0.6054776", "0.60369676", "0.600980...
0.5999811
21
Create a topic. Asynchronously creates a new topic with the specified parameters.
def create_or_update( self, resource_group_name, topic_name, topic_info, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, topic_name=topic_name, topic_info=topi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_topic(self, topic):\r\n params = {'ContentType' : 'JSON',\r\n 'Name' : topic}\r\n response = self.make_request('CreateTopic', params, '/', 'GET')\r\n body = response.read()\r\n if response.status == 200:\r\n return json.loads(body)\r\n else:...
[ "0.7471098", "0.7402585", "0.72845775", "0.7110733", "0.7105458", "0.6989585", "0.69095284", "0.6822076", "0.6807903", "0.67636377", "0.6747429", "0.6678246", "0.6574695", "0.6569806", "0.6538611", "0.65316314", "0.63990927", "0.6359883", "0.6288723", "0.6288031", "0.61089665...
0.0
-1
Delete a topic. Delete existing topic.
def delete( self, resource_group_name, topic_name, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._delete_initial( resource_group_name=resource_group_name, topic_name=topic_name, custom_headers=custom_headers, raw=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteTopic(self, topic):\n self.deleteTopics((topic,))", "def delete_topic(project_id, topic_id):\n topic_path = PUBLISHER_CLIENT.topic_path(project_id, topic_id)\n PUBLISHER_CLIENT.delete_topic(request={\"topic\": topic_path})\n print(\"Topic deleted: {}\".format(topic_path))", "def delet...
[ "0.87805086", "0.8288089", "0.7962646", "0.7542032", "0.7389564", "0.7293008", "0.69789296", "0.6934829", "0.6782455", "0.6661318", "0.63655853", "0.631414", "0.6278597", "0.6179568", "0.60955304", "0.60870034", "0.6081381", "0.605196", "0.6050192", "0.6035347", "0.59596103",...
0.5234672
62
Update a topic. Asynchronously updates a topic with the specified parameters.
def update( self, resource_group_name, topic_name, topic_update_parameters, custom_headers=None, raw=False, polling=True, **operation_config): raw_result = self._update_initial( resource_group_name=resource_group_name, topic_name=topic_name, topic_update_parameter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateTopic():\n data = request.json\n if \"agenda_id\" in data and \"section_position\" in data and \"topic_position\" in data and \"topic_json\" in data:\n if connectMongo.getAgendaById(data.get(\"agenda_id\")).found:\n responseWrapper: ResponseWrapper = connectMongo.updateTopic(data....
[ "0.6406876", "0.62793636", "0.6253238", "0.60155606", "0.59999967", "0.57946056", "0.5733733", "0.57241786", "0.5705997", "0.55933255", "0.5518536", "0.5493581", "0.5404137", "0.540083", "0.5400001", "0.5390997", "0.539089", "0.5376588", "0.53578776", "0.5324113", "0.5302588"...
0.6249222
3
List topics under an Azure subscription. List all the topics under an Azure subscription.
def list_by_subscription( self, filter=None, top=None, custom_headers=None, raw=False, **operation_config): def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_by_subscription.metadata['url'] path_format_a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_topics(project_id):\n project_path = f\"projects/{project_id}\"\n for topic in PUBLISHER_CLIENT.list_topics(request={\"project\": project_path}):\n print(topic)", "def getSubscriptionTopics(self) -> List[str]:\n return self.cpp.getSubscriptionTopics()", "def list(self, topic, **opt...
[ "0.6736064", "0.62780625", "0.6222821", "0.61687106", "0.6118089", "0.60156256", "0.6014105", "0.5942633", "0.5940105", "0.5926205", "0.5869012", "0.58526254", "0.58135444", "0.5807725", "0.57842153", "0.57534415", "0.5664178", "0.5650704", "0.5627084", "0.56049913", "0.55736...
0.49367982
45
List topics under a resource group. List all the topics under a resource group.
def list_by_resource_group( self, resource_group_name, filter=None, top=None, custom_headers=None, raw=False, **operation_config): def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_by_resource_group.metadata['url'] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getGroupTopics(group_id): \r\n return Group.getGroupTopics(group_id)", "def list_topics(project_id):\n project_path = f\"projects/{project_id}\"\n for topic in PUBLISHER_CLIENT.list_topics(request={\"project\": project_path}):\n print(topic)", "def list(self, topic, **options):\n ...
[ "0.73350304", "0.71119845", "0.6633057", "0.6584748", "0.64957994", "0.633008", "0.6203886", "0.6135123", "0.599666", "0.58811647", "0.58784854", "0.587156", "0.5862472", "0.5858558", "0.58489555", "0.58398205", "0.58149993", "0.5806519", "0.5713717", "0.5682325", "0.5678874"...
0.5553765
25
List keys for a topic. List the two keys used to publish to a topic.
def list_shared_access_keys( self, resource_group_name, topic_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.list_shared_access_keys.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, topic, **options):\n pass", "def topkList(self, key):\n \n return self.execute_command(self.TOPK_LIST, key)", "def keys(self):\n return self.get_list(self.cloudman.list_keypairs(),\n kind=\"key\")", "async def list_keys(request: web.Reque...
[ "0.6742458", "0.65125173", "0.62858456", "0.6196233", "0.6187392", "0.61591", "0.6143663", "0.61088187", "0.6076861", "0.5915004", "0.5914555", "0.59127593", "0.587111", "0.58495784", "0.58279574", "0.580333", "0.5802629", "0.57885945", "0.57775235", "0.5745762", "0.5745174",...
0.6011743
9
Regenerate key for a topic. Regenerate a shared access key for a topic.
def regenerate_key( self, resource_group_name, topic_name, key_name, custom_headers=None, raw=False, **operation_config): regenerate_key_request = models.TopicRegenerateKeyRequest(key_name=key_name) # Construct URL url = self.regenerate_key.metadata['url'] path_format_argume...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def generate_new_refesh_key(payload: dict = Depends(get_jwt_payload)):\n if payload[\"type\"] != \"refresh\":\n raise HTTPException(\n status_code=status.HTTP_401_UNAUTHORIZED,\n detail=\"You gave the access key, but we need the refresh key\",\n headers={\"WWW-Authe...
[ "0.6181185", "0.5912194", "0.57736045", "0.5653259", "0.5649086", "0.5508733", "0.5508396", "0.5505565", "0.547415", "0.53989816", "0.5356546", "0.5315606", "0.5276495", "0.52314806", "0.52309495", "0.52278566", "0.51943773", "0.5139199", "0.51312166", "0.51285356", "0.512390...
0.66592574
0
List topic event types. List event types for a topic.
def list_event_types( self, resource_group_name, provider_namespace, resource_type_name, resource_name, custom_headers=None, raw=False, **operation_config): def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list_event_types....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all(self):\r\n return list(pecan.request.storage_conn.get_event_types())", "def describe_event_topics(DirectoryId=None, TopicNames=None):\n pass", "def list(self, topic, **options):\n pass", "def extract_all_types_from_event_trace(events):\n result = []\n for e in events:\n evt ...
[ "0.63180953", "0.6055959", "0.58443826", "0.580303", "0.56400627", "0.5536615", "0.54348886", "0.5391234", "0.52449346", "0.52409774", "0.5210069", "0.5168875", "0.5165478", "0.5140188", "0.5137436", "0.51102954", "0.51049256", "0.5102254", "0.5087781", "0.5077038", "0.507165...
0.5682527
4
turns a number into bytes
def bytify(binary): bytes = [0,0,0,0] i = 3 while binary: bytes[i] = binary&255 binary >>= 8 i -= 1 return bytes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_as_bytes(number, pad_bits=None):\n result = int_to_bytes(number)[::-1]\n while pad_bits is not None and len(result) < (pad_bits // 8):\n result += b'\\x00'\n return result", "def convert_to_binary(num):\n return '{0:b}'.format(num)", "def int_to_bytes(num):\n if not is_natural(...
[ "0.7579284", "0.73712724", "0.7368195", "0.7367384", "0.73571694", "0.7314562", "0.73056656", "0.7275178", "0.72724533", "0.72648454", "0.7182918", "0.7175238", "0.71406275", "0.71131885", "0.7113075", "0.7086963", "0.70536715", "0.7045666", "0.6990678", "0.6976382", "0.69621...
0.0
-1
Initialize a new limit order book.
def __init__(self): self._book = Library.functions.new_()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, limit, doc=None):\n\n self.__doc__ = doc\n self.__limit = limit\n self.__handlers = []", "def _create_limit(self, price_limit):\n if self.price_limit is not None:\n return(order(self.symbol, -self.volume, style=LimitOrder(self.price_limit)))\n else...
[ "0.6296036", "0.6263865", "0.62246937", "0.60178256", "0.601394", "0.5956467", "0.5896801", "0.58927", "0.5877005", "0.57957554", "0.57664686", "0.573833", "0.56853163", "0.5680323", "0.5637562", "0.5574587", "0.5571992", "0.55598056", "0.5548175", "0.55218893", "0.55161417",...
0.5743338
11
Delete this limit order book.
def __del__(self): Library.functions.delete_(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_book(self, book):\n try:\n with self._db as db:\n cur = db.cursor()\n cur.execute('DELETE FROM books WHERE rowid = ?', (book.id, ))\n if not cur.rowcount:\n raise BookError('Tried to delete book tha...
[ "0.6620065", "0.65938026", "0.6397357", "0.62681645", "0.62348604", "0.620339", "0.6127662", "0.61134", "0.6084067", "0.60072225", "0.6006462", "0.5983362", "0.597412", "0.5933583", "0.5933583", "0.5933583", "0.5933583", "0.59255886", "0.5916862", "0.5891132", "0.5891132", ...
0.6035287
9
Clear all the orders in the book.
def clear(self): Library.functions.clear(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearOrderList(self):\r\n\t\tself.orders = []", "def clearOrderList(self):\r\n\t\tself.pair.orders = []", "def clear(self):\r\n self.orderitem_set.all().delete()", "def _delete_all_orders(self):\n for order_ref in self.created_entities['order']:\n order = self.barbicanclient.orde...
[ "0.7651831", "0.7381556", "0.7315735", "0.69155806", "0.6780195", "0.6572606", "0.6431059", "0.6389899", "0.6362085", "0.628537", "0.61881465", "0.61413497", "0.6134893", "0.61341155", "0.6057928", "0.60539746", "0.6039746", "0.6032915", "0.59945935", "0.59925425", "0.5990835...
0.6586561
5
Place a sell limit order with given quantity and price.
def limit_sell(self, order_id, quantity, price): Library.functions.limit_sell(self._book, order_id, quantity, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sell_limit_order(self, price=0, volume=0):\n auth = CoinbaseExchangeAuth(self.api_key, self.secret_key, self.passphrase)\n data = {\n \"size\": volume,\n \"price\": price,\n \"side\": \"sell\",\n \"product_id\": self.rate,\n \"type\": \"limit...
[ "0.7925371", "0.78168416", "0.75428194", "0.7417188", "0.7071134", "0.70346624", "0.6954648", "0.69130063", "0.69096357", "0.6874446", "0.6859875", "0.6753681", "0.66568744", "0.6572149", "0.6491404", "0.6474029", "0.64717853", "0.6457523", "0.6403897", "0.64003015", "0.63966...
0.7997252
0
Place a sell limit order with given quantity and price.
def limit_buy(self, order_id, quantity, price): Library.functions.limit_buy(self._book, order_id, quantity, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_sell(self, order_id, quantity, price):\n Library.functions.limit_sell(self._book, order_id, quantity, price)", "def sell_limit_order(self, price=0, volume=0):\n auth = CoinbaseExchangeAuth(self.api_key, self.secret_key, self.passphrase)\n data = {\n \"size\": volume,\n ...
[ "0.7997252", "0.7925371", "0.78168416", "0.75428194", "0.7071134", "0.70346624", "0.6954648", "0.69130063", "0.69096357", "0.6874446", "0.6859875", "0.6753681", "0.66568744", "0.6572149", "0.6491404", "0.6474029", "0.64717853", "0.6457523", "0.6403897", "0.64003015", "0.63966...
0.7417188
4
Place a sell limit order with given quantity and price.
def limit(self, side, order_id, quantity, price): Library.functions.limit(self._book, side, order_id, quantity, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def limit_sell(self, order_id, quantity, price):\n Library.functions.limit_sell(self._book, order_id, quantity, price)", "def sell_limit_order(self, price=0, volume=0):\n auth = CoinbaseExchangeAuth(self.api_key, self.secret_key, self.passphrase)\n data = {\n \"size\": volume,\n ...
[ "0.7997252", "0.7925371", "0.78168416", "0.75428194", "0.7417188", "0.7071134", "0.70346624", "0.6954648", "0.69130063", "0.6874446", "0.6859875", "0.6753681", "0.66568744", "0.6572149", "0.6491404", "0.6474029", "0.64717853", "0.6457523", "0.6403897", "0.64003015", "0.639665...
0.69096357
9
Return true if the order with given ID is in the book, false otherwise.
def has(self, order_id): return Library.functions.has(self._book, order_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_bookid(self,book_id):\r\n if int(book_id) in [i.book_id for i in self.issued_books]:\r\n return True\r\n else:\r\n return False", "def has_book(self, book):\n return self.books.filter(lists_books.c.book_id == book.id).count() > 0", "def check_if_exists(se...
[ "0.7184754", "0.67059475", "0.66672266", "0.6560992", "0.6473398", "0.6266325", "0.6255005", "0.62520516", "0.6207968", "0.60897744", "0.59901696", "0.5943703", "0.5933619", "0.5922701", "0.5920018", "0.5893061", "0.5883331", "0.5859028", "0.5831498", "0.5804595", "0.58011097...
0.8160919
0
Cancel an order with given order ID.
def cancel(self, order_id): Library.functions.cancel(self._book, order_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_order(self, order_id: str):\n return self._call_txtrader_api('cancel_order', {'id': order_id})", "def cancel_order(self, exchange, order_id):\n return self.ccxt.cancel_order(exchange, order_id)", "def cancel_order(self, walletId, orderId):\n return", "def cancel(self, order_id...
[ "0.8900336", "0.866272", "0.8501935", "0.82820904", "0.8275549", "0.8218187", "0.8117505", "0.80833817", "0.78084546", "0.7742467", "0.7626387", "0.76147395", "0.7600413", "0.7566299", "0.75030136", "0.7351325", "0.7300526", "0.7271292", "0.7271109", "0.7184765", "0.7150706",...
0.85956615
2
Place a market sell order.
def market_sell(self, order_id, quantity): Library.functions.market_sell(self._book, order_id, quantity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_sell_order(self):\n price = request.form[\"price\"]\n stocks = request.form[\"stocks\"]\n trader_id = request.form[\"trader_id\"]\n self.market.place_sell_order(trader_id, price, stocks)\n return \"\"", "def market_sell(self, symbol: Symbol, quantity: str,\n ...
[ "0.7930447", "0.7572596", "0.74668825", "0.74021333", "0.7328512", "0.71016085", "0.70995575", "0.7032074", "0.7010187", "0.69835454", "0.69822085", "0.69458824", "0.6895653", "0.6854374", "0.68069553", "0.67670125", "0.67350507", "0.67321897", "0.6717197", "0.6653469", "0.66...
0.703232
7
Place a market buy order.
def market_buy(self, order_id, quantity): Library.functions.market_buy(self._book, order_id, quantity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_buy_order(self):\n price = request.form[\"price\"]\n stocks = request.form[\"stocks\"]\n trader_id = request.form[\"trader_id\"]\n self.market.place_buy_order(trader_id, price, stocks)\n return \"\"", "def market_buy(self, symbol: Symbol, quantity: str,\n ...
[ "0.7915061", "0.76987463", "0.7456805", "0.7420727", "0.73668903", "0.73653954", "0.721675", "0.7157601", "0.7151941", "0.6919067", "0.6892058", "0.68738705", "0.68698674", "0.6852184", "0.6849464", "0.68483245", "0.68466145", "0.6835547", "0.6833255", "0.681506", "0.6805769"...
0.76428556
2
Place a market order.
def market(self, side, order_id, quantity): Library.functions.market(self._book, side, order_id, quantity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_market_order(self, side, symbol, size, **kwargs):\n pass", "def place_order(self, tradetype, market, amount, rate,\n ordertype, timeInEffect, \n conditionType=None, target=None):\n\n if tradetype in ('BUY', 'buy'):\n method = \"tradebuy\"\n...
[ "0.7884573", "0.76819116", "0.74891746", "0.7365514", "0.72833526", "0.72403765", "0.7080089", "0.703569", "0.7030936", "0.7001504", "0.69562733", "0.68893176", "0.68550634", "0.6851393", "0.67977065", "0.6782327", "0.6683575", "0.66644865", "0.66198164", "0.6609778", "0.6575...
0.6922934
11
Return the best sell price in the book.
def best_sell(self): return Library.functions.best_sell(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_buy(self):\n return Library.functions.best_buy(self._book)", "def get_best_offer(self,way):\n if way==\"BUY\":\n return self.book[Trade.WAY_BUY][0].get_price()\n elif way==\"SELL\":\n return self.book[Trade.WAY_SELL][len(self.book[Trade.WAY_SELL])-1].get_price(...
[ "0.7876577", "0.77371395", "0.7511024", "0.7234025", "0.7008871", "0.69746155", "0.694191", "0.6918493", "0.6890469", "0.685904", "0.68445", "0.68308765", "0.6789738", "0.6782889", "0.67679006", "0.67323667", "0.669388", "0.66653705", "0.6644225", "0.6625419", "0.66128826", ...
0.8430281
0
Return the best buy price in the book.
def best_buy(self): return Library.functions.best_buy(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_sell(self):\n return Library.functions.best_sell(self._book)", "def get_best_offer(self,way):\n if way==\"BUY\":\n return self.book[Trade.WAY_BUY][0].get_price()\n elif way==\"SELL\":\n return self.book[Trade.WAY_SELL][len(self.book[Trade.WAY_SELL])-1].get_pric...
[ "0.78773767", "0.78276116", "0.7595051", "0.7370348", "0.7110304", "0.68662673", "0.682843", "0.68111056", "0.6778916", "0.67588013", "0.6744359", "0.673743", "0.66320306", "0.66038054", "0.6591113", "0.65841454", "0.6548237", "0.653549", "0.6532241", "0.65042275", "0.6503913...
0.8379767
0
Return the best price for the given side.
def best(self, side): return Library.functions.best(self._book, side)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_safe_price(side: str):\n return (\n const.MIN_SUM if side == const.BUY\n else const.MAX_SUM\n )", "def get_best_offer(self,way):\n if way==\"BUY\":\n return self.book[Trade.WAY_BUY][0].get_price()\n elif way==\"SELL\":\n return self....
[ "0.73120564", "0.6958201", "0.67411786", "0.6623038", "0.6302165", "0.6228178", "0.6109067", "0.60349244", "0.60328555", "0.59425896", "0.5927218", "0.58721644", "0.5837019", "0.58329946", "0.57939583", "0.57860625", "0.57763773", "0.5764865", "0.5751211", "0.57504004", "0.57...
0.80683696
0
Return the volume of the sell side of the book at the given price.
def volume_sell(self, price=None): if price is None: return Library.functions.volume_sell(self._book) return Library.functions.volume_sell_price(self._book, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume(self, price=None):\n if price is None:\n return Library.functions.volume(self._book)\n return Library.functions.volume_price(self._book, price)", "def get_own_volume_at(self, price, typ=None):\r\n volume = 0\r\n for order in self.owns:\r\n if order.pri...
[ "0.82540333", "0.73508203", "0.7293334", "0.7108912", "0.67721134", "0.6653987", "0.6506303", "0.6498677", "0.6331713", "0.62851894", "0.6253708", "0.6248566", "0.6227219", "0.6194709", "0.619005", "0.618927", "0.61563796", "0.61169934", "0.61134404", "0.6086485", "0.60847485...
0.81967163
1
Return the volume of the buy side of the book at the given price.
def volume_buy(self, price=None): if price is None: return Library.functions.volume_buy(self._book) return Library.functions.volume_buy_price(self._book, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume(self, price=None):\n if price is None:\n return Library.functions.volume(self._book)\n return Library.functions.volume_price(self._book, price)", "def volume_sell(self, price=None):\n if price is None:\n return Library.functions.volume_sell(self._book)\n ...
[ "0.82664984", "0.7516078", "0.7488547", "0.7051576", "0.68015915", "0.67189145", "0.65990806", "0.6527134", "0.63496965", "0.6312829", "0.6272654", "0.626387", "0.62559175", "0.6233882", "0.6233526", "0.6188062", "0.6141007", "0.6114274", "0.60632724", "0.6055284", "0.605316"...
0.80440706
1
Return the volume of the book at the given price.
def volume(self, price=None): if price is None: return Library.functions.volume(self._book) return Library.functions.volume_price(self._book, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_own_volume_at(self, price, typ=None):\r\n volume = 0\r\n for order in self.owns:\r\n if order.price == price and (not typ or typ == order.typ):\r\n volume += order.volume\r\n return volume", "def get_volume(self, ticker):\n return self.trading_client....
[ "0.74667495", "0.7274619", "0.7216883", "0.7213233", "0.7152009", "0.67414206", "0.6649474", "0.644604", "0.64349836", "0.63823044", "0.62451017", "0.6215957", "0.62002635", "0.6196766", "0.6136535", "0.6116863", "0.6111729", "0.6077984", "0.6072128", "0.60609454", "0.6050351...
0.8870716
0
Return the count at the given limit price.
def count_at(self, price): return Library.functions.count_at(self._book, price)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price_count(self):\n return self.price_set.count()", "def Count(self, limit=None):\n if limit is None:\n count = 0\n for i in self.Run():\n count += 1\n return count\n else:\n return len(self.Get(limit))", "def limit(self, limit):\n\n # Return between 1 and 250 ...
[ "0.68486047", "0.6711644", "0.62374175", "0.6154216", "0.60643214", "0.60539377", "0.5963375", "0.5950641", "0.59431195", "0.5908711", "0.58560854", "0.58281624", "0.5774528", "0.57603157", "0.5749395", "0.574189", "0.5730391", "0.5728614", "0.5705169", "0.5687857", "0.565394...
0.73425525
0
Return the count of the book on the sell side.
def count_sell(self): return Library.functions.count_sell(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_buy(self):\n return Library.functions.count_buy(self._book)", "def count(self):\n return Library.functions.count(self._book)", "def count_at(self, price):\n return Library.functions.count_at(self._book, price)", "def book_count(self):\n\n try:\n cur = ...
[ "0.78120375", "0.77192485", "0.70914364", "0.68656915", "0.6624515", "0.65457547", "0.64217335", "0.6259992", "0.62470585", "0.62161124", "0.61799794", "0.6173208", "0.616138", "0.6150478", "0.61196935", "0.61196935", "0.61010724", "0.6085189", "0.6085189", "0.6085189", "0.60...
0.8766824
0
Return the count of the book on the buy side.
def count_buy(self): return Library.functions.count_buy(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_sell(self):\n return Library.functions.count_sell(self._book)", "def count(self):\n return Library.functions.count(self._book)", "def book_count(self):\n\n try:\n cur = self._db.cursor()\n cur.execute('SELECT COUNT(*) FROM books')\n ...
[ "0.80874604", "0.791642", "0.71182454", "0.70671946", "0.6729253", "0.6499483", "0.6482776", "0.64741236", "0.64674014", "0.6455501", "0.64497244", "0.6448028", "0.6434358", "0.6434358", "0.64228356", "0.63472587", "0.63472587", "0.63472587", "0.63472587", "0.6326487", "0.628...
0.8772569
0
Return the total count of the book (number of orders).
def count(self): return Library.functions.count(self._book)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_items(self):\n count = 0\n for o in self.order_lst:\n count += o.count()\n \n return count", "def get_count(cls):\n total = 0\n for counter in SimpleCounterShard.objects.all():\n total += counter.count\n return total", "def to...
[ "0.7326504", "0.70894116", "0.7065717", "0.7048008", "0.70059586", "0.69761986", "0.6889632", "0.67862225", "0.6757659", "0.664989", "0.6642463", "0.6580156", "0.6578201", "0.65763205", "0.65512884", "0.65499413", "0.6543359", "0.6543359", "0.6543359", "0.6520974", "0.6512532...
0.78544945
0
Include the module in the Pyramid application.
def includeme(config): document_path = config.registry.settings['{}.document'.format(MODULE_NAME)] definition = api.Api(document_path) config.registry.registerUtility(definition, api.IApi) config.add_directive('set_media_renderer', api.set_media_renderer) config.add_directive('add_deserializer', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includeme(config):\n add_view(config)", "def includeme(config):\n settings = config.get_settings()\n Page.data_folder = settings['michelanglo.user_data_folder']\n settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'\n\n # use pyramid_tm to hook the transaction lifecycle to the request\n...
[ "0.69480646", "0.6261175", "0.60762334", "0.60572255", "0.5937143", "0.5885853", "0.5862683", "0.58428794", "0.58415604", "0.57313776", "0.57313776", "0.5711921", "0.5706318", "0.55763155", "0.55611765", "0.5549161", "0.55436224", "0.55151165", "0.54905266", "0.5474433", "0.5...
0.5902467
5
Return price of Promotion from given timecall(second)
def promotion(time, sum_price): time = second_to_minute(time) for (pro, price) in [(24*60, 150), (12*60, 100), (8*60, 80), (3*60, 40), (60, 15), (20, 10)]: sum_price = sum_price + (time//pro)*price time = time % pro oneminute = time - 3 return sum_price + oneminute if oneminute > 0 else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_time_price(supplier_with_transaction):\n supplier_item = supplier_with_transaction.get('supplier_detail')\n transaction_item = supplier_with_transaction.get('supplier_transaction')\n # Check if there is time prices or not\n if supplier_with_transaction.get('time_price'):\n ...
[ "0.67537755", "0.6225738", "0.61765724", "0.61343247", "0.6133116", "0.60193425", "0.60140777", "0.60004115", "0.5960098", "0.58534", "0.583223", "0.583061", "0.5796537", "0.57868993", "0.5755165", "0.57375234", "0.5699371", "0.56611836", "0.56481266", "0.5638357", "0.5602969...
0.7114384
0
Convert second to minute
def second_to_minute(time): if time % 60 != 0: time = time + 60 return time // 60
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_convert_to_minute(value):\n min = int(int(value) / 60)\n sec = int(int(value) % 60)\n return \"%02d\" % min + \":\" + \"%02d\" % sec", "def get_minute(self):\n\n # First we get the first 8 bits stored in the minute register\n # and translate it to an integer\n minute_bcd = s...
[ "0.81158906", "0.7529537", "0.7427662", "0.7400211", "0.7394658", "0.73557305", "0.725303", "0.7242647", "0.7215991", "0.7102178", "0.70426196", "0.69982487", "0.6993329", "0.69814235", "0.6980721", "0.6963728", "0.6873445", "0.6735053", "0.6705921", "0.66999775", "0.66999775...
0.8488949
0
The default path for auth files. Since auth is imported by common, not all functions from common are available yet, so we have to duplicate common.get_etc().
def default_path(): return os.path.join(os.environ.get('OVERRIDE_ETC', '/etc'), 'auth')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_default_path(self):\n\n raise NotImplementedError()", "def getuserbase():\n\tpass", "def _get_config_path():\n return os.path.join(os.path.expanduser('~'))", "def _get_default_path(self):\n return os.path.join(cfg.ROOT_DIR, 'data', 'KITTI')", "def get_default_secrets_basedir():\n ...
[ "0.6578735", "0.6543579", "0.6311381", "0.6221308", "0.6197567", "0.59966385", "0.59602493", "0.5944631", "0.59310985", "0.5916046", "0.58995533", "0.588715", "0.5886533", "0.58850485", "0.58659554", "0.5845714", "0.58420026", "0.5840689", "0.5808696", "0.58013254", "0.575822...
0.7999646
0
When processing a CGI request, validate that request is authenticated and, if it's a POST request, has a CSRF token.
def check_request(auth_dir = default_path()): if (REQUEST_URI in os.environ and not os.environ[REQUEST_URI] in LOGGED_OUT_ENDPOINTS): a = Auth(auth_dir) a.check_authentication() if REQUEST_METHOD in os.environ and os.environ[REQUEST_METHOD] == "POST": a.check_csrf() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csrf_protect():\n if request.method == \"POST\" and request.path[0:5] != \"/api/\":\n token = login_session.pop('_csrf_token', None)\n request_token = request.form.get('_csrf_token')\n print(\"Comparing server token [\" + token + \"]\")\n print(\"with client token [\" + request_t...
[ "0.7817169", "0.73044354", "0.7297086", "0.7293463", "0.72816455", "0.7144391", "0.7137223", "0.69428355", "0.6941922", "0.67545164", "0.6665803", "0.6653398", "0.6594229", "0.6567395", "0.6526108", "0.64494663", "0.6428766", "0.64108694", "0.64074224", "0.6368183", "0.633377...
0.6946042
7
Return True iff a == b, and do it in constant time.
def constant_time_equals(a, b): a = bytearray(a) b = bytearray(b) if len(a) != len(b): return False result = 0 for x, y in zip(a, b): result |= x ^ y return result == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_equal(self, a, b):\n return a is b", "def _eq(a, b):\n return (a - b) % 2 == 0", "def is_equal(self, a, b):\n return a == b", "def equals(x, y):\n return x == y", "def values_eq(self, a, b):\r\n return a == b", "def _isImmediatelyConcurrentWithHelper(self, other):\n ...
[ "0.6991648", "0.6987159", "0.68904316", "0.6511493", "0.6491735", "0.6393032", "0.6370423", "0.62094575", "0.6165589", "0.61569965", "0.6101428", "0.6083719", "0.60202104", "0.6011132", "0.5964354", "0.5960481", "0.59527063", "0.5886779", "0.5871184", "0.5863785", "0.5838165"...
0.7278765
0
Check that the authentication data directory is owned by current user, with safe permissions. throw exception if not.
def check_sane(self): st = os.stat(self.path) if st.st_uid != os.getuid(): raise Exception('Auth dir %s not owned by user %d.' % ( self.path, os.getuid())) # Mode 16832 is equal to (stat.S_IFDIR | stat.S_IRWXU) # In other words, a directory with mode bits rwx-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_owner(data=None, **kw):\n if data and 'owner_id' in data and not data['owner_id'] == current_user.id:\n raise ProcessingException(description=\"No write privileges\",\n code=401)", "def is_admin():\n if os.name == 'nt':\n try:\n # Only Windows users with admin ...
[ "0.69111305", "0.63244414", "0.618211", "0.61762416", "0.60865843", "0.6056135", "0.60496074", "0.60474795", "0.60096633", "0.5915627", "0.5915164", "0.5910356", "0.5902933", "0.5817912", "0.58168834", "0.58168834", "0.5816142", "0.57881606", "0.5775639", "0.57755697", "0.576...
0.7962697
0
Save data into file, with mode bits rw.
def write(self, filename, data): owner_rw = 0600 fd = os.open(filename, os.O_WRONLY | os.O_CREAT, owner_rw) # In case file existed already with wrong permissions, fix them. os.chmod(filename, owner_rw) os.write(fd, data) os.close(fd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveOnFile(self, path, data):\n with open(path, \"w\") as f:\n f.write(data)", "def save(self, data):\n self.write(data)", "def saveIntoFile(self, fname, data, mode='a'):\n\t\tg = open(fname, mode)\n\t\tg.write(data)\n\t\tg.close()", "def write(self, data):\n return self._...
[ "0.7226291", "0.70650244", "0.68625534", "0.68410575", "0.6730982", "0.67121845", "0.66840976", "0.6669404", "0.66520023", "0.65721416", "0.6454757", "0.64442486", "0.64206964", "0.6347395", "0.63168377", "0.6304097", "0.6299632", "0.62755454", "0.62742877", "0.62730885", "0....
0.7425339
0
Return the number of failed passwords the can be entered before logins attempts are disabled for a day. The rate limit information is stored as a count of failed attempts so far. If there have been no failed attempts, or they were more than a day ago, treat that as zero failed attempts.
def rate_limit_remaining(self): if os.path.isfile(self.rate_limit_filename): st = os.stat(self.rate_limit_filename) if time.time() - st.st_ctime > self.RATE_LIMIT_DURATION: return self.RATE_LIMIT_COUNT else: with open(self.rate_limit_filename, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_failed_attempts(self) -> int:\n return pulumi.get(self, \"allowed_failed_attempts\")", "def get_retry_count(self):\r\n return self.retried_nomax + self.retried_withmax", "def rate_limit_check():\n\n data = api.rate_limit_status()\n\n user_timeline_remaining = data['resources']['...
[ "0.72841084", "0.6442284", "0.63025856", "0.62957674", "0.6294218", "0.6247011", "0.6221691", "0.6105994", "0.6071681", "0.6069109", "0.60401917", "0.6027968", "0.6010637", "0.6010314", "0.59940743", "0.59916854", "0.5940475", "0.5892049", "0.5857288", "0.5837647", "0.5832163...
0.7286241
0
On failed login attempt, increment the number of failed attempts.
def increment_rate_limit(self): attempts = self.RATE_LIMIT_COUNT - self.rate_limit_remaining() attempts += 1 self.write(self.rate_limit_filename, "%d" % attempts)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_login_attempts(self):\n\t\tself.login_attempts += 1", "def increment_login_attempts(self):\n\t\tself.login_attempts += 1", "def increment_login_attemtps(self):\r\n self.login_attempts += 1", "def increment_login_attempts(self):\n self.login_attempts += 1", "def increment_login_a...
[ "0.8331031", "0.8331031", "0.83253366", "0.823517", "0.823517", "0.823517", "0.823517", "0.823517", "0.823517", "0.823517", "0.80403215", "0.78654945", "0.7675887", "0.73061955", "0.7291522", "0.7239906", "0.71794003", "0.7049969", "0.7049969", "0.7013948", "0.7013948", "0....
0.0
-1
Return whether a password file exists.
def password_exists(self): return os.path.isfile(self.password_filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exists(file):\n try:\n Cryptography.read(file)\n return True\n except (FileNotFoundError, FileExistsError):\n return False", "def has_credentials(credentials_file=CREDENTIALS_FILE):\n return os.path.exists(credentials_file)", "def file_exist() -> bool:...
[ "0.73339146", "0.72148883", "0.711415", "0.704762", "0.6940705", "0.6932751", "0.68602616", "0.68285614", "0.68142194", "0.6799496", "0.6797534", "0.6792931", "0.67914045", "0.6779414", "0.67747366", "0.6768138", "0.67567444", "0.6748446", "0.67089844", "0.67058", "0.6699733"...
0.84719884
0
Returns true iff the candidate password equals the stored one.
def is_password(self, candidate): if self.rate_limit_remaining() > 0: with open(self.password_filename, 'r') as f: hashed = f.read().strip() if hashed == pbkdf2.crypt(candidate, unicode(hashed)): return True else: # Increment ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(self, password):\n return self.password == password", "def do_passwords_match(self, password1, password2):\n return password1 == password2", "def verify_password(self, password):\n return self.PASS == password", "def verify_password(self, password):\n return sel...
[ "0.75234157", "0.7371934", "0.72819686", "0.72519046", "0.72246903", "0.70825803", "0.704436", "0.698168", "0.6954732", "0.69302136", "0.6905826", "0.6901915", "0.68608254", "0.6840604", "0.6808323", "0.6777243", "0.67617476", "0.6687569", "0.6681926", "0.66676414", "0.666382...
0.72442955
4
Store a new password.
def save_password(self, new_password): # 55 iterations takes about 100 ms on a Netgear WNDR3800 or about 8ms on a # Core2 Duo at 1200 MHz. hashed = pbkdf2.crypt(new_password, iterations=55) self.write(self.password_filename, hashed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_password():\n new_pass = generate_password()\n entry_pass.delete(0, END)\n entry_pass.insert(0, new_pass)", "def save_password():\n title = core.get_value(TITLE_ID)\n identifier = core.get_value(IDENTIFIER_ID)\n password = core.get_value(PASSWORD_ID)\n note = core.get_value(NOTE_ID)\...
[ "0.7707586", "0.7626044", "0.75923395", "0.7500774", "0.746682", "0.7460489", "0.7377513", "0.73487455", "0.7345557", "0.73209494", "0.7307772", "0.7307772", "0.7307772", "0.7307772", "0.72907186", "0.72493607", "0.7229149", "0.7229149", "0.7229149", "0.7229149", "0.7204312",...
0.7453333
6
Generate a CSRF prevention token. We derive this token as the SHA256 hash of the auth token, which ensures the two are bound together, preventing cookie forcing attacks. Returns a valid CSRF prevention token.
def get_csrf_token(self): h = hashlib.new('sha256') h.update(self.__current_authentication_token()) return h.hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_csrf_token() -> int:\r\n ...", "def generate_csrf_token():\n if '_csrf_token' not in login_session:\n login_session['_csrf_token'] = b64encode(urandom(64)).decode() # Cryptographically secure random key\n print(\"_csrf_token:\" + login_session['_csrf_token'])\n return login_sessi...
[ "0.7412592", "0.7199123", "0.7178343", "0.71217203", "0.69856286", "0.68552816", "0.651522", "0.6510274", "0.65009046", "0.63964945", "0.63690513", "0.6342274", "0.6288062", "0.6235347", "0.6221905", "0.62115526", "0.61450565", "0.61078674", "0.60888135", "0.6081029", "0.6066...
0.7876994
0
Validate a presented CSRF token. Note that we validate by rehashing the auth_token, rather than comparing directly to the csrf_token cookie. This prevents cookie forcing by requiring that the auth token and CSRF token be related.
def is_csrf_token(self, candidate_csrf_token): valid_token = bytearray(self.get_csrf_token()) candidate = bytearray(candidate_csrf_token) return constant_time_equals(valid_token, candidate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_csrf_token(token=''):\n\tif not token:\n\t\ttoken = managers.request_manager.get_request().arguments().arguments().get(csrf_token_arg_name, \"\")\n\t\tif token:\n\t\t\ttoken = token[0]\n\tif len(token) != 2 * digest_size + 2 * csrf_salt_len:\n\t\tdebug('Incorrect csrf token length')\n\t\traise VDOM_csrf...
[ "0.79084784", "0.75982994", "0.7324246", "0.7277843", "0.7148549", "0.69121826", "0.69049376", "0.6870323", "0.66957134", "0.6579078", "0.651883", "0.64525086", "0.6364048", "0.63297236", "0.63226295", "0.6320248", "0.62870723", "0.6273856", "0.6262431", "0.6212947", "0.62093...
0.71012455
5
Get a CSRF token from CGI request headers and validate it. If validation fails, render an error and exit early. In our current JSONRPC style, we can send custom headers, so we look for the CSRF token in a header. We may switch to a formsubmissionbased approach, in which case we would need to update this code to look fo...
def check_csrf(self): if (self.HTTP_X_CSRF_TOKEN in os.environ and self.is_csrf_token(os.environ[self.HTTP_X_CSRF_TOKEN])): pass else: common.render_error('Invalid CSRF token.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csrf_protect():\n if request.method == \"POST\" and request.path[0:5] != \"/api/\":\n token = login_session.pop('_csrf_token', None)\n request_token = request.form.get('_csrf_token')\n print(\"Comparing server token [\" + token + \"]\")\n print(\"with client token [\" + request_t...
[ "0.68274045", "0.6708229", "0.6457266", "0.6360868", "0.6295552", "0.62615085", "0.618747", "0.6181233", "0.6172527", "0.6172527", "0.605117", "0.6031059", "0.60022056", "0.5976158", "0.5908596", "0.58976007", "0.5891962", "0.5867035", "0.58416593", "0.5806343", "0.5788977", ...
0.63421667
4
Return the HTTP headers required to log the user in. Specifically, set the auth cookie, the csrf token cookie, and an unsecured cookie logged_in=true, indicating the user is logged in even if the current request context doesn't have the auth cookies. The server should redirect users with the loggedin cookie to the HTTP...
def login_headers(self): auth_token = self.regenerate_authentication_token() csrf_token = self.get_csrf_token() # Set the secure flag on the cookie if the login occurred over HTTPS. secure = '' if 'HTTPS' in os.environ: secure = ' secure;' return ('Set-Cookie:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout_headers(self):\n self.regenerate_authentication_token()\n return ('Set-Cookie: %s=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT\\n'\n 'Set-Cookie: %s=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT\\n'\n 'Set-Cookie: %s=; path=/; expires=Thu,...
[ "0.616512", "0.58029056", "0.5774238", "0.57243794", "0.572148", "0.5703384", "0.5694575", "0.56380635", "0.55908483", "0.55858535", "0.5576539", "0.556314", "0.55448025", "0.54460526", "0.54270995", "0.54115784", "0.54071826", "0.5374451", "0.53601944", "0.53586346", "0.5334...
0.71679306
0
Return the HTTP headers required to log the user out. Specifically, delete and invalidate the auth token and CSRF token.
def logout_headers(self): self.regenerate_authentication_token() return ('Set-Cookie: %s=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT\n' 'Set-Cookie: %s=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT\n' 'Set-Cookie: %s=; path=/; expires=Thu, 01 Jan 197...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forget(self, environ, identity):\n challenge = \"MAC+BrowserID url=\\\"%s\\\"\" % (self.token_url,)\n return [(\"WWW-Authenticate\", challenge)]", "def logout(request):\n if request.method == 'POST':\n request.token.delete()\n return json_response({\n 'status': 'succ...
[ "0.663149", "0.6626839", "0.64436823", "0.6353375", "0.62939614", "0.6245303", "0.6228222", "0.6208567", "0.61947745", "0.6191976", "0.6191976", "0.6157748", "0.6107373", "0.6107373", "0.6101193", "0.6085265", "0.6074504", "0.60680485", "0.6061079", "0.60475695", "0.6046746",...
0.7579529
0
Return the current authentication token if it still valid, else None.
def __current_authentication_token(self): if os.path.isfile(self.token_filename): with open(self.token_filename, 'r') as f: (stored_token, expires) = f.read().split(' ') t = time.time() if int(expires) > t: return stored_token return No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_token(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"auth_token\")", "def token(self):\n if self.is_auth_needed():\n self.authorize()\n\n return self.get_from_cache('token')", "def get_auth_token():\n auth_token_value = memcache.get('authtoken'...
[ "0.75732124", "0.7552719", "0.7514238", "0.74762905", "0.7412203", "0.7278422", "0.72320783", "0.7199977", "0.7183309", "0.7131585", "0.71267015", "0.7103127", "0.7067211", "0.7020245", "0.6927801", "0.6918491", "0.6909502", "0.68631387", "0.6821521", "0.6821521", "0.6819494"...
0.78239816
0
Basic length and character checking on tokens.
def __valid_token_format(self, token): if len(token) != self.TOKEN_LENGTH * 2: return False for c in token: if c not in '01234567890abcdef': return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length(self):\n return len(self.tokens)", "def __len__(self):\n return len(self._tokens)", "def parse_len_token(self, token, context):\n match = Ftype_character.len_token_re.match(token)\n if match is not None:\n return match.group(1)\n else:\n raise Par...
[ "0.6651215", "0.64749897", "0.628126", "0.62707806", "0.6177221", "0.61244524", "0.61134386", "0.61035985", "0.6011891", "0.59627837", "0.58954006", "0.5847126", "0.5801913", "0.57991666", "0.57965124", "0.57956797", "0.5794842", "0.57886124", "0.57449126", "0.5732851", "0.57...
0.64651096
2
Return true iff candidate authentication token matches stored one.
def is_authentication_token(self, candidate): current_token = self.__current_authentication_token() # TODO: Add expiry checking if (current_token and self.__valid_token_format(current_token) and self.__valid_token_format(candidate) and constant_tim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated(self):\n return self.token is not None", "def check_token(self, user, token):\n try:\n data = signing.loads(token, max_age=properties.TOKEN_LOGIN_TIMEOUT)\n except signing.BadSignature:\n return False\n\n return (\n (\n ...
[ "0.6938202", "0.68884546", "0.6865633", "0.68002206", "0.6707966", "0.66578394", "0.6657788", "0.6632563", "0.6583302", "0.6578111", "0.65751725", "0.65728736", "0.6560326", "0.6539685", "0.6510684", "0.649782", "0.649383", "0.64898247", "0.64779943", "0.64613837", "0.6455331...
0.84338975
0
Create and store a new random authentication token. Expires old sessions.
def regenerate_authentication_token(self): new_token = os.urandom(self.TOKEN_LENGTH).encode('hex') expires = int(time.time()) + Auth.SESSION_DURATION self.write(self.token_filename, ('%s %d' % (new_token, expires))) return new_token
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_new_token(self):\n self.access_token = random_auth_key()", "def generate_new_token(uid):\n random_token = uuid.uuid4()\n token = TokenAuth(user_id=uid, token=random_token)\n token.save()\n return random_token", "def _generate_token(self):\n return sha1(\"%s#%s\" % (time()...
[ "0.8077118", "0.7244117", "0.69622195", "0.69050765", "0.689591", "0.6889207", "0.6816747", "0.6809456", "0.6781932", "0.675099", "0.6749914", "0.67392135", "0.67329174", "0.6729028", "0.66792405", "0.6672653", "0.6654001", "0.66211134", "0.650831", "0.6499091", "0.6493759", ...
0.8331127
0
In the context of a CGI request, check whether an authentication cookie is present and valid. If not, render an error.
def check_authentication(self): try: cookies = os.environ['HTTP_COOKIE'].split('; ') except KeyError: cookies = [] for c in cookies: prefix = Auth.AUTH_COOKIE_NAME + '=' if (c.startswith(prefix) and self.is_authentication_token(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_must_authenticate():\n return Response(\n 'Could not verify your access level for that URL.\\n'\n 'You have to login with proper credentials', 401,\n {'WWW-Authenticate': 'Basic realm=\"Login Required\"'})", "def check_auth(*args, **kwargs):\n r = cherrypy.request\n s = cherryp...
[ "0.657821", "0.65143234", "0.63110507", "0.62617683", "0.6211139", "0.6205653", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", "0.6156784", ...
0.67513925
0
Test that the request() wrapper passes along expected headers
def test_request_headers(mock_send, mock_format): ClientSession().request('GET', 'https://url', access_token='token') request_obj = mock_send.call_args[0][0] assert request_obj.headers['Authorization'] == 'Bearer token'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_specific_headers_sent_with_request(self):\n req = self.httpbin.get_my_headers(dry_run=True)\n self.assertIn('All-Request-Headers', req.prepared_request.headers)\n request_data_headers = self.httpbin.client['get_my_headers']['headers']['All-Request-Headers']\n self.assertEqual(r...
[ "0.7787896", "0.77121085", "0.75712365", "0.7443091", "0.7166433", "0.71009004", "0.70632696", "0.7058741", "0.7019937", "0.7008756", "0.69866556", "0.69617903", "0.6924459", "0.687052", "0.68337685", "0.681641", "0.6786742", "0.6786234", "0.6743163", "0.6663947", "0.6661827"...
0.80046374
0
Simple function to return response from requests.get(url), as json if valid
def fetch(url, verbose=False): resp = requests.get(url) if verbose: print(resp.json()) if resp.status_code == 200: resp=resp.json() return resp else: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response(url):\n resp = requests.get(url)\n if resp.status_code == 200:\n return resp.json()\n\n raise Exception(f\"Failed to fetch: {url}\")", "def get_response(request_url):\n response = requests.get(request_url)\n return json.loads(response.text)", "def _request_get(self, url):...
[ "0.79982734", "0.79731727", "0.7702879", "0.7699421", "0.7602866", "0.7590568", "0.75531924", "0.75185215", "0.7513021", "0.7498113", "0.7494227", "0.7483538", "0.7428112", "0.738538", "0.72933406", "0.7285716", "0.72635597", "0.72374666", "0.723036", "0.72031325", "0.7195236...
0.7159486
23
wrapper to make async calls using gevent, concurrent not parallel
def asynchronous(urls, batch_size, delay=0, verbose=False): try: count=1 threads=[] print(urls.strip(' ').split(",")) for url in urls.strip(" '").split(","): print('On batch {}'.format(count)) threads.append(gevent.spawn(fetch, url, verbose)) responses...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_async(self, name, *args, **kwargs):", "async def run():\n sem = asyncio.Semaphore(DEFAULT_SEMAPHORE_LIMIT)\n tasks = []\n\n async with ClientSession() as session:\n for u in [ROOT_URL.format(jid) for jid in DEFAULT_RANGE_IDS]:\n task = asyncio.ensure_future(bound_fetch(sem, u,...
[ "0.6448774", "0.6373844", "0.6306433", "0.61689025", "0.6099593", "0.6085664", "0.60487", "0.59556615", "0.59057474", "0.58697575", "0.58590627", "0.5844879", "0.58389485", "0.5828767", "0.5826276", "0.5818216", "0.58082384", "0.58055556", "0.577954", "0.57730323", "0.576001"...
0.6791043
0
Store PID of the current process into pid_file file name and fork the daemon process. Daemonization recipe compiled from several sources, compared with a number of recipes available on the internet.
def daemonize(config, logger): logger.info("Preparing for daemonization (parent process " "PID: %s) ..." % os.getpid()) # check that there is a log defined, otherwise fail - need to # redirect stdout, stderr stream into this file if not logger.logFile: logger.fatal("No log ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def daemonize(self):\n try:\n pid = os.fork()\n if pid > 0:\n # exit first parent\n sys.exit(0)\n except OSError, e:\n sys.stderr.write(\"fork #1 failed: ...
[ "0.7601164", "0.7577619", "0.75305885", "0.75298476", "0.7517762", "0.75142306", "0.74562967", "0.7408952", "0.727486", "0.7187714", "0.7173085", "0.71049833", "0.69572437", "0.6931968", "0.6908776", "0.6784454", "0.6760963", "0.66886586", "0.65831184", "0.65577734", "0.65398...
0.72415626
9
Takes care of runnign the Application. Regardless of whether this function is run interactively from the command line or running as a background daemon process.
def start_application(config, logger): service = None try: try: service = Application(config, logger) service.start() except KeyboardInterrupt: logger.fatal("Interrupted from keyboard ...") except ServiceShutdownBySignal, ex: logger.fatal(e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n LOGGER.info('Loading Application')\n main_app = Application()\n parser = argparse.ArgumentParser()\n parser.add_argument(\"-c\", \"--console\", help=\"Command Line Mode\", action=\"store_true\")\n args = parser.parse_args()\n if args.console:\n LOGGER.info('Command Line Mode'...
[ "0.69179183", "0.6888247", "0.66983217", "0.6646985", "0.6636805", "0.6592753", "0.65818685", "0.6530207", "0.6519161", "0.64633566", "0.64628696", "0.640798", "0.6401738", "0.6393556", "0.63844955", "0.6321503", "0.63199335", "0.6307606", "0.6307459", "0.6289951", "0.6289951...
0.0
-1
ranks nodes based on the depth of their lowest_common_ancestor With origin (the deeper the better). In case of ties the note Closer to the LCA is preferred.
def tiebreak_on_lca(root,origin,candidates): lca = LCA(root) k = lambda x: (-1 * lca(x, origin,True),lca.get_depth(x),abs(x.first_token.start[0] - origin.first_token.start[0])) return sorted(candidates, key = k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_common_ancestor(node):\n pass", "def ancestor_priority(trial):\r\n unobserved_nodes = trial.unobserved_nodes.copy()\r\n unobserved_nodes.remove(trial.node_map[0])\r\n shuffle(unobserved_nodes)\r\n states = []\r\n while(len(unobserved_nodes) != 0):\r\n scores = []\r\n an...
[ "0.743335", "0.6460991", "0.6381844", "0.62259734", "0.619959", "0.6153047", "0.6029785", "0.5959085", "0.5918079", "0.5752643", "0.57003176", "0.5688026", "0.5665707", "0.5617397", "0.5595786", "0.55868495", "0.5582528", "0.5548037", "0.5433452", "0.54086643", "0.5403144", ...
0.4846424
84
Main function to call This function should obtain results from generators and plot image and image intensity Create a for loop to iterate the generator functions
def display_images(): vc = cv2.VideoCapture(0) # Open webcam figure, ax = plt.subplots(1, 2, figsize=(10, 5)) # Intiialise plot count = 0 # Counter for number of aquired frames intensity = [] # Append intensity across time # For loop over generator here intensity.append(imageintensity) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n \n # for inserting other images, add tem to /input folder and list them here\n images = (\n 'image-0',\n 'image-1',\n 'image-2'\n )\n\n for image_name in images:\n print(image_name, \"image:\")\n\n image = open_image(image_name)\n display_image(im...
[ "0.65730345", "0.64085895", "0.6363845", "0.63635534", "0.62890536", "0.62543195", "0.62491566", "0.6223364", "0.6188411", "0.618029", "0.61280805", "0.61128044", "0.61127687", "0.6095602", "0.60937095", "0.60769194", "0.6063557", "0.6053544", "0.6050049", "0.60302", "0.60264...
0.7101953
0
This function plots image and intensity of image through time
def plot_image_and_brightness(axis, image, imageintensity, framecount): # Plot RGB Image axis[0].imshow(image) axis[0].axis('off') axis[0].set_title(f'Frame Number {framecount}') # Plot intensity axis[1].plot(imageintensity, '.-') axis[1].set_ylabel('Average Intensity') # Stuff to sho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imshow(img):\n imadd(img)\n plt.ion()\n plt.show()", "def fn_intensitytrace(file_name,folder,data,time,i,x,y):\n import numpy as np\n import matplotlib.pyplot as plt\n\n\n figure_name=file_name+'_intensity_trace'\n for a in range(0,len(data),int(len(data)/2)):\n if i==a:\n ...
[ "0.69218147", "0.6863551", "0.668293", "0.667952", "0.66168284", "0.657051", "0.6569345", "0.65316135", "0.65316135", "0.65316135", "0.6529275", "0.6461676", "0.64531654", "0.6427083", "0.64266634", "0.640738", "0.6397536", "0.63804084", "0.63659954", "0.63561183", "0.6350481...
0.71107686
0
Use an infinite loop and write a generator function that should acquire image, convert to rgb, get mean intensity and yield necessary results
def stream_frames(video_capture):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _iter_images(self):\n for image in self._images:\n yield np.array(image.convert('RGB'))", "def get_mean_image(input_image: np.ndarray) -> np.ndarray:\n input_image = input_image.astype(np.uint8)\n @jit(uint8[:,:](uint8[:,:]))\n def filter_2d(image):\n M, N = image.shape\n ...
[ "0.6241185", "0.62201464", "0.5973022", "0.59512883", "0.5836599", "0.57773125", "0.57696205", "0.56897086", "0.56795895", "0.5627707", "0.5619133", "0.55924755", "0.5587323", "0.5574598", "0.55665636", "0.5522737", "0.5520914", "0.5519579", "0.5507161", "0.5507031", "0.54940...
0.0
-1
Creates a COBRApy Reaction object for each reaction to be added to iEK1008
def create_reaction(json_model, rxn_id, rxn_name, ss, mets, lb, ub, gpr): reaction = cobra.Reaction(rxn_id) reaction.name = rxn_name reaction.subsystem = ss json_model.add_reactions([reaction]) reaction.add_metabolites(mets) reaction.lower_bound = lb reaction.upper_bound = ub try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testMakeNewReaction(self):\n\n spcA = Species().fromSMILES('[OH]')\n spcs = [Species().fromSMILES('CC'), Species().fromSMILES('[CH3]')]\n spcTuples = [(spcA, spc) for spc in spcs]\n\n rxns = list(react(*spcTuples))\n\n cerm = CoreEdgeReactionModel()\n\n for rxn in rxns...
[ "0.664883", "0.66347474", "0.6578563", "0.61949325", "0.5876815", "0.58263916", "0.5788129", "0.5761589", "0.5606899", "0.55706173", "0.5537029", "0.5520081", "0.5512158", "0.5445747", "0.54160833", "0.5390883", "0.5368672", "0.53683054", "0.5366003", "0.5348211", "0.53418624...
0.65689945
3
Adds new reactions and metabolites to iEK1008.json while performing continuous testing
def main(): run_test_suite('../models/iEK1008.json') # runs test suite with iEK1008.json # rewrites iEK1008.json to iMtb_H37Rv.json so original model is not overwritten model_iek = cobra.io.load_json_model('../models/iEK1008.json') cobra.io.save_json_model(model_iek, '../models/iMtb_H37Rv.json') m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_reaction_add(reaction, user):\n #Before doing anything\n #Check to see if the reaction was a karma emoji\n if reaction.emoji == initKarma.goodKarma:\n consoleMessage = 'Writing to karmaData file :: Increasing '\n consoleMessage += reaction.message.author.name\n consoleMes...
[ "0.57377374", "0.5685594", "0.567169", "0.5549195", "0.54485726", "0.53651845", "0.5343828", "0.53168577", "0.52647924", "0.5197624", "0.5102805", "0.51013464", "0.5088614", "0.50403416", "0.5033594", "0.5025995", "0.5025969", "0.50153446", "0.4987246", "0.49858665", "0.49766...
0.69024295
0
Converts a cause of death index to a humanreadable string.
def cause_of_death_index_to_string(index: int) -> str: if index == CauseOfDeath.STARVATION.value: return "Starvation" elif index == CauseOfDeath.DEHYDRATION.value: return "Dehydration" elif index == CauseOfDeath.EATEN.value: return "Eaten" else: raise ValueError("Did not recognize CauseOfDea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return \"{}_human\".format(self.index)", "def _index_to_unicode(cls, index: int) -> str:\n return \"\".join(cls._unicode_subscripts[int(_)] for _ in str(index))", "def _make_not_found_message(index: Union[int, slice, str]) -> str:\n msg = [f\"Analysis result {index...
[ "0.5622562", "0.54020613", "0.5385206", "0.5309493", "0.52745426", "0.5257487", "0.5119563", "0.5113673", "0.51084805", "0.5053868", "0.501387", "0.5013531", "0.49857065", "0.49503946", "0.4940279", "0.48666745", "0.48354596", "0.48203522", "0.47872925", "0.4776707", "0.47206...
0.7642903
0
Attaches a text label above each bar which displays the value (height) of the bar.
def attach_text_labels(rects, axes): for rect in rects: height = rect.get_height() label = "{}".format(height) axes.annotate(label, xy=(rect.get_x() + rect.get_width() / 2, height), xytext=(0, 3), textcoords="offset points", ha='cent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autolabel(rects, ax):\n global BAR_NUMBER_SIZE\n for rect in rects:\n height = rect.get_height()\n ax.text(rect.get_x() + rect.get_width()/2.,\n height,\n str(round(height, 1)),\n ha ='center',\n va ='bottom',\n size...
[ "0.7720218", "0.7606605", "0.75506496", "0.74554074", "0.7247496", "0.7140118", "0.71378064", "0.70904166", "0.70445025", "0.7038816", "0.7023626", "0.70203954", "0.7007961", "0.7005911", "0.69808084", "0.6972612", "0.6962681", "0.6962128", "0.6944251", "0.6936561", "0.691810...
0.6458482
65
Creates and returns a grouped bar chart with the death causes. The lists are expected to feature an entry for each cause of death, where the value corresponds to how many specimens died of that cause.
def create_grouped_bar_chart(stats: dict[str, list[int]]): figure, axes = plot.subplots() labels = [str(e) for e in CauseOfDeath] x = numpy.arange(len(labels)) bar_width = 0.15 max_value = 0 rects = [] i = 0 for label, values in stats.items(): max_value = max(max_value, max(values)) rects.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualise_cause_of_death(data: LogData, directory: Path):\n\n rabbit_stats: list[int] = [0 for _ in CauseOfDeath]\n deer_stats: list[int] = [0 for _ in CauseOfDeath]\n wolf_stats: list[int] = [0 for _ in CauseOfDeath]\n bear_stats: list[int] = [0 for _ in CauseOfDeath]\n\n for event in data.events():\n ...
[ "0.7562296", "0.6105632", "0.6035507", "0.5984834", "0.58694273", "0.5796705", "0.57743406", "0.5752848", "0.5696702", "0.5637777", "0.5625334", "0.5550093", "0.55419266", "0.55158776", "0.547458", "0.5461855", "0.5438678", "0.5402194", "0.53831524", "0.5329398", "0.53166", ...
0.806361
0
Produces a grouped bar chart of the different causes of deaths, arranged by the animal types.
def visualise_cause_of_death(data: LogData, directory: Path): rabbit_stats: list[int] = [0 for _ in CauseOfDeath] deer_stats: list[int] = [0 for _ in CauseOfDeath] wolf_stats: list[int] = [0 for _ in CauseOfDeath] bear_stats: list[int] = [0 for _ in CauseOfDeath] for event in data.events(): event_type: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_grouped_bar_chart(stats: dict[str, list[int]]):\n\n figure, axes = plot.subplots()\n\n labels = [str(e) for e in CauseOfDeath]\n x = numpy.arange(len(labels))\n\n bar_width = 0.15\n max_value = 0\n\n rects = []\n i = 0\n for label, values in stats.items():\n max_value = max(max_value, max(val...
[ "0.79494953", "0.6173366", "0.60805166", "0.60178256", "0.59662867", "0.59589386", "0.5912419", "0.59108937", "0.5900395", "0.5898058", "0.5876276", "0.5787513", "0.5760313", "0.5743132", "0.5596977", "0.55531824", "0.553276", "0.54811996", "0.5470746", "0.544473", "0.5411298...
0.7591147
1
Generates a new OperatorBuilder object. atomicTermExpr i an TorqExpression object. A sequence which matches it will be recognized an atomic item and not be parsed further. composedTermNodeLables is a list of labels. Nodes who have one of them will be recognized an expression, which may include another expression inside...
def __init__(self, atomicTermExpr=None, composedTermNodeLabels=None, generatedTermLabel=None): self.__ate = atomicTermExpr if atomicTermExpr is not None else Never() self.__ctnls = composedTermNodeLabels self.__gtl = generatedTermLabel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compile_term(self):\n\n\t\tself.outfile.write('<term>\\n')\n\n\t\tcount = 0\n\n\t\twhile(self.tokenizer.get_token() not in [')',']',';',',', '/', '|', '<', '>', '=', '*', '+', '&']):\n\t\t\tif self.tokenizer.get_token().isdigit():\n\t\t\t\tself.outfile.write(self.tokenizer.int_value())\n\t\t\telif '\"' in self...
[ "0.51256794", "0.50364447", "0.5035556", "0.49387896", "0.49171144", "0.48688382", "0.47859588", "0.47263345", "0.47252068", "0.46344826", "0.46341482", "0.46032685", "0.4565626", "0.45439956", "0.45345488", "0.45064116", "0.4506053", "0.4453859", "0.442932", "0.4415429", "0....
0.6599325
0
Recursively iterate over issue dictionary and print errors.
def _print_issue(issue, ntabs): for key, value in issue.items(): if isinstance(value, dict): tabs = TAB*ntabs print('%s%s (section):' % (tabs, key)) ntabs += 1 print_issue(value, ntabs=ntabs) elif isinstance(value, bool): if value == False:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_wrapper(x):\n errors = list()\n for error_key, error_list in list(x.items()):\n for error in error_list:\n if error_key == 'non_field_errors':\n errors.append(error)\n else:\n errors.append(\"%s: %s\" % (error_key, error))\n return error...
[ "0.57348907", "0.5411636", "0.53937906", "0.53712976", "0.5358204", "0.5333469", "0.52884054", "0.52464217", "0.5168919", "0.51145256", "0.50778586", "0.5039028", "0.5036515", "0.502055", "0.5012484", "0.5011434", "0.4996432", "0.49948236", "0.49832422", "0.49768898", "0.4973...
0.6306336
0
Counts number of neighbours for a torus.
def num_nbrs_torus(A, r, j, c, k): num = 0 r = r - 1 # to account for off by one errors c = c - 1 if j == 0: if k == 0: # top left corner edge case if A[r, c] == ALIVE: num += 1 if A[j, c] == ALIVE: num += 1 if A[j+1, c] == ALIVE: num += 1 if A[r, k+1] == ALIVE: num += 1 if A[j,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def living_neighbors(self):\n neighborCount = 0\n for neighbor in self.__neighbors:\n if neighbor.get_living() == True:\n neighborCount += 1\n return neighborCount", "def count_neighboors(self, x: int, y: int) -> int :\n\n cpt : int = 0\n min_x : int =...
[ "0.7046815", "0.70128703", "0.6961183", "0.689227", "0.67564744", "0.6710658", "0.6696818", "0.66775006", "0.66509134", "0.6617163", "0.6592927", "0.6592103", "0.6536322", "0.65175647", "0.6516252", "0.65064806", "0.64775234", "0.6459924", "0.63998216", "0.6393381", "0.634659...
0.6191579
29
GET / Show the home page
def home(request): return render_to_response('index.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home():\n return response(\"OK\")", "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home():\n payload = manager.get_payload()\n return render_template('index.html', payload=payload)", "def get(self):\n if self.logged_in:\n self.render('home.html', {\n 'n...
[ "0.8102188", "0.78860825", "0.78660476", "0.7857468", "0.77891856", "0.775687", "0.77315885", "0.77263904", "0.7721931", "0.7721931", "0.7721931", "0.7706586", "0.769565", "0.7681862", "0.76753026", "0.7672204", "0.7658548", "0.7657322", "0.7646766", "0.76302624", "0.76005226...
0.77063453
12
POST /validate Validate GeoJSON data in POST body
def validate(request): testing = request.GET.get('testing') if request.method == 'POST': stringy_json = request.raw_post_data else: # GET try: remote_url = request.GET['url'] stringy_json = get_remote_json(remote_url) except KeyError: # The "url" URL param...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_geojson(data):\n \"\"\"Enforces camelcasing of properties\"\"\"\n if 'id' in data:\n del data['id']\n try:\n data['type'] = data['type'] if 'type' in data else \"Feature\"\n data['geometry'] = data['geometry'] if 'geometry' in data else None\n if 'properties' not in ...
[ "0.6258375", "0.61013263", "0.60835147", "0.6058721", "0.60300624", "0.60212815", "0.5967188", "0.580679", "0.58050185", "0.5788679", "0.5773974", "0.5773974", "0.57511264", "0.5706149", "0.5697552", "0.5684848", "0.56350404", "0.5609239", "0.55897486", "0.5548948", "0.554894...
0.67822635
0
Generates a random DSN (Data Source Name).
def dsn(self, dsn_type: t.Optional[DSNType] = None, **kwargs: t.Any) -> str: hostname = self._internet.hostname(**kwargs) scheme, port = self.validate_enum(dsn_type, DSNType) return f"{scheme}://{hostname}:{port}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genRandString(dl = 10):\n ret = ''\n for i in range(dl) :\n ret += random.choice(string.ascii_letters + string.digits)\n return ret", "def generate_domainname():\n domainname = ''.join(generate_string(10, valid_domain_name_chars))\n domain = random.choice(['com', 'co.il', 'info'])\n ...
[ "0.64382917", "0.62634265", "0.6140322", "0.6116163", "0.6050311", "0.6008095", "0.59970444", "0.59962857", "0.59498906", "0.5940348", "0.592077", "0.58331937", "0.5822162", "0.5798043", "0.5791595", "0.57866985", "0.5781572", "0.57651365", "0.57499045", "0.5742771", "0.57403...
0.0
-1