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
178d823c1d5510f85cd65880f356f507a8ac2045
ajsimon1/scripts
/NETI_refPhys.script.py
UTF-8
4,608
2.609375
3
[]
no_license
""" quick script to translate the provided XML and move to excel """ import xml.etree.ElementTree as ET import re import json import requests from openpyxl import load_workbook # add xml to variable xml_phys = "NETIPhysiciansNoLimit.xml" xml_icd = "NETI_ICDsince2015.xml" # add excels to variable xls_phy...
true
d98819128c3bf6e19e9e390cf2350370c0321f29
EADhrubo/Image-Processing-with-Python
/finding_rectangle.py
UTF-8
635
2.53125
3
[]
no_license
import numpy as np import cv2 img = cv2.imread('shape.png') img = cv2.resize(img,(640,480)) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret,thresh = cv2.threshold(gray,127,255,1) img2,contours,h = cv2.findContours(thresh,1,2) count = 0 i = 0 for cnt in contours: approx = cv2.approxPolyDP(cnt,0.01*cv2.arcLen...
true
a0d700e8eb1ef87fbb3e50bdaf20381294259c7c
fonarevvichka/simplifier
/simplifier.py
UTF-8
5,812
2.875
3
[]
no_license
import sys def find_difference(term_one, term_two): differences = 0 index = -1 for i in range(0, len(term_one)): if term_one[i] != term_two[i]: differences += 1 index = i if differences == 1: return index else: return -1 def check_match(term_one,...
true
9c89e9250936ea5fb1479ed16843844472a5ab3d
jackdreinhardt/AI-Project-2
/src/test_cnf_conversion.py
UTF-8
2,391
2.671875
3
[]
no_license
import unittest from convert2CNF import convert2CNF from globals import * # to run the tests: # python -m unittest test_cnf_conversion.py -v # Correct results of CNF conversion come from an online calculator class TestCNFConversion(unittest.TestCase): def setUp(self): self.c = convert2CNF() def test_...
true
3af96774c140a382fd0eaaee1bade7f7c02e0481
OnlyOneUseAcc/Film-Recomendations
/models/WatchHistory.py
UTF-8
1,056
3.484375
3
[]
no_license
from pydantic import BaseModel, Field from typing import Optional, List class WatchHistoryUnit(BaseModel): name: str = Field(..., description='Название единицы контента') duration: float = Field(..., description="Длительность просмотра в процентах") type: Optional[str] = Field(..., description="Тип контен...
true
1302efc23e11ca02c2ff72e69270b31d91a58545
zmskye/Intersection_AV_Trajectory
/memory.py
UTF-8
5,335
3.109375
3
[]
no_license
import numpy as np class SumTree(object): """ This SumTree code is modified version and the original code is from: https://github.com/jaara/AI-blog/blob/master/SumTree.py Story the data with it priority in tree and data frameworks. """ data_pointer = 0 def __init__(self, capacity, s_dim,...
true
a5a843436e4cb586a579add9327b237a2db08393
smartpr/piston-perfect
/piston_perfect/utils.py
UTF-8
121
2.796875
3
[]
no_license
class MethodNotAllowed(Exception): def __init__(self, *permitted_methods): self.permitted_methods = permitted_methods
true
9fbf85740e7f3aa9f1e438ff0a51c5939294dac4
Meenawati/competitive-programming
/dict_in_list.py
UTF-8
522
4.5625
5
[]
no_license
# Write a Python program to check if all dictionaries in a list are empty or not def dict_in_list(lst): for d in lst: if type(d) is not dict: print("All Elements of list are not dictionary") return False elif d: return False return True print(dict_in_list(...
true
580350896c766a68839675257f56f069b90b7eb1
atliSig/T809DATA_2021
/01_decision_trees/template.py
UTF-8
3,116
2.828125
3
[]
no_license
from typing import Union import matplotlib.pyplot as plt import numpy as np from sklearn.tree import DecisionTreeClassifier, plot_tree from tools import load_iris, split_train_test def prior(targets: np.ndarray, classes: list) -> np.ndarray: ''' Calculate the prior probability of each class type given a ...
true
3e4c7bf57134239838d1e21a57ed77b818e5a858
zihuaweng/leetcode-solutions
/leetcode_python/797.All_Paths_From_Source_to_Target.py
UTF-8
543
3.015625
3
[]
no_license
#!/usr/bin/env python3 # coding: utf-8 # Time complexity: O() # Space complexity: O() # https://leetcode.com/problems/all-paths-from-source-to-target/ class Solution: def allPathsSourceTarget(self, graph: List[List[int]]) -> List[List[int]]: def dfs(graph, idx, res, temp): if idx == len(grap...
true
b542c39c4b32b113adb161f4b461d542d07d31fa
BernieLBY/Airsim-imitation-learning
/monitor.py
UTF-8
280
2.84375
3
[]
no_license
from pynput import keyboard def on_press(key): print('{0}'.format(key)) with keyboard.Listener( on_press=on_press ) as listener: listener.join() # ...or, in a non-blocking fashion: listener = keyboard.Listener( on_press=on_press) listener.start()
true
4e3df077ffca6faacddaf20760b987308fb0271b
dalibo/pgtoolkit
/pgtoolkit/log/parser.py
UTF-8
16,376
3.078125
3
[ "PostgreSQL" ]
permissive
import re from collections.abc import Iterable, Iterator, Mapping, MutableMapping, Sequence from datetime import datetime, timedelta from re import Pattern from typing import Any, Callable, Optional, Union class LogParser: """Log parsing manager This object gather parsing parameters and trigger parsing logic...
true
c136b2d988ca67f040e8ddd5bc0d3450017a9105
sweetfruit77/kgitbank-python
/classTest/inheritance_test1.py
UTF-8
433
3.578125
4
[]
no_license
class My: def __init__(self): self._name = "korea" print("My") def get_name(self): print("self._name", self._name) return self._name class SubMy(My): def __init__(self): super().__init__() print("SubMy") def sub_print(self): print("sub_print", se...
true
8a37b2a1f09a361cc01bb85d96a05baabdbf552a
danhammer/diff-eq
/pred.py
UTF-8
3,186
2.84375
3
[]
no_license
import matplotlib.animation as animation import numpy as np from scipy.integrate import odeint from pylab import * import matplotlib.pyplot as plt price = 735 effort_scale = 2e-6 marginal_cost = 556380 carrying_capacity = 3.2e6 intrinsic_growth = 0.08 catchability = marginal_cost / (price * 0.25e6) def BoatFishSyste...
true
a156e33dc341a1af7aad51358341fc1b40831735
arindam5aha/RL_continuous_action_spaces
/environments/multiplayer_car_soccer_env.py
UTF-8
9,613
3.328125
3
[]
no_license
""" A 2-player game. Both players have to score in the opponent's goal """ import math import random import time import numpy as np import pygame screen_width = 800 screen_height = 600 def does_collide(r_xy, r_wh, r_a, c_xy, c_r): # IMPORTANT: rectangle width/height is interpreted in terms of a car ai...
true
17dcd1636c17ed3cddbb5611cb102679f63d25f6
Stymphalian/CSC421_Assignments
/a2/main_match.py
UTF-8
767
3.5
4
[]
no_license
import sys import match state = 2 exps = ["",""] while(True): line = sys.stdin.readline() # empty line if(len(line) == 0): continue # remove the end-line character if(line[-1] == "\n"): line = line[:-1] # if the state is 2 then we are looking for input from the use...
true
52dcaa97693e571bc74e88a2f036f4328dc9f0dc
Skouriskaze/PythonRL
/PAD/game.py
UTF-8
676
3.171875
3
[]
no_license
import pygame from enum import Enum import sys class Color: BLACK = (0, 0, 0) class Game: def __init__(self, width, height): pygame.init() self.screen = pygame.display.set_mode((width, height)) def run(self): while 1: self.process_events() self.update() ...
true
18ccfb2d4bf446ee45d7966e357bc4ebf48065e8
coremedy/Python-Algorithms-DataStructure
/Python-Algorithms-DataStructure/src/leet/279_PerfectSquares.py
UTF-8
730
3.375
3
[]
no_license
''' Created on 2015-10-10 ''' class Solution(object): # Static DP - avoiding dup calculation _table = [0, 1, 2, 3] def numSquares(self, n): """ :type n: int :rtype: int """ if n <= len(self._table) - 1: return self._table[n] ba...
true
4d580e4dde201c16f4186a57d65a3b8421611a39
marionleborgne/EIT_Dashboard
/OpenEIT/reconstruction/pyeit/mesh/plot/simconv.py
UTF-8
739
2.78125
3
[ "CC-BY-NC-SA-4.0", "LicenseRef-scancode-proprietary-license", "CC-BY-NC-4.0", "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain", "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- # pylint: disable=no-member, invalid-name """ common function for simplex """ from itertools import combinations import numpy as np def sim_conv(simplex, n=3): """ simplex to any dimension """ v = [list(combinations(sim, n)) for sim in simplex] # change to (num_of_points x n) ...
true
88ee26861b116e4eed7076e0baf21b3908e260fb
huiyanglu/My_Ideas
/File_processing/connect_imgs.py
UTF-8
2,529
2.953125
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Huiyang Lu from PIL import Image import os import re def connect_imgs(): # 从当前路径进入文件夹,获取所有文件夹名,存入字典 path=r'connect_test' #文件夹名 name_dict = {} #所有需要处理的文件夹合集字典 for each_filename in os.listdir(path): #由当前路径进入path文件夹 if each_filename[0].isdigi...
true
e381ce6edb766ce03030bb0baf393e53ad51011d
MeetAhya11/Codes_in_python
/Fibonacci.py
UTF-8
125
3.65625
4
[]
no_license
def fib(n): if(n<=1): return 1 else: return(fib(n-1)+fib(n-2)) n=int(input()) for i in range(n): print(fib(i))
true
25cfeeabd19b1ede2a7904a071096d1afe85e1b8
loum/domain-intel
/domain_intel/parser/test/test_traffichistory.py
UTF-8
1,539
3.03125
3
[]
no_license
""":class:`domain_intel.parser.TrafficHistory` unit test cases. """ import os import io import json import domain_intel.parser SAMPLE_FILE_DIR = os.path.join('domain_intel', 'test', 'files', 'samples', ...
true
1af54c9dc69e82ad3879ab751d21b97143709e2d
gurbaxaniravi/Udacity-DE-Nanodegree
/Capestone-Covid-19-Data-Analysis/plugins/operators/stage_redshift.py
UTF-8
2,655
2.734375
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- from airflow.hooks.postgres_hook import PostgresHook from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults from airflow.contrib.hooks.aws_hook import AwsHook class StageToRedshiftOperator(BaseOperator): """ The purpose of this cla...
true
b3a8c7d6effcf45caa6e9e60118351421b5f5367
rlpmeredith/cn-python-programming
/labs/03_more_datatypes/1_strings/04_03_vowel.py
UTF-8
348
4.5625
5
[]
no_license
''' Write a script prints the number of times a vowel is used in a user inputted string. ''' # Tested 19-17-19 str_input = input("Please enter your string input in lower case!: ") vowel_list = ["a", "e", "i", "o", "u"] vowel_count = 0 for i in vowel_list: vowel_count += (str_input.count(i)) print("Number of vowels...
true
af35de676af24d0c69b838c77e7946d45eaa3763
W1nU/programmers-todolist
/server/database/access/maria.py
UTF-8
2,269
2.546875
3
[]
no_license
import pymysql from getpass import getpass class maria: def __init__(self): self.maria_user = "todo" self.password = "password" def execute(self, sql): connect = pymysql.connect(host = 'localhost', port = 3306, user =...
true
d2b3c4871de58639c0b0733be8511a640ef4b13e
wschin/onnxmltools
/tests/coreml/test_cml_TreeEnsembleClassifierConverter.py
UTF-8
962
2.671875
3
[ "MIT" ]
permissive
""" Tests CoreML TreeEnsembleClassifier converter. """ import coremltools import unittest from sklearn.ensemble import RandomForestClassifier from onnxmltools.convert.coreml.convert import convert class TestCoreMLTreeEnsembleClassifierConverter(unittest.TestCase): def validate_zipmap(self, model): # Valid...
true
d45f64694f0a7f1a7b3f203671748b7a4d28ec9b
alexanderbartl/aoc2020
/09/B.py
UTF-8
520
3.328125
3
[]
no_license
with open('input.txt') as f: numbers = [int(n) for n in f.readlines()] target = 22477624 def find_continuous_set(start): running_sum = 0 idx = start while running_sum < target: running_sum += numbers[idx] idx += 1 if running_sum == target: return min(numbers[start:idx + 1...
true
b7107d4eb919c0c5003add0185516cf39bdeefc0
theanlay/python
/Illustrative.py
UTF-8
191
3.0625
3
[]
no_license
a = input("Enter something: ").split() a = list(map(eval, a)) for i in range(0 ,len(a)): smallest = min(a[i:]) sindex= a.index(smallest) a[i],a[sindex] = a[sindex],a[i] print (a)
true
c6bbf835a1a0dd2ce5fc114367e3f607accd65c8
wikix/learning-on-python
/09.py
GB18030
359
3.234375
3
[]
no_license
import sys try: s = raw_input('Enter something --> ') except EOFError:#EOFError͵쳣 print '/nWhy did you do an EOF on me?' sys.exit() # ˳ except:#쳣 print '/nSome error/exception occurred.' print 'Done' try : float ([1,2]) except BaseException , da : pass print type(da)
true
5931c27974cc650fdf490d7ac5618a120b8144f9
bryambalan/zabbix
/Scripts/down.py
UTF-8
1,044
2.890625
3
[]
no_license
#!/usr/bin/env python from lxml import html import requests import re import sys def convertTuple(tup): str = ''.join(tup) return str if len(sys.argv) < 2: print("erro, informe o site a ser testado\n") sys.exit(1) site = sys.argv[1] url = 'https://downdetector.com.br/fora-do-ar/' + site + '/' page...
true
aeba744b742a4723c19a5c2a86052fccad2796b8
Sherry3/ME
/exp2/phase3/plots/G_hdd_int.py
UTF-8
293
2.96875
3
[]
no_license
import matplotlib.pyplot as plt f = open("txt/hdd_int.txt", "r") lines = f.readlines() intr = [] for i in lines: if(i != "\n"): intr.append(int(i.split()[4])) plt.title('HDD interrupts') plt.plot(range(len(intr)), intr, 'k') plt.axis([0, len(intr), min(intr), max(intr)]) plt.show()
true
50f20dc791b68f86c046a5f9ed44f4d5f181daf3
manusri2430/manasa
/Count2.py
UTF-8
81
2.828125
3
[]
no_license
c=int(raw_input()) count=0 while(n>0): count=count+1 c=//10 print(count)
true
5251fa9742ed7617754d189e68fc1c323be20138
AlbanVl/ReguCoursGramme
/ModifRST.py
UTF-8
2,708
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed Aug 4 16:33:27 2021 @author: Alban Van Laethem """ import os, glob import zipfile # Supprime les anciens fichiers finaux for root, dirs, files in os.walk('Final/'): for dir in dirs : if dir != 'Images': for file in files: os.remove(o...
true
abfee1b4295113e4af1ae768fdd1633dc5168379
dgalindonavarro/cs182-finalproject
/Team.py
UTF-8
879
3.15625
3
[]
no_license
class Team(): def __init__(self, id): self.id = id self.snakes = [] # Equality check def __eq__( self, other ): if other == None: return False if not self.id == other.id: return False if not len(self.snakes) == len(other.snakes): return False for snake in xrange(len(self.snakes)): if not self.snak...
true
c80eec02e94b19917607dac3491cd670438b1f66
yoshimura19/samples
/python/dataquest/quest/python_intro/1/practice_debug.py
UTF-8
232
3.5625
4
[]
no_license
#coding:utf-8 print("input a probability of heads>"), prob = float(raw_input()) def flip_coin(heads_probability): if heads_probability >= 0.5: return("Heads") else: return("Tails") print(flip_coin(prob))
true
2882d6a58138df2f8c8eb52f90030147276d80bf
NGPHAN310707/C4TB13
/session 12,13,14/Dungeon basics.py
UTF-8
2,603
2.609375
3
[]
no_license
import random player = {'name':'KD', 'backpack':{}, 'HP':100} mapsize = 16 position = [0,0] critter_list = {} exit = [4,4] random.randint(0,1) key = {'keysposition' : [4,4],'signofkey': 'k'} blockingwall = {'bwsposition' : [3,3],'signofbw' : 'I'} map =[ ['-' for i in range(4)], ['-' for i in range(4)],...
true
b54eba1b51ebdc51fa873881b8df2e8032f01690
KanVull/II-8Sem
/test1.py
UTF-8
657
2.984375
3
[]
no_license
import numpy as np def sigmoid(x): return 1/ (1 + np.exp(-x)) training_inputs = np.array([ [1,0,1], [0,0,0], [1,1,1], [0,1,0], ]) training_outputs = np.array([[0,0,1,0]]).T synaptic_weights = 2 * np.random.random((3,1)) - 1 for _ in range(10000): outputs = sigmoid( np.dot(training_inputs, ...
true
af7aa0cd1c23c9f265a824fd6de54d05ecdda927
KarAbhishek/MSBIC
/BioInformatics/Week_14/likelihood.py
UTF-8
1,306
3.015625
3
[]
no_license
from BioInformatics.Week_14.hidden_path import get_matrix def likelihood(string, states, transition_matrix, emission_matrix): from collections import defaultdict placeholder_dict = defaultdict(defaultdict) for state in states: placeholder_dict[0][state] = (1.0 / len(states)) * emission_matrix[(st...
true
8edfa7a261ee69d9b2f90f6061045ecbd135e754
LenKIM/implements
/archive-dhkim/leetcode/ch08_linked_list/prob16_add_two_numbers.py
UTF-8
878
3.625
4
[]
no_license
""" https://leetcode.com/problems/add-two-numbers """ # Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: tmp = ListNode() ...
true
d7ebf28050b40a89d5ab3fb38aaeb07fdcb71f39
Shreyasc13/django-imagekit
/tests/test_closing_fieldfiles.py
UTF-8
804
2.53125
3
[ "BSD-3-Clause" ]
permissive
from nose.tools import assert_false, assert_true from .models import Thumbnail from .utils import create_photo def test_do_not_leak_open_files(): instance = create_photo('leak-test.jpg') source_file = instance.original_image # Ensure the FieldFile is closed before generation source_file.close() i...
true
542b1988d630201a17890cfd17644750ff782ea6
SincroB-Dev/safira-ide
/telas/splash.py
UTF-8
2,527
3
3
[ "MIT" ]
permissive
from tkinter import Frame from tkinter import Label from tkinter import Label from tkinter import NSEW from tkinter import Tk from time import sleep from platform import system as platform_system """ Tela inicial de Splash """ class Splash: def __init__(self, design): self.tela_splash = Tk() se...
true
a928cddf534694b4de3dda3d918e13ec3d692620
huyhoang17/128D-Facenet-LFW-Embedding-Visualisation
/sprite_image.py
UTF-8
1,646
3.078125
3
[ "MIT" ]
permissive
import numpy as np from scipy import misc from PIL import Image IMAGE_SIZE = 28 PATH = "path_to_image_folder" def images_to_sprite(data): """ Creates the sprite image Parameters ---------- data: [batch_size, height, weight, n_channel] Returns ------- data: Sprited image::[hei...
true
d85d0d0d70defedd585b9b7f5d76aa41f0bc6aad
smallpondtom/concentration_game
/myConcentration.py
UTF-8
15,908
4.1875
4
[]
no_license
""" ________ __________ ___________ ____________ |___ ___| | ___ | | ________| | | | | | |___| | | | | | | | | | | _______| | | | | | | __| | | | | |_______ | | | | |_____| |___| |___________| |__ |___...
true
9c631138c3090ab357cee792ca15adfc00508b5f
MerrybyPractice/data-structures-and-algorithms
/python/challanges/max_tree/test_max_tree_value.py
UTF-8
1,025
3.25
3
[]
no_license
from challanges.max_tree.max_tree_value import max_tree_value from data_structures.trees.tree import BinaryTree, Node import pytest @pytest.fixture def ent(): bt = BinaryTree() #root bt.root = Node(10) bt.root.left = Node(5) bt.root.right = Node(15) #root left child bt.root.left.left = Node(3) bt....
true
92fd5b8d76a574801c49b09d0a1a3204e9befc97
whambulance/project-euler-solutions
/python/003.py
UTF-8
134
2.734375
3
[]
no_license
def compute(): for i in range(600851475143//2, 0, -1): if 600851475143 % i == 0: return i print(compute())
true
bcd97c11d799811671fb5caa979f3d9d86c19f88
tayaza/GWAS-Catalog-Analysis
/scripts/snp_analysis.py
UTF-8
2,483
2.953125
3
[]
no_license
#!usr/bin/python import os import sqlite3 import csv """ Retrieves spatial eQTL SNPs from the 'spatial_eqtls' database and produces an output containing: 1) the genes which with the SNP regions interact with 2) the distance of the interactions and 3) whether these interactions are cis (i.e. < 1mb) or trans (i.e. > 1m...
true
835a6ad5624d84539764225d289caade3fec3643
NTomtishen/MathWithPython
/GraphicalEquationSolver.py
UTF-8
578
3.15625
3
[]
no_license
from sympy import * from sympy.plotting import plot import sys expr1str = raw_input('Enter your first expression in terms of x and y: ') expr2str = raw_input('Enter your second expression in terms of x and y: ') x = Symbol('x') try: expr1 = sympify(expr1str) expr2 = sympify(expr2str) except SympifyError: print ('I...
true
aa00c43f419ac83ff1c2a2d7eea9b48637d2b4f5
godzilla-but-nicer/sbgas
/sbgas/sbmga.py
UTF-8
3,902
3.1875
3
[ "MIT" ]
permissive
import numpy as np class DiscreteSBMGA: def __init__(self, fitness_function, pop_size, genome_size, mut_prob, rec_prob, sb_size, dorm_prob, deme_size, alphabet, random_seed=None): """ lets do it babyyyyyy """ # core parameters self.fitness = fitness_functio...
true
5b594e4362beb57e83dff9b9ad247d1f048e25dc
LukaszSzpak/Jezyki_Skryptowe
/Lista_8/App_tests.py
UTF-8
931
2.859375
3
[]
no_license
from App_controller import App_controller def tests(): covid = App_controller() print(covid.deaths_world()) print(covid.deaths_world(date_month='lipiec')) print(covid.deaths_world(date_month='czerwiec', date_day='05'), '\n\n') print(covid.cases_world()) print(covid.cases_world(date_month='li...
true
ab7516e9b0527cfd107c15f4c26ddbce20b8b8a7
vanessaperez/Modelos-3
/Problemario/Problema_7/simulacion.py
UTF-8
3,207
3.203125
3
[]
no_license
from aleatorio import random_demand, random_delivery_time # Datos del problema Q = 100 COSTO_POR_MANTENER = 0.2 COSTO_POR_ESCASEZ = 1 COSTO_POR_PEDIDO = 10 def iniciar_simulacion(maximo_dias, maximo_punto_reorden): # Inicalizamos las variables compartidas costo_minimo = 0 reorden_optimo = 0 costos_pr...
true
3d8822c924a85017abf47a1ff267ff2fc1a9059b
ajayasocean/learnSdet
/pythonBasicsOld/conversion.py
UTF-8
268
3.296875
3
[]
no_license
#mixed arithmetic operations print(int(4.75)) print(float(5)) #print(long(3)), this in not a valid conversion function as per latest python version print(str(97)) print(11/2) print(11/2.0) print(ord('A')) print(chr(65)) print(int(4.5)) print(float(4)) print(str(4.5))
true
aa6c47c77d83e442fc2f463adcaf283bdcdb68c4
Vadym-Skipa/HW13
/task4.py
UTF-8
655
3.90625
4
[]
no_license
# 4. Divide the work between 2 methods: print_cube that returns the cube of number # and print_square that returns the square of number. These two methods should be executed # by using 2 different processes. from concurrent.futures import ProcessPoolExecutor from multiprocessing import current_process def print_cube(...
true
3d1eceaa183f04d9bb99e6a7172f85c9b7682590
uint64t/data_mining
/fp_growth2.py
UTF-8
8,285
3.0625
3
[]
no_license
""" This code is copied from Andrew9255, https://gist.github.com/Andrew9255/7d75710d973e64a33187fca08c273840 """ import pandas as pd import os class node: def __init__(self, word, word_count=0, parent=None, link=None): self.word = word self.word_count = word_count self.parent = par...
true
f64dde89428aa82e1973ddb46ce526cff88112d5
basgitarist/dcore
/shell_ext/linediff.py
UTF-8
1,034
2.84375
3
[]
no_license
import os import argparse _meta_shell_command = 'linediff' def getArgs(): parser = argparse.ArgumentParser() parser.add_argument('left') parser.add_argument('right') parser.add_argument('-w', '--write', action = "store_true") args = parser.parse_args() return args def fi...
true
982f6e53fafeccce1674d7f4707c850198a2edf7
samuel930930/Dual-Manifold-Adversarial-Training
/attacks/manifold_attack.py
UTF-8
1,696
2.640625
3
[ "MIT" ]
permissive
from advertorch.utils import normalize_by_pnorm, batch_multiply from advertorch.utils import to_one_hot import torch import torch.nn as nn import torch.nn.functional as F class ManifoldAttack(object): def __init__(self, predict, gan, num_classes, loss_fn=None, eps_iter=0.0005, nb_iter=5, ord='inf'): self....
true
9a1bad8fd92fd6b38012c85b1dc776f03699119b
StarliteOnTerra/csci127-Assignments
/lab_03/madlibs.py
UTF-8
1,670
3.34375
3
[]
no_license
# Done by Jadeja Baptiste and Stacey Li import random adj = ["beautiful", "aggressive", "calm", "delightful", "silly"] noun = ["tiger", "cat", "house", "banana", "music"] verb = ["running", "jumping", "swimming", "laughing", "skating"] plural_noun = ["tigers", "cats", "houses", "bananas", "musics"] game = ["Scrabble"...
true
04f391facc89616c3654a9897773d809f71fe691
prajwalprabhu/chatbot
/client.py
UTF-8
924
2.953125
3
[]
no_license
import socket import json import threading from time import sleep c=socket.socket() name=input("Enter Your Name") ip=socket.gethostname() message=""" { "info":{ "name":"", "IP":"" }, "message":"Connected" } """ data=json.loads(message) data["info"]["name"]=name data["info"]["IP"]=ip str_data=json.d...
true
4c0b291cee4c67701c52352a6cf76431e6885446
cassioiribarrem/dojo
/fizzbuzz.py
UTF-8
328
3.921875
4
[]
no_license
def transform(number): result = '' if number % 3 == 0: result += 'Fizz' if number % 5 == 0: result += 'Buzz' if number % 3 != 0 and number % 5 != 0: result = number return result def fizzBuzz(last_number): for number in range(1, last_number+1): print(transform(...
true
c320ed1959e73acd6d48eacdb0ecff3790f8ef33
McNuggot/resilient-swarm-communications-with-meta-graph-convolutional-networks
/Drawing/Draw_GIF.py
UTF-8
2,574
2.875
3
[ "MIT" ]
permissive
""" GIF drawing function Note: should input the storage_remain_list, storage_positions, num_remain, storage_connection_states to this file """ from mpl_toolkits.mplot3d import Axes3D import matplotlib.animation as animation import matplotlib.pyplot as plt from Configurati...
true
7455b1536452c9fa7c7a4bdbc2b88786b159808e
Jinali/Password-manager
/ecb_mode_class_file.py
UTF-8
1,682
2.671875
3
[]
no_license
from Crypto.Cipher import AES from Crypto import Random import binascii import sys import os class ECBMode: def __init__(self): self.key = 'youcantseemehahahahajiniqueen!!!' def encrypt(self, plaintext): encrypt_mode = AES.new(self.key, AES.MODE_ECB) ciphertext = encrypt_m...
true
2c249f6d2ad82e6746734fb533e095222e8e34f1
binghe2402/learnPython
/Mooc 陈斌数算/4柱汉诺塔/hannoi_4_dp.py
UTF-8
375
2.765625
3
[]
no_license
def hannoi_4_num_move(n): han4 = [0]*(n+1) han4[0:3] = [0, 1, 3] han3 = [2**x-1 for x in range(n+1)] for i in range(2, n+1): for x in range(1, i): minhan4 = 2 * han4[i-x] + han3[x] if not han4[i] or minhan4 < han4[i]: han4[i] = minhan4 return han4[-1] ...
true
7dff157967382229ef33d90e29073e5f83b1b0d9
singhcse/Practice
/range.py
UTF-8
280
3.375
3
[]
no_license
def printsome(str): print(str) return def changelist(list): list=[1,2,3,4,5] print('elements in list : ',list) return list3=['you','are','great'] changelist(list3) print('\n') print('element in list :' ,list3) printsome('my name') printsome('your name')
true
7d6b845411a3631b659523ffc095b1081eac87b9
12ayushibansal/pythonlab
/dbwtwop.py
UTF-8
104
3.328125
3
[]
no_license
x1=int(input()) x2=int(input()) y1=int(input()) y2=int(input()) d=((x2-x1)**2+(y2-y1)**2)**0.5 print(d)
true
7025b5adff55cedf69c66777e657ba5a803201a1
sushantvyas97/Python_Scripting_L1
/1.py
UTF-8
311
3.03125
3
[]
no_license
Input = ["www.annauniv.edu", "www.google.com", "www.ndtv.com", "www.website.org", "www.bis.org.in", "www.rbi.org.in"] def domain_filter(Input): return Input.split('.')[-1] Output = sorted(Input, key=domain_filter) print("Initial list:") print(Input) print("Sorted list:") print(Output)
true
4c3b3cc67b2d4062cd9ca89c9e0c06a902a967b0
larryvsdata/Stochastic_Gradient
/gradientStochastic.py
UTF-8
2,710
3.0625
3
[]
no_license
import pandas as pd import numpy as np import random as rand fileName="MLproject.xlsx" sheetName="page1" df1=pd.read_excel(fileName,sheetName) columnNames= df1.columns rLength=len(columnNames) #Coefficients coef=np.zeros(len(columnNames)) coef[0]=-45.5 coef[1]=1.3 coef[2]=-1.1 coef[3]=-2.1 coef[4]=5.0 coef[5]=22...
true
217110ac33ecbca814ebef0f066bc77c932ccb35
emi80/encoded
/src/encoded/commands/upgrade.py
UTF-8
3,464
2.578125
3
[ "MIT" ]
permissive
"""\ Run this to upgrade the site. Examples To update on the production server: %(prog)s production.ini For the development.ini you must supply the paster app name: %(prog)s development.ini --app-name app """ from contextlib import contextmanager import logging EPILOG = __doc__ logger = logging.getLogge...
true
46d8cc93a7f028595cdfb53ccc99d8d237e18a62
qinenergy/leetCode
/76. Minimum Window Substring.py
UTF-8
847
3.046875
3
[ "MIT" ]
permissive
class Solution(object): def minWindow(self, s, t): """ :type s: str :type t: str :rtype: str """ start, end, left = 0, 0, 0 min_len = sys.maxsize hash = collections.defaultdict(int) for i in t: hash[i] += 1 num =...
true
2a025f056e94bcb63600163f41ce1abd8645ffa2
vijayalaxmi777/python
/1.Python Introduction/Assignments/4.py
UTF-8
487
4.46875
4
[]
no_license
#WAP to swap contents of 2 numbers using temporary variable def main(): print("Enter 1st number") num1=input() num1=int(num1) print("Enter 2nd number") num2=input() num2=int(num2) print("-------------- Before swapping -----------------") print("num1 = ",num1) print("num2 = ",num2) # logic of swapping temp=...
true
655087968ed6b9664f0e1cd8720bd2381b6b4475
gitPff/sb-
/lib/mioji/common/template/GetDayDiff.py
UTF-8
1,183
2.890625
3
[]
no_license
#!/usr/bin/env python # coding:utf-8 from mioji.common.utils import setdefaultencoding_utf8 setdefaultencoding_utf8() class GetDaydiff(object): def __init__(self): pass def __calsecond(self, hms): dur = 0 hms_list = hms.split(':') dur = int(hms_list[0]) * 3600 + int(hms_list...
true
98e67045a9870b0769f2566743ef90d4efaad8b0
katerina-statestitle/advent_of_code
/day15/puzzle_15.py
UTF-8
3,252
3.359375
3
[]
no_license
from collections import defaultdict PUZZLE_DAY = '15' class Game(): def __init__(self, starting_input): self.test_input = starting_input self.last_spoken = None self.turn = 0 self.times_spoken = defaultdict(list) def play(self, rounds): for x in range(0, rounds): self.make_turn() return self.last_s...
true
3788978609e5d12d8737c1c923069c1b210d2ab6
lixxu/jshdate
/jshdate/__init__.py
UTF-8
13,278
2.6875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import calendar from datetime import datetime, timedelta import six from dateutil.parser import parse __version__ = "0.3.0" ONE_DAY = timedelta(days=1) ONE_HOUR = timedelta(hours=1) SHIFT_MINUTE = "30" MONTH_FMT = "{}-{:02}-01 06:...
true
ac96c2d61af652b20ae86840941e7656b9d80984
chawasit/BackyardZigbee
/utils.py
UTF-8
1,242
2.953125
3
[ "Unlicense" ]
permissive
import serial import sys import glob def create_serial(port): sp = serial.Serial() sp.port = port sp.baudrate = 115200 sp.parity = serial.PARITY_NONE sp.bytesize = serial.EIGHTBITS sp.stopbits = serial.STOPBITS_ONE sp.timeout = None sp.xonxoff = False sp.rtscts = False sp.dsrdt...
true
8de453c31ac9c516ef3cd72b7a6ef365b1d563b1
maxking0p/Best-Password-Generator
/pass_gen.py
UTF-8
2,135
3.09375
3
[]
no_license
import random import time import pywhatkit as kit time.sleep(1) print("Okay! lets generate some passwords") print(".") time.sleep(1) print("..") time.sleep(1) pass_char = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz123456789)(*,.:&^%$#@!" user_input = int(input("bro how much pass.. do you wanna gener...
true
c4fd708784d50a4c682704f616a5edea7a546842
samrao1997/project_euler
/pr082.py
UTF-8
1,005
3.921875
4
[]
no_license
""" The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is indicated in red and bold; the sum is equal to 994. ( 131 673 234 103 18 201 96 342 965 150 630 803 746 422 111 537 699 497 121 956 8...
true
df92f4e12274c3a8252847acdfc9ce41e24756b9
deng0556/review_1120
/SimMultiTrans/bin/Network/Node.py
UTF-8
11,716
2.8125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from .Passenger import Passenger # from bin.Network.Vehicle import Vehicle from .Road import Road import numpy as np import logging import copy class Node(object): """ Use Node class to simulate the behaviors of passengers and vehicles in a node\\ methods:\\...
true
2b8e002fbb3dae0f4b959ebf005b7fa9019c4f0d
3l-d1abl0/DS-Algo
/py/bitonic_subrray_maxlen.py
UTF-8
689
3.625
4
[]
no_license
#O(n) tine and O(n) space def bito(arr): n = len(arr) inc = [0]*n dec = [0]*n inc[0]=1 for i in range(1,n): if arr[i]>=arr[i-1]: inc[i] = inc[i-1]+1 else: inc[i]=1 dec[n-1]=1 for i in range(n-2,-1,-1): if arr[i]>arr[i+1]: ...
true
b3742fb00f2b60a882c739c75c244883e6e2a375
reed9999/reed-hackerrank
/2d_array.py
UTF-8
1,685
3.046875
3
[]
no_license
#!/bin/python3 # https://www.hackerrank.com/challenges/2d-array/problem import math import os import random import re import sys class TwoDArray(list): def __init__(self, arr): self._row_array = arr def __len__(self): return len(self._row_array) def __getitem__(self, ix): return ...
true
fca9b00ce23cd29a5257dcdd91b4dfa8fb2e7c21
avcopan/fermitools
/fermitools/math/combinatorics/sign.py
UTF-8
373
3.015625
3
[]
no_license
"""Permutation signature.""" from sympy.combinatorics.permutations import _af_parity def signature(p, i): """signature of a permutation :param p: permutation, as a sequence of elements :type p: tuple :param i: identity permutation :type i: tuple :rtype: int """ px = tuple(tuple(i).in...
true
9a19f6d31295b902012c725effb49492ed0c413d
JetBrains/intellij-community
/python/testData/surround/CustomFoldingRegionLastMethod_after.py
UTF-8
361
3.0625
3
[ "Apache-2.0" ]
permissive
class ThisIsATest(): def __init__(self): self.test = 1 def another_one(self): print "Hello, world!" def another_two(self): print "Hello, world!" def another_three(self): print "Hello, world!" # <editor-fold desc="Description"> def another_four(self): p...
true
951aacef76c3bb5a5c5bd3c6f9199f2200a4080e
dianwen-ng/30-Day-LeetCoding-Challenge
/subarraySum.py
UTF-8
1,367
3.875
4
[]
no_license
""" *.*.*.*.*.* Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k. Note: The length of the array is in range [1, 20,000]. The range of numbers in the array is [-1000, 1000] and the range of the integer k is [-1e7, 1e7]. *.*.*.*.*.* Example: ...
true
5d9256a007270338cde7b6c7a17923d5de947373
AminuBishir/code_challenges
/draw_circle.py
UTF-8
438
3.40625
3
[]
no_license
import turtle def draw_cicular_square(): window = turtle.Screen() window.bgcolor("white") line = turtle.Turtle() line.shape("turtle") #the speed is change as recommended line.speed(40) line.color("green") for a in range(36): line.right(10) for i in range(4):...
true
b1fed13eeb5bd8a62be045734541f98ac8126111
priyamrvishnu/blogz
/main.py
UTF-8
7,868
2.578125
3
[]
no_license
from flask import Flask, request, redirect, render_template, flash, session from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['DEBUG'] = True app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://blogz:popcorn4@localhost:8889/blogz' app.config ['SQLALCHEMY_ECHO']=True #app.config['SQLALCHEM...
true
c52972bc048fc7b139d569099a543c2eb949c940
JamessssLiu/project-and-work-of-ICC-AL-CS-course-James-Liu
/Revision Paper 20191010/Q4.py
UTF-8
823
3.21875
3
[]
no_license
ClassList=[] StudentCont=open("StudentContact.txt","r") ClassCont=open("ClasContact.txt","w") #Search File def CreateArray(List,File): List=[] while len(File.readline())!=0: List.append(File.readline()) def SearchFile(Name,File): found=False while not found: text=File.readline() ...
true
66307975ecb4fe1769214d648dbdda69af94ad60
waynewu6250/LeetCode-Solutions
/652.find-duplicate-subtrees.py
UTF-8
900
3.0625
3
[]
no_license
# # @lc app=leetcode id=652 lang=python3 # # [652] Find Duplicate Subtrees # # @lc code=start # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findDupli...
true
0cfce75f93bb283b2370a70541a3e91778a86fec
ah4d1/anoapycore
/src-release/chart/boxplot/__init__.py
UTF-8
2,294
3.015625
3
[ "BSD-3-Clause" ]
permissive
import pandas as __pd import matplotlib.pyplot as __plt import seaborn as __sns class __data : q1 = None q2 = None q3 = None iqr = None lower_fence = None upper_fence = None report = None def show (a_data,a_column) : loc_plot = __sns.boxplot(x=a_data[a_column]) loc_data = __data() ...
true
7a8f07b52fb285b869db71afddb0e3ec963bdcc4
PHParis/ConProKnow
/conproknow/utils/helpers.py
UTF-8
707
3.3125
3
[ "MIT" ]
permissive
from re import compile from time import time import numpy as np def keep_alphanumeric_only(s: str) -> str: '''Removes all non alphanumeric caracters from the given string.''' pattern = compile('[\W_]+') return pattern.sub('', s) def timing(f): '''Decorator that track time.''' def wrap(*args): ...
true
0b94fd37288542ffbac40fba9f2ca9e7f4d9b50a
Planheat/Planheat-Tool
/planning_and_simulation_modules/VITO/Prioritization_algorithm.py
UTF-8
2,098
2.734375
3
[ "MIT" ]
permissive
import pandas import os tb_rows = 10 tb_columns = 8 vito_criteria = 16 offset_x = 1 offset_y = 59 delta_x = 11 delta_y = 16 def prioritization_algorithm(weights=(10, 0, 10, 2, 5, 7, 0, 5, 4, 0, 3, 0, 0, 0, 0, 0)): output_vito = {"Space heating high temperature": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], ...
true
b564c5636a018affe69657477c2b04cdfd2b5a2a
githubtoyou/learnpy
/builtInModule/hashlib_t.py
UTF-8
1,475
2.765625
3
[]
no_license
#-*- coding = utf-8 -*- #@Time:2021/5/1313:29 #@Author:Charlie #@File:hashlib_t.py #@Software:PyCharm #Ctrl + D 复制选定的区域或行到后面或下一行 #Shift + Enter 下一行另起一行 #Ctrl + Delete 删除到字符结束--->往后删除全部 #Ctrl + Backspace 删除到字符开始《----往前删除全部 #Ctrl + / 行注释(可选中多行 import os, types, logging, pdb, sys...
true
36858cb607531bcca65a62ed1dacf286b7fa80a2
Sidney-06/mes-programmes
/générateur de nombre entre 1 et 100.py
UTF-8
520
3.859375
4
[]
no_license
from random import randint print() print("vous etes actuelment dans un générateur de nombre !!!") print() party = input("voulez vous générer un nombre entre 0 et 100 ? (écrire oui ou non) : ") print() if party == "oui": nb = randint(0,100) print("le nombre générer est : ", nb,"!!!") print() print("mer...
true
1fd0f0faf9527c2c449f4bdba81dabad6a10fbb1
kingOfFps/my-pygame
/接球/ball3.0.py
UTF-8
6,426
3.296875
3
[]
no_license
# 这是我在嵩天老师的弹球源代码的基础上,用oop重写了一边。加入了挡板移动功能,算是个游戏了游戏 # 此游戏是一个很好的开发框架,以后用pygame写游戏可以在此基础上开发 import pygame import sys # 可采用单例模式 class Ball: width = 80 height = 80 # speed[0]是小球的横向速度,speed[1]是小球的纵向速度 speed = [2, 2] # x,y表示小球的x,y坐标 # x, y = 0, 0 x, y = 0, 0 # 小球图片路径 picPath = "./pic/ball....
true
f1dd66f5d62a25ebecd1e13c6c920cc30a2b362e
ronaldlam/Autotrageur
/libs/logging/bot_logging.py
UTF-8
4,247
3
3
[]
no_license
import logging import logging.handlers import os from datetime import datetime from queue import Queue class AutotrageurBackgroundLogger: """Encapsulates the Background Logger for the Autotrageur Bot. Utilizes the Builder pattern to add each component of the Background Logger.""" def set_stream_handl...
true
419882807d6ebcbdcd3f63a856f5d262379e8d22
vyao95/E4-4U
/main.py
UTF-8
11,888
3.078125
3
[]
no_license
from MCTS import MCTS from connect4 import Board import pyscreenshot as ImageGrab import PIL as Image # issues with pynput clicking at wrong location on screen despite saying it clicks where I want. from pynput.mouse import Button, Listener # so using pyautogui to handle clicks import pyautogui import sys import os i...
true
fef9e4cf29228dd637245603f096caafff8db358
AdamZhouSE/pythonHomework
/Code/CodeRecords/2542/60795/254358.py
UTF-8
415
2.953125
3
[]
no_license
arr=input() newarr="" for i in range(1,len(arr)-1): newarr=newarr+arr[i] list=[int(n) for n in newarr.split(',')] for i in range(0,len(list)): for j in range(i+1,len(list)): if list[i]>list[j]: list[i],list[j]=list[j],list[i] max,sum=0,1 for i in range(1,len(list)): if list[i]-list[i-1]=...
true
8a9933007e83345757c765a135a88dbd986c2776
mauricedenassau/atbswp-2
/ch06/bulletPointAdder.py
UTF-8
407
3.4375
3
[]
no_license
#! python3 # script that adds Wikipedia bullet points to the start # of each line of text on the clipboard import pyperclip text = pyperclip.paste() # Separate lines and add stars lines = text.split('\n') for i in range (len(lines)): # loop through all indexes in the "lines" list lines[i] = '* ' + lines[i] # ad...
true
e4dd90d46aaf345a0c44353231af1f450966b2e0
Jayna822/dd-coding-challenge
/app/api_logic.py
UTF-8
6,974
2.734375
3
[]
no_license
import requests import copy import numbers GITHUB_API = 'https://api.github.com' # currently v3 BITBUCKET_API = 'https://api.bitbucket.org/2.0' # I'm not completely sure on the requirements for this results dict. # At first, I just included all the aggregated data, but then decided to include the repo details as well...
true
eed562c5f853b7bc72b6a81de8da42a4db1c28a8
bhattaomatic/Statistical_Analysis
/examples/1_Loading_learning_predicting_example.py
UTF-8
384
3.046875
3
[]
no_license
#!/usr/bin/env python from sklearn import datasets import numpy as np from sklearn import svm # Loading an example dataset iris = datasets.load_iris() print iris.data.shape print iris.target.shape print np.unique(iris.target) # Learning and predicting clf = svm.LinearSVC() clf.fit(iris.data, iris.target) # learn f...
true
832a02ff7ec0a5ee46eaa1dea48282e7ef589537
chaitanyaj14/mlProject
/PCA_FD_Project/FaceRecognitionUsingPCA/Face_Recognition.py
UTF-8
3,609
2.84375
3
[]
no_license
import cv2 import time # importing algorithms from PCA import PcaClass # importing feature extraction classes from images_to_matrix import ImagesToMatrixClass from dataset import DatasetClass # for video = 1 reco_type = 0 # No of images For Training(Left will be used as testing Image) no_of_images_of_one_person = 8...
true
07f3447b172af6b91ed5c73bf69f4cce1e4bd975
Negation-in-negative-reviews/Datasets-preprocessing
/code/utils.py
UTF-8
843
2.890625
3
[]
no_license
import os import spacy import numpy as np import random def write_file(sents, out_file): with open(out_file, "w") as fout: for s in sents: fout.write(s.strip("\n")+"\n") def read_file(filename): reviews = [] with open(filename, "r") as fin: for line in fin: ...
true
4a0a20343f095632cf42e4f3311e60c0e2c6647f
mat1jaczyyy/honi
/2017/kolo4_izbori.py3
UTF-8
597
2.890625
3
[]
no_license
from itertools import combinations def win(a, x): c = [0] * m for i in range(n): y = a[i][0] j = 1 while y in x: y = a[i][j] j += 1 c[y] += 1 return c.index(max(c)) n, m, k = [int(i) for i in input().split()] k += -1 a = [[int(j) - 1 for j in input().split()] for i in range(n)] x = [] w = win(a, x)...
true
5e62e149c9e0ba1b787df7d5e20a0429d0fabbaa
raghu619/Lo
/Pythonnew/secondprog/Fibbonnaci.py
UTF-8
474
3.734375
4
[]
no_license
fibonacci_cache={} def fibonacci(n): #implicit explaination of cache if type(n) !=int: raise TypeError("n must be positive integer") if(n<1): raise ValueError("n must be a Postive Integer") if n in fibonacci_cache: return fibonacci_cache[n] if n==1: value=1 if n=...
true