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 | TeengardenB/cramer | 0 | 46700 | import pathlib
from setuptools import find_packages, setup
HERE = pathlib.Path(__file__).parent
VERSION = '0.0.0'
PACKAGE_NAME = 'cramer'
AUTHOR = '<NAME>'
AUTHOR_EMAIL = '<EMAIL>'
URL = 'https://github.com/TeengardenB/cramer'
LICENSE = 'MIT'
DESCRIPTION = 'This is a library designed to solve systems ... | 1.601563 | 2 |
docs/examples/container/rancher/search_containers.py | dupontz/libcloud | 1,435 | 46701 | <reponame>dupontz/libcloud<gh_stars>1000+
from libcloud.container.types import Provider
from libcloud.container.providers import get_driver
driver = get_driver(Provider.RANCHER)
connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
host="172.30.22.1", port=8080, secure=False)
search_res... | 2.046875 | 2 |
data/groups.py | bloodes/adressbook | 0 | 46702 | <gh_stars>0
from models.model_group import Group
testdata = [Group(group_name='', group_header='', group_footer=''),
Group(group_name='name1', group_header='name1', group_footer='name1'),
Group(group_name='name2', group_header='name2', group_footer='name2')
] | 2.03125 | 2 |
scripts/create_py_file_with_template_docs.py | TralahM/automate_the_boring_stuff | 1 | 46703 | #!/usr/bin/env python
import sys
import os
from datetime import datetime
from argparse import ArgumentParser
template="""#!/usr/bin/env python
'''
File: {0}
Author: <NAME> <<EMAIL>>
Org: TralahTek LLC <https://github.com/TralahTek>
Date: {1}
'''
""".format(sys.argv[1],datetime.now().date())
if __name__=='__main__'... | 3 | 3 |
src/text_to_speech.py | robhaslinger/Simple-Voice-Activated-Dialogue | 0 | 46704 | import zmq
import simpleaudio as sa
import os
from time import sleep
# ----------------------------------------------------------------------------------------------------------------------
# A few ways of playing .wav files ... comment these out but keep for reference
# import pyaudio
# import wave
# from pydub impo... | 2.921875 | 3 |
design_pattern/memento/implementation.py | AustinHellerRepo/DesignPatternDemo | 0 | 46705 | <filename>design_pattern/memento/implementation.py<gh_stars>0
from __future__ import annotations
from design_pattern.memento.framework import Originator, Memento, Caretaker
from typing import List
from abc import ABC, abstractmethod
class Implementor(ABC):
def __init__(self):
self.__grocery_list = GroceryList(
... | 2.890625 | 3 |
api/src/controller/feature/FeatureDataController.py | SamuelJansen/FeatureManager | 1 | 46706 | from python_framework import Controller, ControllerMethod, HttpStatus
from Role import *
from dto.FeatureDataDto import *
@Controller(url = '/feature-datas', tag='FeatureData', description='Single FeatureData controller')
class FeatureDataController:
@ControllerMethod(url='/<string:featureKey>/<string:sampleKey>... | 2.21875 | 2 |
onadata/libs/tests/test_authentication.py | aondiaye/myhelpline | 1 | 46707 | <reponame>aondiaye/myhelpline<filename>onadata/libs/tests/test_authentication.py<gh_stars>1-10
from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from onadata.apps.api.models.temp_token import TempToken
from onadata.libs.authenti... | 2.109375 | 2 |
protein_transformer/models/transformer/Encoder.py | joegomes/protein-transformer | 77 | 46708 | <reponame>joegomes/protein-transformer<gh_stars>10-100
import torch
from .Attention import MultiHeadedAttention
from .Sublayers import PositionwiseFeedForward, PositionalEncoding, \
SublayerConnection, Embeddings
class Encoder(torch.nn.Module):
"""
Transformer encoder model.
"""
def __init__(sel... | 2.515625 | 3 |
pycmbs/utils/download.py | pygeo/pycmbs | 9 | 46709 | <filename>pycmbs/utils/download.py
# -*- coding: utf-8 -*-
"""
This file is part of pyCMBS.
(c) 2012- <NAME>
For COPYING and LICENSE details, please refer to the LICENSE file
"""
import os
from pycmbs.data import Data
import tempfile
def get_example_directory():
""" returns directory where this file is located "... | 3.109375 | 3 |
tunediagram.py | levondov/Tune-Resonance-Diagram-Python | 0 | 46710 | import matplotlib.pyplot as plt
import numpy as np
def tunediagram(order=range(1,4),integer=[0,0],lines=[1,1,1,1],colors='ordered',linestyle='-',fig=plt.gcf()):
'''
plot resonance diagram up to specified order
mx + ny = p
x = (p-ny)/m
x = 1 where y = (p-m)/n
EXAMPLE:
tunediagram(order=... | 3.46875 | 3 |
playground/read_wifi_name.py | Shingirai98/EEE3097 | 12 | 46711 | <reponame>Shingirai98/EEE3097<gh_stars>10-100
import os
wifi_name = os.popen("iw dev wlan0 link | grep SSID | awk '{print $2}'").read()
print(wifi_name)
| 2.359375 | 2 |
hooks/tests/test_unit/test_validate_django_model_field_names/test_get_validator.py | micheller/pre-commit-hooks | 4 | 46712 | <reponame>micheller/pre-commit-hooks
from __future__ import annotations
import pytest
from hooks.validate_django_model_field_names import boolean_validator, date_validator, datetime_validator, get_validator
@pytest.mark.parametrize(
('field_type', 'expected_validator'), [
('DateField', date_validator),
... | 2.34375 | 2 |
cloudify_agent/tests/api/test_factory.py | cloudify-cosmo/cloudify-agent | 12 | 46713 | import os
import pytest
import shutil
from cloudify_agent.api import exceptions
from cloudify_agent.api import utils
from cloudify_agent.tests.utils import get_daemon_storage
from cloudify_agent.tests import random_id
def test_new_initd(daemon_factory, agent_ssl_cert):
daemon_name = 'test-daemon-{0}'.format(rand... | 1.867188 | 2 |
src/Build-models.py | gh-schen/SiriusEpiClassifier | 1 | 46714 | <gh_stars>1-10
#!/usr/bin/env python3
import logging
from sys import argv
from Classifier import regData
from configData import configData
import pickle
from dataInterface import read_features, load_molcounts_data
"""
Only build model with the input full data and dump with pickle
"""
def main():
logging.basicCo... | 2.34375 | 2 |
gquant/cuindicator/__init__.py | miguelangel/gQuant | 2 | 46715 | <filename>gquant/cuindicator/__init__.py<gh_stars>1-10
from .ewm import Ewm
from .indicator import * # noqa: F403
from .pewm import PEwm
from .rolling import Rolling
from .util import (shift, diff, substract, summation,
multiply, division, scale, cumsum)
__all__ = ["Ewm", "PEwm", "Rolling", "shift"... | 1.71875 | 2 |
backblaze/tests/awaiting/test_files.py | WardPearce/aiob2 | 0 | 46716 | import asynctest
from uuid import uuid4
from .client import CLIENT
from ...settings import BucketSettings
from ...models.file import FileModel
from ...bucket.awaiting import AwaitingFile
class TestAwaitingFiles(asynctest.TestCase):
use_default_loop = True
async def test_file_listing_names(self):
... | 2.296875 | 2 |
requestForProposals.py | converj/reasonSurvey | 0 | 46717 | # Import external modules.
from google.appengine.ext import ndb
import logging
# Import local modules.
from configuration import const as conf
from constants import Constants
const = Constants()
const.MAX_RETRY = 3
# Parent key: none
class RequestForProposals(ndb.Model):
title = ndb.StringProperty()
detail ... | 2.078125 | 2 |
RelevantRecommendation.py | ma-zhiyuan/DynameDB-data-transfer | 0 | 46718 | #-*-coding:utf8-*-
from __future__ import print_function # Python 2/3 compatibility
import boto3
import time
import json
import decimal
import datetime
import json
from boto3.dynamodb.conditions import Key, Attr
from botocore.exceptions import ClientError
class DecimalEncoder(json.JSONEncoder):
def default(self, ... | 2.109375 | 2 |
library/docker/docker.py | Kafkamorph/shutit | 0 | 46719 | <filename>library/docker/docker.py
#Copyright (C) 2014 OpenBet Limited
#
#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 Software without restriction, including without limitation the rights
#to use, cop... | 1.59375 | 2 |
old_code/src_python/nmpccodegen/example_models/__init__.py | kul-forbes/nmpc-codegen | 24 | 46720 | from .example_model import get_chain_model,get_trailer_model
from .trailer_printer import trailer_print,draw_rectangular_obstacle,draw_rectangular_obstacle_around_center | 1.117188 | 1 |
fixture/contact.py | asmirnova-code/python-training | 0 | 46721 | from selenium.webdriver.support.ui import Select
from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def open_home_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/index.php") and
len(wd.find_elements_by_xpath(... | 2.703125 | 3 |
Tac Tac Toe/ttt.py | promitbasak/TicTacToe-Pygame | 3 | 46722 | <gh_stars>1-10
import random
import time
CELLS = 9
PLAYERS = 2
CORNERS = [1, 3, 7, 9]
NON_CORNERS = [2, 4, 6, 8]
board = {}
for i in range(9):
board[i + 1] = 0
signs = {0: " ", 1: "X", 2: "O"}
winner = None
def rpermutation(a):
array = a[:]
for _ in range(len(array)):
yield array... | 3.75 | 4 |
textattack/models/__init__.py | fighting41love/TextAttack | 2 | 46723 | from . import classification
from . import entailment
from . import translation
from . import summarization
from . import helpers | 0.988281 | 1 |
tests/test_analysis/test_plotters.py | martins0n/etna | 326 | 46724 | import numpy as np
import pandas as pd
import pytest
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import TheilSenRegressor
from etna.analysis import get_residuals
from etna.analysis import plot_residuals
from etna.analysis import plot_trend
from etna.analysis.plotters import _get_labels_... | 2.15625 | 2 |
tests/EntityForTest.py | novaweb-mobi/nova-api | 3 | 46725 | <gh_stars>1-10
from dataclasses import dataclass, field
from nova_api.entity import Entity
@dataclass
class EntityForTest(Entity):
test_field: int = 0
not_to_add_field: str = field(default="", metadata={"database": False})
| 2.140625 | 2 |
scripts/downloadcsv.py | payalbal/gbifprocessing | 0 | 46726 | import requests
import io
import zipfile
import shutil
STOREPATH = '/data/csv/'
def download_extract_zip(url, dirpath):
response = requests.get(url)
with zipfile.ZipFile(io.BytesIO(response.content)) as zfile:
store_at = STOREPATH + dirpath
zfile.extractall( store_at )
def download_chunk(url, dirpa... | 3.09375 | 3 |
cookbook/c08/p18_mixin_classes.py | itpubs/python3-cookbook | 3 | 46727 | <reponame>itpubs/python3-cookbook
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 混入类
Desc : 如果单独使用Minxin类没有任何意义,但是当利用多继承和其他类配合后就有神奇效果了。
Mixin也是多继承的主要用途。
"""
class LoggedMappingMixin:
"""
Add logging to get/set/delete operations for debugging.
"""
__slots__ = () # 混入类都没有实例变量,因为直接实例化混入类... | 2.671875 | 3 |
setup.py | exord/cobmcmc | 0 | 46728 | <filename>setup.py<gh_stars>0
from distutils.core import setup
setup(name='cobmcmc',
description='Change-of-Basis, '
'a flexible Metropolis-Hastings MCMC algorithm.',
version='0.1.0',
author='<NAME>',
author_email='<EMAIL>',
url='',
long_description='**COMING SOON*... | 1.054688 | 1 |
tradebook/funds/serializers.py | isuryanarayanan/tradebook-backend | 0 | 46729 | """ Serializers for API views """
# Module imports
from rest_framework import serializers
from django.contrib.auth import authenticate
from funds.models import Wallet
class TransactionSerializer(serializers.Serializer):
""" Serializer for transaction model """
pass
class WalletSerializer(serializers.Serial... | 2.8125 | 3 |
examples/customers.py | AbdulMoeed-140212/mailwizz-python-sdk | 6 | 46730 | from setup_api import setup
from mailwizz.endpoint.customers import Customers
"""
SETUP THE API
"""
setup()
"""
CREATE THE ENDPOINT
"""
endpoint = Customers()
"""
CREATE CUSTOMER
"""
response = endpoint.create({
'customer': {
'first_name': 'John',
'last_name': 'Doe',
'email': '<EMAIL>',
... | 2.6875 | 3 |
package.py | srini009/ascent | 0 | 46731 | <gh_stars>0
#!/bin/env python
###############################################################################
# Copyright (c) Lawrence Livermore National Security, LLC and other Ascent
# Project developers. See top-level LICENSE AND COPYRIGHT files for dates and
# other details. No copyright assignment is required to c... | 1.945313 | 2 |
Assignment_3.py | Lee-Lilly/Embedded-python | 0 | 46732 | #!/usr/bin/env python
# coding: utf-8
# ---
# # Python Basics - Assingment 3 ToDo
#
# ---
# **Exercise 1**
#
# **Task 1** Define a function called **repeat_stuff** that takes in two inputs, **stuff**, and **num_repeats**.
#
# We will want to make this function print a string with stuff repeated num_repeats amount o... | 4.53125 | 5 |
cogs/moderation.py | robonone/RoboNone | 6 | 46733 | import argparse
import copy
import datetime
import re
import shlex
from typing import Union
import time
import discord
from discord.ext import commands
class Arguments(argparse.ArgumentParser):
def error(self, message):
raise RuntimeError(message)
def setup(bot):
bot.add_cog(Moderation(bot))
def ... | 2.53125 | 3 |
examples.py | JayakrishnanAjayakumar/pcml | 1 | 46734 | #!/usr/bin/python
"""
Copyright (c) 2014 High-Performance Computing and GIS (HPCGIS) Laboratory. All rights reserved.
Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Authors and contributors: <NAME> (<EMAIL>); <NAME> (<EMAIL>, <EMAIL>)
"""
from pcml import *
import os.... | 2.28125 | 2 |
magichour/validate/splitter.py | Lab41/magichour | 34 | 46735 | <filename>magichour/validate/splitter.py
from random import shuffle
def splitRDD(rdd, weights=[0.8, 0.1, 0.1]):
train, validation, test = rdd.randomSplit(weights=weights)
return train, validation, test
def split(data, weights=[0.8, 0.1, 0.1]):
d = [x for x in data]
shuffle(d)
idx_train = len(d) ... | 2.796875 | 3 |
newton.py | Robokkie/NA | 0 | 46736 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
import math
from function import Function
import function
if __name__ == '__main__':
print "please input the number that a,b,c,d for function"
a,b,c,d = map(int, raw_input('input a,b,c,d=').split(","))
func=Function(a,b,c,d)
func.showinfo()
while True:
print "in... | 3.859375 | 4 |
tests/amply_tests.py | ruxkor/pulp-or | 2 | 46737 | from pulp.amply import Amply, AmplyError
from StringIO import StringIO
from nose.tools import assert_raises
def test_data():
result = Amply("param T := 4;")['T']
assert result == 4
result = Amply("param T := -4;")['T']
assert result == -4
result = Amply("param T := 0.04;")['T']
assert result =... | 2.390625 | 2 |
toggldash/__init__.py | bigpappathanos-web/Toggl-Dashboard | 13 | 46738 | from .response import process_response
from .response import get_response
from .app import run
# __all__ = ["process_response", "get_response"] | 1.085938 | 1 |
fourq-master/impl/compare.py | rikard-sics/group-oscore-key | 1 | 46739 | <filename>fourq-master/impl/compare.py
#!/usr/bin/env python
from random import getrandbits
from time import time
from fields import GFp2, GFp25519, p1271, p25519
import curve4q
import curve25519
# Adjust these if you want more/fewer samples
FIELD_TEST_LOOPS = 1000
DH_TEST_LOOPS = 100
def compare_fields():
base... | 1.929688 | 2 |
var/spack/repos/builtin/packages/py-flit-core/package.py | zygyz/spack | 348 | 46740 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import glob
import os
import zipfile
from spack import *
class PyFlitCore(PythonPackage):
"""Distribution-building ... | 1.914063 | 2 |
apps/pyexe/hello_world.py | gzvulon/pydocflow | 0 | 46741 | #cython: language_level=3
print("Hello World!")
| 1.695313 | 2 |
commercia/offers/config.py | commoncode/economica | 2 | 46742 | <gh_stars>1-10
from django.apps import AppConfig
from django.utils.importlib import import_module
class OffersConfig(AppConfig):
name = 'commercia.offers'
verbose_name = "Offers"
def ready(self):
import_module('commercia.offers.collections')
import_module('commercia.offers.signals') | 1.679688 | 2 |
tracardi/tests/unit/mocks/mock_storage.py | ryomahan/read-tracardi | 29 | 46743 | sessions = [{
"1": {
"type": "session",
"source": {"id": "scope"},
"id": "1",
'profile': {"id": "1"}
}
}]
profiles = [
{"1": {'id': "1", "traits": {}}},
{"2": {'id': "2", "traits": {}}},
]
class MockStorageCrud:
def __init__(self, index, domain_class_ref, entity):... | 2.296875 | 2 |
7_VAE.py | shenkev/Pyro-Tutorial | 0 | 46744 | import os
import matplotlib.pyplot as plt
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter(log_dir="./logs")
from tqdm import tqdm
import numpy as np
import torch
import torchvision.datasets as dset
import torch.nn as nn
import torchvision.transforms as transforms
import pyro
import pyro.distr... | 2.484375 | 2 |
examples/null_support/client.py | amrhgh/django-grpc-framework | 269 | 46745 | <gh_stars>100-1000
import grpc
import snippets_pb2
import snippets_pb2_grpc
from google.protobuf.struct_pb2 import NullValue
with grpc.insecure_channel('localhost:50051') as channel:
stub = snippets_pb2_grpc.SnippetControllerStub(channel)
request = snippets_pb2.Snippet(id=1, title='snippet title')
# send ... | 2.25 | 2 |
backend/core/service/column_generator/faker_generator/person.py | pecimuth/synthia | 0 | 46746 | <gh_stars>0
from typing import Optional
from core.service.column_generator.base import GeneratorCategory, RegisteredGenerator
from core.service.column_generator.faker_generator.base import FakerGenerator
from core.service.types import Types
class FakerPersonGenerator(FakerGenerator[str]):
category = GeneratorCat... | 2.5625 | 3 |
ddtrace/contrib/vertica/constants.py | melancholy/dd-trace-py | 308 | 46747 | # Service info
APP = "vertica"
| 1.101563 | 1 |
exercicios_mundo-I/ex008.py | Lucas-Lourencao/ExerciciosPython | 0 | 46748 | m = float(input('Digite uma distância em metros: '))
k = m/1000
hct = m/100
dct = m/10
dcm = m*10
cm = m*100
mm = m*1000
print('A distância de {} metros informada corresponde a: \n{} Quilômetros;\n{} Hectômetros;\n{}Decâmetros;\n{:.0f}Decímetros;\n{:.0f}Centímetros e;\n{:.0f}Milímetros.'.format(m, k, hct, dct, dcm, cm,... | 3.84375 | 4 |
tests/units/round_messages/reach_quorum_test.py | iconloop/LFT2 | 23 | 46749 | <reponame>iconloop/LFT2<filename>tests/units/round_messages/reach_quorum_test.py
import os
import random
import pytest
from typing import Tuple, Sequence
from lft.app.vote import DefaultVoteFactory, DefaultVote
from lft.consensus.round import RoundMessages
@pytest.fixture
async def setup(voter_num: int):
voters =... | 2.09375 | 2 |
rally/common/logging.py | sergeygalkin/rally | 0 | 46750 | # Copyright 2014: Mirantis Inc.
# 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 b... | 1.78125 | 2 |
kivyapp.py | rodincode/python | 1 | 46751 | from kivy.uix.screenmanager import Screen
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivymd.app import MDApp
from kivymd.uix.tab import MDTabsBase
from kivymd.icon_definitions import md_icons
from kivymd.uix.button import MDRectangleFlatButton
from kivy.lang import... | 2.046875 | 2 |
ta_bot/__main__.py | ToxicPie/discord-ta-bot | 0 | 46752 | <reponame>ToxicPie/discord-ta-bot
import os
from . import setup_bot
bot_token = os.environ.get('DISCORD_BOT_TOKEN')
bot_prefix = os.environ.get('COMMAND_PREFIX')
bot = setup_bot(bot_prefix)
bot.run(bot_token)
| 1.648438 | 2 |
bluebottle/geo/urls/api.py | terrameijar/bluebottle | 10 | 46753 | <reponame>terrameijar/bluebottle<gh_stars>1-10
from django.conf.urls import url
from ..views import CountryList, CountryDetail, LocationList, GeolocationList, OfficeList, OfficeDetail
urlpatterns = [
url(r'^countries/$', CountryList.as_view(),
name='country-list'),
url(r'^countries/(?P<pk>\d+)$', Coun... | 1.679688 | 2 |
modules/controller/commands/key.py | TheSlimvReal/PSE---LA-meets-ML | 4 | 46754 | <reponame>TheSlimvReal/PSE---LA-meets-ML
from enum import Enum
## enum that represents the possible keys a user can enter
#
# @extends Enum to get the enum logic
class Key(Enum):
QUIT = 0
AMOUNT = 1
NAME = 2
SIZE = 3
PATH = 4
GENERATE = 5
SAVING_PATH = 6
TRAIN = 7
NETWORK = 8
... | 2.78125 | 3 |
quarkchain/evm/tests/new_statetest_utils.py | QuarkChain/pyquarkchain | 237 | 46755 | <reponame>QuarkChain/pyquarkchain
import sys
from quarkchain.evm.state import State
from quarkchain.evm.common import FakeHeader
from quarkchain.evm.utils import (
decode_hex,
parse_int_or_hex,
sha3,
to_string,
remove_0x_head,
encode_hex,
big_endian_to_int,
)
from quarkchain.evm.config impo... | 1.84375 | 2 |
twitterprofiling/User.py | bisite/TwitterProfiling | 0 | 46756 | import pandas as pd
import numpy as np
import threading
from multiprocessing import Pool
from twitterprofiling.auxiliar import *
from twitterprofiling.twitter_manager import *
class User:
"""
class representing the user
"""
name = None
user_name = None
image = None
description = None
... | 2.609375 | 3 |
dzdsu/lockfile.py | conqp/dayz-utils | 0 | 46757 | <reponame>conqp/dayz-utils
"""Lock file implementation."""
from os import linesep
from pathlib import Path
__all__ = ['LockFile']
class LockFile:
"""A lock file."""
def __init__(
self,
file: Path,
reason: str = 'locked',
*,
override: bool = False... | 2.875 | 3 |
docengine/doc.py | usernamedt/multitext-client | 1 | 46758 | import json
from typing import List
from sortedcontainers import SortedList
from .allocator import Allocator
from .character import Character
from .char_position import CharPosition
class Doc:
def __init__(self, site=0) -> None:
"""
Create a new document
:param site: author id
:t... | 2.828125 | 3 |
models/mobilenet_v2/mobilenet_v2_dg.py | lfr-0531/DGNet | 13 | 46759 | <gh_stars>10-100
import torch
import math
import logging
from torch import nn
from prettytable import PrettyTable
from .mobilenet_v2_dg_util import ConvBNReLU_1st, InvertedResidual
__all__ = ['mobilenet_v2_dg']
def conv2d_out_dim(dim, kernel_size, padding=0, stride=1, dilation=1, ceil_mode=False):
if ceil_mode:... | 2.484375 | 2 |
layers/lstm.py | lvyufeng/basic_nlp_modules | 4 | 46760 | <gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
# default torch version
# nn.LSTM(input_size, hidden_size, layer_num)
# use Linear layers
class simpleLSTM(nn.Module):
'''
forget_gate: f_t = sigmoid(W_f[h_(t-1),x_t] + b_f)
input_gate: i_t = sigmoid(W_i[h_(t-1... | 2.734375 | 3 |
pelican_events/signals/__init__.py | rackerlabs/pelican-events | 0 | 46761 | <reponame>rackerlabs/pelican-events<filename>pelican_events/signals/__init__.py
from blinker import signal
event_generator_init = signal('event_generator_init')
event_generator_finalized = signal('event_generator_finalized')
event_generator_preread = signal('event_generator_preread')
event_generator_context = signal('... | 1.601563 | 2 |
twispy/__init__.py | 346pro/Twispy | 12 | 46762 | <filename>twispy/__init__.py
# coding=utf-8
from twispy.request import Request
from twispy.handler import API
| 1.242188 | 1 |
generator.py | ashishrao7/motion_contrast_3D | 0 | 46763 | <filename>generator.py<gh_stars>0
import pattern
def main():
#line = pattern.Line(260, 346, 60, 1)
#line.generate_moving_line('vertical')
#line.generate_moving_line('horizontal')
#line.generate_moving_line('tl_diag')
#line.generate_moving_line('bl_diag')
wave_image = pattern.wave_2d(260, 346, ... | 2.765625 | 3 |
_tests/test_app.py | EinsteinCarrey/Shoppinglist | 0 | 46764 | from unittest import TestCase
import global_functions
import app
from app import flask_app
class TestApp(TestCase):
def setUp(self):
self.app = app
self.username = "newuser"
self.pword = "<PASSWORD>"
self.test_client_app = flask_app.test_client()
self.test_client_app.testin... | 3.546875 | 4 |
src/discriminator_cnn_ver.py | samirsahoo007/Conditional-SeqGAN-Tensorflow | 51 | 46765 | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ discriminator.py ]
# Synopsis [ Discriminator model ]
# Author [ <NAME> (Andi611) ]
# Copyright [ Copyleft(c), NTUEE, NTU, Taiwan ]
"""*********************... | 2.875 | 3 |
simple-fsm.py | jasonmpittman/100-days-of-alife-code | 0 | 46766 | #!/usr/bin/env python3
# Created on 05/01/2018
# @author: <NAME>
# @license: MIT-license
# Purpose: example of a simple finite state machine with a text-based game agent
# Explanation:
from enum import Enum
import time
import random
class state_type(Enum):
state_run = "Run Away"
state_patrol = "Patrol"
st... | 4.09375 | 4 |
custom_imports/importer/simple_finder.py | madman-bob/python-custom-imports | 0 | 46767 | <filename>custom_imports/importer/simple_finder.py<gh_stars>0
from dataclasses import dataclass, field
from types import ModuleType
from typing import Callable, Iterable, Optional, TypeVar
from custom_imports.importer.types import Finder
from custom_imports.utils import field_required
__all__ = ["SimpleFinder"]
LT =... | 2.734375 | 3 |
libraries/api.py | dulibrarytech/oclc-reclamation | 0 | 46768 | import logging
import logging.config
import requests
logging.config.fileConfig('logging.conf', disable_existing_loggers=False)
logger = logging.getLogger(__name__)
def log_response_and_raise_for_status(
response: requests.models.Response) -> None:
logger.debug(f'API response details:\n' \
f'\t- UR... | 2.40625 | 2 |
script/sklearn_like_toolkit/warpper/skClf_wrapper/skRidgeCVClf.py | demetoir/MLtools | 0 | 46769 | from sklearn.linear_model import RidgeClassifierCV as _RidgeClassifierCV
from script.sklearn_like_toolkit.warpper.base.BaseWrapperClf import BaseWrapperClf
from script.sklearn_like_toolkit.warpper.base.MixIn import MetaBaseWrapperClfWithABC
class skRidgeCVClf(_RidgeClassifierCV, BaseWrapperClf, metaclass=MetaB... | 2.25 | 2 |
nlp/if-paragraphs.py | bislai/lab | 2 | 46770 | <filename>nlp/if-paragraphs.py
'''
Script que parsea el texto de un pdf a un string
Se convierte cada parrafo en un elemento de una lista
Se busca el nombre de un/una concejal/concejala en cada parrafo,
si se encuentra se guarda en un fichero TXT
'''
import re
import pdftotext
clean_list = []
dp_list = []
list_pln = ... | 2.890625 | 3 |
src/data/show_results.py | laurabondeholst/Mapping_high_dimensional_data | 0 | 46771 | <reponame>laurabondeholst/Mapping_high_dimensional_data<gh_stars>0
import pandas as pd
import plotly.graph_objects as go
import numpy as np
UMAP_TSNE_FOLDER = "reports_from_tobias/reports/fashion_natural_umap_tsne/"
TSNE_FOLDER = "reports/Noiselevel_experiment_pca_tsne/Fashion/"
TRIMAP_FOLDER = "reports_from_pranjal... | 2.421875 | 2 |
powerup.py | borgaster/SpaceWarsEvolved | 0 | 46772 | import random
from loader import *
import pygame
from spritesheet import *
class Powerup(pygame.sprite.Sprite):
#type e o tipo de powerups
def __init__(self,tipo,screen):
pygame.sprite.Sprite.__init__(self)
self.tipo = tipo
if tipo == 1:
#e um escudo
ss = ... | 3.140625 | 3 |
7i92/src/lib7i92/buildfiles.py | jethornton/7i92 | 3 | 46773 | <gh_stars>1-10
import os, subprocess
from datetime import datetime
def build(parent):
parent.tabs.setCurrentIndex(0)
parent.machinePTE.clear()
backup(parent)
builddirs(parent)
buildini(parent)
buildhal(parent)
buildio(parent)
buildmisc(parent)
def backup(parent):
if parent.backupCB.isChecked():
if os.path.... | 2.296875 | 2 |
scripts/make_easysrl_lexicon.py | marbles-ai/ie | 0 | 46774 | <reponame>marbles-ai/ie
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
import re
import sys
# Modify python path
projdir = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
pypath = os.path.join(projdir, 'src', 'python')
datapath = os.path.joi... | 2.25 | 2 |
cwmud/core/commands/development/spawn.py | whutch/cwmud | 11 | 46775 | # -*- coding: utf-8 -*-
"""Spawn command."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2017 <NAME>
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from .. import Command, COMMANDS
from ...characters import CharacterShell
@COMMANDS.register
cla... | 2.484375 | 2 |
utils/get_image.py | Mingqi-Yuan/ADMP | 0 | 46776 | """
Encoding = UTF-8
By <NAME>, 2019/3/18
Usage: get image file from the onstage
"""
from flask import request
import cv2
import os
def get_image():
img = request.files.get('photo')
path = "static/images/"
file_path = path + img.filename
img.save(file_path)
img = cv2.imread(file_path)
cv2.imwri... | 2.671875 | 3 |
ipset.py | InsaLan/langate2000-netcontrol | 0 | 46777 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from subprocess import run, PIPE, TimeoutExpired
from xmltodict import parse as parsexml
# timeout
# errorcode
class IpsetError(RuntimeError):
"""ipset returned an error"""
def _run_cmd(command, args=[]):
"""
Helper function to help calling and decoding i... | 2.75 | 3 |
02-Coding-skills-swagger/swagger_server/test/test_default_controller.py | igor-voitov/inspectorio-devtest | 0 | 46778 | <filename>02-Coding-skills-swagger/swagger_server/test/test_default_controller.py
# coding: utf-8
from __future__ import absolute_import
from flask import json
from six import BytesIO
from swagger_server.models.aws_info import AwsInfo # noqa: E501
from swagger_server.test import BaseTestCase
class TestDefaultCont... | 2.6875 | 3 |
app/libs/loaderConfig.py | nrshapiro/openpubarchive | 1 | 46779 |
# Configuration file for opasDataLoader
default_build_pattern = "(bEXP_ARCH1|bSeriesTOC)"
default_process_pattern = "(bKBD3|bSeriesTOC)"
# Global variables (for data and instances)
options = None
# Source codes (books/journals) which should store paragraphs
SRC_CODES_TO_INCLUDE_PARAS = ["GW", "SE"]
# for these code... | 1.242188 | 1 |
app.py | 10239847509238470925387z/tmp123 | 0 | 46780 | #!/usr/bin/env python
import urllib
import json
import os
import constants
import accounts
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
PERSON = constants.TEST_1
@app.route('/webhook', methods=['POST'])
def webhook... | 2.953125 | 3 |
commands/move/rps_move.py | hdm-dt-fb/rvt_model_services | 28 | 46781 | <filename>commands/move/rps_move.py
import os
import sys
import json
import clr
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import OpenOptions, DetachFromCentralOption, FilePath, ModelPathUtils
from Autodesk.Revit.DB import WorksetConfiguration, WorksetConfigurationOption
from Autodesk.Revit.DB import SaveAsOpt... | 2.140625 | 2 |
classes/tail_ec2_instance.py | remyh1369/aws-eb-log-retrieval | 1 | 46782 | import os
import paramiko
import queue
from botocore.exceptions import EndpointConnectionError
from ebcli.objects.exceptions import NoRegionError
from ebcli.objects.exceptions import ServiceError
from os.path import expanduser
from paramiko.ssh_exception import SSHException
from threading import Thread
from queue impo... | 2.0625 | 2 |
ENIAC/api/models.py | Ahrli/fast_tools | 1 | 46783 | from sanic_openapi import doc
'''**********************************************************
>>> 策略model <<<
StrategyDto:入口,tradeCondition:交易条件,riskControl:风险控制
tradeCondition:{
'params':{
'args':[],
'logic':logic
... | 2.171875 | 2 |
plugins/games/dueler.py | KVSword/mankabot | 0 | 46784 | from handler.base_plugin import BasePlugin
from vk.helpers import parse_user_id
import peewee_async, peewee, asyncio, random, time
# Requirements:
# PeeweePlugin
#
class DuelerPlugin(BasePlugin):
__slots__ = ("commands", "prefixes", "models", "pwmanager", "active")
def __init__(self, prefixes=("",), _help="... | 2.15625 | 2 |
dist/assets/code/seance3/8.py | Mistergix/deficode | 0 | 46785 | class Chocolatine:
def __init__(self):
print("je suis mangé!")
def nom(self):
return "CH0C0LA71N3 !!!!!"
cadeau = (Chocolatine(), "Nicolas", "Julian")
#déplier un tuple
objet, destinataire, expediteur = cadeau
#afficher un tuple
print(cadeau)
#fonction qui mange un objet de type: tuple... | 3.828125 | 4 |
lib/datasets/tpod_dataset.py | junjuew/py-faster-rcnn | 4 | 46786 | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
import os, time
from datasets.imdb import imdb
import datasets.ds_utils as ds_... | 2.234375 | 2 |
MNIST.py | ConorTighe1995/Image-Identifier | 0 | 46787 | <filename>MNIST.py
# <NAME> - G00314417
import gzip
import numpy as np
import PIL.Image as pil
def read_labels_from_file(filename): # Does work for reading in the labels from desired file
with gzip.open(filename,'rb') as f: # open file and have f represent the file in python
nolab = f.read(4) # r... | 3.515625 | 4 |
vqc_pennylane/qdata.py | QML-HEP/ae_qml | 7 | 46788 | # Loads the data and an autoencoder model. The original data is passed
# through the AE and the latent space is fed to the qsvm network.
import sys
import os
import numpy as np
sys.path.append("..")
from .terminal_colors import tcols
from autoencoders import data as aedata
from autoencoders import util as aeutil
cla... | 3.03125 | 3 |
octopus/constants.py | Fletch498ma/octopus | 12 | 46789 | # Twisted Imports
from twisted.python.constants import ValueConstant, Values
class State (Values):
READY = ValueConstant("ready")
RUNNING = ValueConstant("running")
PAUSED = ValueConstant("paused")
COMPLETE = ValueConstant("complete")
CANCELLED = ValueConstant("cancelled")
ERROR = ValueConstant("error")
class E... | 2.4375 | 2 |
lang/py/pylib/code/fractions/fractions_limit_denominator.py | ch1huizong/learning | 13 | 46790 | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2009 <NAME> All rights reserved.
#
"""
"""
#end_pymotw_header
import fractions
import math
print 'PI =', math.pi
f_pi = fractions.Fraction(str(math.pi))
print 'No limit =', f_pi
for i in [ 1, 6, 11, 60, 70, 90, 100 ]:
limited = f_pi.limit_denominat... | 3.421875 | 3 |
src/utils/utils.py | fangqyi/ROMA | 0 | 46791 | import numpy as np
import torch
from torch import nn
def identity(x):
return x
def fanin_init(tensor):
size = tensor.size()
if len(size) == 2:
fan_in = size[0]
elif len(size) > 2:
fan_in = np.prod(size[1:])
else:
raise Exception("Tensor shape must have dimensions >= 2")
... | 2.703125 | 3 |
client/gateway/__init__.py | crazyfacka/iseeyou | 0 | 46792 | """This imports all the lib package classes"""
from gateway import Gateway
| 1.148438 | 1 |
openamundsen/fileio/griddedoutput.py | openamundsen/openamundsen | 3 | 46793 | from dataclasses import dataclass
import netCDF4
import numpy as np
from openamundsen import constants, errors, fileio, util
import pandas as pd
import pandas.tseries.frequencies
import pyproj
import xarray as xr
_ALLOWED_OFFSETS = [
pd.tseries.offsets.YearEnd,
pd.tseries.offsets.YearBegin,
pd.tseries.off... | 2.609375 | 3 |
onnx_model_maker/ops/op_ver_2.py | BernardJiang/onnx-pytorch | 66 | 46794 | # Autogenerated by onnx-model-maker. Don't modify it manually.
import onnx
import onnx.helper
import onnx.numpy_helper
from onnx_model_maker import omm
from onnx_model_maker import onnx_mm_export
from onnx_model_maker.ops.op_helper import _add_input
@onnx_mm_export("v2.LabelEncoder")
def LabelEncoder(X, **kwargs):
... | 2.09375 | 2 |
tests/presets/test_remove.py | Abeautifulsnow/masonite | 1 | 46795 | import shutil
import os
import filecmp
from src.masonite.commands.presets.Remove import Remove
import unittest
class TestRemove(unittest.TestCase):
def test_update_package_array(self):
expected_packages = {}
# Verify it works with no existing packages
self.assertDictEqual(expected_packa... | 2.515625 | 3 |
modules/spotify.py | montarion/athena | 3 | 46796 | <reponame>montarion/athena
from components.logger import Logger
import requests
class Spotify:
def __init__(self, Database=None, Oauth=None, Watcher=None):
self.dependencies = {"tier":"user", "dependencies":["Database", "Oauth", "Watcher"]}
self.characteristics= ["timed"]
self.capabilities ... | 2.671875 | 3 |
insta/forms.py | CheropS/instagram-clone | 0 | 46797 | from django.contrib.auth import forms
from django.contrib.auth import models
from django.contrib.auth.models import User
from django import forms
from django.forms import fields, widgets
from .models import Comment, Post, Profile
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit,Layout,F... | 2.203125 | 2 |
services/base_image/fixed/fast_oci_object_storage_models__init__.py | samle-appsbroker/acquire | 21 | 46798 | # coding: utf-8
# Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
from __future__ import absolute_import
import lazy_import as _lazy_import
Bucket = _lazy_import.lazy_class("oci.object_storage.models.bucket.Bucket")
BucketSummary = _lazy_import.lazy_class("oci.object_storage.models.bucke... | 1.898438 | 2 |
task1.py | ronakkkk/Distillation-using-Random-Forest-Classifier-on-Decision-Tree-Classifier-with-Comparison | 1 | 46799 | import matplotlib.pyplot as plt
import seaborn as sns
import pandas
import sklearn.tree
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import LabelEncoder
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn.model_selection impo... | 3.0625 | 3 |