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 |
|---|---|---|---|---|
doomrnn/model.py | yumaloop/predwm | 494 | 67920 | <gh_stars>100-1000
import numpy as np
import random
#from scipy.fftpack import dct
import json
import sys
import config
from env import make_env
import time
final_mode = True
render_mode = True
RENDER_DELAY = False
def make_model(game):
# can be extended in the future.
model = Model(game)
return model
def sigm... |
tests/pytests/unit/state/test_sub_state_returns.py | tomdoherty/salt | 9,425 | 67922 | <gh_stars>1000+
"""
:codeauthor: <NAME> <<EMAIL>>
"""
import logging
import pytest # pylint: disable=unused-import
from salt.utils.decorators import state as statedecorators
log = logging.getLogger(__name__)
def test_sub_state_output_check_changes_is_dict():
"""
Test that changes key contains a dictio... |
PyFlow/Packages/PyFlowBase/Nodes/rerouteExecs.py | luzpaz/PyFlow | 1,463 | 67969 | <filename>PyFlow/Packages/PyFlowBase/Nodes/rerouteExecs.py<gh_stars>1000+
## Copyright 2015-2019 <NAME>, <NAME>
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
## http://www.apache.org... |
venv/Lib/site-packages/pythonwin/pywin/scintilla/find.py | ajayiagbebaku/NFL-Model | 150 | 67983 | <filename>venv/Lib/site-packages/pythonwin/pywin/scintilla/find.py
# find.py - Find and Replace
import win32con, win32api
import win32ui
from pywin.mfc import dialog
import afxres
from pywin.framework import scriptutils
FOUND_NOTHING = 0
FOUND_NORMAL = 1
FOUND_LOOPED_BACK = 2
FOUND_NEXT_FILE = 3
class SearchParams:
... |
aiida/cmdline/utils/query/calculation.py | aiidateam/aiida_core | 153 | 67985 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
twistedcaldav/config.py | backwardn/ccs-calendarserver | 462 | 67991 | <filename>twistedcaldav/config.py<gh_stars>100-1000
##
# Copyright (c) 2005-2017 Apple 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/lice... |
extraPackages/matplotlib-3.0.3/examples/userdemo/connect_simple01.py | dolboBobo/python3_ios | 130 | 68010 | <reponame>dolboBobo/python3_ios
"""
================
Connect Simple01
================
"""
from matplotlib.patches import ConnectionPatch
import matplotlib.pyplot as plt
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(6, 3))
xyA = (0.2, 0.2)
xyB = (0.8, 0.8)
coordsA = "data"
coordsB = "data"
con = ConnectionPatch(xyA,... |
alipay/aop/api/domain/RecomProduct.py | antopen/alipay-sdk-python-all | 213 | 68019 | <filename>alipay/aop/api/domain/RecomProduct.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.RecomPlan import RecomPlan
from alipay.aop.api.domain.ProdResource import ProdResource
from alipay.aop.api.domain.ProdResource import... |
torch2trt_dynamic/converters/mean.py | jinfagang/torch2trt_dynamic | 155 | 68024 | <reponame>jinfagang/torch2trt_dynamic
import tensorrt as trt
import torch
from torch2trt_dynamic.module_test import add_module_test
from torch2trt_dynamic.torch2trt_dynamic import (get_arg, tensorrt_converter,
trt_)
@tensorrt_converter('torch.mean')
@tensorrt_converter... |
api/webhooks/tests/test_webhooks.py | SolidStateGroup/Bullet-Train-API | 126 | 68034 | <filename>api/webhooks/tests/test_webhooks.py
import hashlib
import hmac
import json
from unittest import TestCase, mock
import pytest
from core.constants import FLAGSMITH_SIGNATURE_HEADER
from environments.models import Environment, Webhook
from organisations.models import Organisation, OrganisationWebhook
from proj... |
setup.py | rajeshkppt/scispacy | 1,139 | 68037 | from setuptools import setup, find_packages
"""
Instructions for creating a release of the scispacy library.
1. Make sure your working directory is clean.
2. Make sure that you have changed the versions in "scispacy/version.py".
3. Create the distribution by running "python setup.py sdist" in the root of the reposit... |
outputformat/plot.py | JuPeg/outputformat | 146 | 68038 | <reponame>JuPeg/outputformat<gh_stars>100-1000
from outputformat import emoji
def bar(
value,
maxvalue,
style="block",
length=32,
title=False,
title_pad=0,
show_values=True,
values_pad=0,
values_precision=2,
show_percentage=True,
return_str=False,
):
"""Generate a singl... |
utils/env_vars.py | yu-iskw/elementary | 282 | 68065 | <filename>utils/env_vars.py
import os
def is_flight_mode_on() -> bool:
return is_env_var_on('FLIGHTMODE')
def is_debug_mode_on() -> bool:
return is_env_var_on('DEBUG')
def is_env_var_on(env_var) -> bool:
if os.getenv(env_var) == '1':
print(env_var, ' is on!')
return True
return Fa... |
tests/st/ops/ascend/test_tbe_ops/test_tanh_grad.py | GuoSuiming/mindspore | 3,200 | 68072 | # Copyright 2020 Huawei Technologies Co., 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 agreed to... |
cloudiscovery/provider/aws/limit/resource/all.py | MalarvizhiK/cloudiscovery | 429 | 68073 | from concurrent.futures.thread import ThreadPoolExecutor
from typing import List
from provider.aws.common_aws import get_paginator
from provider.aws.limit.command import LimitOptions
from provider.aws.limit.data.allowed_resources import (
ALLOWED_SERVICES_CODES,
FILTER_EC2_BIGFAMILY,
SPECIAL_RESOURCES,
)
f... |
nemo/collections/asr/parts/utils/nmesc_clustering.py | mlgill/NeMo | 4,145 | 68074 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
circus/stats/__init__.py | BradleyKirton/circus | 820 | 68078 | <gh_stars>100-1000
"""
Stats architecture:
* streamer.StatsStreamer listens to circusd events and maintain a list of pids
* collector.StatsCollector runs a pool of threads that compute stats for each
pid in the list. Each stat is pushed in a queue
* publisher.StatsPublisher continuously pushes those stats in a ... |
pymetamap/SubprocessBackendLite.py | liquet-ai/pymetamap | 151 | 68082 | <filename>pymetamap/SubprocessBackendLite.py
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
stonesoup/functions/orbital.py | Red-Portal/Stone-Soup-1 | 157 | 68084 | # -*- coding: utf-8 -*-
"""
Orbital functions
-----------------
Functions used within multiple orbital classes in Stone Soup
"""
import numpy as np
from . import dotproduct
from ..types.array import StateVector
def stumpff_s(z):
r"""The Stumpff S function
.. math::
S(z) = \begin{cases}\frac{\sqrt... |
phobos/utils/editing.py | kartben/phobos | 323 | 68121 | <filename>phobos/utils/editing.py
#!/usr/bin/python3
# coding=utf-8
# -------------------------------------------------------------------------------
# This file is part of Phobos, a Blender Add-On to edit robot models.
# Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center
#
# You should hav... |
os/example_dirs.py | Carglglz/micropython-lib | 1,556 | 68148 | import os
print(os.getcwd())
l = os.listdir()
print(l)
assert "test_dirs.py" in l
assert "os" in l
for t in os.walk("."):
print(t)
for t in os.walk(".", False):
print(t)
|
ip_rep/database_connector/views.py | logicbomb-1/ARTIF | 205 | 68162 | <reponame>logicbomb-1/ARTIF<filename>ip_rep/database_connector/views.py<gh_stars>100-1000
from django.shortcuts import render
from pymongo import MongoClient
# Create your views here.
|
WebMirror/management/rss_parser_funcs/feed_parse_extractNovelsJapan.py | fake-name/ReadableWebProxy | 193 | 68173 | def extractNovelsJapan(item):
"""
'Novels Japan'
"""
if item['title'].endswith(' (Sponsored)'):
item['title'] = item['title'][:-1 * len(' (Sponsored)')]
if item['title'].endswith(' and Announcement'):
item['title'] = item['title'][:-1 * len(' and Announcement')]
vol, chp, frag, postfix = extractVolChapterFrag... |
model_analyzer/config/run/run_search.py | MarkMoTrin/model_analyzer | 115 | 68183 | # Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. 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 requir... |
tests/transactions/tests.py | huicheese/Django-test | 118 | 68206 | from __future__ import absolute_import
import sys
try:
import threading
except ImportError:
threading = None
import time
from django.db import (connection, transaction,
DatabaseError, Error, IntegrityError, OperationalError)
from django.test import TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature... |
deep_models/paper_10_mul_lstm/utils.py | bicepjai/Deep-Survey-on-Text-Classification | 197 | 68220 |
# refer https://github.com/titu1994/Keras-Multiplicative-LSTM
from __future__ import absolute_import
import numpy as np
__all__ = ['MultiplicativeLSTM']
from keras import backend as K
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras... |
sparkmagic/sparkmagic/kernels/__init__.py | sciserver/sparkmagic | 1,141 | 68223 | from sparkmagic.kernels.kernelmagics import *
|
test/test_gpuarray.py | hyperfraise/pycuda | 1,264 | 68227 | <filename>test/test_gpuarray.py
#! /usr/bin/env python
import numpy as np
import numpy.linalg as la
import sys
from pycuda.tools import mark_cuda_test
from pycuda.characterize import has_double_support
import pycuda.gpuarray as gpuarray
import pycuda.driver as drv
from pycuda.compiler import SourceModule
class Tes... |
src/organisations/migrations/0022_organisation_persist_trait_data.py | augustuswm/flagsmith-api | 1,259 | 68244 | # Generated by Django 2.2.15 on 2020-09-09 15:51
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organisations', '0021_auto_20200619_1555'),
]
operations = [
migrations.AddField(
model_name='o... |
permissionslocker/permissionslocker.py | Onii-Chan-Discord/phen-cogs | 105 | 68255 | <reponame>Onii-Chan-Discord/phen-cogs
"""
MIT License
Copyright (c) 2020-2021 phenom4n4n
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 righ... |
orttraining/orttraining/eager/opgen/opgen/ast.py | lchang20/onnxruntime | 6,036 | 68267 | <reponame>lchang20/onnxruntime
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import io
from typing import TextIO, List, Union
from opgen.lexer import Token
class Node(object):
def __init__(self):
self.tokens = []
def write(self, writer: TextIO):
raise NotIm... |
Lib/lib2to3/fixes/fix_input.py | leepro/unladen-swallow | 2,293 | 68294 | """Fixer that changes input(...) into eval(input(...))."""
# Author: <NAME>
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name
from .. import patcomp
context = patcomp.compile_pattern("power< 'eval' trailer< '(' any ')' > >")
class FixInput(fixer_base.BaseFix):
PATTERN = """
... |
scripts/update_taxonomies.py | gaybro8777/osf.io | 628 | 68321 | import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from website.app import init_app
from website import settings
logger = logging.getLogger(__name__)... |
pywick/datasets/PredictFolderDataset.py | achaiah/pywick | 408 | 68324 | <filename>pywick/datasets/PredictFolderDataset.py
from .FolderDataset import FolderDataset, identity_x
class PredictFolderDataset(FolderDataset):
"""
Convenience class for loading out-of-memory data that is more geared toward prediction data loading (where ground truth is not available). \n
If not transfor... |
reaver/__init__.py | HatsuneMiku4/reaver | 239 | 68350 | <reponame>HatsuneMiku4/reaver
import reaver.envs
import reaver.models
import reaver.agents
import reaver.utils
|
conans/test/integration/command/install/install_cascade_test.py | Wonders11/conan | 6,205 | 68359 | import unittest
from collections import OrderedDict
from conans.model.ref import ConanFileReference
from conans.test.utils.tools import TestServer, TurboTestClient, GenConanfile
class InstallCascadeTest(unittest.TestCase):
def setUp(self):
"""
A
/ \
B C
| \
D ... |
librclone/python/rclone.py | elbaby/rclone | 18,121 | 68378 | """
Python interface to librclone.so using ctypes
Create an rclone object
rclone = Rclone(shared_object="/path/to/librclone.so")
Then call rpc calls on it
rclone.rpc("rc/noop", a=42, b="string", c=[1234])
When finished, close it
rclone.close()
"""
__all__ = ('Rclone', 'RcloneException')
import os
im... |
aiida/orm/nodes/data/remote/stash/__init__.py | azadoks/aiida-core | 180 | 68379 | # -*- coding: utf-8 -*-
"""Module with data plugins that represent files of completed calculations jobs that have been stashed."""
# AUTO-GENERATED
# yapf: disable
# pylint: disable=wildcard-import
from .base import *
from .folder import *
__all__ = (
'RemoteStashData',
'RemoteStashFolderData',
)
# yapf: e... |
controle_estoque/mainfinanceiro.py | jucimar1/controleEstoque | 134 | 68422 | # -*- coding: utf-8 -*-
from Views.mainFinanceiro import Ui_ct_MainFinanceiro
from movconta import MainMovimentoConta
from areceber import MainAReceber
from apagar import MainAPagar
from Funcoes.data import DataAtual
class MainFinanceiro(Ui_ct_MainFinanceiro, DataAtual, MainMovimentoConta,
MainAR... |
apps/staffs/migrations/0002_auto_20201124_0614.py | shravakushwaha/school_system | 235 | 68465 | # Generated by Django 3.0.8 on 2020-11-24 12:14
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("staffs", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="staff",
... |
regtests/lang/try_except.py | ahakingdom/Rusthon | 622 | 68475 | <reponame>ahakingdom/Rusthon
from runtime import *
'''
try except
'''
def main():
a = [1,2,3]
b = False
try:
a.no_such_method()
b = 'this should not happen'
except:
b = True
assert( b == True )
main()
|
lib/galaxy/model/migrate/versions/0031_community_and_workflow_tags.py | rikeshi/galaxy | 1,085 | 68479 | <filename>lib/galaxy/model/migrate/versions/0031_community_and_workflow_tags.py
"""
Migration script to (a) add and populate necessary columns for doing community tagging of histories, datasets, and pages and \
(b) add table for doing individual and community tagging of workflows.
"""
import logging
from sqlalchemy i... |
unittests/tools/test_acunetix_parser.py | mtcolman/django-DefectDojo | 249 | 68495 | import datetime
from ..dojo_test_case import DojoTestCase
from dojo.models import Test
from dojo.tools.acunetix.parser import AcunetixParser
class TestAcunetixParser(DojoTestCase):
def test_parse_file_with_one_finding(self):
testfile = open("unittests/scans/acunetix/one_finding.xml")
parser = Ac... |
tests/python/relay/test_relay_te_compiler.py | shengxinhu/tvm | 4,640 | 68540 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
onmt/IO.py | Flamexmt/LMA | 321 | 68550 | # -*- coding: utf-8 -*-
import codecs
from collections import Counter, defaultdict
from itertools import chain, count
import torch
import torchtext.data
import torchtext.vocab
PAD_WORD = '<blank>'
UNK = 0
BOS_WORD = '<s>'
EOS_WORD = '</s>'
def __getstate__(self):
return dict(self.__dict__, stoi=dict(self.stoi)... |
library/connecter/database/mongo.py | GNHJM/lykops | 141 | 68554 | <gh_stars>100-1000
'''
参考文献https://pypi.python.org/pypi/pymongo/3.4.0
mongodb官方推荐
'''
import time, logging, pymongo
from bson.objectid import ObjectId
from library.config.database import mongo_config
from library.utils.dict import dot2_, _2dot
class Op_Mongo():
'''
连接并操作mongo
'''
def __ini... |
examples/esgf_integration_example.py | prashantarya12/climate | 132 | 68588 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
xmodaler/engine/build.py | cclauss/xmodaler | 830 | 68589 | # Copyright 2021 JD.com, Inc., JD AI
"""
@author: <NAME>
@contact: <EMAIL>
"""
from xmodaler.utils.registry import Registry
ENGINE_REGISTRY = Registry("ENGINE")
ENGINE_REGISTRY.__doc__ = """
Registry for engine
"""
def build_engine(cfg):
engine = ENGINE_REGISTRY.get(cfg.ENGINE.NAME)(cfg)
return engine |
speechbrain/nnet/loss/si_snr_loss.py | mj-kh/speechbrain | 3,913 | 68606 | """
# Authors:
* <NAME> 2021
* <NAME> 2020
* <NAME> 2020
* <NAME> 2020
* <NAME> 2020
* <NAME> 2020
"""
import torch
import numpy as np
smallVal = np.finfo("float").eps # To avoid divide by zero
def si_snr_loss(y_pred_batch, y_true_batch, lens, reduction="mean"):
"""Compute the si_snr sco... |
nodes/2.x/python/Group.IsMirrored.py | andydandy74/ClockworkForDynamo | 147 | 68608 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
refgroup = UnwrapElement(IN[0])
groups = UnwrapElement(IN[1])
# Get Mirrored state of first family instance in reference group instance
refGroupMembers = refgroup.G... |
envpool/python/api.py | TachikakaMin/envpool | 330 | 68618 | <reponame>TachikakaMin/envpool
# Copyright 2021 Garena Online Private Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
fastai_do_not_use/callbacks/rnn.py | anhquan0412/fastai_v1 | 115 | 68623 | "Regroups lr adjustment to seq_len, AR and TAR"
from ..torch_core import *
from ..callback import *
from ..basic_train import Learner
__all__ = ['RNNTrainer']
@dataclass
class RNNTrainer(Callback):
"`Callback` that regroups lr adjustment to seq_len, AR and TAR"
learn:Learner
bptt:int
alpha:float=0.
... |
bookwyrm/migrations/0093_alter_sitesettings_instance_short_description.py | mouse-reeve/fedireads | 270 | 68635 | # Generated by Django 3.2.4 on 2021-09-10 19:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0092_sitesettings_instance_short_description"),
]
operations = [
migrations.AlterField(
model_name="sitesettings",
... |
visualdl/utils/update_util.py | rainyfly/VisualDL | 4,861 | 68637 | # Copyright (c) 2020 VisualDL Authors. All Rights Reserve.
#
# 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... |
tests/issues/gh195.py | aureooms-contrib/ics-py | 312 | 68643 | import pytest
from ics import Calendar, ContentLine
def test_gh195_override_prodid():
lines = [
"BEGIN:VCALENDAR",
"VERSION:2.0",
"X-WR-CALNAME:<NAME>",
"X-APPLE-CALENDAR-COLOR:#996633",
"END:VCALENDAR"
]
with pytest.raises(ValueError, match="attribute PRODID is re... |
tests/core/actions/test_loops.py | fintzd/rasa | 9,701 | 68649 | <reponame>fintzd/rasa
from typing import List, Any, Text
import pytest
from rasa.core.actions.loops import LoopAction
from rasa.core.channels import CollectingOutputChannel
from rasa.shared.core.domain import Domain
from rasa.shared.core.events import (
Event,
ActionExecutionRejected,
ActionExecuted,
A... |
plugins/modules/oci_database_autonomous_container_database_dataguard_association_actions.py | slmjy/oci-ansible-collection | 108 | 68659 | <reponame>slmjy/oci-ansible-collection
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apac... |
proj/mnv2_first/gateware/output.py | keadwen/CFU-Playground | 240 | 68726 | #!/bin/env python
# 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 law or agre... |
executor/cook/progress.py | CGe0516/Cook | 345 | 68731 | import logging
import os
import re
import time
from threading import Event, Lock, Thread
import cook.util as cu
class ProgressSequenceCounter:
"""Utility class that supports atomically incrementing the sequence value."""
def __init__(self, initial=0):
self.lock = Lock()
self.value = initial
... |
allure-python-commons-test/src/report.py | ammarnajjar/allure-python | 558 | 68751 | <reponame>ammarnajjar/allure-python
"""
>>> from hamcrest import assert_that
>>> class Report(object):
... def __init__(self):
... self.test_cases = [
... {
... 'fullName': 'package.module.test',
... 'id': '1'
... },
... {
... ... |
telegram_messages_dump/exporters/jsonl.py | emanuelegit/telegram-messages-dump | 109 | 68762 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
import json
from datetime import date, datetime
from .common import common
class jsonl(object):
""" jsonl exporter plugin.
As opposed to json exporter jsonl serializes messages as one JSON object per line, not as
one giant ... |
utils/superpixel_projections.py | niqbal996/ViewAL | 126 | 68772 | <gh_stars>100-1000
import numpy as np
import os
import constants
from numpy.linalg import inv
from dataloader import indoor_scenes
import torch
from collections import OrderedDict, Counter
from tqdm import tqdm
def project_image_to_world(x, y, depth, cam2world, depth_intrinsic):
I = torch.zeros(4, depth.shape[0]).... |
corehq/blobs/migrations/0009_delete_blobexpiration.py | dimagilg/commcare-hq | 471 | 68783 | # Generated by Django 1.11.21 on 2019-06-12 15:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blobs', '0008_deletedblobmeta'),
]
operations = [
migrations.DeleteModel(
name='BlobExpiration',
),
]
|
chainer/functions/normalization/local_response_normalization.py | zaltoprofen/chainer | 3,705 | 68800 | import numpy
import six
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import function_node
from chainer.utils import type_check
def _cu_conv_sum(y, x, n):
# Convolutional sum
# TODO(beam2d): Use scan computation
rdim = x.size // (x.shape[0] * x.shape[1])
cuda.ele... |
{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings/dev.py | lendlsmith/wagtail-cookiecutter-foundation | 182 | 68820 | <gh_stars>100-1000
# flake8: noqa
from .base import *
from os.path import abspath, dirname, join
DEBUG = env.bool('DJANGO_DEBUG', default=True)
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG
INSTALLED_APPS += (
'debug_toolbar',
'django_extensions',
)
INTERNAL_IPS = ('127.0.0.1',)
# See: https://github.com/django... |
third_party/mapreduce/mapreduce/base_handler.py | tingshao/catapult | 2,151 | 68828 | #!/usr/bin/env python
# Copyright 2010 Google 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 ... |
src/bepasty/tests/test_storage.py | Emojigit/bepasty-server | 123 | 68842 | import pytest
from bepasty.storage.filesystem import Storage
def test_contains(tmpdir):
storage = Storage(str(tmpdir))
name = "foo"
# check if it is not there yet
assert name not in storage
with storage.create(name, 0):
# we just want it created, no need to write sth into it
pass
... |
base/site-packages/authsub/urls.py | edisonlz/fastor | 285 | 68844 | from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^login/$', 'authsub.views.login', name="authsub_login"),
) |
vumi/transports/imimobile/imimobile_ussd.py | seidu626/vumi | 199 | 68852 | # -*- test-case-name: vumi.transports.imimobile.tests.test_imimobile_ussd -*-
import re
import json
from datetime import datetime, timedelta
from twisted.python import log
from twisted.web import http
from twisted.internet.defer import inlineCallbacks
from vumi.components.session import SessionManager
from vumi.mes... |
tests/property/test_discrete_log.py | thommignot/electionguard-python | 112 | 68867 | <gh_stars>100-1000
import asyncio
from hypothesis import given
from hypothesis.strategies import integers
from tests.base_test_case import BaseTestCase
from electionguard.constants import get_generator, get_large_prime
from electionguard.discrete_log import (
compute_discrete_log,
discrete_log_async,
Disc... |
up/utils/general/registry_factory.py | ModelTC/EOD | 196 | 68871 | <gh_stars>100-1000
from .registry import Registry
# model
MODULE_ZOO_REGISTRY = Registry()
MODULE_PROCESS_REGISTRY = Registry()
MODULE_WRAPPER_REGISTRY = Registry()
MODEL_WRAPPER_REGISTRY = Registry()
EMA_REGISTRY = Registry()
# data
DATASET_REGISTRY = Registry()
DATALOADER_REGISTRY = Registry()
BATCH_SAMPLER_REGISTR... |
code/certify.py | RuntianZ/smoothing-adversarial | 213 | 68877 | # evaluate a smoothed classifier on a dataset
import argparse
import datetime
import os
from time import time
from architectures import get_architecture
from core import Smooth
from datasets import get_dataset, DATASETS, get_num_classes
import torch
parser = argparse.ArgumentParser(description='Certify many examples... |
pyleus/__init__.py | dapuck/pyleus | 166 | 68885 | from __future__ import absolute_import
import pkg_resources
__version__ = '0.3.0'
BASE_JAR = "pyleus-base.jar"
BASE_JAR_PATH = pkg_resources.resource_filename('pyleus', BASE_JAR)
|
neural_structural_optimization/autograd_lib_test.py | yjxkwp/neural-structural-optimization | 103 | 68909 | <filename>neural_structural_optimization/autograd_lib_test.py
# lint as python3
# Copyright 2019 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/lic... |
third_party/boost.context/tools/build/src/tools/gcc.py | sunny-shu/libgo | 2,831 | 68919 | <reponame>sunny-shu/libgo
# Status: being ported by Steven Watanabe
# Base revision: 47077
# TODO: common.jam needs to be ported
# TODO: generators.jam needs to have register_c_compiler.
#
# Copyright 2001 <NAME>.
# Copyright 2002-2006 <NAME>.
# Copyright 2002-2003 <NAME>.
# Copyright (c) 2005 <NAME>.
# Copyright 2006... |
codebraid/converters/base.py | musm/codebraid | 270 | 68931 | <reponame>musm/codebraid
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018-2019, <NAME>
# All rights reserved.
#
# Licensed under the BSD 3-Clause License:
# http://opensource.org/licenses/BSD-3-Clause
#
import collections
from collections import OrderedDict as ODict
import hashlib
import io
import json
import os
import... |
test/distribution/test_label_smoothing.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 68943 | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
lib/lambda.d/tunasync-handler/index.py | bovi/opentuna | 136 | 68944 | <gh_stars>100-1000
import json
import urllib3
import os
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
http = urllib3.PoolManager()
tunasync_manager_url = os.environ['TUNASYNC_MANAGER_URL']
def handler(event, context):
logger.info(event)
requestUrl = tunasync_manager_url + '/cmd'
... |
macadam/tc/t04_charcnn.py | yongzhuo/Macadam | 290 | 68967 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2020/5/7 21:06
# @author : Mo
# @function: CharCNN [Character-level Convolutional Networks for Text Classification](https://arxiv.org/pdf/1509.01626.pdf)
from macadam.base.graph import graph
from macadam import K, L, M, O
class CharCNNGraph(graph):
def __... |
test/UnitTest/data.py | jason-fox/fogflow | 102 | 68992 | subscription_data=\
{
"description": "A subscription to get info about Room1",
"subject": {
"entities": [
{
"id": "Room1",
"type": "Room",
}
],
"condition": {
"attrs": [
"p3"
]
}
},
"notification": {
"http": {
"url": "http://192.168.100.162:88... |
tests/test_userfields_with_plain_serializer.py | simiotics/djangorestframework-queryfields | 195 | 69017 | from rest_framework.test import APIClient
from tests.app.serializers import QuoteSerializer
from tests.utils import decode_content
def test_list_response_unfiltered():
response = APIClient().get('/quotes/')
expected = [
{
'character': 'Customer',
'line': "It's certainly uncont... |
im2mesh/data/core.py | kitakou0313/differentiable_volumetric_rendering | 595 | 69018 | <reponame>kitakou0313/differentiable_volumetric_rendering<filename>im2mesh/data/core.py
import os
import logging
from torch.utils import data
import numpy as np
import yaml
logger = logging.getLogger(__name__)
# Fields
class Field(object):
''' Data fields class.
'''
def load(self, data_path, idx, catego... |
plugins/idaskins/objectinspector.py | fengjixuchui/IDASkins | 934 | 69019 | from __future__ import absolute_import, division, print_function
import os
from idaskins import UI_DIR
from PyQt5 import uic
from PyQt5.Qt import qApp
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QCursor, QFont, QKeySequence
from PyQt5.QtWidgets import QShortcut, QWidget
Ui_ObjectInspector, ObjectInspectorBas... |
tests/test_app.py | eliksir/Flask-RQ2 | 160 | 69048 | <reponame>eliksir/Flask-RQ2<filename>tests/test_app.py
# -*- coding: utf-8 -*-
from redis import StrictRedis
from rq.queue import Queue
from rq.utils import import_attribute
from rq.worker import Worker
from rq_scheduler import Scheduler
import pytest
from flask_rq2 import RQ
def exception_handler(*args, **kwargs):
... |
tests/test_decoders.py | sandbornm/SteganoGAN | 179 | 69049 | <filename>tests/test_decoders.py
# -*- coding: utf-8 -*-
import copy
from unittest import TestCase
from unittest.mock import Mock, call, patch
import torch
from steganogan import decoders
from tests.utils import assert_called_with_tensors
class TestBasicDecoder(TestCase):
class TestDecoder(decoders.BasicDecod... |
test_frame/test_xiaoxianrou/download_xiaoxianrou_pictures.py | DJMIN/funboost | 120 | 69070 | from funboost import boost
import re
import requests
from parsel import Selector
from pathlib import Path
"""
http://www.5442tu.com/mingxing/list_2_1.html 下载所有明星图片
"""
@boost('xiaoxianrou_list_page', qps=0.05)
def cralw_list_page(page_index):
url = f'http://www.5442tu.com/mingxing/list_2_{page_index}.html'
... |
blaze/expr/tests/test_slicing.py | quantopian-enterprise/blaze | 2,106 | 69117 | from blaze.expr import symbol
import numpy as np
from datashape import dshape, isscalar
def test_array_dshape():
x = symbol('x', '5 * 3 * float32')
assert x.shape == (5, 3)
assert x.schema == dshape('float32')
assert len(x) == 5
assert x.ndim == 2
def test_element():
x = symbol('x', '5 * 3 *... |
nova/conf/base.py | zjzh/nova | 1,874 | 69120 | <filename>nova/conf/base.py
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 <NAME>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in... |
vendor/github.com/google/certificate-transparency/python/ct/crypto/asn1/oid_test.py | weltonrodrigo/origin | 807 | 69124 | <filename>vendor/github.com/google/certificate-transparency/python/ct/crypto/asn1/oid_test.py
#!/usr/bin/env python
import unittest
from ct.crypto import error
from ct.crypto.asn1 import oid
from ct.crypto.asn1 import type_test_base
class ObjectIdentifierTest(type_test_base.TypeTestBase):
asn1_type = oid.Object... |
openpoiservice/server/categories/categories.py | larsrinn/openpoiservice | 131 | 69133 | <filename>openpoiservice/server/categories/categories.py
# openpoiservice/server/categories.py
import yaml
import os
import copy
class CategoryTools(object):
def __init__(self, categories_file):
self.basedir = os.path.abspath(os.path.dirname(__file__))
self.categories_object = yaml.safe_load(ope... |
pyfr/backends/opencl/types.py | rishit2307/PyFR | 185 | 69148 | <filename>pyfr/backends/opencl/types.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from functools import cached_property
import numpy as np
import pyfr.backends.base as base
class _OpenCLMatrixCommon:
@cached_property
def _as_parameter_(self):
return int(self.data)
class OpenCLMatrixBase(_OpenCLMa... |
screenshots/Part-4/ext/table.py | haha517/mywriter | 177 | 69150 | <filename>screenshots/Part-4/ext/table.py
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import Qt
class Table(QtGui.QDialog):
def __init__(self,parent = None):
QtGui.QDialog.__init__(self, parent)
self.parent = parent
self.initUI()
def initUI(self):
# Rows
... |
models/network_srmd.py | WestCityInstitute/KAIR | 1,521 | 69151 | <gh_stars>1000+
import torch.nn as nn
import models.basicblock as B
import torch
"""
# --------------------------------------------
# SRMD (15 conv layers)
# --------------------------------------------
Reference:
@inproceedings{zhang2018learning,
title={Learning a single convolutional super-resolution network for ... |
tests/pybaseball/test_plotting.py | akern40/pybaseball | 650 | 69186 | <filename>tests/pybaseball/test_plotting.py
import pytest
import pandas as pd
from pandas.testing import assert_frame_equal, assert_series_equal
from pybaseball.plotting import transform_coordinates
@pytest.fixture
def coords():
return pd.DataFrame({"x": [1.0, 2.0, -1.0], "y": [1.0, 0.0, 10.0]})
def test_transf... |
third_party/closure_linter/closure_linter/typeannotation_test.py | xzhan96/chromium.src | 123 | 69188 | <filename>third_party/closure_linter/closure_linter/typeannotation_test.py
#!/usr/bin/env python
"""Unit tests for the typeannotation module."""
import unittest as googletest
from closure_linter import testutil
from closure_linter.common import erroraccumulator
CRAZY_TYPE = ('Array.<!function(new:X,{a:null},...(c... |
sympy/mpmath/tests/test_linalg.py | shipci/sympy | 319 | 69189 | <reponame>shipci/sympy
# TODO: don't use round
from __future__ import division
from sympy.mpmath import *
xrange = libmp.backend.xrange
# XXX: these shouldn't be visible(?)
LU_decomp = mp.LU_decomp
L_solve = mp.L_solve
U_solve = mp.U_solve
householder = mp.householder
improve_solution = mp.improve_solution
A1 = mat... |
src/test/py/bazel/query_test.py | jobechoi/bazel | 16,989 | 69232 | # pylint: disable=g-bad-file-header
# Copyright 2018 The Bazel 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
... |
src/sultan/echo/colorlog/notests/test_colorlog.py | curtismuntz/sultan | 692 | 69250 | """Test the colorlog.colorlog module."""
import sys
import pytest
def test_colored_formatter(create_and_test_logger):
create_and_test_logger()
def test_custom_colors(create_and_test_logger):
"""Disable all colors and check no escape codes are output."""
create_and_test_logger(
log_colors={}, r... |
fsspec/compression.py | ernestoeperez88/filesystem_spec | 1,738 | 69257 | """Helper functions for a standard streaming compression API"""
from bz2 import BZ2File
from gzip import GzipFile
from zipfile import ZipFile
import fsspec.utils
from fsspec.spec import AbstractBufferedFile
def noop_file(file, mode, **kwargs):
return file
# should be functions of the form func(infile, mode=, *... |
tuplex/python/tuplex/utils/framework.py | rahulyesantharao/tuplex | 778 | 69265 | <gh_stars>100-1000
#!/usr/bin/env python3
#----------------------------------------------------------------------------------------------------------------------#
# #
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.