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 |
|---|---|---|---|---|
src/deepke/relation_extraction/__init__.py | ishine/DeepKE | 710 | 11034833 | <reponame>ishine/DeepKE
from .standard import *
from .document import *
from .few_shot import * |
test/augmentables/test_normalization.py | MinhTran0311/imgaug_Minh | 12,895 | 11034837 | <filename>test/augmentables/test_normalization.py
from __future__ import print_function, division, absolute_import
import sys
# unittest only added in 3.4 self.subTest()
if sys.version_info[0] < 3 or sys.version_info[1] < 4:
import unittest2 as unittest
else:
import unittest
# unittest.mock is not available in... |
clair/train.py | jopineda/Clair | 101 | 11034885 | import sys
import os
import logging
import random
import numpy as np
from time import time
from argparse import ArgumentParser
from threading import Thread
from clair.model import Clair
import clair.utils as utils
import clair.evaluate as evaluate
import shared.param as param
logging.basicConfig(format='%(message)s',... |
yasql/libs/response.py | Fanduzi/YaSQL | 443 | 11034934 | # -*- coding:utf-8 -*-
# edit by fuzongfei
"""
http返回封装
"""
from rest_framework.response import Response
class JsonResponseV1(Response):
"""
封装by fuzongfei
"""
def __init__(self, data={}, code='0000', message='', status=None, flat=False):
"""
code = '0000' 为success
code = '00... |
Knapsack.py | OluSure/Hacktoberfest2021-1 | 215 | 11034935 | n=int(input("Enter the number of items:\n"))
weight,value=[],[]
for i in range(n):
print("Enter weight and value for item %d"%(i+1))
weight.append(int(input()))
value.append(int(input()))
ratio=[]
for i in range(n):
ratio.append(value[i]//weight[i])
cap=int(input("Enter the maximum capacity:\n"))
w,v=... |
src/simoorg/plugins/topology/TopologyBuilder.py | Spellchaser/simoorg | 197 | 11034969 | <gh_stars>100-1000
#
# Copyright 2015 LinkedIn Corp. 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... |
splink/validate.py | rubensmau/splink | 176 | 11034976 | import pkg_resources
from functools import lru_cache
import math
from jsonschema import validate, ValidationError
import json
import copy
from typeguard import typechecked
@lru_cache()
def _get_schema(setting_dict_should_be_complete=False):
with pkg_resources.resource_stream(
__name__, "files/settings_j... |
mmtbx/hydrogens/validate_H.py | dperl-sol/cctbx_project | 155 | 11034990 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
from iotbx.pdb import common_residue_names_get_class
from libtbx import group_args
from libtbx.str_utils import make_sub_header
from mmtbx.validation import restraints
from mmtbx.validation.molprobity import mp_geo
#from ... |
Module/Spaghetti/modules/discovery/PrivateIP.py | vishnudxb/Yuki-Chan-The-Auto-Pentest | 655 | 11034993 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Spaghetti: Web Server Security Scanner
#
# @url: https://github.com/m4ll0k/Spaghetti
# @author: <NAME> (M4ll0k)
# @license: See the file 'doc/LICENSE'
from lib.net import http
from lib.utils import printer
import re
class PrivateIP():
def __init__(self,url,agent,prox... |
Providers/Scripts/3.x/Scripts/nxAvailableUpdates.py | Microsoft/PowerShell-DSC-for-Linux | 154 | 11035001 | <filename>Providers/Scripts/3.x/Scripts/nxAvailableUpdates.py
#!/usr/bin/env python3
# ===================================
# Copyright (c) Microsoft Corporation. All rights reserved.
# See license.txt for license information.
# ===================================
import subprocess
import sys
import imp
import re
impor... |
examples-master/python_examples/qmc_pi_sho.py | JungHoonJung/2021MD | 186 | 11035031 | <gh_stars>100-1000
#!/usr/bin/env python3
# qmc_pi_sho.py
#------------------------------------------------------------------------------------------------#
# This software was written in 2016/17 #
# by <NAME> <<EMAIL>>/<<EMAIL>> #
# and ... |
seq2seq/test/rnn_encoder_test.py | soupstandstop/test | 6,053 | 11035039 | <filename>seq2seq/test/rnn_encoder_test.py
# Copyright 2017 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... |
setup.py | agiza/fileconveyor | 123 | 11035051 | # coding=utf-8
# Python 2.5 compatibility.
from __future__ import with_statement
import os.path
import sys
from setuptools import setup, find_packages
VERSION = '0.3-dev'
def read_relative_file(filename):
"""Returns contents of the given file.
Filename argument must be relative to this module.
"""
... |
applications/SwimmingDEMApplication/python_scripts/fracture_inertial_focusing/cubic_law.py | lkusch/Kratos | 778 | 11035068 | import math
import numpy as np
from matplotlib import pyplot as plt
import root_finder
import random
import pylab
class ProblemParameters:
def __init__(self):
self.L0 = 0.01
self.H0 = 0.005
self.U0 = 0.31297739987328533717
self.epsilon = self.H0 / self.L0
self.A1 = 0.001
... |
cluster/fleet/test/utils.py | SunGuo/500lines | 134 | 11035100 | from . import fake_network
from .. import member
import unittest
class ComponentTestCase(unittest.TestCase):
def setUp(self):
self.node = fake_network.FakeNode()
self.member = member.Member(self.node)
def tearDown(self):
if self.node.sent:
self.fail("extra messages from n... |
graphwave/performance_evaluation/purity.py | xuyou314/graphwave | 154 | 11035108 | <filename>graphwave/performance_evaluation/purity.py
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 19:18:46 2017
"""
import numpy as np
#### Assess purity of a graph
def get_purity(node,neighbors,colors):
l=len([i for i in range(len(neighbors)) if colors[neighbors[i]]==colors[node]])
#return l*1.0/len(nei... |
mayan/apps/document_states/tests/test_workflow_template_state_action_views.py | nattangwiwat/Mayan-EDMS-recitation | 336 | 11035172 | <gh_stars>100-1000
from mayan.apps.testing.tests.base import GenericViewTestCase
from ..events import event_workflow_template_edited
from ..permissions import permission_workflow_template_edit
from .literals import TEST_WORKFLOW_TEMPLATE_STATE_ACTION_DOTTED_PATH
from .mixins.workflow_template_mixins import WorkflowTe... |
climlab/tests/__init__.py | nfeldl/climlab | 160 | 11035182 | <gh_stars>100-1000
# nothing yet
|
drugresnet/seya/layers/deep_recurrent.py | Naghipourfar/CCLE | 429 | 11035186 | import numpy as np
from keras.layers.core import Dense
from keras.layers.recurrent import Recurrent, LSTM
from keras import initializations, activations
from keras import backend as K
# from theano.printing import Print
class DeepLSTM(Recurrent):
'''Seq2Seq Deep Long-Short Term Memory unit.
Inspired byt Sut... |
client/verta/tests/registry/model_version/test_deployment.py | mitdbg/modeldb | 835 | 11035187 | <reponame>mitdbg/modeldb
# -*- coding: utf-8 -*-
import datetime
import json
import os
import tarfile
import uuid
import hypothesis
import hypothesis.strategies as st
import pytest
from verta._internal_utils import _utils
from verta.data_types import _verta_data_type
from verta.environment import Python
from verta.r... |
docs/examples_src/querying/not_equal.py | dynalz/odmantic | 486 | 11035195 | from odmantic import Model, query
class Tree(Model):
name: str
average_size: float
Tree.name != "Spruce"
#> QueryExpression({'name': {'$ne': 'Spruce'}})
Tree.name.ne("Spruce")
#> QueryExpression({'name': {'$ne': 'Spruce'}})
query.ne(Tree.name, "Spruce")
#> QueryExpression({'name': {'$ne': 'Spruce'}})
|
trixi/experiment/experiment.py | georgepar/trixi | 218 | 11035204 | <reponame>georgepar/trixi
import time
class Experiment(object):
"""
An abstract Experiment which can be run for a number of epochs.
The basic life cycle of an experiment is::
setup()
prepare()
while epoch < n_epochs:
train()
validate()
epoch +... |
ddkangfu/0016/0016.py | saurabh896/python-1 | 3,976 | 11035206 | <gh_stars>1000+
# coding=utf-8
import json
import os
import xlwt
"""
0016: 纯文本文件 numbers.txt, 里面的内容(包括方括号)如下所示:
[
[1, 82, 65535],
[20, 90, 13],
[26, 809, 1024]
]
请将上述内容写到 numbers.xls 文件中,如下图所示:

"""
def load_json_file(file_name):
... |
gcloud/tests/taskflow3/context/task_context/test_task_executor.py | wkma/bk-sops | 881 | 11035210 | <gh_stars>100-1000
# -*- 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>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file ... |
rabbitHole/filter.py | torchhound/warren | 309 | 11035213 | <filename>rabbitHole/filter.py
f = open("links.txt", "r")
f1 = open("cleanedLinks.txt", "w")
for line in f:
if "javascript:void(0)" in line or "login?" in line or "vote?" in line or "item?" in line or "user?" in line or "hide?" in line or "fave?" in line or "reply?" in line:
pass
else:
f1.write... |
tests/test_command.py | duczen/pynsq | 308 | 11035236 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import sys
import json
import pytest
# shunt '..' into sys.path since we are in a 'tests' subdirectory
base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
if base_dir not... |
barbican/tests/cmd/test_db_cleanup.py | dmend/barbican | 177 | 11035247 | # Copyright (c) 2016 IBM
#
# 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, softw... |
torch_geometric/datasets/dblp.py | NucciTheBoss/pytorch_geometric | 2,350 | 11035257 | import os
import os.path as osp
from itertools import product
from typing import Callable, List, Optional
import numpy as np
import scipy.sparse as sp
import torch
from torch_geometric.data import (
HeteroData,
InMemoryDataset,
download_url,
extract_zip,
)
class DBLP(InMemoryDataset):
r"""A subs... |
tests/test_06_math/test_612_ucs_pass_trough.py | jkjt/ezdxf | 515 | 11035260 | # Copyright (c) 2018-2020 <NAME>
# License: MIT License
from ezdxf.math import PassTroughUCS, UCS, Vec3, X_AXIS, Y_AXIS, Z_AXIS
def test_u_vectors():
ucs = PassTroughUCS()
assert ucs.ux == X_AXIS
assert ucs.uy == Y_AXIS
assert ucs.uz == Z_AXIS
def test_to_wcs():
ucs = PassTroughUCS()
assert... |
tests/cuda_smem_test.py | jnice-81/dace | 227 | 11035273 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import dace
from dace.transformation.dataflow import GPUTransformMap, InLocalStorage
import numpy as np
import pytest
N = dace.symbol('N')
@dace.program(dace.float64[N], dace.float64[N])
def cudahello(A, Vout):
@dace.mapscope(_[0:ceilin... |
dojo/management/commands/initialize_permissions.py | dant24/django-DefectDojo | 249 | 11035290 | <gh_stars>100-1000
import logging
from django.core.management.base import BaseCommand
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""
This management command creates non-standard... |
ykdl/extractors/sohu/my.py | panda-mute/ykdl | 136 | 11035298 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from .sohubase import SohuBase
class MySohu(SohuBase):
name = '搜狐自媒体 (MySohu)'
apiurl = 'http://my.tv.sohu.com/play/videonew.do'
apiparams = {
'vid': '',
'referer': 'http://my.tv.sohu.com/'
}
site = MySohu()
|
platform/mcu/haas1000/prebuild/data/python-apps/ml/recognize-character/main.py | NEXTLEO/AliOS-Things | 4,538 | 11035322 |
from minicv import ML
print("-------------------Welcome HaasAI MicroPython--------------------")
print("-----ml ucloud RecognizeCharacter demo start-----")
OSS_ACCESS_KEY = "xxxx"
OSS_ACCESS_SECRET = "xxxx"
OSS_ENDPOINT = "xxxx"
OSS_BUCKET = "xxxx"
ml = ML()
ml.open(ml.ML_ENGINE_CLOUD)
ml.config(OSS_ACCESS_KEY, OSS_... |
WebMirror/misc.py | fake-name/ReadableWebProxy | 193 | 11035364 |
import xxhash
import urllib.parse
from WebMirror.rules import load_rules
import common.util.rewalk_epoch
class UnwantedUrlError(RuntimeError):
pass
def load_nl_refetch_interval_mapping():
rules = load_rules()
ret = {}
for ruleset in rules:
interval = ruleset['rewalk_interval_days']
if ruleset['rewalk_di... |
tests/test_cli_colorful.py | dbajar/segno | 254 | 11035377 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- <NAME>
# All rights reserved.
#
# License: BSD License
#
"""\
CLI colormap (PNG) related tests.
"""
from __future__ import unicode_literals, absolute_import
import io
import os
import tempfile
import pytest
from segno import cli, writers as colors
from png import... |
floweaver/view_graph.py | guest-cc/floweaver | 342 | 11035407 | from .layered_graph import LayeredGraph
from .utils import pairwise
from .sankey_definition import Elsewhere
from .dummy_nodes import add_dummy_nodes
def view_graph(sankey_definition):
G = LayeredGraph()
for k, node in sankey_definition.nodes.items():
G.add_node(k, node=node)
G.ordering = sankey... |
eod/curve_constructor.py | jingmouren/QuantResearch | 623 | 11035408 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import numpy as np
import pandas as pd
from scipy import stats
from datetime import datetime
import h5py
import logging
import global_settings
import data_loader
from futures_tools import get_futures_chain, get_futures_actual_ticker, get_generic_futures... |
colossus/apps/subscribers/migrations/0002_subscriber_last_sent.py | CreativeWurks/emailerpro | 372 | 11035425 | <reponame>CreativeWurks/emailerpro<filename>colossus/apps/subscribers/migrations/0002_subscriber_last_sent.py
# Generated by Django 2.1 on 2018-08-13 18:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('subscribers', '0001_initial'),
]
operati... |
walter/maya/scripts/AEwalterStandinTemplate.py | all-in-one-of/OpenWalter | 187 | 11035457 | <filename>walter/maya/scripts/AEwalterStandinTemplate.py
"""
Attribute Editor tamplate for walterStandin node. It's written on Python to be
able to use complex UI and PySide.
"""
# Copyright 2017 <NAME>. All rights reserved.
from walterWidgets.Qt import QtCore
from walterWidgets.Qt import QtGui
from walterWidgets.Qt ... |
validate_docbr/Certidao.py | leogregianin/validate-docbr | 298 | 11035491 | from .BaseDoc import BaseDoc
from random import sample
class Certidao(BaseDoc):
"""Classe referente a Certidão de Nascimento/Casamento/Óbito."""
def __init__(self):
self.digits = list(range(10))
def validate(self, doc: str = '') -> bool:
"""Método para validar a Certidão de Nascimento/Ca... |
pycket/prims/regexp.py | namin/pycket | 129 | 11035526 | from pycket.prims.expose import (unsafe, default, expose, expose_val,
procedure, make_call_method, define_nyi)
from pycket import values, values_string, values_regex
from pycket.error import SchemeException
from rpython.rlib import jit, rstring
import sys
@expose("regexp", [values_str... |
python/paddle/fluid/tests/unittests/test_fleet_pipeline_meta_optimizer_with_recompute.py | zmxdream/Paddle | 17,085 | 11035533 | # Copyright (c) 2021 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... |
optunity/constraints.py | xrounder/optunity | 401 | 11035569 | #! /usr/bin/env python
# Copyright (c) 2014 <NAME>, ESAT-STADIUS
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, ... |
typed_python/lib/pmap.py | APrioriInvestments/typed_python | 105 | 11035573 | <filename>typed_python/lib/pmap.py
# Copyright 2017-2020 typed_python 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
#
# ... |
feedhq/feeds/management/commands/sync_pubsubhubbub.py | feedhq/feedhq | 361 | 11035577 | import os
import structlog
from django.conf import settings
from django_push.subscriber.models import Subscription, SubscriptionError
from raven import Client
from . import SentryCommand
logger = structlog.get_logger(__name__)
class Command(SentryCommand):
"""Updates PubSubHubbub subscriptions"""
def hand... |
Algo and DSA/LeetCode-Solutions-master/Python/smallest-index-with-equal-value.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11035600 | # Time: O(n)
# Space: O(1)
class Solution(object):
def smallestEqual(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return next((i for i, x in enumerate(nums) if i%10 == x), -1)
|
changes/api/serializer/models/bazeltarget.py | vault-the/changes | 443 | 11035601 | <reponame>vault-the/changes
from changes.api.serializer import Crumbler, register
from changes.constants import ResultSource
from changes.models.bazeltarget import BazelTarget
from changes.models.bazeltargetmessage import BazelTargetMessage
@register(BazelTarget)
class BazelTargetCrumbler(Crumbler):
def crumble(s... |
dbaas/physical/tests/test_engine_type.py | didindinn/database-as-a-service | 303 | 11035613 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.test import TestCase
from django.contrib import admin
from physical.admin.engine_type import EngineTypeAdmin
from physical.models import EngineType
SEARCH_FIELDS = ('name', )
LIST_FILTER = ('is_in_memory', )
LIST_FIELDS = ('n... |
microdata.py | staeff/microdata | 102 | 11035614 | <filename>microdata.py
#!/usr/bin/env python
import sys
import html5lib
from collections import defaultdict
try:
import json
except ImportError:
import simplejson as json
def get_items(location, encoding=None):
"""
Pass in a string or file-like object and get a list of Items present in the
HTM... |
allure-pytest/test/acceptance/label/severity/module_severity_test.py | ammarnajjar/allure-python | 558 | 11035622 | """ ./examples/label/severity/module_severity.rst """
from hamcrest import assert_that
from allure_commons_test.report import has_test_case
from allure_commons_test.label import has_severity
def test_not_decorated_function(executed_docstring_path):
assert_that(executed_docstring_path.allure_report,
... |
vel/models/vision/cifar_resnext.py | galatolofederico/vel | 273 | 11035627 | """
Code based on
https://github.com/fastai/fastai/blob/master/fastai/models/cifar10/resnext.py
"""
import torch.nn as nn
import torch.nn.functional as F
from vel.api import SupervisedModel, ModelFactory
from vel.modules.resnext import ResNeXtBottleneck
class ResNeXt(SupervisedModel):
""" A ResNext model as def... |
journalism_workflow/v1/documents.py | code-review-doctor/orchestra | 444 | 11035695 | <filename>journalism_workflow/v1/documents.py
import logging
from orchestra.google_apps.convenience import create_document_from_template
from orchestra.google_apps.convenience import create_folder_with_permissions
from orchestra.google_apps.permissions import write_with_link_permission
logger = logging.getLogger(__na... |
chatserver/tests/denied_channels.py | unix2315/redis_test | 815 | 11035767 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from django.core.exceptions import PermissionDenied
def denied_channels(request, channels):
if request.META.get('HTTP_DENY_CHANNELS') == 'YES':
raise PermissionDenied('No channels are allowed')
return channels
|
DIE/UI/Die_Icons.py | requizm/DIE | 496 | 11035794 | <reponame>requizm/DIE
from DIE.Lib import DieConfig
import idaapi
import os
import DIE.Lib.DieConfig
#from PySide import QtGui
from PyQt5 import QtGui, QtWidgets
class DieIcons():
"""
DIE Icons
"""
##########################################################################
# Icons Fi... |
pdftabextract/__init__.py | SivaMaplelabs/pdftabextract | 2,087 | 11035801 | import logging
__title__ = 'pdftabextract'
__version__ = '0.4.0'
__author__ = '<NAME>'
__license__ = 'Apache License 2.0'
logger = logging.getLogger('pdftabextract')
logger.addHandler(logging.NullHandler())
|
websploit/core/base/Base.py | albiahbi/websploit | 803 | 11035808 | import cmd
import sys
from websploit.modules import all_modules, module_list
from websploit.core.utils import CPrint
completions = [
'target',
'ip',
'gateway',
'mac',
'iface',
'gateway_mac',
'target_mac'
]
class Module(cmd.Cmd):
parameters = {}
cp = CPrint()
def do_execute(se... |
src/genie/libs/parser/junos/tests/ShowLDPInterfaceDetail/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 11035828 | expected_output = {
"ldp-interface-information": {
"ldp-interface": {
"interface-name": "ge-0/0/0.0",
"ldp-interface-local-address": "10.169.14.157",
"ldp-label-space-id": "10.169.14.240:0",
"ldp-neighbor-count": "1",
"ldp-next-hello": "1",
... |
tfmesos/utils.py | abhin1899/tfmesos | 226 | 11035836 | import struct
import logging
from six.moves import cPickle as pickle
def send(fd, o):
d = pickle.dumps(o)
fd.send(struct.pack('>I', len(d)) + d)
def recv(fd):
d = fd.recv(struct.calcsize('>I'))
assert len(d) == struct.calcsize('>I'), repr(d)
size, = struct.unpack('>I', d)
return pickle.loads... |
tests/modules/pkg1/sub/__main__.py | jouve/coveragepy | 2,254 | 11035891 | <filename>tests/modules/pkg1/sub/__main__.py
# Used in the tests for PyRunner
import sys
print("pkg1.sub.__main__: passed %s" % sys.argv[1])
|
test/motion_blur.py | 738844605/DualResidualNetworks | 144 | 11035946 | # python 2.7, pytorch 0.3.1
import os, sys
import cv2
sys.path.insert(1, '../')
import torch
import torchvision
import numpy as np
import subprocess
import random
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as transforms
import torch.nn.functional as F
from torch.autograd import Var... |
Sketchbots/sw/labqueue/lask/server/http/appkey_handlers.py | rlugojr/ChromeWebLab | 306 | 11035953 | # Copyright 2013 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 ... |
tests/acceptance/enforce_one_basicget_test.py | konstantin-Sk/pika | 2,479 | 11035961 | import unittest
from mock import MagicMock
from pika.frame import Method, Header
from pika.exceptions import DuplicateGetOkCallback
from pika.channel import Channel
from pika.connection import Connection
class OnlyOneBasicGetTestCase(unittest.TestCase):
def setUp(self):
self.channel = Channel(MagicMock(C... |
webapp/graphite/version/views.py | romanek-adam/graphite-web | 4,281 | 11035970 | <filename>webapp/graphite/version/views.py
from django.shortcuts import render
from graphite import settings
def index(request):
context = {
'version' : settings.WEBAPP_VERSION,
}
return render(request, 'version.html', context)
|
Trakttv.bundle/Contents/Libraries/Shared/plex/objects/library/metadata/__init__.py | disrupted/Trakttv.bundle | 1,346 | 11035989 | <reponame>disrupted/Trakttv.bundle
from plex.objects.library.metadata.album import Album
from plex.objects.library.metadata.artist import Artist
from plex.objects.library.metadata.clip import Clip
from plex.objects.library.metadata.episode import Episode
from plex.objects.library.metadata.movie import Movie
from plex.o... |
cirq-core/cirq/testing/_compat_test_data/module_a/__init__.py | Saibaba-Alapati/Cirq | 3,326 | 11035992 | """module_a for module deprecation tests"""
from logging import info
from cirq.testing._compat_test_data.module_a import (
module_b,
)
from cirq.testing._compat_test_data.module_a.dupe import (
DUPE_CONSTANT,
)
from cirq.testing._compat_test_data.module_a.types import (
SampleType,
)
MODULE_A_ATTRIBUTE... |
solutions/problem_290.py | ksvr444/daily-coding-problem | 1,921 | 11035998 | <gh_stars>1000+
COLORS = {"R", "G", "B"}
def get_odd_man(col_a, col_b):
return list(COLORS - set([col_a, col_b]))[0]
def minimize(quixes):
stack = list()
for quix in quixes:
if not stack or stack[-1] == quix:
stack.append(quix)
continue
new = get_odd_man(quix, st... |
discogs_client/tests/make_symlinks.py | VinylVault/discogs_client | 394 | 11036045 | <filename>discogs_client/tests/make_symlinks.py
#!/usr/bin/env python
import os
import sys
from itertools import permutations
for name in sys.argv[1:]:
print("doing {}".format(name))
root, next = name.split('?')
data, ext = next.split('.')
elems = data.split('&')
for permut in permutations(elems):
... |
Lib/test/test_compiler/testcorpus/12_if_elif_else.py | diogommartins/cinder | 1,886 | 11036059 | if a:
b
elif c:
d
else:
e
|
polyvore/fill_in_blank.py | hrsma2i/polyvore | 143 | 11036064 | <filename>polyvore/fill_in_blank.py<gh_stars>100-1000
# Copyright 2017 <NAME>. 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/LICE... |
samples/snippets/storage_list_bucket_notifications.py | micahjsmith/python-storage | 187 | 11036095 | <filename>samples/snippets/storage_list_bucket_notifications.py
#!/usr/bin/env python
# Copyright 2021 Google LLC. 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
#
# ... |
packages/grid/apps/domain/src/main/core/model_centric/models/__init__.py | exityan/PySyft | 425 | 11036106 | # grid relative
from ...database import db
from .model_manager import ModelManager
model_manager = ModelManager(db)
|
test/regexp/fregexp5.py | kylebarron/MagicPython | 1,482 | 11036114 | <filename>test/regexp/fregexp5.py
a = rf'{{foo}}'
a = r'\{foo\}'
a : source.python
: source.python
= : keyword.operator.assignment.python, source.python
: source.python
rf : source.python, storage.type.string.python, string.interpolated.python, string.r... |
components/sample/keras/train_classifier/src/train.py | Iuiu1234/pipelines | 2,860 | 11036115 | # Copyright 2018 The Kubeflow 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... |
examples/invoke-custom-data/invoke-receiver.py | willtsai/python-sdk | 125 | 11036125 | <filename>examples/invoke-custom-data/invoke-receiver.py
from dapr.ext.grpc import App, InvokeMethodRequest
import proto.response_pb2 as response_messages
app = App()
@app.method('my_method')
def mymethod(request: InvokeMethodRequest):
print(request.metadata, flush=True)
print(request.text(), flush=True)
... |
tensorflow_federated/python/core/api/test_case.py | alessiomora/federated | 1,918 | 11036143 | <reponame>alessiomora/federated
# Copyright 2018, The TensorFlow Federated 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
#
# Unl... |
desktop/core/ext-py/nose-1.3.7/functional_tests/support/todo/test_with_todo.py | kokosing/hue | 5,079 | 11036147 | <filename>desktop/core/ext-py/nose-1.3.7/functional_tests/support/todo/test_with_todo.py
from todoplug import Todo
def test_some_important_thing():
raise Todo("Not done yet")
def test_something_else():
pass
|
kitectl/release.py | cihangir/kite | 3,107 | 11036162 | <gh_stars>1000+
#!/usr/bin/env python2.7
"""
A script for packaging and releasing kite tool for OS X and Linux platforms.
It can also upload the generated package file to S3 if you provide --upload flag.
usage: release.py [-h] [--upload]
Run it at the same directory as this script. It will put the generated files
int... |
tests/regression_tests/conftest.py | janmalec/openmc | 262 | 11036176 | <gh_stars>100-1000
import numpy as np
import openmc
from pkg_resources import parse_version
import pytest
@pytest.fixture(scope='module', autouse=True)
def numpy_version_requirement():
assert parse_version(np.__version__) >= parse_version("1.14"), \
"Regression tests require NumPy 1.14 or greater"
@pyte... |
boto3_type_annotations_with_docs/boto3_type_annotations/xray/paginator.py | cowboygneox/boto3_type_annotations | 119 | 11036215 | <filename>boto3_type_annotations_with_docs/boto3_type_annotations/xray/paginator.py<gh_stars>100-1000
from typing import Dict
from typing import List
from datetime import datetime
from botocore.paginate import Paginator
class BatchGetTraces(Paginator):
def paginate(self, TraceIds: List, PaginationConfig: Dict = N... |
koku/api/common/permissions/__init__.py | rubik-ai/koku | 157 | 11036221 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
from api.common.permissions.aws_access import AwsAccessPermission
from api.common.permissions.azure_access import AzureAccessPermission
from api.common.permissions.gcp_access import GcpAccessPermission
from api.common.permissions.openshift_access i... |
examples/extending_query/temporal_range.py | Dreamsorcerer/sqlalchemy | 5,383 | 11036262 | <gh_stars>1000+
"""Illustrates a custom per-query criteria that will be applied
to selected entities.
"""
import datetime
from sqlalchemy import Column
from sqlalchemy import DateTime
from sqlalchemy import orm
class HasTemporal(object):
"""Mixin that identifies a class as having a timestamp column"""
ti... |
python-2.7.8/setup_linux.py | Cadair/conda-recipes | 302 | 11036275 | <gh_stars>100-1000
import sys
from distutils.core import setup, Extension
setup(
ext_modules = [
Extension(
'readline', ['readline.c'],
libraries = ['readline'],#, 'ncursesw', 'tinfow'],
include_dirs = [sys.prefix + '/include'],
library_dirs = [sys.prefix + ... |
framework/scripts/build_linker.py | leeeastwood/Haiway | 162 | 11036278 | #!/usr/bin/python
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://moz... |
RecoPPS/Local/python/totemRPLocalReconstruction_cff.py | ckamtsikis/cmssw | 852 | 11036289 | import FWCore.ParameterSet.Config as cms
# clusterization
from RecoPPS.Local.totemRPClusterProducer_cfi import *
# reco hit production
from RecoPPS.Local.totemRPRecHitProducer_cfi import *
# non-parallel pattern recognition
from RecoPPS.Local.totemRPUVPatternFinder_cfi import *
# local track fitting
from RecoPPS.Lo... |
plenum/test/common/test_prepare_batch.py | andkononykhin/plenum | 148 | 11036317 | import json
from plenum.common.prepare_batch import split_messages_on_batches, SPLIT_STEPS_LIMIT
from plenum.common.util import randomString
LEN_LIMIT_BYTES = 100
SERIALIZATION_OTHER_HEAD_BYTES = 10
MAX_ONE_MSG_LEN = LEN_LIMIT_BYTES - SERIALIZATION_OTHER_HEAD_BYTES
def make_batch_func(msgs):
overhead = b'1' * S... |
examples/scripts/experiment_drive_cycle.py | manjunathnilugal/PyBaMM | 330 | 11036332 | <gh_stars>100-1000
#
# Constant-current constant-voltage charge with US06 Drive Cycle using Experiment Class.
#
import pybamm
import pandas as pd
import os
os.chdir(pybamm.__path__[0] + "/..")
pybamm.set_logging_level("INFO")
# import drive cycle from file
drive_cycle_current = pd.read_csv(
"pybamm/input/drive_c... |
scripts/genfont.py | manobendro/Amethyst | 260 | 11036345 | #!/usr/bin/env python
import re
import sys
from os.path import basename, splitext
from PIL import Image
# TODO: parse command line args
PATTERN_WIDTH = 8
PATTERN_HEIGHT = 8
PACK = False
Y_FLIP = 1
X_FLIP = 0
DEINTERLEAVE_16X8_HALVES = False
# reverse bits
def revb(bitpattern, nbits):
out = 0
for _ in xrang... |
got/manager/__init__.py | mstar95/GetOldTweets-python | 1,385 | 11036348 | from TweetCriteria import TweetCriteria
from TweetManager import TweetManager |
examples/afn/lorenz.py | manu-mannattil/nolitsa | 118 | 11036352 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""AFN for time series from the Lorenz attractor.
E1 saturates near an embedding dimension of 3. E2 != 1 at many values
of d. Thus the series is definitely deterministic. The plot matches
Fig. 3 of Cao (1997) rather nicely.
"""
from nolitsa import data, dimension
impo... |
armi/scripts/__init__.py | keckler/armi | 162 | 11036370 | # Copyright 2019 TerraPower, 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 writi... |
tests/__init__.py | nbanmp/seninja | 109 | 11036371 | from . import file_tests
from . import os_linux_tests
from . import os_windows_tests
from . import memory_tests
def handle_test(module, test):
print(test + "\t", end="")
try:
getattr(module, test)()
print("OK")
except Exception as e:
print("ERROR")
# raise e
def handle_mo... |
py/testdir_0xdata_only/test_DeepLearning_c21.py | gigliovale/h2o | 882 | 11036402 | <reponame>gigliovale/h2o
import unittest, time, sys, random, string
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_nn, h2o_cmd, h2o_import as h2i
DO_SUMMARY=False
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
... |
examples/python/web-service/main.py | andrestone/cdk8s | 2,160 | 11036442 | <filename>examples/python/web-service/main.py
#!/usr/bin/env python3
from constructs import Construct
from cdk8s import App, Chart
from imports import k8s
from webservice import WebService
class MyChart(Chart):
def __init__(self, scope: Construct, ns: str):
super().__init__(scope, ns)
WebService(... |
reference/NumpyDL-master/examples/cnn_sentence_classification.py | code4bw/deep-np | 186 | 11036456 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import os
import numpy as np
import npdl
def prepare_data(nb_seq=20):
all_xs = []
all_ys = []
all_words = set()
all_labels = set()
# get all words and labels
with open(os.path.join(os.path.dirname(__file__), 'data/trec/TREC_10.label')) as fin:
... |
custom_components/xiaomi_miot/system_health.py | 7alva7/hass-xiaomi-miot | 919 | 11036470 | """Provide info to system health."""
import os
import json
from homeassistant.components import system_health
from homeassistant.core import HomeAssistant, callback
from .core.const import *
from .core.xiaomi_cloud import MiotCloud
@callback
def async_register(hass: HomeAssistant, register: system_health.SystemHeal... |
note10/test_visualdl.py | zhuyawen/LearnPaddle2 | 163 | 11036471 | <reponame>zhuyawen/LearnPaddle2<filename>note10/test_visualdl.py
# 导入VisualDL的包
from visualdl import LogWriter
# 创建一个LogWriter,第一个参数是指定存放数据的路径,
# 第二个参数是指定多少次写操作执行一次内存到磁盘的数据持久化
logw = LogWriter("./random_log", sync_cycle=10000)
# 创建训练和测试的scalar图,
# mode是标注线条的名称,
# scalar标注的是指定这个组件的tag
with logw.mode('train') as logger... |
api/genie/migrations/0002_runstatus_updatetimestamp.py | zhangkuantian/cuelake | 272 | 11036478 | <reponame>zhangkuantian/cuelake<filename>api/genie/migrations/0002_runstatus_updatetimestamp.py
# Generated by Django 3.2.4 on 2021-07-21 13:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('genie', '0001_initial'),
]
operations = [
mi... |
scripts/schema_to_enums_v201.py | maurerle/ocpp | 257 | 11036479 | <reponame>maurerle/ocpp<gh_stars>100-1000
#!/usr/bin/env python
import sys
import re
import json
from pathlib import Path
enum_types = []
enum_types_names = []
def create_attribute(name):
"""
Gets an attribute name from the enum and convert it to snake_case
"""
# Removes any hyphens or dots from the ... |
tree/YeSheng/101.Symmetric_Tree.py | lidongdongbuaa/leetcode | 1,232 | 11036506 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
"""
Recursively compare subtrees
"""
def is_symmetric(self, root):
return not root or symmetric(root.left, root.right)
def symmetric(node1, node2):
# Using try catch follows python EAFP coding style
try:
... |
src/c3nav/mapdata/migrations/0083_auto_20191227_1642.py | johnjohndoe/c3nav | 132 | 11036523 | <gh_stars>100-1000
# Generated by Django 2.2.8 on 2019-12-27 15:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mapdata', '0082_dynamiclocation_position'),
]
operations = [
migrations.RemoveField(
model_name='position',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.