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
980a95d7a6de237da4d7f4bc4d8869c52cf7f966
Denizche/Phyton
/lab2/str_reverse.py
UTF-8
304
3.203125
3
[]
no_license
#arr max and average #denis chechelev RT5-51 def str_reverse(inp_str): res = "" for i in range(len(inp_str)): res = inp_str[i] + res return res def main(): hellostr = "Hello world" print(str_reverse(hellostr)) return 0 if __name__ == 'builtins': #builtins вместо __main__ main()
true
db5d40a81f62c3e0fa38030a3e97cf0a80a3980d
dwd31415/tensorflow-diff-eq
/diff_eq.py
UTF-8
3,789
2.9375
3
[ "Apache-2.0" ]
permissive
import tensorflow as tf import numpy as np class DifferentialQuantity(object): def __init__(self, id, eq): self.id = id self.eq = eq self.is_defined = False self.derivatives = [] def d(self,grade): if not self.is_defined: raise Exception("Quantity is not ye...
true
5382f4cfacd143cf746efdb7055263cfc529a54e
virgoaugustine/text-similarity-api
/app.py
UTF-8
6,700
2.84375
3
[]
no_license
from flask import Flask, request, jsonify from flask_restful import Api, Resource from flask_cors import CORS from pymongo import MongoClient from datetime import date import os import bcrypt import spacy app = Flask(__name__) CORS(app) api = Api(app) client = MongoClient(os.environ['MONGO_URI'], connect=False) db...
true
693714d597bc2b4595cf7e4f7d8f239201c46d4a
natanaelfelix/Estudos
/Map/Reduce.py
UTF-8
701
3.375
3
[]
no_license
from Map import produtos, pessoas, lista from functools import reduce #função de acumulação de valores acumula = 0 for item in lista: acumula = acumula + item print (acumula) #utilizando a função reduce soma_lista = reduce(lambda ac, i: i + ac, lista, 0) # o ac é um acumulador, o i e ou outro i é ao que eu irei ...
true
3c363f50f93f1664b1a39d039a5cdaa3a10f2af7
BogdanFi/cmiN
/projects/Python/cli/cmiN/MailSorter.py
UTF-8
2,412
3.03125
3
[]
no_license
#! /usr/bin/env python3.1 # 12.09.2009 <> 12.09.2009 | cmiN # This script sorts e-mails from all files in a path import os, sys def sort(args): os.chdir(args[2]) ext = list() if args[3] == "*": ext.append(".") else: for x in args[3].split(","): ext.append("...
true
521ff645e8c50fd35c99e58ea2e5e789c12b72bd
timothyb89/tracking
/tracking/cluster.py
UTF-8
5,899
3.03125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import cv2 import numpy as np from point import SimplePoint DISTANCE_MULTIPLIER = 35.0 DISTANCE_PHYSICAL = 12.0 class Cluster: def __init__(self, points): self.points = set(points) self.center = None self.update() def contains(self, point): retur...
true
029e6763996acdb2124d6eecd21aad38083c2e84
grodrigues3/InterviewPrep
/Leetcode/reverseK.py
UTF-8
1,742
3.453125
3
[]
no_license
#!/usr/bin/python from data_structures.ListNode import ListNode class Solution(object): def reverseKGroup(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ if head is None or k ==1: return head def reverseK(start):...
true
e9d884b96cef376af1b5d34301b73054d01b29c4
Avani1994/TDAAndVisualizationMiceData
/src/start.py
UTF-8
4,613
2.515625
3
[]
no_license
import numpy as np import pandas as pd from generateParameterization import findParameterization from sys import argv from readandsmooth import readandsmooth from astropy.stats import LombScargle import pylab as plt from readRawMice import readRawMice import os from plotcocyles import plotcocyles import csv from getEm...
true
b34c2f10c6906bc66d0a19bafb33e5a4a02aebbc
yusrakaya/GlobalAIHubPythonHomework
/Homework-1.py
UTF-8
788
4.21875
4
[]
no_license
List='value1','value2','value3','value4','value5' value1=input("Please enter a value:") #Gets needed input print(f"First value is {value1}") #The {value1} means it puts the variable name there print("Entered first value:{}".format(type(value1))) value2=int(input("Please enter a value:")) print(f"Second value is {v...
true
3a5cd1c5862f154979eaec8cfb7706f401541d9c
KnoxMakers/CodingWorkshops
/StrangerThings/strangeCode.py
UTF-8
9,288
3.296875
3
[]
no_license
import RPi.GPIO as GPIO # Here we first import GPIO rules for RPi import time # Here we import time so that we cause timed delays later # Knox Makers a la Stranger Things Alphabet Wall # Uses GPIO pins: 07 11 13 15 29 31 07 33 35 17 # BCM translation key: 04 17 27 22 05 06 04 13 19 26 # A...
true
08d46aa1126c65febb0ab6e92cb14a9dce7df257
HATIMj/MyPythonProblems
/FunnyNames.py
UTF-8
2,555
4.625
5
[]
no_license
#Funny name creator by jumbling the last name of the various names s=int(input("How many names do you need to add:-")) #Taking the number of names as an input k=[] #Creating a list which will contain these names for i in range(s): ...
true
3fbc438e503060088f79f47afb328582d04e1e27
predictionengineer/JobHunter
/JobHunter/job_hunter.py
UTF-8
892
2.984375
3
[]
no_license
""" Runs the job_hunter program """ import pandas as pd import pull_indeed as pull_indeed import waze from tqdm import tqdm def job_hunter(): CITY = str(input("Search which City, State?: ")) CITY = CITY.replace(" ", "+") JOB_TITLE = str(input("what job title?: ")) JOB_TITLE = JOB_TITLE.replace(" ", "...
true
2dec927e76386b9e0f87f3453e263548377c65d0
hvicheka/python-programming-basic-to-advanced
/string type/print-string.py
UTF-8
263
3.8125
4
[]
no_license
num1 = 100 num2 = 200 # This is not recommend print("Value of num1 is",num1,"Value of num2 is",num2) # Recomend print("Value of num1 is {} value of num2 {}".format(num1,num2)) print("Value of num1 is {val1} value of num2 {val2}".format(val1=num1,val2=num2))
true
4e62c44e8a093c60347cf56dbdb1ba7b214ea9cd
michaelnowotny/divergence
/divergence/tests/test_discrete.py
UTF-8
12,962
2.59375
3
[ "MIT" ]
permissive
import numbers import numpy as np import pytest import scipy as sp import typing as tp from divergence.base import _select_vectorized_log_fun_for_base from divergence.discrete import ( discrete_entropy, _construct_frequencies_for_one_sample, _construct_frequencies_for_two_samples, discrete_relative_en...
true
a8ea7ce773541df99891d4c02898df69256e8828
quintel/etdataset-public
/curves/demand/buildings/cooling/script/buildings_cooling.py
UTF-8
1,043
3.21875
3
[]
no_license
import sys import numpy as np from pathlib import Path # Communicate with the user if(len(sys.argv) != 3): print("Use: python " + str(sys.argv[0]) + " <country> <year> ") sys.exit(1) # Import input files else: country = sys.argv[1] year = sys.argv[2] input_file_path = "../data/" + country +"/" + ...
true
5bf3c4c2251407fdf95599f5096d21781eb536f4
thanhvn184/truongcongthanh-fundamental-c4e29
/Fundamental/Session1/HW/btvn5.py
UTF-8
128
3.171875
3
[]
no_license
from turtle import * color("green","yellow") begin_fill() for i in range (360): forward(1) left(1) end_fill() mainloop()
true
c24a11a2c08517d33f4a3d3c6fcbde327fa67055
alexrosl/python_selenium_course
/src/base/selenium_driver.py
UTF-8
12,318
2.515625
3
[]
no_license
import logging import os import time import traceback from traceback import print_stack from typing import List from selenium.common.exceptions import * from selenium.webdriver.common.by import By from selenium.webdriver.remote.webdriver import WebDriver from selenium.webdriver.remote.webelement import WebElement from...
true
9c03ced5a58c09afb8ba3c312859a5ae9b04907e
paurbano/holbertonschool-machine_learning
/unsupervised_learning/0x04-autoencoders/3-variational.py
UTF-8
3,793
3.359375
3
[]
no_license
#!/usr/bin/env python3 ''' "Vanilla" Autoencoder https://blog.keras.io/building-autoencoders-in-keras.html https://www.machinecurve.com/index.php/2019/12/30/how-to-create-a-variational-\ autoencoder-with-keras/ ''' import tensorflow.keras as keras def sampling(args): '''sample new similar points from the latent s...
true
e0fee1be32f11542adc35ae8bf5ae4b743c052fa
robgoyal/reddit2Text
/src/helper.py
UTF-8
3,592
3.4375
3
[]
no_license
# Name: helper.py # Author: Robin Goyal # Last-Modified: July 25, 2017 # Purpose: Functions to list, insert, and delete subreddits from database # Note: Still need to perform error and data handling import setup import os import sqlite3 import sys def database_exists(): ''' Create database if it doesn't exist '''...
true
876b9d7537a6a9d83e7ca2be55fbaa8f6ca4f5b2
cbschaff/benchmark-rrc
/python/env/viz.py
UTF-8
12,672
2.875
3
[ "BSD-3-Clause" ]
permissive
from mp.utils import Transform, get_rotation_between_vecs from scipy.spatial.transform import Rotation as R import numpy as np import pybullet as p class Marker: """ In case any point(for eg. the goal position) in space is to be visualized using a marker. """ def __init__( self, n...
true
bf1d89c47aa147233fa5908f91b9c10b4c3b834d
MrHamdulay/csc3-capstone
/examples/data/Assignment_3/pllker016/question1.py
UTF-8
156
3.78125
4
[]
no_license
height=eval(input("Enter the height of the rectangle:\n")) j=eval(input("Enter the width of the rectangle:\n")) for i in range (height): print(j*"*")
true
951482f407e6cbb013aa29fe96236885aa84c972
JoeeYF/MedDetection
/meddet/data/utils/geometry.py
UTF-8
477
2.75
3
[]
no_license
import numpy as np def getSphere(dim, size, diameter): radius = diameter / 2 - 0.5 structure = np.zeros((size,) * dim) center = [i / 2 for i in structure.shape] ctr = np.meshgrid(*[np.arange(0.5, size)]*dim, indexing='ij') ctr = np.stack(ctr, axis=0) ctr = np.transpose(ctr, [*range(1, dim +...
true
dc4b1c596c3437b0ea4c4e6d3c3698d54aa35833
edulonde/asdp
/fila.py
UTF-8
685
3.75
4
[]
no_license
class Queue: def __init__(self): self.queue = [] self.len_queue = 0 def push(self,e): self.queue.append(e) self.len_queue +=1 def pop(self): if not self.empty(): self.queue.pop(0) self.len_queue -=1 def empty(self): if self.len_...
true
01e7d0dbcfe201e467c005cec44d61e198b3417b
kevdonk/fullstack-nanodegree-movie-trailer
/app.py
UTF-8
2,571
3.328125
3
[]
no_license
import fresh_tomatoes import movie """ Create Movie Objects Movie data is hard coded here """ pulp_fiction = movie.Movie("Pulp Fiction", "(1994)", "What's in the case?", "http://ia.media-imdb.com/images/M/MV5BMjE0ODk2NjczOV5BMl5BanBnXkFtZ...
true
218d97663809032c60353afe072e8b831e9eef13
ChowHome/origin
/python/file.py
UTF-8
190
2.703125
3
[]
no_license
#!/usr/bin/python try: f = file('./passwd') except: print ('File not found!') exit() lines = f.readlines() for i in lines: words = i.split(':') if words[0] == 'root': print (i,)
true
06d1e619583e50465cec123ecf819c179ca547e2
shivkurtarkar/FCND-Estimation-CPP
/findStandardDeviation.py
UTF-8
375
2.71875
3
[]
no_license
import numpy as np data = np.loadtxt('Graph2.txt', delimiter=',', dtype='Float64', skiprows=1) readings = data[:,1] mean = np.sum(readings)/len(readings) print("mean: ",mean/len(readings)) print("stdev:", np.sqrt(np.sum(np.square(readings-mean))/(len(readings))) ) print("count:", len(readings) ) print("np mean:", np...
true
8b3f03fca8fbc8fc4d85766cacbd1c51919570bc
IKATS/ikats-pybase
/src/ikats/core/library/status.py
UTF-8
1,407
2.75
3
[ "LGPL-3.0-only", "LGPL-2.0-or-later", "LGPL-3.0-or-later", "Zlib", "BSD-3-Clause", "Python-2.0", "ZPL-2.0", "LicenseRef-scancode-openssl-exception-lgpl3.0plus", "ZPL-2.1", "Apache-2.0", "MIT" ]
permissive
""" Copyright 2018-2019 CS Systèmes d'Information Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
true
b61eaa29dca2fe3c5abd4b4e1dae242fadfd82df
winther-lee/hadoop-training-2019
/03_spark_intro/script/word_count.py
UTF-8
516
2.71875
3
[ "Unlicense" ]
permissive
from pyspark.sql import SparkSession if __name__ == "__main__": spark = SparkSession.builder.appName("word_count_APP").getOrCreate() source_file_path = "/tmp/news.txt" output_file_path = "/tmp/word_count_han" raw_rdd = spark.sparkContext.textFile(source_file_path) res_rdd = raw_rdd.flatMap(lambd...
true
81a5aba911d566434ddd960510e477bded70a8d6
latikamehra/PythonProjects
/CommonHelpers/matplotCharts/BarGraph.py
UTF-8
956
2.984375
3
[]
no_license
''' Created on Aug 7, 2019 @author: latikamehra ''' import matplotlib.pyplot as plt import numpy as np import os class BarGraph: def __init__(self,fileNamePrefix,title,x_label,y_label): plt.figure(figsize=(10,10)) self.x_fontSize = 10 self.rotation = 30 self.title = title ...
true
dc095a5f8400780d02b468bcd373a064afa46933
anapaulagomes/tdd-workshop
/3_food_and_drinks/food_and_drinks.py
UTF-8
1,032
3.84375
4
[]
no_license
""" Let's say your company is hosting the next PyLadies meetup. One of your tasks is calculating how much food and drinks would be needed to buy. Somebody told you that you should go for 1 pizza for every 10 people who RSVPed and 2 orange juices per person. You already know that 20% of the RSVPs usually don't show up....
true
21ed91e3edb7b847937c94d298dc5452adeeae8a
jsjkimberlite/mySLCC-Python-For-GIS
/filesorter_1_0_0.py
UTF-8
1,542
3.015625
3
[]
no_license
# This is a python program I wrote to sort files and store their paths # by Jeremy Jackson # version 1.0.0 import os print "started" # path varibles dataPath = "A path on your comp" dataInputPath = dataPath + "\\Data Folder" print dataPath print dataInputPath FileList = os.listdir(dataInputPath) print FileList...
true
4b8f5111a367611b8b450567f888c35da1d930ad
robot297/python-multithreading
/main.py
UTF-8
895
2.84375
3
[]
no_license
import threading import time import concurrent.futures from dictionary import * if __name__ == "__main__": big_list = ['hello'] * 100000 print(len(big_list)) master_dictionary = {} start = time.time() # threads = [] # for item in range(0, len(big_list)): # # thread = threading.Thread(...
true
6bed5187bbbc26726919ee0cbb5f5025f535445b
jorgemauricio/INIFAP_Course
/ejercicios/ej_3_indexing.py
UTF-8
1,491
3.5
4
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 17 16:17:25 2017 @author: jorgemauricio """ # librerias import numpy as np # crear arreglo arr = np.arange(0,11) # desplegar arr # obtener el valor en un indice determinado arr[8] # valores de un rango arr[1:5] # valores de un rango arr[0:5] ...
true
cff810727fb2eee96c0fec604c15f470dfe35fcf
dhazu/Mygit
/python_workbook/if-elif/ex34.py
UTF-8
473
5
5
[]
no_license
"""Exercise 34: Even or Odd? Write a program that reads an integer from the user. Then your program should display a message indicating whether the integer is even or odd.""" ##Solution: # ask the user to enter a number num = int(input("Enter an integer number: ")) # apply the condition and display the result if num...
true
e5bffaf9d82906f4a62558bb7ae3b6fabd3bba94
nickromano/django-daily-digest
/leather/utils.py
UTF-8
3,891
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python from collections import namedtuple from datetime import date, datetime, timedelta from decimal import Decimal import math import sys import warnings import six try: __IPYTHON__ from IPython.display import SVG as IPythonSVG except (NameError, ImportError): IPythonSVG = lambda x: x ...
true
ade28da0d7846864c061bcf7db3f8e5a19ff678b
AlineDominique/Curso-Python-for-Data-Science-Fundamentals
/Functions_ Fundamentals-315.py
UTF-8
4,845
3.6875
4
[]
no_license
## 1. Functions ## a_list = [4444, 8897, 6340, 9896, 4835, 4324, 10, 6445, 661, 1246, 1000, 7429, 1376, 8121, 647, 1280, 3993, 4881, 9500, 6701, 1199, 6251, 4432, 37] sum_manual = 0 for element in a_list: sum_manual += element print(sum_manual, sum(a_list)) ## 2. Built-in Functions ## rati...
true
266a208622d1b897d0758749a3f10e473e72c892
marcosmorimoto/fact_checking
/webscraping.py
UTF-8
2,228
3
3
[]
no_license
import urllib.request from bs4 import BeautifulSoup url = "https://exame.abril.com.br/mundo/trump-comete-uma-tremenda-gafe-ao-se-encontrar-com-rainha-elizabeth-ii/" #"https://economia.uol.com.br/noticias/reuters/2018/07/11/cmo-aprova-texto-base-da-ldo-2019.htm" "https://g1.globo.com/rj/rio-de-janeiro/noticia/delator-d...
true
87c5707d1abc27d574410eff0e2af32cb345576a
nstrebendt2/good_practices
/functions/basic_math.py
UTF-8
584
4.0625
4
[]
no_license
class Basic_Math(): """ A list of basic math methods """ def __init__(self): super().__init__() # self.number = 2 def exponentNumber(self, number: int) -> int: """ A good practice is to create a docstring first and then write your code. ...
true
c1f0f56f1f31047cfc5c943b9b8cb27094c83a27
domiee13/dungcaythuattoan
/Codeforces/antonAndDanik.py
UTF-8
1,413
4.65625
5
[]
no_license
# A. Anton and Danik # time limit per test1 second # memory limit per test256 megabytes # inputstandard input # outputstandard output # Anton likes to play chess, and so does his friend Danik. # Once they have played n games in a row. For each game it's known who was the winner — Anton or Danik. None of the games ende...
true
299ff2049477a7100613b9ceeee7b528fef5968b
Ledoux/ShareYourSystem
/Pythonlogy/ShareYourSystem/Standards/Itemizers/Structurer/draft/__init__ copy.py
UTF-8
12,966
2.578125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ <DefineSource> @Date : Fri Nov 14 13:20:38 2014 \n @Author : Erwan Ledoux \n\n </DefineSource> A Structurer """ #<DefineAugmentation> import ShareYourSystem as SYS BaseModuleStr="ShareYourSystem.Standards.Itemizers.Connecter" DecorationModuleStr="ShareYourSystem.Standards.Classors.Cla...
true
76ad4dd127bce47664c49d615ae2f05924e03e09
YoshikiImatake/level-analysis
/mcbmain.py
UTF-8
1,588
2.84375
3
[]
no_license
import os, McbReader, McbAnalyzer import pandas as pd import numpy as np from sklearn.neighbors import KNeighborsClassifier from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix stu_dir = 'mcb_text/student_mcb/' rev_dir = 'mcb...
true
0d399cb33a2d97a29f31d1fd938e24ac222f9f12
amriteshs/comp9414-codes
/Assignment-2/src/agent.py
UTF-8
9,261
3.40625
3
[]
no_license
#!/usr/bin/python3 # Sample starter bot by Zac Partridge # 06/04/19 # Feel free to use this and modify it however you wish import socket import sys from copy import deepcopy from math import inf # a board cell can hold: # 0 - Empty # 1 - I played here # 2 - They played here # the boards are of size 10 because ...
true
9ab2f68bc5df22972f8e81804719ed652200c5cc
snejy/Programming101
/week0/concat_files/solution.py
UTF-8
558
3.1875
3
[]
no_license
import sys import os def concat_files(filenames): filename = open("MEGATRON.txt", "a") for file in filenames: file_handler = open(file, "r") content = file_handler.read() filename.write(content) filename.write('\n') file_handler.close() filename.close() filename = open('MEGATRON.txt', 'r') content = fil...
true
070838491f06b47f48d1a3989845447253e83dc5
Divyanshtuwani/python_assignment
/python/module 2/q3.py
UTF-8
464
3.5625
4
[]
no_license
marks = int(input("Enter percentage : ")) if marks>=90 and marks<=100: print("A Grade") else: if marks>=80 and marks<90: print("B Grade") if marks>=70 and marks<80: print("C Grade") if marks>=60 and marks<70: print("D Grade...
true
e9ef169651e47d304b5c1e0355b34082624111a7
gvraky/Yolo_pruning-CRNN
/image.py
UTF-8
1,311
2.875
3
[]
no_license
# -*- coding: utf-8 -*- import os import numpy as np import cv2 from PIL import Image from numpy import sin,pi def solve(box): x1,y1,x2,y2,x3,y3,x4,y4= box[:8] cx = (x1+x3+x2+x4)/4.0 cy = (y1+y3+y4+y2)/4.0 w = (np.sqrt((x2-x1)**2+(y2-y1)**2)+np.sqrt((x3-x4)**2+(y3-y4)**2))/2 h = (np.sqrt...
true
654ba558a2d92208ff911b919fba2a9cb2e848c5
Aasthaengg/IBMdataset
/Python_codes/p03105/s703688480.py
UTF-8
91
3.09375
3
[]
no_license
a, b, c = [int(i) for i in input().split()] if b > a*c: print(c) else: print(b//a)
true
d5bf9ae716935302ba03caeb87c3f6a8cb22700f
zkbt/MITTENS
/python/candidate.py
UTF-8
5,295
3.203125
3
[]
no_license
""" Candidate class Author: Hannah Diamond-Lowe (hannah.diamond-lowe@cfa.harvard.edu) Date: 11 Dec. 2015 (MEarth camp!) This class describes a candidate planet and helps to visualize the likelihood of different transit durations. """ from marples import Marples import matplotlib.pyplot as plt import matplotlib.grids...
true
b27f5739ee41ac48f7e09e254876fa2990442c8a
Purushotamprasai/Python
/sunny_venkat_aswini/python_introduction/python datatype/001_fundamental.py
UTF-8
251
3.28125
3
[]
no_license
# this script file used for to understand fundamental datatype def main(): num = input("enter single data ") print "num = ",num print "type of ",type(num) print "id of ",id(num) if(__name__ =="__main__"): main()
true
e17e9e2fa53e0701d28226cc55c5b9974b597f25
junyinglucn/leetcode
/easy/53. Maximum Subarray.py
UTF-8
1,577
3.15625
3
[ "MIT" ]
permissive
# Solution A class Solution: def maxSubArray(self, nums): tmp = nums[0] max_ = tmp for i in range(1, len(nums)): if tmp + nums[i] > nums[i]: max_ = max(max_, tmp + nums[i]) tmp = tmp + nums[i] else: max_ = max(max_, nums...
true
63caa55e59feed357d665003bc3625e33f0f84f3
DaHuO/Supergraph
/codes/CodeJamCrawler/16_0_4_neat/16_0_4_efz1005_problem4.py
UTF-8
297
2.84375
3
[]
no_license
__author__ = "Enric Florit <efz1005@gmail.com>" num_test_cases = int(raw_input()) cases = [] for i in xrange(num_test_cases): cases.append([int(i) for i in raw_input().split(" ")]) for i in xrange(num_test_cases): print "Case #" + str(i + 1) + ":", for j in xrange(1, cases[i][0] + 1): print str(j), print
true
2dfccb836789217c4a1f07525c0693ebd3777b95
SamToorchi/2DESAttack
/meetinthemiddle.py
UTF-8
5,031
3.640625
4
[]
no_license
#!/usr/bin/env python import binascii import itertools from pyDes import des from pyDes import CBC import sys # Our IV is 5edcc504 # Instructions # * Use the skeleton code provided here. # * Use the DES library as shown in twodes.py # * Use binascii's (un)hexlify to convert between bytes and hex # representation. W...
true
b7f8a5c97501858600d7321d0be8b9f1fb18112a
Omar97perez/HerramientaMasterIngenieriaInformatica
/server/Algoritmos/Joblib/StrategyFile.py
UTF-8
612
2.6875
3
[]
no_license
#-*- coding: utf-8-*- import matplotlib.pyplot as plt import pandas as pd class File: def __init__(self, file, fichero): self.file = file self.fichero = fichero class Csv(File): def collect(self): return pd.read_csv(self.file) class Json(File): def collect(self): df = pd.read_json...
true
d5c0687fec61cf4e2f450da3e6c6848fcfb55e1c
leasttt/think-more
/scikitlearn/normalization.py
UTF-8
1,203
2.671875
3
[]
no_license
from sklearn import preprocessing import numpy as np from sklearn.cross_validation import train_test_split from sklearn.datasets.samples_generator import make_classification from sklearn.svm import SVC import matplotlib.pyplot as plt a = np.array([[10, 2.7, 3.6], [-100, 5, -2], ...
true
d9f2869b09fed2a14e6f1ad4b15c04810a1e4edc
pyarepiyush/P3-Wrangle-OpenStreetMap-Data
/function to update county values.py
UTF-8
213
3.5
4
[]
no_license
# Update county values def update_county(county): # remove , CA from county names if exists if ',' in county: pos=county.index(",") county=county[:pos] return county
true
2bcafc8f3557bfe83703a23e6b2a3c203e2cbc35
jsqihui/lintcode
/Merge_Sorted_Array_II.py
UTF-8
701
3.390625
3
[]
no_license
ass Solution: #@param A and B: sorted integer array A and B. #@return: A new sorted integer array def mergeSortedArray(self, A, B): # write your code here if not A: return B if not B: return A a = 0 b = 0 ret = [] while...
true
a77c88c151a8a6c87454073103962f5555977440
YChanHuang/Python-for-every-body-notes
/ch8/t.py
UTF-8
195
2.953125
3
[ "MIT" ]
permissive
fh = open('mbox-short.txt') count = 0 for line in fh: if not line.startswith('From'): continue line = line.rstrip() word = line.split() count = count + 1 print(line)
true
9eb448c016477a3a0053aa86dfb86e055af15d28
fholzi8/ACI
/aci-scripts_py2csv/Build/scripts/py/vlan_pool.py
UTF-8
2,612
2.796875
3
[]
no_license
# # Purpose : Cretes Fabric VLAN Pools # import csv import datetime import os xmlfile = './../xml/vlan_pool.xml' # output datafile = './../input/vlan_pool.csv' # input def FIELDNO(number): return number # zero based csv col index poolname = FIELDNO(0) allocmode = FIELDNO(1) vlanfrom = FIELDNO(2) ...
true
066c51769e9d323ac8e9d48a950067de67704a0a
darshans0200/Time-series-forecasting
/log.py
UTF-8
514
2.765625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 30 19:23:54 2019 @author: Darshan """ import logging logging.basicConfig(filename='app.log', filemode='w', format='%(asctime)s - %(message)s', datefmt='%d-%b-%y %H:%M:%S',level=logging.DEBUG) logging.warning('This is a Warning') logging.debug('Thi...
true
044a5a8e55313781e9cf70b0e810feba74346da6
lbaligand/myportfolio
/src/db_backend.py
UTF-8
1,139
2.9375
3
[ "MIT" ]
permissive
""" Contains class definition for database backend. Has utility functions. Uses SQLAlchemy so that switching DBs is seamless """ import datetime import logging from sqlalchemy import create_engine, MetaData from dash_app.config import DB_PATH, transaction_table logger = logging.getLogger() class DBBackend: de...
true
290fa0bdf3d8b1be7a6489fce209bc29c6736ed2
ZombyDogs/Ludobots
/twitch_plays_robotics/vestibularSensor.py
UTF-8
490
2.609375
3
[]
no_license
import constants import numpy as np import copy class VESTIBULAR_SENSOR: def __init__(self, ID = 0 ,objectIndex = 0 ,simulator = None): self.ID = ID self.objectIndex = objectIndex simulator.Send_Vestibular_Sensor(ID=self.ID , objectIndex=self.objectIndex) def Get_Data_...
true
31927bd9cf1c358e324b691ab15d17fb99763e8e
lwtao/augur
/k_tool.py
UTF-8
3,019
2.765625
3
[]
no_license
import talib as tl import numpy as np import functools def macd_cn(close, fast_period, slow_period, signal_period): # short_win = 12 # 短期EMA平滑天数 # long_win = 26 # 长期EMA平滑天数 # macd_win = 20 # DEA线平滑天数 macd_dif, macd_dea, macd = tl.MACDEXT(close, fastperiod=fast_period, fastmatype=1, slowperi...
true
962205f5118d0b3ec73655cb83799eaaa0c221e5
jiwootv/jiwooproject
/공부/3-3 def 복습/3 - 3_2 class 복습.py
UTF-8
389
3.390625
3
[]
no_license
class Clac: def __init__(self, a_class, b): self.a = a_class self.b = b def plus(self): return self.a + self.b def minus(self): return self.a + self.b def multriple(self): return self.a + self.b def divaid(self): return self.a + self.b a = Clac(3...
true
b4791bbffd5caf05f46e1d307673b2dc648fefc6
sohamdats/mydashapp
/dashproject/mongoGuest1.py
UTF-8
1,541
2.546875
3
[]
no_license
from pymongo import MongoClient class mongoGuest: def __init__(self): self.db = MongoClient().test def find_cpu_percentage(self,con): cpu_usage = con["cpu_usage"] system_usage = con["system_cpu_usage"] precpu_usage= con["pre_cpu_usage"] presystem_usage = con["...
true
0b97d5379d0dcf87ca99e2aa74f8d775da017fdf
kylejlynch/Fourier_Forecasting
/fourier_fit_forecast.py
UTF-8
5,128
2.75
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Jan 16 16:34:55 2019 @author: 3722270 """ import numpy as np import pandas as pd from matplotlib import ticker from sympy import Symbol, sympify import sympy as sp import scipy.optimize from symfit import Fit,parameters,variables,GreaterThan,LessThan,Equality,Pa...
true
73aab75c6117922aa21fff9c4f160a96bfc59951
wloszynski/Learning-Python-Book
/Chapter 4 Python Object Types/interactive_shell.py
UTF-8
589
3.078125
3
[]
no_license
S = 'Spam' print(S[0]) print(S[-1]) print(S[1:3]) print(S[1:]) print(S) print(S[::2]) # print(S[START:END:ITERATION]) print(S*8) S = 'duck' L = list(S) print(L) L[0] = 'h' print(''.join(L)) B = bytearray(b'mini') B.extend(b'marathon') print(B) print(B.decode()) S = 'Spam' print(S.find('am')) print(S.repl...
true
b0e82cbbf76ee06320c93fc329dc3cde77baeb8b
agerista/HR_Python
/algorithms/warmup/diagonal_difference.py
UTF-8
503
3.6875
4
[]
no_license
def diagonals(n, a): """Given a square matrix of size n x n, calculate the absolute difference between the sums of its diagonals. """ primary = 0 secondary = 0 i = 0 j = n - 1 while i < n: primary += a[i][i] secondary += a[i][j] i += 1 j -= 1 retur...
true
ce649ebc01554fc2d6a85ee3cefeae6d9a4a8717
akshat12000/Python-Run-And-Learn-Series
/Codes/163) custom_exceptions.py
UTF-8
409
3.828125
4
[]
no_license
# Python custom exception # we use this to increase readability of the code class NameIsTooShortError(ValueError): # by this we inherit our new class from ValueError so we can use it inplace of ValueError!! pass def validate(s): if len(s)<8: raise NameIsTooShortError("Too short username!") ...
true
e83d7a2e9762bc2f87e8057c83413429e306c203
ejs/cyclingants
/aco.py
UTF-8
7,227
3.328125
3
[]
no_license
#! /usr/bin/python3 from bisect import bisect from collections import Counter from itertools import accumulate, starmap from random import choice, random class PheromoneWrapper: """ Add pheromone information to any object """ def __init__(self, wraps): self.pheromones = 1 self.wraps = wraps ...
true
62e21021f826ac54f3a69d275fa17c7995026c79
wibiclint/moviegenie
/scripts/pp.py
UTF-8
604
2.796875
3
[ "Apache-2.0" ]
permissive
# Preprocess user data # Convert tabs into pipes # Turn timestamps from ms since epoch into a string that C* will like from datetime import datetime import sys import argparse parser = argparse.ArgumentParser() parser.add_argument('-t', '--timestamp-token', type=int, default=None, help='Index of field containing...
true
d6ff15107f82d5e8901cb7674ea226402fafa857
ahw/winterhook
/clusters.py
UTF-8
4,866
3.328125
3
[]
no_license
from math import sqrt def readfile(filename): lines = [line for line in file(filename)] # First line is the column titles colnames = lines[0].strip().split('\t')[1:] rownames = [] data = [] for line in lines[1:]: p = line.strip().split('\t') # First column in each row is the ro...
true
5263feb8ac1e8d24e7a31e267c2417e9d5a2e708
FYIFrankie/TokenRing
/screen_color.py
UTF-8
348
3.328125
3
[]
no_license
from blessed import Terminal term = Terminal() height, width = term.height, term.width def color(color): if color == "red": space = term.on_red(' ') print("Red") elif color == "green": space = term.on_green(' ') print("Green") """for i in range(height-2): for j in range (width): with term.location(...
true
f57310cb325335da0c618c8253096d270efbeaf1
peetck/opencv-playground
/image pyramids/main.py
UTF-8
1,398
3.296875
3
[]
no_license
import cv2 import numpy as np """ Pyramid, or pyramid representation, is a type of multi-scale signal representation in which a signal or an image is subject to repeated smoothing and subsampling. """ def image_pyramids_example(): """ image_pyramids_example function """ img = cv2.imread("lena-1.jpg") # read l...
true
4ff44ce5f1b2e6574935ce3eb2140929c29492d4
lightersss/django_blog
/blog/templatetags/extra_tags.py
UTF-8
484
2.71875
3
[]
no_license
from django import template from django.utils.text import Truncator register = template.Library() #注意在Installed app中进行注册!!!! @register.filter(name='My_truncatechars') # 过滤器在模板中使用时的name def My_truncatechars(value, arg): # 把传递过来的参数arg替换为'~' try: length = int(arg) except ValueError: # Invalid literal fo...
true
8a279b90417281374d1fd293764c6eb5265e81d2
ibrahimek76/Python-le-Kodlama-Denemelerim
/Sayıların Değerlerini Değiştiren Program.py
UTF-8
247
3.546875
4
[]
no_license
# sayıların değerlerini, değiştiren program a=(input("a :")) b=(input("b :")) print("Değiştirilmeden Önce Değerler :\na:{} b: {}\n".format (a,b)) a,b=b,a print("Değiştirildikten Sonra Değerler : \na:{} b: {}\n".format(a,b))
true
5ef812e57330be8413f2658beb4cf64d44c6b227
DDAK/autism-viz
/main.py
UTF-8
3,660
2.921875
3
[]
no_license
# -*- coding: utf-8 -*- # [START app] import logging from nvd3 import pieChart, lineChart, lineWithFocusChart from urllib2 import urlopen import json from flask import Flask, render_template from collections import OrderedDict import requests app = Flask(__name__) def get_request(path): """ Given a path, e.g....
true
abb16b18c72b60d4e8fb482f7fea6aeea527ee29
mrbartrns/introducing-to-CS
/objects/people.py
UTF-8
1,772
3.78125
4
[]
no_license
import datetime class Person(object): def __init__(self, name): self.name = name self.birthday = None self.lastName = name.split(' ')[-1] def getLastName(self): return self.lastName def setBirthday(self, year, month, day): self.birthday = datetime.date(year, mo...
true
6de0c9172e79ac770092620bc91e3c1e228eaa5e
lianshyu/YanreSprider
/v4.py
UTF-8
3,689
2.796875
3
[]
no_license
import urllib.request import re import os import time # from tqdm import tqdm # from tqdm._tqdm import trange # # # # # # # # # 高清图爬取版 # # # # # # # # # # 从第几页开始爬取 start = 1 # 搜爬取多少页 page = 3 # ...
true
315796c3c1da0ffafbee116561accb15166bc52a
Wistick/homeworks_skillfactory
/jupyter/registration.py
UTF-8
1,839
3.796875
4
[]
no_license
q = [ "stepan", "anna", "ivanova", "anna", "stepan1", "anna2", "vlad", "arina", "ivanova", "vlad_ivanov", "stepan", "arina", "stepan15", "ivanova", "arina_ivanova" ] def console(): print('Новая регистрация пользователя') print('Введите [1] для регис...
true
f1eb36602c1052456a48a88743f265c1dca5eb9c
justin13601/OligoNNv2
/core/oligo_gen_string.py
UTF-8
12,447
3.234375
3
[ "MIT" ]
permissive
import numpy as np import time # define repeat_filter = 4 # Greater than 3 repeats first_pass_filter = 0.4 # 40% gc_filter_tolerance = 0.1 # 10% palindromic_filter = 6 # Sequences greater or equal to 6 n.t. # Nucleotides # A = 1 T = 2 G = 3 C = 4 U = 5 class Oligo(): de...
true
11666a03236c2379dc32f3c7da70b4e30b8c25d6
prerak23/Arxiv-Paper-Recommender-System
/analysis_encoding/cosine_simi.py
UTF-8
2,719
2.5625
3
[]
no_license
import pandas as pd import seaborn as sns import numpy as np import matplotlib.pyplot as plt from sklearn.metrics.pairwise import cosine_similarity import matplotlib.patches as mpatches data=pd.read_csv("/home/psrivastava/Intern_Summer/data/removal_stopwords_embeds_sentence.csv") print(data.columns) sets=data.ix[2000:5...
true
96e4c317f0e132adf6cd24e2ac730e5d47c4f12d
ozmds/Sway
/py/summary.py
UTF-8
8,413
2.796875
3
[]
no_license
import math ''' method_list entry [methodname, startline, endline, longestwidth, description] class_list entry [methodname, startline, endline] ''' OPEN_CURL = '{' CLOSE_CURL = '}' OPEN_PAR = '(' CLOSE_PAR = ')' FILE_PATH = '../js/' file_list = [] FILE_DEST_PATH = '../docs/' file_list.append('circle.js') file_li...
true
ed6b1ff63c0c4a6a4bd24426545cd942b1164e5f
lzxin96/python_spider
/src/requests/binary.py
UTF-8
504
2.734375
3
[]
no_license
import requests # 抓取图像文件,其中http://t.cn/EfgN7gz是图像文件的短链接 r = requests.get('https://pics3.baidu.com/feed/c995d143ad4bd113d913527dc3047e0849fb05d2.jpeg?token=ce60f7ca1456f20d4eafbd67837ebe3f&s=66F1398D2ACB66DCF6092DDE03008033') # 输出文件的内容,不过是乱码 print(r.text) # 将图像保存为本地文件 # 保存二进制文件,需要保存在本地 # content抓取图片、pdf文档不会变乱码 with ope...
true
f551b38648d383773e44c450d69d0cd6de2bc460
riyazahamed10/flask_sql_starter_update
/models/book.py
UTF-8
563
2.78125
3
[]
no_license
from database import db class Book(db.Model): __tablename__ = 'book_details' id = db.Column(db.Integer, primary_key=True) book_name = db.Column(db.String(30), nullable=False) author_name = db.Column(db.String(30), nullable=False) def __init__(self, book_name, author_name): self.book_name ...
true
465db2a64ecaffaa22d2641a47ebfc28f0687ebd
gapigo/CEV_Aulas_Python
/Aulas/Aula 08/Aula 08c.py
UTF-8
129
2.640625
3
[]
no_license
import emoji print(emoji.emojize('17 :sunglasses:', use_aliases=True)) print(emoji.emojize('Olá, :cookie:', use_aliases=True))
true
ee6c2aec3d298ddfe0af09251a7d54f78f206d75
stevenmcateer/NLPBackend
/torch_model.py
UTF-8
14,061
2.578125
3
[]
no_license
import sklearn import torch import torch.nn as nn import numpy as np import pandas as pd from torch.autograd import Variable import torch.nn.functional as F import torch.optim as optim import sys import import_data import bcolz import pickle import re import evaluation import random import operator from spellchecker im...
true
0d6481bb2211684b581c925a823f181c7f113a37
QualiSystems/cloudshell-L1-pluribus-vle
/pluribus_vle/rest/actions/system_actions.py
UTF-8
3,469
2.515625
3
[]
no_license
class RestSystemActions(object): """ System actions. """ def __init__(self, api, logger): self._api = api self._logger = logger self.__phys_to_logical_table = None def _build_phys_to_logical_table(self): """ Get physical to logical mapping. """ logical_to_phys_dict...
true
c3a35faf5c91dd605d6455ea88626b6dbfc8cfed
jonebeabout/envgen
/envgen/envgen/interface.py
UTF-8
27,474
2.9375
3
[ "MIT" ]
permissive
import argparse import colorama from getpass import getpass from envgen import EnvironmentGenerator import os import re import urllib2 e = EnvironmentGenerator() project_dir = '' def valid_choice(choice): return isinstance(choice, (int, long)) def valid_name(name): if '.' in name: ret...
true
88b0db67b9ce1feda0e0a0f84a4028b71ae95fb2
BogdanFi/cmiN
/projects/Python/cli/cmiN/TLDownloader.py
UTF-8
2,645
2.796875
3
[]
no_license
#! /usr/bin/env python3.1 # 2.10.2009 <> 2.10.2009 | cmiN # Trilulilu Downloader (console) import sys, urllib.request class TLD: def __init__(self, args): usage = """\t\t Trilulilu Downloader 1.0 \t Usage: TLDownloader.py link Where link is a valid trilulilu.ro link \t Example: TLDo...
true
4fae1c59cd93f48e8e267d433d9cd0a5b51010c0
rubythonode/online-hurricane-ios
/OnlineSandwichesServer.py
UTF-8
15,953
2.5625
3
[]
no_license
from twisted.internet.protocol import Factory, Protocol from twisted.internet import reactor from struct import * from collections import deque from random import shuffle from twisted.internet.task import LoopingCall from time import time MESSAGE_PLAYER_CONNECTED = 0 MESSAGE_NOT_IN_MATCH = 1 MESSAGE_START_MATCH = 2 ME...
true
2969934a7dd90f8fea6b138ab87a4916e4e850df
yamaguchi-milkcocholate/adversarial_training
/src/attacks/tools/criterion.py
UTF-8
705
2.59375
3
[]
no_license
import torch from src.storage.cv import printable_colors class PhysicalRobustCriterion: def __init__(self, perturbation_coefficient=0.001): self.cross_entropy = torch.nn.CrossEntropyLoss() self.perturbation_coefficient = perturbation_coefficient self.printable_colors = printable_colors() ...
true
3444db3cb802dc07c85586db2fcaa20f0c2506c0
shilgam/coding-challenges
/python/app/test/test_leap_year.py
UTF-8
754
4.28125
4
[]
no_license
# Define a method to determine whether a year is a leap year # Правила: # * если не делится без остатка на 4 - невисокосный; # * если делится без остатка на 4 - високосный; # * на 100 - невисокосный; # * на 400 - високосный. def leap(year): if (year % 400 == 0): return True if (year % 100 == 0): ...
true
aef6f9927af4ec762c0acd68b3d8db133204f722
Costaspap/TextAnalytics
/Project_2/Project2.py
UTF-8
19,076
2.703125
3
[]
no_license
######################################################################################################## ##################################################### Imports ########################################## ######################################################################################################## ...
true
d3a413b0da2bc7dff710baed48e67c91982d11be
resb53/witcher
/riddle/convert-riddle.py
UTF-8
1,378
2.6875
3
[ "MIT" ]
permissive
#!/usr/local/bin/python3 import sys import json import re import codecs # Get the riddle text with open("riddle-text.json", "r") as f: riddle = json.load(f) f.close() # Replace \n with <br> for key in riddle: riddle[key] = riddle[key].split("\n") # Modify clues # Cyan, plaintext riddle['cyantext'] = "<br>".j...
true
615946723a8cac7cb0207ade23db0c9db4d15852
HuBoZhi/Pygame
/PyGameStudy/直线运动.py
UTF-8
1,183
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- # Time : 2019/2/3 12:07 # Author : hubozhi import pygame from pygame.locals import * from sys import exit import time background_image = './image/sushiplate.jpg' sprite_image = './image/fugu.png' if __name__=="__main__": pygame.init() screen = pygame.display.set_mode((640,...
true
021187c7716e61bc88b466b47adde84a928dcaae
mosen/salt-osx
/_modules/bluetooth.py
UTF-8
4,317
2.90625
3
[ "MIT" ]
permissive
""" Enable or disable Bluetooth and Bluetooth Discoverability via BluetoothIO Framework (private) Credit to Frederik Seiffert for original blueutil source. Credit to github/toy for discoverable state feature. NOTE: In current versions of Mac OS X, discoverability is controlled by whether the Bluetooth System Preferen...
true
1baf5cdee09f3c23d14ed2f4663774e4aff41d75
falapen/voc
/stdlib_tests/test_date_isocalendar.py
UTF-8
134
2.59375
3
[ "BSD-3-Clause" ]
permissive
import datetime for x in [datetime.date(1970, 1, 1), datetime.date(2018, 12, 31), datetime.date(1, 1, 1)]: print(x.isocalendar())
true
6a3a3c2884840f05d43eef853f36fe4381666c7b
John-sone/louplus_python
/calculator.py
UTF-8
996
3.15625
3
[]
no_license
#!/usr/bin/env python3 import sys # 设置税收起征点和社会保险金额 THRESHOLD = 3500 SOCIAL_SECURITY = 0 if len(sys.argv) == 2: try: salary = int(sys.argv[1]) except ValueError: print("Parameter Error") sys.exit() if salary > 3500: tax_owned = salary - SOCIAL_SECURITY - THRESHOLD ...
true
516719e2b4e4c5701b00d97ab15bd1a228998c8f
andraspatka/dsp-labs
/fir/fir_test.py
UTF-8
2,000
2.984375
3
[ "Unlicense" ]
permissive
import numpy as np import matplotlib.pyplot as plt from scipy.signal import freqz if __name__ == '__main__': fs = 5000 Ts = 1/fs Ns = 1024 # Generate the signal f1 = 500 f2 = 2000 t = np.arange(0, 1, Ts) x1 = np.sin(2 * np.pi * f1 * t) x2 = np.sin(2 * np.pi * f2 * t) x = x1 + x...
true
7e0a24c70fb73a69cdfbedb3006d363d52b44c99
gitmjreilly/mj_minix
/ftdi_utilities/ftdi_tester.py
UTF-8
2,176
3.03125
3
[]
no_license
#!/usr/bin/python import os import sys import serial import re def UARTBlast(SerialDevice): SerialPort = serial.Serial(port = SerialDevice, baudrate = 300) for i in range(60): SerialPort.write("M") # # Main Program is Here # def main(): print "Building ttyUSB list..." ActualDeviceList ...
true
7947e6c2e5f0235990f07c834b326d2e210feb3b
carloliveros/phyluce
/bin/attic/get_overlaps_from_lastz.py
UTF-8
4,544
2.59375
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/usr/bin/env python # encoding: utf-8 """ File: get_bed_from_lastz.py Author: Brant Faircloth Created by Brant Faircloth on 02 June 2012 15:06 PDT (-0700) Copyright (c) 2012 Brant C. Faircloth. All rights reserved. Description: Create a BED file from LASTZ alignments """ import os import random import argparse im...
true