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 |
|---|---|---|---|---|---|---|
Beheer/tests.py | RamonvdW/nhb-apps | 1 | 7400 | # -*- coding: utf-8 -*-
# Copyright (c) 2020-2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from TestHelpers.e2ehelpers import E2EHelpers
# updaten met dit com... | 1.640625 | 2 |
L1Trigger/TrackFindingTracklet/python/ProducerKF_cff.py | Jingyan95/cmssw | 5 | 7401 | import FWCore.ParameterSet.Config as cms
from L1Trigger.TrackTrigger.ProducerSetup_cff import TrackTriggerSetup
from L1Trigger.TrackerTFP.Producer_cfi import TrackerTFPProducer_params
from L1Trigger.TrackerTFP.ProducerES_cff import TrackTriggerDataFormats
from L1Trigger.TrackerTFP.ProducerLayerEncoding_cff import Trac... | 1.265625 | 1 |
py_cui/__init__.py | ne-msft/py_cui | 0 | 7402 | """A python library for intuitively creating CUI/TUI interfaces with pre-built widgets.
"""
#
# Author: <NAME>
# Created: 12-Aug-2019
# Docs: https://jwlodek.github.io/py_cui-docs
# License: BSD-3-Clause (New/Revised)
#
# Some python core library imports
import sys
import os
import time
import copy
import shu... | 2.5 | 2 |
isi_sdk_8_0/isi_sdk_8_0/models/auth_access_access_item_file.py | mohitjain97/isilon_sdk_python | 24 | 7403 | # coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class AuthAccessAccessItemFile(object):... | 1.742188 | 2 |
dataconnector.py | iamthinkking/COMP4217_FinalProject | 0 | 7404 | <reponame>iamthinkking/COMP4217_FinalProject<gh_stars>0
#!/usr/bin/python3
import pymysql
class Connection:
SQL_HOST = 'localhost'
SQL_USR = ''
SQL_PWD = ''
SQL_DB = 'HOSPITAL'
# initialize database object
def __init__(self, usr, pwd):
self.USR = usr
self.PWD = <P... | 3.265625 | 3 |
flow/visualize/plot_custom_callables.py | AHammoudeh/Flow_AH | 0 | 7405 | <reponame>AHammoudeh/Flow_AH
"""Generate charts from with .npy files containing custom callables through replay."""
import argparse
from datetime import datetime
import errno
import numpy as np
import matplotlib.pyplot as plt
import os
import pytz
import sys
def make_bar_plot(vals, title):
print(len(vals))
fi... | 2.5625 | 3 |
deployer/src/config_manager.py | yugabyte/docsearch-scraper | 0 | 7406 | <filename>deployer/src/config_manager.py
import algoliasearch
from os import environ
from . import algolia_helper
from . import snippeter
from . import emails
from . import helpers
from . import fetchers
from .helpdesk_helper import add_note, get_conversation, \
get_emails_from_conversation, get_conversation_url_... | 1.976563 | 2 |
Source/budgie/__init__.py | pylover/budgie | 3 | 7407 |
import sys
from sqlalchemy.exc import DatabaseError
from . import cli
from .configuration import settings, init as init_config
from .observer import HelpdeskObserver, MaximumClientsReached
from .models import init as init_models, metadata, engine, check_db
from .smtp import SMTPConfigurationError
__version__ = '0.... | 2.1875 | 2 |
locations/spiders/shopnsave.py | thismakessand/alltheplaces | 1 | 7408 | <reponame>thismakessand/alltheplaces<filename>locations/spiders/shopnsave.py
# -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
DAY_DICT = {
'Mon': 'Mo',
'Tue': 'Tu',
'Wed': 'We',
'Thu': 'Th',
'Fri': 'Fr',
'Sat': 'Sa',
'Sun': 'Su',
'Monday': 'M... | 2.796875 | 3 |
run.py | TovarischSuhov/QR_quest | 0 | 7409 | #!/usr/bin/env python
from app import app
app.run(debug = True)
| 1.117188 | 1 |
tests/twitter_learning_journal/dao/test_os_env.py | DEV3L/twitter-learning-journal | 1 | 7410 | <reponame>DEV3L/twitter-learning-journal<filename>tests/twitter_learning_journal/dao/test_os_env.py<gh_stars>1-10
from unittest.mock import patch
from app.twitter_learning_journal.dao.os_env import os_environ
@patch('app.twitter_learning_journal.dao.os_env.os')
def test_os_environ(mock_os):
expected_value = 'env... | 2.40625 | 2 |
web-scraper/mongoscraper/populate.py | naveenr414/hack-umbc | 0 | 7411 | <filename>web-scraper/mongoscraper/populate.py
import pymongo
myclient = pymongo.MongoClient()
mydb = myclient["mydb"]
hor = mydb["HoR"]
sen = mydb["Senator"]
gov = mydb["Governor"]
def write(fileJSON):
myDoc = fileJSON
if( "hor" in myDoc.values()):
hor.insert_one(myDoc)
elif( "senate" in myDoc.va... | 2.984375 | 3 |
tests/test_utils_obj_value.py | ZSD-tim/dayu_widgets | 157 | 7412 | <reponame>ZSD-tim/dayu_widgets
"""
Test get_obj_value set_obj_value has_obj_value
"""
import pytest
from dayu_widgets import utils
class _HasNameAgeObject(object):
def __init__(self, name, age):
super(_HasNameAgeObject, self).__init__()
self.name = name
self.age = age
@pytest.mark.parame... | 2.421875 | 2 |
desktop/core/ext-py/PyYAML-3.12/tests/lib3/test_all.py | kokosing/hue | 5,079 | 7413 |
import sys, yaml, test_appliance
def main(args=None):
collections = []
import test_yaml
collections.append(test_yaml)
if yaml.__with_libyaml__:
import test_yaml_ext
collections.append(test_yaml_ext)
return test_appliance.run(collections, args)
if __name__ == '__main__':
main()... | 1.914063 | 2 |
tim_camera/oop_detection_webcam.py | Tim-orius/aidem | 0 | 7414 | <reponame>Tim-orius/aidem
""" Webcam Detection with Tensorflow calssifier and object distance calculation """
__version__ = "0.1.0"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__credits__ = "Special thanks to The Anh Vuong who came up with the original idea." \
"This code is also based off of the code fr... | 2.640625 | 3 |
modules/zabbix_smart.py | yakumo-saki/smart_to_zabbix | 0 | 7415 | <filename>modules/zabbix_smart.py
import json
import logging
import config as cfg
from modules.const import Keys, AttrKey
from modules.zabbix_sender import send_to_zabbix
logger = logging.getLogger(__name__)
SMART_ATTR_KEY = "ata_smart_attributes"
NVME_ATTR_KEY = "nvme_smart_health_information_log"
def send_attrib... | 2.234375 | 2 |
data.py | kpister/biaxial-rnn-music-composition | 0 | 7416 | import itertools
from midi_to_statematrix import UPPER_BOUND, LOWER_BOUND
def startSentinel():
def noteSentinel(note):
position = note
part_position = [position]
pitchclass = (note + LOWER_BOUND) % 12
part_pitchclass = [int(i == pitchclass) for i in range(12)]
return part... | 2.609375 | 3 |
ocdb/ws/controllers/datasets.py | eocdb/ocdb-server | 0 | 7417 | # The MIT License (MIT)
# Copyright (c) 2018 by EUMETSAT
#
# 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, copy, modify,... | 1.40625 | 1 |
libAnt/node.py | ayanezcasal/AntLibAYC | 19 | 7418 | import threading
from queue import Queue, Empty
from time import sleep
from libAnt.drivers.driver import Driver
from libAnt.message import *
class Network:
def __init__(self, key: bytes = b'\x00' * 8, name: str = None):
self.key = key
self.name = name
self.number = 0
def __str__(self... | 2.609375 | 3 |
tests/test_seasonality.py | OliPerkins1987/Wildfire_Human_Agency_Model | 1 | 7419 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 30 12:17:04 2021
@author: Oli
"""
import pytest
import pandas as pd
import numpy as np
import netCDF4 as nc
import os
from copy import deepcopy
os.chdir(os.path.dirname(os.path.realpath(__file__)))
wd = os.getcwd().replace('\\', '/')
exec(open("test_set... | 1.59375 | 2 |
bookalo/funciones_report.py | unizar-30226-2019-08/Backend | 3 | 7420 | <gh_stars>1-10
from django.shortcuts import render, redirect
from bookalo.pyrebase_settings import db, auth
from bookalo.models import *
from bookalo.serializers import *
#from bookalo.functions import *
from rest_framework import status, permissions
from rest_framework.decorators import api_view, permission_clas... | 1.976563 | 2 |
tests/test_client.py | patvdleer/nefit-client-python | 11 | 7421 | <filename>tests/test_client.py
import os
import unittest
from nefit import NefitClient, NefitResponseException
class ClientTest(unittest.TestCase):
def test_exceptions(self):
client = NefitClient(
os.environ.get("NEFIT_SERIAL", 123456789),
os.environ.get("NEFIT_ACCESS_KEY", "<KEY>"... | 2.75 | 3 |
opencivicdata/merge.py | GovHawkDC/python-opencivicdata | 0 | 7422 | import datetime
from django.db import transaction
def compute_diff(obj1, obj2):
"""
Given two objects compute a list of differences.
Each diff dict has the following keys:
field - name of the field
new - the new value for the field
one - value of the field in o... | 2.84375 | 3 |
src/python/pants/core/project_info/filedeps.py | silverguo/pants | 0 | 7423 | <reponame>silverguo/pants<filename>src/python/pants/core/project_info/filedeps.py
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import itertools
from pathlib import PurePath
from typing import Iterable
from pants.base.build_root impo... | 2.21875 | 2 |
perfkitbenchmarker/providers/rackspace/rackspace_network.py | dq922/CloudControlVM | 0 | 7424 | <reponame>dq922/CloudControlVM
# Copyright 2014 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | 2.359375 | 2 |
auth0_client/menu/datafiles/scripts/get_active_user_count.py | rubelw/auth0_client | 2 | 7425 | #!/usr/bin/env python
import json
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *
try:
users = {}
client = Auth0Client(auth_config())
results = client.active_users()
print(pretty(results))
except... | 1.945313 | 2 |
encryptfinance/transactions/admin.py | dark-codr/encryptfinance | 0 | 7426 | from __future__ import absolute_import
from django.contrib import admin
from .models import Deposit, Withdrawal, Support
from .forms import DepositForm, WithdrawalForm
# Register your models here.
@admin.register(Deposit)
class DepositAdmin(admin.ModelAdmin):
# form = DepositForm
list_display = ["__str__", "... | 1.90625 | 2 |
vendor-local/src/django-piston/tests/test_project/settings.py | jlin/inventory | 22 | 7427 | import os
DEBUG = True
DATABASES = {
'default':
{
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/tmp/piston.db'
}
}
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = '/tmp/piston.db'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessi... | 1.648438 | 2 |
src/sage/combinat/combinatorial_map.py | UCD4IDS/sage | 0 | 7428 | <gh_stars>0
"""
Combinatorial maps
This module provides a decorator that can be used to add semantic to a
Python method by marking it as implementing a *combinatorial map*,
that is a map between two :class:`enumerated sets <EnumeratedSets>`::
sage: from sage.combinat.combinatorial_map import combinatorial_map
... | 3.15625 | 3 |
tests/cppproj/xdressrc.py | xdress/xdress | 88 | 7429 | <reponame>xdress/xdress<filename>tests/cppproj/xdressrc.py
import os
from xdress.utils import apiname
package = 'cppproj'
packagedir = 'cppproj'
includes = ['src']
plugins = ('xdress.autoall', 'xdress.pep8names', 'xdress.cythongen',
'xdress.stlwrap', )
extra_types = 'cppproj_extra_types' # non-default v... | 1.789063 | 2 |
routines/server.py | henryshunt/c-aws | 0 | 7430 | <gh_stars>0
import os
import subprocess
import routines.config as config
import routines.helpers as helpers
def get_static_info():
""" Outputs data concerning the computer in the C-AWS station
"""
startup_time = None
data_drive_space = None
camera_drive_space = None
# Get sys... | 2.53125 | 3 |
DQM/DTMonitorModule/python/dtChamberEfficiencyHI_cfi.py | pasmuss/cmssw | 0 | 7431 | <gh_stars>0
import FWCore.ParameterSet.Config as cms
from RecoMuon.TrackingTools.MuonServiceProxy_cff import MuonServiceProxy
dtEfficiencyMonitor = cms.EDAnalyzer("DTChamberEfficiency",
MuonServiceProxy,
debug = cms.untracked.bool(True),
TrackCollection = cms.InputTag("standAloneMuons"),
theMaxC... | 1.226563 | 1 |
gym_reinmav/envs/mujoco/__init__.py | peterminh227/reinmav-gym | 60 | 7432 | from gym_reinmav.envs.mujoco.mujoco_quad import MujocoQuadEnv
from gym_reinmav.envs.mujoco.mujoco_quad_hovering import MujocoQuadHoveringEnv
from gym_reinmav.envs.mujoco.mujoco_quad_quat import MujocoQuadQuaternionEnv | 1.148438 | 1 |
test.py | jasonivey/scripts | 0 | 7433 | <reponame>jasonivey/scripts
#!/usr/bin/env python3
# vim:softtabstop=4:ts=4:sw=4:expandtab:tw=120
from ansimarkup import AnsiMarkup, parse
import csv
import datetime
import operator
import os
from pathlib import Path
import re
import sys
import traceback
_VERBOSE = False
user_tags = {
'error' : par... | 2.40625 | 2 |
RDyn-master/rdyn/test/rdyn_test.py | nogrady/dynamo | 12 | 7434 | import unittest
import shutil
from rdyn.alg.RDyn_v2 import RDynV2
class RDynTestCase(unittest.TestCase):
def test_rdyn_simplified(self):
print("1")
rdb = RDynV2(size=500, iterations=100)
rdb.execute(simplified=True)
print("2")
rdb = RDynV2(size=500, iterations=100, max_ev... | 2.515625 | 3 |
recognition/datasets/build.py | Jung-Jun-Uk/UNPG | 7 | 7435 | <reponame>Jung-Jun-Uk/UNPG
import os
from .kface import KFace
from .ms1m import MS1M
from .bin_datasets import BIN
from .ijb import IJB
def build_datasets(data_cfg, batch_size, cuda, workers, mode, rank=-1):
assert mode in ['train', 'test']
cfg = data_cfg[mode]
if cfg['dataset'] == 'kface': ... | 1.8125 | 2 |
django_cd/notifications.py | ppinard/django-cd | 1 | 7436 | """"""
# Standard library modules.
import abc
# Third party modules.
from django.core.mail import send_mail
from django.template import Engine, Context
# Local modules.
from .models import RunState
# Globals and constants variables.
class Notification(metaclass=abc.ABCMeta):
@classmethod
def notify(self, ... | 2.296875 | 2 |
Experiment/ltpFR3_MTurk/ListGen/ltpFR3_listgen.py | jpazdera/PazdKaha22 | 0 | 7437 | <reponame>jpazdera/PazdKaha22<filename>Experiment/ltpFR3_MTurk/ListGen/ltpFR3_listgen.py<gh_stars>0
#!/usr/bin/env python2
import random
import itertools
import numpy
import sys
import json
import copy
def make_bins_ltpFR3(semArray):
"""
Creates four equal-width bins of WAS scores, identical to those used in ... | 2.5 | 2 |
fastestimator/dataset/data/cifar10.py | DwijayDS/fastestimator | 57 | 7438 | # Copyright 2019 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | 2.640625 | 3 |
examples/single_message.py | Inrixia/pyais | 51 | 7439 | <filename>examples/single_message.py
from pyais.messages import NMEAMessage
message = NMEAMessage(b"!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C")
print(message.decode())
# or
message = NMEAMessage.from_string("!AIVDM,1,1,,B,15M67FC000G?ufbE`FepT@3n00Sa,0*5C")
print(message.decode())
| 2.140625 | 2 |
30_days_of_code_10.py | sercangul/HackerRank | 0 | 7440 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 3 19:02:33 2019
@author: sercangul
"""
def maxConsecutiveOnes(x):
# Initialize result
count = 0
# Count the number of iterations to
# reach x = 0.
while (x!=0):
# This operation reduces length
... | 3.71875 | 4 |
artap/algorithm_cmaes.py | artap-framework/artap | 5 | 7441 | <gh_stars>1-10
import numpy as np
from .problem import Problem
from .algorithm_genetic import GeneralEvolutionaryAlgorithm
from .individual import Individual
from .operators import CustomGenerator, nondominated_truncate, RandomGenerator, UniformGenerator
import time
class CMA_ES(GeneralEvolutionaryAlgorithm):
"""... | 2.5 | 2 |
apns_proxy_client/core.py | hagino3000/apns-proxy-client-py | 0 | 7442 | <reponame>hagino3000/apns-proxy-client-py
# -*- coding: utf-8 -*-
"""
APNS Proxy Serverのクライアント
"""
import time
import zmq
import simplejson as json
READ_TIMEOUT = 1500 # msec
FLUSH_TIMEOUT = 5000 # msec
COMMAND_ASK_ADDRESS = b'\1'
COMMAND_SEND = b'\2'
COMMAND_FEEDBACK = b'\3'
DEVICE_TOKEN_LENGTH = 64
JSON_ALERT... | 2.3125 | 2 |
003_joint_probabilities.py | svetlanama/snowball | 0 | 7443 | import sys
sys.path.insert(0, '..')
import numpy
import time
import ConfigParser
import topicmodel
def main():
# read configuration file
config = ConfigParser.ConfigParser()
config.readfp(open('config.ini'))
dataDir = config.get('main', 'dataDir')
io = topicmodel.io(dataDir)
model ... | 2.15625 | 2 |
tests/bugs/core_4318_test.py | FirebirdSQL/firebird-qa | 1 | 7444 | <reponame>FirebirdSQL/firebird-qa
#coding:utf-8
#
# id: bugs.core_4318
# title: Regression: Predicates involving PSQL variables/parameters are not pushed inside the aggregation
# decription:
# tracker_id: CORE-4318
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
fro... | 1.523438 | 2 |
dictionary.py | WilliamHackspeare/profanity-percentage | 0 | 7445 | <gh_stars>0
#Import the json library to parse JSON file to Python
import json
#Import list of punctuation characters from the string library
from string import punctuation as p
#This method checks if the given word is a profanity
def is_profanity(word):
#Open the JSON file
words_file = open('data.json')
#Pars... | 3.890625 | 4 |
setup.py | cyfrmedia/cerridwen | 25 | 7446 | from setuptools import setup
import os
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
#NEWS = open(os.path.join(here, 'NEWS.txt')).read()
rootdir = os.path.dirname(os.path.abspath(__file__))
exec(open(rootdir + '/cerridwen/version.py').read())
version = __VERS... | 1.421875 | 1 |
pajbot/apiwrappers/authentication/access_token.py | JoachimFlottorp/pajbot | 128 | 7447 | <gh_stars>100-1000
import datetime
from abc import ABC, abstractmethod
import pajbot
class AccessToken(ABC):
SHOULD_REFRESH_THRESHOLD = 0.9
"""Fraction between 0 and 1 indicating what fraction/percentage of the specified full validity period
should actually be utilized. E.g. if this is set to 0.9, the i... | 3.265625 | 3 |
GHOST.py | RadicalAjay/Ghost_data | 1 | 7448 | #! /usr/bin/python3
# Description: Data_Ghost, concealing data into spaces and tabs making it imperceptable to human eyes.
# Author: <NAME>
# Github: Radical Ajay
class Ghost():
def __init__(self, file_name, output_format='txt'):
''' Converts ascii text to spaces and tabs '''
self.file_name = file... | 3.484375 | 3 |
scan_predict.py | ychu196/chicago_scan | 0 | 7449 | <reponame>ychu196/chicago_scan
# Image classification using AWS Sagemaker and Linear Learner
# Program set up and import libraries
import numpy as np
import pandas as pd
import os
from sagemaker import get_execution_role
role = get_execution_role()
bucket = 'chi-hackathon-skin-images'
# Import Data
import boto3
from... | 2.703125 | 3 |
gerber/am_statements.py | FixturFab/pcb-tools | 0 | 7450 | <reponame>FixturFab/pcb-tools<filename>gerber/am_statements.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# copyright 2015 <NAME> <<EMAIL>> and <NAME>
# <<EMAIL>>
# 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 ... | 2.09375 | 2 |
heroquest/migrations/0002_auto_20160819_1747.py | DeividVM/heroquest | 0 | 7451 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-08-19 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('heroquest', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | 1.609375 | 2 |
dask/array/utils.py | epervago/dask | 0 | 7452 | <filename>dask/array/utils.py
from distutils.version import LooseVersion
import difflib
import os
import numpy as np
from .core import Array
from ..async import get_sync
if LooseVersion(np.__version__) >= '1.10.0':
allclose = np.allclose
else:
def allclose(a, b, **kwargs):
if kwargs.pop('equal_nan', F... | 2.15625 | 2 |
launchpad_py/__init__.py | inniyah/launchpad-py | 1 | 7453 | <reponame>inniyah/launchpad-py<gh_stars>1-10
# more specific selections for Python 3 (ASkr, 2/2018)
from launchpad_py.launchpad import Launchpad
from launchpad_py.launchpad import LaunchpadMk2
from launchpad_py.launchpad import LaunchpadPro
from launchpad_py.launchpad import LaunchControlXL
from launchpad_py.launchpad ... | 1.21875 | 1 |
networks/adabins/utils.py | EvoCargo/mono_depth | 0 | 7454 | <reponame>EvoCargo/mono_depth
import base64
import math
import re
from io import BytesIO
import matplotlib.cm
import numpy as np
import torch
import torch.nn
from PIL import Image
# Compute edge magnitudes
from scipy import ndimage
class RunningAverage:
def __init__(self):
self.avg = 0
... | 2.03125 | 2 |
gdsfactory/types.py | simbilod/gdsfactory | 0 | 7455 | <gh_stars>0
"""In programming, a factory is a function that returns an object.
Functions are easy to understand because they have clear inputs and outputs.
Most gdsfactory functions take some inputs and return a Component object.
Some of these inputs parameters are also functions.
- Component: Object with.
- name... | 3.765625 | 4 |
tests/_site/myauth/models.py | ahmetdaglarbas/e-commerce | 2 | 7456 | # -*- coding: utf-8 -*-
# Code will only work with Django >= 1.5. See tests/config.py
import re
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.core import validators
from django.contrib.auth.models import BaseUserManager
from oscar.apps.customer.abstract_models impor... | 2.390625 | 2 |
5 - FC layers retraining/4 - FC weights to C++ code/weights_pck_to_cpp_unrolled_loop.py | brouwa/CNNs-on-FPSPs | 1 | 7457 | import pickle
import numpy as np
INPUT_FILENAME = 'NP_WEIGHTS.pck'
PRECISION = 100
# Open weights
fc1_k, fc1_b, fc2_k, fc2_b = pickle.load(
open(INPUT_FILENAME, 'rb'))
# Round them
fc1_k, fc1_b, fc2_k, fc2_b = fc1_k*PRECISION//1, fc1_b*PRECISION//1, fc2_k*PRECISION//1, fc2_b*PRECISION*PRECISION//1
fc1_k, fc1_b, f... | 2.484375 | 2 |
python/Canny_EdgeDetection.py | yubaoliu/Computer-Vision | 0 | 7458 | <gh_stars>0
import cv2
import numpy as np
import random
img = cv2.imread('../../Assets/Images/flower-white.jpeg', 1)
imgInfo = img.shape
height = imgInfo[0]
width = imgInfo[1]
cv2.imshow('img', img)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
imgG = cv2.GaussianBlur(gray, (3, 3), 0)
dst = cv2.Canny(img, 50, 50)
... | 2.53125 | 3 |
avod/core/trainer_stride.py | Guoxs/DODT | 1 | 7459 | <reponame>Guoxs/DODT<filename>avod/core/trainer_stride.py
"""Detection model trainer.
This file provides a generic training method to train a
DetectionModel.
"""
import datetime
import os
import tensorflow as tf
import time
from avod.builders import optimizer_builder
from avod.core import trainer_utils
from avod.core... | 2.359375 | 2 |
rest_framework_hmac/hmac_key/models.py | nickc92/django-rest-framework-hmac | 0 | 7460 | <gh_stars>0
import binascii
import os
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
class HMACKey(models.Model):
"""
The default HMACKey model that can auto generate a
key/secret for HMAC Auth via a signal
"""
def generate_ke... | 2.25 | 2 |
test/conftest.py | Geoiv/river | 0 | 7461 | <gh_stars>0
import os
from tempfile import NamedTemporaryFile
import boto3
from moto import mock_s3
import pandas as pd
import pandavro as pdx
import pickle
import pytest
@pytest.fixture(autouse=True, scope='session')
def aws_credentials():
"""
Sets AWS credentials to invalid values. Applied to all test func... | 2.125 | 2 |
company/migrations/0021_auto_20161208_1113.py | uktrade/directory-api | 2 | 7462 | <filename>company/migrations/0021_auto_20161208_1113.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-12-08 11:13
from __future__ import unicode_literals
from django.db import migrations
from company import helpers
def ensure_verification_code(apps, schema_editor):
Company = apps.get_model("compa... | 1.742188 | 2 |
system/indy-node-tests/TestAuthMapSuite.py | Toktar/indy-test-automation | 0 | 7463 | import pytest
import asyncio
from system.utils import *
from random import randrange as rr
import hashlib
import time
from datetime import datetime, timedelta, timezone
from indy import payment
import logging
logger = logging.getLogger(__name__)
@pytest.mark.usefixtures('docker_setup_and_teardown')
class TestAuthMa... | 1.898438 | 2 |
test/integration/test_reindex.py | jgough/opensearch-curator | 8 | 7464 | <reponame>jgough/opensearch-curator<filename>test/integration/test_reindex.py
import opensearchpy
import curator
import os
import json
import string
import random
import tempfile
import click
from click import testing as clicktest
import time
from . import CuratorTestCase
from unittest.case import SkipTest
from . impo... | 2.203125 | 2 |
libhustpass/login.py | naivekun/libhustpass | 26 | 7465 | import libhustpass.sbDes as sbDes
import libhustpass.captcha as captcha
import requests
import re
import random
def toWideChar(data):
data_bytes = bytes(data, encoding="utf-8")
ret = []
for i in data_bytes:
ret.extend([0, i])
while len(ret) % 8 != 0:
ret.append(0)
return ret
def En... | 2.765625 | 3 |
code/contours_sorting_by_area.py | Asadullah-Dal17/contours-detection-advance | 1 | 7466 | import cv2 as cv
import numpy as np
def areaFinder(contours):
areas = []
for c in contours:
a =cv.contourArea(c)
areas.append(a)
return areas
def sortedContoursByArea(img, larger_to_smaller=True):
edges_img = cv.Canny(img, 100, 150)
contours , h = cv.findContours(edges_img, cv.RETR_... | 3.09375 | 3 |
matchzoo/metrics/precision.py | ChrisRBXiong/MatchZoo-py | 468 | 7467 | <filename>matchzoo/metrics/precision.py
"""Precision for ranking."""
import numpy as np
from matchzoo.engine.base_metric import (
BaseMetric, sort_and_couple, RankingMetric
)
class Precision(RankingMetric):
"""Precision metric."""
ALIAS = 'precision'
def __init__(self, k: int = 1, threshold: float ... | 2.625 | 3 |
src/main/py/ltprg/config/seq.py | forkunited/ltprg | 11 | 7468 | from mung.torch_ext.eval import Loss
from ltprg.model.seq import DataParameter, SequenceModelNoInput, SequenceModelInputToHidden, SequenceModelAttendedInput
from ltprg.model.seq import VariableLengthNLLLoss
# Expects config of the form:
# {
# data_parameter : {
# seq : [SEQUENCE PARAMETER NAME]
# inp... | 2.21875 | 2 |
src/Utilities/metadata_worker.py | sigseg5/nometa-tg | 3 | 7469 | from shutil import move
import piexif
from PIL import Image
def delete_metadata(full_path_to_img):
"""
This function used for remove metadata only from documents, if you send image 'as image' Telegram automatically
removes all metadata at sending. This function removes all metadata via 'piexif' lib, save... | 3.125 | 3 |
dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_unit_2.py | pbarton666/virtual_classroom | 0 | 7470 | #py_unit_2.py
import unittest
class FirstTest(unittest.TestCase):
def setUp(self):
"setUp() runs before every test"
self.msg="Sorry, Charlie, but {} is not the same as {}."
def tearDown(self):
"tearDown runs after every test"
pass
def test_me(self):
"this test should pass"
first=1
second=2
self.asse... | 3.46875 | 3 |
src/scheduled_task/__init__.py | Sciocatti/python_scheduler_and_clean_forced_exit | 0 | 7471 | from .scheduled_task import ScheduledTask | 1.023438 | 1 |
scripts/game.py | davidnegrazis/PyPlayText-Workshop | 0 | 7472 | from sys import exit
# ------------------------------------------------------------------------------
global dev_name
global game_title
dev_name = "" # enter your name in the quotes!
game_title = "" # enter the game title in the quotes!
# ------------------------------------------------------------------------------
... | 3.984375 | 4 |
lc1108_defangip.py | moheed/algo | 0 | 7473 | <reponame>moheed/algo<gh_stars>0
class Solution:
def defangIPaddr(self, address: str) -> str:
i=0
j=0
strlist=list(address)
defang=[]
while i< len(strlist):
if strlist[i] == '.':
defang.append('[')
defang.append('.')
... | 3.21875 | 3 |
src/elections_address_files/commands/zip_files.py | gregbunce/assign_vista_pcts_to_sgid_addrpnts | 0 | 7474 | <filename>src/elections_address_files/commands/zip_files.py<gh_stars>0
import os, zipfile
# Zip files.
def zipfiles(directory):
# File extension to zip.
#ext = ('.gdb', '.csv')
ext = ('.gdb')
# Iterate over all files and check for desired extentions for zipping.
for file in os.listdir(direc... | 3.0625 | 3 |
tartiflette/parser/nodes/node.py | erezsh/tartiflette | 0 | 7475 | <filename>tartiflette/parser/nodes/node.py<gh_stars>0
class Node:
def __init__(self, path, libgraphql_type, location, name):
self.path = path
self.parent = None
self.children = []
self.libgraphql_type = libgraphql_type
self.location = location
self.name = name
de... | 2.296875 | 2 |
mars/services/web/tests/test_core.py | yuyiming/mars | 1 | 7476 | # Copyright 1999-2021 Alibaba Group Holding 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 by applicable law or a... | 1.898438 | 2 |
test/test.py | caizhanjin/deepseg | 0 | 7477 | """
例子为MNIST,对手写图片进行分类。
神经网络hello world。
"""
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('MNIST_data', one_hot=True)
# 封装网络用到的API
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.... | 3.78125 | 4 |
game/content/ghplots/lancemates.py | jwvhewitt/gearhead-caramel | 74 | 7478 | import pbge
from game.content.plotutility import LMSkillsSelfIntro
from game.content import backstory
from pbge.plots import Plot
from pbge.dialogue import Offer, ContextTag
from game.ghdialogue import context
import gears
import game.content.gharchitecture
import game.content.ghterrain
import random
from game import m... | 2.21875 | 2 |
projects/detr/scripts/dd.py | zzzzzz0407/detectron2 | 1 | 7479 | import json
if __name__ == '__main__':
jsonFile = '/data00/home/zhangrufeng1/projects/detectron2/projects/detr/datasets/mot/mot17/annotations/mot17_train_half.json'
with open(jsonFile, 'r') as f:
infos = json.load(f)
count_dict = dict()
for info in infos["images"]:
if info["file_name"]... | 2.625 | 3 |
app/app.py | wesleibarboza/natasha-virtual | 23 | 7480 | <reponame>wesleibarboza/natasha-virtual
# -*- coding: utf-8 -*-
"""Archivo principal para el echobot. Main File for the echobot"""
from fbmq import Page
from flask import Flask, request
# Token generado por la página web. Generated token in the facebook web page
PAGE_ACCESS_TOKEN = "COPY_HERE_YOUR_PAGE_ACCES_TOKEN"
# ... | 2.59375 | 3 |
Camvid/CamVid_utlis.py | Water2style/FCN-pytorch-CanRun | 7 | 7481 | <filename>Camvid/CamVid_utlis.py
# -*- coding: utf-8 -*-
from __future__ import print_function
from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import scipy.misc
import random
import os
import imageio
#############################
# global variables #
#####################... | 2.625 | 3 |
stream-reasoner/ws_client.py | patrik999/AdaptiveStreamReasoningMonitoring | 1 | 7482 | #!/usr/bin/env python
import websocket
import time
try:
import thread
except ImportError:
import _thread as thread
runs = 100
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(ws):
... | 2.734375 | 3 |
Main.py | samuelterra22/Data-Mining | 0 | 7483 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import seaborn as sns
from matplotlib import rcParams
import statsmodels.api as sm
from statsmodels.formula.api import ols
df = pd.read_csv('kc_house_data.csv')
# print(df.head())
# print(df.isnull().any())
# print(df.d... | 3.03125 | 3 |
whole_cell_patch/filterDialog.py | 11uc/whole_cell_patch | 2 | 7484 | <reponame>11uc/whole_cell_patch<filename>whole_cell_patch/filterDialog.py
# Dialogs for setting filter parameters.
from PyQt5.QtWidgets import QLabel, QGridLayout, QPushButton, \
QLineEdit, QVBoxLayout, QHBoxLayout, QDialog, QComboBox, QWidget
from PyQt5.QtCore import pyqtSignal
class FilterDialog(QDialog):
'''
D... | 2.34375 | 2 |
projects/controllable_dialogue/tasks/agents.py | zl930216/ParlAI | 41 | 7485 | <filename>projects/controllable_dialogue/tasks/agents.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
from .build import build, make_path
from parlai.uti... | 2.125 | 2 |
problems/p009.py | davisschenk/project-euler-python | 0 | 7486 | <gh_stars>0
from math import ceil, sqrt
from problem import Problem
from utils.math import gcd
class PythagoreanTriplet(Problem, name="Special Pythagorean triplet", expected=31875000):
@Problem.solution()
def brute_force(self, ts=1000):
for a in range(3, round((ts - 3) / 2)):
for b in ran... | 3.265625 | 3 |
Roche.py | murbanec/Roche2D | 0 | 7487 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 14 10:37:04 2021
@author: <NAME>
"""
#calculates trajectory of small mass positioned close to L4 Lagrange point
#creates gif as output
import math
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation, PillowWriter
Distan... | 3.046875 | 3 |
youtube_dl/extractor/azubu.py | LyleH/youtube-dl | 0 | 7488 | <gh_stars>0
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
ExtractorError,
float_or_none,
sanitized_Request,
)
class AzubuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?azubu\.tv/[^/]+#!/play/(?P<id>\d+)'
_TESTS = [
{
... | 2.171875 | 2 |
conda_build/main_develop.py | dan-blanchard/conda-build | 0 | 7489 | <reponame>dan-blanchard/conda-build
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_import, division, print_function
i... | 1.789063 | 2 |
benchmarking/experiments/sanity_check.py | ltgoslo/norBERT | 19 | 7490 | #!/bin/env python3
from transformers import TFBertForTokenClassification
from data_preparation.data_preparation_pos import MBERTTokenizer as MBERT_Tokenizer_pos
import sys
if __name__ == "__main__":
if len(sys.argv) > 1:
modelname = sys.argv[1]
else:
modelname = "ltgoslo/norbert"
model = T... | 2.3125 | 2 |
nca47/api/controllers/v1/firewall/securityZone.py | WosunOO/nca_xianshu | 0 | 7491 | <filename>nca47/api/controllers/v1/firewall/securityZone.py
from oslo_serialization import jsonutils as json
from nca47.api.controllers.v1 import base
from nca47.common.i18n import _
from nca47.common.i18n import _LI, _LE
from nca47.common.exception import Nca47Exception
from oslo_log import log
from nca47.api.controll... | 2.078125 | 2 |
mlmodels/model_tch/nbeats/model.py | gitter-badger/mlmodels | 1 | 7492 | import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
def seasonality_model(thetas, t, device):
p = thetas.size()[-1]
assert p < 10, 'thetas_dim is too big.'
p1, p2 = (p // 2, p // 2) if p % 2 == 0 else (p // 2, p // 2 + 1)
s1 = torch.tensor([np.cos(2 * np.pi * i * ... | 2.4375 | 2 |
BACKPROPAGATION/Backprop.py | chaya-v/AI-ML-Lab-Programs | 2 | 7493 | from math import exp
from random import seed
from random import random
def initialize_network(n_inputs, n_hidden, n_outputs):
network = list()
hidden_layer = [{'weights':[random() for i in range(n_inputs + 1)]} for i in range(n_hidden)]
network.append(hidden_layer)
output_layer = [{'weights':[random() for i in r... | 3.359375 | 3 |
tests/multi_design_test.py | benoitc/hypercouch | 3 | 7494 | """\
Copyright (c) 2009 <NAME> <<EMAIL>>
This file is part of hypercouch which is released uner the MIT license.
"""
import time
import unittest
import couchdb
COUCHURI = "http://127.0.0.1:5984/"
TESTDB = "hyper_tests"
class MultiDesignTest(unittest.TestCase):
def setUp(self):
self.srv = couchdb.Server(CO... | 2.375 | 2 |
xled_plus/samples/colmeander.py | DanieleMancini/xled_plus | 0 | 7495 | <filename>xled_plus/samples/colmeander.py<gh_stars>0
from .sample_setup import *
ctr = setup_control()
eff = ColorMeanderEffect(ctr, "solid")
eff.launch_rt()
input()
eff.stop_rt()
ctr.turn_off()
| 1.429688 | 1 |
python/dgl/nn/pytorch/sparse_emb.py | wcyjames/dgl | 0 | 7496 | <filename>python/dgl/nn/pytorch/sparse_emb.py
"""Torch NodeEmbedding."""
from datetime import timedelta
import torch as th
from ...backend import pytorch as F
from ...utils import get_shared_mem_array, create_shared_mem_array
_STORE = None
class NodeEmbedding: # NodeEmbedding
'''Class for storing node embeddings.... | 2.84375 | 3 |
tests/sentry/web/frontend/test_create_team.py | seukjung/sentry-custom | 20 | 7497 | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from sentry.models import OrganizationMember, OrganizationMemberTeam, Team
from sentry.testutils import TestCase, PermissionTestCase
class CreateTeamPermissionTest(PermissionTestCase):
def setUp(self):
super(CreateTeamPe... | 2.140625 | 2 |
agendamentos/migrations/0011_alter_agendamentosfuncionarios_table.py | afnmachado/univesp_pi_1 | 0 | 7498 | # Generated by Django 3.2.8 on 2021-11-29 05:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('agendamentos', '0010_agendamentosfuncionarios'),
]
operations = [
migrations.AlterModelTable(
name='agendamentosfuncionarios',
... | 1.25 | 1 |
openstack/tests/unit/metric/v1/test_capabilities.py | teresa-ho/stx-openstacksdk | 43 | 7499 | <reponame>teresa-ho/stx-openstacksdk<gh_stars>10-100
# 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 agre... | 1.929688 | 2 |