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
25be6f3ff800f12831060e1466c1ee069f1a7aad
xljixieqiu/fluentpython
/demo13_10.py
UTF-8
3,105
2.890625
3
[]
no_license
import functools import math import itertools from array import array import reprlib import numbers import operator import itertools class Vector: typecode='d' def __init__(self,components): self._components=array(self.typecode,components) def __iter__(self): return iter(self._components) def __repr__(self):...
true
3d69a089ae2493e85a47f98e4315ca9afb2b1f1c
Aasthaengg/IBMdataset
/Python_codes/p02408/s431845137.py
UTF-8
677
3.109375
3
[]
no_license
n = int(input()) S = [False for i in range(13)] D = [False for i in range(13)] C = [False for i in range(13)] H = [False for i in range(13)] for i in range(n): a,b = input().split() b = int(b) if a == "S": S[b-1] = True elif a == "D": D[b-1] = True elif a == "C": C[b-1] = ...
true
9fd8ee7f9be4eec26dbf72bc8e61287cb63e4d81
theoliver7/hslu-pren2-team1
/stair-climber/camera/video_stream.py
UTF-8
1,712
3.140625
3
[]
no_license
# Import packages from threading import Thread import cv2 # Define VideoStream class to handle streaming of video from webcam in separate processing thread # Source - Adrian Rosebrock, PyImageSearch: https://www.pyimagesearch.com/2015/12/28/increasing-raspberry-pi-fps-with-python-and-opencv/ class VideoStream: "...
true
23ea645f435df7a761e2bf95f18e0efd87fed0ed
ningrulin/PerformanceTest
/public/HttpClient.py
UTF-8
10,157
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """__author__ = 'jiazhu'""" import logging import re import time import requests from requests import Response, Request from requests.exceptions import (RequestException, MissingSchema, InvalidSchema, InvalidURL) import sys reload(sys) sys.setdefaultencoding("utf-8") from public import Eve...
true
a8672ff5422389fd2b1bf6b097e6b4be682ddc18
BreezeDawn/LeetCode
/first/字符串/中等/816. 模糊坐标.py
UTF-8
1,521
3.078125
3
[ "Apache-2.0" ]
permissive
class Num816(object): @staticmethod def leetcode(S): S = S[1:-1] ans = [] res = [] for i in range(len(S) - 1): tmp = [] tmp.append(S[:i + 1]) tmp.append(S[i + 1:]) ans.append(tmp) for i in ans: for m in range(len...
true
2258d1d25b183754a95e4c3a50d14399a4b83b4a
bam6076/PythonEdX
/midterm_part4.py
UTF-8
524
4.28125
4
[]
no_license
## Write a function named list_of_primes that accepts a positive integer n ## and returns a sorted list (ascending order) of all the prime numbers ## between 2 and n (including 2 but not including n) def list_of_primes(n): plist = [] if n == 2: plist.append(2) for i in range (2, n): ...
true
50b65658186cc3ae29a3cc3ba83b269f6532ff5c
dkm/python-jy901
/jy901/device.py
UTF-8
6,306
3.015625
3
[]
no_license
import random import time from .frames import * class DumbDevice: """ Same interface, simply returns random data. """ def __init__(self, freq): self.next_frame_idx = 0 self.period = 1 / freq self.cur_angle = (0,0,0) self.cur_temp = 25 self.cur_acc = (0,0,-1) ...
true
e203045424e76e23dbff458a319014b4307ac083
anhnt2407/DNNs-PINNs
/Func/func.py
UTF-8
1,281
2.890625
3
[]
no_license
''' DNNs for regression @Author: Xuhui Meng ''' import os os.environ['CUDA_VISIBLE_DEVICES']='-1' import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from net import DNN np.random.seed(1234) tf.set_random_seed(1234) def main(): layers = [1] + 3*[20] + [1] x = np.linspace(-1, 1, 21).r...
true
bedfd38a44e2d2aa02c88e2b1d270be188e883c5
LingB94/Target-Offer
/24反转链表.py
UTF-8
692
3.4375
3
[]
no_license
class listNode(object): def __init__(self, n): self.val = n self.next = None def reversedList(L): if(L.next == None or not L): return False p = L.next pPrev = None reversedHead = listNode(0) while(p): pPost = p.next if(pPost == None): ...
true
892ad81ccd159ec746c1aecae18076a6b1779ed2
nallamuthu/RedTeam
/RT-APT2EXCEL/main.py
UTF-8
1,383
2.5625
3
[]
no_license
from custom_parser import * import xlsxwriter group_name,group_dict=json_file_load('APT32.json') excel_file_name=group_name+'.xlsx' workbook = xlsxwriter.Workbook(excel_file_name) worksheet = workbook.add_worksheet(group_name) header_cell_format = workbook.add_format({'bold': True, 'border': True, 'bg_color': 'yello...
true
1c5a069fd56f2b3f34164ee8896785b2f2025c1b
evelinamorim/wordembedding
/sa/config.py
UTF-8
653
2.90625
3
[]
no_license
class Config: def __init__(self): self.__fields = {} def read(self, fileName): fd = open(fileName, 'r') for line in fd: lst = line.replace('\n', '').split('=') conf_values = lst[1].split(';') for v in conf_values: lst_v = v.split(',...
true
069b44dd2524a1beb9f705bf0c1683b1173ff74e
gumblex/simplify.py
/simplify.py
UTF-8
4,640
3.78125
4
[]
no_license
""" simplify.py is a simple port of simplify.js by Vladimir Agafonkin (https://github.com/mourner/simplify-js) It uses a combination of Douglas-Peucker and Radial Distance algorithms. """ try: rangefunc = xrange except NameError: rangefunc = range def getSquareDistance2d(p1, p2): """ Square distance ...
true
ce9cc701fcda7efac27dd167355f75e64db80349
shantanuj/DSP
/Lab3Example.py
UTF-8
1,661
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Dec 2 13:10:08 2017 @author: Chng Eng Siong Date: Dec 2017, using python to solve DSP problems purpose - to remove dependency on Matlab """ # using quiver to plot the vectors 'arrow' showing the direction it is pointing to # we plot for k=1, you can change this va...
true
caf8a86ae11b242ddb168bbcbbfa6c6ee7a51d82
michaelbaz6123/sortingVisualizer
/sortingVisualizer.py
UTF-8
3,095
3.109375
3
[]
no_license
import tkinter as tk import random as rand import time import sys def init_rect_dict(): for i in range(N): h = rand.randint(0,550) height_list.append(h) global is_sorted update() def _shuffle(): global height_list height_list = [] canvas.delete("all") for ...
true
2b60b88dcf4f0b3a6b46ad2fd4b61c987953b592
GongkunJiang/Github
/Python/test_1119.py
UTF-8
2,405
3.171875
3
[]
no_license
""" Author: Dell Time: 2019/11/19 14:18 """ import random import matplotlib.pyplot as plt import math as mt def xor(s1, s2): result = '' for i in range(len(s1)): if s1[i] == s2[i]: result += '0' else: result += '1' return result def inverse(s): result ...
true
1b6fa0c1a72d83a3f6b64e5de7f6a6135fc65c8e
2779857034/qinzhiming
/day01/zuoye1.py
UTF-8
189
3.703125
4
[]
no_license
num1,num2 = eval(input("请输入两个整型数")) if num1>num2: print("{}大于{}".format(num1,num2)) elif num1<num2: print("{}大于{}".format(num2,num1)) else: print("两数相等")
true
ade710b4e85cf0550578dd80fe1631724da7e92a
abhishekkr/tutorials_as_code
/talks-articles/dataengines/redis/redis-pub-sub.py
UTF-8
1,303
2.59375
3
[ "MIT" ]
permissive
import redis import sys def publish(redcli, channel): redcli.publish(channel, "this") redcli.publish(channel, "is") redcli.publish(channel, "a") redcli.publish(channel, "stream") redcli.publish(channel, ".") print('done.') def subscribe(redcli, channel): sub = redcli.pubsub() sub.sub...
true
27cef7b9a9202fc704b36376dd708aa836fbddab
Shuravin/python_practice
/Introduction to Computer Science - MITx/Week 1 Python Basics/Ex. 2.5.py
UTF-8
381
3.40625
3
[]
no_license
s = "dsfailewbafilweafi" count = 0 index = 0 while index < len(s): if s[index] == "a": count += 1 elif s[index] == "e": count += 1 elif s[index] == "i": count += 1 elif s[index] == "o": count += 1 elif s[index] == "u": count += 1 else: count = co...
true
22561539dbf159c5a9300fd617b33be4eff9ecca
Miamiohlibs/worldcat
/python/test-multi.py
UTF-8
3,007
3.421875
3
[ "Apache-2.0" ]
permissive
import sqlite3 import multiprocessing ''' This program starts a daemon process that listens on a queue. It then starts 10 processes that place integers in the queue. The listening daemon pulls the integers out of the queue and stores them in the database. https://gist.github.com/cessor/f8bf530212fbe75263c79564f5fc15ad...
true
f097f37dc1691271ad151f091c220d33faace42c
Jaehwi01/TIL
/python/module_test/a.py
UTF-8
90
3.375
3
[]
no_license
def add(a,b): return a+b def mul(a,b): return a*b print(add(3,4)) print(mul(3,4))
true
518f9f6b046b3e6f2a33d580c8fdf09851390ae1
m-ahmadi/exref
/ml/sklearn/util.py
UTF-8
2,335
3.125
3
[ "MIT" ]
permissive
# https://scikit-learn.org/stable/modules/classes.html#module-sklearn.utils # https://scikit-learn.org/stable/modules/classes.html#module-sklearn.preprocessing #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ # linear algebra two-point transform from sklearn.preprocessing import minmax_scale minmax_scale(X, feature_...
true
22fac02c3a902f76802b15a3335f5d1d0521c47d
kiansweeney11/ca117-programming2
/words_041.py
UTF-8
410
2.765625
3
[]
no_license
#!/usr/bin/env python def main(): import sys d = {} a = [] for line in sys.stdin: sentence = line.lower().split() for token in sentence: count = 0 i = 0 while i < len(token) and token[i] is not token.isalnum() and token[i] != " ": ...
true
e63703064a6fc7b1050a2e43b43eaa06d803a7fd
zero-one-group/zot-internship
/maxine/python/euler/problem2.py
UTF-8
572
4
4
[]
no_license
"""each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued...
true
2143316a7352cbe56a77a58d106cb7824f754fa0
nke001/dreamprop
/lib/hidden.py
UTF-8
2,910
2.546875
3
[]
no_license
import theano import theano.tensor as T import numpy as np #import numpy.random as rng class HiddenLayer: def __init__(self, num_in, num_out, activation = 'lrelu', batch_norm = False, layer_norm = False, norm_prop = False): self.activation = activation self.batch_norm = batch_norm self.la...
true
69e4cc9fa6c49ef80426cf058999b918a778e702
pedrocambui/exercicios_e_desafios
/python/cursoemvideo/ex024.py
UTF-8
104
3.25
3
[]
no_license
cidade = str(input('Digite o nome de uma cidade: ')).upper().strip() print(cidade.split()[0] == 'SANTO')
true
ea363a759cb1af3b8fbd525dc6625664cc81db94
heavypanther/MicroBitStuff
/main.py
UTF-8
2,058
2.8125
3
[]
no_license
def ReadButtons(): global lastButtonNum, buttonVal, buttonNum lastButtonNum = buttonNum buttonVal = pins.analog_read_pin(AnalogPin.P2) if buttonVal < 256: buttonNum = 1 elif buttonVal < 597: buttonNum = 2 elif buttonVal < 725: buttonNum = 3 elif buttonVal < 793: ...
true
137830ffd98c5a3701cadf3c19e5e2626647c851
GabrielSilva2y3d/Snake-game-python-igti
/tela.py
UTF-8
803
2.90625
3
[ "MIT" ]
permissive
import pygame from pygame.locals import * from sys import exit background_image_filename = 'background.jpg' pygame.init() screen = pygame.display.set_mode((640,480), 0, 32) background = pygame.image.load(background_image_filename).convert() Fullscreen = False while True: for event in pygame.event.get(): ...
true
44634bff7f5bb1de1f338f672a306daca612c2d3
ohmema/interview
/python/language/collections/decorator.py
UTF-8
930
3.140625
3
[ "Apache-2.0" ]
permissive
# with open("p.py", mode= "rt", encoding="utf-8") as f : # for line in f.readlines(): # print(line, end="") s= """ a b c d """ def validator(f): def wrap(*args, **kwargs): assert args[1] > 0 assert len(args[0]) > 0 return f(*args, **kwargs) return wrap def f...
true
c22d2667a617121cfdd34491ebfb83bb55473888
zhgmyron/python_ask
/9.2.py
UTF-8
1,119
3.375
3
[]
no_license
# -*- coding: UTF-8 -*- class User(): def __init__(self,first_name,last_name): self.first_name = first_name self.last_name = last_name self.login_attempts=0 def describe_user(self): message= "name is "+ self.first_name + " " + self.last_name return message def greet...
true
5587878128e1fde2f746d08665e8a3f50f419164
wj1224/algorithm_solve
/programmers/python/programmers_72412.py
UTF-8
1,119
3.296875
3
[]
no_license
from collections import defaultdict def bin_search(arr, target): left, right = 0, len(arr) - 1 while left < right: mid = (left + right) // 2 if arr[mid] >= target: right = mid else: left = mid + 1 return len(arr) - right def solution(info, query): answ...
true
a10562d3b9ec1de3e7f13dbb7fc5d66da33003d4
louzhao8712/leet
/concept_implementation/Binary_Search.py
UTF-8
1,445
4
4
[]
no_license
#!/usr/bin/env python a = [1,3 ,4 ,5 ,7 ,8 , 10 , 12] def binary_search_1(a, target): N = len(a) l = 0 r = N - 1 while l + 1 < r: mid = (l + r) / 2 if a[mid] == target: return mid elif a[mid] < target: l = mid else: r = mid print ...
true
cd121510830c39fea3253d11a759677a0e535f3c
Rithvik070/Questionpaperanalysis
/Code/csv_read.py
UTF-8
807
2.859375
3
[]
no_license
import csv import re no_of_items={} dataset={} feature_set={} fh=open("predictiondata.csv","r") count=0 for row in fh: if count==0: count+=1 continue else: a=row a=re.split('[^a-zA-Z0-9\']',row) a.pop() print(a) print(a[6]) no_of_i...
true
ddcf8fd119a32838ed37d98fc570b45483f04d58
orion20041987/exercism
/collatz-conjecture/collatz_conjecture.py
UTF-8
559
3.859375
4
[]
no_license
def steps(number): if number <= 0: raise ValueError('number must be greater than zero') step_counter = 0 while number != 1: if number % 2 == 0: number = if_even(number, step_counter) step_counter += 1 elif number % 2 == 1: number = if_odd(number, s...
true
9cfe95665cbde180ee0ffefebd1c8b06bf130dee
Ragul-SV/Data-Structures-and-Algorithms
/BST/Delete nodes greater than or equal to k.py
UTF-8
268
3.140625
3
[]
no_license
def deleteNode(root, x): # Code here if not root: return if root.data==x: return root.left elif root.data<x: root.right = deleteNode(root.right,x) return root elif root.data>x: return deleteNode(root.left,x)
true
3b323ccf90be8bc02bbf6100d744cbfdff8c7f14
Pranav-Srikumar/sample
/leapyr.py
UTF-8
126
3.203125
3
[]
no_license
yr=int(input()) if((yr%4==0) and (yr%100!=0)) or (yr%400==0): print("Its a leap year") else: print("not a leap year")
true
b595e31e04927a699a8cb96b7c38b4feb52f2b91
guptapankaj831/first
/PythonProgram/dict_example/Convert Key-Value list Dictionary to Lists of List.py
UTF-8
514
4.59375
5
[]
no_license
# Convert Key-Value list Dictionary to Lists of List # Input -> {'gfg' : [1, 3, 4], 'is' : [7, 6], 'best' : [4, 5]} # Output -> [[‘gfg’, 1, 3, 4], [‘is’, 7, 6], [‘best’, 4, 5]] # Method #1 : Using loop + items() test_dict = {'gfg': [1, 3, 4], 'is': [7, 6], 'best': [4, 5]} final_dict = [] for key, val in test_dict....
true
84d9c007728ce316268e13689a3f9ba19486a732
nate-io/python-spark
/scripts/word-count.py
UTF-8
691
3.109375
3
[]
no_license
from pyspark import SparkConf, SparkContext from config import DATA_DIR conf = SparkConf().setMaster("local").setAppName("WordCount") sc = SparkContext(conf = conf) input = sc.textFile(f"{DATA_DIR}/book.txt") # using flatMap here because of the book file structure # it is essentially a list of lists where each sublis...
true
97781f33a68bfa690bbc43591df81369ba73f86e
Hugo-Fuente/LearningHTML
/iterar_2_listas_pythonic.py
UTF-8
194
2.96875
3
[]
no_license
lista = ['Moto', 'Carro', 'Casa'] lista2 = ['Bola', 'Carrinho', 'Peteca'] lista3 = ['Bola', 'Carrinho', 'Peteca'] for auto, brinq, x in zip(lista, lista2, lista3): print(auto, brinq, x)
true
040bfc73e458e6cb2aa7de8fb9489d4cedf0ca6b
duerwen/ML
/线性回归/标准方程法-线性回归.py
UTF-8
727
3.21875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np data = np.genfromtxt("data.csv",delimiter=",") x_data = data[:,0,np.newaxis] y_data = data[:,1,np.newaxis] # 给x_data增加一列偏置值1,axis=1表示在列的方向进行合并 X_data = np.concatenate((np.ones((100,1)),x_data),axis=1) # 标准方程法求解权值矩阵 def weights(x_data,y_data) : xMatrix = np.mat(x_d...
true
dfa7d1690895f3f154aac7246a62dba0df220d45
joehiggins/cme307
/HW3/Q9.py
UTF-8
1,859
2.953125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 21 20:43:46 2018 @author: YinYu Ye Is a cone """ import numpy as np import random as rand e = np.exp(1) anchors = np.matrix([ [1, 0], [-1, 0], [0, 2] ]) sensors = np.matrix([ [-0.5, 0.5], [ 0.5, 0.5] ]) #define gradient funct...
true
de7649a73a2d093b174e90991511830381986ae2
sullylei/python
/xiaojiayu_rumen/01function.py
UTF-8
376
3.859375
4
[]
no_license
def discounts(price,rate): final_price = price * rate old_price = 50 print('修改后的old_price的值是:',old_price) return final_price old_price = float(input('请输入原件:')) rate = float(input('请输入折扣率:')) new_price = discounts(old_price,rate) print('修改后的old_price的值是:',old_price) print('打折后价格是:',new_price)
true
79aef332dda95e169ec36c30a7e5e38b4bf3a828
SubjectNoi/Futures-Spread-Optiver
/src/stage1-Correlation/corr_cov_example.py
UTF-8
3,473
2.921875
3
[]
no_license
# zpf import pandas as pd import numpy as np from pandas import Series, DataFrame # from pandas_datareader import data import re import os data_path = "../../data/dce/2014/" futures_data = {} def file_reader(file_dir, year): for root, dirs, files in os.walk(file_dir): for file_name in files: ...
true
9c837c7700b65433ba54d5a68336d12310455463
TangLeeee/flask_demo
/hello.py
UTF-8
4,893
2.84375
3
[]
no_license
from flask import Flask, render_template, request, flash from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, SubmitField from wtforms.validators import DataRequired, EqualTo from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.secret_key = 'tangle' # 因为编码问题这里将mysql改为mysql+mysql...
true
400b1908e9d1a7d6c480a90fe9653a549d1f8224
chenboshuo/learn_algorithm
/introduction/union_find.py
UTF-8
2,386
3.3125
3
[]
no_license
import unittest import logging from typing import * logging.root.setLevel(level=logging.INFO) class UnionFind(): def __init__(self, n: int, text: str): """ Initialize nodes with integer names(0-n-1) @param n the number of nodes @param text the user input """ self.id = l...
true
fdbfd7c1bde9521833b4299ad8ae7cc10e4f6e2f
moon0331/baekjoon_solution
/programmers/고득점 Kit/단속카메라.py
UTF-8
357
3.0625
3
[]
no_license
def solution(routes): routes.sort(key=lambda x:x[0]) print(routes) answer = 0 x, y = routes[0] for next_x, next_y in routes[1:]: if y < next_x: print(x, y, '<', next_x, next_y) answer += 1 x, y = next_x, next_y return answer print(solution([[-20,15],...
true
77131c9637d92473cc2258cd5d0c5624d3e005c6
gustavo32/DataEngineeringBootcamp
/MODULE1/Activities/AIRFLOW/example_dag.py
UTF-8
955
2.765625
3
[]
no_license
from airflow import DAG from airflow.operators.bash_operator import BashOperator from airflow.operators.python_operator import PythonOperator from datetime import datetime, timedelta default_args = { 'owner': 'Luis Gustavo de Souza', 'depends_on_past': False, 'start_date': datetime(2020, 11, 28), 'emai...
true
96552eda8a3ec2de60b37cda73cd8159788b1211
wahello/dbas
/tests/test_frontend/test_LanguageSwitch.py
UTF-8
3,573
2.921875
3
[ "MIT" ]
permissive
""" This tests need a short timeout at the beginning to make sure everything has loaded correctly. Please visit __init__.py for more details about the parameters. There may be some problems with the pipeline if it runs the tests. This may have the cases. 1: PhantomJs has SSL certificate errors -> add service_args ...
true
c6877d5e248c94540ceb8f754379cb9673289d14
shivampip/socket-angular
/client.py
UTF-8
619
2.78125
3
[]
no_license
import socketio sio = socketio.Client() @sio.on("connect") def connect(): print("I'm Connected") sio.emit("session_request", {"session_id": "shivampip"}) @sio.on("disconnect") def disconnect(): print("I'm Disconnected") @sio.on("session_confirm") def session_confirmed(data): print("Session is con...
true
14e30fa460a1f2af5cb480b0d1d5cd13954b69ef
leslie-mayte/CodigoPython
/CodigoDePractica/CodigoPython/list.py
UTF-8
374
4.5625
5
[]
no_license
#List is a collention which is ordered and changable.Allows duplicate #Create a list, 1st way to do it numbers = [1,2,3,4,5] fruits = ["apple","orange","grapes","pears"] #Create a list, use a constructor numbers2 = list((1,2,3,4,5)) print(numbers,fruits) #Get a value of a list print(fruits[0]) #Get length print(len(...
true
d96415d6f4d1616a51c604fa0c92873e8b6bbe3e
judacribz/python_repo
/csci_3070u/ass/A2/part4.py
UTF-8
4,671
3.640625
4
[]
no_license
from util import * # ============================================================================= # Constants # ============================================================================= FILE = "file.txt" # ============================================================================= # Node Class # ============...
true
710abcd9b87c7fe3b447bf07c9129d79a3e2611b
annali770/Inkfinity
/InkfinityApp.py
UTF-8
17,726
2.671875
3
[]
no_license
from tkinter import * from tkinter.colorchooser import askcolor from tkinter import filedialog import copy from PIL import ImageTk, Image, ImageOps import requests from io import BytesIO def __init__(app, root, canvas): app.board = Board(app) app.brush = Brush(app) app.activeButton = None app.blendingT...
true
457e999b83907150a70ad0853f4ccbb907650599
rvalusa2108/PySparkExercises
/sparkSQL.py
UTF-8
1,704
3.171875
3
[ "Apache-2.0" ]
permissive
from pyspark.sql import SparkSession from pyspark.sql import Row from pyspark.sql.types import StructType, StructField, StringType, IntegerType from pyspark.sql.types import ArrayType, DoubleType, BooleanType from pyspark.sql.functions import col, array_contains from pyspark.sql.functions import count, sum, avg, max #...
true
12f52ae0f87fa1a543b7a7aa91cc91c626dd09df
srodriguez1850/friendtrend
/preprocess_data.py
UTF-8
11,955
2.53125
3
[ "MIT" ]
permissive
import json, pprint, os, itertools, datetime, argparse def main(data_path, username, write_to_file): pp = pprint.PrettyPrinter(indent = 4) all_json_data = [] all_json_files = list( map( lambda x: os.path.join(data_path, x, "message.json"), os.listdir(data_path) ) ...
true
93c9ab54946237123a3b380f520517bad748a83f
molecularsets/moses
/scripts/prepare_dataset.py
UTF-8
3,609
2.65625
3
[ "MIT" ]
permissive
import argparse import gzip import logging from functools import partial from multiprocessing import Pool import pandas as pd from tqdm.auto import tqdm from rdkit import Chem from moses.metrics import mol_passes_filters, compute_scaffold logging.basicConfig(level=logging.INFO) logger = logging.getLogger("prepare da...
true
fc83c7f7fdf5782e84099802aeac7ec96e632864
annmcnamara/sqlalchemy-challenge
/app.py
UTF-8
8,060
2.703125
3
[]
no_license
import numpy as np import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func, desc # Need _and and _or for queries from sqlalchemy import and_ from sqlalchemy import or_ from flask import Flask, jsonify import datetime as dt from d...
true
737818347da9eb138d3800be1f3bf80ba6271e4e
barcher1968/lpthw
/circle.py
UTF-8
198
3.78125
4
[]
no_license
import math class Circle: def __init__(self, r): self.radius = r def area (self): return self.radius ** 2 * math.pi circle = Circle (5) print (circle.area())
true
1e4e669bf3848ba7b229cdabab69d9cbbc04de5a
nlpaueb/SumQE
/src/LM_experiments/BERT_GPT2.py
UTF-8
11,778
2.640625
3
[ "MIT" ]
permissive
import csv import json import os import math import matplotlib.pyplot as plt import numpy as np from scipy.stats import pearsonr, spearmanr, kendalltau import torch from pytorch_pretrained_bert import GPT2Tokenizer, GPT2LMHeadModel from pytorch_pretrained_bert import BertTokenizer, BertForMaskedLM from configuration ...
true
4a11046d4571eee72f1642279419f644255675d4
sybila/eBCSgen
/eBCSgen/Errors/UnspecifiedParsingError.py
UTF-8
305
3.125
3
[ "MIT" ]
permissive
class UnspecifiedParsingError(Exception): def __init__(self, message): self.message = message def __str__(self): return 'Unspecified error while parsing the model:\n\n {} \n\n'\ 'Please check the model for any ambiguous expressions and typos.'.format(self.message)
true
4048d3d0b1b25d0e472d3e546ddef47dcfb79e97
raflyhmk/EncKey
/enckey.py
UTF-8
1,136
2.625
3
[]
no_license
from tkinter import * from fungsi_enkripsi import enkrip, halaman_enkripsi from fungsi_dekripsi import dekrip, halaman_dekripsi from halaman_panduan import halaman_panduan from halaman_visualisasi import halaman_visualisasi, visualisasikan mainframe = Tk() mainframe.title('EncKey') mainframe.geometry("400x300") tool...
true
6169b13a0f82d8d069798e48d59a956d481a6e37
scdev0/euler
/src/p25.py
UTF-8
304
3.265625
3
[]
no_license
import fib def thousand_digit_fib(): '''Return the index of the first thousand digit fibonacci number''' n = 4500 while True: num = fib.fib_dy(n) if len(str(num)) == 1000: return n n += 1 if __name__ == '__main__': print(thousand_digit_fib())
true
96a1ca939c04b1cd4067640e38249d0945a50275
screamff/Hello-Python
/pygame-test/pygame_02_rect_intro.py
UTF-8
288
3.421875
3
[]
no_license
# coding:utf-8 import pygame # 无需pygame.init()也可直接使用 hero_rect = pygame.Rect(100, 500, 120, 125) print "英雄的原点 %d %d" % (hero_rect.x, hero_rect.y) print "英雄的尺寸 %d %d" % (hero_rect.width, hero_rect.height) print "size:%d %d" % hero_rect.size # 元组
true
6529f768cbfe709fffa3c7981394350e84ce63ee
macson777/test_repo
/src/task_10_3.py
UTF-8
881
3.546875
4
[]
no_license
# Имеется текстовый файл. # Все четные строки этого файла записать во второй файл, # а нечетные — в третий файл. # Порядок следования строк сохраняется.[03-15.29] def line_func(): my_file_1 = open('task_10_3_1.txt') my_file_2 = open('task_10_3_2.txt', 'w') my_file_3 = open('task_10_3_3.txt', 'w')...
true
7263931b56a21decf31db4c9567c5c9238b76771
AlleniCode/Zesame
/Carthage/Checkouts/EllipticCurveKit/schnorr.py
UTF-8
7,721
2.578125
3
[ "Apache-2.0", "MIT" ]
permissive
import hashlib import binascii p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F n = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 G = (0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798, 0x483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8) def ...
true
4710c68a8db904c81a16dc4c00e382f3df8442f2
testdemo11/test2_pratice
/hogwarts_demo/test_类.py
UTF-8
2,081
4.5625
5
[]
no_license
# -*- coding:utf-8 -*- __author__ = 'Tnew' """ def 作为函数,放在类的外面; def 作为方法,放在类的里面; 面向对象 类变量:在类里面声明的变量,不在方法之中,访问是通过手动调用 实例变量:self.变量名的方式访问,实例变量的作用域是整个类中的所有方法 普通变量:在类方法之中,没有self开头,作用域是本方法之中 构造方法: 给创建的对象建立标识符 为对象数据成员开辟内存空间 完成对象数据的初始化 self: 代表类的实例 """ class Person: #类变量 name = "default" age = 0 gender = '...
true
16766c2bbd560ba2dbb2a2d8089e36815e4d8718
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4181/codes/1595_1014.py
UTF-8
73
3.078125
3
[]
no_license
total=float(input("qual total de vendas?")) print(round(total/100*30, 2))
true
e51c6e549b5b9077455b206212a20238f6cb3fbd
trnielsen/nexus-constructor
/nexus_constructor/kafka/kafka_interface.py
UTF-8
851
2.6875
3
[ "BSD-2-Clause", "BSD-3-Clause" ]
permissive
from abc import ABC, abstractmethod from copy import copy import asyncio import threading class KafkaInterface(ABC): def __init__(self): self._loop = asyncio.get_event_loop() self._cancelled = False self._poll_thread = threading.Thread(target=self._poll_loop) self._is_connected = F...
true
2d7f367b4c4b578e2e1de96463979363baadadf2
Li-Erica/Insight-Challenge
/src/Hash_Tag_Graph.py
UTF-8
4,153
3.09375
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
import numpy as np from igraph import Graph, plot from itertools import combinations import matplotlib matplotlib.use('SVG') import sys reload(sys) # Reload does the trick! sys.setdefaultencoding('UTF8') __author__ = 'Erica-Li' class hash_tag_graph: """ hash tag graph class """ def __init__(self,...
true
552fe42ed5df2d62833b73d962ed2c23fc7cf572
wanglei742/Programming-for-the-Puzzled----Srini-Devadas
/Puzzle 7/puzzle7_2D_Binary_search.py
UTF-8
2,906
3.765625
4
[]
no_license
# Programming for the Puzzled -- Srini Devadas # Ex_1_2 # 2D Binary Search # (2*n) X (2*n) # By Caliber_X # quadrant : 00 (upper left), 01 (upper right), # 10 (lower left), 11 (lower right) quadrant = [(0, 0), (0, 1), (1, 0), (1, 1)] # Quadrant Approach def ex_1(lst, search_input): size = len(lst[0]) ...
true
c88e390afcf1b4c88a7984ae9e17dbe5379fbf76
chlsgong/ethical-hacking-project
/victim/project.py
UTF-8
1,205
2.90625
3
[]
no_license
import sys def is_user(s): lower = s.lower() if 'user' in lower: return True elif 'u' == lower: return True elif 'email' in lower: return True else: return False def is_pass(s): lower = s.lower() if 'pass' in lower: return True elif 'p' == lower: return True else: return False def parse_cr...
true
f36954e982e17dc48b4e2051100c958d11154b31
tsingroc/1st-city-cognitive-intelligence-challenge
/第1名/code/data-process.py
UTF-8
1,272
2.984375
3
[]
no_license
# python version:3.6.9 # # test env: ubuntu 18.04 # # TODO: from json.decoder import JSONDecodeError import json import time mapPath = "../data/map.json" if __name__ == "__main__": print("start!") start = time.clock() with open(mapPath,'r') as f: mapData = json.load(f) f.close() lane...
true
4ef21b59f4814d15f0facbfc7cd9cc597cc82f9a
Natthapol-PEET/Line-Message-API
/app.py
UTF-8
1,644
2.578125
3
[]
no_license
from flask import Flask, request import json import requests from firebase import firebase # Setup Url Authorization = 'Bearer tVdIAfmI+eV3LfM7LE7RTAQfP6PIcCM/o5/NdkCMV8yUbhcDMnEEX9bGWn8MPbiN8/2gRTAyTemSHxC9YNJYWtaFTliAoVO5vIsxPlnax7FKEpriB8zglavc+0OPPT2AhzLikWe1m7McQxwYoZPUtFGUYhWQfeY8sLGRXgo3xvw=' database_url = 'ht...
true
f422478f927e5cc4431aed85adcaa065ad0f8921
dhruvbatta/TwitterSentimentAnalysisOfAVDataHack
/try1.py
UTF-8
3,044
2.671875
3
[]
no_license
import pandas as pd from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from nltk import word_tokenize import re from sklearn.svm import LinearSVC from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.linear_model import SGDClassifier from sklearn.model_selectio...
true
4866b959f32794503da42bac0a97820c8d7f93eb
goldenratio1618/gameoflife
/r_pentomino.py
UTF-8
368
3.75
4
[]
no_license
# Makes a grid in the shape of an R-pentomino. Not yet functional. #grid = [] """ for a in range(size): row = [] for b in range(size): row.append(0) grid.append(row) # Makes an R-pentomino grid[size//2 - 1][size//2] = 1 grid[size//2 - 1][size//2 + 1] = 1 grid[size//2][size//2 - 1] = 1 grid[size//2...
true
bc64ae503e70ac65f58fbaeb7c0226543ad8c399
s-tajima/learn-deep-learning-from-scratch
/section3/3.3.2.py
UTF-8
344
3.125
3
[]
no_license
import numpy as np A = np.array([[1, 2, 3], [4, 5, 6]]) print(A.shape) B = np.array([[1, 2], [3, 4], [5, 6]]) print(B.shape) print(np.dot(A, B)) C = np.array([[1, 2], [3, 4]]) print(C.shape) print(A.shape) #print(np.dot(A, C)) D = np.array([[1, 2], [3, 4], [5, 6]]) print(D.shape) E = np.array([7, 8]) print(E.shap...
true
4f8ae108dddf038eaedc679d6f159ba224931cd8
chawlamit/mine_sweeper
/agents/base_agent.py
UTF-8
3,599
3.09375
3
[]
no_license
from environment import Environment import random from abc import ABC, abstractmethod from minesweepermatplot import MineSweeper import matplotlib.pyplot as plt from utils import SETTINGS class BaseAgent(ABC): FLAG = -2 def __init__(self, env: Environment, debug=False, visualize=False): self.env = en...
true
c55c911e28e5c8fdfb7a9af49a69469da10bcd08
kiminh/HCL
/graph/cortex_DIM/nn_modules/resnet.py
UTF-8
9,013
2.609375
3
[ "MIT" ]
permissive
'''Module for making resnet encoders. ''' import torch import torch.nn as nn from cortex_DIM.nn_modules.convnet import Convnet from cortex_DIM.nn_modules.misc import Fold, Unfold, View _nonlin_idx = 6 class ResBlock(Convnet): '''Residual block for ResNet ''' def create_layers(self, shape, conv_args...
true
b8f270a138698d58fe682d190e14a7910f2afd17
shahriyar-khan/scrapr-cli
/scrapr_cli/app.py
UTF-8
1,529
3
3
[]
no_license
from urllib.request import urlopen, Request import re import click @click.command(help=f"{'[Scrapr v0.0.1]':<68}{'Author: @xSplayd':<68}" f"{'--------------------------------------------------------------------------':<80}" f"{'This cli tool will automatically scrape email addr...
true
50691ed4c2e457105a81630c49f7881983031bc6
Zhenyaair/Praktika-Python
/Taks02/Calculator Full.py
UTF-8
5,264
3.765625
4
[]
no_license
import tkinter as tk import math class Calculator(tk.Frame): #Створення вікна def __init__(self, master = None): tk.Frame.__init__(self, master) self.master.geometry() self.master.title('Calculator') self.entry = tk.Entry(self.master, justify='right') self.creat_...
true
4d806a63b74a40e4c2dad66cb6a5d22e908a10ac
HippoCP/module
/src/permissions.py
UTF-8
1,447
2.828125
3
[]
no_license
import postgresql from hippocp import database class Permissions: """Class to manage permissions.""" def __init__(self): """Initialize the Permissions class""" self.db = postgresql.open(database.getPgUrl()) def exists(self, permissionid): """Check if the permission exists""" ...
true
235f7d5a4baa88cde7ede6e6b18862cd3e53aad9
wuyx517/SORT-Multiple-Car-Tracking-using-YOLOv5
/utils/datasets_final.py
UTF-8
3,972
2.53125
3
[]
no_license
import glob import math import os import random import shutil import time from pathlib import Path from threading import Thread import cv2 import numpy as np import torch from PIL import Image from torch.utils.data import Dataset from tqdm import tqdm img_formats = ['.bmp', '.jpg', '.jpeg', '.png', '.tif', '.tiff', ...
true
de408e1608e85d720b0e201c0cff3c828b6dec1d
fermiPy/fermipy
/fermipy/diffuse/catalog_src_manager.py
UTF-8
10,573
2.703125
3
[ "BSD-3-Clause" ]
permissive
# Licensed under a 3-clause BSD style license - see LICENSE.rst """ Classes and utilities that manage catalog sources """ from __future__ import absolute_import, division, print_function import os import yaml import numpy as np from fermipy.diffuse.name_policy import NameFactory from fermipy.diffuse.source_factory i...
true
733c0fece5a2b92b703f63099db7223ca577e67c
balapitchuka/python-utilities
/keyboard/keypress-read.py
UTF-8
441
2.84375
3
[]
no_license
# keyboard management: # * input: getch # * output: click # windows: msvcrt import getch def waiting_for_key()->[]: """ blocking read from keyboard get char from keyboard get keytype """ read_symbol_ord = ord(getch.getch()) if read_symbol_ord == 27: return [read_symbol_ord, ord(ge...
true
08e1f4a36a1b5884f470d8364f110c72dc0b2c28
brennash/RaspberryPiBrewBot
/src/PinOutputTest.py
UTF-8
1,281
2.765625
3
[ "MIT" ]
permissive
import os import sys import time import board import busio import random from gpiozero import LED import adafruit_character_lcd.character_lcd_rgb_i2c as character_lcd from optparse import OptionParser class PinOutputTest: def __init__(self, verboseFlag): self.verbose = verboseFlag self.sleepTime = 3 lcd...
true
1ea7c2ba44baec6f40e6bb525544a56c7e8dc1bb
ToshikiShimizu/AOJ
/DSL/3c.py
UTF-8
421
3.21875
3
[ "MIT" ]
permissive
N, Q = map(int, input().split()) A = list(map(int, input().split())) X = list(map(int, input().split())) def two_pointers(x): left = 0 sm = 0 ans = 0 for right in range(N): sm += A[right] while(sm > x): sm -= A[left] left += 1 ans += (right-left+1) # left...
true
a0a6861e8d54526d63c1ed3b7a0e920365001e08
FChen12/paper
/EmbeddingCreator.py
UTF-8
4,492
2.84375
3
[]
no_license
import abc, logging, os from pathlib import Path from Embedding import Embedding, MockEmbedding from Preprocessing.Preprocessor import Preprocessor from Preprocessing.FileRepresentation import FileRepresentation import FileUtil log = logging.getLogger(__name__) WRITE_PREPROCESSED_TOKEN = True # Writes the preprocesse...
true
03cebbe39d4b026d224a34f6cfd95f8164ecf7e1
gamertense/indexParallel
/python_script/punTestParallel.py
UTF-8
799
2.609375
3
[]
no_license
import multiprocessing as mp import timeit import functools import math def func(x): return functools.reduce(lambda a, b: math.log(a+b), range(10**5), x) def multiprocess(number_processes): pool = mp.Pool(processes=number_processes) result = [pool.apply_async(func, args=(x,)) for x in range(1, 100)] ...
true
669e78d987f96d1a298f4a2494bb3845a19dd2c8
petholaszlo/elte-ik-szh
/gy/szh_hf_hcs/TP75FW_CRC/udp_server.py
UTF-8
1,539
2.796875
3
[]
no_license
import socket from time import sleep from logger import Logger from haziCRCCalculator import HaziCRCCalculator class UdpServer(Logger): """ An UDP server""" crcCalc = HaziCRCCalculator() def __init__(self, host = 'localhost', port = 10000, name = "UDP server", debug = False): Logger.__init__(self...
true
c6a7c6f1e0588cc5f45a539495e6b05509b15810
shourya1997/vcfconvertor
/vcfconvert.py
UTF-8
1,147
2.53125
3
[]
no_license
from datetime import datetime def convert_to_vcard(input_file, input_file_format): FN = input_file_format['name']-1 if 'name' in input_file_format else None TEL = input_file_format['tel']-1 if 'tel' in input_file_format else None vcf_filename = 'vcard/contacts_' + str(datetime.now().strftime('%Y-...
true
85812ec593ff6fbc73c95667ac65a9d5c29e8909
fbgkdn2484/python
/0528/starShape.py
UTF-8
214
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 28 14:18:32 2021 @author: Mac_1 """ import turtle as t i = 0 while i < 5: t.forward(200) t.left(144) i = i + 1 t.done() t.bye()
true
85f5fb011f72a9341daa897041ba81dc2233ac3c
pwinning1991/algoexpert
/branchSums/test_branchSums.py
UTF-8
424
3.15625
3
[]
no_license
import unittest from branchSums import branchSums, BinaryTree class TestBranchSums(unittest.TestCase): def test1(self): tree = BinaryTree(1) self.assertEqual(branchSums(tree), [1]) def test2(self): tree = BinaryTree(0) tree.left = BinaryTree(1) tree.left.left = BinaryTr...
true
20f5adf2ac8a4f71e5e8d0588128bd182e17defe
amarazad/DSRNet
/extract_conversation.py
UTF-8
13,240
2.859375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 def get_key(my_dict, val, doc_id): for key, value in my_dict.items(): if val in value and key.split('__')[0] == doc_id: return key print(my_dict, val, doc_id) return "key doesn't exist" tmp = [] with open('resources/bad_words.t...
true
a657c7b764fb5f6e072ce20282d55a89a6d5dd09
amitnir29/Traffical
/gui/simulation_graphics/drawables/car.py
UTF-8
1,352
2.90625
3
[]
no_license
from __future__ import annotations from copy import deepcopy from dataclasses import dataclass from typing import List import pygame from gui.simulation_graphics.camera import Camera from gui.simulation_graphics.drawables.drawable import Drawable from server.simulation_objects.cars.i_car import ICar from server.geom...
true
f715be6e9426287c9a3be2917a10a62721e94181
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_206/900.py
UTF-8
409
3.421875
3
[]
no_license
t = int(raw_input()) for i in range(0,t): d,n = raw_input().split() d = float(d) n = float(n) times = [ ] for j in range(0,int(n)): dat = raw_input().split() dat[0] = float(dat[0]) dat[1] = float(dat[1]) t = (d-dat[0])/dat[1] times.append(t) t...
true
97a4406a6db7c0b33a8ca528837c8c7a6ed717b8
JorgeStolfi/Projeto-MC857-2019
/compra.py
UTF-8
9,784
3.25
3
[]
no_license
# Este módulo define a classe de objetos {ObjCompra}, que # representa um pedido de compra (em particular, um carrinho de # compras). # # Nas funções abaixo, o parâmetro {prod} é um objeto # da classe {ObjProduto}, e {qtd} e um {float} que especifica uma # quantidade desse produto. # Implementaçao deste módulo: impor...
true
daa35ae78121b0025f91ad4e1672f095717f6320
SaurabhPimpalgaokar/assignments
/Exercise_seventh/newserver.py
UTF-8
2,641
3.0625
3
[]
no_license
import socket import sys from _thread import * import argparse thread_number = 0 global output #first create a server socket #AF_INET is type and sock_Stream is for tcp mode server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) parser = argparse.ArgumentParser() parser.add_argument("-ip",help="Enter IP addr...
true
c2ccb6ff5d463ebc43f45568afa4cb8b4e35513c
orenavram/GenomeRearrangements
/genome_numeric_representation.py
UTF-8
7,750
2.65625
3
[]
no_license
import logging import datetime import sys import os def get_genes_info_dicts(fasta_path, delimiter=' # ', gene_index=0, orientation_index = 3): """ :param fasta_path: a path to a FASTA file. If the file is no in PRODIGAL's output format, default params should be set accordingly. :return: two di...
true
37645569c3083d7d1701138d1e7b5955a6d79e0b
hasinthaK/sentiment_analysis
/alternate/nltk-intensity-analyzer.py
UTF-8
1,400
2.90625
3
[]
no_license
import string from collections import Counter # excel file utils import xlrd from xlutils.copy import copy from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.sentiment.vader import SentimentIntensityAnalyzer xl_file = xlrd.open_workbook('ml.xlsx') # xl_file_copy = copy(xl_file) sheet ...
true
241d81f9daed60e2acd2f3b3faf1dbf2f7a2931d
jardelcarvalho/ufsj_computacao-paralela_tp1
/util/comp_arq.py
UTF-8
624
3.171875
3
[]
no_license
import sys # compara matrizes através da igualdade dos arquivos mat_n = mat_m = '' with open(sys.argv[1], 'r') as m: _str = m.read() for c in _str: if c == '\n': mat_m += ' ' else: mat_m += c with open(sys.argv[2], 'r') as n: _str = n.read() for c in _str: ...
true
5e9c24e49cd74e55cb476f5994ad1060991a13ba
Q-Qing/AndroidStepsExploration
/label_exploration/lable_a.py
UTF-8
8,964
2.96875
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import numpy as np from collections import Counter from itertools import product pd.set_option('display.max_columns', 500) pd.set_option('display.width', 10000) """ df = pd.read_csv("/Users/Q-Q/data set/step dataset/detailed_steps/902162251.csv") df['date'] = pd.to_...
true
71dd3c51b0c0d0bb25596241c9f91013b7309d05
cauegonzalez/cursoPython
/desafio002.py
UTF-8
345
4.03125
4
[]
no_license
# Crie um programa que receba o dia, o mês e o ano de nascimento e apresente esta informação na tela print('====Desafio 02 - Aula 04====') dia = input('Dia de nascimento: ') mes = input('Mês de nascimento: ') ano = input('Ano de nascimento: ') print('---------------------------') print('Você nasceu em',dia,'de',mes,'de...
true