code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
comment Name: <Your Name> comment Email: <Your Email> from util import INFINITY comment 1. Multiple choice comment 1.1. Two computerized players are playing a game. Player MM does minimax comment search to depth 6 to decide on a move. Player AB does alpha-beta comment search to depth 6. comment The game is played witho...
# Name: <Your Name> # Email: <Your Email> from util import INFINITY ### 1. Multiple choice # 1.1. Two computerized players are playing a game. Player MM does minimax # search to depth 6 to decide on a move. Player AB does alpha-beta # search to depth 6. # The game is played without a time li...
Python
zaydzuhri_stack_edu_python
function client_activating self clid begin for wsid in call wsidforclient clid begin call workset_activating wsid end end function
def client_activating(self, clid): for wsid in self.wsidforclient(clid): self.crawljob.workset_activating(wsid)
Python
nomic_cornstack_python_v1
function _get_database_display_str self verbosity database_name begin return string '%s'%s % tuple alias if expression verbosity >= 2 then string ('%s') % database_name else string end function
def _get_database_display_str(self, verbosity, database_name): return "'%s'%s" % ( self.connection.alias, (" ('%s')" % database_name) if verbosity >= 2 else '', )
Python
nomic_cornstack_python_v1
string Demo @ fansiqi 2020.4.22 from tkinter import * from tkinter.filedialog import askopenfilename import sys remove path string /opt/ros/kinetic/lib/python2.7/dist-packages import cv2 from time import time from SiamFC.tracker import TrackerSiamFC from DaSiamRPN.tracker import TrackerDaSiamRPN function get_dir path b...
""" Demo @ fansiqi 2020.4.22 """ from tkinter import * from tkinter.filedialog import askopenfilename import sys sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') import cv2 from time import time from SiamFC.tracker import TrackerSiamFC from DaSiamRPN.tracker import TrackerDaSiamRPN def get_dir(path): ...
Python
zaydzuhri_stack_edu_python
function get_substring string begin return string at slice 1 : - 1 : end function
def get_substring(string): return string[1:-1]
Python
flytech_python_25k
function sanity_check share begin if is instance share float begin raise call ValueError string Type float not supported yet! end if is instance share ndarray and not call issubdtype dtype integer begin raise call ValueError string NPArray should have type int, but found { dtype } end if is instance share Tensor and ca...
def sanity_check( share: Union[int, float, torch.Tensor, np.ndarray, "ShareTensor"] ) -> None: if isinstance(share, float): raise ValueError("Type float not supported yet!") if isinstance(share, np.ndarray) and not np.issubdtype(share.dtype, np.integer): raise ValueE...
Python
nomic_cornstack_python_v1
function fix_urls_regex url relpath begin set url = strip call group 1 string "' if starts with url tuple string data: string http: string https: string attr( begin return url end else begin set url = call relpath url relpath return string url(%s) % url end end function
def fix_urls_regex(url, relpath): url = url.group(1).strip('"\'') if url.startswith(('data:', 'http:', 'https:', 'attr(')): return url else: url = os.path.relpath(url, relpath) return 'url(%s)' % url
Python
nomic_cornstack_python_v1
function validate_argv argv begin if length argv != 1 begin return false end return true end function
def validate_argv(argv): if len(argv) != 1: return False return True
Python
nomic_cornstack_python_v1
from fake_useragent import UserAgent from pprint import pprint from lxml import html import requests import datetime from time import sleep from pymongo import MongoClient set date_fmt = string %Y-%m-%d %H:%M set headers = dict string UserAgent random set client = call MongoClient string mongodb://localhost:27017/ set ...
from fake_useragent import UserAgent from pprint import pprint from lxml import html import requests import datetime from time import sleep from pymongo import MongoClient date_fmt = '%Y-%m-%d %H:%M' headers = {'UserAgent': UserAgent().random} client = MongoClient('mongodb://localhost:27017/') db = client['news'] col...
Python
zaydzuhri_stack_edu_python
function test_fma_invalid_param_intarray_floatarray_intarray_intarray_512 self begin comment This version is expected to pass. call fma floatarrayx floatarrayy floatarrayz floatarrayout comment This is the actual test. with assert raises TypeError begin call fma intarrayx floatarrayy intarrayz intarrayout end end funct...
def test_fma_invalid_param_intarray_floatarray_intarray_intarray_512(self): # This version is expected to pass. arrayfunc.fma(self.floatarrayx, self.floatarrayy, self.floatarrayz, self.floatarrayout) # This is the actual test. with self.assertRaises(TypeError): arrayfunc.fma(self.intarrayx, self.floatarrayy...
Python
nomic_cornstack_python_v1
import numpy as np comment Transitional model: set transitional_model = array list list 0.7 0.3 list 0.3 0.7 comment Observational model where an umbrella has been observed: set obs_model_with_umbrella = array list list 0.9 0.0 list 0.0 0.2 comment Observational model where a distinct lack of an umbrella has been obser...
import numpy as np # Transitional model: transitional_model = np.array([[0.7, 0.3], [0.3, 0.7]]) # Observational model where an umbrella has been observed: obs_model_with_umbrella = np.array([[0.9, 0.0], [0.0, 0.2]]) # Observational model where a dis...
Python
zaydzuhri_stack_edu_python
import random comment x = 0 comment y = 0 comment Flip_list = [] comment HNf = {} comment TNf = {} comment HNf = [0 for i in range(1, 51)] comment TNf = [0 for i in range(1, 51)] comment Hn = {} comment Tn = {} comment Hn = [0 for i in range(1, 51)] comment Tn = [0 for i in range(1, 51)] comment total_Heads = 0 comment...
import random # x = 0 # y = 0 # Flip_list = [] # HNf = {} # TNf = {} # HNf = [0 for i in range(1, 51)] # TNf = [0 for i in range(1, 51)] # Hn = {} # Tn = {} # Hn = [0 for i in range(1, 51)] # Tn = [0 for i in range(1, 51)] # total_Heads = 0 # total_tails = 0 Tails_number = 0 Heads_number = 0 tries = 0 ...
Python
zaydzuhri_stack_edu_python
string Problem 7 - Project Euler 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? from utils import prime class Problem7 extends object begin decorator staticmethod function solve value=10001 begin return call nth value ...
"""Problem 7 - Project Euler 10001st prime By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? """ from utils import prime class Problem7(object): @staticmethod def solve(value=10001): return prime.nth(value) @...
Python
zaydzuhri_stack_edu_python
function store_customer_info name phone_number address begin set customer_dict at name = dict string phone_number phone_number ; string address address end function if __name__ == string __main__ begin call store_customer_info string John Doe string 1234567890 string New York end
def store_customer_info(name, phone_number, address): customer_dict[name] = { 'phone_number': phone_number, 'address': address } if __name__ == '__main__': store_customer_info('John Doe', '1234567890', 'New York')
Python
jtatman_500k
comment The Fibonacci sequence is a series where the next term is the sum of previous two terms. comment The first two terms of the Fibonacci sequence is 0 followed by 1 function generate_fibonacci num begin if not is digit num begin print string Please enter number. return end set num = integer num set num1 = 0 set nu...
# The Fibonacci sequence is a series where the next term is the sum of previous two terms. # The first two terms of the Fibonacci sequence is 0 followed by 1 def generate_fibonacci(num): if not num.isdigit(): print("Please enter number.") return num = int(num) num1 = 0 num2 = 1 f...
Python
zaydzuhri_stack_edu_python
import cv2 import pandas as pd import numpy as np import argparse import os import sys from os.path import isfile , join from os import listdir import time import csv comment Mouse Events in CV2 https://www.pyimagesearch.com/2015/03/09/capturing-mouse-click-events-with-python-and-opencv/ set image_folder = join path st...
import cv2 import pandas as pd import numpy as np import argparse import os import sys from os.path import isfile, join from os import listdir import time import csv # Mouse Events in CV2 https://www.pyimagesearch.com/2015/03/09/capturing-mouse-click-events-with-python-and-opencv/ image_folder = os.path.join('imageSe...
Python
zaydzuhri_stack_edu_python
string Format (compressed) CSV file for import into an SQL database using Python. - This script seems to run ~1.6 times slower than the `bash` version. - PyPy runs ~0.97 times faster, so not worth it. from __future__ import print_function import logging import os import os.path as op import re from kmtools import syste...
"""Format (compressed) CSV file for import into an SQL database using Python. - This script seems to run ~1.6 times slower than the `bash` version. - PyPy runs ~0.97 times faster, so not worth it. """ from __future__ import print_function import logging import os import os.path as op import re from kmtools import sy...
Python
zaydzuhri_stack_edu_python
import time function helper message value begin print message value sleep 1 end function comment TO-DO: complete the helper function below to merge 2 sorted Ays comment Sorting happens here... function merge Left Right begin comment elements = len(Left) + len(Right) comment Left index, and right index set li = 0 set ri...
import time def helper(message, value): print(message, value) time.sleep(1) # TO-DO: complete the helper function below to merge 2 sorted Ays # Sorting happens here... def merge(Left, Right): # elements = len(Left) + len(Right) # Left index, and right index li = 0 ri = 0 # Seans way ...
Python
zaydzuhri_stack_edu_python
function create_network normalized_input n_vocab begin comment Create sequential Keras model set model = sequential add model call CuDNNLSTM 256 input_shape=tuple shape at 1 shape at 2 return_sequences=true add model dropout 0.3 add model call CuDNNLSTM 256 add model dense 256 activation=string relu add model dropout 0...
def create_network(normalized_input, n_vocab): # Create sequential Keras model model = Sequential() model.add(CuDNNLSTM(256, input_shape=(normalized_input.shape[1], normalized_input.shape[2]), return_sequences=True)) model.add(Dropout(0.3)) model.add(CuDNNLSTM(256)) model.ad...
Python
nomic_cornstack_python_v1
function expand_uri id cmaps=none strict=false begin try begin set tuple prefix localid = split id string : 1 end except ValueError begin if strict begin raise call InvalidSyntax id end else begin return id end end if cmaps is none begin set uri = call expand curie=id if uri is not none begin return uri end else if str...
def expand_uri(id: str, cmaps: Optional[List[PREFIX_MAP]] = None, strict: bool = False) -> str: try: prefix, localid = id.split(":", 1) except ValueError: if strict: raise InvalidSyntax(id) from None else: return id if cmaps is None: uri = default_con...
Python
nomic_cornstack_python_v1
function app self begin return _app or current_app end function
def app(self): return self._app or current_app
Python
nomic_cornstack_python_v1
function nested_even_sum obj sum_=0 begin set aux_dic = copy obj for tuple k v in items obj begin if type v == int begin if v % 2 == 0 begin set sum_ = sum_ + v end pop aux_dic k end else if type v == dict begin set aux = v pop aux_dic k update aux_dic aux return call nested_even_sum aux_dic sum_ end else begin pop aux...
def nested_even_sum(obj, sum_=0): aux_dic=obj.copy() for k,v in obj.items(): if type(v)==int: if v%2==0: sum_=sum_+v aux_dic.pop(k) elif type(v)==dict: aux=v aux_dic.pop(k) aux_dic.update(aux) return nested_e...
Python
zaydzuhri_stack_edu_python
import numpy as np import matplotlib.pyplot as plt from scipy.stats import poisson function simulate_aloha max_G=5 begin set G = linear space 0.1 max_G num=100 set S = G * exp - 2 * G set dist = poisson 2 * G set rvs = call rvs size=tuple 1000 100 scatter plt G sum rvs == 1 axis=0 / 2000 label=string ALOHA random sampl...
import numpy as np import matplotlib.pyplot as plt from scipy.stats import poisson def simulate_aloha(max_G: int = 5) -> None: G = np.linspace(0.1, max_G, num=100) S = G * np.exp(-2 * G) dist = poisson(2 * G) rvs = dist.rvs(size=(1000, 100)) plt.scatter( G, np.sum(rvs == 1, axis...
Python
zaydzuhri_stack_edu_python
comment recipe-minimizer-binary-Python3.py comment version 1: first Python3 version comment version 2: remove requirement that a non-empty pattern is being constructed comment (Look in repo history for Python2 version, though it seems unlikely that will ever be needed) comment In Golly, orient a slow salvo so that it's...
# recipe-minimizer-binary-Python3.py # # version 1: first Python3 version # version 2: remove requirement that a non-empty pattern is being constructed # (Look in repo history for Python2 version, though it seems unlikely that will ever be needed) # # In Golly, orient a slow salvo so that it's moving northwest, # with ...
Python
zaydzuhri_stack_edu_python
function looks_like_issubclass obj classname begin set t = obj if __name__ == classname begin return true end for klass in __mro__ begin if __name__ == classname begin return true end end return false end function
def looks_like_issubclass(obj, classname): t = obj if t.__name__ == classname: return True for klass in t.__mro__: if klass.__name__ == classname: return True return False
Python
nomic_cornstack_python_v1
function stylometricComparison profileone profiletwo begin set sig1 = call getWritingStyle set sig2 = call getWritingStyle if not sig1 or not sig2 or sum list comprehension sig1 at w for w in sig1 == 0 or sum list comprehension sig2 at w for w in sig2 == 0 begin return 0 end set rms = square root sum list comprehension...
def stylometricComparison(profileone, profiletwo): sig1 = profileone.getWritingStyle() sig2 = profiletwo.getWritingStyle() if not sig1 or not sig2 or sum([sig1[w] for w in sig1]) == 0 or sum([sig2[w] for w in sig2]) == 0 : return 0 rms = math.sqrt(sum([(sig1[word] - sig2[word]) ** 2 for word in si...
Python
nomic_cornstack_python_v1
import sys , queue , math , copy , itertools , bisect , collections , heapq function main begin call setrecursionlimit 10 ^ 7 set INF = 10 ^ 18 set MOD = 10 ^ 9 + 7 set LI = lambda -> list comprehension integer x for x in split read line stdin set _LI = lambda -> list comprehension integer x - 1 for x in split read l...
import sys,queue,math,copy,itertools,bisect,collections,heapq def main(): sys.setrecursionlimit(10**7) INF = 10**18 MOD = 10**9 + 7 LI = lambda : [int(x) for x in sys.stdin.readline().split()] _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()] NI = lambda : int(sys.stdin.readline()...
Python
jtatman_500k
function file_to_loop f begin if which string mdconfig is none begin return list end if not is file path f begin return list end set tuple ret out err = call list string mdconfig string -l string -v if ret != 0 begin return list end string It's possible multiple loopdev are associated with the same file set devs = l...
def file_to_loop(f): if which('mdconfig') is None: return [] if not os.path.isfile(f): return [] (ret, out, err) = call(['mdconfig', '-l', '-v']) if ret != 0: return [] """ It's possible multiple loopdev are associated with the same file """ devs= [] for line in o...
Python
nomic_cornstack_python_v1
function field_1 self begin return _field_1 end function
def field_1(self): return self._field_1
Python
nomic_cornstack_python_v1
function find_best population begin comment by Johannes set best = random choice population call update_revenue for individual in population begin call update_revenue if revenue > revenue begin set best = individual end end return best end function
def find_best(population): #by Johannes best = rnd.choice(population) best.update_revenue() for individual in population: individual.update_revenue() if individual.revenue > best.revenue: best = individual return best
Python
nomic_cornstack_python_v1
function read_envs begin set envs = dict set envs at string S3_SUBMISSION_ARCHIVE_PATH = get environ string S3_SUBMISSION_ARCHIVE_PATH set envs at string S3_VALIDATION_BUCKET = get environ string S3_VALIDATION_BUCKET set envs at string S3_VALIDATION_PREFIX = get environ string S3_VALIDATION_PREFIX set envs at string B...
def read_envs(): envs = {} envs['S3_SUBMISSION_ARCHIVE_PATH'] = os.environ.get('S3_SUBMISSION_ARCHIVE_PATH') envs['S3_VALIDATION_BUCKET'] = os.environ.get('S3_VALIDATION_BUCKET') envs['S3_VALIDATION_PREFIX'] = os.environ.get('S3_VALIDATION_PREFIX') envs['BATCH_NUM_NODES'] = os.environ.get('BATCH_NUM_NODES') envs[...
Python
nomic_cornstack_python_v1
comment -*- coding: utf-8-*- from libs.errorlogLib import writeLogL function fetchUrl fakeUrl begin import re set urlList = list set regex = compile string <<([^>]+)~([^>]+)/([^>]+)>> set parametersList = find all fakeUrl if length parametersList is not 0 begin for para in parametersList begin set para = list comprehe...
# -*- coding: utf-8-*- from libs.errorlogLib import writeLogL def fetchUrl(fakeUrl): import re urlList =[] regex = re.compile("<<([^>]+)~([^>]+)/([^>]+)>>") parametersList =regex.findall(fakeUrl) if len(parametersList) is not 0: for para in parametersList: para =[int(i) for i in para] for num in ran...
Python
zaydzuhri_stack_edu_python
function on_channel_open new_channel begin global channel set channel = new_channel call queue_declare queue=string test durable=true exclusive=false auto_delete=false callback=on_queue_declared end function
def on_channel_open(new_channel): global channel channel = new_channel channel.queue_declare(queue="test", durable=True, exclusive=False, auto_delete=False, callback=on_queue_declared)
Python
nomic_cornstack_python_v1
function deploy_firefox browser_params begin comment directory of this file set root_dir = directory name path __file__ set display_pid = none set display_port = none set fp = call FirefoxProfile set browser_profile_path = path + string / comment Imported browser settings set profile_settings = none comment If profile ...
def deploy_firefox( browser_params): root_dir = os.path.dirname(__file__) # directory of this file display_pid = None display_port = None fp = webdriver.FirefoxProfile() browser_profile_path = fp.path + '/' profile_settings = None # Imported browser settings # If profile settings still n...
Python
nomic_cornstack_python_v1
comment Standard Python Libraries ## import os , sys import numpy as np comment OpenCV Libraries ## import cv2 , glob comment Keras Libraries ## from tensorflow import keras from tensorflow.keras.preprocessing.image import image_dataset_from_directory from keras.models import Sequential from keras.layers import Dense ,...
## Standard Python Libraries ## import os, sys import numpy as np ## OpenCV Libraries ## import cv2, glob ## Keras Libraries ## from tensorflow import keras from tensorflow.keras.preprocessing.image import image_dataset_from_directory from keras.models import Sequential from keras.layers import Dense, Dropout, Activa...
Python
zaydzuhri_stack_edu_python
import random from time import sleep , time function download filename begin print string 开始下载—— + filename set delay = random integer 5 15 print string 预计需要花费%d秒 % delay sleep random integer 5 15 print filename + string 下载完成 end function function main begin set start = time call download string qqq call download strin...
import random from time import sleep, time def download(filename): print('开始下载——' + filename) delay = random.randint(5, 15) print('预计需要花费%d秒' % delay) sleep(random.randint(5, 15)) print(filename + '下载完成') def main(): start = time() download('qqq') download('www') download('eee') ...
Python
zaydzuhri_stack_edu_python
import pytest from SamanthaThesis.visualize import SurveyPlot import pandas as pd decorator fixture function input_data_frame begin set mock_c = list string Entry Id string dimension string value set mock_r = list tuple 1 string D1 2 tuple 2 string D1 3 tuple 3 string D1 2 tuple 4 string D1 1 tuple 5 string D2 3 tuple ...
import pytest from SamanthaThesis.visualize import SurveyPlot import pandas as pd @pytest.fixture def input_data_frame(): mock_c = ['Entry Id', 'dimension', 'value'] mock_r = [ (1, 'D1', 2), (2, 'D1', 3), (3, 'D1', 2), (4, 'D1', 1), (5, 'D2', 3), (6, 'D2', 3), ...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- string Created on Fri Jun 26 20:27:36 2020 @author: rupert import matplotlib import matplotlib.pyplot as plt class RegressionPlotter extends object begin function __init__ self begin set tuple xs ls Ws bs dWs dbs = tuple list list list list list list end function function add_data se...
# -*- coding: utf-8 -*- """ Created on Fri Jun 26 20:27:36 2020 @author: rupert """ import matplotlib import matplotlib.pyplot as plt class RegressionPlotter(object): def __init__(self): self.xs, self.ls, self.Ws, self.bs, self.dWs, self.dbs = [],[],[],[],[], [] def add_data(self, epoch, model, optimi...
Python
zaydzuhri_stack_edu_python
function select_move_minimax board color begin set best_utility = - inf set new_color = if expression color == 2 then 1 else 2 set possible_moves = call get_possible_moves board color set best_move = tuple 0 0 if length possible_moves > 0 begin set best_move = possible_moves at 0 set sorted_states_list = list for move...
def select_move_minimax(board, color): best_utility = -math.inf new_color = 1 if color == 2 else 2 possible_moves = get_possible_moves(board, color) best_move = 0,0 if len(possible_moves) > 0: best_move = possible_moves[0] sorted_states_list = [] for move in possible_moves: ...
Python
nomic_cornstack_python_v1
from typing import List from pytest import mark from algorithims.other.recursion.basic.add_numbers import add_numbers decorator call parametrize string description, nums, expected list tuple string It handles a single number list 3 3 tuple string It handles multiple numbers list 1 2 3 4 10 tuple string It handles negat...
from typing import List from pytest import mark from algorithims.other.recursion.basic.add_numbers import add_numbers @mark.parametrize( 'description, nums, expected', [ ('It handles a single number', [3], 3), ('It handles multiple numbers', [1,2,3,4], 10), ('It handles negative number...
Python
zaydzuhri_stack_edu_python
function __init__ self name ifo tin tout polar ncols GCj GCi Real Complex=none comment=string finalize=true begin call __init__ self name ifo tin tout polar ncols GCj GCi Real Complex comment=comment finalize=finalize end function
def __init__(self, name, ifo, tin, tout, polar, ncols, GCj, GCi, Real, Complex=None, comment='', finalize=True): NastranMatrix.__init__(self, name, ifo, tin, tout, polar, ncols, GCj, GCi, Real, Complex, comment=comment, finalize=fina...
Python
nomic_cornstack_python_v1
function find cls app_name begin set module_name = string %s.app % app_name set module = call try_import module_name if module is none begin return none end try begin set app_class = call get_class module cls end except AttributeError begin set app_class = none end return app_class end function
def find(cls, app_name): module_name = "%s.app" % app_name module = try_import(module_name) if module is None: return None try: app_class = get_class(module, cls) except AttributeError: app_class = None return app_class
Python
nomic_cornstack_python_v1
import math function frustrum_volume base_radius top_radius height begin set base_area = pi * base_radius ^ 2 set top_area = pi * top_radius ^ 2 set average_radius = base_radius + top_radius / 2 set volume = 1 / 3 * pi * height * base_area + top_area + square root base_area * top_area return volume end function set vol...
import math def frustrum_volume(base_radius, top_radius, height): base_area = math.pi * base_radius ** 2 top_area = math.pi * top_radius ** 2 average_radius = (base_radius + top_radius) / 2 volume = (1/3) * math.pi * height * (base_area + top_area + math.sqrt(base_area * top_area)) return volume ...
Python
jtatman_500k
function _is_real symbol begin return call isa symbol float or call is_int symbol end function
def _is_real(symbol): return isa(symbol, float) or is_int(symbol)
Python
nomic_cornstack_python_v1
set numbers = list 1 2 3 4 5 for number in numbers begin print number end
numbers = [1, 2, 3, 4, 5] for number in numbers: print(number)
Python
flytech_python_25k
comment import io comment with io.StringIO() as stream: comment stream.write('Fundamentos de Python.\n') comment print('Bem-vindo ao mundo Python!', file=stream) comment contents = stream.getvalue() comment print(contents) comment stream.close() comment import requests comment urls = { comment 'get': 'https://httpbin.o...
# import io # with io.StringIO() as stream: # stream.write('Fundamentos de Python.\n') # print('Bem-vindo ao mundo Python!', file=stream) # contents = stream.getvalue() # print(contents) # stream.close() # import requests # urls = { # 'get': 'https://httpbin.org/get?title=fundamentos+de+pyt...
Python
zaydzuhri_stack_edu_python
function move_valid self move gameboard begin set x = move at 0 set y = move at 1 if board at x at y == string . begin return true end else begin return false end end function
def move_valid(self, move, gameboard): x = move[0] y = move[1] if gameboard.board[x][y] == '.': return True else: return False
Python
nomic_cornstack_python_v1
comment from multiprocessing import Manager comment Pipe 管道 双向通信 数据不安全 comment Queue 管道+锁 双向通信 数据安全 comment JoinableQueue put和get的一个计数机制,每次get数据之后,发送task_done,put端接收到计数-1,直到计数为0就能感知到 comment Manager是一个类,提供了可以进行数据共享的一个机制 提供了很多数据类型 dict list comment 先定义一个manager的对象,然后通过这个对象来创建数据类型 comment Manager: 不提供数据的安全 comment if __n...
# from multiprocessing import Manager # Pipe 管道 双向通信 数据不安全 # Queue 管道+锁 双向通信 数据安全 # JoinableQueue put和get的一个计数机制,每次get数据之后,发送task_done,put端接收到计数-1,直到计数为0就能感知到 # Manager是一个类,提供了可以进行数据共享的一个机制 提供了很多数据类型 dict list # 先定义一个manager的对象,然后通过这个对象来创建数据类型 # Manager: 不提供数据的安全 # if __name__ == '__main__': # ...
Python
zaydzuhri_stack_edu_python
comment Dictionary with mlbook chapters and sections set questionCategories = dict 0 dict 0 string Beyond the scope of the book ; 1 string See category for details ; 1 dict 0 string The ingredients of machine learning ; 1 string Tasks: the problems that can be solved with machine learning ; 2 string Models: the output ...
# Dictionary with mlbook chapters and sections questionCategories = {\ 0:\ {\ 0:"Beyond the scope of the book", 1:"See category for details" }, 1:\ {\ 0:"The ingredients of machine learning", 1:"Tasks: the problems that can be solved with machine learning", 2:"Models: the output of...
Python
zaydzuhri_stack_edu_python
comment /////////////////////////////////////////////////////////////////////// comment ///////////////////// ALGORITHME GENETIQUE //////////////////////////// comment /////////////////////////////////////////////////////////////////////// comment ///// IMPORTS ///////////////////////////////////////////////////////// ...
#/////////////////////////////////////////////////////////////////////// #///////////////////// ALGORITHME GENETIQUE //////////////////////////// #/////////////////////////////////////////////////////////////////////// #///// IMPORTS ///////////////////////////////////////////////////////// #/////////////////////////...
Python
zaydzuhri_stack_edu_python
function pos self begin set x = _mouse_x - width / 2.0 / width / 2.0 set y = _mouse_y - height / 2.0 / height / 2.0 return array list x y end function
def pos(self): x = (self.ec._win._mouse_x - self.ec._win.width / 2.) / (self.ec._win.width / 2.) y = (self.ec._win._mouse_y - self.ec._win.height / 2.) / (self.ec._win.height / 2.) return np.array([x, y])
Python
nomic_cornstack_python_v1
function distinctPower n begin set s = set for i in range 2 n + 1 begin for j in range 2 n + 1 begin set ret = power i j add s ret end end return length s end function set n = input
def distinctPower(n): s = set() for i in range(2, n+1): for j in range(2, n+1): ret = pow(i, j) s.add(ret) return len(s) n = input()
Python
zaydzuhri_stack_edu_python
import json import typing from typing import List , Union from copy import deepcopy from board import Board , get_all_string_points , BoardPoint from rulechecker import * from definitions import * from utilities import readConfig from exceptions import StoneException , PlayerStateViolation , PlayerTypeError from player...
import json import typing from typing import List, Union from copy import deepcopy from board import Board,get_all_string_points,BoardPoint from rulechecker import * from definitions import * from utilities import readConfig from exceptions import StoneException, PlayerStateViolation, PlayerTypeError from play...
Python
zaydzuhri_stack_edu_python
class Product begin function __init__ self price begin call __set_price price end function function __get_price self begin return __price end function function __set_price self price begin if price < 0 begin raise call ValueError string Cannot be negative end else begin set __price = price end end function end class co...
class Product: def __init__(self, price): self.__set_price(price) def __get_price(self): return self.__price def __set_price(self, price): if price < 0: raise ValueError("Cannot be negative") else: self.__price = price # we don't want negative valu...
Python
zaydzuhri_stack_edu_python
from urllib.request import urlopen import json set name = string PythonCourseCounter set version = string 0.1 set depends = list set waiter = false function get_news begin set url = string https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLlb7e2G7aSpQmGnhrxlqI4iMXNv4R7khy&maxResults=50&order...
from urllib.request import urlopen import json name = "PythonCourseCounter" version = "0.1" depends = [] waiter = False def get_news(): url = "https://www.googleapis.com/youtube/v3/playlistItems?" \ "part=snippet&playlistId=PLlb7e2G7aSpQmGnhrxlqI4iMXNv4R7khy&" \ "maxResults=50&order=date&type...
Python
zaydzuhri_stack_edu_python
function extract_features text_file begin set config = CONFIG set path_to_zipfile = call path_to_file config config at string text_dir text_file set path_to_tempdir = call path_to_file config config at string archive_dir text_file if exists path path_to_zipfile is false begin comment Move data.zip file to temp director...
def extract_features(text_file): config = MLManager.CONFIG path_to_zipfile = FileUtil.path_to_file(config, config['text_dir'], text_file) path_to_tempdir = FileUtil.path_to_file(config, config['archive_dir'], text_file) if os.path.exists(path_to_zipfile) is False: # Move da...
Python
nomic_cornstack_python_v1
function hatnotes self begin string list: Parse hatnotes from the HTML Note: Not settable Note: Side effect is to also pull the html which can be slow Note: This is a parsing operation and not part of the standard API if _hatnotes is none begin set _hatnotes = list set soup = call BeautifulSoup html string html.parser ...
def hatnotes(self): """ list: Parse hatnotes from the HTML Note: Not settable Note: Side effect is to also pull the html which can be slow Note: This is a parsing operation and not part of the standard API""" if self._h...
Python
jtatman_500k
function get_jackknife_centers_epsfile des_region ncen extra=none begin set d = call get_jackknife_centers_dir des_region set fname = list string jackknife des_region string %06d % ncen if extra is not none begin set fname = fname + list extra end set fname = join string - fname set fname = string %s.eps % fname return...
def get_jackknife_centers_epsfile(des_region, ncen, extra=None): d=get_jackknife_centers_dir(des_region) fname=['jackknife',des_region,'%06d' % ncen] if extra is not None: fname += [extra] fname='-'.join(fname) fname = '%s.eps' % fname return os.path.join(d, fname)
Python
nomic_cornstack_python_v1
function wait self begin debug string Waiting for search to finish join _searchthread if _exception and _raise_errors begin raise _exception end end function
def wait(self): log.debug('Waiting for search to finish') self._searchthread.join() if self._exception and self._raise_errors: raise self._exception
Python
nomic_cornstack_python_v1
comment coding=utf-8 from __future__ import division from lab3.utils import epsilon from lab3.point import Point function line_from_segment p1 p2 begin set A = y - y set B = x - x set C = x * y - x * y return tuple A B - C end function function get_intersection_point segment1 segment2 begin set L1 = call line_from_segm...
# coding=utf-8 from __future__ import division from lab3.utils import epsilon from lab3.point import Point def line_from_segment(p1, p2): A = (p1.y - p2.y) B = (p2.x - p1.x) C = (p1.x*p2.y - p2.x*p1.y) return A, B, -C def get_intersection_point(segment1, segment2): L1 = line_from_segment(segme...
Python
zaydzuhri_stack_edu_python
function log self query error begin set message = string now set query = call _shorten_query query if error != string begin set message = message + string ERR + query + string + error end else begin set message = string OK + query end write _file message + string end function
def log(self, query, error): message = str(datetime.datetime.now()) query = self._shorten_query(query) if error != "": message += " ERR " + query + " " + error else: message = " OK " + query self._file.write(message+"\n")
Python
nomic_cornstack_python_v1
function sum_2_num num1 num2 begin string 两个数相加 comment print("%d + %d = %d" % (num1, num2, num1 + num2)) return num1 + num2 end function set result = call sum_2_num 10 20 print result print type result
def sum_2_num(num1, num2): """两个数相加""" # print("%d + %d = %d" % (num1, num2, num1 + num2)) return num1 + num2 result = sum_2_num(10, 20) print(result) print(type(result))
Python
zaydzuhri_stack_edu_python
string module: _linprog.py author: Luis Paris description: - formulas from Chapra's numerical methods textbook - chapters on Constrained Optimization and Linear Programming - implemented from algorithms/pseudocode provided comments: - to install "scipy" python library on Windows: * close your Python editor - don't inst...
''' module: _linprog.py author: Luis Paris description: - formulas from Chapra's numerical methods textbook - chapters on Constrained Optimization and Linear Programming - implemented from algorithms/pseudocode provided comments: - to install "scipy" python library on Windows: * close your Python editor - don't insta...
Python
zaydzuhri_stack_edu_python
import sys import pandas as pd from csv import reader set first_arg = argv at 1 set df = read csv first_arg set maths = 0 set biology = 0 set english = 0 set physics = 0 set chem = 0 set hindi = 0 set marks = dict string maths 0 ; string biology 0 ; string english 0 ; string physics 0 ; string chem 0 ; string hindi 0 ;...
import sys import pandas as pd from csv import reader first_arg = sys.argv[1] df = pd.read_csv (first_arg) maths=biology=english=physics=chem=hindi=0 marks={ "maths": 0, "biology": 0, "english": 0, "physics":0, "chem":0, "hindi":0, "one":0, "two":0, "three":0 ...
Python
zaydzuhri_stack_edu_python
async function test_typing doof repo_info event_loop mocker begin set typing_sync = call Mock async function typing_async *args **kwargs begin string Wrap sync method to allow mocking call typing_sync *args keyword kwargs end function call object doof string typing typing_async await call run_command manager=string mit...
async def test_typing(doof, repo_info, event_loop, mocker): typing_sync = mocker.Mock() async def typing_async(*args, **kwargs): """Wrap sync method to allow mocking""" typing_sync(*args, **kwargs) mocker.patch.object(doof, 'typing', typing_async) await doof.run_command( manage...
Python
nomic_cornstack_python_v1
function get_chars l_index word begin set new_word = string try begin for i in l_index begin set new_word = new_word + word at i - 1 end return new_word end except any begin return none end end function
def get_chars(l_index, word): new_word = '' try: for i in l_index: new_word+= word[i-1] return new_word except: return None
Python
nomic_cornstack_python_v1
function tx_schema self **kwargs begin string Builds the data structure edn, and puts it in the db for s in schema begin set tx = call tx s keyword kwargs end end function
def tx_schema(self, **kwargs): """ Builds the data structure edn, and puts it in the db """ for s in self.schema.schema: tx = self.tx(s, **kwargs)
Python
jtatman_500k
function create_user self name address begin set addr = call Address description=address set user = call User name=name address=addr return tuple user addr end function
def create_user(self, name, address): addr = Address(description=address) user = User(name=name, address=addr) return user, addr
Python
nomic_cornstack_python_v1
function test_runProcedure_args self begin set s = call RPCSystem call addFunction string foo lambda x -> x + 1 set r = call runProcedure call Request string foo list 2 assert equal r 3 end function
def test_runProcedure_args(self): s = RPCSystem() s.addFunction('foo', lambda x:x+1) r = s.runProcedure(Request('foo', [2])) self.assertEqual(r, 3)
Python
nomic_cornstack_python_v1
function batch_ground parent parent_name begin print string Running on benchmarks from %s % parent_name set good = 0 set tot = 0 comment we only care about directories set dirs = list comprehension d for d in list directory parent if is directory path join path parent d set est_tot = length dirs for f in dirs begin set...
def batch_ground(parent, parent_name): print("Running on benchmarks from %s" % parent_name) good = 0 tot = 0 # we only care about directories dirs = [d for d in os.listdir(parent) if os.path.isdir(os.path.join(parent, d))] est_tot = len(dirs) for f in dirs: tot += 1 # pri...
Python
nomic_cornstack_python_v1
function test_parser_with_driver_and_destination parser begin set args = call parse_args list url string --driver string local string /path assert driver == string local assert destination == string /path end function
def test_parser_with_driver_and_destination(parser): args = parser.parse_args([url, "--driver", "local", "/path"]) assert args.driver == "local" assert args.destination == "/path"
Python
nomic_cornstack_python_v1
function random_backward_key self begin set keys = list keys backwards return keys at random integer 0 length keys - 1 end function
def random_backward_key(self): keys = list(self.backwards.keys()) return keys[random.randint(0, len(keys) - 1)]
Python
nomic_cornstack_python_v1
function __init__ self edges=none begin if edges is none begin set edges = tuple tuple 1 2 tuple 2 3 tuple 3 4 tuple 4 1 tuple 1 5 tuple 2 6 tuple 3 7 tuple 4 8 tuple 5 6 tuple 6 7 tuple 7 8 tuple 8 5 end else begin set edges = edges end end function
def __init__(self, edges=None): if edges is None: self.edges = ( (1,2), (2,3), (3,4), (4,1), (1,5), (2,6), (3,7), (4,8), (5,6), (6,7), (7,8), (8,5), ) else: self.edges = edges
Python
nomic_cornstack_python_v1
comment current 10 June 2017 comment This table should eventually be converted to an excel spreadsheet organized comment with a worksheet for each data set, and within each worksheet, each subject's information comment placed in a single row. Make the table pandas-readable. comment on the other hand, for now, it is use...
# current 10 June 2017 # This table should eventually be converted to an excel spreadsheet organized # with a worksheet for each data set, and within each worksheet, each subject's information # placed in a single row. Make the table pandas-readable. # on the other hand, for now, it is useful as is. """ The keys are t...
Python
zaydzuhri_stack_edu_python
function add_pipeline self pipeline begin comment pipeline.add_task_ready_handler(self._on_task_ready) comment pipeline.add_task_start_handler(self._on_task_start) comment pipeline.add_task_finish_handler(self._on_task_finish) call register _task_sched append _pipelines pipeline end function
def add_pipeline(self, pipeline: Pipeline): # pipeline.add_task_ready_handler(self._on_task_ready) # pipeline.add_task_start_handler(self._on_task_start) # pipeline.add_task_finish_handler(self._on_task_finish) pipeline.register(self._task_sched) self._pipelines.append(pipeline)
Python
nomic_cornstack_python_v1
function test_tfrecord_to_mindrecord_with_special_field_name begin if not tf or __version__ < SupportedTensorFlowVersion begin comment skip the test warning format string Module tensorflow is not found or version wrong, please use pip install it / reinstall version >= {}. SupportedTensorFlowVersion return end set file_...
def test_tfrecord_to_mindrecord_with_special_field_name(): if not tf or tf.__version__ < SupportedTensorFlowVersion: # skip the test logger.warning("Module tensorflow is not found or version wrong, \ please use pip install it / reinstall version >= {}.".format(SupportedTensorFlowVersion)...
Python
nomic_cornstack_python_v1
function analyseMolecule self begin for i in range sizeMol begin call analyseAtom atoms at i end end function
def analyseMolecule (self): for i in range(self.sizeMol): self.analyseAtom(self.atoms[i])
Python
nomic_cornstack_python_v1
function configExternalRouter self P_Prefix P_stable R_Preference=0 begin string configure border router with a given external route prefix entry Args: P_Prefix: IPv6 prefix for the route P_Stable: is true if the external route prefix is stable network data R_Preference: a two-bit signed integer indicating Router prefe...
def configExternalRouter(self, P_Prefix, P_stable, R_Preference=0): """configure border router with a given external route prefix entry Args: P_Prefix: IPv6 prefix for the route P_Stable: is true if the external route prefix is stable network data R_Preference: a two...
Python
jtatman_500k
function meet_the_specs self version begin set op_map = dict string == string eq ; string = string eq ; string eq string eq ; string < string lt ; string lt string lt ; string <= string le ; string le string le ; string > string gt ; string gt string gt ; string >= string ge ; string ge string ge ; string != string ne ...
def meet_the_specs(self, version): op_map = { '==': 'eq', '=': 'eq', 'eq': 'eq', '<': 'lt', 'lt': 'lt', '<=': 'le', 'le': 'le', '>': 'gt', 'gt': 'gt', '>=': 'ge', 'ge': 'ge', '!=': 'ne', '<>': 'ne', 'ne': 'ne' } for spe...
Python
nomic_cornstack_python_v1
comment calculating probability string keywords in emails spam non-spam free 0.7 0.2 now 0.6 0.3 low 0.2 0.5 economics 0.1 0.6 set spam = 0.6 * 0.7 * 0.1 * 0.7 set non_spam = 0.3 * 0.2 * 0.6 * 0.3 print spam non_spam string COVID-19 test sick people: 95% positive test result healthy people: 6% positive test result sick...
# calculating probability """ keywords in emails spam non-spam free 0.7 0.2 now 0.6 0.3 low 0.2 0.5 economics 0.1 0.6 """ spam = .6 * .7 * .1 * .7 non_spam = .3 * .2 * .6 * .3 print(spam, non_spam) """ COVID-19 test sick people: 95% positive test result healthy peopl...
Python
zaydzuhri_stack_edu_python
function test_get_details11 self begin pass end function
def test_get_details11(self): pass
Python
nomic_cornstack_python_v1
from turtle import Turtle , Screen import time from snake_v2 import Snake from food import Food from scoreboard import Scoreboard set screen = call Screen setup screen width=600 height=600 call bgcolor string black call tracer 0 set scoreboard = call Scoreboard title screen string Snake Game set snake = call Snake set ...
from turtle import Turtle,Screen import time from snake_v2 import Snake from food import Food from scoreboard import Scoreboard screen = Screen() screen.setup(width=600,height=600) screen.bgcolor("black") screen.tracer(0) scoreboard = Scoreboard() screen.title("Snake Game") snake = Snake() food = Food...
Python
zaydzuhri_stack_edu_python
comment real signature unknown function init_pair *args **kwargs begin pass end function
def init_pair(*args, **kwargs): # real signature unknown pass
Python
nomic_cornstack_python_v1
function updateNamespace self begin import addict set namespace at string config = dictionary namespace at string config end function
def updateNamespace(self): import addict self.namespace['config'] = addict.Dict(self.namespace['config'])
Python
nomic_cornstack_python_v1
function min_size self begin return get pulumi self string min_size end function
def min_size(self) -> pulumi.Input[int]: return pulumi.get(self, "min_size")
Python
nomic_cornstack_python_v1
import nltk set names = names set male_names = call words string male.txt set female_names = call words string female.txt set male_names = list comprehension w for w in male_names set female_names = list comprehension w for w in female_names print string Male Name male_names print string Female Name female_names commen...
import nltk names=nltk.corpus.names male_names=names.words('male.txt') female_names=names.words('female.txt') male_names= [w for w in male_names] female_names =[w for w in female_names] print("Male Name ", male_names) print("Female Name ", female_names) #gives the freq distribution of last letter in names cfd ...
Python
zaydzuhri_stack_edu_python
function navigation_dash flask_app begin set dash_app = call Dash server=flask_app title=string Navigation assets_folder=string ../dash_app/assets routes_pathname_prefix=string /navigation_dash/ external_stylesheets=list BOOTSTRAP FA comment Creating the app layout set layout = call Div id=string page_content children=...
def navigation_dash(flask_app): dash_app = dash.Dash(server=flask_app, title='Navigation', assets_folder='../dash_app/assets', routes_pathname_prefix="/navigation_dash/", external_stylesheets=[dbc.themes.BOOTSTRAP, FA]) ## Creating the app layout dash_app.l...
Python
nomic_cornstack_python_v1
import argparse from hmm_tagger import HMMTagger class HMMTaggerCoNLL2000 extends HMMTagger begin function __init__ self train_path intermediate_path load_vars=false beam_search_n=none begin call __init__ train_path=train_path intermediate_path=intermediate_path load_vars=load_vars beam_search_n=beam_search_n end funct...
import argparse from hmm_tagger import HMMTagger class HMMTaggerCoNLL2000(HMMTagger): def __init__(self, train_path, intermediate_path, load_vars=False, beam_search_n=None): super(HMMTaggerCoNLL2000, self).__init__( ...
Python
zaydzuhri_stack_edu_python
function __call__ self x_input return_logits=false begin set reuse = if expression built then true else none with call as_default as g1 begin with call Session graph=g1 as sess begin set input_graph_def = graph_def load loader sess list string serve string ./modelComdef set g1def = call convert_variables_to_constants s...
def __call__(self, x_input, return_logits=False): reuse = True if self.built else None with tf.Graph().as_default() as g1: with tf.Session(graph=g1) as sess: input_graph_def = saved_model_utils.get_meta_graph_def( "./modelComdef", tag_constants.SERVING).graph_def tf.saved_model...
Python
nomic_cornstack_python_v1
function __init__ self items=none begin if items is not none begin set items = items end else begin set items = list end end function
def __init__(self, items=None): if items is not None: self.items = items else: self.items = []
Python
nomic_cornstack_python_v1
function test_need_login_to_see_meterdetails self begin set url = reverse string api_v1:meter-detail args=list 1 set response = get client url follow=true assert equal status_code 403 end function
def test_need_login_to_see_meterdetails(self): url = reverse('api_v1:meter-detail', args=[1]) response = self.client.get(url, follow=True) self.assertEqual(response.status_code, 403)
Python
nomic_cornstack_python_v1
class Cat begin function __init__ self ålder namn färg favoritgodis begin set ålder = ålder set namn = namn set färg = färg set favoritgodis = favoritgodis end function function __repr__ self begin return namn + ålder + färg + favoritgodis end function end class set c1 = call Cat string 1 string 2 string blå string 3 s...
class Cat: def __init__(self, ålder, namn, färg, favoritgodis): self.ålder = ålder self.namn = namn self.färg = färg self.favoritgodis = favoritgodis def __repr__(self): return self.namn + self.ålder + self.färg + self.favoritgodis c1 = Cat("1", "2", "blå", "3")...
Python
zaydzuhri_stack_edu_python
function PS1toSDSS self table begin if table is not none begin set pscolor = table at string g - table at string i for filter in ps1colorterms begin set colorcorrection = call polyval ps1colorterms at filter pscolor set table at filter = table at filter - colorcorrection end end return table end function
def PS1toSDSS(self, table): if table is not None: pscolor = table['g'] - table['i'] for filter in self.ps1colorterms: colorcorrection = np.polyval(self.ps1colorterms[filter], pscolor) table[filter] -= colorcorrection return table
Python
nomic_cornstack_python_v1
function _get_weight_matrix self tt i store=true begin try begin return _weights at i end except any begin function _get_weights tt begin set tt = call asarray tt set W = zeros tuple size size set h = diff np tt for i in range length tt begin set W at tuple i slice : i : = W at tuple i slice : i : + 0.5 * h at slic...
def _get_weight_matrix(self, tt, i, store=True): try: return self._weights[i] except: def _get_weights(tt): tt = np.asarray(tt) W = np.zeros((tt.size, tt.size)) h = np.diff(tt) for i in range(len(tt)): ...
Python
nomic_cornstack_python_v1
function _create_connection self url begin set parsed_url = url parse url set connection = none if scheme == string https begin set connection = call HTTPSConnection netloc port key_file cert_file end else begin set connection = call HTTPConnection netloc port end return connection end function
def _create_connection(self, url): parsed_url = urlparse.urlparse(url) connection = None if parsed_url.scheme == 'https': connection = httplib.HTTPSConnection(parsed_url.netloc, parsed_url.port, ...
Python
nomic_cornstack_python_v1
from wpilib import SmartDashboard from ctre import WPI_TalonSRX as Talon from wpilib import SmartDashboard from wpilib import PIDController from wpilib import RobotBase import wpilib import map import oi from sim import simComms import math comment gravity for cargo ship is -.1, angle is -28 comment gravity for rocket ...
from wpilib import SmartDashboard from ctre import WPI_TalonSRX as Talon from wpilib import SmartDashboard from wpilib import PIDController from wpilib import RobotBase import wpilib import map import oi from sim import simComms import math #gravity for cargo ship is -.1, angle is -28 #gravity for rocket is .15, angle...
Python
zaydzuhri_stack_edu_python
comment x = 7 comment y = 3 comment total = x + y comment print(total) comment print(type(x)) comment a = 10.8 + 12.2 + 0.2 comment print(a) comment print(type(a)) comment b = 17 % 5 comment print(b) comment print('Welcome to python!') comment print("Welcome to python!") comment print("Welcome", "to", "python!") commen...
# x = 7 # y = 3 # total = x + y # print(total) # print(type(x)) # # a = 10.8 + 12.2 + 0.2 # print(a) # print(type(a)) # # b = 17 % 5 # print(b) # # print('Welcome to python!') # print("Welcome to python!") # print("Welcome", "to", "python!") # print("Welcome\nto\n\npython!\tProgramming") # # Ignoring a Line Break in a ...
Python
zaydzuhri_stack_edu_python
import os import csv import numpy as np import time from enum import Enum from PIL import Image from collections import Counter string This File implements classes necessary to build a decision tree for different translation types. Much of this file is re-use of code from a previous class -> CS6601 Artificial Intellige...
import os import csv import numpy as np import time from enum import Enum from PIL import Image from collections import Counter """ This File implements classes necessary to build a decision tree for different translation types. Much of this file is re-use of code from a previous class -> CS6601 Artificial Intelligen...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python comment -*- coding: utf-8 -*- comment @Time : 2017/8/31 20:44 comment @Author : 李振华 import tkinter comment 第一个tkinter的界面 comment application [ˌæplɪ'keɪʃ(ə)n] 应用程序 function application begin comment 创建一个窗口对象 set top = call Tk comment 设置主循环 call mainloop end function if __name__ == string __m...
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/8/31 20:44 # @Author : 李振华 import tkinter # 第一个tkinter的界面 # application [ˌæplɪ'keɪʃ(ə)n] 应用程序 def application(): # 创建一个窗口对象 top = tkinter.Tk() # 设置主循环 top.mainloop() if __name__ == "__main__": # 调用函数 application()
Python
zaydzuhri_stack_edu_python
function __init__ self *args **kwargs begin call PaintDC_swiginit self call new_PaintDC *args keyword kwargs end function
def __init__(self, *args, **kwargs): _gdi_.PaintDC_swiginit(self,_gdi_.new_PaintDC(*args, **kwargs))
Python
nomic_cornstack_python_v1