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
b248402423a86a908f9957fca8c009a5f4d092db
0utfoxed/reticulated_python
/Code Academy/the_break_keyword.py
UTF-8
119
3.5
4
[]
no_license
numbers = [0, 254, 2, -1, 3] for i in numbers: if (i < 0): print("Negative number detected!") break print(i)
true
afd565196dcd2aa6c6c3c5bc5e1066e774f06cf9
KrTeaparty/git_tutorial
/practice.py
UTF-8
79
3.453125
3
[]
no_license
a = 10 b = 20 print(a+b) c = 5 d = 6 print(c*d) e = 50 f = 5 print(e/f)
true
f56ae03e4760b1b27d22afc55f2ccf10d09fe96e
pen-ualberta/Introduction-to-Computing-Foundations-II
/Lab8/lab8.1.py
UTF-8
3,546
4.25
4
[]
no_license
#Excercise 1 def mylen(aList): ''' Parameters: a list Purpsoe: to find the length of a list using recursion Returns: the length of a list ''' if aList: num = 1 + mylen(aList[1:]) else: num = 0 return num #Excercise 2 def intDivision(dividend, divisor):...
true
127c2b018aba6dfddf6d64618f23fb9cd2dc9a55
ElenaR1/Python-101
/week11/hospital/doctor.py
UTF-8
1,696
2.84375
3
[]
no_license
from hospital.database import Database class DatabaseConnectionError(Exception): pass class Doctor: db=Database() def __init__(self,title,id_user): self.title=title self.id_user=id_user @classmethod def find(cls,username,password):#we make the connection to the databas...
true
530a24d94d804a33fd388ce45f9db45a571da956
Surbhi-Golwalkar/Python-programming
/loop/program.py
UTF-8
120
2.90625
3
[]
no_license
# n=int(input("enter no.")) # i=1 # while(n!=0): # i = i*(n%10) # n=n//10 # print(n) list(range(-10,-20,4)))
true
3ec432e4ec196e322aabb5cf62db9654f624d528
kevinsingapore/Python
/function/demo03.py
UTF-8
171
2.984375
3
[]
no_license
#!/usr/bin/python2 #-*- coding:UTF-8 -*- def kevin(a,b): if b == 0: print "除数不能为0" else: print a / b if __name__ == '__main__': kevin(8,5)
true
a57d619bfe268c05c119f92cbe1e77d68014e326
jnettels/lpagg
/lpagg/misc.py
UTF-8
9,515
2.765625
3
[ "MIT" ]
permissive
# MIT License # Copyright (c) 2022 Joris Zimmermann # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merg...
true
670b1d47925a5209d10d4998eff8aa243bded6ef
Mrwang19960102/work
/model/pratice/deal_B2C.py
UTF-8
2,703
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- # @File: | deal_B@C.py # @Date: | 2021/1/21 15:52 # @Author: | ThinkPad # @Desc: | import pandas as pd df = pd.read_excel('./B2C退货数据.xlsx', converters={'入库单': str}) print(list(df.columns)) df.sort_values(by='创建日期', inplace=True) print(df) sum = 0 sum_list = [] n =...
true
ac91707aadeea91fc85ddb3d40cb75f07c07976c
SuleimanSarb/SPOJ_Suleiman
/Quiz 2/Кастинг/1.py
UTF-8
127
3.125
3
[]
no_license
k = input() n,a,b,c = map(int,input().split()) if k == '2': print(min(a,b,c)) else: print(max(a,b,c)-min(a,b,c))
true
d688d3b63285d3a63ae499039c8eebeaff4d93c5
boc-auto/test
/utils/test_auto1.py
UTF-8
642
3.03125
3
[]
no_license
import pytest def func(x): return x + 1 @pytest.mark.parametrize('a,b',[ (1,2), (5,7), (6,10), (9,10) ]) def test_answer1(a,b): assert func(a) == b def test_answer2(): assert func(4) == 5 @pytest.fixture() def login(): print('需要登录的model') username = 'jerry' return username ...
true
0cfb18f9bb645f8c968aac52c4aeec0c102050f8
wyaadarsh/LeetCode-Solutions
/Python3/0503-Next-Greater-Element-II/soln.py
UTF-8
424
2.96875
3
[ "MIT" ]
permissive
class Solution(object): def nextGreaterElements(self, nums): """ :type nums: List[int] :rtype: List[int] """ res = [-1] * len(nums) stack = [] n = len(nums) for idx, num in enumerate(nums + nums): idx %= n while stack and num > ...
true
4443892283bd654363a8ce33cfac89d9946bfe06
haseebjaved/Connect4
/agents/agent_MCTS/montecarlo.py
UTF-8
7,141
3.328125
3
[]
no_license
import numpy as np from agents.common import PlayerAction, apply_player_action, BoardPiece, available_columns, opponent, connected_four, \ check_end_state, PLAYER2, PLAYER1, NO_PLAYER, SavedState, GenMove, GameState from agents.agent_random.random2 import generate_move_random from typing import Optional, Callable, ...
true
33c4460890d6657349dc98ca397e9bb0dac96294
Code-Wen/LeetCode_Notes
/212.word-search-ii.py
UTF-8
2,548
3.515625
4
[]
no_license
# # @lc app=leetcode id=212 lang=python3 # # [212] Word Search II # # https://leetcode.com/problems/word-search-ii/description/ # # algorithms # Hard (33.26%) # Likes: 2360 # Dislikes: 105 # Total Accepted: 199.5K # Total Submissions: 591.3K # Testcase Example: '[["o","a","a","n"],["e","t","a","e"],["i","h","k",...
true
3729015c2f3660675ca44e4743392fd157ec54dd
odys-z/hello
/challenge/leet/medium/q692.py
UTF-8
1,210
3.53125
4
[ "MIT" ]
permissive
''' ''' from unittest import TestCase from typing import List import heapq class Solution(): ''' Runtime: 60 ms, faster than 30.47% of Python3 online submissions for Top K Frequent Words. Memory Usage: 14.6 MB, less than 10.25% of Python3 online submissions for Top K Frequent Words. ''' def topKFre...
true
31b86133079cf868103b0b2d8d0fe95a9bda7cda
WilliamDiakite/Stage
/AnomalyDetection/trunk/class_LSTMAutoencoder.py
UTF-8
8,878
2.90625
3
[]
no_license
# coding: utf-8 import tensorflow as tf import numpy as np import pandas as pd import matplotlib.pyplot as plt plt.style.use('ggplot') from seq2seq_data_preparation import get_seq2seq_batch from utils import drange class LSTMAutoencoder(object): def __init__(self, model_name, data_shape, hidden_dim, learning_ra...
true
f9c58f1338d19540bcff6478b4e52eb5b1d56734
learndevops19/pythonTraining-CalsoftInc
/Day_04/Sample_Codes/sample_generator_expression.py
UTF-8
205
4
4
[]
no_license
# Initialize the list my_list = [1, 3] # List comprehension lst = [x ** 2 for x in my_list] print(lst) # Generator Expression gen = (x ** 2 for x in my_list) print(gen) print(next(gen)) print(next(gen))
true
ad87dea422fd452aaae1fc576e1e8bd76ffa24e8
nalet/bme.Finite-Element-Analysis-I
/assignment7/plot.py
UTF-8
2,569
3.203125
3
[]
no_license
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt def read_rpt(filename) : # Import data using Pandas. Using report I XY data, this line should work data = pd.read_csv(os.path.dirname(os.path.abspath(__file__)) + '/' + filename, skiprows=5, header=None, delim_...
true
d1f701388fcdc086e3810ab766cc3eab13b2d4c7
reshma-jahir/GUVI
/set1sixpro.py
UTF-8
190
3.015625
3
[]
no_license
u44=int(input()) o44=list(map(int,input().split())) c=0 for i in range(0,u44-2): for j in range(1,u44-1): for k in range(2,u44): if(o44[i]<o44[j] and o44[j]<o44[k]): c+=1 print(c)
true
5ebf0ff1fb93389c1234f306728f380cf5bdb389
beekbin/simpleCNN
/nn/simple_nn.py
UTF-8
3,655
2.90625
3
[]
no_license
from __future__ import division from __future__ import print_function import numpy as np import logging class NNetwork(object): def __init__(self): self.input_layer = None self.output_layer = None self.hidden_layers = [] self.errors = [] self.log_interval = 1000 ret...
true
95cc5c424fbf30b1cda27a0717d79ad4aae60d23
pyxyyy/sound-and-music-computing
/assignment4/synthesis.py
UTF-8
3,071
3.0625
3
[]
no_license
""" usage: python synthesis.py (a) synthesises a wav file modeled after scale.wav (b) lengthens one of the notes in scale.wav as laid out in assignment4.pdf """ import numpy import scipy.io.wavfile import pylab fs = 44100 fin = '../data/scale.wav' fout = 'sin_scale.wav' fout_long = 'long_scale.wav' f0 = [261.63, 293...
true
ddc37be0b1bfbbf61feb614ae3b82edeaf27d063
klistwan/project_euler
/39.py
UTF-8
721
3.59375
4
[]
no_license
def get_solutions(p): a = 1 b = 2 c = p - a - b sols = [] while c - 2 >= a: to_go = range(b,((b+c)/2)) if not to_go: #If it's empty, then goes here. ls = a*a + b*b rs = c*c if a*a + b*b == c*c: sols.append([a,b,c]) else: ...
true
564e86b3c07b5c2b2e27103ab23b6deeee8c057e
sathish0706/guvi-codekata
/Array/47.py
UTF-8
105
2.890625
3
[]
no_license
lst = list(map(str,input().split())) n = input() if n in lst: print(lst.count(n)) else: print(-1)
true
44eb11e63ddd27560dd6848185facf056dbb4d24
caioraveli/Python2021
/02-Intermediate/07-dicionarios03.py
UTF-8
950
4.3125
4
[]
no_license
d1 = { 'str' : 'Valor', 123: 'Outro valor', (1,2,3,4) : 'Tupla', } # Trabalhando só com os valores - coluna da direita print(d1.values()) # dict_values(['Valor', 'Outro valor', 'Tupla']) print('str' in d1) # retorna True print('Valor' in d1.values()) # retorna True # Mesma coisa só que pra chaves print...
true
02c30ed3d362c16d4b6f4c7e2cf2ff6cc675f7f1
ananiastnj/PythonLearnings
/LearningPrograms/passing_list_as_argv.py
UTF-8
122
3.234375
3
[]
no_license
def sumList(sumv): tc = 0 for i in sumv: tc += i return tc list1 = [5,10,25,30] print(sumList(list1))
true
5b8ded2023fa40c346d0709fd4abb03dd0d942e9
chinitacode/Python_Learning
/Practice/fib.py
UTF-8
408
3.625
4
[]
no_license
def fib_iter(n): i = 0 prev,curr = 0,1 while i < n: prev,curr = curr,prev + curr i += 1 return prev def fib_recur(n): if n == 0: return 0 elif n == 1: return 1 else: return fib_recur(n-2) + fib_recur(n-1) def fib(n): prev,curr = ...
true
dd3324113fe41c3a6833d5f75fb94fccde892648
eshelukhina/HSE2021-WebBackend
/application/tests/test_integration.py
UTF-8
2,897
2.859375
3
[]
no_license
import random import string from datetime import date from random import randint from random import seed from application.db.fake_db import data from application.logic.card import is_valid_patient, check_other_appointments, add_visit_helper from application.models.medical_cards import MedicalCard, Appointment, Doctor,...
true
23738593c958a01c7f6736f121fc019adc4a755b
cict-emc230/exercises
/dope-a-meme.py
UTF-8
1,877
3.71875
4
[]
no_license
import turtle import random colors = ['#7D5D99', '#FF6F61', '#D5D717', '#A32857', '#0084A1', '#EE6D8A'] my_turtle = turtle.Turtle() my_turtle2 = turtle.Turtle() my_turtle.speed(0.5) my_turtle.pensize(5) my_turtle.penup() my_turtle.setposition(-80, -150) my_turtle.pendown() def drawACurvedLine(count, angle, length...
true
ab250ff6a83185a844f7011abf8fb673a3dc1533
Lera-Z/hw_python_Lera_3year
/hw_6_Zelenkova.py
UTF-8
4,200
3.75
4
[]
no_license
import re import pandas as pd import unittest with open('snippets.txt', 'r') as f: f = f.read() def to_table_pandas(left, word, right): """ create a DataFrame object with three columns: left context, word, right context :param left: list - array with all left contexts :param word: str - keyword :p...
true
e78ebcf613815e6cefcad1445762bb259a48a6b7
nucleic/atom
/tests/test_del_behaviors.py
UTF-8
2,225
2.75
3
[ "BSD-3-Clause" ]
permissive
# -------------------------------------------------------------------------------------- # Copyright (c) 2013-2023, Nucleic Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # --------------------------------------...
true
aee608218971d4b0c06e87382ccd246a4deeae45
MarceloBD/DJdogz-web
/utils/tsv.py
UTF-8
175
2.546875
3
[]
no_license
import csv class tsv: def __init__(): return def open_tsv(file): with open(file) as tsvfile: reader = csv.DictReader(tsvfile, dialect='excel-tab') return reader
true
b9dc9f75656ed58817ddccef879decb1996dc180
astaff/labware
/labsuite/compilers/pfusx.py
UTF-8
11,803
3.125
3
[ "Apache-2.0" ]
permissive
""" This script takes a 15 nucleotide target sequence followed by a base pair representing the receiver plasmid. It outputs an OT-One protocol to assemble a TALEN protein with the pFusX system, which provides a pre-plated library of plasmids and a database of well positions for this script to query. Input is a string...
true
54658829745047fb4ef53272a84a39b899c43b9b
qq1123702939/numpy
/第一天/1.py
UTF-8
189
3.265625
3
[]
no_license
import numpy as np array = np.array([[1,2,3], [2,4,3]]) print(array) print('number of dim:',array.ndim) print('shape:',array.shape) print('size',array.size)
true
d50c0e07288040d8f3f091f50ee4d9e30062ffd1
mokshkant7/La_Casa_De_Papel
/Code/UDPClient.py
UTF-8
739
2.859375
3
[]
no_license
import socket from Crypto.Cipher import AES obj2 = AES.new(' Moksh is the Professor ', AES.MODE_CBC, 'This is an IV456') msgFromClient = "Hello UDP Server" bytesToSend = str.encode(msgFromClient) serverAddressPort = ("127.0.0.1", 21111) bufferSize = 1024 # Create a UDP socket at cl...
true
2086baf23ade2d99dfc7ed0f785ff3350629ac52
yukisusu/RTL-SDR_Python
/fm_sample.py
UTF-8
3,989
2.875
3
[]
no_license
from rtlsdr import RtlSdr import numpy as np import scipy.signal as signal import matplotlib.pyplot as plt # get device sdr = RtlSdr() F_station = 81.3e6 # 81.3MHz J-Wave Tokyo Sky Tree F_offset = 25000 # Offset to capture at (to avoid DC spike) center_freq = F_station - F_offset # Center frequency Fs = int(1140...
true
c9231958f2b924e76cf5d2fc7056a4ba9e64c207
just-ai/model-api-example
/scripts/main.py
UTF-8
686
2.53125
3
[]
no_license
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. import sys import spacy import json from spacy.matcher import Matcher from spacy.tokens import DocBin from common import g...
true
31899a5d00573614be9a72e1c39ad8f530c43263
ProkopHapala/SimpleSimulationEngine
/cpp/apps/MolecularEditor/py/bas2zero.py
UTF-8
704
2.515625
3
[ "MIT" ]
permissive
#!/usr/bin/python import numpy as np import sys fname_in = sys.argv[1] fname_out = sys.argv[1] def toZeroMinMax( bas ): xmin=bas[:,1].min(); xmax=bas[:,1].max(); bas[:,1]-=(xmin+xmax)*0.5 ymin=bas[:,2].min(); ymax=bas[:,2].max(); bas[:,2]-=(ymin+ymax)*0.5 zmin=bas[:,3].min(); zmax=bas[:,3].max(); bas[:,3]-=(zmin...
true
f4074bf9bf3b90483ec64e3035469b38f796fd87
zhanghuaisheng/mylearn
/Python基础/day010/06 函数的名称空间.py
UTF-8
703
4.125
4
[]
no_license
# 函数的名称空间: # 1.内置空间 -- 存放python自带的一些函数 # 2.全局空间 -- 当前py文件定格编写代码开辟的空间 # 3.局部空间 -- 函数体 # 程序加载顺序(从外向内):内置空间 > 全局空间 > 局部空间 # 程序取值顺序(从内向外):局部空间 > 全局空间 > 内置空间 # a = 10 # b = 10 # def func(): # a = 6 # print(a) # print(b) # func() # 作用域: # 1.全局作用域:内置 + 全局 globals() 查看全局作用域 # 1.局部作用域:局部 locals() 查看当前作用域(建议查看局...
true
28a7e38faf1163f3d91b62e87ae864ba58317c44
PhilWun/MAProjekt
/src/pl/numpy_examples.py
UTF-8
3,519
2.625
3
[]
no_license
import argparse from typing import Callable, Tuple import mlflow import numpy as onp import pennylane as qml import pennylane.numpy as np from pennylane import QNode import QNN1 import QNN2 import QNN3 def normalize_output(output): return output / -2.0 + 0.5 def cost_func_constructor(qnode: QNode, input_values: ...
true
31096f4d32c4c7f2474853dc16a7b770e145e3ce
XilunWu/courses
/cs573/midterm/Q1.py
UTF-8
5,687
2.515625
3
[]
no_license
import numpy as np import pandas as pd from sklearn.naive_bayes import BernoulliNB from sklearn.naive_bayes import GaussianNB from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import classification_report from sklearn.metrics import f1_score from sklearn.cross_validation import KFold from sklearn impor...
true
a31985b0824aaaebb24a1a5b0a226f2714f342cc
salmonofdoubt/TECH
/PROG/PY/py_dummies/py4du__name__main__.py
UTF-8
277
3.203125
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ py4du__name__main__.py """ def f(x): '''a small function''' y = 2**x return y if __name__ == "__main__": '''and it\'s testcode''' print "testing, passing the value 8..." z = f(8) print "the function returns", z
true
7a15fd6b4e05d9743d0ccd5e5bda4005149a0a72
yogeshjadhav7/intellecto
/intellecto/challengesimulator.py
UTF-8
3,819
2.765625
3
[]
no_license
from intellecto import Intellecto import numpy as np import gc import warnings warnings.filterwarnings("ignore") class ChallengeSimulator: def __init__(self): self.I = Intellecto() def simulate_challenge_game(self, model, ipca, queue_size, predict_method=None, difficulty=None, verbose=False): ...
true
6a629ea05995fc11b30aa078b195e6fc32a2388c
ferreret/python-access-web-data
/week_4/assignment_1.py
UTF-8
652
2.859375
3
[]
no_license
# Sample data: http://py4e-data.dr-chuck.net/comments_42.html # Actual data: http://py4e-data.dr-chuck.net/comments_48982.html from urllib.request import urlopen from bs4 import BeautifulSoup import ssl # Ignore SSL certificate errors ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = s...
true
f2baf749f7123f7fa791bf3020cb9ab1f51f5d3e
kcranston/opentree_status
/add_ids_to_jsons.py
UTF-8
1,027
2.734375
3
[ "BSD-3-Clause" ]
permissive
# reads status jsons # extracts studyID and adds as _id field # so that can be import into couchdb # assumes 1. want to import all .json files import sys import os import json import glob def usage() : print "Usage: add_study_ids.py source_directory target_directory" # crappy command-line parameter parsing source...
true
b8e95fe0a43ed65a21d82faeebf41bc9d71d068b
Drakonix000/streamlit-whitehat-jr
/iris_app.py
UTF-8
1,359
3.4375
3
[]
no_license
import streamlit as st import matplotlib.pyplot as plt import seaborn as sns from sklearn.svm import SVC from sklearn.model_selection import train_test_split import pandas as pd iris_df = pd.read_csv("iris-species.csv") iris_df['Label'] = iris_df['Species'].map({'Iris-setosa': 0, 'Iris-virginica': 1, 'Iris-ve...
true
3fb7b7bf17767586e23d66acd41c0b4ee4c3c7a4
rootally/Movie-Recommendation
/conv.py
UTF-8
658
3.390625
3
[]
no_license
import pandas as pd fd=pd.read_csv("data.csv", names=["movie_id","movie_name","year","director", 'rating', ]) data_dict=fd.to_dict() class movie(object): def __init__(self,dictionary): for key in dictionary: setattr(self,key,dictionary[key]) data_dict["movie_id"]= dict((v,k) for k,v in data...
true
8b0126c51a5e1fb4c553a9a179dbeefe9df7f16b
omerfarukbasar/HackAdelphi-2021
/AdelphiHack/CryptoProgram.py
UTF-8
6,218
3.8125
4
[]
no_license
# Author: Omer Basar # Filename: CryptoProgram.py # Version: 4/14/21 # Additional Notes: Learned how to use PySimpleGUI from their website # https://pysimplegui.readthedocs.io/en/latest/cookbook/#recipe-pattern-2b-persistent-window-multiple-reads-using-an-event-loop-updates-data-in-window # Additional Notes: Learned ho...
true
4e160523f340e001496f30cb1bfc14ff5182c291
monkeylyf/interviewjam
/dynamic_programming/leetcode_Expression_Add_Operators.py
UTF-8
1,840
4.03125
4
[]
no_license
"""Expression ad operators leetcode Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or * between the digits so they evaluate to the target value. Examples: "123", 6 -> ["1+2+3", "1*2*3"] "232", 8 -> ["2*3+2", "2+3*2"] "105", 5 -> ["1*...
true
8e46f6c838b20ed23476c03fce24b63b7bb1aab1
ApocalypseMac/LeetCode
/Code/py3/85.最大矩形.py
UTF-8
1,045
3.0625
3
[ "MIT" ]
permissive
# # @lc app=leetcode.cn id=85 lang=python3 # # [85] 最大矩形 # # @lc code=start class Solution: def maximalRectangle(self, matrix: List[List[str]]) -> int: if matrix == []: return 0 m, n = len(matrix), len(matrix[0]) dp = [0] * (n + 2) # max height res = 0 f...
true
2afee7393817497e3f1389ce475841a0b2bcadb6
aneels3/Algorithm
/HackerRank Problem/Python/Blacklist.py
UTF-8
1,034
2.890625
3
[]
no_license
# N represents victims # K represents hitmen N, K = map(int, input().split()) cost = [] MASK = 2<<K INF = 10**8-1 for i in range(K): prices = [int(i) for i in input().split()] prices.reverse() cost.append(prices) # dp stores possibilities dp = [] for i in range(MASK): dp.append([INF] * (N + 1)) dp[0...
true
ae932bdba0ab8fba248b4022aadfa8238a2bf71b
ethanschafer/ethanschafer.github.io
/Python/PythonBasicsPart1/labs/PythonUnit2_IfStatements/slides/ifs.py
UTF-8
219
3.546875
4
[]
no_license
print "Ifs Example 1" num = 97 if num >= 90: print "Hello" print "World" print "\n\nIfs Example 2" num = 50 if num >= 90: print "Hello" print "World" print "\n\nIfs Example 3" num = 150 print (num <= 90)
true
1b24b5389c6068788cd88b4e8b6aa5ea3a6519c1
CodeBrakes/spaCy-and-AWS-named-enitity-identifier
/spacyEntRec.py
UTF-8
849
2.90625
3
[]
no_license
import re import spacy import AnalyzeDatasets if __name__ == '__main__': #Fetch data from datasets input = AnalyzeDatasets.AnalyzeDatasets #Load spaCy NLP library and statistical models nlp = spacy.load("en_core_web_sm") #Initialize data string list data = [] #This for loop app...
true
f8bb86e83f23a03bec6b51bcf4c3dafd8879e2b3
jsemig/rhasspy
/rhasspy/utils.py
UTF-8
16,882
2.6875
3
[ "LicenseRef-scancode-free-unknown", "MIT" ]
permissive
"""Rhasspy utility functions.""" import collections import gzip import io import itertools import json import logging import math import os import random import re import subprocess import threading import wave from collections import defaultdict from pathlib import Path from typing import Any, Callable, Dict, Iterable...
true
1b87c2e837c0971da1def05d7233dedb8aee08ed
ozch/MiB-Server-Django-With-Module-Integration
/BackgroundJobs/Topology/topology_services.py
UTF-8
2,132
2.53125
3
[]
no_license
from singleton import Singleton from .topology_graph import TopologyGraph from Topology.models import TopologyServer from .topology import Topology import time from .mysql_connection import * def NetworkTopologyScanThread(): config = Singleton tp = Topology() tg = TopologyGraph() print(">>Starting Job...
true
2b755a6747e87a52f28d43ffe2755a6590df5385
vincentyliu2001/Tetris
/Tetris/main.py
UTF-8
11,673
3.015625
3
[]
no_license
import graphics import random import pieces import time from board import Board from pieces import * import AI_helper pygame.init() # makes the bag to get pieces from def initialize_bag(piece_bag, piece_bag2): piece_bag.clear() piece_bag2.clear() for i in range(7): piece_bag2.append(i) for i...
true
ae13313e4701dec3ec5a0bec91462ea786828013
zzggbb/rosalind
/subs.py
UTF-8
402
3.609375
4
[]
no_license
#!/bin/env python3 import sys """ Given: Two DNA strings 's' and 't'. Return: All locations of 't' as a substring of 's'. """ s = sys.stdin.readline()[:-1] t = sys.stdin.readline()[:-1] indexes = [] for i in range(len(s)): j = 0 while i+j < len(s) and j < len(t) and s[i+j] == t[j]: j += 1 if j =...
true
9a700acdc651f5d6930c8901a321df2037d7a782
matejc/opensezame
/src/opensezame/entrypoints.py
UTF-8
2,248
3.03125
3
[]
no_license
from opensezame import get_real_path from shutil import copy import argparse import os def copyproject(source_path, destination_path): for root, dirnames, filenames in os.walk(source_path): for filename in filenames: if os.path.splitext(filename)[1] in ['.py', '.json', '.html']: ...
true
cf37703fe80b17dfabfd888ed0d05a0e432d1ca9
ISISComputingGroup/EPICS-upgrade
/test/test_upgrade_base.py
UTF-8
6,785
2.625
3
[]
no_license
import unittest from hamcrest import * from mock import MagicMock as Mock from src.upgrade import Upgrade, UpgradeError from src.upgrade_step import UpgradeStep from mother import LoggingStub, FileAccessStub class TestUpgradeBase(unittest.TestCase): @unittest.mock.patch("git.Repo", autospec=True) def setUp(...
true
635c87e5a232f812f7c2d0f181d50db75bc14e10
zzurie/zurie
/yczhyx/test_case/InformationList_add.py
UTF-8
2,800
2.625
3
[]
no_license
# -*- coding: utf-8 -*- import sys sys.path.append("\public") from public import * from selenium import webdriver import time import unittest class informationList_add(unittest.TestCase): def setUp(self): self.driver=webdriver.Chrome() #self.url="http://192.168.1.252:8010/websystem/login.aspx" ...
true
dcc1052d0e51009be3c4c5128113f7428ad6b9d7
sanjayait/core-python
/14-Chapter 14/14_exercise1.py
UTF-8
413
3.703125
4
[]
no_license
from functools import wraps def print_data(any_func): @wraps(any_func) def wrap3(*args,**kwargs): print(f"You are calling {any_func.__name__} function") print(any_func.__doc__) return any_func(*args,*kwargs) return wrap3 @print_data def addition(a,b): '''This function...
true
01475782a7d8edf49ef54490cfb71b15ee10c032
alexanderGGreenberg/Spring_2018_WICC_OSC
/src/alternatingLists.py
UTF-8
226
3.34375
3
[]
no_license
#return the combination of the two lists such that their elements alternate #unless one list runs out of elements #ex: ['a','b','c','d'], ['1','2'] #return: ['a','1','b','2','c','d'] def alternating_lists(list1, list2): pass
true
4f6f19ae0ad394d495204cb55abb66f49d2a5424
JURSULA/IPYJUN2019
/Homework1/DrawTwoTriangles.py
UTF-8
362
3.90625
4
[]
no_license
import turtle # Draw two triangles turtle.pensize(5) def drawTriangle(x,y): turtle.color("black") turtle.penup() turtle.goto(x,y) turtle.pendown() global side side = 3 while(side !=0): turtle.forward(100) turtle.left(120) side = side - 1 drawTriangle(-110, -25)...
true
5a7459dfab61fd42b92ca3ed2fb3c34ac5b55182
catboost/catboost
/contrib/python/scipy/py2/scipy/_lib/_util.py
UTF-8
14,540
2.734375
3
[ "Apache-2.0", "Python-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference", "Qhull", "BSD-3-Clause", "BSD-2-Clause" ]
permissive
from __future__ import division, print_function, absolute_import import functools import operator import sys import warnings import numbers from collections import namedtuple from multiprocessing import Pool import inspect import numpy as np def _broadcast_arrays(a, b): """ Same as np.broadcast_arrays(a, b) ...
true
752d1eb2ee128016520e8ae05f21ee67c97e2093
GChen-ai/MyLeetCode
/剑指Offer14-I.剪绳子/剑指Offer14-I-剪绳子.py
UTF-8
344
2.515625
3
[ "MIT" ]
permissive
class Solution(object): def cuttingRope(self, n): """ :type n: int :rtype: int """ if n<=2: return 1 if n==3:return 2 res=n%3 if res==1: return 3**(n//3-1)*4 elif res==2: return 3**(n//3)*2 else: ...
true
2c85f1d93aee578f8748430eaf89c965a9cb4a2f
TheTschakk/pydelio
/src/schnittpunkte.py
UTF-8
2,914
2.515625
3
[]
no_license
import numpy as np#importieren der Module import copy as c def schnittp(kd1_i,kd2_i): kd1=c.deepcopy(kd1_i) kd2=c.deepcopy(kd2_i) #Kamera1 Darmstadt Gundernhausen Pos_a=[3842,52484,165] #Pos_a=[1,1,0]#Daten zum Testen #Pos_b=[-1,-1,0] #Kamera2 Worms Pfeddersheim Pos_b=[-32696,25851,...
true
0ea65bd59c873aef7b94e0a3d011627119e3ce4a
geofstone/auxremote
/app/src/test/resources/radec-altaz_generator.py
UTF-8
801
2.671875
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
from astropy import units as u from astropy.coordinates import AltAz from astropy.coordinates import EarthLocation, SkyCoord from astropy.time import Time from random import randint observing_location = EarthLocation(lat='52.2', lon='351.6', height=100 * u.m) observing_time = Time('2017-02-05 20:12:18') aa = AltAz(loc...
true
d1f55fae2d01f2cddb5b09503b013260b3abe98c
kokokostation/roboshifter
/roboshifter/internal/report_maker.py
UTF-8
2,875
2.53125
3
[]
no_license
from features import Flag def get_handles(series, index, mapper): return map(mapper, series[index].index.tolist()) def make_features(series, mapper=None): if mapper is None: mapper = lambda x: x return { 'suspicious': get_handles(series, series.notnull() & (series != 0), mapper), ...
true
1d0bb72d4307a2e980a2d254c9b78bf00931e337
breezy1812/MyCodes
/Python/asyncio/future_with_run_until_complete.py
UTF-8
465
2.734375
3
[]
no_license
#!/usr/local/bin/python3 # coding: UTF-8 # Author: David # Email: youchen.du@gmail.com # Created: 2017-05-09 14:05 # Last modified: 2017-05-09 14:11 # Filename: future.py # Description: import asyncio async def slow_operation(future): await asyncio.sleep(1) future.set_result('Future is done!') loop = asyncio...
true
80122dfb967e25fc2b1433261f68b68edec82fdc
C13429172/CloudComp
/Lab3/fib.py
UTF-8
103
3.28125
3
[]
no_license
def fib(n): if (n / 1000) > 0: return n return fib(n-2) + fib(n-1) result = fib(2) print (result)
true
b6bac20fe8d964a1ccaf5145839b03257a95aadf
syurskyi/Algorithms_and_Data_Structure
/_algorithms_challenges/leetcode/LeetCode/695 Max Area of Island.py
UTF-8
2,168
3.875
4
[]
no_license
#!/usr/bin/python3 """ Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. Find the maximum area of an island in the given 2D array. (If there is no island,...
true
e7ee69270d0bb7c263c1c51d643d9b6bf7acebdd
Ca-moes/MEST
/Semana2/TeoPrat2.py
UTF-8
7,164
3.34375
3
[]
no_license
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import scipy.stats as stats import numpy as np from scipy.stats import kde file = open('D:/Andre/Work/MIEIC - ANO 1 - SEMESTRE 2/MEST/Semana2/adult.data', 'r') def chr_int(a): if a.isdigit(): return int(a) else: return 0...
true
7728667ecf10142f499d81c7bd58ade446feda8a
stuarthallows/machine-learning
/handy/imputers.py
UTF-8
971
3.375
3
[ "MIT" ]
permissive
""" Imputers that impute missing values """ import pandas as pd from sklearn.base import BaseEstimator, TransformerMixin class MostFrequentImputer(BaseEstimator, TransformerMixin): """ Impute most frequent value for string columns. """ """ Inspired from stackoverflow.com/questions/25239958 """ def ...
true
974058f608c2e60654335126dfc401834e2ad147
bruceewmesmo/python-mundo-02
/ex038.py
UTF-8
267
4.1875
4
[ "MIT" ]
permissive
# EXERCICIO 038 - COMPARANDO NUMEROS n1 = int(input('Digite um número: ')) n2 = int(input('Digite um número: ')) if n1 > n2: print('O primeiro número é maior') elif n2 > n1: print('O segundo número é maior') else: print('Os números são iguais')
true
976f3ae5ea8e924d2fd0838cdfbf5981a0195e48
DMRathod/_RDPython_
/Coding Practice/Basic Maths/FindMeetingRoomlist.py
UTF-8
1,089
3.40625
3
[]
no_license
# meeting room details which is dictionary of room number as key and value is list of two values starting and ending time of the meeting # OccupiedRoomDetails = {0 : ["9AM", "11AM"], 1: ["10AM", "12AM"], 2: ["11AM", "12AM"], 3: ["9AM", "10AM"]} # Assuming requested meeting is only of 1 hour. def FindMeetingRoomlist(s...
true
17e6f9fae2fccb64168ff5c54f1b643a445aa02b
benfwalla/Scrape-My-Professor
/app/Top_Stats/Get_Class_Schedule_URL.py
UTF-8
2,246
2.921875
3
[]
no_license
import datetime def get_term_url(date): ''' Returns the url of the term closest to the input data :param date: A datetime object (usually datetime.today()) :return: The Registrar url that points to the most recent completed semester relative to the date ''' year = date.year month = date.st...
true
18658dc74aede8e67ddc717abda2557b0ea1acf4
shivang98/DS-Algo-Practice
/check_permutation.py
UTF-8
602
3.265625
3
[]
no_license
def check_permutation(s1, s2): if len(s1) != len(s2): return False ''' if sorted(s1) == sorted(s2): return True else: return False ''' fm = {} for i in s1: if i in fm.keys(): fm[i] += 1 else: fm[i] = 1 for i in s2:...
true
1812b130b4d54d9805e3d0f5f603cc21f84d5bc2
Djaler/C45algorithm
/mine.py
UTF-8
1,132
2.625
3
[ "MIT" ]
permissive
from c45 import gain from utils import formalize_rules, get_subtables, is_all_equals def mine_c45(table, result): column = max([(column, gain(table, column, result)) for column in table if column != result], key=lambda x: x[1])[0] tree = [] for subtable in get_subtables(tab...
true
e3e08f57ac3a5a84b419f2ca347c1384644d70ba
felipeturing/minitorch-module-1
/minitorch/autodiff.py
UTF-8
5,982
3.0625
3
[]
no_license
import uuid import queue def wrap_tuple(x): if isinstance(x, tuple): return x return (x,) def unwrap_tuple(x): if len(x) == 1: return x[0] return x class Variable: """ Attributes: history (:class:`History`) : the Function calls that created this variable or None if constant derivative (number): the d...
true
19e6202504427fe3976c577172000e123aade6b2
ParkTaeGyu/AutoDataOp
/taegu1.py
UTF-8
3,286
2.703125
3
[]
no_license
# 작성자: 박태규 # 작성일: 2018-06-17 # 프로그램 개요: TTA 성능시험 데이터 변환 프로그램 import io import re import sys # 파일입력 def read_txt(file): with io.open(file,mode='r',encoding='utf-8') as f: data=f.readlines() f.close() return data def write_txt(file,lines): with open(file,'w') as f: f.writelines(lines) f.close() def mode_1(l...
true
0591d99f900323a0a855f176df8610f30619e6da
Self-fish/the-brain-py
/HeaterControl/domain/model/ActiveHeater.py
UTF-8
119
2.53125
3
[]
no_license
from enum import Enum class ActiveHeater(Enum): NONE = 0 FIRST_HEATER = 1 SECOND_HEATER = 2 BOTH = 3
true
85079bd24157265927e9c3da20217d7c9664060b
paulolemus/leetcode
/Python/contains_duplicate.py
UTF-8
782
3.5625
4
[ "MIT" ]
permissive
# Source: https://leetcode.com/problems/contains-duplicate/description/ # Author: Paulo Lemus # Date : 2017-11-16 # Info : #217, Easy, 68 ms, 87.76% # Given an array of integers, find if the array contains any duplicates. # Your function should return true if any value appears at least # twice in the array, and it s...
true
b01d8b4f4582b96ca7baec8e202b73f67a4eb2e4
HarrisonGreen/Advent-of-Code-2020
/Scripts/day25.py
UTF-8
866
3.359375
3
[ "MIT" ]
permissive
def public_values(): public_keys = (18356117, 5909654) mod = 20201227 return public_keys, mod def find_private_key(public_keys, mod): value = 1 loops = 0 while True: value = (7 * value) % mod loops += 1 if value == public_keys[0]: return 0, loops if...
true
3d0799ed033f2f0933a1d18b38c9ab6036169af1
ankit50/Python
/forLoops.py
UTF-8
466
3.625
4
[]
no_license
number = '1, 2, 34, 56, 77, 88, 90' for i in range(0,len(number)): if number[i] in '0123456789': print(number[i], end='') cleanedNumber = '' for char in number: if char in '0123456789': cleanedNumber = cleanedNumber + char newNumber = int(cleanedNumber) print('\n') print(newNumber) movie = ['S...
true
f68cb988decbdf22c4a9d588e5542322fbcda693
verajohne/Animal_model_analysis
/field.py
UTF-8
3,844
2.921875
3
[]
no_license
from __future__ import division import numpy as np import random import frnnr import infection HERD_SIZE = 100 def update_dic(dictionary, nr_of_herds, infection_map): ''' Assumes flocks are of equal size. Dictionary maps herd id to number of infected per time update_dic is called. Each herd_id, i, maps to a li...
true
f55f595fd73b46074fc234d5008fbf7ed8c8d7e5
AMReX-Codes/amrex
/Tools/F_scripts/dep.py
UTF-8
9,728
2.6875
3
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
#!/usr/bin/env python3 # automatically generate Makefile dependencies for Fortran 90 source. # # this will output all the dependency pairs amongst the source files. # # tips for debugging: # # -- do `make > out` when building your code. Any error messages # about modules not found will be sent to stderr, so yo...
true
180c178cdf94fbe28a95432f616200903c6a3ecd
wallet72/bookstuff
/booklist.py
UTF-8
3,105
3.28125
3
[]
no_license
#!/usr/bin/python # my first python program # will take ARGV[0] as the starting directory and will begin to process the contents. # # if file then decide if epub or mobi or txt or pdf # then add full path to html file that will give access to file # if dir then navigate into dir # and process # # long term, would ...
true
4e5ed686e56886e132a8b503aeb215082abb3657
dexter444sz/python
/replace_alph_pos.py
UTF-8
482
3.703125
4
[]
no_license
def alphabet_position(text): s = '' new_list = list('abcdefghijklmnopqrstuvwxyz') alphabet_text = list(text.lower()) for i in alphabet_text: symbol = i for k in new_list: symbol2 = k if symbol == symbol2: s = s + ' ' + str(new_list.in...
true
cf6a6966c4100cc407bfe33a9369b8a74d5ccffc
xiexnot/LeetCode
/101-200/LeetCode 117 Populating Next Right Pointers in Each Node II.py
UTF-8
463
3.28125
3
[]
no_license
# Definition for binary tree with next pointer. # class TreeLinkNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None # self.next = None CurrentDepth = 0 NodeDepth = -1 Node = None class Solution: # @param root, a tree link node # @return nothing ...
true
d7a83f51da7b57758a9fd414161989014166ff73
fjpalacios/exercises
/Python/tests/test_circle.py
UTF-8
619
2.984375
3
[ "MIT" ]
permissive
import pytest import circle @pytest.mark.parametrize("result, expected", [ (4, 50.2654816), (10, 314.15926) ]) def test_area(result, expected): _c = circle.Circle(result) assert _c.area() == expected ...
true
2c9bdf688c48466aec65d9c3b61a9d5518bf0387
DoerteMitHut/distancemeasureofembeddedgraphs
/graph_distance.py
UTF-8
32,971
3.015625
3
[]
no_license
class Vertex(): def __init__(self,index,x,y): self.index = index self.coords = (x,y) self.incidentEdges = set() self.placements = set() self.containingPlacements = dict() self.marked = False self.visited = False self.placementCount = 0; self.l...
true
ba65c39fed1b7be52cbd29a98da54816cc434a94
trey-kirk-sp/maptool-macros
/docker/extract
UTF-8
2,229
2.90625
3
[]
no_license
#!/usr/bin/env python3 """Maptool Object Extractor This provides the UI for running a MTAsset transformation from an asset file (exported/saved from MapTool) into a filesystem format (with macros extracted) See extract --help for usage """ import os import sys sys.path.insert(0, 'docker') from argparse import Argume...
true
3f711b2c3cd01a72b40dbabc1b7bd4e63ca01a62
moalarcon/web-scraping-challenge
/Mission_to_Mars/scrape_mars.py
UTF-8
6,552
3.203125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: from splinter import Browser from bs4 import BeautifulSoup as bs import pandas as pd import datetime as dt import requests as req import time # ## Browser Functions # In[2]: def init_browser(): # @NOTE: Replace the path with your actual path to the chromedriver...
true
1197741500acc79a0ed46b14bf349b8534eb91db
laraty/Twitter-Organization
/tokenlor.py
UTF-8
2,236
3.375
3
[]
no_license
#!/usr/bin/python '''Usage: ./tokenizor.py tweets.txt num_words all_words_output bow_output ''' import sys from collections import defaultdict from operator import itemgetter import nltk from nltk import word_tokenize def read_tweets_to_bow(filename): word_counts = defaultdict(int) user_word_counts = default...
true
11289ee2e38bb30b6357941422af503dae26a60e
proccoli/proccoli-pm
/lib/Process.py
UTF-8
7,987
2.640625
3
[]
no_license
import os, sys import ProcessItemDialog from time import time, sleep from datetime import datetime from psutil import cpu_count, boot_time, Process as _Process from collections import namedtuple from urwid import ( AttrMap, Button, Pile, Columns, Text, MainLoop, ListBox, SimpleListWalke...
true
9ac586b9027dddad6abafe952172b3ce0c99631a
MestreLion/foshelter
/foshelter/dwellers.py
UTF-8
8,548
3.03125
3
[]
no_license
# This file is part of Foshelter, see <https://github.com/MestreLion/foshelter> # Copyright (C) 2018 Rodrigo Silva (MestreLion) <linux@rodrigosilva.com> # License: GPLv3 or later, at your choice. See <http://www.gnu.org/licenses/gpl> """ Fallout Shelter Dwellers info """ import logging import re from . import or...
true
0f0a55a299889458dc3410f2ab94fca1bcfef2f5
verhagenkava/ebanx-take-home
/src/presenters/controllers/withdraw_account_controller_test.py
UTF-8
2,063
2.578125
3
[]
no_license
from faker import Faker from src.data.test import GetAccountMock from src.infra.test import AccountRepositoryMock from src.presenters.helpers import HttpRequest from src.data.withdraw_account import WithdrawAccount from .withdraw_account_controller import WithdrawAccountController faker = Faker() def test_route_exi...
true
0c7365135a22ea38046935d459504770d29bb64f
JoelBNU/grid_strategy
/QT4_sfl/connect_to_mysql.py
UTF-8
964
2.828125
3
[]
no_license
#本代码实现功能:登陆本地mysql from sqlalchemy import create_engine import pandas as pd class Log_on_MySQL(object): def __init__(self,host,port,db,user,password): self.host = host self.port = str(port) self.db = db self.user = user self.password = str(password) self.path = 'mysq...
true
5d017bcdc3560aa58d8280bdde5fbd4b18107a5f
moringDew/h5_text_translation
/tran/test.py
UTF-8
2,204
2.796875
3
[]
no_license
import base64 import hashlib import time import random import string from urllib.parse import quote import requests def curlmd5(src): m = hashlib.md5(src.encode('UTF-8')) return m.hexdigest().upper() # 请求时间戳(秒级),用于防止请求重放(保证签名5分钟有效) def get_params(base64_data): t = time.time() s_id = str(t)[:8] t...
true
8921dd2c67c6c573c47c1397149a22574568215c
mahatosourav00/Computational-Lab
/Second assignment/Python/Ass2_Q1.1.py
UTF-8
226
3.328125
3
[]
no_license
add = 0 diff = 0 no = 0 for i in range(6): for j in range(6): diff = abs(i - j) add = add + diff no = no + 1 print("Total distance = ", add) average = add / 36 print("Average distance = ", average)
true
172d818aee122a4989ed247ea7150dc29ec835a5
RombosK/GB_1824
/Kopanev_Roman_DZ-2/d_z_2_5.py
UTF-8
1,663
4.0625
4
[]
no_license
# Создать список, содержащий цены на товары (10–20 товаров), например: # [57.8, 46.51, 97, ...] # Вывести на экран эти цены через запятую в одну строку, цена должна отображаться в виде <r> руб <kk> коп # (например «5 руб 04 коп»). Подумать, как из цены получить рубли и копейки, как добавить нули, если, например, # п...
true
7af343c6c75fec5b684a39aeb4f23d3a1931fb51
TrellixVulnTeam/Demo_933I
/leetcode/1399.Count Largest Group.py
UTF-8
1,594
3.25
3
[]
no_license
# Given an integer n. Each number from 1 to n is grouped according to the sum of # its digits. # # Return how many groups have the largest size. # # # Example 1: # # # Input: n = 13 # Output: 4 # Explanation: There are 9 groups in total, they are grouped according sum of it # s digits of numbers from 1 to ...
true