code stringlengths 10 2.58M | original_code stringlengths 3 3.18M | original_language stringclasses 1
value | source stringclasses 7
values |
|---|---|---|---|
from java.util import Queue as q
from java.util import LinkedList as ll
class queue extends q
begin
set l1 = call ll
function __init__ self
begin
print string queue
end function
function add self val
begin
add l1 val
end function
function offer self val
begin
add l1 val
end function
function remove self
begin
return ca... | from java.util import Queue as q
from java.util import LinkedList as ll
class queue(q):
l1 = ll()
def __init__(self):
print ("queue")
def add(self,val):
self.l1.add(val)
def offer(self,val):
self.l1.add(val)
def remove(self):
return self.l1.removeFirst()
| Python | zaydzuhri_stack_edu_python |
function execute self constraint relationComponents
begin
set box = call CreateFunctionBox groupName typeName
if not box
begin
raise call ExecutionError string Could not create a "%s" function box from the group "%s". % tuple typeName groupName
end
return box
end function | def execute(self, constraint, relationComponents):
box = constraint.CreateFunctionBox(self.groupName, self.typeName)
if not box:
raise ExecutionError(
'Could not create a "%s" function box from the group "%s".' %
(self.typeName, self.groupName))
return... | Python | nomic_cornstack_python_v1 |
from typing import Iterable , List
import numpy
from scipy import optimize
from corona import dates
from corona.consts import DURATION , N
from corona.reports import print_report
from core.differential_equations import SIR , Coefficients , dI , dR , dS , get_y
function get_curr_s curr_i curr_r
begin
string Calculate co... | from typing import Iterable, List
import numpy
from scipy import optimize
from corona import dates
from corona.consts import DURATION, N
from corona.reports import print_report
from core.differential_equations import SIR, Coefficients, dI, dR, dS, get_y
def get_curr_s(curr_i: List[int], curr_r: List[int]) -> List[i... | Python | zaydzuhri_stack_edu_python |
import unittest
from src.secret_santa import SecretSanta , SecretSantaResults
class SecretSantaTests extends TestCase
begin
function test_john_jack_jill self
begin
set names = list string John string Jack string Jill
set results : SecretSantaResults = call draw_gifters_and_recipients
print results
comment Verify everyb... | import unittest
from src.secret_santa import SecretSanta, SecretSantaResults
class SecretSantaTests(unittest.TestCase):
def test_john_jack_jill(self):
names = ["John", "Jack", "Jill"]
results: SecretSantaResults = SecretSanta(names).draw_gifters_and_recipients()
print(results)
# ... | Python | zaydzuhri_stack_edu_python |
function __load_dataset__ self file=string ./datasets/web-application-attacks-datasets/ecml_pkdd/learning_dataset.xml
begin
function parse_dataset f
begin
string - Parses the dataset - Input dataset must be xml * Class - Valid request or not * Request - Method - `method` - Protocol - `protocol` - Headers - `headers` * ... | def __load_dataset__(self, file: str = "./datasets/web-application-attacks-datasets/ecml_pkdd/learning_dataset.xml"):
def parse_dataset(f: str):
"""
- Parses the dataset
- Input dataset must be xml
* Class - Valid request or not
... | Python | nomic_cornstack_python_v1 |
function verify_against_regex automaton regex test_num=10000 max_sample_num=12
begin
set symbols = list alphabet
for i in range 1 max_sample_num
begin
print string Testing with sample size { i } end=string
for _ in range test_num
begin
set test = join string list comprehension random choice symbols for _ in range i
if... | def verify_against_regex(
automaton: Automaton, regex: Pattern[str],
test_num: int = 10000, max_sample_num: int = 12) -> bool:
symbols = list(automaton.alphabet)
for i in range(1, max_sample_num):
print(f"\rTesting with sample size {i}", end="")
for _ in range(test_num):
... | Python | nomic_cornstack_python_v1 |
function on_config_change self config section key value
begin
info format string main.py: App.on_config_change: {0}, {1}, {2}, {3} config section key value
end function | def on_config_change(self, config, section, key, value):
Logger.info("main.py: App.on_config_change: {0}, {1}, {2}, {3}".format(
config, section, key, value)) | Python | nomic_cornstack_python_v1 |
class Solution extends object
begin
function backspaceCompare self S T
begin
string :type S: str :type T: str :rtype: bool
set S = call __get_char_stack S
set T = call __get_char_stack T
if length S != length T
begin
return false
end
for tuple s t in zip S T
begin
if s != t
begin
return false
end
end
return true
end fu... | class Solution(object):
def backspaceCompare(self, S, T):
"""
:type S: str
:type T: str
:rtype: bool
"""
S = self.__get_char_stack(S)
T = self.__get_char_stack(T)
if len(S)!=len(T):
return False
for s,t in zip(S,T):
if s... | Python | zaydzuhri_stack_edu_python |
function extract_frags gem_list
begin
set raw_frags = split gem_list at 4 string ;
set frags = list
for j in range length raw_frags
begin
set bedentry = split replace split raw_frags at j string ( at 0 string - string : string :
set bedentry at 1 = integer bedentry at 1
set bedentry at 2 = integer bedentry at 2
append... | def extract_frags(gem_list):
raw_frags = gem_list[4].split(";")
frags = []
for j in range(len(raw_frags)):
bedentry = raw_frags[j].split("(")[0].replace("-", ":").split(":")
bedentry[1] = int(bedentry[1])
bedentry[2] = int(bedentry[2])
frags.append(bedentry)
return frags | Python | nomic_cornstack_python_v1 |
function get_models input_shape dataset_size num_classes capacity cuda_device=none
begin
set model_dict = dict
set model_dict at string nearest_neighbor = call IncrementalNearestNeighbor input_shape dataset_size cuda_device=cuda_device
set model_dict at string queue = queue input_shape num_classes capacity cuda_device... | def get_models(input_shape, dataset_size, num_classes, capacity, cuda_device=None):
model_dict = {}
model_dict['nearest_neighbor'] = IncrementalNearestNeighbor(input_shape, dataset_size, cuda_device=cuda_device)
model_dict['queue'] = Queue(input_shape, num_classes, capacity, cuda_device=cuda_device)
mod... | Python | nomic_cornstack_python_v1 |
from math import sqrt
from itertools import product
from ants import *
class AStar extends object
begin
function __init__ self graph
begin
set graph = graph
end function
function heuristic self node start end
begin
raise NotImplementedError
end function
function search self start end
begin
set openset = set
set closeds... | from math import sqrt
from itertools import product
from ants import *
class AStar(object):
def __init__(self, graph):
self.graph = graph
def heuristic(self, node, start, end):
raise NotImplementedError
def search(self, start, end):
openset = set()
closedse... | Python | zaydzuhri_stack_edu_python |
function create_pose self x y z yaw=0.0
begin
set pose = call PoseStamped
set header = call Header
set stamp = now
set frame_id = string world
set x = x
set y = y
set z = z
set q = call quaternion_from_euler 0.0 0.0 pi * yaw / 180.0
set orientation = call Quaternion *q
return pose
end function | def create_pose(self, x, y, z, yaw=0.):
pose = PoseStamped()
pose.header = Header()
pose.header.stamp = rospy.Time.now()
pose.header.frame_id = 'world'
pose.pose.position.x = x
pose.pose.position.y = y
pose.pose.position.z = z
q = tf.transformations.qua... | Python | nomic_cornstack_python_v1 |
function test_skip_container self
begin
set result = call skip_container string bob string
assert true is instance result bool
end function | def test_skip_container(self):
result = utils.skip_container('bob', '')
self.assertTrue(isinstance(result, bool)) | Python | nomic_cornstack_python_v1 |
function all_in phrases list
begin
set combined = join string list
for phrase in phrases
begin
if phrase not in combined
begin
return false
end
end
return true
end function | def all_in(phrases, list):
combined = ''.join(list)
for phrase in phrases:
if phrase not in combined:
return False
return True | Python | nomic_cornstack_python_v1 |
from contacts import Contacts
function create_contact fname lname phone email
begin
string Function to create a new contact
set new_contact = call Contacts fname lname phone email
return new_contact
end function | from contacts import Contacts
def create_contact(fname, lname, phone, email):
"""Function to create a new contact """
new_contact = Contacts(fname, lname, phone, email)
return new_contact
| Python | zaydzuhri_stack_edu_python |
import os
import json
import indicoio
import operator
set api_key = call get_env INDICO_API_KEY
function load_data filename
begin
with open filename string rb as f
begin
return list comprehension loads l for l in f
end
end function
function dump_data filename data
begin
with open filename string wb as outfile
begin
dum... | import os
import json
import indicoio
import operator
indicoio.config.api_key = os.get_env(INDICO_API_KEY)
def load_data(filename):
with open(filename, 'rb') as f:
return [json.loads(l) for l in f]
def dump_data(filename, data):
with open(filename, 'wb') as outfile:
json.dump(data, outfile)... | Python | zaydzuhri_stack_edu_python |
import unittest
from src import ATMachine as aT
class ATMachineTest extends TestCase
begin
set hundred = 0
set fifty = 1
set twenty = 2
set ten = 3
function test_withdraw_30_one_of_20_and_one_of_10 self
begin
set bills = call withdraw 30
assert equal bills at twenty 1
assert equal bills at ten 1
end function
function t... | import unittest
from src import ATMachine as aT
class ATMachineTest(unittest.TestCase):
hundred = 0
fifty = 1
twenty = 2
ten = 3
def test_withdraw_30_one_of_20_and_one_of_10(self):
bills = aT.withdraw(30)
self.assertEqual(bills[self.twenty], 1)
self.assertEq... | Python | zaydzuhri_stack_edu_python |
function proximal_step self gradf=none
begin
string Compute proximal update (gradient descent + constraint). Variables are mapped back and forth between input and frequency domains.
if gradf is none
begin
set gradf = call eval_grad
end
set Vf at slice : : = Yf - 1.0 / L * gradf
set V = call irfftn Vf Nv axisN
set X ... | def proximal_step(self, gradf=None):
"""Compute proximal update (gradient descent + constraint).
Variables are mapped back and forth between input and
frequency domains.
"""
if gradf is None:
gradf = self.eval_grad()
self.Vf[:] = self.Yf - (1. / self.L) * gr... | Python | jtatman_500k |
function define_saver exclude=none
begin
set variables = list
set exclude = exclude or list
set exclude = list comprehension compile regex for regex in exclude
for variable in call global_variables
begin
if any generator expression match name for regex in exclude
begin
continue
end
append variables variable
end
set s... | def define_saver(exclude=None) -> tf.train.Saver:
variables = []
exclude = exclude or []
exclude = [re.compile(regex) for regex in exclude]
for variable in tf.global_variables():
if any(regex.match(variable.name) for regex in exclude):
continue
variables.append(variable)
saver = tf.train.Saver(v... | Python | nomic_cornstack_python_v1 |
comment !/usr/bin/python
import commands
comment Take location where REL ticket needs to be generated
set ticket_location = call raw_input string Enter the directory name where RELEASE ticket needs to be generated :
comment Input user id 1 and user id2
set user1 = call raw_input string Enter userid1 :
set user2 = call ... | #!/usr/bin/python
import commands
# Take location where REL ticket needs to be generated
ticket_location = raw_input("Enter the directory name where RELEASE ticket needs to be generated : ")
# Input user id 1 and user id2
user1 = raw_input("Enter userid1 : ")
user2 = raw_input("Enter userid2 : ")
# Product name inp... | Python | zaydzuhri_stack_edu_python |
import pytest
function inc x
begin
return x + 1
end function
function f
begin
raise call SystemExit 1
end function
comment Le retours des fonctions
function test_answer
begin
assert call inc 3 == 4
end function
comment La bonne gestion des erreurs
function test_mytest
begin
with raises SystemExit
begin
f dist
end
end f... | import pytest
def inc(x):
return x + 1
def f():
raise SystemExit(1)
# Le retours des fonctions
def test_answer():
assert inc(3) == 4
# La bonne gestion des erreurs
def test_mytest():
with pytest.raises(SystemExit):
f() | Python | zaydzuhri_stack_edu_python |
function isfunction obj
begin
return call isfunction obj
end function | def isfunction(obj):
return isfunction(obj) | Python | nomic_cornstack_python_v1 |
function convert self data cf_cap=none
begin
set cf_cap = call default cf_cap tuple generator expression n_caps - 1 for stage in stages
assert length cf_cap == length stages
assert size np data - 1 == n_diff
set base_shape = call shape data at slice : - 1 :
set base_len = length base_shape
set result = list
set colo... | def convert(self, data, cf_cap=None):
cf_cap = default(cf_cap, tuple(stage.meta.n_caps-1 for stage in self.stages))
assert len(cf_cap) == len(self.stages)
assert np.size(data, -1) == self.stages[0].meta.n_diff
base_shape = np.shape(data)[:-1]
base_len = len(base_shape)
... | Python | nomic_cornstack_python_v1 |
function valid_page_in_book arch **kwargs
begin
return not call xpath string //page[not(ancestor::notebook)]
end function | def valid_page_in_book(arch, **kwargs):
return not arch.xpath('//page[not(ancestor::notebook)]') | Python | nomic_cornstack_python_v1 |
function readdata filename
begin
set f = open filename
set tuple num_vehicles capacity speed = list comprehension integer nb for nb in split read line f
assert num_vehicles > 0
assert capacity > 0
assert speed > 0
comment lists to store the parsed file
set customer_ids = list
set coords = list
set demands = list
set... | def readdata(filename):
f = open(filename)
num_vehicles, capacity, speed = [int(nb) for nb in f.readline().split()]
assert num_vehicles > 0
assert capacity > 0
assert speed > 0
# lists to store the parsed file
customer_ids = []
coords = []
demands = []
open_times = []
close_... | Python | nomic_cornstack_python_v1 |
function start_slsqp self
begin
if plot
begin
call init_plot x0
set update_with_energy = true
end
set res = minimize fun x0 method=string SLSQP jac=der_fun tol=0.01 options=dict string disp true
return call to_nn_input x
end function | def start_slsqp(self):
if self.plot:
self.init_plot(self.x0)
self.update_with_energy=True
res=minimize(self.fun,self.x0,
method='SLSQP',
jac=self.der_fun,
tol=1e-2,
options={'disp': True})
... | Python | nomic_cornstack_python_v1 |
string Created on 14 feb 2012 @author: thomasg
comment imports
comment import os
comment from os import listdir
comment from os.path import isfile, join
import numpy as np
from numpy.lib.stride_tricks import as_strided
from scipy.stats import norm , mstats , stats
from scipy.signal import correlate , convolve2d , convo... | '''
Created on 14 feb 2012
@author: thomasg
'''
#
#imports
#import os
#from os import listdir
#from os.path import isfile, join
import numpy as np
from numpy.lib.stride_tricks import as_strided
from scipy.stats import norm, mstats, stats
from scipy.signal import correlate,convolve2d, convolve
#from scipy.signal impor... | Python | zaydzuhri_stack_edu_python |
import unittest
from Dice2 import Die
class DieRollTest extends TestCase
begin
string Test the functionality of the Die class; roll function.
function setUp self
begin
set possible_values = list 1 2 3 string Dog string Cat string hippo
set new_die = call Die possible_values
print shortDescription
end function
function ... | import unittest
from Dice2 import Die
class DieRollTest(unittest.TestCase):
"""Test the functionality of the Die class; roll function."""
def setUp(self):
self.possible_values = [1,2,3,"Dog", "Cat", "hippo"]
self.new_die = Die(self.possible_values)
print(self.shortDescription)
def... | Python | zaydzuhri_stack_edu_python |
comment n=input('enter')
comment n=int(n)
set n = 4
set s = 1
if n > 0
begin
for i in range 1 n + 1
begin
set s = s * i
end
end
print s | #n=input('enter')
#n=int(n)
n=4
s=1
if n>0 :
for i in range(1,n+1):
s=s*i
print(s)
| Python | zaydzuhri_stack_edu_python |
import random
function roll_dice
begin
comment generate random number from 1 to 6
set dice = random integer 1 6
return dice
end function
comment take input from the user
set roll_again = string yes
while roll_again == string yes or roll_again == string y
begin
print string Rolling the dices...
print string The values a... | import random
def roll_dice():
# generate random number from 1 to 6
dice = random.randint(1, 6)
return dice
# take input from the user
roll_again = "yes"
while roll_again == "yes" or roll_again == "y":
print("Rolling the dices...")
print("The values are....")
# get two random values
dice1 = ... | Python | jtatman_500k |
import functools
from tkinter import *
set root = call Tk
function func name
begin
print name
end function
set mylist = list string item1 string item2 string item3
for item in mylist
begin
set button = call Button root text=item command=partial func item
call pack
end
call mainloop | import functools
from tkinter import *
root = Tk()
def func(name):
print (name)
mylist = ['item1','item2','item3']
for item in mylist:
button = Button(root,text=item,command=functools.partial(func,item))
button.pack()
root.mainloop() | Python | zaydzuhri_stack_edu_python |
function get_loss self
begin
comment Loss is the L1 norm of the difference between the obtained sentence encodings
set labels = labels - 1.0 / 4.0
set prediction = prediction
set loss = call loss_function prediction labels
end function | def get_loss(self):
# Loss is the L1 norm of the difference between the obtained sentence encodings
labels = (self.labels - 1.0) / 4.0
prediction = self.prediction
self.loss = self.loss_function(prediction, labels) | Python | nomic_cornstack_python_v1 |
function phone self
begin
return get pulumi self string phone
end function | def phone(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "phone") | Python | nomic_cornstack_python_v1 |
function keyVal key
begin
set key = lower key
if key in data
begin
return count data key
end
else
begin
return string Word not found. Please check again!
end
end function
set key = input string Insert key word:
set answer = call keyVal key
print answer | def keyVal(key):
key = key.lower()
if key in data:
return data.count(key)
else:
return "Word not found. Please check again!"
key = input("Insert key word: ")
answer = keyVal(key)
print(answer) | Python | zaydzuhri_stack_edu_python |
string 多态: 前提就是 需要继承和重写父类方法 重写父类中的方法,创建子类的对象去调用,不同的子类对象,调用相同的方法是不同的结果
class Dog extends object
begin
comment 初始化方法定义属性
function __init__ self name
begin
set name = name
end function
function game self
begin
print string %s 在玩耍... % name
end function
end class
class XiaoTianDog extends Dog
begin
function game self
begin... | """
多态:
前提就是 需要继承和重写父类方法
重写父类中的方法,创建子类的对象去调用,不同的子类对象,调用相同的方法是不同的结果
"""
class Dog(object):
# 初始化方法定义属性
def __init__(self, name):
self.name = name
def game(self):
print("%s 在玩耍..." % self.name )
class XiaoTianDog(Dog):
def game(self):
print("%s 在天上玩耍..." % self.name )
c... | Python | zaydzuhri_stack_edu_python |
function to_str self
begin
import simplejson as json
if PY2
begin
import sys
call reload sys
call setdefaultencoding string utf-8
end
return dumps call sanitize_for_serialization self ensure_ascii=false
end function | def to_str(self):
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False) | Python | nomic_cornstack_python_v1 |
function coherence_from_spectral Sw
begin
set Sxx = real
set Syy = real
set Sxy_mod_sq = real
set Sxy_mod_sq = Sxy_mod_sq / Sxx
set Sxy_mod_sq = Sxy_mod_sq / Syy
return Sxy_mod_sq
end function | def coherence_from_spectral(Sw):
Sxx = Sw[0, 0].real
Syy = Sw[1, 1].real
Sxy_mod_sq = (Sw[0, 1] * Sw[1, 0]).real
Sxy_mod_sq /= Sxx
Sxy_mod_sq /= Syy
return Sxy_mod_sq | Python | nomic_cornstack_python_v1 |
function test_qcschema_molecule_record_round_trip_from_to_from self
begin
comment get a molecule qcschema
import qcportal as ptl
set client = call FractalClient
set record = call query_molecules molecular_formula=string C16H20N3O5 at 0
comment now make the molecule from the record instance with the geometry
set mol_qca... | def test_qcschema_molecule_record_round_trip_from_to_from(self):
# get a molecule qcschema
import qcportal as ptl
client = ptl.FractalClient()
record = client.query_molecules(molecular_formula="C16H20N3O5")[0]
# now make the molecule from the record instance with the geometry... | Python | nomic_cornstack_python_v1 |
string Ann
set greet = string Hello Bob
set x = 0
set y = 6
print greet at y - 2
print greet at 0 greet at 6
print greet at x greet at y
print greet at - 9 greet at - 3
comment Slide 7
greet at slice 0 : 3 :
greet at slice 0 : 3 : 1
greet at slice 3 : 0 : - 1
greet at slice : 5 :
greet at slice 0 : 5 : 1
greet at sl... | '''Ann'''
greet = "Hello Bob"
x = 0
y = 6
print(greet[y - 2])
print(greet[0], greet[6])
print(greet[x], greet[y])
print(greet[-9], greet[-3])
# Slide 7
greet[0:3]
greet[0:3:1]
greet[3:0:-1]
greet[:5]
greet[0:5:1]
greet[5:]
greet[5:9:1]
greet[:]
greet[0:9:1]
greet[::-1]
greet[-1::-1]
# slide 8
"Hello" + "Bob"
... | Python | zaydzuhri_stack_edu_python |
from functools import reduce
from operator import add
import sys
from euler_util import toDigits
function main
begin
set tuple s total = tuple 0 0
set power = 5
for current in range 10 power + 1 * 9 ^ power
begin
set s = reduce add list comprehension d ^ power for d in call toDigits current
if s == current
begin
set to... | from functools import reduce
from operator import add
import sys
from euler_util import toDigits
def main():
s, total = 0, 0
power = 5
for current in range(10, (power+1)*9**power):
s = reduce(add, [d**power for d in toDigits(current)])
if s == current:
total += current
p... | Python | zaydzuhri_stack_edu_python |
from unittest import TestCase
from models.modules.module import Module
from models.users.user import User
import datetime
class TestCourse extends TestCase
begin
function test_create self
begin
set user = call User email=string test@example.com password=string 123
set course = call Module string test_course user
assert... | from unittest import TestCase
from models.modules.module import Module
from models.users.user import User
import datetime
class TestCourse(TestCase):
def test_create(self):
user = User(email="test@example.com",
password="123")
course = Module("test_course", user)
sel... | Python | zaydzuhri_stack_edu_python |
string DIRECTIONS ========== 1. Given the list `friend_favorites`, create a new data structure in the function `create_new_candy_data_structure` that describes the different kinds of candy paired with a list of friends that like that candy. friend_favorites = [ [ "Sally", [ "lollipop", "bubble gum", "laffy taffy" ]], [... | '''
DIRECTIONS
==========
1. Given the list `friend_favorites`, create
a new data structure in the function `create_new_candy_data_structure`
that describes the different kinds of candy paired with a list of friends that
like that candy.
friend_favorites = [
[ "Sally", [ "lollipop", "bubble gum", "laffy taffy... | Python | zaydzuhri_stack_edu_python |
import numpy as np
import matplotlib.pyplot as plt
comment import matplotlib.image as mimg
from scipy import ndimage
function get_local_map img kernel_size=3
begin
string return image local mean map and local standard deviation map. kernel_size: the size of image local
set img_local_mean_map = call uniform_filter img s... | import numpy as np
import matplotlib.pyplot as plt
#import matplotlib.image as mimg
from scipy import ndimage
def get_local_map(img, kernel_size =3):
"""
return image local mean map and local standard deviation map.
kernel_size: the size of image local
"""
img_local_mean_map = ndimage.uniform_fi... | Python | zaydzuhri_stack_edu_python |
from recipes import split_ingredients , validate_time , convert_filename , generate_lines
from pytest import raises
function test_split_ingredients
begin
assert call split_ingredients string == list string
assert call split_ingredients string A == list string A
assert call split_ingredients string A; B, C == list stri... | from recipes import split_ingredients, validate_time, convert_filename,\
generate_lines
from pytest import raises
def test_split_ingredients():
assert(split_ingredients("") == [''])
assert(split_ingredients("A") == ['A'])
assert(split_ingredients("A; B, C") == ['A; B', 'C'])
assert(split_ingredien... | Python | zaydzuhri_stack_edu_python |
function load_cookies filename
begin
with open filename string rb as f
begin
set requests_cookiejar = load pickle f
end
return requests_cookiejar
end function | def load_cookies(filename):
with open(filename, 'rb') as f:
requests_cookiejar = pickle.load(f)
return requests_cookiejar | Python | nomic_cornstack_python_v1 |
function create_context self message_queue task_id
begin
return call UploadContext settings tuple message_queue task_id
end function | def create_context(self, message_queue, task_id):
return UploadContext(self.settings, (), message_queue, task_id) | Python | nomic_cornstack_python_v1 |
function delete_volume self disk_name
begin
debug call _ string Removing the logical volume '%s' % disk_name
call _remove_logical_volume disk_name
end function | def delete_volume(self, disk_name):
LOG.debug(_("Removing the logical volume '%s'") % disk_name)
self._remove_logical_volume(disk_name) | Python | nomic_cornstack_python_v1 |
function group lst n
begin
return call zip_longest *[itertools.islice(lst, i, None, n) for i in range(n)]
end function | def group(lst, n):
return itertools.zip_longest(*[itertools.islice(lst, i, None, n) for i in range(n)]) | Python | nomic_cornstack_python_v1 |
function do_root self arg
begin
if not arg
begin
write stdout string Available ports:
if moteStates
begin
for ms in moteStates
begin
write stdout format string {0} serialport
end
end
else
begin
write stdout string <none>
end
write stdout string
end
else
begin
for ms in moteStates
begin
try
begin
if serialport == arg
be... | def do_root(self, arg):
if not arg:
self.stdout.write('Available ports:')
if self.app.moteStates:
for ms in self.app.moteStates:
self.stdout.write(' {0}'.format(ms.moteConnector.serialport))
else:
self.stdout.write(' <none... | Python | nomic_cornstack_python_v1 |
function refit self
begin
call optimize _x_train _y_train _noise_power
set _likelihood = call compute_loglikelihood _x_train _y_train _noise_power
end function | def refit(self) -> None:
self._kernel.optimize(self._x_train, self._y_train, self._noise_power)
self._likelihood = self._kernel.compute_loglikelihood(
self._x_train, self._y_train, self._noise_power) | Python | nomic_cornstack_python_v1 |
function content_url self snapshot=none path=none live=false
begin
set params : Dict = dict
if ends with CONFIGURATION string Dev
begin
comment In development, it's very useful to be able to preview
comment content, so we return a local URL
set url = reverse string ui-accounts-content kwargs=dictionary project_name=na... | def content_url(self, snapshot=None, path=None, live=False) -> str:
params: Dict = {}
if settings.CONFIGURATION.endswith("Dev"):
# In development, it's very useful to be able to preview
# content, so we return a local URL
url = (
reverse("ui-accounts-c... | Python | nomic_cornstack_python_v1 |
function line_width self *args **kwargs
begin
return call time_raster_sink_b_sptr_line_width self *args keyword kwargs
end function | def line_width(self, *args, **kwargs):
return _qtgui_swig.time_raster_sink_b_sptr_line_width(self, *args, **kwargs) | Python | nomic_cornstack_python_v1 |
comment initializing training data
set training = list
set output_empty = list 0 * length classes
for doc in documents
begin
comment initializing bag of words
set bag = list
comment list of tokenized words for the pattern
set pattern_words = doc at 0
comment lemmatize each word - create base word, in attempt to repre... | # initializing training data
training = []
output_empty = [0] * len(classes)
for doc in documents:
# initializing bag of words
bag = []
# list of tokenized words for the pattern
pattern_words = doc[0]
# lemmatize each word - create base word, in attempt to represent related words
pattern_words =... | Python | zaydzuhri_stack_edu_python |
comment I think this may be some of the uglier code I've written. But it seems to
comment work on the tests provided. -- Alex Vondrak
set VALUE = dict string 2 2 ; string 3 3 ; string 4 4 ; string 5 5 ; string 6 6 ; string 7 7 ; string 8 8 ; string 9 9 ; string T 10 ; string J 11 ; string Q 12 ; string K 13 ; string A ... | ##I think this may be some of the uglier code I've written. But it seems to
##work on the tests provided. -- Alex Vondrak
VALUE = {"2":2, "3":3, "4":4, "5":5, "6":6, "7":7, "8":8, "9":9, "T":10, "J":11, "Q":12, "K":13, "A":14}
def uniq(li): return {}.fromkeys(li, 0).keys()
def rank(hand):
#return rank string, ... | Python | zaydzuhri_stack_edu_python |
comment !/usr/bin/env python2
import os
import sys
import time
import shutil
import hashlib
import copy
import difflib
function print_error message
begin
tuple print ? stderr string [91m + message + string [0m
end function | #!/usr/bin/env python2
import os
import sys
import time
import shutil
import hashlib
import copy
import difflib
def print_error(message):
print >> sys.stderr, '\033[91m' + message + '\033[0m'
| Python | zaydzuhri_stack_edu_python |
set absolute_value = absolute 10
print absolute_value | absolute_value = abs(10)
print(absolute_value) | Python | zaydzuhri_stack_edu_python |
function outputs_for_module_type_operation self
begin
set result = list
set module = __name__
set turbine_rating_MW = input_dict at string turbine_rating_MW
set num_turbines = input_dict at string num_turbines
set project_size_kw = num_turbines * turbine_rating_MW * 1000
if in_distributed_mode
begin
append result dict... | def outputs_for_module_type_operation(self):
result = []
module = type(self).__name__
turbine_rating_MW = self.input_dict['turbine_rating_MW']
num_turbines = self.input_dict['num_turbines']
project_size_kw = num_turbines * turbine_rating_MW * 1000
if self.in_distributed_... | Python | nomic_cornstack_python_v1 |
function _scale_down_if_needed self
begin
comment Kill inactive workers if there's no more work to do.
call _kill_inactive_workers_if_done
while call should_scale_down num_total_workers=call num_total_actors num_idle_workers=call num_idle_actors
begin
set killed = call kill_inactive_actor
if not killed
begin
comment Th... | def _scale_down_if_needed(self):
# Kill inactive workers if there's no more work to do.
self._kill_inactive_workers_if_done()
while self._autoscaling_policy.should_scale_down(
num_total_workers=self._actor_pool.num_total_actors(),
num_idle_workers=self._actor_pool.num_id... | Python | nomic_cornstack_python_v1 |
function name self
begin
return get pulumi self string name
end function | def name(self) -> str:
return pulumi.get(self, "name") | Python | nomic_cornstack_python_v1 |
comment !/usr/bin/env python
comment coding: utf-8
comment # CS-109: Fall 2015 -- Lab 4
comment # Regression in Python
comment ***
comment This is a very quick run-through of some basic statistical concepts
comment * Regression Models
comment * Linear, Logistic
comment * Prediction using linear regression
comment * Som... | #!/usr/bin/env python
# coding: utf-8
# # CS-109: Fall 2015 -- Lab 4
#
# # Regression in Python
#
# ***
# This is a very quick run-through of some basic statistical concepts
#
# * Regression Models
# * Linear, Logistic
# * Prediction using linear regression
# * Some re-sampling methods
# * Train-Test s... | Python | zaydzuhri_stack_edu_python |
function unmonitor_instances self instance_ids dry_run=false
begin
set params = dict
call build_list_params params instance_ids string InstanceId
if dry_run
begin
set params at string DryRun = string true
end
return call get_list string UnmonitorInstances params list tuple string item InstanceInfo verb=string POST
end... | def unmonitor_instances(self, instance_ids, dry_run=False):
params = {}
self.build_list_params(params, instance_ids, 'InstanceId')
if dry_run:
params['DryRun'] = 'true'
return self.get_list('UnmonitorInstances', params,
[('item', InstanceInf... | Python | nomic_cornstack_python_v1 |
function get_boundingbox face width height scale=1.3 minsize=none
begin
set x1 = call left
set y1 = call top
set x2 = call right
set y2 = call bottom
set size_bb = integer max x2 - x1 y2 - y1 * scale
if minsize
begin
if size_bb < minsize
begin
set size_bb = minsize
end
end
set tuple center_x center_y = tuple x1 + x2 //... | def get_boundingbox(face, width, height, scale=1.3, minsize=None):
x1 = face.left()
y1 = face.top()
x2 = face.right()
y2 = face.bottom()
size_bb = int(max(x2 - x1, y2 - y1) * scale)
if minsize:
if size_bb < minsize:
size_bb = minsize
center_x, center_y = (x1 + x2) // 2, (... | Python | nomic_cornstack_python_v1 |
function plex self
begin
return _plex
end function | def plex(self):
return self._plex | Python | nomic_cornstack_python_v1 |
function power self value
begin
set _power = value
end function | def power(self, value: int):
self._power = value | Python | nomic_cornstack_python_v1 |
function direction self
begin
return direction
end function | def direction(self):
return self.cfg.direction | Python | nomic_cornstack_python_v1 |
function get_HMM_gene_ID self hmm_name
begin
set meta = drop missing _meta subset=list string #ncbi_accession axis=0
return call tolist
end function | def get_HMM_gene_ID(self, hmm_name: str) -> list[str]:
meta = self._meta.dropna(subset=["#ncbi_accession"], axis=0)
return meta[meta["#ncbi_accession"] == hmm_name]["gene_symbol"].values.tolist() | Python | nomic_cornstack_python_v1 |
function truncate self before=none after=none axis=none copy=true
begin
string Truncate a Series or DataFrame before and after some index value. This is a useful shorthand for boolean indexing based on index values above or below certain thresholds. Parameters ---------- before : date, string, int Truncate all rows bef... | def truncate(self, before=None, after=None, axis=None, copy=True):
"""
Truncate a Series or DataFrame before and after some index value.
This is a useful shorthand for boolean indexing based on index
values above or below certain thresholds.
Parameters
----------
... | Python | jtatman_500k |
function test_born_scatter_2d
begin
set tuple expected actual = call run_born_scatter_2d propagator=scalarbornprop dt=0.001 prop_kwargs=dict string pml_width 30
set diff = flatten expected - cpu actual
assert norm < 0.0025
end function | def test_born_scatter_2d():
expected, actual = run_born_scatter_2d(propagator=scalarbornprop,
dt=0.001,
prop_kwargs={'pml_width': 30})
diff = (expected - actual.cpu()).flatten()
assert diff.norm() < 0.0025 | Python | nomic_cornstack_python_v1 |
import cv2
import numpy as np
import math
import matplotlib.pyplot as plt
function HausDimIm image
begin
comment Capture the image and convert it to gray
set f = call cvtColor call imread image COLOR_BGR2GRAY
comment Save the length in x and y
set tuple sizeX sizeY = shape
comment Set the number and the size of the box... | import cv2
import numpy as np
import math
import matplotlib.pyplot as plt
def HausDimIm(image):
# Capture the image and convert it to gray
f = cv2.cvtColor(cv2.imread(image), cv2.COLOR_BGR2GRAY)
# Save the length in x and y
(sizeX, sizeY) = f.shape
# Set the number and the size of the boxes
box... | Python | zaydzuhri_stack_edu_python |
function __invert__ self
begin
return wc
end function | def __invert__(self):
return self.wc | Python | nomic_cornstack_python_v1 |
from selenium import webdriver
from file_writer import FileWriter
set DESIRED_SECTIONS = list string processo string órgão julgador string data do julgamento string data da publicação
set WEBDRIVER_PATH = string /usr/local/bin/chromedriver
set BINARY_PATH = string /usr/bin/google-chrome
class Stj
begin
function __init_... | from selenium import webdriver
from file_writer import FileWriter
DESIRED_SECTIONS = ["processo", "órgão julgador", "data do julgamento", "data da publicação"]
WEBDRIVER_PATH = "/usr/local/bin/chromedriver"
BINARY_PATH = "/usr/bin/google-chrome"
class Stj:
def __init__(self):
self.browser = webdriver.C... | Python | zaydzuhri_stack_edu_python |
function test_rectangle12 self
begin
with assert raises ValueError
begin
call Rectangle 5 4 - 1 3
end
with assert raises ValueError
begin
call Rectangle 5 4 1 - 3
end
end function | def test_rectangle12(self):
with self.assertRaises(ValueError):
Rectangle(5, 4, -1, 3)
with self.assertRaises(ValueError):
Rectangle(5, 4, 1, -3) | Python | nomic_cornstack_python_v1 |
comment Iterate through entire Array, selecting the lowest value and replacing that value with the current iteration value
set nums = list 21 6 13 1 105 74 37
for i in range length nums - 1
begin
set low_val_idx = i
for j in range i length nums - 1
begin
if nums at low_val_idx > nums at j + 1
begin
set low_val_idx = j ... | #Iterate through entire Array, selecting the lowest value and replacing that value with the current iteration value
nums = [21, 6, 13, 1, 105, 74, 37]
for i in range(len(nums) -1):
low_val_idx = i
for j in range(i, len(nums) -1):
if nums[low_val_idx] > nums[j + 1]:
low_val_idx = j+1
nu... | Python | zaydzuhri_stack_edu_python |
function _delete_clustering_group_if_empty h5_path label
begin
with call SharedH5File h5_path string r+ as file
begin
if string clustering in file
begin
set clustering_group = file at string clustering
if label in clustering_group
begin
set algo_group = clustering_group at label
comment the algo groups is empty..., so ... | def _delete_clustering_group_if_empty(h5_path, label):
with SharedH5File(h5_path, "r+") as file:
if 'clustering' in file:
clustering_group = file['clustering']
if label in clustering_group:
algo_group = clustering_group[label]
if not list(algo_group.... | Python | nomic_cornstack_python_v1 |
comment -*- encoding: utf-8 -*-
import os | # -*- encoding: utf-8 -*-
import os
| Python | zaydzuhri_stack_edu_python |
function horse_name self
begin
return _horse_name
end function | def horse_name(self) -> str:
return self._horse_name | Python | nomic_cornstack_python_v1 |
function test_past_competition self
begin
print string testing to book a past competition
set result = get client_test string /book/ + competitions_test at 0 at string name + string / + clubs_test at 0 at string name
assert status_code in list 302
end function | def test_past_competition(self):
print('testing to book a past competition')
result = self.client_test.get(
"/book/" + self.competitions_test[0]['name']
+ "/" + self.clubs_test[0]['name']
)
assert result.status_code in [302] | Python | nomic_cornstack_python_v1 |
import pytest
from src import longest_transpose_word
comment End to End testcases to find longest word and transpose of it
set test_longest_transpose_words_testdata = list tuple string ../tests/input_data_files/e2e_data_testcase1.txt string asdasdasda string adsadsadsa tuple string ../tests/input_data_files/e2e_data_te... | import pytest
from src import longest_transpose_word
# End to End testcases to find longest word and transpose of it
test_longest_transpose_words_testdata = [
("../tests/input_data_files/e2e_data_testcase1.txt","asdasdasda","adsadsadsa"),
("../tests/input_data_files/e2e_data_testcase2.txt","fairy-tales,",",s... | Python | zaydzuhri_stack_edu_python |
import os
import tarfile
import urllib.request
set _url_base = string http://www.cs.toronto.edu/%7Ekriz/
set _file_name = string cifar-10-python.tar.gz
set _save_dir_name = string data-set
set _expanded_dir_name = string cifar-10-batches-py
set _base_dir = directory name path absolute path path __file__
set _data_dir =... | import os
import tarfile
import urllib.request
_url_base = 'http://www.cs.toronto.edu/%7Ekriz/'
_file_name = 'cifar-10-python.tar.gz'
_save_dir_name = 'data-set'
_expanded_dir_name = "cifar-10-batches-py"
_base_dir = os.path.dirname(os.path.abspath(__file__))
_data_dir = _base_dir + "/" + _save_dir_name
_saved_file ... | Python | zaydzuhri_stack_edu_python |
function print_menu classes
begin
print string Character/Race Selection
for tuple key classes_ in enumerate classes start=1
begin
print format string {}. {} key classes_
end
print
end function
call print_menu classes
call print_menu races | def print_menu(classes):
print ("Character/Race Selection")
for key,classes_ in enumerate(classes, start=1):
print('{}. {}'.format(key,classes_))
print()
print_menu(classes)
print_menu(races) | Python | zaydzuhri_stack_edu_python |
function _gen_lookup_dirs
begin
comment If _config_dir specified by user, only searches in that dir
if _config_dir is not none
begin
set dirs = list _config_dir
end
else
begin
comment Caller script's dir
set dirs = list absolute path path get current directory
comment Caller script's parent dir
set dirs = dirs + list a... | def _gen_lookup_dirs():
# If _config_dir specified by user, only searches in that dir
if _config_dir is not None:
dirs = [_config_dir]
else:
# Caller script's dir
dirs = [os.path.abspath(os.getcwd())]
# Caller script's parent dir
dirs += [os.path.abspath(os.path.joi... | Python | nomic_cornstack_python_v1 |
function passwd passwd user=string alg=string sha1 realm=none
begin
comment Shouldn't it be SHA265 instead of SHA1?
set digest = has attribute hashlib alg and get attribute hashlib alg or none
if digest
begin
if realm
begin
update digest format string {}:{}:{} user realm passwd
end
else
begin
update digest passwd
end
... | def passwd(passwd, user="", alg="sha1", realm=None):
# Shouldn't it be SHA265 instead of SHA1?
digest = hasattr(hashlib, alg) and getattr(hashlib, alg) or None
if digest:
if realm:
digest.update(
"{}:{}:{}".format(
user,
realm,
... | Python | nomic_cornstack_python_v1 |
comment !/usr/bin/env python3
comment -*- coding: utf-8 -*-
string Created on Tue Jun 9 22:42:50 2020 @author: dogukan
comment matplotlib kutuphanesi
comment gorsellestirma kutuphanesi
comment line plot , scatter plot, bar polt , subplots, histogram
import pandas as pd
set df = read csv string original.csv
print column... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 9 22:42:50 2020
@author: dogukan
"""
# matplotlib kutuphanesi
# gorsellestirma kutuphanesi
# line plot , scatter plot, bar polt , subplots, histogram
import pandas as pd
df = pd.read_csv("original.csv")
print (df.columns)
print(df.Species.uniq... | Python | zaydzuhri_stack_edu_python |
function expand_task_layer self strategy min_n_output_units task_layer
begin
comment Expands (creates new) the fully connected layer
comment then calls adapt_task_layer to copy existing weights +
comment initialize the new weights
if out_features >= min_n_output_units
begin
return task_layer
end
set new_layer = call cr... | def expand_task_layer(self, strategy, min_n_output_units: int, task_layer):
# Expands (creates new) the fully connected layer
# then calls adapt_task_layer to copy existing weights +
# initialize the new weights
if task_layer.out_features >= min_n_output_units:
return task_la... | Python | nomic_cornstack_python_v1 |
import cv2 , math , numpy as np , dlib
from sklearn.externals import joblib
import warnings
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import os
function cls
begin
call system if expression name == string nt then string cls else string clear
end function
filter warnings string ignore
comme... | import cv2, math, numpy as np, dlib
from sklearn.externals import joblib
import warnings
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import os
def cls():
os.system('cls' if os.name=='nt' else 'clear')
warnings.filterwarnings("ignore")
#Declare values
emotions = ["neutral","a... | Python | zaydzuhri_stack_edu_python |
from sys import stdin
set n = integer strip read line stdin
set arr = list map int split read line stdin
sort arr reverse=true
set total = 0
for i in arr
begin
if arr at 0 != i
begin
set total = total + i / 2
end
end
print sum arr - total | from sys import stdin
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
arr.sort(reverse = True)
total = 0
for i in arr:
if arr[0] != i:
total += i / 2
print(sum(arr) - total)
| Python | zaydzuhri_stack_edu_python |
function password
begin
set password_form = call PasswordForm
if call validate_on_submit
begin
call update_password data data
return call redirect string /
end
return call render_template string change_password.html password_form=password_form
end function | def password():
password_form = PasswordForm()
if password_form.validate_on_submit():
current_user.update_password(password_form.current_password.data,
password_form.new_password.data)
return redirect('/')
return render_template('change_password.html', pa... | Python | nomic_cornstack_python_v1 |
function exact self
begin
return get pulumi self string exact
end function | def exact(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "exact") | Python | nomic_cornstack_python_v1 |
comment This is an input class. Do not edit.
class BinaryTree
begin
function __init__ self value left=none right=none
begin
set value = value
set left = left
set right = right
end function
end class
function heightBalancedBinaryTree tree
begin
return call tree_info tree at 1
end function
function tree_info tree
begin
i... | # This is an input class. Do not edit.
class BinaryTree:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def heightBalancedBinaryTree(tree):
return tree_info(tree)[1]
def tree_info(tree):
if tree is not None:
l_h, l_balance=... | Python | zaydzuhri_stack_edu_python |
function imprime_matriz mat
begin
string Função que recebe uma matriz como parâmetro e imprime a matriz, linha por linha.
for i in range length mat
begin
set cont = 0
for j in range length mat at i
begin
if cont < length mat at i - 1
begin
print mat at i at j end=string
end
else
begin
print mat at i at j end=string
end... | def imprime_matriz(mat):
"""
Função que recebe uma matriz como parâmetro e imprime a matriz, linha por linha.
"""
for i in range(len(mat)):
cont = 0
for j in range(len(mat[i])):
if cont < len(mat[i])-1:
print(mat[i][j], end=' ')
else:
... | Python | zaydzuhri_stack_edu_python |
import os
import shutil
set s_path = string C:/Users/tejam/Desktop/one
set d_path = string C:/Users/tejam/Desktop/two
function move_files
begin
for i in range 1 length list directory d_path + 1
begin
if exists path s_path + string /Excel-0 + string i + string .xlsx
begin
comment moves the files from one folder to diffe... | import os
import shutil
s_path = "C:/Users/tejam/Desktop/one"
d_path = "C:/Users/tejam/Desktop/two"
def move_files():
for i in range(1,len(os.listdir(d_path))+1):
if os.path.exists(s_path + '/Excel-0' + str(i) + '.xlsx'):
shutil.move(s_path + '/Excel-0' + str(i) + '.xlsx... | Python | zaydzuhri_stack_edu_python |
function make_directory directory
begin
if exists path directory
begin
return none
end
else
begin
make directory os directory
return none
end
end function | def make_directory(directory):
if os.path.exists(directory):
return None
else:
os.mkdir(directory)
return None | Python | nomic_cornstack_python_v1 |
function import_params self params
begin
for tuple p p_sym in zip params ls_params
begin
call set_value p borrow=true
end
end function | def import_params(self, params):
for p, p_sym in zip(params, self.ls_params):
p_sym.set_value(p, borrow=True) | Python | nomic_cornstack_python_v1 |
import pygame
set WHITE = tuple 255 255 255
class Player extends Sprite
begin
function __init__ self width height speed x
begin
call __init__
set image = call Surface list width height
call fill WHITE
call set_colorkey WHITE
set width = width
set height = height
set speed = speed
call rect image WHITE list 0 0 width he... | import pygame
WHITE = (255,255,255)
class Player(pygame.sprite.Sprite):
def __init__(self,width, height, speed,x):
super().__init__()
self.image = pygame.Surface([width, height])
self.image.fill(WHITE)
self.image.set_colorkey(WHITE)
self.width=width
self.height... | Python | zaydzuhri_stack_edu_python |
string Contains class DoublePendulum for modelling movement of double pendulum.
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate
from math import pi
import matplotlib.animation as animation
import time
class NotSolvedError extends Exception
begin
pass
end class
class NotCreatedError extends Exc... | """
Contains class DoublePendulum for modelling movement of double pendulum.
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.integrate
from math import pi
import matplotlib.animation as animation
import time
class NotSolvedError(Exception):
pass
class NotCreatedError(Exception):
pass
... | Python | zaydzuhri_stack_edu_python |
function test_get self
begin
comment The GET's response should equal the contents of the SavedSearch
comment table's initial data. We verify the result count, the next and
comment previous keys, and each row's keys. We don't verify the contents
comment of each defined search.
set expected_rows = count filter hidden=fal... | def test_get(self):
# The GET's response should equal the contents of the SavedSearch
# table's initial data. We verify the result count, the next and
# previous keys, and each row's keys. We don't verify the contents
# of each defined search.
expected_rows = SavedSearch.object... | Python | nomic_cornstack_python_v1 |
function test_add_customer_pass self
begin
call add_customer customers at 0 at 0 customers at 0 at 1 customers at 0 at 2 customers at 0 at 3 customers at 0 at 4 customers at 0 at 5 customers at 0 at 6 customers at 0 at 7
set cursor = execute conn string SELECT * FROM Customer;
set results = call fetchall
assert equal j... | def test_add_customer_pass(self):
add_customer(customers[0][0], customers[0][1], customers[0][2], customers[0][3],
customers[0][4], customers[0][5], customers[0][6], customers[0][7])
cursor = self.conn.execute('SELECT * FROM Customer;')
results = cursor.fetchall()
se... | Python | nomic_cornstack_python_v1 |
from selenium import webdriver
comment tagname is optional!
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
set driver = call Chrome executable_path=string c:\chromedriver_win32\chromedriver.exe
get driver s... | from selenium import webdriver
# tagname is optional!
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
driver = webdriver.Chrome(executable_path="c:\\chromedriver_win32\chromedriver.exe")
driver.get("https:/... | Python | zaydzuhri_stack_edu_python |
function calculate_duration_minutes start_time end_time
begin
return call total_seconds / 60
end function | def calculate_duration_minutes(start_time, end_time):
return (end_time - start_time).total_seconds() / 60 | Python | nomic_cornstack_python_v1 |
comment noqa
function new ctx name port dist template force celery
begin
set dist = if expression dist is none then get current directory else absolute path path dist
set obj at string FORCE = force
set obj at string CELERY = celery
set obj at string JINJIA_CONTEXT = dict string project_name name ; string port port ; s... | def new(ctx, name, port, dist, template, force, celery): # noqa
dist = os.getcwd() if dist is None else os.path.abspath(dist)
ctx.obj['FORCE'] = force
ctx.obj['CELERY'] = celery
ctx.obj['JINJIA_CONTEXT'] = {
'project_name': name,
'port': port,
'secret_key': ''.join(random.choice... | Python | nomic_cornstack_python_v1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.