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
5589361d682f8fcdaed68ba096bbcae4227797be
tisnik/python-programming-courses
/Python2/examples/OOP/employee_class_7.py
UTF-8
1,126
4.21875
4
[]
no_license
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 """Gettery a settery.""" class Employee: """Třída reprezentující zaměstnance.""" def __init__(self, first_name, surname, salary): """Konstruktor objektu.""" self._first_name = first_name self._surname = surname self._salary...
true
aec6788fdd8b421eef32fb98b06dd3f9be281800
XingXing2019/LeetCode
/Recursion/LeetCode 1137 - N-thTribonacciNumber/N-thTribonacciNumber_Python/main.py
UTF-8
335
3.21875
3
[]
no_license
class Solution: def tribonacci(self, n: int) -> int: if n == 0: return 0 if n < 3: return 1 num0, num1, num2 = 0, 1, 1 for i in range(3, n + 1): temp = num0 + num1 + num2 num0 = num1 num1 = num2 num2 = temp ...
true
fa7cb129d6715955d2e62eb32199c7cc58c64330
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc059/A/4909696.py
UTF-8
56
3.28125
3
[]
no_license
a,b,c = input().split() print((a[0]+b[0]+c[0]).upper())
true
9d2af9a89410ff447ba3497b19ca492860fdd881
maciej88/SmallProgram
/models.py
UTF-8
7,751
3.09375
3
[]
no_license
from psycopg2 import connect from psycopg2.extras import RealDictCursor from clcrypto import generate_salt, password_hash, check_password def create_conenction(db_name='communications_server'): # Otwarcie połączenie do podanej bazy danych. db_connection = connect( user='postgres', password='c...
true
013347f4e4a8526225a9da0c4e5de83777b2f865
GabrielNew/Python3-Basics
/World 3/ex077.py
UTF-8
506
3.859375
4
[]
no_license
# -*- coding: utf-8 -*- ''' ex077 -> Crie um programa que tenha uma tupla com várias palavras (não usar acentos). Depois disso, você deve mostrar, para cada palavra, quais são as suas vogais. ''' palavras = ('LINGUAGEM','PROGRAMACAO','ESTUDAR','PESQUISA','PROGRAMA', 'PYTHON','JAVA','EXERCICI...
true
173a23443fe24862957dbd25294ca121cb399d51
EeshGupta/Cookin-Quantum
/circuit/gate/GateBuilder.py
UTF-8
8,052
2.859375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Tue Aug 13 11:50:43 2019 @author: Eesh Gupta """ import numpy as np import math import cmath from . import GateMaker from . import GroverGates from . import ControlGates class gates(GateMaker.gateMaker): def __init__(self, qubits, state_vector): ...
true
5c1779fb9a0d9f431aa6f5b1a8365d4e33f936bb
Ty-Allen/Allen_T_DataViz
/data/canada_medal_breakdown.py
UTF-8
340
3.5625
4
[ "MIT" ]
permissive
import matplotlib.pyplot as plt #generate a pie chart with our Olympic data values = [315, 203, 107] colors = ["gold", "silver", "brown"] labels = ["Gold: 315", "Silver: 203", "Bronze: 107"] explode = (0.05, 0, 0) plt.title("Canada Medal Breakdown", pad="15") plt.pie(values, labels=labels, colors=colors, explode=e...
true
2749adfbc6c1187140a37c03d3ba69efde9647f1
22lrfuller/RhymingWebScraper
/RapLyricScrape.py
UTF-8
1,589
3
3
[]
no_license
import requests from bs4 import BeautifulSoup import re def lyricScrape(output): # Searching the song on the website and getting the conents of the page song = input("Enter the song name: ") song = song.replace(" ", "+") URL = 'https://search.azlyrics.com/search.php?q=' + song results = BeautifulSoup(requests.ge...
true
d4392174163da8be6207db3521d048f1f81ea2bb
Createitv/BeatyPython
/02-python面向对象/basicOOP/06-static_method.py
UTF-8
266
3.390625
3
[]
no_license
class Player: teamName = 'Liverpool' # class variables def __init__(self, name): self.name = name # creating instance variables @staticmethod def demo(): print("I am a static method.") p1 = Player('lol') p1.demo() Player.demo()
true
b34930ff77b4041652d094a5b4def64e9c26838e
denizmersinlioglu/Python-Basics
/tkinter/TextArcs.py
UTF-8
300
2.828125
3
[]
no_license
from tkinter import * root = Tk() canvas = Canvas(root, width=300, height=300) canvas.pack() canvas.create_arc(10, 10, 200, 80, extent=45, style=ARC) canvas.create_arc(10, 80, 200, 160, extent=167, style=ARC) canvas.create_text(150, 150, text="First GUI text", font=("Times,30")) root.mainloop()
true
b790990643a9a3cae8df8847a479fc3032a29f04
tmdgh3552/Data_Visualization
/df_graph.py
UTF-8
1,793
3.03125
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import pandas as pd import seaborn as sns f = open("datfile_sample","r") dat_file = f.read() fdat_spl = dat_file.split("\n") j = 1 count = 0 odd = [] even = [] for i in range(len(fdat_spl)): start_info = fdat_spl[i].find("MTF Peaks") if...
true
bbe7f7c1d590c7389f4008cc29d2ac4deed266f2
HenriquedaSilvaCardoso/Exercicios-CursoemVideo-Python
/Exercícios em Python/PythonExercícios/ex004.py
UTF-8
821
4.125
4
[ "MIT" ]
permissive
v = input('Digite algo: ') print(f'O tipo desse algo é: \033[7;36;40m{type(v)}\033[m') print(f'ESTÁ EM CAIXA ALTA? \033[7;36;40m{v.isupper()}\033[m') print(f'É alfabético? \033[7;36;40m{v.isalpha()}\033[m') print(f'É um número? \033[7;36;40m{v.isnumeric()}\033[m') print(f'É ASCII? \033[7;36;40m{v.isascii()}\033[m') pr...
true
9aad78794775eccb5de2304d0e10558a612179a3
mikkeloscar/plastix
/plastix.py
UTF-8
2,065
2.890625
3
[]
no_license
from parser import document as parser import sys from elements import ( FootnoteRef, Reference ) class Plastix: def __init__(self, parse): self.parse = parse self.preamble = [ "\\documentclass{article}\n", "\\usepackage[utf8]{inputenc}\n", ...
true
d7f27ae93e5357c31553c1dee50d8d6691455a7d
sai-hardik/basic_python_programs
/calculator.py
UTF-8
804
3.890625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Thu Nov 12 13:30:03 2020 @author: babut """ def add(x,y): return x + y def substract(x,y): return x - y def multiply(x,y): return x * y def divide(x,y): return x/y print("select operation.") print("1.add") print("2.substract") ...
true
361b76496c94cbd30ca63f86e5180d9b3556f510
Balakireva-Maria/test
/main.py
UTF-8
1,717
3.453125
3
[]
no_license
documents = [ {"type": "passport", "number": "2207 876234", "name": "Василий Гупкин"}, {"type": "invoice", "number": "11-2", "name": "Геннадий Покемонов"}, {"type": "insurance", "number": "10006", "name": "Аристарх Павлов"} ] directories = { '1': ['2207 876234', '11-2', '5455 028765'], '2': ['10006...
true
1427b2fe0bed3afba409577517f473592e5d3670
candi-project/Selenium
/SeleniumWDTutorial/PropertiesAndActions/PandA_on_WebElement.py
UTF-8
1,076
2.640625
3
[]
no_license
from selenium import webdriver import time from selenium.common.exceptions import ElementNotVisibleException, NoSuchElementException from selenium.webdriver.common.by import By from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as ec driver = webdriver...
true
ece472a8ed853babd8be4c1307fe484b240aea8e
westernx/sgpublish
/sgpublish/exporter/base.py
UTF-8
3,831
2.53125
3
[]
no_license
import os from sgpublish.publisher import Publisher class Exporter(object): def __init__(self, workspace=None, filename_hint=None, publish_type=None): self._workspace = workspace self._filename_hint = filename_hint self._publish_type = publish_type @property def publish_type...
true
3c98854f949a80a00b32f845f223d9362044ddec
WorkShoft/python-developer-delectatech
/restaurants/repositories/sqlrepository.py
UTF-8
1,393
2.515625
3
[ "Apache-2.0" ]
permissive
from django.db.models.fields import Field from .baserepository import BaseRepo from restaurants.models import Restaurant from restaurants.custom_lookups import NotEqual Field.register_lookup(NotEqual) class SqlRestaurantRepo(BaseRepo): model = Restaurant def _query(self, params={}, first=False, as_dict=Fa...
true
53276ca39b1df73f56cdf3020fb269cb9d12c788
dinesh6752/Competitive-programming
/Codechef/NITIKA.py
UTF-8
362
3.4375
3
[]
no_license
name=[] for x in range(1,int(input())+1): s=input() name=s.split(" "); if(len(name)==1): print(name[0].capitalize()) if(len(name)==2): print(name[0][0].capitalize(),end=". ") print(name[1].capitalize()) elif(len(name)==3): print(name[0][0].capitalize(),end=". ") print(name[1][0].capitalize(),e...
true
3ca5ac353e63f645390f55ddf2ab5c81b145e9b8
ddandur/CDIPS-EEG-Project
/training.py
UTF-8
4,400
2.625
3
[]
no_license
from ecog_tools import * import pandas as pd import numpy as np import sklearn import sklearn.ensemble import scipy.stats from random import shuffle total_test_df = pd.DataFrame() subjects = [] for i in range(1,9): subject = 'Patient_%i'%(i) subjects.append(subject) for i in range(1,5): subject = 'Dog_%i'...
true
1234ceca07fd25bd5e90db5eca6d376edb346f5e
vinaykumar3117/blog-scanner
/post_processor/post_processor.py
UTF-8
3,579
3.234375
3
[]
no_license
""" Module : post_processor.py Description : eliminate blacklisted words, append URL column Input : pipe1_output (csv file) Ouput : pipe2_output (csv file) """ import csv import os local_import = True postfix = '' MIN_CHAR_COUNT = 19 def get_blacklist(): """ Get blacklist words """ g...
true
692637e6472cfbccd7e83b17430418b7352d9a0c
camerongridley/Formula-One-Home-Advantage
/src/show_stats.py
UTF-8
636
3
3
[]
no_license
import numpy as np import scipy.stats as stats class ShowStats: def __init__(self): pass def print_basic_stats(self, one_d_array, data_label='data'): print(f'Mean of {data_label} {np.round(np.mean(one_d_array), 3)}') print(f'Variance of {data_label} {np.round(np.var(one_d_array), 3)}'...
true
b5810dda64cdd275a340ee97c07fd2e17f025cc9
ManuelMeraz/ReinforcementLearning
/rl/agents/reprs/value.py
UTF-8
653
3.515625
4
[ "MIT" ]
permissive
import pprint class Value: def __init__(self, value: float = 0.0, count: float = 0.0): """ Stores the value of a state and how many times the agent has been in this state :param value: The total accumulated reward computed using temporal difference :param count: The number of time...
true
6d511cd842d4ac6b8ed347c422e7e9636bb10e56
tetratec/speedbukkit
/src/org/speedbukkit/block/CraftNoteBlock.py
UTF-8
2,540
2.671875
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python """ generated source for module CraftNoteBlock """ from __future__ import print_function # package: org.bukkit.craftbukkit.block class CraftNoteBlock(CraftBlockState, NoteBlock): """ generated source for class CraftNoteBlock """ world = None note = None @overloaded def __init_...
true
278ec2dec2b3343cab63558478cecb2ed3392fa8
AnnaZavgorodnia/PostgreSQL_LABS
/sem1/lab2/controller.py
UTF-8
5,423
2.90625
3
[]
no_license
from consolemenu import SelectionMenu import model import view import scanner class Controller: def __init__(self): self.model = model.Model() self.view = view.View() self.tables = list(model.TABLES.keys()) def get_table_name(self, index): try: return self.tables...
true
3b104194d83534098e0f51bad081ca3d5cb6b58d
ste-haus/webshot
/src/webshot.py
UTF-8
2,599
2.84375
3
[]
no_license
#!/usr/bin/env python3 import argparse, glob, os, sys, time, uuid from PIL import Image from selenium import webdriver def get_browser(width, height): print(f"Setting up {width}x{height} browser... ", end = '', flush=True) options = webdriver.ChromeOptions() options.add_argument('--headless') options...
true
babae26874fc95c4705578f9c3b0f0078b04a2ff
Srikanth-SM/HackerEarth
/erase_to_max.py
UTF-8
574
3.046875
3
[]
no_license
// https://www.hackerearth.com/challenge/hiring/adessa-backend-hiring-challenge/algorithm/erase-to-max-7b8c0ca3/ def getResult(Arr): # Write your code here dic = {} total = 0 for i in Arr: if i in dic: dic[i] += i else: dic[i] = i total += i sorted_by...
true
20d0db04ce1e0f28731c926445b9944338fbb8db
JustinL42/Project-Euler
/009.py
UTF-8
314
3.375
3
[]
no_license
import math minc = int(math.floor(1000*math.sqrt(2)/(2+math.sqrt(2)))) maxc = 1000//2 count = 0 for c in range(minc, maxc): c2 = c**2 for a in range(1, (1000-c)//2 + 1): count += 1 if c2 == a**2 + (1000 - a -c)**2: print(a, (1000 - a -c), c) print('count:', count) print('count:', count)
true
a6e6dd023358d51e3b4b4bbc496ef9b931f6fff3
kibanana/Study-Python-With
/yewon/ch07/example1.py
UTF-8
705
3.609375
4
[]
no_license
# -*- coding: utf-8 -*- import re # 주민등록번호 뒷자리를 *로 바꾸자 data = """ park 800905-1049118 kim 700905-1059119 """ # 1) 정규표현식을 모를 때 result = [] for line in data.split("\n"): word_result = [] for word in line.split(): if len(word) == 14 and word[:6].isdigit() and word[7:].isdigit(): # 이름인가 / 주민등록번호인...
true
a8032a4e172a31937e39abafc198ab670053bb95
chriso/gauged
/gauged/drivers/mysql.py
UTF-8
16,682
2.65625
3
[ "MIT" ]
permissive
""" Gauged https://github.com/chriso/gauged (MIT Licensed) Copyright 2014 (c) Chris O'Hara <cohara87@gmail.com> """ from collections import OrderedDict from warnings import filterwarnings from .interface import DriverInterface class MySQLDriver(DriverInterface): """A mysql driver for gauged""" MAX_KEY = 255...
true
709ab3140bd37fd8775a3ca4f3b550fa36891c9b
TTTREE/Trackor_base
/src/tracktor/datasets/mot_siamese_wrapper.py
UTF-8
745
2.515625
3
[ "MIT" ]
permissive
from torch.utils.data import Dataset import torch from .mot_siamese import MOT_Siamese class MOT_Siamese_Wrapper(Dataset): """A Wrapper class for MOT_Siamese. Wrapper class for combining different sequences into one dataset for the MOT_Siamese Dataset. """ def __init__(self, split, dataloader): train_folde...
true
3dc66c1e016a29d51b72ae58b14ce41f495556d9
nbgraham/PACCS_Heatmap
/abbr.py
UTF-8
701
3.0625
3
[]
no_license
import csv def remove_duplicates(infilename, outfilename): rows = [] with open(infilename, 'rt', encoding='utf8') as csvinfile: reader = csv.reader(csvinfile) prev_row = None for row in reader: if row != prev_row: rows.append(row) prev_row = row...
true
5bb231626af5037e855e7fa95bda6bf9587c5dec
jerryfeng007/pythonCodes
/multithreading/0007TCP客户端远程执行命令.py
UTF-8
612
3
3
[]
no_license
import socket ip_port = ('localhost', 8090) buffer_size = 1024 tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_client.connect(ip_port) while True: cmd = input('请输入命令:>>>').strip() # 客户端有可能输入空数据 if not cmd: continue if cmd == 'quit': break tcp_client.send(cmd.encode('...
true
843ad74c487134f3ab483ff3ba5db4b557120f5b
abhisekrai88/FS104
/Session6_291220/writetofile.py
UTF-8
194
3.34375
3
[]
no_license
file_string = str(input("Enter Text here:")) def write_to_file(text): file_object = open("testfile.txt","w") file_object.write(text) file_object.close() write_to_file(file_string)
true
fdb03181596d84f3a48c830fd9dc25395b732e0a
lamarrg/Education
/edX/Using Python for Research/case_study2/language_processing.py
UTF-8
1,753
3.9375
4
[]
no_license
#text = "This is my test text. We're keeping this text short to keep things manageable." def count_words(text): """ Count the number of times each word occurs in text (str). Return ditiontary where keys are unique words and values are word counts. Skip punctuation """ text = text.lower() skips = [...
true
9fa458654b200481877c86e718ad5ea4065771da
lenshuygh/python3FromScratch_packt
/control_structure/comparators.py
UTF-8
476
3.375
3
[]
no_license
a = 100 b = 50 c = 100 print(a == a) print(a == b) print(a == c) print("-"*50) print(a != a) print(a != b) print(a != c) print("-"*50) bool_one = 10 == 10 print(bool_one) print("-"*50) bool_one = 10 == 11 print(bool_one) not_equal = 10 != 11 print(not_equal) less_than = 10 < 11 print(less_than) greather_than = 10 > ...
true
1403fe1dcdbcbe85da9b5a2c94eeadd1e28b9de2
open-mmlab/mmagic
/mmagic/models/editors/deepfillv1/deepfill_disc.py
UTF-8
1,859
2.515625
3
[ "Apache-2.0" ]
permissive
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmengine.model import BaseModule from mmengine.model.weight_init import normal_init from mmagic.registry import MODELS @MODELS.register_module() class DeepFillv1Discriminators(BaseModule): """Discriminators used in DeepFillv1 model. ...
true
9efedc01af42df6ada7e62c5f481c80ffecb7879
henrymendez/garage
/openai/venv/lib/python3.10/site-packages/langchain/document_loaders/whatsapp_chat.py
UTF-8
1,207
2.78125
3
[]
no_license
import re from pathlib import Path from typing import List from langchain.docstore.document import Document from langchain.document_loaders.base import BaseLoader def concatenate_rows(date: str, sender: str, text: str) -> str: """Combine message information in a readable format ready to be used.""" return f"...
true
5be4319f25b8bda3528aa3eda014acd2a8dd29ed
phcanalytics/ibd_flare_model
/scripts/analysis/01_lab_selector.py
UTF-8
2,744
2.875
3
[ "MIT" ]
permissive
""" Title: Selecting Labs Measures Features Author: Ryan Gan Date Created: 2020-02-14 Script to identify labs measured on at least 70% of visits/observations. Rational that these would be the most commonly tested labs in Optum EHR and hence the most useful in practice. """ """ Modules """ print('Importing modules/p...
true
eac4b072d0455928915501f1e8935444acdaaa41
RohanSreelesh/School_Project_CRM
/datecheck.py
UTF-8
1,407
3.625
4
[]
no_license
def datecheck(date): import time today=time.strftime("%d%m%Y",time.gmtime()) date=str(date) day=int(date[0:2]) month=int(date[2:4]) year=int(date[4:]) #alphabet check for i in date: if i not in '1234567890': return False break if len(date)!...
true
72a0cd545498eca4a25801c4e53337e17a641db4
gdgf/MoocTF
/2python/b.py
UTF-8
190
3.90625
4
[]
no_license
#coding:utf-8 age=int(input("输入你的年龄\n")) if age>18: print ("大于十八岁") print ("你成年了") else: print("小于等于十八岁") print ("还未成年")
true
d7ab498922d5e5adf6d596d3321cd9cd12ff6398
thydungeonsean/Oryx
/source/items/actors/actor.py
UTF-8
4,752
2.984375
3
[]
no_license
from random import * from ...graphics.image import AnimatedSprite from ...graphics.image import AnimatedAvatar from ...graphics.image import CopiedAnimatedSprite from control_component import ActorControlComponent import mobility class Actor(object): def __init__(self, name, image_package, stat_component, mo...
true
df180cebbcb1bce9da70971f283e1cd1a960d2d7
jwestrob/Script_Toybox
/correcter.py
UTF-8
1,169
2.671875
3
[]
no_license
import os, sys, math import numpy as np import time from Bio import SeqIO def trimmer(filename): found = False new_fasta = [] with open(filename) as inputfile: for line in inputfile: if line[0] == ">": found = True if found == True: new_fasta....
true
536c8aea93d1a76176765efc807c693f94df0486
vvalotto/Patrones_Disenio_Python
/principios_SOLID/SPR/Ejemplo 1 - No SPR/calculador_factura.py
UTF-8
1,452
3.1875
3
[]
no_license
''' Created on 03/01/2014 @author: vvalotto Ejemplo de la violacion a Principio de Resposanbilidad Unica ''' from factura import Factura class CalculadorFactura(): ''' Clase Responsable de Calculo del importe de la factura ''' def __init__(self, factura): ''' El constructor del ca...
true
0efc98f95c863da943b3d3539227c37329ca5641
jpavelw/sam-2017
/SAM2017/registration/models.py
UTF-8
1,137
2.625
3
[ "MIT" ]
permissive
from django.db import models class Role(models.Model): # Jairo added the code field AUT = "AUT" PCM = "PCM" PCC = "PCC" ADM = "ADM" role_choices = ( (AUT, "Author"), (PCM, "Program committee member"), (PCC, "Program committee chair"), (ADM, "Administrator") ...
true
697ee750b5a5a57a28b23e9a954c99120ae96a3f
apple/swift
/utils/viewcfg
UTF-8
6,754
2.53125
3
[ "Apache-2.0", "Swift-exception" ]
permissive
#!/usr/bin/env python3 # viewcfg - A script for viewing the CFG of SIL and LLVM IR -*- python -*- # # This source file is part of the Swift.org open source project # # Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://s...
true
16e61666a3b4efa1348cb6ff5e9d49daa8f98171
kennyjoseph/twitter_matching
/voter_file_aggregation/code/public_voter_data_tools/connecticut.py
UTF-8
3,722
2.578125
3
[]
no_license
import csv import glob from util import get_party party_map = { "R":"R", "D":"D", "U":"U", "UNAFF":"U", } def file_reader(fil): return open(fil) def line_reader(line): try: county = towns[line[236:254].strip()] except: return None votes = line[470:len(line)] votes...
true
bf96ba845e806bb542ee99d2725c1ab4711b6207
eva-koester/census
/queries_manipulations.py
UTF-8
2,014
2.875
3
[]
no_license
from sqlalchemy import create_engine, MetaData, Table, Column, String, Integer, insert, select, func, \ case, cast, Float, desc # Define an engine to connect to the database census.db engine = create_engine('sqlite:///census.db') connection = engine.connect() metadata = MetaData() census = Table('census', metadata...
true
c1109f860c1a14b62855e54a81c5ae5f125986c5
88azerty/connieAI
/main.py
UTF-8
2,704
2.5625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 26 23:58:14 2018 Conectar ROOT con Tensorflow @author: hernanca """ import uproot # Se instala con pip3 install uproot[all] import pandas as pd import tensorflow as tf # Se instala con pip3 install tensorflow[all] import numpy as np...
true
903a8b2523c22baa2e5456527b0c86d0f9e3c11b
ursaMaj0r/python-csc-125
/Snippets/intro-1/Yuor_biran_is_an_azamnig_thnig.py
UTF-8
350
3.734375
4
[ "MIT" ]
permissive
# input input_raw = input("Enter words: ") input_words = input_raw.split() # tests if (set(input_words[0]) == set(input_words[-1])) and (set(input_words[0][0]) == set(input_words[-1][0])) and (set(input_words[0][-1]) == set(input_words[-1][-1])) and (len(input_words[0]) == len(input_words[-1])): print("Super Anagr...
true
1390a166bf51a232cced1183b87b408015f10f0e
Jacyle/binance-technical-algorithm
/Algorithm/Logic.py
UTF-8
9,280
2.5625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import pandas as pd from technical_indicators import TechInd from sqlalchemy import create_engine import config conn = config.conn cur = config.cur tickers = config.ticker for x in tickers: ticker = x cur.execute("""select closetime,lastprice,highprice,lowprice from binance.ticker_da...
true
656333457e18391d8ae8c453afcb80b07b76e163
Beat30/Exercise_CS1
/3_9gamow.py
UTF-8
1,148
3.484375
3
[]
no_license
from itertools import permutations dict={} a=1 for i in range(0,4): for j in range(0,4): for k in range(0,4): dict[a]=[i,j,k,(j+2)%4] a+=1 ###delete double solutions for i in range(1,64): for j in range(i+1,65): try: if (dict[i][0]==dict[j][0])...
true
62e749462e3e4d76e12c2fb5562474ebf95a7a0b
litufu/data_extract
/getdata/get_companylist.py
UTF-8
1,490
2.96875
3
[]
no_license
# _author : litufu # date : 2018/4/19 import pandas as pd import tushare as ts from sqlalchemy import create_engine engine = create_engine(r'sqlite:///H:\data_extract\db.sqlite3') # engine = create_engine('postgresql://postgres:123456abc@localhost:5432/companyvalue') #create_engine说明:dialect[+driver]://user:password@h...
true
2394777b40d434de21b51e709b9a7d464fa85cdc
rgrchen/datamined
/examples/simple_economy.py
UTF-8
3,280
3.3125
3
[ "MIT" ]
permissive
# Provides an example of a dummy cryptoeconomy. This economy is created by a # number of miners/users bringing on-board data onto the network. Miners are # rewarded for their cryptoeconomic with coin issuances. Next, a number of # compute nodes enter the economy. Note that compute nodes start with empty # wallets. Sequ...
true
7cb8b2cf88eab6e8cdf984b39b0042ecb60c723f
pip-services3-python/pip-services3-commons-python
/pip_services3_commons/refer/IReferences.py
UTF-8
6,129
3
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ pip_services3_commons.refer.IReferences ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Interface for references components. :copyright: Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details. :license: MIT, see LICENSE for more details. """ from abc im...
true
0eaa7da8200cba831c95f3e53cb88960ec13462b
raghav-mundhra/Dialogflow-flask-application
/forms.py
UTF-8
1,507
2.546875
3
[]
no_license
from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileAllowed from wtforms import StringField, PasswordField, SubmitField, BooleanField, IntegerField, SelectField from wtforms.validators import DataRequired, Length, Email, EqualTo from functions import getEntities, getIntents class add_intent...
true
1136dd0164d69d68f9ff793c69bda3280a3f5cce
desertzk/pythondemo
/ROC/precition_recall_graph.py
UTF-8
1,749
3.3125
3
[]
no_license
import matplotlib.pyplot as plt truelist =["A","B","C","D","E","F","G","H","I","J"] L1=["A","L","B","N","O","P","Q","C","S","T","D","V","W","X","Y"] L2=["K","A","M","N","O","B","Q","R","S","T","C","V","W","X","D"] plist = [] rlist = [] i = 0 for item in L1: i = i + 1 tempL1 = L1[0:i] sameitem = set(temp...
true
3eb5d1ea46e29001d0f97d9300e96024796586f1
majota2021/pyhon-tuto
/02 strings/TP2 string.py
UTF-8
1,152
3.796875
4
[]
no_license
# indexing s = " hello world" # 012345678910 # -9-8-7-6-5-4-3-2-1 print(s) print (s[0]) # elelment de S dont l indice egal a 0 print (s[1]) print (s[2]) print(s[-5]) print(s[-1]) z = "sidi kacem" + " abdo" print(z) z = "sidi kacem" + s print(z + " python") print(z) z = s*3 print(z) # slissing: extrir de sous string...
true
0d9358f1ec0f56ebeb0b1f1da7fad3a9c8fdb6ae
epsagon/epsagon-python
/epsagon/runners/flask.py
UTF-8
2,995
2.65625
3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
""" Runner for a Flask Python function """ from __future__ import absolute_import import os import uuid from ..event import BaseEvent from ..utils import add_data_if_needed, normalize_http_url from ..constants import EPSAGON_HEADER_TITLE class FlaskRunner(BaseEvent): """ Represents Python Flask event runner....
true
2e4611aba6b32674bbd89a4aa658b14de4d7a41d
Deiz/registry
/scripts/scrape.py
UTF-8
2,022
2.78125
3
[]
no_license
import urllib import json import time from bs4 import BeautifulSoup # We'd so like not to have to scrape this and just use the API but we can't ... # http://developer.github.com/changes/2013-10-18-new-code-search-requirements/ def get_list_from_github(): url = 'https://github.com/search?q=name+extension%3Ajson+pa...
true
7b6f5a2c4451a8fed5c3a0cfabb6422fe10b0836
masalomon01/invcrawler
/crawler.py
UTF-8
5,902
2.515625
3
[]
no_license
import csv import requests from bs4 import BeautifulSoup from requests import get import config import csv import unidecode import os import time def get_soup(url): response = get(url) response = response.text.encode('utf-8') html_soup = BeautifulSoup(response, 'html.parser') return html_soup def cs...
true
7cf402c9d176c7146a198abc5ca66d7a11858434
MaevaLC/BillyValuation
/Graph_anytree.py
UTF-8
1,560
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 12 13:51:00 2017 @author: m.leclech """ #import import json from pprint import pprint from anytree import Node, RenderTree #open the file with the annotated text with open('annotatedText.json', 'r') as f: annotatedText = json.load(f) #these node need to be declared...
true
227068b6719dcbd997fe8ebae0f799ccb8f9f01d
jhare96/Deepspeech
/tests/test_clipped_relu.py
UTF-8
928
2.5625
3
[]
no_license
import tensorflow as tf import os def relu_clipped(x, clip=20): return tf.minimum(tf.maximum(x, 0.0), clip) def test_relu_clipped(): config = tf.ConfigProto(allow_soft_placement=True) # Allow automatic CPU placement if GPU kernel not availiable config.gpu_options.allow_growth = True # Allow GPU grow...
true
1f202d1148637f9249cc4dbc854a1d085f612a88
j0e1in/advent_code
/day3_count_trees.py
UTF-8
631
3.453125
3
[]
no_license
import math with open("input/day3.txt") as f: grid = [[c for c in l] for l in f.read().split("\n") if l] for i in range(len(grid)): assert len(grid[0]) == len(grid[i]), f"{i}: {len(grid[0])} != {len(grid[i])}" print(f"Board size: {len(grid)} x {len(grid[0])}") def count_trees(inp, steps): x, y = 0, 0 ...
true
0aa78980565e258b6438c8b962b75802f6163ddd
jeffleon/Analitica
/app/models.py
UTF-8
1,320
2.703125
3
[]
no_license
from app import db # from passlib.hash import pbkdf2_sha256 as sha256 import bcrypt # class Role(db.Model): # __tablename__ = 'roles' # id = db.Column(db.Integer, primary_key=True) # name = db.Column(db.String(64), unique=True) # users = db.relationship('User', backref='role') # def __repr__(self)...
true
1ef95d544c3dbccb33d2547a5a01c0247d46b66b
mampersat/minions
/esp8266/bbq/turkey.py
UTF-8
886
2.890625
3
[]
no_license
""" turkey.py read the turkey temperature from mqtt bus and display on front of house """ import paho.mqtt.client as mqtt def on_connect(client, userdata, flags, rc): print("Connected with result code "+str(rc)) # the esp8266 with the temperature probe in the turkey client.subscribe("/bbq/esp8266_7f35d5...
true
03f53c318fc63ee3fb8bd565bf2f38990d83f88f
Avator-Chese/Computional-Physics
/Code/main.py
UTF-8
4,242
2.78125
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from random import randint, random #============================================================== N = 20 steps = 10 * N N_T = steps J = 1 T = np.linspace(0.01, 10, N_T) def initial_state(start='Low'): if start == 'High': state = np.zeros(N) for ...
true
9586ac212c09816705959e0ca0b55ea37daea95d
kaurharjeet/CompletePythonDeveloperCourse
/Python3Udemy/BitManipulation.py
UTF-8
142
3.4375
3
[]
no_license
x = 0b10101 y = 0b01101 print(x) print(y) def f(n): print('{:08b}'.format(n) + ' = ' + str(n)) f(x) f(y) f(x&y) f(x|y) f(x>>2) f(y<<3)
true
02530ed3881fe146cad15ba9e9aa13ae5d2b9823
hjqjk/python_learn
/Learning_base/main/thread_demo/producer_consumer2.py
UTF-8
1,100
3.046875
3
[]
no_license
#!/usr/bin/env python #_*_ coding:utf-8 _*_ #生产者和消费者模型,还不是很理解 #最大特点:效率高(异步),解耦合 import threading import random import time import Queue def Producer(name,queue): while True: if queue.qsize() < 3: queue.put('包子') print '%s:make a 包子... ----------' %(name,) ...
true
e013aff01f914c5f1a2a4075fda566f2d4a4641e
Hilldrupca/LeetCode
/python/Monthly/Nov2020/tests/test_slidingwindowmaximum.py
UTF-8
1,656
3.1875
3
[]
no_license
import unittest, sys sys.path.append('..') from slidingwindowmaximum import Solution class TestSlidingWindowMaximum(unittest.TestCase): def setUp(self): self.s = Solution() def test_max_sliding_window(self): case_one = {'nums': [1,3,-1,-3,5,3,6,7], 'k': 3} ...
true
f8d1bc4a1c33a41e5418a97e1f1caebb0a022f22
adenizkorkmaz/chatbot-poc
/main.py
UTF-8
1,317
2.796875
3
[]
no_license
from conversation import Conversation from tags import Tag from intents import Intent from footprint import Footprint import yaml def load_data(file): data = None with open(file) as resource: data = yaml.load(resource, Loader=yaml.FullLoader) tags = list(map( lambda t: Tag(t.get('...
true
f9a3a265c5dc580c7de8498cb5bcc1dbc6201733
PGuajardo/python-exercises
/data_types_and_variables.py
UTF-8
2,402
3.859375
4
[]
no_license
#You have rented some movies for your kids: The little mermaid (for 3 days), Brother Bear (for 5 days, # they love it), and Hercules (1 day, you don't know yet if they're going to like it). # If price for a movie per day is 3 dollars, how much will you have to pay? #Movies['little mermaid', 'brother bead', 'hercules...
true
2b7b96ebaaba2534996388adf692fe030245d862
gdobler/cuip
/cuip/variability/Assorted/plot_ternary.py
UTF-8
5,434
2.9375
3
[]
no_license
import ternary import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import MinMaxScaler plt.style.use("ggplot") def color_point(x, y, z, scale): """Dummy function to create heatmap (background).""" val = 225. / 255 return (val, val, val, 1.) def generate_heatmap_data(scale=5): ...
true
f53e19d174c6d6e8e2bf5703d15ad49263c8b4f2
Kawser-nerd/CLCDSA
/Source Codes/CodeJamData/16/12/20.py
UTF-8
332
2.890625
3
[]
no_license
#!/usr/bin/env python import itertools def main(): for t in xrange(1, 1 + int(raw_input())): print 'Case #%d:' % t, N = int(raw_input()) s = set() for _ in xrange(2 * N - 1): a = map(int, raw_input().split()) s ^= set(a) print ' '.join(map(str, sorted(s))) assert len(s) == N if __name__ == '__main_...
true
349e480efe58f8093e12cbf5981c89a4171cc505
jpchiodini/SentimentAnalysis
/SentimentAnalysis/DataClean.py
UTF-8
3,081
2.984375
3
[]
no_license
# import modules necessary for all the following functions import re import pandas as pd from sklearn import preprocessing import json from RAKE import Rake import operator from nltk.corpus import stopwords import string import json as json from datetime import datetime def readJson(filename): """ reads a json...
true
68c80f758cdb07b904e160af29f8482600bfa5e7
emthompson-usgs/strec
/strec/slab.py
UTF-8
6,558
2.578125
3
[ "LicenseRef-scancode-public-domain", "LicenseRef-scancode-public-domain-disclaimer", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
# stdlib imports import os.path import glob # third party imports from mapio.gmt import GMTGrid import numpy as np import pandas as pd MAX_INTERFACE_DEPTH = 70 # depth beyond which any tectonic regime has to be intraslab # Slab 1.0 does not have depth uncertainty, so we make this a constant DEFAULT_DEPTH_ERROR = 10...
true
c65d77c28af1b3969ad40f13da576032f11f7ac4
zhaizhai/syw
/display.py
UTF-8
9,264
2.71875
3
[]
no_license
#!/usr/bin/env python import pygtk pygtk.require('2.0') import gobject import pango import gtk import math import time from gtk import gdk try: import cairo except ImportError: pass if gtk.pygtk_version < (2,3,93): print "PyGtk 2.3.93 or later required" raise SystemExit from core import * from rules...
true
8e124ccc8de1680b62c4546d6077bc52c9cc59a4
alswlsghd320/CycleGAN_Pytorch
/test.py
UTF-8
4,587
2.546875
3
[]
no_license
import argparse import os from PIL import Image import tqdm import torch import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from dataset import ImageDataset from model import Generator parser = argparse.ArgumentParser() parser.add_argument("--...
true
2348f05156bd24dad7085ce71304df5204b93029
avigad/boole
/boole/core/conv.py
UTF-8
5,457
2.90625
3
[ "Apache-2.0" ]
permissive
############################################################################# # # conv.py # # description: Compute and compare normal forms. # # # Authors: # Cody Roux # # ############################################################################## from expr import * import info def head_beta(expr): """Perform...
true
9127f646e2cd7902249495114bb2647baeec4825
Simo0o08/DataScience_Assignment
/Ass-9/2.py
UTF-8
317
3.234375
3
[]
no_license
#3. Convert summer column with appropriate function to number from sklearn.preprocessing import LabelEncoder import pandas as pd le = LabelEncoder() df=pd.read_csv(r"C:\Users\abc\Documents\Training Data science\datasets\weatherHistory.csv") df['Summary']=le.fit_transform(df['Summary']) print(df['Summary'])
true
ae48c017861526d5fd6a4724e40c34a85ecba7b9
AnishHemmady/Data-Struct-Python
/recur_stack.py
UTF-8
792
3.265625
3
[]
no_license
import pdb def insrt_below(stack,ele): pdb.set_trace() if is_chck_empty(stack)==True: push(stack,ele) else: temp=pops(stack) insrt_below(stack,ele) push(stack,temp) def reverse(stack): pdb.set_trace() if is_chck_empty(stack)==False: new=pops(stack) reverse(stack) insrt_below(stack,new) def cre...
true
7287a3fbb6088c7c656b2af2fb20893a5323de17
andrejaana/Semantic-Emotion-Neural-Network
/SENN/evaluate.py
UTF-8
3,511
2.53125
3
[]
no_license
from sklearn.metrics import confusion_matrix from sklearn.metrics import classification_report import numpy as np import pandas as pd from keras.models import load_model from tensorflow.python.keras.preprocessing.sequence import pad_sequences import pickle from sklearn.utils import shuffle def transform_labels(labels...
true
2652152f251f2b5030d95a98ecd0e5916f69afbd
alexdenker/hdc2021_LGD
/deblurrer/model/AnisotropicDiffusion.py
UTF-8
4,364
3.03125
3
[]
no_license
import torch import torch.nn as nn class PeronaMalik(nn.Module): def __init__(self, kappa, option = 2): """ kappa: float Conduction coefficient. ``kappa`` controls conduction as a function of the gradient. If ``kappa`` is low small intensity gradients are able t...
true
ec2579523a1009a5acc34e7bdeb0c91d96bec868
sreejithev/thinkpythonsolutions
/c8/slice.py
UTF-8
101
3.109375
3
[]
no_license
fruit = 'banana' print fruit[0:6] print fruit[:3] print fruit[3:] print fruit[:-1] print fruit[::-1]
true
c19cf8e8471b331cbd4bfd796011a52629be094b
syntaxmonkey/Thesis
/PycharmProjects/geodesic/FilledPolygon.py
UTF-8
1,107
3.28125
3
[]
no_license
from PIL import Image, ImageFont, ImageDraw import numpy as np def genLetter(): boxsize = 100 fontsize = int(boxsize * 0.8) img = Image.new('RGB', (boxsize, boxsize), color=(255, 255, 255)) # get a font character = 'P' font = ImageFont.truetype("/System/Library/Fonts/Keyboard.ttf", fontsize) width, height = ...
true
36166e51d2b1e1dbff16d9229d6bd58cccea7fd6
prem-jeet/data-structure-and-algorithm
/Data structure/Linked List/circular_link_list/python/circularLL.py
UTF-8
3,367
4.125
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.next = None class circularLL: def __init__(self): self.head = None self.count = 0 # METHOD TO INSERT AT BEGINNING def insert_at_beginning(self, data): new_node = Node(data) new_node.next = new_...
true
f034bbb026b943311eedf981fc5ef37ee76d7154
samuela/e-stops
/research/estop/frozenlake/run_value_iteration.py
UTF-8
4,741
2.59375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from research.estop.frozenlake import frozenlake from research.estop.frozenlake import viz def build_env(lake: frozenlake.Lake): # return frozenlake.FrozenLakeEnv(lake, infinite_time=False) return frozenlake.FrozenLakeWithEscapingEnv(lake, ...
true
63e8d1e6a223a92384adeb68d08ab4af474d71d5
jakelorah/highschoolprojects
/Senior(2018-2019)/Python/Chapter 5/mystery.py
UTF-8
261
3.703125
4
[]
no_license
#Name: Jake Lorah #Date: 11/13/2018 #Program Name: mystery.py y = 8 def main() : x = 4 x = mystery(x + 1) print(x) def mystery(x) : s = 0 for i in range(x) : x = i + 1 s = s + x return s main()
true
1d8e6522f31c541aea1d785aa5fd9d9f76496d2d
crisfelip/programacion1
/clases/ciclofor.py
UTF-8
1,841
3.84375
4
[]
no_license
for iteracion in range (10): print (iteracion) print ('#'*60) #se ven los numeros desde el 0 al 9 for iteracion in range (10): print (iteracion+1) print ('#'*60) # se ven los numeros del 1 al 10 for iteracion in range (1,11): print(iteracion) print ('#'*60) #se ven del 1 al 10 for iteracion in range (1,1...
true
49beb02aecdd5282b0d3904410ef9ee6fb5d0067
elemaryo/Leetcode-problems
/missing letter.py
UTF-8
266
3.046875
3
[]
no_license
import math import os import random import re import sys def missing(s,t): ans = "" for letter in s: #O(n) if letter not in t: #O(1) ans += letter for letter in ans: #O(n) print(letter) missing("abcde", "abce")
true
e03ad3c1f4706052a94c85289c261e1d96279799
nesl/Nurture-UbiTtention18
/agent/base_agent.py
UTF-8
4,576
3.046875
3
[ "BSD-3-Clause" ]
permissive
from constant import * from human_modeling_utils import utils class BaseAgent: """ There are two operating modes for an agent. The first is iteractive operating mode, which follows a standard state-action-reward sequence. It can be used in on-policy learning. The second mode is batch operating mode. ...
true
f63ab6d38ba642c2f3bcc006d2fb06151515d9ad
sathish0706/guvi-codekata
/Array/55.py
UTF-8
140
3.40625
3
[]
no_license
n = input() odd = "" even = "" for i in range(len(n)): if i % 2 == 0: even += n[i] else: odd += n[i] print(even,odd)
true
e87e46c4e013c3b4b4a0e642d6f39e3eb1d24980
lavesh11/4-4-TicTacToe
/game.py
UTF-8
3,240
3.34375
3
[ "MIT" ]
permissive
import random import time import sys EMPTY = 0 PLAYER_X = 1 PLAYER_O = 2 DRAW = 3 BOARD_FORMAT = "-----------------------------------------\n| {0} | {1} | {2} | {3} |\n|---------------------------------------|\n| {4} | {5} | {6} | {7} |" \ "\n|---------------------------------------|\n| {8} | {9} | {10...
true
f454897ff0805e5585b41df7520197d405020b0d
shweta4377/GNEAPY19
/venv/Session3A.py
UTF-8
1,076
3.78125
4
[]
no_license
""" billAmount = float(input("Please Enter Amount: ")) # GST@18% needs to be calculated tax = billAmount * (18/100) print("For {} amount taxes are {}".format(billAmount, tax)) print() billAmount = float(input("Please Enter Amount: ")) # GST@18% needs to be calculated tax = billAmount * (18/100) print("For {} amount t...
true
4fef004fc140a99882a1932022958b63b98550a9
vta/Employee-Resource-Guide
/deguide.py
UTF-8
5,072
2.859375
3
[]
no_license
#!/usr/bin/python # -*- coding: latin-1 -*- import sys, os from os.path import relpath import shutil, errno import json sys.path.append('libs') import markdown RESOURCES_DIR = None def build_page(item, out_dir): p_name = str('None' if item['name'] is None else item['name']) rel_path = os.path.join(out_dir,...
true
793dc6605442947c307538c0b98a81cd935f5759
Sudhakaran7/missingKthElement
/Kthelement.py
UTF-8
499
2.84375
3
[]
no_license
class Solution: def findKthPositive(self, arr,k) -> int: if not arr: return 1 if k>arr[-1]: return k+len(arr) i=1 arr=set(arr) cur=-1 while i<=3000 and k>0: if i in arr: i+=1 else: cur...
true
45fb84862d722c545c9ddb4c21e670ce5798b500
mohandutt134/mongorm
/mongorm/base.py
UTF-8
15,172
2.578125
3
[ "Apache-2.0" ]
permissive
import re import pymongo import datetime from .errors import ORMException from .meta import ModelMeta, DbDictClass, ModelDefinition from .datatypes import ObjectId, ID, Boolean, DataType, List, Dict class ModelBase(ModelDefinition): __baseclass__ = True __metaclass__ = ModelMeta _id = ID(nullable=False)...
true
19ec6387a2a3246f3837f3b3e36164c1d80fc686
jennings1716/deep_learning
/hot-word-detector/Run keras model in ML Engine/trainer/hotword_with_keras.py
UTF-8
3,396
2.59375
3
[]
no_license
from keras.callbacks import ModelCheckpoint from keras.models import Model, load_model, Sequential from keras.layers import Dense, Activation, Dropout, Input, Masking, TimeDistributed, LSTM, Conv1D from keras.layers import GRU, Bidirectional, BatchNormalization, Reshape from keras.optimizers import Adam import numpy as...
true
0aa83284bd4694deab0095cb4fbd5ca3dfd4d721
AlexisEidelman/Insalubrite
/insalubrite/Sarah/date_de_l_affaire.py
UTF-8
1,466
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Quelle date de l'affaire conserver? """ import os import pandas as pd from insalubrite.Sarah.read import read_table hyg = read_table('affhygiene') cr = read_table('cr_visite') hyg = hyg[hyg.affaire_id.isin(cr.affaire_id)] cr.date.value_counts(dropna=False) len(cr) cr.date_creation.value...
true
88aeb4670bb77d75e80c4b73b9998244d1b548bb
hubo00/2nd-Year-Project
/Tests/testshubert/webDriver/test_Categories.py
UTF-8
5,728
3
3
[]
no_license
""" Hubert Bukowski | x00161897 2nd Year Project | PlantOasis eCommerce store Categories page tests """ import time from selenium import webdriver from selenium.webdriver.common.keys import Keys DRIVER_PATTERNS = [ (webdriver.Chrome("D:\\Selenium\\Drivers\\chromedriver.exe")), (webdriver.Edge("D:\\Selenium\\D...
true