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 |
|---|---|---|---|---|---|---|
bigfastapi/models/role_models.py | kofimokome/bigfastapi | 0 | 40000 | import datetime as dt
from re import T
from sqlalchemy.schema import Column
from sqlalchemy.types import String, DateTime
from uuid import UUID, uuid4
import bigfastapi.db.database as database
class Role(database.Base):
__tablename__ = "roles"
id = Column(String(255), primary_key=True, index=True, default=uuid... | 2.28125 | 2 |
core/tmp/entropy_tmp.py | Ulti-Dreisteine/data-information-measurement | 1 | 40001 | <reponame>Ulti-Dreisteine/data-information-measurement
# -*- coding: utf-8 -*-
"""
Created on 2021/12/14 12:38:06
@File -> entropy.py
@Author: luolei
@Email: <EMAIL>
@Describe: 信息熵和互信息计算
"""
__doc__ = """
本代码用于对一维和多维离散或连续变量数据的信息熵和互信息进行计算.
连续变量信息熵使用Kraskov和Lombardi等人的方法计算, Lord等人文献可作为入门;离散变量信息熵则直接进行计算.
... | 1.992188 | 2 |
core/wsgi.py | nicolaerario/djano-custom-user | 1 | 40002 | <reponame>nicolaerario/djano-custom-user
import os
from django.core.wsgi import get_wsgi_application
from dotenv import load_dotenv
load_dotenv()
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings')
application = get_wsgi_application()
| 1.460938 | 1 |
server/apps/api/migrations/0002_allow_null.py | m3xan1k/censortracker_backend | 0 | 40003 | # Generated by Django 3.0.5 on 2020-04-20 15:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='domain',
name='client_ip',
fi... | 1.5625 | 2 |
__data__.py | nadavWeisler/BrmsGeneratorRunner | 1 | 40004 | __version__ = '1.0.dev'
__author__ = '<NAME>'
__name__ = 'bRMS generator'
__app_name__ = 'bRMS' | 1.117188 | 1 |
jax_meta/datasets/transforms/test_functional.py | tristandeleu/jax-meta-learning | 5 | 40005 | <reponame>tristandeleu/jax-meta-learning<filename>jax_meta/datasets/transforms/test_functional.py
import pytest
import numpy as np
from numpy.random import default_rng
import jax_meta.datasets.transforms.functional as F
def test_random_crop():
# Random data
rng = default_rng(0)
data = rng.integers(256, ... | 2.421875 | 2 |
src/analysis/statistical_analysis.py | KewJS/Logs_Prediction | 1 | 40006 | <gh_stars>1-10
import math
import numpy as np
from numpy.random import randn
from numpy import exp
import pandas as pd
import datetime as dt
from itertools import repeat
from collections import OrderedDict
from IPython.display import display, Markdown, HTML
import scipy.stats as stats
import scipy.optimize
import scip... | 3.4375 | 3 |
Mundo 3/ex085.py | RafaelSdm/Curso-de-Python | 1 | 40007 | <filename>Mundo 3/ex085.py<gh_stars>1-10
print("valores dos numeros pares e impares:")
lista = [[],[]]
numero =0
for c in range(0,7):
numero = int(input(f"informe o {c+1}° numero:"))
if numero %2 ==0:
lista[0].append(numero)
else:
lista[1].append(numero)
print("Dados os numeros informado... | 3.796875 | 4 |
Misc/weather.py | LuffyWesley/HydroFarm | 0 | 40008 | import requests
import calendar
import keys
api_call = 'https://api.openweathermap.org/data/2.5/forecast?appid=' + keys.api_key
running = True
# Program loop
while running:
# Asks the user for the city or zip code to be queried
while True:
# Input validation
try:
print('\nThis a... | 3.921875 | 4 |
noronha/db/movers.py | pierodesenzi/noronha | 43 | 40009 | # -*- coding: utf-8 -*-
# Copyright Noronha Development Team
#
# 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... | 1.789063 | 2 |
MainMenu.py | andy-liuu/Pandemic-tour-guide | 0 | 40010 | <reponame>andy-liuu/Pandemic-tour-guide
from pygame import *
import writeTextBox
size=width,height = 1280,720
screen=display.set_mode(size)
RED=(255,0,0)
GREEN=(0,255,0)
BLUE=(0,0,255)
BLACK=(0,0,0)
WHITE=(255,255,255)
#global variables accessed by globals()
wMap = image.load("Images/WorldMap.png").con... | 3.015625 | 3 |
Lib/background.py | ProjectZeroDays/Pyto | 2 | 40011 | """
Run code in background indefinitely
This module allows you to keep running a script in the background indefinitely.
A great usage of this is fetching data in background and sending notifications with :py:mod:`notifications`. You can also run a server or a Discord bot for example.
Note: Because of privacy, apps ca... | 3.453125 | 3 |
E020/main.py | alperkonuralp/AlperIlePython | 1 | 40012 |
def topla(a, b):
toplam = a + b
if a < b:
kucuk = a
else:
kucuk = b
return (toplam, kucuk)
toplam, kucuk = topla(1, 2)
print(toplam, kucuk)
tuple1 = (1, 2, 3)
tuple2 = 1, 2, 3
tuple3 = tuple([1, 2, 3, 4, 5])
ilkSayi = tuple2[0]
ikinciSayi = tuple2[1]
ucunc... | 3.8125 | 4 |
Beecrowd/Python/1073.py | felipemsalles/Programming-Studies | 0 | 40013 | # 1073
n = int(input())
if 5 < n < 2000:
for i in range(2, n + 1, 2):
print("{}^{} = {}".format(i, 2, i ** 2)) | 3.703125 | 4 |
branching.py | fabiolealsc/quest | 2 | 40014 | import sys
n1 = int(sys.argv[1])
n2 = int(sys.argv[2])
if n1 + n2 <= 0:
print('You have chosen the path of destitution.')
elif 1 <= (n1 + n2) <= 100:
print('You have chosen the path of plenty.')
else:
print('You have chosen the path of excess.')
| 3.546875 | 4 |
python_pure_datastructures/binary_indexed_tree.py | shanmuk184/python_pure_datastructures | 0 | 40015 | class BinaryIndexedTree(object):
def __init__(self):
self.BITTree = [0]
# Returns sum of arr[0..index]. This function assumes
# that the array is preprocessed and partial sums of
# array elements are stored in BITree[].
def getsum(self, i):
s = 0 # initialize result
# inde... | 3.671875 | 4 |
db.py | changwang/knowledge | 0 | 40016 | <reponame>changwang/knowledge<filename>db.py
# -*- coding: utf-8 -*-
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from logger import logger
__all__ = [
'fetch_from_table',
'fetch_one_row',
'TableNotFoundException'
]
DATABASE_PASSWORD = os.getenv(... | 2.703125 | 3 |
tests/bvlapi/guid/test_club.py | alanverresen/bvl-api | 1 | 40017 | <gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Contains tests for validating club GUIDs.
from bvlapi.guid.club import is_club_guid
def test_is_club_guid():
""" Test that a valid club GUID is recognized.
"""
assert is_club_guid("BVBL1328")
def test_is_club_guid__false():
""" Test t... | 2.0625 | 2 |
tool.py | LooDaHu/net_drive | 2 | 40018 | import socket
import re
def get_local_adr():
address_set = socket.getaddrinfo(socket.gethostname(), None, family=2)
for address in address_set:
if re.match("192.168.", address[4][0]):
local_network_addr = address[4][0]
return local_network_addr
return "ADDRESS_NOT_FOUND"
| 3.09375 | 3 |
export/parts.py | rostyslavb/brspy | 0 | 40019 | <filename>export/parts.py
from .attributes import AttributeExport
from .attributes import MimicExport
from .attributes import JointExport
from .attributes import JointOrientationExport
from .attributes import GazeExport
import os
class BodyPartsExport:
ExportClass = AttributeExport
def __init_... | 2.3125 | 2 |
test.py | bwagner/parse_python_indentation.py | 2 | 40020 | import unittest
import warnings
from parse_python_indentation import parse_indentation
good_output = [
{'key': 'green:',
'offspring': [
{'key': 'follow', 'offspring': []},
{'key': 'blue', 'offspring': []},
{'key': 'yellow', 'offspring': []},
{'key': 'fishing', 'offspring': []},
{'key': 'sn... | 3.171875 | 3 |
submissions/abc035/b.py | m-star18/atcoder | 1 | 40021 | s = input()
t = int(input())
xy = [0, 0]
cnt = 0
for i in range(len(s)):
if s[i] == 'U':
xy[1] += 1
elif s[i] == 'D':
xy[1] -= 1
elif s[i] == 'R':
xy[0] += 1
elif s[i] == 'L':
xy[0] -= 1
else:
cnt += 1
ans = abs(xy[0]) + abs(xy[1])
if t == 1:
ans += cnt
else:
if ans >= cnt:
ans -= ... | 2.796875 | 3 |
roles/openshift_openstack/library/os_service_catalog.py | Roscoe198/Ansible-Openshift | 164 | 40022 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2018 Red Hat, Inc. and/or its affiliates
# and other contributors as indicated by the @author tags.
#
# 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... | 1.570313 | 2 |
trainModel.py | NYUMedML/DeepEHR | 242 | 40023 | <reponame>NYUMedML/DeepEHR<filename>trainModel.py
import torch
# import torch.nn as nn
# import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
# import torchwordemb
import torch.optim as optim
import sys
import time
import gc
import pickle
import os
import models2 as m
import enc_mode... | 2.375 | 2 |
spinoffs/inference_gym/inference_gym/internal/datasets/synthetic_plasma_spectroscopy.py | mederrata/probability | 1 | 40024 | # Copyright 2021 The TensorFlow Probability 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 o... | 1.796875 | 2 |
plbenchmark/utils.py | kgoossens1/protein-ligand-benchmark | 13 | 40025 | <reponame>kgoossens1/protein-ligand-benchmark
"""
utils.py
Contains utility functions
"""
import numpy as np
from scipy import constants
import requests
import json
from pint import UnitRegistry
import warnings
unit_registry = UnitRegistry()
boltzmann_constant = constants.gas_constant * unit_registry("J / mole / K"... | 2.40625 | 2 |
session.py | nereasastre/upf-calendar-exporter | 3 | 40026 | <filename>session.py
def is_valid_session(session: dict) -> bool:
"""
checks if passed dict has enough info to display event
:param session: dict representing a session
:return: True if it has enough info (title, start time, end time), False otherwise
"""
try:
session_keys = session.ke... | 3.296875 | 3 |
12. Integer to Roman/main.py | PromasterGuru/Leetcode-Solutions | 0 | 40027 | <filename>12. Integer to Roman/main.py
class Solution:
def intToRoman(self, num: int) -> str:
convertor = [
["","M", "MM", "MMM"],
["","C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"],
["","X", "XX", "XXX", "XL", "L", "LX","LXX","LXXX", "XC"],
["","I","... | 3.40625 | 3 |
test/test_node_api.py | atlanticwave-sdx/sdx-controller-client | 0 | 40028 | <reponame>atlanticwave-sdx/sdx-controller-client<filename>test/test_node_api.py
# coding: utf-8
"""
SDX-Controller
You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). # noqa: E501
OpenAPI spec version: 1.0.0
Conta... | 1.859375 | 2 |
raddiwala/views.py | nikhilbelchada/online-raddiwala | 0 | 40029 | from django.views.generic import TemplateView
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import I... | 1.851563 | 2 |
python/test_qmmm.py | wallerlab/yoink | 6 | 40030 | <reponame>wallerlab/yoink
from pyoink import *
from jpype import *
pyoink=PYoink("../build/libs/Yoink-0.0.3.jar","./dori_qmmm.xml")
qm_atoms,qm_molecules = pyoink.get_qm_indices()
print qm_molecules
shutdownJVM()
| 1.84375 | 2 |
model/model.py | MISTCARRYYOU/PythonPDEVS | 1 | 40031 | import sys
sys.path.append("../src/")
from DEVS import CoupledDEVS, AtomicDEVS, RootDEVS, directConnect
from infinity import INFINITY
from collections import defaultdict
from util import allZeroDict, addDict
from statesavers import PickleHighestState as state_saver
from message import NetworkMessage
from messageSchedu... | 2.203125 | 2 |
snaps/openstack/os_credentials.py | hashnfv/hashnfv-snaps | 0 | 40032 | <reponame>hashnfv/hashnfv-snaps<gh_stars>0
# Copyright (c) 2017 Cable Television Laboratories, Inc. ("CableLabs")
# and others. 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... | 1.390625 | 1 |
login_required_middleware.py | IBM/omnia | 1 | 40033 | <gh_stars>1-10
from django.contrib.auth.decorators import login_required
from django.urls import reverse
def login_exempt(view):
view.login_exempt = True
return view
class LoginRequiredMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request)... | 2.3125 | 2 |
yoo.py | Bayurzx/translateReadme | 0 | 40034 | yoo = {
"af": "Afrikaans",
"sq": "Albanian - shqip",
"am": "Amharic - አማርኛ",
"ar": "Arabic - العربية",
"hy": "Armenian - հայերեն",
"az": "Azerbaijani - azərbaycan dili",
"bn": "Bengali - বাংলা",
"bs": "Bosnian - bosanski",
"bg": "Bulgarian - български",
"ca": "Catalan - català",
"zh": "Chinese - 中文",
"zh-Hans": "Chines... | 1.875 | 2 |
codes/LinearRegression.py | CNShawn/DL-ML-Model | 0 | 40035 | import torch
import torch.nn as nn
class LinearRegressionModel(nn.Module):
def __init__(self, input_dim, output_dim):
super().__init__()
self.Linear = nn.Linear(input_dim, output_dim)
def forward(self, x):
out = self.Linear(x)
return out
| 3.0625 | 3 |
spacer/tests/test_train_classifier.py | beijbom/PySpacer | 3 | 40036 | <reponame>beijbom/PySpacer
import random
import unittest
import numpy as np
from spacer import config
from spacer.messages import DataLocation
from spacer.train_classifier import trainer_factory
from spacer.train_utils import make_random_data, train
@unittest.skipUnless(config.HAS_S3_TEST_ACCESS, 'No access to test... | 2.4375 | 2 |
2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/03-Lists-Basics/02_Exercises/02_Multiples-List.py | karolinanikolova/SoftUni-Software-Engineering | 0 | 40037 | <filename>2-Python-Fundamentals (Jan 2021)/Course-Exercises-and-Exams/03-Lists-Basics/02_Exercises/02_Multiples-List.py
# 2. Multiples List
# Write a program that receives two numbers (factor and count) and creates a list with length of the given count
# and contains only elements that are multiples of the given factor... | 4.625 | 5 |
scripts/rewrite-uris.py | CaptSolo/bib-rdf-pipeline | 31 | 40038 | <reponame>CaptSolo/bib-rdf-pipeline
#!/usr/bin/env python
"""Rewrite all the marc2bibframe2-generated URIs in the input NT file; output the rewritten NT file on stdout"""
import sys
import re
# regex for detecting URIs generated by marc2bibframe
m2bf_uri = re.compile(r'(\d{9})#(Work|Instance|Agent)((\d\d\d)-(\d+))?'... | 2.765625 | 3 |
neptune/new/internal/artifacts/file_hasher.py | neptune-ml/neptune-client | 13 | 40039 | <gh_stars>10-100
#
# Copyright (c) 2021, Neptune Labs Sp. z o.o.
#
# 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 appl... | 1.992188 | 2 |
packages/dcos-integration-test/extra/test_applications.py | timgates42/dcos | 2,577 | 40040 | import logging
import uuid
from typing import Any
import pytest
import requests
import test_helpers
from dcos_test_utils import marathon
from dcos_test_utils.dcos_api import DcosApiSession
__maintainer__ = 'kensipe'
__contact__ = '<EMAIL>'
log = logging.getLogger(__name__)
def deploy_test_app_and_check(dcos_api_... | 2.078125 | 2 |
bmorph/tests/test_mizuroute_utils.py | arbennett/bmorph | 8 | 40041 | import pytest
import numpy as np
import pandas as pd
import xarray as xr
import bmorph
from bmorph.util import mizuroute_utils as mizutil
reference = xr.open_dataset("./bmorph/tests/data/test_reference.nc")
routed = xr.open_dataset("./bmorph/tests/data/test_routed.nc")
topo = xr.open_dataset("./bmorph/tests/data/tes... | 2.140625 | 2 |
inverted_hull.py | dskjal/Inverted-Hull-Setup-Tool | 2 | 40042 | <gh_stars>1-10
#// BEGIN MIT LICENSE BLOCK //
#//
#// Copyright (c) 2019 dskjal
#// This software is released under the MIT License.
#// http://opensource.org/licenses/mit-license.php
#//
#// END MIT LICENSE BLOCK //
import bpy
bl_info = {
"name" : "Inverted Hull Setup Tool",
"author" : "dskjal",
"version... | 2.015625 | 2 |
src/harness/wires/base.py | vmagamedov/harness | 6 | 40043 | import asyncio
from types import TracebackType
from typing import Optional, Type, Any
class Wire:
def configure(self, value: Any) -> None:
pass
async def __aenter__(self) -> None:
pass
async def __aexit__(
self,
exc_type: Optional[Type[BaseException]],
exc_val: Op... | 2.46875 | 2 |
tickets/migrations/0011_auto_20190804_2139.py | jdevera/pythoncanarias_web | 5 | 40044 | <reponame>jdevera/pythoncanarias_web<filename>tickets/migrations/0011_auto_20190804_2139.py
# Generated by Django 2.2.4 on 2019-08-04 20:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('tickets', '0010_auto_20190804_18... | 1.578125 | 2 |
tensorboard_pytorch_examples/common/trainer.py | jacekplocharczyk/tensorboard-pytorch-example | 0 | 40045 | from typing import Tuple
import torch
from torch import nn
from torch.utils.tensorboard import SummaryWriter
from tensorboard_pytorch_examples.common.config import (
CPU_DEVICE,
DEFAULT_EPOCHS_COUNT,
DEVICE,
)
class ClassificationTrainer:
def __init__(
self,
trainloader: torch.utils.... | 2.75 | 3 |
custom/ilsgateway/slab/messages.py | kkrampa/commcare-hq | 1 | 40046 | from __future__ import absolute_import
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
REMINDER_TRANS = _("Did you receive or transfer stock to another facility last month?"
" Please reply either 'trans no' or 'trans yes'")
TRANS_HELP = _("You can resp... | 2.234375 | 2 |
scripts/pylint_custom_plugin/tests/test_files/enum_checker_acceptable.py | vincenttran-msft/azure-sdk-for-python | 1 | 40047 | # Test file for enum checker
from enum import Enum
from six import with_metaclass
from azure.core import CaseInsensitiveEnumMeta
class EnumPython2(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
ONE = "one"
TWO = "two"
| 2.65625 | 3 |
tests/test_command_methods_getter.py | chrissimpkins/commandlines | 14 | 40048 | <filename>tests/test_command_methods_getter.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import shlex
import sys
import pytest
from commandlines import Command
from commandlines.exceptions import IndexOutOfRangeError, MissingArgumentError, MissingDictionaryKeyError
# TESTS OVERVIEW: Command object getter method... | 2.46875 | 2 |
mysite/forms.py | AmanRiat1/uOttaHack | 0 | 40049 | from django import forms
gender = [('male', 'M'), ('female', 'F')]
response = [('1', 'yes'), ('0', 'no')]
time = [('1', 'one'), ('2', 'two'), ('3', 'three'), ('4', 'four')]
education = [('0', 'zero'),('1', 'zero'), ('2', 'two'), ('3', 'three'), ('4', 'four')]
rating = [('1', 'one'), ('2', 'two'), ('3', 'three'), ('4',... | 2.203125 | 2 |
src/template_forms/base.py | rpkilby/django-template-forms | 1 | 40050 | <reponame>rpkilby/django-template-forms
from django.forms.forms import BaseForm
from django.utils.encoding import force_text
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from .utils import add_css_classes, try_classmro... | 2.109375 | 2 |
feature_engineering/cloud_functions/dataset_generator_http/main.py | cyberj0g/verification-classifier | 0 | 40051 | '''
Main function to be called from GCE's cloud function
This function is in charge of adding training data to
the datastore for later generation of models and feature study
'''
import sys
import os
import time
import numpy as np
from google.cloud import datastore
from google.cloud import storage
from google.api_core... | 2.796875 | 3 |
1959.py | heltonricardo/URI | 6 | 40052 | <gh_stars>1-10
e = [int(x) for x in input().split()]
print(e[0] * e[1])
| 2.203125 | 2 |
Gerador_de_Senha.py | Jhon-Dx/Program | 0 | 40053 | import Gerador_de_senhas.Defs as ge
import PySimpleGUI as sg
class Gerador:
sg.theme('DarkPurple1')
def __init__(self):
layout = [
[sg.Checkbox('Numeros', key='sonumeros'), sg.Text(size=(3, 1)), sg.Checkbox('Letras', key='soletras'),
sg.Text(size=(3, 1)), sg.Checkbox('Simbolos... | 2.8125 | 3 |
models.py | TsukkiGia/pytrix | 0 | 40054 |
from consts import *
from game2d import *
from consts import *
class Block(GRectangle):
def __init__(self, x, y, width, height, fillcolor, linecolor, linewidth, angle=0):
super().__init__(x=x,
y=y,
width=width,
height=height,
... | 2.859375 | 3 |
python/pointcloud/run/results/plot_usage.py | NLeSC/pointcloud-benchmark | 9 | 40055 | <filename>python/pointcloud/run/results/plot_usage.py
#!/usr/bin/env python
################################################################################
# Created by <NAME> #
# <EMAIL> #
##########################... | 2.109375 | 2 |
adt17.py | Bekyilma/Master_Thesis | 1 | 40056 | #!/usr/bin/env python3.5
import sys
import os
import logging
import numpy as np
import musm
from sklearn.utils import check_random_state
from textwrap import dedent
#1Social Choice
_LOG = musm.get_logger('adt17')
PROBLEMS = {
'synthetic': musm.Synthetic,
'pc': musm.PC,
}
USERS = {
'noiseless': musm.Noi... | 2.015625 | 2 |
agent.py | primeMover2011/MultiAgentDDPG | 0 | 40057 | <filename>agent.py
import random
from model import Actor, Critic
from ounoise import OUNoise
import torch
import torch.optim as optim
GAMMA = 0.99 # discount factor
TAU = 0.01 # for soft update of target parameters
LR_ACTOR = 0.001 # learning rate of the actor
LR_CRITIC = 0.001 # learning rate of the critic
class... | 2.703125 | 3 |
app/forms/main_item_application.py | Wern-rm/raton.by | 0 | 40058 | <reponame>Wern-rm/raton.by
from flask_wtf import FlaskForm
from wtforms import StringField, TextAreaField
class ItemApplicationForm(FlaskForm):
name = StringField('Ф.И.О')
phone = StringField('Адрес')
email = StringField('Адрес')
message = TextAreaField('Сообщение') | 2.0625 | 2 |
pav_propms/pav_property_management_solution/doctype/rent_request/rent_request.py | alkuhlani/pav_propms | 0 | 40059 | # -*- coding: utf-8 -*-
# Copyright (c) 2021, <NAME> and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.model.mapper import get_mapped_doc
class RentRequest(Document):
def validate(self):
fr... | 1.96875 | 2 |
engine.py | 329124/PyCE | 0 | 40060 | <gh_stars>0
from tkinter import Tk
from tkinter import Canvas
from PIL import Image
from PIL import ImageTk
class Window:
def __init__(self, width, height, title):
self.width = width
self.height = height
self.root = Tk()
self.root.title(title)
self.root.resizable(False, Fals... | 2.828125 | 3 |
test/fisheries_test_io.py | phargogh/invest-natcap.invest-3 | 0 | 40061 | <reponame>phargogh/invest-natcap.invest-3
import unittest
import os
import pprint
from numpy import testing
import numpy as np
import invest_natcap.fisheries.fisheries_io as fisheries_io
from invest_natcap.fisheries.fisheries_io import MissingParameter
data_directory = './invest-data/test/data/fisheries'
pp = pprin... | 2.515625 | 3 |
cantina_band.py | agimpel/RPi-music | 0 | 40062 | <filename>cantina_band.py
from speaker import Speaker
import time
import RPi.GPIO as GPIO
speaker = Speaker(GPIO.BCM, 23)
speaker.set_bpm(260)
speaker.pause(2)
#1
speaker.play('A1', 1/4)
speaker.play('D2', 1/4)
speaker.play('A1', 1/4)
speaker.play('D2', 1/4)
#2
speaker.play('A1', 1/8)
speaker.play('D2', 1/4)
spea... | 2.453125 | 2 |
examples/example.py | acamero/MIP-EGO | 0 | 40063 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 4 15:57:47 2017
@author: wangronin
"""
import pdb
import numpy as np
from deap import benchmarks
from GaussianProcess_old import GaussianProcess_extra as GaussianProcess
from BayesOpt import BayesOpt, RandomForest, RrandomForest
np.random.seed(1... | 2.046875 | 2 |
test/test_store.py | 64bit/wikiracer | 0 | 40064 | import unittest
import sys
sys.path.append("../")
from store.store import Store
from store.neo4jstore import Neo4jStore
from store.sqlitestore import SqliteStore
from neo4j.v1 import GraphDatabase, basic_auth
#TODO fix tests
'''
class TestStore(unittest.TestCase):
def setUp(self):
self.store = Neo4jStore()
... | 2.71875 | 3 |
sandbox.py | hemagso/loom | 0 | 40065 | from loom.tables import InputTable, DerivedTable
from loom.fields import RawField, DerivedField
t1 = InputTable("main", "table_1", "Table 1", "t1")
RawField(t1, "id", "Id")
RawField(t1, "value", "Value")
RawField(t1, "income", "Customer Income")
t3 = InputTable("main", "table_1", "Table 1", "t3")
RawField(t3... | 2.515625 | 3 |
apps/events/migrations/0005_auto_20180312_1245.py | Strand94/WhatsMappening | 0 | 40066 | # Generated by Django 2.0.2 on 2018-03-12 11:45
import datetime
import django.contrib.gis.db.models.fields
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('events', '0004_auto_20180309_1804'),
]
operations =... | 1.710938 | 2 |
whatsapp_spam.py | Akash1684/Research-Article-Downloader | 2 | 40067 | #NOTE: for this script to work you have to first sign-in on Whatsapp web using QR code
from splinter import Browser
browser = Browser()
browser.visit('https://web.whatsapp.com/')
input('press enter to continue') #to make sure page is completely loaded
count=20;
friend_list=["friend 1","friend 2","friend 3"] #Wha... | 3.109375 | 3 |
dataloader/stereo_kittilist15.py | ne3x7/VCN | 148 | 40068 | <reponame>ne3x7/VCN
import torch.utils.data as data
import pdb
from PIL import Image
import os
import os.path
import numpy as np
IMG_EXTENSIONS = [
'.jpg', '.JPG', '.jpeg', '.JPEG',
'.png', '.PNG', '.ppm', '.PPM', '.bmp', '.BMP',
]
def is_image_file(filename):
return any(filename.endswith(extension) for... | 2.34375 | 2 |
src/web.py | zmcx16/ChaldeaStockObservatory-Core | 0 | 40069 | import requests
from common import *
def send_request(url):
try:
res = requests.get(url)
res.raise_for_status()
except Exception as exc:
print('Generated an exception: %s' % exc)
return ERR_WEB_ERROR, exc
return ERR_SUCCESS, res.text
| 2.78125 | 3 |
app/account/migrations/0009_relation.py | nabechin/article | 0 | 40070 | <reponame>nabechin/article<gh_stars>0
# Generated by Django 2.2.12 on 2020-06-03 11:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('account', '0008_auto_20200530_1309'),
]
ope... | 1.726563 | 2 |
FAUCovidCrawler/AWSKinesisAndFirehose/twitter_firehose.py | Awannaphasch2016/CDKFAUCovid19Cralwer | 0 | 40071 | <reponame>Awannaphasch2016/CDKFAUCovid19Cralwer<gh_stars>0
import boto3
import json
import time
import sys
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
# Variables that contains the user credentials to access Twitter API
consumer_key = 'M2dcKnRZGqBWTrPBXeefFHHjZ... | 2.796875 | 3 |
pyzome/recipes.py | zdlawrence/pyzome | 0 | 40072 | import xarray as xr
from .basic import zonal_mean, zonal_wave_coeffs, zonal_wave_covariance
def _print_if_true(msg, condition, **kwargs):
r"""Simple utility function to print only if the given condition is True.
Parameters
----------
msg : string
The message to print
condition : bool
... | 3.421875 | 3 |
invenio_records_lom/oai.py | fair-data-austria/invenio-records-lom | 0 | 40073 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Graz University of Technology.
#
# invenio-records-lom is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""OAI-PMH serializers for LOM-records."""
from flask import current_app, g
from inv... | 1.851563 | 2 |
data-storage-manager/src/simcore_service_dsm/rest/generated_code/models/error_model.py | mguidon/aiohttp-dsm | 0 | 40074 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from .base_model_ import Model
from .. import util
class ErrorModel(Model):
"""NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.... | 2.484375 | 2 |
tests/scheduler/test_server.py | kwisniewski98/workload-collocation-agent | 40 | 40075 | <filename>tests/scheduler/test_server.py
# Copyright (c) 2020 Intel Corporation
#
# 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 r... | 1.664063 | 2 |
ls4-maintenance/lambda_function.py | TNRIS/lambda-s4 | 3 | 40076 | <gh_stars>1-10
# --------------- IMPORTS ---------------
import os
import boto3
import psycopg2
# Database Connection Info
database = os.environ.get('DB_NAME')
username = os.environ.get('DB_USER')
password = os.environ.get('DB_PASSWORD')
host = os.environ.get('DB_HOST')
port = os.environ.get('DB_PORT')
bucket_name = o... | 2.40625 | 2 |
compmech/stiffpanelbay/tests/test_stiffpanelbay.py | mrosemeier/compmech | 4 | 40077 | import numpy as np
from compmech.stiffpanelbay import StiffPanelBay
from compmech.analysis import freq, lb
def test_freq_models():
print('Testing frequency analysis for StiffPanelBay with 2 plates')
# From Table 4 of
# Lee and Lee. "Vibration analysis of anisotropic plates with eccentric
# stiffen... | 2.40625 | 2 |
Pyrado/scripts/sandbox/sb_cpp_policy.py | jacarvalho/SimuRLacra | 0 | 40078 | """
Script to export a PyTorch-based Pyrado policy to C++
"""
import numpy as np
import torch as to
from rcsenv import ControlPolicy
from pyrado.policies.linear import LinearPolicy
from pyrado.policies.rnn import RNNPolicy
from pyrado.spaces.box import BoxSpace
from pyrado.utils.data_types import EnvSpec
from pyrado.p... | 2.171875 | 2 |
dataLoader.py | klanita/sigoat | 1 | 40079 | <gh_stars>1-10
import os
import math
import numpy as np
from scipy.sparse import random
from scipy.stats import rv_continuous
from functools import reduce
from operator import __add__
from torch.utils.data import Dataset
from scipy.sparse.linalg import lsqr
import torch
import h5py
from torchvision.utils import make_gr... | 1.609375 | 2 |
fwd9m/utils.py | MFreidank/tensorflow-determinism | 0 | 40080 | <filename>fwd9m/utils.py
# Copyright 2020 NVIDIA Corporation. 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... | 2.4375 | 2 |
blog/admin.py | DongQinglin/djangoblog | 0 | 40081 | <reponame>DongQinglin/djangoblog<gh_stars>0
from django.contrib import admin
from .models import Banner, ArticleTag, ArticleKind, Article, Link, Recommend
# Register your models here.
@admin.register(Article)
class ArticleAdmin(admin.ModelAdmin):
# 添加想要展示的字段
list_display = ('id', 'kind', 'title', 'recommend', ... | 2.0625 | 2 |
simulation/model/blocks/order.py | fladdimir/csa-simulation-based-sc-forecast | 2 | 40082 | import logging
from casymda.blocks.entity import Entity
from simpy.core import Environment
class Order(Entity):
def __init__(self, env: Environment, name: str):
super().__init__(env, name)
self._time_of_acceptance = -1
self._initial_eta = -1
self._eta = -1
self._ready_at ... | 2.46875 | 2 |
tests/delta.py | hiidef/hiispider | 2 | 40083 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for delta functions."""
from unittest import TestCase
from hiispider import delta
from pprint import pprint
import os
import random
import time
from datetime import datetime
from hiiguid import HiiGUID
srt = lambda l: list(sorted(l))
DATAPATH = os.path.abspath(... | 2.734375 | 3 |
src/advisor/naive_comment_parser.py | arm-hpc/porting-advisor | 13 | 40084 | <filename>src/advisor/naive_comment_parser.py<gh_stars>10-100
"""
Copyright 2018 Arm Ltd.
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... | 2.703125 | 3 |
python/en/_numpy/python_numpy_tutorial/python_numpy_tutorial-python-containers_dictionary.py | aimldl/coding | 0 | 40085 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS231n Convolutional Neural Networks for Visual Recognition
http://cs231n.github.io/
Python Numpy Tutorial
http://cs231n.github.io/python-numpy-tutorial/
 ̄
python_numpy_tutorial-python-containers_dictionary.py
2019-07-03 (Wed)
"""
# Python Numpy Tutorial > Python > C... | 3.9375 | 4 |
src/textacy/extract/keyterms/__init__.py | austinjp/textacy | 1,929 | 40086 | """
Keyterms
--------
:mod:`textacy.extract.keyterms`: Extract keyterms from documents using a variety of
rule-based algorithms.
"""
from .scake import scake
from .sgrank import sgrank
from .textrank import textrank
from .yake import yake
| 1.28125 | 1 |
CursoEmVideo/Python/Mundo1/ex003 - somando dois numeros.py | Rodrigofsiqueira/Estudo | 0 | 40087 | <reponame>Rodrigofsiqueira/Estudo
valor1 = int(input('Digite o primeiro valor a ser somado: '))
valor2 = int(input('Digite o segundo valor: '))
soma = valor1 + valor2
print('A soma entre {} e {} é igual a {}.'.format(valor1, valor2, soma))
| 3.875 | 4 |
examples/sumo/sugiyama_8.py | cuijiaxun/MITC | 1 | 40088 | <reponame>cuijiaxun/MITC<gh_stars>1-10
"""Used as an example of sugiyama experiment.
This example consists of 22 IDM cars on a ring creating shockwaves.
"""
from flow.controllers import IDMController, ContinuousRouter
from flow.core.experiment import Experiment
from flow.core.params import SumoParams, EnvParams, \
... | 2.625 | 3 |
scrapyu/_mongodb.py | lin-zone/scrapyu | 1 | 40089 | import logging
from pymongo import MongoClient
from scrapy.exceptions import CloseSpider
class MongoDBPipeline(object):
config = {
'uri': 'mongodb://localhost:270017',
'database': 'scrapyu',
'collection': 'items',
'unique_key': None,
'buffer_length': 0,
}
def ope... | 2.484375 | 2 |
3D_CNNs/S3DG_small.py | Seunghoon-Yi/Paper_review-PyTorch | 2 | 40090 | import torch.nn as nn
import torch
import os
class BasicConv3d(nn.Module):
def __init__(self, in_planes, out_planes, kernel_size, stride, padding=0):
super(BasicConv3d, self).__init__()
self.conv = nn.Conv3d(in_planes, out_planes, kernel_size=kernel_size, stride=stride, padding=padding, bi... | 2.59375 | 3 |
cfdcode/__init__.py | pxr687/cfd2021 | 1 | 40091 | <filename>cfdcode/__init__.py<gh_stars>1-10
""" Support code for textbook
"""
from . import ucb_page
def setup(app):
ucb_page.setup(app)
| 0.996094 | 1 |
Image Classification/CGIAR Computer Vision for Crop Disease/Zindi-CGIAR-master/CGIAR/slim/utils/learning_rate_schedule.py | ZindiAfrica/Computer-Vision | 11 | 40092 | <reponame>ZindiAfrica/Computer-Vision
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framew... | 2.515625 | 3 |
tracker/migrations/0016_merge_20190914_1249.py | TreZc0/donation-tracker | 39 | 40093 | <filename>tracker/migrations/0016_merge_20190914_1249.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-09-14 16:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tracker', '0015_add_speedrun_twitch_name'),
('tracker', '0015_add_allow_d... | 1.15625 | 1 |
src/nasty_utils/io_.py | lschmelzeisen/nasty-utils | 1 | 40094 | #
# Copyright 2019-2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | 2.0625 | 2 |
tests/settings/imagemagick.py | apahomov/sorl-thumbnail | 630 | 40095 | <filename>tests/settings/imagemagick.py
from .default import *
THUMBNAIL_ENGINE = 'sorl.thumbnail.engines.convert_engine.Engine'
THUMBNAIL_CONVERT = 'convert'
| 1.132813 | 1 |
gallery/models.py | tinyx/yitao.io | 0 | 40096 | <reponame>tinyx/yitao.io
from django.db import models
from filer.fields.image import FilerImageField
class Image(models.Model):
name = models.CharField(
max_length=255, null=False, blank=False, help_text="The name of the image"
)
description = models.TextField(
null=True,
blank=Tru... | 2.40625 | 2 |
airpurifier2.py | id872/airpurifier2 | 1 | 40097 | <reponame>id872/airpurifier2<filename>airpurifier2.py
#!/usr/bin/env python3.6
import sys
try:
from PyQt5.QtWidgets import QApplication, QMainWindow
from PyQt5.QtCore import QTimer
from PyQt5.QtWidgets import QMessageBox
except ImportError:
print('PyQt5 is required to run this script')
sys.exit(1)
... | 2.234375 | 2 |
4_SC_project/courses/views.py | abdullah1107/Django-for-Begineers | 0 | 40098 | <gh_stars>0
from django.shortcuts import render
from rest_framework import viewsets
from courses.models import MyCourse
from courses.serializers import CourseSerializer
# Create your views here.
class CourseView(viewsets.ModelViewSet):
queryset = MyCourse.objects.all()
serializer_class = CourseSerializer
| 1.789063 | 2 |
mpisppy/utils/pysp_model/tests/test_scenariotree.py | Matthew-Signorotti/mpi-sppy | 2 | 40099 | # ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC... | 2.140625 | 2 |