code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
function file_saved_true self begin call config state=string normal call config state=string normal call config state=string disabled end function
def file_saved_true(self): self.page_next_button.config(state='normal') self.page_prev_button.config(state='normal') self.text_save_button.config(state='disabled')
Python
nomic_cornstack_python_v1
comment -*-coding:UTF-8-*- string Created on 2014年12月30日 @author: zhangr01 class Father extends object begin function __init__ self name begin set name = name end function end class class Sun extends Father begin function __init__ self fname own_name begin call __init__ self fname set own_name = own_name end function f...
#-*-coding:UTF-8-*- ''' Created on 2014年12月30日 @author: zhangr01 ''' class Father(object): def __init__(self, name): self.name = name class Sun(Father): def __init__(self, fname, own_name): Father.__init__(self, fname) self.own_name = own_name def __str__(s...
Python
zaydzuhri_stack_edu_python
for i in range 0 n begin set tuple Score1 Score2 = split input set count1 = count1 + integer Score1 set count2 = count2 + integer Score2 if count1 > count2 begin if max1 < count1 - count2 begin set max1 = count1 - count2 end set p = 1 end else begin if max1 < count2 - count1 begin set max1 = count2 - count1 end set p =...
for i in range(0,n): Score1, Score2 = input().split() count1 += int(Score1) count2 += int(Score2) if count1 > count2: if max1 < (count1 - count2): max1 = count1 - count2 p = 1 else: if max1 < (count2 - count1): max1 = count2 - count1 ...
Python
zaydzuhri_stack_edu_python
function common_sense_action_failure_heuristic heightmap heightmap_resolution=0.002 gripper_width=0.06 min_contact_height=0.02 push_length=0.0 z_buffer=0.01 begin set pixels_to_dilate = integer ceil gripper_width + push_length / heightmap_resolution set kernel = ones tuple pixels_to_dilate pixels_to_dilate uint8 set ob...
def common_sense_action_failure_heuristic(heightmap, heightmap_resolution=0.002, gripper_width=0.06, min_contact_height=0.02, push_length=0.0, z_buffer=0.01): pixels_to_dilate = int(np.ceil((gripper_width + push_length)/heightmap_resolution)) kernel = np.ones((pixels_to_dilate, pixels_to_dilate), np.uint8) ...
Python
nomic_cornstack_python_v1
function test_redactedCommandLine self begin set inputOutput = list dict string input list ; string output list dict string input list string --apiToken string someSecret ; string output list string --apiToken string REDACTED dict string input list string --apiToken string someSecret string --apiToken string someSecr...
def test_redactedCommandLine(self): inputOutput = [ { "input": [], "output": [], }, { "input": ["--apiToken", "someSecret"], "output": ["--apiToken", "REDACTED"], }, { "input": ["--apiToken", "som...
Python
nomic_cornstack_python_v1
function onReceiverError self receiverError begin pass end function
def onReceiverError(self, receiverError): pass
Python
nomic_cornstack_python_v1
from math import sqrt class Solution begin function kClosest self points K begin return sorted points key=lambda p -> square root p at 0 * p at 0 + p at 1 * p at 1 at slice : K : end function end class
from math import sqrt class Solution(): def kClosest(self, points, K): return sorted(points, key = lambda p : sqrt(p[0] * p[0] + p[1] * p[1]))[:K]
Python
zaydzuhri_stack_edu_python
function scoop_poops_and_go_back base scooper poops begin for poop in poops begin if call go_to_scoop_poop_at base poop at 0 poop at 1 0 begin call scoop end end end function
def scoop_poops_and_go_back(base, scooper, poops): for poop in poops: if go_to_scoop_poop_at(base, poop[0], poop[1],0): scooper.scoop()
Python
nomic_cornstack_python_v1
function distort filename threshold=0.25 type=string arctan wout=true plot=false begin set start = time set tuple n data data_dB sr ch = call inputwav filename set dataD = zeros tuple length data ch comment data_dB set dataD at tuple slice : length data : slice : : = data if type == string arctan begin print strin...
def distort(filename,threshold=0.25,type='arctan',wout=True,plot=False): start=time.time() n, data, data_dB,sr,ch=inputwav(filename) dataD=np.zeros((len(data),ch)) dataD[:len(data),:]=data#data_dB if type=='arctan': print('Applying arctan distortion...') for k in range(ch): ...
Python
nomic_cornstack_python_v1
from matplotlib import rc import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint comment wartosci parametrow set T = 300 set D_incubation = 5.2 set D_infectious = 2.9 set D_death = 18 set D_hospital_lag = 5 set D_recovery_severe = 21 set a = 1 / D_incubation set gamma = 1 / D_infectious s...
from matplotlib import rc import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint # wartosci parametrow T = 300 D_incubation = 5.2 D_infectious = 2.9 D_death = 18 D_hospital_lag = 5 D_recovery_severe = 21 a = 1 / D_incubation gamma = 1 / D_infectious p_severe = 0.19 p_fatal = 0.02 p_mild...
Python
zaydzuhri_stack_edu_python
string #Build Tower by the following given argument: #number of floors (integer and always greater than 0). #Tower block is represented as * for example, a tower of 3 floors looks like below [ ' * ', ' *** ', '*****' ] and a tower of 6 floors looks like below [ ' * ', ' *** ', ' ***** ', ' ******* ', ' ********* ', '**...
''' #Build Tower by the following given argument: #number of floors (integer and always greater than 0). #Tower block is represented as * for example, a tower of 3 floors looks like below [ ' * ', ' *** ', '*****' ] and a tower of 6 floors looks like below [ ' * ', ' *** ', ' *****...
Python
zaydzuhri_stack_edu_python
import pandas as pd from scipy.stats import chisquare from scipy import stats from scipy.stats import chi2_contingency import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import style import random import math set style = string MacOSX function prueba_chi2 numeros intervalos begin if length numero...
import pandas as pd from scipy.stats import chisquare from scipy import stats from scipy.stats import chi2_contingency import numpy as np import matplotlib.pyplot as plt from matplotlib.pyplot import style import random import math style = 'MacOSX' def prueba_chi2(numeros, intervalos): if len(numeros) < 30: ...
Python
zaydzuhri_stack_edu_python
import pygame set Black = tuple 0 0 0 class Paddle extends Sprite begin function __init__ self color width height begin comment (Sprite) Constructor call __init__ set image = call Surface list width height call fill Black call set_colorkey Black call rect image color list 0 0 width height set rect = call get_rect end f...
import pygame Black =(0,0,0) class Paddle(pygame.sprite.Sprite): def __init__(self,color,width,height): super().__init__() # (Sprite) Constructor self.image = pygame.Surface ([width,height]) self.image.fill(Black) self.image.set_colorkey(Black) pygame.draw.rect(self.image,color,[0,0,width,height]) sel...
Python
zaydzuhri_stack_edu_python
function set_args self args begin set epochs = epochs set lrdecay = lrdecay set lrpatience = lrpatience set ntest = ntest set ndiscard = ndiscard set predict = predict set printfreq = printfreq set savefreq = savefreq set resume = resume set seed = seed set timesteps = timesteps set verbose = verbose end function
def set_args(self, args: Namespace) -> None: self.epochs = args.epochs self.lrdecay = args.lrdecay self.lrpatience = args.lrpatience self.ntest = args.ntest self.ndiscard = args.ndiscard self.predict = args.predict self.printfreq = args.printfreq self.save...
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python comment Michael Uftring, Indiana University comment I590 - Python, Summer 2017 comment Assignment 2, Question 1 comment A program to produce a table of Celsius to Fahrenheit conversions comment every 10 degrees from 0C to 100C. function main begin print string Celsius Fahrenheit print strin...
#!/usr/bin/env python # # Michael Uftring, Indiana University # I590 - Python, Summer 2017 # # Assignment 2, Question 1 # # A program to produce a table of Celsius to Fahrenheit conversions # every 10 degrees from 0C to 100C. # def main(): print("Celsius\tFahrenheit") print("------------------") for i in ...
Python
zaydzuhri_stack_edu_python
function gcd num_1 num_2 begin if num_2 == 0 begin return num_1 end return call gcd num_2 num_1 % num_2 end function
def gcd(num_1, num_2): if num_2 == 0: return num_1 return gcd(num_2, num_1 % num_2)
Python
flytech_python_25k
function find_intersection list1 list2 begin set intersection = list for item1 in list1 begin for item2 in list2 begin if item1 == item2 begin append intersection item1 end end end return intersection end function set list1 = list 1 2 3 set list2 = list 3 4 5 set result = call find_intersection list1 list2 print resul...
def find_intersection(list1, list2): intersection = [] for item1 in list1: for item2 in list2: if item1 == item2: intersection.append(item1) return intersection list1 = [1, 2, 3] list2 = [3, 4, 5] result = find_intersection(list1, list2) print(result)
Python
flytech_python_25k
function index begin set query = Product_Table set represent = string set represent = lambda id row -> call A product_name _href=call URL string default string product_page args=list id set rows = call render return dictionary rows=rows end function
def index(): query = db.Product_Table db.Product_Table.product_owner.represent = "" db.Product_Table.product_name.represent = lambda id, row: \ A(row.product_name, _href=URL('default', 'product_page', args=[row.id])) rows = db(query).select().render() return dict(rows=rows)
Python
nomic_cornstack_python_v1
import tensorflow as tf import numpy as np from PIL import Image import streamlit as st set model = call load_model string inceptV3Bug8571-x.h5 set classes = list string Bladlöss string Sköldlöss string Spinnkvalster string Ullöss set img_size = 200 function prediction img begin set image = open img set resized = call ...
import tensorflow as tf import numpy as np from PIL import Image import streamlit as st model = tf.keras.models.load_model('inceptV3Bug8571-x.h5') classes = ['Bladlöss', 'Sköldlöss', 'Spinnkvalster', 'Ullöss'] img_size = 200 def prediction(img): image = Image.open(img) resized = image.resize((img_size, img_...
Python
zaydzuhri_stack_edu_python
function columns self begin return list comprehension col for tuple prop col in items call asdict self if prop not in set literal string path_separator string event_id_identifier end function
def columns(self): return [ col for prop, col in attr.asdict(self).items() if prop not in {"path_separator", "event_id_identifier"} ]
Python
nomic_cornstack_python_v1
comment Matriculation number: 2227134 import numpy as np from scipy.misc import ascent from skimage.transform import radon comment Add other imports here if needed from numpy.fft import fft , ifft , fftshift set im = call ascent set n = shape at 0 set padded = call pad im n // 2 mode=string constant comment ANGLES is a...
# Matriculation number: 2227134 import numpy as np from scipy.misc import ascent from skimage.transform import radon # Add other imports here if needed from numpy.fft import fft, ifft, fftshift im = ascent() n = im.shape[0] padded = np.pad(im, n // 2, mode='constant') # ANGLES is an array between 0 – 180 degrees, e....
Python
zaydzuhri_stack_edu_python
function find_representative_movies movies max_examples=5 begin set movies = sorted movies key=lambda m -> get m string rating 0 reverse=true return list comprehension m for m in movies at slice : max_examples : if get m string rating 0 >= 6 end function
def find_representative_movies(movies, max_examples=5): movies = sorted(movies, key=lambda m: m.get("rating", 0), reverse=True) return [m for m in movies[:max_examples] if m.get("rating", 0) >= 6]
Python
nomic_cornstack_python_v1
function all_gt self other begin return x > x and y > y end function
def all_gt(self, other): return self.x > other.x and self.y > other.y
Python
nomic_cornstack_python_v1
function initialize self kernel_families n_models n_dims begin comment {SE, RQ, LIN, PER} if dataset is 1D comment {SE_i} + {RQ_i} otherwise set kernels = list return kernels end function
def initialize(self, kernel_families, n_models, n_dims): # {SE, RQ, LIN, PER} if dataset is 1D # {SE_i} + {RQ_i} otherwise kernels = [] return kernels
Python
nomic_cornstack_python_v1
function inputs header begin string Read through the HISTORY cards in an image header looking for detrend input lines. Detrend inputs are given on lines like: HISTORY imcombred: file_id We require that the value in file_id be store in the CADC archive before adding to the inputs list. import string , re set inputs = li...
def inputs(header): """Read through the HISTORY cards in an image header looking for detrend input lines. Detrend inputs are given on lines like: HISTORY imcombred: file_id We require that the value in file_id be store in the CADC archive before adding to the inputs list. """ import st...
Python
jtatman_500k
function comparison_id self begin return _benchmark_comparison_id end function
def comparison_id(self): return self._benchmark_comparison_id
Python
nomic_cornstack_python_v1
function construct_array A B begin set n = length A set C = list 0 * n set i = 0 while i < n begin set C at i = A at i * B at i set i = i + 1 end return C end function comment Example usage: set A = list 1 2 3 4 set B = list 5 6 7 8 set C = call construct_array A B comment Output: [5, 12, 21, 32] print C
def construct_array(A, B): n = len(A) C = [0] * n i = 0 while i < n: C[i] = A[i] * B[i] i += 1 return C # Example usage: A = [1, 2, 3, 4] B = [5, 6, 7, 8] C = construct_array(A, B) print(C) # Output: [5, 12, 21, 32]
Python
jtatman_500k
class ToDoList extends object begin function __init__ self title begin set title = title end function function add_task self begin print string Enter the task you'd like to add: set task_to_add = call raw_input string > with open string todos.txt string a as file_object begin write file_object task_to_add write file_ob...
class ToDoList(object): def __init__(self, title): self.title = title def add_task(self): print('Enter the task you\'d like to add:') task_to_add = raw_input('> ') with open('todos.txt', 'a') as file_object: file_object.write(task_to_add) file_object.writ...
Python
zaydzuhri_stack_edu_python
function _set_model self begin set profiles = list function add_profiles name exp idx begin if is instance exp MixedExperiment begin for tuple i p in enumerate parts begin append profiles tuple name + character ordinal string a + i p idx end end else begin append profiles tuple name exp idx end end function if is inst...
def _set_model(self): self.profiles = [] def add_profiles(name, exp, idx): if isinstance(exp, MixedExperiment): for i, p in enumerate(exp.parts): self.profiles.append((name + chr(ord("a") + i), p, idx)) else: self.profiles.appen...
Python
nomic_cornstack_python_v1
from edd import * class Pieza begin comment bordes es un string tipo 'GGGGGG' function __init__ self bordes begin set bordes = bordes comment no cambia set id = bordes set borde1 = bordes at 0 set borde2 = bordes at 1 set borde3 = bordes at 2 set borde4 = bordes at 3 set borde5 = bordes at 4 set borde6 = bordes at 5 if...
from edd import * class Pieza: def __init__(self, bordes): # bordes es un string tipo 'GGGGGG' self.bordes = bordes self.id = bordes # no cambia self.borde1 = bordes[0] self.borde2 = bordes[1] self.borde3 = bordes[2] self.borde4 = bordes[3] self.borde5 = b...
Python
zaydzuhri_stack_edu_python
comment First import all the standard modules: import numpy as np import pyfits import healpy as hp from matplotlib import pyplot comment Now import the MLMapper: from MapMaker.MLMapper import Control comment Open the test data: set hdu = open string TestData.fits set tod = data at string TOD at tuple 0 slice : : 0 ...
#First import all the standard modules: import numpy as np import pyfits import healpy as hp from matplotlib import pyplot #Now import the MLMapper: from MapMaker.MLMapper import Control #Open the test data: hdu = pyfits.open('TestData.fits') tod = hdu[1].data['TOD'][0,:,0] pix = hdu[1].data['PIX'][0,:,0] #Number of...
Python
zaydzuhri_stack_edu_python
function test_210302_multipolygon dbcursor begin set prod = call vtecparser call get_test_file string FLW/FLWJKL_multipolygon.txt call sql dbcursor assert any generator expression string culling in x for x in warnings end function
def test_210302_multipolygon(dbcursor): prod = vtecparser(get_test_file("FLW/FLWJKL_multipolygon.txt")) prod.sql(dbcursor) assert any("culling" in x for x in prod.warnings)
Python
nomic_cornstack_python_v1
function validate_authentication_config config begin assert is instance config Mapping for tuple hint authenticators in items config begin if not is instance hint tuple AuthenticatorHint type none begin raise call TypeError string Authenticator hint must be an instance of authentication.AuthenticatorHint or None end as...
def validate_authentication_config(config): assert isinstance(config, typing.Mapping) for hint, authenticators in config.items(): if not isinstance(hint, (AuthenticatorHint, type(None))): raise TypeError( "Authenticator hint must be an instance of authentication.Authenticator...
Python
nomic_cornstack_python_v1
comment real signature unknown; restored from __doc__ function setDistanceFunction self distanceFunction begin pass end function
def setDistanceFunction(self, distanceFunction): # real signature unknown; restored from __doc__ pass
Python
nomic_cornstack_python_v1
function get_opposite_azimuth myazi tolerance=20 begin set azi_range = 180 - tolerance set minazi = myazi + azi_range set maxazi = myazi - azi_range if minazi > 360 begin set minazi = minazi - 360 end if maxazi < 0 begin set maxazi = maxazi + 360 end return list minazi maxazi end function
def get_opposite_azimuth(myazi, tolerance=20): azi_range = 180 - tolerance minazi = myazi + azi_range maxazi = myazi - azi_range if minazi > 360: minazi -= 360 if maxazi < 0: maxazi += 360 return [minazi, maxazi]
Python
nomic_cornstack_python_v1
import gc import xgboost as xgb import numpy as np from sklearn.model_selection import GridSearchCV , KFold from DataReader import load_data set param = dict string max_depth 6 ; string learning_rate 0.05 ; string n_estimators 1 ; string subsample 0.8 ; string colsample_bytree 0.8 ; string min_child_weight 0.75 ; strin...
import gc import xgboost as xgb import numpy as np from sklearn.model_selection import GridSearchCV, KFold from DataReader import load_data param = { "max_depth": 6, "learning_rate": 0.05, "n_estimators": 1, "subsample": 0.8, "colsample_bytree": 0.8, "min_child_weight": 0.75, 'objective': '...
Python
zaydzuhri_stack_edu_python
function canonical_character_list self begin set char_list_fpath = string /data/fanfiction_ao3/ { fandom } /canonical_characters.txt with open char_list_fpath as f begin set canonical_characters = call splitlines end set extra = list string Dobby set canonical_characters = canonical_characters + extra set canonical_cha...
def canonical_character_list(self): char_list_fpath = f'/data/fanfiction_ao3/{self.fandom}/canonical_characters.txt' with open(char_list_fpath) as f: canonical_characters = f.read().splitlines() extra = ['Dobby'] canonical_characters += extra canonical_characters = [c...
Python
nomic_cornstack_python_v1
function velocity_graph data vkey=string velocity xkey=string Ms tkey=none basis=none n_neighbors=none n_recurse_neighbors=none random_neighbors_at_max=none sqrt_transform=false approx=false copy=false begin string Computes velocity graph based on cosine similarities. The cosine similarities are computed between veloci...
def velocity_graph(data, vkey='velocity', xkey='Ms', tkey=None, basis=None, n_neighbors=None, n_recurse_neighbors=None, random_neighbors_at_max=None, sqrt_transform=False, approx=False, copy=False): """Computes velocity graph based on cosine similarities. The cosine similarities are computed...
Python
jtatman_500k
comment 不同类型用加法会有不同的解释 class Person extends object begin function __init__ self num begin set num = num end function comment 运算符重载 function __add__ self other begin return call Person num + num end function function __str__ self begin return string num = + string num end function end class set per1 = call Person 1 set ...
#不同类型用加法会有不同的解释 class Person(object): def __init__(self, num): self.num = num #运算符重载 def __add__(self, other): return Person(self.num + other.num) def __str__(self): return "num = " + str(self.num) per1 = Person(1) per2 = Person(2) print(per1 + per2) print(per1.__ad...
Python
zaydzuhri_stack_edu_python
function get_blob self index begin string Index is slice ID set blob = _current_blob call retrieve_timeslice index set timeslice_info = call from_template dict string frame_index frame_index ; string slice_id index ; string timestamp utc_seconds ; string nanoseconds utc_nanoseconds ; string n_frames n_frames string Tim...
def get_blob(self, index): """Index is slice ID""" blob = self._current_blob self.r.retrieve_timeslice(index) timeslice_info = Table.from_template({ 'frame_index': self.r.frame_index, 'slice_id': index, 'timestamp': self.r.utc_seconds, 'nan...
Python
jtatman_500k
function containsABA s begin set res = list set tuple a b a1 = tuple string X string X string X for c in s begin set tuple a b a1 = tuple b a1 c if a == a1 and a != b begin append res b + a + b end end return res end function
def containsABA(s): res = [] a, b, a1 = 'X', 'X', 'X' for c in s: a, b, a1 = b, a1, c if a == a1 and a != b: res.append(b + a + b) return res
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- import scrapy from pyquery import PyQuery as pq from copy import deepcopy from dongguan.items import DongguanItem import copy class DgHouseSpider extends Spider begin set name = string dg_house comment allowed_domains = ['*'] set start_urls = list string http://dgfc.dg.gov.cn/dgwebsite_v2/...
# -*- coding: utf-8 -*- import scrapy from pyquery import PyQuery as pq from copy import deepcopy from dongguan.items import DongguanItem import copy class DgHouseSpider(scrapy.Spider): name = 'dg_house' # allowed_domains = ['*'] start_urls = ['http://dgfc.dg.gov.cn/dgwebsite_v2/Vendition/ProjectInfo.aspx...
Python
zaydzuhri_stack_edu_python
class Node begin function __init__ self value begin set value = value set right = none set left = none end function end class function reconstruct preorder inorder begin set first = preorder at 0 set root = call Node first if length preorder == 1 begin return root end set i = 0 while i < length inorder and inorder at i...
class Node: def __init__(self, value): self.value = value self.right = None self.left = None def reconstruct(preorder, inorder): first = preorder[0] root = Node(first) if (len(preorder) == 1): return root i = 0 while (i < len(inorder) and inorder[i] != first): i += 1 root.left = reconstruct(preorder[1...
Python
zaydzuhri_stack_edu_python
import csv from os import path import matplotlib.pyplot as plt import numpy as np from keras.layers import Input from keras.models import Model function combine_model gen disc latent_dim begin string Combines a generator and discriminator model into a GAN. Parameters ---------- gen : Model The generator model. disc : M...
import csv from os import path import matplotlib.pyplot as plt import numpy as np from keras.layers import Input from keras.models import Model def combine_model(gen, disc, latent_dim): """Combines a generator and discriminator model into a GAN. Parameters ---------- gen : Model The generato...
Python
zaydzuhri_stack_edu_python
function general ctx begin set obj = call General end function
def general(ctx): ctx.obj = General()
Python
nomic_cornstack_python_v1
for point in range 0 number begin set point = split input string Noktayı giriniz: string , set x = decimal point at 0 set y = decimal point at 1 set point = tuple x y append list1 point set sumx = sumx + x set sumy = sumy + y end set centerx = sumx / number set centery = sumy / number set centerofmass = list centerx ce...
for point in range (0,number): point = input("Noktayı giriniz: ").split(",") x = float(point[0]) y = float(point[1]) point = (x,y) list1.append(point) sumx = sumx + x sumy = sumy + y centerx = sumx / number centery = sumy / number centerofmass = [centerx,cente...
Python
zaydzuhri_stack_edu_python
function take_positions self cols negate=false begin set make_seq = make_seq set result = dict comment if we're negating, pick out all the positions except specified comment indices if negate begin set col_lookup = call fromkeys cols for tuple name seq in list items named_seqs begin set result at name = call make_seq ...
def take_positions(self, cols, negate=False): make_seq = self.moltype.make_seq result = {} # if we're negating, pick out all the positions except specified # indices if negate: col_lookup = dict.fromkeys(cols) for name, seq in list(self.named_seqs.items())...
Python
nomic_cornstack_python_v1
import unittest import os import NamedPropertyItem class TestAdventOfCodeDay19 extends TestCase begin function test_get_distinct_molecules_WhenThreeTransitionsAndHOHStart_Returns4DistinctMolecules self begin set transitions = dict string H list string HO string OH ; string O list string HH set actual = call get_distinc...
import unittest import os import NamedPropertyItem class TestAdventOfCodeDay19(unittest.TestCase): def test_get_distinct_molecules_WhenThreeTransitionsAndHOHStart_Returns4DistinctMolecules(self): transitions = {'H' : ['HO', 'OH'], 'O': ['HH']} actual = get_distinct_molecules(transitions, 'HOH') ...
Python
zaydzuhri_stack_edu_python
function test_verify_path2_7 self begin call touch set tuple result msg = call verify_path2 file kind=none expect=false with call subTest begin assert false result end with call subTest begin assert is not none msg end end function
def test_verify_path2_7(self): self.file.touch() result, msg = basic.verify_path2(self.file, kind=None, expect=False) with self.subTest(): self.assertFalse(result) with self.subTest(): self.assertIsNotNone(msg)
Python
nomic_cornstack_python_v1
function GetSelectedOutputRow self row begin if row < 0 begin set row = GetSelectedOutputRowCount + row end set ncols = GetSelectedOutputColumnCount set results = list for col in range ncols begin append results call GetSelectedOutputValue row col end return results end function
def GetSelectedOutputRow(self, row): if row < 0: row = self.GetSelectedOutputRowCount + row ncols = self.GetSelectedOutputColumnCount results = [] for col in range(ncols): results.append(self.GetSelectedOutputValue(row, col)) return results
Python
nomic_cornstack_python_v1
class User extends object begin function __init__ self firstname=none lastname=none username=none begin set firstname = firstname set lastname = lastname set username = username end function decorator classmethod function add cls user_info begin set tuple firstname lastname username = user_info print string Calling sub...
class User(object): def __init__(self, firstname=None, lastname=None, username=None): self.firstname = firstname self.lastname = lastname self.username = username @classmethod def add(cls, user_info): firstname, lastname, username = user_info print('Calling subproce...
Python
zaydzuhri_stack_edu_python
function getLightIntHighThreshold self begin return call _read_byte_data REG_AIHTL ? call _read_byte_data REG_AIHTH ? 8 end function
def getLightIntHighThreshold(self): return self._read_byte_data(REG_AIHTL) | (self._read_byte_data(REG_AIHTH) << 8)
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- string Created on Mon Mar 25 16:01:39 2019 @author: WJH comment %% import sys append path string D:\学习\科研2019\Temperature-prediction-using-LSTM import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from Glo_paras import * function prepro FILE_PATH begin co...
# -*- coding: utf-8 -*- """ Created on Mon Mar 25 16:01:39 2019 @author: WJH """ #%% import sys sys.path.append(r'D:\学习\科研2019\Temperature-prediction-using-LSTM') import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from Glo_paras import * def prepro(FILE_PATH): # IMPORT DATA ...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- import os import json import uuid import random import subprocess comment 随机字符串 set randomStr = lambda num -> join string random sample string abcdefghijklmnopqrstuvwxyz num comment Response class Response begin function __init__ self start_response response errorCode=none begin set start...
# -*- coding: utf-8 -*- import os import json import uuid import random import subprocess # 随机字符串 randomStr = lambda num=5: "".join(random.sample('abcdefghijklmnopqrstuvwxyz', num)) # Response class Response: def __init__(self, start_response, response, errorCode=None): self.start = start_response ...
Python
zaydzuhri_stack_edu_python
function getStringArray self key defaultValue begin set path = _path + key set value = call getEntryValue path if not value or type != NT_STRING_ARRAY begin return defaultValue end return value end function
def getStringArray(self, key: str, defaultValue) -> Sequence[str]: path = self._path + key value = self._api.getEntryValue(path) if not value or value.type != NT_STRING_ARRAY: return defaultValue return value.value
Python
nomic_cornstack_python_v1
function generateData numPoints x y begin for i in range 0 numPoints begin if i % 2 == 0 begin append x call normalvariate 25 15 append y call normalvariate 25 15 end else begin append x call normalvariate 75 15 append y call normalvariate 75 15 end end end function
def generateData(numPoints,x,y): for i in range(0,numPoints): if (i % 2 == 0): x.append(random.normalvariate(25, 15)) y.append(random.normalvariate(25, 15)) else: x.append(random.normalvariate(75, 15)) y.append(random.normalvariate(75, 15))
Python
nomic_cornstack_python_v1
comment coding: utf-8 import os import pandas as pd import sys
# coding: utf-8 import os import pandas as pd import sys
Python
zaydzuhri_stack_edu_python
function cal_lcm a b begin if a > b begin set large = a end else begin set large = b end while true begin if large % a == 0 and large % b == 0 begin set lcm = large break end set large = large + 1 end return lcm end function set n1 = integer input string enter num1: set n2 = integer input string enter num2: print strin...
def cal_lcm(a,b): if a>b: large=a else: large=b while(True): if((large%a == 0) and (large%b == 0)): lcm=large break large += 1 return lcm n1=int(input("enter num1:")) n2=int(input("enter num2:")) print("lcm of two numbers is:",cal_lcm(...
Python
zaydzuhri_stack_edu_python
function bundle_quantity self begin return _bundle_quantity end function
def bundle_quantity(self): return self._bundle_quantity
Python
nomic_cornstack_python_v1
with open string Beyondsleep.txt encoding=string utf-8 as file begin for line in file begin for word in split line begin add first word end end end with open string pride&prejudice.txt encoding=string utf-8 as f begin for l in f begin for w in split l begin add second w end end end for w in intersection first second be...
with open("Beyondsleep.txt",encoding = 'utf-8') as file: for line in file: for word in line.split(): first.add(word) with open("pride&prejudice.txt",encoding = 'utf-8') as f: for l in f: for w in l.split(): second.add(w) for w in first.intersection(second): p...
Python
zaydzuhri_stack_edu_python
function stddev_upper_bound self begin return _stddev_upper_bound end function
def stddev_upper_bound(self): return self._stddev_upper_bound
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python3 comment -*- coding: utf-8 -*- comment map function f x begin return x * x end function comment map()作为高阶函数,事实上它把运算规则抽象 set r = map f list 1 2 3 4 5 6 7 8 9 print list r comment 把这个list所有数字转为字符 print list map str list 1 2 3 4 5 6 7 8 9 comment reduce comment reduce把一个函数作用在一个序列[x1, x2, x3, ....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- #map def f(x): return x * x #map()作为高阶函数,事实上它把运算规则抽象 r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9]) print(list(r)) #把这个list所有数字转为字符 print(list(map(str, [1, 2, 3, 4, 5, 6, 7, 8, 9]))) #reduce # reduce把一个函数作用在一个序列[x1, x2, x3, ...]上, # 这个函数必须接收两个参数,reduce把结果继续和序列的下一个元素做累积计算 # ...
Python
zaydzuhri_stack_edu_python
string Maintain a seperate serializer class for experience to handle custom types. Add custom types to the dicts below. Use compression to shrink the experiences. import pyarrow as pa comment Add custom types here as required. set CUSTOM_TYPES = dict set SERIALIZERS = dict set DESERIALIZERS = dict comment same keys ...
""" Maintain a seperate serializer class for experience to handle custom types. Add custom types to the dicts below. Use compression to shrink the experiences. """ import pyarrow as pa # Add custom types here as required. CUSTOM_TYPES = {} SERIALIZERS = {} DESERIALIZERS = {} # same keys should be declared in a...
Python
zaydzuhri_stack_edu_python
set capitalized_words = list comprehension capitalize word for word in words comment Output: ['The', 'Quick', 'Brown', 'Fox'] print capitalized_words
capitalized_words = [word.capitalize() for word in words] print(capitalized_words) # Output: ['The', 'Quick', 'Brown', 'Fox']
Python
jtatman_500k
function testRecord self begin set topic = string http://example.com/feed1 set topic2 = string http://example.com/feed2 comment alphabetical on the hash of this set topic3 = string http://example.com/feed3-124 put list call create topic call create topic2 call create topic3 assert true call get_by_topic topic is none a...
def testRecord(self): topic = 'http://example.com/feed1' topic2 = 'http://example.com/feed2' topic3 = 'http://example.com/feed3-124' # alphabetical on the hash of this db.put([KnownFeed.create(topic), KnownFeed.create(topic2), KnownFeed.create(topic3)]) self.assertTrue(FeedToFetch.get_b...
Python
nomic_cornstack_python_v1
function mac_addr address begin return join string : generator expression string %02x % call compat_ord b for b in address end function
def mac_addr(address): return ':'.join('%02x' % compat_ord(b) for b in address)
Python
nomic_cornstack_python_v1
function _ConvertAnyMessage self value message path begin if is instance value dict and not value begin return end try begin set type_url = value at string @type end except KeyError begin raise call ParseError format string @type is missing when parsing any message at {0} path end try begin set sub_message = call _Crea...
def _ConvertAnyMessage(self, value, message, path): if isinstance(value, dict) and not value: return try: type_url = value['@type'] except KeyError: raise ParseError( '@type is missing when parsing any message at {0}'.format(path)) try: sub_message = _CreateMessageFrom...
Python
nomic_cornstack_python_v1
from selenium import webdriver set driver = call Chrome try begin get driver string http://python.org input string W nowym oknie Chrome powinna załadować się strona python.org end finally begin call quit end
from selenium import webdriver driver = webdriver.Chrome() try: driver.get('http://python.org') input('W nowym oknie Chrome powinna załadować się strona python.org') finally: driver.quit()
Python
zaydzuhri_stack_edu_python
function test_like_mission self begin with client as c begin with call session_transaction as sess begin set sess at string user_id = id end add session mission set resp = post string /v1/mission/like { id } end assert equal json at string success string added set mission = get query id assert equal likes set literal 0...
def test_like_mission(self): with self.client as c: with c.session_transaction() as sess: sess['user_id'] = self.user2.id db.session.add(self.mission) resp = c.post(f'/v1/mission/like{self.mission.id}') self.assertEqual(resp.json['success'], 'added'...
Python
nomic_cornstack_python_v1
function forward self x identity=none begin set out = call layers x if not add_identity begin return call dropout_layer out end if identity is none begin set identity = x end return identity + call dropout_layer out end function
def forward(self, x, identity=None): out = self.layers(x) if not self.add_identity: return self.dropout_layer(out) if identity is None: identity = x return identity + self.dropout_layer(out)
Python
nomic_cornstack_python_v1
comment Obtener la fecha y hora actuales import datetime set ahora = now print ahora print string format time ahora string %d/%m/%Y %H:%M%S print year comment strftime cadena de formateo set hora = time set fecha = call date print hora string print fecha comment propiedades del objeto Hora print hour minute second comm...
# Obtener la fecha y hora actuales import datetime ahora = datetime.datetime.now() print(ahora) print(ahora.strftime('%d/%m/%Y %H:%M%S' "\n") ) print(datetime.date.today().year) #strftime cadena de formateo # hora = ahora.time() fecha = ahora.date() print(hora, "\n") print(fecha) print(hora.hour, hora.minute...
Python
zaydzuhri_stack_edu_python
while true begin set path = string /var/www/html/audio_counter/data3.txt set loket_3 = open path string r set lihat = read loket_3 set data = integer lihat comment writeNumber(data) print string Pin 09 Next print data close loket_3 sleep 1 end
while True: path = '/var/www/html/audio_counter/data3.txt' loket_3 = open(path,'r') lihat = loket_3.read() data = int(lihat) #writeNumber(data) print ("Pin 09 Next") print (data) loket_3.close() time.sleep(1)
Python
zaydzuhri_stack_edu_python
function is_sorted arr cur=0 begin if cur <= length arr - 2 begin if arr at cur <= arr at cur + 1 begin return call is_sorted arr cur + 1 end else begin return false end end else begin return true end end function function sel_swap arr max_run_size cur=0 cur_max=0 begin if cur >= max_run_size begin if arr at cur <= arr...
def is_sorted (arr,cur=0) : if cur <= len(arr)-2 : if arr[cur] <= arr[cur+1] : return is_sorted(arr,cur+1) else : return False else : return True def sel_swap(arr,max_run_size,cur=0,cur_max=0) : if cur >= max_run_size : if arr[cur] <= arr[cur_max] :...
Python
zaydzuhri_stack_edu_python
async function check_migration migration begin try begin set count = await call count_documents dict migration true end except Exception as e begin print e end return count > 0 end function
async def check_migration(migration): try: count = await db.Migrations.count_documents({migration: True}) except Exception as e: print(e) return count > 0
Python
nomic_cornstack_python_v1
comment !/usr/local/bin/python3 comment -*- coding:utf-8 -*- string @author: @file: 剑指 Offer 06. 从尾到头打印链表.py @time: 2020/12/3 11:08 @desc: from typing import List string 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 输入:head = [1,3,2] 输出:[2,3,1] 限制: 0 <= 链表长度 <= 10000 comment Definition for singly-linked list. class ListNode...
#!/usr/local/bin/python3 # -*- coding:utf-8 -*- """ @author: @file: 剑指 Offer 06. 从尾到头打印链表.py @time: 2020/12/3 11:08 @desc: """ from typing import List """ 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。   示例 1: 输入:head = [1,3,2] 输出:[2,3,1]   限制: 0 <= 链表长度 <= 10000 """ # Definition for singly-linked list. class ListNode: ...
Python
zaydzuhri_stack_edu_python
function next self season begin return first call order_by string start end function
def next(self, season): return self.filter(start__gt=season.end).order_by('start').first()
Python
nomic_cornstack_python_v1
function find_neighbors_of_interest self screen_name begin set neighbors = call find_neighbors screen_name return intersection neighbors names_of_interest end function
def find_neighbors_of_interest(self, screen_name): neighbors = self.find_neighbors(screen_name) return neighbors.intersection(self.names_of_interest)
Python
nomic_cornstack_python_v1
class Solution begin function isPossible self nums begin set results = list for num in nums begin for j in range length results - 1 - 1 - 1 begin if results at j at 0 == num - 1 begin set results at j = tuple num results at j at 1 + 1 break end end for else begin append results tuple num 1 end end for res in results b...
class Solution: def isPossible(self, nums: list) -> bool: results = [] for num in nums: for j in range(len(results) - 1, -1, -1): if results[j][0] == num - 1: results[j] = (num, results[j][1] + 1) break else: ...
Python
zaydzuhri_stack_edu_python
function sync test_case begin decorator wraps test_case function run_sync *args **kwargs begin set coro = call test_case *args keyword kwargs try begin set event = none while true begin set event = call send event comment pragma: no cover if not is instance event PingPong begin raise call RuntimeError string test case ...
def sync(test_case: Callable[..., Coroutine]): @wraps(test_case) def run_sync(*args, **kwargs): coro = test_case(*args, **kwargs) try: event = None while True: event = coro.send(event) if not isinstance(event, PingPong): # pragma: no cove...
Python
nomic_cornstack_python_v1
string Driver for STMicroelectronics L3GD20 gyro for MicroPython. This driver assumes a SPI device and a chip select (CS) pin given to the constructor. The following example assumes that the CS is connected to the "PC1" pin and spi bus 5 is used. >>> from pyb import Pin >>> cs = Pin('PC1', Pin.OUT_PP, Pin.PULL_NONE) >>...
""" Driver for STMicroelectronics L3GD20 gyro for MicroPython. This driver assumes a SPI device and a chip select (CS) pin given to the constructor. The following example assumes that the CS is connected to the "PC1" pin and spi bus 5 is used. >>> from pyb import Pin >>> cs = Pin('PC1', Pin.OUT_PP, Pin.PULL_NONE) >>...
Python
zaydzuhri_stack_edu_python
string Constrain the effects of viewing angle. Requires comparisons between all sets of fiducial faces. import sys import os from pandas import DataFrame import numpy as np from multiprocessing import Manager from datetime import datetime from wrapping_function import stats_wrapper from turbustat.statistics import stat...
''' Constrain the effects of viewing angle. Requires comparisons between all sets of fiducial faces. ''' import sys import os from pandas import DataFrame import numpy as np from multiprocessing import Manager from datetime import datetime from wrapping_function import stats_wrapper from turbustat.statistics import ...
Python
zaydzuhri_stack_edu_python
function _VersionBaseURL request begin if local_mode begin set version_base = string %s://%s % tuple scheme host end else begin set version_base = string %s://%s-dot-%s % tuple scheme call get_current_version_name call get_default_version_hostname end return version_base end function
def _VersionBaseURL(request): if settings.local_mode: version_base = '%s://%s' % (request.scheme, request.host) else: version_base = '%s://%s-dot-%s' % ( request.scheme, modules.get_current_version_name(), app_identity.get_default_version_hostname()) return version_base
Python
nomic_cornstack_python_v1
function make_path_agadir_3dots_dirs path_root path_fastafile begin set path_fastafile_split_to_list = split path_fastafile string / set path_agadir_3dots_dirs = list set copy_from_here = false for path_dir in path_fastafile_split_to_list at slice : - 3 : begin if path_dir == string begin continue end if value in p...
def make_path_agadir_3dots_dirs(path_root: str, path_fastafile: str): path_fastafile_split_to_list = path_fastafile.split('/') path_agadir_3dots_dirs = [] copy_from_here = False for path_dir in path_fastafile_split_to_list[:-3]: if path_dir == '': continue ...
Python
nomic_cornstack_python_v1
class Player begin function __init__ self name begin set name = name set game = none set turn = none set score = none end function function move self move begin pass end function function evaluate self board begin pass end function function check_win_board self board begin try begin set n = length board set bool_ = fal...
class Player: def __init__(self, name: str): self.name = name self.game = None self.turn = None self.score = None def move(self, move: str): pass def evaluate(self, board) -> int: pass def check_win_board(self,board): try: ...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- set n = string ano set cont1 = 80000 set cont2 = 200000 set taxa1 = 0.03 set taxa2 = 0.015
# -*- coding: utf-8 -*- n=('ano') cont1=80000 cont2=200000 taxa1=0.03 taxa2=0.015
Python
zaydzuhri_stack_edu_python
function convert_fahr_to_cels deg_fahr begin return round deg_fahr - 32 * 5 / 9 2 end function function convert begin set deg_fahr = decimal input string Temperature F? print format string It is {} degrees Celsius. call convert_fahr_to_cels deg_fahr end function if __name__ == string __main__ begin call convert end
def convert_fahr_to_cels(deg_fahr): return round((deg_fahr - 32) * 5 / 9, 2) def convert(): deg_fahr = float(input('Temperature F? ')) print('It is {} degrees Celsius.'.format(convert_fahr_to_cels(deg_fahr))) if __name__ == '__main__': convert()
Python
zaydzuhri_stack_edu_python
function break_words stuff begin set words = split stuff string return words end function function sort_word words begin return sorted words end function function print_first_word words begin set word = pop words 0 print word end function function print_last_world words begin set word = pop words - 1 print word end fun...
def break_words(stuff): words = stuff.split(' ') return words def sort_word(words): return sorted(words) def print_first_word(words): word = words.pop(0) print(word) def print_last_world(words): word = words.pop(-1) print(word) def sort_sentence(setence): words = break_words(sete...
Python
zaydzuhri_stack_edu_python
import numpy as np import random as ran import os comment --- Lee y recupera la informacion de las comment ---------conexiones y los nodos function openFile ruta begin set data = open ruta string r return data end function comment Recuperar Datos de un archivo con 1 columna function formatA data begin set matrix = list...
import numpy as np import random as ran import os ##--- Lee y recupera la informacion de las ##---------conexiones y los nodos def openFile(ruta): data = open(ruta,"r") return data # Recuperar Datos de un archivo con 1 columna def formatA(data): matrix = [] for line in data: a = float(line) matrix.ap...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python3 from datetime import date from datetime import timedelta from PIL import Image import math set min = 0 set num = 65 for min in range num begin if min % 50 == 0 begin print min end set im = open format min string 02d + string .ppm set pix = load im save string Converted/ + format min string...
#!/usr/bin/env python3 from datetime import date from datetime import timedelta from PIL import Image import math min = 0 num = 65 for min in range(num): if (min%50) == 0: print(min) im = Image.open(format(min, '02d')+".ppm") pix = im.load() im.save("Converted/"+format(min,'02d')+".png") min += 1
Python
zaydzuhri_stack_edu_python
from pytest学习过程与作业.pytest01.Calculator import Calculator import pytest import yaml function get_add_datas begin try begin with open string ./datas/data_add.yaml encoding=string utf-8 as f begin set datas = call safe_load f return datas end end comment safe_load(stram),传入的是文件流,所以将打开的yam文件流传入; comment 目的就是将yam对象,转化为pytho...
from pytest学习过程与作业.pytest01.Calculator import Calculator import pytest import yaml def get_add_datas(): try: with open("./datas/data_add.yaml", encoding='utf-8')as f: datas = yaml.safe_load(f) return datas # safe_load(stram),传入的是文件流,所以将打开的yam文件流传入; # 目的就是将y...
Python
zaydzuhri_stack_edu_python
from program import * from utilities import * from differentiation import * import random import signal class EvaluationTimeout extends Exception begin pass end class set EVALUATIONTABLE = dict class Task extends object begin function __init__ self name request examples features=none cache=false begin string request: ...
from program import * from utilities import * from differentiation import * import random import signal class EvaluationTimeout(Exception): pass EVALUATIONTABLE = {} class Task(object): def __init__(self, name, request, examples, features = None, cache = False): '''request: the type of this task ...
Python
zaydzuhri_stack_edu_python
comment %% import numpy as np import re import time import tensorflow as tf comment %% set lines = split read open string Data/movie_lines.txt encoding=string utf-8 errors=string ignore string set conversations = split read open string Data/movie_conversations.txt encoding=string utf-8 errors=string ignore string comme...
#%% import numpy as np import re import time import tensorflow as tf # %% lines = open('Data/movie_lines.txt',encoding='utf-8',errors='ignore').read().split('\n') conversations = open('Data/movie_conversations.txt',encoding='utf-8',errors='ignore').read().split('\n') # %% '''making dictionary to map each line with ...
Python
zaydzuhri_stack_edu_python
comment Sort the following string alphabetically, from z to a, and assign it to the variable sorted_letters. set letters = string alwnfiwaksuezlaeiajsdl set sorted_letters = sorted letters reverse=true
#Sort the following string alphabetically, from z to a, and assign it to the variable sorted_letters. letters = "alwnfiwaksuezlaeiajsdl" sorted_letters = sorted(letters, reverse = True)
Python
zaydzuhri_stack_edu_python
import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords import itertools import numpy as np import torch.utils.data as utils from PIL import Image import torch import PIL.ImageOps from torch.utils.data import Dataset , DataLoader from torchvision import datasets import torchvision.transfor...
import nltk from nltk.tokenize import word_tokenize from nltk.corpus import stopwords import itertools import numpy as np import torch.utils.data as utils from PIL import Image import torch import PIL.ImageOps from torch.utils.data import Dataset, DataLoader from torchvision import datasets import torchvision.transfo...
Python
zaydzuhri_stack_edu_python
function start self begin call init_network call create_nodes call setup_environment end function
def start(self): self.init_network() self.create_nodes() self.setup_environment()
Python
nomic_cornstack_python_v1
function channel_shuffle x groups begin set tuple batch_size channels height width = size x assert channels % groups == 0 set channels_per_group = channels // groups comment split into groups set x = view x batch_size groups channels_per_group height width comment transpose 1, 2 axis set x = contiguous transpose x 1 2 ...
def channel_shuffle(x, groups): batch_size, channels, height, width = x.size() assert channels % groups == 0 channels_per_group = channels // groups # split into groups x = x.view(batch_size, groups, channels_per_group, height, width) # transpose 1, 2 axis x = x.transpose(1, 2).contiguous() ...
Python
nomic_cornstack_python_v1
comment You are given a positive integer num. You may swap any two digits of num that comment have the same parity (i.e. both odd digits or both even digits). comment Return the largest possible value of num after any number of swaps. comment Example 1: comment Input: num = 1234 comment Output: 3412 comment Explanation...
# You are given a positive integer num. You may swap any two digits of num that # have the same parity (i.e. both odd digits or both even digits). # # Return the largest possible value of num after any number of swaps. # # # Example 1: # # # Input: num = 1234 # Output: 3412 # Explanation: Swap the digit 3 ...
Python
zaydzuhri_stack_edu_python
function savePolyData name polydata asciiorbin=string binary begin set name = call splitext name at 0 + string .vtk set writer = call vtkPolyDataWriter call SetFileName name if asciiorbin == string binary begin call SetFileTypeToBinary end else begin call SetFileTypeToASCII end call SetInput polydata write writer end f...
def savePolyData(name, polydata, asciiorbin='binary'): name = os.path.splitext(name)[0] + '.vtk' writer = vtk.vtkPolyDataWriter() writer.SetFileName(name) if asciiorbin == 'binary': writer.SetFileTypeToBinary() else: writer.SetFileTypeToASCII() writer.SetInput(polydata) write...
Python
nomic_cornstack_python_v1
function get_client self begin return client end function
def get_client(self): return self.client
Python
nomic_cornstack_python_v1
function getFirstKeyForReadsetId readsetId begin return call from_path string GenomicsCoverageStatistics readsetId + __SEP end function
def getFirstKeyForReadsetId(readsetId): return db.Key.from_path("GenomicsCoverageStatistics", readsetId + GenomicsCoverageStatistics.__SEP)
Python
nomic_cornstack_python_v1