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 |
|---|---|---|---|---|
utils/statistic.py | ZGSLZL/LGSC-for-FAS | 195 | 11148164 | import math
import numpy as np
def eval_state(probs, labels, thr):
predict = probs >= thr
TN = np.sum((labels == 0) & (predict == False))
FN = np.sum((labels == 1) & (predict == False))
FP = np.sum((labels == 0) & (predict == True))
TP = np.sum((labels == 1) & (predict == True))
return TN, FN,... |
deep_privacy/detection/__init__.py | skoskjei/DP-ATT | 1,128 | 11148235 | from .detection_api import BaseDetector, RCNNDetector, ImageAnnotation
from .build import build_detector
|
tests/providers/apache/spark/hooks/test_spark_jdbc_script.py | ChaseKnowlden/airflow | 15,947 | 11148238 | <filename>tests/providers/apache/spark/hooks/test_spark_jdbc_script.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. The ASF licenses this file
# to you... |
s3prl/upstream/distiller/builder.py | Hem7513/s3prl | 856 | 11148252 | """
Builder for Distiller
Author: <NAME> (https://github.com/vectominist)
"""
import sys
import copy
import math
from distutils.util import strtobool
import yaml
import numpy as np
import torch
from torch import nn
from torch.nn.utils.rnn import pad_sequence
from .model import DistillerConfig, DistillerModel
i... |
code/networks/blocks.py | Maclory/Deep-Iterative-Collaboration | 276 | 11148255 | <reponame>Maclory/Deep-Iterative-Collaboration
import torch
import torch.nn as nn
from collections import OrderedDict
import sys
################
# Basic blocks
################
def activation(act_type='relu', inplace=True, slope=0.2, n_prelu=1):
act_type = act_type.lower()
layer = None
if act_type == 'r... |
examples/slack/channels.py | q0w/snug | 123 | 11148275 | """queries for the 'channels' method family"""
import typing as t
import snug
from .query import paginated_retrieval, json_post
from .types import Channel, Page
from .load import registry
load_channel_list = registry(t.List[Channel])
@paginated_retrieval('channels.list', itemtype=Channel)
def list_(*, cursor: str=... |
tests/integrations/excepthook/test_excepthook.py | cmalek/sentry-python | 1,213 | 11148278 | <gh_stars>1000+
import pytest
import sys
import subprocess
from textwrap import dedent
def test_excepthook(tmpdir):
app = tmpdir.join("app.py")
app.write(
dedent(
"""
from sentry_sdk import init, transport
def send_event(self, event):
print("capture event was called")
... |
armada_backend/api_health.py | firesoft/armada | 281 | 11148298 | <gh_stars>100-1000
import falcon
from armada_backend.api_base import ApiCommand
from armada_backend.utils import exists_service
from armada_command.consul.consul import consul_put
def _get_consul_health_endpoint(health_check_code):
if health_check_code == 0:
return 'pass'
if health_check_code == 1:
... |
k8s/images/codalab/apps/coopetitions/admin.py | abdulari/codalab-competitions | 333 | 11148332 | <reponame>abdulari/codalab-competitions
from django.contrib import admin
from .models import Like
admin.site.register(Like)
|
examples/py/all-exchanges.py | diwenshi61/ccxt | 24,910 | 11148339 | <gh_stars>1000+
# -*- coding: utf-8 -*-
import os
import sys
from pprint import pprint
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
for exchange_id in ccxt.exchanges:
try... |
ui/pypesvds/plugins/emailextractor/emailextractor.py | onfire73/pypeskg | 117 | 11148367 | import re
import logging
#import traceback
from pypes.component import Component
log = logging.getLogger(__name__)
class Email(Component):
__metatype__ = 'EXTRACTOR'
def __init__(self):
Component.__init__(self)
# define email regular expression string
emailre = r'((?:[a-zA-Z0-9_\-\.... |
tests/components/huisbaasje/test_data.py | MrDelik/core | 30,023 | 11148374 | <gh_stars>1000+
"""Test data for the tests of the Huisbaasje integration."""
MOCK_CURRENT_MEASUREMENTS = {
"electricity": {
"measurement": {
"time": "2020-11-18T15:17:24.000Z",
"rate": 1011.6666666666667,
"value": 0.0033333333333333335,
"costPerHour": 0.202333... |
lang/py/avro/codecs.py | gkomlossi/avro | 1,960 | 11148400 | #!/usr/bin/env python3
##
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... |
realtime/rt/aligner.py | kho/cdec | 114 | 11148420 | <reponame>kho/cdec<filename>realtime/rt/aligner.py
import logging
import os
import sys
import subprocess
import threading
import util
logger = logging.getLogger('rt.aligner')
class ForceAligner:
def __init__(self, fwd_params, fwd_err, rev_params, rev_err, heuristic='grow-diag-final-and'):
cdec_root = o... |
samples/subscription/billing_agreements/search_transactions.py | Hey-Marvelous/PayPal-Python-SDK | 653 | 11148464 | from paypalrestsdk import BillingAgreement
import logging
BILLING_AGREEMENT_ID = "I-HT38K76XPMGJ"
try:
billing_agreement = BillingAgreement.find(BILLING_AGREEMENT_ID)
start_date = "2014-07-01"
end_date = "2014-07-20"
transactions = billing_agreement.search_transactions(start_date, end_date)
for ... |
venv/lib/python3.9/site-packages/pytube/version.py | dajor/youtube2 | 4,079 | 11148474 | <gh_stars>1000+
__version__ = "12.1.0"
if __name__ == "__main__":
print(__version__)
|
components/aws/sagemaker/tests/integration_tests/utils/argo_utils.py | Strasser-Pablo/pipelines | 2,860 | 11148476 | <gh_stars>1000+
import utils
def print_workflow_logs(workflow_name):
output = get_workflow_logs(workflow_name)
print(f"workflow logs:\n", output.decode())
def find_in_logs(workflow_name, sub_str):
logs = get_workflow_logs(workflow_name).decode()
return logs.find(sub_str) >= 0
def get_workflow_logs... |
10_pipeline/sagemaker_mlops/sagemaker-project-modelbuild/pipelines/dsoaws/evaluate_model_metrics.py | ichen20/oreilly_book | 2,327 | 11148482 | <reponame>ichen20/oreilly_book
import functools
import multiprocessing
from datetime import datetime
import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "conda", "install", "-c", "anaconda", "tensorflow==2.3.0", "-y"])
import tensorflow as tf
from tensorflow import keras
subprocess.check_call([... |
nuplan/planning/script/builders/training_builder.py | motional/nuplan-devkit | 128 | 11148483 | <reponame>motional/nuplan-devkit
import logging
from pathlib import Path
from typing import cast
import pytorch_lightning as pl
import pytorch_lightning.loggers
import pytorch_lightning.plugins
import torch
from omegaconf import DictConfig, OmegaConf
from nuplan.planning.script.builders.data_augmentation_builder impo... |
base_models/layers.py | YangLiangwei/DGFraud | 447 | 11148490 | '''
This code is due to <NAME> (@yutongD), <NAME> (@YingtongDou) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
from base_models.inits import *
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
# global unique layer ID dictionary for ... |
plenum/test/watermarks/test_watermarks_after_view_change.py | IDunion/indy-plenum | 148 | 11148506 | import pytest
from plenum.test import waits
from plenum.test.delayers import cDelay, chk_delay, icDelay, nv_delay
from plenum.test.helper import sdk_send_random_and_check, waitForViewChange
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
from plenum.test.stasher import delay_rules
from plen... |
utils/usergrid-util-python/samples/beacon-event-example.py | snoopdave/incubator-usergrid | 788 | 11148511 | <reponame>snoopdave/incubator-usergrid<filename>utils/usergrid-util-python/samples/beacon-event-example.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 copyrigh... |
docx/oxml/document.py | mooosee/python-docx | 169 | 11148524 | # encoding: utf-8
"""
Custom element classes that correspond to the document part, e.g.
<w:document>.
"""
from .xmlchemy import BaseOxmlElement, ZeroOrOne, ZeroOrMore
class CT_Document(BaseOxmlElement):
"""
``<w:document>`` element, the root element of a document.xml file.
"""
body = ZeroOrOne('w:bo... |
testing/tests/001-main/003-self/020-fixup-review-via-push.py | fekblom/critic | 216 | 11148546 | <filename>testing/tests/001-main/003-self/020-fixup-review-via-push.py
import os
def to(name):
return testing.mailbox.ToRecipient("<EMAIL>" % name)
def about(subject):
return testing.mailbox.WithSubject(subject)
FILENAME = "020-fixup-review-via-push.txt"
SETTINGS = { "review.createViaPush": True }
with test... |
apps/oauth/forms.py | sbybfai/izone | 1,009 | 11148568 | # -*- coding: utf-8 -*-
from django import forms
from .models import Ouser
class ProfileForm(forms.ModelForm):
class Meta:
model = Ouser
fields = ['link','avatar']
|
Section 6 - NLP Core/NLP Part 18 - Latent Semantic Analysis Part 2.py | kungfumas/bahasa-alami | 169 | 11148573 | # Latent Semantic Analysis using Python
# Importing the Libraries
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.decomposition import TruncatedSVD
import nltk
# Sample Data
dataset = ["The amount of polution is increasing day by day",
"The concert was just great",
"I lo... |
docs/user_guides/simple_case/word2vec/train.py | shiyutang/docs | 104 | 11148574 | <filename>docs/user_guides/simple_case/word2vec/train.py
# Copyright (c) 2018 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.ap... |
omnizart/cli/common_options.py | nicolasanjoran/omnizart | 1,145 | 11148608 | import click
def add_common_options(options):
def add_options(func):
for option in reversed(options):
func = option(func)
return func
return add_options
COMMON_TRANSCRIBE_OPTIONS = [
click.argument("input_audio", type=click.Path(exists=True)),
click.option(
"-m",
... |
tests/test_ec2/test_account_attributes.py | gtourkas/moto | 5,460 | 11148621 | <filename>tests/test_ec2/test_account_attributes.py
import boto3
from moto import mock_ec2
import sure # pylint: disable=unused-import
@mock_ec2
def test_describe_account_attributes():
conn = boto3.client("ec2", region_name="us-east-1")
response = conn.describe_account_attributes()
expected_attr... |
IOMC/EventVertexGenerators/python/GaussianZBeamSpotFilter_cfi.py | ckamtsikis/cmssw | 852 | 11148626 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from IOMC.EventVertexGenerators.BeamSpotFilterParameters_cfi import baseVtx,newVtx
simBeamSpotFilter = cms.EDFilter("GaussianZBeamSpotFilter",
src = cms.InputTag("generatorSmeared"),
baseSZ = baseVtx.SigmaZ,
baseZ0 = baseVtx.Z0,
newSZ ... |
applications/DelaunayMeshingApplication/python_scripts/post_refining_mesher.py | lkusch/Kratos | 778 | 11148638 | <reponame>lkusch/Kratos
from __future__ import print_function, absolute_import, division # makes KratosMultiphysics backward compatible with python 2.6 and 2.7
#import kratos core and applications
import KratosMultiphysics
import KratosMultiphysics.DelaunayMeshingApplication as KratosDelaunay
# Import the mesher (the... |
isserviceup/services/pusher.py | EvgeshaGars/is-service-up | 182 | 11148653 | <reponame>EvgeshaGars/is-service-up<filename>isserviceup/services/pusher.py
from isserviceup.services.models.statuspage import StatusPagePlugin
class Pusher(StatusPagePlugin):
name = 'Pusher'
status_url = 'https://status.pusher.com/'
icon_url = '/images/icons/pusher.png'
|
examples/example_mnist_ae.py | julesmuhizi/qkeras | 388 | 11148672 | <reponame>julesmuhizi/qkeras
# Copyright 2019 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
Stock/Select/Engine/Regression/DyStockSelectRegressionEngineProcess.py | Leonardo-YXH/DevilYuan | 135 | 11148702 | import queue
from DyCommon.DyCommon import *
from EventEngine.DyEvent import *
from EventEngine.DyEventEngine import *
from ..DyStockSelectSelectEngine import *
from ....Common.DyStockCommon import DyStockCommon
def dyStockSelectRegressionEngineProcess(outQueue, inQueue, tradeDays, strategy, codes, histDaysDataSourc... |
base/site-packages/django_qbe/exports.py | edisonlz/fastor | 285 | 11148709 | <reponame>edisonlz/fastor
# -*- coding: utf-8 -*-
import codecs
import csv
from StringIO import StringIO
from django.http import HttpResponse
from django.utils.datastructures import SortedDict
__all__ = ("formats", )
class FormatsException(Exception):
pass
class Formats(SortedDict):
def add(self, format)... |
tests/functional/sample/child_sample/__init__.py | szabopeter/interrogate | 354 | 11148761 | <filename>tests/functional/sample/child_sample/__init__.py
# Copyright 2020 <NAME>
# intentionally no docstrings here
|
python/examples/include/example.py | bwoodhouse322/package | 512 | 11148798 | #!/usr/bin/python
from metaparticle_pkg import Containerize, PackageFile
import os
import time
import logging
# all metaparticle output is accessible through the stdlib logger (debug level)
logging.basicConfig(level=logging.INFO)
logging.getLogger('metaparticle_pkg.runner').setLevel(logging.DEBUG)
logging.getLogger('... |
aw_nas/objective/fault_injection.py | Harald-R/aw_nas | 195 | 11148799 | <filename>aw_nas/objective/fault_injection.py
# -*- coding: utf-8 -*-
"""
Fault injection objective.
* Clean accuracy and fault-injected accuracy weighted for reward (for discrete controller search)
* Clean loss and fault-injected loss weighted for loss
(for differentiable controller search or fault-injection trainin... |
mayan/apps/checkouts/dashboard_widgets.py | eshbeata/open-paperless | 2,743 | 11148803 | <filename>mayan/apps/checkouts/dashboard_widgets.py<gh_stars>1000+
from __future__ import absolute_import, unicode_literals
from django.apps import apps
from django.urls import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from common.classes import DashboardWidget
def checkedout_documents_qu... |
dislash/__init__.py | Bakersbakebread/dislash.py | 371 | 11148845 | __version__ = "1.5.0"
from .interactions import *
from .application_commands import *
slash_commands = application_commands
|
pyNastran/gui/menus/groups_modify/interface.py | ACea15/pyNastran | 293 | 11148849 | <filename>pyNastran/gui/menus/groups_modify/interface.py
from pyNastran.gui.menus.groups_modify.groups_modify import GroupsModify
def on_set_modify_groups(self):
"""
Opens a dialog box to set:
+--------+----------+
| Name | String |
+--------+----------+
| Min | Float |
+--------... |
OpenCLGA/simple_chromosome.py | czarnobylu/OpenCLGA | 112 | 11148857 | #!/usr/bin/python3
import numpy
import pyopencl as cl
from .simple_gene import SimpleGene
class SimpleChromosome:
# SimpleChromosome - a chromosome contains a list of Genes.
# __genes - a list of Genes
# __name - name of the chromosome
# __improving_func - a function name in kernel to gurantee a better... |
optimus/engines/vaex/io/save.py | ironmussa/Optimus | 1,045 | 11148860 | import os
from optimus.helpers.functions import prepare_path_local, path_is_local
from optimus.helpers.logger import logger
from optimus.helpers.types import *
from optimus.engines.base.io.save import BaseSave
class Save(BaseSave):
def __init__(self, root: 'DataFrameType'):
self.root = root
def hdf... |
tardis/io/tests/test_config_reader.py | ahmedo42/tardis | 176 | 11148866 | # tests for the config reader module
import os
from attr import validate
import pytest
import pandas as pd
from numpy.testing import assert_almost_equal
from jsonschema.exceptions import ValidationError
from tardis.io import config_reader
from tardis.io.config_reader import Configuration
def data_path(filename):
... |
alipay/aop/api/response/AlipayEbppInstserviceTokenCreateResponse.py | antopen/alipay-sdk-python-all | 213 | 11148877 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayEbppInstserviceTokenCreateResponse(AlipayResponse):
def __init__(self):
super(AlipayEbppInstserviceTokenCreateResponse, self).__... |
deepfigures/settings.py | mdcatapult/deepfigures-open | 103 | 11148965 | <gh_stars>100-1000
"""Constants and settings for deepfigures."""
import logging
import os
logger = logging.getLogger(__name__)
# path to the deepfigures project root
BASE_DIR = os.path.dirname(
os.path.dirname(os.path.realpath(__file__)))
# version number for the current release
VERSION = '0.0.1'
# descripti... |
core/__init__.py | azurlane-doujin/AzurLanePaintingExtract-v1.0 | 144 | 11148973 | __all__=["assets", "src"] |
setup.py | alicanb/probtorch | 876 | 11148986 | import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
import setuptools.command.build_py
def get_version():
try:
import subprocess
CWD = os.path.dirname(os.path.abspath(__file__))
rev = subprocess.check_output("git rev-parse --short H... |
spacy/tests/lang/test_initialize.py | snosrap/spaCy | 22,040 | 11149051 | <gh_stars>1000+
import pytest
from spacy.util import get_lang_class
# fmt: off
# Only include languages with no external dependencies
# excluded: ja, ko, th, vi, zh
LANGUAGES = ["af", "am", "ar", "az", "bg", "bn", "ca", "cs", "da", "de", "el",
"en", "es", "et", "eu", "fa", "fi", "fr", "ga", "gu", "he", "... |
haproxystats/__init__.py | unixsurfer/haproxystats | 104 | 11149074 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
"""A collection of Python tools to process HAProxy statistics."""
__title__ = 'haproxystats'
__author__ = '<NAME>'
__license__ = 'Apache 2.0'
__version__ = '0.5.2'
__copyright__ = 'Copyright 2016 <NAME> <<EMAIL>'
DEFAULT_OPTIONS = {
'DEFAULT': {
... |
tools/simnet/train/tf/tools/tf_record_reader.py | comeonfox/AnyQ | 2,414 | 11149109 | <filename>tools/simnet/train/tf/tools/tf_record_reader.py
#coding=utf-8
# Copyright (c) 2018 Baidu, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... |
tracing/tracing/mre/threaded_work_queue.py | tingshao/catapult | 1,894 | 11149122 | <reponame>tingshao/catapult<gh_stars>1000+
# Copyright 2015 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.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import... |
ikalog/ui/events.py | fetus-hina/IkaLog | 285 | 11149138 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <NAME>
# Copyright (C) 2016 <NAME>
#
# 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... |
yagmail/password.py | york-schlabrendorff-liqid/yagmail | 2,431 | 11149156 | try:
import keyring
except (ImportError, NameError, RuntimeError):
pass
def handle_password(user, password): # pragma: no cover
""" Handles getting the password"""
if password is None:
try:
password = keyring.get_password("y<PASSWORD>", user)
except NameError as e:
... |
data/transcoder_evaluation_gfg/python/COUNT_FREQUENCY_K_MATRIX_SIZE_N_MATRIXI_J_IJ.py | mxl1n/CodeGen | 241 | 11149177 | <filename>data/transcoder_evaluation_gfg/python/COUNT_FREQUENCY_K_MATRIX_SIZE_N_MATRIXI_J_IJ.py
# 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(n, k):
if (n + 1 ... |
search/linear_search/python/bm.py | CarbonDDR/al-go-rithms | 1,253 | 11149179 | '''
Boyer–Moore string-search algorithm is an efficient string-searching algorithm
that is the standard benchmark for practical string-search literature.The
algorithm preprocesses the string being searched for (the pattern), but not
the string being searched in (the text).The Boyer-Moore algorithm uses
information gath... |
akshare/futures/futures_rule.py | lisong996/akshare | 4,202 | 11149206 | # -*- coding:utf-8 -*-
#!/usr/bin/env python
"""
Date: 2020/7/12 21:51
Desc: 国泰君安期货-交易日历数据表
https://www.gtjaqh.com/pc/calendar.html
"""
import pandas as pd
import requests
def futures_rule(trade_date: str = "20200712") -> pd.DataFrame:
"""
国泰君安期货-交易日历数据表
https://www.gtjaqh.com/pc/calendar.html
:return... |
examples/Script/script_forward_frames.py | 4ndr3aR/depthai-python | 182 | 11149219 | #!/usr/bin/env python3
import cv2
import depthai as dai
# Start defining a pipeline
pipeline = dai.Pipeline()
cam = pipeline.create(dai.node.ColorCamera)
cam.initialControl.setManualFocus(130)
# Not needed, you can display 1080P frames as well
cam.setIspScale(1,2)
# Script node
script = pipeline.create(dai.node.Scri... |
tests/spot/futures/test_futures_loan_adjust_collateral.py | Banging12/binance-connector-python | 512 | 11149221 | import responses
import pytest
from urllib.parse import urlencode
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
key = random_str()
secret = rando... |
url_filter/backends/base.py | peopleticker/django-url-filter-py3 | 303 | 11149238 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import abc
import six
from cached_property import cached_property
class BaseFilterBackend(six.with_metaclass(abc.ABCMeta, object)):
"""
Base filter backend from which all other backends must subclass.
Parame... |
inquirer/render/__init__.py | SteinRobert/python-inquirer | 640 | 11149246 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from .console import ConsoleRender
try:
from .ncourses import CoursesRender # noqa
except ImportError:
# ncourses will not be available
pass
class Render(object):
def __init__(self, impl=ConsoleRender):
self._impl = impl
def render(self, questi... |
ranking/management/modules/dl_gsu.py | horacexd/clist | 166 | 11149259 | <reponame>horacexd/clist<gh_stars>100-1000
# -*- coding: utf-8 -*-
import re
from collections import OrderedDict, defaultdict
from datetime import timedelta
from pprint import pprint # noqa
from urllib.parse import urljoin
from ranking.management.modules.common import REQ, BaseModule, FailOnGetResponse, parsed_table... |
tortoise/utils.py | blazing-gig/tortoise-orm | 2,847 | 11149295 | <gh_stars>1000+
from typing import TYPE_CHECKING, Any, Iterable, Optional
from tortoise.log import logger
if TYPE_CHECKING: # pragma: nocoverage
from tortoise.backends.base.client import BaseDBAsyncClient
def get_schema_sql(client: "BaseDBAsyncClient", safe: bool) -> str:
"""
Generates the SQL schema f... |
timesketch/models/annotations.py | rushattac/timesketch | 1,810 | 11149304 | # Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
autoimpute/utils/__init__.py | gjdv/autoimpute | 191 | 11149319 | <filename>autoimpute/utils/__init__.py
"""Manage the utils lib from the autoimpute package.
This module handles imports from the utils directory that should be accessible
whenever someone imports autoimpute.utils. The imports include methods for
checks & validations as well as functions to explore patterns in missing ... |
goodtables/cli.py | davidpeckham/goodtables-py | 243 | 11149352 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from sys import exit
import click
import goodtables
import json as json_module
from pprint import pformat
from click_default_g... |
MSDN_crawler/extract_til_constant_info.py | clayne/flare-ida | 1,471 | 11149374 | """
Obtain matchups between a constant name and the standard enum IDA Pro uses.
Authors: <NAME>, <NAME>
Copyright 2014 Mandiant, A FireEye Company
Mandiant licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance with the
License. You may ... |
MuZero/MuCoach.py | morozig/muzero | 111 | 11149395 | <filename>MuZero/MuCoach.py
"""
Implements the abstract Coach class for defining the data sampling procedures for MuZero neural network training.
Notes:
- Base implementation done.
- Documentation 15/11/2020
"""
import typing
from datetime import datetime
import numpy as np
import tensorflow as tf
from Coach impor... |
Python/Tests/TestData/TestDiscoverer/ConfigPythonFiles/test_pt.py | techkey/PTVS | 404 | 11149408 | def test_1():
assert True
|
src/collectors/sqs/sqs.py | hermdog/Diamond | 1,795 | 11149412 | # coding=utf-8
"""
The SQS collector collects metrics for one or more Amazon AWS SQS queues
#### Configuration
Below is an example configuration for the SQSCollector.
You can specify an arbitrary amount of regions
```
enabled = True
interval = 60
[regions]
[[region-code]]
queues = queue_name[,q... |
tests/test_smtp.py | IncognitoCoding/mailrise | 177 | 11149452 | from email.message import EmailMessage
from pathlib import Path
from mailrise.config import Key
from mailrise.smtp import RecipientError, parsemessage, parsercpt
import apprise
import pytest
def test_parsercpt() -> None:
"""Tests for recipient parsing."""
rcpt = parsercpt('<EMAIL>')
assert rcpt.key == K... |
rclpy/executors/examples_rclpy_executors/callback_group.py | peterpolidoro/ros2_examples | 335 | 11149464 | <filename>rclpy/executors/examples_rclpy_executors/callback_group.py
# Copyright 2017 Open Source Robotics Foundation, 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.... |
droidlet/interpreter/tests/test_interpreter_utils.py | ali-senguel/fairo | 669 | 11149471 | <gh_stars>100-1000
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
import re
import unittest
from copy import deepcopy
from droidlet.interpreter import process_spans_and_remove_fixed_value
from droidlet.perception.semantic_parsing.tests.test_y_print_parsing_report import (
common_functional_commands,
c... |
pytype/tests/test_tracebacks2.py | Jrryy/pytype | 3,882 | 11149472 | <reponame>Jrryy/pytype<gh_stars>1000+
"""Tests for displaying tracebacks in error messages."""
from pytype.tests import test_base
class TracebackTest(test_base.BaseTest):
"""Tests for tracebacks in error messages."""
def test_build_class(self):
errors = self.CheckWithErrors("""
class Foo:
def ... |
kats/models/metalearner/__init__.py | iamxiaodong/Kats | 3,580 | 11149476 | <reponame>iamxiaodong/Kats<filename>kats/models/metalearner/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
try:
from . import get_metadata # noqa
except ImportError:
impo... |
tests/fixtures/envs/dummy/dummy_reward_box_env.py | blacksph3re/garage | 1,500 | 11149477 | <filename>tests/fixtures/envs/dummy/dummy_reward_box_env.py
from tests.fixtures.envs.dummy import DummyBoxEnv
class DummyRewardBoxEnv(DummyBoxEnv):
"""A dummy box environment."""
def __init__(self, random=True):
super().__init__(random)
def step(self, action):
"""Step the environment."""... |
tests/helper.py | Jsn2win/pycoinnet | 114 | 11149496 | import hashlib
from pycoin import ecdsa
from pycoin.block import Block, BlockHeader
from pycoin.encoding import public_pair_to_sec
from pycoin.tx.Tx import Tx, TxIn, TxOut
GENESIS_TIME = 1390000000
DEFAULT_DIFFICULTY = 3000000
HASH_INITIAL_BLOCK = b'\0' * 32
def make_hash(i, s=b''):
return hashlib.sha256(("%d_... |
test/unit/test_system_client.py | tomasfarias/dbt-core | 799 | 11149502 | import os
import shutil
import stat
import unittest
import tarfile
import io
from pathlib import Path
from tempfile import mkdtemp, NamedTemporaryFile
from dbt.exceptions import ExecutableError, WorkingDirectoryError
import dbt.clients.system
class SystemClient(unittest.TestCase):
def setUp(self):
super(... |
src/sage/misc/sh.py | bopopescu/sage | 1,742 | 11149509 | "Evaluating shell scripts"
import os
class Sh:
r"""
Evaluates a shell script and returns the output.
To use this from the notebook type ``sh`` at the beginning of
the input cell. The working directory is then the (usually
temporary) directory where the Sage worksheet process is
executing.
... |
tests/context/test_policy.py | MolecularAI/aizynthfinder | 219 | 11149540 | <gh_stars>100-1000
import pytest
import numpy as np
from aizynthfinder.chem import (
TreeMolecule,
SmilesBasedRetroReaction,
TemplatedRetroReaction,
)
from aizynthfinder.context.policy import (
TemplateBasedExpansionStrategy,
QuickKerasFilter,
ReactantsCountFilter,
)
from aizynthfinder.utils.ex... |
evennia/scripts/manager.py | Henddher/evennia | 1,544 | 11149544 | <gh_stars>1000+
"""
The custom manager for Scripts.
"""
from django.db.models import Q
from evennia.typeclasses.managers import TypedObjectManager, TypeclassManager
from evennia.utils.utils import make_iter
__all__ = ("ScriptManager",)
_GA = object.__getattribute__
VALIDATE_ITERATION = 0
class ScriptDBManager(Type... |
snips_nlu/intent_classifier/featurizer.py | CharlyBlavier/snips-nlu-Copy | 3,764 | 11149568 | <filename>snips_nlu/intent_classifier/featurizer.py<gh_stars>1000+
from __future__ import division, unicode_literals
import json
from builtins import str, zip
from copy import deepcopy
from pathlib import Path
from future.utils import iteritems
from snips_nlu.common.utils import (
json_string, fitted_required, r... |
mealpy/math_based/HC.py | thieu1995/mealpy | 162 | 11149603 | <reponame>thieu1995/mealpy
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 10:08, 02/03/2021 %
# ... |
aliyun-python-sdk-privatelink/aliyunsdkprivatelink/request/v20200415/CreateVpcEndpointRequest.py | leafcoder/aliyun-openapi-python-sdk | 1,001 | 11149625 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
lib/datasets/kitti.py | mit-drl/Stereo-RCNN | 681 | 11149640 | <filename>lib/datasets/kitti.py
from __future__ import print_function
from __future__ import absolute_import
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# Modified by <NAME> for Ste... |
3rdParty/V8/v7.9.317/tools/sanitizers/sanitize_pcs.py | rajeev02101987/arangodb | 20,995 | 11149644 | <filename>3rdParty/V8/v7.9.317/tools/sanitizers/sanitize_pcs.py
#!/usr/bin/env python
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Corrects objdump output. The logic is from sancov.py, see comments... |
tensorflow/python/kernel_tests/large_concat_op_test.py | danielgordon10/tensorflow | 101 | 11149650 | <reponame>danielgordon10/tensorflow
# Copyright 2016 The TensorFlow 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... |
capture/noworkflow/resources/demo/1/step2/simulation.py | raffaelfoidl/noworkflow | 108 | 11149707 | <reponame>raffaelfoidl/noworkflow
import csv
import sys
import matplotlib.pyplot as plt
from simulator import simulate
def run_simulation(data_a, data_b):
return simulate(csv_read(data_a), csv_read(data_b))
def csv_read(f):
return list(csv.reader(open(f, 'rU'), delimiter=':'))
def extract_column(data, column... |
src/plugins/plugin.py | BeholdersEye/PyBitmessage | 1,583 | 11149709 | <reponame>BeholdersEye/PyBitmessage
# -*- coding: utf-8 -*-
"""
Operating with plugins
"""
import logging
import pkg_resources
logger = logging.getLogger('default')
def get_plugins(group, point='', name=None, fallback=None):
"""
:param str group: plugin group
:param str point: plugin name prefix
:p... |
test/dual_run.py | TysonHeart/dynomite | 3,380 | 11149714 | #!/usr/bin/env python3
import redis
class ResultMismatchError(Exception):
def __init__(self, r_result, d_result, func, *args):
self.r_result = r_result
self.d_result = d_result
self.func = func
self.args = args
def __str__(self):
ret = "\n\t======Result Mismatch=======\n... |
tools/rst_lint/run.py | mindspore-ai/docs | 288 | 11149729 | """The restructuredtext linter."""
import sys
from docutils import nodes
from docutils.parsers.rst import Directive
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import register_directive
from docutils.parsers.rst.roles import register_generic_role
from sphinx.ext.autodoc.directive im... |
libcloudforensics/providers/gcp/internal/storagetransfer.py | zkck/cloud-forensics-utils | 241 | 11149739 | # -*- coding: utf-8 -*-
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... |
axes/migrations/0002_auto_20151217_2044.py | AMDINDOWS/django-axes | 831 | 11149741 | <gh_stars>100-1000
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("axes", "0001_initial")]
operations = [
migrations.AlterField(
model_name="accessattempt",
name="ip_address",
field=models.GenericIPAddressField(
... |
AppServer/google/appengine/ext/analytics/entity.py | loftwah/appscale | 790 | 11149780 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
tests/test_process_executor_forkserver.py | hoodmane/loky | 248 | 11149793 | <reponame>hoodmane/loky
import sys
from loky import process_executor
from loky.backend import get_context
from ._executor_mixin import ExecutorMixin
if (sys.version_info[:2] > (3, 3)
and sys.platform != "win32"
and not hasattr(sys, "pypy_version_info")):
# XXX: the forkserver backend is broken wi... |
pwnlib/constants/linux/aarch64.py | IMULMUL/python3-pwntools | 325 | 11149834 | <gh_stars>100-1000
from pwnlib.constants.constant import Constant
__NR_io_setup = Constant('__NR_io_setup', 0)
__NR_io_destroy = Constant('__NR_io_destroy', 1)
__NR_io_submit = Constant('__NR_io_submit', 2)
__NR_io_cancel = Constant('__NR_io_cancel', 3)
__NR_io_getevents = Constant('__NR_io_getevents', 4)
__NR_setxatt... |
examples/expl_qwant.py | albmarin/MechanicalSoup | 2,530 | 11149855 | <gh_stars>1000+
"""Example usage of MechanicalSoup to get the results from the Qwant
search engine.
"""
import re
import urllib.parse
import mechanicalsoup
# Connect to duckduckgo
browser = mechanicalsoup.StatefulBrowser(user_agent='MechanicalSoup')
browser.open("https://lite.qwant.com/")
# Fill-in the search form... |
predict.py | annaproxy/udify-metalearning | 185 | 11149861 | <reponame>annaproxy/udify-metalearning
"""
Predict conllu files given a trained model
"""
import os
import shutil
import logging
import argparse
import tarfile
from pathlib import Path
from allennlp.common import Params
from allennlp.common.util import import_submodules
from allennlp.models.archival import archive_mo... |
test/vpp_qos.py | amithbraj/vpp | 751 | 11149889 | <filename>test/vpp_qos.py
"""
QoS
object abstractions for representing QoS config VPP
"""
from vpp_object import VppObject
class VppQosRecord(VppObject):
""" QoS Record(ing) configuration """
def __init__(self, test, intf, source):
self._test = test
self.intf = intf
self.source ... |
test/hummingbot/connector/exchange/coinflex/test_coinflex_order_book.py | pecuniafinance/hummingbot | 542 | 11149918 | from unittest import TestCase
from hummingbot.connector.exchange.coinflex.coinflex_order_book import CoinflexOrderBook
from hummingbot.core.data_type.order_book_message import OrderBookMessageType
class CoinflexOrderBookTests(TestCase):
def test_snapshot_message_from_exchange(self):
snapshot_message = C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.