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
9ad7a99da57e4a481fe29df97769ae5427a4fa86
WallGGom/MoonPool
/20200217/최장 공통 부분 수열.py
UTF-8
526
2.984375
3
[]
no_license
import sys sys.stdin = open('최장 공통 부분 수열.txt', 'r') T = int(input()) for tc in range(T): A, B = map(str, input().split()) lcs = [[0 for i in range(len(A)+1)] for j in range(len(B)+1)] for i in range(len(A)): for j in range(len(B)): if A[i] == B[j]: lcs[i+...
true
cb123be397c586bd62cf16ed5ef0bf8c4ed59e11
tifangel/tubes2_LSTM
/Neuron.py
UTF-8
685
2.828125
3
[]
no_license
class Neuron: def __init__(self, weights): self.weights = weights self.hValue = 0 self.target = [] # Nilai y untuk layer output self.sigma = 0 def printWeight(self): print(self.weights) def getHValue(self): return self.hValue def getWeights(self): ...
true
eb2f249125d58336a46a0ea73ca78b4bde886f64
bala4rtraining/python_programming
/python-programming-workshop/pythondatastructures/while/while_reversed.py
UTF-8
98
4.15625
4
[]
no_license
# Use reversed on a range. for i in reversed(range(0, 3)): # Display the index. print(i)
true
d73d016a4d1423ed79164e6feeefb95dc260928d
janeon/automatedLabHelper
/testFiles/primes/primes21.py
UTF-8
1,001
4.21875
4
[]
no_license
def main(): n = eval(input("Pick a number of primes: ")) if n == 0: print("There are no primes in this range") else: print() print("The first", n, "primes are: ") isPrime(n) print() def isPrime(n): i = 2 if prime(i) == True: print(i, end...
true
c9b4ba1508105c0fe45eaae81d889a9472fccbff
yontaru/ProyectosPython
/Taller_MYSQL/controller.py
UTF-8
2,572
2.578125
3
[]
no_license
from db import get_connection def insert_customer(name, status, mobile): cnn=get_connection() with cnn.cursor() as cursor: cursor.execute("INSERT INTO customer (name, status, mobile) VALUES(%s, %s, %s)", (name, status, mobile)) cnn.commit() cnn.close() def get_customer(): cnn=get_connecti...
true
b66e7b193b9a673f37a47633e96dd64a133629d7
senthilkumarvs83/testpy
/mysqlConnect.py
UTF-8
521
2.6875
3
[]
no_license
import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="Testing!6", database = 'pythonclass') # print(dir(mydb)) mycursor = mydb.cursor() mycursor.execute('select * from student where address = "medavakkam"') # sql = 'insert into student (name, address) values (%s...
true
3e87a349e9311016b340239db53efa68a59b6af3
jeremymcrae/clinical-filter
/tests/test_family.py
UTF-8
6,686
2.734375
3
[]
no_license
''' Copyright (c) 2016 Genome Research Ltd. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distr...
true
5affd62a1e47f56dfd6ef037fc4f2d21c9672e34
nicolasjhampton/Py-Social-Network-Practice
/app.py
UTF-8
5,190
2.8125
3
[]
no_license
from flask import Flask from flask import flash #g is a global object we can attach things to for global access between views and modules from flask import g from flask import redirect from flask import render_template from flask import url_for from flask.ext.bcrypt import check_password_hash from flask.ext.login imp...
true
7eadf9e137a05ac7a8921e0209be708d04953c8c
dangchenyu/data_processing
/utils.py
UTF-8
6,165
2.546875
3
[]
no_license
import cv2 import os import shutil import json import random import string import numpy as np def crop_img(img_path): o=open('C:\\Users\\DELL\\Desktop\\#4484.txt') list_label=o.readlines() for item in list_label: item_list=item.split() if item_list[-1]=='1': region = map(eval, it...
true
f289785025194bf1ba7cee7dfa04e777e421c8ba
rishabhkashyap/Algorithm
/algorithms-python/list/linked_list.py
UTF-8
2,552
4.3125
4
[]
no_license
from __future__ import annotations from typing import Optional class Node: __slots__ = ["_data", "_next"] def __init__(self, data=0): self._data: int = data self._next: Optional[Node] = None @property def data(self) -> int: return self._data @data.setter def data(sel...
true
805abd3f568ffe89ff529e8a9cc009329718c68b
gabriellaec/desoft-analise-exercicios
/backup/user_166/ch83_2019_06_07_01_14_42_800056.py
UTF-8
237
2.6875
3
[]
no_license
def medias_por_inicial(dic): dic_notas_inicial={} for nomes in dic: if nomes[0] not in dic_notas_inicial: dic[nomes[0]]= 1 else: dic[nomes[0]] +=1 return dic_notas_inicial
true
201add728562fb1b9ba8335121f2f3782da30093
rrmina/continual-learning
/ewc/utils.py
UTF-8
1,214
2.515625
3
[]
no_license
import argparse def parse_args(): parser = argparse.ArgumentParser(description="Elastic Weight Consolidation") parser.add_argument('--num_tasks', type=int, default=10, help='number of tasks') parser.add_argument('--num_epochs', type=int, default=10, help='number of epochs per task') parser.add_argument...
true
2446467dadd12e2e02a68a0dcbaadc638867fe83
awillsousa/ccscore
/ccscore/helper_palavras.py
UTF-8
16,389
2.71875
3
[]
no_license
# Create data strucutures with PALAVRAS tags and # provide functions for parsing and processing from palavras_dic_tags import SEMANTIC_TAGSET from palavras_dic_tags import * from bs4 import BeautifulSoup import split_utils as su import requests from enum import Enum class TypeTagset(Enum): WORD_CLASS = 'WORD_CLAS...
true
915aa7f97712b155ea33be57f5a6869c5c8d802c
joanvelro/example_sphix
/teacherAPI/controller.py
UTF-8
8,832
3.234375
3
[]
no_license
""" .. module:: controller :synopsis: All endpoints of the Teacher API are defined here .. moduleauthor:: Rich Yap <github.com/richyap13> """ from flask import request, jsonify, abort, make_response, Blueprint from teacherAPI.database import db_session from teacherAPI.models import Teacher from sqlalchemy import...
true
54c4df2ebdb94f3a4996709cd71d9352249b8e3f
daverayment/aoc
/2016/Helpers/day_07.py
UTF-8
1,474
3.359375
3
[]
no_license
#!/usr/bin/env python3 def get_desc(): return 7, 'Day 7: Internet Protocol Version 7' def calc(log, values): ret = 0 ssl_count = 0 for cur in values: cur = " " + cur + " " in_square = 0 good = False made_bad = False ssl_in = set() ssl_out = set(...
true
371fdd06cc8c08a48171161c6bddbeab51b0614f
mutedalien/PY_algo_interactive
/less_3/task_6.py
UTF-8
165
2.90625
3
[]
no_license
# Ключ словаря - изменяемый объект set_x = {1, 2, 3} lst_x = [1, 4, 9] dict_x = {frozenset(set_x): lst_x} dict_y = {tuple(lst_x): set_x}
true
a14d9c2c33a32748fbe9efab2ab53e1846e21a5f
thatMeow/my_python_skills_collections
/Web_Crawling/access_web_test.py
UTF-8
330
3
3
[]
no_license
import nltk import urllib2 from bs4 import BeautifulSoup url = 'https://en.wikipedia.org/wiki/Basketball' raw = urllib2.urlopen(url).read().decode('utf8') text = BeautifulSoup(raw).get_text() tokens = word_tokenize(text) # Get only words: word_only_list_web = [word for word in tokens if word.isalpha()] word_only_l...
true
a6381df2509c8382ecc4e6b3afb13d07cd37d9f2
alzaia/applied_machine_learning_python
/evaluation_metrics/metrics_multiclass_classification.py
UTF-8
2,600
3.109375
3
[ "MIT" ]
permissive
# multiclass classification evaluation metrics on digits dataset import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib import cm from sklearn.model_selection import train_test_split from sklearn.datasets import load_digits from sklearn.svm import SVC from sklearn....
true
977f322a337aac58a17c046edf46f4be78547d8f
zizhizhou/RedstoneMusic
/music/constructSystem.py
UTF-8
11,936
2.515625
3
[]
no_license
# -------------------- # constructSystem.py # Attach the configured redstone system in game # -------------------- import sys sys.path.append("..") import mcpi.block as block import mcpi.connection import setSystem as ss # rN: repeaterNum # cRPL: columnRelativePlacingList # -------------------- # xBoundary # ------...
true
59b951d46762f3ed225c5fa3f56365a8ee24ce24
SyriiAdvent/Sprint-Challenge--Data-Structures-Python
/ring_buffer/ring_buffer.py
UTF-8
1,807
3.578125
4
[]
no_license
class RingBuffer: def __init__(self, capacity): self.capacity = capacity self.storage = [] self.position = 0 def append(self, item): if len(self.storage) == self.capacity: if self.position < self.capacity and self.position != 5: self.storage.pop(self....
true
a96764744b488429061abfba8fa2cba16f72f5bf
MuskanKhandelwal/Coding-problem-prep
/Heaps.py
UTF-8
16,533
3.46875
3
[]
no_license
####Bottom up approach#### # def parent(i): # return (i-1)//2 # # def left(i): # return (2*i)+1 # # def right(i): # return (2*i)+2 # # def build_heap(heap,n): # for i in range((n//2)-1,-1,-1): # heapify_down(heap,n,i) # # def heapify_down(heap,n,i): # s=i # l=left(i) # ...
true
1ce8eb81f99dd65485a87564f0985ef0c85c4554
topoftheyear/Byte-le-Game-Examples
/Fateful Fable/base_client2.py
UTF-8
2,985
3.203125
3
[]
no_license
from game.client.user_client import UserClient from game.common.enums import * class Client(UserClient): # Variables and info you want to save between turns go here def __init__(self): super().__init__() def team_name(self): return 'Team 2' def set_team(self): return [ ...
true
4f80c5c07955e56a7fbcbffb7ca664230e1fdd6d
kozlovadg/personal_data_db
/PersonalDataDb/personal_data_project/utils.py
UTF-8
2,539
2.6875
3
[]
no_license
from argparse import ArgumentParser def add_arguments_to_parser(parser): # type: (ArgumentParser) -> None parser.add_argument( '-add_from_json', "--add_from_json", action="store", help=( "Add Data From JSON File (Specify path to " "tests JSON file, rela...
true
46fe166af0c8d150c039ea42ef30c31537e0a95d
ryanwcyin/toy-bot
/utils/get_data.py
UTF-8
1,198
2.984375
3
[]
no_license
from binance.client import Client from config import config import pandas as pd from loguru import logger # config # symbol = "BNBUSDT" # fname = f'data/{symbol}_15_val.csv' # startdate = "1 Jun, 2021" # enddate = "30 Jun, 2021" # interval = Client.KLINE_INTERVAL_15MINUTE def get_data(symbol, output=None, startdate="...
true
5ba84dbef3b4021c39c9648302274af505faf852
AaronWhy/Turiss
/Stat/Help_Pos.py
UTF-8
1,952
2.875
3
[]
no_license
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import pandas as pd import seaborn as sns class Comment(object): def __init__(self, seq, score, help): super(Comment, self).__init__() self.seq = seq self.score = score self.help = help def getKey(x): r...
true
25a590b4f006a163d43954c5e17280b30b0838f2
argipap/NBAFantasyHacker
/services/users/project/models/player.py
UTF-8
1,549
2.671875
3
[]
no_license
from project import db class Player(db.Model): __tablename__ = "players" id = db.Column(db.Integer, primary_key=True, autoincrement=True) player_id = db.Column(db.Integer, unique=True, nullable=False) first_name = db.Column(db.String(128), unique=False, nullable=False) last_name = db.Column(db.St...
true
45ce4abe0cb4fdb78c4b0851acc37e244ab9c04d
tedzchu/faust-bot
/Faust.py
UTF-8
2,454
2.765625
3
[]
no_license
import discord import Move from random import randint from discord.ext import tasks from time import sleep def read_token(): with open("token.txt", "r") as f: lines = f.readlines() return lines[0].strip() def read_channel(): with open("token.txt", "r") as f: lines = f.readlines() ...
true
093c8239deb7b05fd28ff46bd2d5cd82d86792a5
abhijeetchauhan/DeepLearning
/HousingPrices.py
UTF-8
3,026
3.21875
3
[]
no_license
# coding: utf-8 # In[20]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import tensorflow as tf # In[21]: df = pd.read_csv("dataHousingPrices.csv") # In[22]: df = df.drop(['index','price','sq_price'],axis=1) # In[23]: dataframe = df[:10] # In[24]: dataframe.loc[:, ("y1")] = [1, 0...
true
0f9e6259d503febb358054294ff82e1f3715543c
aws-samples/aws-builders-fair-projects
/reinvent-2019/polyglot-bot/pi/moveNeck.py
UTF-8
428
2.8125
3
[ "Apache-2.0" ]
permissive
"""Just for namaste""" import time from adafruit_servokit import ServoKit import os import RPi.GPIO as GPIO # Set channels to the number of servo channels on your kit. # 8 for FeatherWing, 16 for Shield/HAT/Bonnet. kit = ServoKit(channels=16) #Move hand time.sleep(1) kit.servo[0].angle = 120 time.sleep(3) kit.s...
true
8be9abb655bfc3a70449a228d970c20d8de64a07
Jalapinho1/suns-MLPclassifier-AirbnbData
/normalizer.py
UTF-8
5,751
2.984375
3
[]
no_license
import pandas as pd import numpy as np from sklearn import preprocessing # -------------Encoding and scaling------------ def createGroups3BCN(row): if 0 < row['price'] <= 60: val = 0 elif 60 < row['price'] <= 120: val = 1 else: val = 2 return val def normalize_csv(newDf): f...
true
b1fc6ccbcc30587c3aeacc17ef3d9c48df49b11f
KentStateRobotics/KSRCore
/KSRCore/robot/motorController.py
UTF-8
3,995
2.8125
3
[]
no_license
import time import struct from enum import Enum import math messageHeader = struct.Struct('<BB') #(motorId, messageId) class MESSAGES(Enum): oMotorCommand = 0, struct.Struct('<BB') #output, Motor command (direction, value) oRequest = 1, struct.Struct('<B') #output, Request value (otherMessageId) iDeltaPo...
true
e547189f32954322c2da14de69c381ec4af1abfb
mcgridles/pickle_exercise
/utils.py
UTF-8
4,353
4.1875
4
[]
no_license
import itertools import enchant def check_input(num): """ Checks for valid input and raises exceptions if invalid. :param num: (str) -> US or wordified phone number :return: (str) -> Phone country code (str) -> US or wordified phone number with hyphens removed """ # Check type try: assert(type(num) is ...
true
e14bc026ca8b6cc6eda80009714072069273ffca
riojano0/Python_Scripts
/GtkImage y BD/main.py
UTF-8
2,590
2.78125
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- from databasehelper import Database import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, GdkPixbuf class MainWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="ImageRefresh from database") self.set_position(Gtk.WindowPosit...
true
abae113762a9f9716d562bd81acfbdd97b8e2cc5
LuMiSxh/Adenn
/Extensions/Handler/Events.py
UTF-8
4,084
2.6875
3
[ "BSD-3-Clause" ]
permissive
# Import import asyncio import datetime import random import discord from discord.ext import commands # Framework import Framework # Cog Initialising class EVENT(commands.Cog): def __init__(self, client): self.client = client self.Uccount = Framework.Uccount(client) # MEMBER JOIN @c...
true
5da8de474930eddd76b40d2da23993bc19eb7fbb
suaibmahmud/oop-in-python
/01_class_instances.py
UTF-8
643
4.09375
4
[]
no_license
class Employee: # __init__(self) method is a constructor for class # here self representes the instance # thats why every method have self argument def __init__(self, fname, lname, age, email): self.fname = fname self.lname = lname self.age = age self.email = email ...
true
7f5ec95c0282c8197e13192d4e748dc3250faa97
sminez/Rust
/embed/embed.py
UTF-8
542
3.125
3
[]
no_license
''' This is an example of how to call a Rust compiled 'C extension' that has been written in Rust! See lib.rs in the /src directory for the corresponding Rust code. Look into how to execute individual functions from within an .so file. (FFI section: p106) ''' from ctypes import cdll # This loads the library compiled ...
true
c49739288caed1ba97d5d123d6ee02bdfac59a72
zarekxu/DAC2019-MASKER
/tf_logits.py
UTF-8
37,067
2.578125
3
[]
no_license
from python_speech_features import mfcc import math import os import sys sys.path.append("DeepSpeech") import numpy as np import tensorflow as tf import scipy.io.wavfile as wav # Okay, so this is ugly. We don't want DeepSpeech to crash # when we haven't built the language model. # So we're just going to monkeypatch T...
true
7367baec30596486fbe88e2c7a2120212f8d68c6
AGOL007/Python-GSHLD-Code
/GeoShieldFunctionalTest/GeoShieldCommonFiles/AppCommonUtility.py
UTF-8
4,505
2.78125
3
[]
no_license
import xlrd import time def locator_value(driver, locator_type, value): """ Method to get the locator type """ if locator_type == "id": webelement = driver.find_element_by_id(value) elif locator_type == "name": webelement = driver.find_element_by_name(value) elif loca...
true
fb30be7c70c7f79884058ec54bbc633980b7902e
ssongman/windmill
/thread/thread_a.py
UTF-8
550
3.1875
3
[]
no_license
# thread_a.py # -*- encoding: cp949 -*- from threading import Thread import time def do_work(start, end, result): sum = 0 for i in range(start,end): sum += i result.append(sum) return if __name__=='__main__': s_time = time.time() START, END = 0, 20000000 result = list() th1 = T...
true
7ac71ddc59f114bcac1e395b2957898477e649fa
rhnvrm/mini-projects
/bioinformatics/HammingDistance.py
UTF-8
164
3.046875
3
[ "MIT" ]
permissive
def HammingDistance(p, q): # your code here distance = 0 for i in range(0,len(p)): if p[i] != q[i]: distance+=1 return distance
true
ef0ea1f2185d9eb3bcaa087841ced64288aa939b
DanielC350/Hangman_game
/hangman_gui.py
UTF-8
9,110
3.265625
3
[]
no_license
from tkinter import * from PIL import ImageTk, Image root =Tk() root.title('Hangman Pog') root.geometry("260x260") #turn list into a string def listToString(list): str1 = "" return(str1.join(list)) #set a word as the answer for the game def submit_word(): #get input from screen global answer answe...
true
2fa76b9dceedfe972fc29deae95321b9c9114300
Devil-ReaperL/Trash
/0109/study2/条件.py
UTF-8
624
4.0625
4
[]
no_license
name = "Tom" pwd = "123" name1 = input("输入用户名") pwd1 = input("输入密码") if name == name1 and pwd == pwd1: print("登录成功") score = int(input("输入学科成绩")) if score>100 or score<0: print("成绩作废") elif score >= 90 : print("优") elif score >= 80: print("良") elif score >= 7...
true
f559b1382be1e7a61cff94525be67931acf6a587
chaipan/NeuralNetwork
/TensorFlow/regression/test.py
UTF-8
805
2.6875
3
[]
no_license
import TensorFlow as tf import numpy as np import matplotlib.pyplot as plt # 造数 x_tf = np.linspace(-1, 1, 100)[:, np.newaxis] noise = np.random.normal(0, 0.1, x_tf.shape) y_tf = np.square(x_tf) + noise # 构造图 x = tf.placeholder(tf.float32, x_tf.shape) y = tf.placeholder(tf.float32, y_tf.shape) l1 = tf.layers.de...
true
53142bf11a2d157ef9bc632a8b2eeec1df05e2e8
dhvssigrun/HTTPFuzz-1
/headers/accept.py
UTF-8
2,702
2.515625
3
[]
no_license
from header import Header import random class Accept(Header): def __init__(self, params=None): Header.__init__(self, params) self.name = "Accept" self.max_types = 10 # Allow this many types self.valid_media_range = {"application":["javascript", "json", "x-www-form-urlencoded", "xml", "zip", "pdf", "sql", "gra...
true
5b8be7ecee1462c756830335263be20671ef9766
unscrambled/stackstorm-pagerduty
/actions/lib/error.py
UTF-8
387
2.71875
3
[]
no_license
class UnknownUser(Exception): default_message = ("I don't know your PagerDuty email address." "Please identify yourself with " "`! pagerduty email <email_address>` first.") def __init__(self, message=None, *args): self.message = message or self.default_mess...
true
65ca59a9e44819243e69a3aa75145941de1d8d04
tius1234/algorithm
/baekjoon/python/success/2579.py
UTF-8
781
3.4375
3
[]
no_license
# https://www.acmicpc.net/problem/2579 def climb_stairs(stair_list): if len(stair_list) < 1: return 0 elif len(stair_list) == 1: return stair_list[0] elif len(stair_list) == 2: return stair_list[0] + stair_list[1] result_list = [ stair_list[0], stair_list[0] +...
true
8bc8ceb92a1c3aad4f3a803f18f524cf3ac3683c
BenjaminLowry/RPGGame
/Collectibles/Usables/Weapons/Pipe.py
UTF-8
218
2.515625
3
[]
no_license
from Collectibles.Usables.Weapons.Weapon import Weapon class Pipe(Weapon): def __init__(self): super().__init__("Pipe", 3, "A rusted pipe. Heavy but brings a punch.", 1, 25, 1, -1, True, 0.999, 0.001)
true
22a0ca011111874615fd0fd595c205f3f512db36
owoicc129/ceb102-pyETL
/22-1接22遇到json.decoder.JSONDecodeError問題.py
UTF-8
1,200
2.65625
3
[]
no_license
#22 遇到json.decoder.JSONDecodeError問題 import requests import json import time from bs4 import BeautifulSoup headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.96 Safari/537.36' } url = 'https://buzzorange.com/techorange/wp-a...
true
98a8744b7bbf730169aa30bf609a202ac53dd56c
guilhermeLMiranda325/cursoPython
/dev/aulas/tomada_decisao/exercicio2_15.py
UTF-8
125
3.453125
3
[]
no_license
caractere = 'z' if(caractere in ('a', 'e', 'i', 'o', 'u')): print("É uma vogal!") else: print("Não é uma vogal!")
true
ec6d7ce027950e70c77e755ed3ce424109a928ea
Slide-to-Display/minionfo-web
/code/Display.py
UTF-8
1,334
3.09375
3
[]
no_license
# display function import json import process_tweets def Display(data): results = list() tweets, processed_tweets = process_tweets.extract_fetched_tweets(data) process_tweets.analyse_tweets(tweets, processed_tweets) pos = 0 neg = 0 net = 0 for tweet in tweets: if tweet.sentiment ...
true
5a3d49f08bc3b8cb05ce50d5694a3a9efacd0605
Skipper609/python
/Sample/class eg/lab questions/2B/1.py
UTF-8
378
3.984375
4
[]
no_license
def biggest(num1, num2, num3): if (num1 > num2 and num1 > num3): return num1 return num2 if num2 > num3 else num3 def biggest2(num1, num2, num3): return num1 if num1 > num2 and num1 > num3 else num2 if num2 > num3 else num3 a, b, c = input("Enter 3 numbers :").split() big = biggest2(int(a), int(...
true
ba2b3c3abaf8ff9dd2ec892a71c657a81941c921
jmcrey/cs584-final-project
/models/textual_entailment.py
UTF-8
5,991
2.703125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Instructions: # # 1. Run the wget command below to download the attention model # 2. Untar the downloaded file and modify the `config.json` file # - Change the key `model.type` to "textual_entailment" # 3. Retar the downloaded file and name it "textual_entailment.tar.gz" ...
true
719cf3ee63ead44ce712192685aa6308b190ca45
marcoarego/CompPhylo
/Exercise_2.py
UTF-8
7,551
4.28125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jan 24 23:04:02 2015 @author: Marcola """ import random from scipy import stats from scipy.stats import rv_discrete import matplotlib.pyplot as plt # Item 1 """ (1) Write a function that multiplies all consecutively decreasing numbers between a maximum and a minimum supplie...
true
8fd1707afe93cc9cc064de3a77d4529a01f8888c
Demfier/Concept-Learning
/concept_context.py
UTF-8
40,626
2.953125
3
[]
no_license
# -*- coding: utf-8 -*- """ Author: Gaurav Sahu, 09:28 16th January, 2018 Implements the various methods related to concepts and contexts. CLassess/Methods implemented here 1. formalConcept - extent - intent 2. formalContext Closure methods, attribute-prime, object-prime see examples.py for usage examples. ""...
true
4c66bf6978c39f5f88c7d425dfece5b94a3db72a
jiheelee/list
/재귀함수/fibo.py
UTF-8
408
3.359375
3
[]
no_license
# def fibo(n): # if n < 2: # return n # else: # return fibo(n-1) + fibo(n-2) # # print(fibo(8)) # # def f(n): # if (n >= 2 and memo[n] == 0): # memo[n] = f(n-1) + f(n-2) # return memo[n] # # N = 10 # memo = [0] * (N+1) # memo[0] = 0 # memo[1] = 1 # print(f(N)) # print(memo) F = ...
true
fd57937bb34a8e9ae4757a6af30d9d65bda6abbd
saharama/UAVClassifier
/raven_sizeF.py
UTF-8
2,452
2.84375
3
[]
no_license
#import json for load() and matplot for graph #both internal libraries import json import matplotlib.pyplot as plt import numpy as np def dict_ignore_on_duplicates(ordered_pairs): """Reject duplicate keys.""" d = {} for k, v in ordered_pairs: if k not in d: d[k] = v return d #print packet count #format= pa...
true
008d183e1acbfe54b45abdd1deec857839b187dd
tkhang1999/Solr-with-BERT-embedding
/semantic_search.py
UTF-8
1,283
2.890625
3
[]
no_license
import pysolr from sentence_transformers import SentenceTransformer import constants embedder = SentenceTransformer(constants.PRE_TRAINED_MODEL) solr = pysolr.Solr(constants.SOLR_URL) def semantic_search(query): # Encode query to BERT embedding query_embedding = [str(emb) for emb in embedder.encode(query)[0]...
true
52d1edfb678b5bb9531ed407d3739a20dfcd759e
manand881/Python-Programs
/vovelcheck.py
UTF-8
434
4.15625
4
[ "MIT" ]
permissive
# Test whether a passed letter is a vowel or not alpha=str(input("enter an alphabet")) feedback=str(input("would you like to use an if statement? ")) if feedback == 'yes' or 'YES' or 'Yes' or'Y': if alpha == 'a' or 'e' or 'i'or'o'or'u': print('vowel') else: def is_vowel(char): all_vowels = 'aeio...
true
70b4e012508187dc38d0f49cdc9b07364ed22c71
nileshram/PortfolioRisk
/src/contract/functions.py
UTF-8
8,868
2.6875
3
[]
no_license
''' Created on 20 Apr 2020 @author: root ''' """ Copyright : 2018 Atlantic Trading London Ltd. All rights reserved. Date of Creation : 22 Jul 2019 Author : nish """ import datetime import pandas as pd from dateutil.relativedelta import relativedelta class PortfolioFunctions: @staticmethod def apply_dat...
true
bfb7050bac054117b2f54d47ba64ed2f0e9d9b92
evandromaster/mysql
/200 - PythonMySQL/Office/insert1.py
UTF-8
687
2.859375
3
[]
no_license
import csv import datetime import mysql.connector mydb = mysql.connector.connect(host='localhost', user='root', passwd='seo23', db='gdo') cursor = mydb.cursor() cursor.execute("truncate tbl_crimes") query = """INSERT INTO tbl_crimes (NREDS) VALUES (%s)""" with open('C:/Users/Geo/Documents/MEGAsync/MySql/200 - PythonM...
true
58147350e5fc9ad55a08ab030894c859d74509e2
MilanaShhanukova/programming-2021-19fpl
/tree/start.py
UTF-8
779
4.625
5
[ "MIT" ]
permissive
""" Programming for linguists Example of the data structure "Binary Search Tree" """ from tree.search_tree import Node if __name__ == '__main__': print(r"""One example of a tree 12 / \ 5 16 / \ 14 19 \ \ ...
true
1a8c578eb3399344663cd2e7516dcb57b4d0bc1b
crushingCodes/beginner-python-tutorial
/5_functions/functions_1.py
UTF-8
142
2.71875
3
[]
no_license
# 5 Functions def say_hello(): print("Hello") # TODO Try running and see what happens say_hello # Ok lets try this one # say_hello()
true
507a18629c7aa4d4e61cbf289d548cea53b04d80
nepstad/einelektron
/test/import_test.py
UTF-8
1,273
2.671875
3
[]
no_license
import sys import unittest sys.path.append("..") class TestImportAllEinPartikkelModules(unittest.TestCase): """ Test that all EinPartikkel submodules, classes and functions may be imported """ def setUp(self): einpartikkel = __import__("einpartikkel") self.globals = {"einpartikkel": einpartikkel} def IsM...
true
b8e2656c7f85d0a80ea748ff499884f00841d9c8
junnyhe/Code
/deprecated/deprecated.src/step2_model_data_prep_signal_only/step2c_model_data_impute_woe.py
UTF-8
7,546
3.03125
3
[]
no_license
import csv import gzip import os import sys import datetime import random from numpy import * sys.path.append("/Users/junhe/Documents/workspace/fraud_model/src/csv_operations") import csv_ops from csv_ops import * ################################################################################ # Define imputation fun...
true
f7d5a56f60be8563129942e27547b22b11c17f54
nucleomis/Archivos_Python
/ejercicios 1er año/ejercicio9.py
UTF-8
314
3.671875
4
[]
no_license
a=int(input("ingrese un valor")) if a>99 and a<1000: print("el numero tiene 3 cifras") else: if a<100 and a>9: print("el numero tiene 2 cifras") else: if a<10: print ("el numero tiene 1 cifra") else: print ("error el numero supera las 3 cifras")
true
0a205bc197e15c7c947a98e216edb38c71faea37
Anonymous0064/CyberUserBot
/userbot/modules/sql_helper/quick_phrases_sql.py
UTF-8
913
2.671875
3
[ "MIT" ]
permissive
try: from userbot.modules.sql_helper import SESSION, BASE except ImportError: raise AttributeError from sqlalchemy import Column, String, UnicodeText class QuickPhrase(BASE): __tablename__ = "quickphrases" resp = Column(String(10), primary_key=True) phrase = Column(UnicodeText, primary_key=True) ...
true
8c8736af4f8efcf1080bfa7110ad79a3d4112ffc
Karma-Team/py-video-processing
/main-map.py
UTF-8
6,203
2.578125
3
[]
no_license
import numpy as np import cv2 FILENAME = "capture.png" THRESHOLD_RED = 50 # 127 THRESHOLD_GREEN = 60 # 127 THRESHOLD_V = 30 # 127 BLUE = 0 RED = 1 GREEN = 2 H = 0 S = 1 V = 2 img = cv2.imread(FILENAME) dimY, dimX, _ = img.shape print(dimX, dimY) imgg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imshow("init", im...
true
7fe2006cce0811e59d081a8f1b0f2c4f7b061351
TidB/irc_sim
/sim/user.py
UTF-8
1,803
3.328125
3
[]
no_license
MIN_LENGTH = 15 class User: def __init__(self, nick, channel=None, markov_text=None): self.nick = nick self.channel = channel self.markov_text = markov_text self._previous_messages = set() def __str__(self): return self.nick def say(self, msg): if self.ch...
true
eecf1d418155f7ae27b4dce7f4c4aa384bb413b4
fxma/testDjango
/testDjango/views.py
UTF-8
1,234
2.515625
3
[]
no_license
from django.http import HttpResponse,Http404 import time import datetime from django.shortcuts import render from django.shortcuts import render_to_response import MySQLdb # def hello(request): # return HttpResponse("hello world!") def hello(request): context = dict() context['hello'] = 'Hello World!' ...
true
51cbdf3a9d1b509570cdc61b6d7d262cb002e859
ddchris/python_note
/檔案壓縮解壓縮/壓縮與解壓縮.py
UTF-8
1,072
3.46875
3
[]
no_license
""" 解壓縮.zip檔案 """ import zipfile # 讀取檔案使之成為程式物件 files = zipfile.ZipFile('calculator_plus.zip') # 顯示壓縮黨內包含哪些檔案 files.namelist() # 解壓縮單一檔案 -> .extract(r'檔案名稱',r'檔案位置') files.extract(r'calculator_plus/image/AC.png', r'C:\Users\chris2012\Documents\visual studio 2017\Projects\Python 標準函式庫應用\Python 壓縮與解壓縮') # 解壓縮所有檔案 ->...
true
3bfb8887eb0eda276ffb2222acd012ee115379c2
pghanem/Data-Structures-Algorithms
/prac_everyOther.py
UTF-8
85
2.8125
3
[]
no_license
def everyother(s1): for x in range(0, len(s1), 2): print(s1[x])
true
10dbab3bb556675d16ddf9858b9a1a64bd9b916d
mhs-capco/jira_tools
/hour_parser.py
UTF-8
766
3.140625
3
[]
no_license
#!/usr/bin/env python3 import sys def time_split(tm_str): bits = tm_str.split() componts = {} for bit in bits: unit = bit[-1] val = int(bit[:-1]) componts[unit] = val return componts rates = { "w": 40.0, "d": 8.0, "h": 1.0, "m": 1.0/60, } def calc_hrs(tm, rts=...
true
03afe7af030445e956c46ff83f49513cfa00ae2a
cityofcapetown/covid-19-widgets
/table_widget.py
UTF-8
4,124
2.6875
3
[]
no_license
import collections import itertools import json import os import tempfile import jinja2 import requests GRIDJS_LINK = ("gridjs.js", "https://unpkg.com/gridjs/dist/gridjs.production.min.js") GRIDJS_CSS_LINK = ("mermain.css", "https://unpkg.com/gridjs/dist/theme/mermaid.min.css") class TableWidget: _template = ji...
true
5717573f9b2b82369bd24da91afc2897e6f9c6b7
LossonLuckett/FaceAuth
/FaceRec (1)/FaceRec/trainfaces.py
UTF-8
1,967
2.78125
3
[]
no_license
import os import cv2 import numpy as np import pickle from PIL import Image face_cascade = cv2.CascadeClassifier('Cascades/data/haarcascade_frontalface_alt.xml') recognizer = cv2.face.LBPHFaceRecognizer_create() BASE_DIR = os.path.dirname(os.path.abspath(__file__)) image_dir = os.path.join(BASE_DIR, "Image...
true
5b2129f5d716789955d9b53aa5c45ee95e07fde0
tomasli/python-cookbook-code
/chepter_02/2_20.py
UTF-8
501
3.3125
3
[]
no_license
data = b'Hello World' print(data[0:5]) print(data.startswith(b'Hello')) print(data.split()) print(data.replace(b'Hello', b'Hello Cruel')) print('\n') data = bytearray(b'Hello World') print(data[0:5]) print(data.startswith(b'Hello')) print(data.split()) print(data.replace(b'Hello', b'Hello Cruel')) print('\n') data = ...
true
ead8295e9430f0d8ec72b5336cf5e710b66365c7
eaniyom/python-challenge-solutions
/Aniyom Ebenezer/phase 1/python 2 basis/Day_18_Challenge_Solution/Question 4 Soln.py
UTF-8
333
4.4375
4
[ "MIT" ]
permissive
""" Write a Python program to add two positive integers without using the '+' operator Note: Use bitwise operations to add two numbers """ a = int(input("Input a Number: ")) b = int(input("Input another number: ")) while b != 0: data = a & b a = a ^ b b = data << 1 print("The sum of the two positive num...
true
e3d50f7d888a0250c7b966effe209946113ee29f
CarolineVantiem/CMSC-201-HW
/hw2/hw2_part2.py
UTF-8
884
4.15625
4
[]
no_license
# File: hw2_part2.py # Author: Caroline Vantiem # Date: 9/18/2017 # Section: 3 # E-mail: cvantie1@umbc.edu # Description: Asks the user to input a number and rounds up or # down depending on the response. def main(): numInput = float(input("Input the number you are rounding: ")) roundNum = str(...
true
8053b979af74913ec106c48b787508a1b76a9e39
joestalker1/leetcode
/src/main/scala/ComboMeal.py
UTF-8
299
2.984375
3
[]
no_license
import sys def profit(b, s, c): x1 = c - s p = b - x1 return p if __name__ == "__main__": t = int(input().strip()) for a0 in range(t): b, s, c = input().strip().split(' ') b, s, c = [int(b), int(s), int(c)] result = profit(b, s, c) print(result)
true
308ae89c0a56da356778a7db314563037a66e888
benrobinson1976/numerical_examples
/fractals.py
UTF-8
802
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- # <nbformat>2</nbformat> # <codecell> from numpy import * import pylab x = [0, 0]; p = [.85, .92, .99, 1.0] A1 = [[.85, .04],[-.04, .85]]; A2 = [[.20, -.26],[.23, .22]]; A3 = [[-.15, .28],[.26, .24]]; A4 = [[0, 0], [0, .16]]; b1 = [0, .16]; b2 = [0, .44]; for i in range(10000): r = rand...
true
389667667d8fc5bb4d5c2126c726c67f02d00a0a
akito-sama/Game
/ennemie.py
UTF-8
770
2.984375
3
[]
no_license
import pygame import random class Ennemie(pygame.sprite.Sprite): """docstring for Ennemie""" def __init__(self, image, player): super().__init__() self.player = player self.image = image self.rect = self.image.get_rect() self.rect.x = random.randint(720, 1200) self.rect.y = player.default_y ...
true
b8a218cdc66c7248b61e6f94418da26319e0929a
MiguelVuori/inf1301
/Yahtzee/TADpontuacao/pontuacao.py
UTF-8
4,223
2.765625
3
[]
no_license
import sys sys.path.insert(1, '../TADtabela/') #from dado import * from tabela import * __all__ = ['pnt_pontua', 'pnt_atualiza_pontuacao', 'pnt_soma_pontuacao', 'pnt_testa_bonus', 'pnt_mostra_tabela'] def init(): global criterios criterios = [] #tab_ins(criterios,[0,0,0,0,0,0,0,0,0,0,0,0]) def pnt_pontu...
true
3e543cbdf466b0a00cb71003f9a8b69dc42de4d3
franciscogomes2020/exercises
/pt/027/python/main.py
UTF-8
172
4.125
4
[ "MIT" ]
permissive
# Faça um programa que leia o nome completo de uma pessoa, mostrando em seguida o primeiro e o último nome separadamente. Ex: Ana Maria de Souza (primeiro = Ana; último = Souza).
true
3ee5be271e0f77eae2045066d3fc54d752ba55df
Abhinav-CHD/Personal-Projects
/Instagram Caption Recommender using Machine Learning/main.py
UTF-8
1,957
2.828125
3
[]
no_license
from tkinter import * from tkinter import filedialog import cv2 from captions import * from random import choice import pyperclip FILE_PATH = None base = Tk() base.config(pady=50) base.title("Instagram Caption Recommender") # Create a canvas img = PhotoImage(file="new.png") canvas = Canvas() canvas.c...
true
6f2202ed64815d4fe1d972b79cd9c33f7d89e014
dwszai/ml-regression-ensemble
/ml-housing-prediction.py
UTF-8
13,159
3.1875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # ## Import libraries # In[1]: import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from pandas_profiling import ProfileReport from datetime import datetime from sklearn.preprocessing import StandardScaler import fuzzywuzzy from fuzzywuzz...
true
035e22baeec102b19eacec756351fcc15b34e909
jhta/ACM-ICPC
/uva/12403.py
UTF-8
400
3.28125
3
[ "MIT" ]
permissive
from sys import stdin, stdout def main(): total = 0 # input via readline method n = stdin.readline() for l in range(int(n)): # array input similar method arr = stdin.readline().split() text = arr[0] if (text == 'donate'): total += int(arr[1]) else: ...
true
068a5657ff857b7f9515990a948031c58fd2ea4f
Kirill888/odc-tools
/libs/dscache/odc/dscache/apps/dstiler.py
UTF-8
2,653
2.625
3
[ "Apache-2.0" ]
permissive
from functools import partial import click from odc import dscache from odc.dscache.tools.tiling import ( bin_by_native_tile, web_gs, extract_native_albers_tile, parse_gridspec, ) from odc.dscache._dscache import mk_group_name from odc.index import bin_dataset_stream @click.command("dstiler") @click....
true
9e9ee7506366cb426d0ded8e2c6bf880ab7d0e37
AK-1121/code_extraction
/python/python_5310.py
UTF-8
136
2.546875
3
[]
no_license
# python: can i access the index of the element when i use map()? map(lambda (index, word): someFunction(word, index), enumerate(data))
true
33d2a10dc269894f2d05692dc4b2d0e4efaa8aa9
AmanDaVinci/DeepLabs
/src/dnn.py
UTF-8
2,742
2.921875
3
[ "MIT" ]
permissive
#! /usr/bin/env python # ==================================== # Fully Connected Feedforward Network # Author: Aman Hussain # ==================================== # Import Libraries import torch import torchvision import torch.nn as nn import torch.optim as optim import torch.nn.functional as F import torchvision.tra...
true
1d6220b60513e7bf82d32266914168baba2cf85b
DarinZhang/lpthw
/ex40/myStuffMod.py
UTF-8
130
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- def apples(): print "This is an apple from a module." tangerine = 'This is a tangerine from a module.'
true
a7ad1846cb1736c20504fd5785b35870abab1bb0
pkpavlov/SoftUni-Basic-Python
/03. SquareArea.py
UTF-8
60
3.265625
3
[]
no_license
а = int(input()) square_area = а*а print(square_area)
true
2172d13052a3d053ffc070cd30d0a56f2f037770
sarathradhakrishnan/Coffee-Machine
/main.py
UTF-8
3,045
3.671875
4
[]
no_license
MENU = { "espresso": { "ingredients": { "water": 50, "coffee": 18, }, "cost": 1.5, }, "latte": { "ingredients": { "water": 200, "milk": 150, "coffee": 24, }, "cost": 2.5, }, "cappuccino": { ...
true
45865b0fab37507745dc77c7f442967192a9c9ad
Rbsann/Niqq_trabalho
/TensorFlowKeras/data_discovery.py
UTF-8
3,168
2.9375
3
[]
no_license
from pymongo import MongoClient import base64 import zlib import re def get_pages_from_db(): client = MongoClient("mongodb://thiago:123456@ds149059.mlab.com:49059/niqqdb") db = client.get_database("niqqdb") collection = db["pages"] pages = [] for page in collection.find({ "classified":Tru...
true
dd360464945a63302b4f48212c2788b1c0842bd6
amanotakarin/Personal_Projects
/Reflexion Projects/Markdown Converter/callMarkdownConverter.py
UTF-8
1,116
3.109375
3
[]
no_license
import sys, os def CallWikiToConfluenceConverter(): #Get the directory and import the path for the MarkdownToWikiConverter script while True: try: getPathInput = raw_input('Input path of MarkdownToWikiConverter --> ') FULL_PATH = os.path.abspath(getPathInput) sys.p...
true
62b5d3826b2d44175e61402da9bc0d39509589b9
Mckale/Bootcamp-14
/Day-0/Test_case_two.py
UTF-8
320
2.890625
3
[]
no_license
import math from math import pi def volume_cylinder(r, h): return int(pi*r**2*h) import unittest class Test_v(unittest.TestCase): def testVolume(self): self.assertEqual(volume_cylinder(4,6),301) self.assertEqual(volume_cylinder(2,2), 25) if __name__ == '__main__': unittest.main()
true
7d00f4d47b833a688979d1e36f9f23e8927f5bbb
hmalif/100-of-py
/day 3/t2.py
UTF-8
153
3.609375
4
[]
no_license
a=int(input("type your number ")) if a == 5: print("a is epual 5") elif a < 5: print("a is less than 5") else: print("a is greater than 5")
true
2f9b9924b0dff93d641b5cdd77c9ab9e86022de8
Farnaz03/Linear_Algebra_Calculator
/user_int3.py
UTF-8
2,798
2.828125
3
[]
no_license
import numpy as np from tkinter import* from tkinter import ttk root = Tk() root.title("Three set of Linear Equations") mainframe = ttk.Frame(root, padding="55 55 55 55") mainframe.grid(column=0, row=0, sticky=(N, W, E, S)) root.columnconfigure(0, weight=5) root.rowconfigure(0, weight=5) x1 = StringVar() y1 = Strin...
true
eb84d8f611995ea16192b3e5b3906cf78fb0ae0b
vaneEmy/resuelve-back
/app/players/services.py
UTF-8
697
3.375
3
[]
no_license
from teams.services import get_team_and_level_data def create_player(name, level, goals, salary, bono, team): """ We get the minimum of goals by team and level that the player has then, we create a Player object with the following information: Name, goals, minimum goals, salary, bono and team ...
true
ea9ccd162578fe2bf4c688f050ad0434aa6c478b
MichalDudkiewicz/Metody_Numeryczne
/Zadanie_5_aproksymacja_wielomiany_Legendre'a/Program/funkcje.py
UTF-8
1,220
3.703125
4
[ "Apache-2.0" ]
permissive
from numpy import sin, cos from horner import horner import sympy as sp def wartosc_funkcji(x, wybor_funkcji): """ :param x: argument funkcji (float) :param wybor_funkcji: wybor funkcji z dostępnych (String) :return: wartość wybranej funkcji (float) dla x """ wartosc = None if ...
true
32b509d3e612fb867cdd481af72d1983cdcdcebe
Srishtimend/openAI-FrozenLake
/Frozen-Lake-wothout-TensorFlow.py
UTF-8
2,143
3.296875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[4]: import gym import numpy as np import time, pickle, os env = gym.make('FrozenLake-v0') #initialize frozen lake environment env.reset() env.render() #loads the environment GUI epsilon = 0.9 total_episodes = 10000 #Total number of episodes - Number of times we're going ...
true
5c44261332fabdcd99073ad23256af7164995cae
btcrabb/NSQIP_ML
/src/data/make_dataset.py
UTF-8
5,485
2.703125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import sys import os.path sys.path.append(os.path.join(os.path.dirname(__file__), '..')) import logging from pathlib import Path from util import util from options.dataset_options import DatasetOptions import pandas as pd import numpy as np from sklearn.model_selection import train_test_split i...
true