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
fb80aaf5d023b4f6d16e32fb9865e6bfbf4cf52b
prasanthtummala/ArtGallery-DataBase
/insertartwork.py
UTF-8
601
2.984375
3
[]
no_license
#!/usr/bin/python import pymysql # Open database connection db = pymysql.connect("localhost","root","123456","artgallery" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Prepare SQL query to INSERT a record into the database. sql = """INSERT INTO artwork(title, type,year,price,name...
true
c862bb127344011a4aa0b05aa2c53d104d18924c
hampusrosvall/leetcode
/longest_palindromic_substring.py
UTF-8
641
3.75
4
[]
no_license
def longestPalindrome(s): longest_palindrome = "" for i in range(1, len(s) - 1): odd = isPalindrome(i - 1, i + 1, s) even = isPalindrome(i - 1, i, s) longest_current = longestString(odd, even) longest_palindrome = longestString(longest_current, longest_palindrome) return ...
true
a60d0960fc817cdc93f65e30d36be27ec5021d50
t-thirupathi/nyc-taxi
/src/initial.py
UTF-8
4,329
3.375
3
[]
no_license
import pandas as pd import numpy as np from datetime import datetime from sklearn.linear_model import LogisticRegression from sklearn.linear_model import LinearRegression from haversine import haversine train = pd.read_csv('../input/train.csv') test = pd.read_csv('../input/test.csv') # Train on lower number of points...
true
e70338e7e0b0effe19426aac384c1048548c06ed
yogeshrnaik/python
/linkedin/Ex_Files_Python_EssT/Exercise Files/Chap07/kwargs.py
UTF-8
1,217
3.6875
4
[]
no_license
#!/usr/bin/env python3 # Copyright 2009-2017 BHG http://bw.org/ def printSeparator(): print('*****************************************************************') def main(): printSeparator() print("Variable Keyword arguments...") variableKeywordArgsExample(Buffy = 'meow', Zilla = 'grr', Angel = 'rawr')...
true
6e0d99e04fc9a4b562499b219e9fae174dc71dc2
zcgzcgzcg1/MRC_book_en
/Chapter_2/2.1.2_Tokenization_Package.py
UTF-8
234
2.90625
3
[]
no_license
# Install spaCy # pip install spacy # python -m spacy download en_core_web_sm import spacy nlp = spacy.load('en_core_web_sm') text = ('Today is very special. I just got my Ph.D. degree.') doc = nlp(text) print([e.text for e in doc])
true
e888a136f706c44d85aeadd72e57e90ce526dcb8
Sngunfei/HSD
/tests/HSD_test/mkarate.py
UTF-8
1,509
2.59375
3
[ "MIT" ]
permissive
# -*- encoding: utf-8 -*- import networkx as nx import numpy as np from model.multiscale_HSD import MultiHSD from tools.isomorphism import get_isomorphism_label from tools.util import merge_dicts_to_lists from tools.visualize import plot_2D_points def load_data(): graph_name = "mkarate" G = nx.read_edgelist...
true
ee02a07c66d4143d5d61851cebeb8c135222e98d
haggarw3/neural-networks
/imdbClassificationNN.py
UTF-8
2,628
2.75
3
[]
no_license
from keras.datasets import imdb from keras import models, layers from keras import optimizers, losses, activations, metrics import pandas as pd pd.set_option('display.max_rows', 10000) pd.set_option('display.max_columns', 10000) import numpy as np (x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=10000) #...
true
af89aa33e93c3f67d8eda57ff1fd43b9c6936026
Nayan95/Advance-Software-System
/Assignment 3/max_min.py
UTF-8
105
3.28125
3
[]
no_license
l = [34,87,892,920,974,893] print("Maximum number is : ",max(l)) print("Minimum number is : ",min(l))
true
f125f1f52429d6d3c85be0d052b623bfca0e44ba
georgreen/Geoogreen-Mamboleo-Dojo-Project
/core/logic.py
UTF-8
7,280
2.984375
3
[ "MIT" ]
permissive
from core.helpers import (add_person, allocate_livingspace, allocate_office, allocate_room, create_room, deallocate_person, get_roomname_type, load_data_text, save_data_text) from models import model def create_and_addroom(dojo, room_type, room_name): ''' us...
true
03ef0fd474d50697b811875830316cdcf3fd128b
proudrain/Heeker-WebIM
/python/invite_keys.py
UTF-8
383
2.890625
3
[]
no_license
"""Show Invite Keys""" import pymysql from dbop import conn_db, close_db, query_db, update_db def get_invitation(): keys = [] conn, cur = conn_db() sql = "SELECT INVITE_KEY FROM invitations" query_db(cur, sql) for row in cur: keys.append(row['INVITE_KEY']) close_db(conn, cur) retur...
true
8e24617931e19042bc269a1273222be49b5f5f07
Snowflake97/RiPO
/tkinter_app.py
UTF-8
7,591
2.578125
3
[]
no_license
import tkinter as tk import cv2 import dlib import numpy as np import matplotlib.pyplot as plt from threading import Thread import time class EyeApp: def __init__(self, master): self.master = master master.title("RiPO") self.label = tk.Label(master, text="Eye tracing app") self.la...
true
e0a56bf88ec5136dcb9d2bbb0ce032d94e2a3acc
codeShuriken/opchapterbot
/testscrapping.py
UTF-8
1,222
2.9375
3
[ "MIT" ]
permissive
from bs4 import BeautifulSoup from urllib.parse import urlparse import requests import bs4 url = 'http://onepiece.wikia.com/wiki/Chapter_863' r = requests.get(url) soup = BeautifulSoup(r.content, 'html.parser') table = soup.find_all('div',attrs={"mw-content-ltr mw-content-text"}) for x in table: i ...
true
6b0bdb1307f7ae792e23fd9768f739256d608aa4
HumphreyLu6/CMPUT412_demo4
/navi_bot.py
UTF-8
3,861
2.53125
3
[ "MIT" ]
permissive
#!/usr/bin/env python # BEGIN ALL import rospy, numpy, actionlib from sensor_msgs.msg import Joy from geometry_msgs.msg import Twist from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal import time import smach import smach_ros class Wait(smach.State): def __init__(self): smach.State.__init__(self,...
true
7d7db949a36d2b5ee53ed22c7fc3eb551f1c6abf
shappydev/gitexplore
/beginner/sum.py
UTF-8
104
3.265625
3
[]
no_license
total = 0 current = 1 end = 6 while current <= end: total += current current += 1 print(total)
true
572de5e5b523026b75d753d3b3f176c1c6e07d12
pansapiens/quantiprot
/quantiprot/utils/io.py
UTF-8
3,524
2.734375
3
[ "MIT" ]
permissive
# Copyright (c) 2016-2017 Witold Dyrka & Bogumil M. Konopka # This software was developed in Kotulska Lab at Politechnika Wroclawska. # This module is a part of Quantiprot, released under the MIT license: # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated ...
true
d40a7ad23b1aec536823d48ed99cc541981b30c7
anshvarshney20/Student-Database-System
/PyCode Hub/Showing.py
UTF-8
3,689
2.828125
3
[]
no_license
from tkinter import * import csv import os from PIL import ImageTk file=open("main.csv","a") file.close() def close(): win.destroy() def credit(): os.system("python credits.py") def edit(): os.system("python edit.py") def delete(): os.system("python delete.py") def searchrec(): os.s...
true
b9505e61a11ae533d645de667c3fcef85cefdf16
MatheusVarela19/stackoverservices-lib
/src/test.py
UTF-8
2,134
2.8125
3
[ "MIT" ]
permissive
# from stackoverservices.data.corpus import filters from typing import Tuple import dask.dataframe as dd from dask.dataframe.core import DataFrame, Series import pandas as pd import os def filter_quantile_union( df: DataFrame, quantile: int, quantile_range: str = 'upper') -> Tuple[DataFrame, Series]: ...
true
4eb389864e6a9edbe41b5cf5cdc8e093e06a34a4
LolaSun/Tasks
/Building Blocks.py
UTF-8
884
4.0625
4
[]
no_license
""" You are dividing up building block toys by color into even amounts for all of the kids in a 15 person kindergarten class. You don't want to give anyone more than anyone else, so you might have some leftover blocks of each color in the end. How many total do you have left over? Task: If you know how many of ...
true
5dc40337a943280bd298033ee840842d6785690b
vladimir314159/asp
/queentest/feature_calculator/AvgQdiagonal.py
UTF-8
1,036
2.78125
3
[]
no_license
import csv import numpy import operator import pandas def MaxQdiagonal(numberfile,sizeofn): temp = [] blocked_file = open("./blocked/blocked"+str(numberfile)+".lp","r") listOfBlocked = [] for line in blocked_file: listOfBlocked.append(line) for x in listOfBlocked: temp.append(x[...
true
441f5230aa199e787ad78f15da94c1a1f3ff9aa6
code4happylife/Python-100-Days
/Day01_15/code/Day03/piecewise.py
UTF-8
617
4.5
4
[]
no_license
""" 分段函数求值 3x - 5 (x > 1) f(x) = x + 2 (-1 <= x <= 1) 5x + 3 (x < -1) Version: 0.1 Author: 骆昊 Date: 2018-02-28 """ x = float(input('x = ')) if x > 1: y = 3 * x - 5 elif x >= -1: y = x + 2 else: y = 5 * x + 3 print('f(%.2f) = %.2f' % (x, y)) ''' 7x + 6 (x > 5) f(x) = 6x - 9...
true
19f36310c3e1c9973aa6e0575b968c731dd671ec
nanigasi-san/nanigasi
/block_chain/use_hash.py
UTF-8
634
3.03125
3
[]
no_license
import sha3 def calc_hash(value): return sha3.sha3_256(value.encode("utf-8")).hexdigest() m1 = "{a:100, b:200}" m2 = "{a:100, b:200}" h1 = calc_hash(m1) h2 = calc_hash(m2) print("m1: {0},hash: 0x{1}".format(m1,h1)) print("m2: {0},hash: 0x{1}".format(m2,h2)) m3 = "{a:101, b:200}" h3 = calc_hash(m3) print("m3: {0...
true
5854dc8db45f20da45ebf529f2b4948828a01812
Miracle-bo/Evernote
/19.07/19.07-第三周/Demo-闭包&装饰器.py
UTF-8
4,237
3.671875
4
[]
no_license
# def line(a, b): # def get_y_axis(x): # return a * x + b # 内部函数使用了外部函数的变量a和b # return get_y_axis # 返回值是闭包函数名,注意不是函数调用没有小括号 # # # L1 = line(1, 1) # 创建一条直线: y = x + 1 # print(L1) # # print(L1(3)) # 获取第一条直线中,横坐标为3时,纵坐标的值 # # L2 = line(2, 3) # 创建一条直线: y = 2x + 3 # print(L2) # # print(L2(3)) ...
true
9a71c14812d75b0e86564e3164ac9526d96f7c65
boringNose/Phone-Book
/phone_book.py
UTF-8
1,029
3.25
3
[]
no_license
import validate import csv class Person: def __init__(self, name, phone): self.name = name self.phone = phone def __str__(self): return f"Name: {self.name}, Phone: {self.phone}" numOfUsers = int(input("How many users do you want to store? ")) with open("phone directory.txt", "a") as...
true
7cc332525370f156e8f6e1b71c367a64ecb54977
khaconoc/nerual-coban
/layers/FCLayer.py
UTF-8
895
3.078125
3
[]
no_license
from layers.layer import Layer import numpy as np class FCLayer(Layer): """ :param input_shape: (1,3) :param output_shape: (1,4) """ def __init__(self, input_share, output_shape): self.input_shape = input_share self.output_shape = output_shape self.weights = np.random.rand(i...
true
c9ad807ca42e01c522db940b213c0f9cff52fdc2
Swall0w/SimpleCNN_originaldata
/util.py
UTF-8
1,814
2.65625
3
[ "MIT" ]
permissive
# -*- coding : utf-8 -*- from chainer.datasets import tuple_dataset import numpy as np from skimage import io import glob from PIL import Image import os def show_data(data): test_data = data img1 = np.rollaxis(test_data,0,3) # change image array to RBG io.imshow(img1) io.show() def load_imageset(d...
true
8f4eee0bc1347fe28a2e6d1d549279aae85a926e
vishalmisra235/B.Tech-Project
/ml_classifier.py
UTF-8
2,321
2.59375
3
[]
no_license
import sklearn import os import numpy as np import pandas as pd from sklearn import datasets import matplotlib.pyplot as plt from sklearn import svm, metrics import cv2 import scipy.misc categories=['NEUTROPHIL','EOSINOPHIL','MONOCYTE','LYMPHOCYTE','BASOPHIL'] #loading of image dataset from tqdm import tqdm def get_d...
true
bdea38331ed3048be31a863171d37c81c7bab708
claytonjwong/Sandbox-Python
/perfect_square.py
UTF-8
1,423
4.1875
4
[]
no_license
""" 367. Valid Perfect Square Given a positive integer num, write a function which returns True if num is a perfect square else False. Note: Do not use any built-in library function such as sqrt. Example 1: Input: 16 Returns: True Example 2: Input: 14 Returns: False """ class Solution(object): def isPerfec...
true
9a08a086fd4e5f42cd5c43982e5e91ab647345a3
vfaris/zfec_fs
/zfec_fs.py
UTF-8
15,014
2.515625
3
[]
no_license
#!/usr/bin/env python import os, sys from errno import * from stat import * import fcntl import fuse import zfec from fuse import Fuse fuse.fuse_python_api = (0, 2) fuse.feature_assert('stateful_files') class ReadableFile: """Should not be used directly, use the openBy* functions""" def __init__(self, fd)...
true
ab2e4d80a9e335907ecc4f73c90f451f7dc3c09c
ToddCombs/Phenomenon
/exercise_forget_me.py
UTF-8
954
3.828125
4
[]
no_license
# author:ToddCombs # 小练习程序,提示用户输入他的名字,并json.dump存到文件中 import json def get_new_name(): """获取新用户名""" user_name = input("请输入你的姓名: ") file_name = 'forget_me.json' with open(file_name, 'w') as f_obj: json.dump(user_name, f_obj) return user_name def get_save_name(): """获取存储在json...
true
a9795e884748997b131e79befcb4a5dbef92fed1
yxwithu/ml_in_action
/SVM_SMO.py
UTF-8
5,891
2.78125
3
[]
no_license
# coding: utf-8 # In[ ]: import numpy as np import random # In[ ]: class opt_struct: def __init__(self, X_train, y_train, C, tol): self.X = X_train self.labels = y_train self.C = C self.tol = tol self.m = shape(X_train)[0] self.alphas = np.mat(np.zeros((self.m...
true
529c5aa71853837d42a27156d1fac45e5ab3abd3
Saduras/gym-playground
/policy_network.py
UTF-8
4,646
3.015625
3
[]
no_license
import numpy as np import tensorflow as tf import yaml def load_network(path, global_step): with open(f"{path}.params", "r") as file: params = yaml.load(file) pn = policy_network(params["state_size"], params["action_size"], params["hidden_units"], params["discount_factor"], params["learning_rate"]) ...
true
b3fd9132ff39ecdfda13e690fd9d1fcdd621d155
erfaenda/learningPy
/base/Stdoutt.py
UTF-8
153
2.625
3
[]
no_license
import sys #sys.stdout.write("Не понятное количество символов о которм нам расскажет") print(sys.version)
true
50941b20b61ae78a1d418ebc2c9e7119d2db7402
jasonish/suricata-verify
/tests/detect-xor/xor.py
UTF-8
224
2.515625
3
[ "MIT" ]
permissive
import sys import binascii import urllib key = binascii.unhexlify("0d0ac8ff") xored = "" for i in range(len(sys.argv[1])): xored = xored + chr(ord(sys.argv[1][i]) ^ ord(key[i%len(key)])) print(urllib.quote_plus(xored))
true
299a6b85ce19a8841825c62675e4ebe43f7d791e
jrartd/Python-tools
/analisisfacebook/inicial.py
UTF-8
1,078
2.953125
3
[]
no_license
#importacion import pandas as pd import matplotlib.pyplot as plt import numpy as np #seleccion de data mainData = pd.read_csv("publidiciembre.csv",index_col=0) #seleccion de fecha datecolum = mainData.iloc[0:,6] npdatecolum = np.array(datecolum) scala = np.array([0,100,900]) npshare = np.array(mainData.iloc[0:,8]) ...
true
c4d0c138d0e9dc05355c08e8d871b2931bf91885
sachin16495/Question_Category_Classification
/question_classification_naive_bayes.py
UTF-8
2,920
3.046875
3
[]
no_license
import os import string import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import model_selection from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import classification_report from nltk.tokenize import sent_tokenize, word_tokenize #Load Excel file from the c...
true
c957b9a1f6da19851e31c9ba305b8790b6a60134
wemake-services/wemake-python-styleguide
/wemake_python_styleguide/transformations/ast_tree.py
UTF-8
2,294
2.5625
3
[ "MIT" ]
permissive
import ast from pep8ext_naming import NamingChecker from typing_extensions import final from wemake_python_styleguide.transformations.ast.bugfixes import ( fix_line_number, ) from wemake_python_styleguide.transformations.ast.enhancements import ( set_constant_evaluations, set_if_chain, set_node_contex...
true
6bda306ee3a4dc761884c3fe662902a9eb830dab
timholds/Twitter-Bio-RNNs
/get_training_bios.py
UTF-8
2,584
2.71875
3
[ "MIT" ]
permissive
from __future__ import print_function import twitter import requests import time from passwords import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET # Create an Api instance. api = twitter.Api(consumer_key=CONSUMER_KEY, consumer_secret=CONSUMER_SECRET, access_toke...
true
0dce2d846c977f98e699ea5dd34cb6a30ccfb36b
Mahadev0317/Codekata
/vowel r consonant.py
UTF-8
151
3.484375
3
[]
no_license
chr=input() lis=['a','e','i','o','u'] if chr.isalpha(): if chr in lis: print("Vowel") else: print("Consonant") else: print("invalid")
true
aa56dd662873d2df16e068955019bb12b6f2a4d7
galileo15640215/atcoder
/abc155c.py
UTF-8
388
2.9375
3
[]
no_license
n = int(input()) dic = {} for i in range(n): s = input() if s not in dic: dic[s] = 1 else: dic[s] += 1 dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse=True) ans = [] s = [] for k, v in dic_sorted: s.append(v) pre = s[0] for k, v in dic_sorted: if v == pre: ans.app...
true
ea5f6a1531e2d40b166388e2245bdc27ad202218
cherylj/juju-release-tools
/scripts/bug_list.py
UTF-8
3,476
2.546875
3
[]
no_license
#!/usr/bin/python import sys import os import csv import re import HTML import time import collections from optparse import OptionParser from argparse import ArgumentParser from launchpadlib.launchpad import Launchpad from pprint import pprint from datetime import datetime csv_fields = [ 'Number', 'Title', ...
true
50f6063b2c9175bc03a79ecb7f8f339ef5ac7e90
Fliv/my-leetcode
/reverse-integer.py
UTF-8
698
3.140625
3
[]
no_license
class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ flag = 1 abs_x = x nums = [] result = 0 if x > 2147483647 or x < -2147483648: return 0 if x < 0: flag = -1 abs_x = -x ...
true
f9611decf17067fb5e313c5c56f533a5e9f141de
CharlesJiang168/MyOwn
/iLeafproject1test/iLeafProject1test.py
UTF-8
2,544
3.578125
4
[]
no_license
import numpy as np def load_csv(fname, header_row=0, first_data_row=None, types=None, **kwargs): """Load a CSV file into a dictionary. The strings from the header row are used as dictionary keys. **Arguments:** - *fname*: Path and name of the file - *header_row*: Row that contains the keys (uses z...
true
a744140f3eec9851de0780125420cd42a99606bc
datto171/TranQuocDat-fundamental-c4e23
/Fundamental/session2/for_explain.py
UTF-8
130
2.828125
3
[]
no_license
n = int(input("Nhap so lan lap:")) for i in range(n): print(i) k = int(input("Nhap n: ")) for j in range(0,k,2): print(j)
true
3ac9dce4665ee5c279f9d7c82da4c43e10f2cc46
scchess/mClass---Multiple-cancer-classification
/6_feature_selection_with_mi.py
UTF-8
4,661
2.6875
3
[]
no_license
import pandas as pd import numpy as np import sys import operator def pair_wise_mi_matrix_to_dict(X, selected_gene_names, feature_size): # converting pair_wise_mi matrix to a dict(), redundant Gene_pair_MI_dict = dict() for i in range(0, feature_size): gene1_name = selected_gene_names[i] for j in range(i +...
true
0d2c3f116d7e0f740f3b6582d4bfa18435891be5
jaykumar-parmar/python-practice
/educative_io/puzzle/binary_search/first_duplicate.py
UTF-8
499
3.53125
4
[]
no_license
def find(A, target): low = 0 high = len(A) - 1 while low <= high: mid = (low + high) // 2 if A[mid] < target: low = mid + 1 elif A[mid] > target: high = mid - 1 else: if mid - 1 < 0: return mid if...
true
69f421080a6a032875ba76a6404539ee19f2c97f
VladaLukovskaya/Python
/lesson4_while/password.py
UTF-8
911
3.53125
4
[]
no_license
password = input('Enter your password: ') check = input('Enter the password again: ') correct = '' while correct != 'OK': if len(password) < 8: print('The password is short.') new_password = input('Enter new password: ') password = new_password new_check = input('Enter new ...
true
e2b469245d7d6ef79969b1f0a9d44574ae7c25a6
bonnetn/backend_adh
/adh/util/checks.py
UTF-8
1,732
2.921875
3
[]
no_license
# from datetime import datetime from ipaddress import IPv4Address, IPv4Network from ipaddress import IPv6Address, IPv6Network, AddressValueError import re MAC_REGEX = re.compile('^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$') EMAIL_REGEX = re.compile(r"[^@]+@[^@]+\.[^@]+") def isEmail(mail): return EMAIL_REGEX.match(m...
true
fcb7bd4a9611f6c91785a0f5dfc4f5c789b50d06
relarr/AlgorithmsAnimation
/quick.py
UTF-8
1,669
3.421875
3
[]
no_license
import time from swap import swap def quick_sort(array, start, end, draw_array): if start < end: draw_array(array, ['white' if x == start else 'red' for x in range(len(array))]) time.sleep(0.1) draw_array(array, ['yellow' if x == start else 'red' for x in range(len(array))]) time.sl...
true
6fa5930859492988722806463b8e1e9307e0054b
oskarzmek/Neural_net
/master 1.0.py
UTF-8
3,022
3.4375
3
[]
no_license
import numpy as np class NeuralNetwork(): def __init__(self): np.random.seed(1) self.synaptic_weights = 2*np.random.random((50,1))-1 def sigmoid(self, x): return 1/(1+np.exp(-x)) def sigmoid_derivative(self, x): return x*(1-x) def train(self, training_inputs, traini...
true
c87aeb1805472a9c1eca63fe392c40c4f5959625
hritik9456/Netflix-movie-recommendation-system
/main.py
UTF-8
685
2.671875
3
[]
no_license
import numpy as np import kmeans import common import naive_em import em X = np.loadtxt("toy_data.txt") K=3 seed = 0 #for i in range(1,5): mixture, post=common.init(X,4,3) mix,pos,cost = naive_em.run(X,mixture,post) mix1,pos1,cost1 = kmeans.run(X,mixture,post) mix2,pos2,cost2 = em.run(X,mixture,post) for j in range(15...
true
c5d8d7f2ced762951e1d9647d0b8704981bbf477
jeffmad/tripx
/resources/trips/xml/pp.py
UTF-8
181
2.515625
3
[]
no_license
import lxml.etree as etree import sys def pp(filename): x = etree.parse(f) print etree.tostring(x, pretty_print = True) if __name__ == '__main__': f = sys.argv[1] pp(f)
true
c6cdcc82cd6445effb93b939f883ed5a036c9370
KratosMultiphysics/Examples
/multilevel_monte_carlo/use_cases/fluid_dynamics_building/source/FluidDynamicsAnalysisProblemZero.py
UTF-8
1,591
2.828125
3
[]
no_license
# Import Python libraries import numpy as np import time import os # Import Kratos import KratosMultiphysics import KratosMultiphysics.FluidDynamicsApplication from KratosMultiphysics.FluidDynamicsApplication.fluid_dynamics_analysis import FluidDynamicsAnalysis import KratosMultiphysics.kratos_utilities as kratos_util...
true
8b679923ee4928cd200ac4b81053f03a9069f19b
HomingYuan/data_science_way
/python/spide_test1.py
UTF-8
932
2.625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat May 27 23:10:50 2017 @author: hongming """ import urllib import urllib.request import requests import re import time def get_html(url): page = requests.get(url) return page.text def get_text(html,file): textre = re.compile(r'content">\n*<span>(.*)</span>') ...
true
111a8ffbad1297f38e47f4f5509bfd74942c0946
rodoufu/challenges
/leetCode/design/DesignBrowserHistory.py
UTF-8
784
3.921875
4
[]
no_license
# https://leetcode.com/problems/design-browser-history/ class BrowserHistory: def __init__(self, homepage: str): self.history = [homepage] self.index = 0 def visit(self, url: str) -> None: self.history = self.history[:self.index + 1] self.history.append(url) self.index +...
true
bfc65e10556fbc530623c8a7ca4b6eb6b6ad286f
miccls/OU3
/bst.py
UTF-8
9,481
3.453125
3
[]
no_license
""" bst.py Student: Mail: Reviewed by: Date reviewed: """ from linked_list import LinkedList import time import random class BST: class Node: def __init__(self, key, left=None, right=None): self.key = key self.left = left self.right = right ...
true
989640846f2923672b9f68b26cea48cd3cda4fa1
ngocphucck/zalo-ai-challange-2020
/voice_verification/src/extractors/MFCC/sigproc.py
UTF-8
3,764
2.609375
3
[ "MIT" ]
permissive
import decimal import numpy import math import logging import matplotlib.pyplot as plt from scipy.io import wavfile def round_half_up(number): return int(decimal.Decimal(number).quantize(decimal.Decimal('1'), rounding=decimal.ROUND_HALF_UP)) def rolling_window(a, window, step=1): shape = a.shape[:-1] + (a....
true
7fabf79deb69734161428e3a1cf6f56739661b45
siyana-plachkova/programming101
/week2/3-Cash-Desk/cash_desk_problem.py
UTF-8
2,390
3.890625
4
[]
no_license
class Bill: def __init__(self, amount): self.amount = amount def __str__(self): return "A " + str(self.amount) + "$ bill." def __repr__(self): return self.__str__() def __int__(self): return self.amount def __eq__(self, other): return self.amount == other...
true
06e0d8e4f20c591bdf2d63a5d5bb365f78fbbecf
harshkumarkhatri/python-google-spreadsheet
/app.py
UTF-8
781
2.828125
3
[]
no_license
import gspread from oauth2client.service_account import ServiceAccountCredentials from pprint import pprint scope = ["https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive"] creds=ServiceAccountCredenti...
true
a4557380b9f9e1f877742f93d80a7cb46eec1397
cyw0626/Huawei-cup-modeling-contest
/DM_PCA.py
UTF-8
2,491
2.703125
3
[]
no_license
#-*-coding:utf-8-*- import numpy as np import pandas as pd from scipy import linalg,stats import matplotlib.pyplot as plt import seaborn as sns #sns.set() from matplotlib.font_manager import FontProperties from pylab import * #fname = "/home/w/soft/anaconda2/envs/lstm/lib/python3.6/site-packages/matplotlib/mpl-data/fo...
true
d63b952730e9a8272e0078db93e6e53ef54d57db
SahasilAK/Some_simple_python_codes
/nameband.py
UTF-8
196
3.546875
4
[]
no_license
print("Welcome To The Band Name Generator") city = input("which city did u grow up in?? \n") pet = input("what is the name of ur pet??? \n") print(f"your band name could be {city} {pet}")
true
42bb4deed6fb14b2c6436ced160a0d18102954ca
smmvalan/Python-Learning
/Selenium_Automation/radio_chk.py
UTF-8
577
2.8125
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys driver=webdriver.Chrome(executable_path="C:\\python\\Python_Drivers\\chromedriver.exe") driver.get("https://krninformatix.com/sample.html") driver.implicitly_wait(10) # working with the radio button status=driver.find_element_by_id("male").i...
true
7b07807c3b097ee1ac2ab4ce4c6ff6e30cd96edd
ntinouldinho/Artificial-Intelligence-SpamHam-Classifier
/naive_bayes.py
UTF-8
1,664
2.734375
3
[]
no_license
#dexete os eisodo ena email k to katatasei se spam/ham import math from id3 import checkType def calc_prob(Xs,sum_mes,sum_ham_mes):#upologismos pithanothtwn new_Xs = {} for key in Xs.keys(): existsHam = (Xs[key][1]+1)/(sum_ham_mes+2)#pithanothta na uparxei dedomenou oti exw ham existsSpam = (Xs...
true
0c7a6b1ccf81d91a348e4f42b6469c0d7c2be79b
MiguelAgueda/ARCRobot
/ARCRobot-5/learning.py
UTF-8
654
3.234375
3
[ "Unlicense" ]
permissive
class Collision: def __init__(self, settings): self.stg = settings self.collision_count = 0 self.no_collision_count = 0 def collision_occurred(self): self.collision_count += 1 self.no_collision_count = 0 self.stg.safe_front_dist += 5 print("Collision occu...
true
ad2718465b72863b576a7132bd6a51f2922f6c32
Quintonamore/ProgrammingSolutions
/CCI/Chapter_1/1_3.py
UTF-8
786
4.09375
4
[]
no_license
# CCI Chapter 1 Problem 3 # Takes a string input and then replaces all the spaces with %20 # TODO This test doesn't work, do later!! urlify = input("Give the string you'd like to urlify: ") new_string = "" prev = '' ran = 1 # Perform the first step here, and get rid of front spaces # Probably smarter to just start ...
true
7d5a5d1e246b43e31dc52cd5f28e7255370d24d4
zelzhan/Challenges-and-contests
/LeetCode/TopInterviewQuestions/ValidAnagram.py
UTF-8
655
3.625
4
[]
no_license
'''Given two strings s and t , write a function to determine if t is an anagram of s.''' from collections import defaultdict class Solution: def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ hashtable = defaultdict(int) hashtable2 = d...
true
7b9653bc637165f55a2f301c4ec88744185fe218
coxwr/Ancient-Greek-Translator
/json_parser.py
UTF-8
939
2.90625
3
[]
no_license
import json file_list = list() for ii in range(1,2): file_list.append("json_"+str(ii)+".json") #function to create lemma of verbs def data_retrieval(fid): temp_fid = open(fid).read() data = json.loads(temp_fid) lemma_list = list() num_sentences = len(data["treebank"]["body"]["sentence"]) for...
true
822a02798566fec72086e76619a836f7de339ad6
night-fury007/SUDOKU
/GenerateSudoku.py
UTF-8
3,191
3.375
3
[]
no_license
import random class GenerateSudoku : def __init__(self, difficulty) : self.rows = 9 self.cols = 9 self.difficulty = difficulty self.sudoku = [[0 for i in range(self.cols)] for j in range(self.rows)] self.initial_positions = [[True for i in range(self.cols)] for j in range(se...
true
62d2f63c3794629dafd89e47ce71764e6dad055f
SrishtiSehgal/CASI
/SVM analysis/SVM for latent space.py
UTF-8
4,233
3.078125
3
[]
no_license
import numpy as np from sklearn import svm import matplotlib.pyplot as plt import itertools import pickle from sklearn.metrics import confusion_matrix def plot_confusion_matrix(cm, name, classes, min, max, dataset, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): """ This function prints and plots the...
true
026c0bea2b48bd192fa32c1d12670693342e789a
mochidamochiko/aws_billing_to_slack
/get_current_billing.py
UTF-8
1,931
2.6875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 import boto3 import pprint #from datetime import datetime, date, timedelta import datetime import dateutil pp = pprint.PrettyPrinter(indent=4) cloudwatch = boto3.client('cloudwatch', region_name='us-east-1') # list_metrics = cloudwatch.list_metrics() response = cloudwatch.get_m...
true
aa9fc6ebcabbe3cf4ae99cbe729558c450e1d7ee
Totoro2205/for_my_shiny_students
/lesson_4/cw_4.py
UTF-8
7,297
3.203125
3
[]
no_license
# from lesson_5.cw_importer import my_func import sys from sys import argv from datetime import datetime as dt from functools import reduce, partial from itertools import count, cycle from asyncio import sleep as asleep from time import sleep from datetime import * """ВРЕМЯ РАБОТЫ ПРОГРАММЫ""" # start = dt.now() # p...
true
139021b5ace27b1466599b4b86cea731813d7d7c
Spucis/CV_PaintingDetection
/fix_statues.py
UTF-8
1,066
2.515625
3
[]
no_license
import os import cv2 import numpy as np src_path = "/home/daniele/Immagini/statue/" dst_path = "/home/daniele/Immagini/fixed/" counter = 1 for name in os.listdir(src_path): img = cv2.imread(src_path + name) # rimuove interfaccia grafica di ubuntu # img = img[132:, 130:, :] # cerca gli indici dove i...
true
58cc7f4eb7208ff2e15bb6992d403a29a0022646
gunjankapoor99/Python-Tutorial-For-Beginners
/Python For Beginners/Python Problems/arithmetic.py
UTF-8
459
4.46875
4
[]
no_license
print("\n") print("Enter two integral numbers to perform operations: ") num1 = int(input()) num2 = int(input()) print("\n") print("Addition of given numbers: ", num1+num2) print("Subtraction of given numbers: ", num1-num2) print("Multiplication of given numbers: ", num1*num2) print("Division of given numbers: ", num1/n...
true
ac1793c7d723d5f8cb7b02a49b4c1d956cd6358f
M0gician/lightRaven
/lightRaven/utils/data_gen.py
UTF-8
3,581
2.859375
3
[ "MIT" ]
permissive
import gym import numpy as np from typing import List, Tuple from functools import partial from multiprocessing import Pool from lightRaven.policy import FAPolicy, TabularPolicy, PolicyBase def generate_episode(env_id: str, gamma: float, _) -> Tuple: """ A partial function for multiprocessing the dataset generati...
true
b8f8b554cd8dff074aedaeb150aece8c91c4a16a
vlong638/VL.Python
/0.Basis/3.Algorithoms/Completed/2.110.最小路径和.py
UTF-8
1,606
3.59375
4
[]
no_license
class Solution: """ @param grid: a list of lists of integers. @return: An integer, minimizes the sum of all numbers along its path 给定一个只含非负整数的m*n网格 找到一条从左上角到右下角的可以使数字和最小的路径。 """ def minPathSum(self, grid): # write your code here if grid==None: return None ...
true
fc3f4e29c669702285b5364a551b573adf21ae3a
elyscape/telepresence
/tests/proxy.py
UTF-8
1,503
2.515625
3
[ "Apache-2.0", "LicenseRef-scancode-public-domain", "MIT" ]
permissive
""" Test that we can communicate with arbitrary hosts via the Kubernetes cluster. For --docker-run this requires the --proxy argument. We do this by setting an alias to a service in /etc/hosts on telepresence-k8s pod. That means that connecting to the alias in the local computer should only work if we're being proxied...
true
b9e9f15dc838768ae9fa92744f3eba61cd655573
lk7630/algorithms
/sort/merge_sort.py
UTF-8
875
3.90625
4
[]
no_license
def merge_sort(arr): if len(arr)>=2: mid=len(arr)//2 left_arr=arr[:mid] right_arr=arr[mid:] merge_sort(left_arr) merge_sort(right_arr) i=j=k=0 left_len=len(left_arr) right_len=len(right_arr) while i<left_len and j<right_len: if left...
true
0cb667b2f2832cf54b3ce1f6e28b97cbeb4dd891
Heigke/MIRI_Eric
/rl_lqr(active)/AC_env.py
UTF-8
3,358
3.03125
3
[]
no_license
import numpy as np from gym import spaces import optimal_lqr_control class Automatic_Control_Environment(): """ ***A simle automatic control environment*** by Niklas Kotarsky and Eric Bergvall The system is described by x_t+1 = A*x_t + B*u_t + C*noise where x_t is a column vector with dimension N ...
true
aedd09ad7fbc9df5c32a5228e5c390501f9154b5
ihristova11/python-basics
/Exams/Exam1/02. Task2.py
UTF-8
1,908
3.3125
3
[]
no_license
a = int(input()) b = int(input()) c = int(input()) d = int(input()) x = int(input()) if x == 1: c += 1 else: d += 1 if a + b >= 5 or a > 3 or b > 3: print ("Pesho, you are stupid!") elif (a + b == 4) and (c > d and c >= 15 and c - d >= 2): print ("Match over! Team 1 is the winner!".format (a + 1,...
true
5f741069b4ea36ef7cfb82159e518e5cb1697e0b
Dunajskie/Gestrure-Recognition
/camera.py
UTF-8
1,966
2.75
3
[]
no_license
import cv2 import numpy as np from PIL import Image from keras import models import os # Load the saved model model = models.load_model('/Users/michal/Desktop/leapGestRecog/model.h5') video = cv2.VideoCapture(0) count = 0 count1 = 0 lookup = dict() reverselookup = dict() count = 0 for j in os.listdir('/Users/michal...
true
865959b277930c5f17904b4c229fab21a8244627
kushinoyuya/AT_Project
/script_practice/05_Bogo_sort.py
UTF-8
926
3.796875
4
[]
no_license
''' 配列の要素をランダムに並び替えて, 運良くソートできていればソート完了というソートアルゴリズム. 配列のサイズが N で, 要素がすべて異なるとしたとき, 平均計算時間は O(N⋅N!). 処理が遅いから、なかなか使われない ''' import random from typing import List #リストの中身を確認 def in_order(numbers: List[int]) -> bool: #処理を1行で記載した場合 return all(numbers[i] <= numbers[i+1] for i in range(len(numbers)-1)) #処理内容の詳細 ...
true
306636d9f3864ce55d1690aa93dd0408c06443ca
rashonmitchell/projeto-algoritmos
/1_introducao/01_max.py
UTF-8
405
3.5625
4
[]
no_license
class Max: @staticmethod def max(elementos): valor_maximo = elementos[0] for valor in elementos[1:]: if valor > valor_maximo: valor_maximo = valor return valor_maximo lista_strings = ["qwe", "mgh", "djf", "ois"] lista_numeros = [2, 35, 843, 1, -45, 63, 1111...
true
d9e3e64b011bd3b1827aaeb7d099cc0916d5f18e
zachrickert/hello
/hello.py
UTF-8
741
3.84375
4
[]
no_license
# A program to say hello world in different languages. def main(): import sys lang = "English" if (len(sys.argv) < 2): sys.argv.append("english") for i in range(1, len(sys.argv)): lang = sys.argv[i] if (lang.lower() == "english"): print ("Hello, World!") ...
true
a97881906585ad571555dc8bcd41a549f563e529
qianjinfighter/py_tutorials
/earlier-2020/TF_codes/data_dist/test_tf.py
UTF-8
2,177
2.625
3
[ "Apache-2.0" ]
permissive
#coding:utf-8 import tensorflow as tf print(tf.__version__) import tensorflow.contrib.eager as tfe tfe.enable_eager_execution() from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Conv2D, Dense, Flatten, MaxPooling2D import numpy as np def build_model(): model = Sequential() mode...
true
4b5b2fe4bd969a457b11bead589051c1915ae535
jacastagnola/MCOC2020-PO
/entrega 5/desempeño_inv_npsolve.py
UTF-8
1,501
2.703125
3
[]
no_license
from time import perf_counter import scipy as sp import numpy as np from scipy.linalg import inv from numpy import float32 from matrizlaplaciana import matriz_laplaciana NP = [2, 5, 10, 12, 15, 20, 30, 40, 45, 50, 55, 60, 75, 100, 125, 160, 200, 250, 350, 500, 600, ...
true
d14aacc4107c4acca6f30800a4c488a09ad4ad5a
lewis617/python-algorithm
/src/009-pascal-triangle.py
UTF-8
537
3.28125
3
[]
no_license
class Solution: def generate(self, n): if n == 0: return [] elif n == 1: return [[1]] elif n == 2: return [[1], [1, 1]] elif n > 2: ans = [[] for i in range(n)] for i in range(n): ans[i] = [1 for i in range(i...
true
4f2bb0d1ea3ea367fa3db3ec4f262c9339e612b4
ThijsKonst/AdventOfCode2020
/day7.py
UTF-8
668
2.8125
3
[]
no_license
file1 = open("day7data") lines = file1.readlines() rules = {} goal = [] for line in lines: line = line.split(" ") colors = [] for i in range(len(line)): if "bag" in line[i]: colors.append(line[i-2] + line[i-1]) rules[colors[0]] = colors[1:] if colors[0] == "shinygold": g...
true
e485e7d66b5198338db77acf2ccd02bc3725e13b
danstonebuilt/PythonLabHome
/python/py_prjct/Lotery/OOP_Samples/Contact.py
UTF-8
563
2.953125
3
[]
no_license
# -*- coding: iso-8859-1 -*- __author__ = 'Daniel' class Contact(object): numberOfContacts = 0 def __init__(self): Contact.numberOfContacts += 1 def get_name(self): return self.__name; def set_name(self, new_name): self.__name = new_name def get_email(self): re...
true
af28052811239db84dd85aadbf5ab4cde33e8ce2
Ustelemov/LipReading-RussianLang
/scripts/stretch_jsons.py
UTF-8
899
2.84375
3
[]
no_license
import os import argparse import glob import json #Конфигурация параметров при вызове с консоли parser = argparse.ArgumentParser(usage='Stretch json files in folder to json') parser.add_argument('--i',dest="input_path",type=str,required=True,help="Path to files") parser.add_argument('--o',dest="out_filepath",type=str...
true
f80e70613e7fff1d1e4a9473df57c55be13ec6b5
abeersalam/Algorithms--Big-O-Sorts
/in-place selection Python/V1/ip_selection_sort.py
UTF-8
1,272
3.625
4
[]
no_license
#Brian Mitzel 893038547 #Sorasit Wanichpan 897260477 #Abeer Salam 899423594 #CPSC 335 #Project 3 First Draft #python3 ip_selection_sort.py <input file> <n value> import sys import time #In place selection sort that was given in class #Will edit later def in_place_selection_sort(L): for k in range(len(...
true
72a4f3f27ffccac0b0c0dcb25d14d85ae74defc2
Mitan/macro-GPO
/Code Tests/hypers.py
UTF-8
3,893
2.578125
3
[]
no_license
import GPy import numpy as np import matplotlib.pyplot as plt import scipy from numpy.random import normal from random import choice from math import sqrt, exp def TestPrediction(locs, vals): test_num_point = 20 # l_1, l_2, signal, noise params = np.array([-2.525728644308256,-3.218875824868201,1.82707829...
true
89c0735be571028614e6ecdc51228d2edbc4f622
kathy531/coding-assignment
/19-4coding.py
UTF-8
235
3.6875
4
[]
no_license
start = int(input("숫자를 입력하세요.")) end = start-1 for i in range(start): for j in range(start+i): if j < end: print(' ',end = '') else: print('*',end='') print() end-=1
true
dfe7efee20e4d3c5490ed395e9a40dba7dd8e7c3
Andyandpandy/codewars
/Completed_Kata/sum_of_positive.py
UTF-8
152
2.9375
3
[]
no_license
def positive_sum(arr): # Your code here result = 0 for number in arr: if number > 0: result += number return result
true
170a346e68400828a57a9da13d4c1a411ddf1679
AnishGeorgeJlabs/Tyrion
/data/menu.py
UTF-8
6,206
2.75
3
[]
no_license
""" This package exposes methods to get the menu from database, following all the given relations """ from . import db from .cache import Cache _cache = Cache('menu') def index_list(lst): for i, obj in enumerate(lst): obj['id'] = i return lst def filter_out_disabled(lst): return list(filter( ...
true
119ec38322a7233a2da859d6ab287a1ad76a87fc
f981113587/Python
/Aula 12/Desafios/052.py
UTF-8
697
4.125
4
[]
no_license
""" Faça um programa que leia um número inteiro e diga se ele é ou não um número primo. Você quer brincar na neve? Um boneco quer fazer? Você podia me ouvir e a porta abrir Eu quero só te ver Nós éramos amigas de coração Mas isso acabou também Você quer brincar na neve? Não tem ...
true
fe494e1278733b3c6b0fd179b73c935aaa57bc6e
thomas-b-jackson/yac
/yac/lib/credentials.py
UTF-8
1,527
2.546875
3
[]
no_license
#!/usr/bin/env python from yac.lib.search import search from yac.lib.params import Params from yac.lib.engines import get_credentials_provider class Credentialers(): def __init__(self, credentialers_descriptor): self.credentialers = {} for credentialer_descriptor in credentiale...
true
a2f4a17dbd90c02d1f55d303df469c1a522aa5d2
fred-drake/twitterbot
/config.py
UTF-8
2,103
2.75
3
[]
no_license
import torch import os class Config: def __init__(self): self.load_filename = None # The filename of the checkpoint to load from relative to the save directory, or None if starting from scratch self.json_file = "realDonaldTrump.json" # The JSON file in the data corpus directory containing tweets...
true
22783488f2911a98e2c7b452ce2d5f7995921412
XavierGratens/MyPyLib
/Brillouin_Function_Fit.py
UTF-8
1,964
2.71875
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from scipy import optimize "Constants" "Bohr magneton in cgs" muB_cgs=9.2741E-21 "Boltzman´s constant in cgs" kB_cgs=1.3807E-16 " Avogadro´s constant " Na = 6.022E+23 "Spin for Co2+" Spin=3/2 "Landé Factors" g = 2.263 "Molar mass for Zn(1-x)CoxO" M_Zn =65.39 M_...
true
d53bd26621ef424d0da39a5e8f9a4dc38a0b957b
devmedtz/accounting_software
/users/models.py
UTF-8
2,703
2.546875
3
[ "MIT" ]
permissive
from uuid import uuid4 from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.db import models from django.utils.text import slugify class UserManager(BaseUserManager): def create_user(self, email, name, password=None): if not email: raise ValueError('Users must ...
true
8de9b3afd440788d7c59861de84a653a81d60246
MinSu-Kim/python_tutorial
/pandas_tutorial/data_structure/dict_to_series.py
UTF-8
323
3.828125
4
[]
no_license
import pandas as pd # k:v 구조를 갖는 딕셔너리를 만들고, 변수 dict_data에 저장 dict_data = {'a': 1, 'b': 2, 'c': 3} # 판다스 Series() 함수로 딕셔너리(dict_data)를 시리즈로 변환. 변수 sr에 저장 sr = pd.Series(dict_data) # 변수 sr의 자료형 출력 print(type(sr), sr, sep='\n')
true
b95a28f7f22041725727b8a3b10b1be85f48fb83
Nancy194/python100
/python67.py
UTF-8
478
4.1875
4
[]
no_license
# 题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。 a=input('请输入一串数字,用空格隔开:') alist=a.strip().split(' ') l=len(alist) blist=[] for i in alist: blist.append(int(i)) mi=min(blist) ma=max(blist) for i in range(l): if blist[i]==mi: x=i if blist[i]==ma: y=i blist[-1],blist[x]=blist[x],blist[-1] blist[0],...
true