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
examples_and_tutorials/grid/heuristic_perception.py
ali-senguel/fairo
669
12685874
from droidlet.memory.memory_nodes import PlayerNode class HeuristicPerception: def __init__(self, agent): self.agent = agent def perceive(self): bots = self.agent.world.get_bots() for bot in bots: # print(f"[Perception INFO]: Perceived bot [{bot.name}] in the wo...
ryu/services/protocols/bgp/info_base/rtc.py
w180112/ryu
975
12685879
# Copyright (C) 2014 Nippon Telegraph and Telephone 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 # # Unless required by appli...
txweb2/dav/test/test_options.py
backwardn/ccs-calendarserver
462
12685886
## # Copyright (c) 2005-2017 Apple Inc. All rights reserved. # # 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, mod...
DQMOffline/CalibCalo/python/MonitorAlCaEcalPhisym_cfi.py
ckamtsikis/cmssw
852
12685890
# The following comments couldn't be translated into the new config version: # prescale import FWCore.ParameterSet.Config as cms # # # \author <NAME> # EcalPhiSymMonDQM = cms.EDAnalyzer("HLTAlCaMonEcalPhiSym", # product to monitor AlCaStreamEBTag = cms.untracked.InputTag("hltAlCaPhiSymStream","phiSymEcalRecH...
usr/callbacks/next/next.py
uwitec/LEHome
151
12685915
<gh_stars>100-1000 #!/usr/bin/env python # encoding: utf-8 from lib.model import Callback class next_callback(Callback.Callback): def callback(self, action = None, target = None, msg = None, state = None, pre_value = None, pass_value = None): DEBUG("* next callback: action: %s, ...
contents/convolutions/2d/code/python/2d_convolution.py
alzawad26/algorithm-archive
1,975
12685963
<reponame>alzawad26/algorithm-archive import numpy as np from contextlib import suppress def convolve_linear(signal, filter, output_size): out = np.zeros(output_size) sum = 0 for i in range(output_size[0]): for j in range(output_size[1]): for k in range(max(0, i-filter.shape[0]), i+1)...
configs/seg/_base_/schedules/schedule_adamw_80k.py
yinchimaoliang/K-Net
361
12685979
# optimizer optimizer = dict(type='AdamW', lr=0.0001, weight_decay=0.0005) optimizer_config = dict(grad_clip=dict(max_norm=1, norm_type=2)) # learning policy lr_config = dict( policy='step', warmup='linear', warmup_iters=1000, warmup_ratio=0.001, step=[60000, 72000], by_epoch=False) # runtime se...
examples/YOLOv3_Training.py
KerasKorea/YOLK_ObjectDetector
124
12685990
from keras.optimizers import Adam from keras_yolov3.train import get_anchors, get_classes, data_generator_wrapper from keras_yolov3.yolov3_class import YOLOv3 import tensorflow as tf config = tf.ConfigProto() config.gpu_options.allow_growth = True sess = tf.Session(config=config) classes_path = '../keras_yolov3/mod...
tests/test_smart/test_smart_bits.py
leonardt/magma
167
12686036
<reponame>leonardt/magma from functools import wraps, partial import operator import pytest import magma as m from magma.smart import SmartBit, SmartBits, concat, signed, make_smart from magma.testing import check_files_equal def _run_test(func=None, *, skip_check=False): if func is None: return partial(_...
fastflix/widgets/panels/status_panel.py
ObviousInRetrospect/FastFlix
388
12686076
<reponame>ObviousInRetrospect/FastFlix #!/usr/bin/env python # -*- coding: utf-8 -*- import datetime import logging import time from datetime import timedelta from typing import Optional from PySide6 import QtCore, QtWidgets from fastflix.exceptions import FlixError from fastflix.language import t from fastflix.model...
startup/GafferOSL/shaderNameCompatibility.py
ddesmond/gaffer
561
12686096
<filename>startup/GafferOSL/shaderNameCompatibility.py ########################################################################## # # Copyright (c) 2018, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that th...
maskrcnn_benchmark/layers/focal_loss.py
sergiev/ContourNet
211
12686114
<reponame>sergiev/ContourNet import torch from torch import nn from torch.nn import functional as F def Focal_Loss(pred, gt): # print('yes!!') ce = nn.CrossEntropyLoss() alpha = 0.25 gamma = 2 # logp = ce(input, target) p = torch.sigmoid(pred) loss = -alpha *...
run_dir/subprocessdebugger.py
classerase/polygott
370
12686124
<filename>run_dir/subprocessdebugger.py<gh_stars>100-1000 import os import json import select import socket import subprocess import sys import tempfile import remotedebugger if sys.version_info[0] == 2: raise ValueError("Wrong Python version! This script is for Python 3.") class DebuggerSocket(): def __in...
lib/carbon/resolver.py
hessu/carbon
961
12686148
<gh_stars>100-1000 import random from zope.interface import implementer from twisted.internet._resolver import GAIResolver from twisted.internet.defer import Deferred from twisted.internet.address import IPv4Address from twisted.internet.interfaces import IResolverSimple, IResolutionReceiver from twisted.internet.err...
pypy/module/unicodedata/test/test_hyp.py
nanjekyejoannah/pypy
333
12686226
<filename>pypy/module/unicodedata/test/test_hyp.py import sys import pytest try: from hypothesis import given, strategies as st, example, settings, assume except ImportError: pytest.skip("hypothesis required") from pypy.module.unicodedata.interp_ucd import ucd from rpython.rlib.rutf8 import codepoints_in_utf8 ...
src/models/sequence/rnns/__init__.py
dumpmemory/state-spaces
513
12686249
# Expose the cell registry and load all possible cells from .cells.basic import CellBase from .cells import basic from .cells import hippo from .cells import timestamp from . import sru
test/sanity/issue4493-win-open-size/test.py
frank-dspeed/nw.js
27,296
12686263
<gh_stars>1000+ import time import os import platform from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("nwapp=" + os.path.dirname(os.path.abspath(__file__))) # open first time print 'Open first time' driver = webdriver.Chrome(...
pyformance/reporters/newrelic_reporter.py
boarik/pyformance
167
12686279
# -*- coding: utf-8 -*- from __future__ import print_function import json import os import socket import sys from pyformance.registry import set_global_registry, MetricsRegistry if sys.version_info[0] > 2: import urllib.request as urllib import urllib.error as urlerror else: import urllib2 as urllib im...
osquery/plugin.py
eoinmiller-r7/osquery-python
274
12686282
<gh_stars>100-1000 """This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. """ # pylint: disable=no-self-use from __future__ import absolute_import from...
constrained_language_typology/scikit_classifier.py
deepneuralmachine/google-research
23,901
12686290
# coding=utf-8 # Copyright 2021 The Google Research 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 required by applicab...
modules/core/sublime_event_loop.py
timfjord/sublime_debugger
225
12686291
<filename>modules/core/sublime_event_loop.py<gh_stars>100-1000 from __future__ import annotations import asyncio import sublime import threading class Handle: def __init__(self, callback, args): self.callback = callback self.args = args def __call__(self): if self.callback: self.callback(*self.args) def...
qiskit_nature/transformers/base_transformer.py
renier/qiskit-nature
132
12686308
<gh_stars>100-1000 # This code is part of Qiskit. # # (C) Copyright IBM 2021. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modificatio...
src/twisted/internet/iocpreactor/iocpsupport.py
giadram/twisted
4,612
12686316
<filename>src/twisted/internet/iocpreactor/iocpsupport.py __all__ = [ "CompletionPort", "Event", "accept", "connect", "get_accept_addrs", "have_connectex", "makesockaddr", "maxAddrLen", "recv", "recvfrom", "send", ] from twisted_iocpsupport.iocpsupport import ( # type: igno...
tests/neptune/new/internal/test_container_structure.py
Raalsky/neptune-client
254
12686319
# # Copyright (c) 2020, Neptune Labs Sp. z o.o. # # 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 agr...
ProofOfConcepts/Vision/OpenMvStereoVision/src/target_code/stereo_remote_cam.py
WoodData/EndpointAI
190
12686330
import image, network, rpc, sensor, struct import time import micropython from pyb import Pin from pyb import LED # variables that can be changed save_to_SD = False sensor_format = sensor.RGB565 #sensor_format = sensor.GRAYSCALE # leds are used as an easy way to know if the remote camera has started fine red_led ...
src/api-service/__app__/timer_daily/__init__.py
tonybaloney/onefuzz
2,692
12686362
<filename>src/api-service/__app__/timer_daily/__init__.py #!/usr/bin/env python # # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import logging import azure.functions as func from ..onefuzzlib.webhooks import WebhookMessageLog from ..onefuzzlib.workers.scalesets import Scaleset def main(m...
factory-ai-vision/EdgeSolution/modules/InferenceModule/shared_memory.py
kaka-lin/azure-intelligent-edge-patterns
176
12686370
import tempfile import mmap import os import logging from exception_handler import PrintGetExceptionDetails # *********************************************************************************** # Shared memory management # class SharedMemoryManager: def __init__(self, shmFlags=None, name=None, size=None...
lisa/core/architecture.py
jrespeto/LiSa
244
12686383
<gh_stars>100-1000 """ ELF architecture detection module. """ import logging.config from lisa.config import logging_config logging.config.dictConfig(logging_config) log = logging.getLogger() e_machine = { 2: 'sparc', 3: 'i386', 4: 'm68k', 8: 'mips', 18: 'sparc32plus', 20: 'ppc', 21:...
tests/datasets/test_combined_source_and_target.py
KevinMusgrave/pytorch-adapt
131
12686396
import unittest import numpy as np import torch from pytorch_adapt.datasets import CombinedSourceAndTargetDataset from pytorch_adapt.utils.common_functions import join_lists class TestCombinedSourceAndTarget(unittest.TestCase): def test_combined(self): np.random.seed(3429) for target_dataset_siz...
RecoBTag/CTagging/python/training_settings.py
ckamtsikis/cmssw
852
12686398
<reponame>ckamtsikis/cmssw import FWCore.ParameterSet.Config as cms ## IMPORTANT! ## This file was automatically generated by RecoBTag/CTagging/test/dump_training_vars_cfg.py ## with input xml files: ## - C vs L: ../data/c_vs_udsg.weight.xml sha1 checksum: 1b50773894bf3c64e41694bd48bda5f6f0e3795b ## - C vs B: .....
buildchain/buildchain/utils.py
SaintLoong/metalk8s
255
12686400
# coding: utf-8 """Miscellaneous helpers.""" import inspect import subprocess import sys from pathlib import Path from typing import Any, Callable, Iterator, List, Optional from docker.types import Mount # type: ignore from buildchain import config from buildchain import constants from buildchain import types ...
third_party/blink/tools/diff_wpt_results_unittest.py
iridium-browser/iridium-browser
575
12686420
<filename>third_party/blink/tools/diff_wpt_results_unittest.py #!/usr/bin/env vpython # Copyright (C) 2021 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of sou...
src/python/k4a/examples/simple_viewer.py
seanyen/Azure-Kinect-Sensor-SDK
1,120
12686421
''' simple_viewer.py A simple viewer to demonstrate the image capture capabilities of an Azure Kinect device using the Python API. This is not the fastest way to display a sequence of images; this is only meant to show how to capture frames in a sequence. Requirements: Users should install the following python packa...
lib/pypng-0.0.9/code/exnumpy.py
ceremetrix/X
460
12686429
<reponame>ceremetrix/X #!/usr/bin/env python # $URL: http://pypng.googlecode.com/svn/trunk/code/exnumpy.py $ # $Rev: 126 $ # Numpy example. # Original code created by <NAME>, modified by <NAME>. ''' Example code integrating RGB PNG files, PyPNG and NumPy (abstracted from Mel Raab's functioning code) ''' # http:/...
src/ansiblelint/rules/key_order.py
willthames/ansible-lint
1,192
12686432
"""All tasks should be have name come first.""" import sys from typing import Any, Dict, Optional, Union from ansiblelint.file_utils import Lintable from ansiblelint.rules import AnsibleLintRule from ansiblelint.testing import RunFromText class KeyOrderRule(AnsibleLintRule): """Ensure specific order of keys in m...
examples/fib.py
chen3feng/pywasm
337
12686438
<filename>examples/fib.py import pywasm # pywasm.on_debug() runtime = pywasm.load('./examples/fib.wasm') r = runtime.exec('fib', [10]) print(r)
cloudbio/custom/galaxy.py
glebkuznetsov/cloudbiolinux
122
12686457
<gh_stars>100-1000 """ Install any components that fall under 'galaxy' directive in main.yaml """ from cloudbio.galaxy import _setup_users from cloudbio.galaxy import _setup_galaxy_env_defaults from cloudbio.galaxy import _install_galaxy from cloudbio.galaxy import _configure_galaxy_options def install_galaxy_webapp(...
mergify_engine/actions/squash.py
truthiswill/mergify-engine
266
12686459
<reponame>truthiswill/mergify-engine<gh_stars>100-1000 # -*- encoding: utf-8 -*- # # Copyright © 2021 Mergify SAS # # 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.o...
gaphas/tree.py
gaphor/gaphas
108
12686461
"""Simple class containing the tree structure for the canvas items.""" from typing import Dict, Generic, Iterable, List, Optional, Sequence, TypeVar, Union T = TypeVar("T") class Tree(Generic[T]): """A Tree structure. Nodes are stores in a depth-first order. ``None`` is the root node. @invariant: len(s...
tests/test_init.py
fariddarabi/fastapi-chameleon
118
12686467
import pytest import fastapi_chameleon as fc from fastapi_chameleon.exceptions import FastAPIChameleonException def test_cannot_decorate_with_missing_init(): fc.engine.clear() with pytest.raises(FastAPIChameleonException): @fc.template('home/index.pt') def view_method(a, b, c): r...
mongomock/object_id.py
moonso/mongomock
574
12686474
<reponame>moonso/mongomock import uuid class ObjectId(object): def __init__(self, id=None): super(ObjectId, self).__init__() if id is None: self._id = uuid.uuid1() else: self._id = uuid.UUID(id) def __eq__(self, other): return isinstance(other, ObjectId...
test/test_render_visual.py
QiukuZ/svox2
1,724
12686488
<gh_stars>1000+ import svox2 import torch import numpy as np from util import Timing from matplotlib import pyplot as plt device='cuda:0' GRID_FILE = 'lego.npy' grid = svox2.SparseGrid(reso=256, device='cpu', radius=1.3256) data = torch.from_numpy(np.load(GRID_FILE)).view(-1, grid.data_dim) grid.sh_data.data = data[.....
nider/__init__.py
rockykitamura/nider
123
12686494
<gh_stars>100-1000 # -*- coding: utf-8 -*- """Top-level package for nider.""" __author__ = """<NAME>""" __email__ = '<EMAIL>' __version__ = '0.5.0'
pfrl/wrappers/monitor.py
ummavi/pfrl-1
824
12686500
import time from logging import getLogger from gym.wrappers import Monitor as _GymMonitor from gym.wrappers.monitoring.stats_recorder import StatsRecorder as _GymStatsRecorder class Monitor(_GymMonitor): """`Monitor` with PFRL's `ContinuingTimeLimit` support. `Agent` in PFRL might reset the env even when `d...
2018/CVE-2018-2894/poc/pocsploit/CVE-2018-2894.py
hjyuan/reapoc
421
12686511
import requests # Vuln Base Info def info(): return { "author": "cckuailong", "name": '''Oracle WebLogic RCE''', "description": '''Easily exploitable vulnerability allows unauthenticated attacker with network access via HTTP to compromise Oracle WebLogic Server.''', "severity": "cr...
tensorflow/compiler/tests/reverse_ops_test.py
abhaikollara/tensorflow
848
12686577
<gh_stars>100-1000 # Copyright 2017 The TensorFlow 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 ...
setup.py
jameswilkerson/elex
183
12686591
<reponame>jameswilkerson/elex<filename>setup.py import os.path try: from setuptools import setup except ImportError: from distutils.core import setup def read(filename): return open(os.path.join(os.path.dirname(__file__), filename)).read() setup( name="elex", version="2.4.4", author="<NAME>...
python/pygcylon/examples/util.py
deHasara/cylon
229
12686593
## # 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 writing, software # distributed under the...
CLUE_Rock_Paper_Scissors/very-simple/code.py
gamblor21/Adafruit_Learning_System_Guides
665
12686598
<reponame>gamblor21/Adafruit_Learning_System_Guides<gh_stars>100-1000 # clue-verysimple-rpsgame v1.0 # CircuitPython rock paper scissors game simple text game # based on https://www.youtube.com/watch?v=dhaaZQyBP2g # Tested with CLUE and Circuit Playground Bluefruit (Alpha) # and CircuitPython and 5.3.0 # copy this fi...
test/misc/mocktest.py
skysightsoaringweather/wrf-python
315
12686599
import sys import os try: from unittest.mock import MagicMock except ImportError: from mock import Mock as MagicMock class Mock(MagicMock): @classmethod def __getattr__(cls, name): return Mock() MOCK_MODULES = ["numpy", "numpy.ma", "xarray", "cartopy", "pandas", "matplotlib"...
py/base/EretPreambleSequence.py
Wlgen/force-riscv
111
12686606
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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 # # THIS SOFTWARE IS PR...
rigl/experimental/jax/datasets/dataset_base.py
xhchrn/rigl
276
12686620
# coding=utf-8 # Copyright 2021 RigL 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 required by applicable law or agree...
ambari-server/src/main/resources/scripts/takeover_config_merge.py
likenamehaojie/Apache-Ambari-ZH
1,664
12686626
<filename>ambari-server/src/main/resources/scripts/takeover_config_merge.py #!/usr/bin/env 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 lice...
samples/payment/all.py
Hey-Marvelous/PayPal-Python-SDK
653
12686633
<filename>samples/payment/all.py # GetPaymentList Sample # This sample code demonstrate how you can # retrieve a list of all Payment resources # you've created using the Payments API. # Note various query parameters that you can # use to filter, and paginate through the # payments list. # API used: GET /v1/payments/pay...
migrations/versions/2e9d99288cd_.py
IsmaelJS/test-github-actions
1,420
12686651
<gh_stars>1000+ """empty message Revision ID: <KEY> Revises: 36954739c63 Create Date: 2015-11-23 21:16:54.103342 """ # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '3<PASSWORD>4<PASSWORD>' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by...
meter/datamodules/trash/nlvr2_datamodule.py
shinying/METER
135
12686654
<reponame>shinying/METER from ..datasets import NLVR2Dataset from .datamodule_base import BaseDataModule class NLVR2DataModule(BaseDataModule): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @property def dataset_cls(self): return NLVR2Dataset @property de...
telemetry/third_party/web-page-replay/rules/rule.py
ravitejavalluri/catapult
226
12686688
<reponame>ravitejavalluri/catapult #!/usr/bin/env python # Copyright 2015 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/licen...
src/garage/envs/mujoco/half_cheetah_env_meta_base.py
blacksph3re/garage
1,500
12686690
"""Base class of HalfCheetah meta-environments.""" from gym.envs.mujoco import HalfCheetahEnv as HalfCheetahEnv_ import numpy as np from garage import EnvSpec class HalfCheetahEnvMetaBase(HalfCheetahEnv_): """Base class of HalfCheetah meta-environments. Code is adapted from https://github.com/tristandel...
metadrive/component/road_network/edge_road_network.py
liuzuxin/metadrive
125
12686692
from metadrive.component.road_network.base_road_network import BaseRoadNetwork, LaneIndex import gc import copy import logging from typing import List, Tuple, Dict import numpy as np from metadrive.component.lane.abs_lane import AbstractLane from metadrive.component.road_network.road import Road from metadrive.compone...
ml3d/torch/modules/losses/semseg_loss.py
krshrimali/Open3D-ML
346
12686699
import torch import torch.nn as nn from ....datasets.utils import DataProcessing def filter_valid_label(scores, labels, num_classes, ignored_label_inds, device): """Loss functions for semantic segmentation.""" valid_scores = scores.reshape(-1, num_classes) valid_labels = labels.reshape(-1).to(device) ...
venv/Lib/site-packages/statsmodels/iolib/stata_summary_examples.py
EkremBayar/bayar
6,931
12686708
""". regress totemp gnpdefl gnp unemp armed pop year Source | SS df MS Number of obs = 16 -------------+------------------------------ F( 6, 9) = 330.29 Model | 184172402 6 30695400.3 Prob > F = 0.0000 Residual | 836424.129 ...
test/integration/samples_in/simple.py
Inveracity/flynt
487
12686746
var = 5 a = "my string {}".format(var)
depixel/io_png.py
sknebel/depixel
128
12686749
<reponame>sknebel/depixel import png from depixel.io_data import PixelDataWriter class Bitmap(object): mode = 'RGB' bgcolour = (127, 127, 127) def __init__(self, size, bgcolour=None, mode=None): if bgcolour is not None: self.bgcolour = bgcolour if mode is not None: ...
prody/sequence/analysis.py
kaynakb/ProDy
210
12686770
<reponame>kaynakb/ProDy # -*- coding: utf-8 -*- """This module defines MSA analysis functions.""" __author__ = '<NAME>, <NAME>, <NAME>' from numbers import Integral import os from numpy import dtype, zeros, empty, ones, where, ceil, shape, eye from numpy import indices, tril_indices, array, ndarray, isscalar, unique...
tables/table-alter/old-fictitious-experiments.py
yash-srivastava19/sempre
812
12686774
<reponame>yash-srivastava19/sempre<filename>tables/table-alter/old-fictitious-experiments.py #!/usr/bin/env python # -*- coding: utf-8 -*- """DEPRECATED. Use fictitious-experiments.py instead.""" import sys, os, shutil, re, argparse, json, gzip from codecs import open from itertools import izip from collections import...
rl_reliability_metrics/analysis/plotter.py
mcx/rl-reliability-metrics
122
12686781
# coding=utf-8 # Copyright 2019 The Authors of RL Reliability Metrics. # # 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 b...
compiler-rt/lib/sanitizer_common/scripts/litlint.py
medismailben/llvm-project
8,865
12686782
#!/usr/bin/env python # # litlint # # Ensure RUN commands in lit tests are free of common errors. # # If any errors are detected, litlint returns a nonzero exit code. # import optparse import re import sys # Compile regex once for all files runRegex = re.compile(r'(?<!-o)(?<!%run) %t\s') def LintLine(s): """ Valid...
utils/gap_configs/python/gap/gap9/gap9.py
00-01/gap_sdk
118
12686788
# # Copyright (C) 2020 GreenWaves Technologies # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
embedding-calculator/src/services/flask_/parse_request_arg.py
Precistat/CompreFace
1,779
12686801
<filename>embedding-calculator/src/services/flask_/parse_request_arg.py # Copyright (c) 2020 the original author or 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 # # https...
amazon_problems/problem_13.py
loftwah/Daily-Coding-Problem
129
12686803
"""This problem was asked by Amazon. Given a pivot x, and a list lst, partition the list into three parts. • The first part contains all elements in lst that are less than x • The second part contains all elements in lst that are equal to x • The third part contains all elements in lst that are larger than x Ordering w...
ads_plugin.py
wukathryn/axondeepseg
115
12686830
""" This is an FSLeyes plugin script that integrates AxonDeepSeg tools into FSLeyes. Author : <NAME> """ import wx import wx.lib.agw.hyperlink as hl import fsleyes.controls.controlpanel as ctrlpanel import fsleyes.actions.loadoverlay as ovLoad import numpy as np import nibabel as nib from PIL import Image, ImageDra...
examples/python/beat.py
eeryinkblot/psmoveapi
306
12686902
# # PS Move API - An interface for the PS Move Motion Controller # Copyright (c) 2011 <NAME> <<EMAIL>> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code mus...
Chapter07/question_5_example_code.py
trappn/Mastering-GUI-Programming-with-Python
138
12686913
<gh_stars>100-1000 from PyQt5 import QtWidgets as qtw from PyQt5 import QtCore as qtc from PyQt5 import QtMultimedia as qtmm from PyQt5 import QtMultimediaWidgets as qtmmw class MainWindow(qtw.QWidget): def __init__(self): super().__init__() self.setLayout(qtw.QVBoxLayout()) # camera ...
binproperty/apps.py
wh8983298/GreaterWMS
1,063
12686927
<filename>binproperty/apps.py from django.apps import AppConfig from django.db.models.signals import post_migrate class BinpropertyConfig(AppConfig): name = 'binproperty' def ready(self): post_migrate.connect(do_init_data, sender=self) def do_init_data(sender, **kwargs): init_category() def init...
samples/utilityimageformatconverter.py
matt-phair/pypylon
358
12686933
<reponame>matt-phair/pypylon<filename>samples/utilityimageformatconverter.py # Note: Before getting started, Basler recommends reading the Programmer's Guide topic # in the pylon C++ API documentation that gets installed with pylon. # If you are upgrading to a higher major version of pylon, Basler also # st...
tests/zoomus/components/live_stream/test_update.py
seantibor/zoomus
178
12686934
import unittest from zoomus import components, util import responses def suite(): """Define all the tests of the module.""" suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(UpdateV2TestCase)) return suite class UpdateV2TestCase(unittest.TestCase): def setUp(self): self.comp...
env/Lib/site-packages/OpenGL/raw/GLES2/EXT/render_snorm.py
5gconnectedbike/Navio2
210
12686946
<filename>env/Lib/site-packages/OpenGL/raw/GLES2/EXT/render_snorm.py '''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GLES2 import _types as _cs # End users want this... from OpenGL.raw.GLES2._types import * from OpenGL.raw.GL...
examples/GridEYE_test.py
timgates42/PyBBIO
102
12686961
""" GridEYE_test.py <NAME> <<EMAIL>> Example program for PyBBIO's GridEYE library. This example program is in the public domain. """ from bbio import * from bbio.libraries.GridEYE import GridEYE # Initialize the I2C bus: I2C1.open() # Create a GridEYE object: grideye = GridEYE(I2C1) ambient = grideye.getAm...
webots_ros2_epuck/launch/robot_launch.py
zegangYang/webots_ros2
176
12686968
<reponame>zegangYang/webots_ros2 #!/usr/bin/env python # Copyright 1996-2021 Cyberbotics 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...
eventsourcing/examples/aggregate8/application.py
bibz/eventsourcing
107
12686994
<filename>eventsourcing/examples/aggregate8/application.py from typing import Any, Dict from uuid import UUID from eventsourcing.application import Application from eventsourcing.examples.aggregate8.domainmodel import Dog, Snapshot from eventsourcing.examples.aggregate8.persistence import ( OrjsonTranscoder, P...
Demo/Network/tcp-echo-client.py
zaklaus/Shrine
1,227
12687031
#!/usr/bin/env python3 import socket import sys HOST = sys.argv[1] PORT = int(sys.argv[2]) MESSAGE = sys.argv[3] with socket.create_connection((HOST, PORT)) as s: s.sendall(MESSAGE.encode()) data = s.recv(1024) if data: print('Received', data.decode())
tests/keras_contrib/optimizers/ftml_test.py
congson1293/keras-contrib
1,335
12687070
from __future__ import print_function import pytest from keras_contrib.utils.test_utils import is_tf_keras from keras_contrib.tests import optimizers from keras_contrib.optimizers import ftml @pytest.mark.xfail(is_tf_keras, reason='TODO fix this.', strict=True) def test_ftml(): ...
examples/python/extras/test_o3d.py
JeremyBYU/polylidar
149
12687071
<gh_stars>100-1000 """Demo of Open3D 0.10.0 Slowdown Please modify DIRECTORY to point to the folder of meshes attached to this issue reply """ import os import open3d as o3d import copy DIRECTORY = 'fixtures/o3d_slow_down' # o3d 0.10.0 - 9 Seconds to load meshes (time to being user interation), 1 FPS (with draw edges e...
tests/test_ihex.py
CreativeLau/stcgal
469
12687076
# # Copyright (c) 2021 <NAME> <<EMAIL>> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, ...
foundations_ui/cypress/fixtures/atlas_scheduler/project_name/with_job_config_project/main.py
DeepLearnI/atlas
296
12687083
<gh_stars>100-1000 import foundations import sys foundations.log_metric("Task", sys.argv[1])
python/herbstluftwm/types.py
ju-sh/herbstluftwm
925
12687093
<gh_stars>100-1000 import re """ Module containing types used in the communication with herbstluftwm; primarily, types used in attributes. """ class Point: """ A point on the 2D plane """ def __init__(self, x=0, y=0): self.x = x self.y = y def __add__(self, other): return ...
extraPackages/matplotlib-3.0.3/examples/mplot3d/3d_bars.py
dolboBobo/python3_ios
130
12687101
<filename>extraPackages/matplotlib-3.0.3/examples/mplot3d/3d_bars.py<gh_stars>100-1000 """ ===================== Demo of 3D bar charts ===================== A basic demo of how to plot 3D bars with and without shading. """ import numpy as np import matplotlib.pyplot as plt # This import registers the 3D projection, ...
pymol/pymol_example_plugin.py
whitmans-max/python-examples
140
12687129
#!/usr/bin/env python2 # plugin can't have `-` in filename # `pymol-example-plugin.py` will not work # `pymol_example_plugin.py` will work import Tkinter as tk import tkMessageBox import pymol class ExamplePlugin: def __init__(self, parent): self.parent = parent # window win = tk.Tople...
maml/utils/_typing.py
anooptp/maml
367
12687142
"""Define several typing for convenient use""" from typing import Union, Callable, Optional, Any, List import numpy as np from pymatgen.core import Structure, Molecule OptStrOrCallable = Optional[Union[str, Callable[..., Any]]] StructureOrMolecule = Union[Structure, Molecule] VectorLike = Union[List[float], np.ndarr...
tests/helpers.py
jleclanche/fastapi-cloudauth
198
12687147
<gh_stars>100-1000 import base64 import json from dataclasses import dataclass from typing import Any, Dict, Iterable, List, Tuple import pytest from fastapi import HTTPException from fastapi.security import HTTPAuthorizationCredentials from fastapi.testclient import TestClient from pydantic.main import BaseModel from...
CapsE/evalCapsE.py
MedyG/kg-reeval
104
12687153
import tensorflow as tf from scipy.stats import rankdata import numpy as np import os import time import datetime from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from builddata_softplus import * from capsuleNet import CapsE # Parameters # ================================================== parser = A...
seq2seq/test/pooling_encoder_test.py
soupstandstop/test
6,053
12687158
<reponame>soupstandstop/test # Copyright 2017 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 # # Unless required by applicable...
french_law/python/main.py
edwintorok/catala
792
12687171
<filename>french_law/python/main.py #!python3 from datetime import date from src.allocations_familiales import PriseEnCharge_Code, Collectivite_Code from src.api import allocations_familiales, Enfant from src.catala import LogEvent, LogEventCode, reset_log, retrieve_log import timeit import argparse from typing import...
matchzoo/modules/dropout.py
ChrisRBXiong/MatchZoo-py
468
12687208
<gh_stars>100-1000 import torch.nn as nn class RNNDropout(nn.Dropout): """Dropout for RNN.""" def forward(self, sequences_batch): """Masking whole hidden vector for tokens.""" # B: batch size # L: sequence length # D: hidden size # sequence_batch: BxLxD ones =...
caffe2/python/operator_test/lars_test.py
Hacky-DH/pytorch
60,067
12687218
<filename>caffe2/python/operator_test/lars_test.py from caffe2.python import core from hypothesis import given import caffe2.python.hypothesis_test_util as hu import hypothesis.strategies as st import numpy as np class TestLars(hu.HypothesisTestCase): @given(offset=st.floats(min_value=0, max_value=100), ...
waliki/search/search_indexes.py
luzik/waliki
324
12687231
<reponame>luzik/waliki from waliki.models import Page from haystack import indexes class PageIndex(indexes.SearchIndex, indexes.Indexable): text = indexes.CharField(document=True, use_template=True) def get_model(self): return Page
riptable/tests/test_categorical.py
rtosholdings/riptable
307
12687233
import pytest import os import pandas as pd import riptable as rt from enum import IntEnum from numpy.testing import assert_array_equal from riptable import * from riptable import save_sds, load_sds from riptable import FastArray, Categorical, CatZero from riptable.rt_categorical import Categories from ript...
strawberry/fastapi/handlers/graphql_ws_handler.py
TheVinhLuong102/Strawberry
2,062
12687262
from typing import Any from strawberry.asgi.handlers import GraphQLWSHandler as BaseGraphQLWSHandler class GraphQLWSHandler(BaseGraphQLWSHandler): async def get_context(self) -> Any: return await self._get_context() async def get_root_value(self) -> Any: return await self._get_root_value()
PhysicsTools/PatAlgos/test/patTuple_addDecayInFlight_cfg.py
ckamtsikis/cmssw
852
12687280
<gh_stars>100-1000 ## import skeleton process from PhysicsTools.PatAlgos.patTemplate_cfg import * #process.Tracer = cms.Service("Tracer") # load the PAT config process.load("PhysicsTools.PatAlgos.producersLayer1.patCandidates_cff") patAlgosToolsTask.add(process.patCandidatesTask) #Temporary customize to the unit test...
scripts/msms2bin.py
CyrusBiotechnology/pv
272
12687283
#!/usr/bin/env python """ Converts the MSMS .vert/.face pair into a compact binary format optimized for file size. """ import sys import os from struct import pack def print_usage(code=0): print 'usage: msm2bin.py <input> [output]' print ' input may either point to the .vert or .face file generated by msms' ...