blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
e7bf9a41e61f37c47ed29aeb5794a9d5ddfd1644 | vidit21srivastava/machine_learning | /backend/script/main.py | UTF-8 | 2,262 | 2.90625 | 3 | [] | no_license | import io
import base64
import sys
import numpy as np
from PIL import Image
import pickle
from sklearn.pipeline import Pipeline
from tensorflow.keras.models import load_model
import socketio as socket
def connect_socket():
sio = socket.Client()
sio.connect('https://mlprojects-backend.herokuapp.com')
retur... | true |
65e402040aa34e953a3763487e2c797a651654a9 | lowRISC/opentitan | /util/reggen/alert.py | UTF-8 | 1,770 | 2.578125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
from typing import Dict, List
from reggen.bits import Bits
from reggen.signal import Signal
from reggen.lib import check_keys, check_name, check_str, check_list
class Al... | true |
f84f840bdfa2ec69f3b0f858cf9321bbe4276f48 | vivekworks/learning-to-code | /4. Discovering Computer Science/Python/Chapter 3 - Visualizing Abstraction/Exercises 2/exercise324.py | UTF-8 | 601 | 3.703125 | 4 | [] | no_license | import turtle
rectangle = turtle.Turtle()
rectangle.speed(1)
rectangle.pencolor('orange')
rectangle.pensize(2)
#count = 1
length = 200
width = 100
forward = length
for rect in range(4):
#if count%2 == 1:
# rectangle.forward(200)
#else:
# rectangle.forward(100)
rectangle.forward(forward)
forward = wid... | true |
665fc2c5e8ccd96d186ce7e604da1c4980617fc6 | damilarelana/flaskiblog | /awokogbon/db.py | UTF-8 | 1,796 | 3.046875 | 3 | [] | no_license | import sqlite3
import click
from flask import current_app, g
from flask.cli import with_appcontext
def open_db(): # open_db() handles connection to the Sqlite [to setup a db pool to use]
if 'db' not in g: # is a flask special object used to pool db connections
g.db = sqlite3.connect(current_app.config['... | true |
5ee16acf74400849a5943a7a4e50881b986784d7 | joernalraun/calliope-mini-stubs | /calliope_mini/toplevel_functions.py | UTF-8 | 930 | 3.375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # source/microbit/modmicrobit.cpp
def panic(n: int = 9999) -> None:
"""
Enter a panic mode.
To leave this mode, restart the Calliope mini (remove/apply power or press
the reset button).
Pass in an arbitrary integer to indicate a status::
calliope_mini.panic(255)
"""
def reset() -> N... | true |
b7779f509f6ec97ff0d98e9771cda17eb51101c6 | skipperkongen/ml-in-finance | /ex_bolling_bands.py | UTF-8 | 419 | 2.71875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
from util import *
df = get_data(['GOOG'], '2015-01-10', '2016-01-01')
rm = get_rolling_mean(df)
rstd = get_rolling_std(df)
lower_band, upper_band = get_bollinger_bands(rm, rstd)
ax = df.plot(title='Bollinger Bands', label='SPY')
rm.plot(label='Rolling mean', ax=ax... | true |
9bdc1ea41f924fe6f8aa062b5cfbdf6a818045b9 | EECS388-F19/lab-zdesira | /helloworld.py | UTF-8 | 237 | 3.59375 | 4 | [] | no_license | import random
from random import randint
first = random.randint(0, 100)
second = random.randint(0, 100)
print("Zachary Desira")
print(first)
print(second)
x = first + second
print ("Sum = " + str(x))
avg = x / 2.0
print ("Average = " + str(avg)) | true |
3dbe9dd890e516c40dd69cc53fdc6cb285da6a63 | emisaycheese/Machine-learning-algos-from-scratch | /KNN.py | UTF-8 | 4,178 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 15 22:32:05 2019
@author: ruiqianyang
"""
import csv
import random
import math
import operator
def loadDataset(filename, split, trainingSet=[] , testSet=[]):
with open(filename, 'rb') as csvfile:
lines = csv.reader(csvfile)
dataset = l... | true |
ba6afb46e77c068d95c7d909c275675cf5b539c2 | bartounet/RedCloud | /scripts/GeoScale/extractDonneesGPS.py | UTF-8 | 2,901 | 2.890625 | 3 | [] | no_license | #! /usr/bin/python
import numpy as np
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
import sys
import os
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.... | true |
1e5f97ecdd60c1f4afb5b78c2d30fbdfaf08dba9 | DoubleBite/BERT-GNN-Dependency | /libs/tools/utils.py | UTF-8 | 219 | 2.5625 | 3 | [] | no_license | import numpy as np
from Levenshtein import distance, ratio
def find_closest_candidate(target, candidates):
distances = [distance(target, x) for x in candidates]
return candidates[np.argmin(distances, axis=0)]
| true |
86d28276f8afea62b4c63661e487a71085020fe9 | Ragz875/PythonLearning | /Arrays/Matrix/Kweakestrows.py | UTF-8 | 612 | 3.671875 | 4 | [] | no_license | """
Given a m * n matrix mat of ones (representing soldiers) and
zeros (representing civilians), return the indexes of the k weakest rows in the matrix
ordered from the weakest to the strongest.
"""
def kweakestrows(mat,k):
weaks = [ (sum(row), index) for index, row in enumerate(mat) ]
print(weaks)
weaks.s... | true |
3cab24d7931c6dfbdb11deab728d991a2deea39f | DenisCB/doodle_recognition | /models.py | UTF-8 | 1,095 | 2.515625 | 3 | [] | no_license | from app import db
import datetime
def generate_filename():
last_obj = Drawings.query.order_by(-Drawings.id).first()
if last_obj:
max_id = last_obj.id + 1
else:
max_id = 1
return 'doodles/{}_{}.jpg'.format(max_id, datetime.datetime.now())
class Drawings(db.Model):
id = db.Column(... | true |
497744480e2d191963e4b03721d2ef87470f2094 | imimran/py-practice | /magic-method.py | UTF-8 | 439 | 3.125 | 3 | [] | no_license | class MyClass:
"""A custom class for nothing"""
def __init__(self, var):
self.var = var
def __del__(self):
del self.var
def __gt__(self, other):
return len(other) > len(self.var)
def __lt__(self, other):
return len(other) < len(self.var)
def __ge__(self, othe... | true |
9d671f0779255bb7903d6d9ab8d7e52c03dadd54 | SweetWeakness/mipt-python19 | /Seminar11/app/handlers.py | UTF-8 | 2,765 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import telebot
from app import bot, NAME, SURNAME, AGE
@bot.message_handler(commands=['start'])
def handle_start(message):
bot.send_message(message.chat.id, 'Привет! Я - тестовый бот. Поговори со мной.')
@bot.message_handler(commands=['help'])
def handle_help(message):
bot.send_messa... | true |
8e2abef61d4fe00c19493abead870f2b858a920e | mximac/SPACE-INVADERS | /programowanie_wygranko.pyde | UTF-8 | 7,064 | 2.9375 | 3 | [] | no_license | class statek():
def __init__(self):
self.x=450
self.y=850
self.left=0
self.right=0
def display(self):
rect(self.x,self.y,100,100)
fill(255,0,0)
def update(self):
self.x = self.x + (self.right - self.left)
global pozycjastatku
pozycjasta... | true |
1f9c1220051628e48590a7489e21501c8e06e8d4 | ZivaUrbancic/SmarnaGora | /src/cancel_critical_sx.py | UTF-8 | 8,450 | 2.921875 | 3 | [
"MIT"
] | permissive | from random import choice
from collections import defaultdict
from numpy import infty
from itertools import combinations, chain
import time
def simplex_closure(a):
"""Returns the generator that iterating over all subsimplices (of all dimensions) in the closure
of the simplex a. The simplex a is also included.... | true |
d92827acf605f3922157a15b483fa3465586bcb9 | stefan-mrazik/jmap-proxy-python | /jmap/errors.py | UTF-8 | 8,196 | 2.53125 | 3 | [
"MIT"
] | permissive | class JmapError(Exception):
"Base JMAP Exception"
def to_dict(self):
out = {'type': self.__class__.__name__}
desc = str(self)
if desc:
out['description'] = desc
return out
class accountNotFound(JmapError):
"The accountId does not correspond to a valid account."
... | true |
b6b446750d5b437ffc2e991957fd73a978436c91 | Jack1shao/wbw | /stock/old/ths_boll.py | UTF-8 | 1,484 | 3.59375 | 4 | [] | no_license | #布林线
#初始化变量
周期 = 20 #用于计算中轨和标准差的周期
倍数 = 2 #用于计算上轨和下轨的倍数
收盘价列表=[] #新建收盘价列表
#获取K线数据
for i in range(0, total):
最高价 = get("最高价",i) #获取最高价
开盘价 = get("开盘价",i) #获取开盘价
最低价 = get("最低价",i) #获取最低价
收盘价 = get("收盘价",i) #获取收盘价
收盘价列表.append(收盘价) #将收盘价储存在"收盘价列表"中, 用于后续计... | true |
021cdb459ff70ef10d22c03188852907f76f1b1f | miriamvall/DD142X | /code/model/genData.py | UTF-8 | 13,673 | 3.609375 | 4 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from math import pi
# Samples a distribution N(meanV, varM)
# Specifically, meanV = [mean, mean, mean, ...] of dimension dims
# varM = var * I where I is the dims * dims identity matrix
### Currently unnecessarily complicated for its' output
### Can be easily modified... | true |
a9f991a12a8f8e804eb629ba8c45a061d27784b7 | peterlavin/pytest-101 | /calculator.py | UTF-8 | 1,454 | 4.0625 | 4 | [] | no_license | import numbers, sys
class CalculatorError(Exception):
""" An exception class for calculator """
class Calculator:
"""" A sample simple calculator """
def add(self, a: int, b: int) -> int:
self._check_operand(a)
self._check_operand(b)
return a+b
def subtract(self, a: int, b: in... | true |
c93e80e7d43af471ea1a84cc8903063fdf5af096 | Ac1d-Md-Shehabul-Islam/Data-Structure | /Object Oriented Programming/variable_overriding.py | UTF-8 | 606 | 4.25 | 4 | [] | no_license | class Animal:
def __init__(self,name):
self.name = name
self.color = "White"
def eat(self):
print(self.color,self.name,"is eating")
#===========================================================================
class Dog(Animal):
def __init__(se... | true |
4c4f11438c54edee954d2846b8b116237b9666f3 | raynald/ETH_BBBigData | /global_meanvar_mapper.py | UTF-8 | 1,133 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import re
import numpy as np
codeSet = {'PRCP':0, 'SNOW':1, 'SNWD':2, 'TMAX':3, 'TMIN':4}
feature = []
feature += [np.array([])]
feature += [np.array([])]
feature += [np.array([])]
feature += [np.array([])]
feature += [np.array([])]
def main(argv):
line = sys.stdin.readline()
t = ... | true |
d9d6484a08d1b16a1fbe1e7927dc043511530602 | arboreus/project_euler | /problem_040.py | UTF-8 | 739 | 3.953125 | 4 | [
"MIT"
] | permissive | #40) Champernowne's constant
#An irrational decimal fraction is created by concatenating the positive integers:
#0.12345678910 1 112131415161718192021...
#It can be seen that the 12th digit of the fractional part is 1.
#If dn represents the nth digit of the fractional part, find the value of the following expressio... | true |
46de1981e2f9540fdad6aee590f8511f4b3c5aba | AngelaRT/tailor_drawer | /PHOTOBOOTH/cod_python/cool_photobooth.py | UTF-8 | 13,271 | 3.046875 | 3 | [
"MIT"
] | permissive | #! /usr/bin/python2.7
'''
Tim Stephens http://www.tjstephens.com
03May2014
This is the photobooth application.
The app starts with a photo gallery that loads some images from a previously used storage directory, and then displays them in a nice grid.
Next, it'll wait for input from the pushbutton - using a callback ... | true |
d85044f06431530f50f5e57b009a88b3e3256308 | Leopoldarroyo25/progavanzada | /ejercicio7.py | UTF-8 | 295 | 3.734375 | 4 | [] | no_license | #(Ejercicio 7.)
#(Escruba un programa que lea un numero positivo(n). insertado por el usuario y despúes despliegue la suma de todos los eneteros desde 1 hasta n positivos puede calculado usando la formula.)
n= int(input('ingresa tu numero'))
operacion= int((n*(n+ 1))/2)
print(operacion) | true |
b0cfd39d63f42e7056573b5c9a1c7cb26243e0fa | savadev/interviewbit | /Linked Lists/sort-list.py | UTF-8 | 1,884 | 3.84375 | 4 | [] | no_license | '''
Sort a linked list in O(n log n) time using constant space complexity.
Example :
Input : 1 -> 5 -> 4 -> 3
Returned list : 1 -> 3 -> 4 -> 5
'''
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param A : ... | true |
551e833a608c71e3556137e8e1cf676131fa30d1 | vivtalla/NBA-DataAnalysis | /SourceCode/NBAAnalysis-SeasonStatsVsSalary (1).py | UTF-8 | 5,914 | 3.625 | 4 | [] | no_license |
# coding: utf-8
# In[2]:
get_ipython().magic(u'matplotlib inline')
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="darkgrid")
# In[3]:
df = pd.read_csv('Seasons_Stats.csv')
# In[4]:
df
# In[5]:
df.drop(df.index[:9547], inplace=True)
# We are... | true |
0e64facf999d41280a16380938e1ef328743d725 | Woody-1018/Python-Autotest_learning | /test20170815/Webdriver API/4.鼠标事件.py | UTF-8 | 1,677 | 3 | 3 | [] | no_license | # ActionChains 类鼠标操作的常用方法:
# context_click() 右击
# double_click() 双击
# drag_and_drop() 拖动
# move_to_element() 鼠标悬停在一个元素上
# click_and_hold() 按下鼠标左键在一个元素上
from selenium import webdriver
# 引入鼠标操作API
from selenium.webdriver.common.action_chains import ActionChains
import time
# 定义浏览器
driver = webdriver.Chrome()... | true |
6956b54d4ea74b7900b48ae4db7b8cfe75dda22b | abhisassy/Simple-Data-Analytics | /IDS-Assg.py | UTF-8 | 8,759 | 3.109375 | 3 | [] | no_license |
# coding: utf-8
# # IDS ASSIGNMENT-1
Abhishek Saseendran 01FB16ECS018Akash Bhat 01FB16ECS038
# In[15]:
import csv
#create the file required
file1=open("C:/Users/jedib/Desktop/3sem/IDS/PROJECT/apy.csv")
file2=open("C:/Users/jedib/Desktop/3sem/IDS/PROJECT/Dharwad.csv","w",newline="")
file3=open("C:/Users/jedib/De... | true |
4b655608f8398692c28ca98e39291340429ff692 | akaliutau/cs-problems-python | /problems/greedy/Solution621.py | UTF-8 | 1,141 | 3.328125 | 3 | [
"MIT"
] | permissive | """ Given a characters array tasks, representing the tasks a CPU needs to do,
where each letter represents a different task. Tasks could be done in any
order. Each task is done in one unit of time. For each unit of time, the CPU
could complete either one task or just be idle.
However, there is a non-n... | true |
3fabf0242a8d6dd85a56c1b3abbe9b2fd26ba224 | yogii1981/Fullspeedpythoneducative1 | /experitnpython/EIPC7.py | UTF-8 | 241 | 3.546875 | 4 | [] | no_license | import math
print(int(math.sqrt(16)))
# calaculate the area of circle
r = 27.6
import math as m
print(m.pi * r ** 2)
print("The ceil of r is:", r, end=" ")
print(math.ceil(r))
print("the floor of r is:", r, end=" ")
print(math.floor(r))
| true |
ef2905450c96671bba63a51b0eab60c1c2348bff | eggeek/MCPC-Workshops | /Orientation/src/lowb0.py | UTF-8 | 141 | 3.140625 | 3 | [] | no_license | def lowb(x):
p = 0
while x:
# if p-th digit is 1, return 2^p
if x & 1: return 1<<p
x >>= 1 # x = x / 2
p += 1
return 0
| true |
85737ff028a650131157f7bf027561865747d919 | catapult-project/catapult | /third_party/google-endpoints/Crypto/Hash/hashalgo.py | UTF-8 | 3,984 | 3.453125 | 3 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | true |
3e5087cd5001d1d5c6990f4b31dea0a06966c359 | framaciotti/HINPy | /hinpy/diversity/truediversity.py | UTF-8 | 510 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from .utils import *
def TrueDiversity(P,alpha,renormalize=False):
# Convert, check, trim, and renormalize
P=np.array(P)
CheckDistribution(P)
# P=TrimDistribution(P)
if renormalize:
P=RenormalizeDistribution(P)
# Computing the True Diversity
if alpha==0:
r... | true |
bc5b82aaf597c22d9558e76463bf7b3dbb19544e | GlitchAyub/Python-Q-A | /6.py | UTF-8 | 750 | 3.609375 | 4 | [] | no_license | '''6:festival budget for 2000 is anounced inr 10000/- and every year it will increade by 10%.
write a recursuve function to calculate total expense till 2020'''
def fes(year,budget):
if year == 2000 :
return budget
else:
year-=1
return fes(year, budget+1000... | true |
ffe2b1fd391ce9fb88810e8ff32f3d4940bc702a | 7kia/AIServer | /src/ai/game_components/move_direction.py | UTF-8 | 1,274 | 2.921875 | 3 | [] | no_license | import math
from enum import Enum
from typing import List
from src.ai.game_components.position import Position
# 7kia В качестве вектора был выбран единичный вектор
class MoveDirection(Enum):
up: Position = Position(0, 1)
up_right: Position = Position(math.sqrt(0.5), math.sqrt(0.5))
right: Position = Pos... | true |
7efb08a2e6582ee3d0646a6179726007fe767273 | oscarliz/Ejercicios-esencia-de-la-logica | /Programa que acepta una frase y determine la cantidad de letras al igual que de la palabras que tiene la misma.py | UTF-8 | 470 | 4.15625 | 4 | [] | no_license | print("Programa que acepta una frase y determine la cantidad de letras al igual que de la palabras que tiene la misma")
text = input("Escriba una frase para comenzar el conteo:")
text2 = len(text.split(" "))
text3 = len(text)
if text2 > 1:
text2 = len(text) - len(text.split(" "))
print("Numero de letras:",te... | true |
628069f1c9643f17e90af11873e5cd48dbdd522c | jashby360/Python-Playground | /PythonEx3/ch12.1.py | UTF-8 | 2,759 | 4.3125 | 4 | [] | no_license | from math import sqrt
# UML Diagram UML Diagram
# GeometricObject Triangle
# --------------------------- ---------------------------
# -color: str -side1: float
# -filled: bool -side2: float... | true |
d3673de86cf79449bdade52cab773acac0b56d3d | Christine1225/Leetcode_py3 | /13.py | UTF-8 | 850 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 6 18:32:27 2018
@author: Abigail
"""
class Solution:
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
dic = {"M":1000,"CM":900,"D":500,"CD":400,"C":100,"XC":90,"L":50,"XL":40,"X":10,"IX":9,"V":5,"IV":4,"I":1}
... | true |
06694f65654a953847ea87d17dcfd8ada7ba7a3b | codingjerk/dotfiles | /tools/motd.py | UTF-8 | 10,912 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import collections
import datetime
import os
import shutil
from typing import Any, Callable, List, Optional
Partition = collections.namedtuple("Partition", [
'device',
'mountpoint'
])
Meminfo = collections.namedtuple('Meminfo', [
'total',
'free',
'cached',
'used',
])
... | true |
4ee906a81ab7663d17363bbcdb89c2a33f27d33c | BubblyFace/Algorithm-practice | /src/old_practice/646. Maximum Length of Pair Chain.py | UTF-8 | 679 | 3.25 | 3 | [] | no_license | class Solution(object):
def findLongestChain(pairs):
"""
:type pairs: List[List[int]]
:rtype: int
"""
lenth = len(pairs)
if not any(pairs) or len(pairs) > 1000:
return
MaxLen = 1
sorted_pairs = sorted(pairs, self.compare)
i = 1
... | true |
ce872ccab359a327989c1d03bfba98d18838dbb9 | nanovche/accounting-web-app | /accounting/apps/acc/models.py | UTF-8 | 1,440 | 2.875 | 3 | [] | no_license | from datetime import date
from django.db import models
from django.db.models import DecimalField
class Product(models.Model):
name = models.CharField(max_length=255, blank=True)
price = models.IntegerField()
quantity = models.IntegerField()
class Service(models.Model):
WATER_SUPPLY = 'Water'
E... | true |
3d449e4f4e9fe2ceb8f0f29ef402a0e39d3f1067 | an-tran528/kaggle-petfinder | /metadata_parsing.py | UTF-8 | 6,979 | 2.5625 | 3 | [] | no_license | # Fork from Wojtek Rosinski's kernel https://www.kaggle.com/wrosinski/baselinemodeling
# ADD SENTIMENT and META DATA FEATURES
class PetFinderParser(object):
def __init__(self, debug=False):
self.debug = debug
self.sentence_sep = ' '
# Does not have to be extracted bec... | true |
9175d98914517e87c12cb1a4f28104e5debcb213 | Manishthakur1297/Python-Examples | /py2.py | UTF-8 | 504 | 3.671875 | 4 | [] | no_license | def count_substring(string, sub_string):
c=0
str = string
while(True):
n = str.find(sub_string)
if(n!=-1):
# n1 = str.index(sub_string)
#print(n," str = ", str)
str = str[n+1:]
c+=1
#print(n," str = ", str)
else:
... | true |
b9a6f72376c753e26626f44cbefe8aa4dabc3e5f | priyankanagaraj1494/ML_basic_codes | /ML_basics/cv.py | UTF-8 | 738 | 2.734375 | 3 | [] | no_license | import tensorflow as tf
import matplotlib.pyplot as plt
print(tf.__version__)
mnist= tf.keras.datasets.fashion_mnist
(ti,tl),(tri,trl) = mnist.load_data()
#normalizing
ti = ti/255.0
tri = tri/255.0
plt.imshow(ti[1])
print(ti[1])
print(tl[1])
#model
model= tf.keras.models.Sequential([tf.keras.layers.Flatten(),
... | true |
06ecd31283e8758457ef04a68702e45291546def | Irobot5/robocar | /Line_follower/line_follower.py | UTF-8 | 4,371 | 2.96875 | 3 | [] | no_license | #1 1 1 forward (in the crossroads)
#0 0 0 turn around to find a line
#1 0 0 turn left (back to line)
#0 1 0 forward
#0 0 1 turn right (back to line)
#1 1 0 turn left (on the corner, with 90 degrees)
#1 0 1 ???
#0 1 1 turn right (ont the corner, with 90 degrees)
import signal, os
import RPi.GPIO as GPIO
impor... | true |
e4aa111123b9a602cbce8559bc15be6ef38abe82 | KaygoYM/Python-and-Tensorflow-learning | /Python_basic/sklearn8.py | UTF-8 | 1,284 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 7 09:39:27 2017
@author: hamch
"""
#交叉验证
#from sklearn.learning_curve import learning_curve
from sklearn.learning_curve import validation_curve
from sklearn.datasets import load_digits
from sklearn.svm import SVC
import matplotlib.pyplot as plt
import numpy a... | true |
8d48038b6468e39317698cf2223c9dcab1873473 | DiegoLins10/PyTube | /teste.py | UTF-8 | 338 | 3.140625 | 3 | [] | no_license | app =Tk() ##intanciando a classe
app.title("Youtube video download")
app.geometry("500x300") ## config tamanho janela
##app.configure(background="#008") ## mudar cor
txt1 = Label(app, text="Youtube",background="#ff0", foreground="#000") ##declarar label
txt1.place(x=10, y=10, width=150, height=30) ## posicionando o lab... | true |
a9c5930a7745da966b89b2f0c47d11446b726e48 | codergirlstl/finalpythonproject | /RenameFile.py | UTF-8 | 737 | 3.6875 | 4 | [] | no_license | import os
import os.path
#Get path from current directory and print
directory_path = os.getcwd()
print("My current directory is : " + directory_path)
folder_name = os.path.basename(directory_path)
#List all the files in the directory and print
directory_files=os.listdir(directory_path)
print(directory_files)
#Let th... | true |
d6a58a3228d4866c5be19f2c91de738c330a50b1 | lihuasheng1234/djjk | /test/测试类定时装饰器.py | UTF-8 | 1,144 | 3.28125 | 3 | [] | no_license | import time, datetime
from functools import wraps
class Foo:
def __init__(self):
self.start_time = datetime.datetime.now()
self.start_time2 = datetime.datetime.now()
self.dic = {}
@property
def now(self):
return datetime.datetime.now()
def clothes(snap_time):
de... | true |
98545bab6bfbdb612c4f33a1ec3b3fa3095e1df5 | 022ey/Python_Scripts | /pdf2image/pdf2img.py | UTF-8 | 1,225 | 2.75 | 3 | [
"MIT"
] | permissive | import os,sys,fitz
if len(sys.argv) != 2:
pdf_path = input("Please enter pdf name(with extention) : ")
else:
pdf_path = sys.argv[1]
# for command line usage : python pdf2img.py main.pdf
# pdf_path = 'main.pdf'
# CHECK IF Path exist
if not os.path.exists(pdf_path):
print("path does not exist, pdf mu... | true |
6e11638e10ec06145d1249d4f24ea2f893c02c01 | IARHeritages/HeritageTribalism_BigData | /codes/python/05_01_Topic_model.py | UTF-8 | 7,452 | 2.578125 | 3 | [
"MIT"
] | permissive | ### Topic model ###
## This code creates the LDA topic model for the unique tweets in the dataset, for topic numbers n = 2:28,
## it calculates the coherence scores for the topic and creates and intertopic-distance visualisation for the model with the highest coherence score, with the LDAvis.
## Then it also assignes t... | true |
78594339f8d7914c2d8ca7601a28704427ac6dd3 | leefige/Ensemble-Learning-Sentiment-Analysis | /scripts/feature.py | UTF-8 | 6,224 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
#-*- coding: UTF-8 -*-
import math
import random
from util import *
from sklearn.feature_extraction.text import TfidfVectorizer
negPrefix = "NOT_"
negaWords = set(["不", "不是", "没", "没有", "木有"])
stopWord = set(["的", "你", "我", "地", "得", "了", "很"])
punc = set([',', '。', '!', '~', '?', '、', '…', ... | true |
e0b9996cd82857af498feaa996a4270e6e7ba2f7 | jamesharrop/HackerRank-Solutions | /Day 11 2D Arrays.py | UTF-8 | 1,531 | 3.53125 | 4 | [
"MIT"
] | permissive | # TODO: Needs refactoring to address scope of variable arr
def cell(x,y):
if x<0 or y<0 or x>5 or y>5:
return None
else:
return(arr[x+6*y])
class hourglass:
def __init__(self, arr, x, y):
self.arr = arr
self.hourglass = []
self.hourglass.append(cell(x, y))
s... | true |
94a6b0d74d53885b976171e1526f3e4c3b2b1c25 | guyrom27/CryoEmSvm | /src/ChimeraUtils/chimera_display_results.py | UTF-8 | 1,074 | 2.640625 | 3 | [] | no_license | import chimera
from VolumeViewer import volume_from_grid_data
from VolumeData import Array_Grid_Data
import numpy as np
import sys
def display(matPaths):
"""
Places list of density maps (supplied as paths to numpy matrices)
in chimera session.
:param matPaths: list of paths of numpy matrices
:ret... | true |
1dd10f87e6e7133372d40e370e70e57247a6d290 | DanhelMerVe/Mision-08 | /mision8.py | UTF-8 | 3,739 | 4.46875 | 4 | [] | no_license | # Danhel Alejandro Mercado Velasco
# Promagra con listas
# Lista con la suma acumulada de los datos
def sumarAcumulado(lista):
listanueva = []
suma = 0
for numero in lista:
suma = suma + numero
listanueva.append(suma)
return listanueva
# Lista que regresa los datos pero s... | true |
26f55da9bae81b3a5c69f312af862768f19aae81 | Vasvi1599/count | /count.py | UTF-8 | 194 | 4.03125 | 4 | [] | no_license | # most_frequent function
from collections import Counter
def most_frequent(s):
counter=Counter(s)
return counter
s=input("Please enter a string: " )
print(most_frequent(s))
| true |
35f7e0ac44907212e30a31ad806330d51823e740 | VirtualPlants/tissuelab | /tissuelab/omero/gateway_ome500_ice351/omero/plugins/tag.py | UTF-8 | 23,026 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tag plugin for command-line tag manipulation
:author: Sam Hart <sam@glencoesoftware.com>
Copyright (C) 2013 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import platform
import subprocess
import sy... | true |
3b6c57adc2aefedc2f2a5877646b048249c3749e | theconsummate/practice | /github-navigator/application.py | UTF-8 | 2,093 | 2.796875 | 3 | [] | no_license | from flask import Flask, render_template, request
from jinja2 import Environment, FileSystemLoader
import requests, json, os, datetime
app = Flask(__name__)
app.debug = True
# Define the template directory. This is the current directory in our case
tpldir = os.path.dirname(os.path.abspath(__file__))
# Setup the temp... | true |
c96ee8757e3e721fca955ba8d2b98919944d0363 | SchneiderJM/WSBDB_Data_Fetcher | /main.py | UTF-8 | 4,901 | 2.6875 | 3 | [] | no_license | #Imports and setting up the reddit API
from flask import Flask, jsonify, request
import pandas as pd
import os
import mysql.connector
import csv
app = Flask(__name__)
@app.route("/")
def hello_world():
#Loads in my db credentials
t = csv.reader(open('./dbcredentials.csv','r'),delimiter=',')
credentials = []
for ... | true |
0341eee36d81b7dc4fa84cffb9c3949129af6c14 | zznixt07/pythonproject | /dijkstras_algorithm.py | UTF-8 | 5,411 | 3.078125 | 3 | [] | no_license | #! python3
# ------- an unoptimized imlementation of Dijkstra's algorithm
#-------- Doesnt support graph with multiple edges between two nodes and self-loop
from pprint import pprint
# a,b,c,d,e
# matrix = [
# [0 ,4 ,8 ,0 ,0],
# [4 ,0 ,0 ,2 ,0],
# [8, 0, 0, 1, 7],
# ... | true |
2f2da01094874f2acb0806afc5b9bd39f412ca36 | TheApertureProject/Yume-Bot | /modules/sql/sanctions.py | UTF-8 | 1,898 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright (c) 2020.
# MIT License
#
# Copyright (c) 2019 YumeNetwork
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... | true |
8b3defa269f83eb453b2275ca9b431ac87157828 | Rohanpatki1995/HackerRank | /29_Itertools_Permutation().py | UTF-8 | 138 | 3.109375 | 3 | [] | no_license | import itertools
s,k=input().split()
result=list(itertools.permutations(sorted(s),int(k)))
for item in result:
print(''.join(item))
| true |
046be694a1d9d8cde5dec49e8f96ecc779e8632d | limgeonho/Fast_Campus_Algo | /유형별풀이/그래프기본탐색알고리즘/1697_숨바꼭질.py | UTF-8 | 297 | 2.8125 | 3 | [] | no_license | # 숨바꼭질
n, k = map(int, input().split())
array = [0] * 100001
q = [n]
while q:
now = q.pop(0)
if now == k:
break
for i in (now+1, now-1, 2*now):
if 0 <= i < 100001 and not array[i]:
array[i] = array[now] + 1
q.append(i)
print(array[k]) | true |
a329342c3ecbab61d4e37c482c0a25b3302beb78 | QiuHongHao123/Algorithm-Practise | /Greedy/用最少数量的箭引爆气球L452.py | UTF-8 | 1,068 | 3.46875 | 3 | [] | no_license | from typing import List
class Solution:
"""
一支弓箭可以沿着 x 轴从不同点完全垂直地射出。在坐标 x 处射出一支箭,
若有一个气球的直径的开始和结束坐标为 xstart,xend, 且满足 xstart ≤ x ≤ xend,则该气球会被引爆。可以射出的弓箭的数量没有限制。
弓箭一旦被射出之后,可以无限地前进。我们想找到使得所有气球全部被引爆,所需的弓箭的最小数量。
"""
def findMinArrowShots(self, points: List[List[int]]) -> int:
"""
贪心... | true |
c5ced0ac99db5633a8cf6e3c2d1e14e1e96fb598 | jlu-ilr-hydro/odmf | /odmf/migration_util/cuahsi/update_transformedvalues.py | UTF-8 | 6,524 | 2.5625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# Updates the transformed timeseries values due to migration reasons
#
# Purpose of this script
#
# 1. Delete already existing temporary records of transformed timeseries
#
# 2. Create records in the record-table from transformed timeseries datasets
# and from recent values, which the transfor... | true |
de0b3f973073fd12f217306bc95532a952ab24d8 | seanlopez/python-new-test | /threading_test/Event_test.py | UTF-8 | 1,034 | 3.15625 | 3 | [] | no_license | import threading,time
event = threading.Event()
counter = 0
def redlight():
event.set()
global counter
while True:
counter = counter + 1
if counter > 5 and counter < 10:
print("\033[41;1mredlight is on,please waiting ....\033[0m")
event.clear()
... | true |
2126ee2d782ea587059a6e35fd3728d9394fda66 | lynch456/Python-review | /OthersControl.py | UTF-8 | 526 | 2.9375 | 3 | [] | no_license |
#######################################
#
# Others Control
# 기타 제어문
#
#######################################
# break 문
#
# 반복문 (while, for)에서 원하는 시점에 반복문을 탈출할 때 사용됨
# 조건문과 함께 사용됨
print("")
# continue 문
#
# 반복문의 제어흐름을 처음으로 돌리는 문법
# while문 일 경우 조건으로 돌아가서 조건을 다시 검사
# for문 일 경우 반복가능객체로 돌아가서 남은 요소가 있는지 확... | true |
9e14642b0576915e14a8833476a69eacc6b3d50d | AnjaliCAbraham/S1-A-Anjali-C-Abraham | /programing lab/17-01-2021/biggest(1).py | UTF-8 | 333 | 3.75 | 4 | [] | no_license | num1=int(input("Enter the first number: "))
num2=int(input("Enter the second number: "))
num3=int(input("Enter the third number: "))
if (num1>num2)and(num1>num3):
print("{} is biggest number".format(num1))
elif num2>num3 and num2>num1:
print("{} is biggest number".format(num2))
else:
print("{} is biggest number".... | true |
75f826d33fd977863c1a95bfb28405e3f6cd8e63 | DarkMemem/Homework | /HomeworkLesson10/23_Reverse_of_the_list.py | UTF-8 | 191 | 3.171875 | 3 | [] | no_license | from random import randint
lst = [randint(10, 50) for _ in range(20)]
print(lst)
for i in range(len(lst) // 2):
lst[i], lst[len(lst)-1-i] = lst[len(lst)-1-i], lst[i]
print(lst) | true |
f004b37e0fb778cb77bdf0ee6c64e2205fbc1631 | Rrawla2/Data-Structures | /hash_table/find_single_number.py | UTF-8 | 288 | 3.515625 | 4 | [] | no_license | def csFindTheSingleNumber(nums):
nums_dict = {}
for num in nums:
if num not in nums_dict:
nums_dict[num] = 1
elif num in nums_dict:
nums_dict[num] -= 1
for key, value in nums_dict.items():
if value == 1:
return key | true |
294c90163a56b234579bf46ce0fcd454877be2ff | histonemark/BioinformaticAlgorithms | /compute_freqs.py | UTF-8 | 849 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
def pattern_to_number(pattern):
symbols = {'A': 0, 'C': 1, 'G': 2, 'T': 3}
if pattern == '':
return 0
symbol = pattern[-1]
prefix = pattern[:len(pattern) - 1]
return 4 * pattern_to_number(prefix) + symbols[symbol]... | true |
e032149d1619b9743486df0e9293f365e72099fd | cplyon/leetcode | /design/log_storage_system.py | UTF-8 | 6,564 | 3.203125 | 3 | [] | no_license | #! /usr/bin/env python3
from datetime import date, datetime
from calendar import monthrange
class LogSystem:
def __init__(self):
self.logs = []
self.indices = {
"Year": 5,
"Month": 8,
"Day": 11,
"Hour": 14,
"Minute": 17,
"Sec... | true |
75b66166ea2437fcae007a32d87476705d469943 | tmu-nlp/100knock2016 | /ryosuke/chapter06/knock56.py | UTF-8 | 2,096 | 3.03125 | 3 | [] | no_license | import xml.sax as sax
from collections import defaultdict
class StanfordCoreXMLHandler(sax.handler.ContentHandler):
def __init__(self):
self.tags = list()
self.sentences = list()
self.correferences = defaultdict(list)
self.is_mention = False
self.is_representative = False
... | true |
341572bdd70ef7ca135509573db716f7caec1780 | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc083/B/4925616.py | UTF-8 | 240 | 2.875 | 3 | [] | no_license | N,A,B=[int(i) for i in input().split()]
ans=0
for i in range(1,N+1):
L=len(str(i))
count=0
for j in range(L):
count=count+int(str(i)[j])
if A<=count<=B:
ans+=i
else:
continue
print(ans) | true |
5932506554c48c1e89eaee339473879f579a9b83 | agvaibhav/searching-sorting | /insertion-sort-recursive.py | UTF-8 | 301 | 3.765625 | 4 | [] | no_license | def insertionSort(arr,n):
if n<=1:
return
insertionSort(arr, n-1)
last = arr[n-1]
j=n-2
while(j>=0 and arr[j]>last):
arr[j+1] = arr[j]
j-=1
arr[j+1]=last
arr = [15,1,48,97,35,68]
insertionSort(arr, len(arr))
print("sorted array is {}".format(arr))
| true |
aa1c02d09c70c51482fcd1e82b9b4fa4579ffda9 | schans/aoc2020 | /05/seat2.py | UTF-8 | 250 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
import fileinput
S = set()
for line in fileinput.input():
S.add(int(line.replace('F', '0').replace('B', '1').replace('L', '0').replace('R', '1'), 2))
print("max", max(S))
print("missing", set(range(min(S), max(S))) - S)
| true |
d936de6fda92ad06e9c0fa842481e26586a33a22 | seahrh/coding-interview | /src/sortingandsearching/tests/test_apartments.py | UTF-8 | 705 | 2.75 | 3 | [
"MIT"
] | permissive | from sortingandsearching.apartments import *
class TestApartments:
def test_one_apartment_one_applicant(self):
assert allocate(apartments=[30], applicants=[25], tolerance=5) == 1
assert allocate(apartments=[30], applicants=[5], tolerance=5) == 0
def test_zero_allocation(self):
... | true |
b4d7b8fb9c46e22a7af28b54bd1185dc24808893 | xiaozuo7/algorithm_python | /offer/VerifySquenceOfBST.py | UTF-8 | 1,299 | 3.796875 | 4 | [] | no_license | #!/usr/local/anaconda3/bin/python3
# -*- coding: utf-8 -*-
"""
输入一个整数数组,判断该数组是不是某二叉搜索树的后序遍历的结果。
如果是则输出Yes,否则输出No。假设输入的数组的任意两个数字都互不相同。
思路:后续遍历 最后一个数是root 前面可以分为 左子树 (比root小) 和 右子树(比root大) 递归判断即可
@author: xiaozuo
"""
class Solution:
def VerifySquenceOfBST(self, sequence):
# write code here
if not se... | true |
3e8ddee53b6dbe09d6a7f79eb66de79ff74bdfe2 | jeroenmeulendijks/gdax-tradebot | /exchange/OHLC.py | UTF-8 | 3,457 | 2.6875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | import threading
import time
import datetime
import logging
from config import *
class RepeatingTimer(object):
def __init__(self, interval, f, *args, **kwargs):
self.interval = interval
self.f = f
self.args = args
self.kwargs = kwargs
self.timer = None
def callback(sel... | true |
da664973a2f8bef7d008c4acf3156f1ee1757171 | ShazbotLabs/slim | /src/slim/file_tools.py | UTF-8 | 398 | 2.8125 | 3 | [
"MIT"
] | permissive | import os
import json
from typing import List, Any
def list_projects(path: str) -> List[str]:
file_list = []
for entry in os.scandir(path):
if entry.name.endswith('.json'):
file_list.append(entry.name)
return file_list
def read_json_file(project_file: str) -> Any:
with open(pr... | true |
751978022f89d65e39b6765832effdb8068d86fe | craighillelson/snow_reporting | /functions.py | UTF-8 | 959 | 3.140625 | 3 | [] | no_license | """ __doc__ """
import codecs
import csv
from collections import namedtuple
RTN = lambda: '\n'
def format_days(a, b):
""" format days as floats to the second decimal """
b = '{0:.2f}'.format(a)
return b
def format_percentage(a, b):
per = float(a / b) * 100
per_fmt = '{0:.2f}'.format(per)+'%'
... | true |
f6066f64e2425f2685e4a82dbd3e36a347c28ee3 | TobiLang/word_embeddings | /glove/glove.py | UTF-8 | 4,039 | 3.15625 | 3 | [
"MIT"
] | permissive | '''
Word 2 Vec in Keras
See: https://adventuresinmachinelearning.com/word2vec-keras-tutorial/
@author: Tobias Lang
'''
import logging
from tensorflow.keras.models import load_model
from preprocessor.text_preprocessor import TextPreprocessor
from .model import GloveModel
class Glove:
'''
Run the GloVe alg... | true |
38076b35837518e6985b35136374b3be731e0734 | joshlapham/py-misc-scripts | /helpers.py | UTF-8 | 667 | 2.75 | 3 | [
"Beerware"
] | permissive | #!/bin/python
from subprocess import call, STDOUT
from os import devnull
from datetime import datetime
from time import strftime
def tprint(message):
""" Prints a given `message` with a timestamp prepended. """
print strftime("%c") + " - %s" % message
def file_timestamp():
""" Returns a timestam... | true |
f10ba6bdc084ccef337af9c32696a7aa5f86f043 | littlemesie/recommend-learning | /src/ncf/util.py | UTF-8 | 5,608 | 2.53125 | 3 | [] | no_license | import pandas as pd
import numpy as np
import random
import tensorflow as tf
user_info_path = '../../data/ml-100k/u.user'
item_info_path = '../../data/ml-100k/u.item'
base_path = '../../data/ml-100k/ua.base'
test_path = '../../data/ml-100k/ua.test'
def user_item_data():
user_header = ['user_id', 'age', 'gender',... | true |
2f7c110576b15b75f4d002470f8d4a54f6dca9d9 | Miguel-Tirado/Python | /python_work/Chapter_11/test_employee.py | UTF-8 | 584 | 3.5 | 4 | [] | no_license | import unittest
from employee import Employee
class TestEmployee(unittest.TestCase):
def setUp(self):
"""Create a instance of an employee"""
self.my_employee = Employee('miguel','tirado',60_000)
def test_give_default_raise(self):
"""test default give rasie method"""
self.my_emp... | true |
a3305d01359aa00ea603484d1270ffea755494fa | Mercy021/quiz | /python_test.py | UTF-8 | 783 | 4.0625 | 4 | [] | no_license | # # # quiz 1
x=[100,110,120,130,140,150]
y=[s*5 for s in x]
print(x)
# quiz 7
def greeting(age,name):
year=2021-age
print ("hello{} your born in year {} ".format(age,name))
greeting("mercy",21)
# # quiz 6
def divisible_by_seven():
x=range(100,200)
for y in x:
if y%7==0:
return y
d... | true |
cf18c99ad768c5b4cb7789be837dbf5496f2a560 | lgerhardt45/learning_from_oss_analysis | /data_collection/contribution_collector.py | UTF-8 | 3,505 | 3.046875 | 3 | [
"MIT"
] | permissive | import json
from data_collection.api.api import API
def get_stats_contributors(repo_owner: str, repo_name: str, api_client) -> {str: int}:
"""
via GET /repos/:owner/:repo/stats/contributors
:returns a dictionary with key: user_name and value: number of commits to repo
"""
stats_contributors_url =... | true |
dc7e598e557c9f9b1a17d6b25fc15add5a023a50 | cedextech/fastText | /server.py | UTF-8 | 4,474 | 2.796875 | 3 | [] | no_license | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
import fasttext
import flask
from flask import request
from flask import jsonify
import json
import requests
import random
app = flask.Flask(__name__)
model_name = 'model'
train_file_name = 'train... | true |
3e37dbef78d733294b35d1a10da3dd0d590b2c72 | akshshar/route-shuttle | /plugins/base.py | UTF-8 | 1,765 | 2.84375 | 3 | [] | no_license | #! /usr/bin/python
from abc import ABCMeta, abstractmethod
class BasePlugin():
__metaclass__ = ABCMeta
@abstractmethod
def get_route_prefix(self):
"""Method to return prefix from
route pushed to queue"""
pass
@abstractmethod
def get_route_prefixlen(self):
"""Me... | true |
1c76f027ba5f8aaa71d5a6b190dedcf6d4fd74e8 | Peder2911/gqltester | /requester.py | UTF-8 | 1,918 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import watchgod
import fire
import requests
from os import path
import json
import pygments
from pygments import highlight, lexers, formatters
from datetime import datetime
def ppJson(data):
return highlight(json.dumps(data, indent = 4),
lexers.JsonLexer(),
formatters.Termina... | true |
270bb92d01b48a27f7436bcc4e56f68f3a5a3fa3 | WeDias/RespCEV | /Exercicios-Mundo2/ex048.py | UTF-8 | 151 | 3.78125 | 4 | [
"MIT"
] | permissive | soma = 0
print('A Soma Dos Impares Entre 1 E 500 É:')
for num in range(1, 501, 2):
if num % 3 == 0:
soma += num
print(soma)
| true |
eeb3512efe1ef30d2454b29bbc5dc56d1aba7d26 | whitezou/learnedindex-Learned-indexes-for-multidimensional-data-using-Z-order-curve | /clustering_old.py | UTF-8 | 2,809 | 2.828125 | 3 | [] | no_license | import pandas
#%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import copy
import morton
from sklearn import preprocessing
df = pandas.read_csv('z_values_world_map_sorted.csv')
df = df.sample(frac=0.001, random_state=1)
df = np.array(df)
from sklearn.cluster import AgglomerativeClustering
clus... | true |
a1bd14d2b2c611f5a995347fefadffe15752ccd2 | techkids-c4e/c4e5 | /Ha Tran/buoi 2_19.6/bai 4.py | UTF-8 | 296 | 3.125 | 3 | [] | no_license | initial_number=int(input("Initial B bacteria number : ")) #Nhap so luong vi khuan ban dau
time=float(input("Period of time : ")) #Nhap so phut
total_B=int(initial_number*(2**(time//2))) #tinh tong so vi khuan
print("After ",time," minutes we would have",total_B," bacteria(s)") #Hien thi ket qua
| true |
1d09708b012cfa78c5762a4aaae9c71323b1a330 | richard-jones/magnificent-octopus | /octopus/modules/sheets/commasep.py | UTF-8 | 6,708 | 2.9375 | 3 | [
"Apache-2.0"
] | permissive | from octopus.core import app
from octopus.modules.sheets.core import BaseReader, BaseWriter, FileReadException, DataStructureException
import csv, codecs, cStringIO
class CsvReader(BaseReader):
DIALECTS = {
"excel" : csv.excel
}
def __init__(self, path, input_encoding=None, try_other_encodings=Tr... | true |
7bd525182a3490507e21dc929888338157584890 | kamkali/Kurs-Python | /week03_day01/day1.py | UTF-8 | 1,227 | 3.5 | 4 | [] | no_license | from typing import Sequence, List, Dict
def multiply_by(my_list, multiplier):
return [element * multiplier for element in my_list]
def name_people(first_names: List, second_names: List, ages: List) -> List:
return [f"{name} {surname}, age = {str(age)}" for name, surname, age in zip(first_names, second_names... | true |
8facc741243dc98670abb17872a6e10ffaad2581 | IIHARUKAII/workshop2 | /operators/member_4.py | UTF-8 | 83 | 3.1875 | 3 | [] | no_license | name_list = ["sorn", "jim"]
print("sorn" in name_list)
print("atom" in name_list) | true |
de8b28d47f055552515e444f323ab73e1368ef90 | RPBarreto/Sistema-de-Arquivos | /readfile.py | UTF-8 | 273 | 3.25 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import os
def readfile(nome):
path = os.getcwd()
totalpath= os.path.join(path,nome)
if os.path.exists(totalpath):
f=open(totalpath,"r")
print(f.read())
f.close
else:
print("Arquivo não encontrado")
| true |
86de8688c83e0d1da638623e2a69d605a895ddd8 | Aasthaengg/IBMdataset | /Python_codes/p03047/s407987926.py | UTF-8 | 92 | 2.75 | 3 | [] | no_license | N, K = list(map(int, input().split()))
if N < K:
print(0)
exit(0)
print(N - K + 1)
| true |
6cc29e6b8f8b1cbbf9f8ed2df93fb72bfe57f6de | neha-dubey/PythonProjects | /exception.py | UTF-8 | 632 | 3.921875 | 4 | [] | no_license | class specialCharactersException(Exception):
'''User defined exception class derived from Exception class'''
def __init__(self, character):
Exception.__init__(self)
self.character = character
try:
input = raw_input("Enter the string without special characters: ")
SkippedChar = '''!@#$%^&*;:"?.~`'''
for char... | true |