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 |
|---|---|---|---|---|
qt__pyqt__pyside__pyqode/test_sql_fetchMore__QSqlTableModel_QSqlQueryModel/main__QSqlQueryModel.py | gil9red/SimplePyScripts | 117 | 12767950 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtWidgets import QApplication, QTableView
from PyQt5.QtSql import QSqlDatabase, QSqlQueryModel, QSqlQuery
db = QSqlDatabase.addDatabase('QSQLITE')
db.setDatabaseName('database.sqlite')
if not db.open():
raise Exception(db.lastErr... |
dbaas/maintenance/admin/database_maintenance_task.py | didindinn/database-as-a-service | 303 | 12767963 | <reponame>didindinn/database-as-a-service<filename>dbaas/maintenance/admin/database_maintenance_task.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.utils.html import format_ht... |
components/isceobj/StripmapProc/runCoherence.py | vincentschut/isce2 | 1,133 | 12767967 | <reponame>vincentschut/isce2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2012 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.
... |
api/tests/opentrons/protocol_engine/actions/test_action_dispatcher.py | anuwrag/opentrons | 235 | 12767978 | <gh_stars>100-1000
"""Tests for the protocol engine's ActionDispatcher."""
from decoy import Decoy
from opentrons.protocol_engine.actions import (
ActionDispatcher,
ActionHandler,
PlayAction,
)
def test_sink(decoy: Decoy) -> None:
"""It should send all actions to the sink handler."""
action = Pla... |
core/scansf.py | faslan1234/socialfish | 2,970 | 12767980 | import nmap
import requests
def nScan(ip):
nm = nmap.PortScanner()
nm.scan(ip, arguments="-F")
for host in nm.all_hosts():
ports = []
protocols = []
states = []
for proto in nm[host].all_protocols():
protocols.append(proto)
lport = nm[host][proto].key... |
warehouse/classifiers/models.py | fairhopeweb/warehouse | 3,103 | 12767982 | # 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 Li... |
tests/data/okta/adminroles.py | sckevmit/cartography | 2,322 | 12767997 | <reponame>sckevmit/cartography
LIST_ASSIGNED_USER_ROLE_RESPONSE = """
[
{
"id": "IFIFAX2BIRGUSTQ",
"label": "Application Administrator",
"type": "APP_ADMIN",
"status": "ACTIVE",
"created": "2019-02-06T16:17:40.000Z",
"lastUpdated": "2019-02-06T16:17:40.000Z",
... |
stonesoup/metricgenerator/__init__.py | Red-Portal/Stone-Soup-1 | 157 | 12768007 | # -*- coding: utf-8 -*-
from .base import MetricGenerator
__all__ = ['MetricGenerator']
|
scripts/ui/common.py | Hiwatts/facebook360_dep | 221 | 12768030 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""Common functions used across the UI tabs.
The UI shares several common functions across its tabs. Unlike ... |
src/test/pythonFiles/definition/three.py | ChaseKnowlden/vscode-jupyter | 615 | 12768054 | import two
two.ct().fun() |
nndet/inference/ensembler/base.py | joeranbosma/nnDetection | 242 | 12768066 | <filename>nndet/inference/ensembler/base.py
"""
Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
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 Lic... |
analytics/ot-iou/utils.py | xwu2git/Smart-City-Sample | 126 | 12768067 |
class BBUtil(object):
def __init__(self,width,height):
super(BBUtil, self).__init__()
self.width=width
self.height=height
def xywh_to_tlwh(self, bbox_xywh):
x,y,w,h = bbox_xywh
xmin = max(int(round(x - (w / 2))),0)
ymin = max(int(round(y - (h / 2))),0)
r... |
plato/agent/component/nlg/slot_filling_nlg.py | avmi/plato-research-dialogue-system | 899 | 12768070 | <filename>plato/agent/component/nlg/slot_filling_nlg.py
"""
Copyright (c) 2019-2020 Uber 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/LICENS... |
pdftotree/TreeVisualizer.py | zviri/pdftotree | 329 | 12768077 | from typing import Tuple
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfparser import PDFParser
try:
from IPython import get_ipython
if "IPKernelApp" not in get_ipython().config:
raise ImportError("console")
except (AttributeError, ImportError):
... |
section_10_(dictionaries)/dict_values.py | alisonjo2786/pythonlessons_materials | 425 | 12768099 | # If you're new to dictionaries, you might want to start with dict_access.py
# We create a dictionary.
contacts = {
'Shannon': '202-555-1234',
'Amy': '410-515-3000',
'Jen': '301-600-5555',
'Julie': '202-333-9876'
}
# We can use the dictionary method .values() to give us a list of all of the values in... |
cantools/database/can/bus.py | VonSquiggles/cantools | 1,063 | 12768100 | <filename>cantools/database/can/bus.py
# A CAN bus.
class Bus(object):
"""A CAN bus.
"""
def __init__(self,
name,
comment=None,
baudrate=None,
fd_baudrate=None,
autosar_specifics=None):
self._name = name
... |
src/hammer-vlsi/test_tool_utils.py | XiaoSanchez/hammer | 138 | 12768119 | <reponame>XiaoSanchez/hammer<filename>src/hammer-vlsi/test_tool_utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Helper and utility classes for testing HammerTool.
#
# See LICENSE for licence details.
import json
import os
import tempfile
from abc import ABCMeta, abstractmethod
from numbers import Number
... |
cozy/polynomials.py | mernst/cozy | 188 | 12768158 | <reponame>mernst/cozy
"""Class for representing polynomials of one variable."""
import functools
@functools.total_ordering
class Polynomial(object):
__slots__ = ("terms",)
def __init__(self, terms=()):
terms = list(terms)
while terms and (terms[-1] == 0):
terms.pop()
self.... |
Algorithms/string_generator/string_generator.py | TeacherManoj0131/HacktoberFest2020-Contributions | 256 | 12768163 | <reponame>TeacherManoj0131/HacktoberFest2020-Contributions
import string,random
def string_generator(size, chars):
return ''.join(random.choice(chars) for _ in range(size))
def get_option(option):
if option == 'alphabet':
characters = string.ascii_uppercase + string.ascii_lowercase + ... |
gym_trading/envs/simulator.py | AdrianP-/gym_trading | 109 | 12768164 | <reponame>AdrianP-/gym_trading<filename>gym_trading/envs/simulator.py<gh_stars>100-1000
import numpy as np
import pandas as pd
from .feature_engineering import FeatureEngineering
class Simulator(object):
def __init__(self, csv_name, train_split, dummy_period=None, train=True, multiple_trades=False):
if "E... |
tests/integ/test_record_set.py | LastRemote/sagemaker-python-sdk | 1,690 | 12768173 | <filename>tests/integ/test_record_set.py
# Copyright 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... |
bin/rstrip.py | cwickham/merely-useful.github.io | 190 | 12768175 | #!/usr/bin/env python
'''
Strip trailing whitespaces from lines.
Usage: rstrip.py file file...
'''
import sys
def main(filenames):
for f in filenames:
with open(f, 'r') as reader:
lines = reader.readlines()
lines = [x.rstrip() + '\n' for x in lines]
with open(f, 'w') as writ... |
integrations/tensorflow_v1/classification.py | clementpoiret/sparseml | 922 | 12768179 | <filename>integrations/tensorflow_v1/classification.py<gh_stars>100-1000
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... |
deepchem/splits/__init__.py | cjgalvin/deepchem | 3,782 | 12768190 | <gh_stars>1000+
"""
Gathers all splitters in one place for convenient imports
"""
# flake8: noqa
# basic splitter
from deepchem.splits.splitters import Splitter
from deepchem.splits.splitters import RandomSplitter
from deepchem.splits.splitters import RandomStratifiedSplitter
from deepchem.splits.splitters import Rand... |
neuralcompression/layers/_generalized_divisive_normalization.py | tallamjr/NeuralCompression | 233 | 12768194 | <reponame>tallamjr/NeuralCompression
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import functools
from typing import Callable, Optional
import torch
import torch.nn.functional
from to... |
tests-deprecating/milvus_benchmark/milvus_benchmark/env/local.py | CyberFlameGO/milvus | 10,504 | 12768232 | <reponame>CyberFlameGO/milvus<filename>tests-deprecating/milvus_benchmark/milvus_benchmark/env/local.py
import logging
from milvus_benchmark.env.base import BaseEnv
logger = logging.getLogger("milvus_benchmark.env.local")
class LocalEnv(BaseEnv):
"""docker env class wrapper"""
env_mode = "local"
def __i... |
lib/matplotlib/tests/test_gridspec.py | jbbrokaw/matplotlib | 113 | 12768253 | import matplotlib.gridspec as gridspec
from nose.tools import assert_equal
def test_equal():
gs = gridspec.GridSpec(2, 1)
assert_equal(gs[0, 0], gs[0, 0])
assert_equal(gs[:, 0], gs[:, 0])
|
examples/password_git.py | qualichat/questionary | 851 | 12768255 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""Example for a password question type.
Run example by typing `python -m examples.password` in your console."""
from pprint import pprint
import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
def ask_pystyle(**kwargs):... |
setup.py | john-veillette/pymc-learn | 187 | 12768267 | <gh_stars>100-1000
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# from builtins import *
from codecs import open
from os.path import realpath, dirname, join
from setuptools import setup, find_packages
import sys
import re
DISTNAME = 'pymc-learn'
DESCRIPT... |
fairness/algorithms/zafar/fair-classification-master/preferential_fairness/synthetic_data_demo/plot_synthetic_boundaries.py | yashwarlord/fairness-comparison | 146 | 12768308 | <gh_stars>100-1000
import matplotlib
import matplotlib.pyplot as plt # for plotting stuff
import os
import numpy as np
matplotlib.rcParams['text.usetex'] = True # for type-1 fonts
def get_line_coordinates(w, x1, x2):
y1 = (-w[0] - (w[1] * x1)) / w[2]
y2 = (-w[0] - (w[1] * x2)) / w[2]
return y1,y2
def... |
cactus/mime.py | danielchasehooper/Cactus | 1,048 | 12768346 | <filename>cactus/mime.py
import os
import mimetypes
MIMETYPE_MAP = {
'.js': 'text/javascript',
'.mov': 'video/quicktime',
'.mp4': 'video/mp4',
'.m4v': 'video/x-m4v',
'.3gp': 'video/3gpp',
'.woff': 'application/font-woff',
'.eot': 'application/vnd.ms-fontobject',
'.ttf': 'applica... |
Python/Tests/TestData/AstAnalysis/Functions.py | techkey/PTVS | 695 | 12768359 | def f():
'''f'''
pass
def f1(): pass
f2 = f
if True:
def g(): pass
else:
def h(): pass
class C:
def i(self): pass
def j(self):
def j2(self):
pass
class C2:
def k(self): pass
|
furnace/datasets/voc/voc.py | Yongjin-colin-choi/TorchSemiSeg | 1,439 | 12768374 | <filename>furnace/datasets/voc/voc.py
#!/usr/bin/env python3
# encoding: utf-8
# @Time : 2017/12/16 下午8:41
# @Author : yuchangqian
# @Contact : <EMAIL>
# @File : mclane.py
from datasets.BaseDataset import BaseDataset
class VOC(BaseDataset):
@classmethod
def get_class_colors(*args):
return [[0,... |
koku/api/common/permissions/test/test_ocp_all_access.py | rubik-ai/koku | 157 | 12768386 | #
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
from itertools import chain
from itertools import combinations
from unittest.mock import Mock
from django.test import TestCase
from api.common.permissions.openshift_all_access import OpenshiftAllAccessPermission
from api.iam.models import User
fr... |
src/PlugIns/PE/ResourceEntriesPlug.py | codexgigassys/codex-backend | 161 | 12768391 | <gh_stars>100-1000
# Copyright (C) 2016 <NAME>.
# This file is part of CodexGigas - https://github.com/codexgigassys/
# See the file 'LICENSE' for copying permission.
from PlugIns.PlugIn import PlugIn
from Modules.PEFileModule import PEFileModule
import pefile
from Utils.InfoExtractor import *
class ResourceEntriesPl... |
data_analysis/subsidy_distribution.py | Bermuhz/DataMiningCompetitionFirstPrize | 128 | 12768447 | root_loc = "/Users/mac/Documents/contest/data/original_data/"
file_name = "subsidy_train.txt"
count_0 = 0
count_1000 = 0
count_1500 = 0
count_2000 = 0
lines = open(root_loc + file_name).readlines()
for line in lines:
temps = line.strip("\n").split(",")
subsidy = int(temps[1])
if subsidy == 0:
count_... |
attic/iterables/almost_aritprog_v0.py | matteoshen/example-code | 5,651 | 12768485 | """
Arithmetic progression class
>>> ap = ArithmeticProgression(1, .5, 3)
>>> list(ap)
[1.0, 1.5, 2.0, 2.5]
"""
from collections import abc
class ArithmeticProgression:
def __init__(self, begin, step, end):
self.begin = begin
self.step = step
self.end = end
def __iter... |
libcity/executor/map_matching_executor.py | moghadas76/test_bigcity | 221 | 12768487 | from logging import getLogger
from libcity.executor.abstract_tradition_executor import AbstractTraditionExecutor
from libcity.utils import get_evaluator
class MapMatchingExecutor(AbstractTraditionExecutor):
def __init__(self, config, model):
self.model = model
self.config = config
self.ev... |
applications/pytorch/conformer/tests/convolution.py | payoto/graphcore_examples | 260 | 12768522 | <filename>applications/pytorch/conformer/tests/convolution.py
# Copyright (c) 2021 Graphcore 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.... |
tests/test_select.py | timgates42/goless | 266 | 12768527 | import goless
from goless.backends import current as be
from . import BaseTests
class RecvCaseTests(BaseTests):
chansize = 1
def setUp(self):
BaseTests.setUp(self)
self.ch = goless.chan(self.chansize)
self.ca = goless.rcase(self.ch)
def test_ready(self):
self.assertFalse(... |
cupy/cuda/cutensor.py | prkhrsrvstv1/cupy | 6,180 | 12768529 | """
cuTENSOR Wrapper
Use `cupy_backends.cuda.libs.cutensor` directly in CuPy codebase.
"""
available = True
try:
from cupy_backends.cuda.libs.cutensor import * # NOQA
except ImportError as e:
available = False
from cupy._environment import _preload_warning
_preload_warning('cutensor', e)
|
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py | Polidea/SiriusObfuscator | 427 | 12768540 | <gh_stars>100-1000
"""Test that a forward-declared class works when its complete definition is in a library"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class ForwardDeclT... |
src/pyinfrabox/testresult/__init__.py | agu3rra/InfraBox | 265 | 12768544 | from builtins import int, range
from pyinfrabox import ValidationError
from pyinfrabox.utils import *
def check_version(v, path):
if not isinstance(v, int):
raise ValidationError(path, "must be an int")
if v != 1:
raise ValidationError(path, "unsupported version")
def parse_measurement(d, pa... |
notebook/opencv_threshold.py | vhn0912/python-snippets | 174 | 12768565 | import cv2
im = cv2.imread('data/src/lena_square_half.png')
th, im_th = cv2.threshold(im, 128, 255, cv2.THRESH_BINARY)
print(th)
# 128.0
cv2.imwrite('data/dst/opencv_th.jpg', im_th)
# True
th, im_th_tz = cv2.threshold(im, 128, 255, cv2.THRESH_TOZERO)
print(th)
# 128.0
cv2.imwrite('data/dst/opencv_th_tz.jpg', im_... |
cgls.py | iggyuga/raisr2 | 275 | 12768568 | import numpy as np
def cgls(A, b):
height, width = A.shape
x = np.zeros((height))
while(True):
sumA = A.sum()
if (sumA < 100):
break
if (np.linalg.det(A) < 1):
A = A + np.eye(height, width) * sumA * 0.000000005
else:
x = np.linalg.inv(A).d... |
tests/test_handwrite.py | ReveRoyl/Handright-generator | 706 | 12768586 | <reponame>ReveRoyl/Handright-generator<filename>tests/test_handwrite.py
# coding: utf-8
import copy
import PIL.Image
import PIL.ImageDraw
from handright import *
from tests.util import *
BACKGROUND_COLOR = "white"
WIDTH = 32
HEIGHT = 32
SIZE = (WIDTH, HEIGHT)
SEED = "Handright"
def get_default_template():
temp... |
Lib/test/test_compiler/test_static/final.py | isabella232/cinder-1 | 1,886 | 12768611 | <gh_stars>1000+
from compiler.errors import TypedSyntaxError
from typing import ClassVar
from .common import StaticTestBase
class FinalTests(StaticTestBase):
def test_final_multiple_typeargs(self):
codestr = """
from typing import Final
from something import hello
x: Final[int, s... |
src/examples/python/gen_py/datahub/ttypes.py | RogerTangos/datahub-stub | 192 | 12768620 | #
# Autogenerated by Thrift Compiler (0.9.2)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
tr... |
statistics/stat_multiv_solutions.py | gautard/pystatsml | 123 | 12768646 | '''
Munivariate statistics exercises
================================
'''
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
np.random.seed(seed=42) # make the example reproducible
'''
### Dot product and Euclidean norm
'''
a = np.array([2,1])
b = np.array([1,1])
def euclidia... |
examples/tickOptionBox.py | tgolsson/appJar | 666 | 12768650 | <gh_stars>100-1000
import sys
sys.path.append("../")
new_ticks = ["Dogs2", "Cats2", "-", " ", "Hamsters2", "Fish2", "Spiders2", "", " "]
orig_ticks = ["Dogs", "Cats", "Hamsters", "Fish", "Spiders"]
from appJar import gui
def get(btn):
print(app.getOptionBox("Favourite Pets"))
print(app.getOptionBox("The Acti... |
test/kernel/integration/LiveUpdate/test.py | jaeh/IncludeOS | 3,673 | 12768671 | <filename>test/kernel/integration/LiveUpdate/test.py<gh_stars>1000+
#!/usr/bin/env python3
from builtins import str
import sys
import os
import socket
from vmrunner import vmrunner
vm = vmrunner.vms[0]
def begin_test(line):
f = open('./kernel_LiveUpdate','rb')
s = socket.socket()
s.connect(("10.0.0.59",... |
underworld/libUnderworld/config/packages/StGermain.py | longgangfan/underworld2 | 116 | 12768682 | <filename>underworld/libUnderworld/config/packages/StGermain.py
import os
from config import Package
from .libXML2 import libXML2
from .MPI import MPI
from .pcu import pcu
class StGermain(Package):
def setup_dependencies(self):
self.mpi = self.add_dependency(MPI, required=True)
self.libxml2 = self... |
Python3/664.py | rakhi2001/ecom7 | 854 | 12768722 | __________________________________________________________________________________________________
sample 140 ms submission
from functools import lru_cache
class Solution:
def strangePrinter(self, s: str) -> int:
@lru_cache(None)
def find_min(start, end):
if start >= end: return 1 if end... |
sample-apps/segmentation_spleen/lib/train.py | IntroAI-termproject/MONAILabel | 214 | 12768731 | # Copyright 2020 - 2021 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in wri... |
libs/configs/_base_/models/retinanet_r50_fpn.py | Artcs1/RotationDetection | 850 | 12768734 | # -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import os
import tensorflow as tf
import math
ROOT_PATH = os.path.abspath('../../')
print(ROOT_PATH)
SUMMARY_PATH = os.path.join(ROOT_PATH, 'output/summary')
# backbone
NET_NAME = 'resnet50_v1d'
RESTORE_FROM_RPN = False
FIXED_BL... |
lib/python/abcutils/CMakeCache.py | ryu-sw/alembic | 921 | 12768742 | <gh_stars>100-1000
#!/usr/bin/env python2.6
#-*- mode: python -*-
##-*****************************************************************************
##
## Copyright (c) 2009-2011,
## <NAME> Imageworks Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All rights reserved.
##
... |
Lambda/MatchStatus.py | nkwangjun/aws-gamelift-sample | 131 | 12768755 | import boto3
from botocore.exceptions import ClientError
import json
import time
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
ddb_table = dynamodb.Table('GomokuPlayerInfo')
def lambda_handler(event, context):
print(event)
# You can also use TicketId to track Matchmaking Event.
ticke... |
pinterest_problems/problem_3.py | loftwah/Daily-Coding-Problem | 129 | 12768761 | """This problem was asked by Pinterest.
At a party, there is a single person who everyone knows, but who does not
know anyone in return (the "celebrity"). To help figure out who this is,
you have access to an O(1) method called knows(a, b), which returns True
if person a knows person b, else False.
Given a list of... |
tools/android/modularization/convenience/touch_resources.py | Ron423c/chromium | 575 | 12768768 | #!/usr/bin/env python3
# Copyright 2021 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.
r"""Creates Android resources directories and boilerplate files for a module.
This is a utility script for conveniently creating resou... |
sot/eval_sot.py | take-cheeze/models | 112 | 12768769 | import argparse
import numpy as np
import chainer
from siam_rpn.general.eval_sot_vot import eval_sot_vot
from siam_rpn.siam_rpn import SiamRPN
from siam_rpn.siam_rpn_tracker import SiamRPNTracker
from siam_rpn.siam_mask_tracker import SiamMaskTracker
from siam_rpn.general.vot_tracking_dataset import VOTTrackingDatase... |
setup.py | dendisuhubdy/deep_complex_networks | 641 | 12768835 | <reponame>dendisuhubdy/deep_complex_networks
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.md') as f:
DESCRIPTION = f.read()
setup(
name='DeepComplexNetworks',
version='1',
license='MIT',
long_description=DESCRIPTION,
packages=find_packages() + find_packa... |
smoke/features/steps/delete_steps.py | nhojpatrick/openshift_jenkins | 267 | 12768852 | <reponame>nhojpatrick/openshift_jenkins<gh_stars>100-1000
from smoke.features.steps.openshift import Openshift
from kubernetes import client, config
oc = Openshift()
v1 = client.CoreV1Api()
@then(u'we delete deploymentconfig.apps.openshift.io "jenkins"')
def del_dc(context):
res = oc.delete("deploymentconfig","je... |
uninstall.py | slmjy/oci-ansible-modules | 106 | 12768876 | #!/usr/bin/env python
# Copyright (c) 2018, 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT f... |
tests/test_cmd.py | KrishanBhasin/giraffez | 122 | 12768881 | # -*- coding: utf-8 -*-
import pytest
from giraffez._teradata import RequestEnded, StatementEnded, StatementInfoEnded
import giraffez
from giraffez.constants import *
from giraffez.errors import *
from giraffez.types import *
class ResultsHelper:
"""
Helps to emulate how exceptions are raised when working w... |
terrascript/oneandone/__init__.py | hugovk/python-terrascript | 507 | 12768930 | <filename>terrascript/oneandone/__init__.py
# terrascript/oneandone/__init__.py
import terrascript
class oneandone(terrascript.Provider):
pass
|
cli/endpoints/online/triton/ensemble/models/triton/bidaf-preprocess/1/model.py | denniseik/azureml-examples | 331 | 12768949 | import nltk
import json
import numpy as np
from nltk import word_tokenize
import triton_python_backend_utils as pb_utils
class TritonPythonModel:
"""Your Python model must use the same class name. Every Python model
that is created must have "TritonPythonModel" as the class name.
"""
def initialize... |
test/tests/test_environments/python_src/main.py | jithindevasia/fission | 6,891 | 12768952 | <gh_stars>1000+
def main():
return 'THIS_IS_MAIN_MAIN'
def func():
return 'THIS_IS_MAIN_FUNC'
|
test/test_server.py | keredson/tinyweb | 138 | 12768989 | <reponame>keredson/tinyweb
#!/usr/bin/env micropython
"""
Unittests for Tiny Web
MIT license
(C) <NAME> 2017-2018
"""
import unittest
import uos as os
import uerrno as errno
import uasyncio as asyncio
from tinyweb import webserver
from tinyweb.server import urldecode_plus, parse_query_string
from tinyweb.server import... |
tests/test_dependency_duplicates.py | Aryabhata-Rootspring/fastapi | 53,007 | 12769000 | <reponame>Aryabhata-Rootspring/fastapi<gh_stars>1000+
from typing import List
from fastapi import Depends, FastAPI
from fastapi.testclient import TestClient
from pydantic import BaseModel
app = FastAPI()
client = TestClient(app)
class Item(BaseModel):
data: str
def duplicate_dependency(item: Item):
retur... |
account/forms.py | ShwethaRGowda/FADB | 149 | 12769006 | from django import forms
from .models import UserProfile
class ProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ['name', 'photo']
widgets = {
'name': forms.TextInput(attrs={'class': 'form-control'}),
'photo': forms.FileInput(attrs={'class': 'for... |
h2o-py/tests/testdir_munging/pyunit_runif.py | ahmedengu/h2o-3 | 6,098 | 12769012 | from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def runif_check():
fr = h2o.H2OFrame([[r] for r in range(1,1001)])
runif1 = fr[0].runif(1234)
runif2 = fr[0].runif(1234)
runif3 = fr[0].runif(42)
assert (runif1 == runif2).all(), "Expected... |
h2o-py/tests/testdir_munging/binop/pyunit_mod.py | ahmedengu/h2o-3 | 6,098 | 12769055 | <gh_stars>1000+
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
def frame_as_list():
prostate = h2o.import_file(path=pyunit_utils.locate("smalldata/prostate/prostate.csv.zip"))
(prostate % 10).show()
(prostate[4] % 10).show()
airlines = h2o.import_file(path=pyun... |
bitex/api/REST/response.py | ligggooo/quant2018 | 312 | 12769072 | # Import Third-Party
from requests import Response
class APIResponse(Response):
def __init__(self, req_response, formatted_json=None):
for k, v in req_response.__dict__.items():
self.__dict__[k] = v
self._formatted = formatted_json
@property
def formatted(self):
retur... |
motrackers/detectors/__init__.py | timseifer/mixed_motion_detection | 570 | 12769082 | from motrackers.detectors.tf import TF_SSDMobileNetV2
from motrackers.detectors.caffe import Caffe_SSDMobileNet
from motrackers.detectors.yolo import YOLOv3
|
tests/orm/nodes/data/test_array_bands.py | azadoks/aiida-core | 180 | 12769083 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
datapackage_pipelines/specs/hashers/hash_calculator.py | gperonato/datapackage-pipelines | 109 | 12769115 | <filename>datapackage_pipelines/specs/hashers/hash_calculator.py
import hashlib
from ...utilities.extended_json import json
from ..parsers.base_parser import PipelineSpec
from ..errors import SpecError
from .dependency_resolver import resolve_dependencies
class HashCalculator(object):
def __init__(self):
... |
cli/src/pcluster/cli/commands/configure/command.py | maclema/aws-parallelcluster | 279 | 12769147 | # Copyright 2013-2018 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 ... |
src/mylib/lgb/util.py | murez/mobile-semantic-segmentation | 713 | 12769184 | <reponame>murez/mobile-semantic-segmentation
from typing import List
import pandas as pd
from lightgbm import Booster
def make_imp_df(boosters: List[Booster]) -> pd.DataFrame:
df = pd.concat([
pd.DataFrame({'name': b.feature_name(), 'importance': b.feature_importance()})
for b in boosters
])
... |
DyCommon/Ui/DyStatsDataFrameTableWidget.py | Leonardo-YXH/DevilYuan | 135 | 12769188 | <filename>DyCommon/Ui/DyStatsDataFrameTableWidget.py
from PyQt5 import QtCore
import pandas as pd
from DyCommon.Ui.DyStatsTableWidget import *
class DyStatsDataFrameTableWidget(DyStatsTableWidget):
"""
只显示DF的列,index需要用户自己转换成列
"""
def __init__(self, df, parent=None):
super().__init__(pare... |
tests/test_kpm.py | lise1020/pybinding | 159 | 12769200 | <reponame>lise1020/pybinding
import pytest
import numpy as np
import pybinding as pb
from pybinding.repository import graphene, group6_tmd
models = {
'graphene-pristine': [graphene.monolayer(), pb.rectangle(15)],
'graphene-pristine-oversized': [graphene.monolayer(), pb.rectangle(20)],
'graphene-const_pote... |
src/plugins_/cfdocs/__init__.py | jcberquist/sublimetext-cfml | 130 | 12769234 | <filename>src/plugins_/cfdocs/__init__.py
from .. import plugin
from .cfdocs import (
get_inline_documentation,
get_completion_docs,
get_goto_cfml_file
)
class CFMLPlugin(plugin.CFMLPlugin):
def get_completion_docs(self, cfml_view):
return get_completion_docs(cfml_view)
def get_inline_do... |
networks/model.py | HighCWu/anime_biggan_toy | 140 | 12769244 | <reponame>HighCWu/anime_biggan_toy
import numpy as np
import paddle.fluid as fluid
from paddle.fluid import layers, dygraph as dg
from paddle.fluid.initializer import Normal, Constant, Uniform
class ModelCache(object):
G = None
D = None
train_mode = False
initialized = False
model_cache = ModelCache
... |
pytorch_lightning/utilities/signature_utils.py | mathemusician/pytorch-lightning | 3,469 | 12769266 | # Copyright The PyTorch Lightning team.
#
# 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 i... |
catalogs/views.py | paulsuh/mwa2 | 155 | 12769307 | <filename>catalogs/views.py
"""
catalogs//views.py
"""
from django.http import HttpResponse
from catalogs.models import Catalog
import json
import logging
LOGGER = logging.getLogger('munkiwebadmin')
def catalog_view(request):
'''Returns list of catalog names in JSON format'''
catalog_list = Catalog.list()
... |
hypatia/physics.py | defcon201/hypatia-engine | 251 | 12769308 | <filename>hypatia/physics.py<gh_stars>100-1000
"""Physical attributes of things.
Right now, not much differs it from the constants
module, but there will surely be much more to do
with physics as time progresses.
See Also:
:mod:`constants`
"""
import pygame
from hypatia import constants
class Velocity(object... |
trigger/acl/tools.py | jccardonar/trigger | 380 | 12769350 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Various tools for use in scripts or other modules. Heavy lifting from tools
that have matured over time have been moved into this module.
"""
__author__ = '<NAME>, <NAME>'
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__copyright__ = 'Copyright 2010-2011, AOL Inc.'
f... |
src/spaczz/customattrs.py | JonasHablitzel/spaczz | 153 | 12769359 | <gh_stars>100-1000
"""Custom spaCy attributes for spaczz."""
from __future__ import annotations
from typing import Iterable, Optional, Set, Tuple, Type
import warnings
from spacy.tokens import Doc, Span, Token
from .exceptions import AttrOverwriteWarning, SpaczzSpanDeprecation
class SpaczzAttrs:
"""Adds spaczz... |
dataset_creation/find_answer.py | AseelAlshorafa/SOQAL | 109 | 12769362 | <filename>dataset_creation/find_answer.py
import sys
import os
from scipy import spatial
import numpy as np
def editDistance(str1, str2, m, n):
# edit distance recursive implementation, m = len(str1) and n = len(str2)
dp = [[0 for x in range(n + 1)] for x in range(m + 1)]
for i in range(m + 1):
for... |
helper_scripts/components/headers_helper.py | fengjixuchui/difuze | 347 | 12769369 | def get_all_includes(comp_args, dst_includes):
i = 0
while i < len(comp_args):
curr_arg = comp_args[i].strip()
if curr_arg == "-isystem":
curr_arg1 = "-I" + comp_args[i+1].strip()
if curr_arg1 not in dst_includes:
dst_includes.append(curr_arg1)
if ... |
tpfd/compat.py | erinxocon/tpfd | 106 | 12769439 | import sys
"""
This module handles import compatibility issues between Python 2 and
Python 3.
"""
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
if is_py2:
builtin_str = str
bytes = str
str = unicode
basestring = basestring
... |
src/patcher.py | MustangYM/xia0LLDB | 464 | 12769463 | <filename>src/patcher.py
#! /usr/bin/env python3
# ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______ ______
# |______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|______|
# _ _... |
tests/ingestion/transformers/monosi/test_monitors.py | monosidev/monosi | 156 | 12769487 | <gh_stars>100-1000
import pytest
import ingestion.transformers.monosi.monitors as monitors
@pytest.fixture
def schema():
return {
'columns': ['NAME', 'COL_NAME', 'COL_TYPE', 'COL_DESCRIPTION', 'COL_SORT_ORDER', 'DATABASE', 'SCHEMA', 'DESCRIPTION', 'IS_VIEW'],
'rows': [
{
... |
mushroom_rl/environments/mujoco_envs/humanoid_gait/humanoid_gait.py | PuzeLiu/mushroom-rl | 344 | 12769513 | import mujoco_py
from pathlib import Path
from mushroom_rl.utils import spaces
from mushroom_rl.environments.mujoco import MuJoCo, ObservationType
from mushroom_rl.utils.running_stats import *
from ._external_simulation import NoExternalSimulation, MuscleSimulation
from .reward_goals import CompleteTrajectoryReward, ... |
discretize/utils/code_utils.py | ngodber/discretize | 123 | 12769527 | <filename>discretize/utils/code_utils.py
import numpy as np
import warnings
SCALARTYPES = (complex, float, int, np.number)
def is_scalar(f):
"""Determine if the input argument is a scalar.
The function **is_scalar** returns *True* if the input is an integer,
float or complex number. The function returns... |
network/layer_implementations/ConvLSTMCell.py | DesperateMaker/TrackR-CNN | 522 | 12769547 | import tensorflow as tf
from network.Util import smart_shape
RNNCell = tf.nn.rnn_cell.RNNCell
LSTMStateTuple = tf.nn.rnn_cell.LSTMStateTuple
def _conv2d(x, W, strides=None):
if strides is None:
strides = [1, 1]
return tf.nn.conv2d(x, W, strides=[1] + strides + [1], padding="SAME")
def dynamic_conv_rnn(cell,... |
AutotestWebD/apps/myadmin/service/UserService.py | yangjourney/sosotest | 422 | 12769554 | import apps.common.func.InitDjango
from all_models.models import TbUser, TbAdminUserPermissionRelation
from apps.common.func.WebFunc import *
class UserService(object):
@staticmethod
def getUsers():
return TbUser.objects.all()
@staticmethod
def getUserByLoginname(loginname):
return ... |
base_solver/pytorch-captcha-recognition/my_dataset.py | johnnyzn/DW-GAN | 109 | 12769557 | <gh_stars>100-1000
# -*- coding: UTF-8 -*-
import os
from torch.utils.data import DataLoader,Dataset
import torchvision.transforms as transforms
from PIL import Image
import one_hot_encoding as ohe
import captcha_setting
import numpy as np
import cv2
class mydataset(Dataset):
def __init__(self, folder, folder_2 = ... |
utils/det_filter.py | rishyak/liverseg-2017-nipsws | 107 | 12769564 | <gh_stars>100-1000
import numpy as np
from scipy import misc
import os
import scipy.io
from PIL import Image
def filter(base_root, crops_list='crops_LiTS_gt.txt', input_config='masked_out_lesion', results_list='detection_lesion_example', th=0.5):
crops_list = base_root + 'utils/crops_list/' + crops_list
resu... |
Joy_QA_Platform/ApiManager/operations/operation_task.py | bzc128/Joy_QA_Platform | 123 | 12769566 | import datetime
import json
import re
import os
import requests
import time
import threading
import pickle
from django.core.mail import send_mail
from django.db import connection
from django.http import JsonResponse
from django.shortcuts import render_to_response, render
from django.core.cache import cache
from ApiMa... |
faceai/opencv/trackbar.py | xurohanmm/faceai | 9,944 | 12769588 | #coding=utf-8
#调色板
import cv2
import numpy as np
img = np.zeros((300, 512, 3), np.uint8)
cv2.namedWindow('image')
def callback(x):
pass
#参数1:名称;参数2:作用窗口,参数3、4:最小值和最大值;参数5:值更改回调方法
cv2.createTrackbar('R', 'image', 0, 255, callback)
cv2.createTrackbar('G', 'image', 0, 255, callback)
cv2.createTrackbar('B', 'image... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.