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 |
|---|---|---|---|---|---|---|---|---|---|---|
tools/defaults.bzl | renovate-bot/angular-bazel-example | 236 | 1746843 | load("@npm_bazel_karma//:defs.bzl", _ts_web_test_suite = "ts_web_test_suite")
def ts_web_test_suite(name, browsers: list[object] = [], tags: list[object] = [], **kwargs):
_ts_web_test_suite(
name = name,
tags = tags + ["native", "no-bazelci"],
browsers = browsers,
**kwargs
)
... | 2 | 0 | 0 | 0 | 2 | 0 |
venv/Lib/site-packages/networkx/readwrite/json_graph/cytoscape.py | amelliaaas/tugastkc4 | 10,024 | 1746859 | <reponame>amelliaaas/tugastkc4
import networkx as nx
__all__ = ["cytoscape_data", "cytoscape_graph"]
def cytoscape_data(G, attrs=None, name="name", ident="id"):
"""Returns data in Cytoscape JSON format (cyjs).
Parameters
----------
G : NetworkX Graph
The graph to convert to cytoscape format
... | 0 | 0 | 0 | 0 | 0 | 0 |
solaris/raster/image.py | rbavery/solaris | 367 | 1746931 | <reponame>rbavery/solaris
from osgeo import gdal
import rasterio
from affine import Affine
import numpy as np
import logging
from ..utils.raster import reorder_axes
from ..utils.log import _get_logging_level
import os
def get_geo_transform(raster_src):
"""Get the geotransform for a raster image source.
Argum... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/perf/metrics/system_memory.py | google-ar/chromium | 777 | 1746951 | <filename>tools/perf/metrics/system_memory.py
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.value import scalar
from metrics import memory
from metrics import Metric
class SystemMemoryM... | 0 | 0 | 0 | 0 | 0 | 0 |
infra/bots/recipe_modules/build/flutter.py | vibeus/skia | 6,304 | 1746953 | # Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from . import util
IMAGES = {
# Used to build Flutter_Android in Debian9, since the underlying build
# scripts require jdk8.
'Debian9': (
... | 0 | 1 | 0 | 0 | 1 | 0 |
PWGJE/EMCALJetTasks/Tracks/analysis/plots/TrackYieldEventPlot.py | maroozm/AliPhysics | 114 | 1746966 | <reponame>maroozm/AliPhysics<gh_stars>100-1000
#**************************************************************************
#* Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
#* *
#* Author: The ALICE Off-line Project. ... | 0 | 0 | 0 | 0 | 0 | 0 |
onnxruntime/core/flatbuffers/create_python_bindings.py | dennyac/onnxruntime | 6,036 | 1746977 | #!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import os
import subprocess
def update_namespace():
# create a copy of the schema so we can replace the namespace so that the generated module name doesn't clash
# with the 'on... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/Unit/Evolution/Systems/Cce/AnalyticSolutions/RotatingSchwarzschild.py | nilsvu/spectre | 117 | 1746993 | <reponame>nilsvu/spectre
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def spherical_metric(sin_theta, cos_theta, t, r, m, f):
return np.array([[(-(1.0 - 2.0 * m / r - f**2 * r**2 * sin_theta**2)), 0.0,
0.0, r**2 * f * sin_theta],
... | 0 | 0 | 0 | 0 | 0 | 0 |
psqlextra/backend/migrations/state/model.py | adamchainz/django-postgres-extra | 529 | 1747002 | from collections.abc import Mapping
from typing import Type
from django.db.migrations.state import ModelState
from django.db.models import Model
from psqlextra.models import PostgresModel
class PostgresModelState(ModelState):
"""Base for custom model states.
We need this base class to create some hooks int... | 0 | 0 | 0 | 0 | 0 | 1 |
lib/_included_packages/plexnet/myplexmanager.py | aleenator/plex-for-kodi | 233 | 1747016 | <gh_stars>100-1000
from __future__ import absolute_import
from xml.etree import ElementTree
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
from . import plexapp
from . import plexconnection
from . import plexserver
from . import myplexrequest
from . import callback
from . import util
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578657_Locate_see_biggest_cross_random_matrix_/recipe-578657.py | tdiprima/code | 2,023 | 1747058 | <gh_stars>1000+
'''
Created on 13 Sep 2013
@author: bakera
'''
import unittest
import numpy as np
import random
from ctypes import *
import sys
if ((sys.platform == 'linux2')):
from termcolor import colored, cprint
def store_value(option, opt_str, value, parser):
setattr(parser.values, option.dest, value... | 0 | 0 | 0 | 0 | 0 | 0 |
launchpad/nodes/base.py | deepmind/launchpad | 264 | 1747100 | <reponame>deepmind/launchpad
# Copyright 2020 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | 0 | 0 | 0 | 0 | 0 | 0 |
solutions/problem_052.py | ksvr444/daily-coding-problem | 1,921 | 1747108 | <reponame>ksvr444/daily-coding-problem<filename>solutions/problem_052.py
class Node:
def __init__(self, key, value):
self.key = key
self.value = value
self.prev = None
self.next = None
class LRU:
def __init__(self, cache_limit):
self.cache_limit = cache_limit
se... | 0 | 0 | 0 | 0 | 0 | 0 |
simple_salesforce/messages.py | nitay-bachrach/simple-salesforce | 1,109 | 1747110 | <reponame>nitay-bachrach/simple-salesforce
""" Salesforce API message templates """
DEPLOY_MSG = \
"""<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:met="http://soap.sforce.com/2006/04/metadata">
<soapenv:Header>
<met:CallOptions>
<met:client>{cli... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/resource/sdm.py | mjuenema/python-terrascript | 507 | 1747117 | <reponame>mjuenema/python-terrascript
# terrascript/resource/sdm.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:26:26 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.resource.sdm
#
# instead of
#
# >>> import terrascript.resource.strongdm.sdm
#
# This is only available for... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration-tests/tests/iam/test_iam.py | bollig/aws-parallelcluster | 415 | 1747130 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... | 0 | 5 | 0 | 0 | 5 | 0 |
src/skiptracer/plugins/fouroneone/__init__.py | EdwardDantes/skiptracer | 912 | 1747157 | from __future__ import annotations
from __future__ import print_function
from __future__ import absolute_import
from ..base import PageGrabber
from ...colors.default_colors import DefaultBodyColors as bc
import re
import logging
try:
import __builtin__ as bi
except BaseException:
import builtins as bi
class F... | 0 | 1 | 0 | 0 | 1 | 0 |
models/pretrainmodel.py | Sergiodiaz53/saint | 208 | 1747164 | <reponame>Sergiodiaz53/saint
from .model import *
class sep_MLP(nn.Module):
def __init__(self,dim,len_feats,categories):
super(sep_MLP, self).__init__()
self.len_feats = len_feats
self.layers = nn.ModuleList([])
for i in range(len_feats):
self.layers.append(simple_MLP([... | 0 | 0 | 0 | 0 | 0 | 0 |
cruds_adminlte/__init__.py | miguelmendez17/django-cruds-adminlte | 351 | 1747167 | <reponame>miguelmendez17/django-cruds-adminlte<filename>cruds_adminlte/__init__.py<gh_stars>100-1000
from .widgets import * # NOQA
| 0 | 0 | 0 | 0 | 0 | 0 |
exceptions/__init__.py | RaczeQ/naive-bayes-classifier | 3,649 | 1747176 | <filename>exceptions/__init__.py<gh_stars>1000+
from .exceptions import * | 0 | 0 | 0 | 0 | 0 | 0 |
ptsemseg/models/linknet.py | yingtao123/PLARD | 122 | 1747201 | <gh_stars>100-1000
import torch.nn as nn
from ptsemseg.models.utils import *
class linknet(nn.Module):
def __init__(self, feature_scale=4, n_classes=21, is_deconv=True, in_channels=3, is_batchnorm=True):
super(linknet, self).__init__()
self.is_deconv = is_deconv
self.in_channels = in_chan... | 0 | 0 | 0 | 0 | 0 | 0 |
dataset/types.py | CHNB128/dataset | 3,152 | 1747203 | from __future__ import annotations
from datetime import datetime, date
from sqlalchemy import Integer, UnicodeText, Float, BigInteger
from sqlalchemy import String, Boolean, Date, DateTime, Unicode, JSON
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.types import TypeEngine, _Binary
MYSQL_LENGTH_TYP... | 1 | 1 | 0 | 0 | 2 | 0 |
example/PrintItStyle/printit_style/core.py | philipsd6/click-plugins | 114 | 1747225 | <reponame>philipsd6/click-plugins
"""
Core components for `PrintItStyle`
"""
import click
COLORS = (
'black',
'red',
'green',
'yellow',
'blue',
'magenta',
'cyan',
'white',
)
@click.command()
@click.argument('infile', type=click.File('r'), default='-')
@click.argument('outfile', typ... | 0 | 0 | 0 | 0 | 0 | 0 |
summer-of-code/week-01/ponies.py | sobia-khalil/toolkitten | 719 | 1747241 | # ponies
| 0 | 0 | 0 | 0 | 0 | 0 |
samples/python/18.bot-authentication/dialogs/logout_dialog.py | Aliacf21/BotBuilder-Samples | 1,998 | 1747243 | <reponame>Aliacf21/BotBuilder-Samples<gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from botbuilder.dialogs import DialogTurnResult, ComponentDialog, DialogContext
from botbuilder.core import BotFrameworkAdapter
from botbuilder.schema import ActivityTypes
... | 0 | 0 | 0 | 0 | 0 | 0 |
.releash.py | vidartf/ipywebrtc | 207 | 1747263 | <reponame>vidartf/ipywebrtc
from releash import *
import glob
# these objects only tag when they are exe
gitpush = ReleaseTargetGitPush()
filenames_python = glob.glob('*')
filenames_python.remove('js')
# filenames_python.remove('notebooks')
package_python = add_package(".", "py", distribution_name='ipywebrtc', filena... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/klampt/math/symbolic_linalg.py | joaomcm/Klampt | 238 | 1747286 | """Defines symbolic linear algebra functions.
Function list:
- norm(x): returns the L-2 norm of a vector
- norm2(x): returns the squared L-2 norm of a vector
- norm_L1(x): returns the L-1 norm of a vector
- norm_Linf(x): returns the L-infinity norm of a vector
- norm_fro(A): returns the Frobeneus norm of a matrix
- ... | 0 | 6 | 0 | 0 | 6 | 0 |
mezzanine/twitter/apps.py | kevinlai219/Mezzanine-Django | 3,053 | 1747293 | <filename>mezzanine/twitter/apps.py
from django.apps import AppConfig
class TwitterConfig(AppConfig):
name = "mezzanine.twitter"
def ready(self):
from . import checks # noqa
| 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib/portfolio_construction/optimizers/nonlinear_function_optimizer.py | webclinic017/qf-lib | 198 | 1747301 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | 6 | 3 | 0 | 0 | 9 | 0 |
src/richie/plugins/lti_consumer/cms_plugins.py | leduong/richie | 174 | 1747302 | <gh_stars>100-1000
"""
LTI consumer CMS plugin
"""
from django.utils.translation import gettext_lazy as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from richie.apps.core.defaults import PLUGINS_GROUP
from .forms import LTIConsumerForm
from .models import LTIConsumer
@plugin_... | 0 | 0 | 0 | 0 | 0 | 0 |
regtests/c++/named_params.py | ahakingdom/Rusthon | 622 | 1747310 | '''
keyword arguments
'''
def f1( a: int=1 ) -> int:
return a*2
## this break rust because the global kwargs-type then requires `b` and `__use__b`
## but the caller only gives `a` and `__use__a`
def f2( a: int=1, b: int=2 ) -> int:
return a + b
def main():
print( f1(a=100) )
#print( f2(a=100, b=200) ) ## TODO f... | 3 | 2 | 0 | 0 | 5 | 0 |
qcodes/tests/test_threading.py | riju-pal/QCoDeS_riju | 223 | 1747314 | <reponame>riju-pal/QCoDeS_riju
"""
Test suite for utils.threading.*
"""
import threading
import time
from collections import defaultdict
from typing import Any
import pytest
from qcodes.instrument.parameter import Parameter, ParamRawDataType
from qcodes.utils.threading import ThreadPoolParamsCaller, call_params_threa... | 0 | 0 | 0 | 0 | 0 | 0 |
angr/analyses/decompiler/peephole_optimizations/single_bit_xor.py | mikenawrocki/angr | 6,132 | 1747321 | <gh_stars>1000+
from ailment.expression import Convert, BinaryOp, Const, UnaryOp
from .base import PeepholeOptimizationExprBase
class SingleBitXor(PeepholeOptimizationExprBase):
__slots__ = ()
name = "bool_expr ^ 1 => !bool_expr (b)"
expr_classes = (Convert, ) # all expressions are allowed
def opt... | 0 | 0 | 0 | 0 | 0 | 0 |
Training CD/IDA Pro/IDA Plug-ins/Selected Plugin Source Code/IDA Sync/ida_sync_server/support/user_manager.py | phoemark2o20/Malware-Analysis-Training | 872 | 1747334 | # IDA Sync Server User Management Class
# Copyright (C) 2005 <NAME> <<EMAIL>>
#
# 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 ... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_generators.py | absanger/sqlacodegen | 960 | 1747339 | <reponame>absanger/sqlacodegen
import sys
from typing import Optional
import pytest
from _pytest.fixtures import FixtureRequest
from sqlalchemy.dialects import mysql, postgresql
from sqlalchemy.engine import Engine, create_engine
from sqlalchemy.schema import (
CheckConstraint, Column, ForeignKey, ForeignKeyConstr... | 0 | 0 | 0 | 0 | 0 | 0 |
survae/tests/transforms/bijections/conditional/autoregressive/autoregressive_splines_2d.py | alisiahkoohi/survae_flows | 262 | 1747342 | import numpy as np
import torch
import torch.nn as nn
import torchtestcase
import unittest
from survae.transforms.bijections.conditional.autoregressive import *
from survae.nn.layers.autoregressive import SpatialMaskedConv2d, MaskedConv2d
from survae.nn.layers import ElementwiseParams, ElementwiseParams2d
from survae.t... | 0 | 1 | 0 | 0 | 1 | 0 |
module/darkexe/lib/encryption.py | tehseensagar/FourEye | 653 | 1747358 | from __future__ import annotations
"""
The aim with these classes is not to provide 100% cryptologically
secure encryption but to provide obsification through encryption.
"""
import random
class XOR(object):
def __init__(self):
super(XOR, self).__init__()
self.gen_key()
def gen_key(self):
... | 3 | 1 | 0 | 0 | 4 | 0 |
gluon/datasets/asr_dataset.py | naviocean/imgclsmob | 2,649 | 1747364 | <filename>gluon/datasets/asr_dataset.py<gh_stars>1000+
"""
Automatic Speech Recognition (ASR) abstract dataset.
"""
__all__ = ['AsrDataset', 'asr_test_transform']
from mxnet.gluon.data import dataset
from mxnet.gluon.data.vision import transforms
from gluon.gluoncv2.models.jasper import NemoAudioReader
class As... | 0 | 0 | 0 | 0 | 0 | 0 |
cellrank/pl/_graph.py | WeilerP/cellrank | 172 | 1747375 | from typing import Any, Dict, Tuple, Union, Callable, Optional, Sequence
from typing_extensions import Literal
from copy import deepcopy
from types import MappingProxyType
from pathlib import Path
from anndata import AnnData
from cellrank import logging as logg
from cellrank._key import Key
from cellrank.ul._docs imp... | 31 | 3 | 0 | 0 | 34 | 0 |
Chapter06/2logistic_function.py | karim7262/Python-Machine-Learning-By-Example | 106 | 1747393 | <reponame>karim7262/Python-Machine-Learning-By-Example
import numpy as np
def sigmoid(input):
return 1.0 / (1 + np.exp(-input))
import matplotlib.pyplot as plt
z = np.linspace(-8, 8, 1000)
y = sigmoid(z)
plt.plot(z, y)
plt.axhline(y=0, ls='dotted', color='k')
plt.axhline(y=0.5, ls='dotted', color='k')
plt.axhli... | 0 | 0 | 0 | 0 | 0 | 0 |
sympy/core/tests/test_rules.py | utkarshdeorah/sympy | 8,323 | 1747417 | from sympy.core.rules import Transform
from sympy.testing.pytest import raises
def test_Transform():
add1 = Transform(lambda x: x + 1, lambda x: x % 2 == 1)
assert add1[1] == 2
assert (1 in add1) is True
assert add1.get(1) == 2
raises(KeyError, lambda: add1[2])
assert (2 in add1) is False
... | 0 | 0 | 0 | 0 | 0 | 0 |
interpretdl/interpreter/transition_attention_maps.py | Christophe-Jia/InterpretDL | 107 | 1747424 |
from __future__ import annotations
import numpy as np
import paddle
import re
from .abc_interpreter import Interpreter
from ..data_processor.readers import preprocess_inputs, preprocess_save_path
from ..data_processor.visualizer import explanation_to_vis, show_vis_explanation, save_image
class TAMInterpreter(Interp... | 10 | 4 | 0 | 1 | 15 | 0 |
mylis/mylis_2/mylis.py | thepabloaguilar/lispy | 118 | 1747462 | #!/usr/bin/env python3
################ mylis: Tiny Scheme Environment in Python 3.10
## Additional runtime support by <NAME> for lis.py by
## <NAME> (c) 2010-18; See http://norvig.com/lispy.html
import functools as ft
import itertools as it
import operator as op
import math
import readline # "unused" import to ena... | 20 | 15 | 0 | 0 | 35 | 0 |
Python/libraries/recognizers-date-time/recognizers_date_time/date_time/chinese/merged_extractor_config.py | AhmedLeithy/Recognizers-Text | 688 | 1747465 | <reponame>AhmedLeithy/Recognizers-Text
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from typing import Pattern, List
from recognizers_text import RegExpUtility
from ...resources.chinese_date_time import ChineseDateTime, BaseDateTime
from ..extractors import DateTime... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/searchforshopping/crowding.py | joinsion/google-api-python-client | 3,469 | 1747478 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014 Google Inc. All Rights Reserved.
"""Query with grouping against the shopping search API"""
import pprint
from googleapiclient.discovery import build
SHOPPING_API_VERSION = 'v1'
DEVELOPER_KEY = '<KEY>'
def main():
"""Get and print a feed of public... | 0 | 0 | 0 | 0 | 0 | 0 |
python/tvm/topi/testing/reorg_python.py | XiaoSong9905/tvm | 4,640 | 1747512 | <filename>python/tvm/topi/testing/reorg_python.py<gh_stars>1000+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under... | 0 | 0 | 0 | 0 | 0 | 0 |
lite/tools/dump_model_mgb.py | Olalaye/MegEngine | 5,168 | 1747513 | <filename>lite/tools/dump_model_mgb.py
# -*- coding: utf-8 -*-
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License")
#
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed... | 0 | 0 | 0 | 0 | 0 | 0 |
astroML/datasets/kelly2007test.py | michaelRadigan/astroML | 735 | 1747519 | <filename>astroML/datasets/kelly2007test.py
"""
Generate input data based on Section 7 in Kelly 2007
"""
import numpy as np
from scipy.stats.distributions import rv_continuous
__all__ = ['simulation_kelly']
class simulation_dist(rv_continuous):
def _pdf(self, x):
# eq 110
return 0.796248 * np... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | senysenyseny16/pytorch-OpCounter | 3,444 | 1747537 | <gh_stars>1000+
#!/usr/bin/env python
import os, sys
import shutil
import datetime
from setuptools import setup, find_packages
from setuptools.command.install import install
readme = open('README.md').read()
VERSION = '0.0.4'
requirements = [
'torch',
]
# import subprocess
# commit_hash = subprocess.check_outp... | 0 | 0 | 0 | 0 | 0 | 0 |
nurses_2/widgets/line_plot/line_plot.py | salt-die/nurses_2 | 171 | 1747540 | import numpy as np
from ...colors import Color
from ...io import MouseEvent, MouseEventType
from ..text_widget import TextWidget, SizeHint, Anchor, Size
from ..scroll_view import ScrollView
from ._legend import _Legend
from ._traces import _Traces, TICK_WIDTH, TICK_HALF
PLOT_SIZES = [SizeHint(x, x) for x in (1.0, 1.2... | 11 | 1 | 0 | 4 | 16 | 0 |
test/custom-concat.py | moroten/scons | 1,403 | 1747548 | <filename>test/custom-concat.py
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use... | 0 | 0 | 0 | 0 | 0 | 0 |
model/attention/SKAttention.py | Nitin-Mane/External-Attention-pytorch | 4,466 | 1747550 | import numpy as np
import torch
from torch import nn
from torch.nn import init
from collections import OrderedDict
class SKAttention(nn.Module):
def __init__(self, channel: int=512,kernels: list[int]=[1,3,5,7],reduction: int=16,group: int=1,L: int=32):
super().__init__()
self.d=max(L,channel//re... | 5 | 1 | 0 | 0 | 6 | 0 |
t/unit/utils/test_debug.py | 7Geese/kombu | 5,079 | 1747571 | <reponame>7Geese/kombu<gh_stars>1000+
from __future__ import absolute_import, unicode_literals
import logging
from case import Mock, patch
from kombu.five import bytes_if_py2
from kombu.utils.debug import Logwrapped, setup_logging
class test_setup_logging:
def test_adds_handlers_sets_level(self):
with... | 0 | 0 | 0 | 0 | 0 | 0 |
pydis_site/apps/api/models/bot/role.py | Robin5605/site | 700 | 1747593 | <filename>pydis_site/apps/api/models/bot/role.py
from __future__ import annotations
from django.core.validators import MinValueValidator
from django.db import models
from pydis_site.apps.api.models.mixins import ModelReprMixin
class Role(ModelReprMixin, models.Model):
"""
A role on our Discord server.
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/iu_test_support.py | bsmith76s/irrigation_unlimited | 114 | 1747596 | import logging
from datetime import datetime, timedelta
import homeassistant.core as ha
from custom_components.irrigation_unlimited.irrigation_unlimited import (
IUCoordinator,
)
_LOGGER = logging.getLogger(__name__)
test_config_dir = "tests/configs/"
NO_CHECK: bool = False
# Shh, quiet now.
def quiet_mode() -... | 23 | 8 | 1 | 0 | 32 | 0 |
gaze_estimation/models/mpiigaze/lenet.py | hysts/pytorch_mpiigaze | 240 | 1747603 | <filename>gaze_estimation/models/mpiigaze/lenet.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import yacs.config
def initialize_weights(module: torch.nn.Module) -> None:
if isinstance(module, nn.Conv2d):
nn.init.zeros_(module.bias)
elif isinstance(module, nn.Linear):
nn... | 0 | 0 | 0 | 0 | 0 | 0 |
functional/io.py | maestro-1/PyFunctional | 1,995 | 1747612 | from __future__ import annotations
import gzip
import lzma
import bz2
import io
import builtins
WRITE_MODE = "wt"
class ReusableFile(object):
"""
Class which emulates the builtin file except that calling iter() on it will return separate
iterators on different file handlers (which are automatically clos... | 40 | 7 | 4 | 0 | 51 | 0 |
enable_mfa.py | mrklees/robinhood-python | 106 | 1747619 | #!/usr/bin/env python3
import argparse
import json
from robinhood.RobinhoodCachedClient import RobinhoodCachedClient, FORCE_LIVE
# Set up the client
client = RobinhoodCachedClient()
client.login()
SMS = 'sms'
APP = 'app'
def enable_mfa(mfa_source):
if mfa_source == APP:
request_mfa_details = client.request_a... | 0 | 0 | 0 | 0 | 0 | 0 |
src/blpapi/debug.py | msitt/blpapi-python | 228 | 1747628 | <reponame>msitt/blpapi-python
# debug.py
"""Provide debugging information for import errors"""
import platform
import os
from .debug_environment import get_env_diagnostics
def debug_load_error(error):
"""Called when the module fails to import "internals".
Returns ImportError with some debugging message.
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/testapp/settings.py | leonardo-modules/leonardo-feature-switcher | 102 | 1747632 |
APP_SPECIFIC_SETTINGS = True
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/average_meter_helper.py | Puzer/SiamMask | 3,503 | 1747649 | # --------------------------------------------------------
# SiamMask
# Licensed under The MIT License
# Written by <NAME> (wangqiang2015 at ia.ac.cn)
# --------------------------------------------------------
from __future__ import annotations
import numpy as np
class Meter(object):
def __init__(self, name, val,... | 1 | 9 | 0 | 0 | 10 | 0 |
InvenTree/order/migrations/0052_auto_20211014_0631.py | carlos-riquelme/InvenTree | 656 | 1747658 | <gh_stars>100-1000
# Generated by Django 3.2.5 on 2021-10-14 06:31
import re
from django.db import migrations
def build_refs(apps, schema_editor):
"""
Rebuild the integer "reference fields" for existing Build objects
"""
PurchaseOrder = apps.get_model('order', 'purchaseorder')
for order in Purc... | 0 | 0 | 0 | 0 | 0 | 0 |
word2word/utils.py | xerevity/word2word | 203 | 1747669 | # -*- coding: utf-8 -*-
from __future__ import annotations
import platform
import wget
import requests
import os
import pickle
from zipfile import ZipFile
from os.path import expanduser
def get_savedir(savedir: object | None=None) -> object:
if savedir:
os.makedirs(savedir, exist_ok=True)
return s... | 1 | 5 | 0 | 0 | 6 | 0 |
tests/test_github.py | stackriot-labs/gitsome | 7,986 | 1747674 | # -*- coding: utf-8 -*-
# Copyright 2015 <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. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license" f... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/click/06_arguments.py | dwreeves/rich-click | 185 | 1747679 | import rich_click as click
# Show the positional arguments
click.rich_click.SHOW_ARGUMENTS = True
# Uncomment this line to group the arguments together with the options
# click.rich_click.GROUP_ARGUMENTS_OPTIONS = True
@click.command()
@click.argument("input", type=click.Path(), required=True)
@click.option(
"--... | 0 | 0 | 0 | 0 | 0 | 0 |
textualheatmap/textual_heatmap.py | VenkteshV/python-textualheatmap | 183 | 1747682 |
import uuid
import json
import os.path as path
import IPython
web_assets_dir = path.join(path.dirname(path.realpath(__file__)), 'web_assets')
class TextualHeatmap:
"""Create interactive textual heatmaps for Jupiter notebooks.
This is useful for PyTorch or pure TensorFlow. You should properly use
`KerasL... | 6 | 1 | 0 | 2 | 9 | 0 |
tests/transforms/test_hamiltonian_expand.py | camponogaraviera/pennylane | 539 | 1747684 | # Copyright 2018-2020 Xanadu Quantum Technologies 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... | 0 | 2 | 0 | 0 | 2 | 0 |
CalibMuon/RPCCalibration/python/ALCARECORpcCalHLT_Output_cff.py | ckamtsikis/cmssw | 852 | 1747705 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
OutALCARECORpcCalHLT_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('pathALCARECORpcCalHLT')
),
outputCommands = cms.untracked.vstring(
'keep *_muonDTDigis_*_*',
'keep CSCDetIdCSCWireDigiM... | 0 | 0 | 0 | 0 | 0 | 0 |
legacy/api/model.py | fkautz/gordon | 106 | 1747708 | <filename>legacy/api/model.py
class Sender(object):
def __init__(self):
pass
def from_json(self, json):
pass
class User(object):
def __init__(self):
pass
def from_json(self, json):
self.login = json.get("login")
class Repository(object):
def __init__(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
ofa/stereo_matching/networks/cost.py | blackjack2015/once-for-all | 388 | 1747709 | import torch
import torch.nn as nn
class CostVolume(nn.Module):
def __init__(self, max_disp, feature_similarity: str='correlation'):
"""Construct cost volume based on different
similarity measures
Args:
max_disp: max disparity candidate
feature_similarity: type of ... | 2 | 2 | 0 | 0 | 4 | 0 |
tests/forms.py | kptac/django-measurement | 118 | 1747719 | from django import forms
from django_measurement.forms import MeasurementField
from tests.custom_measure_base import DegreePerTime, Temperature, Time
from tests.models import MeasurementTestModel
class MeasurementTestForm(forms.ModelForm):
class Meta:
model = MeasurementTestModel
exclude: list[ob... | 0 | 0 | 1 | 0 | 1 | 0 |
masr/masr/decoders/swig_wrapper.py | 2091527886/mockbirdremark | 177 | 1747722 | from __future__ import annotations
"""Wrapper for various CTC decoders in SWIG."""
import swig_decoders
class Scorer(swig_decoders.Scorer):
"""Wrapper for Scorer.
:param alpha: 与语言模型相关的参数。当alpha = 0时不要使用语言模型
:type alpha: float
:param beta: 与字计数相关的参数。当beta = 0时不要使用统计字
:type beta: float
:model... | 8 | 3 | 0 | 0 | 11 | 0 |
panel/layout/__init__.py | sthagen/holoviz-panel | 601 | 1747729 | """
Layout
======
Layouts can layout your python objects and panel components.
Most layouts behave as the Python containers you already know. For example
`Column` and `Row` behaves as lists. I.e. they have a list-like API with
methods to `append`, `extend`, `clear`, `insert`, `pop`, `remove` and
`__setitem__`, which ... | 0 | 0 | 0 | 0 | 0 | 0 |
opencga-app/app/misc/demo/1000G_yml_generator.py | mwhamgenomics/opencga | 146 | 1747744 | <reponame>mwhamgenomics/opencga
#!/usr/bin/env python
import sys
import argparse
_SEX = {
'0': 'UNKNOWN',
'1': 'MALE',
'2': 'FEMALE'
}
_KAR_SEX = {
'0': None,
'1': 'XY',
'2': 'XX'
}
_VARIABLE_FIELDS = ['Relationship', 'Siblings', 'Second Order', 'Third Order', 'Other Comments']
FNAME_TEMPLA... | 0 | 0 | 0 | 0 | 0 | 0 |
src/qrl/core/misc/DependencyChecker.py | scottdonaldau/QRL | 441 | 1747748 | <filename>src/qrl/core/misc/DependencyChecker.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import os
import pkg_resources
class DependencyChecker:
@staticmethod
def _get_requirements_path():
return os.path.abspath(os.path.join(os.path.dirname(__file__),
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sos_notebook/test_utils.py | andrewcrook/sos-notebook | 147 | 1747756 | #!/usr/bin/env python3
#
# Copyright (c) <NAME> and the University of Texas MD Anderson Cancer Center
# Distributed under the terms of the 3-clause BSD License.
#
# NOTE: for some namespace reason, this test can only be tested using
# nose.
from __future__ import annotations
import asyncio
import atexit
import os
impo... | 54 | 36 | 0 | 0 | 90 | 0 |
camply/config/yellowstone_config.py | stjohnjohnson/camply | 123 | 1747764 | #!/usr/bin/env python3
# Author:: <NAME> (mailto:<EMAIL>)
"""
Project Configuration for Yellowstone Variables
"""
import logging
from typing import Dict, List, Tuple
from .data_columns import DataColumns
logger = logging.getLogger(__name__)
class YellowstoneConfig(DataColumns):
"""
Variable Storage C... | 0 | 0 | 41 | 0 | 41 | 0 |
YouXin/app.py | wangzhenjjcn/SZZT_SPIDERS | 103 | 1747777 | #coding=utf-8
import urllib2,sys,time,datetime,os,pymysql.cursors
from setting import headers, domain, start_url, file_output
read_file=open("readed.txt","a")
alldatas={}
readed_file = open("readed.txt","r")
for lines in readed_file:
data = lines.strip("\n")
alldatas[data]="readed"
connection = pymysq... | 0 | 0 | 0 | 0 | 0 | 0 |
test-framework/test-suites/unit/tests/command/stack/commands/set/firmware/model/version_regex/test_command_stack_commands_set_firmware_model_version_regex_plugin_basic.py | kmcm0/stacki | 123 | 1747804 | <reponame>kmcm0/stacki
from unittest.mock import create_autospec, ANY, patch, call
import pytest
from stack.commands import DatabaseConnection
from stack.commands.set.firmware.model.version_regex import Command
from stack.exception import CommandError
from stack.commands.set.firmware.model.version_regex.plugin_basic im... | 0 | 0 | 0 | 0 | 0 | 0 |
outrun/filesystem/fuse/fuse.py | Jacke/outrun | 3,070 | 1747809 | """
Module with ctypes bindings for the high-level FUSE 3.x API.
These are based on the following libfuse headers:
* fuse/fuse.h
* fuse/fuse_common.h
* fuse/fuse_opt.h
Currently the implementation assumes an x86-64 system.
"""
import ctypes
import ctypes.util
from enum import Enum
#
# Helpers
#
def struct_to_dic... | 3 | 2 | 7 | 0 | 12 | 0 |
guietta/__init__.py | shramay-palta/Python-GUIs | 1,984 | 1747816 | <filename>guietta/__init__.py
# -*- coding: utf-8 -*-
from .guietta import *
from .guietta import _, ___
from .guietta import _alsoAcceptAnotherGui # Used by submodules
from .__version__ import __version__
| 0 | 0 | 0 | 0 | 0 | 0 |
unicode/servers/signs_test.py | fluentpython/concurrency | 102 | 1747832 | import pytest
import itertools
from signs import named_chars, build_index
@pytest.fixture
def first_5() -> list[tuple[str, str]]:
return [(' ', 'SPACE'),
('!', 'EXCLAMATION MARK'),
('"', 'QUOTATION MARK'),
('#', 'NUMBER SIGN'),
('$', 'DOLLAR SIGN')]
... | 0 | 1 | 0 | 0 | 1 | 0 |
unstable/run.py | mugheesahmad/pytoflow | 102 | 1747840 | <reponame>mugheesahmad/pytoflow
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# import torch.utils.serialization # it was removed in torch v1.0.0 or higher version.
import math
import PIL
from Network import TOFlow
import matplotlib.pyplot as plt
import sys
import ge... | 0 | 0 | 0 | 0 | 0 | 0 |
torchensemble/utils/operator.py | snuml2021tmp/Ensemble-Pytorch | 217 | 1747849 | """This module collects operations on tensors used in Ensemble-PyTorch."""
import torch
import torch.nn.functional as F
__all__ = [
"average",
"sum_with_multiplicative",
"onehot_encoding",
"pseudo_residual_classification",
"pseudo_residual_regression",
]
def average(outputs) -> object:
"""... | 0 | 5 | 0 | 0 | 5 | 0 |
src/Documentation/Summarizer/summarize_documentation.py | AndreyTretyak/qsharp-compiler | 626 | 1747852 | #!/usr/bin/env python
# -*- coding: utf8 -*-
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from collections import defaultdict
from dataclasses import dataclass, asdict, field
from pathlib import Path
from typing import Set, Union
import glob
import click
import frontmatter
try:
import ... | 8 | 4 | 10 | 0 | 22 | 0 |
rest-service/manager_rest/resolver_with_catalog_support.py | ilan-WS/cloudify-manager | 124 | 1747854 | <reponame>ilan-WS/cloudify-manager
#########
# Copyright (c) 2018 Cloudify Platform Ltd. 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/li... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/lessons/lesson04_ticks.py | jayvdb/live-py-plugin | 224 | 1747857 | """
Current ticks are not ideal because they do not show the
interesting values (+/-pi,+/-pi/2) for sine and cosine. We'll
change them such that they show only these values.
:lesson goal file: goal04.py
"""
# Imports
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-np.pi, np.pi, 256, endpoint=True)... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/python/unittest/test_pass_split_host_device.py | wix-playground/incubator-tvm | 286 | 1747885 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 0 | 0 | 0 | 0 | 0 | 0 |
Examples/Modules/ParticleBoundaryScrape/analysis_scrape.py | oshapoval/WarpX | 131 | 1747888 | #! /usr/bin/env python
import yt
from pathlib import Path
# This test shoots a beam of electrons at cubic embedded boundary geometry
# At time step 40, none of the particles have hit the boundary yet. At time
# step 60, all of them should have been absorbed by the boundary. In the
# absence of the cube, none of the p... | 0 | 0 | 0 | 0 | 0 | 0 |
Hinting/Set blueScale.py | justanotherfoundry/Glyphs-Scripts | 283 | 1747899 | #MenuTitle: Set blueScale
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Sets maximum blueScale value (determining max size for overshoot suppression) possible in Font Info > Font. Outputs other options in Macro Window.
"""
def maxZoneInFont( thisFont ) -> object:... | 0 | 5 | 0 | 0 | 5 | 0 |
arch/api/proto/inference_service_pb2.py | chenj133/FATE | 3,787 | 1747905 | <gh_stars>1000+
#
# Copyright 2019 The FATE 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
pgoapi/protos/pogoprotos/networking/requests/messages/get_map_objects_message_pb2.py | aroo135/pgoapi | 842 | 1747938 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/messages/get_map_objects_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _... | 0 | 0 | 0 | 0 | 0 | 0 |
1 File handle/File handle binary/Deleting record in a binary file.py | sulphatet/Python | 28,321 | 1747953 | import pickle
def Bdelete():
# Opening a file & loading it
F= open("studrec.dat","rb")
stud = pickle.load(F)
F.close()
print(stud)
# Deleting the Roll no. entered by user
rno= int(input("Enter the Roll no. to be deleted: "))
F= open("studrec.dat","wb")
rec= []... | 0 | 0 | 0 | 0 | 0 | 0 |
third-party/skylark/bazel-skylib/lib/structs.bzl | Unknoob/buck | 8,027 | 1747964 | # Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/spot/savings/test_savings_interest_history.py | Banging12/binance-connector-python | 512 | 1747966 | <gh_stars>100-1000
import responses
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
key = random_str()
secret = random_str()
def test_savings_int... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/h/services/auth_token_test.py | BearerPipelineTest/h | 2,103 | 1747967 | <reponame>BearerPipelineTest/h
import datetime
import pytest
from pytest import param
from h.services.auth_token import (
AuthTokenService,
LongLivedToken,
auth_token_service_factory,
)
class TestAuthTokenService:
def test_validate_returns_database_token(self, svc, factories):
token_model = ... | 0 | 0 | 0 | 0 | 0 | 0 |
MachineLearning/project/02_face_detetion/detector.py | fengjixuchui/EmbeddedSystem | 228 | 1748008 | import os
import argparse
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data.sampler import SubsetRandomSampler
from .generate_train_dataset import get_train_test_set
torch.set_default_tensor_type(torch.FloatTensor)
class Net(nn.Module):
def __init__(self):
super(Net, se... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/contrib/set_covering_deployment.py | AlohaChina/or-tools | 8,273 | 1748014 | # Copyright 2010 <NAME> <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 by applicable law or agreed to in writin... | 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib/documents_utils/excel/excel_importer.py | webclinic017/qf-lib | 198 | 1748050 | <filename>qf_lib/documents_utils/excel/excel_importer.py
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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 Licens... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/math/min_max_sum.py | Khushboo85277/NeoAlgo | 897 | 1748083 | <reponame>Khushboo85277/NeoAlgo
'''
Given five positive integers, the aim is to find the minimum and maximum values that can be calculated by summing exactly four of the five integers.
'''
def MMSum(a):
# sorting the array so that it becomes easier to find the min and max set of values
a.sort()
... | 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.