blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 2 333 | src_encoding stringclasses 30
values | length_bytes int64 18 5.47M | score float64 2.52 5.81 | int_score int64 3 5 | detected_licenses listlengths 0 67 | license_type stringclasses 2
values | text stringlengths 12 5.47M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
4b2bb4912f6bec7f2eada013ce9cd897a797e2b9 | Python | PrashantThakurNitP/python-december-code | /assignment 2.8 print in dictionary order.py | UTF-8 | 657 | 3.96875 | 4 | [] | no_license | x=input("input first string :")
y=input("enter second string : ")
z=input("enter third string : ")
if x>=y:
if y>=z:
print("the string in dictionary order are")
print(z,y,x,sep="\n")
elif z>x:
print("the string in dictionary order are")
print(y,x,z,sep="\n")
else:
print("the string in dicti... | true |
09c314502edde5591d88f1de8c98d15463c0ae21 | Python | mvpzone/python-docs-samples | /people-and-planet-ai/land-cover-classification/trainer.py | UTF-8 | 7,350 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | true |
a37d3e3fa59b0a1eab1f1052052a7955450745b9 | Python | JLuebben/pdb2blend | /readpdb.py | UTF-8 | 4,897 | 2.953125 | 3 | [] | no_license | from collections import OrderedDict
class DuplicateAtomError(Exception):
pass
class PdbObject(object):
def __init__(self, fileName):
self._fileName = fileName
self._atomsByEntry = OrderedDict()
self._residues = OrderedDict()
self._residuesByClass = {}
def read(self):
... | true |
c740a29bee23a34edacb2cba7bb182903f2c2e14 | Python | Aasthaengg/IBMdataset | /Python_codes/p03496/s925946878.py | UTF-8 | 371 | 3.25 | 3 | [] | no_license | I = int(input())
L = list(map(int, input().split()))
print(2*I-1, flush=True)
m = 0
m_index = 0
for i, item in enumerate(L):
if abs(item) > abs(m):
m = item
m_index = i
for i in range(I):
print(m_index+1, i+1, flush=True)
if m >= 0:
for i in range(0, I-1):
print(i+1, i+2)
else:
... | true |
f092f3b1f4a5eb4c0ef087a8010212550dcf5af6 | Python | russlarge256/wsgi-calculator | /calculator.py | UTF-8 | 3,630 | 3.5625 | 4 | [] | no_license | import traceback
def home():
""" Sets up home page """
page = """
<h1> Web Calculator </h1>
<p>In order to use this website effectively, use the url to
specify operation type (add, subtract, multiply, divide) and the numbers
for the operation. Example: http://localhost:8080/add/2/3
"""
... | true |
4885480138ca6271277587003c6ad095ef0ac7f1 | Python | avanger9/LP-laboratori | /python/practica/prova1.py | UTF-8 | 71 | 3.515625 | 4 | [] | no_license | a = [1,2,3,4,5]
b = [9,8,7]
for c, d in (a,b):
print(c), print(d)
| true |
b513a1963ce8c6dd11ba50eb69fdf709a10fd91f | Python | lutzer/sahabe | /de.sahabe.backend/main/app/response.py | UTF-8 | 2,029 | 2.515625 | 3 | [] | no_license | '''
Created on Jul 13, 2014
@author: Maan Al Balkhi
'''
from flask import Response
from flask import json
headers = {"Access-Control-Allow-Origin":"http://127.0.0.1:8000",
"Access-Control-Allow-Methods":"*",
"Access-Control-Allow-Credentials":"true",
"Access-Control-Allow-Headers":"X... | true |
a1627eb146da2821a6b3fc5d630ab3724b508fe3 | Python | TTKSilence/Educative | /GrokkingTheCodeInterview-PatternsForCodingQuestions/1.PatternSlidingWindow/5.FruitsIntoBaskets(med).py | UTF-8 | 570 | 3.3125 | 3 | [] | no_license | def solution(Fruit):
left=0
basket={}
count=0
maxlength=0
for i,x in enumerate(Fruit):
if x in basket:
basket[x]+=1
else:
basket[x]=1
count+=1
while count>2:
basket[Fruit[left]]-=1
if basket[Fruit[left]]==0:
... | true |
6beca6e93062b6f4d8cd05282e6a68169a5b260a | Python | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/arc088/B/3620240.py | UTF-8 | 283 | 3.359375 | 3 | [] | no_license | def main():
buf = input()
S = buf
K = len(S) // 2
center_char = S[K]
while K < len(S):
if S[K] == center_char and S[-K - 1] == center_char:
K += 1
else:
break
print(K)
if __name__ == '__main__':
main() | true |
b3b5ca2a033a6c4011c90c3f748500106521b77f | Python | calebsimmons/hungry_monsters | /tiny_monsters/psc_parser.py | UTF-8 | 5,417 | 3.171875 | 3 | [] | no_license | """
This module implements a parser for PySCeS Model Description
Language files, according to the spec provided [LINK GOES HERE].
Input: A .psc filename Output: A list containing reactions and a
dictionary of initial values.
A reaction is a list of the form:
[[reactants],[products],rate]
A initial value dictionary ... | true |
d56d9b5a0018e44ef5f77bf1a2a3af295d6f8f64 | Python | PabloPedace/Python-Curso-Youtube | /metodosdecadenas.py | UTF-8 | 2,394 | 4.625 | 5 | [] | no_license | #Metodos de cadenas
#Uso de metodos de cadenas: string
myStr = "hello world"
print("HELLO WORLD AND " + myStr) #Concatenacion
print(f"HELLO WORLD AND {myStr}") #Concatenacion con f
print("HELLO WORLD AND {0}".format(myStr)) #Concatenacion
#print(dir(myStr))
# print(myStr.upper()) #Convierte todo en mayuscula
# pri... | true |
7b2507ded388ce9e7e21b055a295f650d83e4616 | Python | Aasthaengg/IBMdataset | /Python_codes/p02717/s631808751.py | UTF-8 | 55 | 2.703125 | 3 | [] | no_license | A,B,C = (int(x) for x in input().split())
print(C,A,B)
| true |
de600dcb250ad6782464edc36bdb05fbb49d51da | Python | YellowKyu/ml-interview-review | /kmeans.py | UTF-8 | 1,648 | 3.203125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
# generate 2d classification dataset
X, Y = make_blobs(n_samples=1000, n_features=10, centers=5)
# visualization
#plt.scatter... | true |
222ee35a778a385dbfeef3d30e62c30120ede78e | Python | bardiabarabadi/SingleImage_x264 | /Experiments/Exp_1/pythons/Network.py | UTF-8 | 4,412 | 2.59375 | 3 | [] | no_license | # Modules
from keras.layers.core import Activation
from keras.layers.normalization import BatchNormalization
from keras.layers.convolutional import UpSampling2D
from keras.layers import Input, Concatenate, merge, Add
from keras.layers.convolutional import Conv2D
from keras.models import Model
from keras.layers.advanced... | true |
d00be95c7be01ced03437647da68c23173742954 | Python | loles/fuelweb | /dhcp-checker/dhcp_checker/utils.py | UTF-8 | 4,593 | 2.734375 | 3 | [] | no_license | # Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | true |
84d8e2cff705ad6b609fe9968df6a2bed63bf54f | Python | Adam110001/Elements_in_Circle_in_Array | /main.py | UTF-8 | 773 | 2.96875 | 3 | [] | no_license | import numpy as np
def minusSide(num):
num -= 1
return num
def plusSide(num):
num += 1
return num
if __name__ == '__main__':
numB = 5
midP = 2
if numB == 5:
z = np.zeros(shape=(numB, numB))
elif (numB / 2) % 5 == 0:
numB += 1
z = np.zeros(shape=(numB, num... | true |
562b3fe756ac7c4fa65150b119228260e381297b | Python | remimetzdorff/seconde | /chap/tp_plumarteau/tp_plumarteau_v3/TP Plume/chute_libre.py | UTF-8 | 1,298 | 2.921875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
#########
# DONNÉES
#########
t = np.array([0.00, 0.45, 0.90, 1.35, 1.80, 2.25, 2.70])
X = np.array([0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00])
Y = np.array([0.00, 0.97, 3.89, 8.75, 15.56, 24.31, 35.00])
################################################... | true |
0ac3a254d1683263d7ce0cef27a5c58e0d8cb1fe | Python | HWaymentSteele/kinase_msm | /kinase_msm/plotting_utils.py | UTF-8 | 15,245 | 2.75 | 3 | [] | no_license | #!/bin/evn python
import pandas as pd
import numpy as np
from .mdl_analysis import _map_obs_to_state
from scipy.stats import gaussian_kde
"""
set of helper routines to plot things
"""
def scipy_kde(pr_mdl, pop_vector=None, obs=(0,1),
n_samples=30000, bw_method='scott'):
"""
Returns a opulation ... | true |
acd1dc77d5f6002d103a8f8e51079d4bb5625bcb | Python | obsiwitch/edupr5melkman | /src/utils.py | UTF-8 | 905 | 3.25 | 3 | [] | no_license | import types
# Iterable SimpleNamespace.
class Table(types.SimpleNamespace):
def __iter__(self):
for k, v in self.__dict__.items(): yield v
# Iterable keeping track of the current element.
class Iter:
def __init__(self, collection):
self.collection = collection
self.i = -1
@proper... | true |
dd68395c81b8a2678252149a3b30502382354eb2 | Python | ointaj/VNSP | /src/messages.py | UTF-8 | 285 | 2.78125 | 3 | [] | no_license |
class cErrorMessages:
@staticmethod
def CantOpenFile():
print("Can't open the file !")
@staticmethod
def CantWriteToFile():
print("Can't write to file")
@staticmethod
def StorageError():
print("Error of creating storage for game !")
| true |
846363d81683de9177f333e7a478f6d019c1b01d | Python | danaimone/Blind_75 | /Graphs/course_schedule.py | UTF-8 | 1,273 | 3.40625 | 3 | [] | no_license | from typing import List
class Solution:
def canFinish(self, numCourses: int, prerequisites: List[List[int]]) -> bool:
from collections import defaultdict
course_dict = defaultdict(list)
for relation in prerequisites:
next_course, previous_course = relation[0], relation[1]
... | true |
3a44dc430791d348812ec58a112f23f31b5da8e8 | Python | ekimekim/grabbit | /grabbit/frames/tests/test_datatypes.py | UTF-8 | 1,832 | 2.703125 | 3 | [] | no_license |
from unittest import main
from grabbit.frames.datatypes import *
from common import FramesTestCase
class DatatypeTests(FramesTestCase):
def test_octet(self):
self.check(Octet, '\xab', 0xab)
def test_short(self):
self.check(Short, '\xbe\xef', 0xbeef)
def test_long(self):
self.check(Long, '\xde\xad\xbe\xef'... | true |
84533e99bf66f555fa73defbae8460f6c9c0e241 | Python | M2odrigo/keras_metrics | /train_normalize_data_old.py | UTF-8 | 2,932 | 3.09375 | 3 | [] | no_license | # Create your first MLP in Keras
from desviation_function import calc_metric
from keras.models import Sequential
from keras.layers import Dense
from sklearn.preprocessing import StandardScaler
import numpy as np
# fix random seed for reproducibility
np.random.seed(7)
##variables
cant_epoch = 0
batch_size = 100
###
# ... | true |
754e058181171b81cd9641cd4393c82b5e5ffa8b | Python | aiyingsuccess/machinelearning | /finalbasic.py | UTF-8 | 1,542 | 2.515625 | 3 | [] | no_license | from __future__ import print_function
from pandas import read_csv
import math
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
dataset = read_csv('/home/aiying/Machinelearning/dataorigin.csv')
headers = list(dataset)
ds=dataset.values.tolist()
modset=[]
modframe=[]
... | true |
638ee9e488194d8d8b81d8031b952de2cdeb8742 | Python | krestenkrab/500lines | /cluster/bb_network.py | UTF-8 | 2,267 | 2.765625 | 3 | [
"CC-BY-3.0",
"MIT"
] | permissive | import logging
from multiprocessing import Process, Queue
# Remove from final copy:
# - logging
network = {}
class Node(object):
def __init__(self, address):
self.q = Queue()
self.address = address
self.logger = logging.getLogger('node.%s' % address)
network[self.address] = self... | true |
a3b4d9d3bcdf79fa872469a1dac8ce96300e714e | Python | rajesh-cric/pythonchallenges.py | /code4.py | UTF-8 | 197 | 3.484375 | 3 | [] | no_license | print("***tax Program***")
price=float(input("how much did you pay?: "))
if price>=1.00:
tax=0.07
print('tax rate is:'+str(tax))
else:
tax=0
print('tax rate is:'+str(tax))
| true |
5e813ff1b146cd92d09447327f739b1cb065ddcd | Python | ekitanidis/heart4cast | /utils.py | UTF-8 | 896 | 3.34375 | 3 | [] | no_license | import numpy as np
from itertools import groupby
def find_consec(data, size):
""" Finds all groups of contiguous numbers of a given size in data. These groups may overlap.
Returns a list of tuples, where each tuple is the pair of indices in data enclosing the group.
"""
# find groups of contiguous... | true |
d0f3233f10e832c521bff393c8dac104b65552ca | Python | anaskhan96/r2ic | /src/code.py | UTF-8 | 4,740 | 2.796875 | 3 | [
"MIT"
] | permissive | class ThreeAddressCode:
def __init__(self):
self.symbolTable = None
self.allCode = []
self.tempVarCount = 0
self.loop_statement_count = 0
self.loop_status = ''
self.loop_unroll = False
self.loop_values = []
def loop_begin(self):
self.loop_status = 'begin'
def loop_end(self):
self.loop_status = '... | true |
5562e79062f81e96d531adc685df17684b4d3428 | Python | athro/openSNPAnalysis | /python_scripts/compress.py | UTF-8 | 1,905 | 2.640625 | 3 | [
"MIT"
] | permissive | import gzip
import zipfile
import os
#AK:TBD:# xls unfinished and untested
#AK:TBD:import xlrd
magic = {}
magic["zip"] = b'\x50\x4b\x03\x04'
magic["gzip"] = b'\x1f\x8b\x08'
#magic["bzip"] = b'\x42\x5a\x68'
#AK:TBD:magic["xls"] = b'\xd0\xcf'
#AK:TBD:# change to filehanle for zipped xls?
#AK:TBD:def test_xsl(filename)... | true |
8ed3d20034fa3b76446d18df2fb4d1537805116d | Python | NeuralVFX/wasserstein-gan | /util/helpers.py | UTF-8 | 2,278 | 2.703125 | 3 | [] | no_license | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from torch.utils.data import *
############################################################################
# Helper Utilities
############################################################################
def mf... | true |
7fa8b9fd51cdcc523cc10f8ada9db4ea42d8fd9e | Python | danielpeterson0530/Code | /Python/Functions/gzipfile2dict.py | UTF-8 | 411 | 3.109375 | 3 | [] | no_license | # Python Function to gunzip file and return dictionary (requires gzip package)
def gzipfile2dict(filename):
# requires gzip package
gzip_dict = {}
with gzip.open(filename, mode='rt') as f:
for line in f:
elements = line.strip().split('\t')
label = elements[0]
id = elements[4]
... | true |
4ce7709e03ecea50f48d79e17c98449668a904c2 | Python | As4klat/Tutorial_Python | /Tanda 1/07.py | UTF-8 | 579 | 4.03125 | 4 | [] | no_license | compr = True
while compr:
try:
m = int(input("Introduzca número factoriales a calcular: "))
compr = False
except ValueError:
print("Introduzca solo valores numéricos enteros\n")
for i in range(1, m+1):
compr = True
while compr:
try:
n = int(input("Introduzca ... | true |
51975ed36b591ef25e3d7235d79d68bd3e5fbca3 | Python | cloverrose/pythonz | /pythonz/downloader.py | UTF-8 | 1,840 | 2.890625 | 3 | [
"MIT"
] | permissive |
import urllib
import urllib2
import sys
from pythonz.exceptions import DownloadError
class ProgressBar(object):
def __init__(self, out=sys.stdout):
self._term_width = 79
self._out = out
def update_line(self, current):
num_bar = int(current / 100.0 * (self._term_width - 5))
b... | true |
1dedbe1ea9d944f68f71d2a8a6e06d6774028025 | Python | Aasthaengg/IBMdataset | /Python_codes/p03162/s104439235.py | UTF-8 | 427 | 2.796875 | 3 | [] | no_license | n = int(input())
A, B, C = [], [], []
for i in range(n):
a, b, c = map(int, input().split())
A.append(a)
B.append(b)
C.append(c)
dp_a, dp_b, dp_c = [0] * n, [0] * n, [0] * n
dp_a[0] = A[0]
dp_b[0] = B[0]
dp_c[0] = C[0]
for i in range(1, n):
dp_a[i] = max(dp_b[i-1], dp_c[i-1]) + A[i]
dp_b[i] = max(dp_c[i-... | true |
eebc418d2ed8d3ed1cb30ff00008e19e421efccf | Python | Ponkiruthika112/codekataset1 | /print_bef_0.py | UTF-8 | 301 | 2.71875 | 3 | [] | no_license | n=int(input())
l=list(map(int,input().split()))
s=""
for i in range(0,len(l)):
s=s+str(l[i])
k=""
i=0
p=-1
while i<len(s):
if s[i]=="0" and s[i-1]=="0":
i=i+1
elif s[i]=="0":
k=k+s[p+1:i]+" "
p=i
i=i+1
else:
i=i+1
print(k.strip())
#fjk
| true |
9557732bd2074692bb5987acc3cd6e76f0d0a913 | Python | naturofix/clear_data | /check_4_duplites.py | UTF-8 | 6,936 | 2.671875 | 3 | [] | no_license | # the purpose of this script is to check to file location and make sure files exist in both.
# if not file should be copied to to a temp folder in the second location
import os
import sys
import fnmatch
import time
import datetime
import filecmp
path_1 = sys.argv[1]
path_2 = sys.argv[2]
path_3 = '/mnt/BLACKBURNLAB/... | true |
56990b805ddabefdb25f6f304a6e1f319011e8c7 | Python | jonahobw/honors | /image_features_network.py | UTF-8 | 15,208 | 2.609375 | 3 | [] | no_license | import copy
import torch.nn.functional as F
import torch
import os
import pandas as pd
from sklearn.model_selection import train_test_split
from torch import nn
import torch.optim as optim
from torch.utils.data import Dataset
from sklearn.preprocessing import StandardScaler
import time
import matplotlib.pyplot as plt
... | true |
52e37cecef8f581ae567ea6011fe1b99bc2fa120 | Python | Swapna-Sahu/python-and-data-science-tools | /week1/HomeworkWeek1.py | UTF-8 | 2,316 | 4.65625 | 5 | [] | no_license | # Task 1 - Write a python script to print your name and age
name = input("Enter your name")
age = int(input("Enter your age"))
print(f"Your name is : {name}. Your age is : {age}")
# Task 2 - Create a list of your 5 favorite movies and store it in the variable
movies = []
for i in range(5):
movie = input(" Enter... | true |
b464ea2e3b50573dc561417a5852b727056a0046 | Python | zytMatrix/MBEsolutions | /lab7C.py | UTF-8 | 882 | 2.515625 | 3 | [] | no_license | from pwn import *
SYSTEM_OFFSET = 0x19da37 # Offset from `system` to `small_str`
# Choices
MAKE_STR = "1"
MAKE_NUM = "2"
DEL_STR = "3"
DEL_NUM = "4"
PRINT_STR = "5"
PRINT_NUM = "6"
p = process(["/levels/lab07/lab7C"])
log.info(util.proc.pidof(p))
#pause()
# Fill the first num index with the first allocation pointer... | true |
8947b0311f983a830ad07df5ca8c687f1fd044e9 | Python | bingqingsuimeng/face_data_preprocess | /utils.py | UTF-8 | 3,333 | 3.234375 | 3 | [] | no_license | import os
import time
def mkdir(dir):
try:
os.mkdir(dir)
except OSError:
pass
def load_image_names_and_path(img_folder_path):
'''
Useage: image_names, image_paths, image_names_no_suffix= load_image_names_and_path(img_folder_path)
:param img_folder_path:
:return:
'''
... | true |
0d4f5c7c137cb5c8f047c017c6875511dbfc3e80 | Python | samar2788/codwars-katas | /reverseinbetween.py | UTF-8 | 511 | 3.859375 | 4 | [] | no_license | def reverse(st, a, b) :
print(len(st))
# Invalid range
if (b >= len(st)) :
b=len(st)-1
print(b)
st = list(st)
# While there are characters to swap
while (a <= b) :
# Swap(str[l], str[r])
c = st[a]
st[a] = st[b]
st[b] = c
a... | true |
38ae95963dd2463d1e463affd3caa1ba071021e7 | Python | jnoob/algorithms | /py/leetcode/dp/_010_regexMatch.py | UTF-8 | 275 | 2.890625 | 3 | [] | no_license |
class Solution:
def isMatch(self, s: str, p: str) -> bool:
input, pattern = s, p
iIndex, pIndex = 0, 0
def findStarts(self, p):
indexs = []
for i in p:
if i == '*':
indexs.append(i)
return indexs
| true |
bc10a8701c9dd90eca216068f4bfe9b2eb6adc95 | Python | mbg17/superlist | /day15/shujuku.py | UTF-8 | 1,780 | 2.65625 | 3 | [] | no_license | #1,luyuan,23,13020166103,IT
# 定义取数规则
dic={'name':1,'id':0,'age':2,'telephone':3,'job':4}
def read_file(filename):
with open(filename,encoding='utf-8') as f:
for i in f:
view_list=i.split(',')
yield view_list
# 去除符合条件的所有数据
def filter_detail(detail):
g = read_file('userinfo')
i... | true |
da6b1b75544d866e65f11126fee5f96a442cae59 | Python | justinlboyer/earnscrape | /make_db.py | UTF-8 | 4,310 | 2.765625 | 3 | [] | no_license | import datetime
from dateutil.relativedelta import relativedelta
import json
import logging
import os
from tqdm import tqdm
logging.basicConfig(filename="instantiate_db.log",
format='%(asctime)s %(message)s',
filemode='w')
logger=logging.getLogger()
logger.setLevel(logging.DE... | true |
a44a08a1a3218fd6b6a66eb0c3189911801535a1 | Python | akerusan-s/flask-project | /data/users_resource.py | UTF-8 | 3,853 | 2.734375 | 3 | [] | no_license | from flask_restful import reqparse, abort, Resource
from data import db_session
from .__all_models import User
from flask import jsonify
# инициализация парсера
parser = reqparse.RequestParser()
parser.add_argument("surname")
parser.add_argument("name")
parser.add_argument("email")
parser.add_argument("password")
d... | true |
dee8d730df27b7b684b38d6136724dbd96864f7a | Python | FernandaDR/Programaci-n | /examenes1/examen1_coronavirus.py | UTF-8 | 1,414 | 3.5 | 4 | [] | no_license | #----------------mensajes-------------
MENSAJE_BIENVENIDA = "Bienvenido,"
MENSAJE_BIENVENIDO_II = " a continuación será evaluado para determinar su estado de salud."
MENSAJE_NOMBRE = "Por favor introduzc su nombre \n "
MENSAJE_TEMP = "Por favor intraduzca la temperatura actual de su cuerpo \n"
MENSAJE_LUGAR = "Por fav... | true |
6dccc78dc5c85c78fbd45fe14b5b3a72eb511415 | Python | Skaft/aoc | /2019/day5/aoc5-pruned.py | UTF-8 | 4,879 | 3.515625 | 4 | [] | no_license | """
My attempt to tidy up the intcode computer.
The main issue was finding a consistent and clear way of handling parameter
modes. In the end I landed with a decorator. It allows me to replace parameters
according to their mode before a function gets them, as well as to bypass this
system in a flexible way by marking ... | true |
9fe66a9b139921de5401a2e759cb4bb89f6c3bcd | Python | format37/tfodModelBanknotes | /using/lex.py | UTF-8 | 1,416 | 2.5625 | 3 | [] | no_license | import os
import requests
from datetime import datetime
def host_check(hostname):
return True if os.system("ping -c 1 " + hostname)==0 else False
def send_to_telegram(chat,message):
headers = {
"Origin": "http://scriptlab.net",
"Referer": "http://scriptlab.net/telegram/bots/relaybot/",
'User... | true |
cdde07bd3bee6cf2111d251a7359b0dcaa0d2253 | Python | 19mddil/Python | /miscellenous/chapter2/panic.py | UTF-8 | 295 | 3.359375 | 3 | [] | no_license | phrase = "Don't panic!"
plist = list(phrase)#turing string into list
print(phrase)
print(plist)
new_phrase = "".join(plist[1:3])
print(new_phrase)
new_phrase = new_phrase+"".join([plist[5],plist[4]])
print(new_phrase)
new_phrase = new_phrase+"".join(plist[7:5:-1])
print(plist)
print(new_phrase) | true |
766eb3e55833a4af8e8e9d788ddaa6096b9b7b7a | Python | Cenibee/PYALG | /python/fromBook/chapter6/tree/47-serialize-and-deserialize-binary-tree/47-m.py | UTF-8 | 2,610 | 3.9375 | 4 | [] | no_license | # Definition for a binary tree node.
from typing import Deque, List
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Codec:
def serialize(self, root: TreeNode):
"""Encodes a tree to a single string.
:type root: Tree... | true |
c463d6d5cfe4681891df197b6a8814a3138115ae | Python | kingflyfly/python_study | /第9章-再谈抽象/9.3.1.py | UTF-8 | 1,326 | 3.75 | 4 | [] | no_license | def check_index(key):
"""
指定的键是否是可接受的索引?
键必须是非负整数,才是可接受的。如果不是整数,
将引发TypeError异常;如果是负数,将引发Index
Error异常(因为这个序列的长度是无穷的)
"""
if not isinstance(key,int):raise TypeError
if key < 0: raise IndexError
class ArithmeticSequence:
def __init__(self,start=0,step=1):
"""
初始化这个算术序... | true |
50f8ab978497151974d1bf2f3b54b3451b4dd18f | Python | yaniv14/OpenCommunity | /src/shultze/test_functionality/test_plurality.py | UTF-8 | 2,878 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | # Copyright (C) 2009, Brad Beattie
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | true |
eb36a6f1a71f7abbca5ef7d2cd9ef1f6e6c71994 | Python | hyejinHong0602/BOJ | /bronze3/[WEEK1] 10951 - A + B - 4.py | UTF-8 | 365 | 3.421875 | 3 | [] | no_license | # 이렇게 하면 런타임에러남.
while True:
a, b = map(int, input().split())
if (a>0 and b < 10):
print(a+b)
else:
break
# 입력의 끝이 안정해져있기때문에 이렇게 except 처리를 해줘야한다고 한다.
while True:
try:
a, b = map(int, input().split())
print(a+b)
except:
break | true |
3891c93bb99059d35a4082ef467073fdb99d62ec | Python | joker-xidian/espcn-1 | /dataloader.py | UTF-8 | 1,388 | 2.671875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Time : 2019/2/8 11:39
# @Author : ylin
# Description:
#
from torch.utils.data.dataset import Dataset
from os.path import join
from os import listdir
from PIL import Image
def is_image_file(filename):
return any(filename.endswith(extension) for extension in [... | true |
417abe05ed76361a5b6ca8f7729855d7777f9a86 | Python | crazywiden/Leetcode_daily_submit | /Widen/LC457_Circular_Array_Loop.py | UTF-8 | 3,553 | 3.90625 | 4 | [
"MIT"
] | permissive | """
LC 457 -- Circular Array Loop
You are given a circular array nums of positive and negative integers. If a number k at an index is positive,
then move forward k steps. Conversely, if it's negative (-k), move backward k steps. Since the array is circular,
you may assume that the last element's next element is the f... | true |
4be5d71a17cf8b25c1de2ee84d189bfee5a5832d | Python | benjaminknebusch/formify | /first_app.py | UTF-8 | 664 | 2.734375 | 3 | [] | no_license | from formify.layout import *
from formify.controls import *
import formify
def print_text():
text = ui.value["text"]
if ui.value["print_mode"] == "Dialog":
formify.tools.ok_dialog("Text:", text)
else:
print(text)
def set_value():
ui.value = {'text': 'Moin GUI Runde ', 'print_mode': 'Dialog'}
ui = Form(Co... | true |
85f70c757d0bedbc594bf888558f174b9fed2dcf | Python | cesarschool/cesar-school-fp-2018-2-lista2-JonathasBarreto | /questoes/questao_2.py | UTF-8 | 1,998 | 3.9375 | 4 | [] | no_license | ## QUESTÃO 2 ##
#
# Um robô se move em um plano a partir do ponto original (0,0). O robô pode se
# mover nas direções CIMA, BAIXO, ESQUERDA e DIREITA de acordo com um
# passo fornecido. O traço do movimento do robô é mostrado da seguinte forma:
#
# CIMA 5
# BAIXO 3
# ESQUERDA 3
# DIREITA 2
#
# Os números após a direç... | true |
db6917f1d8d2dea5f7d2c4b6a74c24c69308b444 | Python | sanlingdd/NN | /MXNETDeepLearning/RNNTimeMachine.py | UTF-8 | 4,288 | 2.703125 | 3 | [] | no_license | # coding=utf-8
import sys
sys.path.append('..')
from mxnet import ndarray as nd
import re
with open("data/timemachine.txt") as f:
time_machine = f.read()
def getWords(string):
eraseString = string.lower().replace('\n', '').replace('\r', '').replace('\s','')
return re.split('(\W)', eraseString)
#time_mac... | true |
d43e78e72c091203d55dc52342fb89d40ea6ee5d | Python | gracechang1002/Leetcode_python | /001~200/0067. Add Binary.py | UTF-8 | 182 | 3.125 | 3 | [] | no_license | class Solution:
def addBinary(self, a: str, b: str) -> str:
a_int = int(a,2)
b_int = int(b,2)
output = bin(a_int+b_int)[2:]
return output | true |
e34ce072bf28aec3f48d312c161a76d96f23a740 | Python | wemstar/EksploracjaDanych | /Lab1/Zadanie1.py | UTF-8 | 971 | 2.953125 | 3 | [] | no_license | __author__ = 'wemstar'
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def filterMethodOne(list,axis):
srednia=np.mean(list[:,axis])
sigma=np.std(list[:,axis])
print("{0} {1}".format(srednia,sigma))
return list[abs(list[:,axis]-srednia)> 3.0*sigma]
file =ope... | true |
1e5c91f64f39b71293e1d095ccd25db0b3e3566f | Python | allamberto/CSE20289-Assignments | /reading04/head2.py | UTF-8 | 894 | 3.03125 | 3 | [] | no_license | #!/usr/bin/env python3
import os
import sys
# Global Variables
ENDING = ''
# Usage function
def usage(status=0):
print('''Usage: head.py files...
-n NUM print the first NUM lines instead of the first 10'''.format(os.path.basename(sys.argv[0])))
sys.exit(status)
# Parse command line options
NUM... | true |
bd98f1c22c08ea693d6eed20fdd85b161cda81b0 | Python | lychengrex/Bird-Species-Classification-Using-Transfer-Learning | /src/utils.py | UTF-8 | 2,431 | 2.984375 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
import nntools as nt
import torch
from torch import nn
class NNClassifier(nt.NeuralNetwork):
'''
(Inherit from nt.NeuralNetwork)
Consider only neural networks that will
produce one-hot codes and that are then classifiers.
'''
def __init__(se... | true |
1eee840ebe063ce8dfdbe1f9712c2ce8f2969c7a | Python | jer321/DK-Project | /DATA/Princess.py | UTF-8 | 490 | 2.953125 | 3 | [] | no_license | #Princesa
__Author__='Juan Fernando Otoya'
import pygame as pig
import os
class princesa():
def __init__(self,pos=(0,0),size=(45,62)):
self.rect=pig.Rect(pos,size)
self.img=pig.image.load(os.path.join('IMG','princess.png'))
self.img=pig.transform.scale(self.img,size)
def update(self,player):
if ((player.re... | true |
c508eb9f0ff218b778cd89bf6436108ef4732be6 | Python | mateusgruener/cursopython | /Capítulos/6/exercício 6.1.py | UTF-8 | 242 | 3.46875 | 3 | [] | no_license | #exercício 6.1
from matplotlib.pyplot import *
import numpy as np
a=3
b=4
theta = np.linspace( -1 * np.pi, np.pi, 200)
x= a*np.cos(theta) + b*np.sin(theta)
y= -1 * a* np.sin(theta) + b*np.cos(theta)
plot(x,y, "r*")
show()
| true |
dd79a537ea52a775adf2cdd78e52536937c8948a | Python | sarah-young/Trail-Quest-1.0 | /functions.py | UTF-8 | 18,812 | 2.53125 | 3 | [] | no_license | """Functions for Trail Quest"""
import secrets
import requests
import random
import model
import password_hashing
from flask import Flask, session, jsonify
hp_api_key = secrets.HIKING_PROJECT_API_KEY
#db = SQLAlchemy()
def find_badges():
"""Find badges assigned to user"""
all_user_badges = model.db.session.quer... | true |
32c2de1bcb6a8fb264a0db9745a8e1c2c4f50a88 | Python | kkiyama117/enterlist | /enterlist/models.py | UTF-8 | 1,165 | 2.796875 | 3 | [
"MIT"
] | permissive | class Enter:
def __init__(self, enter_id: str, name: str, univ: str, department: str,
gender: str, interview: str, industry: str, demand: str, line: str, checked: bool = False):
self.enter_id = enter_id
self.name = name
self.univ = univ
self.department = department
... | true |
897c9444b0037f957262a72cd270775ccf77bf25 | Python | amg369/Web-Development-Project | /Models/RegisterModel.py | UTF-8 | 648 | 2.921875 | 3 | [] | no_license | import pymongo
from pymongo import MongoClient
import bcrypt
class RegisterModel:
def __init__(self):
self.client = MongoClient()
self.db = self.client.bonesfan
self.Users = self.db.users
def add_user(self, data):
hashed = bcrypt.hashpw(data.password.encode(), bc... | true |
ca0d30edd5b010308b5bde61b421b8a242d7de63 | Python | Paul9inee/Elementary_Algorithm | /sajun_Test/03_review.py | UTF-8 | 384 | 3.0625 | 3 | [] | no_license | import heapq
def solution(no, works): # max heap 만들기
works = [-1 * x for x in works] # min heap으로만 되어있기 떄문에 음수로 변환
heapq.heapify(works)
while no != 0:
max_val = heapq.heappop(works)
if max_val == 0:
break
heapq.heappush(works, max_val + 1)
no -= 1
return su... | true |
890e01578d4f18a4172799f76700ded5d2b250fb | Python | shreyansh-sawarn/Hacktoberfest | /Python/ScrapBBCnews.py | UTF-8 | 1,189 | 3.90625 | 4 | [] | no_license | '''
Script to scrap the headlines of BBC News website
and gives the headlines with Links
'''
'''
Program uses requests module to get web data from URL and BeautifulSoup module to parse the web data
as HTML using html parser.
Install requests and BeautifulSoup module before executing!
'''
import requests
from bs4 impor... | true |
c0c88a2188801a4035728bf96f6463f6343d0838 | Python | ohassa/code-eval | /p011.py | UTF-8 | 1,192 | 3.21875 | 3 | [] | no_license | import sys
TOP_NODE_VALUE = '30'
node30 = {'value': TOP_NODE_VALUE, 'parent': None}
node8 = {'value': '8', 'parent': node30}
node52 = {'value': '52', 'parent': node30}
node3 = {'value': '3', 'parent': node8}
node20 = {'value': '20', 'parent': node8}
node10 = {'value': '10', 'parent': node20}
node29 = {'value': '29', ... | true |
09cfc2278b44262a0f1e46215a5fb9a0657136d0 | Python | dawgster/NikoHack | /bulb.py | UTF-8 | 1,771 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
import requests
from dotenv import load_dotenv
import os
load_dotenv()
def set_bulb_color(h, s, v):
ip = os.getenv("raspi_ip")
object_id_bulb = os.getenv("object_id_bulb")
if ip is None:
raise RuntimeError("Undefined environment variable `raspi_ip`")
if object_id_bul... | true |
d991eb857e5c5fbe977540b6f9b9e2821d4b0c46 | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_4/lphrof001/ndom.py | UTF-8 | 1,204 | 2.9375 | 3 | [] | no_license | def ndom_to_decimal(a):
a=str(a)
if len(a)==3:
t=a[0]
u=a[1]
v=a[2]
w=int(t)
x=int(u)
y=int(v)
return(w*36+x*6+y*1)
elif len(a)==2:
p=a[0]
q=a[1]
r=int(p)
s=int(q)
return(r*6+s*1)
if l... | true |
028272657a28a56865be5a41ff85042bf50fd928 | Python | pikamar/container-form | /app/test/api.py | UTF-8 | 1,185 | 3.015625 | 3 | [] | no_license | import json
import requests
url = 'http://0.0.0.0:5000/api/data'
headers = {'Accept': 'application/json'}
post_headers = {'Accept': 'application/json',
'Content-Type': 'application/json'}
# Make a POST request to create an object in the database.
data = {
'status': 'active'
}
print(json.dumps(dat... | true |
288cc0936a05a60382c25476ce7ad4669fbf5db8 | Python | yakhira/conversation-bot | /Allison/conversation_bot/watson_tone_analizer.py | UTF-8 | 792 | 2.53125 | 3 | [] | no_license | from watson_developer_cloud import ToneAnalyzerV3
class watson_tone_analizer(object):
"""Tone analizer by IBM Watson"""
def __init__(self, username, password, version="2016-05-19"):
self.username = username
self.password = password
self.version = version
def tone_analizer(self, text... | true |
ee70a30c09ccc35bbfd756468550a031f9acc506 | Python | rushiagr/myutils | /archive/openstack_api.py | UTF-8 | 15,351 | 2.6875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import httplib
import json
class API(object):
"""API object to connect to an OpenStack environment."""
def __init__(self, osurl=None, osuser=None, ospassword=None):
self.url = osurl or "10.63.165.20"
self.osuser = osuser or "demo"
self.ospassword = ospassword or ... | true |
1fca490f63d02dc921728dd22f0a01eeb2927ae8 | Python | mpostaire/deathstick | /turret.py | UTF-8 | 3,276 | 2.875 | 3 | [] | no_license | import string
import random
import time
import cocos
from cocos.text import Label
import cocos.euclid as eu
import cocos.collision_model
from projectile import Projectile
import cocos.euclid as eu
def predict_pos(vec_orig, speed_mag, vec_pos, vec_dir, delta, epsilon):
diff_old, diff = None, None
delta = delta... | true |
7d6d185d3623e95768681df4926fc1ecc76476a2 | Python | kiram15/cs320 | /Prims/kruskal_mst_reference_implementation.py | UTF-8 | 1,707 | 3.328125 | 3 | [] | no_license | from undirected_graph import Graph
def initialize_disjoint_set(items):
return {item: None for item in items}
def canonical_item(ds, item):
path = [item]
parent = ds[path[-1]]
while parent:
path.append(parent)
parent = ds[path[-1]]
for i in path[:-1]:
ds[i] = path[-1]
... | true |
93f6626e6e72b43a195b2373546221693490aeef | Python | me13tz/Linux_folder | /yahooWeather.py | UTF-8 | 731 | 3.609375 | 4 | [] | no_license | #!/home/USERNAME/anaconda3/bin/python3.4
import requests, bs4
###download the weather report from Yahoo
res = requests.get('https://weather.yahoo.com/united-states/washington/seattle-12798961/')
if res.status_code != requests.codes.ok:
print("May want to try downloading again - there was a problem.")
exit()
#... | true |
1eb7373553834aebbb3d8e7326f55c09f4da2791 | Python | jlh040/SQLAlchemy-Blogly-app | /tests.py | UTF-8 | 4,048 | 2.75 | 3 | [] | no_license | from unittest import TestCase
from app import app
from models import db, User, Post
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql:///blogly_test_db'
app.config['SQLALCHEMY_ECHO'] = False
app.config['TESTING'] = True
app.config['DEBUG_TB_HOSTS'] = ['dont-show-debugging-toolbar']
db.drop_all()
db.create_all()
cl... | true |
bde78a4c974e13d854f32ef45423cc476e96523a | Python | sswietlik/helloPython | /nr07_Petle/nr07_DebuggowanieSkryptu_LAB.py | UTF-8 | 327 | 3.921875 | 4 | [] | no_license | print('Zad 1')
number = 1
previus_number = 0
while number < 50:
print(number + previus_number)
previus_number = number
number = number + 1
print()
print('Zad 2')
print()
text = ''
number = 10
condition = True
while condition:
text += 'x'
print(text)
if len(text) > number:
condition ... | true |
84eb88b3ad655a6d227b629f6226850ff335721d | Python | sciftcigit/DERS-ORNEKLER-PYTHON-I-2020 | /scope-global.py | UTF-8 | 507 | 3.796875 | 4 | [] | no_license | # en üste tanımladığım değişken global scope alanında
# böyle olduğu için hem def hemde ana kod bloğu kısmından erişebildik.
surum = "Surum 3.5"
def selamla(isim) :
ad = isim
global x # global kelimesi ile de global bir değişken oluşturabilirsiniz.
x = 5555
print(ad + " hoşgeldiniz.")
prin... | true |
f1380e308bf8026151814ed933cd553a168c37f3 | Python | Bannonsmith/Assignment-1 | /grocery_app.py | UTF-8 | 2,761 | 4.3125 | 4 | [] | no_license | user_input = ""
print("Grocery App")
# Ask user for the input
#input_1 = input("Which store would you like to go to?")
#input_2 = input("brief description")
#Create shopping list- with title and description
user_input = ""
store_list = []
total = 0
class Grocery:
def __init__(self, name, quantity, price, total):
... | true |
006db5553b86bd5eb5d41dadd9cedad3f36f4722 | Python | chengrenjiecrj/PythonLianxi | /copyPro/FreeMemory.py | UTF-8 | 783 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf8 -*-
# @Time : 2017/11/30 14:25
# @Author : hantong
# @File : count_free_memory.py
#统计linux系统空闲内存和所有内存
with open('/proc/meminfo') as fd:
for line in fd:
if line.startswith('MemTotal'):
#startswith是以。。。开头的字符串,上面表示以MemTotal开头的字符串
total = line.split(... | true |
cb6eca75ad2524685edcf359898cfb7401a26c45 | Python | Mabynar/DandyBot | /game/Players/Player.py | UTF-8 | 1,700 | 3.171875 | 3 | [
"MIT"
] | permissive | from Constants import *
class Player:
def __init__(self, game, name, tile):
self.game = game
self.name = name
self.tile = tile
self.x, self.y = 0, 0
self.gold = 0
self.keys = 0
def act(self, cmd):
if cmd == PASS: return
dx, dy = 0, 0
if c... | true |
95354f8c9583d4a4e6ad93cf80ccea3ab00f15f1 | Python | RajjatKumare1606/Angle-detect | /AngleFinder.py | UTF-8 | 1,036 | 2.8125 | 3 | [
"Unlicense"
] | permissive | import cv2
import math
path = 'text1.jpg'
img = cv2.imread(path)
pointsList = []
def mousePoint(event,x,y,flags,params):
if event == cv2.EVENT_LBUTTONDOWN:
size = len(pointsList)
if size != 0 and size % 3 != 0:
cv2.line(img,tuple(pointsList[round((size-1)/3)*3]),(x,y),(0,0,255),2)
... | true |
dcbecc74e41811a8e3bee3bf9afeb3e90b25ae6c | Python | Zen-Master-SoSo/legame | /callout.py | UTF-8 | 1,120 | 3.3125 | 3 | [] | no_license | """ Provides the Callout class, a Sprite used during development to provide debug
information positioned near another animated sprite. """
from pygame import Rect, Surface
from pygame.sprite import Sprite
class Callout(Sprite):
def __init__(self, sprite, group, font):
Sprite.__init__(self, group)
self.sprite =... | true |
dff89387cc8dd54a3cfc547c8e4bd4f7eab3841c | Python | Kooki-eByte/Teaching-Python | /09_Walrus_Expression/example.py | UTF-8 | 411 | 3.21875 | 3 | [
"MIT"
] | permissive | # The Walrus operator :=
request = {
"form": {
"username": "Cristian",
"password": "iLovePython"
}
}
db = []
def process_form(req):
# password = req["form"].get("password")
if len(password := req["form"].get("password")) > 5:
db.append(password)
return "User Added!"... | true |
c28e767b778e0d3822c0cf48a15c3a69ab88a418 | Python | WeiFeiLong/exam | /58_1.py | UTF-8 | 385 | 3.015625 | 3 | [] | no_license | def gettwo(s):
a = {}
b = []
for x in range(len(s)):
if a.__contains__(s[x:x + 2]):
a[s[x:x + 2]] += 1
else:
a[s[x:x + 2]] = 1
a = sorted(a.items(), key=lambda x: x[1])[::-1]
for x in range(len(a)):
if a[x][1] == a[0][1]:
b.append(a[x][0])... | true |
118856e83db829a6b05620cd23e13b85b24e7b8f | Python | u1273400/iscjava | /xpy/trihp.py | UTF-8 | 194 | 3.265625 | 3 | [] | no_license | from math import sqrt
def trihp (a,b, c, f, g):
return 0.5*c*(sqrt(a**2-((c**2+a**2-b**2)/(2*c))**2)+sqrt(f**2-((c**2+f**2-g**2)/(2*c))**2))
area=trihp(3.2, 2.6, 5.15,4.0, 5.5)
print(area) | true |
4112e3a80e7f2e71cdeaab7f658d8a37fe807c7d | Python | xssfox/kiss-fix | /kiss/util.py | UTF-8 | 2,731 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python KISS Module Utility Functions Definitions."""
from . import constants
__author__ = 'Greg Albrecht W2GMD <oss@undef.net>' # NOQA pylint: disable=R0801
__copyright__ = 'Copyright 2017 Greg Albrecht and Contributors' # NOQA pylint: disable=R0801
__license__ = 'A... | true |
19eb5eb412afbf3d5ade665fb570cdde7f49e089 | Python | hiSh1n/learning_Python3 | /py_project02.py | UTF-8 | 172 | 4.28125 | 4 | [] | no_license | #To convert temperature Celsius to Fahrenheit using formula.
tempc = int(input("enter temperature in celsius: "))
tempf = float(tempc * 1.8 + 32)
print(tempf, "farenheit")
| true |
8c8cd7cdbf451df6531e6cf7d5c575d5fb019d56 | Python | mcewenar/PYTHON_INFO_I_BASIC | /lectura_archivos/read.py | UTF-8 | 575 | 3.25 | 3 | [] | no_license | archivo = open('C:\\Users\\dmcew\\proy_programacion\\Info_I\\lectura_archivos\\prueba.txt','r')
contenido1= archivo.readlines() #Lee todas las líneas y las pasa alista
#contenido1=archivo.read()
contenido2=archivo.read()
for linea in archivo:
print (linea)
print (contenido1)
print ('Re-leyendo')
print (contenido2)... | true |
e5a15b2a961f884c31af9ac9ad0fa96ac7cc36aa | Python | NHERI-SimCenter/SimCenterBootcamp2019 | /Code/Python/SimpleCode/countdown.py | UTF-8 | 120 | 3.34375 | 3 | [] | no_license | def countdown(n):
if n<1:
return
while n>0:
print(n)
n -= 1
# execution
countdown(10)
| true |
cdba4884b45b44f6873f3c2c49f6291ba41dc35d | Python | wduan2/learning | /python/basic/bst.py | UTF-8 | 3,490 | 3.390625 | 3 | [] | no_license | class Bst:
class Node:
def __init__(self, value=None, left=None, right=None):
self.value = value
self.left = left
self.right = right
def __init__(self):
self.root = Bst.Node()
def add(self, value):
self.__add(self.root, value)
def add_all(se... | true |
72647acea29fb767c94553ca566d13b3962365d7 | Python | kagxin/recipe | /concurrent_futures/threading_counter.py | GB18030 | 2,946 | 3.28125 | 3 | [] | no_license | # coding=gbk
import threading, time
from threading import RLock, Lock, Condition, Event
count = 0
def print_hello(*args, **kwargs):
print(args, kwargs)
class TimerCircle(threading.Timer):
def run(self):
while True:
self.finished.wait(self.interval)
# if not self.finished.is_s... | true |
87090156619b2dc102bc6ae7a7da225d3b4d87fc | Python | Edo-Hachi/PyxelTinyMevious | /ProjectFile/mevious.py | UTF-8 | 9,504 | 3 | 3 | [
"MIT"
] | permissive | import pyxel
import define
import enemy
#------------------------------------------------------------------------------
# グローバル変数
bullet_list = [] #ザッパー管理リスト
enemy_list = [] #敵管理リスト
_VSYNC = 0
#------------------------------------------------------------------------------
# #線形リストオブジェクトへのupdate一括処理
def update_... | true |
c052d1bdbab67f90d16cada85d8e90cfd74b84b9 | Python | Neminem1203/Puzzles | /DailyCodingProblem/47-hindsightStockTrade.py | UTF-8 | 723 | 4.5 | 4 | [] | no_license | '''
Given a array of numbers representing the stock prices of a company in chronological order, write a function that calculates the maximum profit you could have made from buying and selling that stock once. You must buy before you can sell it.
For example, given [9, 11, 8, 5, 7, 10], you should return 5, since you c... | true |
4cdba18dc592e82cd400e9ef1b5ed8b5324babad | Python | jeremymturner/pytle | /pytle/__init__.py | UTF-8 | 4,530 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import ephem
import os
from os.path import join, dirname, abspath, isfile
from datetime import datetime, timedelta
import logging
import json
from jinja2 import Template
try:
from urllib.request import urlopen, Request
except ImportError:
from urllib import urlencode
from urllib2 import urlopen, Request, H... | true |
8e23e2a4ccef6e6d1a41632fdd5161481fa7bcc9 | Python | zhangchen6523/test | /videoCapture/test.py | UTF-8 | 371 | 2.734375 | 3 | [] | no_license | from tkinter import *
fontSize = 12
root = Tk()
root.title("测试程序")
root.geometry("1200x500")
root.resizable(width=False, height=False)
l = Label(root, text="测试开始", bg="black", font=("Arial", fontSize), width=8, height=3)
l.pack(side=TOP)
b = Button(root, text="点击处理", font=("Arial", fontSize), width=8, height=3)
b.pack... | true |
8b1473ab767238588611ba69101255152db1aa76 | Python | Nano-UT/appli_stat_report | /1st_report/card_stat.py | UTF-8 | 610 | 3.375 | 3 | [] | no_license | from random import shuffle
def trial():
lis = [i//4 for i in range(52)]
shuffle(lis)
tmp = 1
while(True):
if len(lis) < 5:
return(20)
if len(lis[:5]) == len(set(lis[:5])):
tmp += 1
lis = lis[5:]
else:
return(tmp)
data = [trial() f... | true |