code
stringlengths
10
2.58M
original_code
stringlengths
3
3.18M
original_language
stringclasses
1 value
source
stringclasses
7 values
comment Every variable is measured in an SI second comment As of January 1, 2017 CE, we were about 29.691992871777067 parts behind schedule. import math import time from datetime import * comment 23.9344699 hours or 0.99726958 mean solar days set secondsInADay = 86164.0916 comment All Sidereal set secondsInAYear = 3155...
#Every variable is measured in an SI second #As of January 1, 2017 CE, we were about 29.691992871777067 parts behind schedule. import math import time from datetime import * secondsInADay = 86164.0916 #23.9344699 hours or 0.99726958 mean solar days secondsInAYear = 31558149.5 #All Sidereal ephemerisDay = 86400 z = date...
Python
zaydzuhri_stack_edu_python
function __init__ self *args **kwds begin if args or kwds begin call __init__ *args keyword kwds comment message fields cannot be None, assign default values for those that are if header is none begin set header = call Header end if battery_voltage is none begin set battery_voltage = 0.0 end if flight_mode_ll is none b...
def __init__(self, *args, **kwds): if args or kwds: super(mav_monitor, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.header is None: self.header = std_msgs.msg.Header() if self.battery_voltage is None: self.batt...
Python
nomic_cornstack_python_v1
function mark_failed self test begin if not test begin warn string Empty or None test name passed to standard_json_util return end if test in tests begin set tests at test at string actual = tests at test at string actual + string FAIL set tests at test at string is_unexpected = true end else begin set tests at test = ...
def mark_failed(self, test): if not test: LOGGER.warn('Empty or None test name passed to standard_json_util') return if test in self.tests: self.tests[test]['actual'] = self.tests[test]['actual'] + " FAIL" self.tests[test]['is_unexpected'] = True else: self.tests[test] = { ...
Python
nomic_cornstack_python_v1
function __init__ self begin set svclassifier = support vector classifier kernel=string linear end function
def __init__(self): self.svclassifier = SVC(kernel='linear')
Python
nomic_cornstack_python_v1
import webapp2 import logging import urllib import urllib2 import oauth2 import json from jsonpath_rw import jsonpath , parse class MainPage extends RequestHandler begin function get self begin set headers at string Content-Type = string text/plain write response string Hello, World end function end class class SearchH...
import webapp2 import logging import urllib import urllib2 import oauth2 import json from jsonpath_rw import jsonpath, parse class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.write('Hello, World') class SearchHandler(webapp2.R...
Python
zaydzuhri_stack_edu_python
function transient exit_delay=time delta seconds=10 begin function _TransientActor actor_class begin function receiveMessage self msg sender begin if not get attribute self string _TransientExitScheduled none begin call wakeupAfter exit_delay set _TransientExitScheduled = now + exit_delay end if is instance msg WakeupM...
def transient(exit_delay=timedelta(seconds=10)): def _TransientActor(actor_class): def receiveMessage(self, msg, sender): if not getattr(self, '_TransientExitScheduled', None): self.wakeupAfter(exit_delay) self._TransientExitScheduled = datetime.now() + exit_delay...
Python
nomic_cornstack_python_v1
function rearrange_array array begin comment Step 1 set result = list comment Step 2 for num in array begin comment Step 3 if num % 3 == 0 begin append result num end end comment Step 4 for num in array begin comment Step 5 if num % 3 != 0 begin append result num end end comment Step 6 return result end function comme...
def rearrange_array(array): result = [] # Step 1 for num in array: # Step 2 if num % 3 == 0: # Step 3 result.append(num) for num in array: # Step 4 if num % 3 != 0: # Step 5 result.append(num) return result # Step 6 # Test case input_array = ...
Python
jtatman_500k
import copy import itertools import time from dataclasses import dataclass from typing import Dict , List , Optional , Tuple set SPACE_VACANT = string ░ * 2 set SPACE_POPULATED = string █ * 2 set BOARD_SIZE = tuple 25 25 decorator dataclass class Location begin set x : int set y : int function __hash__ self begin retur...
import copy import itertools import time from dataclasses import dataclass from typing import Dict, List, Optional, Tuple SPACE_VACANT = "\u2591" * 2 SPACE_POPULATED = "\u2588" * 2 BOARD_SIZE = (25, 25) @dataclass class Location: x: int y: int def __hash__(self) -> int: return hash(f"{self.x,sel...
Python
zaydzuhri_stack_edu_python
from pandas import Series , DataFrame import pandas as pd import numpy as np import os import csv import xlrd import time import matplotlib.pyplot as plt import pytz comment package developed to do stats analyses import statsmodels.api as sm from datetime import datetime , timedelta comment use this to ensure dates are...
from pandas import Series, DataFrame import pandas as pd import numpy as np import os import csv import xlrd import time import matplotlib.pyplot as plt import pytz import statsmodels.api as sm #package developed to do stats analyses from datetime import datetime, timedelta from dateutil import parser #use this to ensu...
Python
zaydzuhri_stack_edu_python
import pandas as pd from sqlalchemy import create_engine set host = string XXXX set user = string XXXX set password = string XXXX set db = string XXXX set engine = call create_engine string mysql+mysqlconnector:// { user } : { password } @ { host } / { db } pool_pre_ping=true set df = read csv string data.csv comment s...
import pandas as pd from sqlalchemy import create_engine host = 'XXXX' user = 'XXXX' password = 'XXXX' db = 'XXXX' engine = create_engine(f"mysql+mysqlconnector://{user}:{password}@{host}/{db}", pool_pre_ping=True) df = pd.read_csv(r"data.csv") df['Category'] = df['Category'].str.lstrip().str.rstrip() #scraped data...
Python
zaydzuhri_stack_edu_python
from bs4 import BeautifulSoup import re import json function getNewCourseObj begin set obj = dict string code string ; string name string ; string lecs dict ; string tuts dict ; string pracs dict return obj end function function getNewLectureObj begin set obj = dict string days list ; string starts list ; string...
from bs4 import BeautifulSoup import re import json def getNewCourseObj(): obj = {"code": "", "name": "", "lecs": {}, "tuts": {}, "pracs": {}} return obj def getNewLectureObj(): obj = {"days": [], "starts": [], "ends": [], "rooms": [], "prof": ""} return obj def validateCourse(obj): validity =...
Python
zaydzuhri_stack_edu_python
comment **************************************************************************** # comment # comment ::: :::::::: # comment 00_parentheses.py :+: :+: :+: # comment +:+ +:+ +:+ # comment By: szheng <marvin@42.fr> +#+ +:+ +#+ # comment +#+#+#+#+#+ +#+ # comment Created: 2018/10/17 15:28:32 by szheng #+# #+# # comment...
# **************************************************************************** # # # # ::: :::::::: # # 00_parentheses.py :+: :+: :+: ...
Python
zaydzuhri_stack_edu_python
comment !/usr/bin/env python3 comment -*- coding: utf-8 -*- string Created on Mon Aug 16 13:25:09 2021 @author: avmejia if false begin print string dentro del if print string segunda instruccion end else if 5 > 0 begin print string dentro del elif end else begin print string dentro del else end print string fuera de la...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 16 13:25:09 2021 @author: avmejia """ if (False): print("dentro del if") print("segunda instruccion") elif (5 > 0): print("dentro del elif") else: print("dentro del else") print("fuera de la decision") if(False): print("dentro...
Python
zaydzuhri_stack_edu_python
function generate_2D_plot x y labels_dict file_title plot_title begin set fig = figure plot x y if labels_dict begin x label labels_dict at string x y label labels_dict at string y end if plot_title begin title plt plot_title end save figure file_title end function
def generate_2D_plot(x, y, labels_dict, file_title, plot_title): fig = plt.figure() plt.plot(x, y) if labels_dict: plt.xlabel(labels_dict["x"]) plt.ylabel(labels_dict["y"]) if plot_title: plt.title(plot_title) plt.savefig(file_title)
Python
nomic_cornstack_python_v1
from typing import List function solution A K begin set K = if expression A and length A < K then K % length A else K return A at slice - K : : + A at slice 0 : - K : end function
from typing import List def solution(A: List[int], K: int) -> List[int]: K = K % len(A) if A and len(A) < K else K return A[-K:] + A[0:-K]
Python
zaydzuhri_stack_edu_python
comment More on Graph Inspection import tensorflow as tf set a = call constant 2 name=string a set b = call get_variable string b list dtype=int32 set c = a + b set g = call get_default_graph set ops_list = call get_operations print print string tf.Variable objects are really a bundle of four operations (and their cor...
#### More on Graph Inspection import tensorflow as tf a = tf.constant(2, name='a') b = tf.get_variable('b', [], dtype=tf.int32) c = a + b g = tf.get_default_graph() ops_list = g.get_operations() print() print("tf.Variable objects are really a bundle of four operations (and their corresponding tensors):") print(b) ...
Python
zaydzuhri_stack_edu_python
function solution seq n begin set i = 0 set j = 0 set ret = string while i < length seq and j < n begin if not is alpha seq at i and j + 2 <= n begin set ret = ret + seq at slice i : i + 3 : set i = i + 3 set j = j + 2 end else if is alpha seq at i begin comment ĸ set ret = ret + seq at i set i = i + 1 set j = j + 1 ...
def solution(seq, n): i = 0 j = 0 ret = '' while i < len(seq) and j < n: if not seq[i].isalpha() and j+2 <= n: ret += seq[i:i+3] i += 3 j += 2 elif seq[i].isalpha(): # ĸ ret += seq[i] i += 1 j += 1 ...
Python
zaydzuhri_stack_edu_python
import json function convert_json_string string begin return loads string end function comment Returns { "a": 1, "b": 2, "c": 3 } call convert_json_string string
import json def convert_json_string(string): return json.loads(string) convert_json_string(string) # Returns { "a": 1, "b": 2, "c": 3 }
Python
flytech_python_25k
function parse_data_line self line begin string Parses the data line into a dictionary for the importer set it = call _generate line set reader = dict reader it fieldnames=headers set values = next set values at string DefaultResult = string ResidualError set values at string LineName = sub string \W string strip valu...
def parse_data_line(self, line): """ Parses the data line into a dictionary for the importer """ it = self._generate(line) reader = csv.DictReader(it, fieldnames=self.headers) values = reader.next() values['DefaultResult'] = 'ResidualError' ...
Python
jtatman_500k
function get_activation self activation begin if activation == string leaky_relu begin set layer = leaky relu alpha=0.2 end else begin set layer = call Activation activation end return layer end function
def get_activation(self, activation): if activation == 'leaky_relu': layer = LeakyReLU(alpha=0.2) else: layer = Activation(activation) return layer
Python
nomic_cornstack_python_v1
function prepare_df start_date=string 2016-01-01 end_date=string 2021-12-31 begin set df = call read_csv_all_stocks call read_pickle_file string utils/data/column_file.py string utils/data/data_30_2016.csv comment swap levels to be able to call the symbol directly. set df = call swaplevel i=- 2 j=- 1 axis=1 comment ens...
def prepare_df(start_date='2016-01-01', end_date="2021-12-31"): df = read_csv_all_stocks(read_pickle_file('utils/data/column_file.py'), 'utils/data/data_30_2016.csv') df = df.swaplevel(i=- 2, j=- 1, axis=1) # swap levels to be able to call the symbol directly. # ensure we only have data from the provid...
Python
nomic_cornstack_python_v1
function contfrac_to_frac seq begin set tuple num den = tuple 1 0 for u in reversed seq begin set tuple num den = tuple den + num * u num end return tuple num den end function
def contfrac_to_frac(seq: List[int]) -> Tuple[int, int]: num, den = 1, 0 for u in reversed(seq): num, den = den + num * u, num return num, den
Python
nomic_cornstack_python_v1
from __future__ import division import numpy as np import sklearn as sk from sklearn.linear_model import LogisticRegression from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis from sklearn.naive_bayes import GaussianNB import matplotlib as mpl import matplotlib.pyplot as plt from bonnerlib2 import d...
from __future__ import division import numpy as np import sklearn as sk from sklearn.linear_model import LogisticRegression from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis from sklearn.naive_bayes import GaussianNB import matplotlib as mpl import matplotlib.pyplot as plt from bonnerlib2 import d...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import datetime import time import sys , os , errno import urllib comment Data e hora function dataehora begin print string print string Data e hora: + string format time now string %d-%m-%y-%H:%M print string end function comment Pegando conte...
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import requests import datetime import time import sys, os, errno import urllib # Data e hora def dataehora(): print ('') print ("Data e hora: " + datetime.datetime.now().strftime("%d-%m-%y-%H:%M")) print ('') # Pegando conteúdo def pegarconteudo(url): aux...
Python
zaydzuhri_stack_edu_python
function calc_demagspatial self begin return call calc_demagspatial focallength focallength end function
def calc_demagspatial(self): return calc_demagspatial(self.collimator.focallength, self.camera.focallength)
Python
nomic_cornstack_python_v1
comment print(len(a)) set dict = dict string Google string www.google.com ; string Runoob string www.runoob.com ; string taobao string www.taobao.com comment print(dict.items()) for i in items dict begin print i end
# print(len(a)) dict = {'Google': 'www.google.com', 'Runoob': 'www.runoob.com', 'taobao': 'www.taobao.com'} # print(dict.items()) for i in dict.items(): print(i)
Python
zaydzuhri_stack_edu_python
function djr S T kappa d begin comment Equation of Mass in solar masses, per pixel set M = 0.39 * S * exp 17.0 / T - 1.0 * kappa / 0.012 ^ - 1.0 * d / 250.0 ^ 2.0 end function
def djr(S,T,kappa,d): #Equation of Mass in solar masses, per pixel M = 0.39*S*(np.exp(17.0/T)-1.0)*((kappa/0.012)**(-1.0))*((d/250.0)**2.0)
Python
nomic_cornstack_python_v1
function success_threshold self begin return get pulumi self string success_threshold end function
def success_threshold(self) -> Optional[int]: return pulumi.get(self, "success_threshold")
Python
nomic_cornstack_python_v1
class Solution begin decorator staticmethod function subsets nums begin set result = list list for num in nums begin set result = result + list comprehension sub_set + list num for sub_set in result end return result end function end class if __name__ == string __main__ begin print call subsets list 1 2 3 end
class Solution: @staticmethod def subsets(nums: list) -> list: result = [[]] for num in nums: result += [sub_set + [num] for sub_set in result] return result if __name__ == '__main__': print(Solution().subsets([1, 2, 3]))
Python
zaydzuhri_stack_edu_python
function load_pty finder module begin call IgnoreName string sgi end function
def load_pty(finder, module): module.IgnoreName("sgi")
Python
nomic_cornstack_python_v1
function load_frame_building_test_data fb begin call load_building_test_data fb set bay_lengths = list 6.0 6.0 6.0 set beam_depths = list 0.5 set n_seismic_frames = 3 set n_gravity_frames = 0 end function
def load_frame_building_test_data(fb): load_building_test_data(fb) fb.bay_lengths = [6., 6.0, 6.0] fb.beam_depths = [.5] fb.n_seismic_frames = 3 fb.n_gravity_frames = 0
Python
nomic_cornstack_python_v1
function dayslice fileindex hourlist=list comprehension i for i in call xrange 0 24 minutelist=none begin set imageset = list sort hourlist if not minutelist begin set minutelist = list 0 end sort minutelist end function
def dayslice(fileindex, hourlist=[i for i in xrange(0, 24)], minutelist=None): imageset = [] hourlist.sort() if not minutelist: minutelist = [0] minutelist.sort()
Python
nomic_cornstack_python_v1
comment input upp list function career_choice self upp begin if upp at 4 == max upp begin set career = Navy end else if upp at 0 == max upp begin set career = call random_choice list Scouts Marines end else if upp at 2 == max upp begin set career = Army end else if upp at 3 == max upp begin set career = Merchants end e...
def career_choice (self, upp): #input upp list if upp[4]==max(upp): career=self.Navy elif upp[0]==max(upp): career=game.random_choice([self.Scouts, self.Marines]) elif upp[2]==max(upp): career=self.Army elif upp[3]==max(upp): career=self.Merchants else: career=self.Other return car...
Python
nomic_cornstack_python_v1
function init_response res_str=none data=none begin set response = dict set response at string res_str = string set response at string res_data = dict if res_str is not none begin set response at string res_str = res_str end if data is not none begin set response at string res_data = data end return response end fun...
def init_response(res_str=None, data=None): response = {} response["res_str"] = "" response["res_data"] = {} if res_str is not None: response["res_str"] = res_str if data is not None: response["res_data"] = data return response
Python
nomic_cornstack_python_v1
function generate self num_blocks begin set blocks = call generatetoaddress num_blocks _address for b in blocks begin set cb_tx = call getblock blockhash=b verbosity=2 at string tx at 0 append _utxos dict string txid cb_tx at string txid ; string vout 0 ; string value cb_tx at string vout at 0 at string value end retur...
def generate(self, num_blocks): blocks = self._test_node.generatetoaddress(num_blocks, self._address) for b in blocks: cb_tx = self._test_node.getblock(blockhash=b, verbosity=2)['tx'][0] self._utxos.append({'txid': cb_tx['txid'], 'vout': 0, 'value': cb_tx['vout'][0]['value']}) ...
Python
nomic_cornstack_python_v1
function clean_exit *args begin set return_code = 0 for ref in CLEANUP_FUNCTIONS begin try begin set fn = call ref if fn begin call fn end end except Exception begin set return_code = 1 exception string Failure during signal handling end end exit return_code end function
def clean_exit(*args): return_code = 0 for ref in CLEANUP_FUNCTIONS: try: fn = ref() if fn: fn() except Exception: return_code = 1 log.exception("Failure during signal handling") sys.exit(return_code)
Python
nomic_cornstack_python_v1
import numpy as np from scipy import stats from numpy import random class GaussianHMM begin function __init__ self num_hidden_states=1 dim_observation=1 init_parameters=true begin set __num_hidden_states = num_hidden_states set __dim_observation = dim_observation set __has_parameters = false if init_parameters begin co...
import numpy as np from scipy import stats from numpy import random class GaussianHMM: def __init__(self, num_hidden_states=1, dim_observation=1, init_parameters=True): self.__num_hidden_states = num_hidden_states self.__dim_observation = dim_observation self.__has_parameters = False ...
Python
zaydzuhri_stack_edu_python
function _reset self begin call reset return call TimeStep FIRST call float32 0.0 DISCOUNT zeros 23 dtype=float32 end function
def _reset(self): self.spot_supervisor.reset() return ts.TimeStep(ts.StepType.FIRST, np.float32(0.0), DISCOUNT, np.zeros(23, dtype=np.float32))
Python
nomic_cornstack_python_v1
function persist_scan_results self scan_reports begin if not use_s3_integration or not s3_client begin return end if not bucket or not repo_path begin error string Something went wrong: bucket { bucket } , repo path { repo_path } return end comment just process reports with actual results in it set scan_reports = list ...
def persist_scan_results(self, scan_reports: list[Report]) -> None: if not self.use_s3_integration or not self.s3_client: return if not self.bucket or not self.repo_path: logging.error(f"Something went wrong: bucket {self.bucket}, repo path {self.repo_path}") return ...
Python
nomic_cornstack_python_v1
function testSetPowerWithNegativeFloat self begin function setPower begin set power = - 20.1 end function set HALT_ON_ERROR = true assert raises ValueError setPower set HALT_ON_ERROR = false call setPower assert equal tuple call Decimal string 0.0 call Decimal string 0.0 call Decimal string 0.0 power end function
def testSetPowerWithNegativeFloat(self): def setPower(): self.node.power = -20.1 cdl_convert.config.HALT_ON_ERROR = True self.assertRaises( ValueError, setPower ) cdl_convert.config.HALT_ON_ERROR = False setPower() self.ass...
Python
nomic_cornstack_python_v1
from models.item import ItemModel from tests.base_test import BaseTest class ItemTest extends BaseTest begin function test_crud self begin with app_context begin set item = call ItemModel string Piano 20.0 comment assert item does not exit in db assert is none call find_by_name string Piano string Error: found item { n...
from models.item import ItemModel from tests.base_test import BaseTest class ItemTest(BaseTest): def test_crud(self): with self.app_context: item = ItemModel('Piano', 20.00) # assert item does not exit in db self.assertIsNone(ItemModel.find_by_name('Piano'), ...
Python
zaydzuhri_stack_edu_python
function DivideAndConquer arr panjangArrAsli begin if length arr > 1 begin comment implement merge sort# comment mencari mid array set mid = length arr // 2 comment membagi elemen array dari mid ke kiri set L = arr at slice : mid : comment membagi elemen array dari mid ke kanan set R = arr at slice mid : : comment ...
def DivideAndConquer(arr, panjangArrAsli): if len(arr) > 1: ###################### #implement merge sort# ###################### # mencari mid array mid = len(arr)//2 # membagi elemen array dari mid ke kiri L = arr[:mid] # membagi elem...
Python
zaydzuhri_stack_edu_python
comment -*- coding: utf-8 -*- comment Sample Python code for youtube.channels.list comment See instructions for running these code samples locally: comment https://developers.google.com/explorer-help/guides/code_samples#python import os import google_auth_oauthlib.flow import googleapiclient.discovery import googleapic...
# -*- coding: utf-8 -*- # Sample Python code for youtube.channels.list # See instructions for running these code samples locally: # https://developers.google.com/explorer-help/guides/code_samples#python import os import google_auth_oauthlib.flow import googleapiclient.discovery import googleapiclient.error...
Python
zaydzuhri_stack_edu_python
comment Shahar Engel comment חתימות הפונקציות שלי נראות כך (ולא כמו במטלה) כי גרסת הפייתון שלי לא תומכת בחתימות של המטלה class Agent begin function __init__ self name values begin set name = name set values = values end function comment נעזרתי בעמית רן כדי להבין איך לממש את פונקציה זו function value self option begin r...
# Shahar Engel # חתימות הפונקציות שלי נראות כך (ולא כמו במטלה) כי גרסת הפייתון שלי לא תומכת בחתימות של המטלה class Agent: def __init__(self, name, values): self.name = name self.values = values # נעזרתי בעמית רן כדי להבין איך לממש את פונקציה זו def value(self, option): return se...
Python
zaydzuhri_stack_edu_python
function iter_related self concept relation max_degree_of_separation=2 begin set queue = deque list tuple concept 0 while queue begin set tuple current_concept depth = call popleft set depth = depth + 1 for tuple target rel in items get self current_concept dict begin if rel == relation and depth <= max_degree_of_separ...
def iter_related(self, concept, relation, max_degree_of_separation=2): queue = deque([(concept, 0)]) while queue: current_concept, depth = queue.popleft() depth += 1 for target, rel in self.get(current_concept, {}).items(): if rel == relation and depth...
Python
nomic_cornstack_python_v1
function ensure_date_set self message begin if not _date begin raise call EIMParsingError string Date not parsed and set in %s % _filepath end end function
def ensure_date_set(self, message): if not self._date: raise EIMParsingError('Date not parsed and set in %s' % self._filepath)
Python
nomic_cornstack_python_v1
function auth_uri self auth_uri begin set _auth_uri = auth_uri end function
def auth_uri(self, auth_uri): self._auth_uri = auth_uri
Python
nomic_cornstack_python_v1
function get_input_fnames_data_quality cfg subject session run task begin set kwargs = dictionary cfg=cfg subject=subject session=session add_bads=false set in_files = call _get_run_rest_noise_path run=run task=task kind=string orig mf_reference_run=mf_reference_run keyword kwargs comment When doing autobad for the noi...
def get_input_fnames_data_quality( *, cfg: SimpleNamespace, subject: str, session: Optional[str], run: Optional[str], task: Optional[str], ) -> dict: kwargs = dict( cfg=cfg, subject=subject, session=session, add_bads=False, ) in_files = _get_run_rest_n...
Python
nomic_cornstack_python_v1
comment importing linear models import random import time import matplotlib.pyplot as plt import numpy as np from scipy.stats import uniform as sp_rand from sklearn.linear_model import Ridge from sklearn.metrics import r2_score , mean_squared_error , mean_absolute_error from sklearn.model_selection import RandomizedSea...
# importing linear models import random import time import matplotlib.pyplot as plt import numpy as np from scipy.stats import uniform as sp_rand from sklearn.linear_model import Ridge from sklearn.metrics import r2_score, mean_squared_error, mean_absolute_error from sklearn.model_selection import RandomizedSearchCV ...
Python
zaydzuhri_stack_edu_python
function map name begin set map = name end function
def map(name): env.map = name
Python
nomic_cornstack_python_v1
set sentence = input print join string generator expression if expression is lower letter then upper letter else lower letter for letter in sentence
sentence = input() print(''.join(letter.upper() if letter.islower() else letter.lower() for letter in sentence))
Python
zaydzuhri_stack_edu_python
function check_for_no_improvement_decay self ni_buffer begin set no_improvement = call check_no_improvement if no_improvement and hparams at NO_IMPROV_LR_DECAY < 1.0 and ni_buffer <= 0 begin comment setting lr on the schedulers for tuple j base_lr in enumerate base_lrs begin set base_lrs at j = base_lr * hparams at NO_...
def check_for_no_improvement_decay(self, ni_buffer): no_improvement = self.check_no_improvement() if no_improvement and self.hparams[HyperParamKey.NO_IMPROV_LR_DECAY] < 1.0 and ni_buffer <= 0: # setting lr on the schedulers for j, base_lr in enumerate(self.enc_scheduler.base_lrs)...
Python
nomic_cornstack_python_v1
import time import requests import os import random print string python > Hello, docker. set DAPR_HTTP_PORT = call getenv string DAPR_HTTP_PORT 3500 set BASE_URL = format string http://localhost:{0}/v1.0/invoke/{{}}//method/order DAPR_HTTP_PORT function post_order app_id num_of_start begin set n = num_of_start set URL ...
import time import requests import os import random print("python > Hello, docker.") DAPR_HTTP_PORT = os.getenv("DAPR_HTTP_PORT", 3500) BASE_URL = "http://localhost:{0}/v1.0/invoke/{{}}//method/order" \ .format(DAPR_HTTP_PORT) def post_order(app_id, num_of_start): n = num_of_start URL = BASE_URL.format(...
Python
zaydzuhri_stack_edu_python
function add_unknown_words word_vecs vocab min_df=1 k=300 unk_token=UNK_TOKEN begin for word in vocab begin if word not in word_vecs and vocab at word >= min_df begin set word_vecs at word = call uniform_sample - 0.25 0.25 k end end set word_vecs at unk_token = call uniform_sample - 0.25 0.25 k end function
def add_unknown_words(word_vecs, vocab, min_df=1, k=300, unk_token=UNK_TOKEN): for word in vocab: if word not in word_vecs and vocab[word] >= min_df: word_vecs[word] = uniform_sample(-0.25,0.25,k) word_vecs[unk_token] = uniform_sample(-0.25,0.25,k)
Python
nomic_cornstack_python_v1
import csv function write_into_csv info_list begin with open string student_info.csv string a newline=string as csv_file begin set writer = writer csv_file if tell csv_file == 0 begin write row writer list string Name string Age string Contact No string Email-id end write row writer info_list end end function set selec...
import csv def write_into_csv(info_list): with open('student_info.csv','a',newline='') as csv_file: writer=csv.writer(csv_file) if csv_file.tell()==0: writer.writerow(["Name","Age","Contact No","Email-id"]) writer.writerow(info_list) selection=int(input("\nEnter 1 for adding stud...
Python
zaydzuhri_stack_edu_python
import os import hashlib from concurrent_iterator.thread import Producer from functools import reduce import operator class ExitCodeError extends Exception begin pass end class function id x begin return x end function function utf8len s begin return length encode s string utf-8 end function function sh x begin if call...
import os import hashlib from concurrent_iterator.thread import Producer from functools import reduce import operator class ExitCodeError(Exception): pass def id(x): return x def utf8len(s): return len(s.encode('utf-8')) def sh(x): if os.system(x): raise ExitCodeError() def fwrite(fname, content): ...
Python
zaydzuhri_stack_edu_python
string def fact(num): prod=1 for i in range(1,num+1): prod=prod*i return prod num=int(input("Enter number")) result=fact(num) print(result) comment Recursion############# function fact num begin if num == 0 begin return 1 end else begin return num * call fact num - 1 end end function set result = call fact 3 print resu...
'''def fact(num): prod=1 for i in range(1,num+1): prod=prod*i return prod num=int(input("Enter number")) result=fact(num) print(result)''' #############Recursion############# def fact(num): if num==0: return 1 else: return num*fact(num-1) result=fact(3) print(result)
Python
zaydzuhri_stack_edu_python
function get_samples_stream_app self begin set req = call Request method=string get endpoint=string /streamapps/samples function response_handler resp begin if is_success is not true begin raise call StreamAppGetSampleError resp req end return body at string streamAppSample end function return call _execute req respons...
def get_samples_stream_app(self): req = Request( method="get", endpoint="/streamapps/samples", ) def response_handler(resp): if resp.is_success is not True: raise StreamAppGetSampleError(resp, req) return resp.body["streamAppSample...
Python
nomic_cornstack_python_v1
comment 문자열 for i in range n begin set a = input set arr = list comprehension 0 for i in range 26 for j in range length a begin if ordinal a at j >= 65 and ordinal a at j <= 90 or ordinal a at j >= 97 and ordinal a at j <= 122 begin set arr at ordinal upper a at j - 65 = arr at ordinal upper a at j - 65 + 1 end end set...
# 문자열 for i in range(n): a = input() arr = [0 for i in range(26)] for j in range(len(a)): if((ord(a[j]) >= 65 and ord(a[j]) <= 90) or (ord(a[j]) >= 97 and ord(a[j]) <= 122)): arr[ord(a[j].upper())-65] += 1 pen = 1 dpen = 1 tpen = 1 for j in range(26): if(arr[j...
Python
zaydzuhri_stack_edu_python
function parse_command_line args=none final=true begin return call parse_command_line args final=final end function
def parse_command_line(args=None, final=True): return options.parse_command_line(args, final=final)
Python
nomic_cornstack_python_v1
function count_paths_with_sum root target_sum running_sum=0 dict_path_count=dict begin if not root begin return 0 end set running_sum = running_sum + value set to_be_taken = running_sum - target_sum set total_paths = get dict_path_count to_be_taken 0 if running_sum == running_sum begin set total_paths = total_paths + 1...
def count_paths_with_sum(root, target_sum, running_sum=0, dict_path_count={}): if not root: return 0 running_sum += root.value to_be_taken = running_sum - target_sum total_paths = dict_path_count.get(to_be_taken, 0) if running_sum == running_sum: total_paths += 1 actual_count = dict_path_cou...
Python
zaydzuhri_stack_edu_python
function count self x begin return 0 end function
def count(self, x): return 0
Python
nomic_cornstack_python_v1
function name self begin return _name end function
def name(self) -> str: return self._name
Python
nomic_cornstack_python_v1
import nltk from nltk import word_tokenize from nltk.corpus import stopwords import os import re import pickle as pkl import collections import codecs function load_data directory begin set sub_dirs = list string fake string real set label_map = dict string fake 0 ; string real 1 set contents = list set labels = list ...
import nltk from nltk import word_tokenize from nltk.corpus import stopwords import os import re import pickle as pkl import collections import codecs def load_data(directory): sub_dirs = ['fake', 'real'] label_map = {'fake': 0, 'real': 1} contents = [] labels = [] for dir in sub_dirs: ...
Python
zaydzuhri_stack_edu_python
comment Datei muss clock.py heissen !!! function esIst table begin for n in range 0 2 begin for m in range 5 9 begin set table at n at m = 1 end end for n in range 0 2 begin for m in range 12 17 begin set table at n at m = 1 end end end function function fuenf table begin for n in range 0 2 begin for m in range 20 27 b...
# Datei muss clock.py heissen !!! def esIst(table): for n in range(0, 2): for m in range (5, 9): table [n][m] = 1 for n in range(0, 2): for m in range (12, 17): table [n][m] = 1 def fuenf(table): for n in range(0, 2...
Python
zaydzuhri_stack_edu_python
function stable_boltzmann beta numerator denominator begin set minx = min numerator min set new_num = beta * numerator - minx set new_den = beta * denominator - minx return exp new_num / sum exp new_den end function
def stable_boltzmann(beta, numerator, denominator): minx = min(numerator, denominator.min()) new_num = beta * (numerator - minx) new_den = beta * (denominator - minx) return np.exp(new_num) / np.sum(np.exp(new_den))
Python
nomic_cornstack_python_v1
import os import re import time import bs4 import requests from bs4 import BeautifulSoup comment res = requests.get(f'https://github.com/KHwang9883/MobileModels/blob/master/brands/apple.md') function down begin set url = string https://github.com/KHwang9883/MobileModels/blob/master/brands/apple.md set res = get request...
import os import re import time import bs4 import requests from bs4 import BeautifulSoup # res = requests.get(f'https://github.com/KHwang9883/MobileModels/blob/master/brands/apple.md') def down(): url = 'https://github.com/KHwang9883/MobileModels/blob/master/brands/apple.md' res = requests.get(url) res.r...
Python
zaydzuhri_stack_edu_python
function overall_status self overall_status begin set _overall_status = overall_status end function
def overall_status(self, overall_status): self._overall_status = overall_status
Python
nomic_cornstack_python_v1
string 使用迭代优化的方法对全局运动进行估计,通过不断迭代消除局部运动的干扰 code_v3: create on 2020/3/10 by Yang Zhou from lib import flowlib_v2 as fl2 import numpy as np import matplotlib.pyplot as plt import os import cv2 from lib import flowlib as fl from scipy import optimize import time from math import pow comment hyper parameter of the threshold...
""" 使用迭代优化的方法对全局运动进行估计,通过不断迭代消除局部运动的干扰 code_v3: create on 2020/3/10 by Yang Zhou """ from lib import flowlib_v2 as fl2 import numpy as np import matplotlib.pyplot as plt import os import cv2 from lib import flowlib as fl from scipy import optimize import time from math import pow # hyper parameter of the threshold fu...
Python
zaydzuhri_stack_edu_python
function get_token self *scopes **kwargs begin comment type: (*str, **Any) -> AccessToken set aad_header_cosmos_emulator = string {"typ":"JWT","alg":"RS256","x5t":"CosmosEmulatorPrimaryMaster","kid":"CosmosEmulatorPrimaryMaster"} set aad_claim_cosmos_emulator_format = dict string aud string https://localhost.localhost ...
def get_token(self, *scopes, **kwargs): # type: (*str, **Any) -> AccessToken aad_header_cosmos_emulator = "{\"typ\":\"JWT\",\"alg\":\"RS256\",\"x5t\":\"" \ "CosmosEmulatorPrimaryMaster\",\"kid\":\"CosmosEmulatorPrimaryMaster\"}" aad_claim_cosmos_emulator_for...
Python
nomic_cornstack_python_v1
function load_atompairs atpairs missing_reppots=string error begin from DFTB.AtomicData import atom_names for tuple Zi Zj in atpairs begin set tuple atI atJ = tuple atom_names at Zi - 1 atom_names at Zj - 1 end end function
def load_atompairs(atpairs, missing_reppots="error"): from DFTB.AtomicData import atom_names for (Zi,Zj) in atpairs: atI, atJ = atom_names[Zi-1], atom_names[Zj-1]
Python
nomic_cornstack_python_v1
function sort_mappings self begin for t in all_mappings begin set sortkey = vpage ? 32 + size end sort all_mappings key=lambda x -> sortkey end function
def sort_mappings(self): for t in self.all_mappings: t.sortkey = (t.vpage << 32) + (t.size) self.all_mappings.sort(key=lambda x: x.sortkey)
Python
nomic_cornstack_python_v1
comment faça um programa que leia 5 valores numéricos e guarde numa lista comment no fim mostre o maior e o menor valor digitado e suas respectivas posições na lista set valores = list set max = 0 set min = 0 for i in range 0 5 begin append valores integer input string Insira um valor para a posição { i } : if i == 0 ...
#faça um programa que leia 5 valores numéricos e guarde numa lista #no fim mostre o maior e o menor valor digitado e suas respectivas posições na lista valores = [] max = 0 min = 0 for i in range(0,5): valores.append((int(input(f'Insira um valor para a posição {i}: ')))) if i == 0: max = min = valore...
Python
zaydzuhri_stack_edu_python
function arn self begin return get pulumi self string arn end function
def arn(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "arn")
Python
nomic_cornstack_python_v1
comment pylint: disable-msg=too-many-statements function create_account request post_override=none begin comment pylint: disable-msg=invalid-name set js = dict string success false set post_vars = if expression post_override then post_override else POST set extra_fields = get attribute settings string REGISTRATION_EXTR...
def create_account(request, post_override=None): # pylint: disable-msg=too-many-statements js = {'success': False} # pylint: disable-msg=invalid-name post_vars = post_override if post_override else request.POST extra_fields = getattr(settings, 'REGISTRATION_EXTRA_FIELDS', {}) if settings.FEATURES.ge...
Python
nomic_cornstack_python_v1
function cosine_fft data inverse=false begin set N = length data - 1 set extend_data = list 0.0 * 2 * N set extend_data at 0 = data at 0 for j in range 1 N begin set extend_data at j = data at j set extend_data at 2 * N - j = data at j end set extend_data at N = data at N set transform = fft extend_data set cosineft = ...
def cosine_fft(data, inverse=False): N = len(data)-1 extend_data = [ 0.0 ] * (2*N) extend_data[0] = data[0] for j in range(1, N): extend_data[j] = data[j] extend_data[2*N-j] = data[j] extend_data[N] = data[N] transform = fft(extend_data) cosineft = [ 0.0 ] * (N+1) for k i...
Python
nomic_cornstack_python_v1
import unittest from authentication import Authentication from structures import User class FakePersist begin function __init__ self begin set structure = none set structure_instance = none set structure_id = none set custom_retrieve_value = none end function function store self structure begin set structure = structur...
import unittest from authentication import Authentication from structures import User class FakePersist: def __init__(self): self.structure = None self.structure_instance = None self.structure_id = None self.custom_retrieve_value = None def store(self, structure): self....
Python
zaydzuhri_stack_edu_python
import string function sort_by_letter lst begin return list comprehension i for el in list ascii_lowercase for i in lst if el in list i end function
import string def sort_by_letter(lst): return [i for el in list(string.ascii_lowercase) for i in lst if el in list(i)]
Python
zaydzuhri_stack_edu_python
comment Meme Templates from pathlib import Path from PIL import Image , ImageFont , ImageDraw , ImageSequence import requests from io import BytesIO set ROOT_DIR = call resolve set FONT_DIR = ROOT_DIR / string fonts class Meme begin string The basic meme object function __init__ self begin set composition = none return...
# Meme Templates from pathlib import Path from PIL import Image, ImageFont, ImageDraw, ImageSequence import requests from io import BytesIO ROOT_DIR = (Path(__file__).parents[2]).resolve() FONT_DIR = ROOT_DIR / 'fonts' class Meme: """ The basic meme object """ def __init__(self): self.compos...
Python
zaydzuhri_stack_edu_python
function ola array a j begin if array at a - 1 > array at a begin for i in range a length array begin if j < array at i begin return false end set j = array at i end return true end else begin for i in range a length array begin if j > array at i begin return false end set j = array at i end return true end end functio...
def ola(array,a,j): if(array[a-1]>array[a]): for i in range(a,len(array)): if(j<array[i]): return False j=array[i] return True else: for i in range(a,len(array)): if(j>array[i]): return False j=array[i] return True def isMonotonic(array): # Write your code here.'' if(len(array)>2): ...
Python
zaydzuhri_stack_edu_python
function _print_image self img opts begin raise BaseException end function
def _print_image(self, img, opts): raise BaseException
Python
nomic_cornstack_python_v1
comment !/usr/bin/env python comment -*- coding: utf-8 -*- string Author: TaoRui Date: 2020/07/10 14:36:33 Description: 外部排序实现计算日记点赞表的P90值 1.读取大文件表,维护一个数据总量nTotal 2.分为n个小文件(第一次内部排序<采用优化后的快排>;注意:内存量 大于等于 小文件的数据量大小) 3.采用外部排序排序每个小文件 4.合并所有小文件并输出到一个新的文件(依次读取每个文件从第一行到末尾,比较获取极(大/小)值,存入新文件) 5.最终获得一个排序好的大文件 6.通过排序后的大文件获取p90的位置...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Author: TaoRui Date: 2020/07/10 14:36:33 Description: 外部排序实现计算日记点赞表的P90值 1.读取大文件表,维护一个数据总量nTotal 2.分为n个小文件(第一次内部排序<采用优化后的快排>;注意:内存量 大于等于 小文件的数据量大小) 3.采用外部排序排序每个小文件 4.合并所有小文件并输出到一个新的文件(依次读取每个文件从第一行到末尾,比较获取极(大/小)值,存入新文件) 5.最终获得一个排序好的大文件 6.通过排序后的大文件...
Python
zaydzuhri_stack_edu_python
function build_bpmf_model train alpha=2 dim=10 std=0.01 begin set tuple n m = shape comment scaling factor for lambdas; unclear on its use set beta_0 = 1 comment Mean value imputation on training data. set train = copy train set nan_mask = call isnan train set train at nan_mask = mean train at ? nan_mask info string bu...
def build_bpmf_model(train, alpha=2, dim=10, std=0.01): n, m = train.shape beta_0 = 1 # scaling factor for lambdas; unclear on its use # Mean value imputation on training data. train = train.copy() nan_mask = np.isnan(train) train[nan_mask] = train[~nan_mask].mean() logging.info('building...
Python
nomic_cornstack_python_v1
function __init__ self ship_type starting_pos begin set health_points = 30 if ship_type == string Applecat begin call _initialize_applecat end set start_location = starting_pos set model = call Simulator start_location end function
def __init__(self, ship_type, starting_pos): self.health_points = 30 if ship_type == 'Applecat': self._initialize_applecat() start_location = starting_pos self.model = physics.Simulator(start_location)
Python
nomic_cornstack_python_v1
function hourly location=string Fresno, CA days=1 start=none end=none years=1 use_cache=true verbosity=1 begin string Get detailed (hourly) weather data for the requested days and location The Weather Underground URL for Fresno, CA on 1/1/2011 is: http://www.wunderground.com/history/airport/KFAT/2011/1/1/DailyHistory.h...
def hourly(location='Fresno, CA', days=1, start=None, end=None, years=1, use_cache=True, verbosity=1): """ Get detailed (hourly) weather data for the requested days and location The Weather Underground URL for Fresno, CA on 1/1/2011 is: http://www.wunderground.com/history/airport/KFAT/2011/1/1/DailyHistory...
Python
jtatman_500k
function test_absolute_url_without_request self begin set context = dict set abs_url = call absolute_url context string /ciao/ assert equal abs_url string /ciao/ assert not equal abs_url string / end function
def test_absolute_url_without_request(self): context = {} abs_url = absolute_url(context, "/ciao/") self.assertEqual(abs_url, "/ciao/") self.assertNotEqual(abs_url, "/")
Python
nomic_cornstack_python_v1
function _search_names self query begin string Search in the name filed for contacts matching query. :param query: the query to search for :type query: str :yields: all found contacts :rtype: generator(carddav_object.CarddavObject) set regexp = compile query IGNORECASE ? DOTALL for contact in values contacts begin comm...
def _search_names(self, query): """Search in the name filed for contacts matching query. :param query: the query to search for :type query: str :yields: all found contacts :rtype: generator(carddav_object.CarddavObject) """ regexp = re.compile(query, re.IGNORECA...
Python
jtatman_500k
function defang_ip_addr1 address begin set defanged = list for ch in address begin if ch == string . begin append defanged string [.] end else begin append defanged ch end end return join string defanged end function
def defang_ip_addr1(address): defanged = [] for ch in address: if ch == '.': defanged.append('[.]') else: defanged.append(ch) return ''.join(defanged)
Python
zaydzuhri_stack_edu_python
function _insert_action self node begin string Add a L{WrittenAction} to the tree. Parent actions will be created as necessary. @param child: A L{WrittenAction} to add to the tree. @return: Updated L{Task}. set task = self if end_message and start_message and length children == level at - 1 - 2 begin comment Possibly t...
def _insert_action(self, node): """ Add a L{WrittenAction} to the tree. Parent actions will be created as necessary. @param child: A L{WrittenAction} to add to the tree. @return: Updated L{Task}. """ task = self if ( node.end_message and nod...
Python
jtatman_500k
comment Implementing edge computing using TensorFlow Lite. import tensorflow as tf comment Use TensorFlow Lite for edge computing. comment Perform ML inference on edge devices.
# Implementing edge computing using TensorFlow Lite. import tensorflow as tf # Use TensorFlow Lite for edge computing. # Perform ML inference on edge devices.
Python
flytech_python_25k
comment !/usr/bin/env python3 comment -*- coding: utf-8 -*- string Created on Thu May 3 12:55:19 2018 @author: ksato import urllib function read_text begin set quotes = open string /Users/ksato/Desktop/MOOCS Study/OOP-python/movie_quotes.txt set contents_of_file = read quotes set formattedfile = replace contents_of_fil...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 3 12:55:19 2018 @author: ksato """ import urllib def read_text(): quotes = open("/Users/ksato/Desktop/MOOCS Study/OOP-python/movie_quotes.txt") contents_of_file = quotes.read() formattedfile = contents_of_file.replace(' ', '') prin...
Python
zaydzuhri_stack_edu_python
function get_equality_constraint_scaling_factors self begin return none end function
def get_equality_constraint_scaling_factors(self): return None
Python
nomic_cornstack_python_v1
function setObservations self observations begin comment Turn list of observations into a dict (skipping out any scales which comment are in the constant list) set _observations = dict for o in observations begin set level_tuple = call _level_tuple *o[0] if level_tuple in _CONSTANT_SCALES begin continue end set dist_s...
def setObservations(self, observations): # Turn list of observations into a dict (skipping out any scales which # are in the constant list) self._observations = {} for o in observations: level_tuple = ScaleManager._level_tuple(*o[0]) if level_tuple in ScaleManager...
Python
nomic_cornstack_python_v1
function sum x y begin set result = dict set result at string s = x at string s * y at string m + x at string m * y at string s set result at string m = x at string m * y at string m return result end function function minus x y begin set result = dict set result at string s = x at string s * y at string m - x at str...
def sum(x,y): result={} result['s'] = x ['s'] * y ['m'] + x ['m'] * y ['s'] result['m'] = x ['m'] * y ['m'] return result def minus(x,y): result={} result['s'] = x ['s'] * y ['m'] - x ['m'] * y ['s'] result['m'] = x ['m'] * y ['m'] return result def mul(x,y): result=...
Python
zaydzuhri_stack_edu_python
function RetrieveProject begin with open string projects.json as json_file begin set Projects = load json json_file end return Projects end function
def RetrieveProject(): with open('projects.json') as json_file: Projects = json.load(json_file) return Projects
Python
nomic_cornstack_python_v1
string db_functions offers two functions: authenticate which compares a stored password hash that has been salted using the sha256 algorithm to a plaintext password. Function returns boolean check_passwords utilizes authenticate function and checks if password and username input are correct import hashlib from password...
""" db_functions offers two functions: authenticate which compares a stored password hash that has been salted using the sha256 algorithm to a plaintext password. Function returns boolean check_passwords utilizes authenticate function and checks if password and username input are correct """ import ha...
Python
zaydzuhri_stack_edu_python
function deriv self t endBehavior=string halt begin set tuple i u = call getSegment t endBehavior if i < 0 begin return list 0.0 * length milestones at 0 end else if i >= length milestones begin return list 0.0 * length milestones at - 1 end return call mul difference self milestones at i + 1 milestones at i u 1.0 / ti...
def deriv(self,t,endBehavior='halt'): i,u = self.getSegment(t,endBehavior) if i<0: return [0.0]*len(self.milestones[0]) elif i>=len(self.milestones): return [0.0]*len(self.milestones[-1]) return vectorops.mul(self.difference(self.milestones[i+1],self.milestones[i],u),1.0/(self.times[i+1]-self.times[i]))
Python
nomic_cornstack_python_v1
function take_a_break begin import sys , traceback call print_stack file=stdout end function
def take_a_break(): import sys, traceback traceback.print_stack( file = sys.stdout)
Python
nomic_cornstack_python_v1
function itkVectorIndexSelectionCastImageFilterVIUC2IUC2_Superclass_cast *args begin return call itkVectorIndexSelectionCastImageFilterVIUC2IUC2_Superclass_cast *args end function
def itkVectorIndexSelectionCastImageFilterVIUC2IUC2_Superclass_cast(*args): return _itkVectorIndexSelectionCastImageFilterPython.itkVectorIndexSelectionCastImageFilterVIUC2IUC2_Superclass_cast(*args)
Python
nomic_cornstack_python_v1
comment https://realpython.com/python-sql-libraries/ comment https://docs.python.org/3/library/sqlite3.html comment serverless and self-contained! Hooray! Comes included in python, writes to a file. import sqlite3 comment set up a connection comment This special string means the database will be in memory set connectio...
# https://realpython.com/python-sql-libraries/ # https://docs.python.org/3/library/sqlite3.html import sqlite3 # serverless and self-contained! Hooray! Comes included in python, writes to a file. # set up a connection connection = sqlite3.connect(":memory:") # This special string means the database will be in memory...
Python
zaydzuhri_stack_edu_python