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 |
|---|---|---|---|---|---|---|
tests/test_local_tile_server.py | FlorianPignol/telluric | 0 | 33800 | <filename>tests/test_local_tile_server.py
from os import path
from unittest import mock
from common_for_tests import make_test_raster
from tornado.testing import gen_test, AsyncHTTPTestCase
from tornado.concurrent import Future
import telluric as tl
from telluric.util.local_tile_server import TileServer, make_app, Til... | 2.28125 | 2 |
utilities/error.py | pskanade/stretch | 0 | 33801 | class Error():
def __init__(self):
print("An error has occured !")
class TypeError(Error):
def __init__(self):
print("This is Type Error\nThere is a type mismatch.. ! Please fix it.") | 3.140625 | 3 |
skypy/galaxies/__init__.py | itrharrison/skypy-itrharrison | 88 | 33802 | """
This module contains methods that model the intrinsic properties of galaxy
populations.
"""
__all__ = [
'schechter_lf',
]
from . import luminosity # noqa F401,F403
from . import morphology # noqa F401,F403
from . import redshift # noqa F401,F403
from . import spectrum # noqa F401,F403
from . import stella... | 1.648438 | 2 |
tests/__init__.py | s-leroux/sql-moins | 0 | 33803 | <filename>tests/__init__.py
from tests.parser import *
from tests.formatter import *
from tests.utils import *
| 1.289063 | 1 |
appshell/endpoints.py | adh/appshell | 3 | 33804 | from appshell.base import View
from appshell.templates import confirmation, message
from flask import request, flash, redirect
from flask_babelex import Babel, Domain
mydomain = Domain('appshell')
_ = mydomain.gettext
lazy_gettext = mydomain.lazy_gettext
class ConfirmationEndpoint(View):
methods = ("GET", "POST"... | 2.234375 | 2 |
flask_cc_api/utils/requests_utils.py | suAdminWen/cc-api | 6 | 33805 | from flask import g, request
from flask_restful import reqparse
from werkzeug import datastructures
from ..exceptions.system_error import SystemError
from ..exceptions.system_exception import SystemException
from ..exceptions.service_error import ServiceError
from ..exceptions.service_exception import ServiceException... | 2.71875 | 3 |
grouper_lib/parent.py | Saevon/Recipes | 0 | 33806 | import itertools
class ParentFinder(object):
'''
Finds which parent an item should go under
'''
def __init__(self):
self.__parents = {}
def hash(self, item):
if item.prefix:
return item.prefix
else:
return item.group_name
def add(self, parent... | 3.03125 | 3 |
tests/test_memory.py | Lewuathe/algernon | 0 | 33807 | <reponame>Lewuathe/algernon
from algernon.memory import Memory
import pytest
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense
from keras.optimizers import sgd
class MockModel:
def __init__(self, output_dims, input_dims):
self.w = np.random.random(size=(output_dim... | 2.625 | 3 |
m2critic/parse.py | z33kz33k/m2critic | 0 | 33808 | <reponame>z33kz33k/m2critic<filename>m2critic/parse.py
"""
m2critic.parse
~~~~~~~~~~~~~~~
Scrape page.
@author: z33k
"""
from pathlib import Path
from typing import List, Tuple
from bs4 import BeautifulSoup
from bs4.element import Tag
from m2critic import BasicUser
FORBIDDENSTR = "403 Forbidden"... | 2.84375 | 3 |
droidlet/dialog/robot/dialogue_objects/__init__.py | CowherdChris/droidlet | 0 | 33809 | from .loco_dialogue_object import LocoBotCapabilities
__all__ = [LocoBotCapabilities] | 1.046875 | 1 |
yo_fluq_ds/_fluq/_common.py | okulovsky/yo_ds | 16 | 33810 | from .._common import *
from yo_fluq import *
Queryable = lambda *args, **kwargs: FlupFactory.QueryableFactory(*args, **kwargs)
T = TypeVar('T')
TOut = TypeVar('TOut')
TKey = TypeVar('TKey')
TValue = TypeVar('TValue')
TFactory = TypeVar('TFactory') | 1.78125 | 2 |
tools/BlenderProc/src/object/ObjectPoseSampler.py | GeorgSchenzel/pose-detector | 0 | 33811 | import bpy
import mathutils
from src.main.Module import Module
from src.utility.BlenderUtility import check_intersection, check_bb_intersection, get_all_mesh_objects
class ObjectPoseSampler(Module):
"""
Samples positions and rotations of selected object inside the sampling volume while performing mesh and
... | 2.625 | 3 |
models.py | harmonyinnovationhub/project-beta | 0 | 33812 | <reponame>harmonyinnovationhub/project-beta
from core import app
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
db = SQLAlchemy(app)
migrate = Migrate(app, db)
# user table
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
token = db.Column(db.String(50), unique=T... | 2.328125 | 2 |
create_swag/lm/load_data.py | gauravkmr/swagaf | 182 | 33813 | <reponame>gauravkmr/swagaf<gh_stars>100-1000
# First make the vocabulary, etc.
import os
import pickle as pkl
import random
import simplejson as json
from allennlp.common.util import get_spacy_model
from allennlp.data import Instance
from allennlp.data import Token
from allennlp.data import Vocabulary
from allennlp.d... | 2.296875 | 2 |
psana/psana/momentum/Energy.py | JBlaschke/lcls2 | 16 | 33814 | import numpy as np
def CalcEnergy(m_amu,Px_au,Py_au,Pz_au):
amu2au = 1836.15
return 27.2*(Px_au**2 + Py_au**2 + Pz_au**2)/(2*amu2au*m_amu)
| 2.25 | 2 |
timer.py | davidbarkhuizen/simagora | 1 | 33815 | <gh_stars>1-10
from time import clock
import logging
#~ class Timer(object):
#~
#~ def start(self,s):
#~ self.s = s
#~ self.started = clock()
#~
#~ def stop(self):
#~ self.stopped = clock()
#~ t = self.stopped - self.started
#~ self.log(t)
#~
#~ def log(self, t):
#~ lin... | 3.09375 | 3 |
prototype/data/datasets/__init__.py | Sense-GVT/BigPretrain | 8 | 33816 | from .imagenet_dataset import ImageNetDataset, RankedImageNetDataset # noqa
from .custom_dataset import CustomDataset # noqa
from .imagnetc import ImageNet_C_Dataset
| 1.101563 | 1 |
setup.py | BCD65/electricityLoadForecasting | 0 | 33817 | <gh_stars>0
import setuptools
from distutils.core import setup
setup(
name = 'electricityLoadForecasting',
version = '0.1.dev0',
packages = setuptools.find_packages(),
scripts = ['scripts/main_forecasting.py',
'scripts/preprocessi... | 1.054688 | 1 |
python-client/trustedanalytics/core/graph.py | skavulya/atk | 0 | 33818 | <reponame>skavulya/atk
# vim: set encoding=utf-8
#
# Copyright (c) 2015 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/LICENS... | 1.46875 | 1 |
sound_play/scripts/test/test_sound_client.py | iory/audio_common | 742 | 33819 | <filename>sound_play/scripts/test/test_sound_client.py
#!/usr/bin/env python
import unittest
import rospy
import rostest
from sound_play.libsoundplay import SoundClient
class TestCase(unittest.TestCase):
def test_soundclient_constructor(self):
s = SoundClient()
self.assertIsNotNone(s)
if __name_... | 2.15625 | 2 |
misc/getch.py | Chiel92/tfate | 3 | 33820 | #!python
"""This module is for messing with input characters."""
import os
import sys
unicurses_path = os.path.dirname(os.path.abspath(__file__)) + '/../libs/unicurses'
sys.path.insert(0, unicurses_path)
import unicurses as curses
def key_info(key):
try:
_ord = ord(key)
except:
_ord = -1
t... | 3.71875 | 4 |
exercises/linked-list/example.py | haithamk/python-exercism | 1 | 33821 | class Node(object):
def __init__(self, value, next=None, prev=None):
self.value = value
self.next = next
self.prev = prev
class LinkedList(object):
def __init__(self):
self.head = None
self.tail = None
self.length = 0
def push(self, value):
new_node... | 4.03125 | 4 |
tests/unitTest/testBitWiseSupervisor.py | huitredelombre/BERBER | 0 | 33822 | <gh_stars>0
import unittest
import sys
sys.path.append("../../src/")
from supervisors.bitWiseSupervisor import BitWiseSupervisor
from senders.scapySender import ScapySender
from simulations.randomSimulation import RandomSimulation
class testArgParser(unittest.TestCase):
def testApplyBER(self):
sender =... | 2.5625 | 3 |
headless_chrome.py | MineRobber9000/discordscript | 0 | 33823 | from selenium import webdriver
def _options_factory():
"""Produces a selenium.webdriver.ChromeOptions object. Used to force "headless" on invocation. You shouldn't call this function."""
ret = webdriver.ChromeOptions()
ret.add_argument("headless")
return ret
def get_driver(*varargs,args=[]):
"""Creates headless ... | 2.734375 | 3 |
lemonsoap/scent/columns_scent.py | Ekrekr/LemonSoap | 0 | 33824 | # -*- coding: utf-8 -*-
"""
LemonSoap - headers scent.
Deals with column headers.
"""
import pandas as pd
import inflection
import re
import logging
from ..lemon_bar import LemonBar
from .scent_template import ScentTemplate
class ColumnsScent(ScentTemplate):
"""
Manages headers issue identification and fixi... | 2.875 | 3 |
experiments/expression/codex/codex_alignment.py | andrewcharlesjones/spatial-alignment | 14 | 33825 | <reponame>andrewcharlesjones/spatial-alignment
import pandas as pd
from os.path import join as pjoin
import numpy as np
import matplotlib.pyplot as plt
DATA_DIR = "../../../data/codex"
data = pd.read_csv(pjoin(DATA_DIR, "codex_mrl_expression.csv")) # , nrows=200)
marker_names = data.columns.values[1:-8]
sample_names... | 2.59375 | 3 |
plugins/pie_branding.py | juergenz/pie | 0 | 33826 | <reponame>juergenz/pie<gh_stars>0
import pie
@pie.eventhandler('pie.PlayerChat')
async def onLoad():
pass | 1.257813 | 1 |
teleband/users/api/views.py | JMU-CIME/CPR-Music-Backend | 2 | 33827 | <reponame>JMU-CIME/CPR-Music-Backend
import collections
import csv
from io import StringIO
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.core.exceptions import ValidationError
from django.core.validators import validate_email
from rest_framework import permiss... | 2.015625 | 2 |
models/ri_pcn.py | RexSkywalkerLee/VRCNet | 0 | 33828 | <gh_stars>0
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
import torch.nn.functional as F
import math
from utils.model_utils import *
from utils.ri_utils import *
from models.vrcnet import Linear_ResBlock
class PCN_encoder(nn.Module):
def... | 2.328125 | 2 |
tests/unit/test_game.py | BrunoASNascimento/ETHGlobal-Project | 0 | 33829 | <filename>tests/unit/test_game.py
from scripts.helpful_scripts import (
LOCAL_BLOCKCHAIN_ENVIRONMENTS,
get_account,
fund_with_link,
get_contract,
)
from brownie import Game, accounts, config, network, exceptions
from scripts.deploy_game import deploy_game
from web3 import Web3
import pytest
# if netwo... | 2.328125 | 2 |
arquivos_de_exercicios_descubra_o_python/Cap. 04/escreveArquivo_start.py | DiegoDBLe/Python-Linkedin | 0 | 33830 | <reponame>DiegoDBLe/Python-Linkedin
#
# Escrevendo arquivos com funções do Python
#
def escreveArquivo():
arquivo = open('NovoArquivo.txt', 'w+')
arquivo.write('Linha gerada com a função Escrevendo Arquivo \r\n')
arquivo.close()
#escreveArquivo()]
def alteraArquivo():
arquivo = open('NovoArquivo.t... | 3.109375 | 3 |
graphio/queries/query_parameters.py | JTaeger/graphio | 0 | 33831 | <gh_stars>0
def params_create_rels_unwind_from_objects(relationships, property_identifier=None):
"""
Format Relationship properties into a one level dictionary matching the query generated in
`query_create_rels_from_list`. This is necessary because you cannot access nested dictionairies
in the UNWIND qu... | 2.859375 | 3 |
user/migrations/0002_userprofile_relations.py | Trippr-dwoc/Trippr-backend | 0 | 33832 | # Generated by Django 3.2.3 on 2021-10-19 18:54
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='userprofile',
... | 1.71875 | 2 |
src/utils/testing_utils.py | rluiseugenio/dpa_rita | 0 | 33833 | #python -m marbles test_semantic_columns.py
import unittest
from marbles.mixins import mixins
import pandas as pd
import requests
from pyspark.sql import SparkSession
import psycopg2 as pg
import pandas as pd
import marbles
from pyspark.sql.types import StructType, StructField, StringType
import psycopg2 as pg
#from s... | 2.15625 | 2 |
polygon.py | darinamazur/Math-modeling- | 0 | 33834 | import math
class polygon:
def __init__(self, arr):
self.original_arr = arr
self.size = len(self.original_arr)
self.__set_min_max_by_original__()
self.__refactor_original_seq__()
self.sorted_arr.append(self.sorted_arr[0])
self.size += 1
def __set_min_max_by_ori... | 3.171875 | 3 |
post_processing/utils.py | fywalter/TorchSeg | 0 | 33835 |
# coding: utf-8
# In[20]:
import numpy as np
import pydensecrf.densecrf as dcrf
import os
import cv2
import random
from tqdm import tqdm
# In[21]:
from skimage.color import gray2rgb
from skimage.color import rgb2gray
import matplotlib.pyplot as plt
from sklearn.metrics import f1_score, accuracy_score
from pyden... | 2.359375 | 2 |
lists/management/commands/seed_list.py | nasir733/airbnb-clone | 0 | 33836 | import random
from django.core.management.base import BaseCommand
from django.contrib.admin.utils import flatten
from django_seed import Seed
from lists import models as list_models
from users import models as user_models
from rooms import models as room_models
NAME = "lists"
class Command(BaseCommand):
help =... | 2.3125 | 2 |
rdkit/DataStructs/UnitTestBitEnsemble.py | kazuyaujihara/rdkit | 1,609 | 33837 | <gh_stars>1000+
# $Id$
#
# Copyright (C) 2003-2006 <NAME> and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" unit test... | 2.265625 | 2 |
simple_classroom/apps/classroom/migrations/0003_auto_20150207_1835.py | maxicecilia/simple_classroom | 7 | 33838 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('classroom', '0002_assignment_description'),
]
operations = [
migrations.AddField(
model_name='assignment',
... | 1.65625 | 2 |
pyburst/misc/resolution.py | zacjohnston/pyburst | 4 | 33839 | import numpy as np
import matplotlib.pyplot as plt
import os
from pyburst.grids import grid_analyser, grid_strings, grid_tools
# resolution tests
y_factors = {'dt': 3600,
'fluence': 1e39,
'peak': 1e38,
}
y_labels = {'dt': '$\Delta t$',
'rate': 'Burst rate',
... | 2 | 2 |
scielomanager/journalmanager/models.py | jamilatta/scielo-manager | 0 | 33840 | <reponame>jamilatta/scielo-manager
# -*- encoding: utf-8 -*-
import urllib
import hashlib
import logging
import choices
import caching.base
from scielomanager import tools
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from django.db import (
models,
t... | 1.71875 | 2 |
award/forms.py | aiventimptner/stura | 0 | 33841 | <gh_stars>0
from datetime import timedelta
from django import forms
from django.core.exceptions import ValidationError
from django.core.mail import send_mail
from django.http import HttpRequest
from django.urls import reverse
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from... | 2.375 | 2 |
src/train-transformer.py | ARLab-VT/VT-Natural-Motion-Processing | 11 | 33842 | # Copyright (c) 2020-present, Assistive Robotics Lab
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from transformers.training_utils import fit
from transformers.transformers import (
InferenceTransformerEncoder,
... | 1.992188 | 2 |
amocrm_asterisk_ng/integration/Integration.py | iqtek/amocrn_asterisk_ng | 0 | 33843 | <reponame>iqtek/amocrn_asterisk_ng
from typing import Collection
from typing import Sequence
from glassio.initializable_components import InitializableComponent
from glassio.logger import InitializableLogger
from amocrm_asterisk_ng.scenario import IScenario
__all__ = [
"Integration",
]
class Integration:
... | 2.0625 | 2 |
src/pyro_util/modules/__init__.py | MacoskoLab/pyro-util | 0 | 33844 | from typing import Tuple
import torch
import torch.nn as nn
from pyro.distributions.util import broadcast_shape
from pyro_util.modules.weight_scaling import GammaReLU, WSLinear
T = torch.Tensor
def make_ws_fc(*dims: int) -> nn.Module:
"""Helper function for creating a fully connected neural network.
This v... | 2.96875 | 3 |
catalog_harvesting/util.py | ioos/catalog-harvesting | 0 | 33845 | #!/usr/bin/env python
'''
catalog_harvesting/util.py
General utilities for the project
'''
import random
def unique_id():
'''
Return a random 17-character string that works well for mongo IDs
'''
charmap = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
return ''.join([random.cho... | 2.890625 | 3 |
render.py | ondrejkoren/WeatherFrame | 2 | 33846 | from WeatherScreens.RingScreen import RingScreen
from WeatherScreens.QuadrantScreen import QuadrantScreen
from WeatherScreens.ImageScreen import ImageScreen
from WeatherScreens.ScreenBase import ScreenBase
from datetime import datetime, timedelta
from suntime import Sun, SunTimeException
from dateutil import tz
import ... | 2.390625 | 2 |
evergreen/manage/website/page/urls.py | craigsander/evergreen | 0 | 33847 | from django.conf.urls import url, include
from django.conf import settings
from . import views
# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
url(r'manage/', views.index),
]
| 1.59375 | 2 |
algos/td3.py | SrikarValluri/hidden-state-rrl-sl | 0 | 33848 | <reponame>SrikarValluri/hidden-state-rrl-sl
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import random
from algos.dpg import eval_policy, collect_experience
from algos.dpg import ReplayBuffer
class TD3():
def __init__(self, actor, q1, q2, a_lr, c_lr, discount=0.... | 2.21875 | 2 |
Hackathon 4.0_2021-01-08_07-22-55.py | ClointFusion-Community/CFC-Projects | 0 | 33849 | # This code is generated automatically by ClointFusion BOT Builder Tool.
import ClointFusion as cf
import time
cf.window_show_desktop()
cf.mouse_click(int(cf.pg.size()[0]/2),int(cf.pg.size()[1]/2))
try:
cf.mouse_click(*cf.mouse_search_snip_return_coordinates_x_y(r'C:\Users\mrmay\AppData\Local\Temp\cf_log_5fa2... | 2.203125 | 2 |
examples/2d/obsolete/gravity/generate_statedb.py | Grant-Block/pylith | 93 | 33850 | #!/usr/bin/env nemesis
"""
This script creates a spatial database for the initial stress and state
variables for a Maxwell plane strain material.
"""
sim = "gravity_vardensity"
materials = ["crust","mantle"]
import numpy
import h5py
from spatialdata.spatialdb.SimpleIOAscii import SimpleIOAscii
from spatialdata.geoco... | 2.5 | 2 |
Python_Examples/BehaviorPolicy.py | dquail/GVFMinecraft | 0 | 33851 | from random import randint
import numpy as np
import random
class BehaviorPolicy:
def __init__(self):
self.lastAction = 0
self.i = 0
self.ACTIONS = {
'forward': "move 1",
'back': "move -1",
'turn_left': "turn 1",
'extend_hand':"attack 1"
}
def policy(self, state):
se... | 3.46875 | 3 |
Lists/In_Lists.py | obareau/python_travaux_pratiques | 1 | 33852 | # Check if the value is in the list?
words = ['apple', 'banana', 'peach', '42']
if 'apple' in words:
print('found apple')
if 'a' in words:
print('found a')
else:
print('NOT found a')
if 42 in words:
print('found 42')
else:
print('NOT found 42')
# found apple
# NOT found a
# NOT found 42 | 4.1875 | 4 |
src/genesis_api_wrapper/catalogue.py | j-suchard/destatis-genesis-api | 0 | 33853 | import datetime
import typing
from . import enums, tools
class CatalogueAPIWrapper:
"""Methods for listing objects"""
def __init__(
self, username: str, password: str, language: enums.Language = enums.Language.GERMAN
):
"""Create a new Wrapper containing functions for listing different o... | 3.125 | 3 |
python/rsa_encrypt_decrypt.py | hipro/hipro | 0 | 33854 | # coding: utf-8
"""加密算法:公钥(私钥)加密,私钥解密"""
from Crypto.PublicKey import RSA
from Crypto import Random
DATA = 'Hello, word!'
PRIVATE_KEY_PEM = """-----<KEY>"""
PUBLIC_KEY_PEM = """-----<KEY>"""
def _encrypt_by_public():
random_func = Random.new().read
public_key = RSA.importKey(PUBLIC_KEY_PEM)
encrypted =... | 3.515625 | 4 |
users/views.py | migleankstutyte/kaavapino | 3 | 33855 | from django.contrib.auth import get_user_model
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
from users.serializers import UserSerializer
class UserViewSet(mixins.RetrieveModelMixin, mixins.ListModelMixin, GenericViewSet):
queryset = get_user_model().objects.all()
seria... | 1.984375 | 2 |
interpreted/python.py | bupboi1337/Hello-World-Collection | 2 | 33856 | print("Hello, World!")
print("This uses the MIT Licence!")
| 1.742188 | 2 |
survae/tests/transforms/bijections/conditional/coupling/coupling_mixtures.py | alisiahkoohi/survae_flows | 262 | 33857 | <filename>survae/tests/transforms/bijections/conditional/coupling/coupling_mixtures.py
import numpy as np
import torch
import torch.nn as nn
import torchtestcase
import unittest
from survae.transforms.bijections.conditional.coupling import *
from survae.nn.layers import ElementwiseParams, ElementwiseParams2d, scale_fn
... | 2.078125 | 2 |
shop_website/shop/migrations/0002_auto_20200228_1533.py | omar00070/django-shopping-website | 0 | 33858 | <filename>shop_website/shop/migrations/0002_auto_20200228_1533.py
# Generated by Django 3.0.3 on 2020-02-28 15:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0001_initial'),
]
operations = [
migrations.AlterField(
... | 1.335938 | 1 |
machines/migrations/0001_initial.py | minikdo/domino | 0 | 33859 | <reponame>minikdo/domino
# Generated by Django 2.2.3 on 2019-07-21 01:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Device',
... | 1.921875 | 2 |
src/openweather/OpenWeatherParser.py | ralfe/wpi | 0 | 33860 | <gh_stars>0
__author__ = 'renderle'
class OpenWeatherParser:
def __init__(self, data):
self.data = data
def getValueFor(self, idx):
return self.data['list'][idx]
def getTemperature(self):
earlymorningValue = self.getValueFor(0)['main']['temp_max']
morningValue = self.getV... | 2.609375 | 3 |
docs/make_docs.py | yacth/autogoal | 0 | 33861 | <reponame>yacth/autogoal<filename>docs/make_docs.py
# Convert examples in this folder to their corresponding .md files in docs/examples
import re
import inspect
import textwrap
import datetime
import yaml
from pathlib import Path
def hide(line):
return ":hide:" in line
def build_examples():
current = Path(... | 2.875 | 3 |
MVMOO/multi_mixed_optimiser.py | jmanson377/MVMOO | 5 | 33862 | <filename>MVMOO/multi_mixed_optimiser.py<gh_stars>1-10
import numpy as np
from scipy.stats import norm
from .mixed_optimiser import MVO
from scipy.optimize import shgo, differential_evolution, dual_annealing
import scipy as stats
class MVMOO(MVO):
"""
Multi variate mixed variable optimisation
"""
def _... | 2.625 | 3 |
chainer/links/connection/mgu.py | Qwinpin/chainer | 1 | 33863 | import numpy
import chainer
from chainer.backends import cuda
from chainer.functions.activation import sigmoid
from chainer.functions.activation import tanh
from chainer.functions.array import concat
from chainer.functions.math import linear_interpolate
from chainer import link
from chainer.links.connection import lin... | 2.359375 | 2 |
backend/api/v1/rest.py | aroraenterprise/projecteos | 0 | 33864 | <gh_stars>0
"""
Project: flask-rest
Author: <NAME>
Description: Initializes the rest app
"""
from collections import OrderedDict
import flask
from api.v1 import Api
class _SageRest(flask.Flask):
_api = None
__modules = []
_modules = {}
_ordered_modules = OrderedDict()
_auth_module = None
de... | 2.296875 | 2 |
torchreid/losses/log_euclid_loss.py | fremigereau/MTDA_KD_REID | 0 | 33865 | <reponame>fremigereau/MTDA_KD_REID
from __future__ import absolute_import
from __future__ import division
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchreid.metrics import compute_distance_matrix
import scipy.linalg
def adjoint(A, E, f):
A_H = A.T.conj().to(E.dtype)
n = A.size(0... | 2 | 2 |
app/rockband/tests/test_member_api.py | solattila/rock-band-api | 0 | 33866 | from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Member, Band
from rockband.serializers import MemberSerializer
MEMBERS_URL = reverse('rockband:member-l... | 2.703125 | 3 |
bot.py | bufgix/slave | 8 | 33867 | from slave.playground.bots import BotInformation
from slave.lib.bots import BotBasic, BotV2
config = {
'host': 'chat.freenode.net',
'port': 6667,
'channel': "#slavebotpool666",
'boss_name': 'boss666',
'bot_prefix': "SLAVEBOT"
}
BotInformation.read_config_from_dict(config)
BotInformation.use_other... | 2.03125 | 2 |
Desafios-intermediarios-em-Python/Crescente e Decrescente.py | Alexsandramaran/Desafios-Intermedi-rios-Python | 0 | 33868 | <gh_stars>0
X = []
Y = []
cont = 0
n = True
while n:
a,b = input().split(" ")
a = int(a)
b = int(b)
if a == b:
n = False
cont-=1
else:
X.append(a)
Y.append(b)
cont+=1
i = 0
while i < cont:
if X[i] > Y[i]:
print('Decrescente')
... | 3.296875 | 3 |
utils/generate-sha256.py | dskrvk/anteater | 177 | 33869 | ##############################################################################
# Copyright (c) 2017 <NAME> <<EMAIL>>, Red Hat
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is availab... | 2.09375 | 2 |
modules/tts/fs2_orig.py | zjumml/NATSpeech | 1 | 33870 | <reponame>zjumml/NATSpeech<filename>modules/tts/fs2_orig.py<gh_stars>1-10
import torch
from torch import nn
from modules.commons.layers import Embedding
from modules.commons.nar_tts_modules import EnergyPredictor, PitchPredictor
from modules.tts.commons.align_ops import expand_states
from modules.tts.fs import FastSpee... | 2.015625 | 2 |
snets_factory.py | yoosan/i3d-tensorflow | 59 | 33871 | <reponame>yoosan/i3d-tensorflow<filename>snets_factory.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import tensorflow as tf
import i3d, i3d_v2, r3d
FLAGS = tf.flags.FLAGS
networks_map = {'i3d_v1': i3d.I3D,
'i3d_v2': i... | 2.28125 | 2 |
__init__.py | lcit/metrics_delin | 8 | 33872 | from .utils import *
from .path_based import toolong_tooshort, opt_p
from .graph_based import holes_marbles, opt_g
from .pixel_based import corr_comp_qual
from .junction_based import opt_j | 0.980469 | 1 |
deepinesStore/cardg.py | xoascf/store_deepines | 6 | 33873 | <filename>deepinesStore/cardg.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'guis/card.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class QLabelClickable(QtWidg... | 1.984375 | 2 |
blog/views.py | lizheng3401/MetaStudio | 0 | 33874 | <gh_stars>0
from django.shortcuts import render,get_object_or_404, redirect
from .models import Category, Tag, Post
from game.models import GameCategory, Game
from comment.forms import BlogCommentForm,SubBCommentForm
from comment.models import BlogComment,SubBComment
from .forms import PostForm
def index(request):
... | 2.140625 | 2 |
cli4/__main__.py | pygrigori/python-cloudflare | 465 | 33875 | #!/usr/bin/env python
"""Cloudflare API via command line"""
from __future__ import absolute_import
import sys
from .cli4 import cli4
def main(args=None):
"""Cloudflare API via command line"""
if args is None:
args = sys.argv[1:]
cli4(args)
if __name__ == '__main__':
main()
| 1.6875 | 2 |
jsonate/exceptions.py | weswil07/JSONate | 5 | 33876 | <reponame>weswil07/JSONate
class CouldntSerialize(Exception): pass | 1.070313 | 1 |
uq360/algorithms/blackbox_metamodel/metamodel_regression.py | Sclare87/UQ360 | 148 | 33877 | import inspect
from collections import namedtuple
import numpy as np
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.model_selection import train_test_split
from sklearn.exceptions import NotFittedError
from uq360.algorithms.posthocuq import PostHocUQ
class MetamodelRegression(PostHocUQ):
"""... | 2.453125 | 2 |
neural/net_templates.py | deepmind/constrained_optidice | 1 | 33878 | <gh_stars>1-10
# Copyright 2022 DeepMind Technologies Limited
#
# 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 applicab... | 1.9375 | 2 |
test_example.py | cmput401-fall2018/web-app-ci-cd-with-travis-ci-pennyfea | 0 | 33879 | <reponame>cmput401-fall2018/web-app-ci-cd-with-travis-ci-pennyfea
def test_example():
num1 = 1
num2 = 3
if num2 > num1:
print("Working")
| 1.765625 | 2 |
dendron/extension.py | mandarvaze/ulauncher-dendron | 0 | 33880 | import logging
import subprocess
from threading import Thread
from ulauncher.api.client.Extension import Extension
from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent, \
PreferencesEvent, PreferencesUpdateEvent
from ulauncher.api.shared.action.ExtensionCustomAction import \
ExtensionCustomA... | 2.03125 | 2 |
src/Deque/deque_scratch.py | shapovalovdev/AlgorythmsAndDataStructures | 0 | 33881 | <reponame>shapovalovdev/AlgorythmsAndDataStructures
class Node:
def __init__(self,v):
self.next=None
self.prev=None
self.value=v
class Deque:
def __init__(self):
self.front=None
self.tail=None
def addFront(self, item):
node=Node(item)
if self.front is... | 3.71875 | 4 |
buzzard/test/test_footprint_tile.py | ashnair1/buzzard | 30 | 33882 | # pylint: disable=redefined-outer-name
# pylint: disable=too-many-lines
import itertools
import pytest
from buzzard.test.tools import assert_tiles_eq
from buzzard.test import make_tile_set
ANY = 42
PARAMS1 = {
'extend',
'overlap',
'exclude',
'exception',
'shrink',
}
PARAMS2 = {'br', 'tr', 'tl',... | 2.203125 | 2 |
mniconvert/combine_func_redgreen.py | parenthetical-e/wheelerdata | 1 | 33883 | <gh_stars>1-10
"""Combine ar* functional data in along their 4th axes.
usage: combined_func_redgreen datadir
"""
import sys
import os
from roi.pre import combine4d
from roi.io import read_nifti, write_nifti
# Process the argv
if len(sys.argv[1:]) != 1:
raise ValueError('Only one argument allowed')
datadir = sys.a... | 2.359375 | 2 |
es_sink/es_sink/flushing_buffer.py | avmi/community | 305 | 33884 | <reponame>avmi/community<gh_stars>100-1000
'''
Copyright 2020, Amazon Web Services Inc.
This code is licensed under MIT license (see LICENSE.txt for details)
Python 3
Provides a buffer object that holds log lines in Elasticsearch _bulk
format. As each line is added, the buffer stores the control line
as well as the l... | 2.453125 | 2 |
ife/features/tests/test_features.py | Collonville/ImageFeatureExtractor | 2 | 33885 | import unittest
from collections import defaultdict
import numpy as np
import pandas as pd
from ife.io.io import ImageReader
class TestMomentFeatures(unittest.TestCase):
def test_moment_output_type(self) -> None:
features = ImageReader.read_from_single_file("ife/data/small_rgb.jpg")
moment = fe... | 2.625 | 3 |
mysite/timesheets/models.py | xanderyzwich/Timesheets | 0 | 33886 | <filename>mysite/timesheets/models.py<gh_stars>0
"""The database models and form based on the timesheet model"""
import datetime
from django.db import models
from django.forms import ModelForm, ValidationError
# Create your models here.
class Task(models.Model):
"""Used to support Timesheet class"""
type =... | 2.75 | 3 |
waferscreen/inst_control/inactive/keithley_2700_multimeter.py | chw3k5/WaferScreen | 1 | 33887 | '''
Created on Mar 11, 2009
@author: schimaf
'''
import gpib_instrument
class Keithley2700Multimeter(gpib_instrument.Gpib_Instrument):
'''
classdocs
'''
def __init__(self, pad, board_number = 0, name = '', sad = 0, timeout = 13, send_eoi = 1, eos_mode = 0):
'''
Constructor
'... | 2.640625 | 3 |
matchzoo/utils/early_stopping.py | ChrisRBXiong/MatchZoo-py | 468 | 33888 | <gh_stars>100-1000
"""Early stopping."""
import typing
import torch
import numpy as np
class EarlyStopping:
"""
EarlyStopping stops training if no improvement after a given patience.
:param patience: Number fo events to wait if no improvement and then
stop the training.
:param should_decrea... | 2.65625 | 3 |
geometry_processing.py | casperg92/MaSIF_colab | 8 | 33889 | import numpy as np
from math import pi
import torch
from pykeops.torch import LazyTensor
from plyfile import PlyData, PlyElement
from helper import *
import torch.nn as nn
import torch.nn.functional as F
# from matplotlib import pyplot as plt
from pykeops.torch.cluster import grid_cluster, cluster_ranges_centroids, fr... | 2.4375 | 2 |
test/test_comment.py | ExiaSR/server | 3 | 33890 | <filename>test/test_comment.py
import pytest
from test.conftest import *
@pytest.mark.run(after='test_create_article_for_user')
@post('/article/{}/comment', {"comment": "shit posting #1"})
def test_post_comment_to_article(result=None, url_id=['article_id']):
assert result.status_code == 200
assert result.json... | 2.1875 | 2 |
KEGGutils/KEGGhelpers.py | filippocastelli/KGutils | 3 | 33891 | # =============================================================================
# MISC HELPER FUNCTIONS
# =============================================================================
def push_backslash(stuff):
""" push a backslash before a word, dumbest function ever"""
stuff_url = ""
if stuff i... | 3.375 | 3 |
mazeinawall/generate_dataset.py | ncvescera/QRL-Maze_in_a_Wall | 2 | 33892 | from random import randint, seed
import numpy as np
from os import path, mkdir
from maze_utils import generate_grid
seed_number = 69
training_folder = "training"
testing_folder = "testing"
tot_elem_training = 100 # numero di matrici da generare
tot_elem_testing = 20 # numero di matrici da generare
max_w = 10 ... | 3.015625 | 3 |
deploy/alembic/versions/6fb351569d30_create_tables.py | gordon-elliott/glod | 0 | 33893 | """create tables
Revision ID: 6fb351569d30
Revises: 4<PASSWORD>1ff38b
Create Date: 2019-05-06 21:59:43.998735
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '4<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ###... | 1.867188 | 2 |
apps/user/filters/__init__.py | kane-zh/MES_server | 0 | 33894 | <gh_stars>0
from apps.user.filters.basicinfor_filters import * | 1.09375 | 1 |
moog/shapes.py | juanpablordz/moog.github.io | 22 | 33895 | <filename>moog/shapes.py<gh_stars>10-100
"""Shapes and shape-fetching functions for common use across tasks."""
import numpy as np
from moog import sprite
from spriteworld import shapes
# A selection of simple shapes. Elements in SHAPES can be looked up from their
# string keys in sprite.Sprite, i.e. you can give a s... | 3.28125 | 3 |
LoadandStore.py | sjtuzyz/Tomasulo | 0 | 33896 | <filename>LoadandStore.py<gh_stars>0
import prettytable as pt
#Load and Store are special
class BasicRs(object):
def __init__(self, Type):
self.Type = Type
self.clear()
#judge if the RS is busy
def isBusy(self):
return self.busy
def clear(self):
self.op = ""
... | 2.734375 | 3 |
tests/unit/responses/test_response.py | sirosen/globus-sdk-python | 0 | 33897 | <reponame>sirosen/globus-sdk-python
import json
from collections import namedtuple
from unittest import mock
import pytest
import requests
from globus_sdk.response import GlobusHTTPResponse, IterableResponse
_TestResponse = namedtuple("_TestResponse", ("data", "r"))
def _response(data=None, encoding="utf-8", heade... | 2.453125 | 2 |
prot2vec/utils/hparams.py | dillondaudert/prot2vec | 2 | 33898 | """Hparams"""
import argparse as ap
import tensorflow as tf
from pathlib import Path
HOME = str(Path.home())
HPARAM_CHOICES= {
"model": ["cpdb", "copy", "bdrnn", "cpdb2", "cpdb2_prot"],
"optimizer": ["adam", "sgd", "adadelta"],
"unit_type": ["lstm", "lstmblock", "nlstm", "gru"],
"train... | 2.390625 | 2 |
controllers/home.py | elydev01/kvtemplate2 | 0 | 33899 | from kivy.lang import Builder
from kivy.metrics import dp
from kivy import properties as p
from kivy.animation import Animation
from kivymd.app import MDApp as App
from kivymd.uix.screen import MDScreen
class HomeMainScreen(MDScreen):
bg_pos = p.NumericProperty(0)
def toggle_bg_pos(self):
bg_pos... | 2.296875 | 2 |