code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
import socket class IRCClient begin set socket = none set connected = false set nickname = string RowBot set channels = list string #foobar string #barefoot function __init__ self begin set socket = call socket call connect tuple string irc.rigsofrods.org 6667 call send string NICK %s % nickname call send string USER %...
import socket class IRCClient: socket = None connected = False nickname = 'RowBot' channels = ['#foobar', '#barefoot'] def __init__(self): self.socket = socket.socket() self.socket.connect(('irc.rigsofrods.org', 6667)) self.send("NICK %s" % self.nickname) self.send(...
Python
zaydzuhri_stack_edu_python
import lxml.html as html import cssselect import requests import string import pylev3 set ASCII_SET = set ascii_letters function is_char_ascii char begin if char == string - begin return true end else begin return char in ASCII_SET end end function function is_word_ascii word begin return all list comprehension call is...
import lxml.html as html import cssselect import requests import string import pylev3 ASCII_SET = set(string.ascii_letters) def is_char_ascii(char): if char == "-": return True else: return char in ASCII_SET def is_word_ascii(word): return all([is_char_ascii(c) for c in word]) def lev...
Python
zaydzuhri_stack_edu_python
function to_dict self begin set _dict = dict if has attribute self string output and output is not none begin if is instance output dict begin set _dict at string output = output end else begin set _dict at string output = call to_dict end end if has attribute self string context and context is not none begin if is in...
def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'output') and self.output is not None: if isinstance(self.output, dict): _dict['output'] = self.output else: _dict['output'] = self.output.to_dict() if hasattr(self, 'context') and self...
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python comment -*- coding:utf-8 -*- comment File : export_uixls_to_txt.py comment Author : bssthu comment Project : eso_zh_ui comment Description : 从 lua 提取原文,从 xls 提取汉化,写入 txt 中 import os import sys from xlsutils import load_xls from utils import read_lua function usage begin print string usage: ...
#!/usr/bin/env python # -*- coding:utf-8 -*- # File : export_uixls_to_txt.py # Author : bssthu # Project : eso_zh_ui # Description : 从 lua 提取原文,从 xls 提取汉化,写入 txt 中 # import os import sys from xlsutils import load_xls from utils import read_lua def usage(): print('usage:') print('pyt...
Python
zaydzuhri_stack_edu_python
function filter_list input fltr begin if length fltr == 0 begin return tuple dict none end function _subset lst val_filter begin string Index from list by the filter value for tuple i v in enumerate lst begin if v == val_filter begin return i end end end function try begin for element in input begin for tuple k v in i...
def filter_list(input: dict, fltr: dict) -> Tuple[dict, str]: if len(fltr) == 0: return {}, None def _subset(lst: list, val_filter: str) -> int: """ Index from list by the filter value """ for i, v in enumerate(lst): if v == val_filter: return i...
Python
nomic_cornstack_python_v1
function _init_models self begin comment intialise analysis tools set model_freqtime = call load_model join path model_dir model_freqtime set model_dmtime = call load_model join path model_dir model_dmtime comment The model's first prediction takes longer comment pre-empt this by classifying an array of zeros before lo...
def _init_models(self): # intialise analysis tools self.model_freqtime = self.tf.keras.models.load_model(os.path.join(self.config.model_dir, self.config.model_freqtime)) self.model_dmtime = self.tf.keras.models.load_model...
Python
nomic_cornstack_python_v1
function test_list_g_year_enumeration_nistxml_sv_iv_list_g_year_enumeration_1_3 mode save_output output_format begin call assert_bindings schema=string nistData/list/gYear/Schema+Instance/NISTSchema-SV-IV-list-gYear-enumeration-1.xsd instance=string nistData/list/gYear/Schema+Instance/NISTXML-SV-IV-list-gYear-enumerati...
def test_list_g_year_enumeration_nistxml_sv_iv_list_g_year_enumeration_1_3(mode, save_output, output_format): assert_bindings( schema="nistData/list/gYear/Schema+Instance/NISTSchema-SV-IV-list-gYear-enumeration-1.xsd", instance="nistData/list/gYear/Schema+Instance/NISTXML-SV-IV-list-gYear-enumeratio...
Python
nomic_cornstack_python_v1
class VideoGame begin function __init__ self name developers main_character begin set name = name set developers = developers set main_character = main_character end function function info self begin print string Name: { name } Developers: { developers } Main character: { main_character } end function end class set the...
class VideoGame: def __init__(self, name, developers, main_character): self.name = name self.developers = developers self.main_character = main_character def info(self): print(f'Name: {self.name}\n' f'Developers: {self.developers}\n' f'Main character:...
Python
zaydzuhri_stack_edu_python
comment this checks HTML document for properly nested comment open and closing tags: <html>xxxxx</html> from pythonds.basic.stack import Stack import os function htmlCheck htmlFileDirStr begin set fileObj = open htmlFileDirStr set content = read fileObj close fileObj set tagStack = stack set tagList = list for charIdx...
#this checks HTML document for properly nested #open and closing tags: <html>xxxxx</html> from pythonds.basic.stack import Stack import os def htmlCheck(htmlFileDirStr): fileObj = open(htmlFileDirStr) content = fileObj.read() fileObj.close() tagStack = Stack() tagList = [] ...
Python
zaydzuhri_stack_edu_python
string Программа принимает действительное положительное число x и целое отрицательное число y. Необходимо выполнить возведение числа x в степень y. Задание необходимо реализовать в виде функции my_func(x, y). При решении задания необходимо обойтись без встроенной функции возведения числа в степень. Подсказка: попробуйт...
""" Программа принимает действительное положительное число x и целое отрицательное число y. Необходимо выполнить возведение числа x в степень y. Задание необходимо реализовать в виде функции my_func(x, y). При решении задания необходимо обойтись без встроенной функции возведения числа в степень. Подсказка: попробуйте р...
Python
zaydzuhri_stack_edu_python
function kill self begin set is_killed = true call kill end function
def kill(self): self.is_killed = True super(AssociationAcceptor, self).kill()
Python
nomic_cornstack_python_v1
function enter_parameters begin set params = data at string params set pforms = dict for context in keys params begin set pform = call call build_param_form params at context data at string eval_strategy at context form set pforms at context = pform end if method == string POST begin for context in keys pforms begin i...
def enter_parameters(): params = app.data["params"] pforms = {} for context in params.keys(): pform = build_param_form(params[context],app.data["eval_strategy"][context])(request.form) pforms[context] = pform if request.method == "POST": for context in pforms.keys(): ...
Python
nomic_cornstack_python_v1
from timeit import Timer function sum_one n begin set sum = 0 for i in range 1 n + 1 begin set sum = sum + i end return sum end function function sum_two n begin set sum = n * n + 1 / 2 return sum end function set t = call Timer string sum_two(100000) string from __main__ import sum_two set r = call Timer string sum_on...
from timeit import Timer def sum_one(n): sum = 0 for i in range(1, n + 1): sum += i return sum def sum_two(n): sum = (n * (n + 1) / 2) return sum t = Timer("sum_two(100000)", "from __main__ import sum_two") r = Timer("sum_one(100000)", "from __main__ import sum_one") ...
Python
zaydzuhri_stack_edu_python
function minmax colors eles begin comment Max set max_value = max colors set max_string = string %.3e % max_value set max_index = index colors max_value + 1 set xlist_max = list comprehension eles at max_index at i at 0 for i in range 0 4 set ylist_max = list comprehension eles at max_index at i at 1 for i in range 0 4...
def minmax(colors, eles): #Max max_value = max(colors) max_string = "%.3e" % max_value max_index = colors.index(max_value) + 1 xlist_max = [eles[max_index][i][0] for i in range(0, 4)] ylist_max = [eles[max_index][i][1] for i in range(0, 4)] x_pos_max = sum(xl...
Python
nomic_cornstack_python_v1
function contains_nonascii_characters string begin for c in string begin if not ordinal c < 128 begin return true end end return false end function
def contains_nonascii_characters(string): for c in string: if not ord(c) < 128: return True return False
Python
nomic_cornstack_python_v1
string Finds the difference in the sum of the squares of the first 100 natural numbers and the square of the sum of the first 100 natural numbers. Problem set from Project Euler http://projecteuler.net Problem 6 @author Russ Taylor <russ@russt.me> @version 2013-04-29 set sumSquares = 0 set squareSums = 0 for i in range...
""" Finds the difference in the sum of the squares of the first 100 natural numbers and the square of the sum of the first 100 natural numbers. Problem set from Project Euler http://projecteuler.net Problem 6 @author Russ Taylor <russ@russt.me> @version 2013-04-29 """ sumSquares = 0 squareSums = 0 for i in range(1,...
Python
zaydzuhri_stack_edu_python
string Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. class Solution extends object begin function twoSum self nums target begin string :type nums: List[int] :type target: int :rtype: List[int] set req = dict for i in range length nums begin if...
""" Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. """ class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ req = {} ...
Python
zaydzuhri_stack_edu_python
function modified_time self name begin return call modified_time name end function
def modified_time(self, name): return self.get_storage(name).modified_time(name)
Python
nomic_cornstack_python_v1
import codecs import pickle import numpy as np import keras from keras.preprocessing.sequence import pad_sequences from keras.utils.np_utils import to_categorical from keras.preprocessing.text import Tokenizer from keras.models import Sequential , Model from keras.layers import Dense , Dropout , Activation , Conv1D , G...
import codecs import pickle import numpy as np import keras from keras.preprocessing.sequence import pad_sequences from keras.utils.np_utils import to_categorical from keras.preprocessing.text import Tokenizer from keras.models import Sequential,Model from keras.layers import Dense, Dropout, Activation, Conv1D, GlobalM...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/python3 comment coding: utf-8 comment 我们见到的大多数机器学习示例都将使用 MNIST 手写体数字数据集, 手写体数字识别已经在诸如邮局邮政编码识别等方面得到了广泛的运用 comment MNIST 包含 60000 张训练图片(包括 5000 张验证图片), 10000 张测试图片(黑盒), comment 这些图片已经进行了归一化, 并且大小固定, 每张手写数字图片其实是一张可以被转化成矩阵的 28 x 28 的灰度图片 comment 在 TensorFlow 中, 使用 MNIST 非常简单, 它将帮助我们去下载数据并将自动地载入 numpy 中的 a...
#!/usr/bin/python3 # coding: utf-8 # 我们见到的大多数机器学习示例都将使用 MNIST 手写体数字数据集, 手写体数字识别已经在诸如邮局邮政编码识别等方面得到了广泛的运用 # MNIST 包含 60000 张训练图片(包括 5000 张验证图片), 10000 张测试图片(黑盒), # 这些图片已经进行了归一化, 并且大小固定, 每张手写数字图片其实是一张可以被转化成矩阵的 28 x 28 的灰度图片 # 在 TensorFlow 中, 使用 MNIST 非常简单, 它将帮助我们去下载数据并将自动地载入 numpy 中的 array 对象, 同时还可以进行独热编码等数据预处理 from tenso...
Python
zaydzuhri_stack_edu_python
function last_videos_recorded self begin return sorted glob glob VIDEOS_DIR key=getmtime at slice - 20 : : end function
def last_videos_recorded(self) -> list: return sorted(glob.glob(VIDEOS_DIR), key=os.path.getmtime)[-20:]
Python
nomic_cornstack_python_v1
function form self begin from moztrap.view.manage.environments.forms import AddProfileForm return AddProfileForm end function
def form(self): from moztrap.view.manage.environments.forms import AddProfileForm return AddProfileForm
Python
nomic_cornstack_python_v1
function type_of self var_name begin return get subroutineST var_name get classST var_name tuple none none none at 0 end function
def type_of(self, var_name): return self.subroutineST.get(var_name, self.classST.get(var_name, (None, None, None)))[0]
Python
nomic_cornstack_python_v1
function sequence_count self begin return length _data end function
def sequence_count(self): return len(self._data)
Python
nomic_cornstack_python_v1
string Sharad: Count characters in a string, ASSUMPTION: count characters only between a-z, A-Z, rest will be ignored. function countLetter str begin set cnt = 0 for j in str begin if ordinal string A <= ordinal j <= ordinal string Z or ordinal string a <= ordinal j <= ordinal string z begin set cnt = cnt + 1 end end r...
''' Sharad: Count characters in a string, ASSUMPTION: count characters only between a-z, A-Z, rest will be ignored. ''' def countLetter(str): cnt=0 for j in str: if ( (ord('A')<= ord(j) <= ord('Z')) or ((ord('a')<= ord(j) <= ord('z') )) ): cnt +=1 return cnt def main(): str =...
Python
zaydzuhri_stack_edu_python
function handle_config_change self msg begin event string groupchat_config_status msg event string muc::%s::config_status % bare msg end function
def handle_config_change(self, msg): self.xmpp.event('groupchat_config_status', msg) self.xmpp.event('muc::%s::config_status' % msg['from'].bare , msg)
Python
nomic_cornstack_python_v1
if length username >= 6 begin print string username is fine end else begin print string username must be 6 characters end print string Your name is %s % username set age = input string what is your age: print string Your age is age set month = input string what month were you born: print string You were born in %s % mo...
if len(username) >= 6: print("username is fine") else: print("username must be 6 characters") print("Your name is %s" % username) age = input("what is your age: ") print("Your age is", age) month = input("what month were you born: ") print("You were born in %s" % month) mylist = ["Tom", "Susan", "Sandra", "B...
Python
zaydzuhri_stack_edu_python
function gaussian_kernel l=5 sig=1.0 begin set ax = linear space - l - 1 / 2.0 l - 1 / 2.0 l set kernel = exp - 0.5 * call square ax / call square sig return kernel / sum kernel end function
def gaussian_kernel(l=5, sig=1.): ax = np.linspace(-(l - 1) / 2., (l - 1) / 2., l) kernel = np.exp(-0.5 * np.square(ax) / np.square(sig)) return kernel / np.sum(kernel)
Python
nomic_cornstack_python_v1
function getDistances begin comment If there's a wall in the way then there's no edge that way (probably) comment Left set tuple wallL edgeL = call getDistance - 45 comment Forward set tuple wallF edgeF = call getDistance 0 comment Right set tuple wallR edgeR = call getDistance 45 comment Recenter call pan return tuple...
def getDistances(): # If there's a wall in the way then there's no edge that way (probably) wallL, edgeL = getDistance(-45) # Left wallF, edgeF = getDistance( 0) # Forward wallR, edgeR = getDistance( 45) # Right panTilt.pan() # Recenter return wallL, edgeL, wallF, edgeF, wallR, edgeR
Python
nomic_cornstack_python_v1
function space_view_id self space_view_id begin set _space_view_id = space_view_id end function
def space_view_id(self, space_view_id): self._space_view_id = space_view_id
Python
nomic_cornstack_python_v1
import pygame import math from collections import namedtuple call init set tuple WINDOW_WIDTH WINDOW_HEIGHT = tuple 500 500 set ZOOM_FACTOR = 2 set screen = call set_mode tuple WINDOW_WIDTH WINDOW_HEIGHT set clock = call Clock set FractalView = named tuple string FractalView string complex_extent_x complex_extent_y com...
import pygame import math from collections import namedtuple pygame.init() (WINDOW_WIDTH, WINDOW_HEIGHT) = (500, 500) ZOOM_FACTOR = 2 screen = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT)) clock = pygame.time.Clock() FractalView = namedtuple('FractalView', 'complex...
Python
zaydzuhri_stack_edu_python
function convert_bbox bbox width height begin set tuple min_x min_y max_x max_y = bbox comment scale X axis set min_x = min_x * width set max_x = max_x * width comment invert Y axis and scale set min_y = 1 - min_y * height set max_y = 1 - max_y * height return tuple min_x min_y max_x max_y end function
def convert_bbox(bbox, width, height): min_x, min_y, max_x, max_y = bbox # scale X axis min_x *= width max_x *= width # invert Y axis and scale min_y = (1 - min_y) * height max_y = (1 - max_y) * height return min_x, min_y, max_x, max_y
Python
nomic_cornstack_python_v1
function search_nested_list nested_list begin set stack = list nested_list while stack begin set element = pop stack if is instance element list begin for sub_element in element begin append stack sub_element end end else if element == 3 begin print element end end end function
def search_nested_list(nested_list): stack = [nested_list] while stack: element = stack.pop() if isinstance(element, list): for sub_element in element: stack.append(sub_element) elif element == 3: print(element)
Python
greatdarklord_python_dataset
function is_http_retryable self response begin return status in retry_http_codes end function
def is_http_retryable(self, response): return response.status in self.retry_http_codes
Python
nomic_cornstack_python_v1
function reset self begin call initialize end function
def reset(self): self.initialize()
Python
nomic_cornstack_python_v1
function calculate_shares self accelerate begin if accelerate begin set choices = ceil num_options / 10 set repetitions = 10 end else begin comment choices = int(np.sqrt(self.num_options)) comment repetitions = math.ceil(self.num_options / choices) set choices = 1 set repetitions = 100 end set shares = call repeat_choi...
def calculate_shares(self, accelerate): if accelerate: choices = math.ceil(self.num_options / 10) repetitions = 10 # choices = int(np.sqrt(self.num_options)) # repetitions = math.ceil(self.num_options / choices) else: choices = 1 re...
Python
nomic_cornstack_python_v1
class Solution extends object begin function nextGreatestLetter self letters target begin string :type letters: List[str] :type target: str :rtype: str set index = 0 while index < length letters begin if letters at index > target begin break end else begin set index = index + 1 end end if index == length letters begin ...
class Solution(object): def nextGreatestLetter(self, letters, target): """ :type letters: List[str] :type target: str :rtype: str """ index = 0 while index < len(letters): if letters[index] > target: break else:...
Python
zaydzuhri_stack_edu_python
comment Shapes and Texts import cv2 import numpy as np print string Package Imported comment matrix of 0 (black) set img = zeros tuple 512 512 3 uint8 comment img[:] = 255, 0, 0 # change all the pixels in the matrix to blue comment draw a line (image, starting point, ending point(user defined), colour, thickness) call ...
# Shapes and Texts import cv2 import numpy as np print("Package Imported") img = np.zeros((512, 512, 3), np.uint8) # matrix of 0 (black) # img[:] = 255, 0, 0 # change all the pixels in the matrix to blue cv2.line(img, (0,0), (300,300), (0,255,0), 3) ...
Python
zaydzuhri_stack_edu_python
import time import DLP_Algorithm as DLP function main begin comment variable define: set p = 5682549022748424631339131913370125786212509227588493537874673173634936008725904358935442101466555561124455782847468955028529037660533553941399408331331403379 set g = 2410497055970432881345493397846112198995088771364307195189734...
import time import DLP_Algorithm as DLP def main(): # variable define: p = 5682549022748424631339131913370125786212509227588493537874673173634936008725904358935442101466555561124455782847468955028529037660533553941399408331331403379 g = 2410497055970432881345493397846112198995088771364307195189734031205605...
Python
zaydzuhri_stack_edu_python
function readcumulativeTable cumfile begin set colnames = tuple string kepid string kicCum string pn string date string auth string fitFile string centroidFile string dr24disp string dr24flag string dr24comment set data = read csv cumfile names=colnames sep=string | index_col=string kepid comment=string # set newdata =...
def readcumulativeTable(cumfile): colnames=('kepid','kicCum','pn','date','auth','fitFile','centroidFile','dr24disp','dr24flag','dr24comment') data=p.read_csv(cumfile,names=colnames,sep='|',index_col='kepid',comment='#') newdata=data.drop(['date','auth','fitFile','centroidFile'],axis=1) a=p...
Python
nomic_cornstack_python_v1
comment pylint: disable=arguments-differ function get_object self request username begin return call get_user_from_username user username end function
def get_object(self, request, username): # pylint: disable=arguments-differ return get_user_from_username(request.user, username)
Python
nomic_cornstack_python_v1
function print_disk self session hostname begin try begin set rsp = get session string .1.3.6.1.4.1.2021.9.1.9.1 update rrdtool string ./RRDlog/ + hostname + string /disk.rrd string N: + value end except Exception begin return false end return true end function
def print_disk( self, session, hostname): try: rsp = session.get(".1.3.6.1.4.1.2021.9.1.9.1") rrdtool.update( "./RRDlog/" + hostname + "/disk.rrd", "N:" + rsp.value) except Exception: return False return True
Python
nomic_cornstack_python_v1
import pandas as pd import matplotlib import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator , FormatStrFormatter from matplotlib import cm import numpy as np from scipy.optimize import minimize import scipy from mpl_toolkits.mplot3d import Axes3D close pyplot string all set entryoffsets = read csv...
import pandas as pd import matplotlib import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator, FormatStrFormatter from matplotlib import cm import numpy as np from scipy.optimize import minimize import scipy from mpl_toolkits.mplot3d import Axes3D matplotlib.pyplot.close('all') entryoffsets = pd....
Python
zaydzuhri_stack_edu_python
string @file : BiDAF.py @author : xiaolu @time : 2020-02-16 import torch import torch.nn as nn import torch.nn.functional as F from config import Config set d_model = d_model set n_head = num_heads set d_word = glove_dim set d_char = char_dim set batch_size = batch_size set dropout = dropout set dropout_char = dropout_...
""" @file : BiDAF.py @author : xiaolu @time : 2020-02-16 """ import torch import torch.nn as nn import torch.nn.functional as F from config import Config d_model = Config.d_model n_head = Config.num_heads d_word = Config.glove_dim d_char = Config.char_dim batch_size = Config.batch_size dro...
Python
zaydzuhri_stack_edu_python
function write_code_node_to_file code_node filepath begin assert is instance code_node CodeNode assert is instance filepath str set rendered_text = call render_code_node code_node set format_result = call auto_format rendered_text filename=filepath if not did_succeed begin raise call RuntimeError format string Style-fo...
def write_code_node_to_file(code_node, filepath): assert isinstance(code_node, CodeNode) assert isinstance(filepath, str) rendered_text = render_code_node(code_node) format_result = style_format.auto_format(rendered_text, filename=filepath) if not format_result.did_succeed: raise RuntimeEr...
Python
nomic_cornstack_python_v1
function testLocationRegistry self begin call ScratchFile string MODULE.bazel list string bazel_dep(name="hello",version="1.0") call createCcModule string hello string 1.0 extra_module_file_contents=list string wat set tuple _ _ stderr = call RunBazel list string build string @what allow_failure=true assert in string E...
def testLocationRegistry(self): self.ScratchFile('MODULE.bazel', ['bazel_dep(name="hello",version="1.0")']) self.main_registry.createCcModule( 'hello', '1.0', extra_module_file_contents=['wat'] ) _, _, stderr = self.RunBazel(['build', '@what'], allow_failure=True) self.assertIn( 'ERR...
Python
nomic_cornstack_python_v1
function test_param_unit_conversion self begin set template = call create name=string My Template units=string m set tests = dict string 1 1.0 ; string -1 - 1.0 ; string 23m 23.0 ; string -89mm - 0.089 ; string 100 foot 30.48 ; string -17 yards - 15.54 set prt = get objects pk=1 set param = call PartParameter part=prt ...
def test_param_unit_conversion(self): template = PartParameterTemplate.objects.create( name='My Template', units='m', ) tests = { '1': 1.0, '-1': -1.0, '23m': 23.0, '-89mm': -0.089, '100 foot': 30.48, ...
Python
nomic_cornstack_python_v1
comment análise de lista de compras set totCompra = 0 set prodMil = 0 set menor = 0 set contador = 0 set barato = string while true begin print format string {:-^100} string LISTA DE COMPRAS set produto = input string Nome do produto: set preco = decimal input string Preço do produto: set contador = contador + 1 set t...
#análise de lista de compras totCompra = prodMil = menor = contador = 0 barato = ' ' while True: print('{:-^100}'.format(' LISTA DE COMPRAS ')) produto = input('Nome do produto: ') preco = float(input('Preço do produto: ')) contador += 1 totCompra += preco if preco > 1000: prodMil += 1 ...
Python
zaydzuhri_stack_edu_python
function test_eth_nonce test_app begin assert call string eth_getTransactionCount call address_encoder accounts at 0 == string 0x0 assert integer call string eth_nonce call address_encoder accounts at 0 16 == config at string eth at string block at string ACCOUNT_INITIAL_NONCE assert call string eth_sendTransaction dic...
def test_eth_nonce(test_app): assert test_app.client.call( 'eth_getTransactionCount', address_encoder(tester.accounts[0])) == '0x0' assert ( int(test_app.client.call('eth_nonce', address_encoder(tester.accounts[0])), 16) == test_app.config['eth']['block']['ACCOUNT_INITIAL_NONCE']) a...
Python
nomic_cornstack_python_v1
import enum import os import typing import urllib.request import requests class GeocodeMiss extends Enum begin set RateLimitExceeded = string RATE_LIMIT_EXCEEDED set ImpreciseAddress = string IMPRECISE_ADDRESS set UnparseableAddress = string UNPARSEABLE_ADDRESS set UnknownError = string UNKNOWN_ERROR function is_miss s...
import enum import os import typing import urllib.request import requests class GeocodeMiss(enum.Enum): RateLimitExceeded = "RATE_LIMIT_EXCEEDED" ImpreciseAddress = "IMPRECISE_ADDRESS" UnparseableAddress = "UNPARSEABLE_ADDRESS" UnknownError = "UNKNOWN_ERROR" def is_miss(self) -> bool: re...
Python
zaydzuhri_stack_edu_python
function pc_throughput_avg self begin return call Bit_deinterleaver_ATSC_sptr_pc_throughput_avg self end function
def pc_throughput_avg(self): return _mack_sdr_rossi_swig.Bit_deinterleaver_ATSC_sptr_pc_throughput_avg(self)
Python
nomic_cornstack_python_v1
function get_subjects self **kwargs begin return query self string /subjects.json params=kwargs end function
def get_subjects(self, **kwargs): return self.query('/subjects.json', params=kwargs)
Python
nomic_cornstack_python_v1
function sortCompare self other begin if not is instance other __class__ begin raise call TypeError string Invalid other. end if id > id begin return 1 end if id == id begin return 0 end return - 1 end function
def sortCompare( self, other ) : if( not( isinstance( other, self.__class__ ) ) ) : raise TypeError( 'Invalid other.' ) if( self.id > other.id ) : return( 1 ) if( self.id == other.id ) : return( 0 ) return( -1 )
Python
nomic_cornstack_python_v1
import os , django , ast from django.db import transaction from django.db.models.query_utils import Q from django.contrib.gis.geos import Point from django.contrib.gis.gdal import SpatialReference , CoordTransform decorator atomic function update_fines raw_tickets geocoder_info=false begin set ticket_batch = list comm...
import os, django, ast from django.db import transaction from django.db.models.query_utils import Q from django.contrib.gis.geos import Point from django.contrib.gis.gdal import SpatialReference, CoordTransform @transaction.atomic def update_fines(raw_tickets, geocoder_info=False): ticket_batch = [] # prepa...
Python
zaydzuhri_stack_edu_python
function AddAllowMissingCluster parser begin call add_argument string --allow-missing action=string store_true help=string If set, and the Bare Metal cluster is not found, the request will succeed but no action will be taken. end function
def AddAllowMissingCluster(parser: parser_arguments.ArgumentInterceptor): parser.add_argument( '--allow-missing', action='store_true', help=( 'If set, and the Bare Metal cluster is not found, the request will' ' succeed but no action will be taken.' ), )
Python
nomic_cornstack_python_v1
function db_for_write self model **hints begin if app_label == name begin return EJUDGE_PLUG_DB end return none end function
def db_for_write(self, model, **hints): if model._meta.app_label == EjudgePlugConfig.name: return settings.EJUDGE_PLUG_DB return None
Python
nomic_cornstack_python_v1
string Scripted by Charles Edwards comment Node Class class Node begin comment Constructor function __init__ self turple begin comment left node set left = none comment right node set right = none comment turple data assigned to current node set data = turple end function comment recursive auto branch creator function ...
""" Scripted by Charles Edwards """ class Node: ## Node Class def __init__(self, turple): ## Constructor self.left = None # left node self.right = None # right node self.data = turple # turple data assigned to current node def recursivelyConstructBranch( tree, tur...
Python
zaydzuhri_stack_edu_python
function is_valid begin return boolean call _get_config end function
def is_valid(): return bool(_get_config())
Python
nomic_cornstack_python_v1
function unplug_vifs self instance network_info begin raise call NotImplementedError end function
def unplug_vifs(self, instance, network_info): raise NotImplementedError()
Python
nomic_cornstack_python_v1
function count_letters msg begin set list_of_chars = list set msg sort list_of_chars set list_of_counts = list for i in list_of_chars begin append list_of_counts count msg i end set maximum = max list_of_counts set index_max = index list_of_counts maximum set krotka = tuple list_of_chars at index_max list_of_counts at...
def count_letters(msg): list_of_chars=list(set(msg)) list_of_chars.sort() list_of_counts = [] for i in list_of_chars: list_of_counts.append(msg.count(i)) maximum = max(list_of_counts) index_max = list_of_counts.index(maximum) krotka = (list_of_chars[index_max],list_of_counts[index_...
Python
zaydzuhri_stack_edu_python
function resource_type self begin return get pulumi self string resource_type end function
def resource_type(self) -> str: return pulumi.get(self, "resource_type")
Python
nomic_cornstack_python_v1
function printmtrx campus begin set ts = string for tuple idx i in enumerate campus begin if idx + 1 % w == 1 begin if idx == 0 begin set ts = ts + string i + string end else begin set ts = ts + string + string i + string end end else if idx + 1 % w == 0 begin set ts = ts + string i end else begin set ts = ts + str...
def printmtrx(campus): ts="" for idx,i in enumerate(campus): if((idx+1)%w==1): if idx==0: ts += str(i) + " " else: ts+="\n"+str(i)+" " else: if (idx+1)%w==0: ts += str(i) else: ts+=str...
Python
zaydzuhri_stack_edu_python
import numpy as np import cv2 import matplotlib.pyplot as plt from scipy import signal import os function convolution2d image kernel begin return call convolve2d image kernel boundary=string symm mode=string same end function comment m, n = kernel.shape comment if (m == n): comment y, x = image.shape comment y = y - m ...
import numpy as np import cv2 import matplotlib.pyplot as plt from scipy import signal import os def convolution2d(image, kernel): return signal.convolve2d(image, kernel, boundary='symm', mode='same') # m, n = kernel.shape # if (m == n): # y, x = image.shape # y = y - m + 1 # x = x...
Python
zaydzuhri_stack_edu_python
comment Problem: https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/ class Solution begin function minSwaps self s begin set extraClose = 0 set maxClose = 0 for c in s begin if c == string ] begin set extraClose = extraClose + 1 end else if c == string [ begin set extraClose = extraClose ...
# Problem: https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/ class Solution: def minSwaps(self, s: str) -> int: extraClose = 0 maxClose = 0 for c in s: if c == ']': extraClose += 1 elif c == '[': extra...
Python
zaydzuhri_stack_edu_python
while length number > 1 begin while not is digit number or 10 > length number or length number > 11 begin print string Error set number = input string 전화번호 end if length number == 10 begin print format string ({0:3}) {1:3}-{2:4} number at slice : 3 : number at slice 3 : 6 : number at slice 6 : : end else begin prin...
while ( len( number ) > 1 ): while ( not number.isdigit() or 10 > len( number) or len( number) > 11 ): print( 'Error' ) number = input( '전화번호' ) if len(number ) == 10: print( '({0:3}) {1:3}-{2:4}'.format( number[ :3 ], number[ 3:6 ], number[ 6: ] ) ) else: print( '({0:3}){1:...
Python
zaydzuhri_stack_edu_python
import ast from itertools import chain import copy import math import networkx as nx from algorithms.raeke.make_frt_tree import make_frt_tree , create_topology from algorithms.raeke.generate_rt import generate_rt , RTNode from itertools import permutations import time function measure_time f begin function timed *args ...
import ast from itertools import chain import copy import math import networkx as nx from algorithms.raeke.make_frt_tree import make_frt_tree, create_topology from algorithms.raeke.generate_rt import generate_rt, RTNode from itertools import permutations import time def measure_time(f): def timed(*args, **kw): ...
Python
zaydzuhri_stack_edu_python
for i in range N begin if p at i != q at i begin set a = a + 1 end if a > 2 begin print string NO exit end end if a == 0 or a == 2 begin print string YES end else begin print string NO end
for i in range(N): if p[i]!=q[i]: a+=1 if a>2: print('NO') exit() if a==0 or a==2: print('YES') else: print('NO')
Python
zaydzuhri_stack_edu_python
string GDP - The Generic Device Programmer. By Dean Camera (dean [at] fourwalledcubicle [dot] com) from optparse import OptionParser from core.commandparser import * class CommandParserCLIReset extends CommandParser begin function _parser_error self message begin raise call CommandParserError string RESET message end f...
''' GDP - The Generic Device Programmer. By Dean Camera (dean [at] fourwalledcubicle [dot] com) ''' from optparse import OptionParser from core.commandparser import * class CommandParserCLIReset(CommandParser): def _parser_error(self, message): raise CommandParserError("RESET", message)...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python import csv import sys function create_csv_reader file begin set fieldnames = list string transaction_date string settlement_date string sender string receiver string details string amount string ccy string amount_regional string ccy_regional string sender_account_number string receiver_acco...
#!/usr/bin/env python import csv import sys def create_csv_reader(file): fieldnames = ["transaction_date", "settlement_date", "sender", "receiver", "details", "amount", "ccy", "amount_regional", "ccy_regional", "sender_account_number", "receiver_account_number"] return csv.DictReader(file, ...
Python
zaydzuhri_stack_edu_python
from pydantic import BaseModel from datetime import datetime class Store extends BaseModel begin set name : str set distance : float set latitude : str set longitude : str set cep : str end class class Product extends BaseModel begin set description : str set price : str set found_date : datetime set store : Store end ...
from pydantic import BaseModel from datetime import datetime class Store(BaseModel): name: str distance: float latitude: str longitude: str cep: str class Product(BaseModel): description: str price: str found_date: datetime store: Store class ProductBuilder: MAP_PRODUCT_JSO...
Python
zaydzuhri_stack_edu_python
function get_transcripts_from_args self args printer=none return_type=none require_sort=false begin return call get_segmentchains_from_args args printer=printer return_type=Transcript require_sort=require_sort end function
def get_transcripts_from_args(self, args, printer=None, return_type=None, require_sort=False): return self.get_segmentchains_from_args( args, printer=printer, return_type=Transcript, require_sort=require_sort )
Python
nomic_cornstack_python_v1
function sirene self msg args begin yield string Uiuuu uiuuu! end function
def sirene(self, msg, args): yield("Uiuuu uiuuu!")
Python
nomic_cornstack_python_v1
function steer self command begin if is instance command int begin assert command < length commands comment change command id into real command set command = commands at command end if command == string move forward begin call sendall encode string upO end else if command == string turn left begin call sendall encode s...
def steer(self, command): if isinstance(command, int): assert command < len(self.commands) command = self.commands[command] # change command id into real command if command == 'move forward': self.control_conn.sendall('upO'.encode()) elif command == 'tu...
Python
nomic_cornstack_python_v1
from functools import reduce from colorconsole import terminal from copy import deepcopy class KnotHash begin function __init__ self key size=256 begin set key = key set circleSize = size set circle = list comprehension x for x in range 0 size set lengths = call makeLengths key call makeHash set hash = call condenseHas...
from functools import reduce from colorconsole import terminal from copy import deepcopy class KnotHash: def __init__(self, key, size = 256): self.key = key self.circleSize = size self.circle = [x for x in range(0,size)] self.lengths = self.makeLengths(self.key) self.makeHa...
Python
zaydzuhri_stack_edu_python
function settings user_username begin set session_id = session at string user_id end function
def settings(user_username): session_id = session["user_id"]
Python
nomic_cornstack_python_v1
import pandas as pd import numpy as np import pandas.io.data as web from datetime import datetime import scipy as sp import scipy.optimize as scopt import scipy.stats as spstats import matplotlib.mlab as mlab comment plotting import matplotlib.pyplot as plt function get_historical_closes ticker start_date end_date begi...
import pandas as pd import numpy as np import pandas.io.data as web from datetime import datetime import scipy as sp import scipy.optimize as scopt import scipy.stats as spstats import matplotlib.mlab as mlab # plotting import matplotlib.pyplot as plt def get_historical_closes(ticker, start_date, end_date): # get...
Python
zaydzuhri_stack_edu_python
comment 파스칼의 삼각형 function pa n begin set result = list string 1 for i in range 1 n begin if i == 1 begin set result = list string 1 string 1 end else begin set add = list for r in range 1 length result begin append add string integer result at r - 1 + integer result at r end comment print(add) for a in range length ad...
# 파스칼의 삼각형 def pa(n): result = ['1'] for i in range(1, n): if i == 1: result = ['1', '1'] else: add = [] for r in range(1, len(result)): add.append(str(int(result[r-1]) + int(result[r]))) # print(add) for a in range(len...
Python
zaydzuhri_stack_edu_python
comment We put a , (comma) at the end of each print line. This is so print doesn't end the line with a newline character and go to the next line. comment raw_input() takes input in as a string comment encapsulate that in int() to convert to a number when necessary - int(raw_input()) comment The input() function will tr...
#We put a , (comma) at the end of each print line. This is so print doesn't end the line with a newline character and go to the next line. # raw_input() takes input in as a string # encapsulate that in int() to convert to a number when necessary - int(raw_input()) #The input() function will try to convert things you ...
Python
zaydzuhri_stack_edu_python
function requires_feature feature any_org=none begin function decorator func begin function wrapped self request *args **kwargs begin comment The endpoint is accessible if any of the User's Orgs have the feature comment flag enabled. if any_org begin if not any generator expression call has feature org actor=user for o...
def requires_feature(feature, any_org=None): def decorator(func): def wrapped(self, request, *args, **kwargs): # The endpoint is accessible if any of the User's Orgs have the feature # flag enabled. if any_org: if not any(features.has(feature, org, actor=r...
Python
nomic_cornstack_python_v1
comment coding:utf-8 from __future__ import unicode_literals from django.db.utils import IntegrityError from scrape.helpers import to_biz_date from db.models import Girl , Attendance , StatusLog class InvalidDataException extends BaseException begin pass end class class NotOurDataException extends BaseException begin p...
# coding:utf-8 from __future__ import unicode_literals from django.db.utils import IntegrityError from scrape.helpers import to_biz_date from db.models import Girl, Attendance, StatusLog class InvalidDataException(BaseException): pass class NotOurDataException(BaseException): pass class Organizer(object)...
Python
zaydzuhri_stack_edu_python
function status name=string default begin set machine_states = dictionary call _status return machine_states at name end function
def status(name='default'): machine_states = dict(_status()) return machine_states[name]
Python
nomic_cornstack_python_v1
function losses self begin return dict string loss_cls call softmax_cross_entropy_loss ; string loss_box_reg call box_reg_loss ; string loss_mse_z call z_mse_loss ; string loss_mse_tilt call tilt_mse_loss end function
def losses(self): return {"loss_cls": self.softmax_cross_entropy_loss(), "loss_box_reg": self.box_reg_loss(), "loss_mse_z": self.z_mse_loss(), "loss_mse_tilt": self.tilt_mse_loss()}
Python
nomic_cornstack_python_v1
function new_information self information begin if not call find_information information begin append current_information dict string information information return last_block at string index + 1 end else begin return - 1 end end function
def new_information(self, information): if not self.find_information(information): self.current_information.append({'information': information }) return self.last_block['index'] + 1 else: return -1
Python
nomic_cornstack_python_v1
function normalize_scale df level=none begin set original_order = names set shift_levels = difference original_order level set df = call reorder_levels level + shift_levels if length shift_levels > 0 begin set df = call unstack shift_levels end set maxval : Series = max axis=1 set minval : Series = min axis=1 set scale...
def normalize_scale(df: pd.DataFrame, level: Union[Sequence[int], Sequence[str]] = None): original_order = df.index.names shift_levels = original_order.difference(level) df = df.reorder_levels(level + shift_levels) if len(shift_levels) > 0: df = df.unstack(shift_levels) maxval: pd.Series ...
Python
nomic_cornstack_python_v1
function RenameApk dst_apk begin set src_apk = get current directory + string /android-build/bin/QtApp-release.apk tuple print ? stderr string Renaming %s to %s % tuple src_apk dst_apk rename src_apk dst_apk end function
def RenameApk(dst_apk): src_apk = os.getcwd() + "/android-build/bin/QtApp-release.apk" print >> sys.stderr, "Renaming %s to %s" % (src_apk, dst_apk) os.rename(src_apk, dst_apk)
Python
nomic_cornstack_python_v1
function t_asciidoc target source ASCIIDOC_FLAGS begin call add_dep call convert_to_file source call scan source set cmd = call convert_cmd list string asciidoc string -o target + ASCIIDOC_FLAGS + list source end function
def t_asciidoc(target, source, ASCIIDOC_FLAGS): mem.add_dep(mem.util.convert_to_file(source)) scan(source) cmd = mem.util.convert_cmd(["asciidoc","-o",target]+ASCIIDOC_FLAGS+[source])
Python
nomic_cornstack_python_v1
function test_not_equal_on_not_equal_nonce self begin set a = call AttestationCredential nonce=call Nonce nonce_id=b'\x01' nonce_value=b'\x00\x01\x02\x03\x04\x05\x06\x07' set b = call AttestationCredential nonce=call Nonce nonce_id=b'\x02' nonce_value=b'\x07\x06\x05\x04\x03\x02\x01\x00' assert true a != b assert true b...
def test_not_equal_on_not_equal_nonce(self): a = objects.AttestationCredential( nonce=objects.Nonce( nonce_id=b'\x01', nonce_value=b'\x00\x01\x02\x03\x04\x05\x06\x07' ) ) b = objects.AttestationCredential( nonce=objects.Nonce( ...
Python
nomic_cornstack_python_v1
async function begin_reverse_search_address_batch self **kwargs begin set batch_id = pop kwargs string batch_id none set search_queries = pop kwargs string search_queries none if batch_id begin return await call begin_get_reverse_search_address_batch batch_id=batch_id keyword kwargs end set batch_items = if expression ...
async def begin_reverse_search_address_batch( self, **kwargs: Any ) -> AsyncLROPoller[ReverseSearchAddressBatchProcessResult]: batch_id = kwargs.pop("batch_id", None) search_queries = kwargs.pop("search_queries", None) if batch_id: return await self._search_clien...
Python
nomic_cornstack_python_v1
function my_age begin if age < 18 begin print string you are a Minor! end else if age == 18 or age <= 36 begin print string Your are a Youth end else begin print string You are an Elder end end function call my_age
def my_age(): if age < 18: print("you are a Minor!") elif age == 18 or age <= 36: print("Your are a Youth") else: print("You are an Elder") my_age()
Python
zaydzuhri_stack_edu_python
import math function operation count begin if count > 8 begin return 1 end return square root 2 + call operation count + 1 end function function main begin print format string The estimated pi is: {}. string %.30f % 768 * square root 2 - call operation 1 print format string The actual pi is: {}. string %.30f % pi end f...
import math def operation(count): if count > 8: return 1 return math.sqrt(2 + operation(count + 1)) def main(): print("The estimated pi is: {}.".format("%.30f" % (768 * math.sqrt(2 - operation(1))))) print("The actual pi is: {}.".format("%.30f" % math.pi)) ...
Python
zaydzuhri_stack_edu_python
function init_frame self begin set scroller = call ScrolledWindow call set_policy POLICY_AUTOMATIC POLICY_NEVER add scroller view set frame = call Frame call set_shadow_type SHADOW_OUT set hbox = call HBox add hbox scroller set scroller_text = call ScrolledWindow call set_policy POLICY_AUTOMATIC POLICY_AUTOMATIC add sc...
def init_frame(self): scroller = gtk.ScrolledWindow() scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER) scroller.add(self.view) frame = gtk.Frame() frame.set_shadow_type(gtk.SHADOW_OUT) hbox = gtk.HBox() hbox.add(scroller) scroller_te...
Python
nomic_cornstack_python_v1
from graphics import * comment pointlist is a list to store all points, and it is declared as an empty list set pointlist = list set towerlocation = tuple 0 0 set towerlength = 0 comment reading from file set f = open string input.txt string r for x in f begin if x != string string @ and x != string string @@ begin se...
from graphics import * # pointlist is a list to store all points, and it is declared as an empty list pointlist = [] towerlocation=(0,0) towerlength=0 # reading from file f = open("input.txt", "r") for x in f: if x!=str("@\n") and x!=str("@@\n"): tupleinput=tuple(int(inp.strip()) for inp in x.split(',')) ...
Python
zaydzuhri_stack_edu_python
import json import socketserver from OrderingSystem import OrderingSystem set orderingSystem = call OrderingSystem 10 30 class OrderingServer begin function start self HOST=string localhost PORT=8089 begin with call TCPServer tuple HOST PORT OrderHandler as server begin print string started call serve_forever end end f...
import json import socketserver from OrderingSystem import OrderingSystem orderingSystem = OrderingSystem(10, 30) class OrderingServer: def start(self, HOST="localhost", PORT=8089): with socketserver.TCPServer((HOST, PORT), OrderHandler) as server: print("started") server.serve_f...
Python
zaydzuhri_stack_edu_python
set ism = string Jonibek set fam = string Uralov set shahar = string Urganch set viloyat = string Xorazm set matn = string Men yangi noutbuk oldim 😉 print matn print string Mening ismim + ism + string Familiyam + fam set ism_sharif = string { ism } { fam } print upper ism_sharif print lower ism_sharif print title ism_...
ism = "Jonibek" fam = "Uralov" shahar = "Urganch" viloyat = "Xorazm" matn = "Men yangi noutbuk oldim 😉" print(matn) print("Mening ismim "+ ism + " Familiyam "+ fam) ism_sharif = f"{ism} \t {fam}" print(ism_sharif.upper()) print(ism_sharif.lower()) print(ism_sharif.title()) print(ism_sharif.capitalize()) telefon = "...
Python
zaydzuhri_stack_edu_python
from textblob import TextBlob function detect_language text begin set blob = call TextBlob text set language = call detect_language return language end function comment Example usage: set text = string Bonjour tout le monde set language_detected = call detect_language text print string The text is in: { language_detect...
from textblob import TextBlob def detect_language(text): blob = TextBlob(text) language = blob.detect_language() return language # Example usage: text = 'Bonjour tout le monde' language_detected = detect_language(text) print(f'The text is in: {language_detected}')
Python
flytech_python_25k
comment !/usr/bin/env python string Video stabilisation using OpenCV import cv2 import numpy as np import pandas as pd from tqdm import tqdm import matplotlib.pyplot as plt from mTierpsy.programs.box_utils import box_to_df from mTierpsy.programs.data_extraction import extract_data from mTierpsy.programs.smoothing impor...
#!/usr/bin/env python """ Video stabilisation using OpenCV """ import cv2 import numpy as np import pandas as pd from tqdm import tqdm import matplotlib.pyplot as plt from mTierpsy.programs.box_utils import box_to_df from mTierpsy.programs.data_extraction import extract_data from mTierpsy.programs.smoothing import mo...
Python
zaydzuhri_stack_edu_python
function joined_buddies self buddies begin set joinedbuddies = set buddies set newbuddies = difference joinedbuddies _buddies update _buddies newbuddies return newbuddies end function
def joined_buddies(self, buddies): joinedbuddies = set(buddies) newbuddies = joinedbuddies.difference(self._buddies) self._buddies.update(newbuddies) return newbuddies
Python
nomic_cornstack_python_v1
function InitializeWindow self begin set win_height = 600 set win_width = 900 comment 'x' and 'y' coordinates place window in the center of the screen set y = integer call winfo_screenheight / 2 - win_height / 2 set x = integer call winfo_screenwidth / 2 - win_width / 2 call geometry string { win_width } x { win_height...
def InitializeWindow(self): win_height = 600 win_width = 900 # 'x' and 'y' coordinates place window in the center of the screen y = int((self.winfo_screenheight() / 2) - (win_height / 2)) x = int((self.winfo_screenwidth() / 2) - (win_width / 2)) self.geo...
Python
nomic_cornstack_python_v1
comment for defining a variable you would let python do it with the function comment print(type(your variable to test)) comment print(type(1)) comment which would come back as a int, because it is a number comment print(type("where are you")) comment which comes back as a string because of the "" around the words comme...
#for defining a variable you would let python do it with the function #print(type(your variable to test)) # #print(type(1)) #which would come back as a int, because it is a number #print(type("where are you")) #which comes back as a string because of the "" around the words #print(type("1,2,3,4")) #also is cons...
Python
zaydzuhri_stack_edu_python
function subsample self smpl=none freq=none begin info string Enter Series.subsample. set data = call tolist copy=true set full = smpl_full if smpl is not none begin assert is instance smpl_full Sample and is instance smpl Sample assert start >= start and end <= end debug string Subsample based on smpl. comment we do N...
def subsample(self, smpl=None, freq=None): logging.info("Enter Series.subsample.") data = self.tolist(copy=True) full = self.smpl_full if smpl is not None: assert (isinstance(self.smpl_full,Sample) and isinstance(smpl,Sample)) assert (smpl.start >= self.smpl_full.start)and(smpl.end <= self.smpl_full...
Python
nomic_cornstack_python_v1