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 |
|---|---|---|---|---|
projects/mmdet3d_plugin/models/utils/dgcnn_attn.py | XiangTodayEatsWhat/detr3d | 237 | 12783093 | <reponame>XiangTodayEatsWhat/detr3d<filename>projects/mmdet3d_plugin/models/utils/dgcnn_attn.py
import math
import torch
import torch.nn as nn
from mmcv.cnn.bricks.registry import ATTENTION
from mmcv.runner.base_module import BaseModule
@ATTENTION.register_module()
class DGCNNAttn(BaseModule):
"""A warpper for D... |
Lib/test/test_async.py | pyparallel/pyparallel | 652 | 12783125 | import os
import sys
import atexit
import unittest
import tempfile
import async
import _async
import socket
from socket import (
AF_INET,
SOCK_STREAM,
)
def tcpsock():
return socket.socket(AF_INET, SOCK_STREAM)
CHARGEN = [
r""" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefg""",... |
5 - unit testing/vehicle_info_test.py | mickeybeurskens/betterpython | 523 | 12783179 | import unittest
from vehicle_info_after import VehicleInfo
class TestVehicleInfoMethods(unittest.TestCase):
pass
# def test_compute_tax_non_electric(self):
# v = VehicleInfo("BMW", False, 10000)
# self.assertEqual(v.compute_tax(), 500)
# def test_compute_tax_electric(self):
# v =... |
src/azure-cli/azure/cli/command_modules/lab/_params.py | YuanyuanNi/azure-cli | 3,287 | 12783203 | <filename>src/azure-cli/azure/cli/command_modules/lab/_params.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---... |
modules/src/dictionary.py | rampreeth/JARVIS-on-Messenger | 1,465 | 12783212 | <reponame>rampreeth/JARVIS-on-Messenger
import os
import requests
import requests_cache
import config
from templates.text import TextTemplate
WORDS_API_KEY = os.environ.get('WORDS_API_KEY', config.WORDS_API_KEY)
def process(input, entities):
output = {}
try:
word = entities['word'][0]['value']
... |
packages/syft/src/syft/proto/core/auth/signed_message_pb2.py | vishalbelsare/PySyft | 8,428 | 12783243 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proto/core/auth/signed_message.proto
"""Generated protocol buffer code."""
# third party
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf... |
Models/regressionTemplateTF/model.py | UTS-AnimalLogicAcademy/nuke-ML-server | 123 | 12783247 | # Copyright (c) 2020 Foundry.
#
# 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,... |
pyscreenshot/plugins/xwd.py | ponty/pyscreenshot | 416 | 12783252 | import logging
from easyprocess import EasyProcess
from pyscreenshot.plugins.backend import CBackend
from pyscreenshot.tempexport import RunProgError, read_func_img
from pyscreenshot.util import extract_version
log = logging.getLogger(__name__)
PROGRAM = "xwd"
# wikipedia: https://en.wikipedia.org/wiki/Xwd
# ... |
nevergrad/optimization/test_special.py | risto-trajanov/nevergrad | 3,217 | 12783260 | <reponame>risto-trajanov/nevergrad
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import time
import collections
import typing as tp
import pytest
import numpy... |
test/unit/test_noise_gates.py | stjordanis/pyquil | 677 | 12783312 | import numpy as np
from pyquil.gates import RZ, RX, I, CZ, ISWAP, CPHASE
from pyquil.noise_gates import _get_qvm_noise_supported_gates, THETA
def test_get_qvm_noise_supported_gates_from_compiler_isa(compiler_isa):
gates = _get_qvm_noise_supported_gates(compiler_isa)
for q in [0, 1, 2]:
for g in [
... |
setup.py | fdvty/open-box | 184 | 12783317 | <gh_stars>100-1000
#!/usr/bin/env python
# This en code is licensed under the MIT license found in the
# LICENSE file in the root directory of this en tree.
import sys
import importlib.util
from pathlib import Path
from distutils.core import setup
from setuptools import find_packages
requirements = dict()
for extra i... |
img2dataset/logger.py | rom1504/img2dataset | 482 | 12783349 | """logging utils for the downloader"""
import wandb
import time
from collections import Counter
import fsspec
import json
from multiprocessing import Process, Queue
import queue
class CappedCounter:
"""Maintain a counter with a capping to avoid memory issues"""
def __init__(self, max_size=10 ** 5):
... |
src/orders/migrations/0007_OrderPromoCodes.py | denkasyanov/education-backend | 151 | 12783352 | <gh_stars>100-1000
# Generated by Django 2.2.13 on 2020-09-30 13:14
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0006_PromoCodeComments'),
]
operations = [
migrations.AddField(
m... |
examples/simple.py | ldn-softdev/pyeapi | 126 | 12783385 | #!/usr/bin/env python
from __future__ import print_function
import pyeapi
connection = pyeapi.connect(host='192.168.1.16')
output = connection.execute(['enable', 'show version'])
print(('My system MAC address is', output['result'][1]['systemMacAddress']))
|
i3pystatus/pomodoro.py | fkusei/i3pystatus | 413 | 12783389 | import subprocess
from datetime import datetime, timedelta
from i3pystatus import IntervalModule
from i3pystatus.core.desktop import DesktopNotification
STOPPED = 0
RUNNING = 1
BREAK = 2
class Pomodoro(IntervalModule):
"""
This plugin shows Pomodoro timer.
Left click starts/restarts timer.
Right c... |
tests/test_runtime.py | NathanDeMaria/aws-lambda-r-runtime | 134 | 12783400 | import base64
import json
import re
import unittest
import boto3
from tests import get_version, get_function_name, is_local
from tests.sam import LocalLambdaServer, start_local_lambda
class TestRuntimeLayer(unittest.TestCase):
lambda_server: LocalLambdaServer = None
@classmethod
def setUpClass(cls):
... |
tools/check_python_format.py | cockroachzl/recommenders-addons | 584 | 12783416 | <filename>tools/check_python_format.py
#!/usr/bin/env python
from subprocess import check_call, CalledProcessError
def check_bash_call(string):
check_call(["bash", "-c", string])
def _run_format():
files_changed = False
try:
check_bash_call(
"find . -name '*.py' -print0 | xargs -0 yapf --style=./... |
examples/csj/s0/csj_tools/wn.2.prep.text.py | treeaaa/wenet | 1,166 | 12783422 | import os
import sys
# train test1 test2 test3
def readtst(tstfn):
outlist = list()
with open(tstfn) as br:
for aline in br.readlines():
aline = aline.strip()
outlist.append(aline)
return outlist
def split_train_tests_xml(xmlpath, test1fn, test2fn, test3fn):
test1list ... |
hal_fuzz/hal_fuzz/handlers/stm32f4_hal/stm32f4_i2c.py | diagprov/hal-fuzz | 117 | 12783451 | <filename>hal_fuzz/hal_fuzz/handlers/stm32f4_hal/stm32f4_i2c.py
import sys
from unicorn.arm_const import *
from ...util import *
import sys
from ..fuzz import fuzz_remaining, get_fuzz
from ...models.i2c import I2CModel
def HAL_I2C_Init(uc):
pass
def HAL_I2C_Mem_Read(uc):
# HAL_StatusTypeDef __fastcall HAL_I... |
python/gpu-enabled-multiprocessing.py | GangababuManam/tensorflow-101 | 832 | 12783462 | <reponame>GangababuManam/tensorflow-101<gh_stars>100-1000
import pandas as pd
import multiprocessing
from multiprocessing import Pool
def train(index, df):
import tensorflow as tf
import keras
from keras.models import Sequential
#------------------------------
#this block enables GPU enabled multiproc... |
src/networks/lenet.py | francesco-p/FACIL | 243 | 12783471 | from torch import nn
import torch.nn.functional as F
class LeNet(nn.Module):
"""LeNet-like network for tests with MNIST (28x28)."""
def __init__(self, in_channels=1, num_classes=10, **kwargs):
super().__init__()
# main part of the network
self.conv1 = nn.Conv2d(in_channels, 6, 5)
... |
egg/platform_arm.py | TheMartianObserver/nsimd | 247 | 12783490 | <reponame>TheMartianObserver/nsimd<filename>egg/platform_arm.py
# Copyright (c) 2020 Agenium Scale
#
# 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 lim... |
anuga/parallel/tests/test_sequential_dist_sw_flow.py | samcom12/anuga_core | 136 | 12783516 | <reponame>samcom12/anuga_core
"""
Simple water flow example using ANUGA
Water driven up a linear slope and time varying boundary,
similar to a beach environment
This is a very simple test of the parallel algorithm using the simplified parallel API
"""
from __future__ import print_function
from __future__ import divis... |
src/copy_mechanism/copy_layer.py | Ravi-0809/question-generation | 212 | 12783527 | from typing import Callable
from tensorflow.python.layers import base
from tensorflow.python.eager import context
from tensorflow.python.estimator import util as estimator_util
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import tensor_sha... |
nso/test_api.py | caputomarcos/network-programmability-stream | 120 | 12783544 | <reponame>caputomarcos/network-programmability-stream
#!/usr/bin/env python3
import ncs
from ncs.maagic import Root
from typing import Iterator, Tuple
NSO_USERNAME = 'admin'
NSO_CONTEXT = 'python'
# NSO_GROUPS = ['ncsadmin']
def get_device_name(nso: Root) -> Iterator[Tuple[str, str]]:
for device in nso.devices.... |
voctogui/voctogui.py | 0xflotus/voctomix | 521 | 12783558 | #!/usr/bin/env python3
import gi
# import GStreamer and GLib-Helper classes
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
gi.require_version('GstVideo', '1.0')
gi.require_version('GstNet', '1.0')
from gi.repository import Gtk, Gdk, Gst, GstVideo
import signal
import logging
import sys
import os
sy... |
src/genie/libs/parser/iosxr/tests/ShowSpanningTreePvrsTag/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 12783626 |
expected_output = {
'pvrstag': {
'foo': {
'domain': 'foo',
'interfaces': {
'GigabitEthernet0/0/0/0': {
'interface': 'GigabitEthernet0/0/0/0',
'vlans': {
'5': {
'preempt_delay... |
anuga/file_conversion/sts2sww_mesh.py | GeoscienceAustralia/anuga_core | 136 | 12783633 | from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
import os
import numpy as num
from anuga.file.netcdf import NetCDFFile
import pylab as P
import anuga
from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular
from anuga.shallow_... |
hs_core/tests/api/native/test_hs_requests.py | tommac7/hydroshare | 178 | 12783690 | <gh_stars>100-1000
from django.test import TestCase
from hs_core.hydroshare import hs_requests
from django.conf import settings
class TestRewrite(TestCase):
""" Test local rewriting that bypasses firewalls and hits local nginx server """
def setUp(self):
self.prod_fqdn = getattr(settings, "PROD_FQDN_... |
i3pystatus/clock.py | fkusei/i3pystatus | 413 | 12783696 | import errno
import os
import locale
from datetime import datetime
try:
import pytz
HAS_PYTZ = True
except ImportError:
HAS_PYTZ = False
from i3pystatus import IntervalModule
class Clock(IntervalModule):
"""
This class shows a clock.
.. note:: Optionally requires `pytz` for time zone data w... |
scripts/announcement.py | vishalbelsare/jina | 15,179 | 12783701 | import re
import sys
meetup_svg = '.github/images/meetup.svg'
readme_md = 'README.md'
conf_py = 'docs/conf.py'
def rm_announce():
# remove all announcement
with open(readme_md) as fp:
_old = fp.read()
_new = re.sub(
r'(<!--startmsg-->\s*?\n).*(\n\s*?<!--endmsg-->)',
rf... |
deps/ts_proto_deps.bzl | heartless-clown/rules_proto | 249 | 12783715 | <reponame>heartless-clown/rules_proto
"""
GENERATED FILE - DO NOT EDIT (created via @build_stack_rules_proto//cmd/depsgen)
"""
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install", "yarn_install")
def _maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name = name, ... |
languages/python/sqlalchemy-oso/tests/test_partial.py | connec/oso | 2,167 | 12783747 | <reponame>connec/oso
from polar import Variable
from sqlalchemy.orm import Session
from sqlalchemy_oso.partial import partial_to_filter
from .models import User
def test_partial_to_query_filter(oso, engine):
oso.load_str('ok(_: User{username:"gwen"});')
session = Session(bind=engine)
gwen = User(username=... |
src/mesh_edit.py | mbirkholzupc/hmd | 259 | 12783757 | <filename>src/mesh_edit.py
import numpy as np
from scipy import sparse
from scipy.sparse.linalg import lsqr, cg, eigsh
import matplotlib.pyplot as plt
import scipy.io as sio
import pickle
import sparseqr
import time
WEIGHT = 1.0
##############################################################
## Laplac... |
models/nlp/electra/utils.py | kevinyang8/deep-learning-models | 129 | 12783790 | <reponame>kevinyang8/deep-learning-models
from colorama import Fore, Style
def colorize(token: str, color: str) -> str:
return f"{color}{token}{Style.RESET_ALL}"
def colorize_gen(tokenizer, true_ids, gen_ids, mask):
gen_ids = gen_ids.numpy()
true_ids = true_ids.numpy()
mask = mask.numpy()
tokens... |
stable_nalu/layer/gumbel_nalu.py | wlm2019/Neural-Arithmetic-Units | 147 | 12783801 |
from .gumbel_nac import GumbelNACLayer
from .gumbel_mnac import GumbelMNACLayer
from ._abstract_nalu import AbstractNALULayer
from ._abstract_recurrent_cell import AbstractRecurrentCell
class GumbelNALULayer(AbstractNALULayer):
"""Implements the Gumbel NALU (Neural Arithmetic Logic Unit)
Arguments:
i... |
Basset/pretrained_model_reloaded_th.py | Luma-1994/lama | 137 | 12783812 | <reponame>Luma-1994/lama
import torch
import torch.nn as nn
from functools import reduce
from torch.autograd import Variable
class LambdaBase(nn.Sequential):
def __init__(self, fn, *args):
super(LambdaBase, self).__init__(*args)
self.lambda_func = fn
def forward_prepare(self, input):
... |
tests/codec.py | axsguard/sstp-server | 223 | 12783822 | <reponame>axsguard/sstp-server
#!/usr/bin/env python3
import os
import timeit
from sstpd.codec import escape, PppDecoder
decoder = PppDecoder()
def get_enscaped():
frames = [os.urandom(1500) for i in range(2)]
return b''.join([escape(f) for f in frames])
def prof_unescape():
return timeit.timeit('decod... |
skmob/utils/tests/test_gislib.py | FilippoSimini/scikit-mobility | 489 | 12783823 | from skmob.utils import gislib
import math
class TestClustering:
def setup_method(self):
self.point_1 = (43.8430139, 10.5079940)
self.point_2 = (43.5442700, 10.3261500)
self.decimal = 43.8430139
self.DMS = (43, 50, 34.85)
def test_get_distance(self):
output = gislib.... |
examples/settings.py | fakegit/googlevoice-1 | 156 | 12783867 | import pprint
from googlevoice import Voice
def run():
voice = Voice()
voice.login()
pprint.pprint(voice.settings)
__name__ == '__main__' and run()
|
examples/1_clap_for_everything.py | InnovativeInventor/pykeybasebot | 117 | 12783869 | <reponame>InnovativeInventor/pykeybasebot<gh_stars>100-1000
#!/usr/bin/env python3
###################################
# WHAT IS IN THIS EXAMPLE?
#
# This bot listens in one channel and reacts to every text message.
###################################
import asyncio
import logging
import os
import sys
import pykeyba... |
pycaption/scc/translator.py | vpaul-dev/pycaption-github-release-notes | 183 | 12783900 | from pycaption.scc.constants import CHARACTERS, SPECIAL_CHARS, EXTENDED_CHARS
ALL_CHARACTERS = {**CHARACTERS, **SPECIAL_CHARS, **EXTENDED_CHARS}
COMMAND_LABELS = {
"9420": "Resume Caption Loading",
"9429": "Resume Direct Captioning",
"9425": "Roll-Up Captions--2 Rows",
"9426": "Roll-Up Captions--3 Rows... |
tox_helpers/run_integration_tests.py | sivchand/smart_open | 2,047 | 12783915 | <reponame>sivchand/smart_open
"""Runs integration tests."""
import os
import subprocess
os.environ['PYTEST_ADDOPTS'] = "--reruns 3 --reruns-delay 1"
subprocess.check_call(
[
'pytest',
'integration-tests/test_207.py',
'integration-tests/test_http.py',
]
)
if os.environ.get('AWS_ACCESS_... |
lib/datasets/augmentation.py | ParikhKadam/HybridPose | 369 | 12783925 | import numpy as np
import cv2
import pdb
# https://github.com/zju3dv/clean-pvnet/blob/master/lib/datasets/augmentation.py
def debug_visualize(image, mask, pts2d, sym_cor, name_prefix='debug'):
from random import sample
cv2.imwrite('{}_image.png'.format(name_prefix), image * 255)
cv2.imwrite('{}_mask.png'.... |
recipes/nsimd/2.x/conanfile.py | rockandsalt/conan-center-index | 562 | 12783926 | import os
from conans import ConanFile, CMake, tools
required_conan_version = ">=1.33.0"
class NsimdConan(ConanFile):
name = "nsimd"
homepage = "https://github.com/agenium-scale/nsimd"
description = "Agenium Scale vectorization library for CPUs and GPUs"
topics = ("hpc", "neon", "cuda", "avx", "simd"... |
tests/functional/regressions/test_issue87.py | matt-koevort/tartiflette | 530 | 12783930 | import pytest
@pytest.mark.asyncio
@pytest.mark.ttftt_engine
@pytest.mark.parametrize(
"query,errors",
[
(
"""
subscription Sub {
newDog {
name
}
newHuman {
name
}
}
... |
fbchat/_events/_delta_type.py | JabLuszko/fbchat | 1,042 | 12783933 | <reponame>JabLuszko/fbchat
import attr
import datetime
from ._common import attrs_event, Event, UnknownEvent, ThreadEvent
from .. import _util, _threads, _models
from typing import Sequence, Optional
@attrs_event
class ColorSet(ThreadEvent):
"""Somebody set the color in a thread."""
#: The new color. Not li... |
distributed/protocol/tests/test_highlevelgraph.py | crusaderky/distributed | 1,358 | 12783934 | <gh_stars>1000+
import ast
import pytest
import dask
import dask.array as da
import dask.dataframe as dd
from distributed.diagnostics import SchedulerPlugin
from distributed.utils_test import gen_cluster
np = pytest.importorskip("numpy")
pd = pytest.importorskip("pandas")
from numpy.testing import assert_array_equ... |
dreamplace/ops/electric_potential/electric_overflow.py | Eternity666/DREAMPlace | 323 | 12783956 | ##
# @file electric_overflow.py
# @author <NAME>
# @date Aug 2018
#
import math
import numpy as np
import torch
from torch import nn
from torch.autograd import Function
from torch.nn import functional as F
import dreamplace.ops.electric_potential.electric_potential_cpp as electric_potential_cpp
import dreamplace.... |
tests/test_dataflow/multiwoz/conftest.py | luweishuang/task_oriented_dialogue_as_dataflow_synthesis | 257 | 12783974 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Any, Dict, List, Tuple
import pytest
from dataflow.multiwoz.trade_dst_utils import BeliefState
def convert_belief_dict_to_belief_state(belief_dict: Dict[str, str]) -> BeliefState:
belief_state: BeliefState = []
for... |
chapter5_operations/prediction_monitoring_pattern/src/configurations.py | sudabon/ml-system-in-actions | 133 | 12783983 | import os
from logging import getLogger
from src.constants import CONSTANTS, PLATFORM_ENUM
logger = getLogger(__name__)
class PlatformConfigurations:
platform = os.getenv("PLATFORM", PLATFORM_ENUM.DOCKER.value)
if not PLATFORM_ENUM.has_value(platform):
raise ValueError(f"PLATFORM must be one of {[v.... |
tests/messages_data/mime_emails/raw_email7.py | unqx/imap_tools | 344 | 12784029 | <gh_stars>100-1000
import datetime
from imap_tools import EmailAddress
DATA = dict(
subject='testing',
from_='<EMAIL>',
to=('<EMAIL>',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2005, 6, 6, 22, 21, 22, tzinfo=datetime.timezone(datetime.timedelta(0, 7200))),
date_str='Mon, 6 Ju... |
src/prefect/environments/execution/__init__.py | vnsn/prefect | 8,633 | 12784051 | """
Execution environments encapsulate the logic for where your Flow should execute in Prefect Cloud.
DEPRECATED: Environment based configuration is deprecated, please transition to
configuring `flow.run_config` instead of `flow.environment`. See
https://docs.prefect.io/orchestration/flow_config/overview.html for more... |
common/test/test_signing_serializer.py | andkononykhin/plenum | 148 | 12784073 | <gh_stars>100-1000
from collections import OrderedDict
import pytest
from common.serializers.serialization import serialize_msg_for_signing
def test_serialize_int():
assert b"1" == serialize_msg_for_signing(1)
def test_serialize_str():
assert b"aaa" == serialize_msg_for_signing("aaa")
def test_serialize... |
src/UnloadAutoPartitions/genunload.py | rmcelroyF8/amazon-redshift-utils | 2,452 | 12784085 | <reponame>rmcelroyF8/amazon-redshift-utils<gh_stars>1000+
"""
GenUnload : Generate unload commands given a config file (config.ini) which has information about table, schema, partition column & sort columns
-----------------------------------------------------------------------------------------------------------------... |
scripts/contractInteraction/config.py | omerzam/Sovryn-smart-contracts | 108 | 12784098 | from brownie import *
from brownie.network.contract import InterfaceContainer
import json
def loadConfig():
global contracts, acct
thisNetwork = network.show_active()
if thisNetwork == "development":
acct = accounts[0]
configFile = open('./scripts/contractInteraction/testnet_contracts.json... |
social_core/backends/fedora.py | shnaqawi/social-core | 745 | 12784099 | <filename>social_core/backends/fedora.py<gh_stars>100-1000
"""
Fedora OpenId backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/fedora.html
"""
from .open_id import OpenIdAuth
class FedoraOpenId(OpenIdAuth):
name = 'fedora'
URL = 'https://id.fedoraproject.org'
USERNAME_KEY ... |
pytorch_ares/third_party/free_adv_train/free_train.py | thu-ml/realsafe | 107 | 12784137 | <reponame>thu-ml/realsafe
"""Trains a model, saving checkpoints and tensorboard summaries along
the way."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os
import shutil
from timeit import default_timer as ... |
ogb_lsc/pcq/conformer_utils.py | kawa-work/deepmind-research | 10,110 | 12784149 | # Copyright 2021 DeepMind Technologies 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
fkie_node_manager/src/fkie_node_manager/nmd_client/__init__.py | JOiiNT-LAB/multimaster_fkie | 194 | 12784152 | <filename>fkie_node_manager/src/fkie_node_manager/nmd_client/__init__.py
# Software License Agreement (BSD License)
#
# Copyright (c) 2018, Fraunhofer FKIE/CMS, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following ... |
utils/wfuzzbasicauthbrute/wfuzz/framework/core/myexception.py | ismailbozkurt/kubebot | 171 | 12784184 |
class FuzzException(Exception):
FATAL, SIGCANCEL = range(2)
def __init__(self, etype, msg):
self.etype = etype
self.msg = msg
Exception.__init__(self, msg)
|
tests/core/trio/test_trio_endpoint_compat_with_asyncio.py | gsalgado/lahja | 400 | 12784192 | <filename>tests/core/trio/test_trio_endpoint_compat_with_asyncio.py<gh_stars>100-1000
import asyncio
import multiprocessing
import pytest
from lahja.asyncio import AsyncioEndpoint
from lahja.common import BaseEvent, ConnectionConfig
class EventTest(BaseEvent):
def __init__(self, value):
self.value = val... |
lib/WindowParent.py | aganders3/python-0.9.1 | 116 | 12784203 | # A 'WindowParent' is the only module that uses real stdwin functionality.
# It is the root of the tree.
# It should have exactly one child when realized.
import stdwin
from stdwinevents import *
from TransParent import ManageOneChild
Error = 'WindowParent.Error' # Exception
class WindowParent() = ManageOneChild():... |
ansible/roles/lib_gcloud/build/src/gcloud_compute_projectinfo.py | fahlmant/openshift-tools | 164 | 12784209 | # pylint: skip-file
class GcloudComputeProjectInfoError(Exception):
'''exception class for projectinfo'''
pass
# pylint: disable=too-many-instance-attributes
class GcloudComputeProjectInfo(GcloudCLI):
''' Class to wrap the gcloud compute projectinfo command'''
# pylint allows 5
# pylint: disable=... |
examples/optimizers/swarm/create_ffoa.py | anukaal/opytimizer | 528 | 12784220 | from opytimizer.optimizers.swarm import FFOA
# Creates a FFOA optimizer
o = FFOA()
|
pyorient/ogm/vertex.py | spy7/pyorient | 142 | 12784239 | <reponame>spy7/pyorient
from .element import GraphElement
from .broker import VertexBroker
class Vertex(GraphElement):
Broker = VertexBroker
# TODO
# Edge information is carried in vertexes retrieved from database,
# as OrientBinaryObject. Can likely optimise these traversals
# when we know how to... |
external_push/admin.py | fossabot/fermentrack | 114 | 12784243 | <reponame>fossabot/fermentrack
from django.contrib import admin
from external_push.models import GenericPushTarget, BrewersFriendPushTarget, BrewfatherPushTarget, ThingSpeakPushTarget, GrainfatherPushTarget
@admin.register(GenericPushTarget)
class GenericPushTargetAdmin(admin.ModelAdmin):
list_display = ('name',... |
scripts/UtilitiesConvertCharacter.py | CrackerCat/pwndra | 524 | 12784255 | # Convert an operand to characters
#@author b0bb
#@category Pwn
#@keybinding shift r
#@menupath Analysis.Pwn.Utilities.Convert to Char
#@toolbar
import ghidra.app.cmd.equate.SetEquateCmd as SetEquateCmd
import ghidra.program.util.OperandFieldLocation as OperandFieldLocation
import ghidra.program.model.lang.OperandTyp... |
rllab/envs/mujoco/hill/terrain.py | RussellM2020/maml_gps | 1,838 | 12784266 | from scipy.stats import multivariate_normal
from scipy.signal import convolve2d
import matplotlib
try:
matplotlib.pyplot.figure()
matplotlib.pyplot.close()
except Exception:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os
# the colormap should assign light colors to low ... |
FaceTime/frida/replay.py | googleprojectzero/Street-Party | 226 | 12784273 | # Copyright 2018 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
import frida
import sys
import os
vid_index=0
aud_index = 0
d... |
test/rql_test/drivers/driver_test.py | zadcha/rethinkdb | 21,684 | 12784280 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from driver import bag, compare, err, err_regex, partial, uuid
class PythonTestDriverTest(unittest.TestCase):
def compare(self, expected, result, options=None):
self.assertTrue(compare(expected, result, options=options))
def compareFals... |
tests/unit/test_order.py | Aspire1Inspire2/td-ameritrade-python-api | 610 | 12784290 | <gh_stars>100-1000
import unittest
import td.enums as td_enums
from unittest import TestCase
from configparser import ConfigParser
from td.orders import Order
from td.orders import OrderLeg
from td.client import TDClient
from td.stream import TDStreamerClient
class TDSession(TestCase):
"""Will perform a unit t... |
core/polyaxon/polyboard/processors/logs_processor.py | admariner/polyaxon | 3,200 | 12784338 | <filename>core/polyaxon/polyboard/processors/logs_processor.py
# !/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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.ap... |
unstrip.py | pzread/unstrip | 103 | 12784395 | <reponame>pzread/unstrip
import sys
import sqlite3
import msgpack
from scan import *
from mark import *
if __name__ == '__main__':
conn = sqlite3.connect('fin.db')
try:
conn.execute('CREATE TABLE flowfin (label text primary key,len int,fin blob,hash text);')
conn.execute('CREATE INDEX index_flo... |
src/meltano/core/job/finder.py | siilats/meltano | 122 | 12784416 | <reponame>siilats/meltano
"""Defines JobFinder."""
from datetime import datetime, timedelta
from .job import HEARTBEAT_VALID_MINUTES, HEARTBEATLESS_JOB_VALID_HOURS, Job, State
class JobFinder:
"""
Query builder for the `Job` model for a certain `elt_uri`.
"""
def __init__(self, job_id: str):
... |
tasks/admin.py | housepig7/ops | 394 | 12784427 | <reponame>housepig7/ops
from django.contrib import admin
# Register your models here.
from .models import history,toolsscript
admin.site.register(history)
admin.site.register(toolsscript) |
sdk/search/azure-search-documents/tests/test_index_documents_batch.py | rsdoherty/azure-sdk-for-python | 2,728 | 12784432 | <gh_stars>1000+
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
from azure.search.documents.models import IndexAction
from azure.search.documents import IndexDocumentsBatch
METHOD_NAMES = [
"add_... |
src/ostorlab/agent/message/proto/v2/report/status_pb2.py | bbhunter/ostorlab | 113 | 12784475 | <reponame>bbhunter/ostorlab<gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v2/report/status.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import messag... |
memory/memory_object.py | nbanmp/seninja | 109 | 12784504 | <gh_stars>100-1000
from ..expr import BV, BVArray, Bool, ITE
class MemoryObj(object):
def __init__(self, name, bits=64, bvarray=None):
self.bvarray = BVArray(
"MEMOBJ_" + name, bits, 8
) if bvarray is None else bvarray
self.name = name
self.bits = bits
def __str__... |
tests/frequentist/test_bounds.py | danielsaaf/confidence | 107 | 12784518 | import pytest
import time
import numpy as np
from spotify_confidence.analysis.frequentist.confidence_computers.z_test_computer import sequential_bounds
@pytest.mark.skip(reason="Skipping because this test is very slow")
def test_many_days():
"""
This input (based on a real experiment) is very long, which can ... |
m2-modified/ims/common/agentless-system-crawler/tests/functional/test_functional_plugins.py | CCI-MOC/ABMI | 108 | 12784538 | <reponame>CCI-MOC/ABMI
import shutil
import tempfile
import unittest
import docker
import requests.exceptions
from plugins.systems.cpu_container_crawler import CpuContainerCrawler
from plugins.systems.cpu_host_crawler import CpuHostCrawler
from plugins.systems.memory_container_crawler import MemoryContainerCrawler
fro... |
src/std/rfc4566.py | ojimary/titus | 108 | 12784562 | <reponame>ojimary/titus<gh_stars>100-1000
# Copyright (c) 2007, <NAME>. All rights reserved. See LICENSING for details.
# @implements RFC4566 (SDP)
import socket, time
class attrs(object):
'''A generic class that allows uniformly accessing the attribute and items,
and returns None for invalid attribute... |
alipay/aop/api/response/AlipayFundTransAacollectBatchQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 12784568 | <filename>alipay/aop/api/response/AlipayFundTransAacollectBatchQueryResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.BatchDetailInfo import BatchDetailInfo
from alipay.aop.api.domain.BatchDetailInfo import... |
asymmetric_cryptography/asymmetric.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 12784572 | from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys(modulus_length=256*4):
privatekey = RSA.generate(modulus_length, Random.new().read)
publickey = privatekey.publickey()
return privatekey, publickey
def encryptit(message , publickey):
encrypted_msg = publickey... |
airflow/providers/trino/transfers/gcs_to_trino.py | npodewitz/airflow | 8,092 | 12784619 | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
gtsfm/two_view_estimator.py | swershrimpy/gtsfm | 122 | 12784624 | <reponame>swershrimpy/gtsfm
"""Estimator which operates on a pair of images to compute relative pose and verified indices.
Authors: <NAME>, <NAME>
"""
import logging
from typing import Dict, Optional, Tuple
import dask
import numpy as np
from dask.delayed import Delayed
from gtsam import Cal3Bundler, Pose3, Rot3, Uni... |
filters/tests/test_mixins.py | jof/drf-url-filters | 176 | 12784644 | <filename>filters/tests/test_mixins.py
import unittest
from filters.mixins import FiltersMixin
class MyTest(unittest.TestCase):
def test(self):
self.assertEqual(4, 4)
|
tower_cli/cli/action.py | kedark3/tower-cli | 363 | 12784652 | <filename>tower_cli/cli/action.py<gh_stars>100-1000
# Copyright 2017, Ansible by Red Hat
# <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/licen... |
codegen_sources/test_generation/test_runners/python_test_runner.py | AlexShypula/CodeGen | 241 | 12784664 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
import os
import subprocess
import sys
import uuid
from pathlib import Path, PosixPath
from subprocess import Popen
from .evosu... |
bin/generate_sitemap.py | gaybro8777/CiteSeerX | 108 | 12784671 | #!/usr/bin/python
# Script to generate sitemaps
# <NAME>
# Requires mysql-python
import MySQLdb
import argparse
import logging
import os
import sys
import subprocess
from config import db
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument("sitemapdir")
args = parser.parse_a... |
OpenDataCatalog/contest/views.py | runonthespot/Open-Data-Catalog | 105 | 12784676 | from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.template.loader import render_to_string
from django.core.mail import send_mail, mail_managers, EmailMessage
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from ... |
release/stubs.min/Tekla/Structures/ModelInternal_parts/dotBooleanPart_t.py | htlcnn/ironpython-stubs | 182 | 12784741 | <filename>release/stubs.min/Tekla/Structures/ModelInternal_parts/dotBooleanPart_t.py
class dotBooleanPart_t(object):
# no doc
Boolean=None
OperativePart=None
Type=None
|
netdev/vendors/cisco/cisco_asa.py | maliciousgroup/netdev | 199 | 12784744 | <reponame>maliciousgroup/netdev
"""Subclass specific to Cisco ASA"""
import re
from netdev.logger import logger
from netdev.vendors.ios_like import IOSLikeDevice
class CiscoASA(IOSLikeDevice):
"""Class for working with Cisco ASA"""
def __init__(self, *args, **kwargs):
"""
Initi... |
examples/basic_observer.py | ddunmire/python-bleson | 103 | 12784767 | <reponame>ddunmire/python-bleson
#!/usr/bin/env python3
import sys
from time import sleep
from bleson import get_provider, Observer
# Get the wait time from the first script argument or default it to 10 seconds
WAIT_TIME = int(sys.argv[1]) if len(sys.argv)>1 else 10
def on_advertisement(advertisement):
print(ad... |
usaspending_api/download/tests/unit/test_zip_file.py | g4brielvs/usaspending-api | 217 | 12784771 | <filename>usaspending_api/download/tests/unit/test_zip_file.py
import os
import zipfile
from tempfile import NamedTemporaryFile
from usaspending_api.download.filestreaming.zip_file import append_files_to_zip_file
def test_append_files_to_zip_file():
with NamedTemporaryFile() as zip_file:
with NamedTempor... |
google/colab/_import_magics.py | figufema/TesteClone | 1,521 | 12784861 | <filename>google/colab/_import_magics.py
# Copyright 2020 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... |
examples/composite_keys/testdata.py | NeolithEra/Flask-AppBuilder | 3,862 | 12784877 | import logging
from app import db
from app.models import Inventory, Datacenter, Rack, Item
import random
import string
from datetime import datetime
log = logging.getLogger(__name__)
DC_RACK_MAX = 20
ITEM_MAX = 1000
cities = ["Lisbon", "Porto", "Madrid", "Barcelona", "Frankfurt", "London"]
models = ["Server MX", "S... |
fhir/resources/DSTU2/substance.py | cstoltze/fhir.resources | 144 | 12784890 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/DSTU2/substance.html
Release: DSTU2
Version: 1.0.2
Revision: 7202
"""
from typing import List as ListType
from pydantic import Field
from . import domainresource, fhirtypes
from .backboneelement import BackboneElement
class Substance(domainresource.DomainReso... |
fabric_bolt/projects/migrations/0003_auto_20150911_1911.py | jooni22/fabric-bolt | 219 | 12784920 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('hosts', '0002_sshconfig'),
('projects', '0002_auto_20140912_1509'),
]
operations = [
migrations.AddField(
... |
examples/text_scroll.py | paddywwoof/python-sense-hat | 104 | 12784941 | <reponame>paddywwoof/python-sense-hat<gh_stars>100-1000
#!/usr/bin/python
from sense_hat import SenseHat
sense = SenseHat()
sense.set_rotation(180)
red = (255, 0, 0)
sense.show_message("One small step for Pi!", text_colour=red)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.