max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
python/src/mapreduce/api/map_job/abstract_datastore_input_reader.py | Batterii/appengine-mapreduce | 228 | 3223491 | #!/usr/bin/env python
# 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 ... | 0 | 9 | 10 | 0 | 19 | 0 |
recipes/Python/577045_Bible_Verse_Quiz__timeoutpy/recipe-577045.py | tdiprima/code | 2,023 | 3223501 | #! /usr/bin/env python
"""Provide way to add timeout specifications to arbitrary functions.
There are many ways to add a timeout to a function, but no solution
is both cross-platform and capable of terminating the procedure. This
module use the multiprocessing module to solve both of those problems."""
##############... | 1 | 4 | 0 | 0 | 5 | 0 |
gratipay/models/community.py | kant/gratipay.com | 517 | 3223505 | <filename>gratipay/models/community.py<gh_stars>100-1000
import re
from postgres.orm import Model
name_pattern = re.compile(r'^[A-Za-z0-9,._ -]+$')
def slugize(slug):
"""Convert a string to a string for an URL.
"""
assert name_pattern.match(slug) is not None
slug = slug.lower()
for c in (' ', ',... | 0 | 0 | 0 | 0 | 0 | 0 |
octis/models/HDP.py | lei-liu1/OCTIS | 340 | 3223515 | from __future__ import annotations
from octis.models.model import AbstractModel
import numpy as np
from gensim.models import hdpmodel
import gensim.corpora as corpora
import octis.configuration.citations as citations
import octis.configuration.defaults as defaults
class HDP(AbstractModel):
id2word: None = None
... | 15 | 5 | 4 | 0 | 24 | 0 |
examples/other/dolfin/ft09_reaction_system.py | hadivafaii/vedo | 836 | 3223543 | <filename>examples/other/dolfin/ft09_reaction_system.py
"""Convection-diffusion-reaction for a system
describing the concentration of three species A, B, C undergoing a simple
first-order reaction A + B --> C with first-order decay of C.
The velocity
is given by the flow field w from the demo navier_stokes_cylinder.py.... | 0 | 0 | 0 | 0 | 0 | 0 |
pybamm/input/parameters/lithium_ion/electrolytes/lipf6_Ramadass2004/electrolyte_conductivity_Ramadass2004.py | manjunathnilugal/PyBaMM | 330 | 3223544 | from pybamm import exp, constants
def electrolyte_conductivity_Ramadass2004(c_e, T) -> object:
"""
Conductivity of LiPF6 in EC:DMC as a function of ion concentration.
Concentration should be in dm3 in the function.
References
----------
.. [1] <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. "Deve... | 0 | 1 | 0 | 0 | 1 | 0 |
crypto/frank/src/handler.py | cclauss/fbctf-2019-challenges | 213 | 3223579 | <reponame>cclauss/fbctf-2019-challenges
#!/usr/bin/env python3
import logging
import re
import signal
import socket
import socketserver
import sys
import threading
import time
from contextlib import contextmanager
from functools import partial
import bots
import server
class RequestHandler(socketserver.StreamReque... | 0 | 0 | 0 | 0 | 0 | 0 |
flan/utils_test.py | purn3ndu/FLAN | 206 | 3223582 | # Copyright 2021 The FLAN 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 applicable law or agreed to in wri... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/swift_build_support/tests/test_shell.py | lwhsu/swift | 72,551 | 3223588 | <filename>utils/swift_build_support/tests/test_shell.py
# tests/test_shell.py -------------------------------------------*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtim... | 0 | 0 | 0 | 0 | 0 | 0 |
Game22/modules/__init__.py | ttkaixin1998/pikachupythongames | 4,013 | 3223611 | <filename>Game22/modules/__init__.py
'''初始化'''
from .ai import *
from .misc import *
from .online import * | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_process.py | brunobg/spaczz | 153 | 3223618 | <filename>tests/test_process.py
"""Tests for process module."""
import pytest
from spaczz.process import FuzzyFuncs
def test_fuzzyfuncs_raises_value_error_w_unkown_match_type() -> None:
"""The searcher with lower-cased text is working as intended."""
with pytest.raises(ValueError):
FuzzyFuncs(match_t... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | Teino1978-Corp/cloudtools-ssh-ca | 199 | 3223638 | <reponame>Teino1978-Corp/cloudtools-ssh-ca
import glob
from setuptools import setup
setup(
name='ssh-ca',
version='0.3.2',
description="SSH CA utilities",
author="<NAME>",
author_email="<EMAIL>",
maintainer="<NAME>",
maintainer_email="<EMAIL>",
url="https://github.com/cloudtools/ssh-ca"... | 0 | 0 | 0 | 0 | 0 | 0 |
pgl/distributed/dist_graph.py | WenjinW/PGL | 1,389 | 3223663 | <filename>pgl/distributed/dist_graph.py<gh_stars>1000+
# 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.apach... | 0 | 0 | 0 | 0 | 0 | 0 |
projects/safety_bench/run_unit_tests.py | twstewart42/ParlAI | 9,228 | 3223675 | <filename>projects/safety_bench/run_unit_tests.py<gh_stars>1000+
#!/usr/bin/env python3
# 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.
"""
Run all safety unit tests for a model.
For example,... | 0 | 0 | 0 | 0 | 0 | 0 |
care/facility/reports/admin_reports.py | gigincg/care | 189 | 3223679 | import enum
import time
from datetime import timedelta
from uuid import uuid4
import boto3
from celery.decorators import periodic_task
from celery.schedules import crontab
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.mail import EmailMessage
from django.templa... | 0 | 13 | 7 | 2 | 22 | 0 |
CV/SemSegPaddle/src/models/modeling/deeplabv3.py | pkulzb/Research | 1,319 | 3223682 | from __future__ import annotations
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import paddle
import paddle.fluid as fluid
from src.utils.config import cfg
from src.models.libs.model_libs import scope, name_scope
from src.models.libs.mode... | 0 | 6 | 0 | 0 | 6 | 0 |
src/genie/libs/parser/ios/tests/ShowVersion/cli/equal/golden_output_ios_2_expected.py | balmasea/genieparser | 204 | 3223698 | <filename>src/genie/libs/parser/ios/tests/ShowVersion/cli/equal/golden_output_ios_2_expected.py
expected_output = {
"version": {
"chassis": "WS-C4507R",
"chassis_sn": "FOX093206HY",
"compiled_by": "someone",
"compiled_date": "Wed 07-Sep-05 11:16",
"curr_config_register": "0x2... | 0 | 0 | 0 | 0 | 0 | 0 |
Tools/c-analyzer/c-analyzer.py | pxeger/cpython | 52,316 | 3223705 | <reponame>pxeger/cpython
from cpython.__main__ import parse_args, main, configure_logger
cmd, cmd_kwargs, verbosity, traceback_cm = parse_args()
configure_logger(verbosity)
with traceback_cm:
main(cmd, cmd_kwargs)
| 0 | 0 | 0 | 0 | 0 | 0 |
nova/pci/devspec.py | zjzh/nova | 1,874 | 3223717 | <filename>nova/pci/devspec.py<gh_stars>1000+
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
openmdao/test_suite/tests/test_paraboloid_feature.py | friedenhe/OpenMDAO | 451 | 3223729 | """Test the Paraboloid systems used in the basic User Guide. """
import unittest
import openmdao.api as om
from openmdao.utils.assert_utils import assert_near_equal
from openmdao.test_suite.components.paraboloid_feature import Paraboloid
class TestSellarFeature(unittest.TestCase):
def test_paraboloid_feature(s... | 0 | 0 | 0 | 0 | 0 | 0 |
minimal_model/python_predict_client/predict_client.py | yanhuangpai/deep_recommend_system | 1,131 | 3223735 | <gh_stars>1000+
#!/usr/bin/env python
import numpy
from grpc.beta import implementations
import tensorflow as tf
import predict_pb2
import prediction_service_pb2
tf.app.flags.DEFINE_string("host", "127.0.0.1", "gRPC server host")
tf.app.flags.DEFINE_integer("port", 9000, "gRPC server port")
tf.app.flags.DEFINE_stri... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test.py | thomasbach-dev/nix-direnv | 465 | 3223739 | #!/usr/bin/env python2
from tempfile import TemporaryDirectory
import os
import sys
import subprocess
from pathlib import Path
import shutil
import unittest
from typing import List
TEST_ROOT = Path(__file__).resolve().parent
def run(cmd: List[str], **kwargs) -> subprocess.CompletedProcess:
print("$ " + " ".joi... | 1 | 11 | 15 | 0 | 27 | 0 |
setup.py | iskunk/Prosodylab-Aligner | 276 | 3223761 | from setuptools import setup
setup(name="Prosodylab-Aligner",
version="2.0",
description="Forced alignment with HTK",
author="<NAME>",
author_email="<EMAIL>",
url="http://github.com/kylebgorman/Prosodylab-Aligner/",
install_requires=["PyYAML >= 3.11",
"scipy... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_octodns_provider_googlecloud.py | slandry90/octodns | 1,865 | 3223768 | #
#
#
from __future__ import absolute_import, division, print_function, \
unicode_literals
from unittest import TestCase
class TestGoogleCloudShim(TestCase):
def test_missing(self):
with self.assertRaises(ModuleNotFoundError):
from octodns.provider.googlecloud import GoogleCloudProvider... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/zenko_tests/python_tests/zenko_e2e/cosmos/test_cosmos_deployment.py | zarumaru/Zenko | 453 | 3223771 | from __future__ import annotations
import logging
import time
import pytest
import zenko_e2e.conf as conf
from kubernetes import client, config
from kubernetes.client.rest import ApiException
from ..fixtures import *
from .. import util
_log = logging.getLogger('cosmos') # pylint: disable=invalid-name
MD5_HASHES = {... | 1 | 7 | 0 | 0 | 8 | 0 |
demo/examples/sum.summa/src/setup.py | YourNorth/rezak-summarizator | 1,177 | 3223783 | from setuptools import setup, find_packages
setup(
name = 'summa',
packages = find_packages(exclude=['test']),
package_data = {
'summa': ['README', 'LICENSE']
},
version = '1.2.0',
description = 'A text summarization and keyword extraction package based on TextRank',
long_descriptio... | 0 | 0 | 0 | 0 | 0 | 0 |
supportedBackends/google/pipelines/v2beta/src/main/resources/cromwell-monitor/monitor.py | ljyanesm/cromwell | 850 | 3223811 | #!/usr/bin/env python
from functools import reduce
from google.cloud.monitoring_v3 import MetricServiceClient
from google.cloud.monitoring_v3.types import LabelDescriptor, MetricDescriptor, TimeSeries
from os import environ
import psutil as ps
import requests
from signal import signal, SIGTERM
from sys import stderr
f... | 0 | 7 | 0 | 0 | 7 | 0 |
diagrams/alibabacloud/compute.py | Shimpei-GANGAN/diagrams | 17,037 | 3223825 | # This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _AlibabaCloud
class _Compute(_AlibabaCloud):
_type: str = "compute"
_icon_dir: str = "resources/alibabacloud/compute"
class AutoScaling(_Compute):
_icon: str = "auto-scaling.png"
class BatchCompute(_Compute):
_icon... | 0 | 0 | 17 | 0 | 17 | 0 |
third_party/phkit/phkit/chinese/symbol.py | zh794390558/DeepSpeech | 113 | 3223855 | <gh_stars>100-1000
#!usr/bin/env python
# -*- coding: utf-8 -*-
# author: kuangdd
# date: 2020/2/16
"""
#### symbol
音素标记。
中文音素,简单英文音素,简单中文音素。
"""
_pad = '_' # 填充符
_eos = '~' # 结束符
_chain = '-' # 连接符,连接读音单位
_oov = '*'
# 中文音素表
# 声母:27
_shengmu = [
'aa', 'b', 'c', 'ch', 'd', 'ee', 'f', 'g', 'h', 'ii', 'j', 'k', '... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/fixtures/config_teamocil/test3.py | otherJL0/tmuxp | 1,615 | 3223868 | <reponame>otherJL0/tmuxp
from .. import utils as test_utils
teamocil_yaml = test_utils.read_config_file("config_teamocil/test3.yaml")
teamocil_dict = {
"windows": [
{
"name": "my-first-window",
"root": "~/Projects/foo-www",
"layout": "even-vertical",
"filter... | 0 | 0 | 0 | 0 | 0 | 0 |
twistedcaldav/test/test_customxml.py | backwardn/ccs-calendarserver | 462 | 3223894 | <reponame>backwardn/ccs-calendarserver
##
# Copyright (c) 2011-2017 Apple 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-... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_chi_ssa_61.py | MAYANK25402/city-scrapers | 255 | 3223905 | <reponame>MAYANK25402/city-scrapers
from datetime import datetime
from os.path import dirname, join
import pytest # noqa
from city_scrapers_core.constants import COMMISSION
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_ssa_61 import ChiSsa61Spider... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/pyspec/eth2spec/test/altair/transition/test_activations_and_exits.py | sifraitech/eth2.0-specs | 497 | 3223912 | import random
from eth2spec.test.context import (
ForkMeta,
ALTAIR,
with_presets,
with_fork_metas,
)
from eth2spec.test.helpers.constants import (
ALL_PRE_POST_FORKS,
MINIMAL,
)
from eth2spec.test.helpers.fork_transition import (
do_fork,
transition_until_fork,
transition_to_next_epo... | 0 | 0 | 0 | 0 | 0 | 0 |
src/compas/geometry/_core/quaternions.py | XingxinHE/compas | 235 | 3223928 | """
This module contains functions that operate on and/or return quaternions.
Notes
-----
The default convention to represent a quaternion :math:`q` in this module is by four real values **w**, **x**, **y**, **z**.
The first value **w** is the scalar (real) part, and **x**, **y**, **z** form the vector (complex, imagi... | 0 | 6 | 0 | 0 | 6 | 0 |
src/operation/__init__.py | piwaniuk/critic | 216 | 3223965 | # -*- mode: python; encoding: utf-8 -*-
#
# Copyright 2012 <NAME>, Opera Software ASA
#
# 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
#
# Unl... | 1 | 2 | 0 | 0 | 3 | 0 |
lithops/worker/__init__.py | kpavel/lithops | 158 | 3223970 | from .handler import function_handler
from .invoker import function_invoker
| 0 | 0 | 0 | 0 | 0 | 0 |
plugins/oschina.py | messense/wechat-bot | 115 | 3223997 | <gh_stars>100-1000
#coding=utf-8
import requests
from xml.etree import ElementTree
from tornado.util import ObjectDict
__name__ = 'oschina'
def test(data, msg=None, bot=None):
if ('oschina' in data or '开源中国' in data) and '最新' in data and '新闻' in data:
return True
return False
def respond(data, msg=N... | 0 | 0 | 0 | 0 | 0 | 0 |
pycorrector/deepcontext/preprocess.py | joey12300/pycorrector | 3,153 | 3224034 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description:
"""
import os
import sys
from xml.dom import minidom
sys.path.append('../..')
from pycorrector.utils.tokenizer import segment
from pycorrector.deepcontext import config
def parse_xml_file(path, use_segment, segment_type):
print('P... | 0 | 0 | 0 | 0 | 0 | 0 |
plugins/PY/pinpointPy/Flask/FlaskPlugins.py | naver/pinpoint-c-agent | 178 | 3224039 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# ------------------------------------------------------------------------------
# Copyright 2020. NAVER Corp. -
# -
# Licensed... | 0 | 0 | 0 | 0 | 0 | 0 |
commandment/alembics/versions/6675e981817e_create_available_os_updates_table.py | pythonModule/commandment | 138 | 3224047 | <filename>commandment/alembics/versions/6675e981817e_create_available_os_updates_table.py
"""create available_os_updates table
Revision ID: 6675e981817e
Revises: <PASSWORD>
Create Date: 2017-06-23 17:40:11.879267
"""
from alembic import op, context
import sqlalchemy as sa
import commandment.dbtypes
# revision identi... | 0 | 0 | 0 | 0 | 0 | 0 |
cleo/commands/list_command.py | Ivoz/cleo | 859 | 3224061 | from cleo.io.inputs.argument import Argument
from .command import Command
class ListCommand(Command):
name: str = "list"
description: str = "Lists commands."
help: str = """\
The <info>{command_name}</info> command lists all commands:
<info>{command_full_name}</info>
You can also display the comma... | 0 | 1 | 4 | 0 | 5 | 0 |
prml/nn/array/ones.py | jinmang2/PRML | 11,017 | 3224073 | from prml.nn.array.array import Array
from prml.nn.config import config
import numpy as np
def ones(size) -> object:
return Array(np.ones(size, dtype=config.dtype))
| 0 | 1 | 0 | 0 | 1 | 0 |
rx/core/operators/asobservable.py | mmpio/RxPY | 4,342 | 3224086 | from __future__ import annotations
from typing import Callable
from rx.core import Observable
def _as_observable() -> Callable[[Observable], Observable]:
def as_observable(source: Observable) -> Observable:
"""Hides the identity of an observable sequence.
Args:
source: Observable sour... | 2 | 3 | 0 | 0 | 5 | 0 |
dnsdb_common/dal/models/view_acl_subnets.py | baiyongjie/open_dnsdb | 378 | 3224174 | <filename>dnsdb_common/dal/models/view_acl_subnets.py
# -*- coding: utf-8 -*-
from . import AuditTimeMixin, JsonMixin
from .. import db
class ViewAclSubnet(db.Model, AuditTimeMixin, JsonMixin):
__tablename__ = 'tb_view_acl_subnets'
id = db.Column(db.Integer, primary_key=True)
subnet = db.Column(db.String... | 0 | 0 | 0 | 0 | 0 | 0 |
bootstrapvz/providers/kvm/tasks/boot.py | zeridon/bootstrap-vz | 207 | 3224199 | <reponame>zeridon/bootstrap-vz
from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import grub
from bootstrapvz.common.tools import rel_path
assets = rel_path(__file__, '../assets')
class SetGrubConsolOutputDeviceToVirtual(Task):
description = 'Setting the init p... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/rpc/trace.py | michalwy/spdk | 2,107 | 3224205 | <filename>scripts/rpc/trace.py<gh_stars>1000+
from .helpers import deprecated_alias
@deprecated_alias('enable_tpoint_group')
def trace_enable_tpoint_group(client, name):
"""Enable trace on a specific tpoint group.
Args:
name: trace group name we want to enable in tpoint_group_mask. (for example "bdev... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/c-to-c.py | pexip/os-pycparser | 163 | 3224218 | #------------------------------------------------------------------------------
# pycparser: c-to-c.py
#
# Example of using pycparser.c_generator, serving as a simplistic translator
# from C to AST and back to C.
#
# Copyright (C) 2008-2015, <NAME>
# License: BSD
#-------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_updater.py | srdjanrosic/supervisor | 584 | 3224232 | <reponame>srdjanrosic/supervisor<gh_stars>100-1000
"""Test updater files."""
import pytest
from supervisor.coresys import CoreSys
URL_TEST = "https://version.home-assistant.io/stable.json"
@pytest.mark.asyncio
async def test_fetch_versions(coresys: CoreSys) -> None:
"""Test download and sync version."""
c... | 0 | 0 | 0 | 0 | 0 | 0 |
node_modules/node-svm/binding.gyp | myste1tainn/Thesis-ARS | 280 | 3224233 | <reponame>myste1tainn/Thesis-ARS
{
'targets': [
{
'target_name': 'addon',
'sources': [
'./src/libsvm/svm.cpp',
'./src/addon.cc',
'./src/node-svm/node-svm.cc'
],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
'cflags': ['-Wall', '-O3', '-f... | 0 | 0 | 0 | 0 | 0 | 0 |
gcp_variant_transforms/libs/bigquery_vcf_data_converter.py | tsa87/gcp-variant-transforms | 113 | 3224244 | <gh_stars>100-1000
# Copyright 2018 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 b... | 0 | 0 | 0 | 0 | 0 | 0 |
train/image_captcha/baidu.py | zhoumh1988/12306 | 769 | 3224252 | from __future__ import annotations
import requests
from configure import BAIDU_API_KEY,BAIDU_APP_ID,BAIDU_SECRET_ID
from aip import AipImageClassify, AipOcr
class ImageClassify:
def __init__(self,app_id,api_key,secret_key):
self.image_client = AipImageClassify(app_id,api_key,secret_key)
self.words... | 0 | 4 | 0 | 0 | 4 | 0 |
tests/data/plain_old_module.py | msaladna/mitogen | 1,526 | 3224256 | """
I am a plain old module with no interesting dependencies or import machinery
fiddlery.
"""
import math
class MyError(Exception):
pass
def get_sentinel_value() -> object:
# Some proof we're even talking to the mitogen-test Docker image
return open('/etc/sentinel', 'rb').read().decode()
def add(x, ... | 0 | 3 | 0 | 0 | 3 | 0 |
InvenTree/company/urls.py | kbrownnn/InvenTree | 656 | 3224261 | """
URL lookup for Company app
"""
from django.conf.urls import url, include
from . import views
company_detail_urls = [
url(r'^thumb-download/', views.CompanyImageDownloadFromURL.as_view(), name='company-image-download'),
# Any other URL
url(r'^.*$', views.CompanyDetail.as_view(), name='company-detai... | 0 | 0 | 0 | 0 | 0 | 0 |
algorithms/cats-and-a-mouse.py | gajubadge11/HackerRank-1 | 340 | 3224265 | <reponame>gajubadge11/HackerRank-1
#!/bin/python3
import sys
def catAndMouse(x, y, z):
cat_a = abs(x - z)
cat_b = abs(y - z)
if cat_a < cat_b:
return "Cat A"
elif cat_a > cat_b:
return "Cat B"
else:
return "Mouse C"
if __name__ == "__main__":
q = int(input().strip... | 0 | 0 | 0 | 0 | 0 | 0 |
eth/tools/fixtures/fillers/vm.py | ggs134/py-evm | 1,641 | 3224273 | <reponame>ggs134/py-evm
from typing import (
Any,
Dict,
Iterable,
Tuple,
Union,
)
from eth.tools.fixtures.helpers import (
get_test_name,
)
from eth.tools._utils.normalization import (
normalize_bytes,
normalize_call_creates,
normalize_environment,
normalize_execution,
norma... | 0 | 0 | 0 | 0 | 0 | 0 |
tick/base/simulation/simu.py | sumau/tick | 411 | 3224301 | # License: BSD 3 clause
from abc import ABC, abstractmethod
from time import time
import numpy as np
from tick.base import Base
class Simu(ABC, Base):
"""
Abstract simulation class. It does nothing besides printing and
verbosing.
Parameters
----------
seed : `int`
The seed of the ra... | 2 | 2 | 1 | 0 | 5 | 0 |
examples/miniapps/fastapi-redis/fastapiredis/redis.py | whysage/python-dependency-injector | 1,997 | 3224316 | """Redis client module."""
from typing import AsyncIterator
from aioredis import create_redis_pool, Redis
async def init_redis_pool(host: str, password: str) -> AsyncIterator[Redis]:
pool = await create_redis_pool(f'redis://{host}', password=password)
yield pool
pool.close()
await pool.wait_closed()... | 2 | 1 | 0 | 0 | 3 | 0 |
recipes/Python/519645_PEP_367_like_super/recipe-519645.py | tdiprima/code | 2,023 | 3224338 | <reponame>tdiprima/code<filename>recipes/Python/519645_PEP_367_like_super/recipe-519645.py
import sys
class Super(object):
"""
>>> class A(object):
... def a(self):
... print "A.a()"
>>> class B(A):
... def a(self):
... print "B.a()"
... super.a()
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/check_missing_locations.py | WillAdams-afk/Corona | 1,354 | 3224339 | <gh_stars>1000+
import argparse
import pandas as pd
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Check for missing colors & locations",
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('--metadata', type=str, nargs='+', required=True... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/autoscaler/operators.py | luxius-luminus/pai | 1,417 | 3224344 | from abc import abstractmethod
from utils import Shell
from nodes import WorkerNode
class Operator(object):
def __init__(self, shell: Shell):
self._shell = shell
@abstractmethod
def _turn_on(self, nodes: list):
raise NotImplementedError
@abstractmethod
def _turn_off(self, nodes... | 11 | 2 | 0 | 0 | 13 | 0 |
src/detection_efffdet/effdet/evaluation/detection_evaluator.py | yellowdolphin/SIIM-COVID19-Detection | 1,386 | 3224346 | <reponame>yellowdolphin/SIIM-COVID19-Detection
from abc import ABCMeta
from abc import abstractmethod
#import collections
import logging
import unicodedata
import numpy as np
from .fields import InputDataFields, DetectionResultFields
from .object_detection_evaluation import ObjectDetectionEvaluation
def create_categ... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/django-extensions-1.8.0/django_extensions/management/utils.py | kokosing/hue | 5,079 | 3224351 | # -*- coding: utf-8 -*-
from __future__ import annotations
import logging
import os
import sys
import csv
import codecs
from io import BytesIO
from django_extensions.management.signals import post_command, pre_command
def _make_writeable(filename) -> None:
"""
Make sure that the file is writeable. Useful if... | 3 | 4 | 0 | 0 | 7 | 0 |
examples/aes_endec[outdated].py | ViCrack/Burpy | 211 | 3224369 | #coding:utf-8
import re
import base64
import hashlib
from urllib import unquote,urlencode
from Crypto.Cipher import AES
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class Burpy:
'''
header is list, append as your need
body is string, modify as your need
'''
def __init__(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
flags/tests/test_management_commands_disable_flag.py | mdunc/django-flags | 142 | 3224378 | <filename>flags/tests/test_management_commands_disable_flag.py<gh_stars>100-1000
from io import StringIO
from django.core.management import call_command
from django.core.management.base import CommandError
from django.test import TestCase
from flags.models import FlagState
from flags.state import flag_disabled
clas... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/compo_from_image.py | odidev/moviepy | 8,558 | 3224415 | from moviepy import *
from moviepy.video.tools.segmenting import find_objects
# Load the image specifying the regions.
im = ImageClip("../../ultracompositing/motif.png")
# Loacate the regions, return a list of ImageClips
regions = find_objects(im)
# Load 7 clips from the US National Parks. Public Domain :D
clips =... | 0 | 0 | 0 | 0 | 0 | 0 |
foolbox/criteria.py | SamplingAndEnsemblingSolvers/foolbox | 2,292 | 3224437 | <gh_stars>1000+
"""
===============================================================================
:mod:`foolbox.criteria`
===============================================================================
Criteria are used to define which inputs are adversarial.
We provide common criteria for untargeted and targeted ad... | 0 | 0 | 0 | 0 | 0 | 0 |
drb/path.py | vinted/docker-rpm-builder | 355 | 3224452 | # -*- coding: utf-8 -*-
from . import uriresolver
def getpath(path) -> object:
return uriresolver.resource_filename_resolver("req://docker-rpm-builder/{0}".format(path))
| 0 | 1 | 0 | 0 | 1 | 0 |
.modules/.metagoofil/hachoir_parser/image/tga.py | termux-one/EasY_HaCk | 1,103 | 3224458 | <reponame>termux-one/EasY_HaCk
"""
Truevision Targa Graphic (TGA) picture parser.
Author: <NAME>
Creation: 18 december 2006
"""
from hachoir_parser import Parser
from hachoir_core.field import FieldSet, UInt8, UInt16, Enum, RawBytes
from hachoir_core.endian import LITTLE_ENDIAN
from hachoir_parser.image.common import... | 0 | 0 | 0 | 0 | 0 | 0 |
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py | Polidea/SiriusObfuscator | 427 | 3224460 | <filename>SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
"""
Test process attach.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite... | 0 | 0 | 0 | 0 | 0 | 0 |
framework/csp_test.py | liamnewmarch/chromium-dashboard | 450 | 3224524 | # Copyright 2020 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 or agreed to in writing, s... | 0 | 0 | 0 | 0 | 0 | 0 |
ckan/migration/versions/088_3537d5420e0e_delete_extrase_which_are_deleted_state.py | ziveo/ckan | 2,805 | 3224525 | <gh_stars>1000+
# encoding: utf-8
"""delete extrase which are deleted state
Revision ID: 3537d5420e0e
Revises: ff1b303cab77
Create Date: 2019-05-09 13:38:22.072361
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = u'3537d5420e0e'
down_revision = u'ff1b303cab77'
branch_labels = None
depen... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_schemadef_plugin.py | desruie/OpenTimelineIO | 1,021 | 3224547 | <filename>tests/test_schemadef_plugin.py<gh_stars>1000+
#
# Copyright Contributors to the OpenTimelineIO project
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modific... | 0 | 0 | 0 | 0 | 0 | 0 |
Problem019/Python/solution_1.py | drocha87/ProjectEuler | 167 | 3224565 | <reponame>drocha87/ProjectEuler<filename>Problem019/Python/solution_1.py
#!/usr/bin/env python
# coding=utf-8
# Python Script
#
# Copyleft © <NAME>
#
#
"""
Counting Sundays
Problem 19
You are given the following information, but you may prefer to do some research for yourself.
1 Jan 1900 was a Monday.
Th... | 0 | 0 | 0 | 0 | 0 | 0 |
libpyclingo/clingo/_internal.py | potassco/gringo | 423 | 3224568 | <filename>libpyclingo/clingo/_internal.py
'''
Internal functions and classes of the clingo module.
'''
from os import _exit
from traceback import print_exception
import os
import sys
try:
_FLAGS = None
# In the pip module the library also exports the clingo symbols, which
# should be globally available for... | 0 | 0 | 0 | 0 | 0 | 0 |
simplest_saved_model/export_simplest_model.py | tobegit3hub/tensorflow_examples | 156 | 3224590 | <reponame>tobegit3hub/tensorflow_examples
#!/usr/bin/env python
import tensorflow as tf
export_dir = "./model/1"
input_keys_placeholder = tf.placeholder(
tf.int32, shape=[None, 1], name="input_keys")
output_keys = tf.identity(input_keys_placeholder, name="output_keys")
session = tf.Session()
tf.saved_model.simpl... | 0 | 0 | 0 | 0 | 0 | 0 |
lldb/test/API/lang/cpp/char8_t/TestCxxChar8_t.py | LaudateCorpus1/llvm-project | 605 | 3224611 | # coding=utf8
"""
Test that C++ supports char8_t correctly.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class CxxChar8_tTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIf(compiler="clang", compil... | 0 | 0 | 0 | 0 | 0 | 0 |
lisa/analysis/_proxy.py | douglas-raillard-arm/lisa | 159 | 3224619 | <reponame>douglas-raillard-arm/lisa
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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.... | 0 | 0 | 0 | 0 | 0 | 0 |
flare/data_science/markov_model.py | Lonewolf-Information-systems/flare | 433 | 3224633 | from collections import defaultdict, Counter
import random
from math import log
from itertools import repeat
import sys
class MarkovModel(object):
"""
High-order Markov model of string sequences.
Args:
order (int): the desired order of the Markov model.
Returns:
an instance of MarkMod... | 0 | 5 | 0 | 3 | 8 | 0 |
gfauto/gfauto/interrupt_util.py | KishkinJ10/graphicsfuzz | 519 | 3224661 | # -*- coding: utf-8 -*-
# Copyright 2019 The GraphicsFuzz Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | 2 | 4 | 1 | 0 | 7 | 0 |
graphgallery/gallery/nodeclas/tensorflow/experimental/s_obvat.py | EdisonLeeeee/GraphGallery | 300 | 3224698 | import tensorflow as tf
from tensorflow.keras import Input
from tensorflow.keras.layers import Dropout
from tensorflow.keras.optimizers import Adam
from tensorflow.keras import regularizers
from tensorflow.keras.losses import SparseCategoricalCrossentropy
from graphgallery.nn.layers.tensorflow import GCNConv
f... | 9 | 3 | 0 | 0 | 12 | 0 |
matchzoo/datasets/wiki_qa/load_data.py | ChrisRBXiong/MatchZoo-py | 468 | 3224706 | """WikiQA data loader."""
import typing
import csv
from pathlib import Path
import pandas as pd
import matchzoo
from matchzoo.engine.base_task import BaseTask
_url = "https://download.microsoft.com/download/E/5/F/" \
"E5FCFCEE-7005-4814-853D-DAA7C66507E0/WikiQACorpus.zip"
def load_data(
stage: str = 't... | 4 | 3 | 0 | 0 | 7 | 0 |
source/interprocedural_analyses/taint/test/integration/decorator.py | ekmixon/pyre-check | 5,975 | 3224718 | # 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.
# flake8: noqa
from builtins import _test_sink, _test_source
from typing import Awaitable, Callable, TypeVar
from pyre_extensions import Par... | 46 | 39 | 0 | 0 | 85 | 0 |
opsmop/core/action.py | mahak/opsmop | 697 | 3224722 | <filename>opsmop/core/action.py
# Copyright 2018 <NAME> LLC, <<EMAIL>>
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
nogotofail/mitm/connection/handlers/data/imap.py | kbfl0912/nogotofail | 1,594 | 3224756 | from __future__ import annotations
r'''
Copyright 2014 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 requir... | 0 | 4 | 13 | 0 | 17 | 0 |
hubspot/cms/hubdb/api/__init__.py | fakepop/hubspot-api-python | 117 | 3224768 | from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from hubspot.cms.hubdb.api.rows_api import RowsApi
from hubspot.cms.hubdb.api.rows_batch_api import RowsBatchApi
from hubspot.cms.hubdb.api.tables_api import TablesApi
| 0 | 0 | 0 | 0 | 0 | 0 |
test/modules/http2/test_712_buffering.py | sakibguy/httpd | 291 | 3224787 | <gh_stars>100-1000
from datetime import timedelta
import pytest
from .env import H2Conf
from pyhttpd.curl import CurlPiper
class TestBuffering:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
env.setup_data_1k_1m()
conf = H2Conf(env)
conf.add_vhost_cgi(h2pr... | 0 | 0 | 0 | 0 | 0 | 0 |
src/networkx/algorithms/centrality/current_flow_closeness.py | MarletteFunding/aws-kube-codesuite | 184 | 3224803 | # Copyright (C) 2010-2017 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
#
# Author: <NAME> (<EMAIL>)
from __future__ import annotations
"""Current-flow closeness centrality measures."""
import networkx as nx
from networkx.utils import not_implemente... | 2 | 1 | 0 | 0 | 3 | 0 |
security_monkey/tests/auditors/github/test_repo_auditor.py | boladmin/security_monkey | 4,258 | 3224804 | # Copyright 2017 Netflix, 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... | 0 | 0 | 0 | 0 | 0 | 0 |
api/v2/views/image_tag.py | simpsonw/atmosphere | 197 | 3224807 | <reponame>simpsonw/atmosphere<filename>api/v2/views/image_tag.py
from core.models import ApplicationTag as ImageTag
from api.v2.serializers.details import ImageTagSerializer
from api.v2.views.base import AuthModelViewSet
class ImageTagViewSet(AuthModelViewSet):
"""
API endpoint that allows instance tags to b... | 0 | 0 | 0 | 0 | 0 | 0 |
gpytorch/models/pyro/pyro_gp.py | llguo95/gpytorch | 2,673 | 3224815 | <reponame>llguo95/gpytorch
#!/usr/bin/env python3
import pyro
from ..gp import GP
from ._pyro_mixin import _PyroMixin
class PyroGP(GP, _PyroMixin):
"""
A :obj:`~gpytorch.models.ApproximateGP` designed to work with Pyro.
This module makes it possible to include GP models with more complex probablistic m... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/recorders/common/test_china_stock_list_recorder.py | alucardxh/zvt | 2,032 | 3224822 | <reponame>alucardxh/zvt
# -*- coding: utf-8 -*-
from ...context import init_test_context
init_test_context()
from zvt.recorders.eastmoney import EastmoneyStockRecorder
def test_china_stock_recorder():
recorder = EastmoneyStockRecorder()
try:
recorder.run()
except:
assert False
| 0 | 0 | 0 | 0 | 0 | 0 |
pymtl3/passes/testcases/TestCase.py | kevinyuan/pymtl3 | 152 | 3224840 | <reponame>kevinyuan/pymtl3
"""
=========================================================================
TestCase.py
=========================================================================
Implement the base TestCase class.
Author : <NAME>
Date : Dec 12, 2019
"""
from textwrap import dedent
class AliasOf:
def... | 0 | 0 | 0 | 0 | 0 | 0 |
Paddle_Enterprise_CaseBook/PCB_Fault_Detection/dataset_analysis.py | wwhio/awesome-DeepLearning | 1,150 | 3224843 | import json
from collections import defaultdict
import matplotlib.pyplot as plt
with open("/home/aistudio/work/PCB_DATASET/Annotations/train.json") as f:
data = json.load(f)
imgs = {}
for img in data['images']:
imgs[img['id']] = {
'h': img['height'],
'w': img['width'],
'area': img['hei... | 0 | 0 | 0 | 0 | 0 | 0 |
ryu/lib/packet/slow.py | w180112/ryu | 975 | 3224848 | # Copyright (C) 2013 Nippon Telegraph and Telephone 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 appli... | 27 | 3 | 29 | 1 | 60 | 0 |
scripts/external_libs/scapy-2.4.5/scapy/arch/windows/structures.py | dariusgrassi/trex-core | 250 | 3224855 | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
# flake8: noqa E266
# (We keep comment boxes, it's then one-line comments)
from __future__ import annotations... | 1 | 7 | 17 | 0 | 25 | 0 |
sympy/polys/densebasic.py | bigfooted/sympy | 603 | 3224859 | from __future__ import annotations
"""Basic tools for dense recursive polynomials in ``K[x]`` or ``K[X]``. """
from sympy import oo
from sympy.core import igcd
from sympy.polys.monomials import monomial_min, monomial_div
from sympy.polys.orderings import monomial_key
import random
def poly_LC(f, K) -> object:
"... | 10 | 71 | 0 | 0 | 81 | 0 |
mmdet3d/core/visualizer/show_result.py | XuyangBai/mmdetection3d | 109 | 3224861 | from __future__ import annotations
import mmcv
import numpy as np
import trimesh
from os import path as osp
def _write_ply(points, out_filename):
"""Write points into ``ply`` format for meshlab visualization.
Args:
points (np.ndarray): Points in shape (N, dim).
out_filename (str): Filename to... | 1 | 3 | 0 | 0 | 4 | 0 |
code/birthday.py | yunnanyqdu/thinkpython | 2,095 | 3224885 | """This module contains a code example related to
Think Python, 2nd Edition
by <NAME>
http://thinkpython2.com
Copyright 2015 <NAME>
License: http://creativecommons.org/licenses/by/4.0/
"""
from __future__ import print_function, division
import random
def has_duplicates(t) -> bool:
"""Returns True if any elem... | 0 | 3 | 0 | 0 | 3 | 0 |
teste2e/test_indexing.py | williballenthin/ursadb | 101 | 3224913 | <filename>teste2e/test_indexing.py
from .util import UrsadbTestContext, store_files, check_query, get_index_hash, UrsadbConfig
from .util import ursadb # noqa
import pytest
def test_indexing_small(ursadb: UrsadbTestContext):
store_files(ursadb, "gram3", {"kot": b"Ala ma kota ale czy kot ma Ale?"})
ursadb.ch... | 0 | 0 | 0 | 0 | 0 | 0 |
fabric_bolt/fabfile.py | jooni22/fabric-bolt | 219 | 3224918 | <filename>fabric_bolt/fabfile.py<gh_stars>100-1000
import cgi
import datetime
import time
from tempfile import NamedTemporaryFile
from fabric.api import *
from fabric import colors
@task
def update():
"""Requires code_root env variable. Does a git pull and restarts the web server"""
require('code_root')
... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.