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
550c220d04990e4d36926a807bd6c5c623580cf6
Python
JasmineLf/ProjectMePy
/venv/Code/20200422Item/Students.py
UTF-8
10,074
3.609375
4
[]
no_license
''' 时间:2020-4-22 23:13:49 作者:LF 邮箱:jksj27250#gmail.com 主题: 学生信息管理系统 内容: 1.学生信息维护 1.1.录入学生信息 1.2.删除学生信息 1.3.修改学生信息 2.查询/统计 2.1.按学生姓名查找 2.2.按学生ID查找 2.3.查询并显示所有学生信息 2.4.统计学生总人数 3.排序 3.1升序排序 3.2降序排序 ''' # -*- coding: UTF-8 -*- import o...
true
8e21b17a7d7e00ca82552d3057d5921382ae7591
Python
RepnikovPavel/kursach_filtr_of_signal
/EXTRACT_AND_SHOW_DATA/load_saples_from_file.py
UTF-8
1,315
2.6875
3
[]
no_license
import os import numpy as np # self.samples, self.labels = load_all_samples_and_labels(data_path, metki_path) def load_all_samples_and_labels(data_path, metki_path): #так как данных мало, то никаких batches и онлайн подгрузки данных не будет. просто грузим все разом #все выполняется только если что-то запис...
true
3b7d206d3ea38fa0e080bbb4a44088262c4c0603
Python
madaan/minimal-text-diffusion
/src/utils/show_sampling_progress.py
UTF-8
1,638
4.125
4
[ "MIT" ]
permissive
from typing import List list_of_colors_from_red_to_blue = [f"\033[38;2;{r};0;{b}m" for r, b in zip(range(255, 0, -10), range(0, 255, 10))] def pprint_sentences(sentences: List[str], banner: str = "", sep: str = ""): """ Given a list of sentences, prints them with a gradient of colors from red to blue """ ...
true
f6bb0b93c1debdf22edb87b6000be8f94b89a656
Python
wbogatyrewa/checkstudent
/app.py
UTF-8
16,463
2.5625
3
[]
no_license
import dash import dash_html_components as html import pandas as pd import base64 from datetime import datetime as dt import dash_core_components as dcc from dash.dependencies import Input, Output, State import random import re from flask_sqlalchemy import SQLAlchemy from flask import Flask """ Запуск приложения """ s...
true
681a7efb7977f43885a058a44e8519b8e9c13d64
Python
toilatester/sample-automation-frameworks-across-languages
/python/GUI/POM/KnowledgePage/KnowledgeValidation.py
UTF-8
2,092
2.65625
3
[ "Apache-2.0" ]
permissive
from typing import List from Core.Base.BaseValidation import BaseValidation from Core.DatabaseFactory.DatabaseType import DatabaseType from Model.Bot import BotDataModel from Model.QnA import QnADataModel from Utils.DatabaseUtils import DatabaseHelper from .KnowledgePage import KnowledgePage class Knowledg...
true
a632b1ccbe823893811b32dcb2411f82b67451e7
Python
Lmarcho/Research
/testlist.py
UTF-8
609
3.78125
4
[]
no_license
child1 = { "name" : "Emil", "year" : 2004 } child2 = { "name" : "Tobias", "year" : 2007 } child3 = { "name" : "Linus", "year" : 2011 } myfamily = { "child1" : child1, "child2" : child2, "child3" : child3 } # for i in range (1,len(myfamily)+1): # print(i) # x=myfamily.get("child"+str(i)).get("...
true
9d440e6d2d4458a98de53ea80eba4be855e8a42f
Python
swipswaps/grade.py
/gradepy/grade.py
UTF-8
14,315
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- """Object oriented grading of python modules. Defines an abstract base class, Tester, to be used for grading python modules. This module differs from standard testing strategies in two major ways. First, it relies on a correct implementation of the module, making the creation of test cases ver...
true
514add44cc87c5316b33b8deed9771fe28eb0983
Python
Neverous/spoj
/potega.py
UTF-8
134
2.78125
3
[]
no_license
# -*- coding: utf-8 -*- #2009 #Maciej Szeptuch #XIV LO Wrocław import sys a, b = sys.stdin.read().split(' ') a = int(a) b = int(b) print a**b
true
f02738394a4d9522780638c89daa0a96a8228ef3
Python
Jerome-h/embedded-systems
/Submission/IoT Data Aggregation/data_check.py
UTF-8
2,892
3.125
3
[]
no_license
import pandas as pd import glob devices=[] # array to hold device names filedatas=[] # array to hold files times=[] # 2d array to hold times of knocks - times[device][times] files=glob.glob('*.csv') # create array of csv files for entry in range(len(files)): device = files[ent...
true
cd4c76a2c3496d8dd7fbbc054200e7e94b754d94
Python
ehsansh84/services
/news_project/bigtc/statistics.py
UTF-8
4,691
2.53125
3
[]
no_license
import sys sys.path.append("/root/ehsan/services") from public_data import * col = db['news'] col_statistics = db['statistics'] col_categories = db['categories'] col_sub_categories = db['sub_categories'] col_rss = db['rss'] col_sources = db['sources'] def extract_categories(): categories = [] sub_categories ...
true
e09ada7e503ab55563e2147dd1227e1440d8528f
Python
david1983/rtads_ml
/tests/test.py
UTF-8
78
2.6875
3
[]
no_license
def sum(a,b): return a+b def test_answer(): assert sum(1,1) == 2
true
3982faaabc57728a2189d0b5dcc85b620c44ad39
Python
alpha-atul/Selenium_Core
/Headless_Browser/headless.py
UTF-8
928
2.859375
3
[]
no_license
from selenium import webdriver options = webdriver.ChromeOptions() options.headless = True driver = webdriver.Chrome(options=options) driver.maximize_window() driver.implicitly_wait(30) driver.get("https://www.google.com/") navigationStart = driver.execute_script("return window.performance.timing.navigationStart") re...
true
f291d3811e2df5eafa4bf7c0923ff72ee216c567
Python
JoeSeff/hackerrank-python
/019 hackerrank - Introduction to Sets/main.py
UTF-8
266
3.328125
3
[]
no_license
def average(array): sum_set = set(array) sum = 0 for item in sum_set: sum += item return sum/len(sum_set) if __name__ == '__main__': n = int(input()) arr = list(map(int, input().split())) result = average(arr) print(result)
true
a641d22aee5ce35b35c20d930167875e0f49ebc9
Python
jacobhal/ML-DD2421
/lab3py/test.py
UTF-8
918
2.984375
3
[]
no_license
import matrixfuns as m #import lab3 as l # Dimensions of Matrices rows = 7 cols = 4 depth = 5 matrixzeros = m.gen2dMatrix(0, rows, cols) m.printMatrix(matrixzeros) matrixones = m.gen2dMatrix(1, rows, cols) m.printMatrix(matrixones) matrix3dzeros = m.gen3dMatrix(0, rows, cols, depth) m.printMatrix(matrix3dzeros) ma...
true
9118ab2ba34f0b1f6ccf238bb99d290a6346c54d
Python
rrebase/algorithms
/d03_binary_search.py
UTF-8
441
4.34375
4
[]
no_license
# Binary search algorithm def binary_search(array, item): lower, upper = 0, len(array) while lower < upper: mid = (lower + upper) // 2 # middle if array[mid] < item: lower = mid + 1 elif array[mid] > item: upper = mid else: return mid re...
true
d95b27dd96c6fb051be7a74bd48033f910d33d3c
Python
yamaxin/hogwarts-lg4-yamaxin
/python_class/tonglao.py
UTF-8
2,138
4.0625
4
[]
no_license
'''定义一个天山童姥类 ,类名为TongLao,属性有血量,武力值(通过传入的参数得到)。TongLao类里面有2个方法, see_people方法,需要传入一个name参数,如果传入”WYZ”(无崖子),则打印,“师弟!!!!”,如果传入“李秋水”,打印“师弟是我的!”,如果传入“丁春秋”,打印“叛徒!我杀了你” fight_zms方法(天山折梅手),调用天山折梅手方法会将自己的武力值提升10倍,血量缩减2倍。需要传入敌人的hp,power,进行一回合制对打,打完之后,比较双方血量。血多的一方获胜。 定义一个XuZhu类,继承于童姥。虚竹宅心仁厚不想打架。所以虚竹只有一个read(念经)的方法。每次调用都会打印“罪过罪过” 加入...
true
c118e5c5f6cb94c183e10436ca399ce32f55f24e
Python
sydsim/structurized_object_classifier
/features/sequence.py
UTF-8
1,325
2.546875
3
[]
no_license
import tensorflow as tf import numpy as np from . import SOCFeature #### class SOCSequenceFeature(SOCFeature): ''' abstract number feature ''' def __init__(self, module, elem, list_length, optional=False, ): super()...
true
8fd40a72ab7130eb4c53152ab7df047d456ef2fc
Python
Pirouz-Nourian/earthy_20
/House_of_Heritage/A3_Structuring/process/Code/_4_rebuildTriangles.py
UTF-8
1,223
2.515625
3
[ "CC-BY-4.0", "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
# AR3B011 EARTHY (2020/21 Q1) # Zaatari Refugee Camp Heritage Center Project: "Bayt alturath" # Group Members: Selina Bitting, Barbara Foolen de Oliveira, Inaka Sema, Yamini Patidar, Maimuna Bala Shehu import rhinoscriptsyntax as rs import math import cmath levels = levels #Create the list of triangles in the level...
true
b0f2b3b0191148d2144866ac5652ed50fde0edef
Python
wellstseng/XStocker
/src/global_func.py
UTF-8
796
2.84375
3
[]
no_license
from datetime import timedelta, date import datetime import os def daterange(start_date, end_date): for n in range(int ((start_date - end_date).days)): yield start_date - timedelta(n) def get_latest_file_date(relative_path): p = os.path.abspath(relative_path) max_date = None for _, _, filena...
true
cb9354fb70ec0197fa31fee2e3dc6d98a9c7de8a
Python
cuiboautotest/learnpython3
/算法练习/面试/最长连续相同字符长度.py
UTF-8
153
2.84375
3
[]
no_license
s = "cc" res=1 count=1 for i in range(1,len(s)): if s[i]==s[i-1]: count+=1 res = max(count, res) else: count=1 print(res)
true
4c12d875571c6a135b4edba60df961a35ade2059
Python
lclarkmichalek/noughtsandcrosses
/src/server.py
UTF-8
7,677
2.734375
3
[]
no_license
import select import socket import threading import time import json class Server(object): def __init__(self, address, options): self._options = options self._address = address self._epool = EventPool() self._tpool = ThreadPool(self._epool) def start(self): ...
true
f4da1b9bba0a1573707ba6422e7863412233aad2
Python
AndrewLu1992/lintcodes
/115_unique-paths-ii/unique-paths-ii.py
UTF-8
1,178
3.0625
3
[]
no_license
# coding:utf-8 ''' @Copyright:LintCode @Author: hanqiao @Problem: http://www.lintcode.com/problem/unique-paths-ii @Language: Python @Datetime: 16-05-29 14:11 ''' class Solution: """ @param obstacleGrid: An list of lists of integers @return: An integer """ def uniquePathsWithObstacles(self, ...
true
e9a0f49373cb8a083495a2106aec6a8672f31505
Python
etzellux/Python-Demos
/NumPy/numpy_basics_4_operators.py
UTF-8
732
3.65625
4
[]
no_license
#OPERATORS import numpy as np list1 = np.arange(0,9,1).reshape(3,3) list2 = np.arange(9,18,1).reshape(3,3) list3 = np.array(list1*list2) list4 = np.array(np.cross(list1,list2)) #cross çarpım list5 = np.array(list1.dot(list2)) #nokta çarpım list6 = np.array(list1 @ list2) #nokta çarpım list7 = np.ones((3,3)) l...
true
eac8fb3a814e345162f6902a0d35c8de39f11d05
Python
paulsblackfriday/Auto-Facebook-Messenger
/v2.0-fbchat/updateFriends.py
UTF-8
1,234
3.09375
3
[]
no_license
# This script is used to update the friends database import fbchat import sqlite3 username = input('Facebook email: ') password = input('Facebook password: ') # Login to facebook client = fbchat.Client(username, password) # Connect to SQL Database connection = sqlite3.connect('FB_Friends.db') cursor = connection.cu...
true
f42dbcc87413d244ad21b0252f0b7541348cc1cb
Python
MathildeGarrigues/m2ro_project_tabu_search
/flight.py
UTF-8
618
3.046875
3
[]
no_license
import numpy as np import os class Flight: """Classe définissant un vol, caractérisé par : - son numéro - son heure d'arrivée - son heure de départ - les portes sur lesquelles il peut attérir - la date d'entrée à la porte qui lui est attribuée - la date de départ de la porte attribuée ...
true
d003394364b082962d24e04af29af82935682801
Python
zehuag/gdpy3
/src/processors/GTC/meshgrid.py
UTF-8
1,838
2.515625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- # Copyright (c) 2018 shmilee ''' Source fortran code: v110922 ------- diagnosis.F90, subroutine diagnosis:37-50 !!diagnosis xy if(mype==1)then open(341,file='meshgrid.out',status='replace') do i=0,mpsi write(341,*)psimesh(i) write(341,*)sprpsi(psimesh(i)) ...
true
e283eec9bc4c4570734368f1f9ef14a571f3ed35
Python
ashvatb21/cs440
/template4/tes.py
UTF-8
5,548
3.4375
3
[]
no_license
""" Part 3: Here you should improve viterbi to use better laplace smoothing for unseen words This should do better than baseline and your first implementation of viterbi, especially on unseen words """ import math def viterbi_2(train, test): ''' input: training data (list of sentences, with tags on the word...
true
455a63e717edfc0ff7a66f9e1255d454d05a2ab9
Python
sudhirkk/CIS530
/util/removeSolutions.py
UTF-8
267
2.765625
3
[]
no_license
#!/usr/bin/python import sys,re total='' cutout=False for l in sys.stdin: if '### BEGIN SOLUTION' in l: cutout=True if '### END SOLUTION' in l: cutout=False l=l.replace('### END SOLUTION','### YOUR CODE HERE!') if cutout: continue total+=l print(total)
true
cda11b1f43dea351d848572740f3b67c025677cb
Python
csxeba/Karakterlap
/Kijelzo.py
UTF-8
4,336
2.78125
3
[]
no_license
# -*- coding: Utf-8 -*- from Karakterlap.data.frame_foTul_kijelzo import * from Karakterlap.data.frame_harcertekek import * from Karakterlap.data.frame_kepzettsegek import * from Karakterlap.data.frame_pszi_magia import * from Karakterlap.data.frame_szemelyes import * from Karakterlap.data.objektumok import * class K...
true
67e93b2a0903f595f3a705b7b2935b94181a64bc
Python
shaadomanthra/cbpython-advanced
/day20/DayPredictor/models/YearModel.py
UTF-8
249
2.765625
3
[]
no_license
from models.db import * class YearModel: def insert(self,year,leap): conn = connect('year.db') query = f"INSERT INTO leapyear (year,leap) VALUES({year},{leap})" execute(conn,query) print("One record inserted")
true
86be03ecb71a36e70e1295a4d0d89eb5e4c98f20
Python
bascker/py-note
/src/base/coroutine.py
UTF-8
732
3.1875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/python """ 协程(coroutine)的使用 @author bascker """ import os import sys sys.path.append(os.getcwd()) from src.utils.applogger import AppLogger LOG = AppLogger("coroutine.py") def contain(string): """ 协程接受的字符串,是否包含 string @param string """ LOG.info("contain for string: %s" % string) ...
true
358c9ab8a15e672dd201c178b9df4ae45d457df4
Python
muteshi/anagram-hackerrack-solution
/anagram.py
UTF-8
2,241
4.03125
4
[]
no_license
def anagram(s): """ Function to divide a string into two and return minimum number of changes required to make an anagram """ len_of_str=len(s) if len_of_str % 2 != 0: return -1 # if length is not divisible string not anagram string1 = ''.join(sorted(s[:len_of_str//2])) st...
true
7146403fbd9b033234fee379b9b42c339efb0870
Python
robintw/gputools
/gputools/convolve/convolve.py
UTF-8
3,660
2.796875
3
[]
no_license
import logging logger = logging.getLogger(__name__) import os import numpy as np from gputools import OCLProgram, OCLArray, OCLImage, get_device from gputools.core.ocltypes import assert_bufs_type import sys from abspath import abspath def convolve(data,h , res_g = None): """ convolves 1d-3d data with ...
true
0080a386cf268ae5c3a84af778897f5aaea9b2f2
Python
JJong0416/Algorithm
/Leetcode/String/Most_Common_Word_819/819_20210228_eugene-doobu.py
UTF-8
1,124
3.296875
3
[]
no_license
import operator class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: # 특수문자 제거를 위해 paragraph = paragraph.lower().replace('!', ' ').replace('?', ' ').replace('\'', ' ').replace(',', ' ').replace(';', ' ').replace('.', ' ') words = paragraph.sp...
true
a77010c059e759d8570d6b9d5a4a085a58d2b117
Python
yurekliisa/BBC
/Server/ChatBot/venv/Lib/site-packages/pygubu/widgets/editabletreeview.py
UTF-8
10,717
2.671875
3
[ "Apache-2.0" ]
permissive
# encoding: utf8 # # Copyright 2012-2013 Alejandro Autalán # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License version 3, as published # by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but # ...
true
8e1849c0cf34f2a7df881146f50374b4e03b9cf6
Python
total-c/hw_07
/Task_01.py
UTF-8
1,252
4.46875
4
[]
no_license
# Описать функцию fact2(n), вычисляющую двойной факториал: n!! = 1·3·5·...·n, # если n — нечетное; # n!! = 2·4·6·...·n, если n — четное (n > 0 — параметр целого типа). # С помощью этой функции найти двойные факториалы пяти случайных целых чисел. import random def fact2(n: int) -> int: """Функция fact2 расчитывает...
true
71d036b34875e4abe5d42026f1d54a8d2b95271c
Python
acid9reen/Artezio
/Lesson_8_http_regexp/task4.py
UTF-8
456
3.859375
4
[]
no_license
'''Date time regexp''' import re def main(): '''Date time regexp''' date_time = input("Enter the date time: ") reg = r"\d{4}-([0]\d|1[0-2])-([0-2]\d|3[01])T" \ r"([0-1]\d|2[0-3]):[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)" pattern = re.compile(reg) match = re.search(pattern, date_time) ...
true
d257debf3d3de5318b25db367ad8e1212013f174
Python
LanguidCat/BaekJoon
/2935-소음/2935.py
UTF-8
138
3.296875
3
[]
no_license
import sys A = int(sys.stdin.readline()) T = input() B = int(sys.stdin.readline()) if T == '*': print(A * B) else: print(A + B)
true
ecb8cbddb7ab26174aeb9b5dc2024a2e7ebe0783
Python
ParkJeongseop/Algorithm
/Python/3003.py
UTF-8
126
2.859375
3
[]
no_license
b = [1, 1, 2, 2, 2, 8] x = list(map(int, input().split())) answer = [str(b[i]-x[i]) for i in range(6)] print(' '.join(answer))
true
ca14137f2cfa41dbf9d56add6febc2037184c957
Python
AmirAbaskohi/Congestion-Control
/rtt_diagrams/rtt.py
UTF-8
1,263
2.5625
3
[]
no_license
import matplotlib.pyplot as plt time_steps = [] reno_flow1 = [] reno_flow2 = [] cubic_flow1 = [] cubic_flow2 = [] yeah_flow1 = [] yeah_flow2 = [] f = open("./reno/reno1.tr") for i in f.readlines(): temp = i.split() time_steps.append(int(temp[0])) reno_flow1.append(round(float(temp[2]))) f = open("./reno/...
true
fae7abd73fbb0e84821939165591c0a81e3c7621
Python
AliShakoori89/Calculater
/Main.py
UTF-8
2,683
2.546875
3
[]
no_license
from tkinter import * import GUI if __name__ == "__main__": root = Tk() GUI_Frame = GUI.BotGUI(root) B=Button(root,text=' 9 ',activebackground="grey",command=lambda : GUI_Frame.press(9), height=1, width=7) B.grid(row=8, column=2) B=Button(root,text=' 8 ',activebackground="grey",command=lambda : GU...
true
c001b1b93417020fea170578cf81bb4c9f28180e
Python
Parallel-Sanskrit-Corpora/data
/python/mahabharata_parsing/app/fix_translation.py
UTF-8
1,249
2.65625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import MySQLdb import re from difflib import SequenceMatcher db = MySQLdb.connect(user="sanskrit", passwd="sanskrit", db="sanskrit", charset="utf8") cursor = db.cursor() def remove_extra_chars(string): regexp = re.compile('॥(\d+)+॥') changed_string = re.sub(regexp, '', string) ret...
true
93b24ad3ed63642be9d046dff29be1cc7c87d63b
Python
m0in92/Corona-dataset
/script_with_internet_access.py
UTF-8
3,454
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Apr 14 22:55:56 2020 @author: Moin Ahmed This python script finds the total corona cases and deaths stat from every country from worldometers.info website. It then appends these stats to a data_csv csv file. """ from urllib.request import Request, urlopen fr...
true
de922e9fb5ec469f8aa8745e4f1c13a10060acc5
Python
Renzerth/Coronografia-UdeA-EAFIT
/python/to_transfer/Analytical-sol/integral_bessel.py
UTF-8
2,413
2.546875
3
[]
no_license
# Prueba # ########## from __future__ import print_function import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as colors from scipy.special import gamma, j1, jv from scipy.misc import factorial from scipy.integrate import quad, simps # parametros N = 2 L = 1 jobs = 0 mobs = L*(1 + jobs*N) f...
true
52c3d6afb1d522a98ef3a0fe68d410c8d31fc631
Python
ManikhweSchool/Introduction-To-Java-Programming
/Python/For Loops/Exercise 2.5.10/Exercise_2_5_10a.py
UTF-8
144
3.75
4
[]
no_license
rows = eval(input('Enter number of rows : ')) columns = eval(input('Enter number of columns : ')) for i in range(rows): print('*'*columns)
true
c20c7bfba0066588f6266d4d9128f8039501aa31
Python
Aasthaengg/IBMdataset
/Python_codes/p03548/s402182384.py
UTF-8
205
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- X, Y, Z = map(int, input().split()) used_space = Y + (Z * 2) ans = 0 while True: if used_space > X: break used_space = used_space + Y + Z ans += 1 print(ans)
true
9cbb125d601eb443abb244a7da0806a74868f7bc
Python
unfit-raven/yolo-octo
/CST100 Object Oriented Software Development/Week Two/turtleloopcircle.py
UTF-8
1,095
3.90625
4
[]
no_license
import turtle ## Import turtle library wn = turtle.Screen()## Create graphics window wn.bgcolor("blue") ## Set window background color to blue frank = turtle.Turtle() frank.hideturtle() ## Turn off turtle animation frank.speed(0) ## Animation as fast as possible ## Bottom circle of snowman frank.color("...
true
870ad2a7882c23e30bca5e2e1264266dbb249aed
Python
wkroach/learning-machine-learning-
/naive bayes/bayes.py
UTF-8
5,477
3.34375
3
[]
no_license
""" naive bayes code and simple testing data adapted from MLIA in python 3.5.1 test on surface3 """ from numpy import* def load_data_set(): posting_list=[['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ...
true
bf5f6bb6fddd83be76c3b6862cb89f5a404d7c5c
Python
ps1on1ck/methods_of_collecting_and_processing_data_from_Internet
/5/m_client.py
UTF-8
695
3.015625
3
[]
no_license
from pymongo import MongoClient class MClient: def __init__(self, host, port, db_name, collection_name): client = MongoClient(host, port) db = client[db_name] self.collection = db[collection_name] def insert_many(self, items): return self.collection.insert_many(items) def...
true
37de811fde299dcdc2227367afdddc14f8012e4c
Python
RobRoseKnows/umbc-cs-projects
/umbc/CMSC/4XX/473/Assignments/a01/3f.py
UTF-8
685
2.78125
3
[]
no_license
from collections import Counter cnt = Counter() with open('en_ewt-ud-train.conllu') as f: line = f.readline() while line: if line[0] != '#' and line[0] != '\n': cols = line.split('\t') word = cols[1] cnt[word] += 1 line = f.readline() cnt2 = Counter() with ...
true
dd4892c5a0b675d1c97fb91a5ca8115801a2bbca
Python
jaescalante02/IA2
/proyectofinal/transform_data.py
UTF-8
1,594
2.953125
3
[]
no_license
import sys import datetime training = False if (sys.argv[1]=='0') else True def read_file(filename): with open(filename) as f: aux = [str(x) for x in f.readline().split()] array = [] for line in f: # read rest of lines s=line.split() array2=[s[0]] + [float(x) for x in s[1:]] ar...
true
fcdb2b699af0f8e8cf732256452d8daf983807bf
Python
janhenrikbern/VT_OPT
/optimal.py
UTF-8
4,750
2.984375
3
[ "MIT" ]
permissive
import numpy as np import metrics from vehicles.point_car import PointCar from path_finding import find_valid_trajectory from track import load_track import argparse import matplotlib.pyplot as plt # Code in this file is based on the racing line optimization algorithm presented # in the post http://phungdinhthang.c...
true
ad65e7679c6369b4ecbedbcc68e0d2874bf23640
Python
MaxouGJ/LS6
/TPNOTE/Maxime_Gallais_Jimenez.py
UTF-8
1,578
2.859375
3
[]
no_license
import re def question1c(l) : return l[4]+l[len(l)-1] # def question2e(l): return [i for i in l if i >= 8] # def question3c(l): res = [] for i in l : if len(i)>=3: res.append([2*j for j in i]) return res # def question4a(fichier): f = open(fichier) res = re.findall(r"...
true
846b6e54eb6e244b49039f468dd80e847f07ed97
Python
nameless-Chatoyant/pytorch-workspace
/AtrousConv/model.py
UTF-8
1,697
2.640625
3
[]
no_license
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from loss import FocalLoss from cfgs.config import cfg class Net(nn.Module): def __init__(self): super(Net, self).__init__() self.channels = cfg.channels self.channels.append(cfg.class_nu...
true
a76badef38082e0f093f47607ee1a73cd0d171b9
Python
uk-gov-mirror/ministryofjustice.analytical-platform-aws-security
/modules/sns-guardduty-slack/sns_guardduty_slack.py
UTF-8
2,769
2.71875
3
[]
no_license
""" Lambda function receiving SNS notifications from GuardDuty Reformat and send notifications to Slack """ import json import logging import os from urllib.request import Request, urlopen from urllib.error import URLError, HTTPError SLACK_CHANNEL = os.environ['SLACK_CHANNEL'] SLACK_HOOK_URL = os.environ['HOOK_URL'] ...
true
4597098bb6c1c1d354d839e5116f321c4d1777ec
Python
vladklokun/font_renamer
/tests/test_table_name.py
UTF-8
10,799
2.828125
3
[]
no_license
"""Tests the facilities for working with the OpenType `name` table. """ # Test classes do not use the self argument, but are required to accept it # pylint: disable=no-self-use import typing as typ import fontTools.ttLib.tables._n_a_m_e as tt_table_name import hypothesis as h import pytest import font_renamer.table_...
true
ec3e81aed54059e01dc4752117e9ed8608514c52
Python
saharma/PythonExercises
/Lab2/lab2ex12.py
UTF-8
157
3.921875
4
[]
no_license
word = input("Enter a string") vowels = {"a":0, "e":0, "i":0, "o":0, "u":0} for letter in word: if(letter in vowels): vowels[letter] +=1 print(vowels)
true
b9f13265fd2fbe06ffabb0ca4aa07b78827ecbda
Python
N-31V/robotic-software
/py/cnn_miracle.py
UTF-8
3,440
2.8125
3
[]
no_license
#!/usr/bin/env python3 import cv2 # working with, mainly resizing, images import numpy as np # dealing with arrays import os # dealing with directories from random import shuffle # mixing up or currently ordered data that might lead our network astray in training. from tqdm i...
true
1cab3c517fe0b0fe4c8a399bd908097d46edf406
Python
muskanjindal24/18IT040_IT374_Python_Programming
/TASK4[Data Types]/2b.py
UTF-8
66
2.625
3
[]
no_license
tuplex = 50, 100, 150, 200 print(tuplex) tuplex = 1, print(tuplex)
true
36ba5bc7ca03008464ac194e3ad34746d6cbd750
Python
dvtate/single-files
/balls.py
UTF-8
1,570
3.234375
3
[ "MIT" ]
permissive
import tkinter as tk; import random; import time; def randomColor(): return "#%03x" % random.randint(0, 0xFFF); class BouncyBall(object): def __init__(self, canvas, width, height, color, outline = None): self.canvas = canvas; self.xv = random.randint(-10, 10); self.yv =...
true
59cf6fe6a4a3dcb353850c752e681f8d123a214c
Python
olivbak/az
/src/data/convert_client_data.py
UTF-8
564
2.5625
3
[]
no_license
import pygame from ..sprites.tank import Tank from ..sprites.bullet import Bullet class convert_client_data(): def __init__(self): pass def get_tanks_from_server_data(self,data): tanks = pygame.sprite.Group() for dic in data: tanks.add(Tank (dic["pos"],dic["rotation"],d...
true
114f9b0837fd072d7461fa7b514b2bd40e741437
Python
rohanparmar/CMPT-120-Final-Project-Yet-Another-Image-Processor
/cmpt120imageProj.py
UTF-8
3,003
3.28125
3
[]
no_license
# CMPT 120 Yet Another Image Processer # Starter code for cmpt120imageProj.py # ***do not modify this file*** import pygame import numpy def getImage(filename): """ Input: filename - string containing image filename to open Returns: 2d array of RGB values """ image = pygame.image.load(filename) return pyg...
true
9aa5dce55ab0a1c3a4cd906f6fa7a326753dc4d6
Python
sandeepkumar8713/pythonapps
/26_sixthFolder/15_smallest_good_base.py
UTF-8
1,866
4.21875
4
[]
no_license
# https://leetcode.com/problems/smallest-good-base/ # Question : Given an integer n represented as a string, return the smallest good base of n. # We call k >= 2 a good base of n, if all digits of n base k are 1's. # # Example : Input: n = "13" # Output: "3" (3 digit number system) # Explanation: 13 base 3 is 111. # # ...
true
cf97ab1299e2bfcce4cb7fddbd6c920ceef5f29d
Python
alexmlamb/VariationalBayes
/lib/driver.py
UTF-8
4,373
2.578125
3
[]
no_license
import theano import theano.tensor as T import numpy as np import numpy.random as rng from HiddenLayer import HiddenLayer from Updates import Updates import matplotlib.pyplot as plt from RandomData import getData import math theano.config.flaotX = 'float32' if __name__ == "__main__": config = {} config["l...
true
2aaa6692403f7b4b809fcf681e88997148257212
Python
vxlm/DataStructures-Algorithms
/dictionary.py
UTF-8
3,549
3.40625
3
[ "MIT" ]
permissive
#Simple dictionary with hashes by modulo, table doubling for size #and chaining for collisions class Dictionary(): def __init__(self, size = 10): self.dict = [[None,None] for i in range(size)] self.size = size self.inserted = 0 def __str__(self): return str(self.dict) def ha...
true
db70d5602c4cf1ae0665512fa2b6a471179e4972
Python
snowdence/hcmus_ai_wumpus
/18127004_18127027_18127263/src/states/ScreenState.py
UTF-8
679
3.125
3
[ "MIT" ]
permissive
from pygame.math import Vector2 class ScreenState: screen_size: Vector2 = None entities = [] def __init__(self): pass @property def get_width(self): return int(self.screen_size.x) @property def get_height(self): return int(self.screen_size.y) def is_inside(s...
true
04cc2a200b6a1eb751335264f92484fab3adbd90
Python
nghiattran/my-notes
/InterestingProblems/countBattleships.py
UTF-8
1,841
4.0625
4
[]
no_license
# Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules: # You receive a valid board, made of only battleships or empty slots. # Battleships can only be placed horizontally or vertically. I...
true
a78c5b18ed0444314c9b5286c37afa254f37219e
Python
onelab-eu/manifold
/manifold/operators/subquery.py
UTF-8
24,120
2.6875
3
[]
no_license
import traceback from types import StringTypes from manifold.core.filter import Filter from manifold.core.relation import Relation from manifold.core.record import Record, LastRecord from manifold.operators import Node, ChildStatus, ChildCallback from manifold...
true
cdefd2ad395a69ada95e1118b6ce8f7617d09066
Python
Engi20/Python-Programming-for-Beginners
/13. Exceptions/99.2.IndexError.py
UTF-8
126
2.90625
3
[]
no_license
l = [10,20,30,40] #print(l[10]) #print(l) try: print(l[10]) except IndexError as e: print(e) print(l)
true
b5f57fd461404c8cf59d5fd8cd2e160e0f0df0e0
Python
tpsavard/ProjectEuler
/Python/euler_utils.py
UTF-8
879
3.9375
4
[]
no_license
# Break a number down into its component digits, in descending order of place value # Ex.: 1234 -> [1, 2, 3, 4] def getDigitsDescendingOrder(val): cur_val = val digits = [] while cur_val > 0: digits.insert(0, cur_val % 10) cur_val = cur_val // 10 return digits # Recombine an array of di...
true
43bf2fd4c072ee33bcbec31ed47876952696e733
Python
NilsK1812/Shogun-alias-Shmong-Shmong
/Shogun_Feld.py
UTF-8
3,886
3.15625
3
[]
no_license
from tkinter import * import tkinter.messagebox import random as r class MyApp(Frame): def __init__(self, master): super().__init__(master) #self.pack(fill=BOTH, expand=True) master.geometry("800x800") #frame to hold the playing field self.f1 = Frame(master=master)...
true
dc3a0ae520436e7f7dcda26255840051f45564cc
Python
fivefishstudios/GPIBoE-Gateway
/software/GPIB.py
UTF-8
12,370
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/python3 # last modified 2019/09 ## DOC ------------------------------------------------------------------------- # This class generates a GPIB interface based on the IEEE 488.1 specifications. # RESTRICTION: works only as single controller and must be either listener or # talker. # It works with a Raspberr...
true
92b4a3ea4ccc641ceee897045794f7e1228c7197
Python
MenacingManatee/python_practice
/python_basics/0x01/ignore.py
UTF-8
149
2.609375
3
[]
no_license
#!/usr/bin/python import signal signal.signal(signal.SIGINT, signal.SIG_IGN) print 'Your script can\'t be stopped with CTRL+C' while 1: continue
true
96da56f8e09835541e5fbf2262e4329c77bd08cc
Python
dahbiz/sympy-plot-backends
/spb/series.py
UTF-8
77,064
2.515625
3
[ "BSD-3-Clause" ]
permissive
from sympy import sympify, Tuple, symbols, solve, re, im from sympy.geometry import ( Plane, Polygon, Circle, Ellipse, Line, Segment, Ray, Line3D, Curve, Point2D, Point3D, ) from sympy.geometry.entity import GeometryEntity from sympy.geometry.line import LinearEntity2D, Linea...
true
063ea81565ca64c0635afd8e4f7cb7c62daa110e
Python
darkryder/DMG_project
/project/app/management/commands/create_main_attributes_file.py
UTF-8
1,506
2.609375
3
[]
no_license
from glob import glob from progressbar import ProgressBar import os from django.core.management.base import BaseCommand TEMPLATE = """ NOMINAL = %(nominal)s ORDINAL = %(ordinal)s BINARY = %(binary)s NUMERIC = %(numeric)s """ class Command(BaseCommand): help = 'Create a main attribute file after merging all s...
true
1f47a1aa8febc54d322c2f25f53c7114807917c1
Python
YigalOrn/Afeka
/Course Software Engineering Seminar/Spam ANN/SpamANN_with_PCA_with_bias.py
UTF-8
6,186
2.96875
3
[]
no_license
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from mlxtend.plotting import plot_confusion_matrix from sklearn.metrics import confusion_matrix from sklearn.decomposition import PCA from sklearn import preprocessing import numpy as np from random import shuffle import time # program constants E...
true
cefb9981c06530bc5da651768c72dddfe694d72a
Python
viorelrj/tic-tac-toe-neural-net
/intelligence.py
UTF-8
2,481
3.703125
4
[]
no_license
# This is the neural netowrk ai for tic tac toe. # Input array consists of 27 elements: 3 per each cell of board, with each one described as follows: # 1st - cell is free, 2nd cell is occupied by the ai, 3rd - cell is occupied by oponent # # There is only one hidden layer, with 10 elements, each representing a move: ...
true
71353d030a8a6714432fe764f52be791746dc13a
Python
JariMutikainen/pyExercise
/bank/bank.py
UTF-8
2,830
4.21875
4
[]
no_license
# Simulate a banking system in which the user can: # # 1. Open a new savings account with an initial deposit # 2. Withdraw money from his existing savings account # 3. Deposit money into his savings account # 4. Show the current balance of his account # # Use the random number generator for creating 5-digit account num...
true
66b757a46ef5bc8192fb9079e3ba79102f010238
Python
MinaPecheux/Medusa
/medusa/algorithms/vigenere.py
UTF-8
4,223
2.609375
3
[]
no_license
# Copyright 2020 Mina Pêcheux (mina.pecheux@gmail.com) # --------------------------- # Distributed under the MIT License: # ================================== # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # ...
true
106fdb5732ba66602a09170170015e49c0cbb6e2
Python
lutianming/afcp-alumni
/application/views.py
UTF-8
9,973
2.546875
3
[]
no_license
""" views.py URL route handlers Note that any handler params must match the URL route params. For example the *say_hello* handler, handling the URL route '/hello/<username>', must be passed *username* as the argument. """ from google.appengine.api import search as gsearch, mail from google.appengine.ext import ndb...
true
c9b4f8b6c00edc4ed1306a821ce65cfe7812ad57
Python
Aasthaengg/IBMdataset
/Python_codes/p03438/s126460973.py
UTF-8
211
3.3125
3
[]
no_license
n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) cnt=0 for i in range(n): x=a[i] y=b[i] if x>y: cnt-=x-y elif x<y: cnt+=(y-x)//2 print('Yes' if cnt>=0 else 'No')
true
e56fc5050d2e73a3da097ac8595bbffc4384db0a
Python
briandennis/MadPUG
/learning.py
UTF-8
1,481
4.40625
4
[]
no_license
#Dictionaries - mutable SYNTAX: {'myVar': 'Hello'} # .update({'a':'d'}) overrides old value #print(dictionary.items()) prints all items #lists SYNTAX ['here','is','a','list'] myDictionary = { 'a': '65', 'b': '98' } myList = ['this', 'is', 'my', 'list'] print(myList[1:3]) #[1,2) print(myList[0...
true
9da25c75b5ec5071a1f34ab4685cfcdfa28ce03a
Python
hugo-labixiaoxin/cs61a-self-edition
/lecture/code1.py
UTF-8
276
3.140625
3
[]
no_license
from operator import floordiv,mod def divide_exact(n,d): """Return the quotient and remainder of dividing N by D. >>> q,r=divide_exact(2013,10) >>> q 201 >>> r 3 """ return floordiv(n,d),mod(n,d) i,a=0,0 while i<3: i=i+1 a=a+i
true
479f2571a6a7255cc5ba3a05ab7af8133b65713a
Python
bigjay517/transmission-cleanup
/main.py
UTF-8
4,533
2.59375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Transmission Cleanup # (main.py) # # Copyright 2014 Nicolas Cova <nicolas.cova.work@gmail.com> # # 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 F...
true
ea02db2da443546c53aa08d90d7daa3d42d9d757
Python
ed-cetera/project-euler-python
/043_solution.py
UTF-8
1,048
3.625
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 import time def permutations(lst): if len(lst) == 1: yield lst else: for permutation in permutations(lst[1:]): for position in range(len(lst)): yield permutation[:position] + lst[:1] + permutation[position:] def main(): total_sum = 0 ...
true
39226865aef5e9f456b0425caabb4f35d5a10efb
Python
simberaj/mobilib
/mobilib/raster.py
UTF-8
3,086
2.71875
3
[ "MIT" ]
permissive
"""Old machinery for raster handling.""" import os from typing import Tuple import numpy as np import gdal import osr # TODO this probably does not work; would be best rewritten using rasterio class World: def __init__(self, xcell, yrot, xrot, ycell, xorigin, yorigin): self.xcell = xcell self.y...
true
3a14337d5242837f19a22745e3d8c300d547d666
Python
RCI-sfx/Gillespie-algorithm
/question_4.py
UTF-8
1,712
3.0625
3
[]
no_license
from numpy import random import matplotlib.pyplot as plt import numpy as np from scipy.stats import poisson k0 = 0.2 # transcription rate k1 = 0.01 # degradation rate Omega= 1. # cell size k2= 5 # protein translation m=0 # starting mRNA p=0 # starting protein t=0 # starting time divtime= 1 m_store = [m] t_store= [t...
true
54c8ae7ee1248b544d79d5a4bc5456acda197d09
Python
ehlymana/CellsAnalysis
/Code/linearBrightness.py
UTF-8
766
2.734375
3
[]
no_license
import cv2 import matplotlib.pyplot as plt import spasavanjeSlika as ss def increaseBrightness (image, factor): factorscaled = (factor / 100) + 1 return cv2.convertScaleAbs(image, 1, factorscaled) def proba(): image = cv2.imread('image.jpeg') brighterImage = increaseBrightness(image, 20) plt.subplot(121), ...
true
66e3b2f31a0cc64f76adddd9dd7a6b949c7f8e3a
Python
VenkateshMohan3434/hmm
/aa.py
UTF-8
471
2.53125
3
[]
no_license
import numpy as np import pandas as pd from random import sample import utils # data_path = 'train_FD004.txt' # data = utils.load_data(data_path) # x = data.iloc[:, 2:26] # x.insert(0, 'engine_no', data.iloc[:, 0]) # print(x[:][1:]) # a = [2,3,4] # b = [3,5,6] # c = [] # c.append(np.array(a)-np.array(b)) # c.append(np....
true
8025a057c895493eb788aba44c9cb4ffea5f437f
Python
akrami/albaloo
/website.py
UTF-8
3,879
2.609375
3
[]
no_license
import json from time import sleep import socket import requests import re class Website: """ Website class """ def __init__(self, address): self.address = address self.ssllab_result = '' self.ssllab_rating = '' self.ip = '0.0.0.0' self.redirect = False ...
true
990f4dec20395f4a3443d7cb2e6b247a606fde72
Python
henchc/MHG-scansion
/CRF/new_bio_class_report.py
UTF-8
1,429
2.546875
3
[ "MIT" ]
permissive
from CLFL_mdf_classification import classification_report from CLFL_mdf_classification import precision_recall_fscore_support from sklearn.preprocessing import LabelBinarizer from itertools import chain def bio_classification_report(y_true, y_pred): """ Classification report for a list of BIO-encoded sequence...
true
36680e141297b96804e1c4e399e00c18a1b15a96
Python
mdinunzio/pybind11example
/test.py
UTF-8
620
2.703125
3
[]
no_license
import numpy as np from build.Release.module_name import * from concurrent.futures import ThreadPoolExecutor import time print(some_fn_python_name(3, 5)) my_class = PySomeClass(5.0) print('multiplier is', my_class.multiplier) my_class.multiplier = 10 print('multiplier is', my_class.multiplier) print(my_class.multipl...
true
5c7b112eb11123f9f2b228329f2cb609febdc1bc
Python
jesubellido/RestorAppFixed
/restorapp.py
UTF-8
826
2.515625
3
[]
no_license
# Import necessary things. from flask import Flask, render_template, request, Response, session, jsonify from model import entities from database import connector import json import xml # Initializes app. app = Flask(__name__, static_url_path="/static", static_folder='static') # I'll create an object from the manager...
true
925a3c1ee99aedab3a5c6f0696203b56c8bdb1a6
Python
LiLabAtVT/DeepTE
/scripts/DeepTE_generate_CNN_dataset.py
UTF-8
778
2.671875
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python ##import modules from Bio import SeqIO def change_format_for_ncc (input_ori_seq_file): ##initiate a dic to store output file final_format_dic = {} seq_count = 0 for seq_record in SeqIO.parse(input_ori_seq_file,'fasta'): seq_count += 1 label = seq_record.id ...
true
ba342251cc012437c4e1120f38de674ab55ae671
Python
codedjw/DataAnalysis
/QYW_4th_Analysis/qyw_4th_analysis.py
UTF-8
17,241
2.796875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # author: Jiawei Du # email: jiaweidu.js@gmail.com # added: 2016/03/31 import sys,os #获取脚本文件的当前路径 def cur_file_dir(): #获取脚本路径 path = sys.path[0] #判断为脚本文件还是py2exe编译后的文件,如果是脚本文件,则返回的是脚本的目录,如果是py2exe编译后的文件,则返回的是编译后的文件路径 if os.path.isdir(path): re...
true
db22ea8f70ee5ebdfa316698fdebd84b3a607ea1
Python
ReliableDragon/NestedGenerator
/nested_choices.py
UTF-8
9,778
2.546875
3
[]
no_license
import re import random import uuid import math import logging import argparse import state_clause_handler import choices_util import choices_validator import choice_generator as choice_generator_mod from state_regexes import STATE_REGEXES class WeightedChoice(): def __init__(self, weight, choice, tag_num=1, clau...
true
a579b58773d007dcb81d28b8b974e98bf876a778
Python
Aasthaengg/IBMdataset
/Python_codes/p03759/s163335731.py
UTF-8
92
3.328125
3
[]
no_license
[a,b,c] = list(map(int, input().split())) if b-a == c-b: print("YES") else: print("NO")
true
458782ac77fe6713c9aaf10374b1f3683dc26e16
Python
lfwin/FreiburgSLAM
/hw9/hw9.py
UTF-8
1,283
2.59375
3
[]
no_license
#!/usr/bin/python import scipy import matplotlib.pyplot as plt import calibrate # load the odometry measurements odom_motions = scipy.loadtxt('odom_motions.dat') # the motions as they are estimated by scan-matching scanmatched_motions = scipy.loadtxt('scanmatched_motions.dat') # create our measurements vector z z = ...
true
9ae10c4d2a8b7347151c2ff892528c44aa3c0aeb
Python
shrukerkar/ML-Fellowship
/BasicPython/StringReverse.py
UTF-8
812
4.34375
4
[]
no_license
#Write a Python program to reverse a string. #Method 1 def reverse(str): str="" for i in str: str=i+str return str str="we3resource" print("The original string is : ", end="") print(str) print("The reversed string(using loops) is : ", end="") print(reverse(str )) #Method 2 def reverse(s): ...
true
98ab6318ce37e699c5e67ba4ece42d09c2cf7b47
Python
avtar31193/GTPC-protocol
/TESTER/GTPC_VERDICT.py
UTF-8
1,409
2.765625
3
[]
no_license
def IECompare(IE, IR): for EveryElement in IE: if EveryElement in IR: if IE[EveryElement] == IR[EveryElement]: continue else: return "Test Case Failed with IE Field Value wrong :{}".format(EveryElement) else: return "Test Case failed with IE Field Missing {}".format(EveryElement) return "EQUAL" ...
true