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
58b3705800a4c0860239637a6d6e69c7d5a77321
utahTAS/point_to_smoke
/Point_PostProcess.py
UTF-8
2,689
2.828125
3
[]
no_license
#This file is meant to format the data given in house by Scott for point emissions formatting. #This file assumes all emission magnitudes are given in tons/year #The only changes needed to run are the INPUT and EXPORT file names, and a check of the naming convention. #The input csv format should be as follows #FIPS NAI...
true
d993b09c23d9ea0d9a212c53b70a46a3d0e3d4ba
Eric-Wonbin-Sang/CS110Manager
/2020F_hw6_submissions/jaineshita/EshitaJainCH7P1.py
UTF-8
595
3.84375
4
[]
no_license
# I pledge my Honor that I have # abided by the Stevens Honor System. # Eshita Jain # program calculated BMI def main(): print("This program calculated BMI\n") weight = float(input("Enter your weight in pounds: ")) height = float(input("Enter your height in inches: ")) print() bmi = (weight * 720)...
true
0618e50b847f7320fde43970225b1f3c543be2f8
LorgneSchilooch/5IABD-ML
/environments/connect4/experiment_connect4_with_DDQN_agent_training_and_command_line_play.py
UTF-8
624
2.578125
3
[]
no_license
from agents import DDQNAgent, RandomAgent from environments.connect4 import Connect4GameState from runners import run_for_n_games_and_print_stats_1, run_step if __name__ == "__main__": gs = Connect4GameState() agent0 = DDQNAgent(action_space_size=gs.get_action_space_size(), neurons_per_hidden_layer=128, ...
true
91ca884962bf1df13bfd1783ddc7b7a33209cef3
ChenhongyiYang/GPViT
/mmcls/utils/logger.py
UTF-8
1,732
2.875
3
[ "Apache-2.0" ]
permissive
# Copyright (c) OpenMMLab. All rights reserved. import json import logging from collections import defaultdict from mmcv.utils import get_logger def get_root_logger(log_file=None, log_level=logging.INFO): """Get root logger. Args: log_file (str, optional): File path of log. Defaults to None. ...
true
b26f7a5aeec0712ba2a68adb95f875ed30858c4d
kinghaoYPGE/career
/python/20190121/Code/c5.py
UTF-8
1,161
3.671875
4
[ "MIT" ]
permissive
""" 测试 1. 开发测试(开发环境) 1.1 单元测试: 对一个模块,一个函数,一个类等进行正确性检验的测试 2. 业务测试(测试环境) """ # 针对abs函数有如下测试用例: # 1. 输入正数-->和输入相同 # 2. 输入负数--> 和输入相反 # 3. 输入0 --> 还是0 # 4. 输入非数值 --> 抛出TypeError """ 编写一个字典类,要求如下: d = Dict(a=1, b=2, c=4) d['a'] d.a d.a = '1' """ class Dict(dict): """ this is my dict example: >>> d1 = Dict...
true
545b00b6d192f56e18bee7d00efe588efeb09e07
MSUEvoIct/Agency
/Agency/tools/strongconnect.py
UTF-8
1,109
2.65625
3
[]
no_license
from collections import deque class strongconnect: def __init__(self, g): self._ndx = 0 self._indeces = {} self._lowlink = {} self._components = [] self._s = deque() self._do(g) def getComponents(self): return self._components def _do(self, g): for node in g.nodes(): if no...
true
ff3d2e5f62d4e8c18788d5f6d4e492be993db077
daniocen777/Proyectos-python
/herencia/herencia.py
UTF-8
1,823
3.4375
3
[]
no_license
class Producto: def __init__(self, referencia, nombre, precio, descripcion): self.referecia = referencia self.nombre = nombre self.precio = precio self.descripcion = descripcion def __str__(self): return""" REFERENCIA\t{} NOMBRE\t\t{} PRECIO\t\t{}...
true
733755afe9fd902fd83b64e3a5ce65a0b6a2c477
mastrayer/mastrayer
/exercise 5.py
UTF-8
112
2.796875
3
[]
no_license
def count(str) : c=0 for idx in str : if(idx=='e') : c=c+1 return c print count('next people')
true
878e4f9e752ac983c71de52824104b20abbbc87f
sac6199/Bomberman
/Bomberman.py
UTF-8
1,489
3.671875
4
[]
no_license
""" This file contains the Bomberman class to be used in the game. """ from colorama import Fore, Style from Person import Person class Bomberman(Person): """ Bomberman is the Bomberman object in the game. """ key_directions = { 'a' : [0, -1], 'w' : [-1, 0], 's' : [1, 0], 'd' :...
true
492502f5ecd956ae006807b62bef0482f50bf1dd
eareyan/negotiationmediator
/mediators/surrogates/gp_surrogate.py
UTF-8
1,732
2.625
3
[]
no_license
from mediators.base_surrogate import BaseSurrogate from skopt.learning.gaussian_process.kernels import ConstantKernel from skopt.learning.gaussian_process.kernels import Matern from skopt.learning.gaussian_process import GaussianProcessRegressor import numpy as np class GPSurrogate(BaseSurrogate): gp = None ...
true
a27831e31dbc2032c3dfaf72165e43f71ac18986
siddjakes/video_utils
/video_utils.py
UTF-8
2,796
3.140625
3
[]
no_license
import cv2 import numpy as np class Video(object): ''' Wrapper for OpenCV video capture, support indexing and slicing ''' def __init__(self, file_name): # initialize the video file self.file_name = file_name self.cap = cv2.VideoCapture(self.file_name) # load basic infor...
true
63c3374db10cfa2995dc01318037678673902d5e
vchatchai/python101
/python_tutorial/stringFormat.py
UTF-8
481
3.390625
3
[ "Apache-2.0" ]
permissive
print('We are the {} who say "{}!"'.format("knights", 'Ni')) print('{1} and {0}'.format('spam', 'eggs')) print('This {food} is {adjective}.'. format( food = 'spam', adjective='absolutely horrible')) print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred', other='Georg')) table = {'Sjoerd': 4127, 'Jack' : ...
true
59fffd949575a4d9c66c5a93d855085facd51964
TERADA-DANTE/algorithm
/python/codeup/solved/_4531.py
UTF-8
125
3.265625
3
[]
no_license
numbers = [] for _ in range(5): numbers.append(int(input())) numbers.sort() print(int(sum(numbers)/5)) print(numbers[2])
true
b3c2617f93b21b75e4a2a4847f7d4357b877583a
lizhanguo/python_S09
/S09_Python_Learn/Day3/def_2.py
UTF-8
447
3.25
3
[]
no_license
#!/usr/bin/env python #_*_encoding:utf-8_*_ __author__ = 'lizhanguo' def count(): for i in range(1,10): if i==5: return else: print i print "hello world" res=count() print res def count(): name="lizhanguo" for i in range(1,10): if i==5: ret...
true
4efd39d767cbd087a5f0137968a2a8d123a6ae6e
xulei717/Leetcode
/136.只出现一次的数字.py
UTF-8
2,228
4.03125
4
[]
no_license
# -- coding:utf-8 -- # @time : 2020-3-17 13:06 # @author : xulei # @project: leetcode """ 标签:简单、位运算、哈希表 题目:给定一个二叉树,找出其最大深度。 给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 说明: 你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗? 示例 1: 输入: [2,2,1] 输出: 1 示例 2: 输入: [4,1,2,1,2] 输出: 4 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/pro...
true
ce03c3daa38a3868125b8d513858eca65e38fc61
Jawmo/Hope
/engine/db/db_modify.py
UTF-8
492
2.59375
3
[ "MIT" ]
permissive
from engine.global_config import * from engine.db_commands import update_db_item, update_db_player def update_all_items(self): for item in items: if items[item].uuid_id == "70306652-fbda-479a-a06d-48b411911ed7": update_db_item(items[item]) else: print("passing") def update...
true
2ee5849e4aa373609c1bc3ef9f1e2977fe872a40
Imenus24/fastcam
/export/demo_fast-cam.py
UTF-8
14,664
2.734375
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python # coding: utf-8 # # DEMO: Running FastCAM using SMOE Scale Saliency Maps # ## Initial code setup # In[1]: import os import cv2 import numpy as np import torch from torchvision import models from IPython.display import Image # Lets load things we need for **Grad-CAM** # In[2]: from torchv...
true
c384e8e04aa02ab549d94e244810b09385ad7865
XiujuanSu-NOAA/PyGSI
/pyGSI/analysis.py
UTF-8
2,360
3.015625
3
[]
no_license
import netCDF4 as nc import numpy as np import datetime as dt class Increment: def __init__(self, path): """ Initialize a GSI increment file object INPUT: path : path to netCDF GSI increment file """ self.path = path self.get_metadata() def get_me...
true
4e2d2295a552bcae650a048d1f0a77415a587f89
smasoka/Learning-Things
/Botswana_training/script2.py
UTF-8
846
4.125
4
[]
no_license
#!/anaconda3/bin/python print("script 2") my_list = [45, 13, 20] print(len(my_list)) for value in my_list: print(value**2) x = [3, 6, 9, 10] y = [] # y = x^2 +2x +1 # HINT: y = xi**2 +2*xi +1 for xi in x: s = xi**2 +2*xi +1 y.append(s) print(y) # z = 2x^3 + x^4 z = [] for xi in x: s = 2*xi**3 + xi*...
true
f0cccb520cb2b57a5dcb7163da01584c76ee8e96
babooppa6/W261-Fall2016
/Week04/Kmeans.py
UTF-8
2,745
2.84375
3
[]
no_license
from numpy import argmin, array, random from mrjob.job import MRJob from mrjob.step import MRStep from itertools import chain import os #Calculate find the nearest centroid for data point def MinDist(datapoint, centroid_points): datapoint = array(datapoint) centroid_points = array(centroid_points) diff = ...
true
cd3220824af12262474cfb20e6b190c9633d9f28
sherwinfarrell/DevanagariOCR
/KerasOCR.py
UTF-8
5,605
2.671875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Apr 8 16:04:35 2018 @author: sherwin """ from sklearn.utils import shuffle import cv2 # working with, mainly resizing, images import numpy as np # dealing with arrays import os # dealing with directories from tqdm import tqdm import tensorflow as tf import keras os.env...
true
5574c0853e6bd6ae70d00193d7457bbac31e5f63
ryanoh98/pepper_study
/firstpose.py
UTF-8
2,489
2.71875
3
[]
no_license
import requests import cv2 import numpy as np from matplotlib import pyplot as plt from pycocotools.coco import COCO from requests import Session def pose_detect(file): APP_KEY = '3ac17bc0e257b604d053901085eaae99' session = requests.Session() session.headers.update({'Authorization': 'KakaoAK ' + APP_KEY}...
true
0b8867dcfbed1c1ec2778135472b1eae1dbe13af
wasit7/tutorials
/arduino_python/02_python_serial/readUno.py
UTF-8
669
2.71875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Tue Jul 07 13:58:49 2015 @author: Wasit """ import serial import re import datetime #ser = serial.Serial('/dev/tty.usbserial', 9600) #ser = serial.Serial('COM7', 9600) #ser = serial.Serial(0) # open first serial port ser=None for i in xrange(10): try: ser = serial.Se...
true
4936d36b3bb740f6818684d63d583cf214a664a6
ChrisClear/Coding_Dojo_Coursework
/Python/Flask_Fundamentals/Porfolio.py
UTF-8
798
2.96875
3
[]
no_license
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Welcome to my porfolio! My name is Chris!' @app.route('/projects') def show_me_the_cats(): return '<h1>My Projects:<h1><ul><li>Web Fundamentals<li>Pip<li>Python Fundamentals' ...
true
59aa7514c4f744a76cd5c047dba40f5df4f02061
nickaroot/GoToHack
/condb_class.py
UTF-8
2,490
2.5625
3
[]
no_license
class ConDB: def __init__(self, server='goto.reproducible.work', dbname='vk'): from pymongo import MongoClient self.c = MongoClient(server) self.db = self.c[dbname] def getAgesDF(self, lim=100, cond={}): from datetime import datetime from pandas import DataFrame ...
true
440c675b88ebd80990dbb3d20a9d9558203c708b
chapman-cpsc-230/hw2-sweet116
/cooling.py
UTF-8
218
3.671875
4
[ "MIT" ]
permissive
T = float(input('enter the temperature of tea')) T_a= float(input('enter the ambient air temperature')) k = 0.055 rateofcooling = -k * (T - T_a) print('The rate of cooling is', rateofcooling, 'degrees per minute')
true
eec22981e0ac13edfe46414233bff234debea3b3
j16949/Programming-in-Python-princeton
/2.3/factorial_r.py
UTF-8
115
2.921875
3
[]
no_license
import sys def factorial(n): if n == 1: return 1 return n * factorial(n-1) print(factorial(eval(sys.argv[1])))
true
d9b47f3a7ad5c1e0a3c92b07f4d308165900be02
AndreiToroplean/bouncy
/camera.py
UTF-8
3,517
2.90625
3
[]
no_license
import pygame as pg import numpy as np from global_params import FULL_SCREEN, C_BLACK, C_WHITE, FPS, CAM_DAMPING_FACTOR, WINDOWED_RES, C_RED, C_END, N_PLAYERS, \ SLOWMO_FACTOR from rectangle import Rectangle class Camera: def __init__(self): if FULL_SCREEN: self._screen = pg.display.set_m...
true
76e8ccdabcbb59427561cbadb440086b1b4ee474
natashaadler/Adler_Natasha_DataVis
/data/charts.py
UTF-8
442
3.546875
4
[]
no_license
import matplotlib.pyplot as plt # time frame years = [1900, 1950, 1960, 1965, 1970, 1975, 1980, 1985, 1990, 1995, 2000, 2010, 2015] #population pops = [1.6, 2.5, 2.6, 3.0, 3.3, 3.6, 4.2, 4.4, 4.8, 5.3, 5.7, 6.1, 6.5] #plots a built in method / plt.plot(years, pops, color=(255/255, 150/255, 100/255), linewidth=4.0)...
true
75f03d24f87fe377b438b8d8533689805847f723
GVguide/selfteaching-python-camp
/exercises/1901100303/d09/mymodule/stats_word.py
UTF-8
2,084
3.984375
4
[]
no_license
from collections import Counter ##################### 1.输出英文函数 def stats_text_en(text): #定义函数 #统计参数中每个英⽂文单词出现的次数,最后返回⼀一个按词频降序排列列的数组 if not isinstance(text,str): raise ValueError('参数必须是 str 类型,输入类型%s'% type(text)) ######处理生成纯英文单词列表 words = [] elements = text.split() symbols = '...
true
fd013e75e1696d633d94146f10e0c615f1d90a28
vinny0965/phyton
/Lista-Simplesmente-Encadeada-Em-Python-master/Lista.py
UTF-8
5,178
3.78125
4
[]
no_license
from No import No class Lista(object): # Construtor def __init__(self): self.__inicio = None self.__ultimo = None # Métodos acessores def set_Inicio(self, inicio): self.__inicio = inicio def get_Inicio(self): return self.__inicio def set_Ultimo(self, ultimo)...
true
a496dd928edad7d21aa69cf8550db870f04f27c3
dfirence/util-parser
/src/utils/transform.py
UTF-8
874
2.859375
3
[]
no_license
from json import loads, dumps from os import path from sys import exit from random import randint from csv import writer, QUOTE_ALL def to_json(s): return loads(s) def from_json(s): return dumps(s) def to_csv_file(headers_list, records_list): if isinstance(headers_list, list) and isinstance(records_list, li...
true
01af199e4327307b0f84b93762ea7c92677a692b
geneontology/go-site
/pipeline/util/model_organism.py
UTF-8
981
2.609375
3
[ "BSD-3-Clause" ]
permissive
import click import os import sys import yaml import re @click.group() def cli(): pass @cli.command() @click.argument("dataset_dir", type=click.Path(exists=True)) @click.option("--out", "-o", type=click.File("w")) def taxons(dataset_dir, out): datasets_paths = [os.path.abspath(os.path.join(dataset_dir, datase...
true
af4639dff59665c9dd3c6a6e874b88eb532383e5
FishRedLeaf/my_code
/leetcode/探索初级算法/1数组/9两数之和.py
UTF-8
614
3.703125
4
[]
no_license
''' 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 给定 nums = [2, 7, 11, 15], target = 9 因为 nums[0] + nums[1] = 2 + 7 = 9 所以返回 [0, 1] ''' class Solution: def twoSum(self, nums, target): d = {} for i,num in enumerate(nums...
true
48646f341e72a5edd15d11302ccb1b9cbd4ff459
ejolie/problem-solving
/BOJ/src/boj2628.py
UTF-8
548
3.46875
3
[]
no_license
''' boj2628. 종이자르기 ''' def find_max(arr, N): maxleng = 0 s = 0 for i in range(1, N): if arr[i]: if i - s > maxleng: maxleng = i - s s = i return maxleng W, H = map(int, input().split()) N = int(input()) garo = [0] * (W+1) sero = [0] * (H+1) for _ in range...
true
e372e25cdd6f37e20cc97038cf5eaabb91550204
AbySagar/Twilio-flask-test-1
/models/appointment.py
UTF-8
972
2.796875
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, DateTime, String import arrow Base = declarative_base() class Appointment(Base): __tablename__ = 'appointments' id = Column(Integer, primary_key=True) name = Column(String(50), nullable=False) phone_numbe...
true
a1ed13c52ef4fe0f1baf6a75b64cebe3a4bf6c2c
tefra/xsdata-samples
/datexii/models/eu/datexii/v2/speed_management_type_enum.py
UTF-8
1,204
2.578125
3
[]
no_license
from enum import Enum __NAMESPACE__ = "http://datex2.eu/schema/2/2_0" class SpeedManagementTypeEnum(Enum): """ Management actions relating to speed. :cvar ACTIVE_SPEED_CONTROL_IN_OPERATION: Automatic speed control measures are in place at the specified location, whereby speed limits are ...
true
3c8e539eea89cb75b88b1b354f15f2676bf8b784
JonnyCheong/machineLearning
/draw_C.py
UTF-8
1,023
2.96875
3
[]
no_license
import numpy as np from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt from sklearn.svm import LinearSVC from sklearn.decomposition import PCA data=np.loadtxt('Share/bvh.csv',delimiter=',') X=data[:,1:] y=data[:,0] pca=PCA(n_components=2) pca.fit(X) xpca=pca.transform(X) prin...
true
f20b27af8f05dbabbc5a836a1c7c647fe8a82b0c
exo7math/deepmath-exo7
/gradient/python/gradient_surface_6.py
UTF-8
629
3.140625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # Partie A - ligne de niveaux n = 50 VX = np.linspace(-0.2, 0.15, n) VY = np.linspace(-0.3, 0.1, n) X,Y = np.meshgrid(VX, VY) def f(x,y): # from matlab website z = x**2 - y**3 + x*y return z Z = f(X,Y) fig = plt.figure()...
true
444bfde8817051c696edb60e34d44a4639a91673
DiploDatos/AprendizajeSupervisado
/archive/2018/sentiment/model.py
UTF-8
510
2.515625
3
[ "MIT" ]
permissive
from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LogisticRegression params = { 'vect__binary': True, 'vect__ngram_range': (1, 5), 'vect__min_df': 3, 'vect__max_df': 0.9, 'clf__random_state': 0, } def build_pipeline(...
true
8cabcf748e9bbad3ca1b8cd80472b5552a0d6153
LoganRan625/Send-Data
/server
UTF-8
650
2.734375
3
[]
no_license
#!/bin/python3 import socket import sys HOST = '127.0.0.1' PORT = 65432 try: filename = sys.argv[1] except: filename = "file.txt" with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: print(f'[LISTENING] SERVER: {HOST} initiating on PORT: [{PORT}]') s.bind((HOST, PORT)) s.listen() conn, addr = s.accept...
true
6400fad3abb28af292e4898d793f32449ea3a5da
WirKekc/prject1
/stepik.org/stringIn.py
UTF-8
221
3.28125
3
[]
no_license
a = input() b = input() s = set() if a.find(b) == -1: print(a.find(b)) else: for i in range(len(a)): if a.find(b,i) != -1: s.add(a.find(b, i)) s = sorted(list(s)) print(*s, sep=" ")
true
afd5bcb6340a99404f58486213b74448ba7185f0
MarkTheHopeful/mathcontest_server
/exceptions/utils_exception.py
UTF-8
427
3.484375
3
[]
no_license
class UnknownStateException(Exception): def __init__(self, state_code): super(UnknownStateException, self).__init__( f"Attempted to get description of an unknown code: {state_code}") class WrongArgumentStateException(Exception): def __init__(self, tried_type): super(WrongArgumentSt...
true
df29c3ae098f8c347a0e40a4ffe50a85f8d45c9a
rakeshsukla53/interview-preparation
/Rakesh/linked-lists/cycle starts from which node.py
UTF-8
753
3.5
4
[]
no_license
from collections import defaultdict class ListNode(object): def __init__(self, x): self.val = x self.next = None # I used the hash function to uniquely identify the objects class Solution(object): def detectCycle(self, head): """ Given a linked list, return the node where the cy...
true
995653c932de8cb4cfd15d556d429a23cf716bb2
juanpedrovel/bomboclap
/algorithms_and_data_structures/arrays/Best Time to Buy Stocks.py
UTF-8
737
3.484375
3
[]
no_license
class Solution: def maxProfit(self, prices): """ :type prices: List[int] :rtype: int """ profit = 0 stocks = None price = 0 for i in range(len(prices)): if stocks == None: if i < len(prices) - 1: if price...
true
6d19b7c7c7e25f93105176d8013fb3e9cf9afbdb
HELDER2204/CursoEmVideo
/ex060.py
UTF-8
150
3.890625
4
[]
no_license
from math import factorial n1 = int(input('Digíte um valor para saber seu fatorial: ')) print('O fatorial de {} é {}'.format(n1, factorial(n1)))
true
8dfdb84e2b8122550bf660a7698758ca80c1aea7
sonamghosh/Udacity-Deep-Learning-PyTorch
/Lesson_two_Neural_Networks/15_softmax.py
UTF-8
502
3.984375
4
[]
no_license
# Lesson 2 Part 15 on the softmax function import numpy as np def softmax(L): output = [] for i in range(len(L)): val = np.exp(L[i]) / np.sum(np.exp(L[:])) output.append(val) return output """ alternatives: expL = np.exp(L) sumExpL = sum(expL) result = [] for i in expL: result.appe...
true
db8498302ce36b2b7cee7d4ac733f47cbf5d88c7
anastasiiaonishchuk/python_files
/index.py
UTF-8
660
3.59375
4
[]
no_license
gender = '' while (gender != 'выход'): gender = input('Если хочешь закончить, набери “выход”\nПожалуйста, укажи свой пол:') if (gender == 'мальчик' or gender == 'мужчина' or gender == 'юноша' or gender == 'муж' or gender == 'male' or gender == 'м' or gender == 'm'): print( 'wazzaaaap' ) elif (gender == ...
true
bac5ccf6d39d50df18df319d8c43dbee08ad4f36
anuragchhipa123/ASD1998
/Day 9/mongo.py
UTF-8
1,004
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu May 16 12:00:40 2019 @author: DELL """ import pymongo client = pymongo.MongoClient("mongodb://anuragchhipa:16egccs007%40@cluster0-shard-00-00-fnfn1.mongodb.net:27017,cluster0-shard-00-01-fnfn1.mongodb.net:27017,cluster0-shard-00-02-fnfn1.mongodb.net:27017/test?ssl=true&repl...
true
a98e77517c5d7e3af53190b840231252763f45c5
anazareth/advent2020
/day3.py
UTF-8
979
3.28125
3
[]
no_license
# Problem: https://adventofcode.com/2020/day/3 # Date: December 2020 # Author: Alex Nazareth import numpy as np def part1(): in_filename = r'data\day3_in.txt' in_data = np.loadtxt(in_filename, dtype=str, delimiter='\n', comments=None) in_width, ymax = len(in_data[0]), len(in_data) xpos, ypos = 0, 0 ...
true
222b3614b93d176c8eb780a652b79b387322650a
danrasband/coding-experiment-reviews
/responses/FP3ANE-JEK/1_sum_of_integers_in_a_string.py
UTF-8
250
3.09375
3
[]
no_license
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(S): # write your code in Python lists = S.split(",") total =0 for num in lists: total = total + int (num) return total
true
0e320dff23a49b22969479ecceec9f65930cf6ec
harsha-indresh/python_learning
/Python-TrainingNew/PythonBasic4.py
UTF-8
2,714
3.34375
3
[]
no_license
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> numbers=[23,43,54,65,22,76,56,98] >>> no=int(input("Enter a number:")) Enter a number:65 >>> for num in numbers: if(num==no): print("Number is available") ...
true
43ffec97f037da013c5641140a081cab3d7f7d09
RealAntonVoronov/yandex-algorithms-practice
/hw_2/2_f.py
UTF-8
283
3.0625
3
[]
no_license
n = int(input()) a = [int(x) for x in input().split()] b = a[::-1] if a == b: n_min = 0 else: for i in range(len(a)): res = a + b[i:] if res == res[::-1]: n_min = len(a) - i i_best = i print(n_min) if n_min > 0: print(*b[i_best:])
true
803212426436c74cb1bf60f436ee0db2884961db
kujaku11/sandbox_scripts
/test_large_dict.py
UTF-8
1,492
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 13:05:33 2021 @author: jrpeacock """ from pathlib import Path import numpy as np from mtpy.core import mt from datetime import datetime edi_path = Path(r"c:\Users\jpeacock\Documents\GitHub\mtpy\examples\data\ET_edi") edi_list = list(edi_path.glob("*.edi")) def mak...
true
b8e6b3b9c7a9798f0abe0c9aae3203a4a4be9af0
donald-uren/raspberry-pi-apps
/display.py
UTF-8
957
3.734375
4
[]
no_license
from abc import ABC, abstractmethod class AbstractDisplay(ABC): """ Simple abstract class for use in Task A & B """ err_colour = [255, 0, 0] def __init__(self): """ Sets up initial loop condition. While True, the application will continue to run """ self._running =...
true
c1352b670927112c435dc8b73e84a563e2f2a0cd
joaop-aguiar/DNC-Group
/Gerador de senha/generator.py
UTF-8
5,771
2.53125
3
[ "MIT" ]
permissive
import PySimpleGUI as sg import random import os char_list_maiu = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' char_list_minu = 'abcdefghijklmnopqrstuvwxyz' numero_list = '1234567890' especial = '!@#$%&*' def nova_senha(): chars = random.choices(char_list_minu+char_list_maiu+numero_list+especial,k=int(values['n_char'])) senh...
true
f70350994e5c6daddec282129fd42ec1b24fb009
jmgdelgado/Area_Python
/mysensores/photoresistorGL5516.py
UTF-8
1,033
3.625
4
[]
no_license
""" Photoresistor GL5516 La salida del photoresistor es analogica, por ello hay que poner un capacitor Se conecta una pata del photo resistor a 3.3V Se conecta la otra pata del photo resistor con el positivo del condensador Se conecta la entrada GPIO con el punto comun del photoresistor y el condensador La pata negativ...
true
341c96441893a6b1daf8f1c17a163073a5f6b884
psycomarcos/cursointensivodepython
/2.4.py
UTF-8
236
4.09375
4
[]
no_license
# Armazene o nome de uma pessoa em uma vriavel e então apresente o nomeda pessoa em: # letras minusculas, maiusculas e somente com a primeira letra maiuscula nome = "MarCoS" print(nome.lower()) print(nome.upper()) print(nome.title())
true
24f8799ec1cf213cc4fb4d792a69e7a1d31a2571
misterkrc/Braggi-A-Python-Based-Contextual-Chatbot-Framework
/Classifier.py
UTF-8
2,784
2.75
3
[ "MIT" ]
permissive
#%% import numpy as np import tensorflow as tf import tflearn import random import pickle import Text_Processing_Engine def model(train_x,train_y): '''Model Definition of a Deep Neural Network, which is responsible for the Classification. Input matrix size is set dynamically. ''' net = tflearn.input_da...
true
6bb7c9c7180b8052295a30e0a944c6fa6d728420
XiaoqiMa/StudyNotes
/Algorithms/leetcode/[829]连续整数求和.py
UTF-8
743
3.25
3
[]
no_license
# 给定一个正整数 N,试求有多少组连续正整数满足所有数字之和为 N? # # 示例 1: # # # 输入: 5 # 输出: 2 # 解释: 5 = 5 = 2 + 3,共有两组连续整数([5],[2,3])求和后为 5。 # # 示例 2: # # # 输入: 9 # 输出: 3 # 解释: 9 = 9 = 4 + 5 = 2 + 3 + 4 # # 示例 3: # # # 输入: 15 # 输出: 4 # 解释: 15 = 15 = 8 + 7 = 4 + 5 + 6 = 1 + 2 + 3 + 4 + 5 # # 说明: 1 <= N <= 10 ^ 9 # Related...
true
8a90b947178fc8ca7c95a8362b9d6bf8e3384aa6
Azeirah/ALGA
/graphUtils.py
UTF-8
1,341
3.8125
4
[]
no_license
"""Utilities for unclassified or random graph-related stuff""" from dfs import dfs def countGridEdges(x, y): """ x ------> *-*-*-* | | | | | | *-*-*-* | | | | | | y *-*-*-* | | | | | | *-*-*-* v is a grid. Counts the number of edges given its dimensions """ retu...
true
c33ea89aa4c4a5b799d4d0272c58db5b632139a9
ailabteam/CodesignalPython
/isPangram.py
UTF-8
329
3.625
4
[]
no_license
def isPangram(sentence): check = [0 for i in range(26)] sentence = sentence.lower() for i in range(len(sentence)): t = sentence[i] if t >= 'a' and t <= 'z': check[ord(t) - ord('a')] += 1 for i in range(26): if check[i] == 0: return False retu...
true
c63bbd7f795021388600c6ca8c483e0b64eba622
hamuni/Hoogle
/newsengine/module/newsCrawler/DBandJson.py
UTF-8
5,357
2.921875
3
[]
no_license
''' Add the new data to the pre-exiting Json files and Insert the new data into the DB ''' import gzip import pandas as pd import shutil import json import os import datetime import pymysql import codecs from nltk.tokenize import word_tokenize def dateTransition(content): for one_set in content: year = in...
true
7be95d1084be3b6ab89b003a8ee33a592d413b74
kamenchunathan/calculator
/parse.py
UTF-8
1,179
3.859375
4
[]
no_license
"""responsible for enforcement of all rules on a valid math problem""" import string import bodmas def parse(input_string): """:returns a list of operands and a list of operations in the order they appear""" # preprocessing steps: remove all whitespace input_string.translate({ord(c): None for c in string.w...
true
1e67d0769640ef0d8b9693ef424cb62dd71cde01
mamacker/SDD_parser
/convert_annotations.py
UTF-8
1,818
2.515625
3
[]
no_license
import os os.system("sort -n -k 6 annotations.txt > res.txt") os.system("identify reference.jpg > temp.txt") f=open("res.txt","r") f1 = open("temp.txt","r") dim = (f1.readline().split(' ')[2]).split('x') dim_x,dim_y = float(dim[0]),float(dim[1]) os.system("pwd > temp.txt") path = open("temp.txt","r").readline().sp...
true
8a49a392b695243ea17f6d4c829d09bcdfb9339e
DecomPy/DecomPy
/decompy/DataGathering/RepoFilter.py
UTF-8
7,020
2.765625
3
[ "BSD-3-Clause" ]
permissive
import json import requests import time import datetime from datetime import datetime # from decompy.DataGathering.WebNavigator import WebNavigator class RepoFilter: """ First draft of the RepoFilter using the GitHub api. This class searches for repositories on GitHub matching a search. It was written wit...
true
8e678dfee29da8b2cbe9cf74e1385fc69796a899
lonerlin/SelfDrivingCVCar
/jetson/tests/CarTask_test.py
UTF-8
723
2.8125
3
[ "Apache-2.0" ]
permissive
import sys sys.path.append('..') from car.car_task import CarTask from car.car_timer import CarTimer import time task_list = [] def _do_work(**kwargs): direction = kwargs['direction'] print("direction:{}".format(direction)) def do(direction=True, delay=3): task_list.append(CarTask(name="hello", activat...
true
f56d1a5939c97cad8f013c9cf1742f270a341ced
bourdeet/pisa
/pisa/stages/utils/add_indices.py
UTF-8
4,262
2.703125
3
[ "Apache-2.0" ]
permissive
''' PISA module to prep incoming data into formats that are compatible with the mc_uncertainty likelihood formulation This module takes in events containers from the pipeline, and introduces an additional array giving the indices where each event falls into. module structure imported from bootcamp example ''' from _...
true
dcc84b2a542df6eb5078adf768d8d87e180fadbd
xdtcssdi/notes
/tf练习/resNet.py
UTF-8
3,552
2.765625
3
[]
no_license
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import ssl ssl._create_default_https_context = ssl._create_unverified_context class BasicBlock(layers.Layer): def __init__(self, filter_num, stride = 1): super(BasicBlock, self).__init__() self.conv1 = layers.C...
true
ab3aa4686f639cae127f6da4e3e51ea966d5fa03
Fixer38/University-Notes
/semester-1/progra-ex/manip3/ex6-multiply-tables.py
UTF-8
170
3.40625
3
[]
no_license
def print_multiply_tables(nb, start=1, end=10): i = start while i <= end: print(f"{nb} * {i} = {nb * i}") i += 1 print_multiply_tables(2, 5, 12)
true
2aa3d5d188b42d120e9bfcbb3d72956020ad39df
muntherr/Python
/CommandClass.py
UTF-8
2,417
3.046875
3
[]
no_license
# Muntherr anati import glob import os import os.path import shutil # module to support file moving and deletion class Command: def __init__(self, file_name, Path): self.filename = file_name self.path = Path def grep(self): try: Found_path = glob.glob(self....
true
682e09e16bb8bbee9a55c491c2a834e5b0c59411
mavino4/QuizEval
/QuizEval/views.py
UTF-8
1,657
2.59375
3
[]
no_license
from django.shortcuts import render from django.utils import timezone from django.http import HttpResponse, JsonResponse from .models import * import json # Create your views here. def index(request): if request.method == 'GET': #leyendo la par'ametros enviados data = {"quiz_id" : int(request.GET["quiz_id"]),...
true
7a1460e46b7b98c4370803ae28001596d593c66a
zy199529/pachong
/第一个爬虫程序/qiushi.py
UTF-8
1,835
2.625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[27]: import requests import re headers = {'User-Agent':'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Mobile Safari/537.36'} info_lists = [] def judgment_sex(class_name): if class_name == 'womenIcon': ...
true
a96164049e90e774240e080578bcd0aba4a383e7
noashmul/MIL_tiger
/train_test_script_tiger.py
UTF-8
8,574
2.8125
3
[]
no_license
import torch from torch.autograd import Variable import torch.nn as nn import itertools import numpy as np import torch.optim as optim from models_tiger import MIL def calculate_classification_error(Y, Y_hat): """ Calculates the classification error. Parameters ---------- Y : GT labels Y_hat : ...
true
7ce403885ea186acb83d5f0c3fbd62f2f85fc1cb
pyr0tecnix/Aurore
/aurore/src/interrupt.py
UTF-8
68
2.578125
3
[ "MIT" ]
permissive
import time print("Interrupt start") while True: time.sleep(1e6)
true
9c0d58de97e773a42545ea16bfa6c6d14b8d174f
aherdzik/adventofcode
/2020/day18/p1.py
UTF-8
1,542
3.390625
3
[]
no_license
def findMatchingEndParenIndex(string): numParens, index = 1,0 while numParens > 0: if string[index] == "(": numParens = numParens + 1 elif string[index] == ")": numParens = numParens - 1 index = index + 1 return index def evalExpression(string): toReturn ...
true
532cc75a09eea97f1e510c3a98e54cbcb6ea8afb
m-star18/atcoder
/submissions/abc015/a.py
UTF-8
91
3.265625
3
[ "Unlicense" ]
permissive
a = input() b = input() if len(a) < len(b): ans = b else: ans = a print(ans)
true
1c7dd9cf3d7e55c428471f5adcb608a72b0afd55
mariaelenasilveira/periodo-2019-2
/Inteligencia-artificial/DistribuicaoSalasGA.py
UTF-8
2,089
3.6875
4
[]
no_license
from random import random,uniform,randint,randrange import math class Disciplina: #O id, tamanho e turno de cada discplina é fixo. #horário e sala irão variar com as iteraçoes def __init__(self, id_disciplina = 0, tamanho = 0, turno = 0): self.id_disciplina = id_disciplina self.tamanho = tamanho ...
true
dcf4fded646f983f3e23a615fd611c300aef4210
daniil-tol/python
/pythonProject/lesson1 task3.py
UTF-8
136
3.671875
4
[]
no_license
s = int(input("Введите число n? ")) s1 = s s2 = s * 10 + s s3 = s2 + s*100 print(f"n+nn+nn -> {s1}+{s2}+{s3} = {s1+s2+s3}")
true
f32995ecdadb50423ce4aa9c449613ec2f700566
MoJoVi/Euler_Project
/euler012.py
UTF-8
1,048
3.5625
4
[]
no_license
"""Последовательность треугольных чисел образуется путем сложения натуральных чисел. К примеру, 7-ое треугольное число равно 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. Первые десять треугольных чисел: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Перечислим делители первых семи треугольных чисел: 1: 1 3: 1, 3 6: 1, 2, 3, 6 10: 1, 2, 5...
true
34f36255d43d8f7015bbda8734f7e643ac07ee32
anennya/Audiobot
/main.py
UTF-8
3,224
2.734375
3
[]
no_license
from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.label import Label from kivy.uix.boxlayout import BoxLayout import subprocess import tweepy from tweepy import OAuthHandler import json import re class AudiobotNews(Widget): """def speech(self,tweets): for...
true
921028a4004b05edeef4e8009f5bc9548e0f569d
jackrobinsonuk/EngineeringMetrics
/tests/test_exception.py
UTF-8
531
2.734375
3
[]
no_license
import ia.common.exception as iae def test_iaexception(): e = iae.IAException() assert str(e) == 'IAException' e = iae.IAException(status_code=404) assert str(e) == 'IAException - status code: 404' e = iae.IAException(status_code=404, text="page no found") assert str(e) == 'IAException - sta...
true
ede9e2bb1077dafaf6a153a5537d5ebca9997279
jufei/BtsShell
/BtsShell/resources/tools/TA_exe_src/CTelnet.py
UTF-8
3,701
2.890625
3
[]
no_license
import telnetlib, time, sys, os, random class CTelnet: def __init__(self, host, port = 2323, prompt = '$', user = '', passwd = '', timeout = 10): self.host = host self.port = port self.prompt = prompt self.user = user self.passwd = passwd try: ...
true
6da7cf84e0ac56c6fb31a2e57b5f2349c4fee910
Esukhia/J018
/derivative_generator.py
UTF-8
1,620
2.984375
3
[]
no_license
''' Takes a dir named "<project>-suggestions-unicode" and generates following derivatives for Gregory: - suggestions in wylie - diplomatic in unicode - diplomatic in wylie ''' from pathlib import Path from pyewts import pyewts import re # "<project>-<type>-<format>" # "J018-diplomatic-unicode" project = 'J018' types ...
true
6a8377bfabf038390a19c40e2cd6138a1be6976f
amattag/motionPred
/motionPred/probability.py
UTF-8
1,452
3.46875
3
[]
no_license
""" Probability module A module with typical probability functions used in robotics for clustering techniques. """ # Author: Antonio Matta <antonio.matta@upm.es> # Import required modules. import numpy as np from scipy import linalg # Auxiliar functions: t_gaussian, t_zero and t_cummulate functions. def t_zero(traj...
true
61f1b8e8d660495346e4b683280c71ca5d096772
wattaihei/ProgrammingContest
/Codeforces/CR595/probB.py
UTF-8
1,425
3.328125
3
[]
no_license
class UnionFind(): # 作りたい要素数nで初期化 def __init__(self, n): self.n = n self.root = [-1]*(n+1) self.rnk = [0]*(n+1) # ノードxのrootノードを見つける def Find_Root(self, x): if(self.root[x] < 0): return x else: self.root[x] = self.Find_Root(self.root[x]) ...
true
09b0ba48d2ffef3ae37148c6d6e5100f4683c155
ntrex/Machine-Learning-Assignments
/learn.py
UTF-8
229
3.09375
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt xx, yy = np.meshgrid(np.arange(0, 5, 0.5), np.arange(0, 5, 0.5)) print(xx) print(yy) x = [1,2,3,4] y = [3,4,8,6] #matplotlib.pyplot. plt.scatter(x,y) #plt.plot(x,y) plt.show()
true
41fb8bde0eddbe220a39bb7e66281428b037e5f8
MSDS498/DataSet
/creating order-level dataset.py
UTF-8
26,331
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Oct 12 00:02:01 2019 @author: ashley """ import pandas as pd import numpy as np #import matplotlib.pyplot as plt wkg_dir = 'C:/Users/ashle/Documents/Personal Data/Northwestern/2019-04 fall MSDS498_Sec56 Capstone/final dataset/' df_customers = pd.read_cs...
true
3932381c24f0671097c0bdcd12e4fd321ae3ed8c
galli-leo/torch2coreml
/example/openface/visualize.py
UTF-8
627
2.875
3
[ "MIT" ]
permissive
import pydot # import pydot or you're not going to get anywhere my friend :D from coremltools.models import MLModel # first you create a new graph, you do that with pydot.Dot() graph = pydot.Dot(graph_type='graph') print("Loading model...") m = MLModel("openface.mlmodel") print("Loading layers...") layers = m.get_sp...
true
095dacf95066986f9ac53a74e78528137088ee6f
davidcdupuis/dsp
/python/advanced_python_csv.py
UTF-8
7,578
3.515625
4
[]
no_license
import csv import itertools from collections import OrderedDict ''' We cannot pass the csvReader as function argument. So in order to save it, we create two classes to store the information in memory. The first class is Faculty and stores all the Faculty personnel. The second class is Person and stores the information...
true
3ad5c2c07703ed97ec65ac2128dbb00c9061e509
zzlive/AFPD
/other_packages/geolocation/geolocation.py
UTF-8
752
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Mar 23 13:59:32 2018 @author: Zigan Wang """ from geopy.geocoders import Nominatim geolocator = Nominatim() location = geolocator.geocode("175 5th Avenue NYC") print(location.address) print((location.latitude, location.longitude)) print(location.raw) coordinates = geolocato...
true
d98dc2ef023cbd336a1f56140f7a5e713ec67c51
am9417/fpga-client
/desktop.py
UTF-8
5,606
2.59375
3
[]
no_license
# Author: Kim Lehtinen <kim.lehtinen@student.uwasa.fi> import tkinter as tk import fpga_client import constants import utils from PIL import ImageTk,Image # create desktop app window = tk.Tk() # other files can use these variables to access desktop elements server_response_msg = tk.StringVar() input_images = utils....
true
603f56b0b2ec2dc8348132ca2e9b21dd014bc6c3
AlEkramHossainAbir/Python1
/input cgpa.py
UTF-8
141
3.1875
3
[]
no_license
#program name: input cgpa #author name: Al- Ekram Hossain Abir # a program to read cgpa print("Enter Your CGPA ",end=": ") a=float(input()) print(a)
true
12e8f17600edee8f2b9b41b0580b3276d44cd9e0
its-vivek-goel/jarvis
/takecommand.py
UTF-8
884
3.453125
3
[]
no_license
#to take command from user in audio and convert it into text import speech_recognition as sr # use to convert voice to machine readable language def takecommand(): r = sr.Recognizer() with sr.Microphone() as source: # r.adjust_for_ambient_noise(source) print("Lis...
true
32248d8fae01ecd76b4c7c193cc3780ae9a2e66a
awsk1994/DailyCodingProblems
/Problems/day0.py
UTF-8
1,902
4.5
4
[]
no_license
''' There's a staircase with N steps, and you can climb 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters. For example, if N is 4, then there are 5 unique ways: 1, 1, 1, 1 2, 1, 1 1, 2, 1 1, 1, 2 2, 2 What if, instead o...
true
4c9c192d93926cd4b31b4a342f6f68c52032c4fb
CONCORDY/test
/实例属性与类属性.py
UTF-8
632
4
4
[]
no_license
class Student(object): name = 'Student' s = Student() # 创建实例s print(s.name) # 打印name属性,因为实例并没有name属性,所以会继续查找class的name属性 print(Student.name) # 打印类的name属性 s.name = 'Michael' # 给实例绑定name属性 print(s.name) # 由于实例属性优先级比类属性高,因此,它会屏蔽掉类的name属性 print(Student.name) # 但是类属性并未消失,用Student.name仍然可以访问 del s.name # 如果删除实例的n...
true
c24f8cd2ad7293a74526d82c8df5c0cbf69aae7a
abhineet123/PTF
/wmic_mac.py
UTF-8
1,745
2.609375
3
[]
no_license
def get_interfaces_with_mac_addresses(interface_name_substring=''): import subprocess import xml.etree.ElementTree cmd = 'wmic.exe nic' if interface_name_substring: cmd += ' where "name like \'%%%s%%\'" ' % interface_name_substring cmd += ' get /format:rawxml' DETACHED_PROCESS = 8 ...
true
466bdf22a332aa0bd13126463834149a5ce947d8
bpbrown/polytrope
/plot_slices.py
UTF-8
16,970
2.71875
3
[]
no_license
""" Plot slices from joint analysis files. Usage: plot_slices.py join <base_path> plot_slices.py <files>... [options] Options: --output=<output> Output directory; if blank a guess based on likely case name will be made --fields=<fields> Comma separated list of fields to plot [default: s',enstrop...
true
88c3dd51695d761738f1a0857e1e06cd0f2d13f6
utkarsht724/PythonBasicPrograms
/Sets/maxandmin.py
UTF-8
124
2.59375
3
[]
no_license
A={2,3,4,44,55,6,6,722,66} print("the maximum element of the array",max(A)) print("the minimum element of the array",min(A))
true
0db1892e5295f7d557c0fe1ba4c1dcc5aa7d51e6
JakeSigwart/Autonomous_Car
/one_hot_test.py
UTF-8
1,138
2.5625
3
[]
no_license
import numpy as np from Data_log_manager import * from encode_funcs import * from image_funcs import * #Test opening and reading a data file. Test one-hot encoding and decoding of data steering_range = [223, 372, 521] throttle_range = [226, 375, 524] num_steering_classes = 31 num_throttle_classes = 31 steering_range_o...
true