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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
be2c57361b2f737c71e6525199d3910751789de9 | Python | samruddhichitnis02/machine_learning | /Flask/Problem2/app.py | UTF-8 | 1,143 | 3.015625 | 3 | [] | no_license | from flask import Flask, render_template, request
import pickle
import pandas as pd
obj = pickle.load(open('model.pkl','rb'))
lb = obj['lb']
ohe = obj['ohe']
classifier = obj['classifier']
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict',methods = ... | true |
a23a7491daa074d4452ef20dcce4668e59dc9eff | Python | jawor92/Python-Udemy-Mobilo | /Scripts/PythonBeginnerLvl/172/172.py | UTF-8 | 422 | 2.78125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Oct 13 17:34:05 2019
@author: Mateusz.Jaworski
"""
file=open("C:\\Users\\Mateusz.Jaworski\\Desktop\\Prywatne\\Python\\172\\test.txt", "r", encoding="utf-8")
content = file.read()
print(content)
file.close()
with open("C:\\Users\\Mateusz.Jaworski\\Desktop\\Prywatne\\Pytho... | true |
ef68a236827b10a6487d07fc62fe2efd4c6c80fc | Python | alfredt/pj0304 | /preprocessing_nltk.py | UTF-8 | 978 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 14 15:56:29 2017
@author: user
"""
import nltk
import re
from nltk.stem.wordnet import WordNetLemmatizer
#pos_condition = re.compile('NN*|JJ*') #with Adjective & Nouns
#pos_condition = re.compile('NN*')
def preprocess_pos(contents, regrex):
process... | true |
5ed77aa5a6feb2ed817246eb5e8450b94c22da2d | Python | nithinveer/leetcode-solutions | /Replace Words.py | UTF-8 | 736 | 3.46875 | 3 | [] | no_license | class Solution(object):
def replaceWords(self, dict, sentence):
"""
:type dict: List[str]
:type sentence: str
:rtype: str
"""
rtn = []
dict_set = set(dict)
wds = sentence.split()
for each_ in wds:
tmp = ''
found = False
... | true |
6f4136a6cde4ef7942328a2e5d143b0a8199d43c | Python | ykataoka/top100Like | /78_Subsets.py | UTF-8 | 401 | 3.15625 | 3 | [] | no_license | class Solution(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
# Solution1 : bfs
res = []
self.bfs(nums, [], 0, res)
return res
def bfs(self, nums, path, index, res):
res.append(path)
for i i... | true |
56ed1e6c016d3b7db60fd6a614a9b8a47a112f1e | Python | Aasthaengg/IBMdataset | /Python_codes/p02262/s759667808.py | UTF-8 | 802 | 3.203125 | 3 | [] | no_license | N = int(input())
A = [int(input()) for _ in range(N)]
count = 0
def insertion_sort(N, A, gap):
for i in range(gap, N):
value = A[i] # 対象を取得する
j = i - gap # 一つ前の値を取得する
while j >= 0 and A[j] > value:
A[j+gap] = A[j] # 一つずつ後ろにずらしていく
j -= gap
global count
count += 1
A[j+gap] = ... | true |
9b37e65f4562f4c55cb909d8db12bb29c7ca73c1 | Python | Antoine07/Data-01 | /Tp_jeudi/temps.py | UTF-8 | 326 | 3.390625 | 3 | [] | no_license |
def secondeEnMinute(s):
# division entière
minutes = s // 60
secondes = s % 60
return minutes, secondes
def minuteEnHeure(m):
heures = m // 60
minutes = m % 60
return heures, minutes
def heureEnJour(h):
jours = h // 24
heures = h % 24
return jours, he... | true |
3b5db4fb7f62514b78fe08cf8e92cd98a3599a48 | Python | niyaznurbhasha/NBA_PBP | /performance_measure.py | UTF-8 | 4,939 | 2.640625 | 3 | [] | no_license | from collections import OrderedDict
from tqdm import tqdm
class PerformanceMeasureCaclulator(object):
def __init__(self, stats):
self.stats = stats
self.set_game_totals(self.stats)
def update_stats(self):
for team, players in tqdm(self.stats.items(), desc="Added Perf Measures"):
... | true |
5f53ed51ca22a847d984580309b4b198e4247349 | Python | LiuVII/nest_cam_recognition | /async_test.py | UTF-8 | 3,133 | 2.625 | 3 | [
"MIT"
] | permissive | from collections import namedtuple
import time
import asyncio
import aioconsole
from concurrent.futures import FIRST_COMPLETED
from random import randint
start = time.time()
DEFAULT_FPS = 1.0
FRAME_PROCESS_SPEED = 2.5
def tic():
return 'at %1.2f seconds' % (time.time() - start)
async def read_from_stream(frame... | true |
dd99a2d89590c696cb300b8efec753b0c4bada0b | Python | colors-blind/show-me-the-code | /0000/add_num.py | UTF-8 | 1,119 | 3.390625 | 3 | [] | no_license | #coding=utf-8
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
def add_num_to_pic(num, in_pic, out_pic):
"""
功能:给图片加个数字
参考网页
http://stackoverflow.com/questions/16373425/add-text-on-image-using-pil
http://stackoverflow.com/questions/8032642/how-to-obtain... | true |
92b52224a779ef9d273abf955d24bcdae5b0ead9 | Python | RovisLab/GOL | /1d_gol/figure_accuracy_vs_hyperparameters_v03.py | UTF-8 | 2,326 | 2.90625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import medfilt
'''
Accuracy vs no of NN training iterations
Accuracy vs different no of neurons
Accuracy vs no of generated samples
'''
def normalize(x):
return (x-min(x))/(max(x)-min(x))
no_training_iterations = np.arange(0, 20, 1)
accuracy_... | true |
cbcb6541e6494f09d05da23d268567ad51c16440 | Python | alicetang0618/nycdb_record_linkage | /corp_match.py | UTF-8 | 14,804 | 2.96875 | 3 | [] | no_license | import pandas as pd
import re
import csv
def standardize_string(x):
x = re.sub(r'[^\w\s]', ' ', x.upper()).strip()
rv = []
for word in x.split():
word = word.strip()
if word[0].isdigit() and word[-1].isalpha():
for i in range(len(word)):
if word[i].isa... | true |
ab917dd34a9af88426eb5263dda3ec052d483671 | Python | ioos/compliance-checker | /cchecker.py | UTF-8 | 11,641 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
import argparse
import sys
import warnings
from collections import defaultdict
from textwrap import dedent
from compliance_checker import __version__
from compliance_checker.cf.util import download_cf_standard_name_table
from compliance_checker.runner import CheckSuite, ComplianceChecker
def _... | true |
6b7606cfeb554be66d61af9087d67a1c165bd7c7 | Python | tylerpeller/Job-Scraper | /Job_Scraper_2.py | UTF-8 | 2,365 | 2.78125 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time as t
import csv
file = open('c:/Users/tyler/OneDrive/Documents/Python_Scripts/Job_Hunt.csv', 'w')
writer = csv.writer(file)
# writerow() method to the write to the file object
writer.writerow(['Job Title', 'Company',... | true |
2aa6c5b912d06b4f0ead5c504975ff7c4e4977ef | Python | ugobachi/AtCoder | /PanasonicProgrammingContest/C.py | UTF-8 | 699 | 3.59375 | 4 | [] | no_license | # coding: utf-8
"""[solution]
√a + √b < √cかどうかを判定するプログラム
a, b, cの整数の変数
srqtを使うと小数になってしまうため、小数を使わないアプローチを採用
大小比較は両辺を二乗しても可能
a + 2√ab + b < c
まだ√が残っているので、式変形して二乗する
c - a - b > 2√ab
これを二乗して
(c - a - b)^2 > 4ab
また、a + bがcより大きければ絶対に√a + √b < √cを満たさないのでこの条件も追加
条件を満たすもののみをYesを出力
"""
a,b,c = (int(x) for x in input().split())... | true |
963bd98a081a8fe6abd4ae643b41a7e7b63104dd | Python | uden28/lapyh03 | /latihan2.py | UTF-8 | 528 | 3.4375 | 3 | [] | no_license | def perulangan():
print(" ")
max=0
while True :
a=int(input("Masukan Bilangan = "))
if max < a:
max = a
if a==0:
print(" ")
print("Bilangan Terbear =" ,max)
print(" ")
print("Terimakasih Telah Menggunakan Program Ini")
print(" ")
print("DILARANG MENG COPY PROGRAM INI")
PRINT(" ")
... | true |
3df121f6180a2dc3089db48040cce3f5287836d6 | Python | jungeunlee95/algorithm-python | /day16-Tree/2_subtree.py | UTF-8 | 563 | 3.1875 | 3 | [] | no_license | import sys
sys.stdin = open("2_subtree", "r")
def subtree(N):
global cnt
if len(G[N]) != 0:
if len(G[N]) == 1:
cnt += 1
subtree(G[N][0])
else:
cnt += 2
subtree(G[N][0])
subtree(G[N][1])
T = int(input())
for t in range(1, T + 1):
... | true |
e33434ac19f384aaa578ec5b518240802ec54ac9 | Python | TOE703/socket-programming-for-comms | /client_socket.py | UTF-8 | 570 | 3.09375 | 3 | [] | no_license | import socket
# specify type and protocol should be TCP/IP, must match server to connect
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# ip of server to connect to (reserved for localhost)
client_socket.connect(("127.0.0.1", 8081))
print("connected")
# receiving message
incoming_data = client_soc... | true |
eca7712d03419614928ca79255104d89605f66c5 | Python | mahbub29/pythonChallenges | /q51.py | UTF-8 | 314 | 4.15625 | 4 | [] | no_license | # Define a class named Circle which can be constructed by a radius.
# The Circle class has a method which can compute the area.
import math
class Circle:
def __init__(self, r):
self.radius = r
def area(self):
return self.radius ** 2 * math.pi
circle = Circle(2)
print(circle.area())
| true |
195bbed8f8621d73c0a4c9e545f86f05603aa7c5 | Python | pwang867/LeetCode-Solutions-Python | /0350. Intersection of Two Arrays II.py | UTF-8 | 1,254 | 4.03125 | 4 | [] | no_license | from collections import defaultdict
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
d = defaultdict(int)
for num in nums1:
d[num] += 1
res = []
... | true |
e9c525cb0fbe19356719076900dbae75e9e055f0 | Python | yftsai/uva-online-judge | /contest_volumes/volume_112/11264.py | UTF-8 | 300 | 3.1875 | 3 | [] | no_license | # #greedy
for _ in range(int(input())):
input()
last_count, last_amount = 0, 0
count, amount = 0, 0
for c in map(int, input().split()):
if amount < c:
last_count, last_amount = count, amount
count, amount = last_count + 1, last_amount + c
print(count)
| true |
bc9a1dca7ff26828eaa48392f998d9d90faf7693 | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode/1201-1400/001232/001232.py | UTF-8 | 723 | 2.953125 | 3 | [] | no_license | class Solution(object):
def checkStraightLine(self, coordinates):
"""
:type coordinates: List[List[int]]
:rtype: bool
"""
x0, y0, x1, y1 = coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1]
for x, y in coordinates[2:]:
if (... | true |
08c318d3e9f16193160417e4c7c9492741aeba3b | Python | christinebr/INF200-2019-Exercises | /src/pa02/test_pa02.py | UTF-8 | 9,563 | 3.421875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
__author__ = 'Christine Brinchmann', 'Marie Kolvik Valøy'
__email__ = 'christibr@nmbu.no', 'mvaloy@nmbu.no'
import src.pa02.chutes_simulation as ss
class TestPBoard2:
"""Tests that Board works as supposed."""
def test_goal_reached(self):
"""
Create a bo... | true |
dac0ef8ea1002d7dc9938eff1a173dd6ab00820a | Python | ReasonFoundation/parse_cafr_ixbrl | /cafr_excel.py | UTF-8 | 6,688 | 3 | 3 | [] | no_license | import logging
from pathlib import Path
import xlwings as xw
from ixbrl import Criterion, XbrliDocument
class Spreadsheet:
''' Represents an Excel spreadsheet using xlwings. '''
def __init__(self, workbook=None, sheet=None):
if workbook:
self.workbook = workbook
else:
... | true |
1daa1c9251be497158062c7e04a50b93b9a547a0 | Python | Vector06/waifubot | /helper_thread.py | UTF-8 | 1,019 | 3 | 3 | [
"MIT"
] | permissive | import threading
import os
import random
import time
class CSPickupLinesThread(threading.Thread):
def __init__(self):
super().__init__()
self.running = True
self.__list = []
self.__lock = threading.Lock()
def updateFunc(self):
os.system("curl https://raw.githubuserconte... | true |
5f8f673be54b646c5cb4e2b427f2d3baccaf2bec | Python | yanzhenguo/MyExperiment | /src/StanfortSentiment/binary/cnn_s.py | UTF-8 | 2,254 | 2.59375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# 只利用句子级别的样本进行训练
import numpy as np
import pickle
from keras.preprocessing import sequence
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
from keras.models import Sequential,Model
from keras.layers import Dense, Dropout, Activation
from ke... | true |
3887fdc6667f14bae6486dc46d8b03f13f99def8 | Python | ciortanmadalina/algo | /untitled/dna_gc.py | UTF-8 | 1,538 | 2.96875 | 3 | [] | no_license | import random
import collections
dna='aaattcgggg'
#print(type(5), type(5/2), type(3+2j), dna.count('g'), dna.find('cg', 10), help(str))
#random.seed(7)
#print(random.choice("ATCG"))
seq = ''
for _ in range(10):
seq += random.choice('ATCG')
seq = ''.join([random.choice('ATCG') for _ in range (10)])
#print(seq)
d... | true |
c8c259117d91bc2511143d9c47ea3b6ea7f8bcc4 | Python | AbhishekGangadhar/design_patterns | /structural/proxy/book_parser.py | UTF-8 | 473 | 3.59375 | 4 | [] | no_license | from abc import ABC, abstractmethod
class IBookParser(ABC):
@abstractmethod
def get_total_number_of_words(self) -> int:
pass
class BookParser(IBookParser):
def __init__(self, book_text: str):
self.book_text = book_text
# Assuming that the below operation is very expensive
... | true |
2f021878c595d6033f47eabed65f45990d0d5dc3 | Python | bupianlizhugui/comment | /write_data.py | UTF-8 | 1,122 | 2.734375 | 3 | [] | no_license | import codecs
def df_wirte_to_file(filename, feature, sample):
fw = codecs.open(filename, 'w', 'gbk')
for word in feature:
count = 0
for s in sample:
if word in s:
count += 1
fw.write(word)
fw.write('\t')
fw.write(count)
fw.write('\n'... | true |
779ae0a69190f3bce6990f888f41f434481b2591 | Python | dalvaniamp/verifica-diplomas-coppe | /driver.py | UTF-8 | 585 | 2.828125 | 3 | [
"MIT"
] | permissive | from selenium import webdriver
from selenium.webdriver.chrome.options import Options
class Driver():
# Classe singleton que instancia o navegador
__driver = None
def __new__(self):
if Driver.__driver is None:
self.__initDriver(self)
return Driver.__driver
def __initD... | true |
ce0b718c036602e57f97dfb0c71c8a87eef33b91 | Python | sagarsirbi05/Deep_Autoencoder_for_Collaborative_Filtering_for_Recommendation_Systems | /model/AutoEncContentModel.py | UTF-8 | 4,674 | 2.53125 | 3 | [] | no_license | from tensorflow.keras.optimizers import Adam, RMSprop
from tensorflow.keras.layers import Input, Dense, Embedding, Flatten, Dropout, Activation
from tensorflow.keras.models import Model
from tensorflow.keras.regularizers import l2
from tensorflow.keras import backend as K
from tensorflow.keras import regularizers
from ... | true |
65557c4bbc568780ee64a14e622fb1d1f337e1c1 | Python | ash/amazing_python3 | /243-file-getline-n.py | UTF-8 | 125 | 3.03125 | 3 | [] | no_license | # Getting line number N from
# a text file
import linecache
line_n = linecache.getline(
'greek.txt', 4
)
print(line_n)
| true |
d5fb57cc4396235153c59a967f0061e0ffc4b47a | Python | daniela2001-png/Python-3 | /challenge_control_flow.py | UTF-8 | 1,664 | 4.40625 | 4 | [] | no_license | def large_power(base, exponent):
if (base ** exponent > 5000):
return True
else:
return False
# Uncomment these function calls to test your large_power function:
print(large_power(2, 13))
# should print True
print(large_power(2, 12))
# should print False
#other function of the challenge
def over_budget(bud... | true |
6fe1d7789be3bbe94dfb91ffce0b4df464ac8cb8 | Python | Wuwunator/PRS18 | /trigramme.py | UTF-8 | 2,665 | 4.25 | 4 | [
"Unlicense"
] | permissive | # -*- coding: utf-8 -*-
# Wencke Hartwig
# 790786
# Uebungsblatt 6
# 1 N-Gramme
# zuerst definieren wir uns eine funktion, welche die trigramme eines strings ermittelt
def find_trigrams(s):
# als ausnahme deklarieren wir, dass strings, die kleiner als 3 zeichen sind, nicht als trigramme behandelt werden
... | true |
7e4df8d9029e2ec923f57ca3cf7eb0d5db88379e | Python | Kite330/python- | /023从数组中找出a+b=c+d.py | UTF-8 | 747 | 3.8125 | 4 | [
"MIT"
] | permissive | """
给定一个数组[3,4,7,10,20,9,8],可以找出两个数队(3,8),(4,7)=>3+7=8+4
"""
import random
class Pair:
"""docstring for pair"""
def __init__(self,first,second):
self.first=first
self.second=second
def findPairs(arr):
Dict={}
i=0
n=len(arr)
while i<n:
j=i+1
while j<n:
pair=Pair(arr[i],arr[j])
sum=... | true |
9b850343602304cc980cbbb008d113fcd426bc76 | Python | vvwvvv/LotteryPredition | /untitled.py | UTF-8 | 354 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2016-09-20 22:13:33
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
# d = {1:11,2:22,10:33,6:66,4:44}
# aa=lambda a:a+1
# print(sorted(d.items(),key=lambda d:d[1]))
# print(aa(3))
# print([]+[3,5]+[5,8])
# print("20... | true |
dd690588eed850279a56543316ea0976d5c7ff41 | Python | CCallahanIV/CodeWars | /401-code-katas/flight-paths/flight_paths.py | UTF-8 | 2,496 | 3.890625 | 4 | [] | no_license | """This module contains the solution for the flight paths Kata for Codefellows 401 Python course."""
from weighted_graph import WGraph
import json
# This function is provided for the class.
def calculate_distance(point1, point2):
"""
Calculate the distance (in miles) between point1 and point2.
point1 and ... | true |
6fd3f841bca67c8d4e52952680369cc9425b6ce1 | Python | Ishani2509/Coref | /CODE/With_Protein_feature/Feature_parsing.py | UTF-8 | 1,833 | 2.75 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | final_dict = {}
with open('Final_feature_file_train.txt')as f:
content= f.read()
for line in content.split("\n"):
if(line!=""):
filename = line.split(",")[0]
mention = line.split(",")[1]
final_dict[filename+","+mention]={}
if(line.startswith(filename+","+mention)):
final_dict[filename+","+mention]['... | true |
8c5d96d87d0079afbcb265c10ced1c2984868f28 | Python | mynameisalantao/cycle-GAN-image-style-transform | /Prob2_cycle_gan.py | UTF-8 | 24,416 | 3.03125 | 3 | [] | no_license | #------------------------------ Import Module --------------------------------#
import numpy as np
import cv2
import os
import tensorflow as tf
import math
import matplotlib.pyplot as plt
import random
# 使用GPU
os.environ['CUDA_VISIBLE_DEVICES'] = '2'
tf.device('/device:GPU:2')
#-------------------------... | true |
51cf06c5edabc29c7c798479c04482153a1acb9b | Python | MPAS-Dev/MPAS-Tools | /conda_package/mpas_tools/mesh/creation/signed_distance.py | UTF-8 | 7,731 | 2.640625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"BSD-2-Clause"
] | permissive | import numpy as np
from scipy.spatial import KDTree
import timeit
import shapely.geometry
import shapely.ops
from functools import partial
from inpoly import inpoly2
from geometric_features.plot import subdivide_geom
from mpas_tools.mesh.creation.util import lonlat2xyz
def signed_distance_from_geojson(fc, lon_grd, ... | true |
b13d2b0a41338cfbf527b973fbe653d55c8fc7bb | Python | BytecodeClients/DigitalOcean-Snapshot-CLI | /src/mattermostnotifier.py | UTF-8 | 793 | 2.984375 | 3 | [] | no_license | import requests
import json
class MattermostNotifier():
def __init__(self, mattermostWebhookUrl = None):
self.mattermostWebhookUrl = mattermostWebhookUrl
def generateMattermostPayload(self, message):
payloadData = {'text': message}
payloadJson = json.dumps(payloadData)
return p... | true |
5d83b7f3d849fd6ce2494e9848b99e5f80612358 | Python | iamrizwan007/Generator | /C6_ListVSGeneratorPerformance.py | UTF-8 | 742 | 3.578125 | 4 | [] | no_license | import random
import time
names = ['sunny','bunny','chinny','vinny']
subjects =['python','java','data science']
def students_list(num):
students =[]
for i in range(num):
student = {'id':i, 'name':random.choice(names),'subject':random.choice(subjects)}
students.append(student)
return students
def stud... | true |
7d4bd7830b804f3d399211bc5ea3e04468e4112e | Python | nephilem90/fizz-buzz-kata | /SoundNumberEvaluator.py | UTF-8 | 523 | 3.515625 | 4 | [] | no_license | def contain(number, must_contains):
if number == must_contains or unit(number) == must_contains:
return True
elif number > 10:
return contain(decimal(number), must_contains)
return False
def unit(number):
return number % 10
def decimal(number):
return (number - unit(number)) / 10... | true |
db7dd83fbbb10c24d7fe8794d748424de76465c1 | Python | APMonitor/pdc | /Module_27/1_Topic/SecondOrderSystems_1.py | UTF-8 | 2,079 | 3.109375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
# specify number of steps
ns = 100
# define time points
t = np.linspace(0,ns/5.0,ns+1)
class model(object):
# default process model
Kp = 2.0
taus = 1.0
thetap = 0.0
zeta = 1.0
def process(x,t,u,Kp,taus,zeta):
... | true |
f9e108cb992412ba1c4c0a7c7b08f379114ba0b0 | Python | KotatuBot/Pbit | /Pbit/pbit_numerical_test.py | UTF-8 | 2,378 | 3.15625 | 3 | [
"MIT"
] | permissive | import Pbit.pbit_conversion_check
import Pbit.pbit_conversion
class Pbit_Numerical_Test():
"""
計算前の検査を行う関数
"""
def __init__(self):
self.check = Pbit.pbit_conversion_check.Pbit_Conversion_check()
self.conversion = Pbit.pbit_conversion.Pbit_Conversion()
def check_convert(self,one_va... | true |
f51e54a94c044155b826060d431449c4118ded6e | Python | escherba/classifier_comparison | /freq_patterns.py | UTF-8 | 2,425 | 2.765625 | 3 | [] | no_license | import json
import re
import sys
from operator import itemgetter
from os.path import isdir
from itertools import imap
from argparse import ArgumentParser
from lflearn.feature_extract import HTMLNormalizer, RegexTokenizer
from nltk.corpus import stopwords
from fp_growth import find_frequent_itemsets
from utils.lfcorpus... | true |
c4faf43894ad270c47646937c9cd8b8ccf1d9b95 | Python | BigAN/DaZuiWang | /配置/DaZuiWang/forms.py | UTF-8 | 2,688 | 2.578125 | 3 | [] | no_license | '''
Created on 2013-8-19
@author: samsung
'''
from django.contrib.auth.models import User
from django import forms
class ChangeForm(object):
"""design for change personal information"""
username = forms.CharField()
oldpassword = forms.CharField(widget=forms.PasswordInput())
newpassword= forms.CharFiel... | true |
a7ad42a08166ba6b24d25ccfa8aaf4ae62094151 | Python | Mohsin7777/SQL_and_Python | /Python_Snippets/ML - K MEANS CLUSTERING.py | UTF-8 | 4,227 | 3.765625 | 4 | [] | no_license |
'''
This is an unsupervised algorirthm = No labels/Target variables are defined
---> Goal: Find an underlying structure in the data without feeding in any targets
Divides data into 'clusters' based on proximity
'k' is a free parameter - number of groups you want to find
---> These are points on a map and alg... | true |
f2cfbdcb7c53838aab5b1ca787854f536638a15a | Python | ashank135b/Sentiment-Analysis | /Sentiment Analysis.py | UTF-8 | 2,830 | 2.8125 | 3 | [] | no_license | import pickle
import re
from collections import Counter
from nltk.corpus import stopwords
from tweepy import Stream, OAuthHandler
from tweepy.streaming import StreamListener
import json
import sqlite3
from unidecode import unidecode
import time
s = set(stopwords.words('english'))
with open("storefeatures.txt", "rb") ... | true |
90e229f28ec451e908c3ad7019ccba21f81c84c0 | Python | pirurim/DoorPi | /doorpi/action/SingleActions/statusfile.py | UTF-8 | 1,617 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
logger.debug("%s loaded", __name__)
from action.base import SingleAction
import doorpi
from status.status_class import DoorPiStatus
def write_statusfile(filename, filecontent):
try:
filename = doorpi.DoorPi(... | true |
73e2765573b5c0190d0dca3b22dc56138bb47b58 | Python | ShukurDev/Examples-in-Python | /#21_Task_Funksiya_ruyhat.py | UTF-8 | 693 | 3.15625 | 3 | [
"Unlicense"
] | permissive |
# 1-TASK. Matnlardan iborat ro'yxat qabul qilib, ro'yxatdagi har bir matnning birinchi
# harfini katta harfga o'zgatiruvchi funksiya yozing.
def katta_harf(ismlar):
names = []
for i in range(len(ismlar)):
ismlar[i] = ismlar[i].title()
ismlar = ['ali', 'vali', 'hasan', 'husan']
katta_harf(ismlar)
print(... | true |
96e835cfbc1193e06bc1d6005ec1508910a3ea69 | Python | qq1197977022/learnPython | /itcast/02_python核心编程/01_python高级编程/day02/demo05.py | UTF-8 | 652 | 3.765625 | 4 | [] | no_license | # 闭包应用
def outer(k, b):
def inner(x):
print(k*x+b)
print(id(k), id(b))
return inner
# 外层函数确定曲线,内层函数求函数值
line1 = outer(1, 2)
line2 = outer(2, 4)
# 闭包简化调用过程
line1(3)
line2(3)
line1(4)
line2(4)
print('*'*30)
# 常规方式
def line(k, b, x):
print(k*x + b)
# 对于已经确定的曲线,求函数值是k, b参数不是必须的,但这种调用方式必须... | true |
0c670cc87f77156e35f5636a7a97b352c481ff6b | Python | PymMake/Project_Euler | /010_Summation of primes.py | UTF-8 | 528 | 3.828125 | 4 | [] | no_license | '''Summation of primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
素数的和
所有小于10的素数的和是2 + 3 + 5 + 7 = 17。
求所有小于两百万的素数的和。'''
L = [2,3,5,]
num = 2+3+5
for x in range(7,2000000,2):
a = 1
for i in L:
if i**2 > x:#代替开根
brea... | true |
047b62af54c8f14f58fb06ec2b9c1b7407818b5d | Python | denkuc/ITEA_courses | /lesson9/models/models.py | UTF-8 | 1,239 | 2.953125 | 3 | [] | no_license | from mongoengine import *
connect("lesson_9")
class User(Document):
login = StringField(max_length=30)
password = StringField(min_length=8, max_length=30)
email = EmailField(unique=True)
role = StringField()
class Category(Document):
title = StringField(max_length=255, unique=True)
descripti... | true |
758d7629beed871499c9cb816d2f125c916e43d0 | Python | JaakkoAhola/LES-emulator-01prepros | /FindCloudBase.py | UTF-8 | 8,051 | 2.71875 | 3 | [] | no_license | import sys
import numpy as np
import copy
def calc_psat_w(T):
# Function calculates the saturation vapor pressure (Pa) of liquid water as a function of temperature (K)
#
# thrm.f90: real function rslf(p,t)
c0=0.6105851e+03
c1=0.4440316e+02
c2=0.1430341e+01
c3=0.2641412e-01
c4... | true |
73d069876b5fc40bd56bc5fa38a0bc6081daa323 | Python | edipetres/databases-couse | /assignment9/db_controller.py | UTF-8 | 8,575 | 2.953125 | 3 | [] | no_license | import psycopg2
import sys
import pprint
import timeit
from neo4jrestclient import client
from neo4jrestclient.client import GraphDatabase
import random
import numpy as np
import statistics
db = GraphDatabase("http://localhost:7474", username="neo4j", password="secret")
psql_d1_time = []
psql_d2_time = []
psql_d3_tim... | true |
0eb6091976af17a58343be02b34c5c3bd87efa04 | Python | oscar-macias/BHJet | /Examples/Paper_plots/Pairs.py | UTF-8 | 2,970 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Polygon
import math
import matplotlib.ticker as plticker
from matplotlib import cm
from matplotlib.colors import LogNorm
from matplotlib import rc, rcParams
rc('text',usetex=True)
rc('font',**{'family':'serif','serif':['DejaVu Serif Disp... | true |
8201df941deea49a1a39014cce2af3d2ec429bde | Python | dev-onejun/Algorithm-Study | /tutorials/왕실의 나이트.py | UTF-8 | 436 | 3.265625 | 3 | [] | no_license | INIT_POS = input()
MOVES = [(2, 1), (2, -1), (-2, 1), (-2, -1), (1, 2), (-1, 2), (1, -2), (-1, -2)]
ONE_TO_ONE = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
'g': 7,
'h': 8
}
ROW = int(INIT_POS[1])
COL = ONE_TO_ONE[INIT_POS[0]]
answer = 0
for move in MOVES:
if ROW + move[0] <... | true |
62e4a62552bca57f4bdf0bb7c7196c160381cebd | Python | draft-sport/draft-sport-py | /draft_sport/store/denomination.py | UTF-8 | 785 | 2.953125 | 3 | [] | no_license | """
Draft Sport Python Library
Denomination Module
author: hugh@blinkybeach.com
"""
from nozomi import Decodable, Immutable
from typing import Type, TypeVar, Any
T = TypeVar('T', bound='Denomination')
class Denomination(Decodable):
def __init__(
self,
name: str,
iso_4217: str,
sy... | true |
18b5bd0bfa8c25b0827e37ca9e5e2224df821838 | Python | myliu/python-algorithm | /leetcode/fraction_to_recurring_decimal.py | UTF-8 | 934 | 2.9375 | 3 | [] | no_license | class Solution(object):
def fractionToDecimal(self, numerator, denominator):
"""
:type numerator: int
:type denominator: int
:rtype: str
"""
if not numerator:
return '0'
fraction = ''
if (numerator > 0) != (denominator > 0):
fr... | true |
92c16520279fe942a5fc1917c37749b47792ddb4 | Python | dpgonzale/VideoGame_Sentiment | /VideoGame_Sentiment_Final.py | UTF-8 | 2,492 | 2.890625 | 3 | [] | no_license | #load dependencies
import pandas as pd
import numpy as np
import tflearn
import tensorflow as tf
from tflearn.data_utils import to_categorical, pad_sequences, VocabularyProcessor
from sklearn.model_selection import train_test_split
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence... | true |
972fb4000e9a17cff5980bc66b000dd7c3082de5 | Python | vasukulkarni/cephci | /ceph/ceph_admin/__init__.py | UTF-8 | 6,182 | 2.578125 | 3 | [
"MIT"
] | permissive | """
Ceph Administrator aka cephadm module is a configuration tool for Ceph cluster.
It allows the users to deploy and manage their Ceph cluster. It also supports all the
operations part of the cluster lifecycle.
Over here, we create a glue between the CLI and CephCI to allow the QE to write test
scenarios for verifyi... | true |
1e3a092db8ac3ffcf7e21c5bcb1fdb0f4adf3218 | Python | Strashivskyi/algo_lab_3 | /string_to_people.py | UTF-8 | 660 | 4.09375 | 4 | [] | no_license | def string_to_people(input_string):
input_string = input_string.split(" ")
people = []
if len(input_string) > 50:
raise Exception('The input data includes too many people')
else:
for person in range(len(input_string)):
people.append([])
if len(input_string... | true |
17294b09ca98fd68e731567ae1304e681bb59dc0 | Python | KIMSUBIN17/Code-Up-Algorithm | /Python/1089 [기초-종합] 수 나열하기1_1.py | UTF-8 | 98 | 3.171875 | 3 | [] | no_license | a,d,n = map(int,input().split())
count = 1
while (n != count):
a+=d
count+=1
print(a)
| true |
381e8caa9937c7ca1110b920e919086278d968af | Python | hthuwal/competitive-programming | /old/mixed/python/assign-recursive-memoization.py | UTF-8 | 670 | 2.75 | 3 | [] | no_license | import sys
sys.stdin = open("in.txt","rb")
mymap={}
def hc(a,x,n,hash):
key = str(x)+str(n)+"".join(map(str,hash))
# print key
if(x>=n):
return 1
elif(key in mymap):
return mymap[key]
else:
ans=0
for i in range(0,n):
if(hash[i]==0 and a[x][i]==1):
... | true |
c4a47f67635dcc396593f04d7da918d8ec35128b | Python | hedi-sassi/smc_project | /test_secret_sharing.py | UTF-8 | 736 | 2.734375 | 3 | [] | no_license | """
Unit tests for the secret sharing scheme.
Testing secret sharing is not obligatory.
MODIFY THIS FILE.
"""
from secret_sharing import share_secret, reconstruct_secret
def test():
test_value = 15
nbr_participants = 10
shares = share_secret(test_value, nbr_participants)
recovered_value = rec... | true |
f45d18db86deaa5d2e8124ca7e3e5324a5b097cc | Python | andrewsli/problem-solving | /leetcode/152_maximum_product_subarray.py | UTF-8 | 445 | 2.703125 | 3 | [] | no_license | class Solution:
def maxProduct(self, nums) -> int:
global_max = nums[0]
curr_max = nums[0]
curr_min = nums[0]
for idx in range(1, len(nums)):
local_min = min(curr_min * nums[idx], curr_max * nums[idx], nums[idx])
curr_max = max(curr_max * nums[idx], curr_min * num... | true |
a98789a80659e9806d22b1fb6164b8e6817552a5 | Python | Emily-dan/ml_project_template | /src/metrix.py | UTF-8 | 3,352 | 3.109375 | 3 | [] | no_license | import numpy as np
from sklearn import metrics as skmetrics
class RegressionMetrics:
def __init__(self):
self.metrics = {
"mae": self._mae,
"mse": self._mse,
"rmse": self._rmse,
"msle": self._msle,
"rmsle": self._rmsle,
"r2": self._r2... | true |
1078734e22502546b951ea567621f8563402da15 | Python | yangxi5501630/pythonProject | /study/study/2_输出.py | UTF-8 | 155 | 3.625 | 4 | [] | no_license | #可以接收多个字符串,每遇到一个逗号就输出一个空格
print("hello","world","china")
print(250)
print(250+250)
print("250+250 =",500)
| true |
6f9ebde73013ce4521b54c2515c96e407cfa3cd9 | Python | JorgeAGR/nmsu-course-work | /GPHY560/Homework 2/prob2.py | UTF-8 | 1,617 | 2.984375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 10 18:31:16 2020
@author: jorgeagr
"""
import numpy as np
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
# Setting plotting variables
width = 10
height = 10
mpl.rcParams['figure.... | true |
a2fbbf02027ec25d3d2751515754c7c5717180fa | Python | baviamu/set1-2begprograms | /oddin.py | UTF-8 | 98 | 3.28125 | 3 | [] | no_license | bbc,abc=map(int,input().split())
for c in range(bbc+1,abc,1):
if(c%2!=0):
print(c, end=' ')
| true |
abc0767dff114f56bae114e72845a5bb9d35b378 | Python | hrishikeshtak/Coding_Practises_Solutions | /hackerrank/si/linked_lists/SLL_unique.py | UTF-8 | 1,231 | 3.640625 | 4 | [] | no_license | #!/usr/bin/python3
class Node:
def __init__(self, data):
self.data = data
self.next = None
def createNode(data):
node = Node(data)
return node
def createSLL(root, data):
node = createNode(data)
if root is None:
return node
cur = root
while cur.next:
cur... | true |
ddc73b9a4fc948954c40592c2202e7fde1c9fef7 | Python | apbourgeois/Gallador---A-Simple-RPG-Game | /font.py | UTF-8 | 2,364 | 3.078125 | 3 | [] | no_license | import rarity
def text(font, text):
return font + str(text) + default
default = '\033[0m'
'''
How to use custom font:
font.font_here(text here) returns a string with that font.
Example:
print(font.bold_red('-2'))
'''
# Rarities
def rarity_grey(text):
return rarity.grey + str(text) + default
def rarity_green(t... | true |
e9d8448eb780d62755b2083d2966c88b04551ff2 | Python | vishalpmittal/practice-fun | /funNLearn/src/main/java/dsAlgo/dp/KnapsackAlgorithm.py | UTF-8 | 3,758 | 3.953125 | 4 | [] | no_license | """
Tag: dp, recursive, algo
Knapsack problem
Given a set of items, each with a weight and a value, determine
the number of each item to include in a collection so that the
total weight is less than or equal to a given limit and the total
value is as large as possible.
"""
from typing impo... | true |
10929b1796f6fc08409970fff9d33a02bc623bbc | Python | mohitsh/python_work | /recursion/rec_reverse.py | UTF-8 | 306 | 3.625 | 4 | [] | no_license |
def reverse(alist,first,last):
if first <= last:
tmp = alist[first]
alist[first] = alist[last]
alist[last] = tmp
return reverse(alist, first+1, last-1)
alist = [1,2,3,4,5]
reverse(alist,0,4)
print alist
alist = ['dalla','jain','namit','mittal','varun','bohra']
reverse(alist,0,4)
print alist
| true |
49d04e9d1b7a1f2e3195c1373e7e3aedc7af5d8a | Python | sueumin/nabi | /na.py | UTF-8 | 6,896 | 2.890625 | 3 | [] | no_license | import asyncio
import discord
client = discord.Client()
token = 'NjAwODY2MzY1NzI0Njg4Mzg0.XS6K4w.1HZLTK9jLj96zxhWEvoLblb7ybU'
@client.event
async def on_ready():
print('Logged in as') #화면에 봇의 아이디, 닉네임이 출력됩니다.
print(client.user.name)
print(client.user.id)
print("===========")
# 디스코드에는... | true |
e83b0124ce669c2b8e629d92bdbdc5f54a3ae7cc | Python | jeonghanlee/Work | /Python/CodeExamples/Real-Time Simulations/realtime_sim_discrete_ex.py | UTF-8 | 472 | 3.15625 | 3 | [] | no_license | # Real-Time Simulation of Discrete System
import numpy as np
import matplotlib.pyplot as plt
# Model Parameters
a = 0.25
b = 2
# Simulation Parameters
Ts = 0.1
Tstop = 30
uk = 1 # Step Response
xk = 0
y_scale_max = 10
N = int(Tstop/Ts) # Simulation length
data = []
data.append(xk)
plt.axis([0, N, 0, y_scale_max])
... | true |
eba1b2352ffe290ac28365318fd4cf8523258fc6 | Python | mizuochik/contest | /abc095_c.py | UTF-8 | 220 | 2.765625 | 3 | [] | no_license | import sys
A, B, C, X, Y = [int(t) for t in input().split()]
ans = sys.maxsize
for z in range(2 * 10**5 + 1):
x = max(0, X - z // 2)
y = max(0, Y - z // 2)
ans = min(ans, A * x + B * y + C * z)
print(ans)
| true |
5189d0bfb8a6b383801471562d8624d3e87fe7d6 | Python | samanthazhang7/nyc-restaurant-generator | /Restaurant.py | UTF-8 | 4,895 | 3.453125 | 3 | [] | no_license | # Samantha Zhang, samanthz@usc.edu
# ITP 115 Final Project
# Python File 3 of 3
import pandas as pd
import random
class Restaurant(object):
def __init__(self, name, address, restaurant_type, price_range, description):
self.name = name
self.address = address
self.restaurant_type = restaura... | true |
45dfe6254a871cd5c74618ce1b2c1da74cefe8f0 | Python | itamartrainin/smt_biu | /EX2/code/evaluate.py | UTF-8 | 2,194 | 2.625 | 3 | [] | no_license | # Itamar Trainin 315425967
import sacrebleu
import optparse
import torch
import preprocess
import os
def to_sent(x, ix_to_word):
return ' '.join([ix_to_word[int(ix)] for ix in x])
def score(model, X, Y, ix_to_word_src, ix_to_word_trg, print_translations=False, debug=False):
sent_src = []
sents_pred = [... | true |
f606e1c14f36f106eda6b53e38a6ee9007b0c1bb | Python | tanvir362/Python | /fibonacci.py | UTF-8 | 982 | 3.453125 | 3 | [] | no_license | import time
import sys
# def fib(n):
# if n == 0: return 0
# if n == 1: return 1
# return fib(n-1) + fib(n-2)
# cache = {0: 0, 1: 1}
# def fib(n):
# if n == 0: return 0
# if n == 1: return 1
# if cache.get(n):
# return cache.get(n)
# cache[n-1] = fib(n-1)
# cache[n-2] = fib(... | true |
5e9b67870fa3931dc7055b1003c3a33e00c1a3b3 | Python | dinspi3/Python | /paragraph.py | UTF-8 | 355 | 3.09375 | 3 | [] | no_license | import bs4 as bs
import urllib.request
source = urllib.request.urlopen('https://pythonprogramming.net/').read()
soup = bs.BeautifulSoup(source,'lxml')
#print(soup.text)
for paragraph in soup.find_all('p'):
print(paragraph.string)
print(str(paragraph.text))
f = open("text111.txt", "w")
f.write... | true |
9ae471500dfa9c25a457fdc69f718231b15729ca | Python | SONG-WONHO/baekjoon | /2941.py | UTF-8 | 454 | 3.03125 | 3 | [] | no_license | cro_char_list = ['c=','c-','dz=','d-','lj','nj','s=','z=']
string = str(input())
num = 0
logits =0
def is_include(st):
for c in cro_char_list:
if c == st:
return True
return False
while num < len(string):
if is_include(string[num:num+2]):
logits += 1
num += 2
el... | true |
3cad66be14a0bc163fa52e6425866aca46a62e0e | Python | pierrick-giffard/STAMM | /src/Active_kernels.py | UTF-8 | 12,648 | 2.796875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Kernels used to compute swimming velocity and cold induced mortality.
"""
from math import sqrt, cos, sin, atan2, exp, log
import math
from parcels import random #ParcelsRandom
def ComputeMass(particle, fieldset, time):
"Compute mass (kg). SCL is in meters."
... | true |
45d4f945471ef6281cdf3ab91b391b3cd6faf93b | Python | fricative/finance_crawler | /finance_crawler/earning.py | UTF-8 | 2,878 | 3.046875 | 3 | [
"MIT"
] | permissive | from datetime import date, timedelta
import json
import random
import time
import pandas as pd
from selenium import webdriver
class EarningCrawler:
api = 'https://www.bloomberg.com/markets/api/calendar/earnings/%s?locale=en&date=%s'
def __init__(self, chrome_driver_path):
self.driver_path =... | true |
e9789db25f9d4fc863f4c14885a5734b62cc0cf9 | Python | utopfish/LeetCodeCamp | /python/easy/singleNumber.py | UTF-8 | 1,011 | 3.234375 | 3 | [] | no_license | # -*- coding=utf-8 -*-
#@author:liuAmon
#@contact:utopfish@163.com
#@file:singleNumber.py
#@time: 2019/11/8 15:45
class Solution4(object):
'''
方法 4:位操作
概念
如果我们对 0 和二进制位做 XOR 运算,得到的仍然是这个二进制位
a⊕0=a
如果我们对相同的二进制位做 XOR 运算,返回的结果是 0
a⊕a=0
XOR 满足交换律和结合律
a⊕b⊕a=(a⊕a)⊕b=0⊕b=ba
'''
... | true |
802e8228fcd1abc247b81d4499f4e3ee48558175 | Python | BasLangenberg/Advent-of-Code-2016 | /day004/find_north_pole_object.py | UTF-8 | 978 | 3.359375 | 3 | [] | no_license | UPPER_BOUND = ord('z')
LOWER_BOUND = ord('a')
def calculate_real_name(input_data):
return_string = ' '
# Get and remove number
number = input_data.split('-')
number = int(number[-1].split('[')[0])
# Convert string to result
for character in input_data:
if character == '-':
... | true |
d524f537cf16ea1709c87edcb4ed49630595b25d | Python | skdltmxn/n2pc | /script/memory.py | UTF-8 | 1,051 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from instruction import *
from register import *
class Memory(Instruction):
def __init__(self, opcode, rd, rs, offset):
Instruction.__init__(self, 1)
self.opcode = opcode
self.rd = rd
self.rs = rs
self.offset = offset
def raw(self):
retu... | true |
563e1397b481cf8111b9840e6ebeb2c0ad00a029 | Python | UWPCE-PythonCert-ClassRepos/Self_Paced-Online | /students/AndrewKim/lesson03/mailroom.py | UTF-8 | 1,594 | 3.78125 | 4 | [] | no_license |
donors = ["Andrew Kim", "Jamie Park", "Caroline Yeung", "Billy Yan"]
totalAmt = [5.0, 4.0, 3.0, 2.0]
numGifts = [1, 1, 1, 1]
def thankYou():
#prompt for a Full Name
name = input("Type the donor's full name: ")
#if user types 'list'
while name == "list":
for item in donors:
print(it... | true |
014474a37fa4feaa83a3c5081a6b80d610cd09ea | Python | llyyr/aoc-2020 | /11.py | UTF-8 | 1,057 | 2.828125 | 3 | [] | no_license | from itertools import product
inp = [list(l.rstrip()) for l in open(0)]
C = len(inp[0])
R = len(inp)
def cn_occ(x, y, l, p2):
cn = 0
for dx, dy in product([-1,0,1], repeat=2):
if dx == 0 and dy == 0:
continue
cur_x = x + dx
cur_y = y + dy
while p2 and 0<=cur_x<R and... | true |
979792fce5b8b8be826ad14257f7a8bad4991c9c | Python | mrmourao/uri-online-judge-in-python | /uri_1156_Sequencia_S_II.py | UTF-8 | 131 | 3.40625 | 3 | [] | no_license | soma = 1
tmp = 2;
count = 3
while(count < 40):
soma += float(count)/float(tmp)
tmp *= 2
count += 2
print("%.2f" %soma) | true |
4baad0514a42d4bc485a7bf94308e1b28745ac55 | Python | ZZ012345/Data-Mining | /Assignment 3/SpectralClusteringForBigData.py | UTF-8 | 1,929 | 2.921875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from numpy import *
import Kmedoids
import FastKmedoidsForBigData
'''
函数功能:
适用于大数据的谱聚类算法,该算法并不会存储距离矩阵以防内存不够,
输入数据为data,构建邻接矩阵时所用的kNN算法的参数为n,kmedoids聚类时参数为k,
kmedoids算法类型为kmedoidtype,输出聚类结果clusters
数据结构:
data为mat结构,每一列代表一个数据,clusters为list结构,对应每个数据所属聚类的下标
'''
def spectral... | true |
aec0c8a91cb21988d1d6823f05f1c00e645ce669 | Python | TomVdt/PyProjects | /Bird/bird.py | UTF-8 | 660 | 3.3125 | 3 | [] | no_license | from vars import *
class Bird:
def __init__(self):
self.x = 75
self.y = int(height / 2)
self.color = (255,255,255)
self.size = 10
self.vel = 0
self.acc = 0
def apply_force(self, force):
self.acc += force
def update(self):
se... | true |
6e7559d052ab652ca5cd41ae8f08261c635ed9b2 | Python | ZuZuD/hackerranck | /Algorithm/Implementation/beautiful-days-at-the-movies.py | UTF-8 | 267 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python3
a = input().split(' ')
i,j,k = [int(n) for n in a]
count = 0
for val in range(i,j):
val_r = str(val)[::-1]
if val_r[0] == "0":
val_r = val_r[1:]
val_r = int(val_r)
if (val-val_r) % k == 0:
count+=1
print(count)
| true |
e5610adf96d60b5189d35f56ac0aa55ed466c6ad | Python | kkimu/influencer | /APS/data/trim.py | UTF-8 | 555 | 3.140625 | 3 | [] | no_license | from collections import defaultdict
a = []
cit = defaultdict(lambda : defaultdict(int))
#元データを取得 cit[引用した人][引用された人]=引用回数 を入れる
for line in open("apscitation.csv"):
sp = line.strip().split(" ")
cit[sp[0]][sp[1]] += 1
for k1,v1 in cit.items():
for k2,v2 in v1.items():
#引用回数が10回以上の場合のみ、情報が拡散したとみなす
... | true |
957065079a84a15d9d549bb5a2f0ca26d65846df | Python | Sahilsingh0808/student_search | /backend/server.py | UTF-8 | 2,648 | 2.75 | 3 | [
"MIT"
] | permissive | from flask import abort, g, jsonify, request, Flask
import os
from sqlite3 import connect
import itertools
app = Flask(__name__)
DATABASE = os.getenv('DB_LOC', '../database/students.db')
def get_db():
db = getattr(g, '_database', None)
print("DB")
if db is None:
db = g._database = connect(DATABA... | true |
998fcdefd629240351a40b07d1166fc44ca6d4a7 | Python | Imminent-Darkness/hello-world | /programs/WilkinsP1.py | UTF-8 | 1,070 | 4.5 | 4 | [] | no_license | # CS 161 Program One
# Written by Steven Wilkins
# 11 October 2018
#
# This program inputs a base value and shows the first eight powers of that base.
def main ( ):
base = input ("Please enter the base value: ")
base = int (base)
power = base
exponent = 1
power = base
print (base, "to the", exponent, "power is"... | true |
04b4a1db817efb599f166eabc8ee2ef439865796 | Python | Aasthaengg/IBMdataset | /Python_codes/p02601/s678305949.py | UTF-8 | 203 | 3.296875 | 3 | [] | no_license | a, b, c = map(int, input().split())
k = int(input())
times = 0
while a >= b:
b *= 2
times += 1
while b >= c:
c *= 2
times += 1
if times <= k:
print('Yes')
else:
print('No')
| true |
60327f7a178355a6a0e9f22e1b29d0ea036bcb96 | Python | ICRA-2021/Archeology-Robot-Arm | /scripts/ARCHIVE/detect_shard_spaghetti.py | UTF-8 | 9,497 | 2.75 | 3 | [] | no_license | #!/usr/bin/env python
#Import Python libraries
import cv2
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import pyrealsense2 as rs # Intel RealSense cross-platform open-source API
# Import ROS libraries and message types
import rospy
from cv_bridge import CvBridge, CvBridgeEr... | true |
48048cb4339d20e580ade2ab7adaac9d78d4b2fc | Python | CathalMullan/email_stream_processor | /src/email_stream_processor/helpers/output/output_eml.py | UTF-8 | 871 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | """
Convert a list of message contents into eml files.
"""
import time
from pathlib import Path
from typing import List
from email_stream_processor.helpers.globals.directories import CLEAN_ENRON_DIR
from email_stream_processor.parsing.message_contents_extraction import MessageContent
def output_eml(message_contents:... | true |