max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
setup.py | ELC/testnbdev | 1 | 12000 | <reponame>ELC/testnbdev<filename>setup.py
from pkg_resources import parse_version
from configparser import ConfigParser
import setuptools
assert parse_version(setuptools.__version__)>=parse_version('36.2')
# note: all settings are in settings.ini; edit there, not here
config = ConfigParser(delimiters=['='])
config.rea... | 2.359375 | 2 |
amaascore/tools/generate_party.py | amaas-fintech/amaas-core-sdk-python | 0 | 12001 | <reponame>amaas-fintech/amaas-core-sdk-python<filename>amaascore/tools/generate_party.py
from __future__ import absolute_import, division, print_function, unicode_literals
from amaasutils.random_utils import random_string, random_decimal
import random
from amaascore.core.reference import Reference
from amaascore.part... | 2.0625 | 2 |
fitgrid/utils/lmer.py | vishalbelsare/fitgrid | 10 | 12002 | # -*- coding: utf-8 -*-
"""User functions to streamline working with selected pymer4 LMER fit
attributes from lme4::lmer and lmerTest for ``fitgrid.lmer`` grids.
"""
import functools
import re
import warnings
import numpy as np
import pandas as pd
import matplotlib as mpl
from matplotlib import pyplot as plt
import f... | 2.765625 | 3 |
pyesasky/jupyter_server.py | pierfra-ro/pyesasky | 13 | 12003 | <reponame>pierfra-ro/pyesasky<filename>pyesasky/jupyter_server.py
import os
import json
from hashlib import md5
from tornado import web
from notebook.utils import url_path_join
from notebook.base.handlers import IPythonHandler
__all__ = ['load_jupyter_server_extension']
STATIC_DIR = os.path.join(os.path.dirname(__fil... | 2.390625 | 2 |
pingpongskill/pingpongskill.py | Garvys/PingPongSkill | 1 | 12004 | <filename>pingpongskill/pingpongskill.py<gh_stars>1-10
# -*-: coding utf-8 -*-
""" Skeleton Snips skill. """
import re
import json
import os
import datetime
from text2num import text2num
from collections import defaultdict
FORMAT = '%Y.%m.%dT%H:%M:%S'
class PingPongSkill(object):
""" Skeleton Snips skill. """
... | 3.21875 | 3 |
xarray/backends/npy_io.py | martinResearch/xarray | 0 | 12005 | <filename>xarray/backends/npy_io.py
import numpy as np
import xarray as xr
import pandas as pd
import sys
import json
import os
import datetime
from xarray.core.utils import (
decode_numpy_dict_values,
either_dict_or_kwargs,
ensure_us_time_resolution,
)
from numpy.compat import (
asbytes, asstr, asun... | 2.453125 | 2 |
applications/popart/bert/bert_data/squad_dataset.py | Alwaysproblem/examples-1 | 0 | 12006 | # Copyright (c) 2019 Graphcore Ltd. 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 by applicable l... | 1.953125 | 2 |
utils.py | sWizad/HashNeRF-pytorch | 0 | 12007 | import json
import numpy as np
import pdb
import torch
from ray_utils import get_rays, get_ray_directions, get_ndc_rays
BOX_OFFSETS = torch.tensor([[[i,j,k] for i in [0, 1] for j in [0, 1] for k in [0, 1]]],
device='cuda')
SQR_OFFSETS = torch.tensor([[[i,j] for i in [0, 1] for j in [0,... | 2.1875 | 2 |
eval.py | dawnchen123/VS-Net | 55 | 12008 | import os
import cv2
import time
import json
import random
import inspect
import argparse
import numpy as np
from tqdm import tqdm
from dataloaders import make_data_loader
from models.sync_batchnorm.replicate import patch_replication_callback
from models.vs_net import *
from utils.loss import loss_dict
from utils.lr_s... | 1.828125 | 2 |
data/__init__.py | Joaomlg/multilayer-perceptron-mnist | 13 | 12009 | import numpy as np
import gzip
import pickle
import os
import urllib.request
class MNIST:
host = 'http://yann.lecun.com/exdb/mnist/'
filenames = {
'train': ('train-images-idx3-ubyte.gz', 'train-labels-idx1-ubyte.gz'),
'test': ('t10k-images-idx3-ubyte.gz', 't10k-labels-idx1-ubyte.gz'),
}
dataset_filen... | 2.859375 | 3 |
Exemple.py | LVWolff/Python_Lesson_2 | 0 | 12010 | #Задачи на циклы и оператор условия------
#----------------------------------------
'''
Задача 1
Вывести на экран циклом пять строк из нулей, причем каждая строка должна быть пронумерована.
'''
for i in range(1, 6):
print(i, '0000000000000000000000000000000000000000000')
'''
Задача 2
Пользователь в цикле вводит 1... | 3.609375 | 4 |
push_exp/main_CrouchSimulationForCOT.py | snumrl/DeepPushRecovery | 0 | 12011 | import os
import numpy as np
import time
import multiprocessing as mp
import csv
import socket
import datetime
import math
import glob
from pypushexp import PushSim
# # input - [recorded item]
# [weight] : 48
# [height] : 160
# [crouch_angle] (deg)
# [step_length_ratio]
# [halfcycle_duration_rati... | 2.203125 | 2 |
lepiota/lepiota/urls.py | sgelias/lepiota | 0 | 12012 | <reponame>sgelias/lepiota
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, re_path
from django.conf.urls import include
from django.views.generic import TemplateView, RedirectView
urlpatterns = [
# Administration
path('... | 1.859375 | 2 |
src/base/admin.py | dhavall13/Decode | 0 | 12013 | from django.contrib import admin
from .models import Room, Topic, Message, User
admin.site.register(Room)
admin.site.register(Topic)
admin.site.register(Message)
admin.site.register(User)
| 1.445313 | 1 |
gorilla/config/_config.py | sunjiahao1999/gorilla-core | 4 | 12014 | <filename>gorilla/config/_config.py<gh_stars>1-10
# Copyright (c) Open-MMLab. All rights reserved.
import os
import json
import tempfile
import warnings
from typing import Optional
from argparse import Namespace
from addict import Dict
from ..utils import check_file
BASE_KEY = "_base_"
RESERVED_KEYS = ["filename", "... | 2.6875 | 3 |
Kaspa/modules/extension_modules/spotify_module/spotifyModuleEn.py | karim-awad/kaspa | 0 | 12015 | <filename>Kaspa/modules/extension_modules/spotify_module/spotifyModuleEn.py
from Kaspa.modules.abstract_modules.abstractSubmodule import AbstractSubmodule
from Kaspa.modules.exceptions.impossibleActionError import ImpossibleActionError
from Kaspa.config import Config
class SpotifyModuleEn(AbstractSubmodule):
modu... | 2.1875 | 2 |
screenshot-server/app/main.py | martindines/ScreenshotServer | 1 | 12016 | <reponame>martindines/ScreenshotServer
import os
import sys
import pathlib
from utilities import get_random_hash
from flask import Flask, flash, request, redirect, url_for, send_from_directory, jsonify, Response
UPLOAD_FOLDER = os.environ.get('UPLOAD_FOLDER') if os.environ.get('UPLOAD_FOLDER') else '/tmp'
ALLOWED_EXTE... | 2.5 | 2 |
src/waldur_mastermind/notifications/migrations/0002_json_field.py | opennode/nodeconductor-assembly-waldur | 2 | 12017 | <reponame>opennode/nodeconductor-assembly-waldur
# Generated by Django 3.2 on 2022-01-31 14:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('notifications', '0001_initial'),
]
operations = [
migrations.AlterField(
model_na... | 1.367188 | 1 |
gitgoggles/utils.py | nowells/git-goggles | 13 | 12018 | <reponame>nowells/git-goggles
import copy
import subprocess
import sys
import unicodedata
def disable_colored_func(text, *args, **kwargs):
return text
try:
from termcolor import colored as colored_func
except ImportError:
print 'You should run "pip install termcolor" to fully utilize these utilities.'
... | 2.578125 | 3 |
test/unit/tools/test_basisconstructors.py | colibri-coruscans/pyGSTi | 73 | 12019 | <filename>test/unit/tools/test_basisconstructors.py
import numpy as np
import pygsti.baseobjs.basisconstructors as bc
from ..util import BaseCase
class BasisConstructorsTester(BaseCase):
def test_GellMann(self):
id2x2 = np.array([[1, 0], [0, 1]])
sigmax = np.array([[0, 1], [1, 0]])
sigmay... | 2.5625 | 3 |
tensorflow/contrib/training/python/training/hparam_test.py | DEVESHTARASIA/tensorflow | 384 | 12020 | # Copyright 2016 The TensorFlow Authors. 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 by applica... | 2.328125 | 2 |
CodigoSOLID.py | JhonGalarza/SOLID | 0 | 12021 | <filename>CodigoSOLID.py
#DATOS DE ENTRADA
ANIMAL= int(input("¿De cual animal quiere conocer la caracteristicas? 1.Leon 2.Ballena 3.Tucan? "))
class Animal:
def __init__(self, ANIMAL):
self.ANIMAL = ANIMAL
def acciones_comun():
comun = "Comer"
return comun
def sentido_v... | 4.09375 | 4 |
orca/topology/infra/k8s/__init__.py | filwie/orca | 0 | 12022 | <gh_stars>0
# Copyright 2020 OpenRCA Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 1.546875 | 2 |
thelma/repositories/rdb/view.py | fogathmann/TheLMA | 1 | 12023 | """
This file is part of the TheLMA (THe Laboratory Management Application) project.
See LICENSE.txt for licensing, CONTRIBUTORS.txt for contributor information.
Utilities to create/drop views.
Based on a recipe published in:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views
"""
from sqlalchemy.sql import table... | 2.25 | 2 |
msblog/models.py | designermanjeets/mscreativepixel | 0 | 12024 | <reponame>designermanjeets/mscreativepixel
from django.db import models
from datetime import datetime
import string, random
import uuid
# Create your models here.
class HeaderNavs(models.Model):
title = models.CharField(max_length = 50)
url = models.CharField(max_length = 50)
def __str__(self):
... | 2.65625 | 3 |
Practical/Easy/HSV color wheel/colorwheel.py | saintwithataint/Pro-g-rammingChallenges4 | 1 | 12025 | <filename>Practical/Easy/HSV color wheel/colorwheel.py
import colour
import matplotlib.pyplot as plt
import numpy as np
COLOUR_STYLE = colour.plotting.colour_style()
COLOUR_STYLE.update(
{
"figure.figsize": (11, 11),
"legend.framealpha": colour.plotting.COLOUR_STYLE_CONSTANTS.opacity.low,
}
)
p... | 2.78125 | 3 |
kojen/smgen.py | kohjaen/kojen | 3 | 12026 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'eugene'
'''
MIT License
Copyright (c) 2015 <NAME> (email : <EMAIL>)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Softwa... | 1.484375 | 1 |
roku/discovery.py | metagrapher/python-roku | 0 | 12027 | <reponame>metagrapher/python-roku<filename>roku/discovery.py
"""
Code adapted from <NAME>.
https://gist.github.com/dankrause/6000248
http://github.com/dankrause
"""
import socket
from http.client import HTTPResponse
from io import BytesIO
ST_DIAL = 'urn:dial-multiscreen-org:service:dial:1'
ST_ECP = 'roku:ecp'
class ... | 2.484375 | 2 |
Approxilyzer/gem5/scripts/relyzer/run_gem5_gl.py | cornell-zhang/GLAIVE | 10 | 12028 | <reponame>cornell-zhang/GLAIVE<filename>Approxilyzer/gem5/scripts/relyzer/run_gem5_gl.py
import os, sys
from argparse import ArgumentParser
from datetime import datetime as dt
from pprint import pprint as pp
import shutil, glob
#from pyfiglet import figlet_format, Figlet
import datetime
'''
python run_gem5_gl.py -a ra... | 2.15625 | 2 |
onnxsim/__init__.py | Wheest/onnx-simplifier | 1,977 | 12029 | <gh_stars>1000+
from onnxsim.onnx_simplifier import simplify
__version__ = '0.0.0'
| 1.054688 | 1 |
src/commands/__init__.py | lysol/lvlss | 0 | 12030 | <gh_stars>0
from quit import Quit
from set_name import SetName
from who import Who
from say import Say
from look import Look
from go import Go
from take import Take
from inventory import Inventory
from drop import Drop
from make import Make
from landfill import Landfill
from item_info import ItemInfo
from s... | 1.765625 | 2 |
Softmax.py | tranbamanh229289/Machine-and-Data-mining- | 0 | 12031 | <filename>Softmax.py
import Common
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
RATIO = 0.8
EPOCHS = 500
LEARN_RATE = 0.01
INDENTIFICATION_RATE = 0.6
# Read training data
X_train, Y_train, X_test, Y_test,scale_train,scale_test = Common.process(RATIO)
def preprocessing (X_train,Y_train ,X_tes... | 2.9375 | 3 |
Wallpaper change.py | Arbazkhan4712/Wallpaper-Changer-using-Python | 4 | 12032 | <filename>Wallpaper change.py
import ctypes
import os
import time
from pynput.keyboard import Key,Controller
import Bing
def closeTerminal():
keyboard=Controller()
keyboard.press(Key.alt)
keyboard.press(Key.f4)
keyboard.release(Key.alt)
keyboard.release(Key.f4)
def changeWallpaper(image_path):
... | 3.015625 | 3 |
tests/sensitivity/sf2/sf2_test.py | vic-c137/mpi-boids-simulation | 0 | 12033 | <gh_stars>0
# Import statements
import subprocess
from os import system
# Variable declarations
np = "10"
cexe = "./Boids"
nboids = "50"
nloops = "500"
k = "7"
maxv = "10"
acc = "1.25"
width = "1000"
height = "1000"
sf1 = "1"
sf2 = "32"
min = "50"
sf3 = "8"
sf4 = "10"
dataPath = "./data/"
jexe = "Boi... | 1.921875 | 2 |
flask_start/flask_start/public/email.py | kostekci/flask_start | 0 | 12034 | from flask_mail import Message
from flask import render_template
from flask_start.extensions import mail
'''
from threading import Thread
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
'''
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject... | 2.65625 | 3 |
demo/trace_model.py | furkankirac/maskrcnn-benchmark | 0 | 12035 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from __future__ import division
import os
import numpy
from io import BytesIO
from matplotlib import pyplot
import requests
import torch
from PIL import Image
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
from maskrcnn... | 2.25 | 2 |
validation_tests/analytical_exact/river_at_rest_varying_topo_width/numerical_varying_width.py | samcom12/anuga_core | 136 | 12036 | <filename>validation_tests/analytical_exact/river_at_rest_varying_topo_width/numerical_varying_width.py
"""Simple water flow example using ANUGA
Water driven up a linear slope and time varying boundary,
similar to a beach environment
"""
#------------------------------------------------------------------------------
... | 2.09375 | 2 |
src/temperature/urls.py | JohanGovers/home-mon-server | 0 | 12037 | from django.conf.urls import patterns, url
from temperature import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^save_temp_reading$', views.save_temp_reading, name='save_temp_reading'),
)
| 1.703125 | 2 |
FictionTools/amitools/amitools/binfmt/elf/BinFmtELF.py | polluks/Puddle-BuildTools | 38 | 12038 | from amitools.binfmt.BinImage import *
from .ELFFile import *
from .ELF import *
from .ELFReader import ELFReader
from .DwarfDebugLine import DwarfDebugLine
class BinFmtELF:
"""Handle Amiga m68k binaries in ELF format (usually from AROS)"""
def is_image(self, path):
"""check if a given file is a supp... | 2.53125 | 3 |
recordtransform.py | Andresfgomez970/Managing-.wav-files-in-python | 0 | 12039 | <gh_stars>0
import pyaudio
import wave
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pylab as plt
from scipy.io import wavfile
import cmath as cm
from scipy.fftpack import fft
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrF... | 2.46875 | 2 |
AllSidesScraper/allsides.py | Epicrider/polibalance | 0 | 12040 | <filename>AllSidesScraper/allsides.py
from bs4 import BeautifulSoup
import requests
from communityFeedback import *
from time import sleep
from rich.progress import track
import json
page = [
'https://www.allsides.com/media-bias/media-bias-ratings',
]
def table(full_table):
# The main table
print('Web s... | 2.84375 | 3 |
commands/calc.py | periodicaidan/dalton-cli | 2 | 12041 | """
File: commands/calc.py
Purpose: Performs calculations in response to user input, and outputs the result
"""
from sys import argv
import click
from calculator import *
from models import History
from models.Config import Config
from help_menus import calc_help
@click.group("calc", invoke_without_command=True)
@... | 3.40625 | 3 |
aot/meta_triggers/metatrigger_treasure.py | jaycheungchunman/age-of-triggers | 0 | 12042 | <gh_stars>0
from aot import *
from aot.model.trigger import *
from aot.model.condition import *
from aot.model.effect import *
from aot.meta_triggers.metatrigger import MetaTrigger
from aot.model.enums.resource import EnumResource
from aot.model.enums.player import PlayerEnum
from aot.model.enums.unit import UnitConsta... | 2.203125 | 2 |
agent/lm_agent/server_interfaces/lsdyna.py | omnivector-solutions/license-manager | 2 | 12043 | """LS-Dyna license server interface."""
import typing
from lm_agent.config import settings
from lm_agent.exceptions import LicenseManagerBadServerOutput
from lm_agent.parsing import lsdyna
from lm_agent.server_interfaces.license_server_interface import LicenseReportItem, LicenseServerInterface
from lm_agent.server_int... | 2.40625 | 2 |
examples/gan/gan_embeddings.py | ojmakhura/DIGITS | 0 | 12044 | #!/usr/bin/env python3
# Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
import argparse
import os
import pickle
import shutil
import numpy as np
import PIL.Image
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
TB_DIR = os.path.join(os.getcwd(), "gan-tb")
SPRITE_IMA... | 2.21875 | 2 |
punch_version.py | joshua-s/punch | 0 | 12045 | <reponame>joshua-s/punch
major = 1
minor = 4
patch = 5
| 0.785156 | 1 |
17.py | yonghuatang/python | 0 | 12046 | from datetime import date
now = date.today()
print('The date today is', now, now.strftime("%A"))
| 3.765625 | 4 |
pyxtal/miscellaneous/from_ase_molecule.py | ubikpt/PyXtal | 127 | 12047 | <reponame>ubikpt/PyXtal
from pyxtal.molecule import *
from ase.build import molecule
from pymatgen.core import Molecule
def get_ase_mol(molname):
"""convert ase molecule to pymatgen style"""
ase_mol = molecule(molname)
pos = ase_mol.get_positions()
symbols = ase_mol.get_chemical_symbols()
return M... | 2.6875 | 3 |
my_project/evolution_forces.py | Abhigyan-Mishra/Quantum-Animation | 0 | 12048 | from manimlib.imports import *
"""
TODO:
[ ] fix arrow head size
auto scale according to size?
have a default size, but, if the arrow size is too short, then shrink the head
[ ] slide the point according to the gradient
"""
class ParaboloidPlot(SpecialThreeDScene):
CONFIG = {
"three_d_axes_config": {
"num_... | 2.84375 | 3 |
tests/python/tensor_graph/test/test_internal/performance/build_time_resnet.py | QinHan-Erin/AMOS | 22 | 12049 | import tvm
import sys
import time
import numpy as np
from tvm.tensor_graph.testing.models import resnet
from tvm.tensor_graph.core import ForwardGraph, BackwardGraph, compute, \
GraphTensor, GraphOp, PyTIRGraph
from tvm.tensor_graph.nn import CELoss, SGD
from tvm.tensor_graph.core.schedul... | 2.234375 | 2 |
Python3/src/basicExample.py | emanuelen5/XPlaneConnect | 457 | 12050 | <filename>Python3/src/basicExample.py
from time import sleep
import xpc
def ex():
print("X-Plane Connect example script")
print("Setting up simulation")
with xpc.XPlaneConnect() as client:
# Verify connection
try:
# If X-Plane does not respond to the request, a timeout error
... | 3.03125 | 3 |
venv/lib/python3.6/site-packages/pelican/readers.py | RyanHelgoth/CMPUT404-Lab5 | 0 | 12051 | import datetime
import logging
import os
import re
from collections import OrderedDict
from html import escape
from html.parser import HTMLParser
from io import StringIO
import docutils
import docutils.core
import docutils.io
from docutils.parsers.rst.languages import get_language as get_docutils_lang
from docutils.wr... | 2.203125 | 2 |
xmuda/models/CP_v5.py | anhquancao/xmuda-extend | 0 | 12052 | <gh_stars>0
import torch
import torch.nn as nn
import torch.nn.functional as F
from xmuda.models.DDR import Bottleneck3D
from xmuda.models.LMSCNet import SegmentationHead, ASPP
import numpy as np
from xmuda.models.modules import Process, Upsample, Downsample
import math
from xmuda.data.utils.preprocess import create_vo... | 1.867188 | 2 |
gala/potential/potential/tests/helpers.py | ltlancas/gala | 1 | 12053 | # coding: utf-8
from __future__ import division, print_function
# Standard library
import time
# Third-party
import matplotlib.pyplot as plt
import numpy as np
from scipy.misc import derivative
from astropy.extern.six.moves import cPickle as pickle
import pytest
# Project
from ..io import load
from ..core import C... | 2.125 | 2 |
main.py | ailzy/Reinforcement-learning-in-portfolio-management- | 0 | 12054 | # -*- coding: utf-8 -*-
from argparse import ArgumentParser
import json
import time
import pandas as pd
import tensorflow as tf
import numpy as np
import math
from decimal import Decimal
import matplotlib.pyplot as plt
from agents.ornstein_uhlenbeck import OrnsteinUhlenbeckActionNoise
eps=10e-8
epochs=0... | 2.421875 | 2 |
packages/structural_dhcp_mriqc/structural_dhcp_mriqc/utils/fs2gif.py | amakropoulos/structural-pipeline-measures | 2 | 12055 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2016-03-16 11:28:27
# @Last Modified by: oesteban
# @Last Modified time: 2016-04-04 13:50:50
"""
Batch export freesurfer results to animated gifs
"""
from __future__ import absolute_import
from __future__ import division
from __future__ im... | 2.078125 | 2 |
DE_DataBase.py | almirjgomes/DE_DataBaseConnect | 0 | 12056 | <reponame>almirjgomes/DE_DataBaseConnect
import os
import sqlite3 as sq3
import cx_Oracle as ora
import pandas as pd
import psycopg2 as ps2
import mysql.connector as mysql
import sqlalchemy
# Reponsabilidades desta classe:
# Apenas se conectar a uma das bases de dados abaixo especificadas
# Bases conhecidas: SQLITE, O... | 2.6875 | 3 |
peter_lists/blog/views.py | pvize1/peter_lists | 0 | 12057 | from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.views.generic import (
ListView,
DetailView,
CreateView,
UpdateView,
DeleteView,
)
from django.shortcuts import render
from django.db.models import Count
from django.d... | 2.015625 | 2 |
tests/test_pythonpath.py | browniebroke/pytest-srcpaths | 26 | 12058 | import sys
from typing import Generator
from typing import List
from typing import Optional
import pytest
from _pytest.pytester import Pytester
def test_one_dir_pythonpath(pytester: Pytester, file_structure) -> None:
pytester.makefile(".ini", pytest="[pytest]\npythonpath=sub\n")
result = pytester.runpytest("... | 2.375 | 2 |
coretemp.py | InScene/dht22-mqtt-daemon | 0 | 12059 | #!/usr/bin/env python2
import paho.mqtt.client as mqtt
import time
import Adafruit_DHT
from configparser import ConfigParser
import json
config = ConfigParser(delimiters=('=', ))
config.read('config.ini')
sensor_type = config['sensor'].get('type', 'dht22').lower()
if sensor_type == 'dht22':
sensor = Adafruit_DH... | 2.8125 | 3 |
mythril/support/support_utils.py | step21/mythril | 0 | 12060 | <gh_stars>0
"""This module contains utility functions for the Mythril support package."""
from typing import Dict
class Singleton(type):
"""A metaclass type implementing the singleton pattern."""
_instances = {} # type: Dict
def __call__(cls, *args, **kwargs):
"""Delegate the call to an existin... | 2.265625 | 2 |
tests/functions/list/test_lists_map.py | sukovanej/mplisp | 0 | 12061 | import unittest
import mplisp.evaluator as evaluator
class TestListMap(unittest.TestCase):
def map_test(self):
input1 = """
(map (lambda (x) (* 2 x)) (list 1 2 3))
"""
output1 = list(evaluator.evaluate(input1))
self.assertEqual(output1[0], [2, 4, 6])
def map_test_2(... | 3.3125 | 3 |
malpickle/main.py | erose1337/malpickle | 0 | 12062 | <gh_stars>0
import argparse
from __init__ import insert_code
def main():
parser = argparse.ArgumentParser(description="Inject code into pickle files")
parser.add_argument("pickle_file", help="The pickle file to inject code into")
parser.add_argument("code_file", help="The shell script to inject")
#par... | 3 | 3 |
src/redis_lock/django_cache.py | suligap/python-redis-lock | 0 | 12063 | from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django_redis.cache import RedisCache as PlainRedisCache
from redis_lock import Lock
from redis_lock import reset_all
class RedisCache(PlainRedisCache):
@property
def __client(self):
try:
return self.client.get_client()
... | 2.59375 | 3 |
nets/facenet.py | QiongWang-l/llfr | 0 | 12064 | <filename>nets/facenet.py
import torch
import torch.nn as nn
from torch.nn import functional as F
from torchvision.models.utils import load_state_dict_from_url
from nets.inception_resnetv1 import InceptionResnetV1
from nets.mobilenet import MobileNetV1
class mobilenet(nn.Module):
def __init__(self, pretrained):
... | 2.375 | 2 |
distributed_social_network/posts/migrations/0003_auto_20190308_2055.py | leevtori/CMPUT404-project | 0 | 12065 | <filename>distributed_social_network/posts/migrations/0003_auto_20190308_2055.py
# Generated by Django 2.1.7 on 2019-03-08 20:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('posts', '0002_auto_20190221_0234'),
]
operations = [
migrations.Ren... | 1.546875 | 2 |
minify/migrations/0004_auto__del_unique_urlminify_short_url__add_unique_urlminify_short_url_s.py | djsan15/url-minifier | 0 | 12066 | <reponame>djsan15/url-minifier
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'URLMinify', field... | 2.140625 | 2 |
Validation/EcalRecHits/test/EcalTBValidationData_cfg.py | pasmuss/cmssw | 0 | 12067 | import FWCore.ParameterSet.Config as cms
process = cms.Process("h4ValidData")
# initialize MessageLogger
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring... | 1.5625 | 2 |
database/domains.py | changyc9928/Genshin-Discord-Bot | 0 | 12068 | import asyncio
from query_graphql import query_artifact_domains, query_weapon_materials_book
class Domains:
leylines = {
"Blossom of Revelation": "Character EXP Materials",
"Blossom of Wealth": "Mora"
}
weapon_domains = {}
talent_domains = {}
artifact_domains = {}
trounce_doma... | 2.21875 | 2 |
policy.py | nyu-dl/dl4mt-simul-trans | 34 | 12069 | <reponame>nyu-dl/dl4mt-simul-trans<filename>policy.py
"""
-- Policy Network for decision making [more general]
"""
from nmt_uni import *
from layers import _p
import os
import time, datetime
import cPickle as pkl
# hyper params
TINY = 1e-7
PI = numpy.pi
E = numpy.e
A = 0.2
B = 1
class Controller(object):... | 2.546875 | 3 |
src/app/drivers/pycolator/splitmerge.py | husensofteng/msstitch | 0 | 12070 | <gh_stars>0
from app.drivers.pycolator import base
from app.actions.pycolator import splitmerge as preparation
from app.readers import pycolator as readers
from app.drivers.options import pycolator_options
class SplitDriver(base.PycolatorDriver):
outfile = None
def run(self):
self.set_filter_types()
... | 2.734375 | 3 |
ejercicio 14.py | Davidpadilla1234/taller_estructura-secuencial | 0 | 12071 | """
Entradas:
lectura actual--->float--->lect2
lectura anterior--->float--->lect1
valor kw--->float--->valorkw
Salidas:
consumo--->float--->consumo
total factura-->flotante--->total
"""
lect2 = float ( entrada ( "Digite lectura real:" ))
lect1 = float ( entrada ( "Digite lectura anterior:" ))
valorkw = float ( input ( ... | 3.765625 | 4 |
src/workers/correct.py | brainsqueeze/Image_correction | 10 | 12072 | # __author__ = 'Dave'
import cv2
from skimage import io
from skimage.transform import probabilistic_hough_line
import matplotlib.pyplot as plt
import os
import warnings
import random
import numpy as np
warnings.filterwarnings('ignore', category=RuntimeWarning)
class CorrectImage(object):
def __init__(self):
... | 2.78125 | 3 |
plot_scripts/CC_timeline_plot.py | idunnam/Thesis | 0 | 12073 | <filename>plot_scripts/CC_timeline_plot.py
"""
This code is used for plotting induvidual timelines of seasonal CC for each CMIP5 and CMIP6 model
"""
import matplotlib.pyplot as plt
import xarray as xr
import numpy as np
import seaborn as sns
import pandas as pd
#=== Import SEB Anomalies ====
#from seasonal_SEB_compon... | 2.265625 | 2 |
manage.py | xinbingliang/dockertest | 30 | 12074 | <gh_stars>10-100
# manage.py
import unittest
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from skeleton.server import app, db
from skeleton.server.models import User
migrate = Migrate(app, db)
manager = Manager(app)
# migrations
manager.add_command('db', MigrateCommand)
@ma... | 2.515625 | 3 |
client/middleware.py | uktrade/directory-forms-api | 0 | 12075 | <filename>client/middleware.py
import sigauth.middleware
import sigauth.helpers
from client import helpers
class SignatureCheckMiddleware(sigauth.middleware.SignatureCheckMiddlewareBase):
secret = None
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.request_checke... | 2.15625 | 2 |
scripts/prepare-kernel-headers.py | sonicyang/mctest | 4 | 12076 | <reponame>sonicyang/mctest
import os
import subprocess
import errno
import shutil
import re
import sys
kernel_path = ''
install_path = ''
patch_rules = []
arch = ''
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
... | 2.234375 | 2 |
model/loss.py | Daipuwei/YOLO-tf2 | 0 | 12077 | # -*- coding: utf-8 -*-
# @Time : 2021/9/18 下午11:19
# @Author : DaiPuWei
# @Email : <EMAIL>
# @File : loss.py
# @Software: PyCharm
"""
这是YOLO模型的损失函数的定义脚本,目前目标分类损失支持smooth Label;
目标定位损失支持均方差损失、GIOU Loss、DIOU Loss和CIOU Loss;
"""
import math
import tensorflow as tf
from tensorflow.keras import backend a... | 2.78125 | 3 |
electrum_vtc/tests/test_lnpeer.py | samdisk11/electrum | 0 | 12078 | import asyncio
import tempfile
from decimal import Decimal
import os
from contextlib import contextmanager
from collections import defaultdict
import logging
import concurrent
from concurrent import futures
import unittest
from typing import Iterable, NamedTuple, Tuple, List, Dict
from aiorpcx import TaskGroup, timeou... | 1.304688 | 1 |
dictionaries/lab/06_students.py | Galchov/python-fundamentals | 0 | 12079 | <filename>dictionaries/lab/06_students.py
data = input()
courses = {}
while ":" in data:
student_name, id, course_name = data.split(":")
if course_name not in courses:
courses[course_name] = {}
courses[course_name][id] = student_name
data = input()
searched_course = data
searched_course_na... | 3.875 | 4 |
eth_tester/normalization/common.py | PabloLefort/eth-tester | 215 | 12080 | from cytoolz.functoolz import (
curry,
)
from eth_utils import (
to_dict,
to_tuple,
)
@curry
@to_dict
def normalize_dict(value, normalizers):
for key, item in value.items():
normalizer = normalizers[key]
yield key, normalizer(item)
@curry
@to_tuple
def normalize_array(value, normali... | 2.921875 | 3 |
je_open_cv/modules/image_operations.py | JE-Chen/Python-OPENCV-JE | 0 | 12081 | <reponame>JE-Chen/Python-OPENCV-JE
import cv2
'''
基本圖像處理用
'''
# 取得圖像 行 列 通道數
def get_image_properties(image):
total = [image.shape, image.size, image.dtype]
return total
def get_image_shape(image):
return image.shape
# 取得 圖片大小
def get_image_size(image):
return image.size
# 取得圖片類型
def get_image_... | 3.546875 | 4 |
Incident-Response/Tools/grr/grr/client/grr_response_client/vfs_handlers/ntfs.py | sn0b4ll/Incident-Playbook | 1 | 12082 | #!/usr/bin/env python
"""Virtual filesystem module based on pyfsntfs."""
import stat
from typing import Any, Callable, Dict, Iterable, Optional, Text, Type
import pyfsntfs
from grr_response_client import client_utils
from grr_response_client.vfs_handlers import base as vfs_base
from grr_response_core.lib import rdfv... | 2.125 | 2 |
04.Encapsulation/Exe/pizza_maker/project/main.py | nmoskova/Python-OOP | 0 | 12083 | from encapsulation_04.exe.pizza_maker.project.dough import Dough
from encapsulation_04.exe.pizza_maker.project.pizza import Pizza
from encapsulation_04.exe.pizza_maker.project.topping import Topping
tomato_topping = Topping("Tomato", 60)
print(tomato_topping.topping_type)
print(tomato_topping.weight)
mushrooms_toppin... | 2.5625 | 3 |
src/unicon/plugins/iosxe/cat9k/__init__.py | nielsvanhooy/unicon.plugins | 0 | 12084 | <reponame>nielsvanhooy/unicon.plugins<filename>src/unicon/plugins/iosxe/cat9k/__init__.py
""" cat9k IOS-XE connection implementation.
"""
__author__ = "<NAME> <<EMAIL>>"
from unicon.plugins.iosxe import (
IosXESingleRpConnection,
IosXEDualRPConnection,
IosXEServiceList,
HAIosXEServiceList)
from .stat... | 1.773438 | 2 |
ludopediaAnuncios.py | christianbobsin/LudopediaDataMiner | 2 | 12085 | # -*- coding: utf-8 -*-
from lxml import html
from time import sleep
from datetime import datetime
import requests
import os
import sqlite3
import sys
# No terminal usar ~: python ludopedia.py [idIni] [regs]
# por ex. ~: python ludopedia.py 451 3000
con = sqlite3.connect('ludopedia.db')
cursor = con.cursor()
cursor.... | 3.03125 | 3 |
midterm/yolo_utils.py | ClarkBrun/emotic | 0 | 12086 | import cv2
import numpy as np
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
def to_cpu(tensor):
return tensor.detach().cpu()
def xywh2xyxy(x):
''' Convert bounding box from [x, y, w, h] to [x1, y1, x2, y2]
:param x: bounding boxes array
:return: Converted bounding box array
'... | 2.46875 | 2 |
pytracking-master/ltr/train_settings/bbreg/atom.py | wsumel/AMMC | 3 | 12087 | import torch.nn as nn
import torch.optim as optim
from ltr.dataset import Lasot, TrackingNet, MSCOCOSeq, Got10k
from ltr.data import processing, sampler, LTRLoader
import ltr.models.bbreg.atom as atom_models
from ltr import actors
from ltr.trainers import LTRTrainer
import ltr.data.transforms as tfm
def run(settings)... | 1.960938 | 2 |
exercise 8.6.py | tuyanyang/python_exercise | 0 | 12088 | <filename>exercise 8.6.py<gh_stars>0
nums = list()
while True:
nStr = input('Enter a number: ')
try:
if nStr == 'done':
break
n = float(nStr)
nums.append(n)
except:
print('Invalid input')
continue
print('Maximum: ',max(nums))
print('Minimum: ',min(nums)) | 3.9375 | 4 |
gui/activity_list.py | keremkoseoglu/Kifu | 0 | 12089 | """ Activity list window """
import tkinter
import tkinter.ttk
from model import activity, invoice
from model.activity import Activity
from model.company import Company
from gui.activity import ActivityWindow
from gui.activity_split import ActivitySplit
from gui.invoice import InvoiceWindow
from gui.popup_file import p... | 2.640625 | 3 |
src/cactus/shared/commonTest.py | thiagogenez/cactus | 209 | 12090 | import os
import shutil
import unittest
from base64 import b64encode
from sonLib.bioio import TestStatus
from sonLib.bioio import getTempFile
from sonLib.bioio import getTempDirectory
from sonLib.bioio import system
from toil.job import Job
from toil.common import Toil
from cactus.shared.common import cactus_call, Chi... | 2.078125 | 2 |
porespy/networks/__getnet__.py | hfathian/porespy | 3 | 12091 | <filename>porespy/networks/__getnet__.py<gh_stars>1-10
import sys
import numpy as np
import openpnm as op
from tqdm import tqdm
import scipy.ndimage as spim
from porespy.tools import extend_slice
import openpnm.models.geometry as op_gm
def regions_to_network(im, dt=None, voxel_size=1):
r"""
Analyzes an image ... | 2.625 | 3 |
pandas/core/internals.py | lodagro/pandas | 0 | 12092 | import itertools
from datetime import datetime
from numpy import nan
import numpy as np
from pandas.core.common import _possibly_downcast_to_dtype, isnull
from pandas.core.index import Index, MultiIndex, _ensure_index, _handle_legacy_indexes
from pandas.core.indexing import _check_slice_bounds, _maybe_convert_indices... | 2.375 | 2 |
Sketches/MH/PipeBuilder/BuildViewer.py | sparkslabs/kamaelia_orig | 12 | 12093 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Ve... | 2.484375 | 2 |
examples/exp_example.py | physimals/avb | 0 | 12094 | """
Example of usage of the AVB framework to infer a single exponential decay
model.
This uses the Python classes directly to infer the parameters for a single
instance of noisy data constructed as a Numpy array.
"""
import sys
import logging
import numpy as np
from vaby_avb import Avb
import vaby
# Uncomment line ... | 3.203125 | 3 |
tests/test_classes/users.py | dialogs/python-bot-sdk | 9 | 12095 | from dialog_api.users_pb2 import RequestLoadFullUsers, ResponseLoadFullUsers, FullUser
class Users:
def LoadFullUsers(self, request: RequestLoadFullUsers) -> ResponseLoadFullUsers:
return ResponseLoadFullUsers(full_users=[FullUser(id=1, contact_info=[], about=None)])
| 1.976563 | 2 |
aws_marketplace/creating_marketplace_products/src/training_specification.py | jerrypeng7773/amazon-sagemaker-examples | 2,610 | 12096 | import json
class TrainingSpecification:
template = """
{
"TrainingSpecification": {
"TrainingImage": "IMAGE_REPLACE_ME",
"SupportedHyperParameters": [
{
"Description": "Grow a tree with max_leaf_nodes in best-first fashion. Best nodes are defined as relative reduction in impu... | 2.328125 | 2 |
Exercises1_12/R-1.12.py | opnsesame/Data-Structures-and-Algorithms-Exercises | 0 | 12097 | <gh_stars>0
#Python's random module includes a function choice(data) that returns a
#random element from a non-empty sequence. The random modul includes a
#more basic function randrange,with parameterization similar to the
#built-in range function , that return a random choice from the given
#range.Using only the ra... | 3.90625 | 4 |
database/mongo_connector.py | timburbank/openrvdas | 1 | 12098 | <reponame>timburbank/openrvdas
#!/usr/bin/env python3
"""Tables:
data: pk timestamp field_name field_value source_record
We don't know what type each value will have, so have a column for
int, float, str and bool and leave all but the appropriate value type
NULL. Docs claim that NULL values take no space, so...
St... | 2.671875 | 3 |
benchmarks/cifar10/benchmark_sample_creator.py | aarati-K/one-access | 0 | 12099 | <reponame>aarati-K/one-access<gh_stars>0
from store.cifar10 import Cifar10
import torchvision.transforms as transforms
import time
import matplotlib.pyplot as plt
batch_size = 1
rel_sample_size = 10000
ds = Cifar10(input_data_folder="/home/aarati/datasets/cifar-10-batches-py", \
max_batches=2, batch_size=batch_siz... | 2.171875 | 2 |