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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
78f87abe8dbfb1e6419d09859f01e53b757a3276 | Python | TuGiu/DATA_Analysis | /surface_wave_rate.py | UTF-8 | 3,478 | 3.171875 | 3 | [] | no_license | # 函数插值--波动率曲面构造
from scipy import interpolate
#dir(interpolate)[:5]
# print interpolate.spline.__doc__
import numpy as np
from matplotlib import pylab
import seaborn as sns
from CAL.PyCAL import *
font.set_size(20)
x = np.linspace(1.0, 13.0, 7)
y = np.sin(x)
#pylab.figure(figsize = (12,6))
# pylab.scatter(x,y, s = 85... | true |
44bb6e35c4adcee71e46a08133e671cf0a9cfba9 | Python | rwillingeprins/advent_of_code | /2020/day16.py | UTF-8 | 3,011 | 3.078125 | 3 | [] | no_license | def parse_train_ticket_notes(file_path):
with open(file_path) as file:
rules_string, my_ticket_string, other_tickets_string = file.read().split('\n\n', 3)
ranges_per_field = {}
for rule_line in rules_string.splitlines():
field, ranges_string = rule_line.split(': ', 2)
ranges = []
... | true |
5d90764d8aa8088db5c62c4b14d40ed92516061d | Python | jilingyu/homework4 | /script3.py | UTF-8 | 168 | 3.390625 | 3 | [] | no_license | my_list = [1,2,3,4,5,6,7,8,9]
even_list = []
odd_list = []
for i in my_list:
if i%2 == 0:
even_list.append([{i}])
else:
odd_list.append([{i}])
| true |
4f35959a404dc31d4311b67a9f815fd93c083ac7 | Python | mzvk/590ideas | /python/simple/snow.py | UTF-8 | 1,113 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# Snow in the CLI!
# Issues: if screen has big height, when flakes are colored
# screen starts to jitter.
# intro weight to slow-start
# shading for slow-start?
# MZvk 2019
import sys, time, os, random
flaketype = '*#.,` -~oO0'
flakeclr = ['97', '37', '90', '30', '96', '94']
def getflake():... | true |
b4312e5e4de1590eea1afa5bd1759f96daa24ea5 | Python | Enselic/git-repo-language-trends | /src/git_repo_language_trends/_internal/progress.py | UTF-8 | 1,712 | 2.921875 | 3 | [
"MIT"
] | permissive | import sys
import time
RATE_LIMIT_INTERVAL_SECONDS = 0.1
class Progress:
def __init__(self, args, total_commits):
self.args = args
self.current_commit = 1
self.total_commits = total_commits
self.last_print = None
def print_state(self, current_file, total_files):
if... | true |
b3c535a5cfc747a1859ecfb16c0496e3804dab80 | Python | asyaasha/strategyLearner | /experiment1.py | UTF-8 | 2,727 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Student Name: Asiya Gizatulina (replace with your name)
"""
import ManualStrategy as mst
import StrategyLearner as stg
from marketsimcode import compute_portvals
import numpy as np
impor... | true |
fbf5232c6a3ccdab138105d713f10837a2100e88 | Python | liqMix/Multilayer-MNIST-Fashion | /Dataset.py | UTF-8 | 1,235 | 2.765625 | 3 | [] | no_license | import numpy as np
import struct as st
# Copies the MNIST data into memory
class Dataset():
def __init__(self):
self.data = []
self.labels = None
with open('train-images-idx3-ubyte', mode='rb') as file:
file.seek(0)
magic = st.unpack('>4B', file.rea... | true |
ff0d318f866a16f74df514136fd68351e4be7204 | Python | Norbaeocystin/Controlberry | /Controlberry/camera.py | UTF-8 | 1,950 | 2.78125 | 3 | [
"MIT"
] | permissive | '''
short snippet
to take photos
to disable red light
add this line :
disable_camera_led=1
to this file
sudo nano /boot/config.txt
'''
import logging
from io import BytesIO
from time import sleep
from picamera import PiCamera
from picamera.exc import PiCameraMMALError, PiCameraError
logging.basicConfig(level=logg... | true |
75500975b2e537fd1aa19b72fb182be7b959e404 | Python | bajracae/CS325-GroupAssignment2 | /temp.py | UTF-8 | 747 | 3.734375 | 4 | [] | no_license | def change_greedy(coins, value):
n = len(coins)
# coin_counts is the counts of coins you are using
# coin_counts[i] = count(coin[i])
coin_counts = [0]*len(coins)
# Implement the greedy version as described in pdf
# Remember to add to coin_counts[i] for coins[i], when appropriate
... | true |
09d724054a9a32d82e8b376cc3b75a1d0a3a385a | Python | Ing-Josef-Klotzner/python | /_fast_sort.py | UTF-8 | 520 | 3.046875 | 3 | [] | no_license | #!/usr/bin/python3
from sys import stdin
def main ():
alp = "".join (chr (x) for x in range (97, 123))
read = stdin.readline
t = int (read ())
for t_ in range (t):
order = read ().rstrip ()
word = read ().rstrip ()
ao = {a : o for a, o in zip (alp, order)}
oa = {o : a fo... | true |
3d6bf78707ce6ce82bb56272c7d31d765e30fc85 | Python | shehla/house-traffic-profiler | /googlemaps/delay_controller.py | UTF-8 | 2,846 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | from termcolor import colored
import Queue
import time
import statistics
import googlemaps
import googlemaps.route_manager as route_manager
traffic_models = ['optimistic', 'pessimistic', 'best_guess']
gmaps = googlemaps.Client(key='AIzaSyDNIxQQlAu-LzbpCQhvJDMKtPgborYIO7w')
class DelayController(object):
def __i... | true |
7ebbe24844196367151c04ecf5551402219fbc76 | Python | arpitrajput/20_Days_of_Code | /Day_7_Palindromic_Substrings_Count.py | UTF-8 | 269 | 3.125 | 3 | [] | no_license | class Solution:
# @param A : string
# @return an integer
def solve(self, s):
count = 0
for i in range(len(s)):
for j in range(i,len(s)):
if s[i:j] == s[j:i:-1]:
count += 1
return count
| true |
a53a00d729ff85e32f4fd2b776acec2b2219d4a2 | Python | AlexandreInsua/ExerciciosPython | /exercicios_parte06/exercicio02.py | UTF-8 | 490 | 4.25 | 4 | [] | no_license | # 2) Realiza una función llamada area_circulo() que devuelva el área de un círculo a partir de un radio.
# Calcula el área de un círculo de 5 de radio:
# Nota: El área de un círculo se obtiene al elevar el radio a dos y
# multiplicando el resultado por el número pi. Puedes utilizar el valor 3.14159 como pi o
# impo... | true |
6f5abc22170e5e286017c201a05168ad5dc458cb | Python | skcsteven/Python-Team-Project | /Teamproject_edgeblurnoise.py | UTF-8 | 1,718 | 3.203125 | 3 | [] | no_license |
'''
===============================================================================
ENGR 133 Fa 2020
Assignment Information
Assignment: Python Team Project (edge blur/smoothing)
Author(s): Steve Chen, chen3626@purdue.edu
Eric Mesina, emesina@purdue.edu
Danny Mcnulty,... | true |
4f21855c9233d6edf07933e434c5fe089d5023ec | Python | InFinity54/CESI_Python_LoLDDragon | /riotapi/config/apikey.py | UTF-8 | 968 | 3.03125 | 3 | [] | no_license | import os
from assets.colors.fore import ForeColor
from assets.font import FontStyle
# Retourne la clé à utiliser pour utiliser les API de Riot Games, depuis le fichier de configuration dédié
def get_riot_api_key():
file_path = os.path.join(os.path.abspath(os.getcwd()), "config/apikey.txt")
if os.path.ex... | true |
953140f24bd48ed948bff4fdbb4dccaeec8f5976 | Python | VijiKrishna3/100_Days_of_Coding_Other | /Day 002 - Medium/py_solution.py | UTF-8 | 1,127 | 3.96875 | 4 | [
"MIT"
] | permissive | # Node class
class Node:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def countSingleRec(root, c):
if root is None:
return True
left = countSingleRec(root.left, c)
right = countSingleRec(root.right, c)
if left == False or right == F... | true |
3546522dbaef527dcd72c9fa62f90275271838c1 | Python | ta09472/algo | /binary_search_01.py | UTF-8 | 827 | 3.03125 | 3 | [] | no_license | # import sys
# n = int(input())
# lst = set(list(map(int, input().split())))
# m = int(input())
# request = sorted(list(map(int, input().split())))
#
# for i in request:
# if i in lst:
# print("yes", end = " ")
# else:
# print("no", end = " ")
n = int(input())
w_item = sorted(list(map(int, inpu... | true |
77849a31c3c77d270334f31cf1b4891d3e930706 | Python | jinurajan/Datastructures | /LeetCode/top_interview_qns/trees/symmetric_tree.py | UTF-8 | 1,939 | 4.59375 | 5 | [] | no_license | """
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree [1,2,2,3,4,4,3] is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following [1,2,2,null,3,null,3] is not:
1
/ \
2 2
\ \
3 3
Follow up... | true |
87f42f803e3d399ab8b6adca0edcf952337cbe99 | Python | testerkurio/python_learning | /Automate_the_boring_stuff_with_Python/3.11.2_collatzTry.py | UTF-8 | 396 | 4 | 4 | [] | no_license | def collatz(number):
if (number%2) == 0:
print(number//2)
return(number//2)
else:
print(3*number+1)
return(3*number+1)
#将while循环也包含在try里面,这样有错误就不运行while循环了,直接跳出
try:
number = int(input('Enter number: \n'))
while True:
number = collatz(number)
if number == 1:
break
except ValueError:
print('You must... | true |
b09c13488d8b379e6508fc7123236cc86f4b9a54 | Python | quangbk2010/SelfTraining | /MachineLearning/MLCoban/GradientDescent/GradientDescent.py | UTF-8 | 1,197 | 4 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jul 25 10:57:35 2017
@author: quang
Input: f(x) = x**2 + 5*sin (x)
Ouput: find the global minimum by using Gradient descent (based on local minimum)
- More reference:
+ https://phvu.net/2012/07/08/gradient-based-learning/
"""
# To support both python 2 and python 3
fro... | true |
702c4cdc113956d21ad45c488123290469da7610 | Python | xingdashuai/fdg | /lianxi02_fixture_method.py | UTF-8 | 714 | 2.9375 | 3 | [] | no_license | import unittest
import time
# 定义测试类 --- 必须继承unittest.TestCase
class TestFixture(unittest.TestCase):
# 重写父类的setUp方法--方法级别Fixture -- 测试方法-执行前自动执行
def setUp(self):
# 重写父类的tearDown方法--方法级别Fixture -- 测试方法-执行后自动执行
# 定义测试方法 --- 方法名必须是test开头
print("打开浏览器...")
def tearDown(self):
# print... | true |
1d8deb40a861a0ac5eb67a25b3a62c23399a4ebc | Python | ssshhhrrr/Network_Formation_Game | /games/products/score_system/AbstractScoreComputationSystem.py | UTF-8 | 738 | 3 | 3 | [] | no_license | from abc import ABC, abstractmethod
from ..evaluation_system import AbstractNodeEvaluationSystem
class AbstractScoreComputationSystem(ABC):
"""
"""
@abstractmethod
def computeNodeScore(self, graph, node, evalSytem : AbstractNodeEvaluationSystem):
raise NotImplementedError
def compu... | true |
8ca5e72f92c7a4bc0ecb95088ccd0cb34a492b13 | Python | ulyssesz/Old-Website | /handle_incoming_email.py | UTF-8 | 2,418 | 2.515625 | 3 | [] | no_license | import logging, email
import wsgiref.handlers
import exceptions
from google.appengine.api import mail
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp.mail_handlers import InboundMailHandler
class LogSenderHandler(InboundMailHandler):
... | true |
2b5bcd4492f473f823a6eb04792c13d2765aacf8 | Python | KhanZaeem/Random-Forest | /RandomForest3.py | UTF-8 | 1,011 | 3.125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
from pandas import read_csv
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import confusion_matrix
import seaborn as sn
data = read_csv('train.csv')
#Extract attribute names fro... | true |
45d330cf99464cda94b073db8c251271c79b5a5d | Python | oscar60310/GoofyBot | /irc/room.py | UTF-8 | 1,701 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
class room:
def __init__(self,twitch):
self.twitch = twitch
def handle_msg(self,room,confrom,msgs):
if msgs[0] == '!':
args = msgs.split(' ')
if args[0] == '!暱稱':
if len(args) != 2:
self.twitch.send_to_room(room,"!暱稱 [你想要的名子]")
re... | true |
9b830da82718ff7a4d13f5d6a605adce2d8fa304 | Python | mcurry51/EBEC | /sum_average.py | UTF-8 | 1,039 | 4.34375 | 4 | [] | no_license | ################################################################################
# Author: Michael Curry
# Date: 02/28/2021
# This program sums up the value given by the individual,
# then sums and takes the average of all the inputted values.
############################################################################... | true |
2c72dc037b62b5cfbe7e26f9a4421151d24f6ad3 | Python | bendmorris/rosalind | /stronghold/fib.py | UTF-8 | 121 | 2.875 | 3 | [] | no_license | data = raw_input()
n, k = [int(x) for x in data.split()]
a, b, = 1, 1
for _ in range(n-2):
a, b = b, (a*k)+b
print b
| true |
9c2ff3459f71a2cb1a4e50e2f65b5e55f1dfd4e6 | Python | rheehot/ProblemSolving_Python | /baekjoon_1072.py | UTF-8 | 595 | 3.390625 | 3 | [] | no_license | '''
Problem Solving Baekjoon 1072
Author: Injun Son
Date: October 18, 2020
'''
from collections import deque
import sys
import math
X, Y = map(int, input().split())
Z = math.floor(100 * Y / X)
low, high = 0, 1000000000
result = 0
#만약 현재 승률이 99라면 절대 100은 될수 없다. 이미 패한 기록이 있기 때문
if Z >= 99:
print(-1)
else:
while... | true |
b95ffd970b175ec220f668bf23ae55fe6ad14fcf | Python | kujaw/Rosalind | /RNA.py | UTF-8 | 290 | 2.609375 | 3 | [] | no_license | __author__ = 'kujaw'
import time
start = time.perf_counter()
start2 = time.process_time()
with open('rosalind_rna.txt', 'r') as f:
rna = str(f.read())
print(str.replace(rna, 'T', 'U'))
print("Timer: ", time.perf_counter() - start)
print("Timer2: ", time.process_time() - start2) | true |
ca5d029cce4524f81e72dbd200984df900e5cf05 | Python | bradyz/sandbox | /algorithms/number-theory/factor.py | UTF-8 | 463 | 3.640625 | 4 | [] | no_license | def prime_factors(n):
p = []
i = 2
while n > 1:
if n % i == 0:
p.append(i)
n //= i
else:
i += 1
return sorted(p)
def factors(n):
f = set()
i = 1
while i * i <= n:
if n % i == 0:
f.add(n // i)
f.add(i)
... | true |
5491368ebe165a4f551f69bacd3bc61ce79238ec | Python | edithabofra/Python-HyperionDev | /Loop1.py | UTF-8 | 239 | 4.3125 | 4 | [] | no_license | # Prompt user to enter a number
num = int(input("Enter a number: "))
# Set initial value to zero
i = 0
# Using while look print out all even numbers from 1 to the number entered by user
while i <= num:
print(str(i))
i += 2 | true |
c931017280525856f6a718bda55b319624848a15 | Python | yiqin/HH-Coding-Interview-Prep | /Use Python/ContainsDuplicateII.py | UTF-8 | 542 | 3.1875 | 3 | [] | no_license | class Solution(object):
"""docstring for Solution"""
def containsNearbyDuplicate(self, nums, k):
numsDict = dict()
for i in range(len(nums)):
if nums[i] in numsDict:
indexes = numsDict[nums[i]]
# print(indexes, i)
for j in range(len(indexes)):
diff = i - indexes[j]
# print(diff)
if ... | true |
b8759acc17e78f432b329a57e50aca893ab2aca0 | Python | jrsaavedra1022/jrsaavedra-python | /clase5-tipo-datos.py | UTF-8 | 234 | 4.09375 | 4 | [] | no_license | #con la opcio type pueda base el tipo d dato
print(f"Tipo entero: {type(2)}")
print(f"Tipo string: {type('hola')}")
print(f"Tipo float: {type(2.5)}")
print(f"Tipo boolean: {type(True)}")
# print(f"Tipo object: {type(["hola", 12])}") | true |
66346dfa62c54d4f012a38bb129e2014145279dc | Python | cosmozhang/ACE-KL | /lime_ae.py | UTF-8 | 6,578 | 2.515625 | 3 | [] | no_license | # lime_ae.py
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf
import lime
from lime import lime_tabular
from ae_tf import AutoEncoder_tf
from sklearn import preprocessing
import pandas as pd
import sys
from scipy.stats import spearmanr, describe
def pl... | true |
cbdd3493a109ec0868fc615c467a824fb6b144ef | Python | Jiwon0801/MachineLearning | /Keras/ANN.py | UTF-8 | 840 | 2.921875 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Dense, Activation
import numpy as np
import sim_data
x_data, y_data = sim_data.load_data()
#분류기
model = Sequential()
model.add(Dense(3, input_shape=(2,), activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metri... | true |
d39352375fe3acbede7298bb2d22bbad3d7aed77 | Python | Fabrolly/TrenoBot | /telegram-bot/telegram_bot/tests_integration/test_trip_search.py | UTF-8 | 9,734 | 2.890625 | 3 | [] | no_license | import re
import datetime
import unittest
from telegram_bot.tests_integration.test_utility_methods import *
from telegram_bot.bot import create_db
def extract_assert_hour(text, time):
solutions = text.split("!")
cond = len(solutions) == 2
dt = datetime.datetime.today()
start_date = str(dt.day) + "-" +... | true |
bb89184da25eb94859f11f247b20e94dd93565fa | Python | ericchen15/wizard-ordering | /input_generator.py | UTF-8 | 846 | 2.90625 | 3 | [] | no_license | from string import ascii_lowercase
from random import shuffle
from numpy.random import choice
names = []
for c in ascii_lowercase:
names.append(c)
names.append(c.upper())
size = 50
num_constraints = 366
names = names[:size]
shuffle(names)
def random_constraint(names):
sample = choice(len(names), 3, replace=False... | true |
3e5965fcd7463ac64e791c6bfb435bffa657aae1 | Python | m3hm3taydin/codewars | /python/6-kyu/stop-gninnips-my-sdrow.py | UTF-8 | 283 | 3.28125 | 3 | [] | no_license | def spin_words(sentence):
sent_list = sentence.split(' ')
result = ''
for sent in sent_list:
if len(sent) < 5:
result = "{} {}".format(result, sent)
else:
result = "{} {}".format(result, sent[::-1])
return result[1:]
| true |
da2d7b030f16fd2348d9fba9572b6e516c3d69d9 | Python | meshalalsultan/Extrct_Keyword_from_text | /extract.py | UTF-8 | 429 | 3.015625 | 3 | [] | no_license | from rake_nltk import Rake
rake_nltk_var = Rake()
text = """ I am a programmer from India, and I am here to guide you
with Data Science, Machine Learning, Python, and C++ for free.
I hope you will learn a lot in your journey towards Coding,
Machine Learning and Artificial Intelligence with me."""
rake_nltk_var.ext... | true |
06b796e773eabde42d738c0c9f749afab444e882 | Python | gutentag1026/HackHighSchool | /Parseltongue_02/02_numtypes.py | UTF-8 | 650 | 3.65625 | 4 | [] | no_license | import sys
num_one = (int)(sys.argv[1])
num_two = (int)(sys.argv[2])
dividend = num_one / num_two
remainder = num_one % num_two
a = 5
b = 56.99
c = 9.322e-36j
def data_type(x):
if type(x) == int:
return "Integer"
elif type(x) == float:
return "Float"
elif type(x) == complex:
retur... | true |
ea47f10433d4acce7000e6be85337e01ceb90364 | Python | texttxet/code | /hashlib练习/md5爆破弱口令.py | UTF-8 | 1,458 | 3.296875 | 3 | [] | no_license | # conding:utf-8
#! /bin/bash/python3
import hashlib
def ruo_md5():
text = open("password.txt").read()
ruokou = text.splitlines(s)
# print (ruokou)
for s in ruokou:
# print (s)
md5 = hashlib.md5()
md5.update(bytes(s, encoding="utf-8"))
en_pd = md5.hexdigest()
prin... | true |
42d3c528da95b38499ad2688dd9cbf047feb5399 | Python | franksun319/JointPatentsSpider4CNKI | /produce_adjacent_matrix.py | GB18030 | 958 | 2.5625 | 3 | [] | no_license | # -*- coding: cp936 -*-
"""
ɸרڽӾ
"""
import os
import sys
from csv_reader import CsvReader
from graph_maker import GraphMaker
default_encoding = "utf-8"
if default_encoding != sys.getdefaultencoding():
reload(sys)
sys.setdefaultencoding(default_encoding)
YEAR = ['2007', '2008', '2009', '2010', '2011', '2012'... | true |
c84043191fe8d3e458eadc4cee5b2453b4a127a0 | Python | Suja-K/Spo2_evaluation | /spo2evaluation/modelling/healthwatcher/healthwatcher.py | UTF-8 | 2,343 | 2.78125 | 3 | [] | no_license | #method of Scully et al.: "Physiological Parameter monitoring from optical recordings with a mobile phone"
import torchvision
from matplotlib import pyplot as plt
def health_watcher(ppg_blue, ppg_blue_std, ppg_red, ppg_red_std, fps, smooth = True):
#print(meta)
#fps = meta['video_fps']
A = 100 # Fro... | true |
b0a5835621e3acf2d793f81003051e98078ebbbe | Python | fhan90521/algorithm | /leetcode/leetcode-743.py | UTF-8 | 824 | 2.75 | 3 | [] | no_license | class Solution:
def networkDelayTime(self, times: List[List[int]], n: int, k: int) -> int:
graph = collections.defaultdict(list)
for a,b,c in times:
graph[a].append((b,c))
queue=[(k,0)]
total_fee={}
total_fee[k]=0
while queue:
v = queue.... | true |
7a02507bde927a142a137d1597e1b6732ccc3d9a | Python | jia80H/python-learning-experience | /06 函数和装饰器/06 装饰器.py | UTF-8 | 1,935 | 4.1875 | 4 | [] | no_license | """ 装饰器的基本使用 """
def cal_time(fn):
print('我是外部函数,我被调用了')
print('fn={}'.format(fn))
def inner():
import time
start = time.time()
fn()
end = time.time()
print('耗时', (end - start), 's')
return inner
@cal_time
# 上行代码的第一件事是调用cal_time;
# 第二件事是把被装饰的函数传给fn
def cal(... | true |
02acdb14880402ba131d06ecd0f63e714c12b25a | Python | ezinall/StellarPy | /stellarpy/core.py | UTF-8 | 5,822 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
from datetime import datetime
class Star:
def __init__(self, object_name, m, color=(1, 1, 0, 1)):
self.name = object_name
self.m = m # масса
self.X = [0]
self.Y = [0]
self.Z = [0]
self.color = color
... | true |
e052dda6beecdb2a8047bf87eb0c343f7c5e3fab | Python | qmnguyenw/python_py4e | /geeksforgeeks/python/python_all/74_16.py | UTF-8 | 1,989 | 4.03125 | 4 | [] | no_license | Python – Key with all Characters in String
Sometimes, while working with Python Strings, we can have problem in which we
need to extract all the keys that have all the characters in the character
value list. This kind of problem has application has many domains such as day-
day programming. Let’s discuss a wa... | true |
8d968802872aed2943cf77089505141fa323f17b | Python | liqkjm/scrapyd-GUI | /ScrapydTools.py | UTF-8 | 5,418 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import json
import sqlite3
import os
import shutil
__author__ = "chenyansu"
class ScrapydTools(object):
""" 后端:Scrapyd API 的封装调用
日后修改方向:函数打散,不使用类继承。
"""
def __init__(self, baseUrl ='http://127.0.0.1:6800/'):
self.baseUrl = b... | true |
44de9fe78c21992e43834aa98460c96471589517 | Python | Krst0o/backpropagation | /main.py | UTF-8 | 2,722 | 2.71875 | 3 | [] | no_license | import matplotlib.pyplot as plt
from Examples import *
from variables import *
pygame.init()
button_text = pygame.font.SysFont('Comic Sans MS', 20)
ex = Examples()
e = ex.generate(5000)
x_min = np.min(e[0])
x_max = np.max(e[0])
x_train = (np.array(e[0]) - x_min) / (x_max - x_min) * 0.8 + 0.1
y_train = np.array(e[1])... | true |
8b4128184838d5d0e37eb9c41a97ff1bc2610426 | Python | utsavmajhi/CS384_1801ME61 | /Assignments/Assignment_5/tutorial05.py | UTF-8 | 11,818 | 2.734375 | 3 | [] | no_license | import os
import re
os.system("cls")
def rename_FIR(folder_name):
# rename Logic
if(os.path.exists('Subtitles/'+folder_name)):
print("Season Number Padding:")
seasonpad=int(input())
print("Episode Number Padding")
episodepad=int(input())
listoldname=[]
listnewnam... | true |
ed9716cd2e4b8ef963180380b4afbe85202227e0 | Python | robertdigital/sorting | /animation.py | UTF-8 | 3,455 | 3.578125 | 4 | [
"MIT"
] | permissive | import os
import shutil
import imageio as imo
import matplotlib.pyplot as plt
def arrays_2_images(arrays: list, title: str, frame_path: str='data/') -> list:
"""Converts a list of arrays to a list of images.
These are temporarily stored in the directory 'frame_path' and are created
from the matplotlib li... | true |
55f42f75f1e457a875d1862ce90ab16744d9fb40 | Python | Bhasheyam/ALgorithms-PythonSolved | /SubArrayMatcher.py | UTF-8 | 1,051 | 3.984375 | 4 | [] | no_license | # given two set of array- Array A is greater than Array B if the first non-match element of the array A is greater than the element of the Array B.
# if the length of the substring is given then we need to use a sliding window to find all the possible consecutive sub-set of the given array.
# for the given example it i... | true |
1c24b9cbb473c2df10064906ed092c44c6efdb12 | Python | yanggali/group_model | /vertex.py | UTF-8 | 387 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: UTF-8 -*-
class Vertex:
verCount = 0
def __init__(self, name, type):
self.name = name
self.type = type
Vertex.verCount += 1
def __hash__(self):
seed = 131
result = 0
key = str(self.type)+"_"+str(self.name)
for k in ke... | true |
98d36b83e5b3b675e389c80d5525ffb9e93738d8 | Python | jaredgrambihler/NumberNet | /importData.py | UTF-8 | 810 | 3.296875 | 3 | [] | no_license | """
Module to import data from MNIST dataset.
Dependencies:
python-mnist
"""
from mnist import MNIST
def importData(dir = './mnist'):
"""
Returns data of MNIST dataset.
Uses the python-mnist module to import this data.
If the directory of your data is different than /mnist,
this method call ca... | true |
6a3be82cfeb20b5cecdc6fb88a4f970291905aa6 | Python | j6mes/springer2018-hatespeech-bridging-gaps | /src/hatemtl/features/preprocessing.py | UTF-8 | 1,170 | 3.140625 | 3 | [] | no_license | import re
def pp_lowercase(text):
return text.lower()
def pp_strip_hashtags(text):
return ' '.join(re.sub("(\#[A-Za-z0-9]+)"," HASHTAG ",text).split())
def pp_strip_usernames(text):
return ' '.join(re.sub("(@[A-Za-z0-9\_]+)"," USERNAME ",text).split())
def pp_strip_url(text):
return ' '.join(re.s... | true |
52e5b29cbe0a3339b38f8bea7e8546de2c8b45d8 | Python | spacetelescope/stistools | /stistools/calstis.py | UTF-8 | 7,283 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | #! /usr/bin/env python
import os
import sys
import getopt
import glob
import subprocess
from stsci.tools import parseinput, teal
__doc__ = """
Calibrate STIS data.
The input raw files should be in the default directory. This is not
always necessary, but it will always work. For spectroscopic data, if
a path is sp... | true |
a99c5166d8cbc51448db5d0dbab2d5e168424241 | Python | jakejhansen/Advanced_Image_Analysis_02503 | /Final_Project/object_detection/images/distribute_train_test.py | UTF-8 | 326 | 2.734375 | 3 | [] | no_license | import glob
import numpy as np
from shutil import copy2
images = glob.glob('*.png')
print("Copying images")
for img in images:
if np.random.rand() < 0.85:
copy2(img, 'train/')
copy2(img[:-4] + '.xml', 'train/')
else:
copy2(img, 'test/')
copy2(img[:-4] + '.xml', 'test/')
print("... | true |
cde57f4487c710e0c3d6fd43d9b9e86bc143b7a9 | Python | thunderflash/drl | /exps/synthetic.py | UTF-8 | 2,268 | 2.65625 | 3 | [] | no_license | from sys import path
path.append('src/')
import matplotlib.pyplot as plt
from numpy import append, zeros
from trainer import ValidatingTrainer
from models import Nonlinear, Linear
from dataset import Dataset
from utils import synthetic, wealth, sharpe
import plotter
#series = synthetic(4001, seed=1)
#data = Dataset(... | true |
5feefe3b0feec7e52f2e819ddf6ec437bece5255 | Python | miararoy/ttt3d | /ttt3d/enums.py | UTF-8 | 252 | 2.8125 | 3 | [] | no_license | from enum import IntEnum
class Symbol(IntEnum):
E = 0
O = 1
X = 2
def __repr__(self):
return self.name
class GameResult(IntEnum):
NA = 0
O = 1
X = 2
TIE = 3
def __repr__(self):
return self.name
| true |
0d078bbb9bc523baa1e2916963770ea6c18dd660 | Python | mantianwuming/work_test | /work/shunfeng_test1.py | UTF-8 | 660 | 2.90625 | 3 | [] | no_license | num = int(input())
line = input()
pass_self = []
for i in range(len(line)):
pass_self.append(line[i])
line = input()
pass_peo = list(map(int, line.split()))
def get_ans(pass_self, pass_peo):
x = -1
new_pass_self = []
for i in range(len(pass_self)):
x = ord(pass_self[i]) - ord('A')
new_p... | true |
95772ad22795d87017ab6d2e626a5285a323c34a | Python | Arpit-Bajgoti/bounce_game | /main.py | UTF-8 | 5,642 | 3.109375 | 3 | [] | no_license | import pygame
from enum import Enum
from collections import namedtuple
import keyboard
import time
import random
# 1536 x 864 is the current screen resolution of my pc
pygame.init()
radius = 10
width = 836
height = 664
block_size = 20
# rgb colors
DARK_GREEN = (0, 100, 0)
RED = (200, 0, 0)
BLUE1 = (0, 0, 255)
BLUE2 =... | true |
27ef114d334ee0fdc58602b2ff52846eeecfe976 | Python | DanieleCalanna/PyTorchTrainer | /torchtrainer/utils/epochs_plotter.py | UTF-8 | 2,127 | 2.796875 | 3 | [] | no_license | import os
import glob
import pandas as pd
import matplotlib
#matplotlib.use('Agg')
from matplotlib import pyplot as plt
from matplotlib.ticker import MaxNLocator
class EpochsPlotter:
def __init__(self, folder_path, labels=None, columns=None, load=True):
self.folder_path = folder_path
self.exp_name = os.path.basen... | true |
0f7373786a9b371973b9709626dbdc903d9559b8 | Python | plast-lab/doop-mirror | /bin/log-analyzer.py | UTF-8 | 7,722 | 2.96875 | 3 | [
"UPL-1.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #! /usr/bin/env python
#
# Script used to analyze log files created with BloxBatch.
#
# Currently supports log files created with debugDetail@factbus (the default) and
# debugDetail@benchmark. Has been tested with log files generated from LB version 3.8.
#
# Use -h for details on the options.
#
# Remember to keep the v... | true |
19b8eea2edb53ed8eb8c603cc647411380219b8d | Python | iceshadows/CLASS-Assistant | /readxl.py | UTF-8 | 248 | 2.9375 | 3 | [] | no_license | import xlrd
data = xlrd.open_workbook('namelist.xlsx')
table = data.sheets()[0]
rows = table.nrows
print(rows)
for row in range(rows):
# print(row)
idnum = table.cell(row,0).value
name = table.cell(row,1).value
print(name +''+idnum) | true |
fc1d91decf9b07c2eebfdb12451d1d68f423609b | Python | hn416784/fizzbuzz | /task0.py | UTF-8 | 425 | 4.125 | 4 | [] | no_license | #printing number from 1-100
def numbers(count):
while count <= 100:
print(count)
count=count+3;
if count > 100:
count = 100
numbers(0)
#for multiples
def fizz_buzz(num):
if num % 3 == 0:
return 'Fizz'
elif num % 5==0:
return 'Buzz'
elif num%3==0 and num%5==0... | true |
5afd2ea4343983aae7a67b89df07b8ce9ee00a1a | Python | mattstoneham/PiBot | /examples/colour_sensor/rbg_values.py | UTF-8 | 1,917 | 2.84375 | 3 | [] | no_license | __author__ = 'Matt'
__author__ = 'Matt'
import RPi.GPIO as GPIO
import time
class RGBvalues(object):
s2 = 20
s3 = 16
signal = 21
NUM_CYCLES = 10
def __init__(self):
GPIO.setmode(GPIO.BCM)
GPIO.setup(self.signal,GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(self.s2,GPI... | true |
dfab9c1bce482aa88b5f1f5488c20c0f68c85a98 | Python | Riptide684/British-Informatics-Olympiads | /2016Q2b.py | UTF-8 | 3,112 | 3.53125 | 4 | [] | no_license | #Sean Morrell - Aylesbury Grammar School
def pos_to_coords(pos):
coordinates = [0, 0]
y = 5 - ((pos - 1) // 5)
x = pos % 5
if x == 0:
x = 5
coordinates[0] = x
coordinates[1] = y
return coordinates
def do_overflow(board):
add = []
for element in board... | true |
f00515feb232f956a9419b3e169abb532a8743ba | Python | Aasthaengg/IBMdataset | /Python_codes/p03078/s830133898.py | UTF-8 | 442 | 2.71875 | 3 | [] | no_license | x,y,z,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)
b=sorted(list(map(int,input().split())),reverse=True)
c=sorted(list(map(int,input().split())),reverse=True)
ab=[]
for i in range(x):
for j in range(y):
ab.append(a[i]+b[j])
ab.sort(reverse=True)
ans=[]
for i in range(min(... | true |
60d7adefffef29a6dfbb29353f8c28c5b00e82bd | Python | pointOfive/TD | /MYLECTURES/baggingANDrfs/voting.py | UTF-8 | 2,291 | 2.96875 | 3 | [] | no_license | # run this with: bokeh serve --show voting.py
from bokeh.io import curdoc
from bokeh.layouts import column, row
from bokeh.plotting import ColumnDataSource, Figure
from bokeh.models.widgets import Slider
from scipy import stats
my_plot = Figure(title="Binomial Distribution of Correct Votes", plot_height=400, plot_wid... | true |
aa5496731af22a1c42008ff45d08671da30853c4 | Python | vovuh/python-domino | /main.py | UTF-8 | 266 | 2.59375 | 3 | [] | no_license | # NOTE: you have to install keyboard module to run this project
# pip install keyboard
from Game import Game
if __name__ == '__main__':
while True:
game = Game()
need_to_continue = game.play()
if not need_to_continue:
break
| true |
aa393e385ed35517f9505915943ee662959fe61b | Python | btroisi/PythonProjects | /Project1/shapeE.py | UTF-8 | 353 | 2.875 | 3 | [] | no_license | from turtle import *
def shapeD( distance ):
forward( distance )
left( 90 )
forward( distance )
left( 90 )
forward( distance )
left( 90 )
forward( distance )
left( 30 )
forward( distance )
left( 120 )
forward( distance )
def shapeE():
shapeD( 70 )
shapeD( 80 )
shapeD( 90 )
shapeD( 100 )
shapeE()
... | true |
354c4630a28da6c5b28cc8dfdd584c55caca643e | Python | akyruu/blender-cartography-addon | /drawing/drawer/drawer.py | UTF-8 | 1,028 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | """
Module for drawing
History:
2020/08/21: v0.0.1
+ add cartography drawing
+ add cartography room drawing (point + plane)
"""
import logging
import utils
from model import CartographyRoom
from templating import CartographyTemplate
# Classes ================================================================... | true |
7a474ccc4e0a542841010485f7a38a9701794d20 | Python | TerrenceTong/kdd-hw | /sample.py | UTF-8 | 5,019 | 2.609375 | 3 | [] | no_license | import os
import gc
import sys
import pandas as pd
def typicalsamling(group,typicalNDict):
name = group.name
n=typicalNDict[name]
return group.sample(n=n)
def replaced_typicalsamling(group,typicalNDict):
name = group.name
n=typicalNDict[name]
return group.sample(n=n,replace=True)
... | true |
f31f994771afe4880bd0622288e7ed4eb71e900c | Python | freddycra/proyecto_1_paradigmas | /proyecto/Model.py | UTF-8 | 334 | 2.84375 | 3 | [] | no_license | from Grammar import Grammar
class Model(object):
def __init__(self):
super(Model, self).__init__()
self.grammar = Grammar()
def addRules(self, rules):
my_list = rules.split('\n')
for i in my_list:
self.grammar.addRule(i)
def printInfo(self):
self.gramma... | true |
1c5a0b6d7e8866df0bea1325c2d6753a90da80f1 | Python | spacewander/vim-snippets-paster | /vim_snippets_paster/converters/ultility.py | UTF-8 | 1,389 | 2.890625 | 3 | [] | no_license | import re
class NotImplementFeatureException(Exception):
"""an Exception used in parsing"""
def __init__(self, msg='', feature=None):
if feature is not None:
self.message = "%s is not implemented" % feature
else:
self.message = msg
def __str__(self):
return ... | true |
56cf00c457bfc2053e9d8be9c0f3d49ae084c9ef | Python | Purposefully/TeachMe | /lms_app/management/commands/seed.py | UTF-8 | 3,859 | 3.0625 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from ...models import Course, Question, Answer
import random
from django.utils.crypto import get_random_string
# python manage.py seed --mode=refresh
# Clears all data and creates questions and answers
MODE_REFRESH = 'refresh'
# Clears all data and does not create ... | true |
b398604ad3e1afce663de1636333f158de6285f5 | Python | bahattin-urganci/python-training | /dictionary.py | UTF-8 | 298 | 3.078125 | 3 | [
"MIT"
] | permissive | import pandas as pd
bolge='Akdeniz'
sehirler=['Burdur',
'Isparta',
'Antalya',
'Mersin',
'Adana',
'Kahramanmaraş',
'Osmaniye',
'Hatay']
#arrayden dict ne güzel oluşuyor ama :) no loop
data ={'Bölge':bolge,'Şehirler':sehirler}
#şimdi bunu dataframe yapalım
df=pd.DataFrame(data)
print(df) | true |
63d86ed66e7ee222f24434a5caca5698f82d8f23 | Python | Fedy1661/Informatics-EGE-2022 | /23/137/code.py | UTF-8 | 279 | 3.171875 | 3 | [] | no_license | import math
def f(start, x):
if start < x: return 0
if start == x: return 1
if math.log2(start) % 1 == 0: return f(start - 1, x)
zeroize = int('1' + '0' * int(math.log2(start)), 2)
return f(start-1, x) + f(zeroize, x)
print(f(int('1100', 2), int('100', 2))) | true |
6dfd38e3bb26b0320145ef55199107288664a790 | Python | sellalab/HumanLinkedSelectionMaps | /likelihood/jackknife_params.py | UTF-8 | 2,090 | 2.59375 | 3 | [] | no_license | __author__ = 'davidmurphy'
import os
import numpy as np
from sys import argv
from classes.runstruct import ChromStruct, root_dir
init_dir = root_dir + '/result/init_files'
final_dir = root_dir + '/result/final_files'
ffmt = init_dir + '/YRI.{an}.BS1.6.CS0.0.NOT_STARTED.initial.txt'
def jack_params(anno):
# se... | true |
cfac587d1557d1bd44222d5c723f1499f2637cc6 | Python | xyths/trading-robot | /eval/GateIO/HttpUtil.py | UTF-8 | 1,248 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import http.client
import urllib
import json
import hashlib
import hmac
def getSign(params, secretKey):
bSecretKey = bytes(secretKey, encoding='utf8')
sign = ''
for key in params.keys():
value = str(params[key])
sign += key + '=' + value + ... | true |
0d8bd852714cc49a97711483bb918f6e0ca03a04 | Python | MatoPlus/ProjectWitchCraft | /main.py | UTF-8 | 27,329 | 3.21875 | 3 | [
"MIT"
] | permissive | """Author: Rixin Yang
Date: May 30, 2018
Description: Summative Bullet Hell Game - A bullet hell game created in
pygame with the game_sprites class.
Known bugs: Some sound do not play when they are supossed to.
*Please note that must instructions are in full detail in the Readme text
file in the sam... | true |
99b104332576fc65ed3f36fb832034fc6eb923ab | Python | thisiszw/fyb | /submissions/tosubmit/predictor/predictor.py | UTF-8 | 645 | 3.140625 | 3 | [] | no_license | class Predictor:
def __init__(self):
"""
- `self.batch_size`: to tell the caller the batch_size
"""
self.batch_size = 128
def predict(self, content):
"""
Args:
- contents: list of facts (as in string)
Returns:
- list of dict, with each dict to be a sentence result:
{
... | true |
e6dd63bbce38aaeeb262823f5ba12959d25aa39c | Python | BlueGranite/tpc-ds-dataset-generator | /notebooks/TPC-DS-GenerateData.py | UTF-8 | 4,097 | 2.78125 | 3 | [] | no_license | # Databricks notebook source
# DBTITLE 1,Generate TPC-DS data
# MAGIC %md
# MAGIC Generating data at larger scales can take hours to run, and you may want to run the notebook as a job.
# MAGIC
# MAGIC The cell below generates the data. Read the code carefully, as it contains many parameters to control the process. See... | true |
856f183d214f4c86fc933bb1350b7c3c1d2bae96 | Python | akoshel/MADE | /Part_1/Алгоритмы и структуры данных/Homeworks/grafs_2/Task_B_new.py | UTF-8 | 946 | 2.9375 | 3 | [] | no_license | import sys
def dijkstra(n, s, graph):
d = {i: float('Inf') for i in range(n)}
used = {i: False for i in range(n)}
d[s] = 0
for _ in range(n):
next_e = -1
for v in range(n):
if next_e == -1 or (d[v] < d[next_e] and not used[v]):
next_e = v
if d[next_e... | true |
e7a72f9ea046cdb7fc9f307a2e12bd5509ac9b03 | Python | bkhorrami/Algorithms | /Graph.py | UTF-8 | 2,562 | 3.3125 | 3 | [] | no_license | __author__ = 'babak_khorrami'
from collections import defaultdict
class Node(object):
def __init__(self,id,value = 0):
self.id = id
self.value = value
def get_id(self):
return self.id
def get_value(self):
return self.value
class Edge(object):
def __init__(self,tail,... | true |
6b7e8ab82191a9f4f2c5bb25a9bf4cc3bdfdc541 | Python | LabmemNo004/AmazonMoviesDataWarehouse | /数据准备/数据处理/MovieOrganize.py | UTF-8 | 1,410 | 2.890625 | 3 | [
"MIT"
] | permissive | import pandas as pd
import numpy as np
import Levenshtein
import re
import math
import codecs
import csv
def calculate(i,j):
# 总相似度
score=1
# 各特征相似度
score_name=1
score_director=1
score_actor=1
score_release=1
score_time=1
# 各特征值
movie_l=webs[i]
name_l=movie_l[2]
directo... | true |
03d9cfcc802b224f4c8ebb62fa0a2f327327cdb3 | Python | nikhilbommu/DS-PS-Algorithms | /Leetcode/LeetCode Problems/ArrayPartitionI.py | UTF-8 | 240 | 3.25 | 3 | [] | no_license | class Solution:
def arrayPairSum(self, nums) -> int:
nums = sorted(nums)
sum1= 0
for i in range(0,len(nums),2):
sum1 += nums[i]
return sum1
s = Solution()
print(s.arrayPairSum([1,4,3,2,5,6])) | true |
e78d35db1c4c67a831b447011898c1eddb855440 | Python | vasumv/photoproj | /test.py | UTF-8 | 1,243 | 2.625 | 3 | [] | no_license | from skimage import data, io, filter
from skimage.transform import resize
from scipy.misc import imshow
from path import Path
import numpy as np
dir = Path("./great_depression/")
side = int(raw_input("Enter size: "))
values = {}
images = dir.files()
i = 0
or_pic = io.imread("MigrantMother.jpg", as_grey=True)
or_pic = n... | true |
dc4776e3af801f8a599fb7c6b7e750c4f5f246a4 | Python | liuzh139/database_render | /read_db_into_tensor.py | UTF-8 | 4,778 | 3.0625 | 3 | [] | no_license | import MySQLdb
import re
import json
import pandas as pd
import tensorflow as tf
db = MySQLdb.connect(
host = 'localhost',
user = 'root',
passwd = '19931124',
db = 'test'
)
cursor = db.cursor()
def get_column_name(connected_cursor):
column_query = 'SELECT * FROM INFORMATION_SCHEMA.COLUMNS'
... | true |
2bd23a4bcb9b59a2e91bbf8968e8446a336a587e | Python | ivoryRabbit/S3-Rec | /models.py | UTF-8 | 11,120 | 2.578125 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Input, Embedding, Dense
from layers import Encoder, PositionEncoder
class S3Rec(tf.keras.Model):
def __init__(
self,
n_user,
n_item,
max_item_len,
... | true |
f09da72e16632a94e15b69c1fb4c9ba1f194c7ba | Python | lb123456789/mygit | /connect1/TCPclient.py | UTF-8 | 485 | 2.65625 | 3 | [] | no_license | from socket import *
serverName = '127.0.0.1'
serverPort = 11000
BUFSIZ = 1024
ADDR = (serverName,serverPort)
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect(ADDR)
i=1
while True:
data = "client message"
if not data:
break
clientSocket.send(data.encode('utf-8'))
returnData = ... | true |
ff0f74f8d35fe37883665e352427cc0cb1bdace7 | Python | MakeSchool-17/sorting-algorithms-python-ignat980 | /csv_parser.py | UTF-8 | 595 | 3.84375 | 4 | [
"LicenseRef-scancode-public-domain"
] | permissive | import csv
import sys
def parse(file):
parsed = {
'headers': None,
'rows': []
}
with open(file) as data_file:
reader = csv.reader(data_file)
parsed['headers'] = next(reader) # first row of CSV is the headers
parsed['rows'] = [row for row in reader] # remaining ro... | true |
5527633378856ffd568da48d6d3be9c6e0b7593c | Python | M-Vause/SEED | /Algorithms/pySINDy/env/lib/python3.6/site-packages/pylint/test/functional/too_many_arguments.py | UTF-8 | 392 | 3.15625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | # pylint: disable=missing-docstring
def stupid_function(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9): # [too-many-arguments]
return arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9
class MyClass:
text = "MyText"
def mymethod1(self):
return self.text
def mymethod2(self):
... | true |
bb78114d2a904e5ebe6f74fd80ffbb6014b30bca | Python | liuwenye2010/prj_python | /csv2wave/csv2wave.py | UTF-8 | 6,052 | 3.0625 | 3 | [] | no_license | """Load & convert data (should be decimal) from CSV file and convert into Mono Wave file"""
import csv
import wave
import struct
import math
from collections import namedtuple
from datetime import datetime
from pprint import pprint
import os
import glob
import argparse
import os.path
import sys
default_file_to_conv... | true |
fb9dbf1635b9def0e51410fb3cac75e6e6aa7cce | Python | mtn/advent17 | /day03/part2.py | UTF-8 | 611 | 2.734375 | 3 | [] | no_license | from collections import defaultdict
inp = 312051
grid = defaultdict(lambda: defaultdict(int))
grid[0][0] = 1
N = 10
x = y = 0
dx = 0
dy = -1
for i in range(N ** 2):
if -N/2 < x <= N/2 and -N/2 < y <= N/2:
for ddy in [-1, 0, 1]:
for ddx in [-1, 0, 1]:
if ddy == ddx == 0:
... | true |
57ba022f84fbcf7b6bf17b49d0cc89d7b4b86e2f | Python | Hirochon/django-drf | /book/models.py | UTF-8 | 1,056 | 2.515625 | 3 | [] | no_license | from django.db import models
import uuid
from django.utils import timezone
class Book(models.Model):
"""本モデル"""
class Meta:
db_table = 'book'
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
title = models.CharField(verbose_name='タイトル', unique=True, max_length=2... | true |
bf85764b558d5534c458c38e513ec4e884d8e0a0 | Python | Anirud2002/flappybird | /try.py | UTF-8 | 42 | 3.09375 | 3 | [] | no_license | list = []
list.extend((2,3))
print(list) | true |
6d5b5a20632ab36f25cb7684fc93fa2db1579d65 | Python | shubham-dixit-au7/test | /assignments/Week06/Day01_(24-02-2020)/Ques2.py | UTF-8 | 2,343 | 3.96875 | 4 | [] | no_license | #Question- Implement Queues using Stacks
#Answer-
class Node:
def _init_(self, data):
self.data = data
self.next = None
class LinkedList:
def _init_(self):
self.head = None
# self.end = None
def push(self, data):
if self.head is None:
temp_node = Node... | true |
5089ec100b6c536ec984eed06399b5cd951d6e2f | Python | JannaKim/PS | /dp/14501_퇴사On이해후다시.py | UTF-8 | 682 | 2.890625 | 3 | [] | no_license | N = int(input())
cn = [0]
for _ in range(N):
cn.append([int(i) for i in input().split()])
cn += [[0,0]]
#dp[i]: i일 '전'에 끝나는 최상의 스케쥴
dp = [0]+ [0]*(N+2)
for i in range(1,N+2):
if i+cn[i][0]<=N+1: # N+1일 '전'까지 끝날 수 있는 스케쥴만.
dp[i+cn[i][0]]= max(dp[i+cn[i][0]], dp[i]+cn[i][1])
# i+1 날은 더이상 비교할, i+1일 '직전... | true |
783a17b76579dc624a8734c40698e808ca44ac31 | Python | MarioPezzan/ExerciciosGuanabaraECurseraPyCharm | /Exercícios curso em video/Exercicios/ex031.py | UTF-8 | 220 | 3.75 | 4 | [] | no_license | km = float(input('Quantos quilometros você viajará? '))
print(f'Você iniciará uma viagem de {km}Km')
if km >= 200:
print(f'E terá que pagar R${km*0.45:.2f}')
else:
print(f'E terá que pagar R${km*0.50:.2f}') | true |