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 |
|---|---|---|---|---|
pyglet/canvas/base.py | AnantTiwari-Naman/pyglet | 1,160 | 11065001 | <gh_stars>1000+
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2021 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that... |
venv/lib/python3.8/site-packages/pip/_internal/vcs/mercurial.py | Joshua-Barawa/My-Photos | 102 | 11065020 | <gh_stars>100-1000
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
from __future__ import absolute_import
import logging
import os
from pip._vendor.six.moves import configparser
from pip._internal.exceptions import BadCommand, InstallationError
from pip._in... |
onmt/keyphrase/utils.py | memray/OpenNMT-kpg-release | 152 | 11065041 | <filename>onmt/keyphrase/utils.py
import re
import string
from os.path import join, dirname
import numpy as np
import time
import sys,logging
import matplotlib
SEP_token = "<sep>"
DIGIT_token = "<digit>"
import time
from nltk.stem.porter import *
stemmer = PorterStemmer()
# matplotlib.use('agg')
# import matplotlib.... |
libp2p/pubsub/floodsub.py | Jacquelinevv0693/py-libp2p | 315 | 11065042 | <gh_stars>100-1000
import logging
from typing import Iterable, List, Sequence
import trio
from libp2p.network.stream.exceptions import StreamClosed
from libp2p.peer.id import ID
from libp2p.typing import TProtocol
from libp2p.utils import encode_varint_prefixed
from .abc import IPubsubRouter
from .pb import rpc_pb2
... |
src/finn/util/create.py | AlexMontgomerie/finn | 283 | 11065046 | # Copyright (c) 2020 Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the f... |
tf_quant_finance/experimental/instruments/overnight_index_linked_futures_test.py | slowy07/tf-quant-finance | 3,138 | 11065061 | <filename>tf_quant_finance/experimental/instruments/overnight_index_linked_futures_test.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
#
# ... |
libtbx/test_utils/pytest.py | dperl-sol/cctbx_project | 155 | 11065082 | from __future__ import absolute_import, division, print_function
import atexit
import os
import sys
import itertools
import libtbx.load_env
from libtbx.test_utils.parallel import run_command
_first_pytest_collection = True
_pytest_unique_counter = itertools.count(1)
def discover(module=None, pytestargs=None):
'''
... |
tests/errors/codegen/fortran/randint.py | dina-fouad/pyccel | 206 | 11065087 | # pylint: disable=missing-function-docstring, missing-module-docstring/
from numpy.random import randint
a = randint(10, size = 5)
|
coal_mine/memory_store.py | aberja/coal-mine | 108 | 11065120 | # Copyright 2015 Quantopian, 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 agreed to in wri... |
python-package/xlearn/xlearn.py | DavyMorgan/xlearn | 3,144 | 11065145 | # Copyright (c) 2018 by contributors. 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... |
pyppeteer/connection.py | olivierdalang/pyppeteer | 3,747 | 11065159 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Connection/Session management module."""
import asyncio
import json
import logging
from typing import Awaitable, Callable, Dict, Union, TYPE_CHECKING
from pyee import EventEmitter
import websockets
from pyppeteer.errors import NetworkError
if TYPE_CHECKING:
fro... |
PhysicsTools/TagAndProbe/test/testTagProbeFitTreeAnalyzer_Toy.py | ckamtsikis/cmssw | 852 | 11065187 | <filename>PhysicsTools/TagAndProbe/test/testTagProbeFitTreeAnalyzer_Toy.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
process = cms.Process("TagProbe")
process.load('FWCore.MessageService.MessageLogger_cfi')
process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet( input = c... |
pipeline_plugins/components/collections/remote_plugin/v1_0_0.py | qqqqqie/bk-sops | 881 | 11065193 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME> Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in c... |
tests/utils.py | corylevine/okta-sdk-python | 145 | 11065203 | import string
import random
"""
File for utility functions used in testing
"""
def random_string_of_length(length):
"""
Generates a random string of ASCII letters of a fixed length.
Args:
length (int): fixed length desired
Returns:
string: random string generated
"""
return ... |
dataloader/mr.py | mvemoon/TextClassificationBenchmark | 576 | 11065206 | <filename>dataloader/mr.py
# -*- coding: utf-8 -*-
from .Dataset import Dataset
import os
import pandas as pd
import numpy as np
from codecs import open
class MRDataset(Dataset):
def __init__(self,opt=None,**kwargs):
super(MRDataset,self).__init__(opt,**kwargs)
self.urls=['https://www.cs.cornell.e... |
api/python_semrush/errors.py | jmelm93/MLTS | 117 | 11065219 | <gh_stars>100-1000
from __future__ import absolute_import, print_function, unicode_literals
class BaseSemrushError(Exception):
pass
class SemRushKeyError(BaseSemrushError):
pass
class SemRushRegionalDatabaseError(BaseSemrushError):
pass |
applications/SwimmingDEMApplication/tests/ValidationTests.py | lkusch/Kratos | 778 | 11065228 | # Definition of the classes for the VALIDATION TESTS
#Iimport Kratos
import KratosMultiphysics
import KratosMultiphysics.DEMApplication
import KratosMultiphysics.SwimmingDEMApplication
# Import TestFactory
import SPFEMTestFactory as SPFEMTF
# Import KratosUnittest
import KratosMultiphysics.KratosUnittest as KratosUn... |
Custom/events/Zabbix/API/requests/packages/chardet/universaldetector.py | aplishka-az/Deadline | 113 | 11065236 | <reponame>aplishka-az/Deadline
######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C)... |
scripts/west_commands/build.py | Trifunik/zephyr | 6,224 | 11065237 | # Copyright (c) 2018 Foundries.io
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import os
import pathlib
import shlex
import sys
import yaml
from west import log
from west.configuration import config
from zcmake import DEFAULT_CMAKE_GENERATOR, run_cmake, run_build, CMakeCache
from build_helpers import is_ze... |
opendr/__init__.py | foamliu/opendr | 363 | 11065254 | <reponame>foamliu/opendr<filename>opendr/__init__.py
from .version import version as __version__
def test():
from os.path import split
import unittest
test_loader = unittest.TestLoader()
test_loader = test_loader.discover(split(__file__)[0])
test_runner = unittest.TextTestRunner()
test_runner.r... |
tests/test_autogen_indexes.py | kasium/alembic | 1,324 | 11065273 | from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import ForeignKeyConstraint
from sqlalchemy import func
from sqlalchemy import Index
from sqlalchemy import Integer
from sqlalchemy import MetaData
from sqlalchemy import Numeric
from sqlalchemy import PrimaryKeyConstraint
from sqlalchemy i... |
different_ways_to_add_parentheses/solution.py | mahimadubey/leetcode-python | 528 | 11065274 | """
Given a string of numbers and operators, return all possible results from
computing all the different possible ways to group numbers and operators. The
valid operators are +, - and *.
Example 1
Input: "2-1-1".
((2-1)-1) = 0
(2-(1-1)) = 2
Output: [0, 2]
Example 2
Input: "2*3-4*5"
(2*(3-(4*5))) = -34
((2*3)-(4*... |
Alignment/CommonAlignmentProducer/python/ALCARECOMuAlGlobalCosmics_Output_cff.py | ckamtsikis/cmssw | 852 | 11065278 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
# AlCaReco output for track based muon alignment using cosmic ray tracks
OutALCARECOMuAlGlobalCosmics_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('pathALCARECOMuAlGlobalCosmics')
),
outputComman... |
chalice/deploy/appgraph.py | Chen188/chalice | 6,240 | 11065284 | import json
import os
from typing import cast
from typing import Dict, List, Tuple, Any, Set, Optional, Text, Union # noqa
from attr import asdict
from chalice.config import Config # noqa
from chalice import app
from chalice.constants import LAMBDA_TRUST_POLICY
from chalice.deploy import models
from chalice.utils i... |
tests/unit/small_text/utils/test_clustering.py | chschroeder/small-text | 218 | 11065293 | import unittest
import numpy as np
from unittest.mock import patch
from small_text.utils.clustering import init_kmeans_plusplus_safe
class ClusteringTest(unittest.TestCase):
@patch('small_text.utils.clustering.warnings.warn')
@patch('small_text.utils.clustering.choice')
@patch('small_text.utils.cluster... |
detectron2/modeling/meta_arch/rcnn.py | Nour-7/detectron2 | 171 | 11065300 | <filename>detectron2/modeling/meta_arch/rcnn.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import numpy as np
from typing import Optional, Tuple
import torch
from torch import nn
from detectron2.config import configurable
from detectron2.data.detection_utils import convert_im... |
packs/qualys/actions/get_host_range.py | userlocalhost2000/st2contrib | 164 | 11065322 | <reponame>userlocalhost2000/st2contrib
from lib.base import QualysBaseAction
__all__ = [
'GetHostRangeAction'
]
class GetHostRangeAction(QualysBaseAction):
def run(self, host_start, host_end):
host = self.connection.getHostRange(host_start, host_end)
return self.resultsets.formatter(host)
|
docarray/array/mixins/match.py | qdrant/docarray | 591 | 11065330 | from typing import Optional, Union, Callable, Tuple, TYPE_CHECKING
if TYPE_CHECKING:
import numpy as np
from ...typing import ArrayType
from ... import DocumentArray
class MatchMixin:
"""A mixin that provides match functionality to DocumentArrays"""
def match(
self,
darray: 'Docu... |
src/lib/tracker/basetrack.py | EvelynYihuiYang/MCMOT | 306 | 11065333 | # encoding=utf-8
import numpy as np
from collections import defaultdict
from collections import OrderedDict
class TrackState(object):
New = 0
Tracked = 1
Lost = 2
Removed = 3
# TODO: Create a multi-object class BaseTrack class
class MCBaseTrack(object):
_count_dict = defaultdict(int) # the MCB... |
onmt/inputters/datareader_base.py | l-k-11235/OpenNMT-py | 5,864 | 11065354 | # coding: utf-8
# several data readers need optional dependencies. There's no
# appropriate builtin exception
class MissingDependencyException(Exception):
pass
class DataReaderBase(object):
"""Read data from file system and yield as dicts.
Raises:
onmt.inputters.datareader_base.MissingDependenc... |
MangoFuzz/fuzzer/blenders/string_blender.py | fengjixuchui/difuze | 347 | 11065367 | from blender import Blender
from ..utils import *
import random
class StringBlender(Blender):
"""
String Blender.
This generates random string of provided size.
"""
supported_types = ["String"]
def __init__(self, engine_obj):
super(StringBlender, self).__init__(engine_obj)
thick_peel("Created a StringBle... |
GreedyInfoMax/audio/models/loss_supervised_phones.py | weiaicunzai/pytorch-faster-rcnn | 288 | 11065369 | <reponame>weiaicunzai/pytorch-faster-rcnn
import torch.nn as nn
import torch
from GreedyInfoMax.audio.data import phone_dict
from GreedyInfoMax.audio.models import loss
class Phones_Loss(loss.Loss):
def __init__(self, opt, hidden_dim, calc_accuracy):
super(Phones_Loss, self).__init__()
self.opt ... |
model.py | ishit/xfields | 137 | 11065395 |
import tensorflow as tf
from tensorlayer.layers import PadLayer,Conv2d,UpSampling2dLayer,InputLayer,ConcatLayer
import numpy as np
def upsampling_factor_padding(h_res,w_res):
res_temp = h_res
py =[res_temp%2]
while res_temp!=1:
res_temp = res_temp//2
py.append(res_temp%2)
del... |
gratipay/models/country.py | kant/gratipay.com | 517 | 11065408 | from __future__ import absolute_import, division, print_function, unicode_literals
from postgres.orm import Model
class Country(Model):
"""Represent country records from our database (read-only).
:var int id: the record's primary key in our ``countries`` table
:var unicode code: the country's `ISO 3166-... |
test.py | DLPerf/PointASNL | 209 | 11065413 | import tensorflow as tf
import numpy as np
import argparse
import socket
import importlib
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = BASE_DIR
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'models'))
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
import mod... |
mayan/apps/sources/tests/__init__.py | atitaya1412/Mayan-EDMS | 336 | 11065416 | <filename>mayan/apps/sources/tests/__init__.py<gh_stars>100-1000
from .source_backends import ( # NOQA
SourceBackendSimple, SourceBackendTestPeriodic, SourceBackendTestEmail
)
|
knowledge/admin.py | bitmazk/django-knowledge | 199 | 11065424 | <filename>knowledge/admin.py<gh_stars>100-1000
from django.contrib import admin
from knowledge.models import Question, Response, Category
class CategoryAdmin(admin.ModelAdmin):
list_display = [f.name for f in Category._meta.fields]
prepopulated_fields = {'slug': ('title', )}
admin.site.register(Category, Cat... |
modules/dbnd-airflow-monitor/src/airflow_monitor/airflow_monitor_utils.py | busunkim96/dbnd | 224 | 11065428 | import logging
from airflow_monitor.common.metric_reporter import METRIC_REPORTER
logger = logging.getLogger(__name__)
def log_received_tasks(url, fetched_data):
if not fetched_data:
return
try:
d = sorted(
[
(k, len(v))
for k, v in fetched_data.i... |
lib/config/config.py | SunwungLee/Faster-RCNN-TensorFlow-Python3 | 433 | 11065434 | <reponame>SunwungLee/Faster-RCNN-TensorFlow-Python3
import os
import os.path as osp
import numpy as np
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
FLAGS2 = {}
######################
# General Parameters #
######################
FLAGS2["pixel_means"] = np.array([[[102.9801, 115.9465, 122.7717]]])
tf.app.flags.... |
test_epoch.py | Co1lin/RfDNet | 143 | 11065450 | <reponame>Co1lin/RfDNet
# Testing functions.
# author: ynie
# date: April, 2020
from net_utils.utils import LossRecorder
from time import time
import torch
from net_utils.ap_helper import APCalculator
import numpy as np
def test_func(cfg, tester, test_loader):
'''
test function.
:param cfg: configuration f... |
mmdet/models/bbox_heads/bbox_head.py | jiangwenj02/SOLO | 1,467 | 11065456 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from mmdet.core import (auto_fp16, bbox_target, delta2bbox, force_fp32,
multiclass_nms)
from ..builder import build_loss
from ..losses import accuracy
from ..registry import HEADS
@HEAD... |
objectModel/Python/cdm/storage/adls.py | jocubeit/CDM | 265 | 11065477 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
import base64
from collections import OrderedDict
from datetime import datetime
import hashlib
import hmac
from http import HTTPStatus
from time import mktime
impo... |
blogs/parser.py | ewjoachim/pythondotorg | 911 | 11065491 | import datetime
import feedparser
from django.conf import settings
from django.template.loader import render_to_string
from django.utils.timezone import make_aware, utc
from boxes.models import Box
from .models import BlogEntry, Feed
def get_all_entries(feed_url):
""" Retrieve all entries from a feed URL """
... |
autokeras/adapters/input_adapters.py | lc0/autokeras | 4,704 | 11065501 | <reponame>lc0/autokeras
# Copyright 2020 The AutoKeras 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 appli... |
5_pytorch_retinanet/lib/train_detector.py | deepchatterjeevns/Monk_Object_Detection | 549 | 11065503 | <gh_stars>100-1000
import collections
import os
import numpy as np
import torch
import torch.optim as optim
from torchvision import transforms
from retinanet import model
from retinanet.dataloader import CocoDataset, CSVDataset, collater, Resizer, AspectRatioBasedSampler, Augmenter, \
Normalizer
from torch.utils... |
examples/rl/scripts/design-4/train.py | ONLYA/RoboGrammar | 156 | 11065504 | <reponame>ONLYA/RoboGrammar<gh_stars>100-1000
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--save-dir', type = str, default = './trained_models/RobotLocomotion-v0/design-4/')
args = parser.parse_args()
cmd = 'python train/train.py --rule-sequence 0, 14, 2, 11, 4, 16, 6, 4, 19, 10... |
eeauditor/auditors/aws/AWS_IAM_Auditor.py | kbhagi/ElectricEye | 442 | 11065517 | <reponame>kbhagi/ElectricEye
#This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#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 ... |
corehq/apps/userreports/tests/test_columns.py | akashkj/commcare-hq | 471 | 11065518 | import uuid
from django.test import SimpleTestCase, TestCase
from sqlagg import SumWhen
from casexml.apps.case.mock import CaseBlock
from casexml.apps.case.util import post_case_blocks
from corehq.apps.userreports import tasks
from corehq.apps.userreports.app_manager.helpers import clean_table_name
from corehq.apps... |
Contents/Libraries/Shared/rebulk/test/test_toposort.py | jippo015/Sub-Zero.bundle | 1,553 | 11065548 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2014 True Blade Systems, 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
#
# Orig... |
utils/logger.py | mjlbach/3detr | 336 | 11065553 | <reponame>mjlbach/3detr
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
try:
from tensorboardX import SummaryWriter
except ImportError:
print("Cannot import tensorboard. Will log to txt files only.")
SummaryWriter = None
from utils.dist import is_primary
class Logger(object):
def __... |
froide/account/migrations/0025_auto_20200812_1212.py | xenein/froide | 198 | 11065558 | # Generated by Django 3.0.8 on 2020-08-12 10:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("account", "0024_auto_20200608_1111"),
]
operations = [
migrations.AlterModelOptions(
name="accountblocklist",
options={
... |
torchplus/train/learning_schedules_fastai.py | jerry99s/second.pytorch | 1,541 | 11065561 | import numpy as np
import math
from functools import partial
import torch
class LRSchedulerStep(object):
def __init__(self, fai_optimizer, total_step, lr_phases, mom_phases):
self.optimizer = fai_optimizer
self.total_step = total_step
self.lr_phases = []
for i, (start, lambda_func... |
scripts/__init__.py | bigblue/pynab | 657 | 11065579 | <filename>scripts/__init__.py
__author__ = 'James'
|
tests/unit/gapic/aiplatform_v1/test_job_service.py | conankun/python-aiplatform | 180 | 11065584 | <filename>tests/unit/gapic/aiplatform_v1/test_job_service.py
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/... |
package.py | saimohithnaag/StockPredictor | 1,761 | 11065661 | <gh_stars>1000+
# Inspired by npm's package.json file
name = 'bulbea'
version = '0.1.0'
release = '0.1.0'
description = 'A neural stock market predictor and model builder'
long_description = ['README.md']
keywords = ['neural', 'network', 'machine', 'deep',
'learning'... |
oss_src/unity/python/sframe/test/test_sarray_builder.py | venkattgg/venkey | 493 | 11065665 | '''
Copyright (C) 2016 Turi
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
'''
from ..data_structures.sarray_builder import SArrayBuilder
import unittest
import array
import datetime as dt
from ..util.timezone import GMT
class ... |
SPOJ/Week 1/rpn/reverse.py | VastoLorde95/Competitive-Programming | 170 | 11065667 | no_of_iter = input()
N = 0
count = 0
lis = []
while count < no_of_iter:
num1, num2 = raw_input().split()
lis.append((num1,num2))
count+=1
for sample in lis:
num1, num2 = sample
l1, l2 = len(num1), len(num2)
number = ''
l, i, carry = min(l1, l2), 0, 0
while i < l:
x = int(num1[i]) + int(num2[i]) + carry
summ... |
vunit/parsing/verilog/preprocess.py | eataesierp/vunit | 507 | 11065691 | <reponame>eataesierp/vunit<gh_stars>100-1000
# 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.org/MPL/2.0/.
#
# Copyright (c) 2014-2021, <NAME> <EMAIL>
# pylint: disable=unused-wildca... |
ext/totals.py | sskras/timewarrior | 810 | 11065733 | <gh_stars>100-1000
#!/usr/bin/env python3
###############################################################################
#
# Copyright 2016 - 2021, <NAME>, <NAME>, <NAME>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... |
aif360/algorithms/inprocessing/art_classifier.py | sumacm/fairattr | 982 | 11065738 | import numpy as np
from aif360.datasets import BinaryLabelDataset
from aif360.algorithms import Transformer
class ARTClassifier(Transformer):
"""Wraps an instance of an :obj:`art.classifiers.Classifier` to extend
:obj:`~aif360.algorithms.Transformer`.
"""
def __init__(self, art_classifier):
... |
ClemBot.Bot/bot/cogs/eval_cog.py | Iapetus-11/ClemBot | 121 | 11065745 | import json
import logging
import typing as t
import aiohttp
import discord.ext.commands as commands
import discord.utils as utils
import bot.bot_secrets as bot_secrets
import bot.extensions as ext
log = logging.getLogger(__name__)
HEADERS = {
'Content-type': 'application/json',
'Accept': 'application/json'... |
statsmodels/genmod/tests/test_constrained.py | bukzor/statsmodels | 6,931 | 11065755 | # -*- coding: utf-8 -*-
"""
Unit tests for fit_constrained
Tests for Poisson and Binomial are in discrete
Created on Sun Jan 7 09:21:39 2018
Author: <NAME>
"""
import warnings
import numpy as np
from numpy.testing import assert_allclose, assert_equal
from statsmodels.genmod.families import family
from statsmodel... |
netket/experimental/dynamics/__init__.py | NetKet/netket | 352 | 11065768 | # Copyright 2021 The NetKet 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/LICENSE-2.0
#
# Unless required by applicable ... |
models/vision/detection/configs/mask_rcnn/SM/CI/2/sagemaker_2x8.py | piyushghai/deep-learning-models | 129 | 11065773 | import os.path as osp
# date time settings to update paths for jobs
from datetime import datetime
now = datetime.now()
time_str = now.strftime("%d-%m-%Y-%H-%M")
date_str = now.strftime("%d-%m-%Y")
# sagemaker settings
sagemaker_user=dict(
user_id='CI',
s3_bucket='mzanur-sagemaker',
docker_image='57827620... |
umap/tests/test_parametric_umap.py | worldbeater/umap | 5,537 | 11065795 | <gh_stars>1000+
import numpy as np
import tempfile
import pytest
from sklearn.datasets import make_moons
from sklearn.model_selection import train_test_split
try:
import tensorflow as tf
IMPORT_TF = True
except ImportError:
IMPORT_TF = False
else:
from umap.parametric_umap import ParametricUMAP, load_... |
DQMServices/FwkIO/test/create_lumi_only_file_cfg.py | ckamtsikis/cmssw | 852 | 11065820 | <gh_stars>100-1000
from builtins import range
import FWCore.ParameterSet.Config as cms
process =cms.Process("TEST")
process.source = cms.Source("EmptySource", numberEventsInRun = cms.untracked.uint32(1))
elements = list()
for i in range(0,10):
elements.append(cms.untracked.PSet(lowX=cms.untracked.double(0),
... |
test/test_protocol.py | informatique-cdc/kafka-python | 4,389 | 11065822 | <gh_stars>1000+
#pylint: skip-file
import io
import struct
import pytest
from kafka.protocol.api import RequestHeader
from kafka.protocol.commit import GroupCoordinatorRequest
from kafka.protocol.fetch import FetchRequest, FetchResponse
from kafka.protocol.message import Message, MessageSet, PartialMessage
from kafka... |
example/example/settings.py | tomchristie/django-vanilla-views | 476 | 11065827 | import os
import django
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DEBUG = True
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": "sqlite3.db",
}
}
STATIC_URL = "/static/"
STATICFILES_DIRS = [
"statics",
]
SECRET_KEY = "not-secret"
... |
docs/snippets/function_annotations_rst.py | WillDaSilva/mkdocstrings | 354 | 11065837 | from typing import Optional
def my_function(param1: int, param2: Optional[str] = None) -> str:
"""A short description of this function.
Complex markup is supported in the main description section.
I'm a code block!
:param param1: An integer?
:param param2: A string? If you have a long descr... |
common/src/stack/command/stack/commands/remove/repo/__init__.py | sammeidinger/stack | 123 | 11065842 | <reponame>sammeidinger/stack<gh_stars>100-1000
from stack.argument_processors.repo import RepoArgProcessor
import stack.commands
import stack.deferable
from stack.exception import CommandError
class Command(RepoArgProcessor, stack.commands.remove.command):
"""
Remove remote software repositories from stacki.
<arg... |
blender/hecl/sact/SACTSubtype.py | linkmauve/hecl | 267 | 11065843 | import bpy
# Subtype update (if anything important changes)
def active_subtype_update(self, context):
if context.scene.hecl_type == 'ACTOR' and context.scene.hecl_auto_select:
if SACTSubtype_load.poll(context):
bpy.ops.scene.sactsubtype_load()
# Actor subtype overlay class
class SACTSubtypeOv... |
third_party/blink/web_tests/http/tests/websocket/fragmented-binary-frames_wsh.py | zealoussnow/chromium | 14,668 | 11065851 | <reponame>zealoussnow/chromium
from six.moves import range
from mod_pywebsocket import common
from mod_pywebsocket import stream
from mod_pywebsocket import util
def web_socket_do_extra_handshake(request):
pass
def web_socket_transfer_data(request):
# pyformat: disable
messages_to_send = [[b'Hello, ', ... |
var/spack/repos/builtin/packages/py-py6s/package.py | LiamBindle/spack | 2,360 | 11065877 | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyPy6s(PythonPackage):
"""
A wrapper for the 6S Radiative Transfer Model to make it ea... |
examples/python/elf_unstrip.py | rafael-santiago/LIEF | 2,999 | 11065882 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description
# -----------
# In this example, we assume that we found
# the ``main`` function at address 0x402A00
# and we add a static symbol to the binary
# so that we can do:
#
# (gdb) break main
# Breakpoint 1 at 0x402a00
from lief import ELF
import sys
binary = ELF... |
neural_parts/models/resnet.py | naynasa/neural_parts_fork | 137 | 11065889 | <gh_stars>100-1000
import torch
from torch import nn
class ResidualBlock(nn.Module):
def __init__(self, in_dims, out_dims, norm_method="batch_norm"):
super().__init__()
self.proj = (
nn.Sequential() if in_dims == out_dims else
nn.Linear(in_dims, out_dims)
)
... |
neutron/agent/l3/dvr_fip_ns.py | congnt95/neutron | 1,080 | 11065899 | # Copyright (c) 2015 OpenStack Foundation
#
# 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 ... |
tests/conftest.py | DK99/python-betterproto | 708 | 11065908 | import pytest
def pytest_addoption(parser):
parser.addoption(
"--repeat", type=int, default=1, help="repeat the operation multiple times"
)
@pytest.fixture(scope="session")
def repeat(request):
return request.config.getoption("repeat")
|
crawler/base_crawler.py | hridaydutta123/Bitcluster | 102 | 11065911 | import bitcoin
import bitcoin.rpc
import bitcoin.core.script
import socket
import binascii
import http.client
from crawler.address_utils import Addressutils
from bitcoin.core import CTransaction
from settings import settings
from bitcoin.core.script import OP_FALSE
class BaseCrawler:
def __init__(self):
... |
tests/test_simplevardecl.py | rbarzic/PyCParser | 289 | 11065942 |
from pprint import pprint
import helpers_test
from cparser import *
def test_simplevardecl():
testcode = """
int16_t a;
int b = 42;
void* c = &b;
int* d = &b;
char e, *f = "abc", g, **h = &f;
"""
state = helpers_test.parse(testcode)
a = state.vars["a"]
b = state.vars["b"]
c = state.va... |
tests/layers/attentive_gru_test.py | richarajpal/deep_qa | 459 | 11065990 | # pylint: disable=no-self-use
import numpy
from keras.layers import Input, Embedding, merge
from keras.models import Model
import keras.backend as K
from deep_qa.layers.encoders import AttentiveGru
class TestAttentiveGRU:
def test_on_unmasked_input(self):
sentence_length = 5
embedding_dim = 10
... |
jsonrpc/tests/test_pep3107.py | massover/json-rpc | 409 | 11066000 | <filename>jsonrpc/tests/test_pep3107.py<gh_stars>100-1000
from ..manager import JSONRPCResponseManager
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
class TestJSONRPCResponseManager(unittest.TestCase):
@unittest.skipIf(sys.version_info < (3, 5), "Test Py3.5+... |
influxdb/tests/influxdb08/dataframe_client_test.py | timgates42/influxdb-python | 1,429 | 11066009 | <reponame>timgates42/influxdb-python
# -*- coding: utf-8 -*-
"""Unit tests for misc module."""
from datetime import timedelta
import copy
import json
import unittest
import warnings
import requests_mock
from nose.tools import raises
from influxdb.tests import skip_if_pypy, using_pypy
from .client_test import _moc... |
v2/dataset.py | KevinJeon/DanceRevolution | 209 | 11066016 | # This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this open-source project.
""" Define the dance dataset. """
import numpy as np
import torch
import torch.utils.data
from torch.utils.data import Dataset
def paired_collate_fn(insts):
src_seq, tgt_seq = list... |
hand_eye_calibration/python/hand_eye_calibration/extrinsic_calibration.py | Chatoyant19/handeye_calibration | 333 | 11066028 | import os
import json
import numpy as np
from hand_eye_calibration.dual_quaternion import DualQuaternion
class ExtrinsicCalibration:
def __init__(self, time_offset, pose_dual_quat):
self.time_offset = time_offset
self.pose_dq = pose_dual_quat
def writeJson(self, out_file, switchConvention = False):
po... |
hl7apy/v2_5/groups.py | ryoung29/hl7apy | 163 | 11066034 | <filename>hl7apy/v2_5/groups.py
from hl7apy.utils import iteritems
from .segments import SEGMENTS
GROUPS = {
'ADR_A19_INSURANCE': ('sequence',
(['IN1', SEGMENTS['IN1'], (1, 1), 'SEG'],
['IN2', SEGMENTS['IN2'], (0, 1), 'SEG'],
['IN3', ... |
state_of_sparsity/sparse_transformer/decoder.py | deepneuralmachine/google-research | 23,901 | 11066038 | # 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... |
inside/DB/Table_Class/__init__.py | kangzai228/learning-power | 318 | 11066048 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Author : lisztomania
# @Date : 2021/1/15
# @Software : Pycharm
# @Version : Python 3.8.5
# @File : __init__.py.py
# @Function : 数据对象
|
powerfulseal/cli/__main__.py | fahedouch/powerfulseal | 1,362 | 11066065 | <gh_stars>1000+
# Copyright 2017 Bloomberg Finance L.P.
#
# 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... |
jarviscli/tests/test_parser.py | baptoutiego/Jarvis | 2,605 | 11066068 | <gh_stars>1000+
import unittest
from Jarvis import Jarvis
class ParserTest(unittest.TestCase):
def setUp(self):
self.jarvis = Jarvis()
def test_chuck(self):
user_input = "Jarvis, I want to hear a joke about <NAME>, can you help me?"
parsed_input = self.jarvis.parse_input(user_input).... |
alephnull/examples/test_algo.py | flatM/AlephNull | 234 | 11066073 | <filename>alephnull/examples/test_algo.py
#!/usr/bin/env python
#
# Copyright 2013 <NAME> Wealth Management
#
# 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/licen... |
mmdet3d/models/roi_heads/mask_heads/__init__.py | Guangyun-Xu/mmdetection3d | 2,216 | 11066084 | <filename>mmdet3d/models/roi_heads/mask_heads/__init__.py
# Copyright (c) OpenMMLab. All rights reserved.
from .pointwise_semantic_head import PointwiseSemanticHead
from .primitive_head import PrimitiveHead
__all__ = ['PointwiseSemanticHead', 'PrimitiveHead']
|
jina/proto/__init__.py | Rohitpandit021/jina | 15,179 | 11066096 | """
The :mod:`jina.proto` defines the protobuf used in jina. It is the core message protocol used in communicating between :class:`jina.peapods.base.BasePod`. It also defines the interface of a gRPC service.
"""
|
data_preparation/metadata_completion/text_cleaner.py | dweekly/libri-light | 246 | 11066099 | <gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from text_retrieval.guttenberg import is_guttenberg_url
from .utilities import get_txt_name
import os
import json
import progressbar
import sys
sys.path.append('..')
def loadData(pathFile):
with open(pathFile, 'r') as file:... |
src/capb_parser.py | gathierry/FashionAI-KeyPointsDetectionOfApparel | 174 | 11066105 | import numpy as np
from sklearn.model_selection import train_test_split
import pandas as pd
class CAPB():
def __init__(self, data_dir, set_type, train_val):
# set_name should be in ['blouse' 'dress' 'outwear' 'skirt' 'trousers']
self.data_dir = data_dir
set_df = pd.read_table(data_d... |
airflow/providers/google/cloud/hooks/cloud_memorystore.py | npodewitz/airflow | 8,092 | 11066125 | #
# 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... |
tests/import/pkg6/x/y.py | sebastien-riou/micropython | 13,648 | 11066130 | print("y")
|
tests/h/tweens_test.py | pombredanne/h | 2,103 | 11066145 | from unittest import mock
from unittest.mock import MagicMock
import pytest
from h_matchers import Any
from h import tweens
from h.util.redirects import Redirect
class TestRedirectTween:
def test_it_loads_redirects(self, patch):
parse_redirects = patch("h.tweens.parse_redirects")
tweens.redirec... |
runtime/server/x86_gpu/client/offline_client.py | pengchengguo/wenet | 1,166 | 11066161 | # Copyright (c) 2021, 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... |
library/connecter/ansible/yaml/data2db.py | GNHJM/lykops | 141 | 11066172 | <gh_stars>100-1000
import os
from library.connecter.ansible.yaml import Yaml_Base
class Data_DB(Yaml_Base):
def router(self, content, name, yaml_tpye='main', file_type='tasks', preserve=True, together=False, describe=''):
'''
检测yaml数据的语法是否正确,如果含有include或/和roles,将把这些存储在后端数据库中
... |
scripts/examples/OpenMV/25-Machine-Learning/tf_mobilenet_search_just_center.py | jiskra/openmv | 1,761 | 11066188 | # TensorFlow Lite Mobilenet V1 Example
#
# Google's Mobilenet V1 detects 1000 classes of objects
#
# WARNING: Mobilenet is trained on ImageNet and isn't meant to classify anything
# in the real world. It's just designed to score well on the ImageNet dataset.
# This example just shows off running mobilenet on the OpenMV... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.