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 |
|---|---|---|---|---|
benchmarks/benchmarks/api/bench_format_conversion.py | ketyi/dgl | 9,516 | 11000954 | <reponame>ketyi/dgl<filename>benchmarks/benchmarks/api/bench_format_conversion.py
import time
import dgl
import torch
import numpy as np
from .. import utils
@utils.benchmark('time', timeout=600)
@utils.parametrize_cpu('graph_name', ['cora', 'livejournal', 'friendster'])
@utils.parametrize_gpu('graph_name', ['cora',... |
dirigible/user/tests/test_views.py | EnoX1/dirigible-spreadsheet | 168 | 11000957 | # Copyright (c) 2010 Resolver Systems Ltd, PythonAnywhere LLP
# See LICENSE.md
#
from urlparse import urlparse
from mock import Mock, patch, sentinel
import django
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.core.urlresolvers import reverse
from django.http... |
userbot/plugins/mf.py | azizkziba/FridayUserbot | 771 | 11000958 | <filename>userbot/plugins/mf.py
import sys
from telethon import events, functions, __version__
from userbot.utils import admin_cmd
@borg.on(admin_cmd(pattern="mf ?(.*)", allow_sudo=True)) # pylint:disable=E0602
async def _(event):
if event.fwd_from:
return
splugin_name = event.pattern_match.group(1)
... |
mayan/apps/document_states/migrations/0019_workflowtransition_condition.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11000959 | <reponame>nattangwiwat/Mayan-EDMS-recitation<gh_stars>100-1000
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('document_states', '0018_auto_20200129_0926'),
]
operations = [
migrations.AddField(
model_name='workflowtransition'... |
kombu/serialization.py | nlundquist/kombu | 5,079 | 11000965 | """Serialization utilities."""
from __future__ import absolute_import, unicode_literals
import codecs
import os
import sys
import pickle as pypickle
try:
import cPickle as cpickle
except ImportError: # pragma: no cover
cpickle = None # noqa
from collections import namedtuple
from contextlib import contextm... |
tests/tiny_proxy/handlers/base_proxy.py | sjamgade/python-socks | 158 | 11000980 | <filename>tests/tiny_proxy/handlers/base_proxy.py
import logging
import select
import socket
from socketserver import StreamRequestHandler
DEFAULT_RECEIVE_SIZE = 65536
class ProxyError(Exception):
pass
class BaseProxyHandler(StreamRequestHandler):
request: socket.socket
logger: logging.Logger
def ... |
zentral/contrib/osquery/views/configurations.py | arubdesu/zentral | 634 | 11000990 | <filename>zentral/contrib/osquery/views/configurations.py
import logging
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.db.models import Count
from django.shortcuts import get_object_or_404
from django.views.generic import CreateView, DeleteView, DetailView, ListView, UpdateView
from zentral... |
sleekxmpp/exceptions.py | E-Tahta/sleekxmpp | 499 | 11000997 | # -*- coding: utf-8 -*-
"""
sleekxmpp.exceptions
~~~~~~~~~~~~~~~~~~~~
Part of SleekXMPP: The Sleek XMPP Library
:copyright: (c) 2011 <NAME>
:license: MIT, see LICENSE for more details
"""
class XMPPError(Exception):
"""
A generic exception that may be raised while processing an XMPP sta... |
test/py/TestClient.py | Jimexist/thrift | 8,514 | 11001011 | <reponame>Jimexist/thrift<filename>test/py/TestClient.py<gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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... |
smdebug/profiler/profiler_config_parser.py | jsspric/sagemaker-debugger | 133 | 11001016 | <filename>smdebug/profiler/profiler_config_parser.py
# Standard Library
import json
import os
from collections import defaultdict
from enum import Enum
# First Party
from smdebug.core.json_config import get_node_id_from_resource_config
from smdebug.core.logger import get_logger
from smdebug.core.modes import ModeKeys
... |
src/tests/ftest/util/logger_utils.py | fedepad/daos | 429 | 11001018 | #!/usr/bin/python
"""
(C) Copyright 2020-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from logging import DEBUG, INFO, WARNING, ERROR
import sys
class TestLogger():
"""Defines a Logger that also logs messages to DaosLog."""
_LEVELS = {
"debug": DEBUG,
"info": ... |
qiskit/transpiler/__init__.py | QAMP-Spring-2022-Transpiler-Hackathon/qiskit-terra | 1,456 | 11001023 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
tests/test_do_not_error.py | SamBryce-Smith/pyranges | 299 | 11001028 | import pytest
from hypothesis import given, settings, HealthCheck
from hypothesis import reproduce_failure # pylint: disable=unused-import
from itertools import product
import numpy as np
from tests.hypothesis_helper import dfs_min2, dfs_no_min
from os import environ
if environ.get("TRAVIS"):
max_examples = ... |
tests/models/yolos/test_feature_extraction_yolos.py | bugface/transformers | 8,028 | 11001062 | <reponame>bugface/transformers
# coding=utf-8
# Copyright 2021 HuggingFace 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 r... |
dashboard/dashboard/common/namespaced_stored_object_test.py | ravitejavalluri/catapult | 2,151 | 11001075 | <reponame>ravitejavalluri/catapult
# 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.
import unittest
from dashboard.common import namespaced_stored_object
from dashboard.common import stored_object
from das... |
DouBanMovie/DouBanMovie/spiders/douban.py | CareyRay/Python-Spider | 713 | 11001079 | # -*- coding: utf-8 -*-
import scrapy
from DouBanMovie.items import DoubanmovieItem
class DoubanSpider(scrapy.Spider):
name = "douban"
allowed_domains = ["movie.douban.com"]
offset = 0
url = 'https://movie.douban.com/top250?start='
start_urls = (
url + str(offset),
)
def parse(self... |
fairseq/modules/transformer_sentence_encoder.py | kayoyin/DialogueMT | 651 | 11001087 | # 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.
from typing import Optional, Tuple
import torch
import torch.nn as nn
from fairseq.modules import (
FairseqDropout,
LayerDropModuleLi... |
thirdparty/instant-meshes/instant-meshes-dust3d/ext/nanogui/ext/pybind11/tests/test_opaque_types.py | MelvinG24/dust3d | 2,392 | 11001090 | import pytest
def test_string_list():
from pybind11_tests import StringList, ClassWithSTLVecProperty, print_opaque_list
l = StringList()
l.push_back("Element 1")
l.push_back("Element 2")
assert print_opaque_list(l) == "Opaque list: [Element 1, Element 2]"
assert l.back() == "Element 2"
f... |
applications/connection_search/aciConSearch.py | richardstrnad/acitoolkit | 351 | 11001096 | ################################################################################
################################################################################
# #
# Copyright (c) 2015 Cisco Systems #
# All Rights Reserved. ... |
pypy/tool/bench/test/test_benchmark_report.py | nanjekyejoannah/pypy | 381 | 11001148 | import os
import py
try:
import Image
except ImportError as e:
py.test.skip(str(e))
from pypy.tool.bench.htmlreport import (
PerfResult, PerfTable, PerfResultCollection,
PerfResultDelta, Page
)
# Sample performance data with a newline
testlines = """\
--date 1152625530.0 <EMAIL>-20060705122... |
underworld/systems/_timeintegration.py | longgangfan/underworld2 | 116 | 11001164 | ##~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~##
## ##
## This file forms part of the Underworld geophysics modelling application. ##
## ... |
common/src/stack/command/stack/commands/list/firmware/model/plugin_basic.py | kmcm0/stacki | 123 | 11001172 | <filename>common/src/stack/command/stack/commands/list/firmware/model/plugin_basic.py
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the ... |
misc/pytorch_toolkit/face_antispoofing/models/model_tools.py | dqawami/openvino_training_extensions | 256 | 11001196 | <reponame>dqawami/openvino_training_extensions<filename>misc/pytorch_toolkit/face_antispoofing/models/model_tools.py<gh_stars>100-1000
"""
Copyright (c) 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obt... |
tests/test_visitors/test_ast/test_statements/test_parameters_indentation/test_collection_indentation.py | cdhiraj40/wemake-python-styleguide | 1,931 | 11001218 | <filename>tests/test_visitors/test_ast/test_statements/test_parameters_indentation/test_collection_indentation.py
import pytest
from wemake_python_styleguide.visitors.ast.statements import (
ParametersIndentationViolation,
WrongParametersIndentationVisitor,
)
# Correct:
correct_single_line_tuple = 'xy = (1, ... |
nematus/metrics/meteor.py | Adityashar/Sanskrit-Machine-Translation | 572 | 11001252 | #!/usr/bin/env python
import sys
import subprocess, threading
# ModuleNotFoundError is new in 3.6; older versions will throw SystemError
if sys.version_info < (3, 6):
ModuleNotFoundError = SystemError
try:
from .scorer import Scorer
from .reference import Reference
except (ModuleNotFoundError, ImportErro... |
tests/unit/aiplatform/test_automl_text_training_jobs.py | sakagarwal/python-aiplatform | 180 | 11001258 | import pytest
import importlib
from unittest import mock
from google.cloud import aiplatform
from google.cloud.aiplatform import base
from google.cloud.aiplatform import datasets
from google.cloud.aiplatform import initializer
from google.cloud.aiplatform import models
from google.cloud.aiplatform import schema
from g... |
transformer_courses/BERT_distillation/PaddleSlim-develop/paddleslim/nas/search_space/base_layer.py | wwhio/awesome-DeepLearning | 1,150 | 11001260 | # Copyright (c) 2019 PaddlePaddle 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 applic... |
test/programytest/storage/stores/sql/store/test_preprocessors.py | cdoebler1/AIML2 | 345 | 11001267 | <reponame>cdoebler1/AIML2
import unittest
from unittest.mock import patch
import programytest.storage.engines as Engines
from programy.storage.stores.sql.config import SQLStorageConfiguration
from programy.storage.stores.sql.engine import SQLStorageEngine
from programy.storage.stores.sql.store.processors import SQLPreP... |
tests/test_config.py | Singularity0909/LeetCode_Helper | 162 | 11001282 | '''
@Author: KivenChen
@Date: 2019-04-22
@LastEditTime: 2019-04-30
'''
import unittest
import os
import sys
sys.path.append(os.path.abspath(os.path.join(__file__, "../..")))
from helper.config import Config
class TestConfig(unittest.TestCase):
def test_init(self):
pass
def test_getUsername(self):
... |
curator/exceptions.py | ssavrim/curator | 2,449 | 11001287 | <reponame>ssavrim/curator
"""Curator Exceptions"""
class CuratorException(Exception):
"""
Base class for all exceptions raised by Curator which are not Elasticsearch
exceptions.
"""
class ConfigurationError(CuratorException):
"""
Exception raised when a misconfiguration is detected
"""
cla... |
metric_learn/exceptions.py | Spraitazz/metric-learn | 547 | 11001296 | """
The :mod:`metric_learn.exceptions` module includes all custom warnings and
error classes used across metric-learn.
"""
from numpy.linalg import LinAlgError
class PreprocessorError(Exception):
def __init__(self, original_error):
err_msg = ("An error occurred when trying to use the "
"preproce... |
src/dataloader/pascal.py | imatge-upc/rsis | 132 | 11001338 | import errno
import hashlib
import os
import sys
import tarfile
import h5py
import torch.utils.data as data
import torch
import numpy as np
import random
from PIL import Image
import cv2
from transforms.transforms import RandomAffine
import time
from dataset import MyDataset
class PascalVOC(MyDataset):... |
numpy/typing/tests/data/pass/lib_utils.py | iam-abbas/numpy | 20,453 | 11001365 | <filename>numpy/typing/tests/data/pass/lib_utils.py
from __future__ import annotations
from io import StringIO
from typing import Any
import numpy as np
FILE = StringIO()
AR = np.arange(10, dtype=np.float64)
def func(a: int) -> bool: ...
np.deprecate(func)
np.deprecate()
np.deprecate_with_doc("test")
np.deprecate... |
fhirclient/models/communicationrequest_tests.py | carolinarsm/client-py | 418 | 11001373 | <filename>fhirclient/models/communicationrequest_tests.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import communicationrequest
from .fhirdate import FHIRDate... |
qcfractal/cli/qcfractal_manager.py | ahurta92/QCFractal | 113 | 11001380 | """
A command line interface to the qcfractal server.
"""
import argparse
import json
import logging
import os
import signal
from enum import Enum
from math import ceil
from typing import List, Optional, Union
import tornado.log
import yaml
from pydantic import Field, validator
import qcengine as qcng
import qcfract... |
tensorflow_lattice/python/linear_layer.py | sarvex/lattice-1 | 508 | 11001389 | # 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 law or agreed to in writing, ... |
theano/sandbox/cuda/GpuConvTransp3D.py | mdda/Theano | 295 | 11001410 | from __future__ import print_function
import numpy
import theano.tensor as T
from theano.misc import strutil
import theano
from six.moves import xrange
from theano.tensor.nnet.ConvTransp3D import ConvTransp3D
from theano.gof import local_optimizer
from theano.sandbox.cuda.basic_ops import as_cuda_ndarray_variable
fr... |
blender/addons/2.8/mira_tools/mi_wrap_master.py | belzecue/mifthtools | 730 | 11001427 | # ***** BEGIN GPL LICENSE BLOCK *****
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distribute... |
spruned/daemon/connectionpool_base_impl.py | darosior/spruned | 152 | 11001436 | <filename>spruned/daemon/connectionpool_base_impl.py
import abc
import asyncio
import random
import time
from typing import List
from spruned.application.logging_factory import Logger
from spruned.application.tools import check_internet_connection, async_delayed_task
from spruned.daemon import exceptions
from spruned.... |
setup.py | ets-labs/python-dependency-injector | 1,997 | 11001448 | <reponame>ets-labs/python-dependency-injector
"""`Dependency injector` setup script."""
import os
import re
from setuptools import setup, Extension
# Defining setup variables:
defined_macros = dict()
defined_macros['CYTHON_CLINE_IN_TRACEBACK'] = 0
# Getting description:
with open('README.rst') as readme_file:
... |
var/spack/repos/builtin/packages/r-formatr/package.py | kkauder/spack | 2,360 | 11001463 | # 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 RFormatr(RPackage):
"""Provides a function tidy_source() to format R source code. Spaces ... |
integration_tests/src/main/python/spark_session.py | rongou/spark-rapids | 415 | 11001495 | # Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# 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 agre... |
tools/mo/openvino/tools/mo/front/mxnet/expand_dims_ext.py | ryanloney/openvino-1 | 1,127 | 11001505 | <reponame>ryanloney/openvino-1
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.extractor import FrontExtractorOp
from openvino.tools.mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from openvino.tools.mo.ops.expand_dims import ExpandDims
cla... |
bot.py | daviddever/skybot | 114 | 11001509 | <reponame>daviddever/skybot
#!/usr/bin/env python3
from __future__ import print_function
import os
import queue
import sys
import traceback
import time
class Bot:
def __init__(self):
self.conns = {}
self.persist_dir = os.path.abspath("persist")
if not os.path.exists(self.persist_dir):
... |
mmpose/datasets/datasets/animal/animal_fly_dataset.py | nightfuryyy/mmpose | 1,775 | 11001520 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config
from ...builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.register_module()
class AnimalFlyDataset(Kpt2dSviewRgbImgTopDownDataset... |
dojo/tools/rusty_hog/parser.py | dant24/django-DefectDojo | 249 | 11001539 | <reponame>dant24/django-DefectDojo
import json
from dojo.tools.parser_test import ParserTest
from dojo.models import Finding
class RustyhogParser(object):
def get_scan_types(self):
return ["Rusty Hog Scan"]
def get_label_for_scan_types(self, scan_type):
return scan_type # no custom label fo... |
deeprobust/graph/global_attack/__init__.py | shixiongjing/DeepRobust | 647 | 11001544 | <gh_stars>100-1000
from .base_attack import BaseAttack
from .dice import DICE
from .mettack import MetaApprox, Metattack
from .random_attack import Random
from .topology_attack import MinMax, PGDAttack
from .node_embedding_attack import NodeEmbeddingAttack, OtherNodeEmbeddingAttack
from .nipa import NIPA
__all__ = ['B... |
towhee/hub/repo_manager.py | junjiejiangjjj/towhee | 365 | 11001546 | <reponame>junjiejiangjjj/towhee<gh_stars>100-1000
# Copyright 2021 Zilliz. 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-... |
actorlib/storage.py | zuzhi/rssant | 1,176 | 11001553 | <reponame>zuzhi/rssant<filename>actorlib/storage.py
import logging
import os.path
import time
from collections import namedtuple
import msgpack
from .message import ActorMessage
from .state import ActorState, ActorStateError
LOG = logging.getLogger(__name__)
CompactPrepareInfo = namedtuple('CompactPrepareInfo', '... |
tests/t-alias.py | kurtace72/lighttpd2 | 395 | 11001562 | <filename>tests/t-alias.py
# -*- coding: utf-8 -*-
from base import *
from requests import *
class TestAlias1(CurlRequest):
URL = "/alias1"
EXPECT_RESPONSE_BODY = TEST_TXT
EXPECT_RESPONSE_CODE = 200
EXPECT_RESPONSE_HEADERS = [("Content-Type", "text/plain; charset=utf-8")]
config = """
alias "/alias1" => var.defa... |
jdBuyMask/jdEmail.py | yijianduanlang/n95-py | 357 | 11001564 | # -*- coding=utf-8 -*-
'''
发送邮件模块
'''
import traceback
def sendMail(mail, msgtext):
try:
import smtplib
from email.mime.text import MIMEText
# email 用于构建邮件内容
from email.header import Header
# 用于构建邮件头
# 发信方的信息:发信邮箱,QQ 邮箱授权码
from_addr = '<EMAIL>'
pass... |
Autocoders/Python/src/fprime_ac/generators/DictStart.py | SSteve/fprime | 9,182 | 11001571 | # ===============================================================================
# NAME: DictStart
#
# DESCRIPTION: The DictStart class is the main entry point
# for generation of end of file code.
#
# USAGE: Nominally the DictStart.__call__ is called by using the
# instance name. The instan... |
openrasp_iast/core/components/communicator.py | G3G4X5X6/openrasp-iast | 380 | 11001579 | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
Copyright 2017-2020 Baidu 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... |
courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/favsql/extra/views.py | Nahid-Hassan/fullstack-software-development | 297 | 11001615 | from favs.models import Thing, Fav
from django.views import View
from django.views import generic
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import Exists, OuterRef
# These are experiment... |
cockpit/instruments/max_ev_gauge.py | wx-b/cockpit | 367 | 11001679 | """Max EV Gauge."""
import warnings
from matplotlib import ticker
from cockpit.instruments.utils_instruments import check_data, create_basic_plot
def max_ev_gauge(self, fig, gridspec):
"""Showing the largest eigenvalue of the Hessian versus iteration.
The largest eigenvalue of the Hessian indicates the lo... |
src/git/from_keywords.py | jmartens/python-versioneer | 204 | 11001698 | <gh_stars>100-1000
import re # --STRIP DURING BUILD
def register_vcs_handler(*args): # --STRIP DURING BUILD
def nil(f): # --STRIP DURING BUILD
return f # --STRIP DURING BUILD
return nil # --STRIP DURING BUILD
class NotThisMethod(Exception): pass # --STRIP DURING BUILD
@register_vcs_handler("git", "get_... |
OmniMarkupLib/Renderers/libs/python2/docutils/writers/s5_html/__init__.py | henumohe/OmniMarkupPreviewer | 476 | 11001704 | # $Id$
# Authors: <NAME> <<EMAIL>>;
# <NAME> <<EMAIL>>
# Copyright: This module has been placed in the public domain.
"""
S5/HTML Slideshow Writer.
"""
__docformat__ = 'reStructuredText'
import sys
import os
import re
import docutils
from docutils import frontend, nodes, utils
from docutils.writers import ... |
jupyter_resource_usage/tests/test_basic.py | aidy1991/jupyter-resource-usage | 114 | 11001726 | from mock import MagicMock
from mock import patch
class TestBasic:
"""Some basic tests, checking import, making sure APIs remain consistent, etc"""
def test_import_serverextension(self):
"""Check that serverextension hooks are available"""
from jupyter_resource_usage import (
_jup... |
modelzoo/DIEN/data/script/history_behavior_list.py | aalbersk/DeepRec | 292 | 11001742 | item_to_cate_map = {}
with open('item2catmap.txt', 'r') as f:
for line in f:
linelist = line.strip().split('\t')
item = linelist[0]
cate = linelist[1]
item_to_cate_map[item] = cate
user_history_behavior = {}
with open('reviews-info', 'r') as f:
for line in f:
linelist = ... |
opy/_regtest/src/core/tdop.py | Schweinepriester/oil | 2,209 | 11001759 | <reponame>Schweinepriester/oil
#!/usr/bin/env python
"""
tdop.py - Library for expression parsing.
"""
from osh.meta import Id
from core import word
from core import util
from osh.meta import ast, types
p_die = util.p_die
arith_expr_e = ast.arith_expr_e
word_e = ast.word_e
lex_mode_e = types.lex_mode_e
def Assert... |
python/test/visualization/test_tensorboard_plugin.py | gyes00205/Open3D | 1,455 | 11001765 | <gh_stars>1000+
# ----------------------------------------------------------------------------
# - Open3D: www.open3d.org -
# ----------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2018-2021 www.open3d.org
... |
env/lib/python3.8/site-packages/plotly/validators/layout/ternary/aaxis/_title.py | acrucetta/Chicago_COVI_WebApp | 11,750 | 11001790 | import _plotly_utils.basevalidators
class TitleValidator(_plotly_utils.basevalidators.TitleValidator):
def __init__(
self, plotly_name="title", parent_name="layout.ternary.aaxis", **kwargs
):
super(TitleValidator, self).__init__(
plotly_name=plotly_name,
parent_name=par... |
src/sage/categories/magmatic_algebras.py | UCD4IDS/sage | 1,742 | 11001794 | <filename>src/sage/categories/magmatic_algebras.py
r"""
Non-unital non-associative algebras
"""
# ****************************************************************************
# Copyright (C) 2011 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public License (GPL)
# ... |
tools/hub-sync.py | cakiki/bigscience | 189 | 11001811 | #!/usr/bin/env python
#
# This tool automatically pushes newly added and modified files into the hub repo, if they match the
# provided one or more patterns.
#
# If the program fails to run the first time make sure to run `hub-auth.py` to authenticate and save
# the token, and user name/email locally which will then b... |
newsplease/pipeline/extractor/article_extractor.py | freedmand/news-please | 1,311 | 11001845 | <filename>newsplease/pipeline/extractor/article_extractor.py
import importlib
import inspect
import logging
from .cleaner import Cleaner
from .comparer.comparer import Comparer
from .extractors.abstract_extractor import AbstractExtractor
class Extractor:
"""This class initializes all extractors and saves the res... |
src/actions/boilerplate/sample_web_form/__init__.py | anderson-attilio/runbook | 155 | 11001856 | <reponame>anderson-attilio/runbook<gh_stars>100-1000
# save this file/folder to /src/web/reactionforms/some-reaction
######################################################################
# Cloud Routes Web Application
# -------------------------------------------------------------------
# Reaction - Forms Class
####... |
twine/utils.py | CyrilRoelandteNovance/twine | 1,225 | 11001860 | # Copyright 2013 <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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... |
build/config/mac/mac_app.py | akbiggs/buildroot | 108 | 11001863 | <reponame>akbiggs/buildroot<gh_stars>100-1000
#!/usr/bin/env python3
#
# Copyright (c) 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.
import argparse
import os
import errno
import subprocess
import sys
PLUTIL = [
... |
pymdp/envs/grid_worlds.py | Arun-Niranjan/pymdp | 108 | 11001881 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Cube world environment
__author__: <NAME>, <NAME>, <NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from pymdp.envs import Env
class GridWorldEnv(Env):
""" Basic grid-world implementation """
UP = 0
... |
contrib/data_safety_training/image_classification/server/receiver.py | barrierye/PaddleFL | 379 | 11001930 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
lib/python2.7/site-packages/sklearn/semi_supervised/label_propagation.py | wfehrnstrom/harmonize | 6,989 | 11001946 | # coding=utf8
"""
Label propagation in the context of this module refers to a set of
semisupervised classification algorithms. In the high level, these algorithms
work by forming a fully-connected graph between all points given and solving
for the steady-state distribution of labels at each point.
These algorithms per... |
.venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py | acrucetta/Chicago_COVI_WebApp | 115 | 11001955 | <filename>.venv/lib/python3.8/site-packages/pandas/core/tools/datetimes.py
from collections import abc
from datetime import datetime
from functools import partial
from itertools import islice
from typing import (
TYPE_CHECKING,
Callable,
List,
Optional,
Tuple,
TypeVar,
Union,
overload,
)... |
boot/rpi/tools/binman/elf.py | yodaos-project/yodaos | 1,144 | 11001967 | # SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2016 Google, Inc
# Written by <NAME> <<EMAIL>>
#
# Handle various things related to ELF images
#
from collections import namedtuple, OrderedDict
import command
import os
import re
import struct
import tools
# This is enabled from control.py
debug = False
Symbol = ... |
attributes/continuous_integration/main.py | Lufedi/reaper | 106 | 11001980 | <reponame>Lufedi/reaper<gh_stars>100-1000
import os
import sys
from attributes.continuous_integration.discoverer import CiDiscoverer
ci_discoverer = CiDiscoverer()
def run(project_id, repo_path, cursor, **options):
result = ci_discoverer.discover(repo_path)
return (int(result), result)
if __name__ == '__m... |
data/challenges/boxes/Miscellaneous/BroBot/deployment/bot.py | mister-hai/meeplabben | 114 | 11001993 | from telegram.ext import (
Updater,
MessageHandler,
Filters,
CommandHandler,
ConversationHandler,
)
import os
def unknown(update, context):
update.message.reply_text("Sorry, I don't understand that. Try something else!")
def invalid(update, context):
update.message.reply_text("Invalid!")... |
samples/openapi3/client/petstore/python/tests_manual/test_issue10155.py | JigarJoshi/openapi-generator | 11,868 | 11002046 | # coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... |
glasses/warp.py | rickyHong/spatial-transformer-GAN-repl | 344 | 11002058 | <gh_stars>100-1000
import numpy as np
import scipy.linalg
import tensorflow as tf
# fit (affine) warp between two sets of points
def fit(Xsrc,Xdst):
ptsN = len(Xsrc)
X,Y,U,V,O,I = Xsrc[:,0],Xsrc[:,1],Xdst[:,0],Xdst[:,1],np.zeros([ptsN]),np.ones([ptsN])
A = np.concatenate((np.stack([X,Y,I,O,O,O],axis=1),
np.s... |
platform/polycommon/tests/test_events/test_event_service.py | admariner/polyaxon | 3,200 | 11002105 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
cumulusci/tasks/github/pull_request.py | jdominiczak/CumulusCI | 163 | 11002120 | from cumulusci.tasks.github.base import BaseGithubTask
class PullRequests(BaseGithubTask):
def _run_task(self):
repo = self.get_repo()
for pr in repo.pull_requests(state="open"):
self.logger.info("#{}: {}".format(pr.number, pr.title))
|
example/src/canny/canny.py | Cyper77/cvui | 741 | 11002125 | #
# This demo showcases some components of cvui being used to control
# the application of the Canny edge algorithm to a loaded image.
#
# Copyright (c) 2018 <NAME> <<EMAIL>>
# Licensed under the MIT license.
#
import numpy as np
import cv2
import cvui
WINDOW_NAME = 'CVUI Canny Edge'
def main():
lena = cv2.imread('... |
tests/estimator/classifier/RandomForestClassifier/RandomForestClassifierJavaTest.py | midhunexeter/sklearn-porter | 1,197 | 11002127 | # -*- coding: utf-8 -*-
from unittest import TestCase
from sklearn.ensemble import RandomForestClassifier
from tests.estimator.classifier.Classifier import Classifier
from tests.estimator.classifier.ExportedData import ExportedData
from tests.language.Java import Java
class RandomForestClassifierJavaTest(Java, Cla... |
tjctf2020/seashells/exploit.py | nhtri2003gmail/ctf-write-ups | 101 | 11002134 | #!/usr/bin/python3
from pwn import *
#p = process('./seashells')
p = remote('p1.tjctf.org', 8009)
context.clear(arch='amd64')
binary = ELF('./seashells')
shell = binary.symbols['shell']
rop = ROP('seashells')
try:
pop_rdi = rop.find_gadget(['pop rdi','ret'])[0]
except:
print("no ROP for you!")
sys.exit(1)
payl... |
tools/app_reg/common.py | yetsun/hue | 5,079 | 11002142 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
dizoo/mujoco/config/halfcheetah_ppo_default_config.py | LuciusMos/DI-engine | 464 | 11002145 | from easydict import EasyDict
HalfCheetah_ppo_default_config = dict(
exp_name='HalfCheetah_onppo',
env=dict(
manager=dict(shared_memory=True, force_reproducibility=True),
env_id='HalfCheetah-v3',
norm_obs=dict(use_norm=False, ),
norm_reward=dict(use_norm=False, ),
collec... |
tianshou/policy/modelfree/discrete_sac.py | allegro/tianshou | 4,714 | 11002151 | from typing import Any, Dict, Optional, Tuple, Union
import numpy as np
import torch
from torch.distributions import Categorical
from tianshou.data import Batch, ReplayBuffer, to_torch
from tianshou.policy import SACPolicy
class DiscreteSACPolicy(SACPolicy):
"""Implementation of SAC for Discrete Action Settings... |
locations/spiders/golden_corral.py | davidchiles/alltheplaces | 297 | 11002168 | import json
import scrapy
from locations.hours import OpeningHours
from locations.items import GeojsonPointItem
from urllib.parse import urljoin, urlparse
DAY_MAPPING = {
'Sunday': 'Su',
'Monday': 'Mo',
'Tuesday': 'Tu',
'Wednesday': 'We',
'Thursday': 'Th',
'Friday': 'Fr',
'Saturday': 'Sa',... |
TrackingTools/TrajectoryCleaning/python/TrajectoryCleanerBySharedHits_cfi.py | ckamtsikis/cmssw | 852 | 11002187 | import FWCore.ParameterSet.Config as cms
trajectoryCleanerBySharedHits = cms.ESProducer("TrajectoryCleanerESProducer",
ComponentName = cms.string('TrajectoryCleanerBySharedHits'),
ComponentType = cms.string('TrajectoryCleanerBySharedHits'),
fractionShared = cms.double(0.19),
ValidHitBonus = cms.double(... |
Lib/test/test_urllib2_localnet.py | msys2-arm/cpython-mingw | 953 | 11002196 | <filename>Lib/test/test_urllib2_localnet.py
import base64
import os
import email
import urllib.parse
import urllib.request
import http.server
import threading
import unittest
import hashlib
from test import support
from test.support import hashlib_helper
try:
import ssl
except ImportError:
ssl = None
here = ... |
components/test/data/autofill/automated_integration/autofill_test/case.py | zealoussnow/chromium | 14,668 | 11002209 | # Copyright 2016 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 sys
import unittest
from selenium.common.exceptions import TimeoutException
# Local Imports
from autofill_task.exceptions import ExpectationFailure
... |
docs/examples/compute/profitbricks/create_node.py | zimventures/libcloud | 1,435 | 11002212 | <reponame>zimventures/libcloud
import os
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
from libcloud.compute.base import NodeAuthSSHKey
cls = get_driver(Provider.PROFIT_BRICKS)
# Get ProfitBricks credentials from environment variables
pb_username = os.environ.get('PROF... |
nn_meter/ir_converters/frozenpb_converter/__init__.py | kaleid-liner/nn-Meter | 164 | 11002248 | <reponame>kaleid-liner/nn-Meter
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from .frozenpb_converter import FrozenPbConverter
|
data/io/BDD100K/BDD2VOC.py | rickyHong/NAS_FPN_repl | 224 | 11002253 | <filename>data/io/BDD100K/BDD2VOC.py
import json
import os
import cv2
from xml.dom.minidom import Document
import xml.dom.minidom
label_map = {'bus': 1, 'traffic light': 2, 'traffic sign': 3, 'person': 4, 'bike': 5,
'truck': 6, 'motor': 7, 'car': 8, 'train': 9, 'rider': 10}
FLAG = ['train', 'val']
def w... |
ArticutAPI/Toolkit/localRE.py | Joshua0128/ArticutAPI | 375 | 11002262 | <filename>ArticutAPI/Toolkit/localRE.py
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import re
class TaiwanAddressAnalizer:
def __init__(self, locale=None):
if locale in ("TW", "CN"):
pass
else:
locale="TW"
self.addTWPat = re.compile("(?<=<KNOWLEDGE_addTW>)[^<]*?(?... |
MagTag_Dishwasher_Status/wake_on_flip/code.py | mc-mc/Adafruit_Learning_System_Guides | 665 | 11002285 | <reponame>mc-mc/Adafruit_Learning_System_Guides<filename>MagTag_Dishwasher_Status/wake_on_flip/code.py<gh_stars>100-1000
import time
import board
import alarm
import displayio
import adafruit_lis3dh
# get the display
epd = board.DISPLAY
# set up accelerometer
lis = adafruit_lis3dh.LIS3DH_I2C(board.I2C(), address=0x19... |
cirq-core/cirq/contrib/acquaintance/strategies/cubic.py | Saibaba-Alapati/Cirq | 3,326 | 11002318 | # Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
test/run_pyflakes_src.py | tanvimoharir/python-versioneer | 204 | 11002322 | import os
from pyflakes.api import main
def get_filenames():
for dirpath, dirnames, filenames in os.walk("src"):
if dirpath.endswith("__pycache__"):
continue
for rel_fn in filenames:
if not rel_fn.endswith(".py"):
continue
fn = os.path.join(dirpat... |
guests/management/commands/send_save_the_dates.py | EnderGed/django-wedding-website | 384 | 11002332 | <reponame>EnderGed/django-wedding-website<filename>guests/management/commands/send_save_the_dates.py<gh_stars>100-1000
from django.core.management import BaseCommand
from guests.save_the_date import send_all_save_the_dates, clear_all_save_the_dates
class Command(BaseCommand):
def add_arguments(self, parser):
... |
Lib/test/test_tools/test_gprof2html.py | oleksandr-pavlyk/cpython | 52,316 | 11002352 | <reponame>oleksandr-pavlyk/cpython
"""Tests for the gprof2html script in the Tools directory."""
import os
import sys
import unittest
from unittest import mock
import tempfile
from test.test_tools import skip_if_missing, import_tool
skip_if_missing()
class Gprof2htmlTests(unittest.TestCase):
def setUp(self):
... |
pygimli/testing/test_IO_PLC.py | baender/gimli | 224 | 11002357 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
import pygimli as pg
import numpy as np
class TestPLCIO(unittest.TestCase):
def test_io_triangle(self):
"""
"""
# create tempfile in most secure manner, only accesible by this process
# id no execution allo... |
command_helper/completions.py | idxn/sublime-robot-framework-assistant | 103 | 11002358 | <reponame>idxn/sublime-robot-framework-assistant<gh_stars>100-1000
import re
import difflib
from json import load as json_load
try:
from db_json_settings import DBJsonSetting
from utils.get_text import get_prefix
except:
from ..setting.db_json_settings import DBJsonSetting
from ..command_helper.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.