repo_name stringlengths 8 108 | branch_name stringclasses 34
values | path stringlengths 5 188 | content stringlengths 17 814k | context stringlengths 12 9.58M | import_relationships dict |
|---|---|---|---|---|---|
06milena/Parcial-1 | refs/heads/main | /menu.py |
from usuarios.crear_usuario import crear
def menuPrincipal():
opcion=1
while opcion !=0:
print('---------------------------------')
print(' Menu')
print('1. Registrar')
print('2. Iniciar sesion')
print('3. Salir')
opcion = int(input('SELECCIONE UNA O... | from config.db import DB
import re
def crearUsuario(nombre, email, contrasena):
cursor = DB.cursor()
cursor.execute('''insert into
usuarios(nombre, email, contrasena)
values(%s, %s, %s)''', (
nombre,
email,
contrasena,
))
DB.commit()
print... | {
"imports": [
"/usuarios/crear_usuario.py"
]
} |
07akshay/YouLoader | refs/heads/main | /__init__.py | import cv2
import numpy as np
from tkinter import *
import tkinter.font
from tkinter import messagebox
from tkinter import filedialog
from pytube import YouTube
from PIL import ImageTk,Image
from bs4 import BeautifulSoup
from datetime import date
from googlesearch import search
import csv
import time, vlc
import pandas... | def browse():
root.filename = filedialog.askopenfilename(initialdir="/home/akshay",title = "select a file",filetypes=[("mp4","*.mp4")])
res = messagebox.askquestion("Confirmation","Do you want to play it??")
if res =="yes":
video(root.filename)
--- FILE SEPARATOR ---
def Down(name):
links =[]
... | {
"imports": [
"/browse.py",
"/src.py",
"/speech.py",
"/database.py",
"/photoapp.py"
]
} |
0810nitesh/CRUD | refs/heads/master | /todolist.py | from tkinter import Tk, Scrollbar, Button,Label, Listbox,StringVar,Entry ,W,E,N,S, END
from tkinter import ttk
from tkinter import messagebox
import psycopg2 as psy
from db import dbcon
con=psy.connect(**dbcon)
print(con)
cursor=con.cursor()
class todoapp():
def __init__(self):
self.con=psy.connect(**dbcon)
se... | dbcon={
'user':'postgres',
'password':"Password_of_database",
'host':"localhost",
'database':'name_of_database',
'port':"5432"
}
| {
"imports": [
"/db.py"
]
} |
091karan/share-your-project | refs/heads/development | /products/admin.py | from django.contrib import admin
from .models import Product,Comment
admin.site.register(Product)
admin.site.register(Comment)
| from django.db import models
from django.contrib.auth.models import User
from accounts.models import Profile
class Product(models.Model):
title = models.CharField(max_length=255)
url = models.TextField()
pub_date = models.DateTimeField()
count = models.IntegerField(default=1)
image = models.ImageFi... | {
"imports": [
"/products/models.py"
]
} |
091karan/share-your-project | refs/heads/development | /products/models.py | from django.db import models
from django.contrib.auth.models import User
from accounts.models import Profile
class Product(models.Model):
title = models.CharField(max_length=255)
url = models.TextField()
pub_date = models.DateTimeField()
count = models.IntegerField(default=1)
image = models.ImageFi... | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
photo = models.ImageField(upload_to='images/',null=True)
birt... | {
"imports": [
"/accounts/models.py"
]
} |
091karan/share-your-project | refs/heads/development | /accounts/views.py | from django.shortcuts import render
from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from django.contrib import auth
from .models import Profile
def signup(request):
if request.method == 'POST':
# User has info and wants an account now!
if request.POST['pas... | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
photo = models.ImageField(upload_to='images/',null=True)
birt... | {
"imports": [
"/accounts/models.py"
]
} |
0Ndev/cheatsheets-webdev | refs/heads/master | /basic_app/admin.py | from django.contrib import admin
from basic_app.models import Category, Cheatsheet
# Register your models here.
admin.site.register(Category)
admin.site.register(Cheatsheet)
| from django.db import models
class Category(models.Model):
title = models.CharField(max_length=50)
def __str__(self):
return self.title
class Meta:
verbose_name = "Category"
verbose_name_plural = "Categories"
class Cheatsheet(models.Model):
title = models.CharField(max_leng... | {
"imports": [
"/basic_app/models.py"
]
} |
0Ndev/cheatsheets-webdev | refs/heads/master | /basic_app/views.py | from django.shortcuts import render
from .models import Cheatsheet
def index(req):
return render(req, 'index.html')
def cheatsheets(req):
cheatsheets = Cheatsheet.objects
return render(req, 'cheatsheets.html', {'cheatsheets': cheatsheets})
| from django.db import models
class Category(models.Model):
title = models.CharField(max_length=50)
def __str__(self):
return self.title
class Meta:
verbose_name = "Category"
verbose_name_plural = "Categories"
class Cheatsheet(models.Model):
title = models.CharField(max_leng... | {
"imports": [
"/basic_app/models.py"
]
} |
0h-n0/bioplot | refs/heads/master | /bioplot/__init__.py | __version__ = "0.0.2"
from .bioplot import Bioplot
| import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import cm
one_letter_to_three_letter = {
'A' : 'ALA',
'R' : 'ARG',
'N' : 'ASN',
'D' : 'ASP',
'B' : 'ASX',
'C' : 'CYS',
'E' : 'GLU',
'Q' : 'GLN',
'Z' : 'GLX',
'G' : 'GLY',
'H' : 'HIS',... | {
"imports": [
"/bioplot/bioplot.py"
]
} |
0h-n0/pybiodata | refs/heads/master | /pybiodata/entry_point.py | #!/usr/bin/env python
import sys
from .base import AbstractDatabase
from .pdb import PDB
def main():
try:
assert len(sys.argv) > 1
dbname = sys.argv[1]
assert dbname in ['PDB',]
except AssertionError:
parser = AbstractDatabase.set_command_arguments()
print(parser.prin... |
class AbstractDatabase:
description = ('pybiodata')
def __init__(self):
pass
@classmethod
def set_command_arguments(cls):
import argparse
parser = argparse.ArgumentParser(description=cls.description)
parser.add_argument('database', choices=['PDB',], help='set database')... | {
"imports": [
"/pybiodata/base.py",
"/pybiodata/pdb.py"
]
} |
0h-n0/pybiodata | refs/heads/master | /pybiodata/pdb.py | import requests
from .base import AbstractDatabase
from .database_urls import PDB_REST_URL, PDB_DOWNLOAD_URL
class PDB(AbstractDatabase):
def __init__(self, parser):
self.args = vars(parser.parse_args())
def run(self):
pdb_id = self.args['id']
filename = f'{pdb_id}.pdb'
with ... |
class AbstractDatabase:
description = ('pybiodata')
def __init__(self):
pass
@classmethod
def set_command_arguments(cls):
import argparse
parser = argparse.ArgumentParser(description=cls.description)
parser.add_argument('database', choices=['PDB',], help='set database')... | {
"imports": [
"/pybiodata/base.py",
"/pybiodata/database_urls.py"
]
} |
0sh/learning | refs/heads/master | /importtest.py | #import testing
import printouts
printouts.longsword_printout()
| #printouts are a item portrait that will be printed on item pickups or equips.
def longsword_printout():
print(" /\ ")
print(" ||")
print(" ||")
print(" ||")
print(" ||")
print(" ||")
print(" ||")
print(" ||")
print(" ||")
print("(==)")
print(" []")
print(" []")
print... | {
"imports": [
"/printouts.py"
]
} |
0x11111111/PyAutoPlay | refs/heads/main | /pap_win32.py | # -*- coding:utf-8 -*-
import base64
import ctypes
import datetime
import os
import re
import sys
import time
from io import BytesIO, TextIOWrapper
import pyscreeze
import win32api
import win32con
import win32gui
import win32ui
from PIL import Image
from .utils import PAGException
from typing import Union, Optional, A... | # -*- coding:utf-8 -*-
class PAPException(Exception):
"""PyAutoPlay Exception"""
class PAP_ImageNotFound(PAPException):
"""PyAutoPlay image not found exception""" | {
"imports": [
"/utils.py"
]
} |
0x11111111/PyAutoPlay | refs/heads/main | /deprecated/main_old.py | __version__ = '0.2.1'
from deprecated import deprecated
import platform
import time
# from matplotlib import pyplot as plt
from demo.arknights_assistant import Arknights
@deprecated(version='0.2.1', reason='The classes used have been merged into adb.py_auto_play')
def main():
template_name = Arknights.templat... |
class Arknights:
template_name = ['start.png', 'mission_start.png', 'under_control.png', 'brief.png', 'results.png']
precondition = [{'event': 'start.png', 'precondition': 'auto_deploy_on.png', 'warning': 'Auto deployed is '
... | {
"imports": [
"/demo/arknights_assistant.py"
]
} |
0x11111111/PyAutoPlay | refs/heads/main | /demo/main.py | import os
import time
import sys
import re
import logging
from arknights_assistant import Arknights
from pap_adb import PyAutoPlay_adb
__version__ = '0.4.2'
def main():
print('初始化中。请稍等。')
working_path = os.path.dirname(os.path.abspath(__file__))
adb_path = working_path + '\\adb.exe'
template_name = ... | import os
import time
import logging
from PIL import Image
import cv2
import numpy as np
from typing import Union, Optional
logger = logging.getLogger('py_auto_play_adb_main')
class PyAutoPlay_adb():
"""This is the main class of PyAutoPlay containing most of the utilities interacting with window content and user.... | {
"imports": [
"/pap_adb.py"
]
} |
0x11111111/PyAutoPlay | refs/heads/main | /__init__.py | from .pap_adb import PyAutoPlay_adb
from .pap_win32 import PyAutoPlay_win32
__all__=['PyAutoPlay_adb', 'PyAutoPlay_win32'] | import os
import time
import logging
from PIL import Image
import cv2
import numpy as np
from typing import Union, Optional
logger = logging.getLogger('py_auto_play_adb_main')
class PyAutoPlay_adb():
"""This is the main class of PyAutoPlay containing most of the utilities interacting with window content and user.... | {
"imports": [
"/pap_adb.py",
"/pap_win32.py"
]
} |
0x17/SP-Simulation | refs/heads/master | /main.py | import simulation
import evaluation
import helpers
#import mipmodel
n_tries = 1000
def run_2d_plot():
# sim = simulation.TwoClassSimulation('data.json')
sim = simulation.TwoClassSimulation('data_normalized.json')
evl = evaluation.Evaluator(sim)
res = evl.collect_results(n_tries)
evl.export_results_2d(res, 'simul... | import json
from sympy.ntheory import residue_ntheory
import helpers
import random
import math
class AbstractSimulation:
def __init__(self, data_fn):
obj = json.loads(helpers.slurp(data_fn))
self.customers = tuple(map(lambda client: helpers.ObjectFromJson(**client), obj['clients']))
self.C = obj['capacity']
... | {
"imports": [
"/simulation.py",
"/evaluation.py",
"/helpers.py"
]
} |
0x17/SP-Simulation | refs/heads/master | /evaluation.py | import helpers
from openpyxl import Workbook
from openpyxl.formatting.rule import ColorScaleRule
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import math
class Evaluator:
def __init__(self, sim):
self.sim = sim
def collect_results(self, n_tries)... | import random
import math
import scipy.stats
class ObjectFromJson:
def __init__(self, **entries):
self.__dict__.update(entries)
def slurp(fn):
with open(fn) as f:
return f.read()
def pick_rand_std_normal():
u1 = random.uniform(0, 1)
u2 = random.uniform(0, 1)
return math.sqrt(-2.0 * math.log(u1)) * math.sin(... | {
"imports": [
"/helpers.py"
]
} |
0x17/SP-Simulation | refs/heads/master | /multistage.py | import boxplots
import numpy as np
import matplotlib.pyplot as plt
obj = boxplots.json_from_file('multistage_data.json')
nscen = 150
demand_scenarios = [ [ np.random.poisson(client['expD']) for s in range(nscen) ] for client in obj['clients'] ]
#consumption_scenarios = ...
for ds in demand_scenarios:
plt.hist(d... | import matplotlib.pyplot as plt
import json
import numpy as np
import itertools
import sys
def json_from_file(fn):
with open(fn, 'r') as fp:
return json.load(fp)
def parse_scenarios(fn):
data = json_from_file(fn)
return { data['header'][1+i]: [ int(row[1+i]) for row in data['rows'] ] for i in rang... | {
"imports": [
"/boxplots.py"
]
} |
0x17/SP-Simulation | refs/heads/master | /omegazero.py | import random
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import numpy as np
import visalphapsi
S = 25
random.seed(23)
scenarios = [ random.randint(0, 50) for s in range(S) ]
alpha = 0.8
num_worst = round(S * (1-alpha))
worst = sorted(scenarios)[:num_worst]
olists = {}
def C... | import json
import os
import sys
from collections import OrderedDict
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
def plot_coords_from_entries(entries):
frequencies = {}
for entry in entries:
frequencies[entry] = 1 if entry not in frequencies... | {
"imports": [
"/visalphapsi.py"
]
} |
0x17/SP-Simulation | refs/heads/master | /simulation.py | import json
from sympy.ntheory import residue_ntheory
import helpers
import random
import math
class AbstractSimulation:
def __init__(self, data_fn):
obj = json.loads(helpers.slurp(data_fn))
self.customers = tuple(map(lambda client: helpers.ObjectFromJson(**client), obj['clients']))
self.C = obj['capacity']
... | import random
import math
import scipy.stats
class ObjectFromJson:
def __init__(self, **entries):
self.__dict__.update(entries)
def slurp(fn):
with open(fn) as f:
return f.read()
def pick_rand_std_normal():
u1 = random.uniform(0, 1)
u2 = random.uniform(0, 1)
return math.sqrt(-2.0 * math.log(u1)) * math.sin(... | {
"imports": [
"/helpers.py"
]
} |
0x21/ShodanoptikBaskulerScanner | refs/heads/master | /apiexample.py | import api
api_key = ":D"
query = "your Shodan search Query"
try:
liste = api.shodanapi(api_key,query)
j = 0
for i in liste:
print(i)
j = j+1
print(j)
except:
pass | import requests
import json
def Remove(duplicate):
final_list = []
for num in duplicate:
if num not in final_list:
final_list.append(num)
return final_list
def shodanapi(api_key,query):
api_url = "https://api.shodan.io/shodan/host/search?key="+api_key+"&query="... | {
"imports": [
"/api.py"
]
} |
0xf10413/pyEquilibrium | refs/heads/master | /game/boarditems.py | #!/usr/bin/env python3
from math import sin, cos, pi, hypot, atan2
import numpy as np
import pygame as pg
from settings import (
HIGH_BALL_RADIUS,
LOW_BALL_ELASTICITY,
LOW_BAR_SIZE,
WINDOW_WIDTH,
WINDOW_HEIGHT,
GRAVITY,
WHITE,
RED,
LOW_BALL_RADIU... | #!/usr/bin/env python3
"""
Options générales pour le programme
"""
##############################
## Options d'algo génétique ##
##############################
# Algo génétique : accélération de l'algorithme en évitant le rendu à < 25fps ?
WITH_FASTER = True
# Algo génétique : teste-t-on les éléments conservés de la... | {
"imports": [
"/settings.py"
]
} |
0xf10413/pyEquilibrium | refs/heads/master | /ddpg/Algorithm.py | #!/usr/bin/env python3
# import pour DQL
import numpy as np
import random
import timeit
import tensorflow as tf
from keras.models import model_from_json, Model
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.engine.topology import Merge
from keras.engi... | #!/usr/bin/env python3
class LearningAlgorithm(object):
"""
Classe de base pour les algorithmes d'apprentissage
"""
def act(self, X, delta_t):
"""
Un tick de l'algorithme, étant donné l'input X et l'écart de temps
depuis le dernier appel delta_t
"""
raise NotImple... | {
"imports": [
"/game/learning_algorithm.py",
"/ddpg/CriticNetwork.py"
]
} |
0xf10413/pyEquilibrium | refs/heads/master | /game/application.py | #!/usr/bin/env python3
from math import pi
import pygame as pg
from pygame.locals import DOUBLEBUF
import numpy as np
from .board import Board
from .learning_algorithm import LearningAlgorithm, DummyLearningAlgorithm
from .boarditems import HighBar, LowBar, HighBall, LowBall, GameOverException
from settings import ... | #!/usr/bin/env python3
from __future__ import division
from math import pi
import pygame as pg
from pygame.locals import DOUBLEBUF
import numpy as np
from .boarditems import HighBar, LowBar, HighBall, LowBall, GameOverException
from settings import (
WINDOW_HEIGHT,
WINDOW_WIDTH,
WINDOW_SIZE,
... | {
"imports": [
"/game/board.py",
"/game/learning_algorithm.py",
"/game/boarditems.py",
"/settings.py"
]
} |
0xf10413/pyEquilibrium | refs/heads/master | /genetics/genetics.py | #!/usr/bin/env python3
import numpy as np
import operator
import copy
from random import uniform,choice
from game.application import LearningAlgorithm
from settings import (
POPULATION_SIZE,
NUM_PARAMETERS,
RAND_MIN,
RAND_MAX,
MAX_GENERATION,
REF_VECTOR,
MUTATIO... | #!/usr/bin/env python3
from math import pi
import pygame as pg
from pygame.locals import DOUBLEBUF
import numpy as np
from .board import Board
from .learning_algorithm import LearningAlgorithm, DummyLearningAlgorithm
from .boarditems import HighBar, LowBar, HighBall, LowBall, GameOverException
from settings import ... | {
"imports": [
"/game/application.py",
"/settings.py"
]
} |
0xf10413/pyEquilibrium | refs/heads/master | /neat_nn/neat_nn.py | #!/usr/bin/env python3
import numpy as np
import operator
import copy
from random import uniform,choice
import neat
from game.application import LearningAlgorithm
class NEATAlgorithm(LearningAlgorithm):
def __init__(self):
# Configuration
self.config = neat.Config(
neat.DefaultGen... | #!/usr/bin/env python3
from math import pi
import pygame as pg
from pygame.locals import DOUBLEBUF
import numpy as np
from .board import Board
from .learning_algorithm import LearningAlgorithm, DummyLearningAlgorithm
from .boarditems import HighBar, LowBar, HighBall, LowBall, GameOverException
from settings import ... | {
"imports": [
"/game/application.py"
]
} |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5