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
8733e15fe29bf9922ffa54ac40d0c1306041e669
tomasperezmolina/anaydis
/src/main/python/practice/quixote/quixoteParser.py
UTF-8
1,140
2.890625
3
[]
no_license
import os.path as path import re import csv SRC_DIR = path.abspath(path.join(__file__, "../../../../..")) BOOKS_PATH = "".join([SRC_DIR, '/test/resources/books']) QUIXOTE_PATH = "".join([BOOKS_PATH, '/quijote.txt']) QUIXOTE_PARSE_PATH = "".join([BOOKS_PATH, '/quijote_parsed.txt']) QUIXOTE_REVERSE_PATH = "".join([BOOKS...
true
3d874e3941cfed2ab8c401424f6f68d456ac8749
SteveGoodenough/AoC-2020
/tests/test_day11.py
UTF-8
3,418
2.71875
3
[]
no_license
from src.day11 import count1, count2 from src.day11 import calc_grid, calc_grid2 def test_calc_grid(): input_data = """L.LL.LL.LL LLLLLLL.LL L.L.L..L.. LLLL.LL.LL L.LL.LL.LL L.LLLLL.LL ..L.L..... LLLLLLLLLL L.LLLLLL.L L.LLLLL.LL""" data = [line for line in input_data.splitlines()] grid = ["." + line + "."...
true
4c60056acaa8fb5fca874aab4d19616044174aca
sirvar/fast-and-furious-parking
/Gear.py
UTF-8
223
2.859375
3
[]
no_license
#gear class that blits gear image based on speed/gear from pygame import * class Gear() : def __init__(self): "initialize gear and image" self.gear = 1 self.gearImage = image.load("res/gear_"+str(self.gear)+".png")
true
2b4eda56ffcee35cf51094ac9ae29e1594793eaa
adrianomiranda14/amazon_jobs_scrape
/scrape.py
UTF-8
6,070
3.078125
3
[]
no_license
# -*- coding: utf-8 -*- """ 1. Need to create a function to pull the last page through, find the number, and input in the range for page_urls to pull through the agreement urls for all the agreements. 2. 3. Can I calc whether the advert is live or not absed on the dates? 4. Compile the data into one dataframe 5. Store...
true
d27b9916f6d678ec78e5128f630982a9260db095
DongIk-Jang/programmers_dev_course
/week1/day5/FloodFill.py
UTF-8
1,647
3.484375
3
[]
no_license
# DFS 활용한 방문 함수 # def dfs(x,y,n,m,image,d): # if x <= -1 or x >= n or y <= -1 or y >= m: # return False # if image[x][y] == d: # image[x][y] = 0 # dfs(x-1, y,n,m,image,d) # dfs(x, y-1,n,m,image,d) # dfs(x+1, y,n,m,image,d) # dfs(x, y+1,n,m,image,d) # retur...
true
aad9999e3d2003c0f69768c90fb938284b17f037
AnnHalii/Python_Hillel
/lk_5_hw/1_task.py
UTF-8
143
3.375
3
[]
no_license
file = input('Enter name of file:') if '.' not in file: raise BaseException('Incorrect name of file') else: print(file.split('.')[-1])
true
5f1be45ebcaedd208a0a32486e44b2f2a799a924
monjurkuet/tax_records_spiders
/tax_records_spiders/build/lib/tax_records_spiders/spiders/MT/mt_missoula_county_update_record.py
UTF-8
6,253
2.546875
3
[]
no_license
import scrapy from scrapy.http import Request # from scrapy.http import FormRequest from scourgify import normalize_address_record from nameparser import HumanName from ...items import UpdateTaxRecordsItem import traceback class MtMissoulaCountyUpdateRecord(scrapy.Spider): name = 'mt_missoula_county_update_record...
true
2852fbd2c899604c8cebaaf6196d6bf9d04164a3
vselosi/adalin
/script_for_i3stbar.py
UTF-8
1,333
2.59375
3
[]
no_license
#!/usr/bin/env python from urllib.error import URLError from urllib.request import urlopen import json import time import os import sys os.system("setxkbmap -layout us,ru && setxkbmap -option 'grp:alt_shift_toggle'") def getWeather(): try: response = urlopen("https://api.openweathermap.org/data/2.5/find?q=...
true
cc0da98cc000e7233b6dabff8152e756e6c6516e
mvtango/speedupeurope-graphic
/data/transform.py
UTF-8
1,612
2.609375
3
[]
no_license
import csv import sys import string # "number","title","acronym","sme","impactavg","teamavg","impactavg2","teamavg2","fiwareavg","total","smecountry","leadercountry","leadertitle","leadergender","leadername","leadermail","teamcountry2","teamcountry3","teamcountry4","teamcountry5","teamint","teamsize","agribusiness","s...
true
0aede4ac51530f6de463c72269b612d7e95d351e
akihikoy/ay_test
/python/ml/opt_ctrl1.py
UTF-8
2,828
2.578125
3
[]
no_license
#!/usr/bin/python #\file opt_ctrl1.py #\brief Optimal and adaptive control with linear regression and QP # Same problem as ../cma_es/opt_ctrl1.py #\author Akihiko Yamaguchi, info@akihikoy.net #\version 0.1 #\date Apr.20, 2017 import numpy as np import random import math import scipy.optimize from onlin...
true
f28573dbf9f2aa038612526c9da223cd50e023b7
xmiao2/wolfstudy
/wolfstudy/models.py
UTF-8
1,641
2.734375
3
[]
no_license
from . import db from werkzeug.security import generate_password_hash, check_password_hash MAX_QUESTION_TITLE_LENGTH = 200 MAX_USERNAME_LENGTH = 30 MAX_EMAIL_LENGTH = 320 HASH_ITERATIONS = 2**16 SALT_LENGTH = 64 HASH_LENGTH = 123 # Our current system generates hashes of length 123. class Question(db.Model): __ta...
true
fa0f6a13646caa11f0595f0a0e46090016c5550c
NickLee21th/_MyStrategy
/demo_multiple_process_query.py
UTF-8
2,798
2.65625
3
[]
no_license
# -*- coding=utf-8 -*- import time import sys, os import random import multiprocessing from multiprocessing import Pool, Manager class Spider(multiprocessing.Process): def __init__(self, queue): self.queue = queue multiprocessing.Process.__init__(self) self.process_num = os.getpid() d...
true
b1d365889bd02fdb4f2d324fdf25d39f350e0526
SnowWalkerJ/ShowAttendAndTell
/src/model.py
UTF-8
4,318
2.515625
3
[]
no_license
import numpy as np import torch as th import torch.nn as nn from torchvision.models import vgg19_bn class Encoder(nn.Module): def __init__(self): super().__init__() self.base = vgg19_bn(pretrained=True).features self.avgpool = nn.AdaptiveAvgPool2d((14, 14)) def forward(self, x): ...
true
14a35d4c342bcb82b6fde9ad2cf007db5efbd87d
smohapatra1/scripting
/python/practice/day29/break_continue_exercise5.py
UTF-8
123
3.234375
3
[]
no_license
my_str = "university" count = 0 for char in my_str: count = count + 1 if char == "e": break print(count)
true
ca755d189b844aead12ac7a04da46f91a140d165
Hrocyber/python_homeworks
/Machine Learning/lesson10 - DecisionTree/effects_covid.py
UTF-8
1,717
2.953125
3
[]
no_license
import pandas as pd from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier as dtc from sklearn import metrics from sklearn import tree import matplotlib.pyplot as plt covid = pd.read_csv('effects_covid.csv') # # print(alc) # #...
true
ff914631576b605d7b83376a18ef0f4cc538fee0
rubbieKelvin/bubble
/bubble/binaries.py
UTF-8
2,272
2.53125
3
[]
no_license
# this binary class, tursn bynary to string in case of sender # and in cass of recv, it turns it into filr, returning path name import os import json import base64 from PySide2.QtCore import Property, Slot, Signal, QObject IMAGE_EXTENSIONS = ["png", "svg", "jpg", "jpeg", "gif"] AUDIO_EXTENSIONS = ["mp3", "wav", "ogg",...
true
365abe455dff62b15fb4cdd02a06948dddd3df50
ankitthakur00/KLA-Intership_assignment
/main.py
UTF-8
3,234
2.59375
3
[]
no_license
import csv, os, string, uuid, json import urllib.request from app import app import json from flask import Flask, request, redirect, jsonify, send_file, render_template, make_response, Response from werkzeug.utils import secure_filename from flask import abort, send_from_directory api = Flask(__name__) UPLO...
true
ddb88b5dd845c5a3234840bf700f3a3d68fd92fc
ruizca/astromatch
/astromatch/priors.py
UTF-8
17,293
2.828125
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ astromatch module for calculation of magnitude priors. @author: A.Ruiz """ import os import warnings import numpy as np from astropy import units as u from astropy.table import Table from astropy.utils.exceptions import AstropyUserWarning from scipy.interpolate import interp1d from scipy.n...
true
4a93a674e789ab88745f56189b1ee3fa130a65cf
non-uso/wblib
/run_wer.py
UTF-8
3,046
2.53125
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, sys import argparse import base usage_str = 'input best file:' \ ' python run_wer.py --best a.best --refer a.refer --filter wer_filter --special_word <?> > wer.log \n' \ 'input nbest file:' \ ' python run_wer.py --nbest a...
true
5f4534e25ac4ea42b4ccf888b02002eba8cf617a
WassabiVl/SearchBased
/ex1/Codes/SimulatedAnnealClass.py
UTF-8
3,958
3.28125
3
[]
no_license
import random import numpy as np from typing import List from Codes.CommonClass import CommonClass class SimulatedAnneal(object): def __init__(self, initial_solution, stopping_iter: int = -1, temperature: float = -1, alpha: float = -1, stopping_temperature: float = -1) -> None: self.commo...
true
8b936b8403c6957a3a5b81761408b4f453f9c24e
LarsenClose/python-data-structures
/structures/dictionary.py
UTF-8
3,618
3.828125
4
[]
permissive
# -*- coding: utf-8 -*- '''Chained Dictionary with doubling and halving Implement a dictionary using chaining. You may assume every key has a hash() method, e.g.: >>> hash(1) 1 >>> hash('hello world') -2324238377118044897 Author: Larsen Close Version: Completed through extra credit with several extra methods impleme...
true
f0e7980ff16c4427d18192817d82848ecbf19ce0
mmsergeev1/InvestCalc
/__main__.py
UTF-8
4,015
3.515625
4
[]
no_license
# ©Moscow, 2020, Mikhail Sergeev # The project is open source, feel free to use it. The developer is not responsible for # possible financial losses resulting from investments based on data calculated by the program import Company import os import sys version = "1.1" company = Company.Company() def cl...
true
39c04bcd49df2fdb019f744a7d76585f0156a231
hanameee/Algorithm
/Leetcode/파이썬 알고리즘 인터뷰/7_배열/src/trapping-rain-water.py
UTF-8
459
3.078125
3
[]
no_license
def solution(height): if not height: return 0 answer = 0 l, r = 0, len(height)-1 l_max, r_max = height[l], height[r] while l < r: l_max, r_max = max(height[l], l_max), max(height[r], r_max) if l_max <= r_max: answer += l_max - height[l] l += 1 ...
true
2cb55a75de49d71bf12eeca030eb7da85bdb8ce4
Gambrinius/Python_Course
/week3/second_entry.py
UTF-8
224
3.53125
4
[]
no_license
string = input() first_entry = string.find('f') second_entry = string.find('f', first_entry + 1) if first_entry != -1: if second_entry != -1: print(second_entry) else: print(-1) else: print(-2)
true
61be99b080a8f1c18c6affbaf35c344c06f69770
hardikpatel043/sorting_algorithms_python
/Bubble Sort/main.py
UTF-8
404
4
4
[]
no_license
def bubble_sort(item_list): n = len(item_list) for i in range(n): swapped = False for j in range(0, n - i - 1): if item_list[j] > item_list[j + 1]: item_list[j], item_list[j + 1] = item_list[j + 1], item_list[j] swapped = True if not swapped...
true
d12b9df58442a7a791aa5b72984b61fb8fca690b
uyennguyen87/python
/MyUtils/PrintUtils.py
UTF-8
404
2.671875
3
[]
no_license
_HEADER = '\033[95m' _OKBLUE = '\033[94m' _OKGREEN = '\033[92m' _WARNING = '\033[93m' _FAIL = '\033[91m' _ENDC = '\033[0m' _BOLD = '\033[1m' _UNDERLINE = '\033[4m' def green(str): print _OKGREEN, str, _ENDC def blue(str): print _OKBLUE, str, _ENDC def header(str): print _HEADER, str, _ENDC def warning(s...
true
2e38f8449f1e850bcfdd5462b11d62d235b1b883
Stamped/Stamped
/deploy/get_dns_by_node_name.py
UTF-8
2,695
2.5625
3
[]
no_license
#!/usr/bin/env python __author__ = "Stamped (dev@stamped.com)" __version__ = "1.0" __copyright__ = "Copyright (c) 2011-2012 Stamped.com" __license__ = "TODO" import Globals from boto.ec2.connection import EC2Connection from optparse import OptionParser import sys AWS_ACCESS_KEY_ID = 'AKIAIXLZZZT4DMTKZBDQ' AWS...
true
cffe3e8230342d1926cc7ef0b7e2227e8f81d00c
qintian0321/mtDNA_identification_scripts
/test_multi_processing.py
UTF-8
673
2.953125
3
[]
no_license
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: chris # # Created: 04/04/2018 # Copyright: (c) chris 2018 # Licence: <your licence> #------------------------------------------------------------------------------- from multipro...
true
c9f873d66ca01db39968feac8f2dba4ddab323fd
rafitc/actimo
/python/flask/foo.py
UTF-8
891
2.71875
3
[]
no_license
from firebase import firebase import json countor = 198 COUNTOR_MAX = 200 countor_flag = False next_flag = True count = 0 firebase = firebase.FirebaseApplication("xxxxxxxxxxURLxxxxxx", None) result = firebase.get('Accelerometer', '') json_object = json.dumps(result, indent = 4) js = json.loads(json_object) def de...
true
209c27fc27868d20ab94f8a1ea5143ae69aeef9a
Bckant20/Hangman2
/Hangman.py
UTF-8
694
3.390625
3
[]
no_license
import random WORDLIST = [""] updatedWord = "" secret = "" letter = "" def initialize(): print "We have a secret word" print "_ _ _ _ _" def getLetter(): global letter letter = str(raw_input('ENTER YOUR GUESS: ')) print ('YOUR GUESS: ' + letter) def fillLetter(): pos = SECRET.find(letter) ...
true
c7d8127056235401fca921f11629ef2bb8b4300c
ytianxia6/pyzwcad
/tests/test_cached_a.py
UTF-8
2,221
2.703125
3
[ "BSD-2-Clause" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import os, sys sys.path.insert(0, os.path.abspath('..')) import unittest import mock from pyzwcad.pyautocad.cache import Cached class C(object): def __init__(self): self._x = None def getx(self): print("get x...
true
457eec7c13541289eb8adf10ae0daf2f5600490f
acwgough/foreground_moments
/foreground_functions.py
UTF-8
33,817
2.640625
3
[]
no_license
#===================================================================== #-------IMPORT NEEDED PACKAGES--------------------------------------- #===================================================================== import numpy as np import matplotlib.pyplot as plt import healpy as hp from math import pi import scipy.spec...
true
d06883a9bd86ebc59558a53457cac1108c082b7c
rtyh12/wawa
/wawa/tuples.py
UTF-8
1,483
3.546875
4
[]
no_license
# coding: utf-8 import os import re def readMessages(file): """Read messages from a WhatsApp file and returns them as a list. The messages are not parsed (return value consists of strings containing the date, time, name, as well as the message contents).""" lines = file.readlines() m...
true
998531c965d865e459c064e36a7ede523127a543
rob-b/battleship
/tests/test_grid.py
UTF-8
3,036
2.96875
3
[]
no_license
import pytest from pprint import pprint @pytest.fixture def five_grid(): from example import make_grid return make_grid(5, 5) @pytest.mark.parametrize(("x", "y", "expected"), [ (12, 23, (12, 23)), (4, 5, (4, 5)), ]) def test_create_grid(x, y, expected): from example import make_grid grid = m...
true
812b10880e3bb6a643b09f6e46a7adf1e244bd22
Ilya1991/text_normalization
/ML/utils.py
UTF-8
623
2.671875
3
[]
no_license
from ML.class_prediction import ESTIMATOR_PATH as CLASS_DETECTOR_PATH from ML.preprocessing import series2vec, word2vec from sklearn.externals import joblib from pandas import Series CLASS_DETECTOR = joblib.load(CLASS_DETECTOR_PATH) def predict_class(input_data): """ Predict class of object :param input...
true
f21aeaf23136dc7924ffa629d3cdd774d124acf2
dipak-pawar131199/pythonlabAssignment
/Conditional Construct And Looping/SetA/FindprimeNum.py
UTF-8
648
3.859375
4
[]
no_license
# Program to display all prime numbers within an interval # Defination :Prime number is a number whitch is divisible by one or itself # eg. num=3 which is divisible by 3 and 1 only def prime(num): i=2;flag=False while i<=num/2: if num%i==0: ...
true
112132a3923ed5702564de5ac6642c3d0a25deac
UG-SEP/Data-Structure-and-Algorithms
/Leetcode/Sqrt(x)/DSA_square_root.py
UTF-8
397
3.59375
4
[ "MIT" ]
permissive
import numpy #NumPy a library useful in multi-dimensional arrays and matrices, and its operations class Solution: def mySqrt(self, x: int) -> int: m=int(numpy.sqrt(x)) #square root func in NumPy which takes single argument.. return m ''' Input: x = 8 Output: 2 Explanation: The square root of ...
true
412a8d044b8d2e973179d415af509a3cc1cb24ef
Lambipapp/AnimalFactBot
/bot.py
UTF-8
1,189
2.859375
3
[ "MIT" ]
permissive
import logindetails import praw import time animals = [' dog ', ' dogs ', ' cat ', ' cats ' ' rabbit ', ' rabbits '] def login(): print("Account login") r_instance = praw.Reddit( username=logindetails.handle, password=logindetails.pw, client_id=logindetails.cId, ...
true
a9776510ee04fe1d71acf247b564f8c2acfc49ff
zhiyongzhang87/PythonProjects
/SqlTools.py
UTF-8
2,046
2.546875
3
[]
no_license
from enum import Enum import mysql.connector import pyodbc import pandas class DatabaseType(Enum): MySql = 1 MsSqlServer = 2 class SqlExecutionResults(object): def __init__(self): self.hasError = False def ExecutionResult(self, results): self.executionResult = results def...
true
2b8e6b548942d68b4dd78832b70aa8f8e1ac8e64
Arnaudf59/Python-bases
/les-bases/LesDocuments.py
UTF-8
884
3.25
3
[]
no_license
import os import random # Insertion etudiants_liste = ["Arnaud", "Maud", "Thomas", "Floran", "Yannick", "Manu", "Juliette"] with open('etudiants.txt', 'w+') as file: for etudiant in etudiants_liste: file.write(etudiant + "\n") file.close() # Lecture de fichier # Création repas_liste = ["kebab", "...
true
2ac678b83680c634e33f0244e13ea612020c5215
chason/jindo
/tests/test_utils.py
UTF-8
732
3.734375
4
[ "BSD-3-Clause" ]
permissive
from jindo.utils import sinsert, camel_to_human def sinsert(original, new, pos): '''Inserts new string inside original string at pos''' return original[:pos] + new + original[pos:] def camel_to_human(original): #Index where capital letters are i = 0 for s in original: if s.isupper(): ...
true
463e7d65b2c27251e336a2c6baabf32e9bdbcee3
agardner85/QuickReferences
/Python/Create and update a file/main.py
UTF-8
753
3.53125
4
[]
no_license
import json import os # check if file exsisnts if os.path.isfile('./ages.json') and os.stat('./ages.json').st_size != 0: # read the file in question old_file = open('./ages.json','r+') # bring in the jason object and convert it to a python object data = json.loads(old_file.read()) print('current ag...
true
cd94ffe09028608294ad33ea70599abde76c4c25
KaiyouHu/Evolutionary
/src/com/kaiyouhu/pygmo/problem/udp_schaffer.py
UTF-8
1,165
3.125
3
[ "MIT" ]
permissive
# !/usr/bin/env python # -*- coding:utf-8 -*- # Author: kaiyouhu@gmail.com # a test function for multi - objective optimization being introduced # in Schaffer, J.David (1984).Some experiments # in machine learning using vector evaluated genetic algorithms # (artificial intelligence, optimization, adaptation, pattern r...
true
5d82af6eebedacb93318f900f802a62bf8492869
brown-ccv/workshop-python-2020
/week_1/tests/lab3_p4b.py
UTF-8
585
3.09375
3
[ "MIT" ]
permissive
test = { 'name': 'lab3_p4b', 'suites': [ { 'cases': [ { 'code': r""" >>> # The variable name is incorrect. >>> # It should start with var1_ and end with the variablee type (int, flt, str, etc). >>> 'var1_int' in vars() True """ },...
true
42db76540eb58de71b3d4bbe9a49190ea818f926
rowaxl/WAMD102
/pyTraining/p4/classTraining.py
UTF-8
185
3.375
3
[]
no_license
class Person: def __init__(self, name): self.name = name def greeting(self): print(f"Hi, good morning. I'm {self.name}") steveJobs = Person("Steve Jobs") steveJobs.greeting()
true
75a15a2c6978d76038d489e678db9ed232a5b327
darsovit/AdventOfCode2018
/Day14/Day14.5.py
UTF-8
1,555
3.3125
3
[]
no_license
#!python ''' Advent of Code 2018, Day 14 https://adventofcode.com/2018/day/14 ''' state = {} state['scores'] = bytearray() state['scores'].append(3) state['scores'].append(7) state['Alice'] = 0 state['Bob'] = 1 state['scorematch'] = 0 state['scoreToMatch'] = bytearray() state['scoreToMatch'] = [5, 8, 0, 7, 4, 1] numR...
true
eb331d90a812132e331d9c5449051e55ca11c6f8
Onedas/PaperCrawler
/CVPR_crawler.py
UTF-8
3,032
2.796875
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys import argparse import os def get_cvpr_papers(years=2020, keyword=None): url = f'https://openaccess.thecvf.com/CVPR{years}' driver_path = 'chromedriver/chromedriver.exe' options = webdriver.ChromeOptions() options.add_argument('headle...
true
e35eba2d0df9c5a59e9e66e71b1a07d1b7f41749
laferrieren/HoloClean-old
/holoclean/learning/accuracy.py
UTF-8
3,195
2.78125
3
[ "Apache-2.0" ]
permissive
class Accuracy: def __init__( self, dataengine, path_to_grand_truth, dataset, spark_session): self.dataengine = dataengine self.dataset = dataset self.path_to_grand_truth = path_to_grand_truth self.spark_session = spark_ses...
true
d1773792ceed4bf4f262ad9563ad6230665dc9c4
andydonzelli/cs1951a-blog
/not-website/scripts/visualizations/ny_map/plot_locations.py
UTF-8
8,099
2.90625
3
[]
no_license
import matplotlib.pyplot as plt import csv import numpy as np from argparse import ArgumentParser ''' SYNOPSIS python plot_locations.py --infile file.csv --imgfile file.jpg/png... ''' SECONDS_PER_DAY = 86400 #ffd253 color_dict = {"Uber":"#000000","yellow_taxi":"#ffd253","citi":"#00c8fc","green_taxi":"#90EE90","Ly...
true
f5366552777232fde6a6d30222b4d51a2ac659e5
AndreasMadsen/bachelor-code
/test/test_sutskever_decoder.py
UTF-8
3,087
2.765625
3
[ "MIT" ]
permissive
import test from nose.tools import * import numpy as np import theano import theano.tensor as T import dataset import neural def test_sutskever_decoder_fast(): # obs: 2, dims: 4, time: NA b_enc = np.asarray([ [1, 0, 1, 1], [0, 2, 2, 0] ], dtype='float32') b_input = T.matrix('b_enc', ...
true
1483c438d4078171930cccd4fcdb7bec1943ab03
khoom1/Introduction-to-Optimisation-Project
/Problem3/main.py
UTF-8
2,702
2.953125
3
[]
no_license
import networkx as nx import numpy as np import matplotlib.pyplot as plt import scipy as sc from serial import do_serial from parallel import do_parallel def create_problem(num_nodes): G = nx.scale_free_graph(num_nodes) incidence_matrix = -nx.incidence_matrix(G, oriented=True) # s and t are dense, with el...
true
079e54876b8031e2a0c7f37ef0ab5fbafa9bb5a8
4paradigm/AutoX
/autox/autox_recommend/recall_and_rank/recalls/history_recall.py
UTF-8
1,669
2.71875
3
[ "Apache-2.0" ]
permissive
import pandas as pd import numpy as np import os from tqdm import tqdm import datetime import gc def history_recall(uids, data, date, uid, iid, time_col, last_days=7, recall_num=100, dtype='train'): assert dtype in ['train', 'test'] if dtype == 'train': begin_date = datetime.datetime.strptime(date, '%...
true
c3e67d901e0759edd0308d999ad2adff78b1ad78
Genises/H-BRS_NeuralNetworks
/Living skin detection [MLP, SVM, RBFN]/NN_Project_RBFN.py
UTF-8
3,918
3.390625
3
[]
no_license
class RBFN(object): def __init__(self, hidden_dimension, sigma=1.0): """ Radial basis function network (RBFN) # Arguments hidden_dimension: Integer indicating number of radial basis functions sigma: Float indicating the precision of the Gaussian. """ ...
true
07403637e7eaf8267b98b5efa4c17442edcd0f32
victorhugof94/Python
/Exercicios/Desafio005.py
UTF-8
156
3.671875
4
[ "MIT" ]
permissive
n1 = int(input('digite uma valor:')) n2 = n1-1 n3 = n1+1 print( 'o valor digitado foi {}, o anterior a ele é {} e o superior a ele é {}'.format(n1,n2,n3))
true
47c691ed2bba8437e5f071820573eb49fdb875ff
iisdd/Courses
/莫烦强化学习/PPO/simply_PPO.py
UTF-8
8,888
2.8125
3
[ "MIT" ]
permissive
""" 立杆子,真能train起来, 我服了 """ import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import gym EP_MAX = 1000 EP_LEN = 200 GAMMA = 0.9 A_LR = 0.0001 C_LR = 0.0002 BATCH = 32 A_UPDATE_STEPS = 10 # 每次pi采样之后actor更新多少次 C_UPDATE_STEPS = 10 S_DIM, A_DIM = 3, 1 # S: cos(theta), sin(th...
true
09c236f6a168f3df01199d9eb81bd17fa3674081
kmdmonu/python
/words reverse the order of two words .py
UTF-8
92
3.109375
3
[]
no_license
S=input().split() string =[] for i in S: string.insert(0,i) print(" ".join(string))
true
13d446850155c3adf35a900817d22af7eeb840a7
booyoungxu/person_reid
/utils/osutils.py
UTF-8
213
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- import os import errno def make_dir(path): try: os.makedirs(path) except OSError as e: if e.errno != errno.EEXIST: raise ValueError('make dir error!')
true
b36b9da4df0e4637de0e3b060105249f9a7cdcdc
pxrg/puzzles
/palavra_prima.py
UTF-8
861
3.921875
4
[]
no_license
#-*- encoding:latin1-*- # Palavras Primas # http://dojopuzzles.com/problemas/exibe/palavras-primas/ import string import math def retorna_total_palavra(): letras = string.ascii_letters palavra = raw_input("Digite uma palavra: ") if not palavra.isalpha(): print "Digite apenas letras!!" retu...
true
f53700de107c8e847759ab7fc2eb0247b4c77572
Aasthaengg/IBMdataset
/Python_codes/p02953/s183440579.py
UTF-8
342
3.09375
3
[]
no_license
N = int(input()) A = list(map(int,input().split())) # 後ろ向きに考える # 各要素は基本的に大きくしたいので、そのまま、もしくは # うまくいかない場合にのみ、1減らす ans = 'Yes' for i in range(N-1, 0, -1): if A[i] < A[i-1]: A[i-1] -= 1 if A[i] < A[i-1]: ans = 'No' break print(ans)
true
c98af4dae27b900e90132b63afac8337993a0179
A-nony-mous/CreateGirlsMoe
/src/model/utils.py
UTF-8
1,337
2.8125
3
[ "MIT" ]
permissive
__author__ = 'Wendong Xu' import numpy as np hair = ['blonde hair','brown hair','black hair','blue hair','pink hair', 'purple hair','green hair','red hair','silver hair','white hair','orange hair', 'aqua hair','gray hair'] eyes = ['blue eyes','red eyes','brown eyes', 'green eyes','purple eyes'...
true
2d609a26b5ae424ce930c63ba20def4d8615d77e
rtslt/vistec-nested-ner-corpus
/utils/utils_data.py
UTF-8
2,801
2.765625
3
[]
no_license
import glob import json from collections import Counter import pandas as pd def sort_dict_freq(counter_dict, MINCOUNT=1, reverse=True): my_dict = [(w, c) for w, c in counter_dict.items() if c >= 1] my_dict = sorted(my_dict, key=lambda item: item[1], reverse=reverse) return [w[0] for w in my_dict] def l...
true
1a39048c5d0fef65f95d81ab8da167a72ecd0e81
marianodo/proyecto-integrador
/sendEmail.py
UTF-8
1,109
2.65625
3
[]
no_license
import smtplib class responseEmail(object): def __init__(self, toMail,mensaje,asunto): self.to = toMail self.mensaje =mensaje self.asunto = asunto def send(self): gmail_user = 'vigilancialac@gmail.com' # escribe tu passw...
true
20a8d98b68ee25ed2ce25b7d72dc0855122eb10d
abgoswam/cs224u
/_hw4_trials4.py
UTF-8
333
2.515625
3
[ "Apache-2.0" ]
permissive
import numpy as np from skimage import color as clr a = np.array([0.2722222222222222, 0.5, 0.73]) a = a.reshape(1, 1, -1) # p, q, r = np.meshgrid(range(3), range(3), range(3), indexing='ij') # # a[0] * p.flatten() # a[1] * q.flatten() # a[2] * r.flatten() a_rgb = clr.hsv2rgb(a) b = np.concatenate((a, a_rgb), axis=N...
true
09a512e51368685f4717e61588df598e7ac9a544
Aasthaengg/IBMdataset
/Python_codes/p03423/s909444534.py
UTF-8
56
3.234375
3
[]
no_license
a = int(input()) if a<=2: print(0) else: print(a//3)
true
2e8b95fef637c60f943ef9631c701dde1968f246
adamv/c64-utils
/lib/dir.py
UTF-8
3,890
2.703125
3
[]
no_license
#!/usr/bin/env python from __future__ import with_statement import sys import os from c64.formats import d64, d81, t64, basic from c64.formats.cbmdos import GEOS_FILE_TYPES USAGE = """ List the contents of a 1541 (d64) or 1581 (d81) disk image. List the directory: ./dir.py <disk image name> Display a file ...
true
daf3b678f1b194ea16a872ea2a863a187c7f84d3
maprihoda/learning-spark
/ch03_structured_apis/sf-fire-calls.py
UTF-8
7,618
2.765625
3
[]
no_license
# To add a new cell, type '# %%' # To add a new markdown cell, type '# %% [markdown]' # %% import os from settings import DATA_DIRECTORY from pyspark.sql import SparkSession from pyspark.sql.types import StructType, StructField, StringType, IntegerType, BooleanType, FloatType import pyspark.sql.functions as F spark ...
true
2784d914e94a3134c77f583a00474254a922b91e
AdityaKhokhar/AIoTCloud_Vision
/intrusion_detection.py
UTF-8
921
2.59375
3
[]
no_license
import cv2 import numpy as np cap = cv2.VideoCapture("Intrusion_1.mp4") kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3,3)) kernel_dil = np.ones((20,20), np.uint8) subtractor = cv2.createBackgroundSubtractorMOG2(history=20, varThreshold=25, detectShadows=True) while True: ret, frame = cap.read() ...
true
8495ab773584ad2794ea525e8990710e54c47974
GuildGamer/Project-Euler
/euler254.py
UTF-8
1,357
4.0625
4
[]
no_license
#gets the sum of the factorials of the characters of an integer. def f(num): a = str(num) digit_map = map(int, a) num_list = list(digit_map) list_sum = 0 for i in range(0, len(num_list)): list_sum = list_sum + factorial(num_list[i]) return list_sum #gets the sum of the characters of the ...
true
37c8c0e76cb086750c70f70253a85ef8b8eaac73
cgisala/Project3_Spring2021
/email_validation.py
UTF-8
841
3.84375
4
[]
no_license
# Validates email addres to ensure it has @ and . characters def validate_email(email): while True: # Loops until the the email is correct. if email.find('@') != -1 and email.find('.') != -1: # checks to make sure @ and . are in the email if email.find('@') < email.find('.'): # checks to make s...
true
4a4a39ddd81516e91681ddb76200d6e59a029320
bgruening/galaxytools
/chemicaltoolbox/pgchem/pgchem/db_similarity_search.py
UTF-8
4,108
2.546875
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Input: File with a single molecule or SMILES string Output: Similar molecules. """ import argparse import sys import cheminfolib import psycopg2.extras import pybel cheminfolib.pybel_stop_logging() def parse_command_line(argv): parser = argparse.ArgumentParser() parser.add_argumen...
true
631b471ceadf7a625a63bcb6a5878a10e6d84e2b
AdamZhouSE/pythonHomework
/Code/CodeRecords/2486/60625/246730.py
UTF-8
580
3.328125
3
[]
no_license
def code(string, twice): for index in range(len(string)): if '0' <= string[index] <= '9': twice = int(string[index]) elif string[index] == '[': code(string[index + 1:], twice) elif 'a' <= string[index] <= 'z': result = '' for k in range(twice):...
true
ae819e11c347502b637f186b068d2a7829d061b5
SebNik/Project-Euler
/21_1.py
UTF-8
760
3.546875
4
[]
no_license
import timeit import math def find_dividers(number): divider=1 dividers_sum=0 while divider<number/2+1: if number%divider==0: dividers_sum+=divider #print(number,divider) divider+=1 #dividers_sum+=1 #print(divider,number) return dividers_...
true
6539843b4152627393b197a00285e844056f83dc
Thorid/Advent-of-Code-2018
/AoC 2018 Day10 - part2.py
UTF-8
2,218
3.15625
3
[]
no_license
def parseFilePosition(file): fileArray = open(file).read().split('\n') parsedInput = [] for i in range(len(fileArray)): tempArray = [] first = fileArray[i][fileArray[i].find('position=<')+10:fileArray[i].find(', ')] second = fileArray[i][fileArray[i].find(', ')+2:fileArray[i].f...
true
7f625e216d4ad42c03d20bb9374fc0add2f58f3f
cosbidev/PyTrack
/pytrack/graph/distance.py
UTF-8
6,434
3.078125
3
[ "BSD-3-Clause", "BSD-3-Clause-Clear" ]
permissive
import networkx as nx import numpy as np from pyproj import Geod from shapely.geometry import Point, LineString from pytrack.graph import utils geod = Geod(ellps="WGS84") EARTH_RADIUS_M = 6_371_009 # distance in meters def get_bearing(lat1, lon1, lat2, lon2): """ Get bearing between two points. Parameters...
true
67a9fa12c8903ea8205940ff3250258b1027e95f
AdamZhouSE/pythonHomework
/Code/CodeRecords/2483/60592/244458.py
UTF-8
249
3.375
3
[]
no_license
num = int(input()) for i in range(0,num): stri = list(input()) patt = list(input()) for j in range(0,len(stri)): if stri[j] in patt: print(stri[j]) break if j == len(stri)-1: print("$")
true
d1e18b0c9c1cefd1febe7849100875da2c17e669
kelrezo/neural-networks
/Neural Networks/opencv/Object Tracker/find.py
UTF-8
1,728
2.90625
3
[]
no_license
import cv2 import numpy as np image_hsv = None # global ;( pixel = (20,60,80) # some stupid default avg = np.array([[0,0,0],[0,0,0]]) count=0 # mouse callback function def pick_color(event,x,y,flags,c): global avg,count if event == cv2.EVENT_LBUTTONDOWN: pixel = image_hsv[y,x] #you might wan...
true
9b7f74500add8a23640a184f13f4cf0516f8c292
mr-pragadeeshwaran/single-page-application
/crud_application/database.py
UTF-8
2,554
2.53125
3
[]
no_license
from crud_application import db from flask_wtf import FlaskForm from wtforms import StringField, SubmitField, RadioField, SelectField from wtforms.fields.html5 import DateField, EmailField, IntegerField from wtforms.validators import DataRequired, Email class UsersInfo(db.Model): id = db.Column(db.String(90), prim...
true
0854a46943356208dd76123b7bcacdb99e205e16
SoumyJim/Data-Structures-and-Algorithms-in-Python
/1.Python Primer/P-1.30.py
UTF-8
402
4.25
4
[]
no_license
#Write a Python program that can take a positive integer greater than 2 as #input and write out the number of times one must repeatedly divide this #number by 2 before getting a value less than 2. def divide_by_2(inp): if inp == 2: return 1 if inp <2 : return 0 count = 0 while(inp>=2)...
true
033452f4a67319c2df4acc5e0cb943c6094543a7
jananisundaresan/Computational-Finance
/Computational Finance/Assignment 1/4_naive_ev.py
UTF-8
7,480
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 16 19:23:38 2019 @author: Janani """ import pandas as pd import numpy as np import random import matplotlib.pyplot as plt from pandas. plotting import scatter_matrix from scipy.stats import skew from scipy.stats import kurtosis data=pd.read_csv("C:/User...
true
6941a928874f554d59c9c20ac0ff94a83d462296
Codeking14/panda_voice_assistant
/commentary.py
UTF-8
2,980
2.734375
3
[]
no_license
import pyttsx3 #pip install pyttsx3 import speech_recognition as sr #pip install speechRecognition import datetime #pip install datetime import wikipedia #pip install wikipedia import webbrowser #pip install webbrowser...
true
501c1dca823b440c002053a50b1e2a08d46de794
rbwinslow/hq
/test/hquery/test_relational_operators.py
UTF-8
2,963
2.625
3
[ "MIT" ]
permissive
import os import sys sys.path.insert(0, os.path.abspath('../..')) from ..common_test_util import expected_result from test.hquery.hquery_test_util import query_html_doc def test_relational_comparison_of_numbers(): assert query_html_doc('', '1.01>1') == 'true' assert query_html_doc('', '1 > 2') == 'false' ...
true
3b4a54f974def07df16f67916f71eb3c59556347
anastasiadankiv/PP
/1.py
UTF-8
811
3.453125
3
[]
no_license
def part1(num1,num2) : booll = True if(num1 < 0 or num2 <0): raise Exception('Number must be positive') if (num1 % num2 != 0): booll = False return booll def part2(s, e): arr = [] if(s <0 or e <0): raise Exception('Number must be positive') for i in range (s, e+1): ...
true
0bcdeeee83b101d1c958dd48dbf0c007ba5d4728
worldrule206/Opencv
/chapter 5/0506_calcHist[normalize].py
UTF-8
795
2.78125
3
[]
no_license
# 0506.py import cv2 from matplotlib import pyplot as plt bgr = cv2.imread('../data/lena.jpg') hsv = cv2.cvtColor(bgr, cv2.COLOR_BGR2HSV) #1 hist01 = cv2.calcHist([hsv], [0,1], None, [32, 32], [0, 256, 0, 256]) cv2.normalize(hist01, hist01, 0, 1, cv2.NORM_MINMAX) fig = plt.figure() fig.canvas.set_window_title('...
true
e815cfe239ffd14eeba8afffee7159aa7e9fe7ca
Avoluzo/MeuPrimeiroEstudoPython
/OlaMundo.py
UTF-8
205
2.96875
3
[]
no_license
# -*- coding: utf-8- -*- """calculadora autor:gustavo luz de brito """ print("calculadora do luz") num1 = input("digite um número:") operador = input("digite o operador:") num2 = input("digite um segundo número")
true
cf8516b2095344c43a4da7b3b761b5cbe73c275a
Egon2k/testframework
/testframework.py
UTF-8
1,523
2.90625
3
[]
no_license
#!/usr/bin/python import PySimpleGUI as sg def open_file(): file = sg.popup_get_file('Open testframework file', history = True, size = (70, None), file_types = (("Excel CSV", "*.csv"),) ) f = op...
true
aab9a2095df0b80497c073b1275af38fd4889a05
semeniuta/pdata
/pdata/theanoutils.py
UTF-8
3,098
3.109375
3
[]
no_license
import math import numpy as np import theano.tensor as tt def create_mask_matrix(shape, indices): """ Create mask matrix of the specified shape with 1's in positions defined in `indices` and 0's elsewhere :param shape: tuple of integers :param indices: iterable of tuples :return: mask matrix ...
true
35f94731b2f19ef770e4e2e6850fba3abd24f313
jaldag/Advent2019
/day11/day11.py
UTF-8
4,118
2.9375
3
[]
no_license
from collections import defaultdict def getIntcodeParm(modes, P, ip, parm, rBase, location = False): #Modes: # 0 = Value at that address # 1 = Value right there mode = 0 try: mode = int(modes[-parm]) except: pass if mode == 0: return P[P[ip + parm]] if not location e...
true
841879dc2bc833443d4c8e38f98fa50e3bb8023e
lukeart/adventofcode
/2020/4b.py
UTF-8
1,640
2.78125
3
[]
no_license
def main(): file1 = open('./4.lk.in', 'r') lines = file1.read() counter = 0 passports = lines.split("\n\n") for p in passports: valid = True elements = p.replace('\n', ' ').split() filtered_elements = list(filter(lambda e: "cid:" not in e, elements)) # print(len(fi...
true
fbb68367a0ba5be76c7b980488bdab307083d6cb
JeonJe/Algorithm
/백준/Silver/11286. 절댓값 힙/절댓값 힙.py
UTF-8
279
3.0625
3
[]
no_license
import heapq n = int(input()) data = [int(input()) for _ in range(n)] que = [] for d in data: #pop if d == 0: if que: print(heapq.heappop(que)[1]) else: print(0) else: heapq.heappush(que,(abs(d),d))
true
fbad613c88ea447ce5cfd909741cd788e6d588b0
grll/neural-editor
/textmorph/assess_results/logger.py
UTF-8
1,131
2.625
3
[]
no_license
import logging logFormatter = logging.Formatter('%(asctime)s [%(levelname)s] %(message)s', datefmt='%d/%m/%Y %H:%M:%S') rootLogger = logging.getLogger() consoleHandler = logging.StreamHandler() # Logging setup def logging_setup(): rootLogger.setLevel(logging.DEBUG) consoleHandler.setFormatter(logFormatter) ...
true
efc2b01a9e1bfeeae03eebcf89d88cffb64433de
rootAkash/A.I.-AND-ROBOTS
/AI based self balancing robot/arduino.py
UTF-8
618
3.34375
3
[]
no_license
import serial import time ArduinoSerial = serial.Serial('com16',115200) ArduinoSerial.reset_output_buffer() time.sleep(2) print(ArduinoSerial.readline()) count=0 while 1: #Do this forever #get input from user time.sleep(.01)#print the intput for confirmation count=count+1 if(count%2==0): ...
true
5245e5e5c2a908569363cab1dcdc4e5f3a3dff38
soulgchoi/Algorithm
/SWEA/5178.py
UTF-8
788
2.890625
3
[]
no_license
import sys sys.stdin = open('5178.txt', 'r') # def func(t): # if t < N+1: # if tree[t]: # return tree[t] # else: # if t == N//2 and t % 2: # tree[t] = func(2*t) # return tree[t] # else: # tree[t] = func(2*t) + func(...
true
640fe8a6b56e3b839e54aea60de7562257da02bf
matheuswanted/OSPF_attack
/Commom/ConnectionInfo.py
UTF-8
200
2.625
3
[]
no_license
class ConnectionInfo: def __init__(self, src_mac, dst_mac, src_ip, dst_ip): self.src_mac = src_mac self.dst_mac = dst_mac self.src_ip = src_ip self.dst_ip = dst_ip
true
ee3e8e6cb0d0258bf8c09860985bd907e5b47e26
singhalrk/Vortex-Sheet-Roll-up
/cd2.py
UTF-8
3,932
3
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jun 8 01:55:16 2015 @author: raghavsinghal """ # -*- coding: utf-8 -*- """ Created on Mon Jun 8 15:42:38 2015 @author: raghavsinghal """ from math import log,pi,atan,cos,sin,sqrt import numpy as np import matplotlib.pyplot as plt def cd2(N,T): n=float(N) z=np.ar...
true
5677f7ec0b3a11025f6c666abf899a5536518399
agammsantos/Rekomendasi_Buku_Bagus
/rekomendasiBuku.py
UTF-8
6,814
2.890625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt dataBuku=pd.read_csv('books.csv') dataRating=pd.read_csv('ratings.csv') # print(dataBuku.head()) # print(dataRating.head()) def mergeCol(i): return str(i['authors'])+' '+str(i['original_title'])+' '+str(i['title'])+' '+str(i['language_code']) ...
true
9a27ef6d62ef518fb4a2f81c6247c1a38b087fb6
OsmiumDust/classwork
/Bottle Deposits.py
UTF-8
398
3.453125
3
[]
no_license
while True: try: size1 = int(input("How many 1 liter or less bottles do you have: ")) size2 = int(input("How many more than 1 liter bottles do you have: ")) value = (size1 * 0.1) + (size2 * 0.25) value = ("%.2f" % value) print(f"Your bottle totals comes up to ${value}. \nThank you for recycli...
true
21366738f8167a876c68fb039a7b76b5a1e461a5
spelinski/CC16
/DuplicateIncDec.py
UTF-8
3,761
2.546875
3
[]
no_license
import Util def handle_inc_dec_mark(pc, letter, pairs_to_remove, old_instruction_hit_or_not): dec_pc = pc - 1 inc_pc = pc - 1 while pairs_to_remove > 0: while ("dec " + str(letter)) not in old_instruction_hit_or_not[dec_pc][0]: dec_pc -= 1 old_instruction_hit_or_not[dec_pc][5] =...
true
5fa1a98e9feee820ea05fbe877a3e0c02fafc873
pugachAG/PriceFieldOCR
/src/ocr_process.py
UTF-8
6,930
2.640625
3
[]
no_license
import zipfile import os import shutil import logging import cv2 import time from collections import defaultdict import plotly.plotly as py import matplotlib.pyplot as plt import plotly.tools as tls PROCESS_FOLDER_NAME = "process" SOURCE_FOLDER = "input" def levenshtein(s1, s2): if len(s1) < len(s2): ret...
true
15e7484662ef6e8f709d568a0174250e65af0fb8
vincent-kangzhou/LeetCode-Python
/360. Sort Transformed Array.py
UTF-8
844
3.265625
3
[]
no_license
class Solution(object): def sortTransformedArray(self, nums, a, b, c): """ :type nums: List[int] :type a: int :type b: int :type c: int :rtype: List[int] """ def f(x): return a*x**2 + b*x + c def fp(x): return 2*a*x + b...
true
2152834c6f4c32690c9279a2059cf86a3fc84641
Aasthaengg/IBMdataset
/Python_codes/p03264/s809251994.py
UTF-8
45
2.640625
3
[]
no_license
k=int(input()) ans=k//2*((k+1)//2) print(ans)
true