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 |
|---|---|---|---|---|
program/object-detection-tf-py/tensorRT_hooks.py | G4V/ck-tensorflow | 108 | 12771393 | '''
hooks for using tensorRT with the object detection program.
names and parameters are defined as required by the detect.py infrastructure.
'''
import tensorflow as tf
import tensorflow.contrib.tensorrt as trt
def load_graph_tensorrt(params):
graph_def = tf.compat.v1.GraphDef()
with tf.compat.v1.gfile.GFile(pa... |
experiments/distributed.py | DeNeutoy/flowseq | 256 | 12771399 | <reponame>DeNeutoy/flowseq
import sys
import os
current_path = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
sys.path.append(root_path)
import json
import signal
import threading
import torch
from flownmt.data import NMTDataSet
import experiments... |
__init__.py | gszy/kicad-boardview | 116 | 12771408 | import pcbnew
import os
from .pcbnew2boardview import convert
class Pcbnew2Boardview(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Pcbnew to Boardview"
self.category = "Read PCB"
self.description = "Generate Boardview file from KiCad pcb."
def Run(self):
kicad_pcb =... |
tests/test_utils.py | localuser2/pre-commit-hooks | 164 | 12771421 | <reponame>localuser2/pre-commit-hooks<filename>tests/test_utils.py
#!/usr/bin/env python3
import difflib
import os
import re
import shutil
import subprocess as sp
import sys
import pytest
test_file_strs = {
"ok.c": '// Copyright 2021 <NAME>\n#include <stdio.h>\n\nint main() {\n printf("Hello World!\\n");\n retu... |
jsonrpc/tests/test_backend_django/settings.py | DMantis/json-rpc | 409 | 12771439 | SECRET_KEY = 'secret'
ROOT_URLCONF = 'jsonrpc.tests.test_backend_django.urls'
ALLOWED_HOSTS = ['testserver']
DATABASE_ENGINE = 'django.db.backends.sqlite3'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
JSONRPC_MAP_VIEW_ENABLED = True
|
mmdet2trt/core/__init__.py | tehkillerbee/mmdetection-to-tensorrt | 496 | 12771450 | <reponame>tehkillerbee/mmdetection-to-tensorrt
from .anchor import * # noqa: F401,F403
from .bbox import * # noqa: F401,F403
from .post_processing import * # noqa: F401,F403
|
data/text/tokenizer.py | anh/TransformerTTS | 894 | 12771488 | from typing import Union
import re
from phonemizer.phonemize import phonemize
from data.text.symbols import all_phonemes, _punctuations
class Tokenizer:
def __init__(self, start_token='>', end_token='<', pad_token='/', add_start_end=True, alphabet=None,
model_breathing=True):
if no... |
openelex/tests/test_transform_registry.py | Mpopoma/oe-core | 156 | 12771497 | from unittest import TestCase
from mock import Mock
from openelex.base.transform import registry
class TestTransformRegistry(TestCase):
def test_register_with_validators(self):
mock_transform = Mock(return_value=None)
mock_transform.__name__ = 'mock_transform'
mock_validator1 = Mock(retur... |
usaspending_api/references/models/overall_totals.py | g4brielvs/usaspending-api | 217 | 12771509 | from django.db import models
class OverallTotals(models.Model):
id = models.AutoField(primary_key=True)
create_date = models.DateTimeField(auto_now_add=True, blank=True, null=True)
update_date = models.DateTimeField(auto_now=True, null=True)
fiscal_year = models.IntegerField(blank=True, null=True)
... |
Validation/RecoB/test/validation_customJet_cfg.py | ckamtsikis/cmssw | 852 | 12771511 | from __future__ import print_function
# The following comments couldn't be translated into the new config version:
#! /bin/env cmsRun
import FWCore.ParameterSet.Config as cms
process = cms.Process("validation")
import FWCore.ParameterSet.VarParsing as VarParsing
options = VarParsing.VarParsing ('analysis')
# load th... |
datasets/TGS_salt/TGSDataset.py | liaopeiyuan/ml-arsenal-public | 280 | 12771560 | from dependencies import *
IMAGE_HEIGHT, IMAGE_WIDTH = 101, 101
HEIGHT, WIDTH = 128, 128
DY0, DY1, DX0, DX1 = \
compute_center_pad(IMAGE_HEIGHT, IMAGE_WIDTH, factor=32)
#----------------------------------------
def null_augment(image,label,index):
cache = Struct(image = image.copy(), mask = mask.copy())
... |
community/dm-scaffolder/configs.py | shan2202/deploymentmanager-samples | 930 | 12771561 | <reponame>shan2202/deploymentmanager-samples
# Copyright 2018 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
spirit/user/migrations/0009_auto_20161114_1850.py | Ke-xueting/Spirit | 974 | 12771562 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-11-14 18:50
from django.db import migrations
def user_model_content_type(apps, schema_editor):
from ...core.conf import settings
if not hasattr(settings, 'AUTH_USER_MODEL'):
return
user = apps.get_model(settings.AUTH... |
pyxb/bundles/opengis/examples/demo.py | eLBati/pyxb | 123 | 12771565 | from __future__ import print_function
import pyxb.bundles.opengis.gml as gml
dv = gml.DegreesType(32, direction='N')
print(dv.toDOM(element_name='degrees').toxml("utf-8"))
|
music21/stream/streamStatus.py | cuthbertLab/music21 | 1,449 | 12771595 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Name: streamStatus.py
# Purpose: functionality for reporting on the notational status of streams
#
# Authors: <NAME>
#
# Copyright: Copyright © 2013 <NAME> and the music21
# Proje... |
dcase_util/containers/mapping.py | ankitshah009/dcase_util | 122 | 12771597 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
from six import iteritems
import os
import csv
from dcase_util.containers import DictContainer
from dcase_util.utils import FileFormat
class OneToOneMappingContainer(DictContainer):
"""Mapping container class for ... |
desktop/core/ext-py/python-ldap-2.3.13/setup.py | kokosing/hue | 5,079 | 12771619 | <reponame>kokosing/hue
"""
setup.py - Setup package with the help Python's DistUtils
See http://www.python-ldap.org/ for details.
$Id: setup.py,v 1.65 2009/10/21 17:32:11 stroeder Exp $
"""
has_setuptools = False
try:
from setuptools import setup, Extension
has_setuptools = True
except ImportError:
from distutils... |
python/367_Valid_Perfect_Square.py | dvlpsh/leetcode-1 | 4,416 | 12771629 | class Solution(object):
# def isPerfectSquare(self, num):
# """
# :type num: int
# :rtype: bool
# """
# i = 1
# while num > 0:
# num -= i
# i += 2
# return num == 0
def isPerfectSquare(self, num):
low, high = 1, num
... |
corehq/apps/sms/management/commands/change_phonenumber_backend.py | dimagilg/commcare-hq | 471 | 12771663 | <filename>corehq/apps/sms/management/commands/change_phonenumber_backend.py<gh_stars>100-1000
import os
import sys
from collections import defaultdict
from django.core.management.base import BaseCommand
import csv
from corehq.util.log import with_progress_bar
from ...models import PhoneNumber, SQLMobileBackend
from... |
external/plex/dist/tests/test10.py | almartin82/bayeslite | 964 | 12771667 | <filename>external/plex/dist/tests/test10.py
# Test traditional regular expression syntax.
import Test
from Plex.Traditional import re
from Plex.Errors import PlexError
from Plex import Seq, AnyBut
def test_err(s):
try:
print re(s)
except PlexError, e:
print e
print re("")
print re("a")
print re("[a]")
... |
lomond/events.py | johnashu/dataplicity-lomond | 225 | 12771668 | from __future__ import unicode_literals
import json
import time
class Event(object):
"""Base class for a websocket 'event'."""
__slots__ = ['received_time']
def __init__(self):
self.received_time = time.time()
def __repr__(self):
return "{}()".format(self.__class__.__name__)
@c... |
Calibration/IsolatedParticles/test/python/proto_runIsolatedTracksNxNNzsData_cfg.py | ckamtsikis/cmssw | 852 | 12771683 | import FWCore.ParameterSet.Config as cms
process = cms.Process("L1SKIM")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 100000
process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
####################### configure pool source ####... |
build/plugins/lib/nots/package_manager/pnpm/tests/workspace.py | jochenater/catboost | 6,989 | 12771684 | <filename>build/plugins/lib/nots/package_manager/pnpm/tests/workspace.py
from build.plugins.lib.nots.package_manager.base import PackageJson
from build.plugins.lib.nots.package_manager.pnpm.workspace import PnpmWorkspace
def test_workspace_get_paths():
ws = PnpmWorkspace(path="/packages/foo/pnpm-workspace.yaml")
... |
tests/test_processor.py | alisaifee/jira-cli | 125 | 12771687 | <gh_stars>100-1000
import unittest
import mock
from jiracli.interface import build_parser, cli
class AddCommandTests(unittest.TestCase):
def test_issue_type_parsing(self):
"Previously, calling this would raise an exception on python3"
with mock.patch("jiracli.interface.print_output"):
... |
mmf/datasets/processors/video_processors.py | dk25021999/mmf | 1,928 | 12771749 | # Copyright (c) Facebook, Inc. and its affiliates.
# TODO: Once internal torchvision transforms become stable either in torchvision
# or in pytorchvideo, move to use those transforms.
import random
import mmf.datasets.processors.functional as F
import torch
from mmf.common.registry import registry
from mmf.datasets.p... |
kanmail/server/mail/oauth_settings.py | frznvm0/Kanmail | 1,118 | 12771783 | <reponame>frznvm0/Kanmail
from kanmail.settings.hidden import get_hidden_value
OAUTH_PROVIDERS = {
'gmail': {
'auth_endpoint': 'https://accounts.google.com/o/oauth2/auth',
'token_endpoint': 'https://accounts.google.com/o/oauth2/token',
'profile_endpoint': 'https://www.googleapis.com/userin... |
bumblebee_status/modules/contrib/http_status.py | rosalogia/bumblebee-status | 1,089 | 12771805 | # pylint: disable=C0111,R0903
"""Display HTTP status code
Parameters:
* http__status.label: Prefix label (optional)
* http__status.target: Target to retrieve the HTTP status from
* http__status.expect: Expected HTTP status
contributed by `valkheim <https://github.com/valkheim>`_ - many thanks!
"""
from ... |
python/GafferImageUI/ResampleUI.py | ddesmond/gaffer | 561 | 12771855 | <gh_stars>100-1000
##########################################################################
#
# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#... |
tests/test_aio_trampoline.py | suned/pfun | 126 | 12771857 | import pytest
from hypothesis import assume, given
from pfun import compose, identity
from pfun.aio_trampoline import Done
from pfun.hypothesis_strategies import aio_trampolines, anything, unaries
from .monad_test import MonadTest
class TestTrampoline(MonadTest):
@pytest.mark.asyncio
@given(aio_trampolines(... |
tests/test_sklearn_normalizer_converter.py | twosense/sklearn-onnx | 323 | 12771859 | # SPDX-License-Identifier: Apache-2.0
"""
Tests scikit-normalizer converter.
"""
import unittest
import numpy
from sklearn.preprocessing import Normalizer
from skl2onnx import convert_sklearn
from skl2onnx.common.data_types import (
Int64TensorType, FloatTensorType, DoubleTensorType)
from test_utils import dump_da... |
universe/wrappers/experimental/__init__.py | BitJetKit/universe | 8,120 | 12771873 | from universe.wrappers.experimental.action_space import SafeActionSpace, SoftmaxClickMouse
from universe.wrappers.experimental.observation import CropObservations
from universe.wrappers.experimental.random_env import RandomEnv
|
paper code/solveCrossTime.py | PKandarp/TICC | 393 | 12771912 | from snap import *
from cvxpy import *
import math
import multiprocessing
import numpy
from scipy.sparse import lil_matrix
import sys
import time
import __builtin__
import code
# File format: One edge per line, written as "srcID dstID"
# Commented lines that start with '#' are ignored
# Returns a TGraphVX... |
research/attention_ocr/python/datasets/testdata/fsns/download_data.py | gujralsanyam22/models | 82,518 | 12771925 | <gh_stars>1000+
import urllib.request
import tensorflow as tf
import itertools
URL = 'http://download.tensorflow.org/data/fsns-20160927/testdata/fsns-00000-of-00001'
DST_ORIG = 'fsns-00000-of-00001.orig'
DST = 'fsns-00000-of-00001'
KEEP_NUM_RECORDS = 5
print('Downloading %s ...' % URL)
urllib.request.urlretrieve(URL,... |
libs/pipeline_monitor/test.py | silentmonk/KubeFlow | 2,527 | 12771926 | from pipeline_monitor import prometheus_monitor as monitor
_labels= {'a_label_key':'a_label_value'}
@monitor(labels=_labels, name="test_monitor")
def test_log_inputs_and_outputs(arg1: int, arg2: int):
return arg1 + arg2
test_log_inputs_and_outputs(4, 5)
|
securityheaders/checkers/xpoweredby/__init__.py | th3cyb3rc0p/securityheaders | 151 | 12771943 | from .present import XPoweredByPresentChecker
__all__ = ['XPoweredByPresentChecker']
|
datasheets/tab.py | etcher-be/datasheets | 625 | 12771962 | import types
from collections import OrderedDict
import apiclient
import pandas as pd
from datasheets import exceptions, helpers
class Tab(object):
def __init__(self, tabname, workbook, drive_svc, sheets_svc):
"""Create a datasheets.Tab instance of an existing Google Sheets tab.
This class in n... |
examples/streamline1.py | yang69can/pyngl | 125 | 12771967 | #
# File:
# streamline1.py
#
# Synopsis:
# Draws streamlines on a map over water only.
#
# Category:
# Streamlines on a map.
#
# Author:
# <NAME>
#
# Date of original publication:
# December, 2004
#
# Description:
# This example draws streamlines over water on a map using a
# Cylindrical Eq... |
tests/test_model_serializer_deserialize.py | aswinkp/swampdragon | 366 | 12772005 | from swampdragon.serializers.model_serializer import ModelSerializer
from swampdragon.testing.dragon_testcase import DragonTestCase
from .models import TextModel, SDModel
from datetime import datetime
from django.db import models
# to make sure none of the ModelSerializer variables are clobbering the data
MODEL_KEYWO... |
workalendar/usa/pennsylvania.py | taiyeoguns/workalendar | 405 | 12772026 | <gh_stars>100-1000
from ..registry_tools import iso_register
from .core import UnitedStates
@iso_register('US-PA')
class Pennsylvania(UnitedStates):
"""Pennsylvania"""
include_good_friday = True
include_thanksgiving_friday = True
include_election_day_every_year = True
|
llvm/utils/lit/tests/Inputs/shtest-not/fail.py | medismailben/llvm-project | 2,338 | 12772054 | #!/usr/bin/env python
import print_environment
import sys
print_environment.execute()
sys.exit(1)
|
caffe2/python/layers/sampling_train.py | KevinKecc/caffe2 | 585 | 12772057 | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
cpmpy/fancy.py | tias/hakank | 279 | 12772065 | <reponame>tias/hakank
"""
Mr Greenguest puzzle (a.k.a fancy dress problem) in cpmpy.
Problem (and LPL) code in
http://diuflx71.unifr.ch/lpl/GetModel?name=/demo/demo2
'''
Mr. Greenfan wants to give a dress party where the male guests
must wear green dresses. The following rules are given:
1 If someone wears a green ... |
judge/supplementary_gt.py | zwangab91/ctw-baseline | 333 | 12772076 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import matplotlib.pyplot as plt
import os
import plot_tools
import settings
from pythonapi import anno_tools
def plt_print_text(*a... |
nuplan/planning/training/preprocessing/test/test_collate_dataloader.py | motional/nuplan-devkit | 128 | 12772103 | import unittest
import torch.utils.data
from nuplan.planning.scenario_builder.nuplan_db.test.nuplan_scenario_test_utils import get_test_nuplan_scenario
from nuplan.planning.simulation.trajectory.trajectory_sampling import TrajectorySampling
from nuplan.planning.training.data_loader.scenario_dataset import ScenarioDat... |
pypy/tool/pytest/app_rewrite.py | nanjekyejoannah/pypy | 333 | 12772105 | import re
ASCII_IS_DEFAULT_ENCODING = False
cookie_re = re.compile(r"^[ \t\f]*#.*coding[:=][ \t]*[-\w.]+")
BOM_UTF8 = '\xef\xbb\xbf'
def _prepare_source(fn):
"""Read the source code for re-writing."""
try:
stat = fn.stat()
source = fn.read("rb")
except EnvironmentError:
return Non... |
challenges/8.3.Function_Documentation_Strings/lesson_tests.py | pradeepsaiu/python-coding-challenges | 141 | 12772125 | import unittest
from main import *
class FunctionDocumentationStringsTests(unittest.TestCase):
def test_main(self):
self.assertIsNone(docstring_function())
self.assertIsNotNone(docstring_function.__doc__)
self.assertIsInstance(docstring_function.__doc__, str)
|
tables/table-alter/parse-turk-info.py | yash-srivastava19/sempre | 812 | 12772129 | <filename>tables/table-alter/parse-turk-info.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, shutil, re, argparse, json
from codecs import open
from itertools import izip
from collections import defaultdict
def main():
parser = argparse.ArgumentParser()
parser.add_argument('infile')
parse... |
simple/game_loop_global.py | loyalgarlic/snakepit-game | 124 | 12772131 | import asyncio
from aiohttp import web
async def handle(request):
index = open("index.html", 'rb')
content = index.read()
return web.Response(body=content, content_type='text/html')
async def wshandler(request):
app = request.app
ws = web.WebSocketResponse()
await ws.prepare(request)
if ... |
protonfixes/gamefixes/280200.py | Citiroller/protonfixes | 213 | 12772140 | <reponame>Citiroller/protonfixes<filename>protonfixes/gamefixes/280200.py
""" Game fix for Eterium
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" Install xna40
"""
util.protontricks('xna40')
|
env/WritePolicyEnv.py | jeanqasaur/jeeves | 253 | 12772172 | <reponame>jeanqasaur/jeeves
import JeevesLib
# import fast.AST
# from collections import defaultdict
class WritePolicyEnv:
def __init__(self):
self.writers = {}
def mapPrimaryContext(self, ivar, ctxt):
self.writers[ivar] = ctxt
# This function associates a new set of write policies with a label.
def... |
tests.live/Python/test_live.py | Bradben/iqsharp | 115 | 12772183 | #!/bin/env python
# -*- coding: utf-8 -*-
##
# test_live.py: Tests Azure Quantum functionality Live.
##
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
##
## IMPORTS ##
import pytest
import warnings
## TESTS ##
def connect():
import qsharp.azure
return qsharp.azure.connect(
... |
tools/ffmpeg/playmany.py | AnantTiwari-Naman/pyglet | 1,160 | 12772200 | <filename>tools/ffmpeg/playmany.py<gh_stars>1000+
"""
Usage
playmany.py
Uses media_player to play a sequence of samples and record debug info
A configuration must be active, see command configure.py
If the active configuration has disallowed dbg overwrites it will do nothing.
If a playlist was provide... |
core/utils/render_utils.py | hyunynim/DIST-Renderer | 176 | 12772220 | import trimesh
import numpy as np
import cv2
import copy
import pickle
import torch
import pdb
def depth2normal(depth, f_pix_x, f_pix_y=None):
'''
To compute a normal map from the depth map
Input:
- depth: torch.Tensor (H, W)
- f_pix_x: K[0, 0]
- f_pix_y: K[1, 1]
Return:
- normal: t... |
packages/core/minos-microservice-aggregate/minos/aggregate/transactions/repositories/abc.py | minos-framework/minos-python | 247 | 12772229 | <gh_stars>100-1000
from __future__ import (
annotations,
)
from abc import (
ABC,
abstractmethod,
)
from datetime import (
datetime,
)
from typing import (
AsyncIterator,
Optional,
)
from uuid import (
UUID,
)
from minos.common import (
Inject,
Injectable,
Lock,
LockPool,
... |
pkg/package.py | bruce30262/idapkg | 125 | 12772256 | <reponame>bruce30262/idapkg
"""
Package-related classes and methods are in pkg.package module. All constructing arguments are accessible via property.
"""
import ctypes
import glob
import json
import os
import random
import runpy
import shutil
import sys
import traceback
import zipfile
import ida_kernwin
import ida_l... |
test/test_polar_decoding.py | NVlabs/sionna | 163 | 12772263 | #
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
try:
import sionna
except ImportError as e:
import sys
sys.path.append("../")
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
print('Number ... |
tests/openbb_terminal/stocks/due_diligence/test_csimarket_model.py | tehcoderer/GamestonkTerminal | 255 | 12772274 | <gh_stars>100-1000
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.due_diligence import csimarket_model
@pytest.mark.vcr
def test_get_suppliers(recorder):
result_txt = csimarket_model.get_suppliers(ticker="TSLA")
recorder.capture(result_txt)
... |
WebMirror/management/rss_parser_funcs/feed_parse_extractSharramycatsTranslations.py | fake-name/ReadableWebProxy | 193 | 12772282 | def extractSharramycatsTranslations(item):
"""
'Sharramycats Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
tagmap = [
('11 Ways to Forget Your Ex-Boyfriend', '11 Ways to Forget Y... |
torch_glow/tests/nodes/copy_test.py | YaronBenAtar/glow | 2,838 | 12772304 | <reponame>YaronBenAtar/glow<gh_stars>1000+
# Copyright (c) Glow Contributors. See CONTRIBUTORS file.
#
# 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/LIC... |
tests/tasks/sodaspark/test_sodaspark_tasks.py | suryatmodulus/prefect | 8,633 | 12772309 | from unittest.mock import MagicMock
import pytest
from pyspark.sql import SparkSession
from prefect.tasks.sodaspark import SodaSparkScan
class TestSodaSparkScan:
def test_construction_provide_scan_and_df(self):
expected_scan_def = "/foo/bar.yaml"
expected_df = SparkSession.builder.getOrCreate()... |
src/CheckersBot.py | kartikkukreja/blog-codes | 182 | 12772371 | <gh_stars>100-1000
from copy import deepcopy
from time import time
# Global Constants
MaxUtility = 1e9
IsPlayerBlack = True
MaxAllowedTimeInSeconds = 9.5
MaxDepth = 100
class CheckersState:
def __init__(self, grid, blackToMove, moves):
self.grid = grid
self.blackToMove = blackToMove
self.moves = moves ... |
localgraphclustering/algorithms/__init__.py | vishalbelsare/LocalGraphClustering | 106 | 12772372 | <gh_stars>100-1000
from .acl_list import acl_list
from .eig2_nL import eig2_nL, eig2nL_subgraph
from .fista_dinput_dense import fista_dinput_dense
from .sweepcut import sweepcut
|
examples/decompose_fmri_stability.py | johnbanq/modl | 135 | 12772373 | # Author: <NAME>
# License: BSD
import warnings
from nilearn.input_data import NiftiMasker
warnings.filterwarnings("ignore", category=DeprecationWarning)
import os
from os.path import expanduser, join
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from joblib import Memory, dump
from jobli... |
PYTHON/PasswordGen.py | ayushyado/HACKTOBERFEST2021-2 | 125 | 12772391 | <reponame>ayushyado/HACKTOBERFEST2021-2<filename>PYTHON/PasswordGen.py
import string
import random
#Characters List to Generate Password
characters = list(string.ascii_letters + string.digits + "!@#$%^&*()")
def password_gen():
#Length of Password from the User
length = int(input("Password length: "))
#Shuffling ... |
icevision/models/mmdet/models/retinanet/backbones/resnet_fpn.py | bluseking/-first-agnostic-computer-vision-framework-to-offer-a-curated-collection-with-hundreds-of-high-qualit | 580 | 12772407 | __all__ = [
"resnet50_caffe_fpn_1x",
"resnet50_fpn_1x",
"resnet50_fpn_2x",
"resnet101_caffe_fpn_1x",
"resnet101_fpn_1x",
"resnet101_fpn_2x",
"resnext101_32x4d_fpn_1x",
"resnext101_32x4d_fpn_2x",
"resnext101_64x4d_fpn_1x",
"resnext101_64x4d_fpn_2x",
]
from icevision.imports impor... |
docs/source/conftest.py | chaaklau/pycantonese | 124 | 12772409 | """Test code snippets embedded in the docs.
Reference: https://sybil.readthedocs.io/en/latest/use.html#pytest
"""
from doctest import NORMALIZE_WHITESPACE
from os import chdir, getcwd
from shutil import rmtree
from tempfile import mkdtemp
import pytest
from sybil import Sybil
from sybil.parsers.doctest import DocTes... |
multitask_benchmark/datasets_generation/graph_algorithms.py | Michaelvll/pna | 249 | 12772440 | <reponame>Michaelvll/pna<filename>multitask_benchmark/datasets_generation/graph_algorithms.py
import math
from queue import Queue
import numpy as np
def is_connected(A):
"""
:param A:np.array the adjacency matrix
:return:bool whether the graph is connected or not
"""
for _ in range(int(1 + math.c... |
test/unit/config/test_reload_config.py | rikeshi/galaxy | 1,085 | 12772450 | <filename>test/unit/config/test_reload_config.py
import pytest
from galaxy import config
from galaxy.config import BaseAppConfiguration
from galaxy.config import reload_config_options
from galaxy.config.schema import AppSchema
R1, R2, N1, N2 = 'reloadable1', 'reloadable2', 'nonrelodable1', 'nonreloadable2' # config... |
tastyworks/__init__.py | olyoberdorf/tastyworks_api | 198 | 12772487 | <gh_stars>100-1000
import logging
import sys
log = logging.getLogger(__name__)
log.propagate = False
out_hdlr = logging.StreamHandler(sys.stdout)
out_hdlr.setFormatter(logging.Formatter('%(asctime)s %(message)s'))
out_hdlr.setLevel(logging.INFO)
log.addHandler(out_hdlr)
log.setLevel(logging.INFO)
root = logging.getLo... |
src/jNlp/eProcessing.py | Reynolddoss/jProcessing | 133 | 12772495 | <filename>src/jNlp/eProcessing.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pkg_resources import resource_stream
import sys, os, subprocess
from subprocess import call
import xml.etree.cElementTree as etree
import nltk
from nltk.stem.wordnet import WordNetLemmatizer
if __name__ == '__main__':
pass
|
pgcontents/checkpoints.py | freedom079215/pgcontents | 138 | 12772513 | <reponame>freedom079215/pgcontents
"""
An IPython FileContentsManager that uses Postgres for checkpoints.
"""
from __future__ import unicode_literals
from .api_utils import (
_decode_unknown_from_base64,
outside_root_to_404,
reads_base64,
to_b64,
writes_base64,
)
from .managerbase import PostgresMa... |
riptable/rt_meta.py | 972d5defe3218bd62b741e6a2f11f5b3/riptable | 307 | 12772516 | __all__ = ['Item', 'Info', 'Doc', 'apply_schema', 'info', 'doc']
from typing import Optional, List
from .rt_struct import Struct
from .rt_fastarray import FastArray
from .rt_display import DisplayText
META_DICT = '_meta'
DOC_KEY = 'Doc'
DESCRIPTION_KEY = 'Description'
STEWARD_KEY = 'Steward'
TYPE_KEY = '... |
en_transformer/utils.py | dumpmemory/En-transformer | 108 | 12772518 | <filename>en_transformer/utils.py
import torch
from torch import sin, cos, atan2, acos
def rot_z(gamma):
return torch.tensor([
[cos(gamma), -sin(gamma), 0],
[sin(gamma), cos(gamma), 0],
[0, 0, 1]
], dtype = gamma.dtype)
def rot_y(beta):
return torch.tensor([
[cos(beta), 0, ... |
recruiter/api_urls.py | b1pb1p/opensource-job-portal | 199 | 12772554 | <filename>recruiter/api_urls.py
from django.urls import path, re_path
from recruiter import api_views
app_name = "api_recruiter"
urlpatterns = [
path("login/", api_views.login_view, name="api_login"),
path("out/", api_views.getout, name="getout"),
path("change-password/", api_views.change_password, name... |
tools/reval_discovery.py | AdilSiddiqui131/OIM | 231 | 12772556 | <filename>tools/reval_discovery.py
#!/usr/bin/env python
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""Reval = re-eval. ... |
pysec/core/ctx.py | benhunter/owasp-pysec | 416 | 12772562 | <filename>pysec/core/ctx.py
# Python Security Project (PySec) and its related class files.
#
# PySec is a set of tools for secure application development under Linux
#
# Copyright 2014 PySec development team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... |
examples/pytorch/vision/Face_Detection/eval.py | cw18-coder/EdgeML | 719 | 12772567 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import torch
import torch.nn as nn
import torch.utils.data as data
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
import os
import time
import argparse
import numpy as np
from PIL import Ima... |
codigo/Live173/exemplo_tk.py | BrunoPontesLira/live-de-python | 572 | 12772586 | from tkinter import Tk, Label
root = Tk()
a = Label(root, text='Live de Python', font=('Arial', 30))
a.pack()
root.mainloop()
|
flightrl/rpg_baselines/ppo/ppo2_test.py | MarioBonse/flightmare | 596 | 12772587 | <reponame>MarioBonse/flightmare<filename>flightrl/rpg_baselines/ppo/ppo2_test.py<gh_stars>100-1000
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
def test_model(env, model, render=False):
#
fig = plt.figure(figsize=(18, 12), tight_layout=True)
gs = gridspec.GridS... |
test_numpy_embedding.py | morpheusthewhite/twitter-sent-dnn | 314 | 12772591 | <gh_stars>100-1000
import theano
import numpy as np
from dcnn import WordEmbeddingLayer
from dcnn_train import WordEmbeddingLayer as TheanoWordEmbeddingLayer
from test_util import assert_matrix_eq
########### NUMPY ###########
vocab_size, embed_dm = 10, 5
embeddings = np.random.rand(vocab_size, embed_dm)
sents = np.as... |
recipes/structopt/all/conanfile.py | rockandsalt/conan-center-index | 562 | 12772595 | import os
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
class StructoptConan(ConanFile):
name = "structopt"
homepage = "https://github.com/p-ranav/structopt"
url = "https://github.com/conan-io/conan-center-index"
description = "Parse command line arguments by d... |
src/TulsiGenerator/Scripts/install_genfiles_tests.py | comius/tulsi | 511 | 12772607 | <gh_stars>100-1000
# Copyright 2018 The Tulsi 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 requ... |
Tests/Marketplace/Tests/test_pack_dependencies.py | satyakidroid/content | 799 | 12772636 | <reponame>satyakidroid/content<gh_stars>100-1000
# type: ignore[attr-defined]
from unittest.mock import patch
import networkx as nx
from Tests.Marketplace.packs_dependencies import calculate_single_pack_dependencies
def find_pack_display_name_mock(pack_folder_name):
return pack_folder_name
class TestCalculateS... |
util/rev_info.py | ccwanggl/smartknob | 3,836 | 12772649 | <reponame>ccwanggl/smartknob
import datetime
import subprocess
def git_short_rev():
try:
return subprocess.check_output([
'git',
'rev-parse',
'--short',
'HEAD',
]).decode('utf-8').strip()
except Exception:
raise RuntimeError("Could not rea... |
test/pytest/test_anonymous_group.py | showipintbri/ttp | 254 | 12772650 | <filename>test/pytest/test_anonymous_group.py
import sys
sys.path.insert(0, "../..")
import pprint
from ttp import ttp
def test_simple_anonymous_template():
template_1 = """interface {{ interface }}
description {{ description | ORPHRASE }}"""
data_1 = """
interface Port-Chanel11
description Storage Man... |
openproblems/utils.py | bendemeo/SingleCellOpenProblems | 134 | 12772674 | <reponame>bendemeo/SingleCellOpenProblems
from .version import __version__
import decorator
import packaging.version
@decorator.decorator
def temporary(func, version=None, *args, **kwargs):
"""Decorate a function as a temporary fix.
Parameters
----------
version : str
Version after which thi... |
Multiprocessing/single.py | commoncdp2021/Gun-Gaja-Gun | 171 | 12772676 | <filename>Multiprocessing/single.py
#!/usr/bin/python
from gen_rand import gen_random_data
if __name__ == '__main__':
gen_random_data()
gen_random_data()
gen_random_data()
gen_random_data() |
src/mobile_seg/modules/wrapper.py | murez/mobile-semantic-segmentation | 713 | 12772678 | <reponame>murez/mobile-semantic-segmentation
import torch
import torch.nn as nn
from mobile_seg.modules.net import MobileNetV2_unet
class Wrapper(nn.Module):
def __init__(
self,
unet: MobileNetV2_unet,
scale: float = 255.
):
super().__init__()
self.unet = u... |
nanopore-human-transcriptome/scripts/bulk_signal_read_correction/make_reads.py | hasindu2008/NA12878 | 345 | 12772693 | import sys
from pathlib import Path
from argparse import ArgumentParser
import h5py
import pandas as pd
import numpy as np
from tqdm import tqdm
from export import export_read_file
def get_args():
parser = ArgumentParser(description="Parse sequencing_summary.txt files and .paf files to find split reads "
... |
src/chapter-4/conftest.py | luizyao/pytest-chinese-doc | 283 | 12772698 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
'''
Author: <NAME> (<EMAIL>)
Created Date: 2019-09-19 5:35:12
-----
Last Modified: 2019-10-07 8:27:16
Modified By: <NAME> (<EMAIL>)
-----
THIS PROGRAM IS FREE SOFTWARE, IS LICENSED UNDER MIT.
A short and simple permissive license with conditions
only requiring preservation... |
tests/python/frontend/mxnet/model_zoo/squeezenet.py | XiaoSong9905/tvm | 4,640 | 12772719 | <reponame>XiaoSong9905/tvm
# 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
... |
homeassistant/components/webostv/trigger.py | MrDelik/core | 30,023 | 12772799 | """webOS Smart TV trigger dispatcher."""
from __future__ import annotations
from typing import cast
from homeassistant.components.automation import (
AutomationActionType,
AutomationTriggerInfo,
)
from homeassistant.const import CONF_PLATFORM
from homeassistant.core import CALLBACK_TYPE, HomeAssistant
from ho... |
model.py | lFatality/tensorflow2caffe | 115 | 12772825 | <reponame>lFatality/tensorflow2caffe
from tflearn import input_data, conv_2d, max_pool_2d, fully_connected, dropout, Momentum, regression, DNN
#model of vgg-19
def vgg_net_19(width, height):
network = input_data(shape=[None, height, width, 3], name='input')
network = conv_2d(network, 64, 3, activation = 'relu'... |
docs/snippets/ov_python_exclusives.py | kurylo/openvino | 1,127 | 12772826 | # Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
#! [auto_compilation]
import openvino.runtime as ov
compiled_model = ov.compile_model("model.xml")
#! [auto_compilation]
#! [properties_example]
core = ov.Core()
input_a = ov.opset8.parameter([8])
res = ov.opset8.a... |
samples/aci-epg-reports-in-yaml.py | richardstrnad/acitoolkit | 351 | 12772846 | #!/usr/bin/env python
"""
Simple application that logs on to the APIC and displays all
EPGs.
"""
import socket
import yaml
import sys
from acitoolkit import Credentials, Session, Tenant, AppProfile, EPG, Endpoint
def main():
"""
Main show EPGs routine
:return: None
"""
# Login to APIC
descrip... |
tests/test_write.py | sphh/RPLCD | 231 | 12772849 | <reponame>sphh/RPLCD
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import pytest
from RPLCD.gpio import CharLCD
from RPLCD.common import LCD_SETDDRAMADDR
def test_write_simple(mocker, charlcd_kwargs):
"""
Write "HelloWorld" to the display.
"""... |
demo/align_face.py | hologerry/pix2pix-flow | 2,898 | 12772853 | # OLD USAGE
# python align_faces.py --shape-predictor shape_predictor_68_face_landmarks.dat --image images/example_01.jpg
# import the necessary packages
from imutils.face_utils import FaceAligner
from PIL import Image
import numpy as np
# import argparse
import imutils
import dlib
import cv2
# construct the argument... |
data_pipeline/testing_helpers/kafka_docker.py | poros/data_pipeline | 110 | 12772865 | # -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ag... |
lib/bindings/samples/server/debug/profiling_output.py | tlalexander/stitchEm | 182 | 12772903 | import threading
import errors
import vs
import logging
import gc
from blinker import signal
from utils import performance
from output.output import Output
# We need to be able to load (not run) vs_server on windows to generate the documentation.
# So we're skipping non-windows imports
try:
import psutil
except... |
cloudpathlib/local/__init__.py | kabirkhan/cloudpathlib | 128 | 12772926 | <filename>cloudpathlib/local/__init__.py
"""This module implements "Local" classes that mimic their associated `cloudpathlib` non-local
counterparts but use the local filesystem in place of cloud storage. They can be used as drop-in
replacements, with the intent that you can use them as mock or monkepatch substitutes i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.