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 |
|---|---|---|---|---|
ppml/trusted-big-data-ml/python/docker-graphene/examples/orca_api_example.py | DirkFi/BigDL | 2,970 | 96284 | <reponame>DirkFi/BigDL
from zoo.orca import init_orca_context, stop_orca_context
from tensorflow import keras
from zoo.pipeline.api.keras.layers import *
import argparse
import tensorflow as tf
import os
def bigdl_estimator():
from zoo.orca.learn.bigdl.estimator import Estimator
from tensorflow.python.keras.da... |
gym_chess/test/v1/test_run_moves.py | genyrosk/gym-chess | 115 | 96294 | from copy import copy
import numpy as np
from gym_chess import ChessEnvV1
from gym_chess.envs.chess_v1 import (
KING_ID,
QUEEN_ID,
ROOK_ID,
BISHOP_ID,
KNIGHT_ID,
PAWN_ID,
)
from gym_chess.test.utils import run_test_funcs
# Blank board
BASIC_BOARD = np.array([[0] * 8] * 8, dtype=np.int8)
# Pa... |
reddit2telegram/channels/r_00ag9603/app.py | mainyordle/reddit2telegram | 187 | 96302 | #encoding:utf-8
subreddit = '00ag9603'
t_channel = '@r_00ag9603'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
benchmarks/scripts-report/plot_warmup_graalphp_native.py | avierr/graalphp | 267 | 96346 | from bench_db import get_timings_by_id
from bench_graphs import do_warmup_plot
num_iter = 7
color_copy_by_ref = 'green'
name = 'native-'
def warmup_all_plots():
warmup_plot_fannkuch()
warmup_plot_spectralnorm()
warmup_plot_bintree()
def warmup_plot_fannkuch():
ids = [
100 # fannkuchredux-... |
Python/Tests/TestData/DebuggerProject/InfiniteRun.py | techkey/PTVS | 404 | 96357 | x = 1000000
while True:
y = x
z = x + 1
x = z + 1
|
demos/chat-group/handlers/rest.py | karldoenitz/karlooper | 161 | 96370 | # -*- coding: utf-8 -*-
from karlooper.config import get_global_conf
from karlooper.web.request import Request
__author__ = "<EMAIL>"
class MessageHandler(Request):
def get(self):
redis_manager = get_global_conf("redis")
value = redis_manager.get_value()
result = {
"status": ... |
flatdata-generator/tests/generators/py_expectations/archives/subarchive.py | heremaps/flatdata | 140 | 96383 | <reponame>heremaps/flatdata
class n_X(flatdata.archive.Archive):
_SCHEMA = """namespace n {
archive X
{
payload : raw_data;
}
}
"""
_PAYLOAD_SCHEMA = """namespace n {
archive X
{
payload : raw_data;
}
}
"""
_PAYLOAD_DOC = """"""
_NAME = "X"
_RESOURCES = {
"X.archive" : flatdata.arc... |
tensorflow_constrained_optimization/python/rates/helpers_test.py | RMKruse/tensorflow_constrained_optimization | 276 | 96449 | # 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/licenses/LICENSE-2.0
#
#... |
configs/_dynamic_/rules/ar50to101_ft1x_rules.py | zengming16/GAIA-det | 149 | 96459 | model_space_filename = 'path/to/metrics.json'
model_sampling_rules = dict(
type='sequential',
rules=[
# 1. select model with best performance, could replace with your own metrics
dict(
type='sample',
operation='top',
# replace with customized metric in your o... |
pyperformance/utils.py | cvautounix/pyperformance | 266 | 96484 | import contextlib
import errno
import os
import sys
import tempfile
MS_WINDOWS = (sys.platform == 'win32')
@contextlib.contextmanager
def temporary_file():
tmp_filename = tempfile.mktemp()
try:
yield tmp_filename
finally:
try:
os.unlink(tmp_filename)
except OSError as... |
sqlite3_db/push_request.py | spirit1431007/qiandao-1 | 763 | 96514 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Binux <<EMAIL>>
import config
from db.push_request import PRDB as _PRDB
from .basedb import BaseDB
class PRDB(_PRDB, BaseDB):
def __init__(self, path=config.sqlite3.path):
self.path = path
self._execute('''CREATE... |
matrix-python-project/cover_generator/typesetting/model/four.py | hokaso/hocassian-media-matrix | 141 | 96541 | <filename>matrix-python-project/cover_generator/typesetting/model/four.py
import sys, os, time, json, random
from PIL import Image, ImageDraw, ImageFont, ImageFilter
from cover_generator.typesetting.more import More
from cover_generator.typesetting.mark import Mark
from cover_generator.typesetting.build import Build
fr... |
src/seabreeze/pyseabreeze/features/ethernetconfiguration.py | TeamPiccolo/python-seabreeze | 159 | 96561 | <filename>src/seabreeze/pyseabreeze/features/ethernetconfiguration.py
from seabreeze.pyseabreeze.features._base import SeaBreezeFeature
# Definition
# ==========
#
# TODO: This feature needs to be implemented for pyseabreeze
#
class SeaBreezeEthernetConfigurationFeature(SeaBreezeFeature):
identifier = "ethernet_c... |
selfdrive/car/mock/values.py | Neptos/openpilot | 37,508 | 96574 | <reponame>Neptos/openpilot
class CAR:
MOCK = 'mock'
|
python/example_code/dynamodb/batching/test/test_dynamo_batching.py | iconara/aws-doc-sdk-examples | 5,166 | 96608 | <gh_stars>1000+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for Amazon DynamoDB batching code example.
"""
import time
import unittest.mock
from botocore.exceptions import ClientError
import pytest
import dynamo_batching
@pytest.mark.para... |
uq360/algorithms/classification_calibration/__init__.py | Sclare87/UQ360 | 148 | 96615 | <filename>uq360/algorithms/classification_calibration/__init__.py
from .classification_calibration import ClassificationCalibration
|
model/pose/loss/mse_loss.py | qrsforever/torchcv | 171 | 96621 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
# Loss function for Pose Estimation.
import torch.nn as nn
class MseLoss(nn.Module):
def __init__(self, configer):
super(MseLoss, self).__init__()
self.configer = configer
self.reduction = self.configer.get('loss.para... |
doubles/targets/expectation_target.py | fakeNetflix/uber-repo-doubles | 150 | 96628 | import inspect
from doubles.class_double import ClassDouble
from doubles.exceptions import ConstructorDoubleError
from doubles.lifecycle import current_space
def expect(target):
"""
Prepares a target object for a method call expectation (mock). The name of the method to expect
should be called as a metho... |
examples/mcscf/02-cas_space_spin.py | pablomazo/pyscf.github.io | 501 | 96672 | <filename>examples/mcscf/02-cas_space_spin.py
#!/usr/bin/env python
'''
spin settings in active space
The mol.spin attribute controls the Sz value of the molecule. CASCI/CASSCF
methods by default use this parameter to determine Sz of the correlated
wave-function in active space (i.e. the number of alpha and beta elec... |
supersuit/vector/utils/space_wrapper.py | PettingZoo-Team/SuperSu | 237 | 96687 | import gym
import numpy as np
class SpaceWrapper:
def __init__(self, space):
if isinstance(space, gym.spaces.Discrete):
self.shape = ()
self.dtype = np.dtype(np.int64)
elif isinstance(space, gym.spaces.Box):
self.shape = space.shape
self.dtype = np.d... |
utils.py | trannguyen1510/LearningToCountEverything | 129 | 96692 | import numpy as np
import torch.nn.functional as F
import math
from torchvision import transforms
import torch
import cv2
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.patches as patches
matplotlib.use('agg')
MAPS = ['map3','map4']
Scales = [0.9, 1.1]
MIN_HW = 384
MAX_HW = 1584
IM_NORM_MEAN = [0... |
ssm/init_state_distns.py | adelaneh/ssm | 208 | 96695 | <filename>ssm/init_state_distns.py
from functools import partial
from warnings import warn
import autograd.numpy as np
import autograd.numpy.random as npr
from autograd.scipy.special import logsumexp
from autograd.misc.optimizers import sgd, adam
from autograd import grad
from ssm.util import ensure_args_are_lists
c... |
data-structures/equal-stacks.py | gajubadge11/HackerRank-1 | 340 | 96702 | #!/bin/python3
import sys
if __name__ == "__main__":
n1,n2,n3 = input().strip().split(' ')
n1,n2,n3 = [int(n1),int(n2),int(n3)]
h1 = [int(h1_temp) for h1_temp in input().strip().split(' ')]
h2 = [int(h2_temp) for h2_temp in input().strip().split(' ')]
h3 = [int(h3_temp) for h3_temp in input().stri... |
apps/base/views/plugin.py | youssriaboelseod/pyerp | 115 | 96735 | # Standard Library
import json
import subprocess
import sys
from collections import OrderedDict
from importlib import reload
from os import listdir, path
# Django Library
from django.apps import apps
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import... |
python/vineyard/deploy/tests/test_local.py | linlih/v6d | 417 | 96802 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 Alibaba Group Holding 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/LI... |
zeus/migrations/52a5d85ba249_backfill_cr_multi_author.py | conrad-kronos/zeus | 221 | 96812 | <reponame>conrad-kronos/zeus
"""backfill_cr_multi_author
Revision ID: 52a5d85ba249
Revises: <PASSWORD>
Create Date: 2020-03-04 15:23:10.842507
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "52a5d85ba249"
down_revision = "<PASSWORD>"
branch_labels = ()
depends... |
python/src/main/python/pygw/query/statistics/statistic_query_builder.py | radiant-maxar/geowave | 280 | 96817 | <filename>python/src/main/python/pygw/query/statistics/statistic_query_builder.py<gh_stars>100-1000
#
# Copyright (c) 2013-2020 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the... |
agents/rainbow_agent.py | christopherhesse/retro-baselines | 134 | 96818 | <reponame>christopherhesse/retro-baselines
#!/usr/bin/env python
"""
Train an agent on Sonic using an open source Rainbow DQN
implementation.
"""
import tensorflow as tf
from anyrl.algos import DQN
from anyrl.envs import BatchedGymEnv
from anyrl.envs.wrappers import BatchedFrameStack
from anyrl.models import rainbow... |
tests/unit/v1/test_document.py | anna-hope/python-firestore | 140 | 96851 | <reponame>anna-hope/python-firestore
# Copyright 2017 Google LLC 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
#
# Un... |
agents/instance.py | Andrea-MariaDB-2/LastOrder-Dota2 | 332 | 96876 | import numpy as np
from gym_env.feature_processors.enums import ACTION_NAME_TO_INDEX, DOUBLE_ACTION_PARA_TYPE
class Instance:
# reward is the td n reward plus the target state value
def __init__(self,
dota_time=None,
state_gf=None,
state_ucf=None,
... |
kivymd/uix/navigationdrawer/navigationdrawer.py | tct123/KivyMD | 668 | 96892 | <gh_stars>100-1000
"""
Components/NavigationDrawer
===========================
.. seealso::
`Material Design 2 spec, Navigation drawer <https://material.io/components/navigation-drawer>`_ and
`Material Design 3 spec, Navigation drawer <https://m3.material.io/components/navigation-drawer/overview>`_
.. rubric... |
poline/core.py | riolet/poline | 140 | 96918 | <gh_stars>100-1000
from __future__ import print_function
import re
import os
import sys
import argparse
import collections
import subprocess
import json
from poline.utilfuncs import *
from poline.fields import Fields
from itertools import islice
from operator import itemgetter, attrgetter
if sys.version_info >= (3,0... |
playlist/playlist.py | CodeMasters688/pp | 505 | 96923 | <reponame>CodeMasters688/pp<gh_stars>100-1000
"""
playlist.py
Description: Playing with iTunes Playlists.
Author: <NAME>
Website: electronut.in
"""
import re, argparse
import sys
from matplotlib import pyplot
import plistlib
import numpy as np
def findCommonTracks(fileNames):
"""
Find common tracks in giv... |
leetcode.com/python/428_Serialize_and_Deserialize_N-ary_Tree.py | vansh-tiwari/coding-interview-gym | 713 | 96928 | <filename>leetcode.com/python/428_Serialize_and_Deserialize_N-ary_Tree.py<gh_stars>100-1000
"""
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
# Idea: preorder recursive traversal; add number of children after root val, i... |
.modules/.metagoofil/hachoir_parser/misc/mstask.py | termux-one/EasY_HaCk | 1,103 | 96936 | <gh_stars>1000+
"""
ms task/job file parser
Author: <NAME>
Creation date: 2010-11
References:
http://msdn.microsoft.com/en-us/library/cc248286%28v=PROT.13%29.aspx
http://msdn.microsoft.com/en-us/library/cc248287%28v=PROT.13%29.aspx
http://technet.microsoft.com/en-us/library/bb490996.aspx
"""
from hachoir_parser imp... |
dex-net/src/dexnet/grasping/quality.py | gachiemchiep/PointNetGPD | 193 | 96975 | <reponame>gachiemchiep/PointNetGPD
# -*- coding: utf-8 -*-
# """
# Copyright ©2017. The Regents of the University of California (Regents). All Rights Reserved.
# Permission to use, copy, modify, and distribute this software and its documentation for educational,
# research, and not-for-profit purposes, without fee and ... |
app/views/api.py | modoupi/git-webhook | 1,617 | 97047 | <gh_stars>1000+
# -*- coding: utf-8 -*-
'''
Created on 2016-10-20
@author: hustcc
'''
from app import app
from app.utils import RequestUtil, HookDataParse, JsonUtil
from app.tasks import tasks
from flask.globals import request
import json
from app.database.model import WebHook, History
@app.route('/api/git-webhook/<... |
bin/lib/config_safe_loader.py | jfalcou/infra | 135 | 97049 | <gh_stars>100-1000
import yaml
# With thanks to:
# https://stackoverflow.com/questions/34667108/ignore-dates-and-times-while-parsing-yaml
class ConfigSafeLoader(yaml.SafeLoader):
@classmethod
def remove_implicit_resolver(cls, tag_to_remove):
"""
Remove implicit resolvers for a particular tag
... |
mindinsight/debugger/stream_handler/metadata_handler.py | mindspore-ai/mindinsight | 216 | 97050 | <filename>mindinsight/debugger/stream_handler/metadata_handler.py
# Copyright 2020-2021 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/... |
hkust-gmission/gmission/controllers/geo_controller.py | gmission/gmission | 251 | 97051 | import math
__author__ = 'chenzhao'
from gmission.models import *
# 1km is about 0.01, 1m is 0.00001
def location_nearby_user_count(location_id, r=0.01):
location = Location.query.get(location_id)
P = UserLastPosition
in_rect = (P.longitude >= location.coordinate.longitude - r) & (P.longitude <= locatio... |
ch06/06_15.py | TeikyungKim/book-cryptocurrency | 121 | 97054 | import time
import datetime
now = datetime.datetime.now()
mid = datetime.datetime(now.year, now.month, now.day) + datetime.timedelta(1)
while True:
now = datetime.datetime.now()
if mid < now < mid + datetime.timedelta(seconds=10) :
print("정각입니다")
mid = datetime.datetime(now.year, now.month, n... |
tests/schedules/test_filters.py | concreted/prefect | 8,633 | 97086 | import pendulum
import pytest
import prefect.schedules.filters as filters
def test_on_datetime_0():
filter_fn = filters.on_datetime(pendulum.datetime(2019, 1, 2, 3, 4, 5))
assert filter_fn(pendulum.datetime(2019, 1, 2, 3, 4, 5))
def test_on_datetime_1():
filter_fn = filters.on_datetime(pendulum.datetim... |
vnpy/app/rpc_service/ui/widget.py | dennislwm/pyalgotrader | 102 | 97125 | from vnpy.event import EventEngine, Event
from vnpy.trader.engine import MainEngine
from vnpy.trader.ui import QtWidgets, QtCore
from ..engine import APP_NAME, EVENT_RPC_LOG
class RpcManager(QtWidgets.QWidget):
""""""
signal_log = QtCore.pyqtSignal(Event)
def __init__(self, main_engine: MainEngine, event... |
corehq/apps/hqadmin/views/utils.py | dimagilg/commcare-hq | 471 | 97126 | <reponame>dimagilg/commcare-hq<filename>corehq/apps/hqadmin/views/utils.py
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy
from corehq.apps.domain.decorators import require_superuser
from corehq.apps.hqwebapp.views import BaseSectionPageView
from corehq.util import rever... |
data/labeled_faces_wild/fetch_data.py | DEVESHTARASIA/big-data-tutorial | 107 | 97136 | <filename>data/labeled_faces_wild/fetch_data.py
"""Simple script to fetch a numpy version of the LFW data
Original dataset and credits available at:
http://vis-www.cs.umass.edu/lfw/
"""
import os
import urllib2
URL = "https://downloads.sourceforge.net/project/scikit-learn/data/lfw_preprocessed.tar.gz"
ARCHIVE_NAM... |
mmdeploy/mmcv/ops/roi_align.py | xizi/mmdeploy | 746 | 97139 | # Copyright (c) OpenMMLab. All rights reserved.
from typing import List
import torch
from torch import Tensor
from mmdeploy.core import SYMBOLIC_REWRITER
from mmdeploy.utils import Backend, get_backend, get_ir_config
# Here using mmcv.ops.roi_align.__self__ to find
# mmcv.ops.roi_align.RoIAlignFunction, because RoI... |
insights/parsers/tests/test_neutron_ovs_agent_log.py | mglantz/insights-core | 121 | 97154 | from insights.parsers.neutron_ovs_agent_log import NeutronOVSAgentLog
from insights.tests import context_wrap
from datetime import datetime
LOG = """
2016-11-09 14:39:25.348 3153 WARNING oslo_config.cfg [-] Option "rabbit_password" from group "oslo_messaging_rabbit" is deprecated for removal. Its value may be silent... |
src/db-up/azext_db_up/vendored_sdks/azure_mgmt_sql/sql/models/sync_full_schema_table_column_py3.py | Mannan2812/azure-cli-extensions | 207 | 97158 | # 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 ... |
RecoHI/HiEvtPlaneAlgos/python/RecoHiEvtPlane_EventContent_cff.py | ckamtsikis/cmssw | 852 | 97167 | <filename>RecoHI/HiEvtPlaneAlgos/python/RecoHiEvtPlane_EventContent_cff.py
import FWCore.ParameterSet.Config as cms
# AOD content
RecoHiEvtPlaneAOD = cms.PSet(
outputCommands = cms.untracked.vstring(
'keep recoEvtPlanes_hiEvtPlane_*_*',
'keep ZDCRecHitsSorted_zdcreco_*_*',
'keep ZDCDataFramesSorte... |
ipynb/fs/finder.py | jayvdb/ipynb | 208 | 97176 | """
Contains the finder for use with filesystems.
"""
import sys
import os
from importlib.abc import MetaPathFinder
from importlib.machinery import ModuleSpec
class FSFinder(MetaPathFinder):
"""
Finder for ipynb/py files from the filesystem.
Only tries to load modules that are under ipynb.fs.
Tries ... |
cscs-checks/prgenv/cuda/cuda_memtest_check.py | CLIP-HPC/reframe | 167 | 97253 | <filename>cscs-checks/prgenv/cuda/cuda_memtest_check.py
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import reframe as rfm
import reframe.utility.sanity as sn
@rfm.simpl... |
object-detection/yolov2/download_darknet_yolo.py | AaratiAkkapeddi/nnabla-examples | 228 | 97258 | # Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#... |
segmentron/models/espnetv2.py | cocolord/SegmenTron | 654 | 97278 | "ESPNetv2: A Light-weight, Power Efficient, and General Purpose for Semantic Segmentation"
import torch
import torch.nn as nn
import torch.nn.functional as F
from .segbase import SegBaseModel
from .model_zoo import MODEL_REGISTRY
from ..modules import _ConvBNPReLU, EESP, _BNPReLU, _FCNHead
from ..config import cfg
@... |
pytradfri/smart_task.py | ggravlingen/ikeatradfri | 726 | 97292 | """Smart tasks set timers to turn on/off lights in various ways.
> Currently supporting wake up
SmartTask # return top level info
TaskControl # Change top level values
StartAction # Get top level info on start action
StartActionItem # Get info on specific device in task
StartActionItemCont... |
rbtools/utils/tests/test_aliases.py | torcolvin/rbtools | 113 | 97319 | <reponame>torcolvin/rbtools
"""Unit tests for rbtools.utils.aliases."""
from __future__ import unicode_literals
from rbtools.utils.aliases import replace_arguments
from rbtools.utils.testbase import RBTestBase
class AliasTests(RBTestBase):
"""Tests for rbtools.utils.aliases."""
def test_replace_arguments_b... |
src/tools/audio.py | syfengcuhk/FactorizedHierarchicalVAE | 155 | 97386 | import os
import time
import scipy
import numpy as np
import soundfile as sf
def mel_scale(freq):
return 1127.0 * np.log(1.0 + float(freq)/700)
def inv_mel_scale(mel_freq):
return 700 * (np.exp(float(mel_freq)/1127) - 1)
class MelBank(object):
def __init__(self,
low_freq=20,
... |
mmflow/datasets/sintel.py | hologerry/mmflow | 481 | 97387 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
from typing import Optional, Sequence, Union
from .base_dataset import BaseDataset
from .builder import DATASETS
@DATASETS.register_module()
class Sintel(BaseDataset):
"""Sintel optical flow dataset.
Args:
pass_style (st... |
macadam/tc/t00_trainer.py | yongzhuo/Macadam | 290 | 97399 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2020/5/6 21:51
# @author : Mo
# @function: trainer of text-classification
# 适配linux
import sys
import os
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
sys.path.append(path_root)
## cpu-gpu与tf.keras
# os.environ["CUDA_VISIBLE_DEVI... |
tests/test_models_head.py | kevinmtian/pytorchvideo | 2,391 | 97475 | <reponame>kevinmtian/pytorchvideo
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import itertools
import unittest
import numpy as np
import torch
from pytorchvideo.models.head import (
ResNetBasicHead,
ResNetRoIHead,
SequencePool,
create_res_basic_head,
create_res_roi_pool... |
src/permission/conf.py | dkopitsa/django-permission | 234 | 97478 | <filename>src/permission/conf.py
# coding=utf-8
"""
django-permission application configure
"""
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from appconf import AppConf
from permission.handlers import LogicalPermissionHandler
__all__ = ('settings',)
class PermissionConf(A... |
src/core/tests/widgets/test_imageview.py | luizoti/toga | 1,261 | 97494 | <filename>src/core/tests/widgets/test_imageview.py<gh_stars>1000+
import toga
import toga_dummy
from toga_dummy.utils import TestCase
class ImageViewTests(TestCase):
def setUp(self):
super().setUp()
# We need a test app to trigger app module discovery
self.app = toga.App(
forma... |
analyzer/codechecker_analyzer/analyzers/clangsa/ctu_autodetection.py | ryankurte/codechecker | 1,601 | 97498 | # -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ---------------------------------------------------... |
aries_cloudagent/resolver/tests/test_routes.py | SNU-Blockchain-2021-Fall-Group-H/aries-cloudagent-python | 247 | 97512 | <reponame>SNU-Blockchain-2021-Fall-Group-H/aries-cloudagent-python
"""Test resolver routes."""
# pylint: disable=redefined-outer-name
import pytest
from asynctest import mock as async_mock
from pydid import DIDDocument
from ...admin.request_context import AdminRequestContext
from .. import routes as test_module
from... |
aetros/commands/RunCommand.py | aetros/aetros-cli | 120 | 97562 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import argparse
import sys
import os
from math import ceil
import psutil
import six
from cpuinfo import cpuinfo
import aetros.utils.git
from aetros.cuda_gpu import get_ordered_devices... |
problems/can-scramble/can-scramble.py | vidyadeepa/the-coding-interview | 1,571 | 97617 | from collections import Counter
def can_scramble(source, dest):
if len(source) != len(dest):
return False
return Counter(source) == Counter(dest)
assert(can_scramble("abc", "cba") == True)
assert(can_scramble("abc", "ccc") == False)
assert(can_scramble("aab", "bbc") == False)
assert(can_scramble("aabaaaa", "... |
users/views.py | hrbhat/twissandra | 308 | 97628 | from django.shortcuts import render_to_response
from django.template import RequestContext
from django.http import HttpResponseRedirect
from users.forms import LoginForm, RegistrationForm
import cass
def login(request):
login_form = LoginForm()
register_form = RegistrationForm()
next = request.REQUEST.ge... |
nautobot/core/management/commands/start.py | psmware-ltd/nautobot | 384 | 97640 | from django_webserver.management.commands.pyuwsgi import Command as uWSGICommand
class Command(uWSGICommand):
help = "Start Nautobot uWSGI server."
|
ibrnet/data_loaders/spaces_dataset.py | QiuhongAnnaWei/IBRNet | 254 | 97714 | <filename>ibrnet/data_loaders/spaces_dataset.py
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
python/tests/test_packages.py | lambdaofgod/keepsake | 810 | 97742 | <reponame>lambdaofgod/keepsake
import datetime
from keepsake.packages import get_imported_packages
def test_get_imported_packages():
assert "keepsake" in get_imported_packages()
|
InvenTree/stock/migrations/0013_auto_20190908_0916.py | ArakniD/InvenTree | 656 | 97753 | # Generated by Django 2.2.5 on 2019-09-08 09:16
from django.db import migrations
import django.db.models.deletion
import mptt.fields
class Migration(migrations.Migration):
dependencies = [
('stock', '0012_auto_20190908_0405'),
]
operations = [
migrations.AlterField(
model_na... |
tests/commands/test_update.py | kapb14/hatch | 2,549 | 97765 | <reponame>kapb14/hatch<filename>tests/commands/test_update.py
import os
from click.testing import CliRunner
from hatch.cli import hatch
from hatch.config import get_venv_dir
from hatch.env import (
get_installed_packages, get_python_implementation, install_packages
)
from hatch.utils import env_vars, remove_path,... |
spotpy/examples/getting_started.py | cheginit/spotpy | 182 | 97788 | <filename>spotpy/examples/getting_started.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
'''
Copyright 2015 by <NAME>
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: <NAME>
This class holds the example code from the getting_started web-documention.
'''
from __future__ import print_function... |
tests/r/test_utilities2.py | hajime9652/observations | 199 | 97811 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.utilities2 import utilities2
def test_utilities2():
"""Test module utilities2.py by downloading
utilities2.csv and testing shape of
extrac... |
tests/database.py | roor0/dispatch | 3,417 | 97820 | from sqlalchemy.orm import scoped_session, sessionmaker
Session = scoped_session(sessionmaker())
|
test_cases/geo_quiz.py | edupylearn/simplegui | 413 | 97824 | <reponame>edupylearn/simplegui
__author__ = '<NAME>'
# Ref:
# http://stackoverflow.com/questions/29767777/gui-quiz-using-easygui-and-pygame-issue-with-quieting-the-game-and-playing-sound
#We start by importing a few libraries.
#Easygui provides our GUI for the game.
import sys
sys.path.append('..') ;# This is only ... |
Python/palindrome.py | PushpneetSingh/Hello-world | 1,428 | 97834 | //to check if string is a palindrome or not
string=raw_input("Enter string:")
if(string==string[::-1]):
print("The string is a palindrome")
else:
print("The string isn't a palindrome")
|
src/tf_transformers/models/vit/vit.py | legacyai/tf-transformers | 116 | 97903 | # coding=utf-8
# Copyright 2021 TF-Transformers 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 r... |
build-s2i-python-kopf/examples/openshift-template-deployer/operator/operator.py | jkupferer/containers-quickstarts | 238 | 97954 | #!/usr/bin/env python
import kopf
import kubernetes
import os
import json
import subprocess
import yaml
operator_domain = os.environ.get('OPERATOR_DOMAIN', 'app.example.com')
config_map_label = operator_domain + '/config'
app_name_label = operator_domain + '/name'
if os.path.exists('/var/run/secrets/kubernetes.io/se... |
index_creation/vector_feeder.py | lukasstracke/postgres-word2vec | 131 | 97956 | #!/usr/bin/python3
class VectorFeeder:
def __init__(self, vectors, words, cursor=0):
self.data = vectors
self.cursor = cursor
self.words = words
print('len words', len(self.words), 'len data', len(self.data))
def get_next_batch(self, size):
batch = self.data[self.cursor:... |
exercises/isogram/isogram.py | kishankj/python | 1,177 | 97975 | <reponame>kishankj/python
def is_isogram(string):
pass
|
apps/index/views.py | PyCN/BlogBackendProject | 335 | 98011 | from django.shortcuts import render
from django.views.generic.base import View
from base.models import SiteInfo
class IndexView(View):
def get(self, request):
site_infos = SiteInfo.objects.all().filter(is_live=True)[0]
context = {
'site_infos': site_infos
}
request.se... |
__init__.py | virtualcharacters/DisVoice | 191 | 98059 | # -*- coding: utf-8 -*-
__all__=['glottal', 'phonation', 'articulation', 'prosody', 'replearning'] |
tests/bench/test_MComp.py | jmabry/pyaf | 377 | 98072 | import pyaf.Bench.TS_datasets as tsds
import pyaf.Bench.MComp as mcomp
#tester1 = mcomp.cMComp_Tester(tsds.load_M1_comp());
#tester1.testSignals('')
#tester1.testAllSignals()
#tester2 = mcomp.cMComp_Tester(tsds.load_M2_comp());
#tester1.testSignals('')
#tester2.testAllSignals()
#tester3 = mcomp.cMComp_Tester(tsds.... |
python/ray/autoscaler/_private/readonly/node_provider.py | linyiyue/ray | 21,382 | 98074 | <gh_stars>1000+
from typing import Tuple, List
from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import (TAG_RAY_NODE_KIND, NODE_KIND_HEAD,
TAG_RAY_USER_NODE_TYPE, TAG_RAY_NODE_NAME,
TAG_RAY_NODE_STATUS, STATUS_UP_TO_DATE)
f... |
benchmarks/fasta.py | codeclimate-testing/falcon | 115 | 98076 | <filename>benchmarks/fasta.py
import bisect
import sys
alu = (
'GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG'
'GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA'
'CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT'
'ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA'
'GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG'
'AGGCGGAGGT... |
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMu_Output_cff.py | ckamtsikis/cmssw | 852 | 98080 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# AlCaReco for track based alignment using ZMuMu events
OutALCARECOTkAlZMuMu_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('pathALCARECOTkAlZMuMu')
),
outputCommands = cms.untracked.vstring(
... |
web/app.py | pwh19920920/spiders | 390 | 98117 | <filename>web/app.py
import os
import sys
sys.path.append(os.path.join(os.path.dirname(os.getcwd())))
from flask import Flask
from flask_cors import CORS
from web import config, error, views, log
def create_app() -> Flask:
app = Flask(__name__)
app.config.from_object(config)
CORS(app)
views.init_a... |
scripts/atc_visualizations/base.py | efeerdur/atomic-threat-coverage | 542 | 98122 | <gh_stars>100-1000
#!/usr/bin/env python3
# ########################################################################### #
# ############################ Base Classes ################################# #
# ########################################################################### #
import json
import datetime
import g... |
src/out/NIPS18evaluation/evaluationTreeLSTM/Lantern/preprocess_data.py | supunab/Lantern | 158 | 98135 | <filename>src/out/NIPS18evaluation/evaluationTreeLSTM/Lantern/preprocess_data.py
import codecs
import functools
import os
import tempfile
import zipfile
from nltk.tokenize import sexpr
import numpy as np
from six.moves import urllib
def getAllwordsFromOneData(data):
data = data.split()
words = set()
for i in da... |
LinkedList/LineRemoveMiddlePoints.py | Amanjakhetiya/Data_Structures_Algorithms_In_Python | 195 | 98140 | """Given a linked list of co-ordinates where adjacent points either form a vertical line or a horizontal line.
Delete points from the linked list which are in the middle of a horizontal or vertical line."""
"""Input: (0,10)->(1,10)->(5,10)->(7,10)
|
(7,... |
tools/tests/test_check_rabbitmq_queue.py | TylerPham2000/zulip | 17,004 | 98177 | <reponame>TylerPham2000/zulip<gh_stars>1000+
import time
from unittest import TestCase, mock
from scripts.lib.check_rabbitmq_queue import CRITICAL, OK, UNKNOWN, WARNING, analyze_queue_stats
class AnalyzeQueueStatsTests(TestCase):
def test_no_stats_available(self) -> None:
result = analyze_queue_stats("na... |
tests/testing_lib/test_data.py | Zotkin/incremental_learning.pytorch | 277 | 98180 | <gh_stars>100-1000
import pytest
from inclearn.lib import data
@pytest.mark.parametrize("dataset_name,increment,n_tasks", [
("cifar100", 10, 10),
("cifar100", 2, 50)
])
def test_incremental_class(dataset_name, increment, n_tasks):
dataset = data.IncrementalDataset(
dataset_name,
increment... |
Python/math/tribonacci.py | Khushboo85277/NeoAlgo | 897 | 98185 | <reponame>Khushboo85277/NeoAlgo
"""
Python program to find the n'th number in the tribonacci series
Tribonacci series is a generalization of the Fibonacci sequence, in which the current term
is the sum of the previous three terms.
"""
def find_tribonacci(n):
dp = [0] * n
dp[0] = 0
dp[1] = 0
dp[2] = 1
... |
py/elements/offsets.py | pombredanne/debin | 322 | 98205 | import traceback
import sys
import depgraph
from common import utils
from common.constants import UNKNOWN_LABEL, VOID, LOC_VAR, FUN_ARG, INT
from common.constants import ENUM_DW_FORM_exprloc, ENUM_ABBREV_CODE, TTYPES
from elements.ttype import Ttype
from elements.givs import Node
class Offset(Node):
total = 0
... |
examples/semantic_segmentation/backend.py | niqbal996/paz | 300 | 98232 | import cv2
import numpy as np
from paz.backend.image.draw import put_text, draw_rectangle
from paz.backend.image.draw import GREEN
def draw_box(image, coordinates, class_name, score,
color=GREEN, scale=0.7, weighted=False):
x_min, y_min, x_max, y_max = coordinates
if weighted:
color = [in... |
Calibration/TkAlCaRecoProducers/test/inspectNearByPixelClusters_cfg.py | Purva-Chaudhari/cmssw | 852 | 98265 | <gh_stars>100-1000
import glob
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
options = VarParsing.VarParsing()
###################################################################
# Setup 'standard' options
##################################################################... |
usaspending_api/recipient/migrations/0001_initial.py | g4brielvs/usaspending-api | 217 | 98280 | <filename>usaspending_api/recipient/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-05-11 00:51
from __future__ import unicode_literals
import django.contrib.postgres.fields
import django.contrib.postgres.indexes
import partial_index
from django.contrib.postgres.operations impo... |
discovery-provider/src/utils/redis_constants.py | atticwip/audius-protocol | 429 | 98310 | <gh_stars>100-1000
latest_block_redis_key = "latest_block_from_chain"
latest_block_hash_redis_key = "latest_blockhash_from_chain"
most_recent_indexed_block_redis_key = "most_recently_indexed_block_from_db"
most_recent_indexed_block_hash_redis_key = "most_recently_indexed_block_hash_from_db"
most_recent_indexed_ipld_blo... |
tests/runtimes/local/agent_runtime_test.py | bbhunter/ostorlab | 113 | 98340 | <filename>tests/runtimes/local/agent_runtime_test.py
"""Unittest for agent runtime."""
import docker
from ostorlab.runtimes import definitions
from ostorlab.utils import defintions as utils_defintions
from ostorlab.agent import definitions as agent_definitions
from ostorlab.runtimes.local import agent_runtime
import ... |
tests/test_gmplot.py | Monti03/gmplot | 606 | 98348 | import unittest
import warnings
from gmplot.utility import StringIO, _format_LatLng
from gmplot.writer import _Writer
from gmplot.drawables.route import _Route
from gmplot.google_map_plotter import GoogleMapPlotter
class GMPlotTest(unittest.TestCase):
def test_format_LatLng(self):
self.assertEqual(_format_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.