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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
0d190ebd0cd022263649c4dc8a283a4e8c923602 | Python | SamScott/rootbot | /main/main.py | UTF-8 | 2,792 | 2.640625 | 3 | [] | no_license | # ROOT_BOT 1.6.1
# (C) 2014 root_user, Svetlana A. Tkachenko
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | true |
3736ef08b6e27e3b44b3c19a55a75a79d05e36bd | Python | mjpatter88/ProjEuler | /Problem082/test_solver.py | UTF-8 | 1,110 | 2.609375 | 3 | [] | no_license | from solver import min_path_sum, min_path_total
mat = [
[131, 673, 234, 103, 18],
[201, 96, 342, 965, 150],
[630, 803, 746, 422, 111],
[537, 699, 497, 121, 956],
[805, 732, 524, 37, 331]
]
mat2 = [
[131, 673, 234, 103, 18],
[201, 96, 342, 965, 150],
[630, 803, 746, 422, 111],
[537,... | true |
89d65df25aab0e418b19da2cae5ae0018481b6c1 | Python | ViacheslavP/FS_scattering | /novelfss/atomic_states.py | UTF-8 | 2,210 | 2.921875 | 3 | [] | no_license | import numpy as np
# methods and procedures for creating various chains
class atomic_state(object):
def __init__(self, pos, campl):
self.noa = pos.shape[1]
self._mpos = np.asarray(pos, dtype=np.float64)
self.dim = self.noa + 2 * self.noa * (self.noa - 1)
#not shuffled; run atomic_... | true |
990312554a1eddc06d477d4c58dc9b30dceb838d | Python | erickfmm/ML-experiments | /load_data/loader/basic/_glass.py | UTF-8 | 1,815 | 2.546875 | 3 | [
"MIT"
] | permissive | from load_data.ILoadSupervised import ILoadSupervised, SupervisedType
import csv
from os.path import join
__all__ = ["LoadGlass"]
class LoadGlass(ILoadSupervised):
def __init__(self, folder_path="train_data/Folder_Basic/glass/"):
self.TYPE = SupervisedType.Classification
self.folder_path = folder... | true |
9c939af83008e3366669c397a2d00db4d9f55620 | Python | subhadarship/textdistance | /tests/compression_based.py | UTF-8 | 5,267 | 2.828125 | 3 | [
"Python-2.0",
"MIT"
] | permissive | # built-in
from fractions import Fraction
# project
from __main__ import textdistance, unittest
class CommonNCDTest(unittest.TestCase):
def test_monotonicity(self):
algos = (
textdistance.arith_ncd,
# textdistance.bwtrle_ncd,
textdistance.bz2_ncd,
# textdis... | true |
9125b86200cfe6d9af0bf1949a12f64fcf29bc59 | Python | malingreats/scoringapp-serve-model-service | /scoring_service/app.py | UTF-8 | 1,292 | 2.890625 | 3 | [] | no_license | """
This module defines the scoring service in the following steps:
- loads the ML model into memory;
- defines the ML scoring REST API endpoints; and,
- starts the service.
"""
from typing import Dict
import pickle
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
import requests
... | true |
834088d59d32f8712fe303835f9071658e808050 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_206/1190.py | UTF-8 | 464 | 3.359375 | 3 | [] | no_license |
f = open("A-large.in");
f.readline() # Remove total tc cnt..
tc_cnt = 1;
while True:
line = f.readline()
if not line: break
token = line.split(" ")
D = int(token[0])
N = int(token[1])
speed_arr = []
for x in range(N):
line = f.readline()
token = line.split(" ")
... | true |
2ba7b41952c7e4667b958246f678fec9d0132975 | Python | HCelante/Minim-Finite-Automata | /teste.py | UTF-8 | 296 | 2.65625 | 3 | [] | no_license | import sys
def CarregaAFD():
with open((sys.argv[1]), "r") as ponteiro:
automato = [line.strip().split(" ") for line in ponteiro]
return automato
def main():
# automato = []
automato = CarregaAFD()
for line in automato:
print(line)
if __name__ == "__main__":
main() | true |
782574da88b80acc37d54ee2d1adc22129aa834f | Python | dolobanko/python-scripts | /port_scan.py | UTF-8 | 789 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
import socket
import subprocess
import sys
from datetime import datetime
subprocess.call ('clear', shell=True)
host = raw_input ("Enter IP of scanning hosts: ")
print "-"*60
print "Scanning remote host", host
print "-"*60
tl=datetime.now()
try:
for port in range(1,1025):
... | true |
8be770d8ebb0ffdfb6cc66b58fb6f10f23e44ea0 | Python | Teinaki/dev-practicals | /03-practical/practical-03/q1.py | UTF-8 | 1,353 | 4.21875 | 4 | [] | no_license | # Below are three pairs of strings. Before you run the code, try to
# predict what will happen in each case. Then run the code. Did the
# results match your expectations? Can you explain the results?
st1 = 'Spam, spam, spam'
st2 = st1
print('st1 == st2: ' , st1 == st2) #Predict True
print('st1 is st2: ', st1 is st2... | true |
3b37fe9cab677b09d15d37769c48a780bf14e798 | Python | quigsml/PythonTrainingFiles | /Part2_ObjOrienProg/Chapter14_MoreObjectOrientatedProgramming/Chapter14_Challenges.py | UTF-8 | 390 | 3.984375 | 4 | [] | no_license | #Chapter 14 Challenges:
#1, 2
class Square():
square_list = []
def __init__(self, l):
self.len = l
self.square_list.append((self.len))
def __repr__(self):
return "{} by {} by {} by {}".format(self.len, self.len, self.len, self.len)
sq1 = Square(5)
sq2 = Square(6)
print(Square.... | true |
dec4e2ea4112e3dd83d95a8a42db9db64640f03e | Python | jpatsenker/network-routing-learner | /core/user.py | UTF-8 | 296 | 2.9375 | 3 | [] | no_license | class User:
def __init__(self,uid,comm,pos,friends):
self.uid=uid
self.comm=comm
self.pos=pos
self.friends=friends
self.deg1=len(friends)
self.deg2=None
def __repr__(self):
return str(self)
def __str__(self):
return str(self.uid) + ": " + str(self.friends)
| true |
21a3c0a7867dc0af60c051be66c991717100e0b3 | Python | Leehoryeong/proto | /class2/day4/q.py | UTF-8 | 680 | 3.671875 | 4 | [] | no_license | data = [10,70,90,50,40]
data1 = [(40,50),(70,30),(20,60)] #(๊ตญ์ด, ์์ด)
data2 = [{'kor':40,'eng':50},{'kor':70,'eng':30},{'kor':20,'eng':60}]
def vfn(n):
return n
def tkfn(n):
return n[0]
def tefn(n):
return n[1]
def dkfn(n):
return n['kor']
def mymax(dt,key):
mx = None
for n in dt:
if mx ... | true |
77ceddcb97389d8553cfbd99b174be591abb4852 | Python | gunnsa/TgrafProject2 | /box.py | UTF-8 | 769 | 2.671875 | 3 | [] | no_license | from dataclasses import dataclass
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from data import Vector
from data import Point
@dataclass
class Box:
begin_position: Point
end_position: Point
# motion: Vector
# size: Vector
color: tuple
# scale: V... | true |
7204b9498e8255100b5c8af08a9b745e2f303a83 | Python | msjithin/LeetCode_exercises | /LeetCode_exercises/LeetCode_exercises.py | UTF-8 | 163 | 2.734375 | 3 | [] | no_license |
import ex0123_buyAndSellStocks as ex123
prices = [3,3,5,0,0,3,1,4]
#prices = [1,2,3,4,5]
#prices = [7,6,4,3,1]
print( ex123.Solution().maxProfit(prices) ) | true |
c69839bb2de039cbb75d72076f753ab44105cefb | Python | shobhit-nigam/qti_panda | /day4/functions/11.py | UTF-8 | 127 | 3.203125 | 3 | [] | no_license | import matplotlib.pyplot as plt
listx = [1, 2, 3, 4]
listy = [11, 13, 17, 14]
plt.plot(listx, listy, color='red')
plt.show()
| true |
8b73138985b6623ac704c0c8847797b4d1dac069 | Python | JaydeepUniverse/python | /class/40-class.py | UTF-8 | 442 | 3.421875 | 3 | [] | no_license | class Song(object):
def __init__(self, lyrics):
self.lyrics = lyrics
def sing_me_a_song(self):
for line in self.lyrics:
print line
happy_bday = Song(["Happy birthday to you",
"Happy birthday dear Jaydeep",
"Happy birthday to you"])
aashiqui2 ... | true |
e629748732a34fb351711ec9e9766c497bc1633d | Python | wsgan001/PyFPattern | /Data Set/bug-fixing-5/f70146e922873ddb4b8c2b70fe6f2ff81a8fb35d-<__init__>-fix.py | UTF-8 | 319 | 2.9375 | 3 | [] | no_license | def __init__(self, name='weight', n_power_iterations=1, eps=1e-12):
self.name = name
if (n_power_iterations <= 0):
raise ValueError('Expected n_power_iterations to be positive, but got n_power_iterations={}'.format(n_power_iterations))
self.n_power_iterations = n_power_iterations
self.eps = eps | true |
292fecec5f3277e322357504a6c8b7e05a6650cc | Python | tash1629/Game-of-Bingo | /gameBingo.py | UTF-8 | 3,732 | 3.765625 | 4 | [] | no_license | # File: gameBingo.py
# the game of bingo
# 4x4 bingo board
# by: Rushnan Alam
from graphics import *
from random import *
def main():
row1, row2, row3, row4 = printIntro()
windows = drawBoard(row1, row2, row3, row4)
count_ = playGame(windows, row1, row2, row3, row4)
printSummary(count_)
def ... | true |
4ac7f190f2cbfe093f660dd19e88ff6ac8f78a9e | Python | dannywillems/radix-dlt-python | /radixdlt/crypto/utils.py | UTF-8 | 114 | 2.59375 | 3 | [] | no_license | import hashlib
def double_sha256(bytestr):
return hashlib.sha256(hashlib.sha256(bytestr).digest()).digest()
| true |
e20c08ff810e76ed80d649b5b6245635eb394735 | Python | anuar-a/DSA-Algorithmic-toolbox | /gcd.py | UTF-8 | 183 | 3.59375 | 4 | [] | no_license | # Uses python3
def gcd(a, b):
while b != 0:
temp = b
b = a % b
a = temp
return a
numbers = input()
a, b = numbers.split()
print(gcd(int(a), int(b)))
| true |
d8a4cbbb6d9b66ca2cccb4fa532cb3e23c7f2193 | Python | fuyan2/ECE521_Intro_ML | /A2/part_1_2.py | UTF-8 | 785 | 2.78125 | 3 | [] | no_license | from common import *
# part 1.2
# as batch_size increase to the size of training data,
# the training MSE reduces, however, the training time increases
_, axis_1 = plt.subplots()
batch_sizes = [500, 1500, 3500]
for i in range(len(batch_sizes)):
W, b, loss, accuracy, lin_op = linear_optimizer(0.005, 0)
batch_size =... | true |
c68974c23af96020636f268403545fdb3b00df08 | Python | ravshanyusupov/ravshan | /infi.py | UTF-8 | 1,669 | 3.109375 | 3 | [] | no_license | # a = int(input("a soni: "))
# b = int(input("b soni: "))
# c = int(input("c soni: "))
# d = int(input("d soni: "))
# e = int(input("e soni: "))
# s = [a,b,c,d,e,]
# o = max(s)
# print(o)
# a = int(input("son: "))
# if a == 2:
# print("28 kun bor bu oyda")
# elif a == 4 or a == 6 or a == 9 or a == 11:
# print... | true |
265a5304deab118d0da5441a396ad4964cc3d966 | Python | sadqwerch/Bolaris | /user_classfication/my_sql_sentence.py | UTF-8 | 325 | 2.90625 | 3 | [] | no_license |
def my_sql(mysql_conn, sql):
try:
with mysql_conn.cursor() as cursor:
cursor.execute(sql)
mysql_conn.commit()
data = cursor.fetchall()
if len(data) > 0:
return data
except Exception as e:
print(sql)
print("Commit Failed!")
return ... | true |
928666ddb60ab1ed32c5ca0cf5314c2ae2303926 | Python | msuriyak/ME-757 | /recursive_polynomial.py | UTF-8 | 3,442 | 3.421875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.special import legendre
# *********** Evaluation ***********
def legendre_value(n, x):
value = np.zeros(n + 1)
value[0] = 1
value[1] = x
for i in range(2, n + 1):
value[i] = ((2 * i - 1) * value[i - 1] *
x - (i - ... | true |
2f57de3c84557899c80126cb9a492665756f0866 | Python | fwparkercode/IntroProgrammingNotes | /Notes/Fall2018/ch6A.py | UTF-8 | 9,347 | 4.65625 | 5 | [] | no_license | # Chapter 6 Notes, More Loops!
# Learn to master the FOR loop
# more with printing
print("Francis", "Parker") # Python automatically puts a space in between
print("Francis" + "Parker") # Concatenation smushes two strings together
print("Python" * 10) # printing multiple times
# Python automatically adds "\n" to ... | true |
2f53f19a5c879b266767d040ba7bfbe8582bf695 | Python | Kausara-Kpabia/100DaysOfCode-Exercises | /exercise.py | UTF-8 | 526 | 4.1875 | 4 | [] | no_license | """"
#Exercise 1-Hello
name = input("What is your name")
print('hello', name)
"""
"""
#Exercise 2- Area of a room
width = float(input('What is the width of your room'))
length = float(input('What is its length'))
print('The area of your room is :', str(width * length) , 'fts')
"""
"""
#Exercise 3- Area of a field
wid... | true |
33cec4e59f5ed288a177bb4a7e36849d608ca01c | Python | HONGWENHT/LeetCode | /264.py | UTF-8 | 650 | 3.5625 | 4 | [] | no_license | import collections
class Ugly:
def __init__(self):
self.nums = [1, ]
p2 = p3 = p5 = 0
for i in range(1, 1690):
ugly = min(self.nums[p2] * 2, self.nums[p3] * 3, self.nums[p5] * 5)
self.nums.append(ugly)
if ugly == self.nums[p2] * 2:
p2 += ... | true |
0938f530e011d7b3fe70f3733419d6cb0ea1524a | Python | meutband/DailyAssignments | /Natural_Language_Processing/Exercise1.py | UTF-8 | 2,367 | 3.390625 | 3 | [] | no_license | from pymongo import MongoClient
from nltk.tokenize import word_tokenize
from nltk.stem.snowball import SnowballStemmer
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import numpy as np
from sklearn.metrics.pairwise import linear_kernel
import pandas as pd
'''
Setup using MongoDB.
- Marks... | true |
a580cadcdaeaad9d9921e319a42c599572adfb9c | Python | Incertam7/Infosys-InfyTQ | /Data-Structures-and-Algorithms/Day-2/Linked-List-Operations/Insertion.py | UTF-8 | 2,621 | 4.03125 | 4 | [] | no_license | class Node:
def __init__(self, data):
self.__data = data
self.__next = None
def get_data(self):
return self.__data
def set_data(self, data):
self.__data = data
def get_next(self):
return self.__next
def set_next(self, next_node):
self._... | true |
2e7430c3ecae252d5242826b25f34701f5fd1655 | Python | shlomimatichin/codeprocessing | /py/amatureguard/meaninglessidentifier.py | UTF-8 | 558 | 2.9375 | 3 | [] | no_license | import string
CHARACTERS = string.ascii_lowercase + string.ascii_uppercase + string.digits + '_'
OBJECTIVE_C_KEEP_INIT_PREFIX = False
def meaninglessIdentifier(spelling, id):
assert id < len(CHARACTERS) ** 3
first = (id / (len(CHARACTERS) ** 2)) % len(CHARACTERS)
second = (id / len(CHARACTERS)) % len(CHA... | true |
9323772e4a6bde3455ead1262323f32757962f6a | Python | mnastorg/CR_INTERPOLATION_PROJ_MOD | /CODES/rotation_dim_1.py | UTF-8 | 2,391 | 2.734375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def rotation(G1,G2,t):
G1 = G1.reshape(G1.shape[0]*G1.shape[1])
G2 = G2.reshape(G2.shape[0]*G2.shape[1])
theta = np.arccos(np.dot(G1,G2)/(np.linalg.norm(G1)*np.linalg.norm(G2)))
w = G2/np.linalg.norm(G2)
... | true |
848024287c047514457c82559e66ac4e1f17335e | Python | jonathanmendoza-tx/data-structures | /doubly_linked_list/doubly_linked_list.py | UTF-8 | 4,179 | 4.4375 | 4 | [] | no_license | """
Each ListNode holds a reference to its previous node
as well as its next node in the List.
"""
class ListNode:
def __init__(self, value, prev=None, next=None):
self.prev = prev
self.value = value
self.next = next
"""
Our doubly-linked list class. It holds references to
the list's head and tail nodes.
""... | true |
6dede2177648e310011a9a924edce3a5b0073568 | Python | 2333paopao/KomiProject | /test_frame/test_perform/test_perform_notepad.py | UTF-8 | 702 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#====#====#====#====
#Author:
#CreatDate:
#Version:
#====#====#====#====
#ๅฏผๅ
ฅๆต่ฏ็จไพ
from test_case.test_case_notepad import TestCaseNotepad
class TestPerformNotepad:
#ๅๆฐไธบ่พๅ
ฅๆๆฌๅๆไปถไฟๅญ่ทฏๅพ
def __init__(self,text,save_path):
self.text = text
self.save_pat... | true |
dfd5dd95ee26cca99e4974716b999038e9a8afa9 | Python | Manash-git/Python-Programming | /python-programming-basic/none_type_cast.py | UTF-8 | 782 | 3.6875 | 4 | [] | no_license | # print('Test')
# x= None
# print(type(x))
# print(id(x))
# z= 10
# y= print(z)
# print(y)
# print(str(10.5))
# print(type(str(10.5)))
# print(str(0b1011))
# print(type(str(0b1011)))
# print(bool("hello"))
# print(bool("0"))
# print(bool(0))
# print(bool(""))
# print(bool(None))
# print(bool(" "))
# print(bool(0... | true |
103db8e8c5eca497360a576b5fa12262e06d63a8 | Python | macrdona/UserLogin | /Completed Login App/Hash.py | UTF-8 | 530 | 3.296875 | 3 | [] | no_license | import hashlib
#creating class hash
class Hash:
#contructor to initialize password
def __init__(self, password):
self.password = password
#return the hash value of the given password
'''After the password has been hashed, it is then converted into hexadecimal form.
It returns a... | true |
85c1a5ad9e6f089d4147ebe8869f55373139c7c5 | Python | akkikiki/katakana_segmentation | /tfissf/test_tfisfViterbiLattice.py | UTF-8 | 3,089 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | # coding: utf-8
import codecs
import sys
from segment_katakana_tfisf import TfisfViterbiLattice
import unittest
from unittest import TestCase
from sklearn.model_selection import KFold
TF_TRIE = "TF_TRIE"
ISF_TRIE = "ISF_TRIE"
class TestTfisfViterbiLattice(TestCase):
def test_segment_hashtags(self):
in_fi... | true |
3ec375873c07013c9a95364fae74fa0ed767f987 | Python | victorpham1997/Automatic-health-declaration-for-SUTD | /automatic_health_declaration_v3.py | UTF-8 | 11,250 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on 11/03/2021
Last edit on 11/03/2021
version 3
@author: T.Vic
note:
This version can bypass the captcha by utilising cv2 filters, BFS and pytesseract OCR. The script will attempt to make a number of attempts to inference the captcha and log in with the provided username and passwo... | true |
f0fb666f60ea01f9025b5641f3ebbe7fc2b675cc | Python | youngBai-c/100-Days-of-Code | /Beginner/1/1.3.py | UTF-8 | 232 | 3.703125 | 4 | [] | no_license | # input() will get user input in console
# Then print() will print the word "Hello" and the user input
#print("Hello "+input("What is your name?"))
# Example Input Angela
# Example Output 6
print(len(input("What is your name?")))
| true |
98edac331ebba563871cd02e2bbcf6fa3afe1f06 | Python | pmnyc/Data_Engineering_Collections | /trajectory_distance/traj_dist/pydist/erp.py | UTF-8 | 2,027 | 3.171875 | 3 | [] | no_license | import numpy as np
from basic_euclidean import eucl_dist
from basic_geographical import great_circle_distance
#############
# euclidean #
#############
def e_erp(t0,t1,g):
"""
Usage
-----
The Edit distance with Real Penalty between trajectory t0 and t1.
Parameters
----------
param t0 : le... | true |
a691f7fb988158c307f4cc3a10fcc74b8c12dfaf | Python | Iyamoto/stocksadvisor | /collectors/ema.py | UTF-8 | 6,587 | 2.734375 | 3 | [] | no_license | """Collect EMA 200"""
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
import datetime
import time
import logging
import fire
import requests
from influxdb import InfluxDBClient
import configs.alphaconf
import configs.influx
import configs.fxit
def get_ema200(symbol, age=5*23*3600):
influx_client... | true |
c6368e95f6e0febfaae2b4544171d5ee5c3d2402 | Python | CAU-SE-Project/UC-10-Disease-Management | /alarm3.py | UTF-8 | 1,619 | 2.75 | 3 | [] | no_license | # alarm3.py
import sys
from PyQt5.QtWidgets import *
import databaseConnection
class Alarm3(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.tableWidget = QTableWidget()
query_list = self.load_alarm()
rowNum = len(query_... | true |
3deb6aea6ad761f41dbc417cb1113a3cb42e2f1c | Python | Elenanikiforov/my_python | /cinema_price.py | UTF-8 | 7,956 | 3.5625 | 4 | [] | no_license | print("ะคะธะปัะผั:\n1.'ะััะฝะธัะฐ'\n2.'ะงะตะผะฟะธะพะฝั'\n3.'ะะตัะฝะฐัะฐั ะฑะฐะฝะดะฐ'\n")
film = int(input("ะัะฑะตัะธัะต ะฝะพะผะตั ัะธะปัะผะฐ: "))
if film == 1:
day = int(input("1. Cะตะณะพะดะฝั\n2.ะะฐะฒััะฐ\n"))
if day == 1:
time = int(input('ะัะฑะตัะธัะต ะฒัะตะผั:\n12 ัะฐัะพะฒ,16 ัะฐัะพะฒ, 20 ัะฐัะพะฒ:\n'))
if time == 12:
n = int(input("ะกะบะพะปัะบะพ ะฑะธ... | true |
68e481f0d057fbd69486c6a2d8cbf5a9767ced5d | Python | psegedy/schemathesis | /test/loaders/test_graphql.py | UTF-8 | 1,664 | 2.71875 | 3 | [
"MIT"
] | permissive | """GraphQL specific loader behavior."""
from io import StringIO
import pytest
from schemathesis.specs.graphql import loaders
RAW_SCHEMA = """
type Book {
title: String
author: Author
}
type Author {
name: String
books: [Book]
}
type Query {
getBooks: [Book]
getAuthors: [Author]
}"""
def test_graphql_... | true |
4f46c14a4d71b3aa83305b09f73950ba5c884814 | Python | thotte/competitor-price-scraping | /test_hallon.py | UTF-8 | 984 | 2.859375 | 3 | [] | no_license | """
hallon.py unit tests
(https://www.hallon.se/mobilabonnemang)
"""
import requests
from hallon import Hallon
hallon = Hallon("Hallon")
df = hallon.get_dataframe()
function_returns_list = hallon.process_dataframe(df)
def test_site_availability():
"""Test site availability"""
site = Hallon.website
... | true |
9d2239873e2251549e018b4dade871fc023bce60 | Python | another1s/Companyfreport | /financial_repot_pdf/code/debug_.py | UTF-8 | 6,716 | 2.671875 | 3 | [] | no_license | import pandas as pd
import tabula
from pandas.api.types import *
import numpy as np
import csv
import pdfplumber
import re
import warnings
warnings.filterwarnings("ignore")
TAG = 'PdfPlumber_Demo:'
class Util:
@staticmethod
def get_page_text(text_page):
text_str = []
text_list = []
for... | true |
758dcb1574ad7d8789c01505826013f0c254af56 | Python | wert23239/SmashBot | /util.py | UTF-8 | 6,200 | 2.609375 | 3 | [
"MIT"
] | permissive | import melee
import pandas as pd
import numpy as np
import random
from pathlib import Path
from melee import Button
from melee.enums import Action
from keras_pandas.Automater import Automater
from keras.models import model_from_json
class Util:
def __init__(self,logger=None,controller=None,config=None):
... | true |
76d752fd634565f7aee4b36e841fa13f68f38829 | Python | Nitin2611/15_Days-Internship-in-python-and-django | /DAY 3/task5.py | UTF-8 | 110 | 3.703125 | 4 | [] | no_license | x = 46
y = 53
if x > y:
print("x is greater number")
if y > x:
print("y is greater number")
| true |
fe0edb52088967b5f63fd9eb20ce089398a2c27a | Python | ooooo-youwillsee/wechat-data-structures-and-algorithms | /1-50/27/main.py | UTF-8 | 400 | 3.234375 | 3 | [] | no_license | # coding=utf-8
class Solution:
def solution(self):
sum = 0
for i in range(2, 5 * pow(9, 5) + 1):
if self.sum4(i) == i:
sum += i
return sum
def sum4(self, n):
sum = 0
while n:
sum += pow(n % 10, 5)
n //= 10
ret... | true |
cd2f90b535285d46dfccf2e407f9543511935c34 | Python | tanyabudinova/hack-bulgaria-Python101 | /week6/Generators/book_reader.py | UTF-8 | 661 | 3.28125 | 3 | [] | no_license | from os import system
def book(*files):
for file in files:
with open(file, 'r') as f:
for line in f:
yield line
def read_chapter(next_line, book_lines):
while next_line[0] != '#':
print(next_line.strip())
next_line = next(book_lines)
system("""bash -c ... | true |
d861f5dfa4b79c83463924d3dd81bbed7542836e | Python | brunolcarli/AlgoritmosELogicaDeProgramacaoComPython | /livro/code/capitulo5/exemplo49.py | UTF-8 | 1,951 | 3.8125 | 4 | [] | no_license | #entrar com a disciplina
disciplina = input("Insira sua disciplina: ")
#Entrar com a quantidade de alunos da turma
quantidade = int(input("Insira o numero de alunos da turma: "))
#a turma e uma lista com tamanho igual a quantidade informada
turma = [alunos for alunos in range(quantidade)]
#para cada aluno na turma
fo... | true |
2b811bbef7640de0c2f78f5fa8ae95ae380e469c | Python | mzhuang1/lintcode-by-python | /็ฎๅ/141. x็ๅนณๆนๆ น.py | UTF-8 | 486 | 3.984375 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
ๅฎ็ฐ int sqrt(int x) ๅฝๆฐ๏ผ่ฎก็ฎๅนถ่ฟๅ x ็ๅนณๆนๆ นใ
ๆ ทไพ
sqrt(3) = 1
sqrt(4) = 2
sqrt(5) = 2
sqrt(10) = 3
"""
class Solution:
"""
@param x: An integer
@return: The sqrt of x
"""
def sqrt(self, x):
# write your code here
if x == 0:
return 0
if x == 1... | true |
2439bbaa8001a50e3088ff10ff792bf725370d2e | Python | Susros/NUesc | /model/svm_gridsearch_plot.py | UTF-8 | 2,351 | 3.171875 | 3 | [
"MIT"
] | permissive | """ SVM Grid Search Plot
This script load Grid Search results and plot heatmap for
C Parameters vs Gamma Parameters vs Accuracy.
Author: Kelvin Yin
"""
import sys
import pickle
import plotly.graph_objects as go
from plotly.subplots import make_subplots
# Output Directory
OUTPUT_DIR = 'output/'
# Grid Search Parma... | true |
f2a3d40f08af6ae9ca6643e5766f61691883fcde | Python | guilhermeafonsoch/neural-networks | /cancer-de-mama.py | UTF-8 | 2,139 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 21:45:34 2021
@author: guilh
"""
import numpy as np
from sklearn import datasets
def sigmoid(soma):
return 1 / (1 + np.exp(-soma))
#DERIVADA PARCIAL DA SIGMOID
def derivadaSigmoid(sig):
return sig * (1 - sig)
#database
base = datasets.load_breast_cancer()
e... | true |
87bb86d4da9d0aa719d0d6e30592d5f4b0b9ecda | Python | DevMan-VR/minizinc | /repo/readMKP.py | UTF-8 | 1,318 | 2.84375 | 3 | [] | no_license |
class readMKP:
def read_MkpProblems():
problems = dict();
problems['data'] = []
problems['capacidad'] = []
problems['beneficio'] = []
problems['pesos'] = []
problems['optimo'] = []
f = open("./mkp_problems.txt", "r")
lines = f.readlines()
for line in lines:
if '#' in line:
... | true |
d192873f077d2ff920b0a69161d9ebeacecb71ad | Python | ll0816/My-Python-Code | /decorator/decorator_with_function_args.py | UTF-8 | 907 | 3.859375 | 4 | [] | no_license | # !/usr/bin/python
# -*- coding: utf-8 -*-
# Decorator function with Function Args
# Liu L.
# 12-05-15
import datetime
def decorator_maker_with_args(decorator_arg1):
def decorator(func):
def wrapper(*args):
print "Calling function: {} at {} with decorator arguments: {} and function arguments {... | true |
2bffd1f93ade43d54ca1a2f9fa505cfa7550d0f7 | Python | FarsBein/python-terminal-chat | /client.py | UTF-8 | 931 | 3.046875 | 3 | [] | no_license | import threading
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 59000))
def client_receive():
while True:
try:
message = client.recv(1024).decode('utf-8')
if message == "quit" or message == "q":
break
... | true |
9bc07e166414ebb22ce002bf520b22de140e769f | Python | DR-84/winc_backend_opdrachten | /opdracht_031_class_objects_2/class_objects_2.1.py | UTF-8 | 3,532 | 3.28125 | 3 | [] | no_license | # is het idee van de opdracht dat we onze code/functions uit "return value"
# herschrijven? of gaat het het om het eind resultaat.
# -------------- opdracht 1------------------
class Player:
def __init__(self, name, num, team):
self.full_name = name
self.id = num
self.team = team
class ... | true |
85e9d3a895ac8eeb8293ea471e0785b792253860 | Python | luoyt14/deeplearningHW | /hw2/codes/functions.py | UTF-8 | 5,630 | 2.765625 | 3 | [] | no_license | import numpy as np
def im2col(x, field_height, field_width, padding=1, stride=1):
N, C, H, W = x.shape
out_height = int((H + 2 * padding - field_height) / stride + 1)
out_width = int((W + 2 * padding - field_width) / stride + 1)
i0 = np.repeat(np.arange(field_height), field_width)
i0 = np.tile(i0... | true |
ee3da7b40af8192dc6fe4b86d9f615bbf14714b9 | Python | grayfox7744/quantLibrary | /utility/dataframefeed.py | UTF-8 | 1,112 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 08 22:26:36 2016
@author: Administrator
"""
from pyalgotrade.barfeed import membf
from pyalgotrade import dataseries
from pyalgotrade import bar
class Feed(membf.BarFeed):
def __init__(self, frequency=bar.Frequency.DAY, maxLen=dataseries.DEFAULT_MAX_LEN):
me... | true |
77d6013525ce507a6e84141bcb2d7ef6432be94d | Python | ThunderFlurry/django-th | /django_th/tasks.py | UTF-8 | 9,079 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | # coding: utf-8
from __future__ import unicode_literals
from __future__ import absolute_import
import arrow
# django
from django.conf import settings
from django.core.cache import caches
from django.utils.log import getLogger
# django-rq
from django_rq import job
# trigger happy
from django_th.services import defau... | true |
aac99e1f9ca3816465d60fd950c388131954ba55 | Python | shokri-matin/Python_Basics_OOP | /MRO.py | UTF-8 | 436 | 3.171875 | 3 | [] | no_license | class X:
i = 0
class Y:
i = 1
class Z:
i = 2
class A(X, Y):
pass
class B(Y, Z):
pass
class M(B, A, Z):
pass
AObj = A()
print(AObj.i)
BObj = B()
print(BObj.i)
MObj = M()
print(MObj.i)
# Output:
# [<class '__main__.M'>, <class '__main__.B'>,
# <class '__main__.A'>, <class '__main__.... | true |
5a5aef44c8c6c3130d60ba653f47923c53242587 | Python | joansanchez/MapReduce | /task5/model1/reducer.py | UTF-8 | 211 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python2
import sys
range = []
for range_years in sys.stdin:
year = range_years.strip().split("\t")
range.append(year[1])
range.append(year[2])
print (min(range) + "\t" + max(range))
| true |
e075c11d4348674d81362fb80e9a37db1b434b39 | Python | miaozaiye/PythonLearning | /miaozaiye/introcs-python/helloworld.py | UTF-8 | 364 | 2.5625 | 3 | [
"MIT"
] | permissive | #-----------------------------------------------------------------------
# helloworld.py
#-----------------------------------------------------------------------
import stdio
# Write 'Hello, World' to standard output.
stdio.writeln('Hello, World')
#--------------------------------------------------------------------... | true |
404c0ae1dbe01022c3667f89f26e99223f3948d3 | Python | sunsetoversunset/data-mutations | /Indexing/indexer-intersections.py | UTF-8 | 1,182 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
import fiona
import shapely.geometry
import csv
import sys
import os
debug = False
def process(f):
inFile = f
outFileN = "intersections-n.csv"
outFileS = "intersections-s.csv"
with fiona.open(inFile) as pointsSrc:
lineSrc = fiona.open('../Street Data/sunset-single-line.gpkg')
fo... | true |
5296309d359c6e02ef109a704912056cf407afdb | Python | matiasbrunofornero/Products-Tkinter | /index.py | UTF-8 | 3,304 | 3.328125 | 3 | [] | no_license | from tkinter import ttk
from tkinter import *
import sqlite3
class Product:
db_name = 'database.db'
def __init__(self, window):
self.wind = window
self.wind.title('Products Application')
# Creating a Frame Container
frame = LabelFrame(self.wind, text='Register a Product')
... | true |
13f5c2f10381d57983b836f83c219fe74fdfb41c | Python | 8589/codes | /python/cookbook/strings/variables_to_str.py | UTF-8 | 1,002 | 2.96875 | 3 | [] | no_license | class Info:
def __init__(self, name, n):
self.name = name
self.n = n
class safesub(dict):
def __missing__(self, key):
return '{' + key + '}'
if __name__ == '__main__':
from minitest import *
with test("format"):
s = '{name} has {n} messages.'
s.forma... | true |
8b3fbee9b4ab861616bdef95b1fa60cc2356c124 | Python | hypothesis/h | /tests/h/paginator_test.py | UTF-8 | 9,206 | 2.84375 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause",
"BSD-2-Clause-Views"
] | permissive | from unittest import mock
import pytest
from webob.multidict import NestedMultiDict
from h.paginator import paginate, paginate_query
class TestPaginate:
def test_current_page_defaults_to_1(self, pyramid_request):
"""If there's no 'page' request param it defaults to 1."""
pyramid_request.params =... | true |
7ed7e99d239e416f176efe2ca9bcde677188afbf | Python | Eliacim/Checkio.org | /Python/Incinerator/The-warriors.py | UTF-8 | 2,577 | 4.1875 | 4 | [] | no_license | '''
https://py.checkio.org/en/mission/the-warriors/
I'm sure that many of you have some experience with computer games. But have
you ever wanted to change the game so that the characters or a game world would
be more consistent with your idea of the perfect game? Probably, yes. In this
mission (and in several subseque... | true |
d1e3abda9585ad5ea89939937c81faabc84bee5b | Python | AlbertFutureLab/OpenSentiment | /IntegratedTSA/test/haha.py | UTF-8 | 2,134 | 2.703125 | 3 | [] | no_license | from tensorflow import keras
import tensorflow as tf
import numpy as np
class MyModel(keras.Model):
def __init__(self, num_classes=10, *args, **kwargs):
print(args, kwargs)
super(MyModel, self).__init__(name='my_model', *args, **kwargs)
self.num_classes = num_classes
self.dense_1 = tf.layers.Dense(un... | true |
e95e097a6f0183ba62469363450d186d4a28665d | Python | jaeyun95/Programmers | /level2/level2_ex46.py | UTF-8 | 889 | 3.578125 | 4 | [] | no_license | #(46) ๊ดํธ ๋ณํ
def balance_check(p):
check = 0
for index,char in enumerate(p):
if char == '(': check += 1
else: check -= 1
if check == 0: return index + 1
def right_check(u):
check = [u[0]]
for char in u[1:]:
if len(check) == 0: return False
if char == '(':... | true |
3ad0917ea6082036a301ae16667cba12008f24b3 | Python | deepthi2105/GFG | /Array/CyclicallyRotateArray.py | UTF-8 | 127 | 2.984375 | 3 | [] | no_license | def rotatearr(a):
a[:]=a[len(a)-1:]+a[:len(a)-1]
return a
a=list(map(int,input().split(" ")))
print(rotatearr(a))
| true |
456a823989044276744a3e367dc0b7638bd7430e | Python | hyoretsu/uri-online-judge | /python/beginner/1009.py | UTF-8 | 143 | 3.546875 | 4 | [] | no_license | _employeeName = input()
fixedSalary = float(input())
salesBonus = float(input())
print(f"TOTAL = R$ {fixedSalary + (salesBonus * 0.15):.2f}")
| true |
37d6d9c916fcd909ce8fdb82945ed11145d8603c | Python | nathhje/EvolutionaryComputing | /Old/run_results.py | UTF-8 | 998 | 2.515625 | 3 | [] | no_license | import sys, os
sys.path.insert(0, 'evoman')
from environment import Environment
from ai_controller import player_controller
from operator import itemgetter
from smart_functions import *
import random
import matplotlib.pyplot as plt
index = 0
experiment_name = 'dummy_demo'
if not os.path.exists(experiment_name):
o... | true |
beba238cdf8ce68f7a2162fc0a92f244c2ec869d | Python | chain-bot/alert | /firestore/__init__.py | UTF-8 | 1,168 | 2.6875 | 3 | [] | no_license | import logging
import firebase_admin
import os
from firebase_admin import credentials, firestore
logger = logging.getLogger(__name__)
FIRESTORE_JSON = os.getenv('FIRESTORE_ADMIN')
if FIRESTORE_JSON is None:
logger.warning("LOCAL USE")
else:
with open("firestore-admin.json", "w") as jsonFile:
jsonFile.... | true |
eef3bc8bbff3f27b12d5c539fcfccddf43c38fa2 | Python | 0xhrsh/rendezvous_with_.py | /writer.py | UTF-8 | 267 | 2.875 | 3 | [] | no_license | # data writer
import json
f = open('data.json','a')
print("enter number of data to be added")
n=input()
#print("n")
#n=10
i=0
while i<int(n):
print("Enter Accno and Pasw respectively")
x =dict(accno=input(),pasw=input())
json.dumps(x)
#pprint(json.dumps(x))
i+=1 | true |
0e9a24d332b2cbf6eddc6b9b7f30f984232c20d2 | Python | AsimPoptani/mhealth-playground | /Stuffs/Over_powered_neural_network_model_UF_.py | UTF-8 | 3,843 | 2.78125 | 3 | [] | no_license | from helper_functions import mhealth_get_dataset
import random
import tensorflow as tf
import numpy as np
from collections import defaultdict
# Hyperparameters
# This is how many samples per col
data_length = 2
# Prep data
# Get the dataset
dataset=mhealth_get_dataset()
# shuffle dataset
random.shuffle(dataset)
#... | true |
494d22d9ee09c62abab7635da3de97c55ab4915b | Python | NeonedOne/Basic-Python | /First Lab (1)/Short Small Talk.py | UTF-8 | 552 | 3.5625 | 4 | [] | no_license | # ะะปะตะบัะตะน ะะพะปะพะฒะปะตะฒ, ะณััะฟะฟะฐ ะะกะะ-07-19
answer = input("ะั ััะพ, ะบะฐะบ ะฝะฐัััะพะตะฝะธะต?\n")
if "ั
ะพัะพัะตะต" in answer or "ะฟัะตะบัะฐัะฝะพ" in answer:
print("ะัะปะธัะฝะพ, ั ะผะตะฝั ัะพะถะต ะฒัั ั
ะพัะพัะพ ))")
elif "ะฟะปะพั
ะพ" in answer or "ัะถะฐัะฝะพ" in answer:
print("ะะธัะตะณะพ, ัะบะพัะพ ะฒัั ะฝะฐะปะฐะดะธััั")
elif "!" in answer or "?" in answer:
print("ัะผะพัะธ... | true |
5ccc9877ddfcb635e6cac051e2e51043db55178b | Python | beOk91/baekjoon2 | /baekjoon9086.py | UTF-8 | 115 | 3.328125 | 3 | [] | no_license | n=int(input())
for _ in range(n):
text=input()
print(text*2 if len(text)==1 else text[0]+text[len(text)-1]) | true |
197c63e22ff0ed45a1e113018f89564d04467160 | Python | KritiBhardwaj/PythonExercises | /functions.py | UTF-8 | 2,233 | 4.375 | 4 | [] | no_license | # # Q1 Convert fahrenheit input to celcius
# celcius = (fahrenheit - 32)* 5/9
def convert_to_C(input_in_F):
temp_in_F = float(input_in_F)
celcius = (temp_in_F - 32) * (5/9)
print(f"Temperature {temp_in_F}F in celcius is: {celcius: .2f}C ")
input_in_F = input("Enter temperature in Fahrenheit: ")
convert... | true |
09343f6d188e26b4814842e9d02efcfa1206129a | Python | cqemail/pyda | /is_triangle.py | UTF-8 | 1,867 | 4.15625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# __author = 'c08762'
"""่พๅ
ฅ3ไธชๆฐ๏ผๅคๆญ่ฝๅฆ็ปๆไธ่งๅฝข"""
def is_positive(numb):
"""่พๅ
ฅๅๆณๆงๆฃๆฅ๏ผๅฟ
้กป่พๅ
ฅๆญฃๆฐ๏ผไธๆฏๆ็งๅญฆ่ฎกๆฐๆณ"""
try:
float(numb)
except:
return False
else:
if float(numb) <= 0:
return False
else:
return True
def is_pythagoras(a, b, c):
... | true |
0ba95845c9a52d5a6a969bec2b2cdb984ab3183b | Python | USTC-Titanic/webapp | /user.py | UTF-8 | 9,836 | 2.5625 | 3 | [] | no_license | import re, random, hashlib, json
from string import ascii_letters as letters
from page import PageHandler, admin_username
from database import Database
# ้ๆบ็ๆ้ฟๅบฆไธบ 5 ็ salt, ็ฑๅคงๅฐๅๅญๆฏๆๆ
def make_salt(length=5):
# salt = []
# for i in range(length):
# salt.append(random.choice(letters))
# return ''.join(salt)
return '... | true |
5f9e50bf14ca1c8c17ddafb2314552034e485f0f | Python | jeevitharajasekhar/Python_11_am_Offline | /Day02_Datatypes/Ex2.py | UTF-8 | 139 | 2.640625 | 3 | [] | no_license | #list type append
mobiles = [ 'Samsung', 'Lg', 'Sony', 'Mi', 'RedMe', 'Vivo', 'Oppo', 'Lg', 'Sony']
mobiles.append('Iphone')
print(mobiles) | true |
c0c94798a31f304a1afc3601599b95836e72a98e | Python | ane4katv/STUDY | /Basic Algorithms/Bit Manipulation/from_book_5.1_combine_2_binary_range.py | UTF-8 | 1,153 | 3.5625 | 4 | [] | no_license | def insert_bin_to_another(N, M, i, j):
left_border = ~((1 << j) - 1)
right_border = (1 << i) - 1
mask = left_border | right_border
obnulenie = N & mask
result = obnulenie | M << i
return bin(result)
print(insert_bin_to_another(221, 10, 2, 6))
"""
N, M 32 bit nums
i, j bit positions
Insert M bet... | true |
71890ef18ba587ca79c15bb75cea4c8cec82a2fd | Python | fog-gates/Markov-Chain-Sentence-Generator | /markov.py | UTF-8 | 1,094 | 3.453125 | 3 | [] | no_license | testTxt = "the theremin is theirs, ok? This is a theremin. This is not anything but a theremin."
nGrams = []
nextChar = []
import random
#Creates the nGram object which stores the necessary information
class nGram:
def __init__(self, name, count, next):
self.ngram = name
self.count = count
... | true |
a82dbed0dbfcae8accd9f7872871b8d8b59447bc | Python | commaai/panda | /tests/elm_throughput.py | UTF-8 | 1,030 | 2.828125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import socket
import threading
import select
class Reader(threading.Thread):
def __init__(self, s, *args, **kwargs):
super(Reader, self).__init__(*args, **kwargs)
self._s = s
self.__stop = False
def stop(self):
self.__stop = True
def run(self):
... | true |
58cd10a448ebd2efeed5077874db310ec42e9a37 | Python | LawerenceLee/coding_dojo_projects | /python_stack/hospital.py | UTF-8 | 1,776 | 3.625 | 4 | [] | no_license | import hashlib
class Patient():
def __init__(self, name, allergies=""):
self.name = name
self.allergies = allergies
self.bed_number = None
self.id = hashlib.sha512(name + allergies).hexdigest()[-8:].upper()
def __str__(self):
return "PATIENT-ID: {}\nNAME: {}\nALLERGIES... | true |
a3983f2eaa5c87c11ba09a61567c591882829f4f | Python | pedro-f-nogueira/TV-data-analysis | /03_text_mining/gen_t_python_programs.py | UTF-8 | 1,415 | 2.8125 | 3 | [] | no_license | # coding=utf-8
"""
.. module:: gen_t_python_programs.py
:synopsis: This module generates cleans the program description and determines its the language
.. moduleauthor:: Pedro Nogueira <pedro.fig.nogueira@gmail.com>
"""
import os
import sys
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if... | true |
ef8d7b56016b415cdb1ca4fb4a74685491ae10d5 | Python | NamanBalaji/Python-programs | /Tic Tak Toe.py | UTF-8 | 2,618 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jun 6 11:07:48 2020
@author: Naman Balaji
"""
entries =[' ',' ',' ',' ',' ',' ',' ',' ',' ']
win = ''
player = 'player1'
def draw_board(val):
print(val[6]+'|'+val[7]+'|'+val[8])
print('-|-|-')
print(val[3]+'|'+val[4]+'|'+val[5])
print('... | true |
e67ff1d116b92f9e367ef24b2254082fd9db4765 | Python | stratosgear/eve-swagger | /eve_swagger/definitions.py | UTF-8 | 1,871 | 2.734375 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
eve-swagger.definitions
~~~~~~~~~~~~~~~~~~~~~~~
swagger.io extension for Eve-powered REST APIs.
:copyright: (c) 2016 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
from collections import OrderedDict
from flask import current_app as app
def definit... | true |
b6ff62db13829c24d908adbeb098c45a3d76bdd7 | Python | streppneumo/isp | /CellScribe/logic.py | UTF-8 | 2,013 | 3.234375 | 3 | [] | no_license |
from foundation import Composite, Added
from registry import Registered
class Logicable(object):
# this is an Abstract Base Class
def __and__(self, other):
return And(self, other)
def __rand__(self, other):
return self.__and__(other)
def __or__(self, other):
return Or(self,... | true |
8189aa8fdd5a5db89eee2104826a6a7eed4c9d6a | Python | SeonJongYoo/Algorithm | /BOJ/ForCodingTest/Bruteforce-Permutation/BeforPermutation.py | UTF-8 | 1,294 | 3.0625 | 3 | [] | no_license | # ์ด์ ์์ด
# import sys
# import itertools as it
#
#
# n = int(sys.stdin.readline().rstrip())
# inp = list(map(int, sys.stdin.readline().rstrip().split()))
# ck = False
# for i in range(1, n+1):
# if i == inp[i-1]:
# ck = True
# else:
# ck = False
# break
# if ck:
# print(-1)
# else:
#... | true |
4a171e15bb6f2f3edf088401afa8a0a3464f4fa4 | Python | MinCheng123/Python | /leetcode/28 Implement strStr().py | UTF-8 | 1,225 | 3.34375 | 3 | [] | no_license | class Solution(object):
def strStr(self, haystack, needle):
"""
:type haystack: str
:type needle: str
:rtype: int
"""
ans=0
flag=0
complete=0
if len(haystack)==0 and len(needle)==0:
return 0
if len(haystack)==0 or len(needle... | true |
86570fa1ff2ceb6c5241ca33dfed85d2ba67c7b2 | Python | switchell1990/Python-Exercises | /stars_diamond_shape_5.py | UTF-8 | 1,094 | 4.34375 | 4 | [] | no_license | def star_diamand_shape(n):
"""
Write a program that produce the following output giving an integer input n.
Expected Output:
n=1 n=2 n=3 n=4 n=5 n=9
* * * * * *
* *** *** *** ***
* ***... | true |
652ad6c3772764d7275318dc965bc2ac4ce436c0 | Python | mjamesruggiero/tripp | /tripp/dimensionality.py | UTF-8 | 1,651 | 3.046875 | 3 | [
"BSD-3-Clause"
] | permissive | import algebra
import gradient
from functools import partial
def direction(w):
mag = algebra.magnitude(w)
return [w_i / mag for w_i in w]
def directional_variance_i(x_i, w):
"""the variance of the row x_i in the direction determined by w"""
return algebra.dot(x_i, direction(w)) ** 2
def directiona... | true |
c30edb19eb8da668da638726ca7d351d0d802ea3 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2420/60699/239378.py | UTF-8 | 290 | 3.078125 | 3 | [] | no_license | cnt=int(input())
def func(e):
while e > 0:
if e % 10 == 0:
return False
e//=10
return True
for i in range(1,cnt//2+1):
if func(i) and func(cnt-i):
list1=[]
list1.append(i)
list1.append(cnt-i)
print(list1)
break | true |
362086e41eda543491c4e0966bcf5fb22c93fdc1 | Python | ninadangchekar96/ga-learner-dsmp-repo | /Census---First-Project-using-Numpy/code.py | UTF-8 | 1,416 | 3.34375 | 3 | [
"MIT"
] | permissive | # --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
data = np.genfromtxt(path,delimiter=",",skip_header=1)
census = np.concatenate((data,new_record))
# -----... | true |
58fb5fed71fde71f14ce6f9618084309bc19236a | Python | Parthi3610/pandas_workbook | /src/chapter02/c2_df2.py | UTF-8 | 811 | 2.9375 | 3 | [] | no_license | import pandas as pd
import numpy as np
#college = pd.read_csv("C:/Users/preet/PycharmProjects/pandas_workbook/src/data/college.csv")
colleges = pd.read_csv("../data/college.csv", index_col="INSTNM")
colleges_ugds= colleges.filter(like="UGDS_")
print(colleges_ugds)
name = "Northwest-Shoals Community College"
print(c... | true |
fe283bd2ba37fee9d8bb02ab12f0a62b55f90b3d | Python | SakshamDhiman180/Facial-recognition-system | /faces-train.py | UTF-8 | 1,857 | 2.78125 | 3 | [] | no_license | import os
from PIL import Image
import numpy as np
import cv2
import pickle
import time
BASE_DIR=os.path.dirname(os.path.abspath(__file__))# returning the dir path
image_dir = os.path.join(BASE_DIR,"images")# looking for images folder
face_cascade = cv2.CascadeClassifier('cascades/data/haarcascade_frontalface_alt2.x... | true |
63ea0337d8c90851029671e1ba131460a7a3711e | Python | tenebrion/slack_bot | /google_shorten_url.py | UTF-8 | 723 | 3.109375 | 3 | [] | no_license | import json
import requests
import remove_chars
from misc import apis
# Setting up initial variables
API_KEY = apis.google()
def return_shorter_url(url):
"""
This simple method will take a long url and return a short url
:param url:
:return:
"""
# found out that the entries were coming over i... | true |