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
Z - Tool Box/LaZagne/Windows/lazagne/softwares/games/turba.py
dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1
1,290
11087686
# -*- coding: utf-8 -*- import os try: import _winreg as winreg except ImportError: import winreg import lazagne.config.winstructure as win from lazagne.config.module_info import ModuleInfo from lazagne.config.winstructure import string_to_unicode class Turba(ModuleInfo): def __init__(self): M...
scripts/controllers/controller.py
MPC-Berkeley/genesis_path_follower
101
11087689
import abc class Controller: """ Abstract Base Class for control implementation. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def solve(self): """ Returns a dictionary sol_dict with control input to apply, as well as other useful information (e.g. MPC solution). ...
ML/Projects/Exploring_MNIST/utils/utils.py
xuyannus/Machine-Learning-Collection
3,094
11087703
<reponame>xuyannus/Machine-Learning-Collection import torch import visdom import os device = "cuda" if torch.cuda.is_available() else "cpu" dtype = torch.float32 def save_checkpoint(filename, model, optimizer, train_acc, epoch): save_state = { "state_dict": model.state_dict(), "acc": train_acc, ...
src/olympia/addons/signals.py
shashwatsingh/addons-server
843
11087723
<filename>src/olympia/addons/signals.py import django.dispatch version_changed = django.dispatch.Signal()
scripts/mell/core/trainer.py
zhenhua32/EasyTransfer
806
11087728
<filename>scripts/mell/core/trainer.py # coding=utf-8 # Copyright (c) 2020 Alibaba PAI team. # # 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...
data_utils/utils.py
Pelhans/ZASR_tensorflow
115
11087732
<gh_stars>100-1000 # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division import os from collections import Counter import numpy as np import scipy.io.wavfile as wav from python_speech_features import mfcc from data_utils.audio_featurizer import AudioFeaturizer from data_utils....
src/prefect/tasks/asana/asana_task.py
concreted/prefect
8,633
11087741
<filename>src/prefect/tasks/asana/asana_task.py from prefect import Task from typing import Any from prefect.utilities.tasks import defaults_from_attrs try: import asana except ImportError: pass class OpenAsanaToDo(Task): """ Task for opening / creating new Asana tasks using the Asana REST API. ...
open_spiel/python/algorithms/discounted_cfr_test.py
texasmichelle/open_spiel
3,167
11087774
<filename>open_spiel/python/algorithms/discounted_cfr_test.py<gh_stars>1000+ # Copyright 2019 DeepMind Technologies Ltd. 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 #...
var/spack/repos/builtin/packages/py-planar/package.py
kkauder/spack
2,360
11087802
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyPlanar(PythonPackage): """2D planar geometry library for Python.""" homepage = "htt...
Contents/Libraries/Shared/subliminal/utils.py
jippo015/Sub-Zero.bundle
1,553
11087806
<gh_stars>1000+ # -*- coding: utf-8 -*- from datetime import datetime import hashlib import os import re import struct def hash_opensubtitles(video_path): """Compute a hash using OpenSubtitles' algorithm. :param str video_path: path of the video. :return: the hash. :rtype: str """ bytesize =...
omni_anomaly/model.py
hyydrra/OmniAnomaly
344
11087831
# -*- coding: utf-8 -*- from functools import partial import tensorflow as tf import tfsnippet as spt from tensorflow.python.ops.linalg.linear_operator_identity import LinearOperatorIdentity from tensorflow_probability.python.distributions import LinearGaussianStateSpaceModel, MultivariateNormalDiag from tfsnippet.dis...
textworld/thirdparty/glulx/Git-Glulx/user_agent.py
JohnnySun8/TextWorld
307
11087834
<filename>textworld/thirdparty/glulx/Git-Glulx/user_agent.py<gh_stars>100-1000 def evaluate(words): return ('n', False)
packaging/setup/plugins/ovirt-engine-setup/ovirt-engine-common/dialog/titles.py
hbraha/ovirt-engine
347
11087836
# # ovirt-engine-setup -- ovirt engine setup # # Copyright oVirt Authors # SPDX-License-Identifier: Apache-2.0 # # """Titles plugin.""" import gettext from otopi import plugin from otopi import util from ovirt_engine_setup import constants as osetupcons from ovirt_engine_setup import util as osetuputil from ovirt...
thumbor/handler_lists/upload.py
bear8421/thumbor
6,837
11087838
<filename>thumbor/handler_lists/upload.py #!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com <EMAIL> from typing import Any, cast from thumbor....
tests/test_stacks.py
coltonfischer/pydfs-lineup-optimizer
326
11087854
from __future__ import absolute_import, division import unittest from collections import Counter, defaultdict from parameterized import parameterized from pydfs_lineup_optimizer import get_optimizer from pydfs_lineup_optimizer.constants import Site, Sport from pydfs_lineup_optimizer.player import Player, GameInfo from ...
plugin/gogo/protobuf/variants.bzl
heartless-clown/rules_proto
249
11087878
<gh_stars>100-1000 """variants.bzl """ GOGO_VARIANTS = [ "combo", "gogo", "gogofast", "gogofaster", "gogoslick", "gogotypes", "gostring", ]
t/unit/test_sasl.py
scottp-dpaw/py-amqp
253
11087881
import contextlib import socket import sys from io import BytesIO from unittest.mock import Mock, call, patch import pytest from amqp import sasl from amqp.serialization import _write_table class test_SASL: def test_sasl_notimplemented(self): mech = sasl.SASL() with pytest.raises(NotImplementedE...
tests/admin_scripts/management/commands/label_command.py
webjunkie/django
790
11087937
<filename>tests/admin_scripts/management/commands/label_command.py from django.core.management.base import LabelCommand class Command(LabelCommand): help = "Test Label-based commands" requires_model_validation = False args = '<label>' def handle_label(self, label, **options): print('EXECUTE:L...
iceoryx_integrationtest/iceoryx_integrationtest/test_ice_access_control_example.py
sloretz/iceoryx
560
11087939
# Copyright (c) 2021 by Apex.AI 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 by applicable ...
refinery/refinery/__init__.py
csa0001/Refinery
103
11087944
from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy from flask.ext.login import LoginManager from celery import Celery print "Opening a Refinery" app = Flask(__name__) app.config.from_object('config') db = SQLAlchemy(app) lm = LoginManager() lm.init_app(app) lm.login_view = 'login' def make_celery(a...
systrace/systrace/tracing_agents/walt_agent_unittest.py
tingshao/catapult
311
11087945
#!/usr/bin/env python # Copyright (c) 2017 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. import logging import unittest from systrace import decorators from systrace import run_systrace from systrace.tracing_agents imp...
build/lib.linux-x86_64-3.7/detectron2/modeling/roi_heads/mutil_path_fuse_module.py
muchwater/TextFuseNet_EfficientNet
348
11087961
import torch from torch import nn from detectron2.structures import Boxes def get_selfarea_and_interarea(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor: """ Given two lists of boxes of size N and M, compute self_area and inter_area between __all__ N x M pairs of boxes. The box order must be (xmin, y...
mpf/platforms/pkone/pkone_switch.py
haggispinball/mpf_fathom_fast
163
11087962
<filename>mpf/platforms/pkone/pkone_switch.py """A switch input on a PKONE Extension board.""" import logging from collections import namedtuple from mpf.core.platform import SwitchConfig from mpf.platforms.interfaces.switch_platform_interface import SwitchPlatformInterface MYPY = False if MYPY: # pragma: no cover ...
OpenAttack/victim/classifiers/methods.py
e-tornike/OpenAttack
444
11087976
<filename>OpenAttack/victim/classifiers/methods.py from ..method import VictimMethod from ...attack_assist.word_embedding import WordEmbedding class GetPredict(VictimMethod): def before_call(self, input_): if not isinstance(input_, list): raise TypeError( "get_pred: `input` must be a list of se...
third_party/py/abseil/absl/command_name.py
jobechoi/bazel
38,667
11087980
<reponame>jobechoi/bazel<gh_stars>1000+ # Copyright 2017 The Abseil 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 req...
pylearn2/scripts/icml_2013_wrepl/multimodal/extract_kmeans_features.py
ikervazquezlopez/Pylearn2
2,045
11088010
<reponame>ikervazquezlopez/Pylearn2 from __future__ import print_function import numpy as np import os import sys from pylearn2.utils import serial from pylearn2.utils.string_utils import preprocess def usage(): print(""" Run python extract_kmeans_features.py public_test to extract features for the ICML 2013 mul...
src/genie/libs/parser/utils/tests/test_add_parser.py
balmasea/genieparser
204
11088018
import logging import unittest from unittest.mock import Mock from genie.libs.parser.utils import common from genie.libs.parser.utils.entry_points import add_parser class TestAddParser(unittest.TestCase): def setUp(self): try: del common.parser_data except AttributeError as err:...
5]. Projects/Machine Learning & Data Science (ML-DS)/Python/Deep Learning Projects/Computer Vision/011]. Traffic Light Classification/Traffic_Light_Classification.py
Utqrsh04/The-Complete-FAANG-Preparation
6,969
11088019
import cv2 import numpy as np from scipy.stats import itemfreq def get_dominant_color(image, n_colors): pixels = np.float32(image).reshape((-1, 3)) criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 200, .1) flags = cv2.KMEANS_RANDOM_CENTERS flags, labels, centroids = cv2.kmeans( ...
examples/03-exceptions/example.py
tavaresrodrigo/kopf
855
11088020
<filename>examples/03-exceptions/example.py import kopf class MyException(Exception): pass @kopf.on.create('kopfexamples') def instant_failure_with_only_a_message(**kwargs): raise kopf.PermanentError("Fail once and for all.") @kopf.on.create('kopfexamples') def eventual_success_with_few_messages(retry, **...
qa/rpc-tests/test_framework/connectrum/__init__.py
MONIMAKER365/BitcoinUnlimited
535
11088044
from .exc import ElectrumErrorResponse __version__ = '0.7.4'
solt/constants/__init__.py
MIPT-Oulu/solt
263
11088126
<reponame>MIPT-Oulu/solt """ Constants module .. data:: ALLOWED_BLURS Defines the blur modes. Can be ``'g'`` - gaussian or ``'m'`` - median. .. data:: ALLOWED_TYPES Defines the allowed types to be stored in a DataCantainer. Can be ``'I'`` - image, ``'M'`` - mask, ``'L'`` - labels, ``'P'`` - Keypoints. ...
astroML/datasets/sdss_filters.py
astroML/astroML
735
11088140
<gh_stars>100-1000 import os import numpy as np from urllib.request import urlopen from astroML.datasets import get_data_home # Info on vega spectrum: http://www.stsci.edu/hst/observatory/cdbs/calspec.html VEGA_URL = ('https://github.com/astroML/astroML-data/raw/main/datasets/' '1732526_nic_002.ascii') F...
zentral/contrib/santa/migrations/0010_auto_20190603_1543.py
arubdesu/zentral
634
11088146
<filename>zentral/contrib/santa/migrations/0010_auto_20190603_1543.py # Generated by Django 2.2.1 on 2019-06-03 15:43 from django.db import migrations def update_santa_releases(apps, schema_editor): Enrollment = apps.get_model("santa", "Enrollment") for enrollment in Enrollment.objects.filter(santa_release__...
blogs/hparam/trainer/flow.py
laurenzberger/training-data-analyst
6,140
11088167
<reponame>laurenzberger/training-data-analyst import argparse import hypertune import logging # Problem from GINO program (Liebman, Lasdon, Schrage, and Waren 1986) # as quoted in SAS manual Version 8 on p340 # See: http://www.math.wpi.edu/saspdf/iml/chap11.pdf # Reformulated slightly to meet boxed constrained optimiz...
examples/issues/issue387.py
tgolsson/appJar
666
11088177
import sys sys.path.append('../../') from appJar import gui def press(): app.changeOptionBox('opt', ['aaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbb']) with gui() as app: with app.labelFrame("test"): app.setSticky('ew') app.option('opt', ['a','b','c','d','e']) app.button('press', press)
airflow_code_editor/code_editor_view.py
dolfinus/airflow-code-editor
194
11088216
<reponame>dolfinus/airflow-code-editor #!/usr/bin/env python # # Copyright 2019 <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 copy of the License at # # http://www.apache.org/licens...
examples/manage/plot_failed_fits.py
varman-m/eeg_notebooks_doc
154
11088217
<filename>examples/manage/plot_failed_fits.py<gh_stars>100-1000 """ Failed Model Fits ================= Example of model fit failures and how to debug them. """ ################################################################################################### # Import the FOOOFGroup object from fooof import FOOOFGr...
qt4i/driver/instruments/internal/_command.py
beijixing0202/QT4i
209
11088240
# coding: UTF-8 # # Tencent is pleased to support the open source community by making QTA available. # Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved. # Licensed under the BSD 3-Clause License (the "License"); you may not use this # file except in compliance with the License. You may obtain ...
test/test_query.py
dongsc1994/sql-metadata
313
11088259
from sql_metadata.parser import Parser def test_get_query_tokens(): assert Parser("").tokens == [] tokens = Parser("SELECT * FROM foo").tokens assert len(tokens) == 4 assert str(tokens[0]) == "SELECT" assert tokens[1].is_wildcard assert tokens[2].is_keyword assert str(tokens[2]) == "FROM...
release/stubs.min/System/Windows/Forms/__init___parts/DataGridView.py
htlcnn/ironpython-stubs
182
11088267
class DataGridView(Control,IComponent,IDisposable,IOleControl,IOleObject,IOleInPlaceObject,IOleInPlaceActiveObject,IOleWindow,IViewObject,IViewObject2,IPersist,IPersistStreamInit,IPersistPropertyBag,IPersistStorage,IQuickActivate,ISupportOleDropSource,IDropTarget,ISynchronizeInvoke,IWin32Window,IArrangedElement,IBindab...
bitshares/aio/wallet.py
silverchen0402/python-bitshares
102
11088271
# -*- coding: utf-8 -*- from bitsharesbase.account import PrivateKey from graphenecommon.aio.wallet import Wallet as GrapheneWallet from ..instance import BlockchainInstance # Uses synchronous BlockchainInstance because it's __init__ is synchronous. # Other methods will use async Instance. @BlockchainInstance.inject ...
setup.py
Tonow/cookiecutter
7,210
11088272
#! /usr/bin/env python3 """cookiecutter distutils configuration. The presence of this file ensures the support of pip editable mode *with setuptools only*. """ import setuptools # https://github.com/jazzband/pip-tools/issues/1278 setuptools.setup( use_scm_version={"local_scheme": "no-local-version"}, setup_re...
knover/models/nsp_model.py
youth123/Knover
1,373
11088273
<reponame>youth123/Knover # Copyright (c) 2020 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 ...
src/oci/database/models/create_db_home_base.py
Manny27nyc/oci-python-sdk
249
11088276
<filename>src/oci/database/models/create_db_home_base.py # coding: utf-8 # Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. # This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown...
conans/client/tools/system_pm.py
fanStefan/conan
6,205
11088279
import os import sys import six from conans.client.runner import ConanRunner from conans.client.tools.oss import OSInfo, cross_building, get_cross_building_settings from conans.client.tools.files import which from conans.errors import ConanException from conans.util.env_reader import get_env from conans.util.fallbacks...
src/masonite/filesystem/drivers/LocalDriver.py
StevenMHernandez/masonite
1,816
11088295
<gh_stars>1000+ import os from shutil import copyfile, move from ..FileStream import FileStream import uuid import os class LocalDriver: def __init__(self, application): self.application = application self.options = {} def set_options(self, options): self.options = options ret...
python/ql/test/query-tests/Imports/cyclic-module/module6.py
vadi2/codeql
4,036
11088314
def foo(): import module7
tests/slice_getattribute.py
ZYAZP/python2
1,062
11088316
class M(type): __getattribute__ = None class G(object): __metaclass__ = M __getattribute__ = None def __get__(self, instance, owner): def f(*args): print args return f class C(object): __metaclass__ = M __getattribute__ = None __getitem__ = G() __setitem__ =...
luigi/contrib/lsf_runner.py
gaybro8777/luigi
14,755
11088330
# -*- coding: utf-8 -*- """ .. Copyright 2012-2015 Spotify AB Copyright 2018 Copyright 2018 EMBL-European Bioinformatics Institute 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 ...
mmaction/models/tenons/cls_heads/__init__.py
shreyas-bk/TPN
353
11088332
<filename>mmaction/models/tenons/cls_heads/__init__.py from .cls_head import ClsHead __all__ = [ 'ClsHead', ]
fury/ui/__init__.py
SunTzunami/fury
149
11088338
<gh_stars>100-1000 from fury.ui.core import * from fury.ui.containers import * from fury.ui.elements import *
tests/test_fitness_shaping.py
mahi97/evosax
102
11088358
import jax.numpy as jnp from evosax import FitnessShaper def test_fitness_shaping_rank(): shaper = FitnessShaper(centered_rank=True) x = jnp.array([[1.0], [2.0], [3.0]]) fit = jnp.array([0.0, 1.0, 2.0]) fit_re = shaper.apply(x, fit) assert jnp.allclose(fit_re, jnp.array([-0.5, 0.0, 0.5]), atol=1e-...
dashboard/reporter.py
vzhong/dashboard
155
11088359
from collections import defaultdict class Reporter: """ Utility for aggregating metrics """ def __init__(self): self.log = [] self.keys = set() def add(self, metrics): """ Adds metrics to the cache """ for k in metrics.keys(): self.keys...
multi_video_sim/generate_test_video.py
matvaibhav/pensieve
462
11088396
import os import numpy as np VIDEO_SOURCE_FOLDER = '../video_server/' VIDEO_FOLDER = 'video' VIDEO_OUTPUT_FOLDER = './test_video/' TOTAL_VIDEO_CHUNCK = 49 BITRATE_LEVELS = 6 MASK = [0, 1, 0, 1, 1, 1, 1, 1, 0, 0] M_IN_B = 1000000.0 video_chunk_sizes = [] for bitrate in xrange(BITRATE_LEVELS): video_chunk_sizes.a...
uasyncio.udp/example_dns_junk.py
Carglglz/micropython-lib
126
11088403
<filename>uasyncio.udp/example_dns_junk.py<gh_stars>100-1000 # This example is intended to run with dnsmasq running on localhost # (Ubuntu comes configured like that by default). Dnsmasq, receiving # some junk, is still kind to reply something back, which we employ # here. import uasyncio import uasyncio.udp import uso...
homeassistant/components/airzone/climate.py
liangleslie/core
30,023
11088407
<reponame>liangleslie/core """Support for the Airzone climate.""" from __future__ import annotations import logging from typing import Any, Final from aioairzone.common import OperationMode from aioairzone.const import ( API_MODE, API_ON, API_SET_POINT, API_SYSTEM_ID, API_ZONE_ID, AZD_DEMAND, ...
colour/colorimetry/cmfs.py
rift-labs-developer/colour
1,380
11088408
# -*- coding: utf-8 -*- """ Colour Matching Functions ========================= Defines the colour matching functions classes for the datasets from the :mod:`colour.colorimetry.datasets.cmfs` module: - :class:`colour.colorimetry.LMS_ConeFundamentals`: Implements support for the *Stockman and Sharpe* *LMS* cone ...
pyflux/__check_build/__init__.py
ThomasHoppe/pyflux
2,091
11088449
""" Module to give helpful messages to the user that did not compile package properly, This code was adapted from scikit-learn's check_build utility. """ import os PACKAGE_NAME = 'pyflux' INPLACE_MSG = """ It appears that you are importing {package} from within the source tree. Please either use an inplace install or...
revitAPI/applicationGetAllFailureMessages.py
sixtysecondrevit/dynamoPython
114
11088451
''' GET ALL POSSIBLE FAILURE MESSAGES ''' __author__ = '<NAME> - <EMAIL>' __twitter__ = '@60secondrevit' __github__ = '@sixtysecondrevit' __version__ ='1.0.0' # dynamo version - 1.3.3 # import common language runtime import clr # Import DocumentManager and TransactionManager clr.AddReference("RevitS...
pandasdmx/tests/__init__.py
vedal/pandaSDMX
105
11088452
<filename>pandasdmx/tests/__init__.py import importlib from distutils import version from pathlib import Path import numpy as np import pandas as pd import pytest from .data import BASE_PATH def assert_pd_equal(left, right, **kwargs): """Assert equality of two pandas objects.""" if left is None: ret...
example/configure/app.py
RonnyPfannschmidt/dynaconf
2,293
11088532
from dynaconf import settings settings.configure(settings_module="/tmp/configure_test/settings.py") assert settings.MESSAGE == "Hello from tmp" print(settings.MESSAGE) # noqa
alipay/aop/api/response/AlipayDaoweiOrderQueryResponse.py
snowxmas/alipay-sdk-python-all
213
11088558
<gh_stars>100-1000 #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.OrderLogisticsInfo import OrderLogisticsInfo from alipay.aop.api.domain.ServiceOrderInfo import ServiceOrderInfo class AlipayDaoweiOrderQueryRespon...
tests/test_rtcrtptransceiver.py
thedilletante/aiortc
1,992
11088560
<filename>tests/test_rtcrtptransceiver.py from unittest import TestCase from aiortc.rtcrtpparameters import RTCRtpCodecCapability from aiortc.rtcrtptransceiver import RTCRtpTransceiver class RTCRtpTransceiverTest(TestCase): def test_codec_preferences(self): transceiver = RTCRtpTransceiver("audio", None, ...
src/gluonnlp/torch/models/__init__.py
leezu/gluon-nlp
2,461
11088576
<gh_stars>1000+ from . import transformer from . import bert
malwareconfig/fileparser.py
BA7JCM/RATDecoders
905
11088578
import re import hashlib import pefile import io import yara from binascii import hexlify from androguard.core.bytecodes import apk from androguard.core.bytecodes import dvm from androguard import misc from malwareconfig.yarascanner import YaraScanner from zipfile import ZipFile class FileParser: def __init__(...
tests/conftest.py
brunolnetto/python-statemachine
264
11088632
<filename>tests/conftest.py # coding: utf-8 import pytest from datetime import datetime @pytest.fixture def current_time(): return datetime.now() @pytest.fixture def campaign_machine(): "Define a new class for each test" from statemachine import State, StateMachine class CampaignMachine(StateMachi...
{{cookiecutter.project_name}}/src/sitesettings/serializers.py
techquila/Wagtail-Boilerplate
124
11088648
<reponame>techquila/Wagtail-Boilerplate from rest_framework import serializers from sitesettings.models import SiteSetting class SiteSettingSerializer(serializers.ModelSerializer): class Meta: model = SiteSetting fields = ["gtm_id", "cookie_content"]
MangaTaggerLib/models.py
Inpacchi/Manga-Tagger
106
11088649
<gh_stars>100-1000 import logging from datetime import datetime from pytz import timezone from MangaTaggerLib.errors import MetadataNotCompleteError from MangaTaggerLib.utils import AppSettings, compare class Metadata: _log = None @classmethod def fully_qualified_class_name(cls): re...
moya/tests/testproject/wsgi.py
moyaproject/moya
129
11088655
# encoding=UTF-8 # This file serves the project in production # See http://wsgi.readthedocs.org/en/latest/ from __future__ import unicode_literals from moya.wsgi import Application application = Application( "./", ["local.ini", "production.ini"], server="main", logging="prodlogging.ini" )
2019/quals/hardware-flagrom/src/emu8051/crosstest.py
iicarus-bit/google-ctf
2,757
11088662
# 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/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
betfairlightweight/__init__.py
blake3/betfair
300
11088667
import logging from .apiclient import APIClient from .exceptions import BetfairError from .streaming import StreamListener from . import filters from .__version__ import __title__, __version__, __author__ # Set default logging handler to avoid "No handler found" warnings. logging.getLogger(__name__).addHandler(loggin...
mmdet3d/ops/iou3d/iou3d_utils.py
collector-m/SST
217
11088670
<filename>mmdet3d/ops/iou3d/iou3d_utils.py import torch from . import iou3d_cuda # to be released # try: # import weighted_nms_ext # except Exception as e: # print(f'Error {e} when import weighted_nms.') def boxes_iou_bev(boxes_a, boxes_b): """Calculate boxes IoU in the bird view. Args: box...
devito/ir/__init__.py
BrunoMot/devito
204
11088682
from devito.ir.support import * # noqa from devito.ir.equations import * # noqa from devito.ir.clusters import * # noqa from devito.ir.iet import * # noqa
views/view_alert.py
TomasTorresB/nerve
365
11088734
from core.redis import rds from core.security import session_required from flask import ( Blueprint, render_template, flash, redirect ) alert = Blueprint('alert', __name__, template_folder='templates') @alert.route('/alert/view/<alert_id>') @session_required def view_alert(alert_id): ...
Exscript/util/event.py
saveshodhan/exscript
226
11088749
# # Copyright (C) 2010-2017 <NAME> # The MIT License (MIT) # # 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, modif...
FreeRTOS/Test/VeriFast/scripts/extract.py
JVVJV/FreeRTOS
2,603
11088796
#!/usr/bin/env python3 from __future__ import print_function import sys from enum import Enum class Extractor(object): @staticmethod def __parse_ctags(tags_filename): def convert_excmd(excmd): assert excmd.endswith(';"') linenum = excmd[:-2] # remove ';"' return in...
components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/authn.py
zhyon404/kubeflow
9,272
11088811
<reponame>zhyon404/kubeflow<filename>components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/authn.py import logging from flask import Blueprint, current_app, request from werkzeug.exceptions import Unauthorized from . import config, settings bp = Blueprint("authn", __name__) log = logging.getLogger(_...
notebooks-text-format/gaussian_param_inf_1d_numpyro.py
arpitvaghela/probml-notebooks
166
11088830
# --- # jupyter: # jupytext: # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.11.3 # kernelspec: # display_name: Python 3 # name: python3 # --- # + [markdown] id="view-in-github" colab_type="text" # <a href="https://colab...
freight/api/serializer/__init__.py
armandomeeuwenoord/freight
562
11088831
<reponame>armandomeeuwenoord/freight<filename>freight/api/serializer/__init__.py from .manager import serialize # NOQA # TODO(dcramer): we cant seem to use import_submodules here as something is # wrong w/ the code that causes it to mess up the default_manager instance from . import app # NOQA from . import deploy ...
habanero/request_class.py
sckott/habanero
115
11088852
<filename>habanero/request_class.py import requests import json import re import math from tqdm import tqdm from .filterhandler import filter_handler from .habanero_utils import ( switch_classes, check_json, is_json, parse_json_err, make_ua, filter_dict, rename_query_filters, ifelsestr,...
examples/hf20_testnet.py
Nickfost/beem
118
11088863
<reponame>Nickfost/beem from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import sys from datetime import datetime, timedelta import time import io import logging from beem.blockchain import Blockchain from beem.block im...
src/anyconfig/processors/__init__.py
Terrance-forks/python-anyconfig
213
11088881
<reponame>Terrance-forks/python-anyconfig # # Copyright (C) 2021 <NAME> <<EMAIL>> # SPDX-License-Identifier: MIT # r"""Abstract class provides a list of :class:`anyconfig.models.processor` class objects, related utility functions and data types. .. versionchanged:: 0.10.2 - Split and re-organize the module and add...
todo/commands/group/add.py
tomasdanjonsson/td-cli
154
11088888
<filename>todo/commands/group/add.py from sqlite3 import Error, IntegrityError from todo.commands.base import Command from todo.exceptions import TodoException from todo.renderers import RenderOutput class Add(Command): def run(self, args): try: group_name = self.service.group.add(args.name) ...
metaflow/metadata/util.py
Netflix/metaflow
5,821
11088894
from io import BytesIO import os import tarfile from distutils.dir_util import copy_tree from metaflow import util from metaflow.datastore.local_storage import LocalStorage def sync_local_metadata_to_datastore(metadata_local_dir, task_ds): with util.TempDir() as td: tar_file_path = os.path.join(td, 'met...
app/http_downloader.py
porcupineyhairs/rapidbay
351
11088907
import requests import urllib import os import log from common import threaded class HttpDownloader: downloads = {} def clear(self, output_path): try: del self.downloads[output_path] except KeyError: pass def download_file(self, url, output_path): if self...
fastreid/layers/frn.py
tenghehan/reid_without_id
2,194
11088924
<filename>fastreid/layers/frn.py # encoding: utf-8 """ @author: liaoxingyu @contact: <EMAIL> """ import torch from torch import nn from torch.nn.modules.batchnorm import BatchNorm2d from torch.nn import ReLU, LeakyReLU from torch.nn.parameter import Parameter class TLU(nn.Module): def __init__(self, num_feature...
checkov/cloudformation/checks/resource/aws/DynamoDBTablesEncrypted.py
niradler/checkov
4,013
11088926
<gh_stars>1000+ from checkov.common.models.enums import CheckResult, CheckCategories from checkov.cloudformation.checks.resource.base_resource_check import BaseResourceCheck class DynamoDBTablesEncrypted(BaseResourceCheck): def __init__(self): name = "Ensure DynamoDB Tables are encrypted using a KMS Custo...
data_collection/gazette/spiders/sc_braco_do_trombudo.py
kaiocp/querido-diario
454
11088934
from gazette.spiders.base.fecam import FecamGazetteSpider class ScBracoDoTrombudoSpider(FecamGazetteSpider): name = "sc_braco_do_trombudo" FECAM_QUERY = "cod_entidade:50" TERRITORY_ID = "4202859"
scripts/eval/eval_root.py
facebookresearch/banmo
201
11088942
<filename>scripts/eval/eval_root.py # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # python scripts/eval_root.py cam-files/adult7-b25/ cam-files/adult-masked-cam/ 1000 import sys, os sys.path.append(os.path.dirname(os.path.dirname(sys.path[0]))) os.environ["PYOPENGL_PLATFORM"] = "egl" #opengl ...
saleor/order/migrations/0107_set_origin_and_original_values.py
fairhopeweb/saleor
15,337
11088945
from django.db import migrations def set_origin_and_original_order_values(apps, schema_editor): Order = apps.get_model("order", "Order") draft_events = ["placed_from_draft", "draft_created"] Order.objects.filter(events__type__in=draft_events).update(origin="draft") orders = [] for order in Order.o...
var/spack/repos/builtin/packages/py-os-service-types/package.py
LiamBindle/spack
2,360
11088946
<gh_stars>1000+ # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyOsServiceTypes(PythonPackage): """Python library for consuming OpenStack...
tests/test_utils/test_module_hooks.py
Naoki-Wake/mmaction2
648
11088947
<reponame>Naoki-Wake/mmaction2 import copy import os.path as osp import mmcv import numpy as np import pytest import torch from mmaction.models import build_recognizer from mmaction.utils import register_module_hooks from mmaction.utils.module_hooks import GPUNormalize def test_register_module_hooks(): _module_...
eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py
phenixmzy/apache-eagle-0.5
322
11088960
<filename>eagle-external/hadoop_jmx_collector/hadoop_ha_checker.py # !/usr/bin/python # # 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 th...
coarse_to_fine/refine_cityscapes_coarse.py
jblanche/STEAL
478
11088962
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
StackApp/env/lib/python2.7/site-packages/flask_api/tests/test_request.py
jonathanmusila/StackOverflow-Lite
555
11088967
<reponame>jonathanmusila/StackOverflow-Lite # coding: utf8 from __future__ import unicode_literals from flask import request from flask_api import exceptions import flask_api import io import unittest app = flask_api.FlaskAPI(__name__) class MediaTypeParsingTests(unittest.TestCase): def test_json_request(self): ...
cooka/service/process_monitor.py
highboo52na/Cooka
222
11088975
<reponame>highboo52na/Cooka<filename>cooka/service/process_monitor.py # -*- encoding: utf-8 -*- import threading import time import psutil from psutil import _common as ps_cons from cooka.common.model import Model, JobStep, TrainStep from cooka.service.experiment_service import ExperimentService from cooka.common.log ...
trainers/base_trainer.py
zekunhao1995/DualSDF
107
11088978
<filename>trainers/base_trainer.py import torch import torch.nn as nn class BaseTrainer(nn.Module): def __init__(self, cfg, args, device): self.cfg = cfg self.args = args self.device = device
src/account/azext_account/generated/_params.py
Mannan2812/azure-cli-extensions
207
11088989
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
simulation/scenario_seven.py
Barala/doorman
1,831
11089030
<filename>simulation/scenario_seven.py #!/usr/bin/python2.7 # Copyright 2016 Google, Inc. # # 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 ...
localgraphclustering/MQI_weighted.py
vishalbelsare/LocalGraphClustering
106
11089052
<filename>localgraphclustering/MQI_weighted.py<gh_stars>100-1000 from typing import * import numpy as np from .cpp import * def MQI_weighted(G, ref_nodes): """ Max Flow Quotient Cut Improvement (MQI) for improving either the expansion or the conductance of cuts of weighted or unweighted graphs. For de...