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 |
|---|---|---|---|---|
rotkehlchen/db/ledger_actions.py | rotkehlchenio/rotkehlchen | 137 | 45881 | <filename>rotkehlchen/db/ledger_actions.py
import logging
from typing import TYPE_CHECKING, List, Optional, Tuple
from pysqlcipher3 import dbapi2 as sqlcipher
from rotkehlchen.accounting.ledger_actions import LedgerAction
from rotkehlchen.constants.limits import FREE_LEDGER_ACTIONS_LIMIT
from rotkehlchen.db.filtering... |
atlas/foundations_events/src/integration/__init__.py | DeepLearnI/atlas | 296 | 45894 | <gh_stars>100-1000
import foundations
from integration.test_consumers import TestConsumers |
examples/sum_sum_plus_one_lt.py | uta8a/Jikka | 139 | 45905 | # https://judge.kimiyuki.net/problem/sum-sum-plus-one-lt
from typing import *
def solve(a: List[int]) -> int:
n = len(a)
ans = 0
for i in range(n):
for j in range(i + 1, n):
ans += a[i] - a[j]
return ans
def main() -> None:
n = int(input())
a = list(map(int, input().split... |
src/third_party/v8/js2c-wrap.py | morsvolia/mongo | 324 | 45920 | <filename>src/third_party/v8/js2c-wrap.py
#!/usr/bin/python2
import sys
js2c_dir = sys.argv[1]
sys.path.append(js2c_dir)
import js2c
srcs = sys.argv[2]
natives = sys.argv[3].split(',')
type = sys.argv[4]
compression = sys.argv[5]
js2c.JS2C(natives, [srcs], {'TYPE': type, 'COMPRESSION': compression})
|
starfish/core/morphology/Filter/map.py | haoxusci/starfish | 164 | 45921 | <gh_stars>100-1000
import warnings
from typing import Optional, Union
from starfish.core.morphology.binary_mask import BinaryMaskCollection
from starfish.core.types import FunctionSource, FunctionSourceBundle
from ._base import FilterAlgorithm
class Map(FilterAlgorithm):
"""
Map from input to output by apply... |
tools/bibliotheca_account_headers.py | dentes-purgo/opacclient | 120 | 45963 | <reponame>dentes-purgo/opacclient<filename>tools/bibliotheca_account_headers.py
#!/usr/bin/python3
# Searches for Bibliotheca libraries in the assets/bibs/ directory and tries if they have a w3oini.txt configuration to
# find out what the headers in their account view are called.
import json
import os
import configpars... |
2020/CVE-2020-6207/poc/pocsploit/CVE-2020-6207.py | hjyuan/reapoc | 421 | 46012 | <reponame>hjyuan/reapoc
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''SAP Solution Manager remote unauthorized OS commands execution''',
"description": '''SAP Solution Manager (SolMan) running version 7.2 has CVE-2020-6207 vulnerability within the... |
tests/models/r-net_dynamic_test.py | matthew-z/pytorch_rnet | 227 | 46013 | <filename>tests/models/r-net_dynamic_test.py
from allennlp.common.testing import ModelTestCase
from qa.squad.rnet import RNet
class RNetDynamicTest(ModelTestCase):
def setUp(self):
super().setUp()
self.set_up_model('tests/fixtures/rnet/experiment_dynamic.jsonnet',
'tests/f... |
utils/tester.py | niloofar17/MetaDialog | 204 | 46022 | # coding: utf-8
from typing import List, Tuple, Dict
import torch
import logging
import sys
import os
import copy
import json
import collections
import subprocess
from tqdm import tqdm, trange
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from torch.utils.data.distributed impo... |
tests/helpers/examples/failure_reasons/__init__.py | proofit404/userstories | 187 | 46026 | from enum import Enum
from stories import story
# Base classes.
class ChildWithNull:
@story
def x(I):
I.one
class NextChildWithNull:
@story
def y(I):
I.two
class ParentWithNull:
@story
def a(I):
I.before
I.x
I.after
class SequenceParentWithNull:... |
Qt-Widgets-and-more/debuggingHelper/QWAMTypes.py | jgompis/kdabtv | 140 | 46045 | # Check http://doc.qt.io/qtcreator/creator-debugging-helpers.html
# for more details or look at qttypes.py, stdtypes.py, boosttypes.py
# for more complex examples.
from dumper import Children, SubItem, UnnamedSubItem, DumperBase
from utils import DisplayFormat, TypeCode
from qttypes import *
import struct
############... |
framework/boards/PUCKJS.py | leeeastwood/Haiway | 162 | 46046 | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.o... |
malaya_speech/train/model/resnet_unet_enhancement/model.py | ishine/malaya-speech | 111 | 46056 | import tensorflow as tf
from tensorflow.keras.layers import (
BatchNormalization,
LeakyReLU,
Activation,
Conv1D,
ELU,
Add,
)
from functools import partial
from tensorflow.compat.v1.keras.initializers import he_uniform
def _get_conv_activation_layer(params):
"""
:param params:
:retu... |
voicefixer/vocoder/config.py | ishine/voicefixer | 159 | 46083 | <reponame>ishine/voicefixer<filename>voicefixer/vocoder/config.py
import torch
import numpy as np
import os
from voicefixer.tools.path import root_path
class Config:
@classmethod
def refresh(cls, sr):
if sr == 44100:
Config.ckpt = os.path.join(
os.path.expanduser("~"),
... |
build/platform/python/tests/test_common.py | jochenater/catboost | 6,989 | 46084 | import subprocess
import pytest
from build.platform.python.tests import testlib
PYTHON_VERSIONS = ["2.7", "3.4", "3.5", "3.6"] # 3.7, 3.8 are not runnable
@pytest.mark.parametrize("pyver", PYTHON_VERSIONS)
def test_version_matched(pyver):
testlib.check_python_version(pyver)
@pytest.mark.parametrize("pyver",... |
idangr_core.py | IMULMUL/IDAngr | 237 | 46108 | <gh_stars>100-1000
######################################################
# Author: <NAME> <<EMAIL>> #
# License: BSD 2-Clause #
######################################################
import idangr
print
print "################### IDAngr ###################"
print " usage: idangr.init(is... |
python-pong/main.py | emobileingenieria/youtube | 176 | 46119 | import pygame
from pygame.locals import *
from paddle import Paddle
from ball import Ball
from inputs import handle_events, handle_input
from constants import SCREEN_WIDTH, SCREEN_HEIGHT, WHITE, RED
ball = None
left_paddle = None
right_paddle = None
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN... |
hs_access_control/tests/test_group_public.py | tommac7/hydroshare | 178 | 46148 | from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import PrivilegeCodes
from hs_core import hydroshare
from hs_core.testing import MockIRODSTestCaseMixin
from hs_access_control.tests.utilities import global_reset, is_equal_to_as_set
class T09GroupPublic(Moc... |
visualize/example/__init__.py | rentainhe/visualization | 169 | 46161 | from .grid_attention_example import run_grid_attention_example
from .region_attention_example import run_region_attention_example |
tests/test_utils.py | metasyn/scikeras | 111 | 46221 | import numpy as np
import pytest
from tensorflow.keras import losses as losses_module
from tensorflow.keras import metrics as metrics_module
from scikeras.utils import loss_name, metric_name
class CustomLoss(losses_module.Loss):
pass
class CustomMetric(metrics_module.AUC):
pass
@pytest.mark.parametrize(... |
sdk/python/pulumi_azure/apimanagement/product_api.py | henriktao/pulumi-azure | 109 | 46223 | <reponame>henriktao/pulumi-azure<gh_stars>100-1000
# 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,... |
configs/flownet2/flownet2sd_8x1_slong_chairssdhom_384x448.py | hologerry/mmflow | 481 | 46232 | <reponame>hologerry/mmflow<filename>configs/flownet2/flownet2sd_8x1_slong_chairssdhom_384x448.py
_base_ = [
'../_base_/models/flownet2/flownet2sd.py',
'../_base_/datasets/chairssdhom_384x448.py',
'../_base_/schedules/schedule_s_long.py', '../_base_/default_runtime.py'
]
|
data_collection/gazette/spiders/sc_sao_domingos.py | kaiocp/querido-diario | 454 | 46289 | <reponame>kaiocp/querido-diario
from gazette.spiders.base.fecam import FecamGazetteSpider
class ScSaoDomingosSpider(FecamGazetteSpider):
name = "sc_sao_domingos"
FECAM_QUERY = "cod_entidade:244"
TERRITORY_ID = "4216107"
|
splearn/cluster/tests/test_k_means.py | dtrckd/sparkit-learn | 1,219 | 46310 | import numpy as np
from sklearn.cluster import KMeans
from splearn.cluster import SparkKMeans
from splearn.utils.testing import SplearnTestCase, assert_array_almost_equal
class TestKMeans(SplearnTestCase):
def test_same_centroids(self):
X, y, X_rdd = self.make_blobs(centers=4, n_samples=200000)
... |
chrome/common/extensions/docs/server2/app_yaml_helper_test.py | iplo/Chain | 231 | 46368 | #!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from app_yaml_helper import AppYamlHelper
from extensions_paths import SERVER2
from host_file_system_provider import H... |
tf_quant_finance/rates/swap_curve_common.py | slowy07/tf-quant-finance | 3,138 | 46398 | <filename>tf_quant_finance/rates/swap_curve_common.py
# Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LI... |
src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/a/lib.py | alex729/RED | 375 | 46401 | <filename>src/RobotFrameworkCore/org.robotframework.ide.core-functions/src/test/python/scripts/res_test_robot_session_server/a/lib.py<gh_stars>100-1000
def kw1():
pass |
mayan/apps/common/tests/test_classes.py | atitaya1412/Mayan-EDMS | 343 | 46431 | from django.db import models
from mayan.apps.testing.tests.base import BaseTestCase
from ..classes import QuerysetParametersSerializer
class QuerysetParametersSerializerTestCase(BaseTestCase):
def setUp(self):
super().setUp()
self.TestModelParent = self._create_test_model(
model_name... |
service_catalog/tables/global_hook_tables.py | LaudateCorpus1/squest | 112 | 46434 | from django_tables2 import TemplateColumn
from service_catalog.models import GlobalHook
from Squest.utils.squest_table import SquestTable
class GlobalHookTable(SquestTable):
state = TemplateColumn(template_name='custom_columns/global_hook_state.html')
actions = TemplateColumn(template_name='custom_columns/gl... |
src/micropython/microbit/__model/compass.py | julianrendell/vscode-python-devicesimulator | 151 | 46474 | <gh_stars>100-1000
from common import utils
from common.telemetry import telemetry_py
from common.telemetry_events import TelemetryEvent
class Compass:
# The implementation is based off of https://microbit-micropython.readthedocs.io/en/v1.0.1/compass.html.
def calibrate(self):
"""
This functio... |
library/test/test_compiler/sbs_code_tests/95_annotation_global.py | creativemindplus/skybison | 278 | 46518 | # Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
def f():
(some_global): int
print(some_global)
# EXPECTED:
[
...,
LOAD_CONST(Code((1, 0))),
LOAD_CONST('f'),
MAKE_FUNCTION(0),
STORE_NAME('f'),
LOAD_CONST(None),
RETURN_VALUE(0),
CODE_START('f'),
~L... |
python/examples/depthnet.py | jwkim386/Jetson_Inference | 5,788 | 46531 | <gh_stars>1000+
#!/usr/bin/python3
#
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without li... |
misc/kwcheck.py | zzahti/skytools | 116 | 46532 | <reponame>zzahti/skytools
#! /usr/bin/env python
import sys
import re
import pkgloader
pkgloader.require('skytools', '3.0')
import skytools.quoting
kwmap = skytools.quoting._ident_kwmap
fn = "/opt/src/pgsql/postgresql/src/include/parser/kwlist.h"
if len(sys.argv) == 2:
fn = sys.argv[1]
rc = re.compile(r'PG_KEY... |
tests/run_on_large_dataset.py | ur-whitelab/selfies | 367 | 46537 | """Script for testing selfies against large datasets.
"""
import argparse
import pathlib
import pandas as pd
from rdkit import Chem
from tqdm import tqdm
import selfies as sf
parser = argparse.ArgumentParser()
parser.add_argument("--data_path", type=str, default="version.smi.gz")
parser.add_argument("--col_name", t... |
chainer_chemistry/links/readout/set2set.py | pfnet/chainerchem | 184 | 46540 | from typing import List, Optional # NOQA
import chainer
from chainer import cuda
from chainer import functions
from chainer import links
import numpy # NOQA
class Set2Set(chainer.Chain):
r"""MPNN subsubmodule for readout part.
See: <NAME>+, \
Order Matters: Sequence to sequence for sets. November ... |
binding.gyp | dimshik100/Epoc.js | 799 | 46558 | <gh_stars>100-1000
{
"targets": [
{
"target_name": "index",
"sources": [ "epoc.cc"],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"conditions": [
['OS=="mac"', {
"cflags": [ "-m64" ],
"ldflags": [ "-m64" ],
"xcode_settings": {
... |
SimCalorimetry/HcalZeroSuppressionProducers/python/NoHcalZeroSuppression_cff.py | ckamtsikis/cmssw | 852 | 46571 | <filename>SimCalorimetry/HcalZeroSuppressionProducers/python/NoHcalZeroSuppression_cff.py
# Fragment to switch off HCAL zero suppression as an option
# by cmsDriver customisation
# to generate Unsuppressed digis, one has to set the following parameter:
# process.simHcalDigis.useConfigZSvalues = 1
# to generate suppres... |
py/testdir_single_jvm/test_failswith512chunk.py | gigliovale/h2o | 882 | 46575 | <reponame>gigliovale/h2o<gh_stars>100-1000
import unittest, time, sys
# not needed, but in case you move it down to subdir
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i
import h2o_browse as h2b
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_error... |
running_modes/configurations/reinforcement_learning/reinforcement_learning_components.py | lilleswing/Reinvent-1 | 183 | 46579 | from dataclasses import dataclass
from reinvent_scoring.scoring.diversity_filters.reinvent_core.diversity_filter_parameters import \
DiversityFilterParameters
from reinvent_scoring.scoring.scoring_function_parameters import ScoringFunctionParameters
from running_modes.configurations.reinforcement_learning.incepti... |
examples/how_to/per_round_max_channel.py | haoxusci/starfish | 164 | 46650 | <reponame>haoxusci/starfish<filename>examples/how_to/per_round_max_channel.py
"""
.. _howto_perroundmaxchannel:
Decoding Spots with :py:class:`.PerRoundMaxChannel`
===================================================
:py:class:`.PerRoundMaxChannel` is a :py:class:`.DecodeSpotsAlgorithm` that picks the channel with
max... |
Python/sum_prime.py | kennethsequeira/Hello-world | 1,428 | 46652 | <reponame>kennethsequeira/Hello-world<filename>Python/sum_prime.py<gh_stars>1000+
'''
Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.
Here are some examples to show how your function should work.
>>> sumprimes([3,3,1,13])
19
'''
def sumprim... |
Algorithms/Merge Sort/LinkedListMergeSort.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 46675 | #Program for merge sort in linked list
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, new_value):
new_node = Node(new_value)
if self.head is None:
self.head = new_node
return
curr_node = self.head
... |
dusty/systems/docker/testing_image.py | gamechanger/dusty | 421 | 46684 | <filename>dusty/systems/docker/testing_image.py<gh_stars>100-1000
from __future__ import absolute_import
import docker
from ...compiler.compose import container_code_path, get_volume_mounts
from ...compiler.spec_assembler import get_expanded_libs_specs
from ...log import log_to_client
from ...command_file import dusty... |
examples/dir.py | dmytrostriletskyi/design-kit | 107 | 46696 | <gh_stars>100-1000
from accessify import accessify, private
@accessify
class Car:
@private
def start_engine(self):
return 'Engine sound.'
if __name__ == '__main__':
car = Car()
assert 'start_engine' not in dir(car)
|
docs/examples/container/rancher/search_containers.py | dupontz/libcloud | 1,435 | 46701 | <reponame>dupontz/libcloud<gh_stars>1000+
from libcloud.container.types import Provider
from libcloud.container.providers import get_driver
driver = get_driver(Provider.RANCHER)
connection = driver("MYRANCHERACCESSKEY", "MYRANCHERSECRETKEY",
host="172.30.22.1", port=8080, secure=False)
search_res... |
tests/test_analysis/test_plotters.py | martins0n/etna | 326 | 46724 | import numpy as np
import pandas as pd
import pytest
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import TheilSenRegressor
from etna.analysis import get_residuals
from etna.analysis import plot_residuals
from etna.analysis import plot_trend
from etna.analysis.plotters import _get_labels_... |
var/spack/repos/builtin/packages/py-flit-core/package.py | zygyz/spack | 348 | 46740 | # 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)
import glob
import os
import zipfile
from spack import *
class PyFlitCore(PythonPackage):
"""Distribution-building ... |
examples/null_support/client.py | amrhgh/django-grpc-framework | 269 | 46745 | <gh_stars>100-1000
import grpc
import snippets_pb2
import snippets_pb2_grpc
from google.protobuf.struct_pb2 import NullValue
with grpc.insecure_channel('localhost:50051') as channel:
stub = snippets_pb2_grpc.SnippetControllerStub(channel)
request = snippets_pb2.Snippet(id=1, title='snippet title')
# send ... |
ddtrace/contrib/vertica/constants.py | melancholy/dd-trace-py | 308 | 46747 | # Service info
APP = "vertica"
|
quarkchain/evm/tests/new_statetest_utils.py | QuarkChain/pyquarkchain | 237 | 46755 | <reponame>QuarkChain/pyquarkchain
import sys
from quarkchain.evm.state import State
from quarkchain.evm.common import FakeHeader
from quarkchain.evm.utils import (
decode_hex,
parse_int_or_hex,
sha3,
to_string,
remove_0x_head,
encode_hex,
big_endian_to_int,
)
from quarkchain.evm.config impo... |
spotpy/database/sql.py | cheginit/spotpy | 182 | 46843 | <filename>spotpy/database/sql.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import sqlite3
import sys
from .base import database
if sys.version_info[0] >= 3:
unicode = str
class Pickalable... |
nominations/migrations/0001_initial.py | ewjoachim/pythondotorg | 911 | 46844 | <gh_stars>100-1000
# Generated by Django 2.0.9 on 2019-03-18 20:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import markupfield.fields
class Migration(migrations.Migration):
initial = True
dependencies = [migrations.swappable_dependency(setti... |
ch22-直方图/22.3.4.hsv_hist-绘制2D直方图.py | makelove/OpenCV-Python-Tutorial | 2,875 | 46853 | <filename>ch22-直方图/22.3.4.hsv_hist-绘制2D直方图.py
# -*-coding:utf8-*-#
__author__ = 'play4fun'
"""
create time:15-11-8 下午4:44
绘制2D直方图
"""
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('../data/home.jpg')
# cv2.imshow("src", img)
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
hist = cv2.... |
WebMirror/management/rss_parser_funcs/feed_parse_extractExpandablefemaleBlogspotCom.py | fake-name/ReadableWebProxy | 193 | 46862 | def extractExpandablefemaleBlogspotCom(item):
'''
DISABLED
Parser for 'expandablefemale.blogspot.com'
'''
return None |
lav/train_bev.py | Kin-Zhang/LAV | 122 | 46869 | import tqdm
import torch
from lav.lav_privileged import LAV
from lav.utils.datasets import get_data_loader
from lav.utils.logger import Logger
def main(args):
dmd = LAV(args)
data_loader = get_data_loader('bev', args)
logger = Logger('lav_bev', args)
save_dir = logger.save_dir
torch.manual_seed(a... |
selene_sdk/targets/tests/test_genomic_features.py | msindeeva/selene | 307 | 46893 | <gh_stars>100-1000
import os
import unittest
import numpy as np
from selene_sdk.targets import GenomicFeatures
from selene_sdk.targets.genomic_features import _any_positive_rows, \
_is_positive_row, _get_feature_data
class TestGenomicFeatures(unittest.TestCase):
def setUp(self):
self.features = [
... |
timesearch_modules/get_styles.py | clayne/timesearch | 127 | 46911 | <filename>timesearch_modules/get_styles.py
import os
import requests
from . import common
from . import tsdb
session = requests.Session()
def get_styles(subreddit):
(database, subreddit) = tsdb.TSDB.for_subreddit(subreddit, fix_name=True)
print('Getting styles for /r/%s' % subreddit)
subreddit = common.... |
corehq/motech/dhis2/tests/test_tasks.py | akashkj/commcare-hq | 471 | 46940 | from django.test import TestCase
from corehq import toggles
from corehq.motech.dhis2.tasks import send_datasets_for_all_domains
class TestSendDatasetsForAllDomains(TestCase):
domain_name = 'does-not-exist'
def setUp(self):
toggles.DHIS2_INTEGRATION.set(
self.domain_name,
ena... |
tests/data/expected/main/multiple_files_self_ref_single/output.py | adaamz/datamodel-code-generator | 891 | 46965 | <reponame>adaamz/datamodel-code-generator
# generated by datamodel-codegen:
# filename: test.json
# timestamp: 2019-07-26T00:00:00+00:00
from __future__ import annotations
from pydantic import BaseModel, Field
class Second(BaseModel):
__root__: str
class First(BaseModel):
__root__: Second
class Mod... |
modoboa/lib/tests/test_web_utils.py | HarshCasper/modoboa | 1,602 | 46976 | <gh_stars>1000+
"""Tests for web_utils."""
from django.test import SimpleTestCase
from .. import web_utils
class TestCase(SimpleTestCase):
"""Test functions."""
def test_size2integer(self):
self.assertEqual(web_utils.size2integer("1024"), 1024)
# Convert to bytes
self.assertEqual(we... |
src/fuzzingtool/utils/utils.py | NESCAU-UFLA/FuzzingTool | 131 | 47002 | # Copyright (c) 2020 - present <NAME> <https://github.com/VitorOriel>
#
# 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, ... |
tests/utils/test_events.py | nox237/CTFd | 3,592 | 47009 | <filename>tests/utils/test_events.py<gh_stars>1000+
from collections import defaultdict
from queue import Queue
from unittest.mock import patch
from redis.exceptions import ConnectionError
from CTFd.config import TestingConfig
from CTFd.utils.events import EventManager, RedisEventManager, ServerSentEvent
from tests.h... |
alipay/aop/api/domain/AlipayOfflineProviderShopactionRecordModel.py | snowxmas/alipay-sdk-python-all | 213 | 47022 | <filename>alipay/aop/api/domain/AlipayOfflineProviderShopactionRecordModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.OuterShopDO import OuterShopDO
class AlipayOfflineProviderShopactionRecordModel(object):
def __i... |
Testing/test_springs.py | geosharma/PyNite | 199 | 47033 | # -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2020 <NAME>, SE; tamalone1
"""
import unittest
from PyNite import FEModel3D
import sys
from io import StringIO
class Test_Spring_Elements(unittest.TestCase):
''' Tests of spring members.'''
def setUp(self):
# Suppress printed output temporarily
... |
ptf_nn/ptf_nn_test_eth.py | linarnan/ptf | 113 | 47042 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, 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
#
#... |
docarray/array/storage/elastic/seqlike.py | jina-ai/docarray | 591 | 47063 | <filename>docarray/array/storage/elastic/seqlike.py<gh_stars>100-1000
from typing import Union, Iterable, Dict
from ..base.seqlike import BaseSequenceLikeMixin
from .... import Document
class SequenceLikeMixin(BaseSequenceLikeMixin):
"""Implement sequence-like methods for DocumentArray with Elastic as storage"""... |
quantdom/ui.py | HiteshMah-Jan/Quantdom | 578 | 47064 | """Ui."""
import logging
import logging.config
import os.path
from datetime import datetime
from PyQt5 import QtCore, QtGui
from .lib import (
EquityChart,
OptimizatimizedResultsTable,
OptimizationTable,
Portfolio,
QuotesChart,
ResultsTable,
Settings,
Symbol,
TradesTable,
get_... |
parsl/dataflow/states.py | cylondata/parsl | 323 | 47093 | from enum import IntEnum
class States(IntEnum):
"""Enumerates the states a parsl task may be in.
These states occur inside the task record for a task inside
a `DataFlowKernel` and in the monitoring database.
In a single successful task execution, tasks will progress in this
sequence:
pendin... |
data_selection/wmt/common.py | DionysisChristopoulos/google-research | 23,901 | 47098 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
Trakttv.bundle/Contents/Libraries/Shared/plugin/core/configuration.py | disrupted/Trakttv.bundle | 1,346 | 47116 | from plugin.core.environment import Environment
from ConfigParser import NoOptionError, NoSectionError, ParsingError, SafeConfigParser
import logging
import os
log = logging.getLogger(__name__)
CONFIGURATION_FILES = [
'advanced'
]
class ConfigurationFile(object):
def __init__(self, path):
self._pat... |
main_dpir_sisr_real_applications.py | HedgehogCode/DPIR | 328 | 47159 | <reponame>HedgehogCode/DPIR<filename>main_dpir_sisr_real_applications.py
import os.path
import glob
import cv2
import logging
import time
import numpy as np
from datetime import datetime
from collections import OrderedDict
import hdf5storage
import torch
from utils import utils_deblur
from utils import utils_logger
... |
nussl/separation/spatial/duet.py | ZhaoJY1/nussl | 259 | 47189 | import numpy as np
from scipy import signal
from .. import MaskSeparationBase
from ...core import utils
from ...core import constants
class Duet(MaskSeparationBase):
"""
The DUET algorithm was originally proposed by S.Rickard and F.Dietrich for DOA
estimation and further developed for BSS and demixing b... |
scale/storage/test/test_delete_files_job.py | kaydoh/scale | 121 | 47190 | from __future__ import unicode_literals
import os
import django
from django.test import TestCase
from mock import call, patch
from storage.brokers.host_broker import HostBroker
from storage.delete_files_job import delete_files
from storage.test import utils as storage_test_utils
class TestDeleteFiles(TestCase):
... |
junior_class/chapter-6-sentiment_classification/code/model/sentiment_classifier.py | wwhio/awesome-DeepLearning | 1,150 | 47210 | # copyright (c) 2021 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 applica... |
tests/test_openapi_scheme.py | montaro/fastapi-azure-auth | 137 | 47211 | import pytest
from demo_project.main import app
from fastapi.testclient import TestClient
openapi_schema = {
'openapi': '3.0.2',
'info': {
'title': 'My Project',
'description': '## Welcome to my API! \n This is my description, written in `markdown`',
'version': '1.0.0',
},
'path... |
tests/test_load_docker_api.py | ReconPangolin/tern | 361 | 47218 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2020 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
import unittest
from tern.load import docker_api
from tern.utils import rootfs
from test_fixtures import create_working_dir
from test_fixtures import remove_working_dir
class TestLoadDockerAPI(un... |
tests/update_golds.py | leonardt/magma | 167 | 47219 | """
Expected to be run from repo root
"""
import shutil
import os
def copy_golds(dir_path):
for f in os.listdir(os.path.join(dir_path, "gold")):
try:
shutil.copy(
os.path.join(dir_path, "build", f),
os.path.join(dir_path, "gold", f)
)
except ... |
src/multiclass/LSTMMultiClass.py | ocatak/malware_api_class | 172 | 47226 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 1 14:52:43 2018
@author: user
"""
import pandas as pd
from keras import preprocessing
import os
import datetime
from multiclass.AnalizeRunner import AnalizeRunner
##################################################
prefix = "dataset"
data_path = "C:\\... |
indexpy/cli.py | abersheeran/index.py | 242 | 47232 | from __future__ import annotations
import os
import signal
import subprocess
import sys
import time
from multiprocessing import cpu_count
from typing import List, Union
import click
from .__version__ import __version__
from .routing.commands import display_urls
from .utils import F, import_from_string, import_module... |
unittest/scripts/auto/py_shell/scripts/util_help_norecord.py | mueller/mysql-shell | 119 | 47270 | #@ util help
util.help()
#@ util help, \? [USE:util help]
\? util
#@ util check_for_server_upgrade help
util.help('check_for_server_upgrade')
#@ util check_for_server_upgrade help, \? [USE:util check_for_server_upgrade help]
\? check_for_server_upgrade
# WL13807-TSFR_1_1
#@ util dump_instance help
util.help('dump_i... |
cogdl/layers/gine_layer.py | li-ziang/cogdl | 1,072 | 47320 | import torch
import torch.nn.functional as F
from cogdl.utils import spmm
from . import BaseLayer
class GINELayer(BaseLayer):
r"""The modified GINConv operator from the `"Graph convolutions that can finally model local structure" paper
<https://arxiv.org/pdf/2011.15069.pdf>`__.
Parameters
---------... |
events/migrations/0010_auto_20180528_2033.py | Akash1S/meethub | 428 | 47332 | <reponame>Akash1S/meethub
# Generated by Django 2.0.4 on 2018-05-28 20:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0009_auto_20180428_0845'),
]
operations = [
migrations.RemoveField(
model_name='comment',
... |
base/site-packages/mobileadmin/templatetags/mobile_admin_media.py | edisonlz/fastor | 285 | 47348 | <filename>base/site-packages/mobileadmin/templatetags/mobile_admin_media.py
from django.template import Library
register = Library()
def mobileadmin_media_prefix():
"""
Returns the string contained in the setting MOBILEADMIN_MEDIA_PREFIX.
"""
try:
from mobileadmin.conf import settings
exce... |
src/algo/api_nfdomains.py | jumperavocado/staketaxcsv | 140 | 47358 | import logging
import requests
from settings_csv import ALGO_NFDOMAINS
# API documentation: https://editor.swagger.io/?url=https://api.testnet.nf.domains/info/openapi3.yaml
class NFDomainsAPI:
session = requests.Session()
def get_address(self, name):
endpoint = f"nfd/{name}"
para... |
tests/test_basics.py | viki-org/logstash-docker | 305 | 47400 | <filename>tests/test_basics.py
from .fixtures import logstash
from .constants import logstash_version_string
def test_logstash_is_the_correct_version(logstash):
assert logstash_version_string in logstash.stdout_of('logstash --version')
def test_the_default_user_is_logstash(logstash):
assert logstash.stdout_... |
rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py | rotkehlchenio/rotkehlchen | 137 | 47406 | <filename>rotkehlchen/tests/unit/uniswap/test_calculate_events_balances.py
from typing import List
import pytest
from rotkehlchen.chain.ethereum.interfaces.ammswap.types import LiquidityPool, LiquidityPoolEvent
from .utils import (
LP_1_EVENTS,
LP_1_EVENTS_BALANCE,
LP_2_EVENTS,
LP_2_EVENTS_BALANCE,
... |
e2e/test_override.py | navoday-91/oncall | 857 | 47432 | # Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
import requests
import time
from testutils import prefix,api_v0
start, end = int(time.time()), int(time.time() + 36000)
start = start / 1000 * 1000
end = end /... |
openbook_notifications/models/post_reaction_notification.py | TamaraAbells/okuna-api | 164 | 47443 | from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from openbook_notifications.models.notification import Notification
from openbook_posts.models import PostReaction
class PostReactionNotification(models.Model):
notification = GenericRelation(Notification, related_name='po... |
scripts/subreddit_comments_alt.py | awesome-archive/subreddit-analyzer | 497 | 47456 | <filename>scripts/subreddit_comments_alt.py
"""
This script uses the Pushshift API to download comments from the specified subreddits.
By default it downloads all the comments from the newest one to the first one of the specified date.
"""
import csv
import sys
import time
from datetime import datetime
import request... |
ch02-安装OpenCV/最简单-使用pip安装opencv-python和opencv-contrib-python/test_video.py | makelove/OpenCV-Python-Tutorial | 2,875 | 47463 | # -*- coding: utf-8 -*-
# @Time : 2017/8/2 10:46
# @Author : play4fun
# @File : test_video.py
# @Software: PyCharm
"""
test_video.py:
"""
import numpy as np
import cv2
from matplotlib import pyplot as plt
cap = cv2.VideoCapture('../../data/vtest.avi')#不支持读取视频
# cap = cv2.VideoCapture('output.avi')
# cap = cv2... |
contrib/stack/alosStack/estimate_swath_offset.py | yuankailiu/isce2 | 1,133 | 47489 | #!/usr/bin/env python3
#
# Author: <NAME>
# Copyright 2015-present, NASA-JPL/Caltech
#
import os
import glob
import datetime
import numpy as np
import isce, isceobj
from isceobj.Alos2Proc.runSwathOffset import swathOffset
from StackPulic import loadTrack
from StackPulic import acquisitionModesAlos2
def cmdLinePar... |
tests/functions/test_get_referencing_foreign_keys.py | tteaka/sqlalchemy-utils | 879 | 47495 | <gh_stars>100-1000
import pytest
import sqlalchemy as sa
from sqlalchemy_utils import get_referencing_foreign_keys
class TestGetReferencingFksWithCompositeKeys(object):
@pytest.fixture
def User(self, Base):
class User(Base):
__tablename__ = 'user'
first_name = sa.Column(sa.Un... |
mars/serialization/arrow.py | hxri/mars | 2,413 | 47498 | <reponame>hxri/mars
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
python/ql/test/3/library-tests/modules/general/main.py | vadi2/codeql | 4,036 | 47504 | import package
import helper
import package.assistant
#We expect that 'a' below will be 1 not a module.
from confused_elements import a
import sys |
deeppavlov/models/go_bot/dto/dataset_features.py | xbodx/DeepPavlov | 5,893 | 47508 | <filename>deeppavlov/models/go_bot/dto/dataset_features.py<gh_stars>1000+
from typing import List
import numpy as np
# todo remove boilerplate duplications
# todo comments
# todo logging
# todo naming
from deeppavlov.models.go_bot.nlu.dto.nlu_response import NLUResponse
from deeppavlov.models.go_bot.policy.dto.digit... |
mininet/p4_mininet.py | ghostli123/p4factory | 205 | 47529 | # Copyright 2013-present Barefoot Networks, 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 or ... |
tests/test_axial_att_block.py | Siyuan89/self-attention-cv | 759 | 47574 | <reponame>Siyuan89/self-attention-cv
import torch
from self_attention_cv import AxialAttentionBlock
def test_axial_att():
device = 'cuda' if torch.cuda.is_available() else 'cpu'
model = AxialAttentionBlock(in_channels=256, dim=64, heads=8).to(device)
x = torch.rand(1, 256, 64, 64).to(device) # [batch, t... |
common/util/dates.py | jmcollis/GitSavvy | 2,058 | 47586 | <reponame>jmcollis/GitSavvy
from datetime import datetime
TEN_MINS = 600
ONE_HOUR = 3600
TWO_HOURS = 7200
ONE_DAY = 86400
def fuzzy(event, base=None, date_format=None):
if not base:
base = datetime.now()
if date_format:
event = datetime.strptime(event, date_format)
elif type(event) == st... |
app/scripts/config_check.py | PromoFaux/plex-utills | 179 | 47591 | #!/usr/local/bin/python3
import os
import subprocess
from subprocess import Popen, PIPE, STDOUT
from configparser import ConfigParser
import subprocess
import plexapi
import schedule
import time
from datetime import datetime
import re
from colorama import Fore, Back, Style
import socket
from urllib import... |
data/transcoder_evaluation_gfg/python/COUNT_PAIRS_TWO_SORTED_ARRAYS_WHOSE_SUM_EQUAL_GIVEN_VALUE_X_2.py | mxl1n/CodeGen | 241 | 47659 | <gh_stars>100-1000
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( arr1 , arr2 , m , n , x ) :
count , l , r = 0 , 0 , n - 1
while ( l < m and r >= 0 ) :
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.