blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
3bbcaf26cf7f9b12f454f1eab576bc1d55e025d1
Python
bipinkh/ai-search-algorithms
/node.py
UTF-8
852
3.21875
3
[]
no_license
class Node: def __init__(self, parent_node = None, move=None, state=None, depth=0, g=0): self.parent_node = parent_node # the anccestor of this node self.move = move # Up, Down, Left, Right self.state = state # 2D Array of state self.depth = depth self.__map() ...
true
a3c3b8de50facef60137e568588ca7513889b555
Python
aggo/jku-tcml
/tcml_a3_e5/ex5.py
UTF-8
3,261
3.625
4
[]
no_license
#!/usr/bin/python # Author: Amalia Ioana Goia # Matr. Nr.: k1557854 # Exercise 2 from pprint import pprint import math def read_data(filename): import csv, numpy as np instances = [] with open(filename, 'r') as csvfile: dataset = csv.reader(csvfile, delimiter=',') for row in dataset: ...
true
a1f7090200078ace0ebc88c38dea9352923b8c7e
Python
Anseik/algorithm
/study/정올/Language_Coder/j_102_형성평가2.py
UTF-8
108
3.15625
3
[]
no_license
text1 = 'hometown' text2 = 'Flowering' print('My {}'.format(text1), '{} mountain'.format(text2), sep='\n')
true
2aa59c82fcf8e1c3a079ff7f3c0bfa50568d6e20
Python
blueshed/chat
/chat/websocket.py
UTF-8
914
2.640625
3
[]
no_license
""" our websocket handler """ import logging from tornado.websocket import WebSocketHandler log = logging.getLogger(__name__) class Websocket(WebSocketHandler): """ a websocket handler that broadcasts to all clients """ clients = [] def check_origin(self, origin): """ in development allow ws fr...
true
3385bfa22f98c30ec746287a3dfb700265a5daca
Python
keshavjha018/Web_Automation
/test2.py
UTF-8
682
2.953125
3
[]
no_license
from selenium import webdriver PATH = 'C:\Program Files (x86)\chromedriver.exe' driver = webdriver.Chrome(PATH) import time #from selenium import webdriver from selenium.webdriver.common.keys import Keys # If you have Chromedriver In Same folder then you dont need to pass executable path... #driver = webdriver.Chro...
true
cedb3a8a6d329a28c0abc23a6caa40dec3ce508d
Python
quangxdu/cs425
/MP2/main.py
UTF-8
1,495
2.84375
3
[]
no_license
import nodes, coordinator, threading, sys continue_looping = 1 #Check if the user wants writeback writeback = 0 if len(sys.argv) > 2: if (sys.argv[1] == "-g"): outputfile = sys.argv[2] writeback = 1 f = open(outputfile, 'w') #Create new coordinator coordinator = coordinator.Coordinator() Node0 ...
true
33287f4872a2994f668586c1a4ee3f7782862d2d
Python
matanboaz/SPC
/change_in_var/prog10.py
UTF-8
2,737
2.828125
3
[]
no_license
import numpy as np import pandas as pd from scipy.stats import gamma """ This is a program for detecting a 2-sided change in the variance with known baseline s.d., unknown baseline mean, by a mixture of discretized conditional Gamma. input: ====== :x: data :sigma: s.d. :alpha1: :beta1: ...
true
aa5fa2df17add420aa420e8cdf0eb043d032edf3
Python
pranav-maddali/playlister
/app.py
UTF-8
4,290
2.71875
3
[]
no_license
from flask import Flask, request, jsonify, render_template import spotipy.util as util from spotipy.oauth2 import SpotifyClientCredentials import pandas as pd import numpy as np from sklearn.cluster import KMeans, DBSCAN from sklearn.decomposition import PCA from sklearn.preprocessing import StandardScaler app = Fl...
true
126c18c6b07f4c8879495eab2058d802378632a8
Python
tlananthu/python-learning
/00_simple_examples/07_float_int.py
UTF-8
112
2.9375
3
[ "Apache-2.0" ]
permissive
f=float(8.11) print(f) i=int(f) print(i) j=7 print(type(j)) j=f print(j) print(type(j)) print(int(8.6))
true
298fd47ef063564f220bf7491ecb427e1127c349
Python
RengarAndKhz/QuoraInterview
/InorderPreoder.py
UTF-8
1,300
3.46875
3
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None #O(n^2) every node in postorder need index of in inorder class Solution(object): '''def buildTree(self, inorder, postorder): """ :...
true
d55ccfcc528e3a67b9d180b1d739df8b431807f7
Python
Windman/AlgorithminThinking
/GraphTheory/GraphTheory.py
UTF-8
1,912
3.71875
4
[]
no_license
"""Graph theory p1 m1""" EX_GRAPH0 = {0: set([1,2]), 1: set([]), 2: set([])}; EX_GRAPH1 = {0: set([1,4,5]), 1: set([2,6]), 2: set([3]), 3: set([0]), 4: set([1]), 5: set([2]), 6: set([])}; EX_GRAPH2 = {0: set([1,4,5]), 1: set([2,6]), 2: set([3,7]), 3: set([7]), 4: set([1]), 5: set([2]), 6: set([]), 7: set([3]), 8: set(...
true
76e3b65f764f43bd105495eae79ac6da7bd359c5
Python
chae1108/wheel-of-jeopardy
/classes/Board.py
UTF-8
1,305
3.84375
4
[]
no_license
from classes.Category import Category class Board: def __init__(self, categories, round): self.__categories = self.__createCategories(categories, round) # Returns a list of category objects from the list provided by the game def __createCategories(self, categories, round): categoryObjects...
true
eda2ba42a6e803ab4a5255648286b4842fdab86f
Python
jamesaduke/toy-problems-new
/codewars/python-problems/anti_vowel.py
UTF-8
140
3.296875
3
[]
no_license
def anti_vowel(text): vowels="aeiouAEIOIU" string="" for char in text: if char not in vowels: string += char return string
true
8fd3dcf13f5dbfae9ee509ebff2c964b51b365ec
Python
carlesanton/visuall-hull-extractor
/utils/fundamental_matrix.py
UTF-8
3,129
2.625
3
[]
no_license
from sift import compute_sift_descriptor_of_image, compute_sift_matches import os import cv2 import random from matplotlib import pyplot as plt import numpy as np def compute_fundamental_matrix(): calibration_images_folder_path = os.path.join(os.getcwd(),'visuall_hull_extractor/calibration_images/v3labs') ...
true
c154487ce52e90b01243c30ea60403f7d47fb948
Python
hed-standard/hed-python
/tests/tools/util/test_data_util.py
UTF-8
9,670
2.546875
3
[ "MIT" ]
permissive
import os import unittest import numpy as np from pandas import DataFrame from hed.errors.exceptions import HedFileError from hed.tools.util.data_util import add_columns, check_match, delete_columns, delete_rows_by_column, \ get_key_hash, get_new_dataframe, get_row_hash, get_value_dict, \ make_info_dataf...
true
50670815d03c919c665b55bb569d7d59a1074110
Python
ModelSEED/PlantSEED
/Scripts/PlantSEED_v3/Template/Fix_Reaction_Curation.py
UTF-8
586
2.75
3
[]
no_license
#!/usr/bin/env python from urllib.request import urlopen import sys import json import string with open("../PlantSEED_Roles.json") as subsystem_file: roles_list = json.load(subsystem_file) reactions_list=list() for entry in roles_list: for rxn in entry['reactions']: if(rxn not in reactions_list): ...
true
bbe321005807a4bd950595eeb59f589a1cb7744c
Python
wadayamada/Tensorflow-ImageClassification
/data_preparation/keep_2_gakushu.py
SHIFT_JIS
1,358
2.8125
3
[]
no_license
from PIL import Image import os #keep_2_gakushu.py #摜̖ #data_keep_other_gazou=1101 #data_keep_latte_gazou=901 #data_keep̉摜(28,28)ɃTCYāAdataɈړ def keep_2_other(data_keep_other_gazou,name): for a in range(data_keep_other_gazou): b=str(a+1) #pXw肵ĉ摜ǂݍ image=Image.open("./dat...
true
fcfff80359a6a7596a050c81a9fc9877a666f348
Python
jmiths/PE
/Problem23.py
UTF-8
1,428
3.25
3
[]
no_license
#!/usr/bin/python # Primes by default are not abundant import math, itertools from sets import Set #primes = [1]*28125 #primes[0] = 0 #primes[1] = 0 #for num in range(0,len(primes)): # if primes[num] == 0: # continue # else: # for bad_val in range(num*num,len(primes),num): # primes[bad_val] = 0 #abun = [] #for...
true
f5cdde2a396d0330bfa9e86c19d972e91786cb40
Python
Mat4wrk/Parallel-Programming-with-Dask-in-Python-Datacamp
/3.Working with Dask DataFrames/Building a pipeline of delayed tasks.py
UTF-8
382
2.71875
3
[]
no_license
# Read from 'WDI.csv': df df = dd.read_csv('WDI.csv') # Boolean series where 'Indicator Code' is 'EN.ATM.PM25.MC.ZS': toxins toxins = df['Indicator Code'] == 'EN.ATM.PM25.MC.ZS' # Boolean series where 'Region' is 'East Asia & Pacific': region region = df['Region'] == 'East Asia & Pacific' # Filter the DataFrame using...
true
ed48cef2f6b31a439d0c974932e66974d6c5392d
Python
gplatono/lexical_resources
/pos_split.py
UTF-8
655
2.578125
3
[]
no_license
#Uncomment the lines below to download and install wordnet corpus for nltk #import nltk #nltk.download('wordnet') import nltk #nltk.download('averaged_perceptron_tagger') #nltk.download('brown') from nltk.corpus import wordnet as wn from nltk.corpus import brown from nltk.tag import pos_tag brown_news_tagged = brown....
true
90a5cd6e797608f3033109bb32dab01302c85795
Python
SeanDavis268/Mine-Sweeper
/main.py
UTF-8
9,363
3.265625
3
[]
no_license
from tkinter import * from math import * from random import randrange #print("yeet") class startUp(): '''This is the first window to pop up and it asks for the players prefered difficulty and board size. ''' def __init__(self): self.frame=Tk() self.size = 0 Label(self.frame,text...
true
70b86fb5719508e92e72ec5e281d457472a00214
Python
dbreen/connectfo
/game/scenes/main.py
UTF-8
6,701
3.046875
3
[ "MIT" ]
permissive
import pygame from game import gamestate, utils from game.constants import * from game.media import media from game.scene import Scene class MainScene(Scene): def load(self): # state variables self.set_state('running', True) self.drop_info = None # resources ...
true
ce29ecd821ffbdbde6f09ac8a847691e3a79cfa5
Python
szheng15/Computer-Vision
/pa1/assignment1.py
UTF-8
713
2.96875
3
[]
no_license
import numpy as np from scipy.ndimage.filters import convolve import skimage from skimage import color def energy_image(im): input_color_image = skimage.img_as_float(color.rgb2gray(im)) gradient_x = convolve(input_color_image, np.array([[1,-1]]), mode = "wrap") gradient_y = convolve(input_color_image, np.a...
true
8d2855c8652f3db74ad194ff17c3e0d507ad8838
Python
francisco-igor/ifpi-ads-algoritmos2020
/G - Fabio 2a e 2b - Condicionais/G - Fabio 2a - Condicionais/G_Fabio_2a_q25_senha.py
UTF-8
633
3.8125
4
[]
no_license
'''Verifique a validade de uma senha fornecida pelo usuário. A senha é 1234. O algoritmo deve escrever uma mensagem de permissão de acesso ou não.''' # ENTRADA def main(): senha = int(input('Senha do usuário: ')) verificar(senha) # PROCESSAMENTO def verificar(senha): digito1 = senha // 1000 ...
true
8659b1ac62975a7052a111f1a4529a63be538623
Python
sanjibkd/py_stringmatching
/py_stringmatching/tests/test_simfunctions.py
UTF-8
31,476
2.6875
3
[ "BSD-3-Clause" ]
permissive
from __future__ import unicode_literals import math import unittest from nose.tools import * # sequence based similarity measures from py_stringmatching.simfunctions import levenshtein, jaro, jaro_winkler, hamming_distance, needleman_wunsch, \ smith_waterman, affine, editex, bag_distance, soundex # token based ...
true
3bc30d6861e5cb0df68b40b3cfd0103d3791b270
Python
matiboy/test_contact_app
/contact/views.py
UTF-8
1,703
2.5625
3
[]
no_license
from flask import render_template, request, redirect, url_for, flash from models import MyContact def reg_views(app): db_session = app.config['DATABASE'] @app.route('/') def index(): contacts = MyContact.query.all() return render_template('index.html', contacts=contacts) @app.route('...
true
10f4d48450d0e8809143fee66ff77d61a8825d9f
Python
Shusuke-Irikuchi/X-means
/xmeans.py
UTF-8
4,073
2.9375
3
[]
no_license
"""===================================================== import =====================================================""" import pandas as pd from sklearn.cluster import KMeans import scipy import numpy as np from numpy.random import * """===================================================== ...
true
849e123943e45bf161ec1aea47d7c0c5e2785406
Python
Ojisama/breeding
/Mapping.py
UTF-8
10,239
3.171875
3
[]
no_license
from math import * from collections import deque, namedtuple DIRECTIONS = namedtuple('DIRECTIONS', ['Up', 'Down', 'Left', 'Right'])(0, 1, 2, 3) BOARD_LENGTH=32 #renvoie un tableau de taille 34*34*4 correspondant aux inputs du rĂŠseau de neurones Ă  partir du board #parcours de la grille dans le sens...
true
72635d8b1ee94439e34dd44d1f76c321a6f5fb4a
Python
LightXEthan/ServerNetwork
/socket_client.py
UTF-8
4,818
2.875
3
[]
no_license
""" CITS3002 Computer Networks Project Written by Ethan Chin 22248878 and Daphne Yu 22531975 @brief: socket client for basic_server.c extended version of the given example code """ import socket,sched,time from time import sleep # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_...
true
f2d3680ecff51f18ac623bb7f7835d752afe21bf
Python
Feipeng-Yang/python-challenge
/PyPoll/main.py
UTF-8
2,974
3.34375
3
[]
no_license
# Election result analysis for the data in "election_data.csv" # import modules import os import csv # read data from "election_data.csv" election_data = os.path.join("Resources", "election_data.csv") # initialize variables candidate_list = [] total_votes = 0 with open(election_data) as VotingResult: votes = csv...
true
65da1233d7e4464e33186b55844b91b9b19caccc
Python
AleksasVaitulevicius/masters
/3d_object_recognition_from_images/model.py
UTF-8
3,125
2.78125
3
[]
no_license
from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Dropout, Flatten, Activation, Dense # args ------------------------------------------------------------------------------------------------- epochs = 9 batch_size = 100 image_widt...
true
87e19fc2f2dc65c1f1b2aa1932120dec9e9e01b1
Python
dennlinger/Dagger
/nodagger.py
UTF-8
7,361
2.609375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 11 10:42:45 2019 @author: dennis """ import random import sys import os import numpy as np import scipy.sparse as spa from sklearn.linear_model import SGDClassifier from sklearn.neighbors import DistanceMetric from sklearn.metrics import classi...
true
5aa9241315ca7de6d55078c5f16089a0e8e19c5f
Python
celtic108/Generative-MNIST-Digits
/src/test_file.py
UTF-8
249
2.546875
3
[]
no_license
from network import sigmoid from network import sigmoid_prime import numpy as np test = np.array([-6, -4, -2, 0, 2, 4, 6]) vsigmoid = np.vectorize(sigmoid) vsigmoid_prime = np.vectorize(sigmoid_prime) print vsigmoid(test) print vsigmoid_prime(test)
true
b5d87aaffc923686eb8053e1c91a9f69ec0b5a61
Python
zoejane/uband_python
/worldcup/comments.py
UTF-8
1,094
3.46875
3
[]
no_license
import json # 读取文件 with open('response.txt', 'r', encoding='utf-8') as f: contents = '' for line in f.readlines(): contents += line.strip() # print(contents) comments = json.loads(contents) # 这是一个 dictionary # print(comments) # print(type(comments)) # 初始化计算器 users = dict() # 循坏遍历 for comment in comm...
true
af30ace529f65ebe2549b3172bd0587b09b0a07e
Python
TheMiles/aoc
/12.py
UTF-8
3,330
3.03125
3
[]
no_license
#!/usr/bin/python3 import argparse import numpy as np import re from datetime import datetime def getArguments(): parser = argparse.ArgumentParser(description='Advent of code') parser.add_argument('input', metavar='file', type=argparse.FileType('r')) parser.add_argument('-i','--iterations', type=int, def...
true
51b2bf3ea8a97f0c85da5153fa14b5d4669e6434
Python
weltonvaz/Coursera
/Python3/1a. parte/5semana/vogal.py
UTF-8
292
3.71875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Escreva a função vogal que recebe um único caractere como parâmetro e devolve True se ele for uma vogal e False se for uma consoante.""" def vogal(s): if s.lower() in 'aeiou': return True else: return False
true
a7cd879c743fb08a8801c8766381f06808fdfe8f
Python
q-hwang/tacotron2
/chinese_process.py
UTF-8
2,785
2.890625
3
[ "BSD-3-Clause" ]
permissive
import numpy as np import re from pypinyin import pinyin, Style num=['零','一','二','三','四','五','六','七','八','九'] kin=['十','百','千','万','零'] def sadd(x): x.reverse() if len(x) >= 2: x.insert(1,kin[0]) if len(x) >= 4: x.insert(3,kin[1]) if len(x) >= 6: x.inser...
true
ca5371ab7a1975d0f07a0fe54f12b5f81014752d
Python
MDYLL/EPAM
/EPAM_hw11.py
UTF-8
760
2.890625
3
[]
no_license
import pytest from homework4_2 import count_words def test_count_words_positive(): assert count_words(['epam-pam-pam', 'param-pam-bam'], 'pam') == 4 def test_count_words_zero(): assert count_words(['intel', 'mera', 'microsoft'], 'epam') == 0 def test_count_words_bad_input(): with pytest.raises(TypeErro...
true
495ba20a6c80ff229cf17ac8ae2d59c87d9a5710
Python
johnmerm/bioinfo
/src/main/java/bioinfo/yeast/quiz.py
UTF-8
2,004
2.96875
3
[]
no_license
''' Created on May 26, 2015 @author: grmsjac6 ''' from math import sqrt import numpy def pointDist(a,b): return sum([(a[i]-b[i])**2 for i in range(len(a))]) def test_maxDist(): points = [(2, 6), (4, 9), (5, 7), (6, 5), (8, 3) ] centers = [ (4, 5), (7, 4)] dists = [[sqrt(pointDist(p, c)) for c in...
true
a5ce3c9292dcbf4eb1785810f5963dd2b0089821
Python
lruczu/ml_utils
/ml_utils/optimization/pyomo/linear programming/basic_example1.py
UTF-8
509
2.65625
3
[]
no_license
from pyomo.environ import ConcreteModel, Constraint, Objective, Var, NonNegativeReals """ min x1 + 2 * x2 s.t. 3 * x1 + 4 * x2 >= 1 2 * x1 + 5 * x2 >= 2 x1, x2 >= 0 """ model = ConcreteModel() model.x_1 = Var(within=NonNegativeReals) model.x_2 = Var(within=NonNegativeReals) model.obj = Objective(expr=model.x_1 + 2 * ...
true
b56a8c2b677028639a6781af19c6114e68744343
Python
satyam-seth-learnings/python_learning
/Geeky Shows/Core Python/91.Pass_Or_Call_By_Object_Reference_Example-3[124].py
UTF-8
163
2.703125
3
[]
no_license
def val(lst): print("IFBA",lst,id(lst)) lst=[11,22,33] print("IFAA",lst,id(lst)) lst=[1,2,3] print("BCF",lst,id(lst)) val(lst) print("ACF",lst,id(lst))
true
21b7ccf3dda56703ecdcf68001e8fec6d5bd1868
Python
surenderthakran/test_suite
/keras_runner/trainers/wine_quality/wine_quality_classification.py
UTF-8
2,048
2.84375
3
[]
no_license
import os from keras.models import Sequential from keras.layers import Dense import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler dir_path = os.path.dirname(os.path.realpath(__file__)) # Read in red wine data red = pd.read_csv(dir...
true
dc49048442f175b7a5c8c6d47e9371639dc70e91
Python
ijnji/sandbox
/python/epi/interconverting_string_integer_test.py
UTF-8
704
2.953125
3
[]
no_license
#!/usr/bin/env python3 import pytest from epi.interconverting_string_integer import int_to_string from epi.interconverting_string_integer import string_to_int def test_small(): assert(int_to_string(0) == '0') assert(int_to_string(-1) == '-1') assert(int_to_string(1) == '1') assert(int_to_string(1000)...
true
82e695190257703b73e06e0b998dc82b8489f388
Python
lukaswals/busqueda-soluciones
/busqueda.py
UTF-8
4,426
3.296875
3
[]
no_license
# -*- coding: utf-8 -*- import time from tkinter import * class Busqueda(object): def __init__(self, inicio): self.abiertos = [] self.cerrados = [] self.tiempo_total = 0 self.inicio = inicio def buscar(self): encontro = False self.abiertos.append(self.inicio) ...
true
d78bf2e22c0b7e7d13eb8def9f83ff64a7c5c658
Python
RailanderJoseSantos/Python-Learnning
/ex017.py
UTF-8
177
3.375
3
[]
no_license
from math import hypot kop = float(input('Informe o cateto oposto:')) kad = float(input('Informe o cateto adjacente:')) print('A hipotenusa é: {}'.format(hypot(kop, kad)))
true
fa2351c67ccfc917229d91d6682e651f7228971e
Python
sebaF96/C2_practicas
/walkie_talkie/bob.py
UTF-8
1,330
3.296875
3
[]
no_license
#!/usr/bin/python import socket import sys import getopt def stablish_connection(): try: opt, arg = getopt.getopt(sys.argv[1:], 'a:') alice_address = opt[0][1] if opt else '' bob_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) bob_socket.connect((alice_address, 8080)) ...
true
2c3541620cbc642360c1f4cace0051c6afd19919
Python
gabrielasigolo/exerciseGeometricForms
/formasVolume.py
UTF-8
1,344
4.21875
4
[]
no_license
#Author: GabrielaSigolo from math import pi print("Choose a geometric shape to know the volume: ") print("[1] Sphere ") print("[2] Cub") print("[3] Parallelepiped") print("[4] Pyramid ") answer = int(input("Answer: ")) ## answer check if answer == 1: rad = float(input("Type the rad: ")) elif answer == 2: sid...
true
bd72d1274fbad0f68f7dcb08db60efa75e4678df
Python
ptracton/experimental
/python3/stats/stats.py
UTF-8
1,025
2.953125
3
[]
no_license
#! /usr/bin/env python3 import datetime import random import statistics import pandas #import pandas_datareader import pandas_datareader.data as web import matplotlib.pyplot as plt if __name__ == "__main__": print ("Stats") data = [random.randint(0,100) for x in range(100)] print (data) print (statis...
true
642a0323423d92e414d046a3892f4d65a8885bfd
Python
BenBlueAlvi/Algorithms
/hw2/inversions.py
UTF-8
1,083
3.421875
3
[]
no_license
import math #how many pairs in the opposite order #if sorted, 0 #reverse sorted, n(n-1)/2 #3, 1, 5, 2, 4 = 4 #should be nlogn #equal to number of sort swaps #if left pointer less than right, no inversions #broken #sorted array + n inverssions def _num_inversions(arr, ninv): if (len(arr) > 1): #get midpoint mid =...
true
8112e7d856979095b58cb0855d64eaf240510fd8
Python
rboulton/adventofcode
/2017/day4b.py
UTF-8
501
3.296875
3
[ "MIT" ]
permissive
import sys def has_duplicates(phrase): words = phrase.split() sorted_words = [''.join(sorted(word)) for word in words] already_seen = set() for word in sorted_words: if word in already_seen: return True already_seen.add(word) return False def phrase_is_valid(phrase): ...
true
f951df26678a6845ac67647a896b25ca4bb4764a
Python
HatemSaadallah/speedmedia
/speedmedia.py
UTF-8
1,869
2.625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options import time import os import sys options = Options() options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Chrome('chromedriver', options=options...
true
1d8f51ed2c8674e26fdc9f9d1b1f5df10547f5cf
Python
kadglass/SHELS_metallicity
/SHELS_gal_flux.py
UTF-8
2,444
2.75
3
[ "BSD-3-Clause" ]
permissive
'''Loads galaxy .fits file, coverts flux data to table''' ################################################################################ # # LOAD LIBRARIES # ################################################################################ from os.path import isfile from astropy.io import fits f...
true
c64087486482bd6d8ffc605cf887057fe3383d83
Python
akshshu/space_invader_game
/space_invad.py
UTF-8
4,465
3.109375
3
[]
no_license
import pygame import random import math from pygame import mixer # needed to handle music class player_begin: def __init__(self, x, y, change): self.x = x self.y = y self.change = change class enemy_begin: def __init__(self, index, x, y, changeX): self.index = index ...
true
cfee59ee77584670b859bad56392003a09c5308f
Python
ByronPhung/combinations-using-stacks
/stack.py
UTF-8
3,347
3.890625
4
[ "MIT" ]
permissive
#=============================================================================== # File : stack.py # Project : Combinations Using Stacks # Description : Simulate stacks. # Company : Cal Poly Pomona # Engineer : Byron Phung # Gregory Lynch #==========================================...
true
2e6e717c5f5b4d02b62eab63157e0850bad671d3
Python
bassil/codefights
/arcade/python/lurking_in_lists/remove_tasks.py
UTF-8
422
3.046875
3
[]
no_license
def removeTasks(k, toDo): """ remove each kth task from input list toDo ---------- parameters ---------- k: integer toDo: list of integers ---------- >>> removeTasks(3, [1237, 2847, 27485, 2947, 1, 247, 374827, 22]) [1237, 2847, 2947, 1, 374827, 22] """ del toDo[k-...
true
c8e6065ac061f5e6d25cc11ac5aa55d2177cee5a
Python
stefansilverio/holbertonschool-higher_level_programming
/0x0A-python-inheritance/class_behavior/2-is_same_class.py
UTF-8
249
3.515625
4
[]
no_license
#!/usr/bin/python3 """ Determine if obj is instance of class Return: Status """ def is_same_class(obj, a_class): """Return class status examine object """ if type(obj) == a_class: return True else: return False
true
80c42755c8234b05f25316dad363aae56b24875e
Python
xeaser/aws-auto-remediation
/remediation-functions/rds_instance/rdsinstance_copytagstosnapshot.py
UTF-8
2,137
2.65625
3
[ "MIT" ]
permissive
''' Enable Copy Tags to snapshot feature for AWS RDS database instance ''' from botocore.exceptions import ClientError def run_remediation(rds, RDSInstanceName): print("Executing RDS instance remediation") copytags='' try: response = rds.describe_db_instances(DBInstanceIdentifier=RDSInstanceName...
true
55adaadf7420293a29a6e44889777eba70d121b4
Python
WoosukYang-MEG/ros2-study
/src/my_first_ros_rclpy_pkg/my_first_ros_rclpy_pkg/helloworld_publisher.py
UTF-8
1,094
2.75
3
[]
no_license
import rclpy from rclpy.node import Node from rclpy.qos import QoSProfile from std_msgs.msg import String class HelloworldPublisher(Node): def __init__(self): super().__init__('helloworld_publisher') qos_profile = QoSProfile(depth=10) self.helloworld_publisher = self.create_publisher( ...
true
8b825d62c93846dbfe8fcab4787473701c3f3c01
Python
slonoten/deep_nlp
/word_casing.py
UTF-8
610
3.671875
4
[]
no_license
"""Извлекаем признаки из регистра и наличия цифр в слове""" def get_casing(word): num_digits = sum(int(ch.isdigit()) for ch in word) digit_fraction = num_digits / float(len(word)) casing = [ float(word.isdigit()), float(digit_fraction > 0.5), # В основном цифры float(num_digits ...
true
5c905d6408852a8376eab1bb323d04aa07023967
Python
Angeliz/text-index
/knn_predict.py
UTF-8
1,367
3.015625
3
[]
no_license
# encoding=utf-8 from sklearn.neighbors import KNeighborsClassifier from utils import read_bunch_obj from config_local import space_path, experiment_space_path def predict_result(space_path, experiment_space_path): train_set = read_bunch_obj(space_path) test_set = read_bunch_obj(experiment_space_path) ...
true
1b3ac1b61ae0707a19fc4530f9cf9c88f97c4b8b
Python
luoye2333/ann
/rbinary/prepare_binary.py
UTF-8
1,010
3.0625
3
[]
no_license
#生成一串01代码 #长度为20,要求其中1出现的次数 import pandas as pd import random import os path=os.path.dirname(__file__) len=20 #含1个数从0~len,每组n个,共(len+1)*n sample_num=10000 si=[] labels=[] n1=-1 for _ in range(len+1): n1=n1+1 for _ in range(sample_num//(len+1)):#//整除 s=[] for i in range(len): if i<...
true
ca691ca19a1fb5995077f3923e020871f011757d
Python
GuglielmoS/ProjectEuler
/euler22.py
UTF-8
959
4
4
[]
no_license
#!/usr/bin/ python # Using names.txt (http://projecteuler.net/project/names.txt), a 46K text file # containing over five-thousand first names, begin by sorting it into # alphabetical order. # Then working out the alphabetical value for each name, multiply this value # by its alphabetical position in the list to obt...
true
33e3f23b0968f6a50fe7c4e2af347ebf07a51007
Python
narinn-star/Python
/Review/Chapter08/8-09.py
UTF-8
478
3.875
4
[]
no_license
class Queue: def __init__(self): self.q = [] def isEmpty(self): return (len(self.q) == 0) def enqueue(self, item): return self.q.append(item) def dequeue(self): '''큐 맨 앞의 항목을 제거하고 반환 만약 큐가 비어있으면 KeyboardInterrupt 예외가 발생''' if len(self)==0: ...
true
7f00a6385288322c6837a016e486b704ff53ec26
Python
JessicaJang/cracking
/Chapter 4/q_4_2.py
UTF-8
1,174
3.4375
3
[]
no_license
import unittest import random from random import seed from random import randint class Node(): def __init__(self, item, left=None, right=None): self.item = item self.left = None self.right = None def disp(self, nesting=0): indent = " " * nesting * 2 output = f"{self.item}\n" if self.left is ...
true
2b73e6ad71cfe966c9b8dcd7db7d4be7d4e448af
Python
trishu99/Microsoft-WIT-hackathon
/api/startp.py
UTF-8
5,418
2.671875
3
[]
no_license
import subprocess import shlex import psutil import signal import os def startprocess(cmd): try: p = subprocess.run(cmd, stdout=False, stderr=False, shell=True, check=True) if p.returncode != 0: return cmd + ' : wrong command to run program or no such program exist' else: return cmd + ' : program started ...
true
3b62492860ec030a1e50b6964393406b945f4ab8
Python
wuluchaoren/py_learning_projects
/data_visualization/dice_visual.py
GB18030
721
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- import pygal from die import Die # D6ɫ die_1=Die() die_2=Die() results=[] # ɫӲ洢һб for roll_num in range(1000): result=die_1.roll()+die_2.roll() results.append(result) # frequencies=[] max_result=die_1.num_sides+die_2.num_sides for value in range(2,max_result+1): frequency=results....
true
c54086f79eb3a164e1b685e1903ce39f997f6482
Python
quesmues/curso-python-basico
/exercicio4.py
UTF-8
321
3.796875
4
[]
no_license
def maiorNumero(colecao): colecao = max(colecao) print('O maior número é: ',colecao) def menorNumero(colecao): colecao = min(colecao) print('O menor número é: ',colecao) colecao = [] for i in range(5): colecao.append(int(input('Informe um numero: '))) maiorNumero(colecao) menorNumero(colecao)
true
2316a295baf695b2250b1e4bc525ec4cdca24c5a
Python
hyunjun/practice
/Problems/hacker_rank/Algorithm/Strings/20150316_Make_it_Anagram/solution2.py
UTF-8
305
3.625
4
[]
no_license
from collections import Counter def number_of_deletion(s1, s2): total, d1, d2 = 0, Counter(s1), Counter(s2) for i in range(97, 97 + 26): c = chr(i) total += abs(d1[c] - d2[c]) return total if __name__ == '__main__': s1 = raw_input() s2 = raw_input() print number_of_deletion(s1, s2)
true
e17fb5682564b8cce516ce16a40c688f2c83e7ee
Python
Racso/puzzles
/AdventOfCode2017/3.py
UTF-8
363
3.296875
3
[]
no_license
import math def distanceToCenter(x): if x==1: return 0 circle = math.ceil(x**0.5)//2 circleSize = circle*2+1 corner = circleSize**2 distToCorner = (corner-x)%(circleSize-1) distToMidPoint = abs(distToCorner-circleSize//2) return circle+distToMidPoint def partOne(): print(distanceToCent...
true
a9bb93b7d54367fa398a7abe9510e8c317e6c216
Python
code-roamer/IF-Defense
/baselines/dataset/ModelNet40.py
UTF-8
5,709
2.625
3
[ "MIT" ]
permissive
import numpy as np from torch.utils.data import Dataset from util.pointnet_utils import normalize_points_np, random_sample_points_np from util.augmentation import rotate_point_cloud, jitter_point_cloud def load_data(data_root, partition='train'): npz = np.load(data_root, allow_pickle=True) if partition == '...
true
de42c6737ab2027b03d3a5133e5023142c58eb94
Python
loganrane/zipcodes-in
/zipcode_in/zipcode.py
UTF-8
3,600
3.75
4
[ "MIT" ]
permissive
""" Zipcode India ----------------------------- Zipcode class to validate and fetch details of India zipcodes """ import json import os import sys import warnings import random class Zipcode(): """Zipcode Class""" def __init__(self): """Constructor to initialze the path, data and valid length.""" ...
true
36001e6449053606573ff687dd3323d7ec93ade1
Python
ToucanToco/toucan-data-sdk
/tests/utils/generic/test_date_requester.py
UTF-8
4,401
2.703125
3
[ "BSD-3-Clause" ]
permissive
import pandas as pd from toucan_data_sdk.utils.generic import date_requester_generator fixtures_base_dir = "tests/fixtures" df = pd.DataFrame( { "date": ["2018-01-01", "2018-01-05", "2018-01-04", "2018-01-03", "2018-01-02"], "my_kpi": [1, 2, 3, 4, 5], } ) df_2 = pd.DataFrame( { ...
true
ff48f0a10d3409189299d59003c6100c59a4b5e0
Python
zww520/segmentation0
/segmentation/Component.py
UTF-8
2,009
2.859375
3
[ "MIT" ]
permissive
import numpy as np import random as rand import matplotlib.pyplot as plt class component: def __init__(self,num_node): self.num_node = num_node self.parent = [i for i in range(num_node)] self.weight = [0 for i in range(num_node)] self.size = [1 for i in range(num_node)] def find(...
true
1792cf28b0e58a58ea2eb363869c3e6ef8753200
Python
katapenzes/W1DKME.beadando
/W1DKME_EX04.py
UTF-8
249
3.3125
3
[]
no_license
def EX4(str): t = '' str = str.lower() for i in str.split(' '): for j in range(1,len(i)): t += i[j] t += i[0] t += 'ay' t += ' ' return t.capitalize() print(EX4('The quick brown fox'))
true
6dc3b12e8129e3f5e364a61bc5c30ac2e9390f77
Python
qmnguyenw/python_py4e
/geeksforgeeks/python/python_all/125_8.py
UTF-8
2,834
3.96875
4
[]
no_license
Python | Dictionary key combinations Sometimes, while working with Python dictionaries, we can have a problem in which we need to get all the possible pair combinations of dictionary pairs. This kind of applications can occur in data science domain. Let’s discuss certain ways in which this task can be perform...
true
fcafd0485182ed4b28b146407a239968b7bc6dbb
Python
Cica013/Exercicios-Python-CursoEmVideo
/Pacote_Python/Ex_python_CEV/exe042.py
UTF-8
801
4.1875
4
[]
no_license
# Refaça o desafio 35 dos triângulos, acrescentando o recurso de mostrar que tipo de triângulo será formado: # -Equilatero: Todos os lados iguais -isóceles: dois lados iguais - escaleno: todos os lados diferentes n1 = int(input('Digite um valor: ')) n2 = int(input('Digite outro valor: ')) n3 = int(input('Digite mais um...
true
423f6e287d6613dce2b09d4a6d5fbda5790c106b
Python
mkuczynski11/Leetcode-solutions
/1334.py
UTF-8
1,511
3.515625
4
[]
no_license
#https://leetcode.com/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/ import heapq class Solution(object): def findTheCity(self, n, edges, distanceThreshold): """ :type n: int :type edges: List[List[int]] :type distanceThreshold: int :rty...
true
e79babc7ecca1546f6177dff6cec09053702270d
Python
KePcA/LVR-sat
/SAT_implementation/algorithm_utilities.py
UTF-8
10,936
3.078125
3
[]
no_license
""" Utility methods used in DPLL algorithm. """ __author__ = 'Grega' import SAT_implementation.bool_formulas as bf import itertools def cnf_nnf(p): """ Converts the specified p formula to a NNF form and then to a CNF form. """ nnf_p = nnf(p) return cnf(nnf_p) def cnf(p): """ Converts the specified p formula...
true
3174dd5a8edd2bd6a244fd87aca13462b6cb6db1
Python
sudh4444/Gear_image_processing
/Pooja/flank_seperation.py
UTF-8
6,926
2.71875
3
[]
no_license
import numpy as np import time import os import math import cv2 from envision import crop from envision.convolution import convolve_sobel ind = 0 def showimage(name,image): # return # cv2.imwrite("output/" + str(ind) + str(name) +".jpg", image) cv2.imshow(str(name),image) cv2.waitKey(0) cv2.destro...
true
88cbea9957231274ab980cb2300feec6109ad50b
Python
sprout42/cgm
/cgm/types/string.py
UTF-8
988
2.65625
3
[]
no_license
from cgm.utils import word from .base import CGMBaseType, CGMLengthType class _SF(CGMLengthType): def extract_item(self): data = self.fp.read(self.param_len) self.value = data.decode('latin-1') class _S(CGMBaseType): def extract(self): # Variable length string that is null terminated...
true
ad4ab4532e143f004fb57e8dc922b45112c4fd74
Python
Jay-gupta/Data-Analysis
/ZomatodataAnalysis.py
UTF-8
900
2.890625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[2]: import numpy as np # In[1]: import pandas as pd # In[3]: import matplotlib.pyplot as plt # In[5]: data = pd.read_csv('C:/Users/hkc03/Desktop/JAY/project2/zomato.csv') data # In[12]: data.describe() # In[9]: data['Country Code'].value_counts() # In[...
true
4671a5307493bf19cf66348dee8c7c84a6d573ed
Python
manojsudharsan/Python
/RemoveExtraSpace.py
UTF-8
51
2.734375
3
[]
no_license
X=list(map(str,input().split())) print(*X,end=" ")
true
894248939d84fdfbcf420143ca7a8f6297b7fe4d
Python
gorlins/PyMVPA
/mvpa/clfs/ridge.py
UTF-8
3,201
3.03125
3
[ "MIT" ]
permissive
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the PyMVPA package for the # copyright and license terms. # ### ### ### ### ###...
true
57246aaaade483c4ed190d947cc93c9969774ed6
Python
manifoldco/aggregate-ml-logs
/ml_logs/training/keras_job.py
UTF-8
1,045
2.59375
3
[]
no_license
from keras.models import Sequential from keras.layers import Dense, Dropout from ml_logs.data import read_traces, scale_traces from ml_logs import env from ml_logs.logs import logger def train_nn(x_train, y_train): logger.info('Training Simple Keras NN') model = Sequential() model.add(Dense(1, kernel_in...
true
c459f967a4a8445e08f4a267cac8887963f306ff
Python
gkchai/planus
/bin/testnlu.py
UTF-8
2,238
2.75
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- from optparse import OptionParser import sys, pdb, traceback from math import log10 import numpy as np, re from src import ds # Example test file for using an object of type ds() def main(): for i, line in enumerate(open('data/sentences.txt', 'r')): testobj = ds.ds() #...
true
0ea37acaee2181a6c15c4ad9cfa1969c31903bd3
Python
tom-f-oconnell/scripts
/change_git_auth.py
UTF-8
1,853
2.921875
3
[]
no_license
#!/usr/bin/env python3 """ Takes piped output of git remote -v and returns one line with remote changed to desired authentication type. """ import sys if __name__ == '__main__': valid_auth_types = ('g','h','s') if len(sys.argv) != 2: raise ValueError('one required argument (g/h/s) to specify auth typ...
true
db698a16a165aac9b4c5ae29d8c4b189b3726b33
Python
HilaGast/FT
/network_analysis/nodes_network_properties.py
UTF-8
2,398
2.875
3
[ "Apache-2.0" ]
permissive
import numpy as np import networkx as nx def merge_dict(dict1, dict2): ''' Merge dictionaries and keep values of common keys in list''' import more_itertools dict3 = {**dict1, **dict2} for key, value in dict3.items(): if key in dict1 and key in dict2: dict3[key] = [value , dict1[key...
true
4d0d1c6fdb282d93d6fe97e25adba1b832a04464
Python
Menooker/dgl
/tests/graph_index/test_hetero.py.bak
UTF-8
14,648
2.546875
3
[ "Apache-2.0" ]
permissive
import numpy as np import dgl import dgl.ndarray as nd import dgl.graph_index as dgl_gidx import dgl.heterograph_index as dgl_hgidx from dgl.utils import toindex import backend as F """ Test with a heterograph of three ntypes and three etypes meta graph: 0 -> 1 1 -> 2 2 -> 1 Num nodes per ntype: 0 : 5 1 : 2 2 : 3 re...
true
907836a00eb2fea6f4925d1ad2e143a99a4a4d26
Python
TMKangwantas/TicTacToe
/Tic.Tac.Toe.py
UTF-8
15,228
3.78125
4
[]
no_license
#Thanathip Mark Kangwantas ################################################# #Triplets ################################################# triplets = [] x = 0 while x < 1: for col in range (3): rowWin = [] for row in range(3): rowWin.append([row,col]) triplets.append(rowWin) x...
true
a25aa6de4b06c7d4ec48d693d3a4f71a3c9ded03
Python
AwuorMarvin/Bank-Account
/bank_account.py
UTF-8
566
3.65625
4
[]
no_license
class BankAccount(object): def __init__(self, account_balance = 500): self.account_balance = account_balance def deposit(self, amount): self.amount = amount self.account_balance += amount return self.account_balance def withdraw(self, amount): if self.account_balanc...
true
22b155e7456d8bb8ea402d5a64c630f636354944
Python
Bubbet/MyAnimeList-PlanToWatchComparison
/main.py
UTF-8
1,245
3.234375
3
[]
no_license
from requests import get from json import loads import concurrent.futures from time import time from bs4 import BeautifulSoup def parse_url(user, any_bool=False): url = f'https://myanimelist.net/animelist/{user}' page = get(url) soup = BeautifulSoup(page.content, 'html.parser') results = soup.find('ta...
true
3f4ca4360cd8988cf61436066f23287dd44c8ce5
Python
caionms/python
/Reaprendendo/l1q9.py
UTF-8
219
3.578125
4
[]
no_license
print('Iremos calcular o valor a ser pago em um aluguel de carro.') t = int(input('Digite a qtd de dias: ')) d = int(input('Digite a qtd de KM rodados: ')) print(f'O valor a ser pago será de {(60*t)+(d*0.15)} reais.')
true
6642ec02f3d8fca17d237d3565ad041cf83dfa15
Python
kramax8/gthome1Part2
/tz20/tz20.py
UTF-8
806
3.21875
3
[]
no_license
g_countries = {1: 'google_kazakstan.txt', 2: 'google_paris.txt', 3: 'google_uar.txt', 4: 'google_kyrgystan.txt', 5: 'google_san_francisco.txt', 6: 'google_germany.txt', 7: 'google_moscow.txt', 8: 'google_sweden.txt'} for key in g_countries: a = str(key) ...
true
fc4f9604d8f9ecb274900fd268092444ebf7178e
Python
LukaP-BB/PyDiscord
/coroPack/geo.py
UTF-8
8,175
2.515625
3
[]
no_license
#!/usr/bin/env python3 #-*- coding:utf-8 -*- import requests as req import pandas as pd import numpy as np from scipy import stats import geopandas as gpd import matplotlib.pyplot as plt import datetime as dtt from coroPack.interface import depFromCode from coroPack.analyse import timeFrame, loadData from colors imp...
true
6018ddb4cd390b7e4056079c971f98357aecf787
Python
realbadbytes/POP
/pipeline.py
UTF-8
3,017
3.15625
3
[]
no_license
#!/usr/bin/python3 import numpy as np from parser import Operation registers = ['.gp0', '.gp1', '.gp2', '.gp3', '.gp4', '.gp5', '.gp6', '.stack', '.next'] class Pipeline(): def __init__(self, program): self.program = program print ('[+] initializing pipeline for') for op in program.oper...
true
598d57c3b0d6b4dc7e13e901d6d8f5e8c7b339db
Python
Polaricicle/practical02
/q09_find_smallest.py
UTF-8
422
4.21875
4
[]
no_license
#Filename: q09_find_smallest.py #Author: Tan Di Sheng #Created: 20130130 #Modified: 20130130 #Description: This program uses a while loop to find the smallest integer n #such that n^2 is greater than 12,000. print("""This program finds the smallest integer n such that n^2 is greater than 12,000.""") sInteger = 1 whi...
true
853a69b125b11d270fc34d010883d45f8792e247
Python
Madndev/myfirstproject
/checkandcopy.py
UTF-8
538
3.015625
3
[]
no_license
import os fh = open("developer.txt","w") n=int(input("how many developing languages do u want : ")) i=0 while(i<n): dev=input("enter the developing programas : ") fh.write(dev+"\n") i+=1 fh.close() fh1 = open("web.txt","w") n=int(input("how many web languages do u want : ")) i=0 while(i<n): dev=input...
true
3995c73a708e75564b2f54093f433e19666ed2a0
Python
SilasA/CIS-HW
/CIS-365/uninformed-search/search.py
UTF-8
1,779
4.21875
4
[]
no_license
#!/usr/bin python3 # Maze represented by dictionary with key: Node; value: Array of children # The way I implemented the maze turns out to make the graph a binary tree. graph = { "Start" : ["A", "B"], "A": ["C", "D"], "B": [], "C": [], "D": ["E", "F"], "E": ["G", "H"], ...
true
1fd1b585c646513b89268de86b9b6c6cc3ce36e2
Python
ksm0207/Python_study
/chapter6_python_function/forward_return.py
UTF-8
1,016
3.890625
4
[]
no_license
# 전달값 and 반환값 def open_account(): print("새로운 계좌가 생성되었습니다.") def deposit(balance, money): # 입금 print("입금이 완료되었습니다.{0}원".format(balance + money)) return balance + money def withdraw(balance, money): # 출금 if balance > money: print("출금이 완료되었습니다. 잔액은 {0}원 남았습니다.".format(balance ...
true
71decca796e3a6ad3a3941d56d7e9cfb242eeb0a
Python
Thien223/Sentiment-Analysis
/source/sentiment_models.py
UTF-8
8,298
2.71875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np import pandas as pd from keras.callbacks import EarlyStopping, ModelCheckpoint from keras.layers import Dense, Embedding, Input, Bidirectional from keras.layers import LSTM, Dropout from keras.models import Model from keras.preprocessing import text, seq...
true