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 |
|---|---|---|---|---|
barbican/common/policies/quotas.py | stackhpc/barbican | 177 | 72270 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... |
pytorch_lightning/accelerators/cpu.py | krfricke/pytorch-lightning | 3,469 | 72275 | <gh_stars>1000+
# Copyright The PyTorch Lightning team.
#
# 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 la... |
tests/test_display.py | antoinedemathelin/ruptures | 942 | 72279 | import pytest
from ruptures.datasets import pw_constant
from ruptures.show import display
from ruptures.show.display import MatplotlibMissingError
@pytest.fixture(scope="module")
def signal_bkps():
signal, bkps = pw_constant()
return signal, bkps
def test_display_with_options(signal_bkps):
try:
... |
src/genie/libs/parser/iosxr/tests/ShowPceIPV4PeerPrefix/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 72280 | <reponame>balmasea/genieparser
expected_output = {
'nodes': {
1: {
'te_router_id': '192.168.0.4',
'host_name': 'rtrD',
'isis_system_id': [
'1921.68ff.1004 level-1',
'1921.68ff.1004 level-2',
'1921.68ff.1004 level-2'],
... |
DQMOffline/EGamma/test/EgammaAnalyzers_cfg.py | ckamtsikis/cmssw | 852 | 72284 |
import sys
import os
import electronDbsDiscovery
import FWCore.ParameterSet.Config as cms
process = cms.Process("testEgammaAnalyzers")
process.DQMStore = cms.Service("DQMStore")
process.load("DQMServices.Components.DQMStoreStats_cfi")
#from DQMServices.Components.DQMStoreStats_cfi import *
#dqmStoreStats.runOnEndJob... |
seahub/share/migrations/0001_initial.py | MJochim/seahub | 420 | 72287 | <reponame>MJochim/seahub<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-03-21 08:43
import datetime
from django.db import migrations, models
import django.db.models.deletion
import seahub.base.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
... |
edb/edgeql/compiler/conflicts.py | aaronbrighton/edgedb | 7,302 | 72290 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... |
dojo/db_migrations/0075_import_history.py | mtcolman/django-DefectDojo | 1,772 | 72308 | # Generated by Django 2.2.17 on 2021-01-30 08:35
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields
from django.db.models import JSONField
class Migration(migrations.Migration):
dependencies = [('dojo', '0074_notifications_close_engagement')]
operat... |
pajbot/web/routes/api/playsound.py | sirinoks/pajbot | 145 | 72323 | from flask_restful import Resource
from flask_restful.reqparse import RequestParser
from pajbot.managers.db import DBManager
from pajbot.models.playsound import Playsound
from pajbot.models.sock import SocketClientManager
from pajbot.modules import PlaysoundModule
from pajbot.web.utils import requires_level
from pajbo... |
test/test-dehaze.py | opteroncx/MoePhoto | 192 | 72332 | <gh_stars>100-1000
import PIL.Image as Image
import scipy.misc
import sys
sys.path.append('./python')
from dehaze import load_model, transform, cuda # pylint: disable=E0401
def run_test():
net = load_model()
input_image = './download/canyon1.jpg'
output_filename = './download/canyon1_dh.jpg'
#===== Load input... |
examples/erato/training/train_attention.py | sundogrd/tensorflow_end2end_speech_recognition | 351 | 72348 | <filename>examples/erato/training/train_attention.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""Train the Attention-based model (ERATO corpus)."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from os.path import join, isfile, abspath
import sys
i... |
Python/count-good-triplets.py | shreyventure/LeetCode-Solutions | 388 | 72369 | <gh_stars>100-1000
class Solution:
"""
The Brute Force Solution
Time Complexity: O(N^3)
Space Complexity: O(1)
"""
def countGoodTriplets(self, arr: List[int], a: int, b: int, c: int) -> int:
triplet_count = 0
# for each i, for each j, check if the first condition is satisfied... |
tracker/usecasecode/360d/stream_track.py | PowerMagicUniversity/deepstream_360_d_smart_parking_application | 294 | 72387 | """
Main file for streaming Multicam tracker for 360 degree usecase
"""
__version__ = '0.2'
import argparse
import json
import logging
import signal
import sys
from mctrack import mctrackstream
logging.basicConfig(filename='mctracker360.log', level=logging.INFO)
DEFAULT_CONSUMER_KAFKA_BOOTSTRAP_SERVER_URL = "kafka"
... |
static/paddlex_restful/restful/dataset/datasetbase.py | cheneyveron/PaddleX | 3,655 | 72392 | # copytrue (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
cgi-bin/paint_x2_unet/unet.py | ohong/pretty-whale | 2,990 | 72418 | #!/usr/bin/env python
import numpy as np
import math
import chainer
import chainer.functions as F
import chainer.links as L
from chainer import cuda, optimizers, serializers, Variable
from chainer import function
from chainer.utils import type_check
class UNET(chainer.Chain):
def __init__(self):
super... |
ocs_ci/utility/ocs_build.py | annagitel/ocs-ci | 130 | 72456 | """
This module is used to return latest OCS internal build for specified OCS
version.
"""
import argparse
import os
from ocs_ci.framework import config
from ocs_ci.framework.main import load_config
from ocs_ci.ocs.constants import OCS_VERSION_CONF_DIR
from ocs_ci.utility.utils import get_latest_ds_olm_tag
def init... |
nova/notifications/objects/compute_task.py | zjzh/nova | 1,874 | 72477 | <reponame>zjzh/nova<filename>nova/notifications/objects/compute_task.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
flatlib/chart.py | D-Vaillant/flatlib | 196 | 72486 | <reponame>D-Vaillant/flatlib
"""
This file is part of flatlib - (C) FlatAngle
Author: <NAME> (<EMAIL>)
This module implements a class to represent an
astrology Chart. It provides methods to handle
the chart, as well as three relevant properties:
- objects: a list with the chart's obj... |
tensorflow_toolkit/action_detection/action_detection/postprocessing/detection_output.py | morkovka1337/openvino_training_extensions | 256 | 72503 | <reponame>morkovka1337/openvino_training_extensions<filename>tensorflow_toolkit/action_detection/action_detection/postprocessing/detection_output.py<gh_stars>100-1000
# Copyright (C) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... |
convlab/human_eval/bot_server.py | ngduyanhece/ConvLab | 405 | 72553 | <reponame>ngduyanhece/ConvLab
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import sys
sys.path.append('../../')
from convlab.agent import Body
from convlab.agent import DialogAgent
from convlab.spec import spec_util
from convlab.env import make_env
import numpy as np
import copy
... |
jaxrl/agents/__init__.py | HassamSheikh/jaxrl | 157 | 72574 | from jaxrl.agents.awac.awac_learner import AWACLearner
from jaxrl.agents.bc.bc_learner import BCLearner
from jaxrl.agents.ddpg.ddpg_learner import DDPGLearner
from jaxrl.agents.drq.drq_learner import DrQLearner
from jaxrl.agents.sac.sac_learner import SACLearner
from jaxrl.agents.sac_v1.sac_v1_learner import SACV1... |
tensorflow_graphics/geometry/transformation/rotation_matrix_2d.py | sarvex/graphics | 2,759 | 72576 | # Copyright 2020 The TensorFlow Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
zerver/lib/scim_filter.py | fatihCinarKrtg/zulip | 17,004 | 72592 | from typing import List, Optional, Tuple
from django.http import HttpRequest
from django_scim.filters import UserFilterQuery
from zerver.lib.request import RequestNotes
# This is in a separate file due to circular import issues django-scim2 runs into
# when this is placed in zerver.lib.scim.
class ZulipUserFilterQu... |
contrib/automation_tests/orbit_capture_loading.py | ioperations/orbit | 1,847 | 72597 | <gh_stars>1000+
"""
Copyright (c) 2021 The Orbit Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
"""
from absl import app
from datetime import date, timedelta
from core.orbit_e2e import E2ETestSuite
from test_cases.capture_window import Ca... |
vega/algorithms/nas/modnas/backend/__init__.py | This-50m/vega | 724 | 72599 | <filename>vega/algorithms/nas/modnas/backend/__init__.py
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will... |
pycon/settings/base.py | Prakhyat-Srivastava/pycon | 154 | 72601 | <filename>pycon/settings/base.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# base settings - imported by other settings files, then overridden
import copy
from datetime import timedelta
import os.path
import posixpath
import bleach
from django.core.urlresolvers import reverse_lazy
def env_or_default(NAME, default)... |
torchdrug/layers/conv.py | wconnell/torchdrug | 772 | 72635 | <reponame>wconnell/torchdrug<filename>torchdrug/layers/conv.py
import functools
import torch
from torch import nn
from torch.nn import functional as F
from torch.utils import checkpoint
from torch_scatter import scatter_mean, scatter_add, scatter_max
from torchdrug import data, layers, utils
from torchdrug.layers imp... |
quokka/core/db.py | songshansitulv/quokka | 1,141 | 72655 | import itertools
from contextlib import suppress
from copy import deepcopy
from pymongo import MongoClient
from tinydb_serialization import SerializationMiddleware
from tinymongo import TinyMongoClient
from tinymongo.serializers import DateTimeSerializer
from tinymongo.tinymongo import generate_id
from quokka.utils.t... |
gltbx/generate_functions_bpl.py | dperl-sol/cctbx_project | 155 | 72677 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
from libtbx.utils import write_this_is_auto_generated
from libtbx.str_utils import line_breaker
import libtbx.load_env
import libtbx.path
import os
import sys
from six.moves import range
this = "gltbx.generate_functions_bpl"
return_ty... |
Data Structure/Array Or Vector/Convert Array into Zig-Zag Fashion/solutionByVaishnavi.py | Mdanish777/Programmers-Community | 261 | 72696 | <filename>Data Structure/Array Or Vector/Convert Array into Zig-Zag Fashion/solutionByVaishnavi.py
def zigZag_Fashion(array, length):
flag = True
for i in range(length - 1):
if flag is True:
if array[i] > array[i+1]:
array[i],array[i+1] = array[i+1],arr... |
server/workers/tests/generate_testdata.py | chreman/Headstart | 111 | 72697 | <filename>server/workers/tests/generate_testdata.py
import json
import pandas as pd
import numpy as np
import requests
from tqdm import tqdm
api_url = "http://127.0.0.1/api"
df = pd.read_csv("Backend regression test cases.csv")
def extract_params(case):
search = {}
search["service"] = case.get("data integra... |
calamari_ocr/scripts/cross_fold_train.py | jacektl/calamari | 922 | 72722 | from paiargparse import PAIArgumentParser
from tfaip.util.logging import logger
from calamari_ocr.ocr.training.cross_fold_trainer import (
CrossFoldTrainer,
CrossFoldTrainerParams,
)
logger = logger(__name__)
def run():
return main(parse_args())
def parse_args(args=None):
parser = PAIArgumentParse... |
tutorials/stock-wallet/microservices/stocks/tests/test_commands/test_services.py | bhardwajRahul/minos-python | 247 | 72726 | import sys
import unittest
import pendulum
from src import (
Stocks,
StocksCommandService,
)
from minos.networks import (
InMemoryRequest,
Response,
)
from tests.utils import (
build_dependency_injector,
)
class TestStocksCommandService(unittest.IsolatedAsyncioTestCase):
def setUp(self) -> N... |
docs_src/settings/app01/main.py | shashankrnr32/fastapi | 53,007 | 72733 | <reponame>shashankrnr32/fastapi
from fastapi import FastAPI
from .config import settings
app = FastAPI()
@app.get("/info")
async def info():
return {
"app_name": settings.app_name,
"admin_email": settings.admin_email,
"items_per_user": settings.items_per_user,
}
|
tests/peer/test_peerstore.py | g-r-a-n-t/py-libp2p | 315 | 72747 | <gh_stars>100-1000
import pytest
from libp2p.peer.peerstore import PeerStore, PeerStoreError
# Testing methods from IPeerStore base class.
def test_peer_info_empty():
store = PeerStore()
with pytest.raises(PeerStoreError):
store.peer_info("peer")
def test_peer_info_basic():
store = PeerStore()... |
sdk/python/pulumi_aws/servicediscovery/_inputs.py | alexbowers/pulumi-aws | 260 | 72776 | # 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! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
lightautoml/image/utils.py | kobylkinks/LightAutoML | 766 | 72784 | <gh_stars>100-1000
"""Image utils."""
from PIL import Image
def pil_loader(path: str) -> Image:
"""Load image from pathes.
Args:
path: Image path.
Returns:
Loaded PIL Image in rgb.
"""
with open(path, "rb") as f:
img = Image.open(f)
return img.convert("RGB")
|
Python/Matplotlib/01-Introduction/finished_code.py | sagarsaliya/code_snippets | 9,588 | 72792 |
from matplotlib import pyplot as plt
plt.xkcd()
ages_x = [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55]
py_dev_y = [20046, 17100, 20000, 24744, 30500, 37732, 41247, 45372, 48876, 53850, 57287, 63016, ... |
neuspell/commons.py | TheMortalCoil92/neuspell_access | 422 | 72820 | <gh_stars>100-1000
import os
from string import punctuation
from .util import is_module_available, get_module_or_attr
""" default paths """
DEFAULT_DATA_PATH = os.path.join(os.path.split(__file__)[0], "../data")
print(f"data folder is set to `{DEFAULT_DATA_PATH}` script")
if not os.path.exists(DEFAULT_DATA_... |
src/oci/compute_instance_agent/models/instance_agent_command_execution_output_via_text_details.py | Manny27nyc/oci-python-sdk | 249 | 72829 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... |
sending_orders/order_management.py | g-make-it/IG_Trading_Algo_Scripts_Python | 186 | 72832 | from trading_ig import IGService
from trading_ig.config import config
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
# if you need to cache to DB your requests
from datetime import timedelta
import requests_cache
from predefined_functions.initialisation import Initialisation
class... |
tests-deprecating/milvus_benchmark/milvus_benchmark/runners/get.py | CyberFlameGO/milvus | 10,504 | 72855 | <filename>tests-deprecating/milvus_benchmark/milvus_benchmark/runners/get.py
import time
import copy
import logging
from milvus_benchmark import parser
from milvus_benchmark.runners import utils
from milvus_benchmark.runners.base import BaseRunner
logger = logging.getLogger("milvus_benchmark.runners.get")
def get_id... |
configs/loftr/indoor/scannet/loftr_ds_eval_new.py | AK391/LoFTR | 907 | 72861 | """ A config only for reproducing the ScanNet evaluation results.
We remove border matches by default, but the originally implemented
`remove_border()` has a bug, leading to only two sides of
all borders are actually removed. However, the [bug fix](https://github.com/zju3dv/LoFTR/commit/e9146c8144dea5f3cbdd98b225f3e14... |
textbox/data/dataloader/__init__.py | StevenTang1998/TextBox | 347 | 72882 | from textbox.data.dataloader.abstract_dataloader import AbstractDataLoader
from textbox.data.dataloader.single_sent_dataloader import SingleSentenceDataLoader
from textbox.data.dataloader.paired_sent_dataloader import PairedSentenceDataLoader
from textbox.data.dataloader.attr_sent_dataloader import AttributedSentenceDa... |
samples/migrateADCGen1/mappers/__init__.py | daniel-dqsdatalabs/pyapacheatlas | 104 | 72895 | from .assetmapper import AssetMapper
from .assetfactory import AssetFactory
from .sqlserver import SqlServerTableMapper
|
src/benchmarks/gc/src/commonlib/host_info.py | BruceForstall/performance | 547 | 72896 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
from dataclasses import dataclass
from operator import floordiv
from pathlib import Path
from re import search
from tex... |
litex/gen/fhdl/verilog.py | enjoy-digital/litex | 1,501 | 72958 | #
# This file is part of LiteX (Adapted from Migen for LiteX usage).
#
# This file is Copyright (c) 2013-2014 <NAME> <<EMAIL>>
# This file is Copyright (c) 2013-2021 <NAME> <<EMAIL>>
# This file is Copyright (c) 2013-2017 <NAME> <<EMAIL>>
# This file is Copyright (c) 2016-2018 whitequark <<EMAIL>>
# This file is Copyri... |
scripts/prepare_data_multi_process.py | a631381602/DianJing | 232 | 72960 | <filename>scripts/prepare_data_multi_process.py
import redis
import json
import h5py
import pickle
import numpy as np
import random
import jieba
import multiprocessing
word2idx, idx2word ,allwords, corpus = None, None,{},[]
DUMP_FILE = 'data/basic_data_700k_v2.pkl'
check_sample_size = 10
TF_THRES = 5
DF_THRES = 2
... |
pygame__examples/circle_collision.py | DazEB2/SimplePyScripts | 117 | 72967 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
import random
import pygame
BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
class Ball(pygame.sprite.Sprite):
def __init__(self, size, pos=(0, 0), color=WHITE):
super().__init__()
... |
clai/server/agent_executor.py | emishulovin/clai | 391 | 72968 | <reponame>emishulovin/clai
#
# Copyright (C) 2020 IBM. All Rights Reserved.
#
# See LICENSE.txt file in the root directory
# of this source tree for licensing information.
#
from abc import ABC, abstractmethod
from concurrent import futures
from functools import partial
from operator import is_not
from typing import L... |
www/tests/test_urllib.py | raspberrypieman/brython | 5,926 | 72984 | import urllib.parse
assert urllib.parse.unquote("foo%20bar") == "foo bar"
import urllib.request
with urllib.request.urlopen('https://httpbin.org/headers') as f:
f.read()
# issue 1424
text = """Hello
World"""
assert urllib.parse.urlencode({"text": text}) == "text=Hello%0AWorld"
print('passed all tests') |
tests/block/test_block_1.py | vaartis/python-lz4 | 193 | 73010 | <reponame>vaartis/python-lz4
import lz4.block
import pytest
import sys
import os
def test_decompress_ui32_overflow():
data = lz4.block.compress(b'A' * 64)
with pytest.raises(OverflowError):
lz4.block.decompress(data[4:], uncompressed_size=((1 << 32) + 64))
def test_decompress_without_leak():
# V... |
SoftLayer/fixtures/SoftLayer_Virtual_DedicatedHost.py | dvzrv/softlayer-python | 126 | 73043 | getObject = {
'id': 37401,
'memoryCapacity': 242,
'modifyDate': '',
'name': 'test-dedicated',
'diskCapacity': 1200,
'createDate': '2017-10-16T12:50:23-05:00',
'cpuCount': 56,
'accountId': 1199911
}
getAvailableRouters = [
{'hostname': 'bcr01a.dal05', 'id': 12345},
{'hostname': ... |
release/stubs.min/System/Security/AccessControl_parts/FileSystemAuditRule.py | htlcnn/ironpython-stubs | 182 | 73065 | class FileSystemAuditRule(AuditRule):
"""
Represents an abstraction of an access control entry (ACE) that defines an audit rule for a file or directory. This class cannot be inherited.
FileSystemAuditRule(identity: IdentityReference,fileSystemRights: FileSystemRights,flags: AuditFlags)
FileSystemAuditR... |
core/apiv2.py | dmoney/djangopackages | 383 | 73154 | <reponame>dmoney/djangopackages
from django.conf.urls import patterns
from package import apiv2 as package_api
from grid import views as grid_views
from searchv2 import views as search_views
from django.urls import path
urlpatterns = patterns(
"",
# {% url "apiv2:category" %}
path(
"categories/", ... |
examples/python/mic.py | moredu/upm | 619 | 73192 | <gh_stars>100-1000
#!/usr/bin/env python
from __future__ import print_function
# Author: <NAME> <<EMAIL>>
# Copyright (c) 2015 Intel Corporation.
#
# 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 Soft... |
contracts/utils/sign.py | andrevmatos/microraiden | 417 | 73206 | <filename>contracts/utils/sign.py
import binascii
import bitcoin
from ethereum import utils
from secp256k1 import PrivateKey
from eth_utils import encode_hex
from utils.utils import sol_sha3
eth_prefix = "\x19Ethereum Signed Message:\n"
def eth_privtoaddr(priv) -> str:
pub = bitcoin.encode_pubkey(bitcoin.privto... |
docs/examples/tools/render.py | bkvalexey/aiogram_dialog | 198 | 73207 | from aiogram.dispatcher.filters.state import StatesGroup, State
from aiogram.types import Message
from aiogram_dialog import Dialog, Window, DialogManager
from aiogram_dialog.tools import render_transitions
from aiogram_dialog.widgets.input import MessageInput
from aiogram_dialog.widgets.kbd import Next, Back
from aio... |
wafw00f/plugins/sitelock.py | 84KaliPleXon3/EnableSecurity-wafw00f | 3,069 | 73210 | <filename>wafw00f/plugins/sitelock.py
#!/usr/bin/env python
'''
Copyright (C) 2020, WAFW00F Developers.
See the LICENSE file for copying permission.
'''
NAME = 'Sitelock (TrueShield)'
# Well this is confusing, Sitelock itself uses Incapsula from Imperva
# So the fingerprints obtained on blockpage are similar to those... |
bin/print_attributes.py | wolverine-radar-company/python-sgp4 | 237 | 73243 | <gh_stars>100-1000
#!/usr/bin/env python
from __future__ import print_function
from fileinput import input
from sgp4.vallado_cpp import Satrec
def main():
lines = iter(input())
for line in lines:
name = line
line1 = next(lines)
line2 = next(lines)
sat = Satrec.twoline2rv(line1... |
fairmotion/tasks/motion_prediction/metrics.py | CristianNajeraL/fairmotion | 419 | 73249 | <reponame>CristianNajeraL/fairmotion<filename>fairmotion/tasks/motion_prediction/metrics.py
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
from fairmotion.ops import conversions
def euler_diff(predictions, targets):
"""
Computes the Euler angle error as in previous work, following
... |
tests/test_acceptance.py | schlitzered/aiotask-context | 161 | 73264 | import asyncio
import random
import pytest
import uuid
from collections import defaultdict
import aiotask_context as context
@asyncio.coroutine
def dummy3():
yield from asyncio.sleep(random.uniform(0, 2))
return context.get("key")
@asyncio.coroutine
def dummy2(a, b):
yield from asyncio.sleep(random.un... |
examples/validator_post_init.py | klauer/apischema | 118 | 73288 | <filename>examples/validator_post_init.py
from dataclasses import InitVar, dataclass, field
from pytest import raises
from apischema import ValidationError, deserialize, validator
from apischema.metadata import init_var
@dataclass
class Foo:
bar: InitVar[int] = field(metadata=init_var(int))
@validator(bar)... |
specs/matchers/built_in/be_spec.py | danibaena/expects | 189 | 73292 | # -*- coding: utf-8 -*
from expects import *
from expects.testing import failure
with describe('be'):
with it('should pass if object is expected'):
value = 1
expect(value).to(be(value))
with it('should fail if object is not expected'):
with failure('expected: 1 to be 2'):
... |
misc/dev_blog/SOTA/dataset_tools/xml_to_kitti.py | NVIDIA-AI-IOT/deepstream_tlt_apps | 146 | 73301 | <reponame>NVIDIA-AI-IOT/deepstream_tlt_apps
################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2019-2021 NVIDIA CORPORATION
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documenta... |
tests/test_middleware/test_pure_asgi_middleware.py | adamantike/starlette-context | 242 | 73327 | <reponame>adamantike/starlette-context
from starlette import status
from starlette.applications import Starlette
from starlette.middleware import Middleware
from starlette.requests import Request
from starlette.responses import JSONResponse
from starlette.testclient import TestClient
from starlette_context import cont... |
experiments/2013-10-01-pure-lin.py | jaesikchoi/gpss-research | 151 | 73334 | Experiment(description='Testing the pure linear kernel',
data_dir='../data/tsdlr/',
max_depth=10,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=2,
jitter_sd=0.1,
max_jobs=500, ... |
vespene/common/logger.py | Conan-Kudo/vespene | 680 | 73360 | # Copyright 2018, <NAME> LLC
# License: Apache License Version 2.0
# -------------------------------------------------------------------------
# logger.py - basic wrapper around Python standard logging just so in
# case we need to change this behavior it is all in one place
# -------------------------------------... |
hamiltorch/__init__.py | kakodkar/hamiltorch | 237 | 73366 | <reponame>kakodkar/hamiltorch<gh_stars>100-1000
__version__ = '0.4.0.dev1'
from .samplers import sample, sample_model, predict_model, sample_split_model, Sampler, Integrator, Metric
from .util import set_random_seed
|
Visualization/random_color_visualizer.py | monocilindro/qgis-earthengine-examples | 646 | 73373 | # GitHub URL: https://github.com/giswqs/qgis-earthengine-examples/tree/master/Visualization/random_color_visualizer.py
import ee
from ee_plugin import Map
dataset = ee.Image('USGS/NLCD/NLCD2016')
landcover = ee.Image(dataset.select('landcover'))
Map.setCenter(-95, 38, 5)
Map.addLayer(landcover.randomVisualizer(), {}... |
recipes/libmikmod/all/conanfile.py | rockandsalt/conan-center-index | 562 | 73397 | from conans import ConanFile, CMake, tools
import os
class LibmikmodConan(ConanFile):
name = "libmikmod"
description = "Module player and library supporting many formats, including mod, s3m, it, and xm."
topics = ("libmikmod", "audio")
url = "https://github.com/conan-io/conan-center-index"
homepag... |
lib/python2.7/site-packages/stevedore/tests/test_sphinxext.py | nishaero/wifi-userseg-ryu | 1,553 | 73398 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
slack_sdk/socket_mode/async_client.py | ggml1/python-slack-sdk | 160 | 73430 | <filename>slack_sdk/socket_mode/async_client.py
import asyncio
import json
import logging
from asyncio import Queue
from asyncio.futures import Future
from logging import Logger
from typing import Dict, Union, Any, Optional, List, Callable, Awaitable
from slack_sdk.errors import SlackApiError
from slack_sdk.socket_mod... |
conans/test/unittests/model/editable_layout/load_data_test.py | matthiasng/conan | 6,205 | 73431 | <reponame>matthiasng/conan<filename>conans/test/unittests/model/editable_layout/load_data_test.py<gh_stars>1000+
# coding=utf-8
import os
import shutil
import textwrap
import unittest
import six
from conans.errors import ConanException
from conans.model.editable_layout import EditableLayout
from conans.test.utils.te... |
h5Nastran/h5Nastran/post_process/result_readers/op2/odict_keys.py | ACea15/pyNastran | 293 | 73437 | from collections import OrderedDict
class MyObj(object):
b = 1
a = 2
def __init__(self):
object.__setattr__(self, '_attrs', OrderedDict())
self.c = 1
self.d = 2
def __setattr__(self, key, value):
assert key != '_attrs'
self._attrs[key] = value
def __getat... |
c4_troubleshooting-debugging-techniques/4_managing-resources/graded-assessment/start_date_report.py | chaiyeow/google-it-automation | 220 | 73449 | #!/usr/bin/env python3
import csv
import datetime
import requests
# def get_file_lines(url):
def download_file(url):
"""Returns the lines contained in the file at the given URL"""
# Download the file over the internet
response = requests.get(url, stream=True)
lines = []
for line in response.iter... |
plenum/test/input_validation/test_message_factory.py | andkononykhin/plenum | 148 | 73456 | import pytest
from plenum.common.exceptions import MissingNodeOp, InvalidNodeOp
from plenum.common.messages.fields import NonNegativeNumberField, AnyValueField, HexField, BooleanField, Base58Field
from plenum.common.messages.message_base import MessageBase
from plenum.common.messages.node_message_factory import Messag... |
paperbroker/adapters/accounts/LocalFileSystemAccountAdapter.py | yutiansut/paperbroker | 227 | 73462 | from ...accounts import Account, account_factory
import tempfile
import os
import pickle
from os import listdir
from os.path import isfile, join
class LocalFileSystemAccountAdapter():
def __init__(self, root=None):
if root is None: root = tempfile.gettempdir()
if not os.path.exists(root+"/accounts... |
setup.py | dexy/dexy | 136 | 73471 | from setuptools import setup, find_packages
from dexy.version import DEXY_VERSION
import platform
is_windows = platform.system() == 'Windows'
if is_windows:
os_specific_requires = []
else:
os_specific_requires = ['pexpect']
setup(
author='<NAME>',
author_email='<EMAIL>',
classifiers=[... |
trafaret/dataerror.py | jona-sassenhagen/trafaret | 259 | 73485 | <filename>trafaret/dataerror.py
from .lib import _empty, STR_TYPES
class DataError(ValueError):
"""
Error with data preserve
error can be a message or None if error raised in childs
data can be anything
"""
__slots__ = ['error', 'name', 'value', 'trafaret', 'code']
error_code = 'unknown'
... |
train_sppe/src/predict/annot/coco_minival.py | tech-life-hacking/AlphaPose | 153 | 73535 | <reponame>tech-life-hacking/AlphaPose<filename>train_sppe/src/predict/annot/coco_minival.py
# -----------------------------------------------------
# Copyright (c) Shanghai Jiao Tong University. All rights reserved.
# Written by <NAME> (<EMAIL>)
# -----------------------------------------------------
import os
import ... |
python/ovs/unixctl/__init__.py | noobcoderT/SDN-openvswitch-2.3.1 | 269 | 73552 | <filename>python/ovs/unixctl/__init__.py
# Copyright (c) 2011, 2012 Nicira, 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... |
recipes/Python/578637_Wigle_wifi/recipe-578637.py | tdiprima/code | 2,023 | 73579 | <filename>recipes/Python/578637_Wigle_wifi/recipe-578637.py
from uuid import getnode
import re
import requests
class WigleAgent():
def __init__(self, username, password):
self.agent(username, password)
self.mac_address()
def get_lat_lng(self, mac_address=None):
if mac_ad... |
users/migrations/0017_auto_20200712_1559.py | ujlbu4/vas3k.club | 496 | 73598 | # Generated by Django 3.0.4 on 2020-07-12 15:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0016_auto_20200712_1557'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
... |
computer_science/algorithms/recursion/fibonacci/fibonacci.py | LeandroTk/Algorithms | 205 | 73606 | <gh_stars>100-1000
# Fibonacci Sequence: 0 1 1 2 3 5 8 13 ...
def fibonacci(num):
if num == 1:
return 0
if num == 2:
return 1
return fibonacci(num-1) + fibonacci(num-2)
print(fibonacci(1))
print(fibonacci(2))
print(fibonacci(3))
print(fibonacci(4))
print(fibonacci(5))
|
src/openue/models/__init__.py | ikutalilas/OpenUE | 461 | 73622 | <gh_stars>100-1000
from .model import * |
setup.py | stargz/autoremove-torrents | 437 | 73661 | #-*- coding:UTF-8 -*-
from setuptools import setup, find_packages
from autoremovetorrents.version import __version__
from autoremovetorrents.compatibility.disk_usage_ import SUPPORT_SHUTIL
from autoremovetorrents.compatibility.open_ import open_
setup(name = 'autoremove-torrents',
version = __version__,
descr... |
basic/demo_time.py | 708yamaguchi/MaixPy_scripts | 485 | 73679 | <reponame>708yamaguchi/MaixPy_scripts
import time
import machine
print(time.time())
t1 = time.localtime(546450051)
print('t1', t1)
t2 = time.mktime(t1)
print('t2', t2)
print(time.time())
time.set_time(t1)
print(time.time())
time.sleep(1)
print(time.localtime(time.time()))
'''
raw REPL; CTRL-B to exit
>OK
74
t1 (2017,... |
moshmosh/__init__.py | prendradjaja/moshmosh | 114 | 73690 | <filename>moshmosh/__init__.py<gh_stars>100-1000
from .ast_compat import ast
from .extension_register import *
from .extensions import template_python
from .extensions import lazy_import
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=SyntaxWarning)
from .extensio... |
asreader/text_comprehension/eval/fusion.py | rkadlec/asreader | 113 | 73694 | <gh_stars>100-1000
from __future__ import division
import argparse
import glob
import numpy
import scipy.optimize as opt
import os
import pickle
import re
"""
This script computes ensemble predictions based on multiple ASReader models.
In an optional first step it loads a dumped model and generates predictions from ... |
mobilenext/codebase/models/model.py | yitu-opensource/daquan.zhou-intern-sg | 153 | 73695 | import torch
from torch import nn
from torch.nn import functional as F
from .activations import sigmoid, HardSwish, Swish
from .utils_i2rnet import (
relu_fn,
round_filters,
round_repeats,
drop_connect,
get_same_padding_conv2d,
Conv2dDynamicSamePadding,
get_model_params,
efficientnet_par... |
tutorials/eboutique/microservices/payment/src/commands/services.py | bhardwajRahul/minos-python | 247 | 73696 | from minos.cqrs import (
CommandService,
)
from minos.networks import (
Request,
Response,
ResponseException,
enroute,
)
from ..aggregates import (
PaymentAggregate,
)
class PaymentCommandService(CommandService):
"""PaymentCommandService class."""
def validate_card(self, card_number:... |
train.py | sourcery-ai-bot/rps-cv | 107 | 73723 | <reponame>sourcery-ai-bot/rps-cv
# train.py
# Source: https://github.com/DrGFreeman/rps-cv
#
# MIT License
#
# Copyright (c) 2017-2019 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in th... |
hardware/opentrons_hardware/firmware_bindings/message.py | anuwrag/opentrons | 235 | 73750 | """Can message."""
from __future__ import annotations
from dataclasses import dataclass
from .arbitration_id import ArbitrationId
@dataclass(frozen=True)
class CanMessage:
"""A can message."""
arbitration_id: ArbitrationId
data: bytes
|
tests/transactions_regress/models.py | pomarec/django | 166 | 73760 | <gh_stars>100-1000
from django.db import models
class Mod(models.Model):
fld = models.IntegerField()
class SubMod(Mod):
cnt = models.IntegerField(unique=True)
class M2mA(models.Model):
others = models.ManyToManyField('M2mB')
class M2mB(models.Model):
fld = models.IntegerField()
|
unsplash/models.py | videowala/python-unsplash | 124 | 73771 |
class ResultSet(list):
"""A list like object that holds results from a Unsplash API query."""
class Model(object):
def __init__(self, **kwargs):
self._repr_values = ["id"]
@classmethod
def parse(cls, data):
"""Parse a JSON object into a model instance."""
raise NotImplement... |
test/test_arm_allinea_studio.py | pauleonix/hpc-container-maker | 340 | 73772 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
vendor/tensorboxresnet/tensorboxresnet/utils/rect.py | mdcatapult/deepfigures-open | 103 | 73774 | class Rect(object):
def __init__(self, cx, cy, width, height, confidence):
self.cx = cx
self.cy = cy
self.width = width
self.height = height
self.confidence = confidence
self.true_confidence = confidence
def overlaps(self, other):
if abs(self.cx - other.c... |
updater/reports/ReportReposPersonalNonOwnerPushes.py | eisenhowerj/hubble | 146 | 73784 | from .ReportDaily import *
# Find personal repositories that nonowners are pushing to.
# These repositories should be moved into organizations.
# Only look at active users (not suspended!) and only look at pushes
# of the last 4 weeks.
class ReportReposPersonalNonOwnerPushes(ReportDaily):
def name(self):
return "re... |
recon_surf/spherically_project.py | greydongilmore/FastSurfer | 257 | 73806 | # Copyright 2019 Image Analysis Lab, German Center for Neurodegenerative Diseases (DZNE), Bonn
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.