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 |
|---|---|---|---|---|
services/ssh/create_60_sec_jwt.py | jrsouth/lagoon | 418 | 112964 | #!/usr/bin/env python3
import os
import jwt
from datetime import datetime, timezone, timedelta
iat = datetime.now(timezone.utc)
exp = iat + timedelta(minutes=1)
payload = {'exp': exp, 'iat': iat, 'role': 'admin', 'aud': os.environ['JWTAUDIENCE'], 'sub': 'ssh'}
print(jwt.encode(payload, os.environ['JWTSECRET'], algor... |
dialogue-engine/src/programy/clients/restful/yadlan/flask/client.py | cotobadesign/cotoba-agent-oss | 104 | 112969 | <reponame>cotobadesign/cotoba-agent-oss
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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 u... |
util/compute_bootstrap.py | AnneBeyer/tgen | 222 | 112975 | <filename>util/compute_bootstrap.py
#!/usr/bin/env python
# -"- coding: utf-8 -"-
from argparse import ArgumentParser
import os
import re
from subprocess import call
from tgen.logf import log_info
MY_PATH = os.path.dirname(os.path.abspath(__file__))
def lcall(arg_str):
log_info(arg_str)
return call(arg_str... |
vilya/views/settings/codereview.py | mubashshirjamal/code | 1,582 | 112981 | # -*- coding: utf-8 -*-
import json
from vilya.libs.auth.decorators import login_required
from vilya.libs.template import st
_q_exports = ['setting', ]
@login_required
def _q_index(request):
user = request.user
return st('settings/codereview.html', **locals())
@login_required
def setting(request):
is_... |
neo/io/intanio.py | Mario-Kart-Felix/python-neo | 199 | 113038 | <filename>neo/io/intanio.py
from neo.io.basefromrawio import BaseFromRaw
from neo.rawio.intanrawio import IntanRawIO
class IntanIO(IntanRawIO, BaseFromRaw):
__doc__ = IntanRawIO.__doc__
_prefered_signal_group_mode = 'group-by-same-units'
def __init__(self, filename):
IntanRawIO.__init__(self, fil... |
bfxapi/models/trade.py | uggel/bitfinex-api-py | 162 | 113066 | <filename>bfxapi/models/trade.py<gh_stars>100-1000
"""
Module used to describe all of the different data types
"""
import datetime
class TradeModel:
"""
Enum used to index the different values in a raw trade array
"""
ID = 0
PAIR = 1
MTS_CREATE = 2
ORDER_ID = 3
EXEC_AMOUNT = 4
EXEC... |
examples/sample_program.py | GProulx/PyCuber | 199 | 113100 | import sys
import os
import pycuber as pc
from pycuber.solver import CFOPSolver
c = pc.Cube()
alg = pc.Formula()
random_alg = alg.random()
c(random_alg)
solver = CFOPSolver(c)
solution = solver.solve(suppress_progress_messages=True)
print(solution)
|
tests/attacks/test_adversarial_embedding.py | monshri/adversarial-robustness-toolbox | 1,350 | 113101 | <filename>tests/attacks/test_adversarial_embedding.py
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# 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 wit... |
scripts/pretrain.py | yihui-he/longformer | 1,458 | 113129 | import argparse
import glob
import os
import random
import logging
import numpy as np
import math
from tqdm import tqdm
import time
import torch
from transformers import AutoTokenizer, AutoModelForMaskedLM
from transformers import DataCollatorForLanguageModeling
from transformers.optimization import AdamW, get_linear_s... |
model/utils/pad.py | UmaTaru/run | 163 | 113159 | import torch
from torch.autograd import Variable
from .convert import to_var
from .vocab import PAD_TOKEN, SOS_TOKEN, EOS_TOKEN
def pad(tensor, length, dtype=None):
if isinstance(tensor, Variable):
var = tensor
if length > var.size(0):
return torch.cat(
[var, torch.zero... |
python/v2.6/configure_dynamic_asset_selection.py | byagihas/googleads-dfa-reporting-samples | 103 | 113187 | <reponame>byagihas/googleads-dfa-reporting-samples
#!/usr/bin/python
#
# Copyright 2016 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.ap... |
uxy/uxy_du.py | sustrik/uxy | 735 | 113221 | # Copyright (c) 2019 <NAME>
#
# 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, distrib... |
newm/hysteresis.py | sadrach-cl/newm | 265 | 113223 | from __future__ import annotations
import math
class Hysteresis:
def __init__(self, amount: float, initial_value: float):
self._amount = amount
self._at = round(initial_value)
def __call__(self, value: float) -> int:
i, j = math.floor(value), math.ceil(value)
if self._at != i ... |
saas/system/api/resource/backend-framework/webpy/tesla-faas/teslafaas/server_entry/webapp/proxy_handler.py | iuskye/SREWorks | 407 | 113239 | #!/usr/bin/env python
# encoding: utf-8
""" """
from common.decorators import exception_wrapper
__author__ = 'adonis'
import re
import httplib
import urllib
import web
import requests
import requests_unixsocket
import logging
from teslafaas.common.const import ALL_HEADERS, NON_WSGI_HEADER
from teslafaas.common.util_... |
tests/integration/test_run_distillation_agent.py | medipixel/rl_algorithms | 466 | 113262 | <filename>tests/integration/test_run_distillation_agent.py
"""Test only one step of distillation file for training."""
import os
import pickle
import re
import shutil
import subprocess
def check_distillation_agent(config: str, run_file: str):
"""Test that 1 episode of run file works well."""
cmd = (
... |
tools/lib-alert-tree/metalk8s/__init__.py | SaintLoong/metalk8s | 255 | 113299 | <filename>tools/lib-alert-tree/metalk8s/__init__.py
"""MetalK8s hierarchy of alerts."""
from lib_alert_tree.models import Relationship, severity_pair
from lib_alert_tree.prometheus import PrometheusRule
from .network import NETWORK_WARNING
from .nodes import NODE_WARNING, NODE_CRITICAL
from .platform import PLATFORM_... |
azure/core/pipeline/transport/_base_async.py | adityasingh1993/azure-core | 2,728 | 113310 | # --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""), ... |
social/backends/openstreetmap.py | raccoongang/python-social-auth | 1,987 | 113312 | from social_core.backends.openstreetmap import OpenStreetMapOAuth
|
internal/usecases/metafunctions/metafunctions.py | HEmile/problog | 189 | 113339 | <reponame>HEmile/problog
"""
Module name
"""
testprogram = """
a(1).
a(2).
b(1,2).
b(2,3).
c(2,6).
c(3,4).
c(3,5).
d(5).
q(X,Z) :- @f(a(X),b(X,Y)), c(Y,Z), @g(d(Z)).
query(q(_,_)).
"""
from problog.engine import DefaultEngine
from problog.program import PrologString
from prob... |
docs/examples/data_access/django/example/app/test_app.py | connec/oso | 2,167 | 113380 | import pytest
from django_oso.models import AuthorizedModel, authorize_model
from django_oso.oso import Oso, reset_oso
from django.core.management import call_command
from app.models import Post, User
@pytest.fixture(autouse=True)
def reset():
reset_oso()
@pytest.fixture
def users():
(manager, _) = User.o... |
config/config.py | vovanphuc/hum2song | 108 | 113393 | class Config(object):
env = 'default'
backbone = 'resnet18'
classify = 'softmax'
num_classes = 5000
metric = 'arc_margin'
easy_margin = False
use_se = False
loss = 'focal_loss'
display = False
finetune = False
meta_train = '/preprocessed/train_meta.csv'
train_root = '/p... |
tests/r/test_slid.py | hajime9652/observations | 199 | 113404 | <reponame>hajime9652/observations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.slid import slid
def test_slid():
"""Test module slid.py by downloading
slid.csv and testing shape of
ex... |
tock/projects/templatetags/project_tags.py | mikiec84/tock | 134 | 113486 | from django import template
register = template.Library()
def get(value, key):
return value.get(key)
register.filter('get', get)
|
azure-devops/azext_devops/devops_sdk/v6_0/pipelines_checks/__init__.py | dhilmathy/azure-devops-cli-extension | 248 | 113603 | <reponame>dhilmathy/azure-devops-cli-extension
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------... |
helpers/labml_helpers/datasets/remote/test/mnist_server.py | mcx/labml | 174 | 113625 | <reponame>mcx/labml<gh_stars>100-1000
from labml import lab
from labml_helpers.datasets.remote import DatasetServer
from torchvision import datasets, transforms
def main():
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))
])
train_dataset ... |
test/dlc_tests/benchmark/bai/mxnet/training/test_performance_mxnet_training.py | Elizaaaaa/deep-learning-containers | 383 | 113647 | import re
import pytest
from invoke.context import Context
from test.test_utils.benchmark import execute_single_node_benchmark, get_py_version
@pytest.mark.skip(reason="Temp skip due to timeout")
@pytest.mark.model("resnet18_v2")
@pytest.mark.integration("cifar10 dataset")
def test_performance_mxnet_cpu(mxnet_traini... |
recipes/Python/277099_Rss_aggregator_with_twisted/recipe-277099.py | tdiprima/code | 2,023 | 113675 | <gh_stars>1000+
from twisted.internet import reactor, protocol, defer
from twisted.web import client
import feedparser, time, sys
# You can get this file from http://xoomer.virgilio.it/dialtone/out.py
# Since it's only a list of URLs made in this way:
# out = [ ( 'URL', 'EXTRA_INFOS'),
# ( 'URL', 'EXTRA_INFO... |
test_project/tst/models.py | babayko/django-fias | 108 | 113686 | <gh_stars>100-1000
from django.db import models
# Create your models here.
from fias.fields import AddressField, ChainedAreaField
from fias.models import AddrObj, FIASAddress, FIASAddressWithArea, FIASHouse
class Item(models.Model):
title = models.CharField('title', max_length=100)
location = AddressF... |
eg/eg_exec.py | sbienkow/eg | 1,389 | 113702 | # In eg 0.0.x, this file could be used to invoke eg directly, without installing
# via pip. Eg 0.1.x switched to also support python 3. This meant changing the
# way imports were working, which meant this script had to move up a level to be
# a sibling of the eg module directory. This file will exist for a time in orde... |
siammot/modelling/track_head/EMM/sr_pool.py | pha-nguyen/siam-mot | 399 | 113720 | import torch
from torch import nn
from maskrcnn_benchmark.modeling.poolers import LevelMapper
from maskrcnn_benchmark.modeling.utils import cat
from maskrcnn_benchmark.layers import ROIAlign
class SRPooler(nn.Module):
"""
SRPooler for Detection with or without FPN.
Also, the requirement of passing the sc... |
examples/issues/issue249.py | tgolsson/appJar | 666 | 113726 | <gh_stars>100-1000
import sys
sys.path.append("../../")
from appJar import gui
def DoExit(opt):
if app.yesNoBox("Confirm exit","Exit sub window now?", parent="SUB1"):
app.hideSubWindow("SUB1")
with gui("Example","400x200") as app:
app.setLocation(100,100)
with app.subWindow("SUB1", modal=True):
... |
languages/python/oso/polar/__main__.py | connec/oso | 2,167 | 113736 | <reponame>connec/oso
import sys
from .polar import Polar
Polar().repl(files=sys.argv[1:])
|
skidl/libs/msp430_sklib.py | arjenroodselaar/skidl | 700 | 113780 | <filename>skidl/libs/msp430_sklib.py
from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
msp430 = SchLib(tool=SKIDL).add_parts(*[
Part(name='MSP430AFE221IPW',dest=TEMPLATE,tool=SKIDL,keywords='MSP430 MIXED SIGNAL MICROCONTROLLER',description='24pin TSSOP, 16KB Flash Memory, 512B R... |
src/genie/libs/parser/junos/tests/ShowChassisPower/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 113799 | expected_output = {
'power-usage-information': {
'power-usage-item': [
{
'name': '<NAME>',
'state': 'Online',
'dc-input-detail2': {
'dc-input-status':
'OK (INP0 feed expected, INP0 feed connected)'
... |
tests/test_environment.py | kasium/alembic | 1,324 | 113846 | <gh_stars>1000+
#!coding: utf-8
import os
import sys
from alembic import command
from alembic import testing
from alembic import util
from alembic.environment import EnvironmentContext
from alembic.migration import MigrationContext
from alembic.script import ScriptDirectory
from alembic.testing import config
from alem... |
stocklook/apis/twitah.py | zbarge/stocklook | 149 | 113872 | """
MIT License
Copyright (c) 2017 <NAME>
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, distri... |
esphome/components/cs5460a/sensor.py | OttoWinter/esphomeyaml | 249 | 113877 | import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import spi, sensor
from esphome.const import (
CONF_CURRENT,
CONF_ID,
CONF_POWER,
CONF_VOLTAGE,
UNIT_VOLT,
UNIT_AMPERE,
UNIT_WATT,
DEVICE_CLASS_POWER,
DEVICE_CLASS_CURRENT,
DEVICE_CLASS_VO... |
jmetal/algorithm/singleobjective/__init__.py | 12yuens2/jMetalPy | 335 | 113912 | from .evolution_strategy import EvolutionStrategy
from .genetic_algorithm import GeneticAlgorithm
from .local_search import LocalSearch
from .simulated_annealing import SimulatedAnnealing
|
test/unit/test_unpack.py | timmartin/skulpt | 2,671 | 113939 | # Unpack tests from CPython converted from doctest to unittest
import unittest
class UnpackTest(unittest.TestCase):
def test_basic(self):
t = (1, 2, 3)
a, b, c = t
self.assertEqual(a, 1)
self.assertEqual(b, 2)
self.assertEqual(c, 3)
l = [4, 5, 6]
a, b, c =... |
discodo/server/__init__.py | eunwoo1104/discodo | 105 | 113944 | from .server import app as server
|
.modules/.recon-ng/modules/recon/locations-pushpins/twitter.py | termux-one/EasY_HaCk | 1,103 | 113976 | from recon.core.module import BaseModule
from datetime import datetime
from urlparse import parse_qs
class Module(BaseModule):
meta = {
'name': 'Twitter Geolocation Search',
'author': '<NAME> (@LaNMaSteR53)',
'description': 'Searches Twitter for media in the specified proximity to a locati... |
protos/__init__.py | oktoshi/OpenBazaar-Server | 723 | 114036 | __author__ = 'chris'
"""
Package for holding all of our protobuf classes
"""
|
flask/app.py | vdaytona/statistical-arbitrage-18-19 | 163 | 114113 | # import os
# from flask import Flask, render_template, send_from_directory
# app = Flask(__name__)
# @app.route("/")
# def index():
# return render_template("index.html")
# if __name__ == '__main__':
# app.run(debug = True)
# === bokeh demo at below ===
# embedding the graph to html
from flask ... |
tests/migrations/0010_song.py | ababic/django-modelcluster | 278 | 114117 | # Generated by Django 2.1.5 on 2019-01-17 21:49
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('tests', '0009_article_related_articles'),
]
operations = [
migrations.CreateMode... |
backend/model/user_token.py | LiangTang1993/Icarus | 686 | 114125 | <gh_stars>100-1000
"""
token
fingerprint
useragent
expire_time
ip
"""
import binascii
import os
import time
from typing import Optional
import peewee
from peewee import TextField, BigIntegerField, BlobField
from slim.utils import to_bin, get_bytes_from_blob
from model import StdUserModel, INETField, db
class UserTo... |
pywraps/py_kernwin_idaview.py | fengjixuchui/src | 1,160 | 114128 |
#<pycode(py_kernwin_idaview)>
#-------------------------------------------------------------------------
# IDAViewWrapper
#-------------------------------------------------------------------------
import _ida_kernwin
class IDAViewWrapper(CustomIDAMemo):
"""
Deprecated. Use View_Hook... |
tests/compare_messages.py | matan-h/friendly | 287 | 114140 | <gh_stars>100-1000
"""Compare messages for exceptions other than SyntaxError"""
import messages_3_6
import messages_3_7
import messages_3_8
import messages_3_9
import messages_3_10
info_36 = messages_3_6.messages
info_37 = messages_3_7.messages
info_38 = messages_3_8.messages
info_39 = messages_3_9.messages
info_310 =... |
source/remediation_runbooks/scripts/GetPublicEBSSnapshots.py | sybeck2k/aws-security-hub-automated-response-and-remediation | 129 | 114178 | <filename>source/remediation_runbooks/scripts/GetPublicEBSSnapshots.py
#!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
aetros/commands/StartSimpleCommand.py | aetros/aetros-cli | 120 | 114181 | <filename>aetros/commands/StartSimpleCommand.py
from __future__ import absolute_import
from __future__ import print_function
import argparse
import sys
from aetros.starter import start_keras
from aetros.backend import JobBackend
from aetros.utils import unpack_full_job_id
class StartSimpleCommand:
def __init__(... |
veinmind-backdoor/plugins/service.py | Jqqzzz/veinmind-tools | 364 | 114232 | <gh_stars>100-1000
from register import register
from common import *
import os
import re
@register.register("service")
class service():
service_dir_list = ["/etc/systemd/system"]
def detect(self, image):
results = []
for service_dir in self.service_dir_list:
for root, dirs, files... |
tests/integration/optimizers/test_optimizer_pod_choice.py | Rohitpandit021/jina | 15,179 | 114236 | import os
import pytest
from jina import Document
from jina.optimizers import FlowOptimizer, EvaluationCallback
from jina.optimizers.flow_runner import SingleFlowRunner
cur_dir = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def config(tmpdir):
os.environ['JINA_OPTIMIZER_WORKSPACE_DIR'] = str(tmpd... |
pymtl3/dsl/Placeholder.py | kevinyuan/pymtl3 | 152 | 114252 | """
========================================================================
Placeholder.py
========================================================================
Author : <NAME>
Date : June 1, 2019
"""
class Placeholder:
pass
|
indra/tests/test_hprd.py | zebulon2/indra | 136 | 114261 | from os.path import join, abspath, dirname
from nose.tools import raises
from indra.statements import Complex, Phosphorylation
from indra.sources import hprd
test_dir = join(abspath(dirname(__file__)), 'hprd_tests_data')
id_file = join(test_dir, 'HPRD_ID_MAPPINGS.txt')
def test_process_complexes():
cplx_file ... |
test/dot_index_test.py | ohld/annoy | 9,609 | 114361 | # Copyright (c) 2018 Spotify AB
#
# 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, s... |
mctorch/optim/rsgd.py | SatyadevNtv/mctorch | 188 | 114372 | import torch
from torch.optim.optimizer import Optimizer, required
from torch.optim import SGD
class rSGD(SGD):
def __init__(self, params, lr=required, momentum=0, dampening=0,
weight_decay=0, nesterov=False):
super(rSGD, self).__init__(params, lr=lr, momentum=momentum,
... |
SMPyBandits/Policies/UCBH.py | balbok0/SMPyBandits | 309 | 114456 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
""" The UCB-H policy for bounded bandits, with knowing the horizon.
Reference: [Audibert et al. 09].
"""
__author__ = "<NAME>"
__version__ = "0.6"
from numpy import sqrt, log
import numpy as np
np.seterr(divide='ignore') # XXX dangerous in general, controlled here!
try:
... |
code/engram_functions.py | Apsu/engram | 103 | 114458 | # %load code/engram_functions.py
# Import dependencies
import xlrd
import numpy as np
from sympy.utilities.iterables import multiset_permutations
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
def permute_optimize_keys(fixed_letters, fixed_letter_indices, open_letter_indices,
... |
siuba/sql/translate.py | tmastny/siuba | 831 | 114501 | """
This module holds default translations from pandas syntax to sql for 3 kinds of operations...
1. scalar - elementwise operations (e.g. array1 + array2)
2. aggregation - operations that result in a single number (e.g. array1.mean())
3. window - operations that do calculations across a window
(e.g. array... |
src/ostorlab/apis/agent_details.py | bbhunter/ostorlab | 113 | 114502 | """Get agent details from the public api."""
import json
from typing import Dict, Optional
from ostorlab.apis import request
class AgentDetailsAPIRequest(request.APIRequest):
"""Get agent details for a specified agent_key."""
def __init__(self, agent_key: str) -> None:
"""Initializer"""
self... |
bnpy/allocmodel/__init__.py | raphael-group/bnpy | 184 | 114506 | <gh_stars>100-1000
from bnpy.allocmodel.AllocModel import AllocModel
from bnpy.allocmodel.mix.FiniteMixtureModel import FiniteMixtureModel
from bnpy.allocmodel.mix.DPMixtureModel import DPMixtureModel
from bnpy.allocmodel.mix.DPMixtureRestrictedLocalStep import make_xPiVec_and_emptyPi
from bnpy.allocmodel.topics.Fini... |
test/demoappext-setuptools/setup.py | tanvimoharir/python-versioneer | 204 | 114547 |
from setuptools import setup, Extension
import versioneer
commands = versioneer.get_cmdclass().copy()
extension = Extension('demo.ext',
sources=['demo/ext.c'],
)
setup(name="demoappext",
version=versioneer.get_version(),
description="Demo",
url="url",
author="author",
... |
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/plugins/builder_darwin.py | Polidea/SiriusObfuscator | 427 | 114567 |
from __future__ import print_function
import os
import lldbsuite.test.lldbtest as lldbtest
from builder_base import *
def buildDsym(
sender=None,
architecture=None,
compiler=None,
dictionary=None,
clean=True):
"""Build the binaries with dsym debug info."""
commands = ... |
third_party/html5lib-python/html5lib/tests/test_parser.py | tingshao/catapult | 2,151 | 114606 | <filename>third_party/html5lib-python/html5lib/tests/test_parser.py
from __future__ import absolute_import, division, unicode_literals
import os
import sys
import traceback
import warnings
import re
warnings.simplefilter("error")
from .support import get_data_files
from .support import TestData, convert, convertExpe... |
Athos/tests/onnx/unittests/test_convolution.py | kanav99/EzPC | 221 | 114608 | """
Authors: <NAME>.
Copyright:
Copyright (c) 2021 Microsoft Research
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, mo... |
Packs/ContentManagement/Scripts/ListCreator/ListCreator.py | diCagri/content | 799 | 114624 | import demistomock as demisto
from CommonServerPython import *
SCRIPT_NAME = 'ListCreator'
def configure_list(list_name: str, list_data: str) -> bool:
"""Create system lists using the createList built-in method.
"""
demisto.debug(f'{SCRIPT_NAME} - Setting "{list_name}" list.')
res = demisto.executeC... |
mushroom_rl/environments/mujoco_envs/humanoid_gait/_external_simulation/human_muscle.py | PuzeLiu/mushroom-rl | 344 | 114636 | import numpy as np
from .muscle_simulation_stepupdate import step_update_state
class MuscleTendonComplex:
def __init__(self, nameMuscle, frcmax, vmax, lslack, lopt,
lce, r, phiref, phimaxref, rho, dirAng, phiScale,
offsetCorr, timestep, angJoi, eref=0.04, act=0.01,
... |
boto3_type_annotations_with_docs/boto3_type_annotations/backup/client.py | cowboygneox/boto3_type_annotations | 119 | 114673 | <filename>boto3_type_annotations_with_docs/boto3_type_annotations/backup/client.py<gh_stars>100-1000
from typing import Optional
from botocore.client import BaseClient
from typing import Dict
from botocore.paginate import Paginator
from datetime import datetime
from botocore.waiter import Waiter
from typing import Unio... |
tests/test_models.py | abitrolly/stellar5 | 932 | 114676 | from stellar.models import get_unique_hash, Table, Snapshot
def test_get_unique_hash():
assert get_unique_hash()
assert get_unique_hash() != get_unique_hash()
assert len(get_unique_hash()) == 32
def test_table():
table = Table(
table_name='hapsu',
snapshot=Snapshot(
snaps... |
helper_scripts/components/parse_v4l2_header.py | fengjixuchui/difuze | 347 | 114678 | from base_component import *
import os
import xml.etree.ElementTree as ET
class ParseV4L2Headers(Component):
"""
Component which parses the v4l2 headers to get ioctl function pointer structure members.
"""
def __init__(self, value_dict):
c2xml_path = None
kernel_src_dir = None
... |
examples/eigenfaces/demo.py | DeepanChakravarthiPadmanabhan/paz_coco | 300 | 114707 | import os
import argparse
import numpy as np
import processors as pe
from paz.backend.camera import VideoPlayer
from paz.backend.camera import Camera
from demo_pipeline import DetectEigenFaces
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Real-time face classifier')
parser.add_argum... |
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/OperationStaResult.py | yuanyi-thu/AIOT- | 128 | 114743 | class OperationStaResult(object):
def __init__(self):
self.total = None
self.wait = None
self.processing = None
self.success = None
self.fail = None
self.stop = None
self.timeout = None
def getTotal(self):
return self.total
def setTotal(self... |
voctocore/tests/commands/test_get_audio.py | 0xflotus/voctomix | 521 | 114745 | import json
from mock import ANY
from lib.response import OkResponse
from tests.commands.commands_test_base import CommandsTestBase
class GetAudioTest(CommandsTestBase):
def test_get_audio(self):
self.pipeline_mock.amix.getAudioVolumes.return_value = [1.0, 0.0, 0.25]
response = self.commands.ge... |
ldaptor/dns.py | scottcarr/ldaptor | 133 | 114778 | """DNS-related utilities."""
from socket import inet_aton, inet_ntoa
import struct
def aton_octets(ip):
s = inet_aton(ip)
return struct.unpack("!I", s)[0]
def aton_numbits(num):
n = 0
while num > 0:
n >>= 1
n |= 2 ** 31
num -= 1
return n
def aton(ip):
try:
... |
datasets/cifar.py | takuhirok/rGAN | 103 | 114779 | import os
import sys
if sys.version_info[0] == 2:
import cPickle as pickle
else:
import pickle
import numpy as np
import torch
import torchvision.datasets as datasets
class CIFAR10NoisyLabels(datasets.CIFAR10):
"""CIFAR10 Dataset with noisy labels.
Args:
noise_type (string): Noise type (def... |
corehq/apps/toggle_ui/admin.py | omari-funzone/commcare-hq | 471 | 114780 | from django.contrib import admin
from corehq.apps.toggle_ui.models import ToggleAudit
@admin.register(ToggleAudit)
class ToggleAdmin(admin.ModelAdmin):
date_hierarchy = 'created'
list_display = ('username', 'slug', 'action', 'namespace', 'item', 'randomness')
list_filter = ('slug', 'namespace')
order... |
app/codeEvaluator.py | Vikum94/pslab-remote | 1,129 | 114843 | from __future__ import print_function
import sys,inspect
import numpy as np
from flask import json
from collections import OrderedDict
class Evaluator:
def __init__(self,functionList):
self.generatedApp=[]
self.hasPlot=False
self.itemList=[]
self.evalGlobals={}
self.functionList = functionList
se... |
tests/commands/dev/conftest.py | chuckyQ/briefcase | 917 | 114855 | <reponame>chuckyQ/briefcase<filename>tests/commands/dev/conftest.py
from unittest import mock
import pytest
from briefcase.commands import DevCommand
from briefcase.config import AppConfig
@pytest.fixture
def dev_command(tmp_path):
command = DevCommand(base_path=tmp_path)
command.subprocess = mock.MagicMock... |
gluoncv/data/transforms/presets/imagenet.py | Kh4L/gluon-cv | 5,447 | 114865 | """Transforms for ImageNet series."""
from __future__ import absolute_import
import mxnet as mx
from mxnet.gluon.data.vision import transforms
__all__ = ['transform_eval']
def transform_eval(imgs, resize_short=256, crop_size=224,
mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)):
"""A uti... |
docs/pyplots/volumetrics.py | ValtoGameEngines/Intrinsic-Engine | 1,176 | 114882 | <filename>docs/pyplots/volumetrics.py
import matplotlib.pyplot as plt
import numpy as np
exp = 2.0
near = 1.0
far = 10000.0
volumeDepth = 128.0
def volumeZToDepth(z):
return np.power(z / volumeDepth, exp) * far + near
t1 = np.arange(0.0, volumeDepth, 1.0)
plt.plot(t1, volumeZToDepth(t1), 'bo', t1, volumeZToDept... |
src/lib/shelve.py | DTenore/skulpt | 2,671 | 114886 | <filename>src/lib/shelve.py
import _sk_fail; _sk_fail._("shelve")
|
sdk/python/pulumi_aws/chime/__init__.py | chivandikwa/pulumi-aws | 260 | 114965 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from .. import _utilities
import typing
# Export this package's modules as members:
from .voice_connector import *
from .voice_connecto... |
tools/constraint.py | fsanges/glTools | 165 | 114982 | import maya.mel as mm
import maya.cmds as mc
import maya.OpenMaya as OpenMaya
import glTools.utils.base
import glTools.utils.component
import glTools.utils.constraint
import glTools.utils.mathUtils
import glTools.utils.mesh
import glTools.utils.reference
import glTools.utils.stringUtils
import glTools.utils.transform
... |
ProofOfConcepts/Vision/OpenMvMaskDefaults/finetune.py | WoodData/EndpointAI | 190 | 115007 | <gh_stars>100-1000
import sys
import argparse
import torch
import torch.nn as nn
import torchvision
import numpy as np
import lightly.cli as cli
import lightly.data as data
import lightly.models as models
from classifier import Classifier
from utils import calculate_class_weight
# parse arguments
parser = argparse... |
dataset/mnist.py | vahidk/TensorflowFramework | 129 | 115073 | <reponame>vahidk/TensorflowFramework<gh_stars>100-1000
"""Mnist dataset preprocessing and specifications."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import matplotlib.pyplot as plt
import numpy as np
import os
from six.moves import urlli... |
mayan/apps/tags/tests/test_document_tag_api.py | atitaya1412/Mayan-EDMS | 343 | 115104 | <gh_stars>100-1000
from rest_framework import status
from mayan.apps.documents.tests.mixins.document_mixins import DocumentTestMixin
from mayan.apps.rest_api.tests.base import BaseAPITestCase
from ..events import event_tag_attached, event_tag_removed
from ..permissions import (
permission_tag_attach, permission_t... |
src/sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py | fchapoton/sage | 1,742 | 115114 | <filename>src/sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py<gh_stars>1000+
## -*- encoding: utf-8 -*-
"""
This file (./sol/linalg_doctest.sage) was *autogenerated* from ./sol/linalg.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environm... |
calendars/holidays/utils/anglorules.py | gusamarante/Quantequim | 296 | 115140 | <filename>calendars/holidays/utils/anglorules.py
from pandas.tseries.holiday import Holiday, next_monday_or_tuesday, \
sunday_to_monday, MO
from pandas.tseries.offsets import DateOffset
NewYearsDay = Holiday('New Year´s Day', month=1, day=1,
observance=sunday_to_monday)
UKEarlyMayBank = Hol... |
lwh/21/encrpyt.py | saurabh896/python-1 | 3,976 | 115150 | from hashlib import sha256
from hmac import HMAC
import os
class Encrypt(object):
def encrypt(self, password, salt=None):
if salt is None:
salt = os.urandom(8)
result = password.encode('utf-8')
for i in range(10):
result = HMAC(result, salt, sha256).digest()
... |
pymagnitude/third_party/allennlp/tests/data/token_indexers/character_token_indexer_test.py | tpeng/magnitude | 1,520 | 115152 | # pylint: disable=no-self-use,invalid-name
from __future__ import absolute_import
from collections import defaultdict
from allennlp.common.testing import AllenNlpTestCase
from allennlp.data import Token, Vocabulary
from allennlp.data.token_indexers import TokenCharactersIndexer
from allennlp.data.tokenizers.character... |
plex_mpv_shim/gdm.py | aelfa/plex-mpv-shim | 231 | 115153 | """
PlexGDM.py - Version 0.3
This class implements the Plex GDM (G'Day Mate) protocol to discover
local Plex Media Servers. Also allow client registration into all local
media servers.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as publis... |
scripts/parse_elapsed.py | disktnk/chainer-compiler | 116 | 115157 | #!/usr/bin/env python3
#
# Usage:
#
# $ ./scripts/runtests.py -g onnx_real --show_log |& tee log
# $ ./scripts/parse_elapsed.py log
import re
import sys
tests = {}
cur_test = None
with open(sys.argv[1]) as f:
for line in f:
m = re.match(r'^Running for out/onnx_real_(.*?)/', line)
if m:
... |
qiskit/transpiler/passes/utils/remove_barriers.py | Roshan-Thomas/qiskit-terra | 1,599 | 115177 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 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 modifications or derivat... |
youtube_dlc/extractor/gedi.py | mrysn/yt-dlc | 3,001 | 115183 | <filename>youtube_dlc/extractor/gedi.py
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
base_url,
url_basename,
urljoin,
)
class GediBaseIE(InfoExtractor):
@staticmethod
def _clean_audio_fmt... |
regexploit/bin/regexploit_js.py | CrackerCat/regexploit | 592 | 115185 | <reponame>CrackerCat/regexploit<filename>regexploit/bin/regexploit_js.py
#!/usr/bin/env python
import argparse
import io
import json
import logging
import os.path
import re
import subprocess
import sys
import traceback
import warnings
from regexploit.ast.sre import SreOpParser
from regexploit.bin.files import file_gen... |
win/pywinauto/controlproperties.py | sk8darr/BrowserRefresh-Sublime | 191 | 115216 | # GUI Application automation and testing library
# Copyright (C) 2006 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your optio... |
data_preprocessing/convert_data_format/convert_mha_nii.py | aiswaryasankar/280 | 192 | 115236 | import SimpleITK as sitk
data_mha = open('data_mha.txt', 'r')
mha_dir = data_mha.readlines()
data_nii = open('data_nii.txt', 'r')
nii_dir = data_nii.readlines()
for i in range(len(mha_dir)):
print(i)
path, _ = mha_dir[i].split("\n")
savepath, _ = nii_dir[i].split("\n")
img = sitk.ReadImage(path)
si... |
Source/Utility/python-twitter/twitter/error.py | guissy/StockRecommendSystem | 137 | 115255 | #!/usr/bin/env python
class TwitterError(Exception):
"""Base class for Twitter errors"""
@property
def message(self):
'''Returns the first argument used to construct this error.'''
return self.args[0]
class PythonTwitterDeprecationWarning(DeprecationWarning):
"""Base class for pytho... |
admino/views.py | erdem/django-admino | 221 | 115267 | from collections import OrderedDict
from urllib import urlencode
from admino.serializers import ModelAdminSerializer
from django.core.urlresolvers import reverse_lazy
from django.http import JsonResponse
from django.views.generic import View
class APIView(View):
def json_response(self, data, *args, **kwargs):
... |
apps/monitor/views/newsblur_users.py | Paul3MK/NewsBlur | 3,073 | 115326 | <reponame>Paul3MK/NewsBlur
import datetime
from django.contrib.auth.models import User
from django.shortcuts import render
from django.views import View
from apps.profile.models import Profile, RNewUserQueue
class Users(View):
def get(self, request):
last_month = datetime.datetime.utcnow() - datetime.ti... |
evaluate.py | BoPang1996/TubeTK | 142 | 115344 | import pickle
import os
import numpy as np
import torch
import warnings
from tqdm import tqdm
from Metrics import evaluateTracking
from dataset.dataLoader import Data_Loader_MOT
from network.tubetk import TubeTK
from post_processing.tube_nms import multiclass_nms
from apex import amp
import argparse
import multiprocess... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.