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
383004b6e4d91181c99c97abd7e7b16c34871828
JgamerXD/Kunstprojekt
/python/hist.py
UTF-8
980
2.8125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import cv2 import argparse import json import io parser = argparse.ArgumentParser(description='Generates histograms from a json file containing the average colors of images') parser.add_argument('input', metavar='I', nargs=1,help='Input json file') args = parser.pars...
true
9184a5b2c3a2c56ec22ef90c9b26cf6de1aa0639
cnpepper/crawler
/jifcw.com/htm_parser.py
UTF-8
7,024
2.65625
3
[ "Apache-2.0" ]
permissive
import os import pandas as pd from bs4 import BeautifulSoup # 扫描目录中的文件 file_list = [] file_dir = './html' for root, dirs, files in os.walk(file_dir): file_list = files def htm_get(path): content = '' with open(path) as f: content = f.read() return content ''' 项目名称 ctl00_ContentPlaceHolder2_...
true
c4c1f1a3e0ac463e03839234becd8fb7658bfb2b
isl-org/Open3D
/python/open3d/ml/torch/python/layers/neighbor_search.py
UTF-8
14,300
3.046875
3
[ "MIT" ]
permissive
# ---------------------------------------------------------------------------- # - Open3D: www.open3d.org - # ---------------------------------------------------------------------------- # Copyright (c) 2018-2023 www.open3d.org # SPDX-License-Identifier: MIT # ---------...
true
e625e4b7e98ac0ea19ff07a5320acea0dee75d63
tsbawa61/Basic-Python
/global3.py
UTF-8
707
4.34375
4
[]
no_license
# This is a global variable a = 0 if a == 0: # This is still a global variable b = 1 def my_function(c): # this is a local variable d = 3 a=5 print(c) print(d) print(a) # Now we call the function, passing the value 7 as the first and only parameter my_function(7)...
true
5e19871794e6d0e92d4db2e4d06708b3799d12c3
leye195/Advent_Of_Code
/solutions/2020/day4/PassportProcessing-part1 copy.py
UTF-8
527
2.921875
3
[]
no_license
''' byr (Birth Year) iyr (Issue Year) eyr (Expiration Year) hgt (Height) hcl (Hair Color) ecl (Eye Color) pid (Passport ID) cid (Country ID) ''' def solution(): f = open("/Users/yjlee/Documents/advent-of-code/solutions/day4/input.txt",'r') lines = f.readlines() answer = 0 for line in lines: if l...
true
b9347964426e56f9bffd0afa12e4eee10add3729
gcoop-libre/pilas-simonpugliese
/tecla.py
UTF-8
684
2.546875
3
[]
no_license
import pilas tecla_pulsada = pilas.evento.Evento("Nota pulsada") class Tecla(pilas.actores.Actor): def __init__(self, tipo_de_tecla, nota, x, y): imagen = "data/img/" + tipo_de_tecla + ".png" self.nota = nota self.sonido = pilas.sonidos.cargar('notas/' + nota + '.wav') pilas.actor...
true
33a1820be558e31fb86e8d6ede46f6126b3f42d9
gdeluca1/assignment_11
/src/tweet.py
UTF-8
2,726
3.15625
3
[]
no_license
from . import utils import random from nltk.corpus import opinion_lexicon from nltk.tokenize import treebank class Tweet(object): all = 'All' positive = 'Positive' negative = 'Negative' neutral = 'Neutral' def __init__(self, tweet_dict): """ Parameters ---------- ...
true
497dc2bf72936ee60cf700798b0f57411ee93431
heewei/kur
/kur/utils/network.py
UTF-8
1,749
2.609375
3
[ "Apache-2.0", "Python-2.0" ]
permissive
""" Copyright 2016 Deepgram 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 writing, software distri...
true
1dcfa68d0e7882211f187a79c52bfc5c334e4931
lbwxly/PythonStarter
/Calculator.py
UTF-8
140
3.390625
3
[]
no_license
def add(a,b): return a + b def substract(a,b): return a - b def divide(a,b): return a / b def multiple(a,b): return a * b
true
9e31d39f9da1a4701bbaeba576b458e00bfeb515
lhwwhl/news_spider
/chinanews_spider/spiders/news.py
UTF-8
1,399
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- import scrapy import re import json import time from bs4 import BeautifulSoup from scrapy.http import Request from chinanews_spider.items import ChinanewsSpiderItem class NewsSpider(scrapy.Spider): name = 'news' allowed_domains = ['www.chinanews.com'] #base_url = 'http://channel.chi...
true
5ef95049e3a51fce65cdc87290a0e085b19ee729
Guanghan/easypython
/basicIO.py
UTF-8
6,632
3.15625
3
[]
no_license
# -*- coding: utf-8 -*- """ Basic I/O: Aims at providing easy access to basic I/O operations with Python. [Volumns]: 1. Deal with folders 1.1 Create folder 1.2 Move folder 2. Deal with files 2.1 Read/Write txt files 2.2 Read/Write Json files ...
true
5baceaa75206b317bb2485546b76e2d8d37423ba
nazifamouli/Applied-Algorithm
/Leetcode/Python Solutions/Linked List/AddTwoNumbersII.py
UTF-8
1,127
3.796875
4
[ "MIT" ]
permissive
""" LeetCode Problem: 445. Add Two Numbers II Link: https://leetcode.com/problems/add-two-numbers-ii/ Language: Python Written by: Mostofa Adib Shakib Time Complexity: O(n) Space Complexity: O(n) """ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # s...
true
ad450d2e2e9fce4c2e35c4192db30224d48db157
so-jin/baekjoon
/4358 생태학.py
UTF-8
405
3.234375
3
[]
no_license
import sys cnt = 0 dict = {} # sys를 통해 한번에 입력 모두 받아주고 처리,, for line in sys.stdin: if line == '\n': break line = line.replace("\n", "") if line in dict: dict[line] += 1 else: dict[line] = 1 cnt += 1 dict = sorted(dict.items()) for i in range(len(dict)): print(dict[i][0...
true
e58a0c8b88896d3a4c0770bd1ad8252e84dc574b
aliaksei-chareshneu/python-scripts
/mmcif-aliaksei.py
UTF-8
6,075
2.703125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 ### Parses mmCIF ### Issue 1: molecule name (alternative: can be set as "nAChR" by default) import os import re from Bio.PDB import * from Bio.PDB import MMCIF2Dict def numbersInPdbxDescription(s): #checks if string contains numbers, and returns the number (or 1, if none found) ...
true
3dc0a194fbb6d9f1bcad366643bc53b12d43de00
mukeshsahani00852/calculator.py
/python calculator.py
UTF-8
1,958
3.78125
4
[]
no_license
#this is a calculator created by using python CODE---SELFP01 print("THIS IS CALCUATOR PROGRAM FOR ENTER IN PROGRAM PRESS true") res=input("RESPONCE:::") while res=="true": print("************************************************************************************************************************") print("TY...
true
a2a77018454bc9ee694750c4cd1fd2c3ea5e2e2a
uppala-praveen-au7/blacknimbus
/warGame.py
UTF-8
3,212
3.96875
4
[]
no_license
''' A war has been declared between the countries of Geekyland1 and Geekyland2. The former’s army has already occupied the battleground, which is an N * N grid. Only one soldier can stay in a single square. Each soldier is denoted by an uppercase English alphabet. However, it is suspected that three Geekyland2 spies ha...
true
c3375948009b909d397b760a8ae25fe9c762a7fe
ricky-J-Li/Concordia-Course
/COMP472/Comp472-Assignment2/output_writer.py
UTF-8
2,325
3.5
4
[]
no_license
class OutputWriter: """ This class is responsible for writing to the output files for a particular algorithm and heuristic. For example, the SOLUTION output for the first "Greedy Best First Search" algorithm, using heuristic 1, should output to the following path: "outputs/solutions/0_gbfs-h1_solution.t...
true
6fb6bbedecb18e715cc8ca2433a4b9647b10e09b
gedingyu/my_pro
/python复习/test.py
UTF-8
421
2.921875
3
[]
no_license
#coding=utf-8 def isxing(getstr): getlist=list(getstr) i=0 for i in range(0,len(getlist)-1): if '*'==getlist[i]: return 0 else: return 1 b=isxing('*b') k=1 while(k<=3): getstr = raw_input('输入') print(isxing(getstr)) if isxing(getstr)==int(0): print k ...
true
04f2e04b76ddcc89bf4d108fad60b08b9f316304
abhatia05/Udemy---Colt-Steele-Modern-Python-Bootcamp-Codebook
/08. and 09. ConditionalLogic and RPS/marvel_quotes_generator.py
UTF-8
5,181
3.921875
4
[ "MIT" ]
permissive
print("\nHeyy there! Welcome to Marvel quotes machine.\n") print("What is your name human ?\n") user_name = input() print(f"\nHeyy {user_name}, select corresponding numbers in front of your favorite superhero/villain to get one or two quotes related to them ;) ") print("\n 1. Captain America\n 2. Iron Man\n 3. Spid...
true
1f89af2a6351552d4b2c4be57fda764ca2d658c4
titaofdata/emnlp2019-NeuralWeb
/util/logger.py
UTF-8
2,878
2.59375
3
[ "Apache-2.0" ]
permissive
"""This script provides the logging utility functions for operational and training logging.""" import logging import os # create logger with 'neuralweb' logger = logging.getLogger('neuralweb') logger.propagate = False logger.handlers = [] logger.setLevel(logging.DEBUG) # create file handler which logs even debug messa...
true
8a0f8cf564b414e413f47f1979500b60fef7a856
explorerwjy/jw_anly502
/PS03/plot.py
UTF-8
282
2.9375
3
[ "CC0-1.0" ]
permissive
import pylab as pl import matplotlib.pyplot as plt def plotit(x,y): pl.plot(x,y) return if __name__ == "__main__": hand = open("wikipedia_stats.txt") x = [] y = [] for l in hand: t1,t2 = l.strip().split() x.append(''.join(t1.split('-'))) y.append(t2) plotit(x,y)
true
9f54bc3c565ed63f7efb20c6d41ddc0d23c4249c
OscarXZQ/GeneticAlgorithm
/solver_naive.py
UTF-8
5,793
2.59375
3
[]
no_license
import networkx as nx from parse import read_input_file, write_output_file from utils import is_valid_solution, calculate_happiness from utils import convert_dictionary import sys import glob import os #import basename #import normpath def solve(G, s): """ Args: G: networkx.Graph s: stress_bud...
true
a1d13e66a773b78c000b6752222c076a9935a8ce
Djabx/adventofcode2020
/2020/7/__main__.py
UTF-8
5,874
3.59375
4
[]
no_license
""" --- Day 7: Handy Haversacks --- You land at the regional airport in time for your next flight. In fact, it looks like you'll even have time to grab some food: all flights are currently delayed due to issues in luggage processing. Due to recent aviation regulations, many rules (your puzzle input) are being enforce...
true
e0a2d2b2dc50def6eb9bc655f0bc60f7d25d36b0
bibek22/project-euler
/python/43-substring.py
UTF-8
694
3.078125
3
[]
no_license
#!/usr/bin/python import time import primeMod as pm start = time.time() result = [] for each in pm.getPermut(1023456789): nu = str(each) if len(nu) < 10: continue one = (int(nu[1]+nu[2]+nu[3]) % 2 == 0) tw = (int(nu[2]+nu[3]+nu[4]) % 3 == 0) th = (int(nu[3]+nu[4]+nu[5]) % 5 == 0) fo = (...
true
edb119f1c7880a5ecbf289b514c9f0b02fad8c1e
sunilmummadi/Linked-List-1
/linked_List_Cycle_2.py
UTF-8
1,810
4.28125
4
[]
no_license
# Leetcode 142. Linked List Cycle II # Time Complexity : O(n) where n is the size of the linked list # Space Complexity : O(1) # Did this code successfully run on Leetcode : Yes # Any problem you faced while coding this : No # Approach: Using a slow pointer moving at 1x speed and fast pointer moving at 2x speed, i...
true
f50d1c2ac80859534706b421a5507b9cb36717f3
artemis-p/Python_practise
/Challenges_loops.py
UTF-8
5,193
4.71875
5
[]
no_license
# Create a function named divisible_by_ten() that takes a list of numbers # named nums as a parameter. # Return the count of how many numbers in the list are divisible by 10. def divisible_by_ten(nums): final_numbers = [] for num in nums: if num % 10 == 0: final_numbers.append(num) return len(...
true
ed6d3866af120b0287da98311c5deb8a44d25600
cedricfoucault/networks_for_sequence_prediction
/code/measure.py
UTF-8
8,676
2.59375
3
[ "MIT" ]
permissive
import io_model import numpy as np from scipy import stats import sequence from statsmodels.formula.api import ols from statsmodels.stats.anova import anova_lm import torch def get_loss(predictions, targets): loss_function = torch.nn.BCELoss() # binary cross entropy return loss_function(predictions, targets).i...
true
24608b99ae1709ad72bf2b7d78c380c2d263b0ae
claudiaps/Atividades_Grafos
/minimal-tree/minimal_tree.py
UTF-8
1,230
3.265625
3
[]
no_license
import graph def main(): first_input = input().split(' ') n_ilhas = int(first_input[0]) n_pontes = int(first_input[1]) n_sede = int(first_input[2]) gp = graph.Graph() for i in range(1, n_ilhas + 1): gp.add_vertex(str(i)) for i in range(n_pontes): ponte = input().split(' ')...
true
d5fea23986a66e2ae0f399095cbfcd5a748da843
spachev/usatf
/scrape_age_grading.py
UTF-8
2,933
2.75
3
[]
no_license
#! /usr/bin/python import requests import lxml.html import csv import datetime import sys from util import * from constants import * URL = "https://runbundle.com/tools/age-grading-calculator" SAMPLE_PACE_KM = 300 MIN_AGE = 5 MAX_AGE = 100 KM_IN_MILE = 1.60934 DIST_LIST = ["1 M", "5 K", "10 K", "15 K", "Half Marathon...
true
4da7e4d2797e9a7fdbd4b36f267e2440cde86a74
Bouananhich/Scraping
/ActuScrap.py
UTF-8
963
2.609375
3
[]
no_license
#!/usr/bin/env python from selenium import webdriver from selenium.webdriver.common.keys import Keys import time import os from openpyxl import Workbook from selenium.webdriver.common.by import By from docx import Document option = webdriver.ChromeOptions() option.add_argument("--incognito") option.add_argument("--sta...
true
3dff3495e0aeaf4790c0629a889ca057b15b566c
nagula-ritvika/Algorithms-Practice
/Linked Lists/add_numbers.py
UTF-8
1,117
3.46875
3
[]
no_license
#__author__ = ritvikareddy2 #__date__ = 2019-02-16 # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None def addTwoNumbers(l1, l2): """ :type l1: ListNode :type l2: ListNode :rtype: ListNode """ carry = 0 x, ...
true
154929e8435da25ba2615a680990c0bb002cf5e5
optionalg/Python-6
/Exercise64.py
UTF-8
887
2.859375
3
[]
no_license
# Python: 2.7.13 # # Author: Nash N. Wood # #Purpose: The Tech Acadmey - Python Course, Item 64 # Daily File Transfer scripting project # An exercise to transfer text files added or edited in the # last day to the main office #=================================================...
true
afda60cc7aa24fc8fa31182b457a480480dc90dd
nrisse/mwi-srf183
/src/evaluation/dtb_mwi_est.py
UTF-8
9,859
2.640625
3
[ "MIT" ]
permissive
""" Comparison of virtual MWI observation with estimates based on a top-hat SRF and selected frequencies. """ import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches import xarray as xr from string import ascii_lowercase as abc import os from helpers import mwi, wyo, colors from doten...
true
7d7ee3acd023b7f6f53ef01cfeaa317eb913b2b4
qmnguyenw/python_py4e
/geeksforgeeks/python/expert/8_20.py
UTF-8
1,304
3.9375
4
[]
no_license
Python | Pandas DatetimeIndex.second Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. **_Pandas_** is one of those packages and makes importing and analyzing data much easier. Pandas **DatetimeIndex.second** attribute outputs a...
true
6fd669fa5ebf751b616a0560fb14465e21b132a0
saveliyde/KR4_msg
/security.py
UTF-8
1,000
3.046875
3
[]
no_license
class security(): def __init__(self, public_key1, public_key2, private_key): self.public_key1 = public_key1 self.public_key2 = public_key2 self.private_key = private_key self.full_key = None def generate_partial_key(self): partial_key = self.public_key1 ** self.private_k...
true
df03b9e08768110c54a9e33d21af3405f3cd9837
Parquery/icontract
/benchmarks/against_others/compare_invariant.py
UTF-8
4,263
2.9375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 """ Benchmark icontract against dpcontracts and no contracts. The benchmark was supplied by: https://github.com/Parquery/icontract/issues/142 """ import os import sys import timeit from typing import List import deal import dpcontracts import tabulate import icontract @icontract.invariant(la...
true
5fefc05dac43529d1ec2cdcf3f73ac8a832c43d2
shuyiz666/Big-Data-Analytics-with-pyspark
/assignment-6/main_task2.py
UTF-8
2,470
2.5625
3
[ "Apache-2.0" ]
permissive
from __future__ import print_function import sys from operator import add from re import sub, search import numpy as np from numpy.random.mtrand import dirichlet, multinomial from string import punctuation import random from pyspark import SparkConf, SparkContext if __name__ == "__main__": if len(sys.argv) != 3:...
true
f2c083d189bb6bfed18513526b7ff2f377f6afda
lucasestini/RL-64-test-trained
/plotMap_cycle.py
UTF-8
1,014
2.84375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def plotmap(): for i in range(0,250,8): print(i) maze = np.load('mappe_64_trans/map_' + str(i) + '.npy') #maze = np.load('mappe_64_front/map_' + str(i) + '.npy') puntox = 3 puntoy = 3 puntox2 = 7 puntoy2 = 3 ...
true
1898a29bbfee20d1c23f47081980a46f03606402
k-dx2/Image_Processing_lab_7thsem
/sha/erosion.py
UTF-8
1,852
3
3
[]
no_license
import cv2 import numpy as np import copy def threshold(image): for i in range(image.shape[0]): for j in range(image.shape[1]): if image[i][j]>126: image[i][j]=255 else: image[i][j]=0 return image def erode(image): movements=[[0,0],[1,0],[0,1],[1,1],[-1,0],[0,-1],[-1,-1],[-1,1],[1,-1]] nimage=copy.deepcopy(image) ...
true
1abaa625f53c0f5d627fc9952e03166da435c4c2
syurskyi/Python_Topics
/045_functions/_exercises/templates/The_Modern_Python_3_Bootcamp/Coding Exercise 48 multiple_letter_count.py
UTF-8
321
4.09375
4
[]
no_license
# I used a dictionary comprehension. For each letter in the input string, # I make the key the letter itself ("a" for example), # and the corresponding value is the result of running count() of that letter in the string. def multiple_letter_count(string): return {letter: string.count(letter) for letter in string}...
true
7594037b99126b44cba8ee451f5487a293f93cec
qiongyu/CosmoCodes
/fitting/xi_mono/rec/stream.py
UTF-8
785
2.578125
3
[]
no_license
import numpy as np from scipy import integrate #These scripts are for adding in streaming (exp or Gaussian) and the Kaiser #factor (1+beta*mu**2)**2 def pmu_gauss(mu, k, sig, beta): return (1.0+beta*mu**2)**2*np.exp(-(k*sig*mu)**2) def pmu_exp(mu, k, sig, beta): return (1.0+beta*mu**2)**2/(1+(k*sig*mu)**2/2.)**2 ...
true
668ed6030ecc6ef34fa8e6ed81e653edf252731a
freeman-zhang/GalaQuest
/Sprites.py
UTF-8
21,140
3.265625
3
[]
no_license
''' Author: Freeman Zhang Date: May 30, 2017 Description: This is the code for sprites for GalaQuest ''' import pygame, random class Player(pygame.sprite.Sprite): '''This class defines the sprite for the paddle which is controlled by the player''' def __init__(self, screen): '''This initializ...
true
653cb1ce750659ed0c2c04a28c72e605c4a1953b
Exia-Aix-2016/Data-Project
/cli/utils.py
UTF-8
488
3.0625
3
[ "MIT" ]
permissive
from PyInquirer import Validator, ValidationError class NumberValidator(Validator): def validate(self, document): try: int(document.text) except ValueError: raise ValidationError( message='Please enter a number', cursor_position=len(document....
true
d81daef2867a2f826cdaaf82fd159dd15f6da025
michaelstecklein/StockAnalysis2
/Strategy.py
UTF-8
4,606
3.640625
4
[]
no_license
import datetime import Database import Log from StockData import Stock, SDate, SDailyData, createSDate class Strategy: ''' This class can be extended to implement various trading strategies. The following methods must be overridden by implementing classes: init(self) day(self, dayNumber) The following class...
true
13aa0c8e70255c763f3a971256f52b7b1bee2010
artkoci/FitnessBanking
/Strava.py
UTF-8
1,263
2.765625
3
[]
no_license
from stravaio import strava_oauth2 from stravaio import StravaIO import json with open('local-settings.json') as f: config = json.load(f) CLIENT_ID = config['strava_client_id'] CLIENT_SECRET_ID = config['strava_client_secret'] ACCESS_TOKEN = config['strava_access_token'] KILOMETERS = 1000.00 def get_athlete(a...
true
ad0892764cb7d7546541bb868a5e7547918860bf
HackneyChad/python-exercises
/4.4_function_exercises.py
UTF-8
10,723
4.125
4
[]
no_license
# 4.4_function_exercises.py # Hackney,_Chad # 5_Mar_19 #================================== COMPLETED =================================# print('If you see this message, the file is working properly.') #================================== COMPLETED =================================# # Exercises # Create a file named 4.4...
true
586ce4487fea00b52a21836f55d1892cf2c9d2d9
robertclemo/python-fundamentals-1
/Conditionals/conditionals2.py
UTF-8
916
3.03125
3
[]
no_license
import functions as func import os os.system('clear') maxGallonQt = 15 lowGallonQt = 2 isARental = False # flag currentStatus = float(input('Please take a look at your gas gauge and tell us how many gallons do you have left? >> ')) response = int(input('Is this a rental? 1 for yes or 2 for no >> ')) if (response ==...
true
2f3091216c00c600a9bdc4d8d41e948ca0227ff1
EvgeniyKireev/UNIX_4
/9_flask/server/code/utils.py
UTF-8
157
2.578125
3
[]
no_license
import uuid def token_generator() -> str: """Генерация токена пользователя""" return str(uuid.uuid4()).replace("-", "")
true
9f32607b910634c8c8de0c0e252d4e081581e9fd
Sergey55/dlnd_dog_breed_classifier
/net_scratch.py
UTF-8
2,583
2.546875
3
[]
no_license
import os import torch import torch.nn as nn import torch.nn.functional as F import pytorch_lightning as pl class DogsBreedClassifier(pl.LightningModule): def __init__(self): super(DogsBreedClassifier, self).__init__() self.conv1 = nn.Conv2d(3, 32, 3, 2, 1) self.conv2 = nn.Conv2d(32, 64, ...
true
1f26e3185dab64cd1d09cd0041865262d7c28fb1
AnonymouX47/ucode-2.0
/challenges/queens/gen.py
UTF-8
7,137
2.84375
3
[]
no_license
#! /usr/bin/env python3 import sys from random import randint, choice from solution import solve sys.path.append("../") from utils import * init() i = 0 # Samples n, p, k = 8, 3, 5 pieces = "q b r".split() positions = [(4, 2), (6, 4), (4, 6)] obstacles = [(2, 6), (5, 2), (8, 4), (1, 5), (4, 4)] with open(f"testcas...
true
8d4d7b6bbfb5ccef6c51bbedeaff454b871705a4
lajapathy/python-practice
/pycharm_programs/sorting/selection_sort.py
UTF-8
521
3.703125
4
[]
no_license
def selection_sort(list): start_index=0 found_new_min = False for i in xrange(len(list)-1): min = list[i] for j in xrange(i+1,len(list)): if list[j] < min: found_new_min = True min = list[j] min_index = j #Swap if...
true
0d507f5a2932976b99896da01d23a7f32c5b861b
tuhinsharma121/pybandit
/pybandit/epsilon_bandit.py
UTF-8
1,722
2.796875
3
[ "BSD-3-Clause" ]
permissive
import numpy as np import random import copy class EpsilonGreedy(object): def __init__(self, n_arms, epsilon, draw_count_list, conv_rate_list): self._n_arms = copy.copy(n_arms) self._epsilon = copy.copy(epsilon) self._draw_count_list = copy.copy(draw_count_list) self._conv_rate_lis...
true
3b90c13cc0fba21ba5997b938312993bb2cc9cf8
gineer01/programming-challenges
/python/UVA/10237_bishops.py
UTF-8
1,344
2.828125
3
[ "MIT" ]
permissive
import fileinput import collections f = fileinput.input() def build_count(vals): n = len(vals) r = [[0 for i in range(n + 1)] for j in range(n + 1)] r[1][1] = vals[0] r[1][0] = 1 for i in range(2, n + 1): r[i][0] = 1 for k in range(1, i + 1): r[i][k] = r[i - 1][k] + r...
true
7bef86c0b54b6d45d5aa5231362d5ef97cea4195
davidc1/gallery-framework
/UserDev/EventDisplay/python/datatypes/database.py
UTF-8
4,018
2.703125
3
[]
no_license
# from ROOT import evd # These classes provide the basic interfaces for drawing objects # It's meant to be inherited from for specific instances # There is a class for drawing the following things: # - Raw wire data # - hits # - clusters # - nothing else ... yet # To add a class, what you have to do is write...
true
ba232d702b09f434617b56af4ce38fda990a3ca9
wuba/qa_match
/sptm/models.py
UTF-8
20,581
2.640625
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ models implementation for runing pretrain and finetune language models using tensroflow library """ import tensorflow as tf import collections import re import math class BiDirectionalLmModel(object): """Constructor for BiDirectionalLmModel Args: lstm_dim: in...
true
db607e8de2c192488d1cde12840127396f7d6c7c
maciexu/Web-Scraping-in-Python
/CSS.py
UTF-8
3,684
4.375
4
[]
no_license
""" The (X)Path to CSS Locators """ # Create the XPath string equivalent to the CSS Locator xpath = '/html/body/span[1]//a' # Create the CSS Locator string equivalent to the XPath css_locator = 'html > body > span:nth-of-type(1) a' # Create the XPath string equivalent to the CSS Locator xpath = '//div[@id="uid"]/s...
true
2996b4d548bff7917aed0a0ad0c8fe9db1e51761
mz1290/levenshtein
/main.py
UTF-8
648
3.40625
3
[]
no_license
import csv # library required for csv read write import Levenshtein # pip install python-Levenshtein #https://pypi.org/project/python-Levenshtein/#documentation readFile = open("FILE_NAME.csv", "r") writeFile = open("output.csv", "w") with readFile: reader = csv.reader(readFile) ...
true
de22141fdd8ed2f85b53540e7eb4650d4241cf31
Maxime-Favier/Isep-informatique
/semestre1/revisions/ex6.py
UTF-8
97
3.078125
3
[]
no_license
for i in range(0,11): if i == 5: print("***********") else: print("\t *")
true
da3276e81dfd7e27a488940e21497d94e9624fa0
paul-mathieu/class-work-python-basics
/TP2_Emoticons/Q6/Q6Button.py
UTF-8
4,869
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Nov 16 19:47:50 2017 @author: MATHIEU - FANTON """ import pygame class Button: def __init__(self, sensor) : self.sensor = sensor #========================================================================== # Draws rect on pygame screen ...
true
da87c8e09a91f090b6c94fdb4ba11c4421c799e2
oamam/100knock
/09/84.py
UTF-8
1,676
2.59375
3
[]
no_license
from collections import Counter from collections import OrderedDict from scipy import sparse, io import math import pickle def main(): input_file = 'context.txt' counter_tc = Counter() counter_t = Counter() counter_c = Counter() tc_arr = [] t_arr = [] c_arr = [] N = 68083972 with o...
true
ac693ab92ccb7e3904e5c964069e42c2b3540093
kimnh16/Homework
/day13_hw_Obstacle.py
UTF-8
5,120
3.953125
4
[]
no_license
import turtle as t # turtle 모듈을 불러옴 import random # random 모듈을 불러옴 def wall(): # 벽 그리는 함수 정의 t.speed(0) # 속도를 최고 속도로 설정 t.up() # 펜을 올림 t.goto(-250,-250) # 거북이 위치를 (-250, 250)으로 이동 t.down() # 펜을 내림 for x in range(4): # 아래 과정을 4번 반복 (정사각형 그리기) t.forward(500) # 앞으로 500만큼 감 t.left(90) ...
true
2bd3eb907783328a6aa3f59c9091dc2b49e763b1
BlazeZ/DNP3Maker
/Lib/AttackType.py
UTF-8
1,219
2.734375
3
[]
no_license
from Pre_made import * from CustomPayload import * ''' What attack type are available ''' def attack_type(): print "Enter a type of attack:" attack_type = int(raw_input()) if attack_type == 1: dnp3 = custum_payload() if attack_type == 2: dnp3=dnp3_warm_start() if attack_type == 3: dnp3=dnp3_cold_start() ...
true
5021b45f8d5416b794e7c02fc2971337e830ad19
johnofsydney/python_warmups
/scrabble/scrabble.py
UTF-8
1,481
4.25
4
[]
no_license
# Write a program that, given a word, computes the scrabble score for that word. # scrabble("cabbage") # # => 14 # Letter Values # Letter Value # A, E, I, O, U, L, N, R, S, T 1 # D, G 2 # B, C, M, P 3 # F, H, V, W, Y ...
true
7c0f7aeb823c4631b66a86f05d63b2b789db753e
AkshatM/Physics180Q
/Week 2/Analysis/hwp_part2_plot.py
UTF-8
1,294
3.09375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np def f1(t): return pow(np.sin(2*t),2) def f2(t): return pow(np.cos(2*t),2) myrange = np.arange(0,370,10) values1 = float(3.334/10000)*np.array([619,204,110,400,880,1420,1760,1590,1120,540,193,128,400,960,1460,1770, 1580,1060,478,158,174,415,1060,156...
true
b46d8c9e5296051a4edf907ac71d1edcbebc217f
ForSign/Leetcode-1
/Difficulty/Hard/[126] Word Ladder II/solution.py
UTF-8
1,583
3.265625
3
[]
no_license
from collections import deque class Solution: def __init__(self): self.wordList = dict() self.ans = [] self.visited = dict() self.level = 1 self.minLevel = 2 ** 31 - 1 def findLadders(self, beginWord: str, endWord: str, wordList: List[str]) -> List[List[str]]: f...
true
316373a03fa1a35fa7c9d9c18f0a1c36d9a17e12
gulci-poz/pyref
/pyref04.py
UTF-8
1,636
4.125
4
[]
no_license
# -*- coding: utf-8 -*- # zbiory są nieuporządkowane, elementy nie powtarzają się, elementy nie są indeksowane s = set([1, 3, 5, 7, 9, 11, 13, 15, 17, 19]) t = set("Hello") print(s) print(t) # unia print(t | s) # intersekcja, w tym przypadku zwraca pusty zbiór set() print(t & s) # różnica print(t - s) # różnica ...
true
6155a3de07f6ee37b8c71ef5838c550a89b62c10
rzaluska/lzw-py
/src/entropy.py
UTF-8
1,983
2.65625
3
[]
no_license
import argparse from collections import Counter import math args = argparse.ArgumentParser() args.add_argument("-s", help="information source block size", type=int, default=1) args.add_argument("-g", help="draw hitsogram", action="store_true", default=False) args.add_argument("file", help="File to examin") p = args.p...
true
94009b44bd71e4d8307240daacad4a2103792d11
lewis2222/VehicleRecognition
/Shanghai_NewEnergy_Compete/cluster.py
UTF-8
3,530
2.9375
3
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2020/10/27 11:13 # @Author : Hou Jue # @Email : 382062104@qq.com # @File : cluster.py # @Software: PyCharm class KMeans(): def __init__(self, n_clusters: int = 8, max_iter: int = 300, tol: float = 1e-4): self.n_clusters = n_clusters self.max_iter = max_it...
true
55dca3d0322c85da11463883cfda866e1bbd7417
gkhabas76/LetsTalk
/app.py
UTF-8
1,752
3.109375
3
[]
no_license
from gtts import gTTS import speech_recognition as sr import os import webbrowser import playsound def Daisy(text): # print(text) tts = gTTS(text=text, lang='en-uk') soundSource = 'audio.mp3' tts.save(soundSource) playsound.playsound(soundSource) os.remove(soundSource) def myWords(): r ...
true
16c6c1e663a1a2d14cb786e893f3e21ea1b14f04
Lin-John/abnormity
/preprocess.py
UTF-8
3,408
3.34375
3
[]
no_license
import os import datetime import numpy as np from openpyxl import load_workbook def xls2txt(idir, odir, start, end): """Extracts columns from xlsx files and fills missing values with 'None', and combines the data belongs to the same feature in a txt file. Args: idir: the address of the folder ...
true
54b77963f53a7b6e11d4a7adedb4f70e65c165f5
chenzheng102/PythonModuleDemo
/asyncios/fors.py
UTF-8
221
3.046875
3
[]
no_license
import time def hello(): print('Hello World:%s' % time.time()) # 任何伟大的代码都是从Hello World 开始的! def run(): for i in range(1000000): hello() if __name__ == '__main__': run()
true
90465ea980d3e041211ca71ec324deb854acdd0d
EduarFlo/Examen-Unidad-3
/examen3D.py
UTF-8
4,607
3.453125
3
[]
no_license
""" Examen de Recuperación 3D Graficacion ISIC EDUARDO GONZALEZ FLORES """ import tools3d from math import sin, cos, radians, sqrt from tools3d import rotRx, rotRy, rotRz import matplotlib.pyplot as plt import numpy as np from math import cos, radians, sin, sqrt #___Coordenadas iniciales xg = [] yg = [] zg = [] #___...
true
d564e6960fc67ccde9431dd207f115c2a98dfb20
kevinpav/MySQL_Flask
/LoginRegistration/server.py
UTF-8
5,110
2.84375
3
[]
no_license
from flask import Flask, request, redirect, render_template, session, flash from mysqlconnection import MySQLConnector from flask_bcrypt import Bcrypt import re app = Flask(__name__) app.secret_key = 'MySuperSecretKey' bcrypt = Bcrypt(app) # Adjusted existing schema, added 'first_name, last_name, passwd' fields for thi...
true
13d320728e949a32302f7e23191d97b769b44d52
jjjune0304/1072_ML
/final/gbm.py
UTF-8
2,483
2.765625
3
[]
no_license
# coding: utf-8 # pylint: disable = invalid-name, C0111 import lightgbm as lgb import numpy as np import matplotlib.pyplot as plt import time from sklearn.metrics import mean_squared_error from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split def WMAE(predict,Y,weight): ...
true
56f010ab2fa035cc5042dbb4568097f03732f53d
QPC-database/amazon-codeguru-profiler-python-agent
/codeguru_profiler_agent/utils/log_exception.py
UTF-8
116
3
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
def log_exception(logger, message): logger.info(message) logger.debug("Caught exception: ", exc_info=True)
true
f059a5dda26e010b4fda0545a6e19469d0b8ee1d
piantola/introducao-a-programacao-estruturada
/modulo2/exercicio2_14.py
UTF-8
115
3.5
4
[]
no_license
lista = list() for i in range(10): lista.append(input("Digite o numero " + str(i+1) + ": ")) print(max(lista))
true
8c5667199241c35d86a34016be4f5dbc7a2952b5
lionheartStark/sword_towards_offer
/leetcode/py36/移动零N283.py
UTF-8
724
3.09375
3
[]
no_license
from typing import List class Solution: def maopao_moveZeroes(self, nums: List[int]): """ Do not return anything, modify nums in-place instead. """ n = len(nums) for i in range(n): for j in range(n - i - 1): if nums[j] == 0: n...
true
5fa41fd394489cff80cc62e805f03349fd1700f1
memkite/searchspaces
/searchspaces/test_utils.py
UTF-8
629
3.171875
3
[]
no_license
from functools import wraps from nose import SkipTest def skip_if_no_module(name): """ Decorator that skips a test if `name` cannot be imported. Parameters ---------- name : str The name of the import to depend on. Raises ------ SkipTest If the module named in `name` c...
true
c75cd6274f8f1a97db6ce6e709456522f3f473f2
Marceggl/exerciciosPythonBrasil
/4_ExerciciosListas/4.py
UTF-8
384
4.21875
4
[]
no_license
''' Faça um Programa que leia um vetor de 10 caracteres, e diga quantas consoantes foram lidas. Imprima as consoantes. ''' c = [] vogal = 'aeiou' consoantes = 0 for i in range(1, 11): letra = input('Digite o %dº caractere: ' % i).lower() if letra not in vogal: consoantes += 1 c.append(letra) ...
true
cf7c23bca2611c5152e595661ba6ae4e475ea8d6
joein/telegram_marvel_bot
/text.py
UTF-8
1,567
3.140625
3
[]
no_license
class _Text: greetings = ( "Hi, I'm Marvel Bot and I'm here to help you gather " "information about Marvel Universe." ) stop = "Okay, bye." end = "See you around!" ask_for_input = "Okay, tell me." error = "Sorry, I can't handle this now, try again later." @staticmethod ...
true
aaaaf78296a42dd8b146dd177cbd561bee2f98cd
zwotzie/raspberry-pi-heizung
/RelaisStatus.py
UTF-8
477
2.796875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import platform raspberry = False if 'raspberrypi' in platform.uname(): # global raspberry raspberry = True import RPi.GPIO as GPIO # gpio 4 = BCM 23 = Pin 16 RelaisHeizung = 23 GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(Relai...
true
d4a919b5d34ab216b6491839ef8c8cf8489e0da0
huangsam/ultimate-python
/ultimatepython/syntax/variable.py
UTF-8
1,838
4.3125
4
[ "MIT" ]
permissive
""" Variables allow us to store values in named records that can be used in a program. This module shows how to define variables and make assertions about the state of each defined variable. """ def main(): # Here are the main literal types to be aware of a = 1 b = 2.0 c = True d = "hello" # ...
true
098aeeefc060af683de0bcb7fe99e40b68833150
prashusat/Bayesian-Linear-Regression
/task3_2.py
UTF-8
6,181
3.015625
3
[]
no_license
import pandas as pd import numpy as np import math from matplotlib import pyplot as plt import random import time #fucntion to read data in pandas dataframe def read_data(data_file,regression_values_file): df_data=pd.read_csv(data_file, sep=',',header=None) df_regression_values=pd.read_csv(regression_values_f...
true
abb3d0677e432b2294d92721fc7dc205ff672e16
usnistgov/OOF3D
/SRC/TEST-SRC/testmatrix.py
UTF-8
5,110
2.734375
3
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
# -*- python -*- # This software was produced by NIST, an agency of the U.S. government, # and by statute is not subject to copyright in the United States. # Recipients of this software assume all responsibilities associated # with its operation, modification and maintenance. However, to # facilitate maintenance we as...
true
46f7256277573519cfe96e456f2fcc58ed2d41c2
GGoes01/EAISO_TCC
/EAISO/Coordenada.py
UTF-8
584
3.1875
3
[]
no_license
class Coordenada: def __init__(self, caminho): self.__caminho = caminho self.__coord = [] def ler_coordenadas(self): arq = open(self.__caminho, "r") for line in arq.readlines(): if line != 'EOF\n': cut_point = line.index(' ') cut_po...
true
601eefea782299a6140a2016271b68d37f257354
ajgreenwell/JavaClassGenerator
/src/returntypes.py
UTF-8
519
2.78125
3
[]
no_license
""" This module contains a dictionary that maps lowercased return types to their type-correct, default return values. These default return values are then used in generate.py according to the return type of each method in the corresponding interface. Written by: Andrew Greenwell """ values = { 'boolean': ' fals...
true
edb31a08948784764f5ba2fa78326dac3a8c2d2c
thesagargoyal/PYTHGON_LAB
/symmetricoflist.py
UTF-8
149
3.171875
3
[]
no_license
lis = [1,2,3,4,5,6] lis1 = [1,2,3,4,8,9] lis2=[i for i in lis if i not in lis1] lis3=[j for j in lis1 if j not in lis] lis4=lis2+lis3 print(lis4)
true
1d46cf2f3c4e7fc4f39f0fe5f39433ccb4b6bcfb
ta11ey/algoPractice
/utilities/linkedLists.py
UTF-8
322
3.125
3
[]
no_license
from algoPractice.dataStructures.ListNode import ListNode def visualize(linkedList: ListNode): output = linkedList.val head = linkedList.next while (head.val): output = f'{output} -> {head.val}' if (head.next): head = head.next else: break return outpu...
true
efaa377f7bffd505148336e50c860ee9faa38757
gsnyder206/Illustris_Morph
/RF_output.py
UTF-8
761
3.03125
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt #reads in data for the result output of the random forest result=pd.read_pickle('/Users/aquirk/Desktop/PyML_Illustris/result_cut_PC_0_0.5_105.pkl') #reads probability data from random forest probability=pd.read_pickle('/Users/aquirk/Desktop/PyML_Illustris/label_prob...
true
76bb9ddc6fa58f4fc1454bffc1a92f5d7e95a11c
adarshsaraf123/hackerrank_solutions
/Road Reforms/djikstra1.py
UTF-8
1,666
2.921875
3
[]
no_license
# Enter your code here. Read input from STDIN. Print output to STDOUT from heapq import heappush, heappop N, M = map(int, raw_input().split()) edges = [map(int, raw_input().split()) for _ in xrange(M)] neighbours = {vertex: [] for vertex in xrange(1, N+1) } for u, v, c in edges: neighbours[u].append( (v, c) ) ...
true
512a742113f2eef6fc08188c835973b1a5fb433e
pi1Mg/web_scraping_bs4
/pass/bs4/find_all_more_parameters.py
UTF-8
1,027
3.515625
4
[]
no_license
import re from bs4 import BeautifulSoup def read_file(): file = open('three_sisters.html') data = file.read() file.close() return data soup = BeautifulSoup(read_file(), 'lxml') # Signature: find_all(name=None, attrs:dict={}, recursive:bool=True, # text=None, limit=None, **kwargs) # string (text)...
true
3d6584cbcb3973ca2e4fa55f01d7e545139507f7
KunalMahi/Python-training
/PythonTraining/strings.py
UTF-8
118
2.625
3
[]
no_license
from django.template.defaultfilters import upper name="Kunal Maheshwari" strlen=len(name) print(strlen) print(upper(name))
true
dea9014db00e23e2926eecfe26a982ac51b5512f
starmap0312/refactoring
/big_refactoring/convert_procedural_design_to_objects.py
UTF-8
1,160
3.765625
4
[]
no_license
# - turn the procedural code into object-oriented code # - when you have code written in a procedural style # turn the data records into objects (data class) # break up the behavior # move the behavior into the object (move method) # - typical situation # 1) long procedural methods on a class with little data #...
true
783bef4651755bf7d11b86e2dec7d6bb9da3b3b8
aidanns/Hacker-Cup-2012
/checkpoint/checkpoint.py
UTF-8
1,848
3.296875
3
[]
no_license
import sys from collections import defaultdict import math kCacheSize = 5000 kMaxPerms = 10000000 def main(): num_cases = int(sys.stdin.readline()) for case_num in range(1, num_cases + 1): line = sys.stdin.readline() s = int(line) print "Case #" + str(case_num) + ": " + str(checkpo...
true
a04014a588e2b16f91cdf84274537c68650ddcc6
carlCarlson6/UFirstGroupAssignment
/1_transformation_script/main.py
UTF-8
707
2.609375
3
[]
no_license
from lib.EpaData import EpaData from lib.extractRawEpaData import extractRawEpaData import json print('reading file') epaFile = open('data/epa-http.txt', 'r') epaStrings = epaFile.readlines(); print('processing data') epaRawDataList = [extractRawEpaData(epaString) for epaString in epaStrings] epaData = [EpaData(epa...
true
b239b4c480373638a4bf3d80aa71914d48d18e14
Promyer/Regulus
/src/generate_total_csv.py
UTF-8
1,682
2.640625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 from scipy.io import loadmat from datetime import datetime, timedelta import numpy as np import pandas as pd rel_path = '../' # suppose that py file lies in ~/src/ mat_arr = loadmat(rel_path + 'data/imdb_crop/imdb.mat')['imdb'] urls = mat_arr['full_path'][0][0][0] urls = list(m...
true
9e1c2375ba5ce1685156b263e3ba840eac4ee946
andybr10/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python
/Midterm Exam - Problem 7.py
UTF-8
1,102
4.25
4
[]
no_license
def score(word, f): """ word, a string of length > 1 of alphabetical characters (upper and lowercase) f, a function that takes in two int arguments and returns an int Returns the score of word as defined by the method: 1) Score for each letter is its location in the alphabet...
true
83773e0a2be5e3ebf368298ff4c0135de85b9435
Sebastiaan-Alvarez-Rodriguez/Meizodon
/lib/execute/component.py
UTF-8
3,963
2.65625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python import configparser import datetime import lib.dynamic.component as comp import lib.execute.apk as apkfile import lib.execute.config as cnf import lib.execute.task as task import lib.independence.fs as fs import lib.settings as s class ExecutionComponent(object): """Object to facilitate exe...
true
6248f5d3f67b532be7c114512340c3404e5277ef
MaartenAmbergen/TICT-V1PROG-15-Maarten-Ambergen-
/Les02/Oefening2_6.py
UTF-8
166
2.90625
3
[]
no_license
naam=input('Wat is je naam: ') leeftijd=eval(input('Hoe oud ben je: ')) volgendjaarleeftijd=(leeftijd+1) print(naam+', volgend jaar ben je '+str(volgendjaarleeftijd))
true
eb6dac95fb5be7d9ce5a27b745b0756d98933860
Aasthaengg/IBMdataset
/Python_codes/p03593/s333786709.py
UTF-8
572
2.53125
3
[]
no_license
from collections import Counter as co n,m=map(int,input().split()) l=co("".join([input()for i in range(n)])).values() if n%2 and m%2: l=list(l) f=1 for v in range(len(l)): if l[v]%2: if f:f=0;l[v]-=1 else:print("No");exit() if f==1:print("No");exit() print("Yes"if(n+m...
true