max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
async.py | nakamoo/a3c_PredNet | 443 | 11179958 | <reponame>nakamoo/a3c_PredNet<filename>async.py
import multiprocessing as mp
import os
import random
import chainer
import numpy as np
import random_seed
def set_shared_params(a, b):
"""
Args:
a (chainer.Link): link whose params are to be replaced
b (dict): dict that consists of (param_name, mul... |
filebeat/tests/system/test_container.py | tetianakravchenko/beats | 9,729 | 11179968 | <reponame>tetianakravchenko/beats
from filebeat import BaseTest
import socket
import os
class Test(BaseTest):
"""
Test filebeat with the container input
"""
def test_container_input(self):
"""
Test container input
"""
input_raw = """
- type: container
paths:
- {}... |
grammarinator/runtime/dispatching_listener.py | 38b394ce01/grammarinator | 228 | 11179981 | # Copyright (c) 2020 <NAME>, <NAME>.
#
# Licensed under the BSD 3-Clause License
# <LICENSE.rst or https://opensource.org/licenses/BSD-3-Clause>.
# This file may not be copied, modified, or distributed except
# according to those terms.
from .default_listener import DefaultListener
class DispatchingListener(DefaultL... |
sonarqube/community/settings.py | ckho-wkcda/python-sonarqube-api | 113 | 11179982 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Author: <NAME>
from sonarqube.utils.rest_client import RestClient
from sonarqube.utils.config import (
API_SETTINGS_SET_ENDPOINT,
API_SETTINGS_RESET_ENDPOINT,
API_SETTINGS_VALUES_ENDPOINT,
API_SETTINGS_LIST_DEFINITIONS_ENDPOINT,
)
from sonarqube.utils.comm... |
mac/pyobjc-framework-Quartz/PyObjCTest/test_civector.py | albertz/music-player | 132 | 11180012 | <filename>mac/pyobjc-framework-Quartz/PyObjCTest/test_civector.py<gh_stars>100-1000
from PyObjCTools.TestSupport import *
from Quartz.QuartzCore import *
class TestCIVector (TestCase):
def testMethods(self):
self.assertArgIsIn(CIVector.vectorWithValues_count_, 0)
self.assertArgSizeInArg(CIVector.v... |
pythainlp/wangchanberta/__init__.py | Gorlph/pythainlp | 569 | 11180076 | # -*- coding: utf-8 -*-
__all__ = [
"ThaiNameTagger",
"pos_tag",
"segment",
]
from pythainlp.wangchanberta.core import ThaiNameTagger, segment
from pythainlp.wangchanberta.postag import pos_tag
|
src/utils.py | lingluodlut/Att-ChemdNER | 126 | 11180086 | <filename>src/utils.py<gh_stars>100-1000
import os
import re
import codecs
import numpy as np
import six
import theano
models_path = "./models"
eval_path = "./evaluation"
eval_temp = os.path.join(eval_path, "temp")
eval_script = os.path.join(eval_path, "conlleval")
class EarlyStopping(object):
#{{{
'''Stop trai... |
src/models/audiounet.py | TECHENGINESSRL/audio-super-res | 712 | 11180090 | <gh_stars>100-1000
import numpy as np
import tensorflow as tf
from scipy import interpolate
from .model import Model, default_opt
from .layers.subpixel import SubPixel1D, SubPixel1D_v2
from tensorflow.python.keras import backend as K
from keras.layers import merge
from keras.layers.core import Activation, Dropout
fr... |
xhr/resources/get-set-cookie.py | meyerweb/wpt | 14,668 | 11180091 | import datetime
def main(request, response):
response.headers.set(b"Content-type", b"text/plain")
# By default use a session cookie.
expiration = None
if request.GET.get(b"clear"):
# If deleting, expire yesterday.
expiration = -datetime.timedelta(days=1)
response.set_cookie(b"WK-t... |
step07_appsync_with_subscriptions_using_amplify/aws-cdk/python/lambda/main.py | fullstackwebdev/full-stack-serverless-cdk | 192 | 11180102 | <filename>step07_appsync_with_subscriptions_using_amplify/aws-cdk/python/lambda/main.py
from __future__ import print_function
from addTodo import addTodoItem
from getTodo import getItem
from deleteTodo import deleteItem
from updateTodo import updateItem
import os
import boto3
dynamodb = boto3.resource('dynamodb')
def h... |
tests/testapp/lookups.py | StreetHawkInc/django-rest-framework-filters | 743 | 11180116 | <gh_stars>100-1000
from django.db.models import Transform
# This is a copy of the `Unaccent` transform from `django.contrib.postgres`.
# This is necessary as the postgres app requires psycopg2 to be installed.
class Unaccent(Transform):
bilateral = True
lookup_name = 'unaccent'
function = 'UNACCENT'
|
lite/tests/unittest_py/op/test_lod_reset_op.py | 714627034/Paddle-Lite | 808 | 11180137 | # Copyright (c) 2021 PaddlePaddle 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 appli... |
backend/pubsub/store.py | restato/bunnybook | 131 | 11180153 | <reponame>restato/bunnybook<filename>backend/pubsub/store.py
import datetime as dt
from typing import Union, List
from uuid import UUID
from injector import singleton, inject
from common.injection import PubSubStore
from common.schemas import dt_to_iso8601z
@singleton
class WebSocketsStore:
ONLINE_STATUS_EX: in... |
thirdparty/nsiqcppstyle/rules/RULE_9_2_D_use_reentrant_function.py | cfsengineering/tigl | 171 | 11180201 | """
Use reentrant functions. Do not use not reentrant functions.(ctime, strtok, toupper)
== Violation ==
void A() {
k = ctime(); <== Violation. ctime() is not the reenterant function.
j = strok(blar blar); <== Violation. strok() is not the reenterant function.
}
== Good ==
void A() {
k = t... |
benchmarks/driver/runner.py | SymbioticLab/Salus | 104 | 11180207 | <reponame>SymbioticLab/Salus
# -*- coding: future_fstrings -*-
#
# Copyright 2019 <NAME> <<EMAIL>>
#
# This file is part of Salus
# (see https://github.com/SymbioticLab/Salus).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ... |
model/resnet_cifar10.py | cmu-enyac/LeGR | 106 | 11180218 | <filename>model/resnet_cifar10.py
'''ResNet in PyTorch.
For Pre-activation ResNet, see 'preact_resnet.py'.
Reference:
[1] <NAME>, <NAME>, <NAME>, <NAME>
Deep Residual Learning for Image Recognition. arXiv:1512.03385
'''
import torch
import math
import torch.nn as nn
import torch.nn.functional as F
class Downsamp... |
lib/pymedphys/_experimental/wlutz/interppoints.py | ethanio12345/pymedphys | 207 | 11180222 | # Copyright (C) 2019 Cancer Care Associates
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to ... |
Hamming_Distance/Python/jcla1/hamming.py | Mynogs/Algorithm-Implementations | 1,184 | 11180237 | <gh_stars>1000+
def hamming_distance(p, 1):
"""Return the Hamming distance between equal-length sequences"""
if len(p) != len(q): raise ValueError("Undefined for sequences of unequal length")
return sum(ch1 != ch2 for ch1, ch2 in zip(p, q)) |
tbx/work/migrations/0009_remove_play_fields.py | elviva404/wagtail-torchbox | 103 | 11180248 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-21 13:52
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("work", "0008_remove_workpage_body"),
]
operations = [
migrations.RemoveField(model... |
atest/testdata/test_libraries/MyLibDir/ClassLib.py | rdagum/robotframework | 7,073 | 11180254 | <filename>atest/testdata/test_libraries/MyLibDir/ClassLib.py
class ClassLib:
def keyword_in_mylibdir_classlib(self):
pass
|
matchzoo/utils/timer.py | ChrisRBXiong/MatchZoo-py | 468 | 11180257 | """Timer."""
import time
class Timer(object):
"""Computes elapsed time."""
def __init__(self):
"""Timer constructor."""
self.reset()
def reset(self):
"""Reset timer."""
self.running = True
self.total = 0
self.start = time.time()
def resume(self):
... |
applications/FluidDynamicsApplication/python_scripts/flow_output_process.py | lkusch/Kratos | 778 | 11180268 | # Importing the Kratos Library
import KratosMultiphysics
import KratosMultiphysics.FluidDynamicsApplication as KratosCFD
# other imports
from KratosMultiphysics.time_based_ascii_file_writer_utility import TimeBasedAsciiFileWriterUtility
def Factory(settings, Model):
if(type(settings) != KratosMultiphysics.Paramete... |
Sources/Workflows/Monkey-Patch/alfred/util.py | yagosys/AlfredWorkflow.com | 2,177 | 11180319 | # -*- coding: utf-8 -*-
import hashlib, random
import core
hashDigest = lambda s: hashlib.md5(s).hexdigest()
uid = lambda: '{0}.{1}'.format(core.bundleID(), random.getrandbits(25)) |
xrspatial/tests/test_focal.py | g2giovanni/xarray-spatial | 547 | 11180320 | <filename>xrspatial/tests/test_focal.py
import pytest
import xarray as xr
import numpy as np
import dask.array as da
from xrspatial.utils import doesnt_have_cuda
from xrspatial.utils import ngjit
from xrspatial import mean
from xrspatial.focal import hotspots, apply, focal_stats
from xrspatial.convolution import (
... |
tools/pot/openvino/tools/pot/configs/hardware_config.py | ryanloney/openvino-1 | 1,127 | 11180332 | <reponame>ryanloney/openvino-1
# Copyright (C) 2020-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
try:
import jstyleson as json
except ImportError:
import json
from collections import OrderedDict
from addict import Dict
from .utils import product_dict
class HardwareConfig(list):
def get(s... |
sdklab/meantimerecovery/mean_time_recover_with_docker.py | dominicbetts/azure-iot-sdk-python | 366 | 11180340 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import doc... |
api/tests/unit/features/test_unit_features_views.py | SolidStateGroup/Bullet-Train-API | 126 | 11180348 | from django.urls import reverse
from rest_framework import status
from environments.models import Environment
from features.feature_types import MULTIVARIATE
from features.models import Feature
from features.multivariate.models import MultivariateFeatureOption
from organisations.models import Organisation
from project... |
RecoTracker/MkFit/python/mkFitHitConverter_cfi.py | Purva-Chaudhari/cmssw | 852 | 11180361 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from RecoTracker.MkFit.mkFitHitConverterDefault_cfi import mkFitHitConverterDefault as _mkFitHitConverterDefault
from RecoLocalTracker.SiStripClusterizer.SiStripClusterChargeCut_cfi import *
mkFitHitConverter = _mkFitHitConverterDefault.clone(
minGoodStr... |
h2o-py/tests/testdir_algos/isoforextended/pyunit_isoforextended_saveload.py | vishalbelsare/h2o-3 | 6,098 | 11180418 | from __future__ import print_function
import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.extended_isolation_forest import H2OExtendedIsolationForestEstimator
def extended_isolation_forest_save_and_load():
print("Extended Isolation Forest S... |
examples/d2/white.py | manu-mannattil/nolitsa | 118 | 11180426 | <reponame>manu-mannattil/nolitsa
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""D2 for white noise.
D2 is (theoretically) equal to the embedding dimension for white noise.
"""
import numpy as np
import matplotlib.pyplot as plt
from nolitsa import d2, utils
x = np.random.random(5 * 1000)
dim = np.arange(1, 10 + ... |
mmdet/utils/general_utils.py | Yibin122/conditional-lane-detection | 232 | 11180447 | import os
import time
import numpy as np
import cv2
def getPathList(path, suffix='png'):
if (path[-1] != '/') & (path[-1] != '\\'):
path = path + '/'
pathlist = list()
g = os.walk(path)
for p, d, filelist in g:
for filename in filelist:
if filename.endswith(suffix):
... |
tool/taint_analysis/coretaint.py | cpbscholten/karonte | 294 | 11180452 | <reponame>cpbscholten/karonte<filename>tool/taint_analysis/coretaint.py
import os
import claripy
import logging
import random
import signal
from random import shuffle
from angr import BP, SimValueError
from angr.procedures.stubs.ReturnUnconstrained import ReturnUnconstrained
from taint_analysis.utils import *
loggi... |
compiler_opt/rl/feature_ops.py | google/ml-compiler-opt | 130 | 11180476 | <reponame>google/ml-compiler-opt
# coding=utf-8
# Copyright 2020 Google LLC
#
# 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 requ... |
hv6/hv6/spec/kernel/spec/helpers.py | ProKil/OS2018spring-projects-g10 | 132 | 11180481 | <reponame>ProKil/OS2018spring-projects-g10
#
# Copyright 2017 Hyperkernel Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
tests/test_resource_tracker/test_api/test_resource_pool_api_views/test_rp_attribute_definition_api_views/test_delete.py | LaudateCorpus1/squest | 112 | 11180494 | <filename>tests/test_resource_tracker/test_api/test_resource_pool_api_views/test_rp_attribute_definition_api_views/test_delete.py
from rest_framework import status
from rest_framework.reverse import reverse
from resource_tracker.models import ResourcePoolAttributeDefinition
from tests.test_resource_tracker.test_api.ba... |
dev_utils/memory.py | e-ntro-py/desktop-app | 518 | 11180503 | <gh_stars>100-1000
import psutil
import sys
import pandas as pd
import math
pid = int(sys.argv[1])
proc = psutil.Process(pid)
processes = [proc, ] +proc.children()
data = [ {
'name': p.name(),
'pid': p.pid,
'rss': p.memory_info().rss,
'vms': p.memory_info().vms
} for p in processes]
df = pd.DataFr... |
support/Lab03 - Blockchain4Students/blockchain/consensus.py | RafaelAPB/university-course | 125 | 11180570 | <gh_stars>100-1000
from abc import ABC, abstractmethod
class Consensus(ABC):
def __init__(self, block):
self.block = block
super().__init__()
@abstractmethod
def mine_block(self):
pass
class ProofOfWork(Consensus):
def __init__(self, block, difficulty):
self.diffic... |
hdf_compass/compass_viewer/frame.py | HDFGroup/hdf-compass | 124 | 11180576 | ##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... |
contrib/demUtils/test/testCorrect_geoid_i2_srtm.py | vincentschut/isce2 | 1,133 | 11180593 | <reponame>vincentschut/isce2
#!/usr/bin/env python3
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2012 California Institute of Technology. ALL RIGHTS RESERVED.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compl... |
skbayes/decomposition_models/__init__.py | Habush/sklearn-bayes | 478 | 11180614 | <reponame>Habush/sklearn-bayes<filename>skbayes/decomposition_models/__init__.py<gh_stars>100-1000
from .gibbs_lda_cython import GibbsLDA
from .rbm import BernoulliRBM
__all__ = ['GibbsLDA','BernoulliRBM']
|
libraries/botframework-streaming/botframework/streaming/transport/disconnected_event_args.py | andreikop/botbuilder-python | 388 | 11180626 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class DisconnectedEventArgs:
def __init__(self, *, reason: str = None):
self.reason = reason
DisconnectedEventArgs.empty = DisconnectedEventArgs()
|
autodist/utils/network.py | Ezra-H/autodist | 127 | 11180630 | <reponame>Ezra-H/autodist
# Copyright 2020 Petuum, 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 req... |
ghostwriter/commandcenter/migrations/0009_cloudservicesconfiguration_notification_delay.py | bbhunter/Ghostwriter | 601 | 11180677 | # Generated by Django 3.0.10 on 2021-09-20 21:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('commandcenter', '0008_remove_namecheapconfiguration_reset_dns'),
]
operations = [
migrations.AddField(
model_name='cloudservice... |
setup.py | aicentral/torchbiomed | 106 | 11180681 | #!/usr/bin/env python
import os
import shutil
import sys
from setuptools import setup, find_packages
readme = open('README.md').read()
VERSION = '0.0.1'
# same as ./requirements.txt
requirements = [
'numpy',
'torch',
'torchvision',
]
setup(
# Metadata
name='torchbiomed',
version=VERSION,
... |
ai/sample-model2.py | dekimir/RamFuzz | 310 | 11180691 | #!/usr/bin/env python
# Copyright 2016-2018 The RamFuzz contributors. 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
... |
lintcode/92.backpack.py | geemaple/algorithm | 177 | 11180708 | class Solution:
"""
@param m: An integer m denotes the size of a backpack
@param A: Given n items with size A[i]
@return: The maximum size
"""
def backPack(self, m, A):
# write your code here
table = [False for _ in range(m + 1)]
table[0] = True
for i in range(le... |
tensorflow_constrained_optimization/__init__.py | RMKruse/tensorflow_constrained_optimization | 276 | 11180726 | <gh_stars>100-1000
# Copyright 2018 The TensorFlow Constrained Optimization 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/licen... |
python/tests/json/json_dictionary_test.py | vvucetic/keyvi | 199 | 11180733 | <filename>python/tests/json/json_dictionary_test.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Usage: py.test tests
import sys
import os
from keyvi.compiler import JsonDictionaryCompiler
root = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(root, "../"))
from test_tools import tmp_dictionar... |
draft-3/salad/setup.py | hmenager/common-workflow-language | 1,365 | 11180738 | #!/usr/bin/env python
import os
import sys
import setuptools.command.egg_info as egg_info_cmd
import shutil
from setuptools import setup, find_packages
SETUP_DIR = os.path.dirname(__file__)
README = os.path.join(SETUP_DIR, 'README.rst')
try:
import gittaggers
tagger = gittaggers.EggInfoFromGit
except Import... |
concern/__init__.py | CelineWang1027/PSGAN | 570 | 11180746 | <gh_stars>100-1000
from .image import load_image
|
k-distribution/tests/pyk/unit-test.py | nrdxp/k | 404 | 11180778 | <reponame>nrdxp/k<filename>k-distribution/tests/pyk/unit-test.py
#!/usr/bin/env python3
import sys
import unittest
from functools import reduce
# From K's pyk-library
from pyk import *
class TestPyk(unittest.TestCase):
def test_newLines(self):
self.assertEqual(newLines(['aaa', 'bbb']), 'aaa\nbbb')
... |
examples/t_entries.py | tgolsson/appJar | 666 | 11180793 | import sys
sys.path.append("../")
from appJar import gui
def changer(btn):
print(btn, app.entry(btn), "changed")
def submit(btn):
print(btn, app.entry(btn), "submitted")
def validater(btn):
if btn == "A":
app.setEntryBg("e1", "red")
app.setEntryBg("le1", "red")
app.setEntryBg("ld1... |
bookwyrm/tests/models/test_import_model.py | mouse-reeve/fedireads | 270 | 11180801 | <filename>bookwyrm/tests/models/test_import_model.py
""" testing models """
import datetime
import json
import pathlib
from unittest.mock import patch
from django.utils import timezone
from django.test import TestCase
import responses
from bookwyrm import models
from bookwyrm.book_search import SearchResult
from book... |
src/datashare/azext_datashare/vendored_sdks/datashare/aio/_data_share_management_client_async.py | Mannan2812/azure-cli-extensions | 207 | 11180808 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
thespian/test/test_HAConvention.py | godaddy/Thespian | 210 | 11180810 | <reponame>godaddy/Thespian
from thespian.test import *
from time import sleep
import pytest
from thespian.actors import *
from datetime import timedelta
class PreRegActor(ActorTypeDispatcher):
def receiveMsg_str(self, regaddr, sender):
self.preRegisterRemoteSystem(regaddr, {})
self.send(sender, 'R... |
hs_core/tests.py | tommac7/hydroshare | 178 | 11180831 | <filename>hs_core/tests.py
"""Empty. See tests/ folder."""
|
tests/machines/merge_overlapping_intervals/merge_overlapping_intervals_test.py | ealter/vim_turing_machine | 149 | 11180844 | from unittest import mock
import pytest
import vim_turing_machine.machines.merge_overlapping_intervals.merge_overlapping_intervals
import vim_turing_machine.struct
import vim_turing_machine.turing_machine
from vim_turing_machine.constants import INITIAL_STATE
from vim_turing_machine.constants import NO_FINAL_STATE
fr... |
scripts/eval_mesh.py | isabella232/lasr | 128 | 11180847 | <reponame>isabella232/lasr
# Copyright 2021 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
tempest/tests/lib/services/identity/v2/test_tenants_client.py | mail2nsrajesh/tempest | 254 | 11180861 | # Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
stores/apps/payments/taxes.py | diassor/CollectorCity-Market-Place | 135 | 11180890 | import decimal, logging
from django.db import models
from shops.models import Shop
from preferences.models import Preference, TaxState
class TaxCalculator():
@classmethod
def get_tax(cls, shop, state, city=None):
try:
tax_rate = TaxState.objects.filter(shop=shop).filter(state=state)... |
tests/data/test_mixins.py | arvindmuralie77/gradsflow | 253 | 11180907 | # Copyright (c) 2021 GradsFlow. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
clients/python_client/simplest_client.py | jnclt/simple_tensorflow_serving | 771 | 11180925 | <reponame>jnclt/simple_tensorflow_serving<filename>clients/python_client/simplest_client.py
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import requests
def main():
endpoint = "http://127.0.0.1:8500"
print("Request for raw model signature")
input_data = {"data": {"keys": [1, 2]}}
result = requests.post(... |
examples/swat-s1/plc3.py | pgaulon/minicps | 119 | 11180952 |
"""
swat-s1 plc3
"""
from minicps.devices import PLC
from utils import PLC3_DATA, STATE, PLC3_PROTOCOL
from utils import PLC_SAMPLES, PLC_PERIOD_SEC
from utils import IP
import time
PLC1_ADDR = IP['plc1']
PLC2_ADDR = IP['plc2']
PLC3_ADDR = IP['plc3']
LIT301_3 = ('LIT301', 3)
class SwatPLC3(PLC):
def pre_loo... |
src/dataloaders/prepare/eeg/constants.py | dumpmemory/state-spaces | 513 | 11180981 | INCLUDED_CHANNELS = [
"EEG FP1",
"EEG FP2",
"EEG F3",
"EEG F4",
"EEG C3",
"EEG C4",
"EEG P3",
"EEG P4",
"EEG O1",
"EEG O2",
"EEG F7",
"EEG F8",
"EEG T3",
"EEG T4",
"EEG T5",
"EEG T6",
"EEG FZ",
"EEG CZ",
"EEG PZ",
]
INCLUDED_CHANNELS_STANFORD =... |
perma_web/perma/tests/test_urls.py | rachelaus/perma | 317 | 11181010 | from django.urls import reverse
from perma.urls import urlpatterns
from .utils import PermaTestCase
class UrlsTestCase(PermaTestCase):
def test_url_status_codes(self):
"""
A really simple test for 500 errors. We test all views that don't
take parameters (it's not easy to guess what params... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/a/assignment_from_no_return.py | ciskoinch8/vimrc | 463 | 11181032 | # pylint: disable=missing-docstring
def some_func():
pass
def decorate(func):
"""Decorate *fn* to return ``self`` to enable chained method calls."""
def wrapper(self, *args, **kw):
func(self, *args, **kw)
return 42
return wrapper
class Class:
def some_method(self):
pas... |
app/demo/countries/migrations/0018_person_time.py | sesostris/django-material-admin | 270 | 11181074 | # Generated by Django 3.0 on 2020-01-03 08:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('countries', '0017_country1_country2_country3_country4_country5_country6'),
]
operations = [
migrations.AddField(
model_name='perso... |
tools/mo/openvino/tools/mo/front/mxnet/crop_ext.py | ryanloney/openvino-1 | 1,127 | 11181087 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from openvino.tools.mo.ops.crop import Crop
class CropFrontExtractor(FrontExtractorOp):
... |
recommends/storages/mongodb/managers.py | coagulant/django-recommends | 142 | 11181109 | <reponame>coagulant/django-recommends
from recommends.managers import DictStorageManager
class MongoStorageManager(DictStorageManager):
def filter_for_object(self, obj):
ctype_id = self.get_ctype_id_for_obj(obj)
return {'object_ctype': ctype_id, 'object_id': obj.id}
def filter_for_related_obj... |
data_management/importers/idaho-camera-traps.py | dnarqq/WildHack | 402 | 11181141 | #
# idaho-camera-traps.py
#
# Prepare the Idaho Camera Traps dataset for release on LILA.
#
#%% Imports and constants
import json
import os
import numpy as np
import dateutil
import pandas as pd
import datetime
import shutil
from tqdm import tqdm
from bson import json_util
from collections import defaultdict
# Mu... |
exercises/list-ops/example.py | kishankj/python | 1,177 | 11181142 | <gh_stars>1000+
def append(list1, list2):
return concat([list1, list2])
def concat(lists):
return [element for list in lists for element in list]
def filter(function, list):
return [item for item in list if function(item)]
def length(list):
return sum(1 for _ in list)
def map(function, list):
... |
tests/test_http.py | avivazran/UnrealEnginePython | 2,350 | 11181210 | import unittest
import unreal_engine as ue
from unreal_engine import IHttpRequest
import json
class TestHttp(unittest.TestCase):
def test_user_agent(self):
request = IHttpRequest('GET', 'http://httpbin.org/user-agent')
request.set_header('User-Agent', 'UnrealEnginePython_test')
request.pro... |
test/layers/test_common.py | wconnell/torchdrug | 772 | 11181211 | import unittest
import torch
from torch import nn
from torchdrug import layers
class CommonTest(unittest.TestCase):
def setUp(self):
self.a = torch.randn(10)
self.b = torch.randn(10)
self.g = torch.randn(10)
def test_sequential(self):
layer1 = nn.Module()
layer2 = n... |
entity/cards/LETL_037H/LETL_282.py | x014/lushi_script | 102 | 11181217 | # -*- coding: utf-8 -*-
from hearthstone.entities import Entity
from entity.spell_entity import SpellEntity
class LETL_282(SpellEntity):
"""
顶级捕食者5
<b>攻击</b>生命值最低的敌人。<b>击杀:</b>重复此效果。
"""
def __init__(self, entity: Entity):
super().__init__(entity)
self.damage = 0
... |
ckan/migration/versions/051_a4fb0d85ced6_add_tag_vocabulary.py | ziveo/ckan | 2,805 | 11181223 | <gh_stars>1000+
# encoding: utf-8
"""051 Add tag vocabulary
Revision ID: a4fb0d85ced6
Revises: <KEY>
Create Date: 2018-09-04 18:49:06.480087
"""
from alembic import op
import sqlalchemy as sa
from ckan.migration import skip_based_on_legacy_engine_version
# revision identifiers, used by Alembic.
revision = 'a4fb0d85ce... |
glue/formats/scss.py | glensc/glue | 514 | 11181248 | import os
from css import CssFormat
class ScssFormat(CssFormat):
extension = 'scss'
@classmethod
def populate_argument_parser(cls, parser):
group = parser.add_argument_group("SCSS format options")
group.add_argument("--scss",
dest="scss_dir",
... |
app/core/admin/forms.py | tutengfei/flaskblog | 204 | 11181272 | from wtforms import form
from wtforms import StringField, PasswordField, BooleanField
from wtforms.validators import DataRequired
from wtforms import validators
from werkzeug.security import generate_password_hash, check_password_hash
import hashlib
from app.core.models import db, User
class LoginForm(form.Form):
... |
explorer/urls.py | Patil2099/django-sql-explorer | 1,729 | 11181275 | from django.urls import path, re_path
from explorer.views import (
QueryView,
CreateQueryView,
PlayQueryView,
DeleteQueryView,
ListQueryView,
ListQueryLogView,
DownloadFromSqlView,
DownloadQueryView,
StreamQueryView,
EmailCsvQueryView,
SchemaView,
format_sql,
)
urlpatte... |
examples/pytorch/GNN-FiLM/main.py | ketyi/dgl | 9,516 | 11181289 | <reponame>ketyi/dgl
import torch
import torch.nn as nn
import torch.nn.functional as F
import dgl
import dgl.function as fn
from utils import evaluate_f1_score
from data_loader import load_PPI
import argparse
import numpy as np
import os
class GNNFiLMLayer(nn.Module):
def __init__(self, in_size, out_size, etypes, ... |
model/components/DenseNet.py | lianxiaolei/LaTeX_OCR | 290 | 11181311 | <reponame>lianxiaolei/LaTeX_OCR
from torchvision.models import densenet169 # import *=all the models from torchvision
DenseNet169 = densenet169
|
Dragon/python/dragon/vm/tensorflow/layers/convolutional.py | neopenx/Dragon | 212 | 11181326 | <filename>Dragon/python/dragon/vm/tensorflow/layers/convolutional.py
# --------------------------------------------------------
# TensorFlow @ Dragon
# Copyright(c) 2017 SeetaTech
# Written by <NAME>
# --------------------------------------------------------
from dragon.vm.tensorflow.framework import tensor_shape
from... |
FinMind/crawler/government_bonds.py | vishalbelsare/FinMind | 1,106 | 11181333 | <reponame>vishalbelsare/FinMind
"""
政府債券
G8-俄羅斯、美國、加拿大、英國、法國、德國、義大利及日本
"""
import datetime
import os
import re
import sys
import pandas as pd
import requests
from lxml import etree
from FinMind.crawler.base import BaseCrawler, USER_AGENT
PATH = "/".join(os.path.abspath(__file__).split("/")[:-2])
sys.path.append(PATH... |
insights/tests/core/test_marshalling.py | mglantz/insights-core | 121 | 11181372 | import pytest
from insights.core import marshalling
def mar_unmar(o, use_value_list=False):
marshalled = marshalling.marshal(o, use_value_list)
unmarshalled = marshalling.unmarshal(marshalled)
return marshalled, unmarshalled
def test_string_marshal():
flag = "TEST_FLAG"
_, unmarshalled = mar_unm... |
niftynet/io/__init__.py | tdml13/NiftyNet | 1,403 | 11181409 | """
.. module:: niftynet.io
:synopsis: High-level input / output operations.
"""
|
uuv_control/uuv_control_cascaded_pids/scripts/VelocityControl.py | hust-arms/uuv_simulator-armsauv | 470 | 11181411 | <reponame>hust-arms/uuv_simulator-armsauv<gh_stars>100-1000
#!/usr/bin/env python
# Copyright (c) 2016 The UUV Simulator 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 L... |
atest/testdata/cli/dryrun/vars.py | phil-davis/robotframework | 7,073 | 11181423 | RESOURCE_PATH_FROM_VARS = 'resource.robot'
|
mediasoup-client/deps/webrtc/src/build/config/fuchsia/build_symbol_archive.py | skgwazap/mediasoup-client-android | 128 | 11181514 | #!/usr/bin/env python
#
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates a compressed archive of binary symbols derived from the unstripped
executables and libraries cataloged by "ids.txt"."""
i... |
tests/test_packages/test_skills/test_simple_oracle_client/test_behaviours.py | bryanchriswhite/agents-aea | 126 | 11181525 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI 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 ... |
transformer/__init__.py | richarai9/FastSpeech2 | 753 | 11181559 | from .Models import Encoder, Decoder
from .Layers import PostNet |
data/transforms/arguement.py | donnyyou/centerX | 350 | 11181575 | import cv2
import numpy as np
import random
import torch
import imgaug as ia
import imgaug.augmenters as iaa
import copy
# points = [
# [(10.5, 20.5)], # points on first image
# [(50.5, 50.5), (60.5, 60.5), (70.5, 70.5)] # points on second image
# ]
# image = cv2.imread('000000472375.jpg')
# inp_bbox = [np.arr... |
src/anyconfig/processors/utils.py | ssato/python-anyconfig | 213 | 11181591 | <reponame>ssato/python-anyconfig
#
# Copyright (C) 2018 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
# pylint: disable=unidiomatic-typecheck
r"""Utility functions for anyconfig.processors.
"""
import operator
import typing
import warnings
import pkg_resources
from .. import common, ioinfo, models, utils
f... |
deepneuro/outputs/visualization.py | ysuter/DeepNeuro | 113 | 11181608 | import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
from deepneuro.utilities.conversion import read_image_files
def create_mosaic(input_volume, output_filepath=None, label_volume=None, generate_outline=True, mask_value=0, step=1, dim=2, cols=8, label_buffer=5, rotate_90=3, flip=True):
"... |
homeassistant/components/progettihwsw/const.py | tbarbette/core | 30,023 | 11181660 | """Define constant variables for general usage."""
DOMAIN = "progettihwsw"
DEFAULT_POLLING_INTERVAL_SEC = 5
|
benchmarks/import_cost/classes_100_with_5_invariants.py | kklein/icontract | 244 | 11181783 | <filename>benchmarks/import_cost/classes_100_with_5_invariants.py
#!/usr/bin/env python3
import icontract
@icontract.invariant(lambda self: self.x > 0)
@icontract.invariant(lambda self: self.x > 1)
@icontract.invariant(lambda self: self.x > 2)
@icontract.invariant(lambda self: self.x > 3)
@icontract.invariant(lambda ... |
aries_cloudagent/messaging/base_message.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 11181892 | <gh_stars>100-1000
"""Base message."""
from abc import ABC, abstractclassmethod, abstractmethod, abstractproperty
from enum import Enum, auto
from typing import Optional, Type, TYPE_CHECKING
if TYPE_CHECKING:
from .base_handler import BaseHandler
class DIDCommVersion(Enum):
"""Serialized message formats."""... |
insights/tests/test_integration_support.py | lhuett/insights-core | 121 | 11181938 | from insights.plugins.ps_rule_fakes import psaux_no_filter, psauxww_ds_filter, psalxwww_parser_filter
from insights.specs import Specs
from . import InputData, run_test
import pytest
def test_run_test_missing_filters_exception():
"""
The rule underlying datasource requires a filter,
an exception should b... |
tests/test_dataset.py | Harald-R/aw_nas | 195 | 11181996 | <gh_stars>100-1000
import os
import pytest
# we use environments variable to mark slow instead of register new pytest marks here.
AWNAS_TEST_SLOW = os.environ.get("AWNAS_TEST_SLOW", None)
@pytest.mark.skipif(not AWNAS_TEST_SLOW, reason="parse corpus might be slow, by default not test")
def test_ptb_batchify():
fr... |
Examples/AppKit/CocoaBindings/CurrencyConvBinding/CurrencyConvBindingDocument.py | Khan/pyobjc-framework-Cocoa | 132 | 11182024 | from Cocoa import *
class CurrencyConvBindingDocument (NSDocument):
def windowNibName(self):
return "CurrencyConvBindingDocument"
|
lbry/build_info.py | nishp77/lbry-sdk | 4,996 | 11182044 | # don't touch this. CI server changes this during build/deployment
BUILD = "dev"
COMMIT_HASH = "none"
DOCKER_TAG = "none"
|
api/features/workflows/core/exceptions.py | SolidStateGroup/Bullet-Train-API | 126 | 11182064 | <filename>api/features/workflows/core/exceptions.py<gh_stars>100-1000
from rest_framework import status
from rest_framework.exceptions import APIException
class FeatureWorkflowError(APIException):
status_code = status.HTTP_500_INTERNAL_SERVER_ERROR
class ChangeRequestNotApprovedError(FeatureWorkflowError):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.