code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
import turtle import pandas set screen = call Screen title screen string U.S States Game set image = string blank_states_img.gif call addshape image call shape image set data = read csv string 50_states.csv set all_states = call to_list set guessed_states = list while length guessed_states < 50 begin set answer_state ...
import turtle import pandas screen = turtle.Screen() screen.title("U.S States Game") image = "blank_states_img.gif" screen.addshape(image) turtle.shape(image) data = pandas.read_csv("50_states.csv") all_states = data.state.to_list() guessed_states = [] while len(guessed_states) < 50: answer_state = screen.text...
Python
zaydzuhri_stack_edu_python
function get_pump self pump text=false begin if not call have_pump pump begin return none end if text begin return text_pump at pump_status at pump end return pump_status at pump end function
def get_pump(self, pump, text=False): if not self.have_pump(pump): return None if text: return text_pump[self.pump_status[pump]] return self.pump_status[pump]
Python
nomic_cornstack_python_v1
import argparse import os import random import torch from torch.optim.lr_scheduler import ReduceLROnPlateau import torch.backends.cudnn as cudnn from model import build_model from data import CIFARLoader from utils import save_checkpoint function get_arguments begin set parser = call ArgumentParser description=string A...
import argparse import os import random import torch from torch.optim.lr_scheduler import ReduceLROnPlateau import torch.backends.cudnn as cudnn from model import build_model from data import CIFARLoader from utils import save_checkpoint def get_arguments(): parser = argparse.ArgumentParser(description='Attention i...
Python
zaydzuhri_stack_edu_python
import pandas as pd set data = dict string calories list 420 380 390 ; string duration list 50 40 45 set df = call DataFrame data index=list string Kadiatou string Tima string Formation print loc at list string Kadiatou
import pandas as pd data = { "calories": [420, 380, 390], "duration": [50, 40, 45] } df = pd.DataFrame(data, index = ["Kadiatou", "Tima ", "Formation"]) print(df.loc[["Kadiatou"]])
Python
zaydzuhri_stack_edu_python
function set_activated self value begin set activated = value return self end function
def set_activated(self, value: bool) -> "Logger": self.activated = value return self
Python
nomic_cornstack_python_v1
function _create_user self email password **extra_fields begin if not email begin raise call ValueError string The given email must be set end set email = call normalize_email email set user = model email=email keyword extra_fields call set_password password save using=_db return user end function
def _create_user(self, email, password, **extra_fields): if not email: raise ValueError('The given email must be set') email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save(using=self._db) retu...
Python
nomic_cornstack_python_v1
for line in file begin append astArray list strip line end close file import math comment copied from carlundersman at https://community.esri.com/thread/158038 function calculateDistance x1 y1 x2 y2 begin set dist = square root x2 - x1 ^ 2 + y2 - y1 ^ 2 return dist end function comment copied from Manivannan Murugavel,...
for line in file: astArray.append(list(line.strip())) file.close() import math def calculateDistance(x1,y1,x2,y2): #copied from carlundersman at https://community.esri.com/thread/158038 dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2) return dist def getAngle(a, b, c): #copied from Man...
Python
zaydzuhri_stack_edu_python
function iterencode self o begin if check_circular begin set markers = dict end else begin set markers = none end return call _iterencode o markers end function
def iterencode(self, o): if self.check_circular: markers = {} else: markers = None return self._iterencode(o, markers)
Python
nomic_cornstack_python_v1
function assign_responsible name form begin if not call validate_on_submit begin raise call ValueError call form_error_string errors end set uid = data set send = data set user = call user_by_id uid if string admin in call permissions begin set project = call get_project_by_name name end else begin set project = call c...
def assign_responsible(name, form): if not form.validate_on_submit(): raise ValueError(form_error_string(form.errors)) uid = form.login.data send = form.send.data user = user_by_id(uid) if "admin" in current_user.permissions(): project = get_project_by_name(name) else: pr...
Python
nomic_cornstack_python_v1
function train self input_callbacks=none begin comment Add optional input callbacks to default callbacks set callbacks = list scheduler call DilatedOnTrainingEvaluation model validation_data tolerance=training_parameters at string prediction_window_size probability_threshold=training_parameters at string probability_th...
def train(self, input_callbacks: Optional[list[K_callbacks.Callback]] = None): # Add optional input callbacks to default callbacks callbacks = [self.scheduler, evaluation.DilatedOnTrainingEvaluation (self.built_model.model, self.validation_data, tolerance=self.training_parameters['p...
Python
nomic_cornstack_python_v1
import requests import pandas as pd set offset = 0 with open string keys/data_gov_api_key.txt as f begin set api_key = read f end print string api_key api_key set base_url = string https://api.data.gov.in/resource/3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69 comment api_key = "Your API Key" set data_format = string json set of...
import requests import pandas as pd offset = 0 with open("keys/data_gov_api_key.txt") as f: api_key = f.read() print("api_key",api_key) base_url = "https://api.data.gov.in/resource/3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69" # api_key = "Your API Key" data_format = "json" offset = 0 # url = "{}?api-key={}&format={}&o...
Python
zaydzuhri_stack_edu_python
function parse_import stream begin set module_name = call parse_text stream set as_name = call parse_text stream set descriptor = call parse_import_descriptor stream return call Import module_name as_name descriptor end function
def parse_import(stream: IO[bytes]) -> Import: module_name = parse_text(stream) as_name = parse_text(stream) descriptor = parse_import_descriptor(stream) return Import(module_name, as_name, descriptor)
Python
nomic_cornstack_python_v1
function to_dict self begin set d = copy __dict__ set d at string contestant = if expression contestant then call to_dict else none set d at string decision = if expression decision then id else none return d end function
def to_dict(self): d = self.__dict__.copy() d['contestant'] = self.contestant.to_dict() if self.contestant else None d['decision'] = self.decision.id if self.decision else None return d
Python
nomic_cornstack_python_v1
import random function rock_paper_scissors begin string This function implements the rock paper scissors game. set choices = tuple string rock string paper string scissors print string Hello and welcome to game of rock paper scissors. while true begin set player_input = call raw_input string Please choose rock, paper, ...
import random def rock_paper_scissors(): """ This function implements the rock paper scissors game. """ choices = ("rock", "paper", "scissors") print("Hello and welcome to game of rock paper scissors.") while True: player_input = raw_input("Please choose rock, paper, or scissors. Enter 'r' for rock, 'p' for p...
Python
zaydzuhri_stack_edu_python
function __loadQmi filename **kwargs begin comment open file comment TODO: check for errors set f = open filename string rb comment read / check header set headersize = call calcsize string !4sQ set tuple magic datasize = call unpack string !4sQ read f headersize if magic == string QMI1 begin set version = 1 end else i...
def __loadQmi(filename, **kwargs): # open file # TODO: check for errors f = open(filename, "rb") # read / check header headersize = struct.calcsize("!4sQ") (magic, datasize) = struct.unpack("!4sQ", f.read(headersize)) if magic == "QMI1": version = 1 elif magic == "QMI2": ...
Python
nomic_cornstack_python_v1
function max_even_seq n begin set ans = 0 set counter = 0 set num = string n for a in num begin if integer a % 2 == 0 begin set counter = counter + 1 end else if counter > ans begin set ans = counter set counter = 0 end else begin set counter = 0 end end if counter > ans begin set ans = counter end return ans end funct...
def max_even_seq(n): ans = 0 counter= 0 num = str(n) for a in num: if int(a)%2 == 0: counter = counter+1 else: if counter>ans: ans = counter counter = 0 else: counter = 0 if counter>ans: ans = counter return ans
Python
zaydzuhri_stack_edu_python
import torch import torch.nn as nn import torch.nn.functional as F class LSTMConvs extends Module begin function __init__ self embeddings_dim output_dim lstm_hidden_dim n_layers dropout begin call __init__ set conv1 = conv 1d embeddings_dim embeddings_dim 21 stride=1 padding=21 // 2 set conv2 = conv 1d embeddings_dim e...
import torch import torch.nn as nn import torch.nn.functional as F class LSTMConvs(nn.Module): def __init__(self, embeddings_dim: int, output_dim, lstm_hidden_dim, n_layers, dropout): super(LSTMConvs, self).__init__() self.conv1 = nn.Conv1d(embeddings_dim, embeddings_dim, 21, stride=1, padding=21 ...
Python
zaydzuhri_stack_edu_python
import math import time set T1 = time function collatz n begin if n % 2 == 0 begin return integer n / 2 end else begin return integer 3 * n + 1 end end function for i in range 0 1000001 begin set record = 0 set tel = 0 set t = call collatz i while t > 1 begin set t = call collatz t set tel = tel + 1 end if tel > record...
import math import time T1 = time.time() def collatz(n): if(n % 2 == 0): return int(n/2) else: return int(3*n+1) for i in range(0,1000001): record = 0 tel = 0 t = collatz(i) while(t > 1): t = collatz(t) tel += 1 if(tel > record): record = tel T2 = t...
Python
zaydzuhri_stack_edu_python
string 测试 try...except...finally... for i in range 2 at slice : : - 1 begin try begin print string try... set r = 10 / i set a = string dfg print string result: r end except ZeroDivisionError as e begin print string except: e set a = string fdfdg end finally begin print string finally... end set t = tuple string evd ...
''' 测试 try...except...finally... ''' for i in range(2)[::-1]: try: print('try...') r = 10 / i a = 'dfg' print('result:', r) except ZeroDivisionError as e: print('except:', e) a = 'fdfdg' finally: print('finally...') t = ('evd', a, 'df') print...
Python
zaydzuhri_stack_edu_python
function parse_args begin set parser = call ArgumentParser call add_argument string --start type=str default=string required=false help=string The start square of the agent, in the form row,col. If not specified, this is randomized call add_argument string --actions type=str required=true nargs=string + help=string Th...
def parse_args(): parser = argparse.ArgumentParser() parser.add_argument( "--start", type=str, default="", required=False, help="The start square of the agent, in the form row,col. If not specified, this is randomized" ) parser.add_argument( "--actions...
Python
nomic_cornstack_python_v1
function __len__ self begin return length tc_lst end function
def __len__(self): return len(self._tr.tc_lst)
Python
nomic_cornstack_python_v1
class Case begin function __init__ self x y begin set x = x set y = y end function function adjacentes self jeu begin set cases_adjascentes = list for c in listesDesCase begin if absolute x - x <= 1 and absolute y - y <= 1 begin if x == x and y == y begin continue end append cases_adjascentes c end end return cases_ad...
class Case: def __init__(self, x, y): self.x = x self.y = y def adjacentes(self, jeu): cases_adjascentes = [] for c in jeu.listesDesCase: if (abs(c.x - self.x) <= 1) and (abs(c.y - self.y) <= 1): if (c.x == self.x) and (c.y == self.y): ...
Python
zaydzuhri_stack_edu_python
from settings import * from debugger import debugger class Block begin string The main block class which represents all objects not in user control function __init__ self x y velx vely otp begin set x = x set y = y set velocity = dict string x velx ; string y vely set otp = otp end function function move self begin str...
from .settings import * from .debugger import debugger class Block(): """The main block class which represents all objects not in user control""" def __init__(self, x, y, velx, vely, otp): self.x = x self.y = y self.velocity = { "x": velx, "y": vely } ...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/python comment ------------------------------------------------------------------------------- comment Name: base.py comment Purpose: Music21 base classes and important utilities comment Authors: Michael Scott Cuthbert comment Christopher Ariza comment Copyright: (c) 2009-2010 The music21 Project comm...
#!/usr/bin/python #------------------------------------------------------------------------------- # Name: base.py # Purpose: Music21 base classes and important utilities # # Authors: Michael Scott Cuthbert # Christopher Ariza # # Copyright: (c) 2009-2010 The music21 Project ...
Python
zaydzuhri_stack_edu_python
function request_key_lock_status begin return string STX end function
def request_key_lock_status() -> str: return "STX"
Python
nomic_cornstack_python_v1
function component_type self component_type begin set allowed_values = list string CONNECTION string PROCESSOR string PROCESS_GROUP string REMOTE_PROCESS_GROUP string INPUT_PORT string OUTPUT_PORT string REMOTE_INPUT_PORT string REMOTE_OUTPUT_PORT string FUNNEL string LABEL string CONTROLLER_SERVICE string REPORTING_TA...
def component_type(self, component_type): allowed_values = ["CONNECTION", "PROCESSOR", "PROCESS_GROUP", "REMOTE_PROCESS_GROUP", "INPUT_PORT", "OUTPUT_PORT", "REMOTE_INPUT_PORT", "REMOTE_OUTPUT_PORT", "FUNNEL", "LABEL", "CONTROLLER_SERVICE", "REPORTING_TASK", "PARAMETER_CONTEXT", "PARAMETER_PROVIDER", "TEMPLATE"...
Python
nomic_cornstack_python_v1
import sys import math set tuple width height = list comprehension integer i for i in split input set game_map = list for i in range height begin set line = input append game_map list line end function get_adjacent_count h w begin set count = 0 try begin if w != width and game_map at h at w + 1 != string # begin set c...
import sys import math width, height = [int(i) for i in input().split()] game_map = [] for i in range(height): line = input() game_map.append(list(line)) def get_adjacent_count(h,w): count = 0 try: if w != width and game_map[h][w+1] != '#': count += 1 except: pass ...
Python
zaydzuhri_stack_edu_python
function need_context self begin return true end function
def need_context(self): return True
Python
nomic_cornstack_python_v1
for i in range n begin append lis input end for i in range n begin for j in range i + 1 n begin if lis at i == lis at j begin set temp = temp + 1 end end if temp == 0 begin set count = count + 1 end set temp = 0 end print count
for i in range(n): lis.append(input()) for i in range(n): for j in range(i+1, n): if lis[i] == lis[j]: temp += 1 if temp == 0: count += 1 temp = 0 print(count)
Python
zaydzuhri_stack_edu_python
class Node begin function __init__ self data begin set data = data set next = none end function function get_data self begin return data end function function get_next self begin return next end function function set_next self next begin set next = next end function function set_data self data begin set data = data end...
class Node: def __init__(self, data): self.data = data self.next = None def get_data(self): return self.data def get_next(self): return self.next def set_next(self, next): self.next = next def set_data(self, data): self.data = data class Lin...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python comment -*- coding: utf-8 -*- comment Seeing the world: comment Think of at least five places in the world you'd like to visit: comment Store the locations in a list. Make sure the list is not in comment alphabetical order. comment Print your list in its original order. Dont worry about pri...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Seeing the world: # Think of at least five places in the world you'd like to visit: # Store the locations in a list. Make sure the list is not in # alphabetical order. # Print your list in its original order. Dont worry about printing # the list neatly. Just print it a...
Python
zaydzuhri_stack_edu_python
comment real signature unknown; NOTE: unreliably restored from __doc__ function acceptAllKeys self *args **kwargs begin pass end function
def acceptAllKeys(self, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ pass
Python
nomic_cornstack_python_v1
string numbers[0] = 3 numbers[-1] = 2 numbers[3] = 1 numbers[:-1] = removed last element numbers[3:4] = number after 3 and after 5 5 in numbers = True 7 in numbers = False "3" in numbers = False numbers + [6, 5, 3] = added 6, 5 & 3 to end of list set numbers at 0 = 10 set numbers at - 1 = 1 numbers at slice 2 : length ...
''' numbers[0] = 3 numbers[-1] = 2 numbers[3] = 1 numbers[:-1] = removed last element numbers[3:4] = number after 3 and after 5 5 in numbers = True 7 in numbers = False "3" in numbers = False numbers + [6, 5, 3] = added 6, 5 & 3 to end of list ''' numbers[0] = 10 numbers[-1] = 1 numbers[2:len(numbers)] 9 in numbers
Python
zaydzuhri_stack_edu_python
function _register_converters_xgboost exc=true begin set registered = list try begin from xgboost import XGBClassifier end comment pragma: no cover except ImportError as e begin if exc begin raise e end else begin warn string Cannot register XGBClassifier due to ' { e } '. set XGBClassifier = none end end if XGBClassi...
def _register_converters_xgboost(exc=True): registered = [] try: from xgboost import XGBClassifier except ImportError as e: # pragma: no cover if exc: raise e else: warnings.warn( f"Cannot register XGBClassifier due to '{e}'.") XG...
Python
nomic_cornstack_python_v1
function run_setup_teardown_query **kwargs begin set query_results = list if kwargs at string do_run begin for query in kwargs at string queries begin set result = call run_query query=query iterations=1 trim=kwargs at string trim con=kwargs at string con if not result at string query_succeeded begin warning string Err...
def run_setup_teardown_query(**kwargs): query_results = list() if kwargs['do_run']: for query in kwargs['queries']: result = run_query( query=query, iterations=1, trim=kwargs['trim'], con=kwargs['con'] ) if not result['q...
Python
nomic_cornstack_python_v1
function makeMove self movable_statement begin comment Student code goes here set string_statement = string movable_statement set disk_a = split string_statement at 1 set peg_a = split string_statement at 2 comment drop the ')' set peg_b = split string_statement at 3 at slice : - 1 : comment disk1 is no longer top of...
def makeMove(self, movable_statement): ### Student code goes here string_statement = str(movable_statement) disk_a = string_statement.split()[1] peg_a = string_statement.split()[2] #drop the ')' peg_b = string_statement.split()[3][:-1] #disk1 is no longer top of ...
Python
nomic_cornstack_python_v1
function GetCenterMarkCount2 self Size=defaultNamedNotOptArg begin return call _ApplyTypes_ 249 1 tuple 3 0 tuple tuple 16387 3 string GetCenterMarkCount2 none Size end function
def GetCenterMarkCount2(self, Size=defaultNamedNotOptArg): return self._ApplyTypes_(249, 1, (3, 0), ((16387, 3),), u'GetCenterMarkCount2', None,Size )
Python
nomic_cornstack_python_v1
import pandas as pd import sys import requests from bs4 import BeautifulSoup set funcionarios = read json string funcionarios_id.json set n_funcionarios = shape at 0 function baixa_id id_funcionario begin set url = string https://www.consultaremuneracao.rj.gov.br/ConsultaRemuneracao/vinculos/?id= { id_funcionario } pri...
import pandas as pd import sys import requests from bs4 import BeautifulSoup funcionarios = pd.read_json('funcionarios_id.json') n_funcionarios = funcionarios.shape[0] def baixa_id(id_funcionario): url = f'https://www.consultaremuneracao.rj.gov.br/ConsultaRemuneracao/vinculos/?id={id_funcionario}' print...
Python
zaydzuhri_stack_edu_python
import md5 set door_id = string ffykfhsq set password = string set found_hashes = 0 set counter = 0 while found_hashes < 8 begin set md5sum = md5 door_id + string counter if hex digest md5sum at slice 0 : 5 : == string 0 * 5 begin set password = password + hex digest md5sum at 5 set found_hashes = found_hashes + 1 en...
import md5 door_id = 'ffykfhsq' password = '' found_hashes = 0 counter = 0 while found_hashes < 8: md5sum = md5.md5(door_id + str(counter)) if md5sum.hexdigest()[0:5] == '0' * 5: password += md5sum.hexdigest()[5] found_hashes += 1 counter += 1
Python
zaydzuhri_stack_edu_python
comment ch7_5.py set players = list string curry string jordan string james string durant string obama for player in players begin print string { title player } , it was a great game. print string 我迫不及待想看下一場比賽 { title player } end
# ch7_5.py players = ['curry', 'jordan', 'james', 'durant', 'obama'] for player in players: print(f"{player.title()}, it was a great game.") print(f"我迫不及待想看下一場比賽 {player.title()}")
Python
zaydzuhri_stack_edu_python
string Простые делители числа 13195 - это 5, 7, 13 и 29. Каков самый большой делитель числа 600851475143, являющийся простым числом? set number = 600851475143 set divider = 2 while divider != number begin if number % divider == 0 begin set number = number / divider end else begin set divider = divider + 1 end end print...
"""Простые делители числа 13195 - это 5, 7, 13 и 29. Каков самый большой делитель числа 600851475143, являющийся простым числом?""" number = 600851475143 divider = 2 while divider != number: if number % divider == 0: number = number / divider else: divider = divider + 1 print(int(number))
Python
zaydzuhri_stack_edu_python
function get_creds begin set creds = dict with open string config.txt as file begin for line in file begin set tuple key val = list comprehension strip x for x in split line string = set creds at lower key = val end end return creds end function
def get_creds(): creds = {} with open("config.txt") as file: for line in file: (key, val) = [x.strip() for x in line.split('=')] creds[key.lower()] = val return creds
Python
zaydzuhri_stack_edu_python
function set_policy_weights self network_type network_weights begin if network_type == string actor begin call set_weights network_weights end else begin call set_weights network_weights end end function
def set_policy_weights( self, network_type: str, network_weights: List[np.ndarray]) -> None: if network_type == 'actor': self._neural_net.set_weights(network_weights) else: self._critic_net.set_weights(network_weights)
Python
nomic_cornstack_python_v1
function train param hyp x_train y_train x_test y_test cfg_idx begin set num_epoches = hyp at string num_epoches set batch_size = hyp at string batch_size set learning_rate = hyp at string learning_rate set mu = hyp at string mu set tuple test_loss_list test_accu_list = tuple list list if boolean hyp at string moment...
def train(param, hyp , x_train, y_train, x_test, y_test,cfg_idx): num_epoches = hyp['num_epoches'] batch_size = hyp['batch_size'] learning_rate = hyp['learning_rate'] mu = hyp['mu'] test_loss_list, test_accu_list = [],[] if bool(hyp['momentum']) == True: w_velocity = np.zeros(param['w']....
Python
nomic_cornstack_python_v1
function fill_attributes ml_file other_file begin with call load_dataset other_file as other begin with call open_dataset ml_file as ml begin for variable in variables begin if variable in variables begin set attrs = attrs end end end call to_netcdf other_file end end function
def fill_attributes(ml_file, other_file): with xr.load_dataset(other_file) as other: with xr.open_dataset(ml_file) as ml: for variable in other.variables: if variable in ml.variables: other[variable].attrs = ml[variable].attrs other.to_netcdf(other_fil...
Python
nomic_cornstack_python_v1
function detect_image screengrab imageset searchx searchy threshold=none radius=2 great_threshold=none xradius=none yradius=none algorithm=SEARCH_SPIRAL compare_regions=none begin set tuple image_width image_height = size if threshold is none begin comment Use an automatic threshold. set best_rms = image_width * image_...
def detect_image(screengrab, imageset, searchx, searchy, threshold=None, radius=2, great_threshold=None, xradius=None, yradius=None, algorithm=SEARCH_SPIRAL, compare_regions=None): image_width, image_height = imageset[0][1].size if threshold is None: # Use an automatic threshold. ...
Python
nomic_cornstack_python_v1
function while_U begin set i = 0 while i < 5 begin set j = 0 while j < 4 begin if j == 0 and i != 4 or j == 3 and i != 4 or i == 4 and j not in tuple 0 3 begin print string * end=string end else begin print string end=string end set j = j + 1 end set i = i + 1 print end end function
def while_U(): i=0 while i<5: j=0 while j<4: if j==0and i!=4 or j==3 and i!=4 or i==4 and j not in(0,3) : print("*",end=" ") else: print(" ",end=" ") j+=1 i+=1 p...
Python
nomic_cornstack_python_v1
print string =================================================================== print string | Numberic Data Type | print string | 1.int | print string | 2.float | print string | 3.Octal & Hexadecimal | print string | 4.Arithmetic operator | print string ================================================================...
print('===================================================================') print('| Numberic Data Type |') print('| 1.int |') print('| 2.float |') print('| 3....
Python
zaydzuhri_stack_edu_python
function evaluateTrainTest self xtrain ytrain xtest ytest name rho m_name modelFit i begin comment only minimum information is output if exception is raised in learning or evaluation set out = dict string name name ; string model m_name ; string rho rho ; string i i try begin comment fits the model set tuple ypredtrain...
def evaluateTrainTest(self, xtrain, ytrain, xtest, ytest, name, rho, m_name, modelFit, i): # only minimum information is output if exception is raised in learning or evaluation out = { "name" : name, "model" : m_name, "rho" : rho, "i" : i ...
Python
nomic_cornstack_python_v1
function time self begin string Retrieve the current time from the redis server. :rtype: float :raises: :exc:`~tredis.exceptions.RedisError` function format_response value begin string Format a TIME response into a datetime.datetime :param list value: TIME response is a list of the number of seconds since the epoch and...
def time(self): """Retrieve the current time from the redis server. :rtype: float :raises: :exc:`~tredis.exceptions.RedisError` """ def format_response(value): """Format a TIME response into a datetime.datetime :param list value: TIME response is a lis...
Python
jtatman_500k
from tkinter import * from tkinter import ttk , filedialog , messagebox from OpenKompas import * comment список значений находящихся в listbox set lb = list set dmin_value = none set dmax_value = none comment 21 - размер вала; b9 - класс допуска; 20.84 - Dmax; 20.788 - Dmin set values = dict string 21 dict string b9 t...
from tkinter import * from tkinter import ttk, filedialog, messagebox from OpenKompas import * lb = [] # список значений находящихся в listbox dmin_value = None dmax_value = None # 21 - размер вала; b9 - класс допуска; 20.84 - Dmax; 20.788 - Dmin values = {'21': {'b9': (20.84, 20.788), 'c11': (20.89, 20.7...
Python
zaydzuhri_stack_edu_python
function get_binding_code self thres=0.69 begin comment first, sec, third = self.free_bases comment a, b, c = self.scaf_comp_bases set fbs = free_bases set fb_codes = list string 1 string 2 string 3 set cbs = scaf_comp_bases set cb_codes = list string a string b string c set b_code = string for i_fb in range length fb...
def get_binding_code(self, thres=0.69): # first, sec, third = self.free_bases # a, b, c = self.scaf_comp_bases fbs = self.free_bases fb_codes = ["1", "2", "3"] cbs = self.scaf_comp_bases cb_codes = ["a", "b", "c"] b_code = "" for i_fb in range(len(fbs)): ...
Python
nomic_cornstack_python_v1
function replace_and_update self contact begin set match = call find_match contact if match begin merge contact return match end else begin return contact end end function
def replace_and_update(self, contact): match = self.find_match(contact) if match: match.merge(contact) return match else: return contact
Python
nomic_cornstack_python_v1
function build_show_log ctx args begin for build_id in args begin set data = call get_build_log_by_build_id build_id call echo text end end function
def build_show_log(ctx, args): for build_id in args: data = ctx.obj.get_build_log_by_build_id(build_id) click.echo(data.text)
Python
nomic_cornstack_python_v1
import sys set stdin = open string 4865_input.txt string r set T = integer input for tc in range 1 T + 1 begin set char = set input set target = input set value = set target set comp = dict for elem in value begin if elem in char begin set comp at elem = count target elem end end print format string #{} {} tc max valu...
import sys sys.stdin = open('4865_input.txt', 'r') T = int(input()) for tc in range(1, T + 1): char = set(input()) target = input() value = set(target) comp = {} for elem in value: if elem in char: comp[elem] = target.count(elem) print('#{} {}'. format(tc, max(comp.values(...
Python
zaydzuhri_stack_edu_python
function run_all self delay_seconds=0 begin string Run all jobs regardless if they are scheduled to run or not. A delay of `delay` seconds is added between each job. This helps distribute system load generated by the jobs more evenly over time. :param delay_seconds: A delay added between every executed job info string ...
def run_all(self, delay_seconds=0): """ Run all jobs regardless if they are scheduled to run or not. A delay of `delay` seconds is added between each job. This helps distribute system load generated by the jobs more evenly over time. :param delay_seconds: A delay added ...
Python
jtatman_500k
comment ! /usr/bin/env python comment 05.09.2010 <> 05.09.2010 | cmiN comment IEHistoryView Parser 4 Flubber @ rstcenter.com import urllib function main begin comment settings comment name of the text file to be parsed set fname = string log.txt comment destination file set dname = string links.txt comment starting url...
#! /usr/bin/env python # 05.09.2010 <> 05.09.2010 | cmiN # IEHistoryView Parser 4 Flubber @ rstcenter.com import urllib def main(): # settings fname = "log.txt" # name of the text file to be parsed dname = "links.txt" # destination file ul = 3 # starting url line sv = 10 # step value dl = True...
Python
zaydzuhri_stack_edu_python
class Solution extends object begin function addDigits self num begin string :type num: int :rtype: int set sums = 0 while num > 9 begin set sums = sums + num % 10 set num = num / 10 if num < 10 begin set num = num + sums set sums = 0 end end return num end function end class if __name__ == string __main__ begin call a...
class Solution(object): def addDigits(self, num): """ :type num: int :rtype: int """ sums = 0 while num >9: sums+= num%10 num/=10 if num < 10: num +=sums sums = 0 return num if __name__ == ...
Python
zaydzuhri_stack_edu_python
import smbus import time import math class PWM begin function __init__ self bus_number address frequency begin set bus = call SMBus bus_number set address = address call _setup_chip frequency end function function _setup_chip self frequency begin set _MODE1 = 0 set _MODE2 = 1 set _PRESCALE = 254 set _SLEEP = 16 set _AL...
import smbus import time import math class PWM: def __init__(self, bus_number, address, frequency): self.bus = smbus.SMBus(bus_number) self.address = address self._setup_chip(frequency) def _setup_chip(self, frequency): _MODE1 = 0x00 _MODE2 =...
Python
zaydzuhri_stack_edu_python
function test_variation_non_probabilistic acquisition_function begin set input_ = tensor list list list 0.0 2.0 0.4 list 2.0 0.0 1.6 with raises ValueError begin call acquisition_function input_ end end function
def test_variation_non_probabilistic(acquisition_function): input_ = torch.tensor([[[0.0, 2.0, 0.4], [2.0, 0.0, 1.6]]]) with pytest.raises(ValueError): acquisition_function(input_)
Python
nomic_cornstack_python_v1
import os , sqlite3 , csv , romkan from gtts import gTTS set conn = call connect string master_dict.db set c = call cursor execute c string select distinct kana, id from dictionary; for word in call fetchall begin set my_path = string string ./audio/ja/ + replace call to_roma word at 0 string / string + string .wav if ...
import os, sqlite3, csv, romkan from gtts import gTTS conn = sqlite3.connect('master_dict.db') c = conn.cursor() c.execute("select distinct kana, id from dictionary;") for word in c.fetchall(): my_path = str('./audio/ja/' + romkan.to_roma(word[0]).replace('/', ' ') + '.wav') if (not os.path.exists(my_path)): ...
Python
zaydzuhri_stack_edu_python
function save_images self x output name n=16 begin comment make grids and save to logger set grid_top = call make_grid x at tuple slice : n : slice : : slice : : slice : : nrow=n set grid_bottom = call make_grid output at tuple slice : n : slice : : slice : : slice : : nrow=n set grid = call cat t...
def save_images(self, x, output, name, n=16): # make grids and save to logger grid_top = vutils.make_grid(x[:n,:,:,:], nrow=n) grid_bottom = vutils.make_grid(output[:n,:,:,:], nrow=n) grid = torch.cat((grid_top, grid_bottom), 1) self.logger.experiment.add_image(name, grid, self.c...
Python
nomic_cornstack_python_v1
comment Rock-paper-scissors-lizard-Spock template import random comment The key idea of this program is to equate the strings comment "rock", "paper", "scissors", "lizard", "Spock" to numbers comment as follows: comment 0 - rock comment 1 - Spock comment 2 - paper comment 3 - lizard comment 4 - scissors comment helper ...
# Rock-paper-scissors-lizard-Spock template import random # The key idea of this program is to equate the strings # "rock", "paper", "scissors", "lizard", "Spock" to numbers # as follows: # # 0 - rock # 1 - Spock # 2 - paper # 3 - lizard # 4 - scissors # helper functions def number_to_name(number): if number ==...
Python
zaydzuhri_stack_edu_python
function leave self begin if m_stack is none begin raise error string Encoder not initialized. Call start() first. end if length m_stack == 1 begin raise error string Tag stack is empty. end set value = join b'' m_stack at - 1 del m_stack at - 1 call _emit_length length value call _emit value end function
def leave(self): if self.m_stack is None: raise Error('Encoder not initialized. Call start() first.') if len(self.m_stack) == 1: raise Error('Tag stack is empty.') value = b''.join(self.m_stack[-1]) del self.m_stack[-1] self._emit_length(len(value)) ...
Python
nomic_cornstack_python_v1
comment magic 5gon comment outer ring starts with the smallest value comment so to max we would have 6, 7, 8, 9, 10 in the outer nodes comment starting with 6. comment that leaves 5,4,3,2,1 on the inner nodes. comment 6+7+8+9+10 + 2*(1+2+3+4+5) = 70 / 5 = 14 comment so max case starts with 6,5,3 comment then that force...
# magic 5gon # outer ring starts with the smallest value # so to max we would have 6, 7, 8, 9, 10 in the outer nodes # starting with 6. # that leaves 5,4,3,2,1 on the inner nodes. # 6+7+8+9+10 + 2*(1+2+3+4+5) = 70 / 5 = 14 # so max case starts with 6,5,3 # then that forces 10,3,1 # aiming for max, we would like 9,1,4 t...
Python
zaydzuhri_stack_edu_python
import pygame import core class Bird begin function __init__ self begin set hitbox = none set couleur = string set rayon = none set pos_x = none set pos_y = none end function comment Init après collision function reset self posX posY begin set pos_x = posX set pos_y = posY end function comment Affichage dans la fenêtr...
import pygame import core class Bird: def __init__(self): self.hitbox = None self.couleur = "" self.rayon = None self.pos_x = None self.pos_y = None # Init après collision def reset(self, posX, posY): self.pos_x = posX self.po...
Python
zaydzuhri_stack_edu_python
function GenerateLabels self hash_information begin if hash_information begin return list string nsrl_present end comment TODO: Renable when tagging is removed from the analysis report. comment return [u'nsrl_not_present'] return list end function
def GenerateLabels(self, hash_information): if hash_information: return [u'nsrl_present'] # TODO: Renable when tagging is removed from the analysis report. # return [u'nsrl_not_present'] return []
Python
nomic_cornstack_python_v1
function delta_c self z begin return 1.686 / call growth_factor z end function
def delta_c(self, z): return 1.686 / self.cosmo.growth_factor(z)
Python
nomic_cornstack_python_v1
function process_file self stream begin if cols is none and sep is none begin call process_options end set tuple cols sep = tuple cols sep set seen_header = false if cols is not none begin comment Prepare ncols and headers in advance here set ncols = length cols set headers = list comprehension string Dataset %d % idx ...
def process_file(self, stream): if self.cols is None and self.sep is None: self.process_options() cols, sep = self.cols, self.sep seen_header = False if cols is not None: # Prepare ncols and headers in advance here ncols = len(cols) head...
Python
nomic_cornstack_python_v1
class Animal extends object begin function __init__ self name age begin comment Instance variables set name = name set age = age end function function __str__ self begin return name end function end class comment Uses parent's init method class Cat extends Animal begin comment Class variable shared among all instances ...
class Animal(object): def __init__(self, name, age): # Instance variables self.name = name self.age = age def __str__(self): return self.name # Uses parent's init method class Cat(Animal): # Class variable shared among all instances of a class found_rats = False ...
Python
zaydzuhri_stack_edu_python
import turtle import math function olympic begin comment radius has to be over 50 set radius = integer input string Enter a number: call speed 2 call showturtle call pensize 5 call color string blue call circle radius call color string yellow call penup call goto 50 - 50 call pendown call circle radius call color strin...
import turtle import math def olympic(): radius = int(input("Enter a number: ")) #radius has to be over 50 turtle.speed(2) turtle.showturtle() turtle.pensize(5) turtle.color("blue") turtle.circle(radius) turtle.color("yellow") turtle.penup() turtle.goto(50, -50) turtle.pendown(...
Python
zaydzuhri_stack_edu_python
function to_compare ch1 ch2 begin if ch1 == string rock begin if ch2 == string scissors begin return string Rock win end end else begin return string Paper win end if ch1 == string paper begin if ch2 == string rock begin return string Paper win end else begin return string Rock win end end if ch1 == string scissors beg...
def to_compare(ch1,ch2): if ch1 == "rock": if ch2 == "scissors": return("Rock win") else: return("Paper win") if ch1 == "paper": if ch2 == "rock": return("Paper win") else: return("Rock win") if ch1 == "scissors": if ch2 == "pa...
Python
zaydzuhri_stack_edu_python
function copy_to_ocr doc_dict begin try begin comment check if document directory in OCR input directory exists if not exists path join path TOC_OCR_IN doc_dict at string name begin comment create missing directories make directories join path TOC_OCR_IN doc_dict at string name end end except any begin raise call IOErr...
def copy_to_ocr(doc_dict): try: # check if document directory in OCR input directory exists if not os.path.exists(os.path.join(config.TOC_OCR_IN, doc_dict['name'])): # create missing directories os.makedirs(os.path.join(config.TOC_OCR_IN, doc_dict['name'])) except: ...
Python
nomic_cornstack_python_v1
import os set default environ string DJANGO_SETTINGS_MODULE string bingo_coffquiz_project.settings import django setup django from coffquiz.models import Coffee , Article from django.contrib.auth.models import User comment Coffee product information and reviews come from Amazon website https://www.amazon.com/ function ...
import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bingo_coffquiz_project.settings') import django django.setup() from coffquiz.models import Coffee, Article from django.contrib.auth.models import User # Coffee product information and reviews come from Amazon website https://www.amazon.com/ def populate(): ...
Python
zaydzuhri_stack_edu_python
comment Strings set first_name = string Sherly comment integers set age = 39 comment float set pi = 3.14 comment booleans T/F set can_drive = true comment can_drive="Yes I can" comment arthmetic comment concatination "hi" + "world" set a = 10 set b = 5 comment FOLLOWS PEMDAS/BODMAS print a + b print a - b print a * b p...
#Strings first_name='Sherly' #integers age=39 #float pi=3.14 #booleans T/F can_drive=True #can_drive="Yes I can" #arthmetic #concatination "hi" + "world" a=10 b=5 #FOLLOWS PEMDAS/BODMAS print(a+b) print(a-b) print(a*b) print(a/b) print(a%b) #modulus command, i.e. remainder command print(a%2) #even ...
Python
zaydzuhri_stack_edu_python
comment https://www.codewars.com/kata/56ff6a70e1a63ccdfa0001b1 function array_madness a b begin return sum list comprehension el ^ 2 for el in a > sum list comprehension el ^ 3 for el in b end function
# https://www.codewars.com/kata/56ff6a70e1a63ccdfa0001b1 def array_madness(a,b): return sum([el**2 for el in a]) > sum([el**3 for el in b])
Python
zaydzuhri_stack_edu_python
comment def check_reverse(string): comment your code goes here comment txt = string comment txt2 = string[::-1] comment if txt == txt2: comment print('True') comment else: comment print('False') comment check_reverse('abc') comment def fib(num): comment lst = [0,1] comment for i in range(num): comment fibarr = lst[-2:]...
#def check_reverse(string): # your code goes here # txt = string # txt2 = string[::-1] # # if txt == txt2: # print('True') # else: # print('False') # #check_reverse('abc') #def fib(num): # lst = [0,1] # for i in range(num): # fibarr = lst[-2:] #con...
Python
zaydzuhri_stack_edu_python
function getDistIdForPackage self product version flavor=none begin return string eupspkg:%s-%s.eupspkg % tuple product version end function
def getDistIdForPackage(self, product, version, flavor=None): return "eupspkg:%s-%s.eupspkg" % (product, version)
Python
nomic_cornstack_python_v1
function cluster_shutdown begin map shutdown cluster end function
def cluster_shutdown(): map(shutdown, cluster)
Python
nomic_cornstack_python_v1
if length original > 0 and is alpha original begin print original lower original set palabra = lower original set primera = palabra at 0 if primera == string A or primera == string a or primera == string E or primera == string e or primera == string I or primera == string i or primera == string O or primera == string o...
if len(original) > 0 and original.isalpha(): print (original) original.lower() palabra = original.lower() primera = palabra[0] if primera == "A" or primera == "a" or primera == "E" or primera == "e"\ or primera == "I" or primera == "i" or primera == "O"\ or primera == "o" or primera == "U...
Python
zaydzuhri_stack_edu_python
import os set l = list map int split input sort l set a = l at 2 * 10 + l at 1 + l at 0 print a
import os l = list(map(int,input().split())) l.sort() a =l[2]*10+l[1]+l[0] print(a)
Python
zaydzuhri_stack_edu_python
print string hello set x = 5 set y = 4 set z = y + x print z
print('hello') x = 5 y = 4 z = y+x print(z)
Python
zaydzuhri_stack_edu_python
function fetch_model_versions_table self columns=none begin return call _fetch_entries self child_type=MODEL_VERSION query=call NQLQueryAggregate items=list call NQLQueryAttribute name=string sys/model_id value=_sys_id operator=EQUALS type=STRING call NQLQueryAttribute name=string sys/trashed type=BOOLEAN operator=EQUA...
def fetch_model_versions_table(self, *, columns: Optional[Iterable[str]] = None) -> Table: return MetadataContainer._fetch_entries( self, child_type=ContainerType.MODEL_VERSION, query=NQLQueryAggregate( items=[ NQLQueryAttribute( ...
Python
nomic_cornstack_python_v1
function _get_text cls encoded_text begin set boundary = replace _encoding_boundary string \ string \\ set regex = compile boundary at slice 1 : : + string (.*) + boundary at slice : - 1 : + string (.*) DOTALL try begin return tuple call group 1 call group 2 end except AttributeError begin raise call WeirdTextDecod...
def _get_text(cls, encoded_text: str) -> (str, str): boundary = cls._encoding_boundary.replace('\\', '\\\\') regex = re.compile(boundary[1:] + r'(.*)' + boundary[:-1] + r'(.*)', re.DOTALL) try: return regex.search(encoded_text).group(1), regex.search(encoded_text).group(2) e...
Python
nomic_cornstack_python_v1
function plot_contours fisher pos i j nstd=1.0 ax=none resize=false **kwargs begin import matplotlib.pyplot as plt from matplotlib.patches import Ellipse function eigsorted cov begin set tuple vals vecs = call eigh cov set order = call argsort at slice : : - 1 return tuple vals at order vecs at tuple slice : : ord...
def plot_contours(fisher, pos, i, j, nstd=1., ax=None, resize=False, **kwargs): import matplotlib.pyplot as plt from matplotlib.patches import Ellipse def eigsorted(cov): vals, vecs = onp.linalg.eigh(cov) order = vals.argsort()[::-1] return vals[order], vecs[:, order] cov...
Python
nomic_cornstack_python_v1
function get_weighted_drugbank_graph drugbank_graph potency_filepath begin set potency_mapping = read csv potency_filepath sep=string index_col=false dtype=dict string chemical_pubchem_id str set edge_weights = dictionary comprehension tuple chemical_pubchem target_uniprot : normalized_pchembl for tuple chemical_pubch...
def get_weighted_drugbank_graph( *, drugbank_graph: BELGraph, potency_filepath: str, ): potency_mapping = pd.read_csv( potency_filepath, sep='\t', index_col=False, dtype={'chemical_pubchem_id': str}, ) edge_weights = { (chemical_pubchem, target_uniprot): n...
Python
nomic_cornstack_python_v1
function replace self collection begin set _cards = cards end function
def replace(self, collection): self._cards = collection.cards
Python
nomic_cornstack_python_v1
function init_widget self begin string Initialize the underlying widget. call init_widget set d = declaration set w = widget if not enabled begin call set_enabled enabled end if indicator_background_color begin call set_indicator_background_color indicator_background_color end if indicator_color begin call set_indicato...
def init_widget(self): """ Initialize the underlying widget. """ super(AndroidSwipeRefreshLayout, self).init_widget() d = self.declaration w = self.widget if not d.enabled: self.set_enabled(d.enabled) if d.indicator_background_color: self....
Python
jtatman_500k
function Sa self x_surface geom begin return zeros tuple 0 0 dtype=float end function
def Sa(self, x_surface, geom): return np.zeros((0, 0), dtype=float)
Python
nomic_cornstack_python_v1
function __init__ self iface begin set iface = iface set ch = call getChannelByName string gpio if not ch begin raise exception string No gpio channel found, please create on the sending and receive nodes to use this (secured) service (--ch-add gpio --info then --seturl) end set channelIndex = index call subscribe onGP...
def __init__(self, iface): self.iface = iface ch = iface.localNode.getChannelByName("gpio") if not ch: raise Exception( "No gpio channel found, please create on the sending and receive nodes to use this (secured) service (--ch-add gpio --info then --seturl)") ...
Python
nomic_cornstack_python_v1
comment coding=utf-8 class Facility extends object begin comment 房源id set hid = string comment 电视 set tv = false comment 冰箱 set refri = false comment 空调 set air = false comment 洗衣机 set wash = false comment 热水器 set water_heater = false comment 暖气 set air_heater = false comment 床 set bed = false comment 宽带 set wideband ...
# coding=utf-8 class Facility(object): hid = '' # 房源id tv = False # 电视 refri = False # 冰箱 air = False # 空调 wash = False # 洗衣机 water_heater = False # 热水器 air_heater = False # 暖气 bed = False # 床 wideband ...
Python
zaydzuhri_stack_edu_python
with open string all_output_depressing.txt as f begin set lines = call splitlines end set output_lines = list with open string ids.txt as f begin set ids = call splitlines end for i in call xrange 0 length ids begin append output_lines lines at integer ids at i end with open string all_output_depress_filtered.txt stri...
with open('all_output_depressing.txt') as f: lines = f.read().splitlines() output_lines = [] with open('ids.txt') as f: ids = f.read().splitlines() for i in xrange(0, len(ids)): output_lines.append(lines[int(ids[i])]) with open('all_output_depress_filtered.txt', 'w') as f: for i in xrange(0, len(output_...
Python
zaydzuhri_stack_edu_python
from unittest.mock import patch , MagicMock import unittest from vectorAnalysis.vectorAnalysisModule import Validation from random import random from random import randint from random import randrange from vectorAnalysis import vectorAnalysisModule set Validation = Validation class TestValidaton extends TestCase begin ...
from unittest.mock import patch, MagicMock import unittest from vectorAnalysis.vectorAnalysisModule import Validation from random import random from random import randint from random import randrange from vectorAnalysis import vectorAnalysisModule Validation = vectorAnalysisModule.Validation class TestValidaton(unitte...
Python
zaydzuhri_stack_edu_python
import re import cPickle as pickle set edges = load pickle open string Data/edge.p string rb comment com_follower_num_list = [] set com_follower_num_dist = dict set matrix = list with open string Data/train.txt string r as file begin for line in file begin set row = find all string [\w']+ line append matrix row end e...
import re import cPickle as pickle edges = pickle.load(open("Data/edge.p", "rb")) # com_follower_num_list = [] com_follower_num_dist = {} matrix = [] with open("Data/train.txt", 'r') as file: for line in file: row = re.findall(r"[\w']+", line) matrix.append(row) def check_common_follower(edge): ...
Python
zaydzuhri_stack_edu_python
function cmd_line_mirror argv=none quiet=false begin if argv is none begin set argv = argv end from docopt import docopt import pyNastran set msg = string Usage: bdf mirror IN_BDF_FILENAME [-o OUT_BDF_FILENAME] [--punch] [--plane PLANE] [--tol TOL] bdf mirror IN_BDF_FILENAME [-o OUT_BDF_FILENAME] [--punch] [--plane PLA...
def cmd_line_mirror(argv=None, quiet=False): if argv is None: argv = sys.argv from docopt import docopt import pyNastran msg = ( "Usage:\n" " bdf mirror IN_BDF_FILENAME [-o OUT_BDF_FILENAME] [--punch] [--plane PLANE] [--tol TOL]\n" " bdf mirror IN_BDF_FILENAME [-o OUT_...
Python
nomic_cornstack_python_v1
import sys set m = list with open argv at 1 as file begin for line in file begin append m split strip line string end end
import sys m = [] with open(sys.argv[1]) as file: for line in file: m.append(line.strip().split("\t"))
Python
zaydzuhri_stack_edu_python
function setUp self begin set templates = glob glob TEMPLATES end function
def setUp(self): self.templates = glob.glob(self.TEMPLATES)
Python
nomic_cornstack_python_v1
function make_submission data model path begin set counter = 0 set length = length data set test_predictions = list comment Data has form of [(id,vec),(id,vec)....] for instance in data begin print string Prog: counter / length * 100 set counter = counter + 1 set id = instance at 0 set vec = instance at 1 set res = pr...
def make_submission(data, model, path): counter = 0 length= len(data) test_predictions = [] #Data has form of [(id,vec),(id,vec)....] for instance in data: print("Prog: ",(counter/length*100)) counter+=1 id = instance[0] vec = instance[1] res = model.predict(v...
Python
nomic_cornstack_python_v1
function MakeRequest http http_request retries=7 max_retry_wait=60 redirections=5 retry_func=HandleExceptionsAndRebuildHttpConnections check_response_func=CheckResponse begin set retry = 0 set first_req_time = time while true begin try begin return call _MakeRequestNoRetry http http_request redirections=redirections ch...
def MakeRequest(http, http_request, retries=7, max_retry_wait=60, redirections=5, retry_func=HandleExceptionsAndRebuildHttpConnections, check_response_func=CheckResponse): retry = 0 first_req_time = time.time() while True: try: return _Make...
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python comment -*- coding: utf-8 -*- string コーディング規則 関数を書く上で、単語ごとには必ず大文字にする(前置詞も、冠詞も含む) しかし、変数に関しては、全て小文字にする。 単語ごとにはアンダーバーを入れる (例) URL_Download_To_File Return_Arguments_In_the_Fuction int retrutn_of_arguments = 32; import review_calculator import datetime import google_write if __name__ == string ...
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' コーディング規則 関数を書く上で、単語ごとには必ず大文字にする(前置詞も、冠詞も含む) しかし、変数に関しては、全て小文字にする。 単語ごとにはアンダーバーを入れる (例) URL_Download_To_File Return_Arguments_In_the_Fuction int retrutn_of_arguments = 32; ''' import review_calculator import datetime import google_write if __name__ == "__main__": ...
Python
zaydzuhri_stack_edu_python