seq_id stringlengths 4 11 | text stringlengths 113 2.92M | repo_name stringlengths 4 125 ⌀ | sub_path stringlengths 3 214 | file_name stringlengths 3 160 | file_ext stringclasses 18
values | file_size_in_byte int64 113 2.92M | program_lang stringclasses 1
value | lang stringclasses 93
values | doc_type stringclasses 1
value | stars int64 0 179k ⌀ | dataset stringclasses 3
values | pt stringclasses 78
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
13759218020 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 30 16:40:59 2023
@author: joachim
"""
import requests
import json
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime
def get_cik_from_ticker(ticker):
with open("company_tickers.json") as f:
... | joachims97/marketmapper | eps.py | eps.py | py | 2,764 | python | en | code | 0 | github-code | 90 |
26034640126 | import datetime
import logging
import re
import webapp2
from google.appengine.api import datastore_errors
from google.appengine.api import modules
from google.appengine.api import taskqueue
from google.appengine.ext import ndb
from google.appengine.ext.ndb import polymodel
from google.protobuf import json_format
fro... | luci/luci-py | appengine/components/components/auth/change_log.py | change_log.py | py | 28,114 | python | en | code | 74 | github-code | 90 |
26559440451 | import pytest
from point1 import Point
def test_point_default():
p = Point()
assert p.x == 0
assert p.y == 0
def test_point():
p = Point(3, 4)
assert p.x == 3
assert p.y == 4
def test_point_equals():
p1 = Point(3, 4)
p2 = Point(3, 4)
assert p1 == p2
def test_point_not_equals():
... | gavrie/pycourse3 | examples/test_point1.py | test_point1.py | py | 1,163 | python | en | code | 1 | github-code | 90 |
29059284350 | #!/usr/bin/env python
import scan_bv
import optparse, sys, time
def opts():
parser = optparse.OptionParser(usage="usage: %prog [options] RBX")
parser.add_option("--nseconds",
dest="nSeconds",
default=2,
type="int",
help="... | elaird/phase1-regtest | scan_peltier.py | scan_peltier.py | py | 4,381 | python | en | code | 1 | github-code | 90 |
18143342359 | def convert(s):
o = ord(s)
if o >= 65 and o <= 90:
return s.lower()
elif o >= 97 and o <= 122:
return s.upper()
return s
def main():
strings = input()
answer = ""
for s in strings:
s = s
answer += convert(s)
print(answer)
if __name__ == "__main__":
... | Aasthaengg/IBMdataset | Python_codes/p02415/s028825120.py | s028825120.py | py | 326 | python | en | code | 0 | github-code | 90 |
34715816271 | import tkinter
window = tkinter.Tk()
window.title("My First GUI Program")
window.minsize(width=500, height=300)
window.config(padx = 100, pady=100)
# Label
my_label = tkinter.Label(text = "I Am a Label", font = ("Arial", 24, "italic"))
my_label.pack(side= "left")
# same
my_label["text"] = "New Text"
my_label.confi... | hao134/100_day_python | day27_Tkinter_args_kwargs_and_creating_gui_programs/main.py | main.py | py | 893 | python | en | code | 2 | github-code | 90 |
32365775776 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('content_management', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='post',
nam... | simranjkk/teach | content_management/migrations/0002_auto_20150218_1623.py | 0002_auto_20150218_1623.py | py | 433 | python | en | code | 0 | github-code | 90 |
11019038681 | import pygame
from PIL import Image
SCREEN_SIZE = 1250, 900
clock = pygame.time.Clock()
velocity = 240
fps = 60
num_cells_in_line = 20
size_of_cell = (SCREEN_SIZE[1] - 70) // num_cells_in_line
immediate_quit = False
money_player_1 = 100
money_player_2 = 100
sprite_group_weapons = pygame.sprite.Group()
# Инициализац... | MatveevDmtr/our_game1 | main_class1.py | main_class1.py | py | 15,649 | python | en | code | 0 | github-code | 90 |
41228612929 | from ase.build import fcc100
from ase.visualize import view
"""
Remove an atom. Once again, you don't necessarily have to be able to build this function yourself!
"""
def Remove(file):
view(file)
indices = input('Enter the index of the atom(s) to delete:').split()
atomsRemove = []
for element in in... | AlexBoucherr/StudentsTutorials | Remove.py | Remove.py | py | 545 | python | en | code | 0 | github-code | 90 |
38468011269 | from os import path
from backends.filesync.data import errors
from backends.filesync.data.dao import VolumeProxy
from backends.filesync.data.logging import log_dal_function
def date_formatter(dt):
"""Format dates."""
return dt.isoformat().replace("T ", "T").split(".")[0] + "Z"
class ForbiddenRestOperation(... | stevegood/filesync-server | src/backends/filesync/data/resthelper.py | resthelper.py | py | 11,776 | python | en | code | 7 | github-code | 90 |
18015556599 | # A - Airport Bus
# https://atcoder.jp/contests/agc011/tasks/agc011_a
n, c, k = map(int, input().split())
T = [int(input()) for _ in range(n)]
T.sort()
ans = 1
cnt = 0
st = T[0]
for t in T:
cnt += 1
if t - st > k or cnt > c:
ans += 1
st = t
cnt = 1
print(ans) | Aasthaengg/IBMdataset | Python_codes/p03785/s823354106.py | s823354106.py | py | 279 | python | en | code | 0 | github-code | 90 |
72489264618 | from typing import List
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
if not nums:
return 0
top = 0
for n in nums:
if n != nums[top]:
top += 1
nums[top] = n
return top + 1
| JumHorn/leetcode | python/RemoveDuplicatesfromSortedArray.py | RemoveDuplicatesfromSortedArray.py | py | 288 | python | en | code | 0 | github-code | 90 |
26441777003 | import requests
class LocationService:
def __init__(self):
self._google_api_url = (
'http://maps.googleapis.com/maps/api/geocode/json?address=')
def get_zipcode_location(self, zipcode):
if len(zipcode) != 5 or not(zipcode.isdigit()):
return 'INVALID'
... | sikendershahid91/SoftwareDesign | assign2/src/location_service.py | location_service.py | py | 882 | python | en | code | 0 | github-code | 90 |
26521788437 | import numpy as np
import os
#from xml.etree import ElementTree
import lxml.etree as ElementTree
class XML_preprocessor(object):
def __init__(self, data_path):
self.path_prefix = data_path
self.num_classes = 1
self.data = dict()
self._preprocess_XML()
def _preprocess_XML(self)... | sinarazi/Froth_flotation_Computer_Vision | Utils/get_data_from_XML.py | get_data_from_XML.py | py | 2,194 | python | en | code | 5 | github-code | 90 |
17844800624 | from rasterio.mask import mask
import numpy as np
from shapely.geometry import Polygon
import geopandas as gpd
def mean_ws(geodataframe_of_regions, wtk_raster_ob, region_identifier):
"""Takes a geodataframe, masks against the provided WTK raster and return a
dictionary of averaged values for each region.
... | dtcallahan/python_projects | wind_resources_utilities.py | wind_resources_utilities.py | py | 2,547 | python | en | code | 0 | github-code | 90 |
12611639725 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 19 14:47:43 2014
@author: gabriel
"""
#script para análise e validação das anotações da sequência selecionada, nomeadamente as features do tipo "gene" ou "CDS"
#importações
from Bio import SeqIO
#selecionar e guardar as features do tipo "gene", CDS" ou outros em fichei... | grupo14/trabalho-1 | script_anotacoes.py | script_anotacoes.py | py | 2,462 | python | pt | code | 0 | github-code | 90 |
43931328560 | #!/usr/env/python
from gnuradio import blks2, gr, gru
from grc_gnuradio import blks2 as grc_blks2
from gnuradio import smartnet
import string
import random
import time, datetime
import os
class logging_receiver(gr.hier_block2):
def __init__(self, talkgroup, options):
gr.hier_block2.__init__(self, "fsk_demod",
... | bistromath/gr-smartnet | src/python/logging_receiver.py | logging_receiver.py | py | 4,743 | python | en | code | 45 | github-code | 90 |
41159197401 | # Stock Market Simulation
# By William Kong
# December 1, 2011
# Based on Lecture 23 of the MIT Intro to Comp. Sci. and Prog. Series
# by Prof. Eric Grimson and Jogn Guttag
# Here is where I will be generating a stock market simulator with the assumption
# that the efficient market hypothesis holds true; this simulat... | wwkong/Stock-Simulator | stock_plot.py | stock_plot.py | py | 11,090 | python | en | code | 4 | github-code | 90 |
14814814367 | import pandas as pd
import numpy as np
import math
import time
from copy import deepcopy
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
#total error distance after centroid have fixed for a K
def sq_error(dataset,point):
x,y=dataset.shape
dist=0
for i in range(x):
dist... | saurabhkumar8112/Machine-Learning-Assigment-1 | kmeans.py | kmeans.py | py | 3,306 | python | en | code | 1 | github-code | 90 |
44347181114 | """
Sam Lindsay and Peter Xu
CSE 163
This file contains all the testing programs for all functions in Utils
class from utilities file.
"""
from cse163_utils import assert_equals
from utilities import Utils
import pandas as pd
def test_get_mir():
"""
Test the get_mir method in Utils class. Report errors if g... | samuel-lindsay/cse163-cancer-research | test.py | test.py | py | 3,497 | python | en | code | 0 | github-code | 90 |
15767684918 | import os
import argparse
import time
import numpy as np
import random
from copy import deepcopy
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib
import matplotlib.pyplot as plt
from argparse import Namespace
from scipy.integrate import odeint as scipy_odeint
from torchdiffeq import ode... | izhangxm/N15Tracing | torchdiff-dataset.py | torchdiff-dataset.py | py | 6,185 | python | en | code | 0 | github-code | 90 |
21280245424 | import torch
from torch import nn
from torch.nn import functional as F
from torch.optim.lr_scheduler import ReduceLROnPlateau
from torch.utils import data
from torch.utils.data import DataLoader
from torch.utils.data import random_split
import torchvision
from torchvision import transforms
from models.decoderlstm impor... | zacharie12/Hypernet-image-captioning | cc_train_gru.py | cc_train_gru.py | py | 15,181 | python | en | code | 0 | github-code | 90 |
25150808416 | #carrinho de compra
#passo1:dicionario de preços
frutas = {'Banana':1.50, 'Morango':3.99, 'Melancia':4.00}
carrinho = []
while True:
opcao = int(input( 'Escolha a fruta :\n1- Banana \n2- Morango \n3 - Melancia \n'))
if opcao == 1:
carrinho.append('Banana')
elif opcao == 2:
carrinho.... | otamori/python4linux | aula03/ex03.py | ex03.py | py | 704 | python | pt | code | 0 | github-code | 90 |
73820235817 | class Solution:
def maxDistance(self, grid: List[List[int]]) -> int:
size = len(grid)
record = {}
queue = collections.deque()
for row in range(size):
for col in range(size):
if grid[row][col]:
queue.append((row, col, 0))
if no... | HarrrrryLi/LeetCode | 1162. As Far from Land as Possible/Python 3/solution.py | solution.py | py | 989 | python | en | code | 0 | github-code | 90 |
25503833181 | #!/usr/bin/env python3
import argparse
import datetime
import textwrap
import os
DAIRY_ROOT = os.environ.get('DAIRY_ROOT')
EDITORS_CMDS = {
'vscode': 'code',
'vim': 'vim',
'nano': 'nano'
}
class Dairy(object):
def __init__(self, date: datetime.datetime):
self.date = date
s... | meisimo/dairy | main.py | main.py | py | 2,122 | python | en | code | 1 | github-code | 90 |
18189244519 | N, M, K = map(int,input().split())
A = list(map(int,input().split()))
A.insert(0, 0)
B = list(map(int,input().split()))
a = []
b = []
def nibun(L,l,r,target):
wrk = -(-(l+r)//2)
# print(l,r,target,wrk)
if r == l:
if r == len(L):
return 0
else:
return wrk + 1
if l == (len(L)-1):
... | Aasthaengg/IBMdataset | Python_codes/p02623/s899292267.py | s899292267.py | py | 811 | python | en | code | 0 | github-code | 90 |
41266348243 | import matplotlib.pyplot as plt
import imageio,os
from PIL import Image
images = []
filenames=[]
count=0
for fn in os.listdir('pic/'):
count+=1
for i in range (count):
filenames.append('ori_tree_'+str(i)+'.png')
for filename in filenames:
im=Image.open('pic/'+filename)
nim=im.resize((950,550))
nim.save('pic/'+file... | AKUMA58/Decision-Tree-Visualization-with-Iris-Dataset | mkgif.py | mkgif.py | py | 436 | python | en | code | 0 | github-code | 90 |
74946849255 | # -*- coding: utf-8 -*-
"""
Problem 155 - Counting Capacitor Circuits
An electric circuit uses exclusively identical capacitors of the same value C.
The capacitors can be connected in series or in parallel to form sub-units,
which can then be connected in series or in parallel with other capacitors or
other sub-units... | yred/euler | python/problem_155.py | problem_155.py | py | 2,352 | python | en | code | 1 | github-code | 90 |
26606286715 | # Written by Rosalie Lucas
# Last update 07/06/2021
# Useful for combining Triggerlogger, iButton, FLIR and questionnaire data
# For the CTET
# Data structure in the following folders
# [Data] --------- [FLIR] |
# [Questionnaires] |
# [TriggerLogger] --------- [BSRT]
# ... | rooslucas/Bachelor-Thesis | CTET/data_combination_CTET.py | data_combination_CTET.py | py | 7,398 | python | en | code | 0 | github-code | 90 |
73009628458 | import math
class Point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def distance(self,other):
return ((self.x-other.x)**2+(self.y-other.y)**2)**0.5
def __str__(self):
return f"<{self.x},{self.y}>"
class Line():
def __init__(self, a, b):
self.a = a... | logxdx/deadly_python | Class And Objects/Ruler-Compass.py | Ruler-Compass.py | py | 6,178 | python | en | code | 0 | github-code | 90 |
18221129089 | def resolve():
N = int(input())
A = list(map(int, input().split()))
mp = dict()
ans = 0
for i in range(N):
x = i - A[i]
ans += mp.get(x, 0)
y = A[i] + i
mp[y] = mp.get(y, 0) + 1
print(ans)
if __name__ == "__main__":
resolve() | Aasthaengg/IBMdataset | Python_codes/p02691/s436617724.py | s436617724.py | py | 287 | python | en | code | 0 | github-code | 90 |
16947951931 | class Solution():
def find_difference(self, s: str, t: str):
hash1 = {}
for i in s:
if hash1.get(i):
hash1[i] += 1
else:
hash1[i] = 1
for i in t:
if hash1.get(i):
hash1[i] -= 1
else:
... | iamsuman/algorithms | iv/Leetcode/easy/389_difference_string.py | 389_difference_string.py | py | 507 | python | en | code | 2 | github-code | 90 |
72259113898 | from bs4 import BeautifulSoup
import requests
url = 'https://www.n11.com/bilgisayar/dizustu-bilgisayar'
html = requests.get(url).content
soup = BeautifulSoup(html, 'html.parser')
count = soup.find('div', {'class': 'listView'}).find('ul').find('li').find('div').get('data-searchcount')
count = int(count)
page = 1
whil... | ensardemirci/BTKAkademi | 15 - Requests,BeautifulSoup ve JSON/15.8 - Requests ve BeautifulSoup n11 ürün listesi(HTML).py | 15.8 - Requests ve BeautifulSoup n11 ürün listesi(HTML).py | py | 811 | python | en | code | 0 | github-code | 90 |
40235209460 | import plotly.graph_objects as go
import streamlit.components.v1 as components
import streamlit as st
import requests
from bs4 import BeautifulSoup
import pandas as pd
import json
import plotly.express as px
from streamlit_plotly_events import plotly_events
try:
fig = go.Figure()
config = {'staticPlot': True}
df_r... | ozgurdugmeci/player-stats | app.py | app.py | py | 9,895 | python | en | code | 0 | github-code | 90 |
18381732849 | n, k = map(int, input().split())
max_val = (n - 1) * (n - 2) // 2
if n == 2 and k == 1:
print(-1)
exit()
if k > max_val:
print(-1)
exit()
else:
cnt = (n - 1) * (n - 2) // 2 - k
m = n - 1 + cnt
print(m)
for i in range(n-1):
print(1, i+2)
if cnt == 0:
exit()
tmp ... | Aasthaengg/IBMdataset | Python_codes/p02997/s473319489.py | s473319489.py | py | 488 | python | en | code | 0 | github-code | 90 |
276972907 | import crypto.designs.hash.sponge as sponge
from crypto.utilities import xor_sum, rotate_left
from crypto.analysis.metrics import test_hash_function
def round_function(left, right, key, index,
mask=255, rotation_amount=5, bit_width=8):
key ^= right
right = rotat... | acad2/crypto | designs/nonlinear/hash/sponges.py | sponges.py | py | 4,242 | python | en | code | 2 | github-code | 90 |
18039341579 | from collections import defaultdict
class Unionfind:
def __init__(self,n):
self.n=n
self.roots=[i for i in range(self.n)]
def root(self,x):
if self.roots[x]==x:
return x
else:
self.roots[x]=self.root(self.roots[x])
return self.roots[x]
de... | Aasthaengg/IBMdataset | Python_codes/p03855/s283917178.py | s283917178.py | py | 1,116 | python | en | code | 0 | github-code | 90 |
28890075128 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 17 16:22:52 2018
@author: eo
"""
# ---------------------------------------------------------------------------------------------------------------------
#%% Imports
from itertools import tee
import numpy as np
# -------------------------------... | EricPacefactory/eolib | math/signal_processing.py | signal_processing.py | py | 31,963 | python | en | code | 0 | github-code | 90 |
39373247223 | import asyncio
import logging
from bond_api import BPUPSubscriptions, start_bpup
async def main(ip_address):
"""Example of library usage."""
sub = BPUPSubscriptions()
stop_bpup = await start_bpup(ip_address, sub)
for i in range(500):
print("BPUP is alive:", sub.alive)
await asyncio.... | prystupa/bond-api | bpup_test.py | bpup_test.py | py | 570 | python | en | code | 3 | github-code | 90 |
74925843176 | import numpy as np
import findDetails as FD
import pandas as pd
from scipy import stats
def errorCalc(Readings,**kwargs):
pcErr = kwargs.get('pcErr', None)
listErr = kwargs.get('listErr', None)
WMean, eWMean = 0 , 0
if pcErr != None:
w = [(pcErr*x)**-2 for x in Readings]
Num ... | CDuncan/Laser-Tweezers | errorCalc.py | errorCalc.py | py | 782 | python | en | code | 0 | github-code | 90 |
28875906963 | import os
from pathlib import Path
import argparse
import json
import workflow.logger as my_logger
from workflow.dicom_org import run_dicom_org
from workflow.bids_conv import run_bids_conv
# argparse
HELPTEXT = """
Top level script to orchestrate workflows as specified in the global_config.json
"""
parser = argparse.A... | yarikoptic/mr_proc | mr_proc.py | mr_proc.py | py | 1,823 | python | en | code | null | github-code | 90 |
18315574989 | #!python3
from collections import deque
LI = lambda: list(map(int, input().split()))
# input
N, M = LI()
S = input()
INF = 10 ** 6
def main():
w = [(INF, INF)] * (N + 1)
w[0] = (0, 0)
# (cost, index)
dq = deque([(0, 0)])
for i in range(1, N + 1):
if i - dq[0][1] > M:
dq.pop... | Aasthaengg/IBMdataset | Python_codes/p02852/s469367260.py | s469367260.py | py | 676 | python | en | code | 0 | github-code | 90 |
19515879808 | import logging
import os
import errno
import os.path as os_path
from eventlet import tpool
from gluster.swift.common.exceptions import FileOrDirNotFoundError, \
NotDirectoryError
def do_walk(*args, **kwargs):
return os.walk(*args, **kwargs)
def do_write(fd, msg):
try:
cnt = os.write(fd, msg)
e... | zaitcev/swift-lfs | gluster/swift/common/fs_utils.py | fs_utils.py | py | 4,201 | python | en | code | 2 | github-code | 90 |
18071710347 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2023 all rights reserved
# externals
import pyre
import journal
# the app
class Open(pyre.application):
"""
Trace {ros3} when opening/closing a file without any other activity
"""
# th... | aivazis/s3 | ros3/open.py | open.py | py | 1,186 | python | en | code | 0 | github-code | 90 |
3965517045 | """Calcula a quantidade em metros da categoria FlexPipe \n \n Autor: Paulo Giavoni"""
# Importa o API do Revit
from Autodesk.Revit import DB
# Documento atual do Revit
doc = __revit__.ActiveUIDocument.Document
# Create Filtered Element Collector
collector = DB.FilteredElementCollector(doc)
# Create Filte... | ggiavoni/Python-Substation- | pyRevitSubstation.extension/pyRevitSub.tab/Civil.panel/Arruamento.pushbutton/Equipamentos_script.py | Equipamentos_script.py | py | 1,245 | python | en | code | 1 | github-code | 90 |
34887860600 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 6 09:41:11 2017
@author: eyt21
"""
import matplotlib
matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
from matplotlib.figure import Figure
import myRecorder as rcd
import tkinter as tk
from tkinter import ... | torebutlin/cued_datalogger | cued_datalogger/acquisition/Week1/liveplotTk.py | liveplotTk.py | py | 3,171 | python | en | code | 1 | github-code | 90 |
5778568902 | '''
Greedy.py
greedy: 贪心算法, 以最大value为始终目标
'''
import sys
sys.path.append(sys.path[0] + '/../')
sys.path.append('..')
import numpy as np
import re
import random
from functions.func_solution_factor import solution_cost,Statistic_factor,Solution_Evaluation
from functions.func_cl_estimator import monte_carlo... | eddylxf23/DDCCMCKP | src/functions/func_greedy.py | func_greedy.py | py | 5,295 | python | en | code | 1 | github-code | 90 |
6279376966 | import config
import openpyxl
def informations(card_name):
city = config.soup.find('a', class_='current-location')
card_name = config.soup.findAll('a', class_='item-card__name')
card_price = config.soup.findAll('span', class_='item-card__prices-price')
card_as = config.soup.findAll('span', class_='item... | Musa-505/techno-bot | main.py | main.py | py | 1,737 | python | en | code | 1 | github-code | 90 |
8673264532 | import numpy as np
import pandas as pd
import copy
# 根据多个字典序列创建DataFrame
file_path = r'E:\李震祥\PYGIT\PYref\ReviewCode\pandas\Data\各省市订单数据.csv'
df = pd.read_csv(file_path, encoding='utf-8')
df.set_index(['name'], inplace=True)
df.reset_index(inplace=True, drop=False)
# 大概就是有六种方法
df['temp'] = df.apply(lambda x: str(x['n... | muyuchenzi/PYref | ReviewCode/pandas/basic_skill/pandas_001.py | pandas_001.py | py | 1,178 | python | en | code | 0 | github-code | 90 |
10223425445 | # __________/BIBLIOTECAS
import tkinter as tk # Se importa tkinter
from tkinter import * # Tk(), Label, Canvas, Photo
from threading import Thread # p.start()
import os # ruta = os.path.join('')
import time # time.sleep(x)
from tkinter import messagebox # AskYesNo ()
from WiFiClient import NodeMCU # Biblioteca p... | Kenfu03/RaioMakuin | 3° Proyecto.py | 3° Proyecto.py | py | 92,218 | python | es | code | 0 | github-code | 90 |
72559230376 | #!/usr/bin/env python
# TraxScript
# By Mike Cook November 2019
import Neo_Thread as ws
import FL3731_Thread as fl
import RPi.GPIO as io
from copy import deepcopy
from tkinter import filedialog
from tkinter import *
import pygame
import time
import sys
import os
root = Tk()
pygame.init()
os.environ['SDL_VIDEO_WINDOW_... | Grumpy-Mike/Mikes-Pi-Bakery | GraviTrax Part 3/Software/TraxScript.py | TraxScript.py | py | 8,775 | python | en | code | 71 | github-code | 90 |
38004895487 | import boto3
import os
from math import ceil
import requests
class Client:
def __init__(self, name_node_url, aws_access_key, aws_secret_key, s3_bucket_name, data_filename_s3,
data_filename_local='data.txt', s3_region_name='us-west-2'):
assert type(name_node_url) is str
assert type... | RichardCharczenko/DistributedFileSystem | client.py | client.py | py | 6,002 | python | en | code | 0 | github-code | 90 |
35658176990 | '''
Find number
list "a", Find number index "x".
If you find number "x" display "x" position, but display "-1" is can't find number case.
'''
def serch_list(a,x):
n=len(a) #input size 'n'
for i in range(0,n): #list "a" sort
if x==a[i]: #Compare with "x" and "list a".
return i #Same retur... | Charlie-kun/Python3-fundation | DayStudy/FindNumber.py | FindNumber.py | py | 470 | python | en | code | 0 | github-code | 90 |
39298696568 | import csv
def transform_user_details(csv_file_name):
new_user_data = []
with open("user_details.csv", newline='') as csvfile:
user_details_csv = csv.reader(csvfile, delimiter=",")
for user in user_details_csv:
transformation = []
transformation.append(user[1])
... | NikhilJha42/eng110-python | csvfiles/csv_example.py | csv_example.py | py | 844 | python | en | code | 0 | github-code | 90 |
70857992617 | from typing import List, Tuple
import numpy as np
import pandas as pd
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
class LinearRegressor:
def __init__(self) -> None:
self.learning_rate = 0.001
self.weights = np.ar... | banislav/ml-basics | linear-regression/linear-regression.py | linear-regression.py | py | 1,399 | python | en | code | 1 | github-code | 90 |
18386265499 | import itertools
n = int(input())
xy = []
for i in range(n):
x,y = map(int, input().split())
xy.append([x,y])
a,b = [],[]
for v in itertools.combinations(xy,2):
z = list(v)
z.sort()
x = z[1][0]-z[0][0]
y = z[1][1]-z[0][1]
a.append([x,y])
if [x,y] in b:
continue
b.append([x,y])
c = 0
for i in b... | Aasthaengg/IBMdataset | Python_codes/p03006/s048489026.py | s048489026.py | py | 357 | python | en | code | 0 | github-code | 90 |
37091812566 | # Zeile 1 kann unverändert bleiben.
meine_filme = []
# "filme =" wird durch das Keyword "with" ersetzt und der Filehandle mit einem "as" hinter die open-Funktion geschrieben.
with open("filme.txt", "r") as filme:
# Die Zeilen 3 und 4 können unverändert bleiben, müssen aber eingerückt werden.
for film in filme:
... | xstealerx/Python-Advent-of-Code- | Python_Buch/python_für_einsteiger/lösungen/l_kapitel_10/lösung_10.4.5.py | lösung_10.4.5.py | py | 412 | python | de | code | 0 | github-code | 90 |
25654510916 | nterms = int(input("Enter a number of terms: "))
term1 = 0
term2 = 1
number = 0
while (number < nterms):
print(term1)
add = term1 + term2
term1 = term2
term2 = add
number += 1
#0, 1, 1, 2, 3, 5, 8, 13, 21
| camBraden/Custom-Lesson-Excercises | fib.py | fib.py | py | 252 | python | en | code | 0 | github-code | 90 |
74442519336 | # Dependencies
import time
import tweepy
# Twitter API Keys
# Twitter API Keys
consumer_key = 'n1sAdlZkFmYtjQjnKi4tvWVvq'
consumer_secret = 'Whrb65sNFHQ4r1x7XbaumLuaioCQ5qMnmzRoBgqGRJkJTlAcc7'
access_token = '975007267899703296-EK68p5xrtfuwJcFSEobrPT7k6hLwlAn'
access_token_secret = 'uWuNHTj8GXHUUOdnKphHkyLdVy... | lgidugu/first_deploy | tweet_out.py | tweet_out.py | py | 760 | python | en | code | 0 | github-code | 90 |
19818929830 | from numpy import insert, where, abs as np_abs, argsort, array, exp, pi, arange
from SciDataTool import DataFreq, Data1D
def store(self, out_dict):
"""Store the standard outputs of Electrical that are temporarily in out_dict as arrays into OutElec as Data object
Parameters
----------
self : OutElec
... | janzencalma20/django-backend | gitsubmodules/pyleecan/pyleecan/Methods/Output/OutElec/store.py | store.py | py | 3,206 | python | en | code | 0 | github-code | 90 |
21849947081 | from django import forms
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from modelcluster.fields import ParentalManyToManyField
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.fields import StreamField
from wagtail.models import DraftState... | wagtail/bakerydemo | bakerydemo/breads/models.py | models.py | py | 6,943 | python | en | code | 805 | github-code | 90 |
17987284699 | n = int(input())
arr = list(map(int, input().split()))
colors = [0] * 8
over = 0
for i in arr:
if i >= 3200:
over += 1
else:
colors[i // 400] += 1
res = 8 - colors.count(0)
if res:
print(res, res+over)
else:
print(1, over) | Aasthaengg/IBMdataset | Python_codes/p03695/s804150729.py | s804150729.py | py | 257 | python | en | code | 0 | github-code | 90 |
14269075157 | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 2 08:36:09 2020
@author: HB47810
"""
import pandas as pd
data = pd.read_csv('day2.csv', names=['key'])
extract = data["key"].str.split(" ", expand = True)
minmax = extract[0].str.split("-", expand = True)
extract["min"]= minmax[0]
extract["max"]= minmax[1]
e... | drewmogck/AdventOfCode | 2020/Day2/day2.py | day2.py | py | 405 | python | en | code | 1 | github-code | 90 |
18435078239 | import sys
def input():
return sys.stdin.readline().strip()
sys.setrecursionlimit(20000000)
MOD = 10 ** 9 + 7
INF = float("inf")
def f(n):
if n % 2 == 0:
a = n // 2
if a % 2 == 0:
return n
else:
return n ^ 1
else:
a = n // 2
if a % 2 == ... | Aasthaengg/IBMdataset | Python_codes/p03104/s488349021.py | s488349021.py | py | 538 | python | en | code | 0 | github-code | 90 |
18016328629 | import sys
import bisect
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
N = int(input())
A = [int(x) for x in input().split()]
A.sort()
impossible_num = 0
ruiseki = 0
for i, a in enumerate(A):
if i == N - 1:
continue
ruiseki += a
... | Aasthaengg/IBMdataset | Python_codes/p03786/s800994149.py | s800994149.py | py | 455 | python | en | code | 0 | github-code | 90 |
36638811265 | # Autor: Paulo Henrique Diniz de Lima Alencar
decimal = [1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000]
roman = ['I','IV', 'V', 'IX', 'X', 'XL', 'L', 'XC', 'C', 'CD', 'D', 'CM', 'M']
# Funcao: reponsavel pela conversao de numero romano para decimal.
def toDecimal(roman_number=""):
if roman_number == "":
... | pauloh-alc/Roman-numeral-conversion | toDecimal_toRoman.py | toDecimal_toRoman.py | py | 1,900 | python | en | code | 1 | github-code | 90 |
72899823338 | from sklearn.decomposition import PCA as sklearnPCA
import pandas as pd
import matplotlib
from matplotlib import pyplot as plt
import numpy
from sklearn.manifold import TSNE
def plots(x2):
plt.scatter(x2[:,0], x2[:,1])
plt.show()
def vPca(filepath):
df = pd.read_csv(filepath_or_buffer=filepath, sep=',')
x = df.ix... | srujanpatil/Juxtanet | visualise.py | visualise.py | py | 724 | python | en | code | 0 | github-code | 90 |
29626753297 | #
# @lc app=leetcode id=875 lang=python
#
# [875] Koko Eating Bananas
#
# @lc code=start
class Solution(object):
def minEatingSpeed(self, piles, H):
"""
:type piles: List[int]
:type H: int
:rtype: int
"""
def isValid(piles, H, target):
total = 0
... | zhch-sun/leetcode_szc | 875.koko-eating-bananas.py | 875.koko-eating-bananas.py | py | 1,164 | python | en | code | 0 | github-code | 90 |
75056935335 | import sys
def main(argv):
source_dir = "/home/yzlin/Shells/cdex"
error_output = ""
std_output = ""
action_output = "None"
dict_name = f"{source_dir}/path_set.txt"
action_file = f"{source_dir}/action"
# @ dictionary for path settings
path_names = []
paths = []
# TODO: Re... | lyz508/cd_existed | scripts/ChangeExistedDir.py | ChangeExistedDir.py | py | 5,169 | python | en | code | 0 | github-code | 90 |
21888309251 | #coding=utf-8
#python连接数据步骤
#1、导入数据库驱动模块import mysql.connector
#2、打开数据库连接
# cnn = mysql.connector.connect(user='root',passwd='',database='mysql')
#3、使用cursor()方法获取操作游标
# cursor=cnn.cursor()
#4、使用execute方法执行SQL语句
# cursor.execute(sql)
#5、关闭数据库连接
# cnn.close()
# 注:如果数据库连接参数多 可以写成字典模式
config={'host':'127.0.0.1',#... | carrotWu/pythonProjrct | ConMysql/msql1.py | msql1.py | py | 2,846 | python | en | code | 1 | github-code | 90 |
72201292458 | # Easy
# Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements.
#
# Note that you must do this in-place without making a copy of the array.
#
#
#
# Example 1:
#
# Input: nums = [0,1,0,3,12]
# Output: [1,3,12,0,0]
# Constraints:
#
# 1 <= nums.length <=... | ArmanTursun/coding_questions | LeetCode/Easy/283. Move Zeroes/283. Move Zeroes.py | 283. Move Zeroes.py | py | 1,298 | python | en | code | 0 | github-code | 90 |
44019684222 | import unittest
"""
Given an array of random numbers, push all zeros of given array to end of array.
Time complexity: O(n) and Space complexity: O(1)
Input: 1 9 8 4 0 0 2 7 0 6 0
Output: 1 9 8 4 2 7 6 0 0 0 0
"""
"""
Approach:
1. Scan array from left to right.
2. Keep a variable to count number of non-zero items in th... | prathamtandon/g4gproblems | Arrays/move_zeros_to_end.py | move_zeros_to_end.py | py | 1,210 | python | en | code | 3 | github-code | 90 |
36426911813 |
import re
import nltk
from nltk.stem.snowball import SnowballStemmer
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
def wordTokens(text, stop_words):
"""
Tokenization of a string in word tokens
:param text: A string
:param stop_words: A list of stop words to not be cons... | pjinthehouse/LiteroAnalyzer | graph_final.py | graph_final.py | py | 10,495 | python | en | code | 1 | github-code | 90 |
18559358929 | # -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
def main():
N,K=map(int,input().split())
... | Aasthaengg/IBMdataset | Python_codes/p03418/s562528201.py | s562528201.py | py | 457 | python | en | code | 0 | github-code | 90 |
18323704169 | from collections import Counter
mod = 998244353
N = int(input())
D = list(map(int, input().split()))
if D[0] != 0:
print('0')
exit()
counter = Counter(D)
if counter[0] != 1:
print('0')
exit()
counter = sorted(counter.items())
# print(counter)
keys = []
values = []
for i in range(len(counter)):
keys.... | Aasthaengg/IBMdataset | Python_codes/p02866/s565976937.py | s565976937.py | py | 573 | python | en | code | 0 | github-code | 90 |
22026239000 | # -*- coding: utf-8 -*-
import unittest
import sys
from gilded_rose import Item, GildedRose, Check
class GildedRoseTest(unittest.TestCase):
def setUp(self):
self.items = [Item(name="item1", sell_in=10, quality=20),
Item(name="Aged Brie", sell_in=2, quality=0),
... | mblaszczyk97/AdvancedProgrammingLanguages | test_gilded_rose.py | test_gilded_rose.py | py | 5,769 | python | en | code | 0 | github-code | 90 |
13266407172 | # !/user/bin/env python
# -*- coding:utf-8 -*-
# author:Zfy date:2021/6/29
import re
import csv
import hashlib
def get_words():
# 读取数据
with open('word2count.txt') as fp:
text = fp.read()
text = text.lower() # 所有字母改为小写
words = re.findall("\w*", text) # 正则匹配
words = [x for x in words if... | feiyu7348/python-Learning | 算法作业/第一题修改.py | 第一题修改.py | py | 1,945 | python | en | code | 0 | github-code | 90 |
4193338528 | from pyxtal.db import database
from pyxtal.msg import AtomTypeError, ReadSeedError
import numpy as np
import pandas as pd
db = database('../dataset/shape.db')
for i, p in enumerate([(0, 19), (19, -1)]):
(i1, i2) = p
name = 'shape-'+str(i)
sphs = []
codes = []
for i, code in enumerate(db.codes[i1:i... | MaterSim/MolecularPacking | example-03/run.py | run.py | py | 1,167 | python | en | code | 3 | github-code | 90 |
43135443561 | from flask import Flask, request, jsonify, abort
from ecgmeasure import ECGMeasure
import pandas as pd
app = Flask(__name__)
app.config["JSON_SORT_KEYS"] = False
# probably not the most elegant way of doing this, but should work
# more ideal to use something innate to the post to increment the counter
request_counter ... | raspearsy/bme590hrm | ecgcloud.py | ecgcloud.py | py | 4,254 | python | en | code | 2 | github-code | 90 |
30129341984 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.nn as nn
import math
class ModeModel(nn.Module):
def __init__(self, batch_size, seq_length, vocab_size, mode_num, target,
lstm_num_hidden=256, lstm_num_layers=1, device='cuda... | AxelBremer/chants | code/model.py | model.py | py | 3,740 | python | en | code | 1 | github-code | 90 |
33959194518 | import torch
import torch.nn as nn
# Define string returning function for input-output-weights-thresholds
def str_tensor(x, tensor_name):
input_image_txt = '#define '+tensor_name+' {'
in_ch,H,W = x.size(1), x.size(2), x.size(3)
for i in range(H):
for j in range(W):
for c in range(in_ch)... | pulp-platform/pulp-nn-mixed | generators/pulp_nn_network_test.py | pulp_nn_network_test.py | py | 3,220 | python | en | code | 8 | github-code | 90 |
25532554313 | from __future__ import annotations
from rich.console import RenderableType
from rich.style import StyleType
from textual import events
from textual.geometry import SpacingDimensions
from textual.layouts.grid import GridLayout
from textual.message import Message
from textual.messages import CursorMove
from textual.sc... | udincer/psub | psub/utilities/sge_monitor_tui_scrollview.py | sge_monitor_tui_scrollview.py | py | 5,221 | python | en | code | 0 | github-code | 90 |
28736419788 | # -*- coding: utf-8 -*-
import requests
import random
class OpenSTF:
def __init__(self, url, token):
self.base = 'http://{0}/api/v1/'.format(url)
self.token = token
self.device_url = 'http://{0}/api/v1/devices'.format(url)
self.user_url = 'http://{0}/api/v1/user'.format(url)
... | fspinillo/appium-openstf-hockeyapp | utilities/openstf_api.py | openstf_api.py | py | 3,892 | python | en | code | 1 | github-code | 90 |
2874821506 | import copy
# member = ['小甲鱼','小布丁','黑夜','咪兔','意境']
# print(member)
#
# mix = ['1','小甲鱼',3.14,[1,2,3]]
# print(mix)
#
# empty = []
# #添加元素的方法
# empty.append('你好周杰伦')
# empty.append('朱晶晶')
#
# empty.extend(['qqq','ddd'])
# print(empty,len(empty))
#
# empty.insert(0,'asd')
# print(empty,len(empty))
member = ['小甲鱼','黑夜',... | pqgk/urllib_demo1 | 小甲鱼/列表.py | 列表.py | py | 2,726 | python | en | code | 0 | github-code | 90 |
30733935627 | """ Commands handler """
import sys
import os
from collections import OrderedDict
from knack.util import CLIError
from knack.log import get_logger
from azure.cli.command_modules.resource.custom import run_bicep_command
from azure.cli.core.util import user_confirmation
from azure.cli.core import __version__ as azure_cl... | ahelal/cdf | azext_cdf/handlers.py | handlers.py | py | 8,843 | python | en | code | 1 | github-code | 90 |
9302339941 | import numpy as np
import pandas as pd
import matplotlib
matplotlib.use('QtAgg')
import matplotlib.pyplot as plt
import pickle
import serial
from ctypes import Structure, c_float, sizeof
from pure_sklearn.map import convert_estimator
import collections
import itertools
from PyQt6.QtCore import *
from PyQt6.QtGui import... | nosovand/pedometer | collectData.py | collectData.py | py | 9,613 | python | en | code | 0 | github-code | 90 |
6342565060 | #!/usr/bin/python3
"""liklist task
"""
class Node:
"""this is a node class
"""
def __init__(self, data, next_node=None):
self.data = data
self.next_node = next_node
@property
def data(self):
return self.__data
@data.setter
def data(self, value):
if no... | uoch/holbertonschool-higher_level_programming | python-classes/100-singly_linked_list.py | 100-singly_linked_list.py | py | 1,389 | python | en | code | 0 | github-code | 90 |
18120036199 | import math
deg = int(input())
li_x = list(map(int,input().split()))
li_y = list(map(int, input().split()))
p1_dis = 0.0
p2_dis = 0.0
p2_temp = 0.0
p3_dis = 0.0
p3_temp = 0.0
p4_dis = 0.0
p4_temp = [ ]
for i in range(deg):
p1_dis += math.fabs(li_x[i] - li_y[i])
p2_temp += (li_x[i] - li_y[i]) **2.0
p3_temp += math.f... | Aasthaengg/IBMdataset | Python_codes/p02382/s134541276.py | s134541276.py | py | 614 | python | en | code | 0 | github-code | 90 |
6685741885 | # The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)
# P A H N
# A P L S I I G
# Y I R
# And then read line by line: "PAHNAPLSIIGYIR"
# Write the code that will take a string and make this... | lawrencemq1992/uiuc | leetcode/zigzag-conversion.py | zigzag-conversion.py | py | 1,428 | python | en | code | 1 | github-code | 90 |
33659945617 | #
# @lc app=leetcode.cn id=49 lang=python3
#
# [49] 字母异位词分组
#
# https://leetcode-cn.com/problems/group-anagrams/description/
#
# algorithms
# Medium (58.65%)
# Likes: 205
# Dislikes: 0
# Total Accepted: 35.1K
# Total Submissions: 59.3K
# Testcase Example: '["eat","tea","tan","ate","nat","bat"]'
#
# 给定一个字符串数组,将字母... | algorithm004-04/algorithm004-04 | Week 02/id_699/LeetCode_49_699.py | LeetCode_49_699.py | py | 957 | python | en | code | 66 | github-code | 90 |
73001418858 | ##OBS1: Comidas podem spawnar em cima da cobra, o que faz com que ela cresça sem comer a comida
##OBS2: Talvez possa aumentar a velocidade do jogo de acordo com o tamanho da cobra
##OBS3: Os pixeis não pertencem a uma grid, portanto, para manter uma certa proporção, o tamanho da tela deve ser múltiplo ao tamanho do qua... | Popsicle-Cat/python_snake | Snake.py | Snake.py | py | 4,576 | python | pt | code | 0 | github-code | 90 |
35615497531 | import os
import re
import tifffile
from tiff_image_class import tiff_file
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
project=["trains"]
dpath = "/Volumes/GoogleDrive/Shared drives/Beique Lab/PAST LAB MEMBERS/Cary Soares/SNIFFER DATA SHARED AUG 2020/CaryData/tiff_archive"
roisavepath =... | anupgp/image_analysis | analyze_data_tiff.py | analyze_data_tiff.py | py | 2,459 | python | en | code | 1 | github-code | 90 |
33206346977 | # Plot the loss decreasing data for multi-branches in deep learning
# Here the three branches are called 'grid', 'masking', 'pixel'
# Over 100,000 iterations
import numpy as np
import matplotlib.pyplot as plt
with open('./trainingdata/grid_ori_loss') as f:
lines = f.read().splitlines()
grid = [float(i) f... | doem97/matplotlib-examples-deep-learning | multi-branch-loss.py | multi-branch-loss.py | py | 1,821 | python | en | code | 0 | github-code | 90 |
22917551515 | #!/usr/bin/env python
from re import sub
from sys import argv,exit
from os import system,getenv
import json
debug_level = 2
torun = argv[1]
output = 'snapshot.root'
if len(argv)>2:
debug_level = int(argv[2])
if len(argv)>3:
output = argv[3]
argv = []
import ROOT as root
from PandaCore.Tools.Load imp... | sidnarayanan/RedPanda | Cluster/test/snapshot.py | snapshot.py | py | 576 | python | en | code | 0 | github-code | 90 |
18546807389 | N = int(input())
X_list = list(map(int, input().split()))
tmp = X_list.copy()
tmp.sort()
a = tmp[int(N/2)-1]
b = tmp[int(N/2)]
for i in range(N):
if(X_list[i] <= a):
print(b)
else:
print(a) | Aasthaengg/IBMdataset | Python_codes/p03379/s991955067.py | s991955067.py | py | 214 | python | en | code | 0 | github-code | 90 |
21275667044 | import copy
from typing import List
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
'''def backtrack(combination, nextnums):
if len(nextnums)==0:
return res.append(combination)
else:
for number in nextnums:
if ... | Yue-Du/Leetcode | 46.py | 46.py | py | 1,053 | python | en | code | 0 | github-code | 90 |
13918926009 | """Алгоритм Евклида - наибольший общий делитель НОД
---Наибольший общий делитель(greatest common divisor)"""
import random
# Хвостовая рекурсия
def gcd_rec(a, b):
if b == 0:
return a
return gcd_rec(b, a % b)
# Итерационный вариант
def gcd_iter(a, b):
while b != 0:
b, a = a % b, b
retur... | Vik154/Algorithms_training_code | MATHEMATICAL_PY/GCD___(Euclidean_algorithm).py | GCD___(Euclidean_algorithm).py | py | 3,293 | python | ru | code | 1 | github-code | 90 |
18101117429 | def dfs(adjlist,v):
global d,f,t
d[v-1]=t
t+=1
for node in adjlist[v-1]:
if d[node-1]<0 and node>0:
dfs(adjlist,node)
f[v-1]=t
t+=1
n=int(input())
adjlist=[list(map(int,input().split()))[2:] for _ in range(n)]
d=[-1]*n
f=[-1]*n
t=1
for i in range(1,n):
if d[i-1]<0:
... | Aasthaengg/IBMdataset | Python_codes/p02238/s706679240.py | s706679240.py | py | 400 | python | en | code | 0 | github-code | 90 |
24146553330 | import logging
import MeCab
from ..unit import Morpheme, PASUnit, POS, UnitType
logger = logging.getLogger(__name__)
tagger = MeCab.Tagger()
tagger.parse('')
def analyze(document):
def start_idx_of_compound_term(end_idx):
start_idx = end_idx
while (start_idx >= 0
and is_noun_or_... | toutobu/pasnominator | pasnominator/mecab/nominator.py | nominator.py | py | 3,546 | python | en | code | 0 | github-code | 90 |
32057784152 |
class Cat(object):
def say(self):
print('i am a cat')
class Dog(object):
def say(self):
print('i am a dog')
class Duck(object):
def say(self):
print('i am a duck')
def __getitem__(self, item):
return ['xiaoweigege'][item]
animal_list = [Cat, Dog, Duck]
for animal ... | xiaoweigege/Python_senior | chapter03/1.鸭子类型.py | 1.鸭子类型.py | py | 774 | python | en | code | 1 | github-code | 90 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.