code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
function create self request begin set serializer = call HelloSerializer data=data if call is_valid begin set name = get data string name set message = string Hello { name } return call Response dict string message message end else begin return call Response errors status=HTTP_400_BAD_REQUEST end end function
def create(self, request): serializer = serializers.HelloSerializer(data=request.data) if serializer.is_valid(): name = serializer.data.get('name') message = f'Hello {name}' return Response({'message': message}) else: return Response(serializer...
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python3 comment -*- coding: utf-8 -*- string Created on Wed Mar 21 15:08:49 2018 @author: ermanbekaroglu import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D function styblinski x y begin return 1.0 / 2 * x ^ 4 - 16 * x ^ 2 + 5 * x + y ^ 4 - 16 * y ^ 2 + ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 21 15:08:49 2018 @author: ermanbekaroglu """ import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D def styblinski(x,y): return(1.0/2*(x**4-16*x**2+5*x+y**4-16*y**2+5*y)) def ackley2d(x, y, a=2...
Python
zaydzuhri_stack_edu_python
function ask_create_post begin set blog_name = input string Enter the blog title you want to write a post in: set title = input string Enter your post title: set content = input string Enter your post content: call create_post title content end function
def ask_create_post(): blog_name = input("Enter the blog title you want to write a post in:\n") title = input("Enter your post title:\n") content = input("Enter your post content:\n") blogs[blog_name].create_post(title, content)
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8 -*- string Created on Wed Mar 11 00:20:49 2020 @author: nxf55806 import random import numpy as np class innings begin set _registry = list function __init__ self name begin append _registry self set name = name end function function add_batsmen self batsmen begin set batsmen = batsmen end fun...
# -*- coding: utf-8 -*- """ Created on Wed Mar 11 00:20:49 2020 @author: nxf55806 """ import random import numpy as np class innings: _registry = [] def __init__(self, name): self._registry.append(self) self.name = name def add_batsmen(self, batsmen): self.batsmen =...
Python
zaydzuhri_stack_edu_python
function get_width self begin string Compute width of each surface element, and return area-weighted average value (in km). set areas = call _get_areas set widths = array list comprehension call get_width for surf in surfaces return sum areas * widths / sum areas end function
def get_width(self): """ Compute width of each surface element, and return area-weighted average value (in km). """ areas = self._get_areas() widths = numpy.array([surf.get_width() for surf in self.surfaces]) return numpy.sum(areas * widths) / numpy.sum(areas)
Python
jtatman_500k
function second_largest lst begin set sorted_list = sorted lst return sorted_list at - 2 end function set result = call second_largest lst print result
def second_largest(lst): sorted_list = sorted(lst) return sorted_list[-2] result = second_largest(lst) print(result)
Python
flytech_python_25k
function nodes self begin return iterate edges end function
def nodes(self): return iter(self.edges)
Python
nomic_cornstack_python_v1
function square x begin return x * x end function set sqnum = call square 2 print sqnum set sqnumfunc = square set sqnum2 = call sqnumfunc 20 print sqnum2 comment Higher order function Map comment easy way to take function and apply to list set numbers = list 1 2 3 4 5 set sqnum3 = list map square numbers print sqnum3 ...
def square(x): return x*x sqnum = square(2) print (sqnum) sqnumfunc = square sqnum2 = sqnumfunc(20) print (sqnum2) # Higher order function Map # easy way to take function and apply to list numbers = [1,2,3,4,5] sqnum3=list(map(square, numbers)) print (sqnum3) # lambda functions (anonymous functions) numbers4 = [...
Python
zaydzuhri_stack_edu_python
function read_mods begin return list comprehension base name path o for o in glob glob get paths string mods string * if is directory path o and call is_compatible string mods base name path o end function
def read_mods(): return [os.path.basename(o) for o in glob.glob(paths.get('mods', '*')) if os.path.isdir(o) and manifest.is_compatible('mods', os.path.basename(o))]
Python
nomic_cornstack_python_v1
function send_to_list_of_people self people msg begin comment Currently not used. If I dediced to add groups comment to the app, then I will use this method. for client in people begin call _send_msg client msg end end function
def send_to_list_of_people(self, people, msg): # Currently not used. If I dediced to add groups # to the app, then I will use this method. for client in people: self._send_msg(client, msg)
Python
nomic_cornstack_python_v1
function create_bag_feature_selection n_instances relevant_features_idx feature_names sfa_words remove_repeat_words begin set relevant_features = call empty key_type=uint32 value_type=uint32 for tuple k v in zip feature_names at relevant_features_idx array range length relevant_features_idx dtype=uint32 begin set relev...
def create_bag_feature_selection( n_instances, relevant_features_idx, feature_names, sfa_words, remove_repeat_words ): relevant_features = Dict.empty(key_type=types.uint32, value_type=types.uint32) for k, v in zip( feature_names[relevant_features_idx], np.arange(len(relevant_features_idx), d...
Python
nomic_cornstack_python_v1
set var = input set var1 = input set var2 = input if var > var1 and var > var2 begin print var end else if var1 > var and var1 > var2 begin print var1 end else begin print var2 end
var=input() var1=input() var2=input() if(var>var1)and(var>var2): print(var) elif(var1>var)and(var1>var2): print(var1) else: print(var2)
Python
zaydzuhri_stack_edu_python
function writeDictFile filePath dictToWrite begin set fileId = open filePath string w write fileId call pformat dictToWrite close fileId end function
def writeDictFile(filePath, dictToWrite): fileId = open(filePath, 'w') fileId.write(pprint.pformat(dictToWrite)) fileId.close()
Python
nomic_cornstack_python_v1
comment / comment 'ORGANIZATION AND SIMULTANEOUS FITS' ROOT.RooFit tutorial macro #504 comment Using ROOT.RooSimWSTool to construct a simultaneous p.d.f that is built comment of variations of an input p.d.f comment 07/2008 - Wouter Verkerke comment / import ROOT function rf504_simwstool begin comment C r e a t e m a s ...
# / # # 'ORGANIZATION AND SIMULTANEOUS FITS' ROOT.RooFit tutorial macro #504 # # Using ROOT.RooSimWSTool to construct a simultaneous p.d.f that is built # of variations of an input p.d.f # # # 07/2008 - Wouter Verkerke # # / import ROOT def rf504_simwstool(): # C r e a t e m a s t e r p d f # ----------...
Python
zaydzuhri_stack_edu_python
function upload_checkpoint bucket_namespace bucket_name prefix checkpoint_filepath begin set bucket_prefix = prefix set dst_path = string { bucket_prefix } / { checkpoint_filepath } comment dst_path = f"{bucket_prefix}/{target_filepath}" print format string Uploading {} => {} checkpoint_filepath dst_path set bucket = c...
def upload_checkpoint( bucket_namespace: str, bucket_name: str,prefix:str, checkpoint_filepath: Union[Path, str] ): bucket_prefix = prefix dst_path = f"{bucket_prefix}/{checkpoint_filepath}" # dst_path = f"{bucket_prefix}/{target_filepath}" print('Uploading {} => {}'.format(checkpoint_filep...
Python
nomic_cornstack_python_v1
function dependency_order self begin set seen = set function _prune_visited node begin if node in seen begin return true end add seen node return false end function for target in targets begin if target in seen begin continue end for node in call postorder prune_fn=_prune_visited begin yield data end end end function
def dependency_order(self): seen = set() def _prune_visited(node): if node in seen: return True seen.add(node) return False for target in self.targets: if target in seen: continue for node in target.pos...
Python
nomic_cornstack_python_v1
import picamera import RPi.GPIO as GPIO import threading import os import time import logging call basicConfig filename=string timelapse.log level=DEBUG format=string %(asctime)s %(message)s call addHandler call StreamHandler set event_start = event comment pin 7 set GPIO_INPUT_BCM = 4 comment BCM mode is required to e...
import picamera import RPi.GPIO as GPIO import threading import os import time import logging logging.basicConfig(filename='timelapse.log', level=logging.DEBUG, format='%(asctime)s %(message)s') logging.getLogger().addHandler(logging.StreamHandler()) event_start = threading.Event() GPIO_INPUT_BCM = 4 # p...
Python
zaydzuhri_stack_edu_python
import json class JsonEncoderInterface begin function to_json self begin raise exception string need implement end function end class class JsonEncoder extends JSONEncoder begin function default self o begin if is subclass __class__ JsonEncoderInterface begin return to json o end return call default self o end function...
import json class JsonEncoderInterface: def to_json(self): raise Exception('need implement') class JsonEncoder(json.JSONEncoder): def default(self, o): if issubclass(o.__class__, JsonEncoderInterface): return o.to_json() return json.JSONEncoder.default(self, o)
Python
zaydzuhri_stack_edu_python
import warnings filter warnings string ignore import pandas as pd import numpy as np import lightgbm as lgb from sklearn.model_selection import KFold from sklearn.metrics import accuracy_score comment データの読み込み set df_train = read csv string ./all/train.csv set df_test = read csv string ./all/test.csv set df_gender_subm...
import warnings warnings.filterwarnings('ignore') import pandas as pd import numpy as np import lightgbm as lgb from sklearn.model_selection import KFold from sklearn.metrics import accuracy_score # データの読み込み df_train = pd.read_csv("./all/train.csv") df_test = pd.read_csv("./all/test.csv") df_gender_submission = pd.re...
Python
zaydzuhri_stack_edu_python
from django.shortcuts import render , HttpResponse , redirect import random comment Create your views here. function index request begin if string gold not in session begin set session at string gold = 0 set session at string activity = list end return call render request string ng_interface.html end function function...
from django.shortcuts import render, HttpResponse, redirect import random # Create your views here. def index(request): if "gold" not in request.session: request.session['gold'] = 0 request.session['activity'] = [] return render(request,'ng_interface.html') def process(request): request.s...
Python
zaydzuhri_stack_edu_python
function get_text self begin if is file path destination begin set pdf = call read_from_text end else begin set pdf = convert_to_text call save_text_to_file pdf end return pdf end function
def get_text(self): if os.path.isfile(self.destination): pdf = self.read_from_text() else: pdf = self.convert_to_text self.save_text_to_file(pdf) return pdf
Python
nomic_cornstack_python_v1
string Effect of plankton composition shifts in the North Atlantic on atmospheric pCO2 Boot, A., von der Heydt, A.S., and Dijkstra, H.A. (2022) Script for plotting Figure S15a-f Necessary ESGF datasets: - CMIP6.C4MIP.NCAR.CESM2.esm-ssp585.r1i1p1f1.Oyr.phydiat.gn - CMIP6.C4MIP.NCAR.CESM2.esm-ssp585.r1i1p1f1.Oyr.phypico....
""" Effect of plankton composition shifts in the North Atlantic on atmospheric pCO2 Boot, A., von der Heydt, A.S., and Dijkstra, H.A. (2022) Script for plotting Figure S15a-f Necessary ESGF datasets: - CMIP6.C4MIP.NCAR.CESM2.esm-ssp585.r1i1p1f1.Oyr.phydiat.gn - CMIP6.C4MIP.NCAR.CESM2.esm-ssp585.r1i1p1f1.Oyr.phypico.g...
Python
zaydzuhri_stack_edu_python
import random function primes_sieve limit begin string Finding array of prime numbers in range from 0 to limit :param limit: max value of number to find prime :return: list of prime numbers set a = list true * limit set a at 0 = false set a at 1 = false for tuple i is_num_prime in enumerate a begin if is_num_prime begi...
import random def primes_sieve(limit): """ Finding array of prime numbers in range from 0 to limit :param limit: max value of number to find prime :return: list of prime numbers """ a = [True] * limit a[0] = a[1] = False for (i, is_num_prime) in enumerate(a): if is_num_prime: ...
Python
zaydzuhri_stack_edu_python
function _set_state self v load=false begin if has attribute v string _utype begin set v = call _utype v end try begin set t = call YANGDynClass v base=yc_state_openconfig_mpls_igp__mpls_lsps_constrained_path_tunnels_tunnel_bandwidth_auto_bandwidth_overflow_state is_container=string container yang_name=string state par...
def _set_state(self, v, load=False): if hasattr(v, "_utype"): v = v._utype(v) try: t = YANGDynClass(v,base=yc_state_openconfig_mpls_igp__mpls_lsps_constrained_path_tunnels_tunnel_bandwidth_auto_bandwidth_overflow_state, is_container='container', yang_name="state", parent=self, path_helper=self._path...
Python
nomic_cornstack_python_v1
import time set startNumber = integer input string Enter the start number here set endNumber = integer input string Enter the end number here set start_time = time function fib n begin if n < 2 begin return n end return call fib n - 2 + call fib n - 1 end function print fib range startNumber endNumber print string --- ...
import time startNumber = int(input("Enter the start number here ")) endNumber = int(input("Enter the end number here ")) start_time = time.time() def fib(n): if n < 2: return n return fib(n-2) + fib(n-1) print(fib, range(startNumber, endNumber)) print("--- %s seconds ---" % (time.time() - st...
Python
zaydzuhri_stack_edu_python
string __init__ # Private and Protected methods class Invoice begin function __init__ self client total begin set client = client set total = total end function function __str__ self begin return string Invoice from { client } for $ { total } end function function __repr__ self begin return string Invoice <value: { cli...
""" __init__ # Private and Protected methods """ class Invoice: def __init__(self, client, total): self.client = client self.total = total def __str__(self): return f"Invoice from {self.client} for ${self.total}" def __repr__(self): return f"Invoice <value: {self.client},...
Python
zaydzuhri_stack_edu_python
function _alter_project **kwargs begin set sql = format string select * from alter_project( {}::integer, '{}'::character varying, '{}'::text, {}::integer, {}::integer, {}::integer, {}::integer, {}::double precision, '{}'::date, '{}'::date, '{}'::character varying) AS result( rc integer, msg text ) kwargs at string id k...
def _alter_project(**kwargs): sql = """select * from alter_project( {}::integer, '{}'::character varying, '{}'::text, {}::integer, {}::integer, {}::integer, {}::integer, {}::double precision, '{}'::date, '{}'::date, '{}'::charac...
Python
nomic_cornstack_python_v1
function start self begin print string Creating log file call start_log string Logs string NavLog.txt print string starting connection start connection print string Closing log file call stop_log end function
def start(self): print("Creating log file") self.start_log("Logs", "NavLog.txt") print("starting connection") self.connection.start() print("Closing log file") self.stop_log()
Python
nomic_cornstack_python_v1
function get_links self begin comment if there are not enough links in the buffer if length _buffer < _buffer_size_threshold begin try begin comment manager would return links together with a comment message(self.focusing), which tell the crawler whether it comment should still be focused-crawling or not set tuple focu...
def get_links(self): # if there are not enough links in the buffer if len(self._buffer) < self._buffer_size_threshold: try: # manager would return links together with a # message(self.focusing), which tell the crawler whether it # should still...
Python
nomic_cornstack_python_v1
set my_list = list 1 16 81 256 625
my_list = [1, 16, 81, 256, 625]
Python
flytech_python_25k
function _readloop self begin while _ll_alive begin with _rx_lock begin set data = call _Random 1 comment check for timeout if length data != 0 begin put data end end end end function
def _readloop(self): while self._ll_alive: with self._rx_lock: data = self._Random(1) if len(data) != 0: # check for timeout self._uart_rx_queue.put(data)
Python
nomic_cornstack_python_v1
import book_analysis from pathlib import Path comment main set zh_book = call Path string zh_book with open string name.txt string r encoding=string utf-8 as f begin set name = call splitlines end for each in recursive glob zh_book string *.txt begin set content = call READFILE each comment 返回人物字典、段落共存列表和人物关系字典 set tup...
import book_analysis from pathlib import Path #main zh_book= Path(r"zh_book") with open("name.txt", "r", encoding = "utf-8") as f: name = f.read().splitlines() for each in zh_book.rglob("*.txt"): content = book_analysis.READFILE(each) names_dic,name_list,relation_dic = book_analysis.Content_analysis(content,name)...
Python
zaydzuhri_stack_edu_python
function hangman begin global word length count display already_guessed word_to_guess set limit = 5 set guess = strip input string This is the Hangman Word: + display + string Enter your guess: if length guess != 1 or is digit guess begin print string Invalid. Write a letter. end else if guess in word begin extend alre...
def hangman(): global word, length, count, display, already_guessed, word_to_guess limit = 5 guess = input("This is the Hangman Word: " + display + " Enter your guess: \n").strip() if len(guess) != 1 or guess.isdigit(): print("Invalid. Write a letter. \n") elif guess i...
Python
nomic_cornstack_python_v1
function test_validation_of_account_type self begin set row = list string Michael string Murwayi string MichaelMurwayi 420 string save string Thika string 0746256084 set expected_value = tuple string provide valid account type list string Michael string Murwayi string MichaelMurwayi 420 string save string Thika string ...
def test_validation_of_account_type(self): row = [ "Michael", "Murwayi", "MichaelMurwayi", 420, "save", "Thika", "0746256084", ] expected_value = ( "provide valid account type", [ ...
Python
nomic_cornstack_python_v1
function a_power_b a b begin set contador = 1 for i in range 0 b begin set contador = contador * a end return contador end function while true begin set x = integer input string ingrese el numero bro if x == 0 begin print string no sirve break end set y = integer input string ingrese el segundo numero set que = call a_...
def a_power_b(a, b): contador=1 for i in range(0, b): contador=contador*a return contador while True: x=int(input("ingrese el numero bro")) if x==0: print("no sirve") break y=int(input("ingrese el segundo numero")) que= a_power_b(x,y) print(que)
Python
zaydzuhri_stack_edu_python
function test_wavelet_errors self begin comment too high center frequency set kwds = dict string signal test_data ; string freq fs / 2 assert raises ValueError wavelet_transform keyword kwds set kwds = dict string signal test_data_arr ; string freq fs / 2 ; string fs fs assert raises ValueError wavelet_transform keywor...
def test_wavelet_errors(self): # too high center frequency kwds = {'signal': self.test_data, 'freq': self.fs / 2} self.assertRaises( ValueError, elephant.signal_processing.wavelet_transform, **kwds) kwds = { 'signal': self.test_data_arr, 'freq': self.f...
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python3 comment -*- coding: utf-8 -*- set __author__ = string Erik YU import calendar import datetime function ymd2date ymd se=string N begin set date = call date integer ymd at slice 0 : 4 : integer ymd at slice 4 : 6 : integer ymd at slice 6 : 8 : if se == string S begin set date = call calmonth...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Erik YU' import calendar import datetime def ymd2date(ymd, se='N'): date = datetime.date(int(ymd[0:4]), int(ymd[4:6]), int(ymd[6:8])) if se == 'S': date = calmonths(date) elif se == 'E': date = calmonthe(date) return date ...
Python
zaydzuhri_stack_edu_python
function serve port begin run host=string 0.0.0.0 port=port debug=true end function
def serve(port): app.run(host='0.0.0.0', port=port, debug=True)
Python
nomic_cornstack_python_v1
import numpy as np import cv2 import matplotlib.pyplot as plt import os set img = call imread string E:\idk\road main.jpeg set tuple r c _ = shape set blank = zeros tuple r c dtype=uint8 set blanktest = zeros tuple r c dtype=uint8 set gray = call cvtColor img COLOR_BGR2GRAY set gauss = call GaussianBlur gray tuple 5 5 ...
import numpy as np import cv2 import matplotlib.pyplot as plt import os img = cv2.imread(r'E:\idk\road main.jpeg') r,c,_=img.shape blank = np.zeros((r,c),dtype=np.uint8) blanktest = np.zeros((r,c),dtype=np.uint8) gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) gauss=cv2.GaussianBlur(gray,(5,5),0) canny = cv2.Cann...
Python
zaydzuhri_stack_edu_python
function _expand_sub_pipelines self validate=true begin info string Expand | Checking nodes for sub-pipelines set check_fanout = true for node in call topological_order begin debug string Expand | Checking %s for sub-pipeline node comment setup and render the subpipe node. We comment do this so that local variables use...
def _expand_sub_pipelines(self, validate=True): log.info("Expand | Checking nodes for sub-pipelines") check_fanout = True for node in self.topological_order(): log.debug("Expand | Checking %s for sub-pipeline", node) # setup and render the subpipe node. We # ...
Python
nomic_cornstack_python_v1
comment 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数, comment 并返回他们的数组下标。 comment 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 comment 示例: comment 给定 nums = [2, 7, 11, 15], target = 9 comment 因为 nums[0] + nums[1] = 2 + 7 = 9 comment 所以返回 [0, 1] class Solution extends object begin function twoSum self nums target begin...
# 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数, # 并返回他们的数组下标。 # 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 # 示例: # 给定 nums = [2, 7, 11, 15], target = 9 # 因为 nums[0] + nums[1] = 2 + 7 = 9 # 所以返回 [0, 1] class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :typ...
Python
zaydzuhri_stack_edu_python
comment Uses python3 import sys function euclidgcd a b begin set remainder = 1 set values = list a b while remainder > 0 begin set remainder = values at 0 % values at 1 set values at 0 = values at 1 set values at 1 = remainder end return values at 0 end function function lcd a b begin if b == 0 begin return a end retur...
# Uses python3 import sys def euclidgcd(a, b): remainder = 1 values = [a,b] while remainder > 0: remainder = values[0] % values[1] values[0] = values[1] values[1] = remainder return values[0] def lcd(a, b): if b == 0: return a return (a * b) // euclidgcd(a, b) ...
Python
zaydzuhri_stack_edu_python
function GetOrigin self begin return call itkGenerateImageSourceICVF42_GetOrigin self end function
def GetOrigin(self) -> "itkPointD2 const &": return _itkGenerateImageSourcePython.itkGenerateImageSourceICVF42_GetOrigin(self)
Python
nomic_cornstack_python_v1
function title_based_split df split_val begin comment retrieve split title and get the minimum id with that title set split_title = iloc at integer split_val * length df - 1 set split_index = min return tuple iloc at slice : split_index : iloc at slice split_index : : end function
def title_based_split(df, split_val): # retrieve split title and get the minimum id with that title split_title = df['title'].iloc[int(split_val * len(df)) - 1] split_index = df[df['title'] == split_title].index.min() return df.iloc[:split_index], df.iloc[split_index:]
Python
nomic_cornstack_python_v1
function update_recipe model_info recipe_builder begin raise call NotImplementedError end function
def update_recipe(model_info: ModelInfo, recipe_builder: RecipeYAMLBuilder): raise NotImplementedError()
Python
nomic_cornstack_python_v1
class Solution begin function singleNumber self nums begin return sum set nums * 2 - sum nums end function end class from collections import Counter class Solution begin function singleNumber self nums begin return call most_common length nums at - 1 at 0 end function end class
class Solution: def singleNumber(self, nums: List[int]) -> int: return(sum(set(nums))*2-sum(nums)) from collections import Counter class Solution: def singleNumber(self, nums: List[int]) -> int: return(Counter(nums).most_common(len(nums))[-1][0])
Python
zaydzuhri_stack_edu_python
function get_distance self a begin set dist_x = a at 0 ^ 2 set dist_y = a at 1 ^ 2 return dist_x + dist_y ^ 0.5 end function
def get_distance(self, a: list) -> float: dist_x = a[0] ** 2 dist_y = a[1] ** 2 return (dist_x + dist_y) ** 0.5
Python
nomic_cornstack_python_v1
function forward self x begin set x = relu call linear1 x set mu = call mu x set sigma = exp call sigma x set latents = mu + sigma * random sample shape return tuple latents mu sigma end function
def forward(self, x): x = self.relu(self.linear1(x)) mu = self.mu(x) sigma = torch.exp(self.sigma(x)) latents = mu + sigma*self.normal.sample(mu.shape) return latents, mu, sigma
Python
nomic_cornstack_python_v1
function encode_segmap self mask begin set mask = as type mask int set label_mask = zeros tuple shape at 0 shape at 1 dtype=int16 for tuple ii label in enumerate call get_pascal_labels begin set label_mask at where all mask == label axis=- 1 at slice : 2 : = ii end set label_mask = as type label_mask int return label...
def encode_segmap(self, mask): mask = mask.astype(int) label_mask = np.zeros((mask.shape[0], mask.shape[1]), dtype=np.int16) for ii, label in enumerate(self.get_pascal_labels()): label_mask[np.where(np.all(mask == label, axis=-1))[:2]] = ii label_mask = label_mask.astype(int)...
Python
nomic_cornstack_python_v1
function onPasswordFocusOut self event begin if get obj2 == string begin insert obj2 0 string New Password end end function
def onPasswordFocusOut(self,event): if self.obj2.get() == "": self.obj2.insert(0,"New Password")
Python
nomic_cornstack_python_v1
function hit_test self position vector max_distance=8 begin comment get m from the gamerule set m = status set tuple x y z = position set tuple dx dy dz = vector set dx = dx / m set dy = dy / m set dz = dz / m set previous = none for _ in range max_distance * m begin set key = call normalize tuple x y z set block = cal...
def hit_test( self, position: typing.Tuple[float, float, float], vector: typing.Tuple[float, float, float], max_distance: int = 8, ) -> typing.Union[ typing.Tuple[ typing.Tuple[int, int, int], typing.Tuple[int, int, int], typing.Tuple[float...
Python
nomic_cornstack_python_v1
comment ze souboru kodovac.py vkladame tridu Kodovac from kodovac import Kodovac from PyQt5 import QtWidgets , uic class MainWindow begin set window = none function set_window self window begin set window = window end function function zasifrovani self begin comment vytvorime objekt, ktery ukladame do promene kodovac s...
from kodovac import Kodovac # ze souboru kodovac.py vkladame tridu Kodovac from PyQt5 import QtWidgets, uic class MainWindow(): window = None def set_window(self, window): self.window = window def zasifrovani(self): kodovac = Kodovac() # vytvorime objekt, ktery ukladame do promene kodov...
Python
zaydzuhri_stack_edu_python
comment Soma dos n primeiros naturais set soma = 0 set x = integer input string Digite um numero: for numeros in range x + 1 begin set soma = soma + numeros end print soma
# Soma dos n primeiros naturais soma = 0 x = int(input("Digite um numero: ")) for numeros in range(x+1): soma = soma + numeros print(soma)
Python
zaydzuhri_stack_edu_python
function subjectDone self subject begin set _serialized at subject = true end function
def subjectDone(self, subject): self._serialized[subject] = True
Python
nomic_cornstack_python_v1
function checkout args begin call __resolve_uncommitted_changes_checkout args call fetch args comment collect local branch names set branches = list for branch in call __call list string git string branch begin if branch at 0 == string * begin append branches strip branch at slice 1 : : end else begin append branches...
def checkout(args): __resolve_uncommitted_changes_checkout(args) fetch(args) # collect local branch names branches = [] for branch in __call(['git', 'branch']): if branch[0] == '*': branches.append(branch[1:].strip()) else: branches.append(branch.strip()) ...
Python
nomic_cornstack_python_v1
function _getGlobalNonOverlappingCellIDs self begin return array range numberOfCells end function
def _getGlobalNonOverlappingCellIDs(self): return numerix.arange(self.numberOfCells)
Python
nomic_cornstack_python_v1
import numpy as np string def solve_linear_equations(a,b): a=np.array(a) b=np.array(b) #x = np.linalg.solve(a, b) x = np.linalg.lstsq(a, b) return x.tolist() function solve_linear_equations_dfs a b x depth begin for value in range 1 16 begin set x at depth = value if depth == length x - 1 begin set ax = matrix multiply...
import numpy as np ''' def solve_linear_equations(a,b): a=np.array(a) b=np.array(b) #x = np.linalg.solve(a, b) x = np.linalg.lstsq(a, b) return x.tolist() ''' def solve_linear_equations_dfs(a,b,x,depth): for value in range(1,16): x[depth] = value if depth == len(x)-1: ...
Python
zaydzuhri_stack_edu_python
function create_node_from_server server ip begin return call Node id=id ip=ip az=placement at string AvailabilityZone name=string state=call server_status_to_state state end function
def create_node_from_server(server, ip): return Node( id=server.id, ip=ip, az=server.placement['AvailabilityZone'], name="", state=server_status_to_state(server.state), )
Python
nomic_cornstack_python_v1
import os.path as path import cv2 import pptx from pptx.util import Inches as Inch from pptx.util import Pt from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN , MSO_AUTO_SIZE set DATADIR = join path directory name path absolute path path __file__ string data set PIXEL_TO_INCH = 1 / 96 function _get...
import os.path as path import cv2 import pptx from pptx.util import Inches as Inch from pptx.util import Pt from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN, MSO_AUTO_SIZE DATADIR = path.join(path.dirname(path.abspath(__file__)), "data") PIXEL_TO_INCH = 1/96 def _get_image_shape(im...
Python
zaydzuhri_stack_edu_python
from numpy import * from scipy import * from datetime import datetime function sigmoid z begin set g = 1.0 / 1.0 + exp - z return g end function function sigmoid_gradient z begin set g = sigmoid z * 1 - sigmoid z return g end function function initialize_weights L_in L_out begin comment random.seed(datetime.now()[-1]) ...
from numpy import * from scipy import * from datetime import datetime def sigmoid(z): g = 1.0 / (1.0 + exp(-z)) return g def sigmoid_gradient(z): g = sigmoid(z)*(1-sigmoid(z)) return g def initialize_weights(L_in, L_out): #random.seed(datetime.now()[-1]) epsilon_init = 0.12 W = rand(L_ou...
Python
zaydzuhri_stack_edu_python
async function match_work_queues self prefixes begin set page_length = 100 set current_page = 0 set work_queues = list while true begin set new_queues = await call read_work_queues offset=current_page * page_length limit=page_length work_queue_filter=call WorkQueueFilter name=call WorkQueueFilterName startswith_=prefi...
async def match_work_queues( self, prefixes: List[str], ) -> List[WorkQueue]: page_length = 100 current_page = 0 work_queues = [] while True: new_queues = await self.read_work_queues( offset=current_page * page_length, limi...
Python
nomic_cornstack_python_v1
comment !/usr/bin/python3 import socket import time import sys set ip = string set port = 21 set buffer = list set counter = 100 while length buffer < 30 begin append buffer string A * counter set counter = counter + 100 end for string in buffer begin try begin set timeout = 10 set s = call socket AF_INET SOCK_STREAM...
#!/usr/bin/python3 import socket import time import sys ip = "" port = 21 buffer = [] counter = 100 while len(buffer) < 30: buffer.append("A" * counter) counter += 100 for string in buffer: try: timeout = 10 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(tim...
Python
zaydzuhri_stack_edu_python
function subtract_days date_init_str date_final_str date_format=string %Y-%m-%d begin set date_init_dt = string parse time date_init_str date_format set date_final_dt = string parse time date_final_str date_format set time_delta = date_final_dt - date_init_dt return days end function
def subtract_days(date_init_str, date_final_str, date_format='%Y-%m-%d'): date_init_dt = datetime.datetime.strptime(date_init_str, date_format) date_final_dt = datetime.datetime.strptime(date_final_str, date_format) time_delta = date_final_dt - date_init_dt return time_delta.days
Python
nomic_cornstack_python_v1
comment !/usr/bin/python comment programm to use les boucles from os import system import hashlib function fonction_calcule_perimetre a b begin set peri = a * b set peri = string peri print string le perimetre est + peri end function function fonction_magique charset begin print hex digest call sha224 charset end funct...
#!/usr/bin/python #programm to use les boucles from os import system import hashlib def fonction_calcule_perimetre(a,b): peri=a*b peri=str(peri) print ("le perimetre est "+peri) def fonction_magique(charset): print(hashlib.sha224(charset).hexdigest()) ''' print(" hello bidule") print(" hello machin") pri...
Python
zaydzuhri_stack_edu_python
function getSNR self begin return SNR end function
def getSNR(self): return self.SNR
Python
nomic_cornstack_python_v1
comment !/usr/bin/python comment arn arn:aws:sqs:us-east-1:088831977567:smarthome-updates.fifo comment url https://sqs.us-east-1.amazonaws.com/088831977567/smarthome-updates.fifo comment message looks like: {"device":"CoffeeMaker","newState":"ON","token":"Atz" } import boto.sqs import json from datetime import datetime...
#!/usr/bin/python # arn arn:aws:sqs:us-east-1:088831977567:smarthome-updates.fifo # url https://sqs.us-east-1.amazonaws.com/088831977567/smarthome-updates.fifo # message looks like: {"device":"CoffeeMaker","newState":"ON","token":"Atz" } import boto.sqs import json from datetime import datetime, timedelta from time im...
Python
zaydzuhri_stack_edu_python
class Node begin function __init__ self v begin set value = v set next = none end function end class class LinkedList begin function __init__ self begin set head = none set tail = none end function function add_in_tail self item begin if head is none begin set head = item end else begin set next = item end set tail = i...
class Node: def __init__(self, v): self.value = v self.next = None class LinkedList: def __init__(self): self.head = None self.tail = None def add_in_tail(self, item): if self.head is None: self.head = item else: self.tail.next = it...
Python
zaydzuhri_stack_edu_python
from google.cloud import firestore import google.cloud.exceptions import datetime from models.firestore_client import FirestoreClient class Common extends FirestoreClient begin function correct_date_format self date_str begin try begin string parse time date_str string %Y%m%d return tuple true none end except ValueErro...
from google.cloud import firestore import google.cloud.exceptions import datetime from models.firestore_client import FirestoreClient class Common(FirestoreClient): def correct_date_format(self, date_str): try: datetime.datetime.strptime(date_str, '%Y%m%d') return True, None ...
Python
zaydzuhri_stack_edu_python
comment list.append(x) append list string Pear set item = pop list
#list.append(x) list.append("Pear") item=list.pop()
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- string Created on Tue Jul 30 17:23:17 2019 @author: srika import pandas as pd set df_alt = read csv string alt_data.csv header=0 set df_you = read csv string youtube_all_data_cleaned.csv header=0 set df_link = read csv string youtube.csv header=0 set y_cols = list string views string likes...
# -*- coding: utf-8 -*- """ Created on Tue Jul 30 17:23:17 2019 @author: srika """ import pandas as pd df_alt = pd.read_csv("alt_data.csv", header=0) df_you = pd.read_csv("youtube_all_data_cleaned.csv", header =0) df_link = pd.read_csv("youtube.csv", header = 0) y_cols =['views','likes','dislikes', "CommentCount"] ...
Python
zaydzuhri_stack_edu_python
function emit self klass items begin set token = call klass pos items set _last_emitted_pos = pos set tokens = tokens + list token end function
def emit(self, klass, items): token = klass(self.pos, items) self._last_emitted_pos = self.pos self.tokens += [token]
Python
nomic_cornstack_python_v1
comment needed names.txt file so its pending set name = string SATHISH,SOWMYA set names = list map str split name string , sort names print names set st = string A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z set lis = list map str split st string , set SCORES = list set count = 1 for name in names begin set SCOR...
# needed names.txt file so its pending name = "SATHISH,SOWMYA" names = list(map(str,name.split(","))) names.sort() print(names) st = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z" lis = list(map(str,st.split(","))) SCORES = [] count = 1 for name in names: SCORE = 0 for i in name: SCORE += lis.in...
Python
zaydzuhri_stack_edu_python
function test_initial_risk_position_sizer_with_cap self begin comment will give leverage of 2, that will be capped to 1.5 set fraction_at_risk = 0.01 set signal = call Signal ticker LONG fraction_at_risk last_price now set orders = call size_signals list signal comment market order and stop order assert equal length or...
def test_initial_risk_position_sizer_with_cap(self): fraction_at_risk = 0.01 # will give leverage of 2, that will be capped to 1.5 signal = Signal(self.ticker, Exposure.LONG, fraction_at_risk, self.last_price, self.timer.now()) orders = self.initial_risk_position_sizer.size_signals([signal]) ...
Python
nomic_cornstack_python_v1
import string string Clean non utf characters from string function cleanstring invalidString begin comment Method 1 set printable = set printable set cleanstring = filter lambda x -> x in printable invalidString end function
import string ''' Clean non utf characters from string ''' def cleanstring(invalidString): ## Method 1 printable = set(string.printable) cleanstring = filter(lambda x: x in printable, invalidString)
Python
zaydzuhri_stack_edu_python
function summarize_series is_factor data begin return if expression is_factor then value counts data else describe data end function
def summarize_series(is_factor, data): return data.value_counts() if is_factor else data.describe()
Python
nomic_cornstack_python_v1
function external self begin return get pulumi self string external end function
def external(self) -> Optional['outputs.ExternalMetricStatus']: return pulumi.get(self, "external")
Python
nomic_cornstack_python_v1
for _ in range integer input begin set n = integer input set a = list comprehension integer o for o in split input set s = list set lis = list for i in range n begin if not s begin append s a at i continue end while s and s at - 1 > a at i begin append lis pop s end append s a at i end print length lis end
for _ in range(int(input())): n=int(input()) a=[int(o) for o in input().split()] s=[] lis=[] for i in range(n): if not(s): s.append(a[i]) continue while s and s[-1]>a[i]: lis.append(s.pop()) ...
Python
zaydzuhri_stack_edu_python
function plot self ax=none begin pass end function
def plot(self, ax=None): pass
Python
nomic_cornstack_python_v1
function merchant_category_code self merchant_category_code begin set _merchant_category_code = merchant_category_code end function
def merchant_category_code(self, merchant_category_code): self._merchant_category_code = merchant_category_code
Python
nomic_cornstack_python_v1
function is_publishable self begin comment rejected, cancelled, or already published? if call is_closed begin return false end set last_action = call last_action if action_type != APPROVE begin return false end return call next_mandatory_stage is none end function
def is_publishable(self): if self.is_closed(): # rejected, cancelled, or already published? return False last_action = self.last_action() if last_action.action_type != self.APPROVE: return False return last_action.next_mandatory_stage() is None
Python
nomic_cornstack_python_v1
comment brute force: scan all points and calculate the corresponding distance. comment a better solution: knowing the fact that the median point is the optimized point. class Solution begin function minTotalDistance self grid begin set rows = list comprehension i for i in range length grid for q in range length grid at...
# brute force: scan all points and calculate the corresponding distance. # a better solution: knowing the fact that the median point is the optimized point. class Solution: def minTotalDistance(self, grid: List[List[int]]) -> int: rows = [i for i in range(len(grid)) for q in range(len(grid[0])) if grid[i][...
Python
zaydzuhri_stack_edu_python
import pandas as pd class FeaturesMapping begin set df_imd_mapping = call DataFrame dict string imd_value list 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 none index=list string 0-10% string 10-20 string 20-30% string 30-40% string 40-50% string 50-60% string 60-70% string 70-80% string 80-90% string 90-100% none...
import pandas as pd class FeaturesMapping: df_imd_mapping = pd.DataFrame({ 'imd_value': [.05,.15,.25,.35,.45,.55,.65,.75,.85,.95, None], }, index=['0-10%', '10-20', '20-30%', '30-40%', '40-50%', '50-60%','60-70%','70-80%','80-90%','90-100%', None] ) def map_imd_band(self, df_mapped): ...
Python
zaydzuhri_stack_edu_python
function gausianfit self X Y begin comment guess values are the initial values taken to start the fit comment A fraction of the Y data range is taken as initial gaussian height and \ comment X data range center is taken as initial gaussian center set guess = list min Y 0.0 0.6 * max Y - min Y min X + max X / 2 1.0 comm...
def gausianfit(self, X, Y): # guess values are the initial values taken to start the fit # A fraction of the Y data range is taken as initial gaussian height and \ # X data range center is taken as initial gaussian center guess = [min(Y), 0.0, 0.6 * (max(Y)-min(Y)),(min(X)+max(X))/2...
Python
nomic_cornstack_python_v1
function _get_request_payload data=none files=none json_payload=false begin set data = data or dict set files = files or dict set headers = dict string Authorization string Token { API_TOKEN } if json_payload begin update headers dict string Content-Type string application/json set data = dumps data end return dict s...
def _get_request_payload(*, data=None, files=None, json_payload=False): data = data or {} files = files or {} headers = {'Authorization': f'Token {API_TOKEN}'} if json_payload: headers.update({'Content-Type': 'application/json'}) data = json.dumps(data) return {'data': dat...
Python
nomic_cornstack_python_v1
comment -------------------------------------------------# comment Title: Fizz Buzz Exercise, working with modulo comment Dev: Scott Luse comment Date: January 30, 2018 comment -------------------------------------------------# comment Write a program that prints the numbers from 1 to 100 inclusive. comment But for mul...
#-------------------------------------------------# # Title: Fizz Buzz Exercise, working with modulo # Dev: Scott Luse # Date: January 30, 2018 #-------------------------------------------------# # Write a program that prints the numbers from 1 to 100 inclusive. # But for multiples of three print “Fizz” instead of the...
Python
zaydzuhri_stack_edu_python
comment https://practice.geeksforgeeks.org/problems/binary-tree-to-dll/1/ from base import buildTree class Node begin function __init__ self val begin set right = none set data = val set left = none end function end class class DLLNode begin function __init__ self val=none begin set left = none set right = none set dat...
# https://practice.geeksforgeeks.org/problems/binary-tree-to-dll/1/ from base import buildTree class Node: def __init__(self, val): self.right = None self.data = val self.left = None class DLLNode(): def __init__(self, val=None): self.left = None self.right = None ...
Python
zaydzuhri_stack_edu_python
function get_words word_list minimum maximum begin comment Total words to return set total = random integer minimum maximum set result = list for i in range total begin append result random choice word_list end return result end function
def get_words(word_list, minimum, maximum): total = random.randint(minimum, maximum) #Total words to return result = [] for i in range(total): result.append(random.choice(word_list)) return result
Python
nomic_cornstack_python_v1
function createModule self moduleName begin Ellipsis end function
def createModule(self, moduleName: unicode) -> ghidra.program.model.listing.ProgramModule: ...
Python
nomic_cornstack_python_v1
function show_ref self *args begin set lines = call call_output string show-ref *args return call _dict_from_refs lines end function
def show_ref(self, *args): lines = self.cmd.call_output("show-ref", *args) return _dict_from_refs(lines)
Python
nomic_cornstack_python_v1
function test_monitor_job_with_retry2 client begin with call app_context begin set app = application call flushall set task_id = string uuid 4 set t = call create_task task_id set j = call create_job set job_id = job_id set metadata at string retries = 3 set metadata at string retry_count = 3 set ex = call create_execu...
def test_monitor_job_with_retry2(client): with client.application.app_context(): app = client.application app.redis.flushall() task_id = str(uuid4()) t = Task.create_task(task_id) j = t.create_job() job_id = j.job_id j.metadata["retries"] = 3 j.metada...
Python
nomic_cornstack_python_v1
comment Definition for singly-linked list. class ListNode extends object begin function __init__ self x begin set val = x set next = none end function end class class Solution extends object begin function isPalindrome self head begin string :type head: ListNode :rtype: bool set fast = head set slow = head comment find...
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def isPalindrome(self, head): """ :type head: ListNode :rtype: bool """ fast = slow = head # find the mid nod...
Python
zaydzuhri_stack_edu_python
function _format_exception_message failure_prefix message caused_by begin set cause_name = __name__ set cause_message = string caused_by set formatted_message = string { failure_prefix } : (caused by { cause_name } ): { message } : { cause_message } comment up to 1KB is allowed in output message return strip formatted_...
def _format_exception_message(failure_prefix: str, message: str, caused_by: Exception) -> str: cause_name = caused_by.__class__.__name__ cause_message = str(caused_by) formatted_message = f"{failure_prefix}: (caused by {cause_name}): {message}: {cause_message}" # up to 1KB is allowed in ...
Python
nomic_cornstack_python_v1
from functools import reduce set hex2bin = dict string 0 string 0000 ; string 1 string 0001 ; string 2 string 0010 ; string 3 string 0011 ; string 4 string 0100 ; string 5 string 0101 ; string 6 string 0110 ; string 7 string 0111 ; string 8 string 1000 ; string 9 string 1001 ; string A string 1010 ; string B string 101...
from functools import reduce hex2bin = { '0' : '0000', '1' : '0001', '2' : '0010', '3' : '0011', '4' : '0100', '5' : '0101', '6' : '0110', '7' : '0111', '8' : '1000', '9' : '1001', 'A' : '1010', 'B' : '1011', 'C' : '1100', 'D' : '1101', 'E' : '1110', 'F'...
Python
zaydzuhri_stack_edu_python
function get_ptransform self tag begin if tag is none or tag not in _ptransform_by_tag begin return tuple _ptransform_by_tag at _GENERAL_ENVIRONMENT_TAG none end return tuple _ptransform_by_tag at tag value end function
def get_ptransform(self, tag): if tag is None or tag not in self._ptransform_by_tag: return self._ptransform_by_tag[self._GENERAL_ENVIRONMENT_TAG], None return self._ptransform_by_tag[tag], tag.value
Python
nomic_cornstack_python_v1
function lcs x1 y1 begin for i in range 1 n + 1 begin set c at i at 0 = 0 end for j in range 0 m + 1 begin set c at 0 at j = 0 end for i in range 1 n + 1 begin for j in range 1 m + 1 begin if y1 at i - 1 == x1 at j - 1 begin set c at i at j = c at i - 1 at j - 1 + 1 set cfrom at i at j = string c end else begin set val...
def lcs(x1,y1): for i in range(1,n+1): c[i][0] = 0 for j in range(0,m+1): c[0][j] = 0 for i in range(1,n+1): for j in range(1,m+1): if y1[i-1] == x1[j-1]: c[i][j] = c[i-1][j-1]+1 cfrom[i][j]="c" else: val1=c[i-1]...
Python
zaydzuhri_stack_edu_python
comment Arnab Kumar Datta (arnabkd) - Task 7.5 set filename = string sample.txt set f = open filename string r for line in f begin set x = split strip strip strip line string string string , set sum = 0.0 for i in range 1 length x begin set sum = sum + decimal x at i end end
#Arnab Kumar Datta (arnabkd) - Task 7.5 filename = "sample.txt" f = open(filename, 'r') for line in f: x = line.strip('\n').strip('\r').strip().split(',') sum = 0.0 for i in range (1, len(x)): sum += float(x[i])
Python
zaydzuhri_stack_edu_python
comment coding:utf-8 comment https://leetcode.com/problems/plus-one/ (66. Plus One) class Solution extends object begin function plusOne self digits begin string :type digits: List[int] :rtype: List[int] set length = length digits set carry = 0 for i in range length - 1 - 1 - 1 begin if i == length - 1 begin set s = di...
# coding:utf-8 # https://leetcode.com/problems/plus-one/ (66. Plus One) class Solution(object): def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ length = len(digits) carry = 0 for i in range(length-1, -1, -1): if i == ...
Python
zaydzuhri_stack_edu_python
comment 1. tao ra list liet ke 2 - 3 thu moi nguoi thich comment 2. hoi user 1 so thich moi comment 3. them so thich moi vao danh sach khai bao comment 4. in lai set favorite_items = list string gym string swimming string chatting print *favorite_items sep=string , set new_favorite = input string What is your favorite ...
# 1. tao ra list liet ke 2 - 3 thu moi nguoi thich # 2. hoi user 1 so thich moi # 3. them so thich moi vao danh sach khai bao # 4. in lai favorite_items = ['gym', "swimming", "chatting"] print(*favorite_items, sep = ", ") new_favorite = input("What is your favorite activities? ") favorite_items.append(new_favorite) p...
Python
zaydzuhri_stack_edu_python
function somme_de_points_main main begin set s = 0 for m in main begin set s = s + call somme_des_point end return s end function
def somme_de_points_main(main): s=0 for m in main: s+=m.somme_des_point() return s
Python
nomic_cornstack_python_v1
comment William Zhu (wzhu4@uchicago.edu) import tkinter as tk from abc import ABC , abstractmethod from card import Card from deck import Deck from hand import Hand class GameGUI extends ABC begin function __init__ self window begin set _window = window set _canvas_width = 1024 set _canvas_height = 400 set _canvas = ca...
# William Zhu (wzhu4@uchicago.edu) import tkinter as tk from abc import ABC, abstractmethod from card import Card from deck import Deck from hand import Hand class GameGUI(ABC): def __init__(self, window): self._window = window self._canvas_width = 1024 self._canvas_height = 400 ...
Python
zaydzuhri_stack_edu_python