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
3b700ff80eb5d49cfa868bf79bd6d16ba08241c4
SleepingMonster/DQN
/PER+Dueling DQN/utils_memory.py
UTF-8
6,119
2.75
3
[]
no_license
from typing import ( Tuple, ) import torch import numpy as np import random from utils_types import ( BatchAction, BatchDone, BatchNext, BatchReward, BatchState, TensorStack5, TorchDevice, ) class Tree(object): data_pointer = 0 #存经验的下标和对应的优先级在树中 def __init__(self,chan...
true
111421cff1576d8a9b956e4bd50067ee0364ee6c
Matias-Bustamante/complejidad
/euclides.py
UTF-8
284
3.171875
3
[]
no_license
from timeit import default_timer; inicio=default_timer(); def euclides(M,N): if N==0: return M; else: res=euclides(N,M%N); return res; final=default_timer(); final=final-inicio; print(euclides(2353,1651), "Tiempo de ejecucion: %.8f"%final);
true
a0a48ab4469e94543a520a6f263fc9f69f3f00e4
karishma0806/best-enlist-internship-of-python
/task10.py
UTF-8
355
3.515625
4
[]
no_license
1. import re text = input("Enter: ") result = re.sub("[A-Za-z0-9]", '', text) if len(result) == 0: print("Success") else: print("Failure") #2. import re a="abcdefghijkABCDlmnopqrstw" x=re.findall("ab",a) print(x) #3. x=re.search("w",a) print(x.end()) #4. x=re.search("bc",a) print...
true
e2a24ed2a5a6ff02d0d105b545a5bb4795e8fe51
uTensor/utensor_cgen
/tests/test_graph_constructor/test_ops/test_op_max.py
UTF-8
961
2.625
3
[ "Apache-2.0" ]
permissive
import numpy as np def test_op_max(ugraph): with ugraph.begin_construction(): tensor_x, = ugraph.add_op( np.random.rand(3, 5, 9, 2).astype('float32'), op_type='Const', name='x' ) tensor_out1, = ugraph.add_op( tensor_x, op_type='Ma...
true
0c5e8b46431a678c9a11d390e407f45effada667
Pratster95/Python-Code
/Exception.py
UTF-8
367
3.328125
3
[]
no_license
def get_ratios(L1,L2): ratios=[] for index in range(len(L1)): try: ratios.append(L1[index]/L2[index]) except ZeroDivisionError: ratios.append(float('nan')) except: raise ValueError('get_ratios called with bad argument') return print (ratios) L...
true
87cc41c721088f8abab5debb8b286f6a7bc80307
anish-bardhan/dfsbfs
/unit_1/arrprac.py
UTF-8
233
3.015625
3
[]
no_license
arr = ["mark", "teddy", "fer", "navi", "duncan", "matt"] for friend in arr: if friend == "matt": print(friend,"you're invite got lost in the mail.") else: print("Hey,", friend, "where should we go to lunch?")
true
13c856911e47d4bceaf465efd49e5d7e1d2d403f
Primakovski/dailyplaylist
/dailyplaylist.py
UTF-8
2,285
2.546875
3
[]
no_license
import os from urllib.parse import urlparse, parse_qs import re from flask import Flask, redirect from slackclient import SlackClient app = Flask(__name__) SLACK_TOKEN = os.environ.get('SLACK_TOKEN') CHANNEL_ID = os.environ.get('CHANNEL_ID') NUMBER_OF_MESSAGES = 1000 YOUTUBE_VIDEO_ID_LEN = 11 def get_urls_from_te...
true
1b41b57a617b33a18284a6634c160efaf4cf2090
AlexandreLamure/TchoupiTeam
/dumb.py
UTF-8
803
2.515625
3
[]
no_license
from parse import * import time import os param, courses = getfile() r, c, f, n, b, t = param def dst(x0, y0, x1, y1): return abs(y1 - y0) + abs(x1 - x0) cours = [] x = 0 for i in courses: cours.append((x, i[4])) x += 1 cours = sorted(cours, key=lambda x: x[1]) if not os.path.exists("results"): ...
true
00161c1598f7cddc3217f9b0b0ad17d6156f8661
anasLearn/AI_ztag
/simulation.py
UTF-8
6,210
2.890625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Apr 18 10:17:32 2017 @author: aanas / anasLearn / Anas Aamoum """ import pylab import visualize as VS import playing_field as PF import player as PL import functions as FN import data as DT def runSimulation(num_of_times, num_zomb_team1 = DT.z1, num_zomb_team2 = DT....
true
79c8c7bfedcb1b2d159898a1d3861a5f0bbdfea4
connorf25/robotics-assignment-2
/Internal_Pat.py
UTF-8
1,448
3.09375
3
[]
no_license
import sys # For cmd arguments import random from colorama import init, Fore import matplotlib.pyplot as plt from matplotlib.pyplot import text, ylabel, yticks import numpy as np import seaborn as sns unvisited = "U" open_space = "O" wall = "H" start = "S" goal = "G" def read_map(fn): grid = [] with open(fn)...
true
3356f84ff316a1809e46393416272bf493eb23ab
mc4117/Mariana-Numerical-assignment
/src/plotting_functions.py
UTF-8
11,069
3.515625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Mariana Clare Functions which plot the solutions found by the numerical schemes (Note these functions do not plot any analytic solution. For functions comparing analytic solutions and solutions from numerical methods please see error_functions.py). """ impor...
true
78cf8f15bad6953bc5c1a6b9f26b02c4c5849e11
tliu57/Leetcode
/Medium/CombinationSumII/test.py
UTF-8
808
3.125
3
[]
no_license
class Solution(object): def combinationSum2(self, candidates, target): res = [] if not candidates or len(candidates)==0: return res candidates.sort() self.combinationSumHelper(candidates, target, 0, [], res) return res def combinationSumHelper(self, candidates, target, pos, subsol, res): if target == ...
true
4ce393001e3bc0a5ae450526ffbddc89b8aff573
NicoEssi/Machine_Learning_scikit-learn
/py_files/multiple_linear_regression.py
UTF-8
2,264
2.734375
3
[ "MIT" ]
permissive
# Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('50_Startups.csv') X = dataset.iloc[:, :-1] y = dataset.iloc[:, 4] # Encode categorical data X = X.values from sklearn.preprocessing import LabelEncoder, OneHotEncoder label...
true
e01e56cb16b57f94f988e8810fa370054b94e1d5
lucas-silvs/Curso-Guanabara
/Mundo - 1/Bom dia.py
UTF-8
64
3.3125
3
[]
no_license
n=input("Digite seu nome\n") print("Prazer em te conhecer, "+n)
true
4d3f5852494d3fdf654dd6d62e7d085df456004a
eseisaki/Regression-FGM
/statistics.py
UTF-8
2,139
2.828125
3
[]
no_license
""" This module concludes all metric functions in order to calculate the network communication""" from components import MulticastChannel ############################################################################### # # Statistics # ############################################################################### #...
true
bf06f36e7bc50de8082861d30ba194aad79e5250
rawk-v/MLND-projects
/cv-project1-image-caption/model.py
UTF-8
3,660
2.703125
3
[]
no_license
import torch import torch.nn as nn import torchvision.models as models class EncoderCNN(nn.Module): def __init__(self, embed_size): super(EncoderCNN, self).__init__() resnet = models.resnet50(pretrained=True) for param in resnet.parameters(): param.requires_grad_(False) ...
true
6474a97be4aee86f53312f92d83b89fec6d3137d
ImperialAI-Blockchain-Team/group-project-decentralised
/reactapp/public/model.py
UTF-8
1,230
3.078125
3
[ "Apache-2.0" ]
permissive
# Please Include an empty line at the start and at the end of your file import torch import torch.nn as nn import pandas as pd import flower as fl from typing import Tuple class Net(nn.Module): def __init__(self): super(Net, self).__init__() pass def forward(self, x): pass class Lo...
true
70a215a2978de7ad41f753b86b46d375d64d348b
zcolleen/iot
/functions/test.py
UTF-8
384
3.40625
3
[]
no_license
class Test: def __init__(self, mas): self.mas = mas self.test = [[]] def chenge(self): self.mas[0][1] = 488 def getMas(self): return self.mas mas = [[10, 20], [21, 43], "sdfsdf"] #print(mas) #mas.append(200) #print(mas[2][0]) #print(mas) test = Test(mas) #print(len(test.test)) for m in mas[1:]: pr...
true
2e8c009c19cc81f0de21eaa1bb80f57a2ee8bb46
jhwendang/learn_python
/day03/老师课程/函数/函数.py
UTF-8
610
3.609375
4
[]
no_license
#!/usr/bin/python # -*- coding:utf-8 -*- ''' 没有函数会有什么问题? 1.无组织无结构,代码冗余 2.可读性差 3.无法统一管理且维护成本高 ''' # 在python中函数分两类:内置函数,自定义函数 #内置函数 # sum # max # min # # a=len('hello') # print(a) # # b=max([1,2,3]) # print(b) #自定义函数 # # ****** # # ****** # # ****** # # hello world # # ****** # # ****** # # ****** # def print_sta...
true
806ba442f4dc7f1485c04f3bd29469e2b649dfe7
lukehorak/pokelitics
/TrainerBattle.py
UTF-8
704
2.515625
3
[]
no_license
from bs4 import BeautifulSoup as bs from Trainer import * def makeLogs(filepath): match_page = bs(open(filepath), "html.parser").find_all("script", class_="battle-log-data")[0].get_text() with open("temp.log", "w+") as f: f.write(match_page) def parseLine(line): parsed = line.replace('\n', '') ...
true
36d02e60bf8fb8f4a92f3532ba9f517f8fc04daa
deanlyoung/raspberry_pi
/Scripts/sound_button.py
UTF-8
1,783
2.515625
3
[]
no_license
#!/usr/bin/env python import grequests import PCF8591 as ADC import RPi.GPIO as GPIO import LCD1602 import RPi_I2C_driver import time BtnPin = 23 mylcd = RPi_I2C_driver.lcd() base = 'https://maker.ifttt.com/trigger/' key = 'XXX' event = 'sound' isPressed = False isOn = False url = sound_maker_url = base + event + ...
true
79308e512bac01098e6dcd801b221aaf210e5d6d
nathancharlesjones/Downforce-measurement-device
/Software/Host/MCP2221/adc_plus_gps_test.py
UTF-8
1,652
2.78125
3
[]
no_license
import time import board from analogio import AnalogIn import serial import matplotlib.pyplot as plt lightSensor = AnalogIn(board.G1) port = serial.Serial("/dev/ttyACM0", baudrate=4800, timeout=3.0) def get_voltage(raw): return ( raw * 3.3 ) / 65535 plt.ion() timestamps = [] value = [] counter = 0 ...
true
2a0873c48356d6f94bb9c75ef52bed970865cc68
strob/bsides
/cluster.py
UTF-8
2,287
2.515625
3
[]
no_license
# Combine `feat` files and cluster into 15 bins. import numpy as np from scipy.cluster.vq import kmeans, vq import json import numm import meap import os def cluster(src, key="AvgTonalCentroid(6)", nbins=15, min_volume=-30): jsonfile = "%s-%s-%d.json" % (src, key, nbins) if os.path.exists(jsonfile): ...
true
59fc58da7a3728a44d6c434ef0e4490a851b8a9a
lemontech119/TIL
/algorithm/test/test_1.py
UTF-8
290
3.078125
3
[]
no_license
def solution(S): alpha_num = [0] * 26 answer = 0 for alpha in S: asc = ord(alpha) - 97 alpha_num[asc] += 1 for chk in alpha_num: if chk % 2 == 1: answer += 1 return answer print(solution("aabbbccd")) print(solution("abebeaedeac"))
true
f4773f458a3766832063f9b9c7b56728f3fb9b81
scottbrumley/opendxl-cookbook
/examples/tie_rep_api.py
UTF-8
5,464
2.75
3
[ "Apache-2.0" ]
permissive
# This sample demonstrates invoking the McAfee Threat Intelligence Exchange # (TIE) DXL service to retrieve the the reputation of files (as identified # by their hashes) import base64 import json import logging import os import sys from dxlclient.client import DxlClient from dxlclient.client_config import DxlClientCon...
true
b0d25c188da83dc00560d9584568edf244889194
pedrocadahia/NLP
/AKD/summarizer(Cluster_Version).py
UTF-8
16,855
2.75
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Conexion y Consulta elastisearch import sys from elasticsearch import Elasticsearch from pyspark import SparkConf, SparkContext from pyspark.sql import SQLContext, HiveContext # Crear la configuración de spark conf = (SparkConf() .setAppName("summarize") ...
true
b66885db302ca0db6c83641e77b4d0fbe4a95116
mveselov/CodeWars
/katas/beta/nothing_special.py
UTF-8
170
2.5625
3
[ "MIT" ]
permissive
from string import punctuation def nothing_special(s): try: return s.translate(None, punctuation) except AttributeError: return 'Not a string!'
true
56ee57d6cda9427ad7a39938b59f1e3f71831e41
kostyaby/EventingApp
/EventingLib/Rider.py
UTF-8
1,350
4
4
[]
no_license
class Rider( object ): def __init__( self, name = "John Appleseed", ID = 10000000, NF = "USA" ): self.__name = name if 10000000 <= ID <= 99999999: self.__ID = ID else: raise ValueError( "ID must be an 8-digit number without leading zeroes!" ) if NF in Natio...
true
d2b2cc18c74dede20bf33d908611c20acd4f51f2
Devang-25/acm-icpc
/project-euler/p108.py
UTF-8
375
3.5
4
[]
no_license
# nx + ny = xy # (x - n) (y - n) = n^2 def count(n): result, p = 1, 2 while p * p <= n: if n % p == 0: e = 0 while n % p == 0: e += 1 n /= p result *= e + e + 1 p += 1 if n > 1: result *= 3 return (result + 1) ...
true
efca2b366d027586803ef667a22ce42e8e933525
JennyHasACat/SeleniumPythonAuto
/common/BasicPage.py
UTF-8
2,547
2.640625
3
[]
no_license
# coding=utf-8 ''' Created on 2018-06-04 @author: Jenny ''' from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC # from common.ParseJson import parseJson import os import json driver = webdriver.Firefox() base_url = "...
true
aee6cf1a725d9609059ef2c1270d1e76f72106ca
JCardenasRdz/Quantitative-MRI
/Quantitative_MRI/models.py
UTF-8
1,524
3.0625
3
[ "MIT" ]
permissive
import numpy as np def T1_vTR(TR, *args): """ Description ---------- Simulate Spin Echo Saturation Recovery Experiment sig = Mz * (1 - np.exp(-RepTime/T1)) Parameters ---------- TR: float ndarray of repetition times (TR) in seconds *args: positional arguments in the follow...
true
ba1efe1754d8607d1f0bdf73576e85a97a7367fe
JeremyFyke/MPAS-Analysis
/mpas_analysis/test/test_interpolate.py
UTF-8
5,345
2.59375
3
[]
no_license
""" Unit test infrastructure for horizontal interpolation. Xylar Asay-Davis 02/25/2017 """ import pytest import shutil import os import tempfile import numpy from mpas_analysis.shared.interpolation import interpolate from mpas_analysis.test import TestCase, loaddatadir from mpas_analysis.configuration.MpasAnalysisCo...
true
e565f2fb66b313546fdcfdfdd37573cae8424172
mpofukelvintafadzwa/Python-for-Genomic-Data-Science
/gcPercentageFunction.py
UTF-8
259
3
3
[]
no_license
def gc(dna) : #This function computes the gc percentage of DNA numbases = dna.count('n')+dna.count('N') gcPercent = float(dna.count('c')+dna.count('C')+dna.count('g')+dna.count('G')*100/len(dna)-numbases) return gcPercent print(gc('AAAGTNNAGTCC'))
true
0a965267e09fb2c9f022ec13d5e689fe4ad0cdde
krstoilo/SoftUni-Fundamentals
/Python-Fundamentals/Homeworks-and-labs/lists/seize_the_fire.py
UTF-8
965
3.640625
4
[]
no_license
fires = input().split('#') water = int(input()) effort = 0 total_fire = 0 cells_list = [] isValid = False cell_num = "" for i in range(len(fires)): test_str = fires[i] for char in test_str: if char.isdigit() == True or char == '-': cell_num += char if 'High' in test_str: if 81...
true
fe5718c0a8ab19a85441ea55fe048fe44e3bc6d4
makennamartin97/python-algorithms
/countdown.py
UTF-8
385
4.46875
4
[]
no_license
# Objectives # Create a function that accepts a number as an input. Return a new list that # counts down by one, from the number (as the 0th element) down to 0 (as the # last element). #For example, countdown(5) should return [5,4,3,2,1] def Countdown(n): new = [] while n >= 0: new.append(n) ...
true
db57b64490bfca2fb930ff29a1e0e7313bc88462
ZhaoGuofang/shwjzf
/shwjzf_feature/Data_extraction.py
UTF-8
1,267
3
3
[]
no_license
# -*- coding:utf-8 -*- import numpy as np import pandas as pd from sklearn.utils import shuffle import datetime as dt import json ''' 国家,罪名二个特征项分析 ''' #读取文件 df = pd.read_csv(r"./shwjzf_.csv", header=0, delimiter='\t', index_col=0, dtype='object') # print(df.head()) # 去重后 df = df.drop_duplicates() #print(df...
true
64809ff154034ddfdbbf30a39a41463294556ce4
ioanbsu/copter_bitify
/i2c-sensors/bitify/python/copter/FileUtils.py
UTF-8
1,028
2.625
3
[ "Apache-2.0" ]
permissive
# !/usr/bin/python __author__ = 'ivanbahdanau' import csv import os def read_file_data(): global copter_is_on, copter_torque, is_kill, control_force, z_axe_control copterControlFile = os.environ.get('COPTER_CONTROL_FILE') with open(copterControlFile, 'rb') as csvfile: reader = csv.reader(csvfile,...
true
2f0217f64fe024746405619c36b0435f15d798af
judyliou/LeetCode
/python/1277. Count Square Submatrices with All Ones.py
UTF-8
556
2.8125
3
[]
no_license
class Solution(object): def countSquares(self, matrix): """ :type matrix: List[List[int]] :rtype: int """ count = 0 for i in range(len(matrix)): for j in range(len(matrix[0])): if matrix[i][j] == 0: continue ...
true
2467d37f04bb6604a998c4b884c860058d24f40b
Zahidsqldba07/CodeSignal-26
/The Core/Well of Integration/074 - timedReading.py
UTF-8
158
2.703125
3
[]
no_license
def timedReading(maxLength, text): return len([j for j in "".join([i if i in string.ascii_letters else " " for i in text]).split() if len(j)<=maxLength])
true
0913ef75e1bc59c97500975a69027db7672cc701
jknlsn/rexport
/export_helper.py
UTF-8
1,975
2.8125
3
[ "MIT" ]
permissive
import argparse from pathlib import Path import sys from typing import Sequence def setup_parser(parser: argparse.ArgumentParser, params: Sequence[str]): PARAMS_KEY = 'params' class SetParamsFromFile(argparse.Action): def __call__(self, parser, namespace, values, option_string=None): secr...
true
7833b64492201747f8e88051a13aebafb0e68c5b
bmdaj/ML_2021_Big_Project
/NN_Architecture.py
UTF-8
4,921
2.796875
3
[]
no_license
import torch import torch.nn as nn #%% INVERSE: from frequencies to parameters. Input blocks + FC. class InverseNN(nn.Module): def __init__(self, N_BLOCKS: int, D_IN: int, D_HIDDEN_BK: list, D_HIDDEN_FC: list, D_OUT: int, ...
true
8140e42efcc965e3bfc713c6d970f077247278f9
its-tn10/zendesk-ticket-viewer
/utils.py
UTF-8
1,029
2.59375
3
[]
no_license
from errors import APIError import base64, datetime, iso8601, os, requests def make_request(endpoint): auth_str = base64.b64encode((os.environ.get('ZENDESK_EMAIL') + '/token:' + os.environ.get('ZENDESK_TOKEN')).encode()).decode() response = requests.get(os.environ.get('ZENDESK_DOMAIN') + endpoint, heade...
true
92ca9367b6a2c9c223ef1e5f374874728807688d
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_117/430.py
UTF-8
1,909
2.984375
3
[]
no_license
#!/usr/local/bin/python2.7 from __future__ import print_function import unittest import sys sin = '''5 3 3 2 1 2 1 1 1 2 1 2 5 5 2 2 2 2 2 2 1 1 1 2 2 1 2 1 2 2 1 1 1 2 2 2 2 2 2 1 3 1 2 1 8 4 1 2 1 2 2 2 2 2 2 1 2 1 2 1 1 1 1 2 2 1 1 2 1 2 1 1 2 1 2 1 2 1 8 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 ...
true
43a0c1e596c706448bb40635c3869a28ccadbe8c
bilalikram94/Selenium-Advanced
/drag_and_drop.py
UTF-8
1,021
2.828125
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver import ActionChains import time class DragDrop: def test(self): baseURL = "http://jqueryui.com/droppable/" driver = webdriver.Chrome("C:\\Users\\Bilal.Ikram\\PycharmProjects\\firstSeleniumTest\\venv\\...
true
7eb354b85340aea6e6217404d28c6ba276050bea
SzczotkaKamil/pp1
/07-ObjectOrientedProgramming/zad5.py
UTF-8
558
3.5
4
[]
no_license
class Utwory(): def __init__(self,wykonawca,tytul,album,rok): self.wykonawca=wykonawca self.tytul=tytul self.album=album self.rok=rok def __str__(self): return 'Wykonawca: '+self.wykonawca+'\nUtwór: '+self.tytul+'\nAlbum: '+self.album+'\nRok: '+self.rok+'\n' obie...
true
2e056241e3f91bf0fc03da17bde71136ce610150
templeblock/pytoolkit
/pytoolkit/pipeline/sklearn.py
UTF-8
3,563
2.625
3
[ "MIT" ]
permissive
"""scikit-learn""" from __future__ import annotations import pathlib import typing import numpy as np import sklearn.base import pytoolkit as tk from .core import Model class SKLearnModel(Model): """scikit-learnのモデル。 Args: estimator: モデル nfold: cvの分割数 models_dir: 保存先ディレクトリ ...
true
c6fd60e28a02604ae467eedb968d4029fc932f6e
tnakaicode/jburkardt-python
/test_values/cheby_v_poly_values.py
UTF-8
3,354
3.03125
3
[]
no_license
#! /usr/bin/env python # def cheby_v_poly_values ( n_data ): #*****************************************************************************80 # ## CHEBY_V_POLY_VALUES returns values of Chebyshev polynomials V(n,x). # # Discussion: # # In Mathematica, the function can be evaluated by: # # u = Sqrt[(x+1)/2], # ...
true
72588bd3aab6f2326841ddc3001dc5bcdd758769
jfrelinger/fcm
/src/statistics/cluster.py
UTF-8
15,417
2.625
3
[ "BSD-2-Clause" ]
permissive
""" Created on Oct 30, 2009 @author: Jacob Frelinger """ from numpy import zeros, outer, sum, eye, array, mean, cov, vstack, std, ones from numpy.random import multivariate_normal as mvn from numpy.random import seed from scipy.cluster import vq import collections from dpmix import DPNormalMixture, BEM_DPNormalMixt...
true
82b3cf09511e6126acea1064651c4fe1c8188956
rahulj1601/Python
/Project Euler/P10 Sieve of Erasthotenes.py
UTF-8
291
3.078125
3
[]
no_license
import math n = 2000000 nums=[] for each in range(2,n+1): nums.append(each) index=-1 p=2 while p <= math.sqrt(n): index+=1 p=nums[index] for i in range(p*2,n+1,p): if i in nums: nums.remove(i) total=0 for j in nums: total+=j print(total)
true
6ee3870c90a3982e5e06c3adc8823dcfcd1d0a9f
Nizametdinov/elastic_const
/elastic_const/elastic_const_computation.py
UTF-8
2,695
2.78125
3
[]
no_license
import logging import traceback from elastic_const import xy_method from elastic_const import r_method from elastic_const.derivatives_with_distance import Potential2, Potential3 from elastic_const.crystals import Lattice def compute_constants_xy_method(max_order, triplet_fem, pair_fem, triplet_fdc, pair_fdc, lattice:...
true
c9c3a76f5b77481d5d8fcacbb474406414a4ae6f
gato/lana-client
/lana/client.py
UTF-8
1,799
2.546875
3
[]
no_license
import requests class LanaClient(): def __init__(self, host, port): self.baseurl = '{}:{}/api/v1/basket/'.format(host, port) def create_basket(self): try: x = requests.post(self.baseurl) except Exception as e: return None, 'Exception: {}'.format(e) if x.status_code != 201: return...
true
55be6fa101b3643b73edb6695dd92d6b2831826a
Rainsaays/opera_scripts
/micro_check/micro_easy.py
UTF-8
3,811
2.5625
3
[]
no_license
#/usr/bin/env python3 # -*- coding: utf-8 -*- import requests,re,os,time,json from lxml import etree from dingtalkchatbot.chatbot import DingtalkChatbot # pip install dingtalkchatbot ###引用日志类 from logger import logger_get logger = logger_get("info") ###配置信息 domain_url="http://www.micro.com/" eureka_name="user" eure...
true
40eac88f0adfb5c899971c70647d24da3ace327d
rishirajani/NumberWords
/numberwordsexample.py
UTF-8
433
3.265625
3
[]
no_license
from numberwords import grouping_func def main(): number = num = None while True: number = input("Enter number : ") if not number.replace(',','').isdigit(): print("Incorrect input. Try again!") continue num = number.replace(',','') break print(f"\nNum...
true
5b92c61ec893ed3d1e316bf5361733a9acafbb9f
made-ml-in-prod-2021/kadetfrolov
/ml_project/models/model_fit_predict.py
UTF-8
2,313
2.671875
3
[]
no_license
from typing import Union, Dict import sklearn from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.pipeline import Pipeline from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score from sklearn.compose import Colum...
true
f4e4594afcec135ca1b9eab707273610018b16b5
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/arc051/B/3503713.py
UTF-8
63
3.203125
3
[]
no_license
a,b=1,1 for _ in range(int(input())): a,b=a+b,a print(a,b)
true
13bfa33ce0b3c98a0f377ac0c8e7a93528fb7697
Julialva/projmac
/Maquinas.py
UTF-8
4,288
2.671875
3
[]
no_license
import numpy as np import math import matplotlib.pyplot as plt from pos_4_barras import * class Mecanismo: def grashof(self,elos): aux_elos = elos elo_maior = max(elos) elo_menor = min(elos) elos.remove(max(aux_elos)) elos.remove(min(aux_elos)) elos_restantes = sum(a...
true
e017f8bbbca94de5aadfa471ffb2ee13898c3e24
V-Kiruthika/GuviBeginner
/prime_interval.py
UTF-8
250
3.109375
3
[]
no_license
def prime(n): c=0 for j in range(2,n): if n%j==0: c+=1 if c==0: a=1 else: a=0 return a s,e=map(int,input().split()) l=[] for i in range(s+1,e): if prime(i)==1: l.append(i) print(*l)
true
accd3a7f513b086efc0fc7510a0865c9cb1b7a54
massimopiedimonte99/PygameTemplate
/Pygame Template/Game.py
UTF-8
944
3.046875
3
[ "MIT" ]
permissive
import pygame as pg from settings import * class Game: def __init__(self): self.screen = pg.display.set_mode((W, H)) self.screen.fill(BLACK) pg.display.set_caption(TITLE) self.running = True def new_game(self): self.playing = True sel...
true
db3084aa2b477b23f26f9389dc1ee30318411c8e
Aasthaengg/IBMdataset
/Python_codes/p02238/s908068805.py
UTF-8
894
3.109375
3
[]
no_license
ii = lambda : int(input()) mi = lambda : map(int,input().split()) li = lambda : list(map(int,input().split())) class tree: def __init__(self,n): self.n = n self.vlist = [None]*self.n self.start = [None]*self.n self.finish = [None]*self.n self.time = 0 def add(self,n...
true
aba867560becef44d8c9fbe74de876e8bcafa996
EdvardPedersen/ChessTactics
/chesstactics.py
UTF-8
5,127
2.671875
3
[ "MIT" ]
permissive
import re import subprocess import time import io import threading from urllib.request import urlopen import pickle import chess.pgn import chess.engine class PGNFile: def __init__(self, filename, player): self.player = player with open(filename) as f: self.file = f.read() def get...
true
88b4dc5783e9521622cc7fea8aa888f7a3162120
davidcawork/UAV-Report
/githubTrends/plot_githubTrend.py
UTF-8
583
2.796875
3
[]
no_license
#!/usr/bin/python3 import pandas as pd import matplotlib.pyplot as plt reposbyYear = pd.read_csv('data/githubTrendYear.csv') reposbyYear.set_index('Year', inplace=True) print(reposbyYear.head()) print(reposbyYear.info()) reposbyYear.plot.bar(figsize=(10, 8), color='#ffb630', legend=False, zorder=3, linewidth=1, ed...
true
995df1d9ed889a2c0a0fef5730d2e377e754ac34
mdmuneerhasan/python
/SVM/svm1.py
UTF-8
2,108
2.828125
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import make_classification X, Y = make_classification(n_classes=2, n_samples=400, n_clusters_per_class=1, random_state=3, n_features=2, n_informative=2, n_redundant=0) Y[Y==0]=-1 plt.scatter(X[:, 0], X[:, 1], c=Y) ...
true
f31f6bb0bdba75c239b10e9ca607116fa903fe65
PaPiix/DecoraterBot-cogs
/voice.py
UTF-8
133,055
2.75
3
[ "MIT" ]
permissive
# coding=utf-8 """ DecoraterBot's Voice Channel Plugin. """ import json import sys import os import youtube_dl import discord from discord.ext import commands from DecoraterBotUtils import BotErrors from DecoraterBotUtils.utils import * def make_voice_info(server_id, textchannel_id, voice_id): ...
true
f1aa4935d9b9e7009f8ca2f5205e1126acaad2ea
ZoieM/DJam
/quicksort2.py
UTF-8
1,528
3.640625
4
[]
no_license
def quickSort(alist): quickSortHelper(alist,0,len(alist)-1) def quickSortHelper(alist,first,last): if first<last: splitpoint = partition(alist,first,last) quickSortHelper(alist,first,splitpoint-1) quickSortHelper(alist,splitpoint+1,last) def partition(alist,first,last): p...
true
dbae329ffb353a2b6527fd4dce5080a682e5e22d
Aasthaengg/IBMdataset
/Python_codes/p02596/s807787603.py
UTF-8
177
3
3
[]
no_license
k = int(input()) if k%2 == 0 or k%5 == 0: print(-1) exit() i = 0 mod = 0 while True: mod = (mod*10 + 7)%k i += 1 if mod == 0: print(i) break
true
cc7f87ae6be7e9ba67366658d1590ea1ab820e50
victorrgouvea/URI-Problems
/Vetores/1129.py
UTF-8
511
3.5625
4
[]
no_license
q = ["A", "B", "C", "D", "E"] while True: n = int(input()) if n == 0: break while n > 0: v = input().split() r = 0 for i in range(0, len(v)): v[i] = int(v[i]) for i in range(0, len(v)): if v[i] == 0 or v[i] <= 127: r += 1 ...
true
a2b8d4abc189f78b9694ed361649811f2f971266
angeldev96/ProyectoAED
/html_importer.py
UTF-8
679
3.53125
4
[]
no_license
import urllib.request #Clase que se encarga con obtener el codigo fuente de un sitio web class Html_import: def __init__(self): #Metodo init que inicializa la variable "url" que es la que usaremos para obtener la pagina web self.url = " " def obtener_html(self): #Metodo que obtiene el codig...
true
b6bf4504ff84ed3e2cd84f28c5641cd339abd022
mjachowdhury/MachineLearning-4thYear-CIT
/workCopy/mohammed.py
UTF-8
11,760
3.546875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Oct 22 19:02:23 2019 @author: Mohammed """ import pandas as pd import numpy as np import re from pandas import ExcelWriter from pandas import ExcelFile from collections import Counter import seaborn as sns import math minimumWordLength = 2 minimumWordOccurences = 2 inputSt...
true
d02cd1812191562af7c572241efcc850f06d4ed7
trueutkarsh/vector_ai_backend_test
/writer/validator.py
UTF-8
2,986
3.421875
3
[]
no_license
""" This module is for validating that, data passed to database layer for DB operations Data types in DB tables, Validation to be performed - string -> name - Check that name only contains alphabets - int -> population, num_* -> e.g check the consistency of the values (population) ...
true
887ccbba4baf5c71e8a2d17cfd52780fb6fc7248
kostas-simi/patsak
/askisi3.py
UTF-8
948
3.296875
3
[]
no_license
#! Python program that removes comments (with #) for a python code. #! Created by Kostas Simiriotis, January 2019 for the Python test of the 1st semester. print("Welcome to Python comment remover, noComm1.0 by Kostas Simiriotis!") filename = input("Please provide the name of the file: ") print("Opening the file...") f...
true
0adc74d5e05e775ddd1a30b9e2fd3d2aa58c6828
gdc2016/algorithm011-class02
/Week_04/433.最小基因变化.py
UTF-8
982
2.78125
3
[]
no_license
# # @lc app=leetcode.cn id=433 lang=python3 # # [433] 最小基因变化 # # @lc code=start from collections import deque class Solution: def minMutation(self, start: str, end: str, bank: List[str]) -> int: if not bank: return -1 if not start or not end: return -1 bank = set(ban...
true
2ce99d775a8947a8c4910f2c392d22fd73d53c9f
Cyra25/CP1404_Practicals
/Prac_05/Extension 2.py
UTF-8
285
4.28125
4
[]
no_license
"""Takes 2 lists and creates a dictionary with the elements in one of the list as the key and the elements in the other as the values""" names = ["Jack", "Jill", "Harry"] dobs = [(12, 4, 1999), (1, 1, 2000), (27, 3, 1982)] names_to_dobs = dict(zip(names, dobs)) print(names_to_dobs)
true
9b534fe33f6f65717257c637fd6ff337c2c0f65f
hrishikeshtak/Coding_Practises_Solutions
/leetcode/LeetCode-75/Level-1/09-Best-Time-to-Buy-and-Sell-Stock.py
UTF-8
2,120
4.40625
4
[]
no_license
""" Best Time to Buy and Sell Stock You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock. Return the maximum profit you can achieve from this...
true
b55076fd856fbfe79dfdb6c252e7da605f538db9
TheGigacorn/theoryhw1
/roman.py
UTF-8
5,662
3.59375
4
[]
no_license
def roman_expander(base_roman): new_roman= [] lim = len(base_roman) i = 0 print(lim) while i < lim: print(i) if i + 1 == lim: new_roman.append(base_roman[i]) break elif (i < lim and base_roman[i] == 'I' and base_roman[i+1] == 'V'): new_roma...
true
42f170aad1a3ea1e383ab1d6f7c4d4838c2be6e4
vjthedeejay/property-finder
/craigslist_housing_filter.py
UTF-8
4,552
2.796875
3
[]
no_license
from craigslist import CraigslistHousing from config import DatabaseConfig from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from sqlalchemy import Column, Integer, String, DateTime, Float, Boolean from dateutil.parser import parse engi...
true
2215fdf23a1c7a95ecbe14d1507fb68cb1ca2c78
MPMG-DCC-UFMG/M02
/Segmentacao/main.py
UTF-8
1,061
2.75
3
[]
no_license
import sys import os import argparse import segmentacao import random def main(): #Para replicar os resultados random.seed(1608637542) parser = argparse.ArgumentParser(description='Segmentação dos Diários Oficiais dos Municípios Mineiros.') parser.add_argument("-o", metavar="<diretório>",type=str, help="Caminho ...
true
fdc32f0ffbfbf71075289ad26be89b3ae8fc0972
run-tmc/tensorflow_projects
/linear_regression_model_eval_tensorflow.py
UTF-8
3,422
3.46875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Jan 27 12:29:51 2018 @author: trevo """ """ Demostrate ML with a linear regression algorithm built in tensorflow with a L2 loss function and gradient descent optimizer Find a weight value A from a x dataset feature with a y target value Split dataset for model training and...
true
75e0b58bfeac510e96cdb5b4243c550707404922
jonathanfrawley/PyAutoConf_copy
/test_autoconf/json_prior/code/module.py
UTF-8
172
2.828125
3
[ "MIT" ]
permissive
class MyClass: def __init__( self, simple: float, tup=(1.0, 1.0) ): self.simple = simple self.tup = tup
true
fc36c2a6ae1ff0fac841d862415467506aad2e57
heyheycel/advent-of-code
/2019/day3.py
UTF-8
1,485
3.03125
3
[]
no_license
with open('input_day3.txt') as f: cables_lines=[line.strip().split(',') for line in f] dX={'R':1, 'L':-1, 'U':0, 'D':0} dY={'R':0, 'L':0, 'U':1, 'D':-1} visited={0:set(), 1:set()} for cable in range(2): x=y=0 for cable_line in cables_lines[cable]: direction, steps= cable_line[0], int(cable_line[1:]) for i in ...
true
e15ab4808a97f3fd0ba7315d9d47f370d486796c
macster00/TimeClock
/checkstatus.py
UTF-8
624
2.734375
3
[]
no_license
import sqlite3 import datetime import time conn = sqlite3.connect('TCTest1.db', detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES) c = conn.cursor() pins = [] def enter_pin(): pin = int(raw_input("Enter your 4 digit PIN: ")) get_times(pin) def get_rids(): for row in c.execute('sele...
true
60376393a9c8fb305a73ac328a5d46160d1aa5f2
just3019/taole_pc
/thread_pool.py
UTF-8
1,797
3
3
[]
no_license
import threading import time from threading import Thread from queue import Queue import requests class ThreadPool: def __init__(self, number_of_workers): self.tasks_queue = Queue(number_of_workers) self.result_queue = Queue(0) for _ in range(number_of_workers): ThreadWorker(s...
true
a91215982c68b501d1209b6b4a82741f05461015
yirantai/torflaio_validators
/base/fields.py
UTF-8
3,627
2.65625
3
[]
no_license
# coding: utf-8 import datetime from .exceptions import ParamsValidationError from .time_tools import dt_str_to_datetime class BaseField(object): field_type = None field_type_name = None def __init__(self, field_name=None, field_value=None, required=True, default=None, max_length=0, min_length=0): ...
true
6ab2eb157e36eb5297faae17f6a1246e320f7d14
jestemjacek/keylogger
/main.py
UTF-8
1,071
2.703125
3
[]
no_license
#! /usr/bin/env python import pynput.keyboard import therading import smtplib class Keylogger: def __init__(self, interval, email, password): self.data = "Apllication started" self.interval = interval self.email = email self.password = password def append_data(self, string): self.data += string def ke...
true
eda550f97132b31bf7aa0d15aa69e10280a1013c
veetarag/Data-Structures-and-Algorithms-in-Python
/Interview Questions/Watering Flowers.py
UTF-8
708
3.484375
3
[]
no_license
def watering(array, cap1, cap2): l = len(array) lo = 0 hi = l-1 myRes = 0 frnRes = 0 cnt = 0 while lo <= hi: if lo==hi: if myRes+frnRes < array[lo]: myRes += cap1 cnt+=1 else: if array[lo] > myRes: ...
true
41a3ef55f00d7c09603dd97fa7d1f83fff22159e
SteevenMnw/TpTechnicienIntervention
/src/DataAccess/DataBaseManip.py
UTF-8
1,807
2.90625
3
[]
no_license
import sqlite3 import os import json from definitions import DB_PATH from src.entities.intervention import Intervention from src.entities.technicien import Technicien from src.repositories.technicienRepository import technicienRepository from src.repositories.interventionRepository import intervientionRepository def...
true
1023034b6269b901451a94badf1911c674066560
loan181/INGInious_memoire
/Introduction_IA_NN/exHandleLayers/correction.py
UTF-8
934
2.75
3
[]
no_license
#!/bin/python3 import os import sys import sys sys.path.insert(1, '/course/common') from contextlib import redirect_stdout if __name__ == '__main__': X = "X" try: studentsMats = [ @@res@@, @@res2@@, ] except Exception as e: print(e) exit() expe...
true
cd16debd913ce66e668838000f4e5c83372d1012
bodyshopbidsdotcom/cnn_workshop
/app/infer.py
UTF-8
1,552
2.734375
3
[]
no_license
import pdb from os import listdir from os.path import join import cv2 import numpy as np from model import model_alexnet, model_inception_v3 from constants import IMAGE_FILE_SUFFIXES, TESTING MODEL = 'weights-0016-0.36.hdf5' def infer(model, image_array): norm_image_array = np.array(image_array, np.float32) /...
true
753ecfdef342ed94ae28474a9dcaa4f74940bc56
suzusu/intro-info
/td4.py
UTF-8
967
4.40625
4
[]
no_license
# Exercice 1 : Afficher les nombres paires entre 0 et 30. X = 0 for compteur in range(16): print(X) X = X + 2 # Exercice 2 : Afficher en ordre décroissant les nombres de 10 à 1. x = 10 while x != 0: print(x) x = x - 1 # Exercice 3 : Calculer 1 x 2 x 3 x 4 x 5 x 6 avec une boucle. y = 1 for x in ran...
true
95df18633bd0c058923f1350052ab4c98b185396
johnghr/The_Real_Funky_Karaoke
/tests/test_karaoke_bar.py
UTF-8
3,180
3.09375
3
[]
no_license
import unittest from src.karaoke_bar import * from src.song import Song from src.guest import Guest from src.room import Room class TestKaraokeBar(unittest.TestCase): def setUp(self): self.song_1 = Song("Get Up Offa That Thing") self.song_2 = Song("Can't Stop") self.room = Room("The Real ...
true
abdceabf3353032529001d576443cce654fc4e6e
maykkk1/curso-em-video-python
/exercicios/MUNDO 3/Dicionários/ex094.py
UTF-8
1,438
3.625
4
[]
no_license
import pandas as pd dados = list() pessoa = dict() mulheres = list() acima_da_media = list() tot = 0 while True: pessoa['nome'] = str(input('Nome: ')) while True: pessoa['sexo'] = str(input('Sexo: [F/M]: ')).upper() if pessoa['sexo'] == 'F' or pessoa['sexo'] == 'M': break els...
true
2278f8867b4868e4de839e796714bff4a252c778
dinkoslav/Python
/Programing0-1/Week4/6-Count-of-Neighbours-With-Zero-Sum/pairs.py
UTF-8
379
3.671875
4
[]
no_license
def count_zero_neighbours(numbers): pairs = [] count = 0 while count < len(numbers) - 1: if numbers[count] + numbers[count+1] == 0: pairs = pairs + [numbers[count]] pairs = pairs + [numbers[count+1]] count = count + 1 return pairs numbers = [1, 2, -2, 0, 0, ...
true
50b11267879396964167d3cbdcac8d812e335587
jitendra977/My-Python
/tout72_comphernsis.py
UTF-8
475
3.796875
4
[]
no_license
# list comprehensions lst = [i for i in range(100) if i % 3 == 0] print(lst) # dictionary comprehensions dict1 = {i: f'item{i}' for i in range(1, 100) if i % 20 == 0} dict2 = {value: key for key, value in dict1.items()} print(dict1) print(dict2) # set comprehensions dress = {dress for dress in ['dress1', 'dress2', 'dr...
true
daab07137eaf689d1759ddff1d33379e77c54843
fonzynice/Native-App
/Product Order Form.py
UTF-8
5,755
3.0625
3
[]
no_license
# import modules for this application import tkinter as tk from tkinter import * from tkinter import ttk import sqlite3 from sqlite3 import Error # Product Database, sqlite3 def sql_connection(): try: connection = sqlite3.connect('pro_database.db') return connection except Error: pri...
true
387715e961f9850dcc2ef89386dab927bb18be03
k4ml/jazzpos
/src/kecupuapp_base/log.py
UTF-8
1,250
2.5625
3
[ "MIT" ]
permissive
import syslog import inspect def log_syslog(msg, priority='LOG_INFO', facility='LOCAL0', debug=False): """ Configure syslog (/etc/rsyslog.conf) to have the following:- local0.* /var/log/local0 local1.* /var/log/local1 TODOS: Get the class name if the caller is a class/instance m...
true
84600fd8150de6eba52de2d7456dd1360a45cb87
dexterchan/DailyChallenge
/MAR2020/MakingChange.py
UTF-8
1,139
4.25
4
[ "Apache-2.0" ]
permissive
#Given a list of possible coins in cents, and an amount (in cents) n, # return the minimum number of coins needed to create the amount n. # If it is not possible to create the amount using the given coin denomination, return None. #Here's an example and some starter code: #ANalysis, sort the list of possible coins O(n...
true
1894cbd0befe3b55d2f7db77e675e165e5554781
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc031/A/4921990.py
UTF-8
180
3.0625
3
[]
no_license
def game(A: int, D: int)->int: return max((A + 1) * D, A * (D + 1)) if __name__ == "__main__": A, D = map(int, input().split()) ans = game(A, D) print(ans)
true
4c8ea2ec6c932e1f3f8c2d270bb7f0ed412c8b15
google/ldif
/ldif/util/gaps_util_tf.py
UTF-8
3,364
2.515625
3
[ "Apache-2.0" ]
permissive
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
true
c544b72e64adb59f707a606a38fbfeb41ada779f
martin-chobanyan/transfer-visualization
/feature_vis/render.py
UTF-8
5,371
3.015625
3
[]
no_license
"""The render module defines an object which can be used to create feature visualizations""" from torch import mean import torch.nn as nn from torch.optim import Adam from torchvision.transforms import ToPILImage from tqdm import tqdm from .colors import DecorrelateColors from .fourier import FourierParam from .transf...
true
aeca63479888d32670c2b60d0ce857c27c6656cb
eneyi/100StatisticalTestsTestsInPython
/test_60.py
UTF-8
195
2.828125
3
[]
no_license
# Test 60 Friedman’s test for multiple treatment of a series of subjects # compare samples stat, p = friedmanchisquare(data1, data2, data3, data4) print('Statistics=%.3f, p=%.3f' % (stat, p))
true
91c45099f70dac253dced43e6a9f51eac6bab699
iswanlun/PatternTradingBot
/src/binance_trading_api.py
UTF-8
1,039
2.609375
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
import pprint from broker import Broker from binance.client import Client from binance.enums import * from config import config # ref : https://python-binance.readthedocs.io/en/latest/account.html class Binance(Broker): def __init__(self) -> None: self.client = Client(config['apiKey'], config['apiSecret']...
true