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
57f600f47fa9a39db14f3d2e11372c2b961dac6d
feluxerich/FastVueAuth
/app/user/models.py
UTF-8
690
2.546875
3
[]
no_license
import uuid from datetime import datetime from sqlalchemy import Column, Integer, String, Boolean from sqlalchemy.types import DateTime from app.database import Base class User(Base): __tablename__ = "users" id = Column(Integer, primary_key=True, index=True) public_id = Column(String(36), unique=True) ...
true
c1a85c1735149618e45ce2f0073ef880ddb83cbb
DisappearedCat/Algorithms_bybook
/ShellSort.py
UTF-8
823
3.515625
4
[]
no_license
def sort(data): h = 1 while h < len(data) / 3: h = 3 * h + 1 while h >= 1: for i in range(h, len(data)): for j in range(i, h - 1, -h): if data[j] < data[j - h]: data[j], data[j - h] = data[j - h], data[j] else: ...
true
c35cac0d3b4fd1616c0e342352fcb78cbe12b240
Zhen-1225/PAPA
/0414(4).py
UTF-8
559
3.234375
3
[]
no_license
class Head: def __init__(self,size): self.size=size class Body: def __init__(self,volume): self.volume=volume class Hand: def __init__(self,lenth): self.lenth=lenth class leg: def __init__(self,width): self.width=width class Person: def __init__(self,head,body,rh,lh,...
true
2fc625b009c4971ad1530cebcf07dccda5c39d7b
liviaasantos/curso-em-video-python3
/mundo-1/ex025.py
UTF-8
215
3.375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Jun 3 20:06:53 2021 @author: Livia """ name = input('Qual seu nome completo? ') n = name.strip().upper().split(' ') print('Seu nome tem Silva? {}'.format('SILVA' in n))
true
8c5c1b0ed0007990fc2027e6e35ed5d59a10a761
bloomberg/phabricator-tools
/py/abd/abdt_rbranchnaming.py
UTF-8
6,869
2.90625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""Branch naming conventions for 'r/base/description' style.""" # ============================================================================= # CONTENTS # ----------------------------------------------------------------------------- # abdt_rbranchnaming # # Public Classes: # Naming # .make_tracker_branch_from_na...
true
84d537bf0276041161f82c4dbd986b114e4c902f
iangornall/week1
/string/caesar.py
UTF-8
407
3.796875
4
[]
no_license
encoded = raw_input("Encoded string: ") decoded = "" for char in encoded: ascii_code = ord(char) if (ascii_code > 64 and ascii_code < 78) or (ascii_code > 96 and ascii_code < 110): decoded += chr(ascii_code + 13) elif (ascii_code > 77 and ascii_code < 91) or (ascii_code > 109 and ascii_code < 123): ...
true
53451800a9a0aced6afe0d3420ce941f16f01c49
fishenm1/PFB_problemsets
/Python4/Q2.py
UTF-8
281
3.640625
4
[]
no_license
#!/usr/bin/env python3 taxa = 'sapiens, erectus, neanderthalensis' print(taxa) print(taxa[1]) print(type(taxa)) print (taxa.split(', ')) species = (taxa.split(', ')) print(species[1]) print(type(species)) species.sort() print(species) print(sorted(species, key=len))
true
9522a0c4abc64445d9a95a324893f48b76ca7ae3
yuewenz/Machine-Learning-Assignment-Summary
/Assignment3/nb.py
UTF-8
3,168
2.890625
3
[]
no_license
''' File: nb.py Project: Downloads File Created: March2021 Author: Yuzi Hu (yhu495@gatech.edu) ''' import numpy as np from sklearn.feature_extraction import text from sklearn.model_selection import train_test_split import pandas as pd RANDOM_SEED = 5 class NaiveBayes(object): def __init__(self): pass ...
true
8a53497d0132788f45e1a3f8a6997d8761eb0fb7
barbara-favadacosta/kanban_board
/kanban.py
UTF-8
9,774
2.609375
3
[]
no_license
from flask import Flask, render_template, request, redirect, url_for, flash, session from flask_sqlalchemy import SQLAlchemy from wtforms import Form, BooleanField, TextField, PasswordField, validators import os from werkzeug.security import generate_password_hash, check_password_hash import bcrypt from flask_login imp...
true
e60c99585d3949265b42236f3cc0b8a62441252b
mksy61/python
/learn/dd/pd3.py
UTF-8
478
3.03125
3
[ "CC0-1.0" ]
permissive
import pandas ulkeler = pandas.read_csv("pd_ulkeler.csv", squeeze=True) nufus = pandas.read_csv("pd_ulkenufus.csv", squeeze=True) print(len(ulkeler)) print(len(nufus)) print(sorted(ulkeler)) x = dict(zip(ulkeler, nufus)) print(ulkeler[4]) print(ulkeler[3:5]) print(nufus.count()) def d(x): if x < 40: ...
true
45ac944938bc4ef044cab098c83eecd760a6265a
mustangman578/MAPCP2019U
/homework/4/test_newton.py
UTF-8
968
3.421875
3
[]
no_license
def Newton(f, dfdx, x, eps=1E-7, maxit=100): if not callable(f): raise TypeError( 'f is %s, should be function or class with __call__' % type(f) ) if not callable(dfdx): raise TypeError( 'dfdx is %s, should be function or class with __call__' % type(dfdx) ) if not isinstance(maxit, int): raise TypeError( 'm...
true
804d929e289d5023b64f9b030264e0def8f7f905
vccabral/mosaic-generator
/mosaic.py
UTF-8
2,887
2.890625
3
[]
no_license
import os import random import itertools import numpy import argparse import shutil from PIL import Image, ImageOps from clint.textui import progress, colored def nearest_neighbour(color, color_data): color = color[:3] indexes = color_data.keys() other_colors = color_data.values() colors_array = num...
true
0f70bf29bc4e588d8bed1fc462bcbc083681b61c
ee359-data-mining-technique/Trading-strategy-based-on-reinforcement-learning
/ENV/StockEnv.py
UTF-8
4,861
3.375
3
[]
no_license
''' This file specify the stock price environment: reset(): start from a random training day step(action): given an action, return a corresponding reward return next_observation, reward, done ''' FEATURE_COLS = ["indicator1", "indicator2", "indicator3", "indicator4", "indicator5", "indic...
true
6b9b5d6c43f6518ac38c3679bd6632b72ee432cd
cstuartroe/thesis
/code/alignment.py
UTF-8
4,566
2.71875
3
[]
no_license
from collections import namedtuple from tqdm import tqdm from .general import * InflectionShapes = namedtuple('InflectionShapes', ['prefix', 'infix', 'alternation', 'suffix']) PAD_CHR = '$' def hamming_distance(s1, s2): assert(len(s1) == len(s2)) # lol code golfing it up return sum([c1 != c2 for c1, c2 ...
true
e92a0f6464b050f078da62f065b178926d148864
szho42/tensortrade
/tests/tensortrade/base/test_core.py
UTF-8
743
2.90625
3
[ "Apache-2.0" ]
permissive
from tensortrade.base.core import TimedIdentifiable class ExampleTimedIdentifiable(TimedIdentifiable): def __init__(self, msg): self.msg = msg class Environment(TimedIdentifiable): def __init__(self): pass def step(self): self.clock.increment() def test_basic_init(): e...
true
eca75ac7bf8dc751b456fb9dd7a46c6a23c32913
yaml2sbml-dev/yaml2sbml
/yaml2sbml/YamlModel.py
UTF-8
25,973
2.953125
3
[ "MIT" ]
permissive
"""A Model Editor for creating YAML models.""" import yaml import os.path import copy from typing import Union from pathlib import Path from .yaml2sbml import _parse_yaml_dict, _load_yaml_file from .yaml2PEtab import _yaml2petab from .yaml_validation import _validate_yaml_from_dict class YamlModel: """Functional...
true
958401af99eda039b8336a8d1335bf74d1f43530
DJacobo/InteractivePython
/IP_Ch3_22_OrderedList.py
UTF-8
4,058
3.671875
4
[]
no_license
class MyOrderedList(): def __init__(self): self.head = None self.count = 0 def add(self, item): newNode = myNode(item) if self.isEmpty() or self.head.getData() > item: newNode.setNext(self.head) self.head = newNode else: prev = self.he...
true
2552a2929dd83d167c77f0cbe5244aef6cd5bb9b
geradcoles/lib7shifts
/lib7shifts/daily_sales_labor.py
UTF-8
1,923
3.203125
3
[]
no_license
""" API methods to access the daily_sales_and_labour API endpoint. See the following for more details: https://developers.7shifts.com/reference/getdailysalesandlabor """ ENDPOINT = '/v2/reports/daily_sales_and_labor' def get_daily_sales_and_labor(client, **params): """Make an API call against the daily_sales_and...
true
d334c85ba35d061194790ff69e862df734668316
revythas/FastAPI_EuroConvension
/app/app.py
UTF-8
3,888
3.046875
3
[ "MIT" ]
permissive
import json import os import sys from datetime import date, datetime, timedelta from typing import Optional from pydantic import BaseModel import httpx import redis from dotenv import load_dotenv from fastapi import FastAPI load_dotenv() class Item(BaseModel): price: float currency: str date : Optional[st...
true
d734d3bdd45321c339154a9ac76d4467daff33ee
hjs90911/1804_Learning_MachineLearning
/Day_3/svc_test.py
UHC
1,607
3.0625
3
[]
no_license
# -*- coding: ms949 -*- from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split from sklearn.svm import SVC cancer = load_breast_cancer() X_train, X_test, y_train, y_test = train_test_split(cancer.data, cancer.target, random_state=0) svc = SVC() svc.fit(X_train, y...
true
6c23b3bb43a6834aa88e1f3b01ba3f72c874271d
ANKITPODDER2000/LinkedList
/31_linked_list_modulo.py
UTF-8
446
3.421875
3
[]
no_license
from LinkedList import LinkedList from LinkedListHelper import CreateLinkedList def get_ans(head , k): ans = None c = 1 while head: if c % k == 0: ans = head head = head.next c += 1 return ans.val def main(): l1 = LinkedList() CreateLinkedList(l1) k = int(...
true
591f2807fc29bea9423050cca3e8b9c8fe664df2
FrancescoBettazzi/BayesianNetwork
/beliefTable.py
UTF-8
46,407
3.125
3
[]
no_license
class BeliefTable(object): def __init__(self, variables, table): # variables = a list of strings (names of variables) # table = a list of list of float (representing a table) # conditioned = a boolean (for separate joint prob from conditioned prob) self.variables = variables ...
true
dc936cb01466ed3d7f2d460e8ae55f19e0a23cb8
razvanmarinescu/gcv_indiv_proj
/code/input_nets/convert_all_to_gw.py
UTF-8
603
2.703125
3
[]
no_license
#! /usr/bin/env python # usage: python convert_to_gw <folder> <start_year> <end_year> # converts all .undirected files from the specified folder to .gw years start_year to end_year import os import sys NET_PATH_TRADE_ALL=sys.argv[1] START_YEAR=int(sys.argv[2]) END_YEAR=int(sys.argv[3]) for net_nr in range(START_Y...
true
c5c711849bf6bca116f805bfce69d32d33a5194d
famaxth/Way-to-Coding
/MCA Exam Preparations/Python/LAB/decimal to binary.py
UTF-8
154
3.625
4
[]
no_license
number = int(input("Enter a decimal number : ")) binary = [] while number!=0: binary.append(number%2) number //=2 binary.reverse() print(binary)
true
3e98cc5233eefcc4b18df4aa336bf04145dca4e0
choyunseol/nyunnyu
/E-oN 7th hw/main.py
UTF-8
555
2.78125
3
[]
no_license
import BookSystem Run_system = BookSystem.System() Run_system.selection() out = input('프로그램을 종료하시겠습니까? 숫자를 입력하세요\n1. 예\n2. 아니요\n') while True : if out == '1' : Run_system.auto_save() break elif out == '2' : Run_system.selection() out = input('프로그램을 종료하시겠습니까? 숫자를 입력하세요\n1. 예\n2...
true
c4c34ef1721bbcb9a4932f12fe2b07aa3057409f
bjpaul/serverless-oauth
/common/crypto.py
UTF-8
627
2.546875
3
[]
no_license
import json import crypt from common.config import Config common = Config() key = common.encryption_salt def encrypt(data): if common.enable_jti_encryption: return crypt.crypt(json.dumps(data), key) else: return data def validate(data, encrypted_data): if common.enable_jti_encryption: ...
true
96015ff870753575a81c38295c1b92968686c314
Rossnhi/Python
/Coding Problems/valley.py
UTF-8
995
3.296875
3
[]
no_license
def insertion_sort_d(l): n=len(l) for sort_end in range(n): pos=sort_end while pos>0 and l[pos]>l[pos-1]: (l[pos],l[pos-1])=(l[pos-1],l[pos]) pos-=1 return(l) def strict_descending(l): n=len(l) if n==0 or n==1: return(5>6) x=l[0:n] insertion_sort_d(x) if l==x: return(5<6) else: ...
true
47c5809fa914cba87a7aadab92ffdfaa27dc142a
ShawK91/Naive_Bayes
/impl2_funcs.py
UTF-8
12,993
3.28125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Oct 16 16:57:11 2016 @author: Brandon """ import math import numpy as np from collections import Counter # Maybe we should get rid of "the" "a" "and" etc. removed from bag of words # This is a global variable used to map a bagofwords number to a word # see lo...
true
61e3734303c3e18e39cbff3b259ce74cf3f871b0
plainspooky/giovannireisnunes
/manipulando-xlsx-em-python/server.py
UTF-8
900
2.578125
3
[]
no_license
from datetime import datetime from random import randint from tempfile import NamedTemporaryFile from flask import Flask, Response from openpyxl import Workbook from openpyxl.utils.cell import get_column_letter RAND = (1, 1000) ROWS, COLS = 100, 100 DATE_FORMAT = "%Y%m%d_%H%M%S" HTTP_MIMETYPE_XLSX = ( "applicat...
true
e44c94fbd41ff2fb43c2c0eead4af72f2dd1be96
aseth99/Webscraper
/experimenting and learning basics of webscraping/lambda_expressions.py
UTF-8
533
3.328125
3
[]
no_license
# accessing attributes: v often we look not for tags but for attributes # <a href=...> <img src=...> href attribute contains url, src attribute contains target image # myTag.attrs, myImgTag.attrs['src'] python dictionary of objects # lambda expression: fxn taht is into another fxn as a var # f(x,y)-f(g(x),y) or f(g(...
true
d8fd2d0b492ec2299fae7bec3815a299e3d4fc03
bergpb/repositorio_aulas_tecnicas_programacao
/aula05/python_code/main.py
UTF-8
691
2.9375
3
[]
no_license
from pessoa import Pessoa from funcionario import Funcionario from supervisor import Supervisor from datetime import datetime as dt data_nascimento = dt.strptime('2000-01-01', '%Y-%m-%d') data_admissao =dt.strptime('2005-01-01', '%Y-%m-%d') funcionario = Funcionario('Josh', '793.253.125-92', data_nascimento, data_ad...
true
97cd594bb0140f34cad6d06df9366ec63ef77497
TakutoYoshikai/emotion-chip
/livedoor.py
UTF-8
658
2.59375
3
[]
no_license
import glob import os dataset_dir = "./datasets/livedoor/" dataset_files = list(map(lambda s:dataset_dir + s + "/*.txt", ["dokujo-tsushin","it-life-hack","kaden-channel","livedoor-homme", "movie-enter","peachy","smax","sports-watch","topic-news"])) def load_dataset(path): files = glob.glob(path) print(files...
true
88c888af18fe128cdbceecc070d46e950ef180f3
0NEPDEV/Hacktoberfest-2021
/Python/addnumber.py
UTF-8
27
2.65625
3
[]
no_license
a=3 b=5 add=a+b print(add)
true
df9a3cc4ea572c0924b2119f68c28a33c5d4af9f
LeoLeeYEAH/GitWarehouse
/Postgraduate/Python/HBGA-benchmark/DE.py
UTF-8
5,254
2.703125
3
[]
no_license
import numpy as np import ea_common import random import matplotlib.pyplot as plt import math # 创建DE类 class DE: # 构造方法 def __init__(self, size, dim, pos_max, pos_min, max_iter, func_no, F, CR): # 种群大小 self.size = size # 维度 self.dim = dim # 搜索域上限 self.pos_max = p...
true
512759ac61fd71508155d8dddb20888a469d8ed5
i008/dsr-pytorch
/generate-shapes/test_generate_shapes.py
UTF-8
3,247
2.828125
3
[]
no_license
import numpy as np from numpy.testing import assert_array_equal, assert_equal import pytest from generate_shapes import generate_shapes def test_generates_color_images_with_correct_shape(): images, _ = generate_shapes( number_of_images=100, width=128, height=128, max_shapes=1) assert len(images) == ...
true
fe8a6962c63d254ac8f6cb2b64751428ce65bba4
wangfin/QAsystem
/QAManagement/create_data.py
UTF-8
1,225
2.546875
3
[]
no_license
#from .withweb import Withweb import withweb withweb = withweb.Withweb() #myelas = elas.Elas() # withweb.webinsert('qa_sys','机器学习的概念?','机器学习的概念?','机器学习真的是很厉害的工具。','www.bca.com','机器学习',2) # withweb.webinsert('qa_sys','机器学习有什么价值?','机器学习有什么价值?','价值很高','www.bca.com','机器学习',3) # withweb.webinsert('qa_sys','华为云服务器能做什么?','华为...
true
1138cc75f0ef12f5a8448eb1d4349d6bf50eba03
layoaster/compython
/p4/pmc.py
UTF-8
2,304
2.953125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ $Id$ Description: Main del Analizador Sintáctico de Pascal-. $Author$ Lionel Aster Mena Garcia, Alejandro Samarin Perez, Sergio Armas Perez $Date$ $Revision$ """ import sys import argparse from error import * from parser import SynAn from html impo...
true
2be8001393fd2a0142fddb29c0fae3dee1a41cbf
LouisBox/Gym-data-cleaning
/Data cleaning/Training log/gym training cleaning.py
UTF-8
3,129
2.84375
3
[]
no_license
import pandas as pd import numpy as np import re import datetime import math import os from pandas import ExcelWriter def replace_kg(n): if pd.isna(n): return n elif "bw" in n.lower(): bw_indx = w.index[w["Weight"] == n].to_list()[0] date = w["Date"].iloc[bw_indx] ...
true
e93c1775c6f2b04d1d954df9148b8e94cc4909e9
dEbAR38/ITMO_ICT_WebDevelopment_2020-2021
/students/K33401/Klishin_Nikita/Lr_3/peer_review_system/accounts/forms.py
UTF-8
2,135
2.609375
3
[ "MIT" ]
permissive
from django import forms from django.contrib.auth.forms import UserCreationForm, UserChangeForm from .models import CustomUser from django.core.exceptions import ValidationError from django.contrib.auth.forms import ReadOnlyPasswordHashField class CustomUserCreationForm(forms.ModelForm): """ Переопределенная...
true
a6e1ba84d1b1cecb04531023fdf3cc6b26eb78b8
erkan-polat/python
/Python Class/w9_ex1.py
UTF-8
1,028
3.40625
3
[]
no_license
from tkinter import * def toplama(): a=e1.get() b=e2.get() c=float(a)+float(b) print(c) answer.configure(text = str(c)) def cikarma(): a=e1.get() b=e2.get() c=float(a)-float(b) print(c) answer.configure(text = str(c)) def carpma(): a=e1.get() b=e2.get() c=float(a)*fl...
true
fc54aef6d9811f78aed8dcf72f761d3d43363386
jitenadav/Smart-Expense-Manager
/arima_train.py
UTF-8
870
2.796875
3
[]
no_license
# save finalized model from pandas import read_csv from statsmodels.tsa.arima.model import ARIMA import numpy # create a differenced series def difference(dataset, interval=1): diff = list() for i in range(interval, len(dataset)): value = dataset[i] - dataset[i - interval] diff.append(value) return diff def tr...
true
8878b05e93824a28eddc4bc60ecd1ee2efb54fb2
paulo03/bitcoin_OFAC
/check_SDN_BTC_address_balance.py
UTF-8
953
2.71875
3
[]
no_license
import SDN_List_Scrape_Crypto_Address ''' Once this .py file is imported, its code is executed, and it's the source of our imported data read into variable 'df' ''' import pandas as pd import datetime import requests from bitcoin_explorer import Address date = str(datetime.date.today()) csv = 'OFAC_CRYPTO_ADDRESS_CHE...
true
f7d0fe49c36a11760b2dad7a7a2b2606a9c7a07f
lamida/kattis
/python/plan.py
UTF-8
205
3.0625
3
[]
no_license
import sys inn = sys.stdin for line in inn: n = int(line.strip()) last = 2 current = 0 for i in range(n): current = last + (last-1) last = current print(current**2)
true
0a0e07860e314a78795ea062230cf9576b80b639
haksung/project-euler
/3.py
UTF-8
136
3.0625
3
[]
no_license
num = 600851475143 prime = 3 n = num while prime < n: if n % prime == 0: n = n/prime else: prime += 2 print n
true
600702b155fe7b472a7ab1b03c356ab77fdcec81
danmar3/twodlearn
/twodlearn/core/exceptions.py
UTF-8
2,691
2.90625
3
[ "Apache-2.0" ]
permissive
'''Definition of tdl specific errors and exceptions ''' import inspect class PropertyRedefinition(Exception): # Constructor or Initializer def __init__(self, property, object): self.property = property self.object = object def __str__(self): return ('The property {} in object {} ...
true
4835dc6cccefc33d182244cd0b0a183d8f8d51ca
jedrzejkozal/AdventOfCode
/2017/day12/GraphTraversing_test.py
UTF-8
1,436
2.734375
3
[]
no_license
import pytest from GraphTestBase import * class TestGraphTraversing(GraphTestBase): def test_traverse_one_node_graph_all_nodes_are_visited(self, one_node_graph): self.parse_graph(one_node_graph) startingNode = 0 visited_nodes = self.sut.traverseAll(startingNode) assert set(visit...
true
9e66c588f47240b4cdf9039bdb9b5a26e2b92828
HappyBat1189/HappyBat.tkBot
/happybat bot/cogs/say.py
UTF-8
456
2.59375
3
[ "Apache-2.0" ]
permissive
import discord from discord.ext import commands class Say(commands.Cog): def __init__(self, client): self.client = client @commands.Cog.listener() async def on_ready(self): print('Commands loaded') print('Ready to use!') print('Enjoy! Made by HappyBat.') ...
true
124476c25a8c13b514258a5a888c094293cb5064
arinamark/python-project-lvl1
/brain_games/engine.py
UTF-8
804
3.546875
4
[]
no_license
#!env python from brain_games.cli import welcome_user import prompt LAST_STEP = 3 def game(rule, game_function): name = welcome_user() print(rule) step = 1 while step <= LAST_STEP: right, expression = game_function() print('Question: {}'.format(expression)) answer = prompt.st...
true
65a656c81c91b00a5d07e4f52c4c2114029343e3
gcrabrahao/hello
/name/models.py
UTF-8
528
2.671875
3
[]
no_license
from sqlalchemy import Column, Integer, String from database import Base class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) userid = Column(String(5), unique=True) extension = Column(String(4), unique=True) name = Column(String(100), unique=False) def __...
true
07cf9eee2bc62c74197bdec69a61aec3df74c124
AlexandrSech/Z49-TMS
/students/Eliseev/TMS/HomeWork-1/Task-1.py
UTF-8
38
2.875
3
[]
no_license
a = 2 b = 2 print(a + b, b - a, a * b)
true
36fc09813e9b5ba93bb42c01045eb25b837f9af1
MengLingXiao1/CrackImageCode
/verify3.py
UTF-8
340
2.78125
3
[]
no_license
import tesserocr from PIL import Image img = Image.open('code.jpg') print (img.format, img.size, img.mode) img = img.convert('L') table=[] print (img) print (img.format, img.size, img.mode) for i in range(0, img.size[0]): for j in range(0, img.size[1]): table.append(img.getpixel((i, j))) print (img...
true
eca4b5d12930927b87d320f2222654998159b5bd
Trixter9994/lazero
/bootstrap/legacy/container_1/random/compare_loader.py
UTF-8
1,758
2.578125
3
[ "MIT" ]
permissive
import re # /sys/fs/cgroup to find it. def readFile(a): with open(a,"r") as f: return f.read() def splitlines(a): return a.split("\n") def verifier(a,b): for c in b: if c in a: return a return def checker(a,b): return list(filter(lambda x: x!=None,[verifier(c,b) for c ...
true
098697d716fc04edabcd24525c96acadfe556e2f
VaishnavJois/python_ws
/day3/fancy_number.py
UTF-8
485
3.78125
4
[]
no_license
def sum_digits(num): if num < 10: return num s = 0 while num != 0: s += num % 10 num //= 10 return s def get_digits(temp): a,temp = temp//1000 , temp%1000 b,temp = temp//100 , temp%100 c,temp = temp//10 , temp%10 d,temp = temp//1 , temp%1 re...
true
ea94b2a77f3b837094febb33982d4e8f7dac245c
Exper1mental/OpenBCI_DataHandling
/DataRecording.py
UTF-8
4,250
3.0625
3
[]
no_license
#FOR REFERENCE: https://www.youtube.com/watch?v=iaQirRf2V7E&feature=youtu.be import tkinter as tk from PIL import Image, ImageTk import random import glob #Imported from DataRecording import time import datetime as dt import os # Directory where the photos for the slideshow are located # Photos are shown in alphabe...
true
d813f854ac25abbac393af46244898988a771246
NISH1001/humT
/recorder.py
UTF-8
1,375
2.96875
3
[]
no_license
#!/usr/bin/env python3 import pyaudio import wave class Recorder: def __init__(self, fmt=pyaudio.paInt16, channels=2, rate=44100, chunk=1024, ): self.audio = pyaudio.PyAudio() self.fmt = fmt self.channels = channels self.rate = rate self.chunk = chun...
true
0c40f14af82893bc8ccce60259424a98aaf28574
Wintus/MyPythonCodes
/PrimeChecker.py
UTF-8
608
3.890625
4
[]
no_license
'''Prime Checker''' def is_prime(n): '''check if interger n is a prime''' n = abs(int(n)) # n is a pesitive integer if n < 2: return False elif n == 2: return True # all even ns aren't primes elif not n & 1: # bit and return False else: # for all odd ns ...
true
e61a610ab92890e68ee79486ac1e860c749a3eaf
deekshaaneja/educate_problems
/queue/circular_queue_2.py
UTF-8
716
3.484375
3
[]
no_license
class Node: value = None nextNode = None def __init__(self, value): self.value = value class CircularList: head = None tail = None def __init__(self): pass def enqueue(self, elem): node = Node(elem) if self.head is None and self.tail is None: ...
true
a15513a4e318dd2affd50b70d06955f76c5c96b8
DJHyun/Algorithm
/와우패스 삼성 역량테스트/PART03/8절_스도쿠.py
UTF-8
1,437
3.3125
3
[]
no_license
''' 4 5 2 6 1 8 3 7 9 3 7 1 4 2 9 8 6 5 9 8 1 5 7 3 2 4 1 7 3 4 1 6 2 5 6 8 6 2 9 8 4 5 7 1 3 8 1 5 3 9 8 6 2 4 2 9 3 7 5 4 1 8 6 1 4 8 4 3 6 9 5 7 5 6 7 9 8 1 4 3 2 ''' arr = [list(map(int, input().split())) for _ in range(9)] for i in arr: print(i) check = [[0] * 9 for _ in range(9)] numbers = [] for i in range(...
true
3ae14a53be3de552c775f89e9271f5720a9c95e9
xiaochideid/yuke
/7-12/1.集合及运算.py
UTF-8
3,143
4.3125
4
[]
no_license
# 重点内容: # 1.去重功能(元素不可重复) # 2.交集:intersection(&) 差集:difference(-) 并集:Union(|) 子集:issubset() 父集:issuperset() 交集:isdisjoint() # 3.常用函数:add()、remove()、discard()、pop()、updata()、clear() # 集合是一个无序的,元素不可重复的数据组合 它的标识符号{} # 它有两个作用: # 1.去重:把一个容器变成集合,可以实现去重的功能。 # 2.关系测试:测试两组数据之间的交集 差集 并集等等。 # .....................去重...............
true
e4bdcf89409b0ac716a2449739592e800f493221
sw554227643/Python-Text
/利用函数实现字符在字符串中出现的次数
UTF-8
379
4.1875
4
[]
no_license
#!/usr/bin/env python # -*- coding:utf-8 -*- #求 字符在字符串中出现的次数 a = input('请输入一个字符串: ') b = input('请输入一个字串:') def ch(Str,Wor): j=0 #初始数据类型为整形 i='' #初始数据类型为字符型 for i in Str: if i == Wor: j += 1 print(i, '出现了{}次'.format(j)) ch(a,b)
true
7caa1c3e8c27f24ebda9d4de3eea072e98b90c2e
annapragadas/moseq2-ephys-sync
/build/lib/moseq2_ephys_sync/video.py
UTF-8
3,759
2.53125
3
[]
no_license
''' Tools for extracting info, timestamps, and frames from mkv files ''' import os import subprocess import numpy as np def get_mkv_info(fileloc, stream=1): stream_features = ["width", "height", "r_frame_rate", "pix_fmt"] outs = {} for _feature in stream_features: command = [ "ffprobe...
true
7f354925f84572bd33c1fd213a5a10082c06412f
1ingzero/GBDT
/GBDT_tune1.py
UTF-8
1,632
2.703125
3
[]
no_license
#导入必要的库 import pandas as pd from sklearn.ensemble import GradientBoostingClassifier from sklearn.grid_search import GridSearchCV print ("**********************************TUNE1*******************************") #定义输出寻优结果函数 def print_best_score(gsearch, param_test): # 输出best score print("grid_scores:",gsearch.g...
true
4803f4506f8b989d1151cae95214df236218c52c
creturn/workSnippet-python
/http_sniff/core/HttpUtil.py
UTF-8
1,848
2.5625
3
[]
no_license
#!/usr/bin/env python #coding: utf-8 import cookielib import urllib2,urllib import os import gzip,StringIO """ HttpUtil是http的工具类,此类会缓存cookie,并且支持gzip页面 Blog: www.creturn Autor: Return """ class HttpUtil(): # http head信息 head = {} # cookie cookie = None # cookie存储路径 cookieFile = '' # connect opener...
true
58dac637644eadd90e5d4e1ba4ac09001882a746
nkmk/python-snippets
/notebook/scipy_shortest_path.py
UTF-8
4,271
3.15625
3
[ "MIT" ]
permissive
import numpy as np from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson from scipy.sparse import csr_matrix l = [[0, 1, 2, 0], [0, 0, 0, 1], [3, 0, 0, 3], [0, 0, 0, 0]] # print(shortest_path(l)) # AttributeError: 'list' object has no attribute 'shape' a = np....
true
8db2c027ddd4edd88ce90b9dd979b5df507b4d73
jlmaynard/theRegs
/theRegs.py
UTF-8
5,147
3.3125
3
[]
no_license
# fileName: otheRegs.py # Demonstrates regular expressions to locate and change key input parameter. # This is an example of a script that pulls data, does work, then writes data. # # J. Maynard 01/26/17 # Input: "iniFile.ini", "logFile.log" # Output: Will update a scale parameter in the "iniFile.ini" file. ...
true
ee7413c5686d9d3530583642ad8cd24dec09dc46
MkhitarOn/POM_Automation
/Test/test_women_data.py
UTF-8
1,094
3.03125
3
[]
no_license
from Lib import LIB from POM.Home import Home from pathlib import Path ''' 1. Go to URL 2. Click to Woment tab 3. Open file with 'log' name 4. Write there all found products name with their prices 5. Close browser ''' def test_3(): try: #open browser obj_lib = LIB() brows...
true
790cdb9f4327c1f7014d6f4db68a2ac78a846382
vixadd/sparseml
/src/sparseml/sparsification/recipe_editor.py
UTF-8
2,195
2.515625
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved. # # 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 b...
true
eb7c0de739ce1fa9bf4f9a4e6b14ef3b48f585a4
stanfeldman/samples
/python/mong.py
UTF-8
499
2.65625
3
[]
no_license
from pymongo import Connection import time connection = Connection() db = connection.test collection = db.test_collection time1 = time.time() for i in range(0,1): doc = { "name": "person %s" % i, "age": i, "tags": ["python", "js"] } collection.insert(doc) time2 = time.time() print "save time: %s" % (time2-tim...
true
d4c70670162f51f5d6fd77d5e451eed9618426b1
ministryofjustice/operations-engineering
/python/services/auth0_service.py
UTF-8
7,411
2.90625
3
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
import time from datetime import datetime, timedelta import requests from python.config.logging_config import logging from python.config.constants import ( RESPONSE_OKAY, RESPONSE_NO_CONTENT ) class Auth0Service: def __init__(self, client_secret: str, client_id: str, domain: str, grant_type: str = 'clien...
true
06dce047e8ec533db7972613ae7040769f58e5b0
leo-the-cat/ManUtd_2021
/module_0/pr_start.py
UTF-8
550
4.28125
4
[]
no_license
# This programm guesses number in the range from 1 to 1000 and returns total amount of attempts. import random left=1 right=1000 number = random.randint(left,right) print ("Загадано число от 1 до 1000") predict = random.randint(left,right) count = 1 while number != predict: a = (left + right) // 2 count+=1 ...
true
ce4661f419a581d2432f4b3723432702d0020439
AllanPatrickS/LinearCongruentialMethod
/pseudo-graph.py
UTF-8
1,285
3.625
4
[]
no_license
import random import math from matplotlib import pyplot as plt def rand(n): pseudo = [] for i in range(1, n+1): x = random.random() pseudo.append(x) return pseudo def mcl(a, c, m, x0, n): pseudo = [] if n < 1: return pseudo x1 = (a*x0 + c) % m x1 = x1 / m pseud...
true
0f278142b14a251079ddf5e2f9691dbc18304aed
KazutoshiShinoda/Zeroshot-QuestionGeneration
/models/triples2seq.py
UTF-8
24,265
2.828125
3
[ "MIT" ]
permissive
from __future__ import print_function import time import math import pickle import tensorflow as tf from tensorflow.python.layers.core import Dense class Triple2SeqModel(): """ This Model Triple to sequence model: Generating Factoid Questions With Recurrent Neural Networks: The 30M Factoid Question-Answ...
true
5021cac58bb0d39213d15ada665e2f956c222d53
LealPFernando/CompiladoresProy
/Semantic_Cube.py
UTF-8
2,216
2.609375
3
[]
no_license
from collections import defaultdict cubo_semantico = defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: defaultdict(lambda: None)))) #ASSIGN cubo_semantico['int']['int']['<'] = "int" cubo_semantico['float']['float']['<'] = "float" cubo_semantico['char']['char']['<'] = "char" #GT cubo_semantico['int']['int']...
true
1e438ee54ea586ee9ee83e7f6468d99d7615e1b0
lokesh1729/inmemory_database_design
/column.py
UTF-8
2,118
3.578125
4
[]
no_license
""" Class Column: Name Id Required - bool Class Value: Schema -> Column object Value -> actual value Class IntColumn(Column): Min_va_allowed - -1024 Max_val_allowed - 1024 __init__ Add the constraints related checks Class StrColumn(Column): - max_len = 20 __init__ Add the constraints related checks Class DateTim...
true
d2580dca4eb7005238b906200edfffdbbc22f83c
physoce/physoce-py
/physoce/oceans.py
UTF-8
4,212
2.875
3
[ "CC-BY-4.0" ]
permissive
import numpy as np def wavedisp(wavper,h): """ (omega,k,Cph,Cg) = wavedisp(wavper,h) ------------------ Returns [omega,k,Cph,Cg] Inputs (can use arrays): wavper - wave period [s] h - water depth [m] Outputs: omega - angular wave frequency [radians/s] k - angular wave number [radians/m] Cph ...
true
1697bdfe95428209f28a3bd59aaa334a2125064d
Neerav2008/Project-98
/swappingFiles.py
UTF-8
919
3.453125
3
[]
no_license
import os # opening file 2 and extra file with open('s2.txt','r') as secondfile, open('s.txt','a') as file: # read content from second file for line in secondfile: # copying to extra file file.write(line) #removing contents of file 2 file = open("s...
true
375691dea2b145a0a74193176c0f775d50b10183
AdamZhouSE/pythonHomework
/Code/CodeRecords/2923/59137/309531.py
UTF-8
347
2.9375
3
[]
no_license
s = input() if s == "3 3": print(25) elif s == "16 13": print(2838) elif s == "45 79": print(867265) elif s == "31 48": print(17471) elif s == "17 23": print(71982) elif s == "34 21": print(9382) elif s == "22 92": print(420847) elif s == "22 7": print(2202) elif s == "55 10": print(...
true
0e71d5219661386169e44660bb7f9c8b2a4237ce
isouzasoares/work-at-olist
/phonecalls/phone/tests/test_models.py
UTF-8
2,685
2.5625
3
[]
no_license
from decimal import Decimal from dateutil.relativedelta import relativedelta from django.test import TestCase from django.db import IntegrityError from django.utils import timezone from phone.models import Phone, Call, CallDetail from phone.choices import START, END from bill.utils import bill_create, get_month_year ...
true
b532cd7ea7c9b3ac616df8f64988d216735a9e29
OscartGiles/Hitting-the-target
/Plotting/FIGURE_4_correlation.py
UTF-8
4,892
2.875
3
[]
no_license
""" @author: Oscar T Giles @Email: o.t.giles@leeds.ac.uk Plots for the correlation analysis Notes: The easiest way to run is to download the anaconda python distribution (https://www.anaconda.com/) which will install all the packages you need (except pymc2) """ from __future__ import division, print_function, unicod...
true
7f2fb8c96968c4e1a3255993599ddda72ec43d10
Aasthaengg/IBMdataset
/Python_codes/p02647/s889194333.py
UTF-8
421
2.609375
3
[]
no_license
import sys,math,collections,itertools input = sys.stdin.readline N,K=list(map(int,input().split())) A = list(map(int,input().split())) for i in range(K): imo = [0]*(N+1) flag = 1 for j in range(N): imo[max(0,j-A[j])] += 1 imo[min(N,j+A[j]+1)] -= 1 if j-A[j]>0 or j+A[j]+1<N: ...
true
52c86716c0770f4f3ac33c78ec4c560d95f58295
4RG0S/2021-Spring-Jookgorithm
/박준서/[21.04.07]17219.py
UTF-8
209
2.953125
3
[]
no_license
import sys read = sys.stdin.readline memo = {} n, m = map(int, read().split()) for _ in range(n): site, pw = read().rstrip().split() memo[site] = pw for _ in range(m): print(memo[read().rstrip()])
true
0ca52d623268f8aee3829410a4c4c416e1e64725
loganknecht/CrackingTheCodingInterviewExercises
/Miscellaneous/Python/breadth_first_search.py
UTF-8
938
3.578125
4
[]
no_license
# Python Standard Libraries # N/A # Third-Party Libraries # N/A # Custom Libraries import trees def breadth_first_search(node_queue): """Sometimes this is called 'level-order' searching Arguments: node_queue (List of Node): a FIFO style array """ can_current_node_be_processed = (len(node_que...
true
7ac19b811a7e6cbb41b1345b8b47155f9e2b19a0
g-lyc/PRACTICE
/python-GUI/pgku.py
UTF-8
471
3
3
[]
no_license
#coding:utf-8 #import Tkinter #top = Tkinter.Tk() #top.mainloop() #pack简单 grid复杂界面 from Tkinter import * root = Tk() root.geometry('500x200') #位置 li = ['python','java','php'] lid = ['缩微','小王子'] listb = Listbox(root)#创建两个列表组件 listb2 = Listbox(root) #插入数据 for item in li: listb.insert(0,item) for item in...
true
f15a19861d246ca5943397294e7f06805b48c26f
sawoo1111/work
/Demo.py
UTF-8
131
3.296875
3
[]
no_license
class Demo: def bar(self, x): return 2 * x def main(): foo = Demo() print(foo.bar(32)) main()
true
bf7f7d2fe625305058585b512b23eade6d4f2894
rodrimozocubaz1/PC2
/Pregunta02.py
UTF-8
425
3.359375
3
[]
no_license
a= int(input("Ingrese el primer numero de su arreglo")) b= int(input("Ingrese el segundo numero de su arreglo")) c= int(input("Ingrese el tercer numero de su arreglo")) d= int(input("Ingrese el cuarto numero de su arreglo")) e= int(input("Ingrese el quinto numero de su arreglo")) arreglo= [] arreglo.append(a) arreglo....
true
af796d2f451f64a524b1c76bfe30a474802377cf
YuikiTakahashi/New-Yuiki-DSMC
/2Dsim/fluidSim.py
UTF-8
7,145
2.96875
3
[]
no_license
import random import numpy as np import matplotlib.pyplot as plt import scipy.stats as st kb = 1.38 * 10**-23 NA = 6.022 * 10**23 T = 4 # Container temperature m = 0.004 / NA # Ambient gas mass (kg) M = .190061 / NA # Species mass (kg) massParam = 2 * m / (m + M) n = 10**12 # per sq. meter cross = 4 * (140 * 10**(-12)...
true
ea1977d45a435eb747bd3cb97f894553797dee54
Aasthaengg/IBMdataset
/Python_codes/p02830/s448265561.py
UTF-8
91
3.109375
3
[]
no_license
N = int(input()) S, T = input().split() L = [S[i]+T[i] for i in range(N)] print(*L, sep="")
true
0ffaeb796b2fc4cac985aa3441c050a11c948b8c
Heeseok-Jeong/Algorithm_Coding_Practice
/BaekJoon_Online_Judge/7576.py
UTF-8
840
2.78125
3
[]
no_license
import sys from copy import deepcopy input = sys.stdin.readline M, N = map(int, input().split()) grid = [[-1 for _ in range(M+2)]] for _ in range(N): line = [-1] + list(map(int, input().split())) + [-1] grid.append(line) grid.append([-1 for _ in range(M+2)]) locs = [] for i in range(N+2): for j in range...
true
241a5eb5adb2e50ede8ebcb19d716772686327c9
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_206/279.py
UTF-8
589
3.03125
3
[]
no_license
import sys def solve(): D, N = map(int, sys.stdin.readline().rstrip().split()) max_time = 0 for i in range(N): K, S = map(int, sys.stdin.readline().rstrip().split()) time_taken = (D-K)*1.0/S if time_taken >= max_time: slow_K = K slow_S = S max_ti...
true
4b794400767df9708d184ef262c7ddcc9b97c75a
RitoBB/leetcode
/289.生命游戏.py
UTF-8
857
3.234375
3
[]
no_license
# # @lc app=leetcode.cn id=289 lang=python3 # # [289] 生命游戏 # # @lc code=start class Solution: def gameOfLife(self, board: List[List[int]]) -> None: """ Do not return anything, modify board in-place instead. """ m, n = len(board), len(board[0]) for i, j in itertools.product(r...
true
1de8f21a7c3ebeeca70c784491fcd804f61c8737
ivadimn/py-input
/Head04/Lesson 4.py
UTF-8
4,804
4.46875
4
[]
no_license
# 1: Создайте функцию, принимающую на вход имя, возраст # и город проживания человека. Функция должна возвращать строку # вида «Василий, 21 год(а), # проживает в городе Москва» def person (name, age, from_in): enter = (name + ", " + age + " год(а)," + " проживает в городе " + from_in) return enter name...
true
f5ca8c2c79ebe0b5c29e7241b374b59c0bbd3fc9
sundayroom/sockettest
/socketclient.py
UTF-8
754
2.890625
3
[]
no_license
import socket import hashlib import json client=socket.socket() try: client.connect(('127.0.0.1',5000)) except Exception : print("服务器未启动") dic={} def login(name,password): for k,v in dic.items(): if k!=name and v!=password: dic[name] = password print("登录成功") else: ...
true
245a01f4819643b9a908c204185840184d3af40c
BogdanFi/cmiN
/FII/L3/CC/3/restaurant/rdb.py
UTF-8
4,112
3.109375
3
[]
no_license
#! /usr/bin/env python import json import os DB_PATH = "restaurant.json" class RestaurantDBError(Exception): pass class RestaurantDB(object): _ENTITIES = ["employee", "product"] _REQUIRED_FIELDS = { "employee": [ "name", "salary" ], "product": [ ...
true
92d1685f7f4107db7f7e24757ac2d6a5637ab5d1
G8-CS207F17/cs207-FinalProject
/chemkin8/chemkin.py
UTF-8
35,734
2.859375
3
[]
no_license
import numpy as np import sqlite3 import os from chemkin8.parser import * from parser import * # to be deleted import datetime import matplotlib as mpl if os.environ.get('DISPLAY','') == '': mpl.use('Agg') import matplotlib.pyplot as plt class backward: """Methods for calculating the backward reaction rate. ...
true
a23bccb58dddcc08a315b9a2d2ab684f32a6a8ea
sepehrgdr/Mode_Imputation
/Codes/Prediction/RF_Prediction.py
UTF-8
1,245
2.8125
3
[ "BSD-3-Clause" ]
permissive
# -*- coding: utf-8 -*- """ Created on Thu Feb 28 14:24:27 2019 @author: adarzi """ #Loading the libraries import pandas as pd import os from os import sys import pickle #setting the directory os.chdir(sys.path[0]) #loading the data: data = pd.read_csv('../../Inputs/Trip_Data/AirSage_Data/trips_lon...
true
0a481127d28f5dc032d85eb95754290f4dcc695b
count99/practice
/jisuanke.com/remove_element.py
UTF-8
204
3.234375
3
[]
no_license
#coding="utf-8" n = input() a_array = input() remove_number = input() element_list = a_array.split(" ") while remove_number in element_list: element_list.remove(remove_number) print(len(element_list))
true
d7c9a3fcfcb1f2bcf54dbdb912074c63ff852360
shogunpurple/athletics-ni-api
/scraper/src/pdf_parser.py
UTF-8
1,721
2.578125
3
[]
no_license
import tabula import numpy as np import pandas as pd import logging import uuid URL = 'https://athleticsni.org/download/files/' PDF_TABLE_COORDS = [153.15, 5.1, 775.87, 589.48] PDF_COLUMN_COORDS = [42.74, 174.78, 259.62, 323.81, 529.21, 591.15] def parse_pdf_to_df(pdf_file_name = 'XCandRRFixtures-Updated-131218.pdf')...
true
7a51f34bb2f85f68be8576a659c43402fe8c25ce
Tehforsch/bob
/bob/plots/luminosityOverTime.py
UTF-8
1,336
2.578125
3
[]
no_license
import matplotlib.pyplot as plt import astropy.units as pq from bob.postprocessingFunctions import MultiSetFn from bob.result import Result from bob.multiSet import MultiSet from bob.plots.timePlots import addTimeArg from bob.util import getArrayQuantity from bob.plotConfig import PlotConfig class LuminosityOverTime...
true
c1886303347916a5623d47154b29f5dfc7f42ad1
erdzhemadinov/MADE_FINAL_PROJECT
/parsers/qaloader.py
UTF-8
3,010
2.609375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 7 14:11:25 2020 @author: iavode """ import os import sys from logging import getLogger, INFO from random import randint, seed from time import time_ns from pandas import DataFrame from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter ...
true
27cdba4fdd4a16d648f33431f608b6e66ce58f71
BrinkOfMan/Intro-CS
/caesar_cipher.py
UTF-8
936
4.46875
4
[]
no_license
#program to encrypt/decrypt using the Caesar cipher #function to encrypt/decrypt one character #assume char is alphabetic def caesarShift(char, num): if char.islower(): #lowercase letters have ASCII values 97 to 122 val = ord(char) - 97 + num return chr((val % 26) + 97) else: #up...
true