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 |
|---|---|---|---|---|
betting.py | Carterbouley/football-predictor | 189 | 11177898 | def test_betting_stategy(predictions, test_features, test_labels, bet_difference=0.05):
result = {
'spend': 0,
'return': 0,
}
for i in range(0, len(predictions)):
probabilities = predictions[i]['probabilities']
if probabilities[1] > (1 / test_features['odds-draw'][i]) + bet... |
examples/ranking_others.py | khalillakhdhar/recommander_python | 407 | 11177912 | """
Running item recommendation algorithms
"""
from caserec.recommenders.item_recommendation.bprmf import BprMF
tr = '../../datasets/ml-100k/folds/0/train.dat'
te = '../../datasets/ml-100k/folds/0/test.dat'
BprMF(tr, te, batch_size=30).compute()
|
server/models.py | nathandarnell/sal | 215 | 11177918 | import plistlib
import random
import string
from datetime import datetime
from xml.parsers.expat import ExpatError
import pytz
from dateutil.parser import parse
from ulid2 import generate_ulid_as_uuid
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
from util... |
modules/intelligence-gathering/dnstwist.py | decidedlygray/ptf | 4,391 | 11177928 | #!/usr/bin/env python
#####################################
# Installation module for dnstwist
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="<NAME> (ninewires)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update dnstwist - Domain name permutation engine for detecting homo... |
resources.py | lokitold/lambdachat | 416 | 11177948 | #!/usr/bin/env python
"""
Script to generate a CloudFormation Template that brings up all of the AWS
resources needed to run lambda-chat
This requires Python 2.7. To get the required libraries:
sudo pip install docopt boto troposphere awacs pyyaml --upgrade
Usage:
resources.py cf
resources.py launch --region=<r... |
scripts/unfuck-path.py | kasymovga/taisei | 573 | 11177969 | #!/usr/bin/env python3
from taiseilib.common import (
run_main,
)
from pathlib import Path, PureWindowsPath, PurePosixPath
import sys
def main(args):
import argparse
parser = argparse.ArgumentParser(description='Because Windows is the worst.', prog=args[0])
parser.add_argument('path',
help... |
env/lib/python3.4/site-packages/bulbs/tests/gremlin_tests.py | mudbungie/NetExplorer | 234 | 11177989 | import unittest
from .testcase import BulbsTestCase
class GremlinTestCase(BulbsTestCase):
def setUp(self):
# self.client = RexsterClient()
# self.vertex_type = "vertex"
# self.edge_type = "edge"
#raise NotImplemented
pass
def test_gremlin(self):
# limi... |
esmvaltool/cmorizers/obs/cmorize_obs_ceres_ebaf.py | cffbots/ESMValTool | 148 | 11178019 | <filename>esmvaltool/cmorizers/obs/cmorize_obs_ceres_ebaf.py<gh_stars>100-1000
"""ESMValTool CMORizer for CERES-EBAF data.
Tier
Tier 2: other freely-available dataset.
Source
https://ceres-tool.larc.nasa.gov/ord-tool/jsp/EBAF4Selection.jsp
Last access
20191126
Download and processing instructions
Se... |
Examples/AppKit/Todo/ToDoCell.py | Khan/pyobjc-framework-Cocoa | 132 | 11178050 | <gh_stars>100-1000
from Cocoa import *
NOT_DONE=0
DONE=1
DEFERRED=2
class ToDoCell (NSButtonCell):
__slots__ = ('_triState', '_doneImage', '_deferredImage', '_timeDue' )
def init(self):
self._triState = NOT_DONE
self._timeDue = None
self._doneImage = None
self._deferredImage ... |
ttskit/makefile.py | shuahs/ttskit | 247 | 11178065 | from pathlib import Path
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(Path(__file__).stem)
import os
import datetime
def make_document():
"""生成模块脚本的说明文档。"""
code_dir = Path(__file__).parent
doc_path = code_dir.joinpath('document.txt')
with doc_path.open('wt', enc... |
Chapter11/CreateDataLake.py | VinushaVemuri/learn | 185 | 11178095 | from faker import Faker
import json
import os
os.chdir("/home/paulcrickard/datalake")
fake=Faker()
userid=1
for i in range(1000):
name=fake.name()
fname=name.replace(" ","-")+'.json'
data={
"userid":userid,
"name":name,
"age":fake.random_int(min=18, max=101, step=1),
"street"... |
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/NotifyFwUpgradeResultDTO.py | yuanyi-thu/AIOT- | 128 | 11178111 | class NotifyFwUpgradeResultDTO(object):
def __init__(self):
self.notifyType = None
self.deviceId = None
self.appId = None
self.operationId = None
self.subOperationId = None
self.curVersion = None
self.targetVersion = None
self.sourceVersion = None
... |
source/openqasm/visitor.py | shiyunon/openqasm | 603 | 11178159 | <reponame>shiyunon/openqasm<filename>source/openqasm/visitor.py
from typing import Optional, TypeVar, Generic
from openqasm.ast import QASMNode
T = TypeVar("T")
class QASMVisitor(Generic[T]):
"""
A node visitor base class that walks the abstract syntax tree and calls a
visitor function for every node fo... |
zippy/edu.uci.python.test/src/tests/generator-yield-expression-test.py | lucapele/pele-c | 319 | 11178178 | <reponame>lucapele/pele-c<filename>zippy/edu.uci.python.test/src/tests/generator-yield-expression-test.py
# zwei 06/28/2014
# generator that yields a built-in constructor with a generator expression argument
def generator(n):
for i in range(n):
x = yield i * 2
print(x)
gen = generator(5)
it = 0
gen.__next__()
t... |
test/layers/operations/test_norm.py | dawnclaude/onnx2keras | 115 | 11178195 | import torch.nn as nn
import torch
import numpy as np
import pytest
from test.utils import convert_and_test
class FNormTest(nn.Module):
"""
Test for nn.functional types
"""
def __init__(self, dim, keepdim):
super(FNormTest, self).__init__()
self.dim = dim
self.keepdim = keepd... |
01_mysteries_of_neural_networks/06_numpy_convolutional_neural_net/src/activation/relu.py | angliu-bu/ILearnDeepLearning.py | 1,093 | 11178206 | <reponame>angliu-bu/ILearnDeepLearning.py<gh_stars>1000+
import numpy as np
from src.base import Layer
class ReluLayer(Layer):
def __init__(self):
self._z = None
def forward_pass(self, a_prev: np.array, training: bool) -> np.array:
"""
:param a_prev - ND tensor with shape (n, ..., ch... |
blender/arm/logicnode/animation/LN_set_bone_fk_ik_only.py | onelsonic/armory | 2,583 | 11178216 | <filename>blender/arm/logicnode/animation/LN_set_bone_fk_ik_only.py
from arm.logicnode.arm_nodes import *
class SetBoneFkIkOnlyNode(ArmLogicTreeNode):
"""Set particular bone to be animated by Forward kinematics or Inverse kinematics only. All other animations will be ignored"""
bl_idname = 'LNSetBoneFkIkOnlyNo... |
docpkg/config.py | icgood/continuous-docs | 336 | 11178228 | <filename>docpkg/config.py
"""This module contains the configuration routines."""
from typing import Optional, TypeVar
T = TypeVar('T')
class MyConfig:
"""Loads and manages the configuration.
Args:
filename: The filename to load configs from.
"""
def __init__(self, filename: str) -> None:... |
janitor/functions/coalesce.py | farhanreynaldo/pyjanitor | 674 | 11178261 | from typing import Optional, Union
import pandas as pd
import pandas_flavor as pf
from janitor.utils import check, deprecated_alias
from janitor.functions.utils import _select_column_names
@pf.register_dataframe_method
@deprecated_alias(columns="column_names", new_column_name="target_column_name")
def coalesce(
... |
pymtl3/passes/backends/verilog/test/TranslationImport_adhoc_test.py | jbrzozo24/pymtl3 | 152 | 11178277 | <filename>pymtl3/passes/backends/verilog/test/TranslationImport_adhoc_test.py
#=========================================================================
# TranslationImport_adhoc_test.py
#=========================================================================
# Author : <NAME>
# Date : Jun 5, 2019
"""Test ad-hoc co... |
src/lib/attacks/arp_spoof/arp_spoofer.py | FrancescoPenasa/vault_scanner | 230 | 11178293 | #! /usr/bin/python
import subprocess
import os
import re
import colors
import sys
import time
import scapy.all as scapy
from io import StringIO
class ARPSpoof(object):
def __init__(self, ip=None):
self.target_ip = None
self.router_ip = None
self.target_mac = None
self.router_mac... |
leo/modes/scala.py | ATikhonov2/leo-editor | 1,550 | 11178323 | # Leo colorizer control file for scala mode.
# This file is in the public domain.
# Properties for scala mode.
properties = {
"commentEnd": "*/",
"commentStart": "/*",
"doubleBracketIndent": "false",
"indentCloseBrackets": "}",
"indentOpenBrackets": "{",
"indentPrevLine": "\\s*(((if|w... |
tests/utils/method_test_case.py | VeliborKrivokuca/batavia | 1,256 | 11178330 | <filename>tests/utils/method_test_case.py<gh_stars>1000+
from .adjust_code import adjust
from .expected_failure import NotImplementedToExpectedFailure
from .samples import SAMPLE_DATA, SAMPLE_SUBSTITUTIONS
def _one_arg_method_test(name, module, cls_, f, examples):
def func(self):
self.assertOneArgMethod(
... |
pifpaf/drivers/qdrouterd.py | OmarTrigui/pifpaf | 181 | 11178345 | # 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, software
# distributed under the... |
mac/pyobjc-core/PyObjCTest/test_convenience.py | albertz/music-player | 132 | 11178366 | from PyObjCTools.TestSupport import *
import objc
import objc._convenience as convenience
class TestConvenienceHelpers (TestCase):
def test_add_for_selector(self):
methods = [
('add', lambda self, x: self.testMethod_(x))
]
with filterWarnings("error", DeprecationWarning):
... |
tests/base_ming.py | tcmike/depot | 128 | 11178377 | from __future__ import absolute_import
import os
import ming
from ming import Session
from ming.odm import ThreadLocalODMSession
from ming import create_datastore
from depot.fields.ming import DepotExtension
mainsession = Session()
DBSession = ThreadLocalODMSession(mainsession, extensions=(DepotExtension, ))
database... |
pyocd/probe/common.py | claymation/pyOCD | 276 | 11178378 | # pyOCD debugger
# Copyright (c) 2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# ... |
wt5/wt5/metrics.py | deepneuralmachine/google-research | 23,901 | 11178381 | <reponame>deepneuralmachine/google-research
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... |
ppapi/generators/idl_visitor.py | zealoussnow/chromium | 14,668 | 11178394 | # Copyright (c) 2012 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.
""" Visitor Object for traversing AST """
#
# IDLVisitor
#
# The IDLVisitor class will traverse an AST truncating portions of the tree
# when 'VisitFilt... |
gordon/resources/s3.py | patgoley/gordon | 2,204 | 11178395 | import re
from collections import defaultdict, Counter
import six
import troposphere
from troposphere import sqs, sns, awslambda
from . import base
from gordon import exceptions
from gordon import utils
from gordon.actions import Ref
from gordon.contrib.s3.resources import (
S3BucketNotificationConfiguration,
... |
tests/test_overrides.py | alexmusa/adt | 153 | 11178422 | <filename>tests/test_overrides.py
import unittest
from adt import Case, adt
from tests import helpers
from typing import Callable, Optional, TypeVar
_T = TypeVar('_T')
def optionality(x: _T) -> Optional[_T]:
return x
@adt
class OverriddenAccessors:
INTVALUE: Case[int]
STRVALUE: Case[str]
@propert... |
src/sage/monoids/hecke_monoid.py | bopopescu/sage | 1,742 | 11178524 | <reponame>bopopescu/sage
# -*- coding: utf-8 -*-
"""
Hecke Monoids
"""
#*****************************************************************************
# Copyright (C) 2015 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public License (GPL)
# http://www.gnu.org/lice... |
lib/hachoir/parser/archive/lzx.py | 0x20Man/Watcher3 | 320 | 11178525 | """LZX data stream parser.
Also includes a decompression function (slow!!) which can decompress
LZX data stored in a Hachoir stream.
Author: <NAME>
Creation date: July 18, 2007
"""
from hachoir.parser import Parser
from hachoir.field import (FieldSet,
UInt32, Bit, Bits, PaddingBits,
... |
Unix/scriptext/py/setup.py | Beguiled/omi | 165 | 11178557 | <filename>Unix/scriptext/py/setup.py<gh_stars>100-1000
import os
from distutils.core import setup, Extension
#hardcoded directory, need to be updated
dirs = "/tmp/omi-latest"
setup(name='PMI_Instance',version = '1.0', ext_modules = [Extension('mi.PMI_Instance',sources=['PMI_Instance.c'],extra_compile_args=['-O0'... |
tests/components/sensibo/__init__.py | MrDelik/core | 22,481 | 11178558 | <reponame>MrDelik/core
"""Tests for the Sensibo integration."""
|
PhysicsTools/PatExamples/python/JetEnergyShift_cfi.py | ckamtsikis/cmssw | 852 | 11178574 | import FWCore.ParameterSet.Config as cms
scaledJets = cms.EDProducer("JetEnergyShift",
inputJets = cms.InputTag("cleanPatJets"),
inputMETs = cms.InputTag("patMETs"),
scaleFactor = cms.double(1.0),
jetPTThresholdForMET = cms.double(20.),
jetEMLimitForMET = cms.doub... |
tablib/packages/xlwt/examples/hyperlinks.py | rhunwicks/tablib | 372 | 11178577 | #!/usr/bin/env python
# -*- coding: windows-1251 -*-
# Copyright (C) 2005 <NAME>
from xlwt import *
f = Font()
f.height = 20*72
f.name = 'Verdana'
f.bold = True
f.underline = Font.UNDERLINE_DOUBLE
f.colour_index = 4
h_style = XFStyle()
h_style.font = f
w = Workbook()
ws = w.add_sheet('F')
##############
## NOTE: p... |
scripts/zile/zile.py | upenderadepu/crimson | 108 | 11178588 | # github.com/xyele
import os,sys,re,requests,random
from termcolor import colored
from concurrent.futures import ThreadPoolExecutor
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# Base Variables
colors = ["red","green","yellow... |
src/utility/convert_software_call.py | ocatak/malware_api_class | 172 | 11178596 | <reponame>ocatak/malware_api_class<filename>src/utility/convert_software_call.py
from common.HashMap import HashMap
file = open("source/CallApiMap.txt", "r")
map = HashMap()
for line in file:
line = line.strip()
if line == "":
continue
splitted = line.split("=")
print(line)
... |
pyexfil/physical/audio/exfiltrator.py | goffinet/PyExfil | 603 | 11178622 | <reponame>goffinet/PyExfil
#!/usr/bin/python
from __future__ import division #Avoid division problems in Python 2
import sys
import math
import zlib
import base64
import pyaudio
PyAudio = pyaudio.PyAudio
BITRATE = 14400
RATE = 16000
class Exfiltrator():
def __init__(self, file_path):
self.file_path = fi... |
python-package/setup.py | Priveyes/tgboost | 350 | 11178632 | <filename>python-package/setup.py<gh_stars>100-1000
from distutils.core import setup
setup(
name='tgboost',
version='1.0',
description='tiny gradient boosting tree',
author='wepon',
author_email='<EMAIL>',
url='http://wepon.me',
packages=['tgboost'],
package_data={'tgboost': ['tgboost.j... |
pico8/game/formatter/rom.py | lifning/picotool | 310 | 11178633 | <filename>pico8/game/formatter/rom.py<gh_stars>100-1000
"""File formatter for .rom files"""
__all__ = [
'ROMFormatter',
]
from .base import BaseFormatter
# from .. import compress
# from ..game import Game
# from ... import util
# from ...lua.lua import Lua
# from ...gfx.gfx import Gfx
# from ...gff.gff import Gf... |
components/isceobj/TopsProc/runCropOffsetGeo.py | vincentschut/isce2 | 1,133 | 11178672 | #
# Author: <NAME>
# Copyright 2016
#
import os
import isceobj
import logging
import numpy as np
from imageMath import IML
def runCropOffsetGeo(self):
'''
Crops and resamples lat/lon/los/z images created by topsApp to the
same grid as the offset field image.
'''
print('\n==========================... |
models/network_dpsr.py | WestCityInstitute/KAIR | 1,521 | 11178675 | import math
import torch.nn as nn
import models.basicblock as B
"""
# --------------------------------------------
# modified SRResNet
# -- MSRResNet_prior (for DPSR)
# --------------------------------------------
References:
@inproceedings{zhang2019deep,
title={Deep Plug-and-Play Super-Resolution for Arbitrary B... |
mmdet3d/models/sst/sra_block.py | collector-m/SST | 217 | 11178682 | import torch
import torch.nn as nn
from torch.utils.checkpoint import checkpoint
from mmcv.runner import auto_fp16
from mmcv.cnn import build_norm_layer
from mmdet3d.ops import flat2window, window2flat, SRATensor, DebugSRATensor, spconv
from ipdb import set_trace
import os
import pickle as pkl
class WindowAttention(... |
sponsors/migrations/0031_auto_20210810_1232.py | ewjoachim/pythondotorg | 911 | 11178683 | # Generated by Django 2.0.13 on 2021-08-10 12:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0030_auto_20210715_2023'),
]
operations = [
migrations.AlterField(
model_name='sponsorcontact',
name='a... |
frontend/context_processors.py | hungbbear/spleeter-web | 202 | 11178746 | <gh_stars>100-1000
import os
def debug(context):
return {'DJANGO_DEVELOPMENT': os.getenv('DJANGO_DEVELOPMENT')}
|
moya/tests/test_context.py | moyaproject/moya | 129 | 11178764 | <filename>moya/tests/test_context.py
from __future__ import unicode_literals
from __future__ import print_function
import unittest
from moya.context import Context
from moya.context import dataindex
class TestDataIndex(unittest.TestCase):
def test_parse(self):
"""Test dataindex parse"""
tests = [... |
TWE-3/gensim/test/test_corpora.py | sysuhu/topical_word_embeddings | 330 | 11178825 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking corpus I/O formats (the corpora package).
"""
import logging
import os.path
import unittest
import tempfile
import itertools... |
playbooks/custom_functions/custom_list_enumerate.py | arjunkhunti-crest/security_content | 348 | 11178829 | def custom_list_enumerate(custom_list=None, **kwargs):
"""
Fetch a custom list and iterate through the rows, producing a dictionary output for each row with the row number and the value for each column.
Args:
custom_list: the name or ID of a custom list
Returns a JSON-serializable obje... |
SCons/Tool/ninja/Overrides.py | jcassagnol-public/scons | 1,403 | 11178846 | <gh_stars>1000+
# MIT License
#
# Copyright The SCons Foundation
#
# 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, copy,... |
quantdsl/domain/model/call_dependents.py | johnbywater/quantdsl | 269 | 11178853 | from eventsourcing.domain.model.entity import EventSourcedEntity, EntityRepository
from eventsourcing.domain.model.events import publish
class CallDependents(EventSourcedEntity):
"""
Call dependents are the calls that are waiting for this call to be evaluated.
The number of dependents will be the number ... |
tests/test_injectable_marker.py | wetgi/lagom | 109 | 11178875 | <filename>tests/test_injectable_marker.py<gh_stars>100-1000
from copy import deepcopy
import pytest
from lagom import injectable
from lagom.exceptions import InjectableNotResolved
def test_injectable_is_falsy():
assert not injectable
def test_trying_to_reference_a_property_on_injectable_raises_an_error():
... |
images/merge-svgs.py | ragerdl/dtrace-stap-book | 139 | 11178876 | <filename>images/merge-svgs.py
import os
import sys
import xml.etree.ElementTree as etree
NAMESPACES = {
'': 'http://www.w3.org/2000/svg',
'xlink': 'http://www.w3.org/1999/xlink',
'sodipodi': 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd',
'inkscape': 'http://www.inkscape.org/nam... |
src/uvm/dap/uvm_set_get_dap_base.py | rodrigomelo9/uvm-python | 140 | 11178911 | <reponame>rodrigomelo9/uvm-python
#//
#//------------------------------------------------------------------------------
#// Copyright 2007-2011 Mentor Graphics Corporation
#// Copyright 2007-2011 Cadence Design Systems, Inc.
#// Copyright 2010-2011 Synopsys, Inc.
#// Copyright 2013 NVIDIA Corporation
#// ... |
textdistance/algorithms/vector_based.py | juliangilbey/textdistance | 1,401 | 11178984 | <reponame>juliangilbey/textdistance
"""
IMPORTANT: it's just draft
"""
# built-in
from functools import reduce
# app
from .base import Base as _Base, BaseSimilarity as _BaseSimilarity
try:
import numpy
except ImportError:
numpy = None
class Chebyshev(_Base):
def _numpy(self, s1, s2):
s1, s2 = n... |
bindings/python/examples/linear_crf.py | shubho/gtn | 478 | 11179054 | #!/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.
"""
import gtn
import numpy as np
def gen_transitions(num_classes, calc_grad=False):
"""Make a bigram transition gra... |
talkgenerator/slide/slide_generator_types.py | korymath/talk-generator | 110 | 11179060 | <gh_stars>100-1000
import logging
from abc import ABCMeta
from abc import abstractmethod
from talkgenerator.slide import slides
from talkgenerator.util import generator_util
logger = logging.getLogger("talkgenerator")
class SlideGenerator(metaclass=ABCMeta):
""" Generating Slide objects using a list of generato... |
mmrotate/core/anchor/builder.py | williamcorsel/mmrotate | 449 | 11179074 | <reponame>williamcorsel/mmrotate<filename>mmrotate/core/anchor/builder.py
# Copyright (c) OpenMMLab. All rights reserved.
from mmcv.utils import build_from_cfg
from mmdet.core.anchor.builder import ANCHOR_GENERATORS
ROTATED_ANCHOR_GENERATORS = ANCHOR_GENERATORS
def build_prior_generator(cfg, default_args=None):
... |
Bruteapi.py | Yang2635/telescope | 699 | 11179077 | #encoding=utf8
from brutedns import Brutedomain
class cmd_args:
def __init__(self):
self.domain=''
self.speed=''
self.level=''
self.cdn = ''
self.sub_dict=''
self.next_sub_dict =''
self.default_dns = ''
self.other_result=''
class Brute_subdomain_api... |
data/micro-benchmark/lists/simple/main.py | vitsalis/pycg-evaluation | 121 | 11179106 | def func1():
pass
def func2():
pass
def func3():
pass
a = [func1, func2, func3]
a[0]()
a[1]()
a[2]()
def func4():
pass
b = [None]
b[0] = func4
b[0]()
|
barbican/tests/model/repositories/test_repositories_acls.py | mail2nsrajesh/barbican | 177 | 11179122 | <reponame>mail2nsrajesh/barbican
# 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... |
examples/config_change.py | josephwhite13/netmiko | 2,833 | 11179134 | #!/usr/bin/env python
from netmiko import ConnectHandler
from getpass import getpass
device = {
"device_type": "cisco_ios",
"host": "cisco1.lasthop.io",
"username": "pyclass",
"password": getpass(),
}
commands = ["logging buffered 100000"]
with ConnectHandler(**device) as net_connect:
output = net... |
cross-modal-search/flows/executors.py | nikosNalmpantis/examples | 434 | 11179136 | """ Implementation of filters for images and texts"""
import numpy as np
from jina import Executor, DocumentArray, requests
class ImageReader(Executor):
@requests(on='/index')
def index_read(self, docs: 'DocumentArray', **kwargs):
array = DocumentArray(list(filter(lambda doc: doc.modality=='image', d... |
tests/test_tags_in_curlies_2.py | adamserafini/pyxl4 | 366 | 11179140 | # coding: pyxl
from pyxl import html
def test():
assert str(<frag>{'<img src="foo" />'}</frag>) == """<img src="foo" />"""
|
lib/python/lightningjs/compiler/__init__.py | hooplab/lightningjs | 193 | 11179154 | import os
import re
import sys
import tempfile
import subprocess
_CLOSURE_COMPRESSOR_PATH = os.path.join(os.path.dirname(__file__), 'closure-compiler.jar')
_YUI_COMPRESSOR_PATH = os.path.join(os.path.dirname(__file__), 'yuicompressor-2.4.2.jar')
def minify_with_closure(path):
pipe = subprocess.Popen([
'ja... |
pydocx/openxml/wordprocessing/level.py | botzill/pydocx | 127 | 11179198 | <reponame>botzill/pydocx<gh_stars>100-1000
# coding: utf-8
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
from pydocx.models import XmlModel, XmlChild, XmlAttribute
from pydocx.openxml.wordprocessing.run_properties import RunProperties
from pydocx.openxml.wordprocessing.parag... |
scvelo/plotting/velocity.py | WeilerP/scvelo | 272 | 11179230 | <reponame>WeilerP/scvelo
import numpy as np
import pandas as pd
from scipy.sparse import issparse
import matplotlib.pyplot as pl
from matplotlib import rcParams
from scvelo.preprocessing.moments import second_order_moments
from scvelo.tools.rank_velocity_genes import rank_velocity_genes
from .scatter import scatter
f... |
cosypose/training/pose_models_cfg.py | ompugao/cosypose | 202 | 11179241 | # Backbones
from cosypose.models.efficientnet import EfficientNet
from cosypose.models.wide_resnet import WideResNet18, WideResNet34
from cosypose.models.flownet import flownet_pretrained
# Pose models
from cosypose.models.pose import PosePredictor
from cosypose.utils.logging import get_logger
logger = get_logger(__n... |
iexfinance/tests/stocks/test_field_methods.py | jto-d/iexfinance | 653 | 11179253 | <reponame>jto-d/iexfinance<gh_stars>100-1000
import numpy as np
import pandas as pd
import pytest
from iexfinance.stocks import Stock
from iexfinance.utils.exceptions import IEXQueryError
class TestFieldMethod(object):
def setup_class(self):
self.a = Stock("AAPL")
self.b = Stock(["AAPL", "TSLA"])... |
secure/__init__.py | sesh/secure | 247 | 11179303 | from secure.headers import CacheControl as CacheControl
from secure.headers import ContentSecurityPolicy as ContentSecurityPolicy
from secure.headers import PermissionsPolicy as PermissionsPolicy
from secure.headers import ReferrerPolicy as ReferrerPolicy
from secure.headers import ReportTo as ReportTo
from secure.head... |
other/gdb_scripts/get_cmds.py | CyberFlameGO/tilck | 1,059 | 11179309 | # SPDX-License-Identifier: BSD-2-Clause
import gdb # pylint: disable=import-error
from . import base_utils as bu
from . import tilck_types as tt
from . import tasks
class cmd_get_task(gdb.Command):
cmd_name = "get-task"
def __init__(self):
super(cmd_get_task, self).__init__(
cmd_get_task.cmd_na... |
challenges/4.E.Max_Value/main.py | pradeepsaiu/python-coding-challenges | 141 | 11179340 | <reponame>pradeepsaiu/python-coding-challenges
numbers = [8, 2, 4, 3, 6, 5, 9, 1]
### Modify the code below ###
highest = numbers
### Modify the code above ###
print(highest)
|
guild/tests/samples/projects/hparam-summaries/echo.py | wheatdog/guildai | 694 | 11179341 | <filename>guild/tests/samples/projects/hparam-summaries/echo.py
x_flag = None
print("x_metric: %s" % x_flag)
|
util.py | WangYueFt/prnet | 105 | 11179362 | <reponame>WangYueFt/prnet
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
from scipy.spatial.transform import Rotation
def euler2mat(angle):... |
modules/nameparser/config/regexes.py | whanderley/eden | 205 | 11179396 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
# emoji regex from https://stackoverflow.com/questions/26568722/remove-unicode-emoji-using-re-in-python
try:
# Wide UCS-4 build
re_emoji = re.compile('['
'\U0001F300-\U0001F64F'
'\U0001F680-\U0001F6FF'
'\u2600-\u2... |
frankensteinWebUI/views.py | ParikhKadam/frankenstein | 344 | 11179433 | <reponame>ParikhKadam/frankenstein
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render, redirect
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse
from django.utils.http import urlencode
from django import forms
import os
import j... |
osf/models/schema_response_block.py | gaybro8777/osf.io | 628 | 11179434 | <reponame>gaybro8777/osf.io
from django.db import models
from django.utils.functional import cached_property
from osf.exceptions import SchemaResponseUpdateError
from osf.models.base import BaseModel, ObjectIDMixin
from osf.utils.datetime_aware_jsonfield import DateTimeAwareJSONField
from osf.utils import sanitize
S... |
igibson/object_states/frozen.py | mamadbiabon/iGibson | 360 | 11179480 | <reponame>mamadbiabon/iGibson
import numpy as np
from igibson.object_states.object_state_base import AbsoluteObjectState, BooleanState
from igibson.object_states.temperature import Temperature
from igibson.object_states.texture_change_state_mixin import TextureChangeStateMixin
from igibson.utils.utils import transform... |
lra/attention_reformer.py | batuozt/transformer-ls | 177 | 11179495 | """
This file is from https://github.com/mlpen/Nystromformer
"""
import torch
import torch.nn as nn
from transformers.models.reformer.modeling_reformer import LSHSelfAttention, ReformerConfig
class LSHAttention(LSHSelfAttention):
def __init__(self, config, query, key, value):
self.num_hash = config.num_ha... |
components/iscesys/StdOEL/StdOELPy.py | vincentschut/isce2 | 1,133 | 11179496 | <reponame>vincentschut/isce2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2010 California Institute of Technology. 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.
... |
test_classful/test_method_dashified.py | antgel/flask-classful | 201 | 11179530 | from flask import Flask
from flask_classful import FlaskView
from nose.tools import eq_
class DashifiedDefaultView(FlaskView):
def some_route(self):
return "some route"
class DashifiedAttributeView(FlaskView):
method_dashified = True
def another_route(self):
return "another route"
cl... |
tools/test/topos/uk-onos.py | meodaiduoi/onos | 1,091 | 11179552 | <gh_stars>1000+
#!/usr/bin/python
from onosnet import run
from uk import UkTopo
run( UkTopo() )
|
src/dependency_injector/resources.py | whysage/python-dependency-injector | 1,997 | 11179610 | """Resources module."""
import abc
from typing import TypeVar, Generic, Optional
T = TypeVar('T')
class Resource(Generic[T], metaclass=abc.ABCMeta):
@abc.abstractmethod
def init(self, *args, **kwargs) -> Optional[T]:
...
def shutdown(self, resource: Optional[T]) -> None:
...
class A... |
running_modes/transfer_learning/link_invent_actions/collect_stats.py | lilleswing/Reinvent-1 | 183 | 11179626 | <reponame>lilleswing/Reinvent-1
import random
from reinvent_chemistry import TransformationTokens
from reinvent_chemistry.library_design import BondMaker, AttachmentPoints
from reinvent_chemistry.conversions import Conversions
from typing import List, Optional
import numpy as np
import scipy.stats as sps
from reinvent... |
tests/test_compat.py | PavanTatikonda/toasted-marshmallow | 304 | 11179671 | from toastedmarshmallow.compat import is_overridden
class Base(object):
def foo(self):
pass
class NoOverride(Base):
pass
class HasOverride(Base):
def foo(self):
pass
def test_is_overridden():
assert is_overridden(HasOverride().foo, Base.foo)
assert not is_overridden(NoOverrid... |
graph4nlp/pytorch/modules/prediction/classification/graph_classification/max_pooling.py | cminusQAQ/graph4nlp | 1,269 | 11179685 | import torch
import torch.nn as nn
from .....data.data import from_batch
from ..base import PoolingBase
class MaxPooling(PoolingBase):
r"""Apply max pooling over the nodes in the graph.
.. math::
r^{(i)} = \max_{k=1}^{N_i}\left( x^{(i)}_k \right)
"""
def __init__(self, dim=None, use_linear_... |
notebooks/ch6/detect.py | wangyonghong/RabbitMQ-in-Depth | 111 | 11179695 | """
Facial recognition specific methods
"""
import cv2
def _boxes(filename, faces):
img = cv2.imread(filename)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (100, 100, 255), 2)
filename = filename.split('/')[-1]
parts = filename.split('.')
new_name = '/tmp/%s-detec... |
thirdparty/ghostcat.py | wukong-bin/PeiQi-LandGrey-ClassHound | 489 | 11179706 | <reponame>wukong-bin/PeiQi-LandGrey-ClassHound
#!/usr/bin/env python
# coding: utf-8
# Referer: https://github.com/00theway/Ghostcat-CNVD-2020-10487/blob/master/ajpShooter.py
import codecs
import socket
import platform
try:
from urlparse import urlparse
except ImportError:
from urllib.request import urlparse
... |
coderedcms/urls.py | fakegit/coderedcms | 526 | 11179725 | from django.urls import include, path, re_path
from wagtail.contrib.sitemaps.views import sitemap
from wagtail.core import urls as wagtailcore_urls
from coderedcms.settings import cr_settings
from coderedcms.views import (
event_generate_ical_for_calendar,
event_generate_recurring_ical_for_event,
event_gene... |
alf/algorithms/sarsa_algorithm_test.py | www2171668/alf | 175 | 11179749 | <reponame>www2171668/alf
# Copyright (c) 2019 Horizon Robotics. 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
#
# Un... |
Simulator/gazebo_simulator/models/race_track/real_world/gate/meshes/set_gate_properties.py | 473867143/Prometheus | 1,217 | 11179766 | import argparse
import xml.etree.ElementTree as ET
def set_property(xml_root, name, value):
# changing the field {emission, ambient}
for elem in xml_root.iter():
if name in elem.tag:
color = elem.getchildren()[0]
if color is None:
raise IOError("Not found name {}".format(name))... |
graphql_compiler/compiler/helpers.py | kensho-technologies/graphql-compiler | 521 | 11179771 | <gh_stars>100-1000
# Copyright 2017-present Kensho Technologies, LLC.
"""Common helper objects, base classes and methods."""
from abc import ABCMeta, abstractmethod
from collections import namedtuple
from functools import total_ordering
import string
from typing import Any, Collection, Dict, Hashable, Iterable, Optiona... |
tools/kapture_data_date_ranges.py | v-mehta/kapture | 264 | 11179830 | <reponame>v-mehta/kapture<gh_stars>100-1000
#!/usr/bin/env python3
# Copyright 2020-present NAVER Corp. Under BSD 3-clause license
"""
Script to print statistics about kapture data.
"""
import argparse
import logging
import os
import os.path as path
import re
from datetime import datetime
import path_to_kapture # n... |
pymterm/colour/zenburn_2.py | stonewell/pymterm | 102 | 11179873 | <reponame>stonewell/pymterm
_color0 = '000d18'
_color8 = '000d18'
_color1 = 'e89393'
_color9 = 'e89393'
_color2 = '9ece9e'
_color10 = '9ece9e'
_color3 = 'f0dfaf'
_color11 = 'f0dfaf'
_color4 = '8cd0d3'
_color12 = '8cd0d3'
_color5 =... |
batchMonitorUpdate/batchUpdateReturnAll.py | Manny27nyc/Miscellany | 155 | 11179879 | from datadog import initialize, api
import datadog_api_client.v1
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import monitors_api
from datadog_api_client.v1.models import *
from pprint import pprint
options... |
test-tools/component_test/start.py | BernardXiong/wasm-micro-runtime | 1,723 | 11179898 | <reponame>BernardXiong/wasm-micro-runtime
#
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
It is the entrance of the iagent test framework.
"""
import argparse
import datetime
import os
impor... |
seq2seq-chatbot/vocabulary_importers/flatfile_vocabulary_importer.py | rohitkujur1997/chatbot | 104 | 11179921 | """
Base class for Flat File vocabulary importers
"""
import numpy as np
from collections import OrderedDict
from os import path
from vocabulary_importers.vocabulary_importer import VocabularyImporter
class FlatFileVocabularyImporter(VocabularyImporter):
"""Base class for Flat File vocabulary importers
"""
... |
samcli/lib/bootstrap/stack_builder.py | aubelsb2/aws-sam-cli | 2,959 | 11179931 | <filename>samcli/lib/bootstrap/stack_builder.py<gh_stars>1000+
"""
Abstract definitions for stack builder
"""
import json
from abc import ABC
from copy import deepcopy
from typing import Dict, Union, cast
from samcli import __version__ as VERSION
METADATA_FIELD = "Metadata"
RESOURCES_FIELD = "Resources"
OUTPUTS_FIELD... |
terrascript/resource/hashicorp/kubernetes_alpha.py | mjuenema/python-terrascript | 507 | 11179943 | # terrascript/resource/hashicorp/kubernetes_alpha.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:20:48 UTC)
import terrascript
class kubernetes_manifest(terrascript.Resource):
pass
__all__ = [
"kubernetes_manifest",
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.