max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
care/utils/notification_handler.py | gigincg/care | 189 | 194807 | <gh_stars>100-1000
import json
import celery
from django.apps import apps
from django.conf import settings
from pywebpush import WebPushException, webpush
from care.facility.models.daily_round import DailyRound
from care.facility.models.facility import Facility, FacilityUser
from care.facility.models.notification imp... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/test_authentication.py | vincentfretin/kinto | 4,618 | 194810 | from unittest import mock
from kinto.core import authentication, utils
from kinto.core.testing import DummyRequest, unittest
from .support import BaseWebTest
class AuthenticationPoliciesTest(BaseWebTest, unittest.TestCase):
def test_basic_auth_is_accepted_by_default(self):
self.app.get(self.plural_url, ... | 0 | 0 | 0 | 0 | 0 | 0 |
dvadmin-backend/apps/vadmin/monitor/models/__init__.py | yuanlaimantou/vue-django-admin | 193 | 194813 | <filename>dvadmin-backend/apps/vadmin/monitor/models/__init__.py
from apps.vadmin.monitor.models.monitor import Monitor
from apps.vadmin.monitor.models.server import Server
from apps.vadmin.monitor.models.sys_files import SysFiles
| 0 | 0 | 0 | 0 | 0 | 0 |
vnpy/gateway/oes/error_code.py | howyu88/vnpy2 | 323 | 194817 | from __future__ import annotations
from vnpy.api.oes.vnoes import OesApi_GetErrorMsg, OesApi_GetLastError
def error_to_str(code: int) -> object | str:
try:
# return error_codes[code]
return OesApi_GetErrorMsg(code)
except KeyError:
return "Unknown error code!"
def get_last_error() ->... | 1 | 2 | 0 | 0 | 3 | 0 |
sweeps/benchmarks/cortexsuite.py | TAKAKEYA/gem5-aladdin | 135 | 194828 | # CortexSuite benchmark definitions.
from datatypes import *
from params import *
disparity = Benchmark("disparity", "disparity/src/c")
disparity.set_kernels(
["computeSAD",
"integralImage2D2D",
"finalSAD",
"findDisparity"])
# computeSAD
disparity.set_main_id(0x1f0)
disparity.add_loop("computeSAD",... | 0 | 0 | 0 | 0 | 0 | 0 |
hasher-matcher-actioner/hmalib/lambdas/ddb_stream_counter.py | garnesen/ThreatExchange | 997 | 194834 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import typing as t
from collections import defaultdict
import os
from functools import lru_cache
from mypy_boto3_dynamodbstreams.type_defs import GetRecordsOutputTypeDef, RecordTypeDef
import boto3
from hmalib.common.models.content import ContentO... | 5 | 4 | 2 | 0 | 11 | 0 |
tests/rest/admin/test_media.py | dsonck92/synapse | 9,945 | 194869 | <gh_stars>1000+
# Copyright 2020 <NAME>
# Copyright 2021 The Matrix.org Foundation C.I.C.
#
# 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
#
... | 0 | 0 | 0 | 0 | 0 | 0 |
update.py | sileence114/blivechat | 757 | 194879 | # -*- coding: utf-8 -*-
import asyncio
import aiohttp
VERSION = 'v1.5.3'
def check_update():
asyncio.ensure_future(_do_check_update())
async def _do_check_update():
try:
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10)) as session:
async with session.get('https... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pycares/errno.py | mcepl/pycares | 121 | 194897 | <gh_stars>100-1000
from ._cares import ffi as _ffi, lib as _lib
from .utils import maybe_str
exported_pycares_symbols = [
'ARES_SUCCESS',
# error codes
'ARES_ENODATA',
'ARES_EFORMERR',
'ARES_ESERVFAIL',
'ARES_ENOTFOUND',
'ARES_ENOTIMP',
'ARES_EREFUSED',
'ARES_EBADQUERY',
'ARES... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models.py | praveenkuttappan/azure-sdk-for-python | 2,728 | 194904 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 0 | 0 | 37 | 29 | 66 | 0 |
tests/io/file_readline.py | sebastien-riou/micropython | 13,648 | 194907 | f = open("io/data/file1")
print(f.readline())
print(f.readline(3))
print(f.readline(4))
print(f.readline(5))
print(f.readline())
# readline() on writable file
f = open("io/data/file1", "ab")
try:
f.readline()
except OSError:
print("OSError")
f.close()
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_screenshot.py | Sab0tag3d/pyppeteer | 3,747 | 194908 | <filename>tests/test_screenshot.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import base64
from pathlib import Path
from unittest import TestCase
from syncer import sync
from pyppeteer import launch
root_path = Path(__file__).resolve().parent
blank_png_path = root_path / 'blank_800x600.png'
blank_pdf_path = ro... | 0 | 0 | 0 | 0 | 0 | 0 |
logistic_regression/logistic_regression.py | suitnecniv/dota2 | 127 | 194928 | <filename>logistic_regression/logistic_regression.py
import numpy as np
import pickle, os
NUM_HEROES = 108
NUM_FEATURES = NUM_HEROES * 2
class D2LogisticRegression:
def __init__(self, model_root='logistic_regression'):
model_path = os.path.join(model_root, 'model.pkl')
with open(model_path, 'r') a... | 0 | 0 | 0 | 0 | 0 | 0 |
ane/2_compile/struct_recover.py | el-iot/tinygrad | 5,578 | 194937 | #!/usr/bin/env python3
from ane import ANE
ane = ANE()
lens = {}
dat = b"\xff"*0x300
ret = ane.debug(dat, 16)
for k,v in ret.items():
found = None
for i in range(33):
#print(v, (1 << i) - 1)
if v == (1 << i) - 1:
found = i
break
#print(k, hex(v), found)
lens[k] = found
pos = []
dat = b"\x... | 0 | 0 | 0 | 0 | 0 | 0 |
tmp/vggverydeep19.py | sonuranjitjacob/facenet | 13,408 | 194948 | <filename>tmp/vggverydeep19.py<gh_stars>1000+
"""Load the VGG imagenet model into TensorFlow.
Download the model from http://www.robots.ox.ac.uk/~vgg/research/very_deep/
and point to the file 'imagenet-vgg-verydeep-19.mat'
"""
import numpy as np
from scipy import io
import tensorflow as tf
def load(filename, images):
... | 0 | 0 | 0 | 0 | 0 | 0 |
RecoHI/HiTracking/python/HIPixelTripletSeeds_cff.py | ckamtsikis/cmssw | 852 | 194956 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# pixel track producer (with vertex)
from RecoHI.HiTracking.HIPixel3PrimTracks_cfi import *
from RecoTracker.TkSeedingLayers.PixelLayerTriplets_cfi import *
# pixel seeds
import RecoPixelVertexing.PixelLowPtUtilities.TrackSeeds_cfi
hiPixelTrackSeeds ... | 0 | 0 | 0 | 0 | 0 | 0 |
blockchain-workbench/rest-api-samples/python/create_update_from_CSV/python_HelloBlockchain.py | foxi-spectech/blockchain | 738 | 194964 | #%%
from adal import AuthenticationContext
import requests
import json
import pandas as pd
import numpy as np
#%%
AUTHORITY = 'https://login.microsoftonline.com/*****.onmicrosoft.com'
# Click on this link to get the Swagger API reference
WORKBENCH_API_URL = 'https://*****-*****-api.azurewebsites.net'
# This is the a... | 0 | 5 | 0 | 0 | 5 | 0 |
segmentation/DataSet.py | wangyihuan123/ESPNetv2 | 429 | 194966 | <reponame>wangyihuan123/ESPNetv2<gh_stars>100-1000
import cv2
import torch.utils.data
import numpy as np
#============================================
__author__ = "<NAME>"
__license__ = "MIT"
__maintainer__ = "<NAME>"
#============================================
class MyDataset(torch.utils.data.Dataset):
'''
... | 0 | 0 | 0 | 0 | 0 | 0 |
var/spack/repos/builtin/packages/r-spatialeco/package.py | kkauder/spack | 2,360 | 195019 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RSpatialeco(RPackage):
"""Spatial Analysis and Modelling Utilities
Utilities to suppo... | 0 | 0 | 3 | 0 | 3 | 0 |
examples/docs/guidemodels/1.py | PGM-Lab/InferPy | 140 | 195028 | <reponame>PGM-Lab/InferPy<filename>examples/docs/guidemodels/1.py
import inferpy as inf
import numpy as np
# definition of a generic model
@inf.probmodel
def pca(k,d):
w = inf.Normal(loc=np.zeros([k,d]), scale=1, name="w") # shape = [k,d]
with inf.datamodel():
z = inf.Normal(np.ones(k),1, name="z"... | 0 | 0 | 0 | 0 | 0 | 0 |
faasmcli/faasmcli/tasks/files.py | kubasz/faasm | 278 | 195037 | from invoke import task
from os.path import basename
from faasmcli.util.endpoints import get_upload_host_port
from faasmcli.util.upload_util import curl_file
@task(default=True)
def upload(ctx, in_path, shared_path):
"""
Upload a shared file to Faasm
"""
host, port = get_upload_host_port()
url ... | 0 | 0 | 0 | 0 | 0 | 0 |
nevergrad/optimization/recaster.py | yvan-vin/nevergrad | 3,217 | 195038 | <reponame>yvan-vin/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 warnings
import threading
import queue
import numpy as np
import nevergrad.common.typ... | 0 | 0 | 0 | 0 | 0 | 0 |
060_hair_segmentation/01_float32/06_tflite_model_load_test.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 195067 | import numpy as np
import tensorflow as tf
interpreter = tf.lite.Interpreter(model_path="hair_segmentation_512x512_float32.tflite")
# interpreter = tf.lite.Interpreter(model_path="hair_segmentation_512x512_weight_quant.tflite")
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_detai... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/ngs_roi/tests/run_tests.py | JensUweUlrich/seqan | 409 | 195077 | <reponame>JensUweUlrich/seqan
#!/usr/bin/env python2
"""Execute the tests for the roi_intersect program.
The golden test outputs are generated by the script generate_outputs.sh.
You have to give the root paths to the source and the binaries as arguments to
the program. These are the paths to the directory that conta... | 0 | 0 | 0 | 0 | 0 | 0 |
goose3/utils/__init__.py | martinvk1/goose-spkt | 575 | 195085 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""\
This is a python port of "Goose" orignialy licensed to Gravity.com
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.
Python port was written by <NAME... | 2 | 7 | 0 | 1 | 10 | 0 |
Lib/signal.py | shawwn/cpython | 11,058 | 195096 | <filename>Lib/signal.py
import _signal
from _signal import *
from functools import wraps as _wraps
from enum import IntEnum as _IntEnum
_globals = globals()
_IntEnum._convert_(
'Signals', __name__,
lambda name:
name.isupper()
and (name.startswith('SIG') and not name.startswith(... | 0 | 0 | 0 | 0 | 0 | 0 |
vectorhub/encoders/audio/base.py | vector-ai/vectorhub | 385 | 195098 | <reponame>vector-ai/vectorhub
from ...import_utils import *
if is_all_dependency_installed('audio-encoder'):
import librosa
import soundfile as sf
import tempfile
import shutil
import os
from urllib.request import urlopen, Request
from urllib.parse import quote
import io
import numpy as np
from ...base impor... | 0 | 0 | 0 | 0 | 0 | 0 |
influxdb_client/domain/authorization_post_request.py | wasted925/influxdb-client-python | 380 | 195105 | <reponame>wasted925/influxdb-client-python<filename>influxdb_client/domain/authorization_post_request.py
# coding: utf-8
"""
Influx OSS API Service.
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 2.0.0
Generated by: https... | 0 | 0 | 0 | 0 | 0 | 0 |
etc/theory/experiments/rupture_performance/serial_adaptive_25/parse.py | Cancelll/rupture | 184 | 195120 | from datetime import datetime
filenames = ['aes128cbc', 'aes128gcm', 'aes256cbc', 'aes256gcm']
for filename in filenames:
with open(filename, 'r') as f:
lines = f.readlines()
first_split = lines[0].strip('\n').split()
last_split = lines[-1].strip('\n').split()
prev_datetime = datetime.strptim... | 0 | 0 | 0 | 0 | 0 | 0 |
kik_unofficial/protobuf/bridgetest/v1/authenticated_service_pb2.py | 3dik/kik-bot-api-unofficial | 120 | 195128 | <filename>kik_unofficial/protobuf/bridgetest/v1/authenticated_service_pb2.py
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bridgetest/v1/authenticated_service.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 _de... | 0 | 0 | 0 | 0 | 0 | 0 |
fastapi_crudrouter/core/mem.py | robert-werner/fastapi-crudrouter | 686 | 195175 | from typing import Any, Callable, List, Type, cast, Optional, Union
from . import CRUDGenerator, NOT_FOUND
from ._types import DEPENDENCIES, PAGINATION, PYDANTIC_SCHEMA as SCHEMA
CALLABLE = Callable[..., SCHEMA]
CALLABLE_LIST = Callable[..., List[SCHEMA]]
class MemoryCRUDRouter(CRUDGenerator[SCHEMA]):
def __ini... | 31 | 14 | 0 | 2 | 47 | 0 |
nni/runtime/tuner_command_channel/legacy.py | sky-dust-intelligence-bv/nni | 2,305 | 195192 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from __future__ import annotations
__all__ = [
'CommandType',
'LegacyCommandChannel',
'send',
'receive',
'_set_in_file',
'_set_out_file',
'_get_out_file',
]
import logging
import os
import threading
from .command_typ... | 0 | 3 | 0 | 0 | 3 | 0 |
build/python/examples/FeatureExtractionModulesExamples/kmeans_quantizer_example.py | torydebra/grt | 818 | 195201 | import GRT
import sys
import argparse
def main():
'''GRT KMeansQuantizer Example
This examples demonstrates how to use the KMeansQuantizer module.
The KMeansQuantizer module quantizes the N-dimensional input vector to a 1-dimensional discrete
value. This value will be between [0 K-1], where K ... | 0 | 0 | 0 | 0 | 0 | 0 |
test.py | qbetterk/multiwoz | 598 | 195218 | #!/usr/bin/env python
# coding: utf-8
from __future__ import division, print_function, unicode_literals
import argparse
import json
import os
import shutil
import time
import torch
from utils import util
from evaluate import MultiWozEvaluator
from model.model import Model
parser = argparse.ArgumentParser(descriptio... | 1 | 2 | 0 | 0 | 3 | 0 |
torch_geometric/nn/glob/__init__.py | rusty1s/pytorch-geometric | 2,350 | 195238 | from .glob import global_add_pool, global_mean_pool, global_max_pool
from .glob import GlobalPooling
from .sort import global_sort_pool
from .attention import GlobalAttention
from .gmt import GraphMultisetTransformer
__all__ = [
'global_add_pool',
'global_mean_pool',
'global_max_pool',
'GlobalPooling',... | 0 | 0 | 0 | 0 | 0 | 0 |
graph4nlp/pytorch/modules/evaluation/bleu_translation.py | cminusQAQ/graph4nlp | 1,269 | 195251 | import sacrebleu
from .base import EvaluationMetricBase
class BLEUTranslation(EvaluationMetricBase):
def __init__(self):
super(BLEUTranslation, self).__init__()
def calculate_scores(self, ground_truth, predict) -> object:
"""
The standard BLEU calculation function for translation... | 0 | 1 | 0 | 0 | 1 | 0 |
mac/pyobjc-core/PyObjCTest/test_specialtypecodes_struct.py | albertz/music-player | 132 | 195261 | """
Tests for using special type codes in struct definitions
TODO:
* _C_UNICHAR, _C_CHAR_AS_INT, _C_CHAR_AS_TEXT
"""
import weakref
from PyObjCTools.TestSupport import *
from PyObjCTest.fnd import NSObject
from PyObjCTest.specialtypecodes import *
EmbeddedBoolStruct = objc.createStructType(
"EmbeddedBoolStr... | 0 | 0 | 0 | 0 | 0 | 0 |
python/docker-app-with-asg-alb/dockerized_app_cdk/asg_stack.py | marclyo/aws-cdk-examples | 2,941 | 195266 | from aws_cdk.aws_ec2 import SubnetType
from aws_cdk import (
aws_ec2 as ec2,
aws_autoscaling as autoscaling,
aws_elasticloadbalancingv2 as elbv2,
core
)
class ASGStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, props, **kwargs) -> None:
super().__init__(scope, id,... | 2 | 1 | 0 | 0 | 3 | 0 |
blender/arm/lightmapper/utility/gui/Viewport.py | onelsonic/armory | 2,583 | 195269 | import bpy, blf, bgl, os, gpu
from gpu_extras.batch import batch_for_shader
class ViewportDraw:
def __init__(self, context, text):
bakefile = "TLM_Overlay.png"
scriptDir = os.path.dirname(os.path.realpath(__file__))
bakefile_path = os.path.abspath(os.path.join(scriptDir, '..', '..', 'asse... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/mathter/all/conanfile.py | rockandsalt/conan-center-index | 562 | 195283 | from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
import os
class MathterConan(ConanFile):
name: str = "mathter"
license: str = "MIT"
homepage: str = "https://github.com/petiaccja/Mathter"
url: str = "https://github.com/conan-io/conan-center-index/"
description... | 0 | 2 | 8 | 0 | 10 | 0 |
python/client.py | pl8787/textnet-release | 114 | 195293 | import zmq
import json
import time
import sys
def get_nodes(model):
node_set = set()
node_list = []
for layer in model['layers']:
if layer['bottom_nodes']:
for node in layer['bottom_nodes']:
if node not in node_set:
node_set.add(node)
... | 0 | 0 | 0 | 0 | 0 | 0 |
randopt/__init__.py | seba-1511/randopt | 115 | 195303 | #!/usr/bin/env python
import random
# Fork Python's RNG and seed with a truly random number
if 'RANDOP_INIT' not in globals():
RANDOPT_RNG = random.Random()
sys_seed = random.SystemRandom().randint(0, 1e10)
RANDOPT_RNG.seed(sys_seed)
RANDOPT_INIT = True
args = None
from ._version import __version__
... | 0 | 0 | 0 | 0 | 0 | 0 |
unitypack/exceptions.py | isombyt/UnityPack | 633 | 195328 | class UnityPackException(Exception):
pass
class ArchiveNotFound(UnityPackException):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
delta/utils/metrics/py_metrics_test.py | didichuxing/delta | 1,442 | 195330 | <gh_stars>1000+
# Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache... | 0 | 0 | 0 | 0 | 0 | 0 |
Game21/modules/sprites/__init__.py | ttkaixin1998/pikachupythongames | 4,013 | 195342 | <filename>Game21/modules/sprites/__init__.py
'''初始化'''
from .mole import Mole
from .hammer import Hammer | 0 | 0 | 0 | 0 | 0 | 0 |
src/enamlnative/ios/uikit_view_group.py | codelv/enaml-native | 237 | 195371 | """
Copyright (c) 2017, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Aug 3, 2017
@author: jrm
"""
from atom.api import Instance, observe
from enamlnative.widgets.view_group import ProxyViewGroup
from .uikit_view import ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/taichi/examples/simulation/fem128.py | kxxt/taichi | 11,699 | 195375 | <reponame>kxxt/taichi
import taichi as ti
ti.init(arch=ti.gpu)
N = 12
dt = 5e-5
dx = 1 / N
rho = 4e1
NF = 2 * N**2 # number of faces
NV = (N + 1)**2 # number of vertices
E, nu = 4e4, 0.2 # Young's modulus and Poisson's ratio
mu, lam = E / 2 / (1 + nu), E * nu / (1 + nu) / (1 - 2 * nu) # Lame parameters
ball_pos, ... | 0 | 0 | 0 | 0 | 0 | 0 |
score/whiten/train_ZCA_Whitening.py | ishine/asv-subtools | 370 | 195394 | <reponame>ishine/asv-subtools
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ------------------------------------
# file: zca.py
# date: Thu May 21 15:47 2015
# author:
# <NAME>
# github.com/mwv
# <EMAIL>
#
# Licensed under GPLv3
# ------------------------------------
"""zca: ZCA whitening with a sklearn-like interface
s... | 0 | 0 | 0 | 0 | 0 | 0 |
build/scripts/check_config_h.py | HeyLey/catboost | 6,989 | 195413 | <gh_stars>1000+
import sys
data = """
#if defined(SIZEOF_LONG)
static_assert(sizeof(long) == SIZEOF_LONG, "fixme 1");
#endif
#if defined(SIZEOF_PTHREAD_T)
#include <pthread.h>
static_assert(sizeof(pthread_t) == SIZEOF_PTHREAD_T, "fixme 2");
#endif
#if defined(SIZEOF_SIZE_T)
#include <stddef.h>
static_assert(sizeof... | 0 | 0 | 0 | 0 | 0 | 0 |
model_SentCNN.py | srviest/CharCNN_PyTorch | 132 | 195440 | <gh_stars>100-1000
import torch
import torch.nn as nn
import torch.nn.functional as F
class CNN_Text(nn.Module):
def __init__(self, args):
super(CNN_Text,self).__init__()
self.args = args
V = args.embed_num
D = args.embed_dim
C = args.class_num
Ci = 1
... | 0 | 0 | 0 | 0 | 0 | 0 |
Z - Tool Box/LaZagne/Windows/lazagne/softwares/sysadmin/opensshforwindows.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 195499 | <reponame>dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1<gh_stars>1000+
# -*- coding: utf-8 -*-
from lazagne.config.module_info import ModuleInfo
from lazagne.config.constant import constant
# from Crypto.PublicKey import RSA
# from Crypto.PublicKey import DSA
import os
class OpenSSHForWindows(ModuleInfo):
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/londiste/util.py | zzahti/skytools | 116 | 195512 | <gh_stars>100-1000
import skytools
import londiste.handler
__all__ = ['handler_allows_copy', 'find_copy_source']
def handler_allows_copy(table_attrs):
"""Decide if table is copyable based on attrs."""
if not table_attrs:
return True
attrs = skytools.db_urldecode(table_attrs)
hstr = attrs.get(... | 0 | 0 | 0 | 0 | 0 | 0 |
dbaas/dbaas_services/analyzing/migrations/0011_auto__chg_field_analyzerepository_analyzed_at.py | didindinn/database-as-a-service | 303 | 195521 | <filename>dbaas/dbaas_services/analyzing/migrations/0011_auto__chg_field_analyzerepository_analyzed_at.py
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forw... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/extmod/uctypes_array_assign_le.py | learnforpractice/micropython-cpp | 692 | 195536 | <filename>tests/extmod/uctypes_array_assign_le.py<gh_stars>100-1000
try:
import uctypes
except ImportError:
print("SKIP")
raise SystemExit
desc = {
# arr is array at offset 0, of UINT8 elements, array size is 2
"arr": (uctypes.ARRAY | 0, uctypes.UINT8 | 2),
# arr2 is array at offset 0, size 2, ... | 0 | 0 | 0 | 0 | 0 | 0 |
site_scons/site_tools/AsagiTool.py | fabian-kutschera/SeisSol | 165 | 195544 | <filename>site_scons/site_tools/AsagiTool.py
#! /usr/bin/python
##
# @file
# This file is part of SeisSol.
#
# @author <NAME> (sebastian.rettenberger AT tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger)
#
# @section LICENSE
# Copyright (c) 2016, SeisSol Group
# All rights reserved.
#
# Redistributio... | 0 | 0 | 0 | 0 | 0 | 0 |
sorting/data.py | xuserwhat/sorting-visualizer | 234 | 195548 | # Script Name : data.py
# Author : <NAME>
# Created : 14th June 2018
# Last Modified : 14th June 2018
# Version : 1.0
# Modifications :
# Description : The struct of data to sort and display.
from __future__ import annotations
class Data:
# Total of data to sort
data_count... | 1 | 0 | 1 | 0 | 2 | 0 |
tests/opytimizer/optimizers/science/test_moa.py | anukaal/opytimizer | 528 | 195550 | <reponame>anukaal/opytimizer
from opytimizer.optimizers.science import moa
from opytimizer.spaces import search
def test_moa_params():
params = {
'alpha': 1.0,
'rho': 2.0,
}
new_moa = moa.MOA(params=params)
assert new_moa.alpha == 1.0
assert new_moa.rho == 2.0
def test_moa_par... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_reassembler.py | Kyle-Kyle/angr | 6,132 | 195560 |
import sys
import platform
import os
import tempfile
import subprocess
import shutil
import angr
test_location = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries', 'tests')
# Note: Reassembler is intensively tested by Patcherex test cases on CGC binaries.
def is_linux_x64() -> obje... | 0 | 1 | 0 | 0 | 1 | 0 |
Hackathon/hackerearth_hackathons.py | elawang9/Scripting-and-Web-Scraping | 119 | 195565 | """ Hackerearth hackathons """
from selenium import webdriver
from bs4 import BeautifulSoup
driver = webdriver.Chrome()
driver.get('https://www.hackerearth.com/challenges/')
res = driver.execute_script("return document.documentElement.outerHTML")
driver.quit()
soup = BeautifulSoup(res, 'lxml')
upcoming = soup.find('... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_LightModel/test_Profiles/test_moffat.py | heather999/lenstronomy | 107 | 195584 | <reponame>heather999/lenstronomy<filename>test/test_LightModel/test_Profiles/test_moffat.py
import pytest
from lenstronomy.LightModel.Profiles.moffat import Moffat
class TestMoffat(object):
"""
class to test the Moffat profile
"""
def setup(self):
pass
def test_function(self):
""... | 0 | 0 | 0 | 0 | 0 | 0 |
trakt/core/exceptions.py | ruinernin/trakt.py | 147 | 195591 | from __future__ import absolute_import, division, print_function
from trakt.core.errors import ERRORS
class RequestFailedError(Exception):
pass
class RequestError(Exception):
def __init__(self, response):
self.response = response
self.status_code = response.status_code if response is not No... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/System/Diagnostics/__init___parts/DebuggerStepperBoundaryAttribute.py | htlcnn/ironpython-stubs | 182 | 195624 | class DebuggerStepperBoundaryAttribute(Attribute,_Attribute):
"""
Indicates the code following the attribute is to be executed in run,not step,mode.
DebuggerStepperBoundaryAttribute()
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_plugin_type_manager.py | thijskramer/flake8 | 2,013 | 195654 | """Tests for flake8.plugins.manager.PluginTypeManager."""
from unittest import mock
import pytest
from flake8 import exceptions
from flake8.plugins import manager
TEST_NAMESPACE = "testing.plugin-type-manager"
def create_plugin_mock(raise_exception=False):
"""Create an auto-spec'd mock of a flake8 Plugin."""
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/check-haste.py | johnpaulbin/LibreASR | 680 | 195663 | <reponame>johnpaulbin/LibreASR
import torch
m = torch.nn.LSTM(20, 30, batch_first=True).cuda()
x = torch.randn(4, 33, 20).cuda()
x, _ = m(x)
x.mean().backward()
print("after nn.LSTM backward")
import haste_pytorch as haste
print("after imports")
gru_layer = haste.GRU(input_size=128, hidden_size=256, zoneout=0.1, ... | 0 | 0 | 0 | 0 | 0 | 0 |
locations/spiders/mcdonalds_fi.py | davidchiles/alltheplaces | 297 | 195669 | <reponame>davidchiles/alltheplaces
# -*- coding: utf-8 -*-
import scrapy
import re
import json
from locations.items import GeojsonPointItem
class McDonaldsFISpider(scrapy.Spider):
name = "mcdonalds_fi"
item_attributes = { 'brand': "McDonald's" }
allowed_domains = ["www.mcdonalds.fi"]
start_urls = (
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/backend_pool/util.py | uwacyber/cowrie | 2,316 | 195675 | # Copyright (c) 2019 <NAME> <<EMAIL>>
# See the COPYRIGHT file for more information
from __future__ import annotations
import os
import random
import subprocess
import time
def ping(guest_ip: str) -> int:
# could use `capture_output=True` instead of `stdout` and `stderr` args in Python 3.7
out = subprocess.... | 7 | 7 | 1 | 0 | 15 | 0 |
django/contrib/auth/signals.py | jpmallarino/django | 61,676 | 195678 | from django.dispatch import Signal
user_logged_in = Signal()
user_login_failed = Signal()
user_logged_out = Signal()
| 0 | 0 | 0 | 0 | 0 | 0 |
cumulusci/cli/tests/test_ui.py | emregunel/CumulusCI | 163 | 195690 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import os
from pprint import pformat
from unittest import mock
import pytest
from rich.emoji import Emoji
from cumulusci.cli.ui import (
CHECKMARK,
CROSSMARK,
CliTable,
SimpleSalesforceUIHelpers,
_summarize,
)
@pytest.fixture
def sample_data():
retu... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sage/interfaces/frobby.py | UCD4IDS/sage | 1,742 | 195724 | # -*- coding: utf-8 -*-
from __future__ import annotations
r"""
Interface to Frobby for fast computations on monomial ideals.
The software package Frobby provides a number of computations on
monomial ideals. The current main feature is the socle of a monomial
ideal, which is largely equivalent to computing the maximal... | 3 | 12 | 0 | 0 | 15 | 0 |
security_monkey/tests/sso/test_header_auth.py | boladmin/security_monkey | 4,258 | 195740 | # Copyright 2018 Netflix, 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 law... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_mocker.py | akhsiM/requests-mock | 315 | 195747 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | 0 | 3 | 2 | 0 | 5 | 0 |
src/jupyter_contrib_nbextensions/nbconvert_support/__init__.py | WTRipper/jupyter_contrib_nbextensions | 4,439 | 195771 | """Classes and functions provided for use with nbconvert."""
import os
from .collapsible_headings import ExporterCollapsibleHeadings
from .embedhtml import EmbedHTMLExporter
from .execute_time import ExecuteTimePreprocessor
from .exporter_inliner import ExporterInliner
from .nbTranslate import NotebookLangExporter
fr... | 0 | 1 | 0 | 0 | 1 | 0 |
python/federatedml/feature/feature_selection/iv_top_k_filter.py | hubert-he/FATE | 3,787 | 195776 | <filename>python/federatedml/feature/feature_selection/iv_top_k_filter.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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.
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
pybaseball/analysis/projections/marcels/age_adjustment.py | reddigari/pybaseball | 650 | 195796 | <filename>pybaseball/analysis/projections/marcels/age_adjustment.py
from typing import Optional
from pandas import isnull
def age_adjustment(age: Optional[float]) -> float:
"""
Marcel age adjustment
:param age: numeric
:return: float
"""
if isnull(age):
return float("nan")
a... | 0 | 0 | 0 | 0 | 0 | 0 |
mmtrack/models/trackers/__init__.py | BigBen0519/mmtracking | 2,226 | 195820 | <gh_stars>1000+
# Copyright (c) OpenMMLab. All rights reserved.
from .base_tracker import BaseTracker
from .byte_tracker import ByteTracker
from .masktrack_rcnn_tracker import MaskTrackRCNNTracker
from .sort_tracker import SortTracker
from .tracktor_tracker import TracktorTracker
__all__ = [
'BaseTracker', 'Trackt... | 0 | 0 | 0 | 0 | 0 | 0 |
old_stuff/harold/tests/test_system_funcs.py | weightan/quaternion_polynomials | 154 | 195839 | """
The MIT License (MIT)
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, publi... | 0 | 0 | 0 | 0 | 0 | 0 |
clang-tools-extra/clang-tidy/rename_check.py | mkinsner/llvm | 2,338 | 195848 | #!/usr/bin/env python
#
#===- rename_check.py - clang-tidy check renamer ------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===----------... | 0 | 9 | 0 | 0 | 9 | 0 |
src/solver.py | YoavRamon/Conv-TasNet | 487 | 195887 | <filename>src/solver.py
# Created on 2018/12
# Author: <NAME>
import os
import time
import torch
from pit_criterion import cal_loss
class Solver(object):
def __init__(self, data, model, optimizer, args):
self.tr_loader = data['tr_loader']
self.cv_loader = data['cv_loader']
self.mod... | 0 | 0 | 0 | 0 | 0 | 0 |
edifice/logger.py | fding/pyedifice | 151 | 195890 | <reponame>fding/pyedifice
import logging
# Support for colored logging: https://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#The background is set with 40 plus the number of the color, and the foreground with 30
#These are ... | 0 | 0 | 0 | 0 | 0 | 0 |
pyserum/_layouts/market.py | dpguoming/pyserum | 129 | 195907 | from construct import Bytes, Int8ul, Int64ul, Padding
from construct import Struct as cStruct
from .account_flags import ACCOUNT_FLAGS_LAYOUT
MARKET_LAYOUT = cStruct(
Padding(5),
"account_flags" / ACCOUNT_FLAGS_LAYOUT,
"own_address" / Bytes(32),
"vault_signer_nonce" / Int64ul,
"base_mint" / Bytes(... | 0 | 0 | 0 | 0 | 0 | 0 |
config/custom_components/ble_monitor/test/__init__.py | Poeschl/home-assistant-config | 820 | 195908 | # Tests for BLE monitor
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_type_error.py | priya1puresoftware/jsons | 234 | 195912 | <gh_stars>100-1000
import datetime
from unittest import TestCase
import jsons
from jsons import DeserializationError
class WrongUser:
def __init__(self,
id: int,
birthday: datetime, # intentionally wrong
):
self.id = id
self.birthday = birthday
... | 0 | 0 | 0 | 0 | 0 | 0 |
LeetCode/python3/485.py | ZintrulCre/LeetCode_Archiver | 279 | 195920 | <reponame>ZintrulCre/LeetCode_Archiver
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
consecutive = 0
ret = 0
for i in range(len(nums) + 1):
if i == len(nums) or nums[i] == 0:
ret = max(ret, consecutive)
consecutive = 0
... | 0 | 0 | 0 | 0 | 0 | 0 |
test/fx2trt/converters/acc_op/test_batchnorm.py | dllehr-amd/pytorch | 60,067 | 195923 | <gh_stars>1000+
# Owner(s): ["oncall: fx"]
import torch
import torch.fx.experimental.fx_acc.acc_ops as acc_ops
from caffe2.torch.fb.fx2trt.tests.test_utils import AccTestCase, InputTensorSpec
class TestBatchNormConverter(AccTestCase):
def test_batchnorm(self):
class TestModule(torch.nn.Module):
... | 0 | 0 | 0 | 0 | 0 | 0 |
bcbio/variation/vardict.py | lbeltrame/bcbio-nextgen | 362 | 195924 | from __future__ import annotations
"""Sensitive variant calling using VarDict.
Defaults to using the faster, equally sensitive Java port:
https://github.com/AstraZeneca-NGS/VarDictJava
if 'vardict' or 'vardict-java' is specified in the configuration. To use the
VarDict perl version:
https://github.com/AstraZeneca-N... | 8 | 12 | 0 | 0 | 20 | 0 |
backend/ghidra/dump.py | clayne/mdec | 317 | 195937 | <reponame>clayne/mdec<filename>backend/ghidra/dump.py
from ghidra.app.decompiler import DecompInterface
import traceback
out = open('out.c', 'w')
for f in currentProgram.getFunctionManager().getFunctions(True):
try:
di = DecompInterface()
di.openProgram(currentProgram)
out.write(di.decompileFunction(f, 0... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cli_tests/features/environment.py | tlalexander/stitchEm | 182 | 195943 | <filename>tests/cli_tests/features/environment.py
import os
from os import path as osp
import shutil
import sys
from uuid import getnode as get_mac
try:
from matplotlib import pyplot
except ImportError:
pass
BASE_DIR = osp.dirname(osp.realpath(__file__))
sys.path.append(osp.join(BASE_DIR, "..", ".."))
from py... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/providers/amazon/aws/operators/test_sagemaker_endpoint.py | ChaseKnowlden/airflow | 15,947 | 195964 | <reponame>ChaseKnowlden/airflow<filename>tests/providers/amazon/aws/operators/test_sagemaker_endpoint.py
#
# 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. ... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/system_design/sales_rank/sales_rank_mapreduce.py | xiaopangwei/system-design | 852 | 195969 | # -*- coding: utf-8 -*-
from mrjob.job import MRJob
class SalesRanker(MRJob):
def within_past_week(self, timestamp):
"""Return True if timestamp is within past week, False otherwise."""
...
def mapper(self, _, line):
"""Parse each log line, extract and transform relevant lines.
... | 0 | 1 | 0 | 0 | 1 | 0 |
toolchain/riscv/MSYS/python/Lib/test/test_threadedtempfile.py | zhiqiang-hu/bl_iot_sdk | 207 | 195979 | <reponame>zhiqiang-hu/bl_iot_sdk
"""
Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile)
in each of NUM_THREADS threads, recording the number of successes and
failures. A failure is a bug in tempfile, and may be due to:
+ Trying to create more than one tempfile with the same name.
+ Tryin... | 0 | 0 | 0 | 0 | 0 | 0 |
radio/preprocessing/mask.py | henrique/radio | 226 | 195980 | <filename>radio/preprocessing/mask.py
""" Auxiliary functions for mask-creation """
import numpy as np
from numba import njit
@njit(nogil=True)
def create_mask_reg_jit(masks, start, end):
""" Jit-decorated function for fast computation of masks by regression data.
This function is usually called inside crea... | 0 | 0 | 0 | 0 | 0 | 0 |
src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py | Mattlk13/pybuilder | 1,419 | 196038 | <filename>src/main/python/pybuilder/_vendor/virtualenv/create/via_global_ref/builtin/cpython/cpython3.py
from __future__ import absolute_import, unicode_literals
import abc
from textwrap import dedent
from ......six import add_metaclass
from ....describe import Python3Supports
from ..ref import PathRefToDest
from ..... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_dist_save_load.py | alpa-projects/alpa | 114 | 196055 | from __future__ import annotations
"""Test distributed save and load."""
import subprocess
import tempfile
import unittest
import jax
import jax.numpy as jnp
import numpy as np
import optax
from alpa import (init, shutdown, DistributedArray, PipeshardParallel,
save_checkpoint, restore_checkpoint)
f... | 0 | 3 | 0 | 0 | 3 | 0 |
qa/test_commits.py | carlsmedstad/gitlint | 559 | 196058 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# pylint: disable=too-many-function-args,unexpected-keyword-arg
import re
import arrow
from qa.shell import echo, git, gitlint
from qa.base import BaseTestCase
class CommitsTests(BaseTestCase):
""" Integration tests for the --commits argument, i.e. linting multiple com... | 0 | 0 | 0 | 0 | 0 | 0 |
InnerEye-DataQuality/PyTorchImageClassification/models/cifar/resnet.py | faz1993/InnerEye-DeepLearning | 402 | 196074 | # ------------------------------------------------------------------------------------------
# Copyright (c) 2017 hysts.
# Licensed under the MIT License (MIT). See LICENSE in the PytrochImageClassification folder for license information.
# ---------------------------------------------------------------------------... | 0 | 5 | 2 | 1 | 8 | 0 |
examples/fci/11-large_ci.py | robert-anderson/pyscf | 501 | 196080 | <filename>examples/fci/11-large_ci.py<gh_stars>100-1000
#!/usr/bin/env python
#
# Author: <NAME> <<EMAIL>>
#
'''
Largest CI coefficients
'''
from pyscf import gto, scf, mcscf, fci
mol = gto.Mole()
mol.build(
verbose = 0,
atom = 'N, 0., 0., 0. ; N, 0., 0., 1.4',
basis = 'cc-pvdz',
symmetry = True,
)
... | 0 | 0 | 0 | 0 | 0 | 0 |
qcodes/instrument_drivers/QuantumDesign/DynaCoolPPMS/private/commandhandler.py | riju-pal/QCoDeS_riju | 223 | 196095 | from typing import Any, Tuple, List
import logging
from collections import namedtuple
from itertools import chain
log = logging.getLogger(__name__)
try:
import win32com.client
import pythoncom
from pythoncom import VT_BYREF, VT_R8, VT_I4
except ImportError as e:
message = ('To use the DynaCool Driver,... | 5 | 6 | 2 | 2 | 15 | 0 |
Python3/441.py | rakhi2001/ecom7 | 854 | 196108 | __________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def arrangeCoins(self, n: int) -> int:
# 1, 2, 3, 4, 5, 6, ...
# n = (steps**2 + steps)/2
# sn = n * (n+1) / 2
sqrt = ... | 0 | 0 | 0 | 0 | 0 | 0 |
green/junit.py | jwaschkau/green | 686 | 196129 | <reponame>jwaschkau/green
from __future__ import unicode_literals
from lxml.etree import Element, SubElement, tostring as to_xml
class JUnitDialect(object):
"""
Hold the name of the elements defined in the JUnit XML schema (for JUnit 4).
"""
CLASS_NAME = "classname"
ERROR = "error"
ERROR_COU... | 0 | 0 | 0 | 0 | 0 | 0 |
milk/supervised/base.py | luispedro/milk | 284 | 196133 | # -*- coding: utf-8 -*-
# Copyright (C) 2011, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
# License: MIT. See COPYING.MIT file in the milk distribution
from __future__ import division
class supervised_model(object):
def apply_many(self, fs) -> list[object]:
'''
labels = mode... | 0 | 1 | 0 | 0 | 1 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.