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
047f06b0f8afa9e26af495f9142ccae149741b75
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc036/B/4722404.py
UTF-8
248
2.890625
3
[]
no_license
n=int(input()) line=[] for i in range(n): k=list(input()) line.append(k) ans=[] for i in range(n): stack=[] for j in range(n): stack.append(line[j][i]) stack.reverse() ans.append(stack) for i in ans: print("".join(i))
true
7f500e5a7e780390b63b12cd0961734657ce9cad
fanny/networking
/udp_socket_ack/server.py
UTF-8
1,421
3.125
3
[]
no_license
# -*- coding: utf-8 -*- import socket from threading import Thread import time LOCALHOST = '127.0.0.1' PORT = 6789 def calculator(operation, first_number, second_number): result = '[ERROR] Your operation is not registered.' first_number = int(first_number) second_number = int(second_number) if opera...
true
4a77017ceca03726a8770889159c1f6c81ab0a68
huahua1128/python
/test/zz_ningmeng/week_2/class_1206_if&for/if条件语句.py
UTF-8
1,832
3.921875
4
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2018/12/6 20:40 # @Author : lemon_huahua # @Email : 204893985@qq.com # @File : if条件语句.py #强制同学们选一个 #酸的A 甜的B 辣的C 苦的D 不知道自己的口味E #明星 # A 周杰伦粉丝会 # B 彭于晏粉丝会 # C 胡歌粉丝会 # D 华华粉丝会 # E 无组织人员 #分支引流的作用 #条件判断 根据条件去进行判断去进行处理 #圣诞节来了 #心仪的对象表白 A 巧克力+鲜花 B 平安果 #条件语句 if ...else #语法: #i...
true
cac2eb0fb5ce1b73c844656d2e2c56499b820677
r-tran/advent-of-code
/aoc-2019/day2/day2.py
UTF-8
723
3.484375
3
[]
no_license
def calc_program(intcode, noun, verb): intcode = list(intcode) intcode[1], intcode[2] = noun, verb supported_opcodes = set([1, 2, 99]) i = 0 while i < len(intcode) - 3: opcode = intcode[i] if opcode in supported_opcodes: a, b, = intcode[intcode[i + 1]], intcode[intcode[i + 2]] if opcode == 1: intco...
true
f53147b4ea638097717d55cd96b58b0df2d71535
daigo0927/blog
/tfp-flipout/models.py
UTF-8
1,727
2.703125
3
[ "MIT" ]
permissive
''' 3 types of CNN (normal/reparameterized/flipout) ''' import tensorflow as tf import tensorflow_probability as tfp from tensorflow.keras import layers def CNN(num_classes=10, **kwargs): model = tf.keras.Sequential([ layers.Conv2D(64, 3, 2, 'same', activation=tf.nn.relu, **kwargs), layers.Conv2D...
true
dba96df0417731381deabb5d11fb39e818d7858c
r-malon/python-code
/OLD/calculadora.py
UTF-8
369
4.03125
4
[]
no_license
x = int(input("Digite o nº que vai somar: ")) oper = input("Digite a operação que vai fazer: ") y = int(input("Agora o outro nº: ")) if oper == "/": print("O resultado é", x/y) elif oper == "*": print("O resultado é", x*y) elif oper == "-": print("O resultado é", x-y) elif oper == "+": print("O resulta...
true
b554c3948df67c80d28f1a97fca88ff8bed0e984
TheGreatPerhaps/SearchMethods
/my_code/test2.py
UTF-8
1,260
3.546875
4
[]
no_license
import sys from data.dict import cities_and_paths from data.graph import Graph stack = [] visited = [] def iterative_path(start, goal): root = Graph(start, start, 0, 1) for i in range(1,sys.maxsize): visited.append(root.name) if dfs_path(root, goal, i): break else: ...
true
4e9bcfbbd23c14be4211d16d9afd35c96785d109
QuantXP/OxBerryPis
/oxberrypis/parsing/parsers.py
UTF-8
6,067
3.140625
3
[]
no_license
"""Parsers for XDP streams.""" import os import io import struct import os.path from oxberrypis.errors import ParsingError from oxberrypis.parsing.headers import PacketHeader from oxberrypis.parsing.headers import MsgHeader class XDPChannelUnpacker(object): """XDP channel parser (unpacker). The parser read...
true
3cac8d74d9141360dd020444025ab59f93be77c7
HadXu/python-machine-learning
/python-machine-learning/chapter9/lst_flask_app_2/app.py
UTF-8
756
2.546875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Nov 21 21:08:38 2015 @author: hadxu """ from flask import Flask, render_template,request from wtforms import Form,TextAreaField,validators app = Flask(__name__) class HelloForm(Form): sayhello = TextAreaField('',[validators.DataRequired()]) @app.route('/') def index(...
true
52e1a8690600aa02fb859fca030d76b5e3a1438f
IShengFang/NYCU_2021spring_Computer_Vision_Group27
/HW2/plot_filter.py
UTF-8
1,426
2.75
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d if __name__ == '__main__': h, w = 300, 300 ratio = 0.28 filter_type = 'ideal' high_pass = True fltr = np.zeros((h, w)) cutoff_freq = min(h, w) / 2 * ratio cutoff_freq = int(cutoff_f...
true
d0099691c3cbfa5667ad5723a9ca474754718004
nikitakukreti/MCQ_Quiz
/mcqquiz.py
UTF-8
9,759
3.84375
4
[]
no_license
print("Welcome to the quiz with questions related to Python...") print("Let's start the quiz..") score=0 while(True): print("1.Given a function that does not return any value, what value is shown when executed at the shell?") print("A.int\n B.bool \nC.void \nD.None") a=input("enter your choice") ...
true
88f2be3442f05a0f1f10cd32b6f01cf77a358357
AdamStew/School-Repos
/CIS365_Projects/Texas_HoldEm_AI/deck.py
UTF-8
3,409
3.96875
4
[]
no_license
from random import shuffle """ Card and Deck Classes. This module holds classes which represent both cards and decks. Author: Omar Shammas omar.shammas@gmail.com> Editors: Charles Billingsley Josh Getter Adam Stewart Josh Techentin """ class Card: """ Class to hold specific card data ...
true
9d4c5aa6e8d49c6e12066d034eb0afe9a5fdbebd
Minghe0Zhang/Leetcode
/Array/914. X of a Kind in a Deck of Cards/main.py
UTF-8
1,276
3.8125
4
[]
no_license
""" In a deck of cards, each card has an integer written on it. Return true if and only if you can choose X >= 2 such that it is possible to split the entire deck into 1 or more groups of cards, where: Each group has exactly X cards. All the cards in each group have the same integer. Example 1: Input: deck = [1,...
true
f54c9542b0f9f4b7105f602a595bf9db3e0e3704
laundrydirty/programovani2
/oop.py
UTF-8
793
4.125
4
[]
no_license
# class definition class Animal(object): #weight #color # inicializator atributu def __init__(self,weight=None,color=None): print("Initializing...") self.weight = weight self.color = color # aby nam to vypisovalo neco hezkyho def __str__(self): return "Ani...
true
56dabfa777293d75419ec8b0d1b262ec36a1dee1
freedomexists/regru-internship
/day5/task1/task1.py
UTF-8
595
3.9375
4
[]
no_license
# task 1: # Оберните функцию в хлеб, кетчуп и сыр, используя один декоратор. def sandwich(func): def wrapper(meat): print('----хлеб----') print('---кутчуп---') print('----сыр-----') func(meat) print('----хлеб----') return wrapper @sandwich def mainingredient(meat): ...
true
0133080247ed5d2bdc5f2edd95cb006eb92797ea
xyzemc/GSI_plots
/plot_GSI_diagnostic_files.py
UTF-8
5,256
2.609375
3
[]
no_license
import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt import matplotlib.colors as mcolors from scipy import spatial import cartopy.crs as ccrs import cartopy.feature as cfeature import argparse parser = argparse.ArgumentParser(description='Plot O-F histogram and spatial plot with GSI diagnost...
true
e2d590b76bfb0be2f23245de7a8d6d0bfb4f49f3
ankittandon/svm-hinge-loss
/real_data_demo.py
UTF-8
3,499
2.921875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.linalg import sklearn.preprocessing import sklearn import linear_svm_square_loss # Use real-world spam dataset spam = pd.read_table('https://statweb.stanford.edu/~tibs/ElemStatLearn/datasets/spam.data', sep=' ', header=None) ...
true
7b0a95c0985ee6e31c992fc2db462f9a1753cc80
crquan/software_execution_measurement
/SimplePBWMTemplate.py
UTF-8
4,096
2.703125
3
[]
no_license
#!/usr/bin/python """ This file is in charge of generating the path based watermark template """ import random class SimplePBWMTemplate: _predicate_list = \ [ ["1", 0],\ ["0", 1] ] def __init__(self): self._...
true
f48da5ce2d81c22186bf2ccbcaac07b574cd775a
DKU-STUDY/Algorithm
/programmers/난이도별/level02.구명보트/dkdlelk99.py
UTF-8
951
3.71875
4
[]
no_license
# 출처 https://programmers.co.kr/learn/courses/30/lessons/42885 # input people : 사람들의 몸무게가 담긴 배열, limit : 구명보트의 무게 제한 # output 구명보트의 최소 갯수 # 보트의 최대 수용 인원은 2명 # 구명보트 무게 제한은 언제나 사람 무게와 같거나 크다. (구출할 수 없는 경우는 없음) def solution(people, limit): answer, start, end = 0, 0, len(people) people = sorted(people) while st...
true
4137c0c248adc7ae89e4416ce443dc0acfa231ea
khmahmud101/CodingBat_problem_solve
/String-1/combo_string.py
UTF-8
144
2.828125
3
[]
no_license
def combo_string(a, b): if a == b: return "str can not be same" elif len(a) > len(b): return b + a + b else: return a + b + a
true
e7b84916d5b368c2ee139ce484a9eb5a493c9c91
Sneha07-git/Python-Projects
/JPEGtoPNGconvertor.py
UTF-8
494
3.21875
3
[]
no_license
import sys import os from PIL import Image # command line input image_folder = sys.argv[1] new_folder = sys.argv[2] print(image_folder,new_folder) if not os.path.exists(new_folder): #to create a folder os.mkdir(new_folder) for file_name in os.listdir(image_folder): img = Image.open(f'{image_f...
true
b76062cf8db8266dd36a8f529f44d615706c7b83
Meeds122/Simple-POS
/printing.py
UTF-8
4,316
3.296875
3
[]
no_license
#Simple-POS/printing.py #functions to print receipt, dayfile, etc. import records as records # generate dayfile name... from cart import Cart, Item import platform # detect platform for printing import os # windows printing import subprocess # linux printing def printReceipt(cart): """ printReceipt(cart) ...
true
a6a97d013383c3c52926e236af02c892c5158d0f
kalmi901/Symplectic
/Krylov/2x2Matrix.py
UTF-8
304
2.71875
3
[]
no_license
import numpy as np from GMRES import gmres_solve from BICG import bicg_solve A = np.array([[2.0, 3.0], [4.0, -1.0]]) # x = np.array([10000.0, -2000.0]) x = np.array([5.0, 3000000.100000]) b = np.array([1.0, 23.0]) #print(gmres_solve(A, b, x, 1000, 3, tol=1e-6)) print(bicg_solve(A, b, x, 20, tol=1e-6))
true
c89ba7a643b64534b9f9dbb70a09d0ea4517b242
Nitty12/MADRL
/environment.py
UTF-8
2,637
2.609375
3
[]
no_license
import abc import tensorflow as tf import numpy as np from tf_agents.environments import py_environment from tf_agents.environments import tf_environment from tf_agents.environments import tf_py_environment from tf_agents.environments import utils from tf_agents.specs import array_spec from tf_agents.trajectories impo...
true
2be7d0c73034f376d2d794275115dc33865a5f91
AGou-ops/myPyQT5-StudyNote
/Basic/ListWidget.py
UTF-8
958
3.046875
3
[]
no_license
''' 扩展的列表控件(QListWidget) QListView ''' from PyQt5.QtWidgets import * import sys class ListWidget(QMainWindow): def __init__(self): super(ListWidget, self).__init__() self.setupUI() def setupUI(self): self.setWindowTitle("List Widget") self.resize(300, 270) self.listw...
true
542cb727c8db99a283036f9894a04bc64e9d78b8
Compphysguy/intro-fortran-2016
/web/python/fdm-neumann.py
UTF-8
2,977
2.625
3
[ "MIT" ]
permissive
import math import numpy as np import matplotlib matplotlib.use('SVG') import matplotlib.pyplot as plt fig, ax = plt.subplots() N = 5 M = 6 h = 1. / M grid = [(h * i, h * j) for i in range(0, M + 1) for j in range(0, N + 1)] sx, sy = zip(*grid) ax.scatter(sx, sy, marker='+') boundary = [(0, h * j) for j in range...
true
b43ff7a9158684263ce52b9129af12a6565a879d
devdoomari/pyvalidator
/pyvalidator/errors/funcexception.py
UTF-8
1,208
3.28125
3
[]
no_license
class FuncException(Exception): def __init__(self, func, var, exception): self.error_name = "func_exception" self.func = func self.var = var self.exception = exception def __cmp__(self, other): if self.__eq__(other): return 0 elif self.__lt__(other): ...
true
b6994a3e0fad6975f0e11f85793a66cc82a3b31d
devinshields/AdventuresInNumericalOptimization
/linearregression.py
UTF-8
2,951
3.796875
4
[]
no_license
#!/usr/bin/python ''' this module solves an example of a linear least squares regression problem via gradient descent''' import numpy as np def least_squares_via_gradient_descent(A, b, max_gradient_norm=10**-6): ''' http://en.wikipedia.org/wiki/Gradient_descent#Solution_of_a_linear_system Minimize: ||A*x ...
true
cbc230ba57ebb207c3d5d8131cb8794650bf5286
YangJiao85/MicrosoftDS
/C11_Capstone/t1_SimplestLinearModel/3Modeling.py
UTF-8
7,234
2.71875
3
[]
no_license
## Construct model ## Label: rate_spread ## import pandas as pd from sklearn import preprocessing import sklearn.model_selection as ms from sklearn import linear_model import sklearn.metrics as sklm import numpy as np import numpy.random as nr import matplotlib.pyplot as plt import seaborn as sns import scipy.stats as...
true
610ed47bd817a9a5c6d8f06985e9e856eed50c64
dhmit/gender_analysis
/gender_analysis/analysis/dependency_parsing.py
UTF-8
4,438
2.984375
3
[ "BSD-3-Clause" ]
permissive
from nltk.tokenize import sent_tokenize, word_tokenize from gender_analysis.text import common from gender_analysis.gender.common import _get_parser_download_if_not_present def generate_dependency_tree(document, genders=None, pickle_filepath=None): # pylint: disable=too-many-locals """ This function retu...
true
4ee6072bfb849c110f935e4c3f984cc45428b62b
NREL/floris
/floris/simulation/wake_turbulence/crespo_hernandez.py
UTF-8
3,409
2.5625
3
[ "Apache-2.0" ]
permissive
# Copyright 2021 NREL # 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 http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distri...
true
33f24c6b5a731e8fbf9452ce82482264c13bdc7a
AmberFalbo/campbellluggblackwell.com
/scripts/head_fix_1.py
UTF-8
5,036
2.703125
3
[]
no_license
""" Program to clean metas and some tops of files """ import glob from IPython import embed import os import re from pathlib import Path import sys from bs4 import BeautifulSoup, NavigableString, Doctype from urllib.parse import urlparse import tidylib from tidylib import tidy_document def lo...
true
879193328c50c8e3528613c0e63658937fddd859
IndirectCogs/CodingPlayground
/RockPaperScissors.py
UTF-8
1,780
4.34375
4
[]
no_license
# RockPaperScissors.py # December Redinger # 3/15/2020 ''' This game of Rock, Paper, Scissors could be used in different programs as a sort of random decider. Many systems use "Paper beats Rock, Rock beats Scissors, Scissors beat Paper", and this sort of function could be used in many different ways. That's t...
true
4cae5f9a956833f1fdcd32dc7a66720fc287beb6
sjdeak/interview-practice
/contest/leetcode/135/Binary_Search_Tree_to_Greater_Sum_Tree.py
UTF-8
1,474
2.703125
3
[]
no_license
# https://leetcode.com/contest/weekly-contest-135/problems/binary-search-tree-to-greater-sum-tree/ import os, sys, shutil, glob, re import time, calendar from datetime import datetime, timezone import hashlib, zipfile, zlib from math import * from operator import itemgetter from functools import wraps, cmp_to_key, redu...
true
7c8877ec6c62f1fbe981d431686b344dbd852c79
keenlykeenly/Differentially-Private-Mean-Embeddings-with-Random-Features-for-Synthetic-Data-Generation
/code/mnist/real_mmd_loss.py
UTF-8
2,752
3.03125
3
[]
no_license
import torch as pt # implementation of non-appriximate mmd loss mostly for debugging purposes def get_squared_dist(x, y=None): """ This function calculates the pairwise distance between x and x, x and y, y and y Warning: when x, y has mean far away from zero, the distance calculation is not accurate; use get_...
true
10033d168beb179d773d6b051ec77000fa2cb355
loc-vu/patent-scraper
/query_parameters.py
UTF-8
5,021
2.984375
3
[ "MIT" ]
permissive
import json class Query: """ Holds the two query parameters for GET and POST request """ def getParameter(self, comp_name, num_pat, start_date, result_fields): """Query parameter for GET request Parameters ---------- comp_name : str Company nam...
true
f7d3d1c09e83719d05ac91d5b94663702043b545
luenling/Vetgrid10
/replace_chr_names.py
UTF-8
1,528
2.78125
3
[]
no_license
import sys, re import os import argparse import select import gzip parser = argparse.ArgumentParser(description="""Reads replacement list and replaces all occurences of term in first or other given columns in none (framed by whitespace or word boundaries) in a file with the other. Usually replaces column 1 with 2, can...
true
71e9b664c9d41d47ec1f3078f0839bd9a8624d97
fjelenic/Character_Recognition
/NeuronskeMreze.py
UTF-8
5,644
2.84375
3
[]
no_license
from matrica import * import random def dekodiraj_predvidjanje(y): max = 0 for i in range(1, y.oblik[0]): if y[i][0] > y[max][0]: max = i return max def raspakiraj(file): with open(file, 'r') as f: X = [] y = [] for line in f.readlines(): ...
true
257a9455297fe1172896dfbe27d7617a2f544d66
hwangyoungjae/study
/python_tkinter_003.py
UTF-8
353
2.84375
3
[]
no_license
# -*- encoding:utf8 -*- # Python version in the development environment 2.7.11 import os os.chdir(os.path.dirname(__file__)) from Tkinter import * root = Tk() WidgetCanvas = Canvas(root,bg='yellow', height=250,width=300) coord = 10, 50, 240, 210 arc = WidgetCanvas.create_arc(coord, start=0, extent=150, fill='red') Wi...
true
749971f05d7fe172a32a64b5e5e4f33ba677cf38
EdZou/495Bio-face-recognition
/Draw.py
UTF-8
4,590
3.03125
3
[]
no_license
from matplotlib import pyplot as plt import numpy as np import pylab as pl from scipy import interpolate from tqdm import tqdm import os import pickle from scipy.spatial.distance import hamming import copy class Drawfunc(object): def __init__(self, matrix, res_dir): super(Drawfunc, self).__init...
true
5cc2e00c4b75e5f6a67af19fc5859b0a571f254b
hifitim/projecteuler
/prob10.py
UTF-8
399
3.375
3
[]
no_license
import math def is_prime_num(num): num_sqrt = int(math.ceil(math.sqrt(num))) for i in xrange(2,num_sqrt+1): if num % i == 0: return False return True def find_prime_sum_below(num): total = long(0) for i in xrange(long(num)): if is_prime_num(i): total += i ...
true
8e8453b6d7c65238070034f4317fd2727b790fb9
sandipdeshmukh77/python-practice-code
/to check whether given file exist or not.py
UTF-8
278
3.5
4
[]
no_license
import os fname=input('enter the name of file:') if os.path.isfile(fname): print('this file is available',fname) print('the content of this file is:') f=open(fname,'r+') print('*'*40) print(f.read()) print('*'*40) f.close() else: print("this file does not exist",fname)
true
154b9b64fde59fc74599fd25e501b09deeb1b1a7
biobakery/shortbred_doit
/src/create_metagenome/zopy/test/make_big_table.py
UTF-8
701
2.8125
3
[]
no_license
#! usr/bin/env python import random cols = 2000 rows = 100000 outline = ["headers"] for j in range( cols ): outline.append( "COL"+str( j+1 ) ) print "\t".join( outline ) """ outline = ["META"] for j in range( cols ): outline.append( random.choice( ["aaa", "bbb", "ccc"] ) ) print "\t".join( outline ) """ for i ...
true
e4bf7b14138fe801091b2d1dae9db900778890fc
weiuniverse/python_learning
/check_profanity.py
UTF-8
365
2.90625
3
[]
no_license
import urllib.request def read_text(): quotes=open("profanity.txt") contents=quotes.read() print(contents) quotes.close() check_profanity(contents) def check_profanity(text_to_check): connection=urllib.request.urlopen("http://www.wdyl.com/profanity?q="+text_to_check) ## 404 output=con...
true
e1d4727e8f0dcddaf5239e20e221be5bd659149e
ChesterNut999/Python_Lab_02_Test_Py_Flask_Rest
/app.py
UTF-8
675
2.859375
3
[]
no_license
from flask import Flask, jsonify, request import json app = Flask(__name__) @app.route('/<int:id>') def testApi_Informacoes(id): return jsonify({'id': id, 'Nome': 'Maurilio', 'Profissao': 'Desenvolvedor'}) @app.route('/soma/<int:num1>/<int:num2>/') def soma(num1, num2): return jsonify({'soma':num1 + num2})...
true
b709c3ef81236bcdbd32aed698227e4e2f9d5597
hujunhao66666/python---spider
/MyFirstSpider.py
UTF-8
1,712
2.796875
3
[]
no_license
import requests from bs4 import BeautifulSoup def download_page(url): headers={'User-Agent':"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0"} r=requests.get(url,headers=headers) return r.text def get_content(html,page): output="第{}页 作者:{} 性别:{} 年龄:{} 点赞:{} 评论:{...
true
f3174cac6975f6862b7e8026a6270212faee0e05
vishalsodani/deal
/tests/test_silent.py
UTF-8
233
2.75
3
[ "MIT" ]
permissive
import deal import pytest def test_silent_contract_not_allow_print(): @deal.silent def func(msg): if msg: print(msg) func(None) with pytest.raises(deal.SilentContractError): func('bad')
true
7cfd3809667c8dee340c0280bcff8ad5df9278d2
satoshi6380/To-DoList
/To-Do List/task/todolist/todolist.py
UTF-8
3,782
3.4375
3
[]
no_license
# Write your code here from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine, Column, Integer, String, Date from sqlalchemy.orm import sessionmaker from datetime import datetime, timedelta Base = declarative_base() class Task(Base): __tablename__ = 'task' id = Column(In...
true
cae5bc344e46096cb920924fdf927b3fbfdf8e81
Anusha260/dictionary
/.vscode/first repace last.py
UTF-8
78
3.171875
3
[]
no_license
str=input("enter the user") a=str[-1:] b=str[1:-1] c=str[:1] d=a+b+c print(d)
true
946c10c57f4b9f88fc25a11477e6c1670efd82dd
aallenchen2018/machinelearn201903
/逻辑回归/Logis.py
UTF-8
2,720
2.90625
3
[]
no_license
import pandas as pd import numpy as np from sklearn.metrics import log_loss import matplotlib.pyplot as plt import seaborn as sns dpath='/home/aallen/git/Logistic 回归——Otto商品分类' train=pd.read_csv('/home/aallen/git/Logistic 回归——Otto商品分类/Otto_train.csv',index_col=['id']) # print(train.head()) # print(train.shape) ...
true
3cd5c4386a800b9c4bdf294b31ec7db5aede013b
neticdk/ansible-auditlog-callback
/auditlog.py
UTF-8
11,590
3.09375
3
[ "BSD-3-Clause" ]
permissive
# This callback plugin will: # 1) create a logfile (/var/log/ansible/<uuid>.log) for the entire run # 2) log audit information to that file in JSON-format # # For available settings, see CallbackModule below import os import tempfile import errno import datetime import socket import json import uuid import re im...
true
f58ac5ba84ac84d6abc56af7953e80fa31a8e2bc
xuyao-lu/python
/eve.py
UTF-8
110
3.28125
3
[]
no_license
import math sum=0 x,y,z=input('please input the number x,y,z') sum=x+y+z aver=sum/3.0 print(‘aver=’,aver)
true
3063a502ad2db810715039de77a1c8ce69f6b544
KisaraBlue/ManaClash
/code/controller.py
UTF-8
13,111
2.921875
3
[]
no_license
import random from manaclash import db # db.drop_all() # db.create_all() from manaclash import User, Game, Board from manaclash import Monster, MonsterEffect from manaclash import BoardMonster from manaclash import Type from manaclash.models import State import sys def query_yes_no(question, default="yes"): ""...
true
f978085d11409deb9d87f81e5b5ffe336bbe0c5a
Jhynn/programming-concepts-and-logic
/solutions/3rd-loops/l3_a9.py
UTF-8
384
3.5
4
[ "CC-BY-4.0" ]
permissive
number_of_hamsters = int(input('Type the number of hamsters, to stop type ' 'a non-natural number: ')) while number_of_hamsters: cost = (number_of_hamsters * 0.8) / 2 + 10 print(f'The cost is U${cost}') number_of_hamsters = int(input('Type the number of hamsters, to stop ty...
true
9a48077f0f5641b56d77215e90291bda8e4ba0dc
Maruf-S/Competitve-programing
/1905-count-sub-islands/1905-count-sub-islands.py
UTF-8
861
2.921875
3
[]
no_license
class Solution: def countSubIslands(self, grid1: List[List[int]], grid2: List[List[int]]) -> int: rows,cols = len(grid2),len(grid2[0]) visit = set() islands = 0 def dfs(r,c): if r < 0 or r >= rows or c < 0 or c >= cols or (r,c) in visit or grid2[r][c] != 1: ...
true
f80f7d83ea3b8bbab13a223f7b885811f7c83fb7
giuscri/problem-solving-workout
/google_code_jam/alien_language/alien_language.py
UTF-8
1,282
3.3125
3
[]
no_license
# Very bad code. I was rusty!! import re def to_regex(in_str): def fn(x): if not re.match('\(.*?\)$', x): return x i = 1 ret = '' while x[i] != ')': ret += x[i] + '|' i += 1 return '({})'.format(ret[:-1]) i = j = 0 chunks = [] delim = '...
true
a5f0c1247b3e448b010e1acc731accf497cfaed0
BhatnagarKshitij/Algorithms
/Array/validSudoko.py
UTF-8
1,288
3.265625
3
[]
no_license
class Solution: def isValidSudoku(self, board): rows=[{} for i in range(9)] columns=[{} for i in range(9)] boxes=[{} for i in range(9)] breakSolution=False for i in range(9): for j in range(9): num=board[i][j] if ...
true
d6e81b95bcf8d50fc646acd855a2630030def192
natandias/Python_CursoEmVideo
/051_PA.py
UTF-8
181
3.578125
4
[]
no_license
num = int(input("Digite um numero: ")) razao = int(input("Digite a razão da PA: ")) print (num, end = ' ') for i in range (1, 10): print (num+razao, end=' ') num += razao
true
8ad91af73714ab3583a48cdc6b2c2b9478acd395
kebding/crypto
/elliptic_curve.py
UTF-8
7,260
3.984375
4
[]
no_license
''' elliptic_curve.py This program defines a library for elliptic curve operations. ''' from math import sqrt import bigfloat def extended_gcd(a, b): ''' extended_gcd This function returns the greatest common divisor of its inputs using the extended Euclidean algorithm. It returns the gcd and the Bezout...
true
7dcbf816d9f11133eea5116242779500f48679a3
majurski/Softuni_Fundamentals
/Mid-Exam/1-task.py
UTF-8
439
3.734375
4
[]
no_license
employees_per_hour_1 = int(input()) employees_per_hour_2 = int(input()) employees_per_hour_3 = int(input()) number_of_students = int(input()) all_students_per_hour = employees_per_hour_1 + employees_per_hour_2 + employees_per_hour_3 count_hour = 0 while number_of_students > 0: number_of_students -= all_students_p...
true
e6d5f910a5646b94351a2f08136dadd48b8d1d6c
buddhisant/FCOS_with_cuda
/transform.py
UTF-8
4,479
2.84375
3
[]
no_license
import cv2 import random import config as cfg import numpy as np import torch class Compose(): def __init__(self, transforms): self.transforms = transforms def __call__(self, image, bboxs=None, labels=None): for t in self.transforms: image, bboxs, labels = t(image, bboxs, labels) ...
true
fb83dd788bf6347e2ddde314383247ef20c237fa
denisristic/python101
/002-if-else-statement.py
UTF-8
296
4.0625
4
[ "Apache-2.0" ]
permissive
# 002-if-else-statement.py def statement(state): if state: print("If statement was true!") else: print("If statement was false!") if __name__ == '__main__': statement(True) statement(False) statement(None) statement(0) statement(1) statement('a')
true
b6b4a14f84bfeb29208c4eccfa12e7045875b42e
Dumbaz/TibiaPythonVIP
/tests/test_character.py
UTF-8
962
3.109375
3
[]
no_license
import unittest from character import Character class CharacterTest(unittest.TestCase): """General Character Test""" def test_creation(self): Satai = Character('Satai', 'Master Sorcerer', '95', 'Rowana', 'Jul 10 2015, 13:05:56 CEST', 'Premium Account') self.assertEqual(Satai.name[0], "Satai") self.assertEqual(...
true
5c5fcadd2a7d9d3bd1465858b8fe75af08b94809
behappyny/python_study
/python/20180412 challenges/dict_key_check.py
UTF-8
183
3.140625
3
[]
no_license
hash_list = dict(age=36, name='John') if 'name' in hash_list: print('name이 있습니다') if 'aaa' not in hash_list: print('aaa라는 키는 존재하지 않습니다')
true
9339f056cc655ac662b0c69f48d8d3a834242a4e
Devansh-Anhal/CIIE-Website
/accounts/models.py
UTF-8
2,042
2.515625
3
[]
no_license
from django.db import models from django.contrib.auth.models import( BaseUserManager, AbstractBaseUser ) from django.core.validators import RegexValidator import hashlib NAME_REGEX = '^[a-zA-Z]+$' # Create your models here. class UserManager(BaseUserManager): def create_user(self,username, email, password = Non...
true
1aaa9063edec2b3baf9133a2de3a2622759e3cc7
Venergon/OneNight
/tests/CardBaseTestDir/TroublemakerTests.py
UTF-8
404
2.625
3
[]
no_license
import tests.CardTestDefault as CardTestDefault from CardBase import * class TroublemakerTests(CardTestDefault.CardTestDefault): def get_role(self): return Troublemaker def test_two_targets(self): expected_order = ["player2", "player1", "self", "left", "centre", "right", "wolf"] s...
true
c66a459ea89bbe189473c8a608d3cacd0c50afa8
hupili/hk_census_explorer_2011
/scripts/geo_naming.py
UTF-8
4,290
2.625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# -*- coding: utf-8 -*- # This script standardize geo naming issues resulted from multiple sources. # * districts and regions do not have code # * map from area to district and to region # * translation from region/ district/ area codes to natural language # # Functions: # * provide standard names for Pyth...
true
4f16d7b3c1a20e64e6a251a86bb43b2888d70341
HermannKroll/AspectDrivenNewsStructuring
/src/nnsummary/wikipedia/category_tree.py
UTF-8
5,671
2.921875
3
[ "MIT" ]
permissive
import json from tqdm import tqdm from nnsummary.config import FILE_WIKIPEDIA_CATEGORIES def clean_category_name(category_name): cat_name = category_name.lower() cat_name = cat_name.replace(' naar nationaliteit', '') cat_name = cat_name.replace(' naar beroep', '') return cat_name.strip() class Cat...
true
851fd97232302f2ea353eab9c72753147b54f39d
bulmasen/learn-to-program
/GB_LearnProgramming/Python_Programming/lesson-04/homeWork-lesson04_1.py
UTF-8
1,274
3.8125
4
[]
no_license
# This Python file uses the following encoding: utf-8 # Реализовать скрипт, в котором должна быть предусмотрена функция расчета # заработной платы сотрудника. В расчете необходимо использовать формулу: # (выработка в часах * ставка в час) + премия. Для выполнения расчета для # конкретных значений необходимо запускать с...
true
2aaf0ab85d2da1523be05a361b8c8c9712cd138c
meltmedia/the-ark
/the_ark/field_handlers.py
UTF-8
16,368
2.796875
3
[ "Apache-2.0" ]
permissive
import selenium_helpers import traceback FIELD_IDENTIFIER = "type" STRING_FIELD = "string" PHONE_FIELD = "phone" ZIP_CODE_FIELD = "zip_code" DATE_FIELD = "date" INTEGER_FIELD = "integer" EMAIL_FIELD = "email" DROP_DOWN_FIELD = "drop_down" CHECK_BOX_FIELD = "check_box" RADIO_FIELD = "radio" SELECT_FIELD = "select" BUTT...
true
b720120758d3c37f665710dde866b63d009038f6
hegde421201/python_programming
/arrays/LCS128.py
UTF-8
1,176
4.125
4
[]
no_license
''' https://leetcode.com/problems/longest-consecutive-sequence/ LEETCODE 128. Longest Consecutive Sequence Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. You must write an algorithm that runs in O(n) time. Example 1: Input: nums = [100,4,200,1,3,2] Outp...
true
fe6def48f83fe2ac7fbd357cea03154f6b00d40e
ypandya614929/COMP-6411-Assignment-1
/client.py
UTF-8
16,752
3.671875
4
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- # ----- Program Details ----- # Age is always integer and phone number is in XXX XXX-XXXX format is accepted. # Further options are given when entering wrong data/info to help the client user. # The socket module is a framework for creating network servers. # It defines class...
true
a7c5bea73b8dbf509bdb20525ec7f146971cf8e0
LuanGermano/Mundo-2-Curso-em-Video-Python
/exercicios2/ex063p.py
UTF-8
363
3.96875
4
[ "MIT" ]
permissive
print('-' * 30) print('Sequencia de Fibonacci') print('-' * 30) n = int(input('Quantos termos voce quer mostrar? ')) t1 = 0 t2 = 1 print('-' * 30) cont = 3 while cont <= n: t3 = t1 +t2 print(f' - {t3}',end='') t1 = t2 # to transformando o termo 1 no termo 2 e embaixo tornando o 2 no 3 assim sempre avançand...
true
41c6ba77c814ed22c6826c602ba254e72101237a
DpEpsilon/spybee
/template/node.py
UTF-8
2,193
3.46875
3
[ "Apache-2.0" ]
permissive
import cgi class Node(object): '''Base class for nodes''' def eval(self, context): raise NotImplemented('Base Node class does not implement eval') class GroupNode(Node): '''Node for grouping a sequence of other nodes''' def __init__(self): self.children = [] def add_child(self, child): self.children.appen...
true
653098f39a38dd2e02999c0d87277f05664f02f5
theGreenJedi/Path
/Python Books/Athena/training/demo/demo/traits_examples/traffic_light_1.py
UTF-8
991
3.875
4
[]
no_license
############################################################################# # ex_traffic_light_12.py # # 1. Default initialization # 2. Enumerated editor ############################################################################# # enthought imports from traits.api import HasTraits, Enum class TrafficLight(HasTr...
true
e20376372af1a4f9c4fd1724181c851f706de5de
sharmaji27/Leetcode-Problems
/1299. Replace Elements with Greatest Element on Right Side.py
UTF-8
508
3.796875
4
[]
no_license
''' Given an array arr, replace every element in that array with the greatest element among the elements to its right, and replace the last element with -1. After doing so, return the array. Example 1: Input: arr = [17,18,5,4,6,1] Output: [18,6,6,6,1,-1] Constraints: 1 <= arr.length <= 10^4 1 ...
true
ec159df4860da63cd5c64cf3c337f4e65fd0a546
rllola/dogecoin-extractor
/src/utils.py
UTF-8
2,220
2.75
3
[]
no_license
import hashlib import struct import time def wait_for(s, command_expected): waiting = True while waiting: #print("Waiting for {}".format(command_expected)) data = b'' empty_call = 0 while len(data) < 24: # we might not have 24 bytes... data_received = s.r...
true
989f5e8137eb44d63f4388f058f6c6badfbec2ed
redx14/ClassGradeCalc
/ClassGradeCalculator.py
UTF-8
1,873
4.09375
4
[]
no_license
#Andrey Ilkiv Assignment 5 Problem 2 Section 01 10/19/2020 #variable for average total avgtotal = 0 #asks user for number of students in the class students = int(input("How many students are in your class? ")) #checks to make sure user entered a valid input while students < 0 : print("Invalid # of stud...
true
e080206bb71594983118c18c2b96cba52b2ad43b
uched41/NE
/NE_Base_Tests/test1.py
UTF-8
3,399
2.546875
3
[]
no_license
import os import pygatt from binascii import hexlify import time # Definitions device_address = 'cc:0f:bd:d1:01:92' char_id = "f3641401-00b0-4240-ba50-05ca45bf8abc" DEFAULT_RESULT = 255 result = DEFAULT_RESULT # commands read_sensor_data_command = 0 erase_sensor_data_command = 1 read_sensor_data_desc_command = 2 ...
true
348fb7b0880217463b36de4678ecc8a2298e95ac
Kirk-V/TSO
/src/tso/observation/tests/test_observation_request.py
UTF-8
2,783
2.671875
3
[ "MIT", "CC-BY-3.0" ]
permissive
import pytest import astroplan from tso.observation import observation_request from astropy import units as u from astropy.coordinates import SkyCoord from astroplan import FixedTarget request_variables = { "observation_id": 69, "coordinates": SkyCoord(ra=10.625*u.degree, dec=41.2*u.degree, frame='icrs'), ...
true
49f0c3b5aba706eaf74322420d18f4384b9afb71
JWiryo/LearnAlgorithms
/DynamicProgramming/DP_LongestCommonSubsequence.py
UTF-8
1,942
4.09375
4
[]
no_license
class LongestCommonSubsequence: # Top Down Recursive with Memo Solution # Time Complexity: O(M*N) # Space Complexity: O(M*N) def memoRecursiveLongestCommonSubsequence(self, text1: str, text2: str) -> int: # Edge Case if len(text1) == 0 or len(text2) == 0: return 0 ...
true
c84eacd105b0f61d29d4ef7a98c4e2197db70f88
DelanoDuarte/pyflask-vueapp
/backend/resources/CarEvaluationResource.py
UTF-8
1,127
2.578125
3
[]
no_license
from flask_restful import Resource from flask import request from models.carevaluation import CarEvaluation from business.CarBusiness import CarBusiness from business.CarEvaluationBusiness import CarEvaluationBusiness class CarEvaluationResource(Resource): carBusiness = CarBusiness() carEvaluationBusiness =...
true
c771246a9118e4d40983fca5e4c050895887f057
JideUt/LearnPythonTheHardWay
/exer23.py
UTF-8
850
3.03125
3
[]
no_license
# Exercise 23 # LPTHW # Reading Some Code # Page 82 (PDF Page 99) # This lesson focuses on reading code so I can learn: # How to find Python Source Code for things I need # Reading through the code and looking for files # Trying to understand the code I find # go on github and type python # try and und...
true
cfb02984d1fa06ac71e2fb053307b3fc36205384
breecummins/Mosquitoes
/Mosquitoes/unittests_interpFunctions.py
UTF-8
5,193
2.875
3
[]
no_license
import numericalSims as nS import interpFunctions as iF import numpy as np def testaccuracy(xy): mysim = nS.numericalSims() # bilinear/linear/affine functions should be recovered exactly randVel1 = 0.03*mysim.xg + 0.1 randVel2 = -0.02*mysim.yg CO2 = mysim.xg + 2.5*mysim.yg # exact values at (x...
true
df176f67ac4c92e88626cba88330611226c399bb
sanmanivannan/Python-Practice
/PythonBasicsSessions/cudenumber_function.py
UTF-8
396
4.3125
4
[]
no_license
'''function that takes a positive integer and returns the sum of the cube of all the positive integers smaller than the specified number. Ex.: 8 = 73+63+53+43+33+23+13 = 784''' def sum_of_cube(num): total=0 num = num - 1 while num>0: total = total+(num*num*num) num = num - 1 retur...
true
f094ab73e94dc1bc9802fa4905b68f8143a585b6
doflamingo0/Planning_Optimization
/gen.py
UTF-8
1,258
3.15625
3
[]
no_license
import random as rd def genData(fileName, N, M): with open(fileName, "w") as f: f.write(str(N) + " " + str(M) + "\n") x = [0 for i in range(N)] # x[i]: total of all items i # Generate matrix Q: Q(i,j) is number of item i on table j for i in range(N): s = "" ...
true
7281e6d11d89bd0f990e1d49822ed1005df2631c
hshrimp/letecode_for_me
/letecode/241-360/241-260/257.py
UTF-8
1,033
3.625
4
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ @author: wushaohong @time: 2020/8/4 下午3:17 """ """257. 二叉树的所有路径 给定一个二叉树,返回所有从根节点到叶子节点的路径。 说明: 叶子节点是指没有子节点的节点。 示例: 输入: 1 / \ 2 3 \ 5 输出: ["1->2->5", "1->3"] 解释: 所有根节点到叶子节点的路径为: 1->2->5, 1->3""" # Definition for a binary tree node. class TreeNode: def _...
true
728158811ea0272f1cb2f1819fbdf563b30af12a
chengupc/NMA_total
/step4.py
UTF-8
477
2.59375
3
[]
no_license
# 生成反式的索引 import numpy as np a = np.load('Params.npy') n = 0 indi = [] for i, x in enumerate(a): if (abs(x[16]) > 170) : indi.append(i) n += 1 print(n) np.save('indi.npy',indi) #进行数据清新,可以清洗所有的数据 import numpy as np from sys import argv script, old_data, new_data = argv ind = np.load('indi.npy') ...
true
cf56a49b556bfb1b7f6be036f77b9f5fe9b23529
tomasra/aicamp2017
/features.py
UTF-8
2,247
2.921875
3
[]
no_license
#!/usr/bin/env python from __future__ import division import re import codecs import time import nltk from sklearn.feature_extraction.text import TfidfVectorizer TOP_SENTENCES = 5 def article_words_count(article): ''' Nustatomas žodžių kiekis straipsnyje © Wirusiux ''' words = re.split("\s",arti...
true
f6c08ef5b2b242e8fc61338487c6798e91de5850
duceppemo/selective_primer_finder
/primer_finder_methods.py
UTF-8
27,193
2.515625
3
[ "MIT" ]
permissive
#!/usr/local/env python3 from glob import glob import subprocess from multiprocessing import cpu_count from psutil import virtual_memory import sys import gzip import os import pathlib from concurrent import futures from shutil import copyfileobj import pysam from collections import OrderedDict from Bio.Blast.Applicat...
true
6f58151cc6823d7331364506571d0692909d3880
bhupen13au/Basic_Programs
/Sorts/Selection_sort.py
UTF-8
378
3.546875
4
[]
no_license
def selection_sort(collection): for i in range(len(collection)-1): least = i for j in range(i+1,len(collection)): if collection[j] < collection[least]: least = j collection[i], collection[least] = collection[least], collection[i] return collection col = [22,9...
true
a918227cc44f1bad9a32cdf9b098d585d5a665c9
kiranscaria/msc_thesis
/src/nn_solution.py
UTF-8
5,615
2.84375
3
[]
no_license
import numpy as np from numpy.matrixlib.defmatrix import matrix from typing import Callable import matplotlib.pyplot as plt import sgd import util from mnist import MNIST class linear_layer(): def __init__(self, rows, cols, learning_rate): self.f_in = rows self.f_out = cols self.learning_ra...
true
0da4013c2ee1a78990c269fd9575962672d48116
setyo-dwi-pratama/python-basics
/12.oper_perbandingan.py
UTF-8
720
4.09375
4
[]
no_license
# OPERATOR PERBANDINGAN print("===============OPERATOR PERBANDINGAN===============") # Operator Perbandingan merupakan operator untuk membandingkan suatu nilai. hasil dari perbandingan nya hanya akan mengeluarkan boolean yaitu True dan False # Operator perbandingan ini biasa dipakai dalam proses pengambilan keputusa...
true
a96ec998b2034b8bb917eac345a940b8cef60138
OZ-T/Bilgisayar-Bilimi-Python-Dersleri
/Ders_04_kosullu_durumlar/ice_ice_kosul_01.py
UTF-8
176
3.546875
4
[]
no_license
deger = int(input("Lütfen 0….10 aralığında bir tam sayı giriniz: ")) if deger >= 0 and deger <= 10: # İkili koşul kontrolü print("aralıkta") print("tamamlandı")
true
f0d95c96c40cfed434bccaee021cc4d0a972cf85
cyberwitch/nospoilers-old
/tmdbutils.py
UTF-8
1,466
2.859375
3
[]
no_license
import tmdbsimple as tmdb class TMDBUtils(): def __init__(self, api_key): tmdb.API_KEY = api_key self.config = tmdb.Configuration().info() return def transform_result(self, result): image_url = None year = None if result['poster_path']: image_url =...
true
7631b0c36f0841bd0b99e213d063588b7b7e3a5b
mbhs/mbit
/archive/2019/solutions/NumberCookies.py
UTF-8
530
3.21875
3
[]
no_license
import itertools n = int(input()) x = input().split(" ") m = 0 for p in itertools.permutations(x): s = "".join(p) works = True for i in range(n-1): if(s[i] in ["+","*","-"] and s[i+1] in ["+","*","-"]): works = False for i in range(n-2): if(s[i] in ["+","*","-"...
true
6abc5c88b35c05748e98553ac9fc2cb840c4e2ae
rawsashimi1604/Qns_Leetcode
/leetcode_py/two-sum-ii.py
UTF-8
480
3.28125
3
[]
no_license
from typing import List class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: leftPtr = 0 rightPtr = len(numbers) - 1 while (leftPtr < rightPtr): if numbers[leftPtr] + numbers[rightPtr] == target: return [leftPtr + 1, rightPtr + 1] ...
true
dc796a631cc1604b6818de3b6015d3b118977084
glhlr/DaiMeng
/DaiMeng/program/business0530/phframe_ana03-18.py
UTF-8
76,143
2.609375
3
[]
no_license
# -*- coding:utf-8 -*- import xml.etree.cElementTree as ET from xml.etree.ElementTree import * import urllib import requests import time import json import business.trans_ltp as TL from business.trans_ltp import * from business.structure import * import business.hownet_get as hownet_get from business.hownet_get impo...
true
ff37eb307e910518e103a56cdf3418dc6c92a659
vibhuk16/6.00.1x
/Pset3/Problem1.py
UTF-8
641
4.25
4
[]
no_license
""" Implement the function isWordGuessed that takes in two parameters A string, secretWord, and a list of letters, lettersGuessed. This function returns a boolean - True if secretWord has been guessed and False otherwise. """ def isWordGuessed(secretWord, lettersGuessed): """ secretWord: String, the word t...
true
27f62c5cb228f1e1f02f7f292e934c3c184011cc
talkl/Gematch-ITC-HACKATHON-
/find_cycles.py
UTF-8
3,144
3.1875
3
[]
no_license
import pymysql class User: def __init__(self, user_id, wants, offers): self.id = user_id self.wants = wants self.offers = offers class Graph: def __init__(self): self.connections = [] def add_connection(self, from_id, to_id): self.connections.append((from_id, to...
true