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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
63d627c88a9aa71a2769bf5b8910517e7fd68c8d | Python | MdAlSiam/My-Codeforces-Solutions | /1293B.py | UTF-8 | 88 | 3.3125 | 3 | [] | no_license | n = int(input())
ans = 0.00
for i in range (1, n+1):
ans = ans + (1.00 / i)
print(ans)
| true |
edcf6b0dd77e51c4dd1d843da33877a96b236c2f | Python | isthegoal/Predicting_Air_Quality | /model/XGBOOST.py | UTF-8 | 14,153 | 2.53125 | 3 | [] | no_license | #-*-coding:utf-8-*-
import pandas as pd
import lightgbm as lgb
import numpy as np
from sklearn.model_selection import KFold
from sklearn.model_selection import train_test_split
import h5py
import pickle
from xgboost import XGBRegressor as XGBR
from pandas import DataFrame as DF
from sklearn import metrics
def smape_... | true |
92dd735cac212d3f3ed043761a96474a16eb7488 | Python | dillonmk/Python_git_practice | /helloworld.py | UTF-8 | 144 | 3.046875 | 3 | [] | no_license | import os
os.system('clear')
# This is a comment
'''
For a multiline comment
'''
full_name = "Dillon Kabot"
print('hello world')
print(full_name)
| true |
79be4b55c082a9607014d7ba1d612e251ceb90fe | Python | cheery/20131031-compiler | /analysis.py | UTF-8 | 3,367 | 2.515625 | 3 | [] | no_license | from structures import Variable
def dominance_frontiers(function):
def peel(obj, depth):
for _ in range(depth, obj.idom_depth):
obj = obj.idom
return obj
for block in function:
block.idom = None
block.idom_depth = 0
block.frontiers = set()
assert len(func... | true |
1aec5b12d7ad9b5e6672827932acf93f9c49d171 | Python | VinidiktovEvgenijj/PY111-april | /Tasks/e2_dijkstra.py | UTF-8 | 651 | 3.625 | 4 | [] | no_license | from typing import Any
import networkx as nx
def dijkstra_algo(g: nx.DiGraph, starting_node: Any) -> dict:
"""
Count shortest paths from starting node to all nodes of graph g
:param g: Graph from NetworkX
:param starting_node: starting node from g
:return: dict like {'node1': 0, 'node2': 10, '3': 33, ..... | true |
08275277792398c8942b42e2dee05099419bc035 | Python | gmgall/python-hpc | /multiprocessing/multiprocessing2.py | UTF-8 | 378 | 3.09375 | 3 | [] | no_license | import multiprocessing
import time
class Processo(multiprocessing.Process):
def __init__(self, id):
super(Processo, self).__init__()
self.id = id
def run(self):
time.sleep(1)
print("Sou o processo com ID: {}".format(self.id))
if __name__ == '__main__':
p = Processo(0)
... | true |
3fe851b211f25093a40d9c7e054eaa08b0c03c2f | Python | JonathanSomer/StatisticalLearningClassCompetition | /regressors/dl_regressor.py | UTF-8 | 2,504 | 2.6875 | 3 | [] | no_license | import numpy as np
from sklearn.decomposition import PCA
from sklearn.preprocessing import MinMaxScaler
from regressors.base_regressor import BaseRegressor
from data_pre_processing.clean_data import remove_bad_movies
from data_pre_processing.fill_missing_values import fill_ratings_with_mean_per_user
from sklearn.ensemb... | true |
30a7fe78323ba04b7dcd27daa249e115d5765fe3 | Python | sharmapieyush/python | /Data Types Assignment.py | UTF-8 | 643 | 3.921875 | 4 | [] | no_license | #Question1
b=[]
a=input("Enter the input for list")
b.append(a)
f=input("Enter the input for list ")
b.append(f)
print("The list is",b)
#Question2
c=['google','apple','facebook','microsoft','tesla']
d=c+b
print(d)
#Question3
e=[1,1,2,6,4,1]
print(e.count(1))
#Question4
m=[3,8,1]
m.sort()
print(m)
#Question5
x=[7,8,... | true |
1831ab27da901a2c477bc829bb3224621b84855d | Python | ssangitha/guvicode | /hunter_128.py | UTF-8 | 145 | 3.21875 | 3 | [] | no_license | s=input()
z=[]
for i in range(0,len(s)-1):
for j in range(i+1,len(s)):
a=s[i:j+1]
b=a[::-1]
if a==b:
z.append(a)
for i in z:
print(i)
| true |
57a799d6e481e484bc5a8591d543c1faf24210d1 | Python | eulersformula/Lintcode-LeetCode | /Zoombie_In_Matrix.py | UTF-8 | 3,200 | 3.734375 | 4 | [] | no_license | # Lintcode 598//Medium
# Description
# Give a two-dimensional grid, each grid has a value, 2 for wall, 1 for zombie, 0 for human (numbers 0, 1, 2).Zombies can turn the nearest people(up/down/left/right) into zombies every day, but can not through wall. How long will it take to turn all people into zombies? Return -1 if... | true |
c19d52e24f107a68879d019ae535eeca13cd821e | Python | johnfercher/b2w-backend | /tests/application/filters/has_valid_data_in_response_test.py | UTF-8 | 1,034 | 2.78125 | 3 | [
"MIT"
] | permissive | from random import randint
from flask import Response
from src.application.filters.response_data_validator import has_valid_data_in_response
from src.domain.entities.planet import Planet
def test_when_return_is_none_should_return_404():
@has_valid_data_in_response
def return_none():
return None
... | true |
26ef0a5959e63e306a3d6e6c92c19bb0be0b2bde | Python | yadukrishnanaj/droneprogramming | /codes/guidedflight.py | UTF-8 | 1,834 | 2.609375 | 3 | [] | no_license | from dronekit import connect,VehicleMode,LocationGlobalRelative,APIException
import socket
import time
import exceptions
import math
import argparse
def connectmy():
parser=argparse.ArgumentParser(description="commands")
parser.add_argument('--connect')
args=parser.parse_args()
connection_string=args.connect
if n... | true |
a3d6f19ad3de3e401ef0be705ec6e9851afbac31 | Python | MiaoLi/trimesh | /trimesh/ray/ray_triangle_cpu.py | UTF-8 | 3,578 | 3.0625 | 3 | [
"MIT"
] | permissive | '''
Narrow phase ray- triangle intersection
'''
import numpy as np
import time
from ..constants import log, tol
from ..util import diagonal_dot
def rays_triangles_id(triangles,
rays,
ray_candidates = None,
return_any = False):
... | true |
9034be0fa12f086163dae9defc6cb5a193b18268 | Python | ASketin/python_developer | /hw2/tests/test_patient_collection.py | UTF-8 | 3,450 | 2.671875 | 3 | [
"CC0-1.0"
] | permissive | import os
import pytest
from hw2.homework.config import PASSPORT_TYPE, CSV_PATH
from hw2.homework.patient import PatientCollection, Patient
from hw2.tests.constants import PATIENT_FIELDS
GOOD_PARAMS = (
("Кондрат", "Рюрик", "1971-01-11", "79160000000", PASSPORT_TYPE, "0228 000000"),
("Евпатий", "Коловрат", "... | true |
701a6215fbf3dbafcb11bbfea5389afd713f3dc5 | Python | mabogunje/pentago | /pentago/assets.py | UTF-8 | 5,427 | 3.765625 | 4 | [] | no_license | '''
@author: Damola Mabogunje
@contact: damola@mabogunje.net
@summary: Pentago pieces
'''
from pentago import *;
class BLOCK(object):
'''
Represents a game block on the pentago board
Note: Assigned values are important!
DO NOT MODIFY!
'''
(TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT)... | true |
17f634688eee06cd6d905a7b8104f83b61326b5f | Python | shehzad-lalani/Pyda-PythonDigitalAssistant | /pyda-advancedwikipedia.py | UTF-8 | 170 | 2.953125 | 3 | [] | no_license | import wikipedia
# Translate wikipedia data to GERMAN LANGUAGE
while True:
input = input("Wiki Q: ")
wikipedia.set_lang("de")
print(wikipedia.summary(input))
| true |
f7f28bc4984d0e389e40b59ba99395f5c08d1c6e | Python | ThomasBollmeier/GObjectCreator3 | /src/gobjcreator3/model/module.py | UTF-8 | 6,743 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | class ModuleElement(object):
MODULE_SEP = '/'
def __init__(self, name):
self.name = name
self.module = None
self.filepath_origin = ""
def get_fullname(self):
res = self.name
module = self.module
while module and module... | true |
7c00aa8cb9b58ab0183ec3577d718ad84ee93dd9 | Python | premsair/Logistic-Regression | /rank_fft_data.py | UTF-8 | 2,152 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 02 23:11:42 2015
@author: Prem Sai Kumar Reddy Gangana (psreddy@unm.edu)
"""
import numpy as np
def rank_fft_features(genre_list,fft_Data):
############## Approach 1 : Based on Standard Deviations of Data
std_dev_genre_fft_features=[]
# Collects the genre ... | true |
a883a9d45e33dcb3492ad105ed144d990e391ab2 | Python | nikoneko035/Kaggle | /venns_atmaCup#5.py | UTF-8 | 675 | 2.546875 | 3 | [] | no_license | fig, axes = plt.subplots(3,4,figsize=(15,5))
venn2(subsets=(train.shape[0],test.shape[0],0), set_labels=("train", "test"), ax=axes[0,0])
for ax in axes.ravel()[:4]:
ax.tick_params(labelbottom=False, labelleft=False, labelright=False, labeltop=False,
bottom=False, left=False, right=False, top=Fals... | true |
a29a6c160ee3e5d717333bbd8a7729f007f8ebe6 | Python | harshiniravula/DSP_LAB | /lab4_prog2.py | UTF-8 | 762 | 3.03125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def movavg(x):
l=int(input("enter the order:"))
n=len(x)
z=[]
for i in range(n):
s=0
for k in range(l):
if i-k<n and i-k>=0:
s=s+x[i-k]
k=float(s)/float(l)
z=np.append(z,k)
return(z)
l=[]
g=int(input("enter no of samples:"))
for j in... | true |
e999832d4a6f6a094df5343e1e6cfc0afad11fa2 | Python | matthewmjm/data-science-exercises | /6-programing-in-python/6-8_strings.py | UTF-8 | 723 | 3.65625 | 4 | [] | no_license | #Hello World
def hello(name):
return('Hello, ' + name)
#Quotable
def quotable(name, quote):
return name + ' said: \"' + quote + '\"'
#Repeater
def repeater(string, n):
return string * n
#Repeater, level 2
def repeater(string, n):
return '\"' + string + '\"' + ' repeated ' + str(n) + ' times is: \"'... | true |
8d52a90b4f52cf1a48fdc2632d5c8f3435a8dd31 | Python | YeswanthRajakumar/LeetCode_Problems | /Easy/day-2/Create Target Array in the Given Order.py | UTF-8 | 169 | 3.03125 | 3 | [] | no_license | nums = [0,1,2,3,4]
index = [0,1,2,2,1]
target =[]
l = len(index)
for i in range(l):
# print(nums[i],index[i])
target.insert(index[i],nums[i])
print(target)
| true |
0eb1d52449f7c629e6c0ceae3f5af0356ccec33b | Python | zubairwazir/technical_tests | /question_A.py | UTF-8 | 332 | 3.703125 | 4 | [] | no_license | def check_for_overlap(line_1, line_2):
for num_point in line_2:
if num_point in xrange(line_1[0], line_1[1]):
return 'Both lines overlap!'
break
else:
return 'Lines do not overlap!'
break
line_1 = [1, 4]
line_2 = [5, 6]
print(check_for_overlap(line_... | true |
d37183c125829791680bf95eb477188add1f61f7 | Python | lxconfig/UbuntuCode_bak | /algorithm/牛客网/40-数组中只出现一次的数字.py | UTF-8 | 1,665 | 4.21875 | 4 | [] | no_license |
"""
一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。
"""
class Solution:
# 返回[a,b] 其中ab是出现一次的两个数字
def FindNumsAppearOnce(self, array):
# 运行时间:22ms 占用内存:5732k
# 先异或,找出两个只出现一次数字的异或结果
tmp = l = m = 0
if not array:
return []
for i in array:
... | true |
a39be9ed2f40c401dae5e94d3439edfb68ab1396 | Python | jeeten/ThinkBoard | /common/validation.py | UTF-8 | 562 | 2.734375 | 3 | [] | no_license | from common import log
logging = log.logging
def checkKey(dict, key):
if isinstance(key, str) and key not in dict.keys():
raise Exception("{} Key is missing!".format(key))
elif isinstance(key, list) :
logging.debug("validation: {} is tupple".format(key))
for k in key:
logging... | true |
0b940c4a54c1efa706ede7c5953341d11cd0fe33 | Python | powerthecoder/TeamRandomizer | /main_2.py | UTF-8 | 1,542 | 3.359375 | 3 | [
"MIT"
] | permissive | import random
import time
import sys
# Developed By: Leo Power
# https://powerthecoder.xyz
main_list= []
list_am = input("Enter amount of players: ")
for i in range(int(list_am)):
name = input("Enter Player Name: ")
main_list.append(name)
x = 0
while x != 1:
print()
amount_per_team = input("Player Pe... | true |
049f389600472b5b43e562b11f3a6cbf62227586 | Python | laits1/Algorithm | /0714_Algorithm/Code07-01.py | UTF-8 | 484 | 3.25 | 3 | [] | no_license | SIZE = 5
queue = [None for _ in range(SIZE)]
front, rear= -1, -1
# enQueue
rear += 1
queue[rear] = '화사'
rear += 1
queue[rear] = '솔라'
rear += 1
queue[rear] = '문별'
# deQueue
front += 1; data = queue[front]
queue[front] = None; print('입장손님-->', data)
front += 1; data = queue[front]
queue[front] = None; print('입장손님-... | true |
c90cc9f951789edc4ec845f6abdd21e14b8b94c9 | Python | lylenchamberlain/teamx | /Classes/World.py | UTF-8 | 2,510 | 3.15625 | 3 | [] | no_license | from Classes.AbstractWorld import AbstractWorld
import pygame
pygame.font.init()
class World(AbstractWorld):
def __init__(self):
AbstractWorld.__init__(self)
self.height = 600
self.width = 800
self.screen = pygame.display.set_mode((self.width, self.height))
self.black = (0,0,0)
self.clock = pygame... | true |
aa31e5a802c3cfd46b2180f516a960cfd146edc3 | Python | RossHann/data_integration_iii | /main.py | UTF-8 | 16,954 | 2.578125 | 3 | [] | no_license | # import numpy as np
# import similaritymeasures
# import matplotlib.pyplot as plt
#
# # Generate random experimental data
# x = np.random.random(100)
# y = np.random.random(100)
# exp_data = np.zeros((100, 2))
# exp_data[:, 0] = x
# exp_data[:, 1] = y
#
# # Generate random numerical data
# x = np.random.random(100)
# ... | true |
fa2b6ce0fc9cf1f2b5ea025a7168c1794c383021 | Python | carderne/descarteslabs-python | /descarteslabs/workflows/types/containers/tests/test_check_valid_binop.py | UTF-8 | 1,273 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import operator
import pytest
from ...primitives import Int, Float, Bool
from .._check_valid_binop import check_valid_binop_for
def test_valid():
check_valid_binop_for(operator.add, Int, "While testing", valid_result_types=(Int,))
def test_unsupported():
with pytest.raises(
TypeError, match="Whil... | true |
662cbf2e2cf4a9787261a87eedf0c9c239910de8 | Python | Brian-Yang-Git/EE599 | /MNIST_Example.py | UTF-8 | 1,413 | 2.765625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow import keras
import numpy as np
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
print(f'Using tensorflow version {tf.__version__}')
fashion_mnist = keras.datasets.fashion_mnist
(train_images, train_labels), (test_images, test_labels) = fashion_mnist.load... | true |
aa9db7af98d1a9674eb379d91844e65ec2264840 | Python | m04kA/my_work_sckool | /pycharm/Для школы/в разработке/ПанаринЯрослав_ИКТ_ИР_20.py | UTF-8 | 3,208 | 3.625 | 4 | [] | no_license | import time
from random import randint
test = int(input('Количество тестов: '))
ranger = int(input('Длинна массива: '))
my_min = int(input('Min: '))
my_max = int(input('Max: '))
def massive(minim, maxim, count):
my_masive = []
for idx in range(count): #заполняем массив рандомными элементами
my_masive.... | true |
b78f8f04017521d925389fdcad67386ec3c46623 | Python | KRISHNA1432/Digit-Recognition | /nn_cnn.py | UTF-8 | 1,732 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 04 19:39:57 2018
@author: user
"""
from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, Flatten, Input, Reshape
from keras.layers import Conv2D,... | true |
14be2669951ae1fd69c4344e47838c242926e787 | Python | krusse-bah/aos-cx-python | /src/system.py | UTF-8 | 878 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from src import common_ops
def get_system_info(params={}, **kwargs):
"""
Perform a GET call to get system information
:param params: Dictionary of optional parameters for the GET request
:param kwargs:
keyword s: requests.session object with loaded cookie jar
keyword url: URL in main()... | true |
7702bfbbae07e76921e19157e9710e541cbaffc8 | Python | GordonGustafson/Poker | /Player.py | UTF-8 | 260 | 2.78125 | 3 | [] | no_license | class Player(object):
def __init__(self, name, money):
self.name = name
self.money = money
self.has_folded = False
self.hand = None
self.in_pot_total = 0
def get_move(self, gamestate):
return {"bet": 0}
| true |
748e6b12779ffa55af50e22446b66553cf14d172 | Python | Rodrigo61/GUAXINIM | /UVa/10198/main.py | UTF-8 | 603 | 3.0625 | 3 | [] | no_license | import sys
target = 0
memo = []
def solve(sum):
if sum > target:
return 0
if sum == target:
return 1
if memo[sum] != -1:
print("memorizou")
return memo[sum]
res = 0
res += solve(sum + 1)
res += solve(sum + 1)
res += solve(sum + 2)
res += solve(sum + 3)
memo[sum] = res
return res
for line in ... | true |
042d3b2025dfa3f45503a636bc7205caf6afd939 | Python | nazariyv/leetcode | /solutions/easy/moving_average_from_data_stream/main.py | UTF-8 | 525 | 3.796875 | 4 | [] | no_license | #!/usr/bin/env python
from __future__ import division
from collections import deque
class MovingAverage:
def __init__(self, size: int):
self._d: deque = deque(maxlen=size)
def next(self, val: int) -> float:
self._d.append(val)
return sum(self._d) / len(self._d)
# Your MovingAverage ... | true |
39e52a761d75a0fd9f3191fb9048e3e893161294 | Python | cascav4l/20Questions | /main.py | UTF-8 | 16,747 | 4.03125 | 4 | [] | no_license | ###################################################################
# Author:
# Adrian Negrea
#
#
# 20 Questions Game
# This program is a game which aims to guess the animal that someone
# is thinking about using a series of 20 yes or no questions.
#
# A database is used to store the questions in a table, with a
# sepa... | true |
d980a0ff6c31fe2c5a792cae460edfd3842876e1 | Python | zcf1998/zcf1998 | /ex14.py | UTF-8 | 426 | 3.109375 | 3 | [] | no_license | import numpy as np
from sys import argv
script,r=argv
r=float(r)
def Cir(r): #calculate the circumference
return 2*np.pi*r
C=Cir(r)
C_earth=Cir(6378.0)
C_mars=Cir(3396.0)
if abs(C-C_earth)<abs(C-C_mars):
print "more likely to be earth.%.16f"%(abs(C-C_mars)-abs(C-C_earth))
elif abs(C-C_earth)>abs(C-C_mars):
... | true |
0df17f202dcfbaf6e1149e4e092dad2a1765817e | Python | khushigupta9401/pygame | /image.py | UTF-8 | 613 | 3.265625 | 3 | [] | no_license | import pygame
pygame.init()
display_width = 500
display_hight = 500
gameDisplay = pygame.display.set_mode((display_width,display_hight))
pygame.display.set_caption('a bit racey')
white = (255,255,255)
clock = pygame.time.Clock()
crashed = False
carImg = pygame.image.load('3.jpg')
def c... | true |
dc2121cf13a274e29371c8523db7019937f39552 | Python | rarch/codeeval | /easy/testing.py | UTF-8 | 617 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
def test(bugs):
if bugs==0: return 'Done'
elif bugs<=2: return 'Low'
elif bugs<=4: return 'Medium'
elif bugs<=6: return 'High'
else: return 'Critical'
def getBugs(str1,str2):
count=0
for ind in xrange(len(str1)):
if str1[ind]!=str2[ind]: count+=1
... | true |
f949232efae375e4dd8ce4e46ccaff5b343ae219 | Python | SheilaAbby/politico-api | /utils/validations.py | UTF-8 | 1,747 | 2.890625 | 3 | [] | no_license | from marshmallow import ValidationError
import re # use regex
def required(value):
if isinstance(value, str): # check if value is type string
if not value.strip(' '):
raise ValidationError('This parameter cannot be null')
return value
elif value:
return value
def email(... | true |
a1742f18c2206d2bb59431a11626f13f55b7b334 | Python | massimotassinari/split | /split.py | UTF-8 | 2,252 | 2.578125 | 3 | [] | no_license | # people = [{
# 'name':'Miguel',
# 'spent' : 30,
# 'has_to_recieve':0,
# 'split': []
# },
# {
# 'name':'Omar',
# 'spent' : 20,
# 'has_to_recieve':0,
# 'split': []
# },
# {
# 'name':'Stefi',
# 'spent' : 12,
# 'has_to_recieve':0,
# ... | true |
87abf365ad450327a75f1debe59a1ca319e902c7 | Python | RSAKing/checkpoint2 | /func.py | UTF-8 | 1,047 | 3.46875 | 3 | [] | no_license | import re
def cadastrar(vazamento):
check = "S"
resp = "S"
while resp == "S":
tag = input("Informe o ID do vazamento >> ")
while check == "S":
email = input("Qual e-mail vazado?\n").upper()
if re.match("[^@]+@[^@]+\.[^@]+", email):
check =... | true |
d6c4e50dac08c74559ca4472bfbad33e5212e461 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_211/322.py | UTF-8 | 3,065 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
def find_deficits(list, avg):
num_items = len(list)
total_deficits = 0.000000
for i in range(0, num_items):
if list[i] < avg:
total_deficits += avg - list[i]
return total_deficits
def find_avg(list, last_item, extras):
total = 0.000000
for i in range(0, last_item):
total +... | true |
e940291663362d1e28018e59f4fcafdbd4615d39 | Python | My-lsh/Python-for-Data-Mining | /blog09-LinearRegression/test01.py | UTF-8 | 2,142 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 05 18:10:07 2017
@author: eastmount & zj
"""
#导入玻璃识别数据集
import pandas as pd
glass=pd.read_csv("glass.csv")
#显示前6行数据
print(glass.shape)
print(glass.head(6))
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(font_scale=1.5)
sns.lmplot(x='al', y='ri', data=gla... | true |
6f9720b650883f0b310319250ac7d78a7ee65da1 | Python | DivyanshuSaxena/Distributed-GHS | /generate.py | UTF-8 | 4,617 | 3.515625 | 4 | [] | no_license | """Generate test cases for the MST Problem"""
import sys
import random
def write_to_file(num_nodes, edges, graph_type):
"""Write the edges on the input file
Arguments:
num_nodes {Integer} -- Number of nodes in the graph
edges {List} -- List of edges with unique edges
graph_type {S... | true |
cbf1bbf826b36638e3723387e314799ec18fb62d | Python | robertdahmer/Exercicios-Python | /Projetos Python/Aulas Python/Aula07/DESAFIO08.py | UTF-8 | 208 | 3.78125 | 4 | [
"MIT"
] | permissive | #MOSTRA O VALOR COM 5% DE DESCONTO
valor = float(input('Qual o valor do produto? R$ '))
desconto = valor - (valor * 5 / 100)
print('Seu produto com 5% de desconto ficaria {:.2f} R$. '.format(desconto))
| true |
9615e5db50c04a6671a238147bf2ed19bb80c8c3 | Python | Taschee/schafkopf | /tests/test_card_deck.py | UTF-8 | 896 | 2.875 | 3 | [
"MIT"
] | permissive | from schafkopf.card_deck import CardDeck
from schafkopf.suits import ACORNS, BELLS, HEARTS, LEAVES
from schafkopf.ranks import ACE, TEN, EIGHT, SEVEN
import pytest
@pytest.fixture
def card_deck():
return CardDeck()
def test_deal_hand(card_deck):
hand = card_deck.deal_hand()
assert len(hand) == 8
ass... | true |
c3b57aa500c46fb1658373b5ef6fa5ba88f3d263 | Python | HLNN/leetcode | /src/0557-reverse-words-in-a-string-iii/reverse-words-in-a-string-iii.py | UTF-8 | 668 | 3.765625 | 4 | [] | no_license | # Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
#
#
# Example 1:
# Input: s = "Let's take LeetCode contest"
# Output: "s'teL ekat edoCteeL tsetnoc"
# Example 2:
# Input: s = "God Ding"
# Output: "doG gniD"
#
#
# Constraints... | true |
d80022c348f736f29e8f962dba3aa9f3ad6fb630 | Python | Dzen819/pong_game | /main.py | UTF-8 | 1,215 | 3.0625 | 3 | [] | no_license | from turtle import Screen
from pads import Paddle
from scoreboard import Border, Score
from ball import Ball
import time
import random
screen = Screen()
screen.setup(width=800, height=600)
screen.bgcolor("black")
screen.title("Pong")
screen.listen()
screen.tracer(0)
bord = Border()
ball = Ball()
p1_score = Score((-370... | true |
8fedcced2e82c4e6c2a65aafc8bb518d92251495 | Python | lemduc/CSCI622-Advanced-NLP | /HW1/python_code/2.SpaceDeleter.py | UTF-8 | 308 | 2.6875 | 3 | [] | no_license | import string
output = ""
f = open('space-deleter.fst', 'w')
f.write('%%%%%% Filename: space-deleter.fst %%%%%%\n')
f.write('0\n')
for c in string.ascii_uppercase:
out = '(0 (0 "{}" "{}"))'.format(c, c)
f.write(out + '\n')
f.write('(0 (0 "{}" {}))'.format('_', '*e*') + '\n')
f.close() | true |
a49bc0c7a2888a15b4724be56a6a903b0309cac1 | Python | nicoddemus/lima | /lima/abc.py | UTF-8 | 849 | 2.890625 | 3 | [
"MIT"
] | permissive | '''Abstract base classes for fields and schemas.
.. note::
:mod:`lima.abc` is needed to avoid circular imports of fields needing to
know about schemas and vice versa. The base classes are used for internal
type checks. For users of the library there should be no need to use
:mod:`lima.abc` directly.
'''
... | true |
1c4d27a3df6ede37d699a66640227ad17ac94f3d | Python | umairwaheed/mangrove | /mangrove/models.py | UTF-8 | 5,546 | 2.75 | 3 | [
"MIT"
] | permissive | import sys
import json
import sqlalchemy
import collections
from mangrove import query
from mangrove import fields
from mangrove import exceptions
from mangrove import connection
if sys.version_info < (3, 0):
import py2_base as base
else:
from mangrove import py3_base as base
class Model(base.ModelBase):
... | true |
b2a74e1f1c3f772455b315f61db73c6e2ebaa53a | Python | nephashi/news-spider | /redis_util/redis_url_pusher.py | UTF-8 | 1,013 | 2.71875 | 3 | [] | no_license | import common_utils.json_util as ju
class RedisUrlPusher(object):
def __init__(self, redis_queue_dao, dup_rmv_cache, logger):
self.__redis_queue_dao = redis_queue_dao
self.__dup_rmv_cache = dup_rmv_cache
self.__logger = logger
def log_cache_status(self):
status = "url pusher c... | true |
4dfe985538845dc9fca0fc5cb2bf0ac70c5ed1b8 | Python | henry0312/keras_compressor | /bin/keras-compressor.py | UTF-8 | 2,466 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import logging
import keras
import keras.backend as K
import numpy
from keras.models import load_model
from keras_compressor.compressor import compress
def count_total_params(model):
"""Counts the number of parameters in a model
See:
https://github.com/fchollet... | true |
248c233766b0f2bfef4c58a9e1555527bb6d9135 | Python | adrianflatner/ITGK | /9AdrianFlatner/øving9/Generelt_om_filbehandling.py | UTF-8 | 529 | 3.78125 | 4 | [] | no_license | def write_to_file(data):
f = open('default_file.txt','w')
f.write(data)
f.close()
def read_from_file(filename):
f = open(filename,'r')
innhold = f.read()
f.close()
return innhold
def main():
r_or_w = 0
while r_or_w != 'done':
r_or_w = input("Do you want to rea... | true |
fbcbc5ea5ccc0bcc4c9a762e1758f49d7c6b2dd5 | Python | SaifurShatil/Python | /dict.py | UTF-8 | 440 | 2.90625 | 3 | [] | no_license | d={1:'jsh',2:'jhdhdf',4:'jfdhjr'}
print(d[4])
print(d.get(2))
print(d.get(3,'Not Found'))
print(d.get(1,'Not Found'))
print(d.keys())
print(d.values())
keys=[1,2,3,'y']
val=[34,'drtt',4.7,45]
data=dict(zip(keys,val))
print(data)
print(data['y'])
data['mon']=87
print(data)
del data[3]
print(data)
... | true |
8ff6f948a1f61865e041817c413147be10d366f4 | Python | Alfredogomes/LabBio_Trabalho | /src/motifs.py | UTF-8 | 1,037 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Motifs
======
"""
import argparse
import sys
from Bio import SeqIO
from Bio.ExPASy import ScanProsite
SEQUENCES = 'data/translations.fasta'
def get_motifs(records, outfile):
for record in SeqIO.parse(records, 'fasta'):
seq = record.seq
keywords = {'CC':'/SKIP-FLAG=FALS... | true |
282e3ddb204cb14d11f0d5438b042fbb196c3fb2 | Python | lpxxn/lppythondemo | /base/http-reqpest-demo-.py | UTF-8 | 405 | 2.765625 | 3 | [] | no_license | import requests
r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))
print(r.status_code)
assert r.status_code == 200, f'Should be 200 current is {r.status_code}'
print(r.encoding)
print(r.text)
print(r.json())
print(r.json()['authenticated'])
# print(r.json()['user1'])
print(r.json()... | true |
7ee4d4f2c0ccc3534bac2702fbaff8e1439c90c1 | Python | dmorais/rede | /Alternative_citation.py | UTF-8 | 1,716 | 3.328125 | 3 | [] | no_license | import sys
import os
def ensure_dir(dir_path):
if not os.path.exists(dir_path):
print("Creating", dir_path)
os.makedirs(dir_path)
return True
def create_list_of_citations(file_name, dir_path, author):
citations = dict()
with open(file_name, 'r') as f:
for line in f:
... | true |
11455cf640b4546ec9bb8f682397484a7d18cef3 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_118/1634.py | UTF-8 | 1,028 | 2.921875 | 3 | [] | no_license | import fileinput
import math
def palindromes_count(start, end):
palindromes_list = [1, 4, 9, 121, 484, 10201, 12321, 14641, 40804, 44944, 1002001, 1234321, 4008004, 100020001, 102030201, 104060401, 121242121, 123454321, 125686521, 400080004, 404090404, 10000200001, 10221412201, 12102420121, 12345654321, 400008000... | true |
e5a4a429adba1fe3efc41baeb97f0d6fe0e0034d | Python | MaximZolotukhin/erik_metiz | /chapter_9/exercise_9.3.py | UTF-8 | 1,856 | 4.21875 | 4 | [] | no_license | """
Пользователи:
создайте класс с именем User. Создайте два атрибута first_name и last_name, а затем еще
несколько атрибутов, которые обычно хранятся в профиле пользователя. Напишите метод describe_user(),
который выводит сводку с информацией о пользователе. Создайте еще один метод greet_user()
для вывода персональног... | true |
38c8c9c8e877ca204b5e23df37719c7e32d31bf2 | Python | BIAOXYZ/variousCodes | /_CodeTopics/LeetCode/401-600/000565/000565.py3 | UTF-8 | 716 | 2.671875 | 3 | [] | no_license | class Solution:
def arrayNesting(self, nums: List[int]) -> int:
globallyVisitedIndex = set()
lis = []
for i, num in enumerate(nums):
if i not in globallyVisitedIndex:
se = set([i])
while nums[i] not in se:
se.add(nums[i])
... | true |
c3e2069f025c19c712ee604f4e997c8516bab0bb | Python | danny-hunt/Advent-of-Code-2019 | /day10.py | UTF-8 | 804 | 3.3125 | 3 | [] | no_license | from math import atan2, hypot, pi
def angle(a, b):
return atan2(b[0] - a[0], a[1] - b[1]) % (2 * pi)
def visible(asteroids, a):
return len(set(angle(a, b) for b in asteroids if a != b))
with open('day10.txt', 'r') as text_input:
data = text_input.read().splitlines()
asteroids = [(x, y) for y in range(le... | true |
1d239c579a16a6bfc1957297b88a3e83f7b9440d | Python | polarisXD/Automation-Certification | /commons/printer.py | UTF-8 | 184 | 3.75 | 4 | [] | no_license |
class Printer:
def __init__(self):
pass
def printEntries(self, dictionary):
for key in dictionary.keys():
print(key + ": " + str(dictionary[key])) | true |
5d307d0d41c0dea73fcaf9a3c0ca7f76a02a51ee | Python | broox9/learning | /egghead/python/inputs.py | UTF-8 | 507 | 4.28125 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
#python 2
# rname = raw_input('What is your python 2 name?: ')
# print("hello there, {0} from the letter python".format(rname))
# python 3
name = input('Name: ')
job = input('Job: ')
location = input('Where are you? ')
print(f"Hello there, {name} from {location}")
#inputs are always strings
... | true |
3705f10549a58788f7e6b71f2992f8a773377458 | Python | lasoren/ml-optimization | /neural_net/NeuralNet.py | UTF-8 | 9,420 | 3.359375 | 3 | [
"MIT"
] | permissive | """
Created on Wed Feb 10 21:56:02 2016
@author: Ryan Lader, Emily MacLeod working from Lab4_Soln
"""
import numpy as np
import matplotlib.pyplot as plt
def construct_truth(y):
v = []
for i in range(len(y)):
if y[i] == 0:
v += [[1,0]]
elif y[i] == 1:
v += [[0,1]]
r... | true |
3244f48a0637c4d3fab77dcc9c4727c81c2c7524 | Python | MatteoEsposito/ProgettoInItinereI-IngegneriaDegliAlgoritmi- | /Python/lib/ProjUtilities.py | UTF-8 | 8,294 | 3.515625 | 4 | [
"MIT"
] | permissive | # coding=utf-8
# ProjUtilities.py
# Autore: Matteo Esposito
# Versione di Python: 2.6.9
import random
from extendedAVL import ExtendedAVL
from settings import DEBUG
def createAVLByArray(array):
'''
Classe usata per creare un albero AVL da un Array
:Time: O(n)
:param array: Array of integers
:re... | true |
9cba45842ecc00ece7ee8604a27381d39ea04255 | Python | BenDosch/holbertonschool-higher_level_programming | /0x03-python-data_structures/4-new_in_list.py | UTF-8 | 483 | 3.71875 | 4 | [] | no_license | #!/usr/bin/python3
def new_in_list(my_list, idx, element):
copy_list = []
if my_list:
for i in range(len(my_list)):
copy_list.append(my_list[i])
if idx < len(my_list) and idx >= 0:
copy_list[idx] = element
return (copy_list)
def main():
test_list = [1, 2, 3, 4, 5]
id... | true |
66349255efbb80b5be35c924f47a2df1c88dd0ee | Python | thomas-dubard/python-eval | /needleman_wunsch/ruler.py | UTF-8 | 4,818 | 3.5625 | 4 | [] | no_license | import numpy as np
from colorama import init, Fore, Style
# Variable à changer pour adapter les scores
egalite = 1
trou = 1
def red_text(text: str) -> str:
"""
On utilise cette fonction pour proprement inclure du texte en rouge.
"""
init(convert=True) # nécessaire sous des OS propriétaires :p
retu... | true |
2b081a79cb6a40c88d923968b114ac3179ce80fd | Python | hugoboursier/python | /connexion_database.py | UTF-8 | 437 | 2.578125 | 3 | [] | no_license | import sqlite3
fichierDonnees ="/hometu/etudiants/b/o/E155590U/2eme_annee/python/python/db.sq3"
conn = sqlite3.connect('fichierDonnees')
cur = conn.cursor()
"""
cur.execute("INSERT INTO membres(age,nom,taille) VALUES(21,'Dupont',1.83)")
cur.execute("INSERT INTO membres(age,nom,taille) VALUES(15,'Blumâr',1.57)")
cur.ex... | true |
722cff4cd6c60e5c5558310def15b6ff9a9473c8 | Python | NaoiseGaffney/PythonMTACourseCertification | /GaffTest/temperatureConversion.py | UTF-8 | 1,593 | 4.78125 | 5 | [] | no_license | temperatureInput = input("Please enter the temperature as a number,followed by either a 'C' for Celsius or\
'F' for Fahrenheit: ").upper().replace(" ", "")
"""
Enter temperature in either Celsius followed by a 'C' or Fahrenheit followed by an 'F'.
The variable 'temperatureInput' contains the entered temperature and e... | true |
bae5522ffa522122a30c9144bcbced453e61d53e | Python | SebghatYusuf/vpic-api | /vpic/client.py | UTF-8 | 31,266 | 3 | 3 | [
"MIT"
] | permissive | import logging
from typing import Any, Dict, List, Optional, Union
from .client_base import ClientBase
log = logging.getLogger(__name__)
class Client(ClientBase):
"""A client library for the U.S. NHTSA vPIC API
``Client`` returns JSON responses from the vPIC API. vPIC responses
don't always use the sam... | true |
2eb9b16e6411f114ee2da5254c527768bbe7bdb1 | Python | Haimzis/Moles_Detective_Data_Backend | /color_picker.py | UTF-8 | 1,788 | 2.953125 | 3 | [] | no_license | import cv2
import numpy as np
import glob
image_hsv = None
pixel = (20, 60, 80)
image_src = None
# mouse callback function
def pick_color(event, x, y, flags, param):
"""
clicking event - prints the color range of the area that have been clicked
:param event: click event on specific img
:param x: coor... | true |
f9276d3c198a04ab7db2e2cade312693da322bbb | Python | pyg-team/pytorch_geometric | /test/explain/algorithm/test_attention_explainer.py | UTF-8 | 2,057 | 2.625 | 3 | [
"MIT"
] | permissive | import pytest
import torch
from torch_geometric.explain import AttentionExplainer, Explainer
from torch_geometric.explain.config import ExplanationType, MaskType
from torch_geometric.nn import GATConv, GATv2Conv, TransformerConv
class AttentionGNN(torch.nn.Module):
def __init__(self):
super().__init__()
... | true |
83fecede726ed0a96e970bd26a16aeaa8ad59cc3 | Python | hazrmard/SatTrack | /experiments/multi.py | UTF-8 | 507 | 3.015625 | 3 | [
"MIT"
] | permissive | __author__ = 'Ibrahim'
# Testing python multiprocessing functionality
import multiprocessing as mp
import time
jobs = []
def worker(i):
time.sleep(i)
print 'worker function ', i, ' Name: ', mp.current_process().name
def main(n):
for i in range(n):
p = mp.Process(target=worker, args=[i], name='w... | true |
4cbb030f6fc35c6c9e5b750360f3de7413b8e71a | Python | BattySingh/myLearn | /coding/python/list7.py | UTF-8 | 277 | 3.140625 | 3 | [] | no_license | motorcycles = ['honda', 'yamha', 'suzuki']
print(motorcycles)
motorcycles.remove('honda')
print(motorcycles)
motorcycles.append('ducati')
too_expensive = 'ducati'
motorcycles.remove(too_expensive)
message = f"{ too_expensive.title() } is too expensive for me"
print(message) | true |
beebb0cae516a65eb8b305915870b6ea4c542684 | Python | TaeHyangKwon/RSASimulator | /Bob.py | UTF-8 | 632 | 2.859375 | 3 | [] | no_license | from Crypto.PublicKey import RSA
from Crypto.Signature import pkcs1_15
from Crypto.Hash import SHA256
import base64
f = open('AlicePubKey.pem', 'r')
AlicPubKey = RSA.import_key(f.read())
f.close()
f = open('Message.pem', 'r')
message = f.read()
f.close()
f = open('Signature.pem', 'r')
signature = f.read()
signature ... | true |
4b69b87b827ad878bc16fedf48a88ae8fc4dc219 | Python | Blaxzter/UM_ARS_G8 | /04_Genetic_Algorithm/src/genetic/Mutations.py | UTF-8 | 1,982 | 2.8125 | 3 | [] | no_license | import numpy as np
from genetic import Genome
# todo write some other mutation operators
import utils.Constants as Const
"""
Author Guillaume Franzoni Darnois & Theodoros Giannilias
"""
def mutation(genome: Genome):
for i in range(len(genome.genes)):
if np.random.uniform(low = 0, high = 1... | true |
c3d745e4623485dfa725b6ccfb60c307cea8e7d8 | Python | chenghuiyu/MachineLearning-Tutorials | /Tutorials/2_Models/DecisionTree/python/test.py | UTF-8 | 551 | 3.21875 | 3 | [
"MIT"
] | permissive | """
对实现的函数进行测试
"""
from decision_tree import DecisionTree
if __name__ == '__main__':
# Toy data
X = [[1, 2, 0, 1, 0],
[0, 1, 1, 0, 1],
[1, 0, 0, 0, 1],
[2, 1, 1, 0, 1],
[1, 1, 0, 1, 1]]
y = ['yes', 'yes', 'no', 'no', 'no']
clf = DecisionTree(mode='ID3')
clf.fi... | true |
05af3dba75d7f03b0643ce2e0c7d0056ab1fd621 | Python | sergey-judi/python3 | /Coursera/Основы программирования на Python/Week5/task_04.py | UTF-8 | 168 | 3.65625 | 4 | [] | no_license | def printStair(n):
stair = ''
for i in range(n):
stair += str(i + 1)
print(stair)
def main():
n = int(input())
printStair(n)
main()
| true |
58fee0daa8dc5bb801ef46c686c3fdf679c29aef | Python | bulboushead/AtBS | /DateDetection.py | UTF-8 | 1,538 | 3.59375 | 4 | [] | no_license | #! python2
# Date format replacer, takes any date and formats it correctly.
import re, pyperclip
# DD/MM/YYYY, 01-31, 01-12, 1000-2999, if single digit, will have leading zero
# regEx will accept right format, wrong days
dateRegex = re.compile(r'''(
([0-9]{2})
/
([0-9]{2})
/
([0-9]{4... | true |
4d8f998976180dbf1fdfd5d4d4bb40a6369f50b7 | Python | MrLittlejohn/Python_Project-1 | /python/function.py | UTF-8 | 3,218 | 4.0625 | 4 | [] | no_license | # Littlejohn, sort functions for a python Project.
#Dr.Decker, Due: Feb 26th, 2018, class: 16:00 to 17:15
#All rights are reserved to me, the almighty.
#1st includes insertion sort
#2nd is the recursive binary sort
#3rd is the split sort
def insertion_sort(insertion_list) :
for number in range(1,len(insertion_lis... | true |
5b92b4e09f11b4bd3fead2f9528ee39c659234a8 | Python | yueeong/geoip | /tests/test_libs.py | UTF-8 | 3,466 | 2.6875 | 3 | [] | no_license | import unittest
import geoip2.database
from collections import Counter
from library.filterextract import FilterExtract
from library.geo_utils import GeoClassifier
from library.stats import StatsCollector
class TestFE(unittest.TestCase):
def setUp(self):
self.list_of_strings = ['static', 'images', '/images... | true |
d4c3ebd033337a457413458b0badd29bdf25274b | Python | maksimuc24/GooglePlayCrawler-1 | /web_driver/scroll_driver.py | UTF-8 | 1,048 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
class ScrollDriver:
def __init__(self, web_driver, logger):
self.web_driver = web_driver
self.logger = logger
def scroll_down(self, load_time):
last_height = self.web_driver.execute_script("return document.body.scrollHeight")
... | true |
80bf20c63d78e3e6c03dcd035622c021a864f03e | Python | crebro/BrainStorm | /brainstorm/koiGame.py | UTF-8 | 9,325 | 2.84375 | 3 | [] | no_license | from brainstorm.button import Button
from brainstorm.koiFish import KoiFish
from brainstorm.menuButton import MenuButton
import pygame
import sys
from brainstorm.constants import COLORS, FONTS, HEIGHT, IMAGES, KOISIZE, SOUNDS, WIDTH
class KoiGame:
def __init__(self, surface) -> None:
self.surface = surfac... | true |
ae4ed6b5b3568d2aae50d11250713e534e8ed918 | Python | KristianLN/Thesis_UCPH | /utils/preprocessing_features_and_labels.py | UTF-8 | 134,428 | 2.515625 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import re
import os
import time
import h5py
import copy
import datetime
import ta
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import Normalizer
from sklearn.preprocessin... | true |
e6b4d6ecf8fd23790b020838b599585adac028a6 | Python | karan-sikarwa123/machine-learning-projects | /decisiontree.py | UTF-8 | 991 | 3.21875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
dataset = pd.read_csv('Position_Salaries.csv')
x = dataset.iloc[: , 1:2].values
y =dataset.iloc[:, 2].values
from sklearn.model_selection import train_test_split
x_train ,x_test ,y_train , y_test = train_test_split(x , y ,test_size=... | true |
3f347db35c519205d69e9622201e21fb7619ab65 | Python | zclgni/compress-picture-by-opencv3 | /conpress_img.py | UTF-8 | 1,397 | 2.921875 | 3 | [] | no_license | #coding = utf-8
import cv2
import os
import math
def get_doc_size(path):
try:
size = os.path.getsize(path)
return get_mb_size(size)
except Exception as err:
print(err)
def get_mb_size(bytes):
bytes = float(bytes)
mb = bytes / 1024 / 1024
return mb
def delete_file(path):
... | true |
3cd6287a0032ab49773b660b0dcc402bfd53c225 | Python | Mikescher/AdventOfCode2017 | /02_solution-1.py | UTF-8 | 237 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
import aoc
rawinput = aoc.read_input(2)
result = 0
for line in rawinput.splitlines():
values = list(map(lambda d: int(d), line.split('\t')))
result = result + (max(values) - min(values))
print(result)
| true |
3b89173c0a5c961f67b994a39e593d0f947b1684 | Python | dkuspawono/puppet | /modules/mediawiki/files/hhvm/cleanup_cache | UTF-8 | 3,626 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
"""
hhvm_cleanup_cache
Prune stale tables from the HHVM bytecode cache.
Tables are deemed unused if they reference a repo schema other than the
current one.
"""
import sys
import logging
from logging.handlers import SysLogHandler
import os.path
import subprocess
import sqlite3
import argp... | true |
5033fe4c192ac0f5a2912eefcddf14a157df8cd5 | Python | nlintz/ThinkDSP | /Chapter1/exercise7.py | UTF-8 | 1,789 | 2.96875 | 3 | [] | no_license | import os, sys
lib_path = os.path.abspath('../lib/ThinkDSP/code/')
sys.path.append(lib_path)
import thinkdsp
import thinkplot
import matplotlib.pyplot as pyplot
import helpers
import random
def harmonics(base_frequency=400):
# cos_sig = thinkdsp.CosSignal(freq=440, amp=1.0, offset=0)
base_signal = thinkdsp.CosSign... | true |
f787d593655dc9ee6fac1ba0bebe92e152355e5f | Python | AP-MI-2021/lab-4-irinaranga | /main.py | UTF-8 | 3,102 | 3.890625 | 4 | [] | no_license | def isPrime(x):
'''
determina daca un nr. este prim
:param x: un numar intreg
:return: True, daca x este prim sau False in caz contrar
'''
if x < 2:
return False
for i in range(2, x//2 + 1):
if x % i == 0:
return False
return True
def last_digit(x):
'''
... | true |
289196ec448470e6454a15e79799e683aa593b63 | Python | Yasaman1997/My_Python_Training | /Test/till you get 100/__init__.py | UTF-8 | 164 | 4 | 4 | [] | no_license |
name = input("enter your name: \n")
age = int(input(" your age : \n "))
year = str((2017-age)+100)
print(name + " will be 100 years old in the year " +year) | true |
0cefd2453ead41582697da8762605e13f08f8363 | Python | huangdaoxu/Machine_Learning | /autoencoder/train.py | UTF-8 | 3,653 | 2.796875 | 3 | [] | no_license | """
Created on 2017-12-13 23:05
@author: huangdaoxu
"""
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data as input_data
import matplotlib.pyplot as plt
class autoencoder(object):
def __init__(self):
self._X = tf.placeholder(tf.float32, shape=[None,784], name='X')
# en... | true |
97fc0303cb5b65f13eadee82c1a86ca22fe7eefc | Python | imishinist/dfa-sample | /main_test.py | UTF-8 | 3,144 | 2.984375 | 3 | [] | no_license | import unittest
from main import FARule
from main import DFADesign
from main import DFARulebook
from main import NFADesign
from main import NFARulebook
from main import NFASimulation
class TestNFARulebook(unittest.TestCase):
def test_alphabet(self):
rulebook = NFARulebook([
FARule(1, 'a', 1), ... | true |
0886e75497833c68b5cde160399ce85fa2439b22 | Python | kubikowski/PythonScripts | /dotify_image/_rgb_color.py | UTF-8 | 269 | 2.953125 | 3 | [] | no_license | from typing import Final, NamedTuple, Tuple
RGB: Final[str] = 'RGB'
class RGBColor(NamedTuple):
red: int
green: int
blue: int
@staticmethod
def of(color: Tuple[int, int, int]) -> 'RGBColor':
return RGBColor(color[0], color[1], color[2])
| true |
ff6c55293354ef668d8e5f3ca72d9457d63ad839 | Python | snowjamai/LeetCode | /palindrome-linked-list/palindrome-linked-list.py | UTF-8 | 657 | 3.359375 | 3 | [] | no_license | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
from collections import deque
class Solution:
def isPalindrome(self, head: Optional[ListNode]) -> bool:
DQ = deque()
next_h = 1
while next... | true |
3b3322a07221ca39815337eb44c7269fca72977e | Python | YerardinPerlaza/AirBnB_clone_v2 | /2-do_deploy_web_static.py | UTF-8 | 1,452 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
# Fabric script (based on the file 1-pack_web_static.py) that
# distributes an archive to your web servers
from fabric.api import *
from os import path
env.host = ['35.190.183.78', '34.226.194.149']
def do_deploy(archive_path):
'''Distributes an archive to your web servers'''
if len(archiv... | true |