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 |
|---|---|---|---|---|
sympy/polys/tests/test_polymatrix.py | iamabhishek0/sympy | 603 | 12675281 | <gh_stars>100-1000
from sympy.matrices.dense import Matrix
from sympy.polys.polymatrix import PolyMatrix
from sympy.polys import Poly
from sympy import S, ZZ, QQ, EX
from sympy.abc import x
def test_polymatrix():
pm1 = PolyMatrix([[Poly(x**2, x), Poly(-x, x)], [Poly(x**3, x), Poly(-1 + x, x)]])
v1 = PolyMat... |
server/intrinsic/algorithm/grosse2009/poisson.py | paulu/opensurfaces | 137 | 12675293 | import numpy as np
import pyamg
import scipy.sparse
def get_gradients(I):
"""Get the vertical (derivative-row) and horizontal (derivative-column) gradients
of an image."""
I_y = np.zeros(I.shape)
I_y[1:, :, ...] = I[1:, :, ...] - I[:-1, :, ...]
I_x = np.zeros(I.shape)
I_x[:, 1:, ...] = I[:, 1:... |
qiskit/test/mock/backends/paris/fake_paris.py | Roshan-Thomas/qiskit-terra | 1,599 | 12675299 | <reponame>Roshan-Thomas/qiskit-terra<filename>qiskit/test/mock/backends/paris/fake_paris.py<gh_stars>1000+
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# o... |
test/test_3gpp_channel_channel_coefficients.py | NVlabs/sionna | 163 | 12675336 | #
# 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 ... |
packages/syft/src/syft/core/node/vm/__init__.py | vishalbelsare/PySyft | 8,428 | 12675340 | # stdlib
from typing import Dict # noqa: F401
# relative
from ..common.node_service.node_service import NodeService # noqa: F401
from .client import VirtualMachineClient
from .vm import VirtualMachine
message_service_mapping: Dict[str, NodeService] = {}
__all__ = [
"NodeService",
"VirtualMachineClient",
... |
youtube_dl/extractor/beampro.py | hackarada/youtube-dl | 3,001 | 12675350 | <filename>youtube_dl/extractor/beampro.py
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
compat_str,
float_or_none,
int_or_none,
parse_iso8601,
try_get,
urljoin,
)
class BeamProBaseIE(InfoExtr... |
applications/admin.py | crydotsnake/djangogirls | 446 | 12675354 | from adminsortable2.admin import SortableAdminMixin
from django.contrib import admin
from django.shortcuts import redirect, render
from django.urls import reverse, path
from django.utils.html import format_html
from core.models import Event
from .models import Answer, Application, Email, Form, Question
class FormAd... |
igibson/utils/muvr_utils.py | suresh-guttikonda/iGibson | 360 | 12675366 | <reponame>suresh-guttikonda/iGibson
""" Utility classes and functions needed for the multi-user VR experience. """
import copy
import time
from collections import defaultdict
from time import sleep
import numpy as np
from PodSixNet.Channel import Channel
from PodSixNet.Connection import ConnectionListener, connectio... |
pogom/pgoapi/protos/POGOProtos/Networking/Responses/ReleasePokemonResponse_pb2.py | tier4fusion/pogom-updated | 463 | 12675375 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Responses/ReleasePokemonResponse.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
f... |
Algo and DSA/LeetCode-Solutions-master/Python/last-substring-in-lexicographical-order.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12675379 | # Time: O(n)
# Space: O(1)
class Solution(object):
def lastSubstring(self, s):
"""
:type s: str
:rtype: str
"""
left, right, l = 0, 1, 0
while right+l < len(s):
if s[left+l] == s[right+l]:
l += 1
continue
if s[... |
pyethapp/eth_service.py | josephites/pyethapp | 1,519 | 12675390 | <reponame>josephites/pyethapp
# -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division
from builtins import str
from builtins import range
from past.utils import old_div
from builtins import object
import copy
import time
import statistics
from collections import deque
import geven... |
examples/basic/tube.py | hadivafaii/vedo | 836 | 12675407 | <gh_stars>100-1000
"""Use array to vary radius and color
of a line represented as a tube"""
from vedo import *
import numpy as np
settings.defaultFont = 'Quikhand'
ln = [[sin(x), cos(x), x / 2] for x in np.arange(0,9, 0.1)]
N = len(ln)
############################### a simple tube( along ln
t1 = Tube(ln, c="blue", r... |
Lib/idlelib/idle_test/test_macosx.py | oleksandr-pavlyk/cpython | 52,316 | 12675421 | "Test macosx, coverage 45% on Windows."
from idlelib import macosx
import unittest
from test.support import requires
import tkinter as tk
import unittest.mock as mock
from idlelib.filelist import FileList
mactypes = {'carbon', 'cocoa', 'xquartz'}
nontypes = {'other'}
alltypes = mactypes | nontypes
def setUpModule()... |
lstm_chem/data_loader.py | Janson-L/fch-drug-discovery | 400 | 12675424 | <gh_stars>100-1000
import json
import os
import numpy as np
from tqdm import tqdm
from tensorflow.keras.utils import Sequence
from lstm_chem.utils.smiles_tokenizer import SmilesTokenizer
class DataLoader(Sequence):
def __init__(self, config, data_type='train'):
self.config = config
self.data_type ... |
tensortrade/agents/dqn_agent.py | highburygambit/tensortrade | 3,081 | 12675426 | <reponame>highburygambit/tensortrade
# Copyright 2020 The TensorTrade Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
pyannote/audio/train/generator.py | avramandrei/pyannote-audio | 1,543 | 12675430 | <reponame>avramandrei/pyannote-audio
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2019-2020 CNRS
# 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 ... |
tests/utils/test_exception.py | freefrag/mlflow | 1,825 | 12675471 | <filename>tests/utils/test_exception.py<gh_stars>1000+
from mlflow.exceptions import ExecutionException
def test_execution_exception_string_repr():
exc = ExecutionException("Uh oh")
assert str(exc) == "Uh oh"
|
tests/unit/test_model.py | l00ptr/temboard | 294 | 12675477 | <reponame>l00ptr/temboard<gh_stars>100-1000
import pytest
def test_check_connectivity_ok(mocker):
from temboardui.model import check_connectivity
engine = mocker.Mock(name='engine')
check_connectivity(engine)
assert engine.connect().close.called is True
def test_check_connectivity_sleep(mocker):
... |
pygtkweb/demos/027-fixed.py | takipsizad/pyjs | 739 | 12675504 | <gh_stars>100-1000
#!/usr/bin/env python
# example fixed.py
import pygtk
pygtk.require('2.0')
import gtk
class FixedExample:
# This callback method moves the button to a new position
# in the Fixed container.
def move_button(self, widget):
self.x = (self.x+30)%300
self.y = (self.y+50)%300... |
examples/misc/djangotasks/todo/models.py | takipsizad/pyjs | 739 | 12675511 | <reponame>takipsizad/pyjs
from django.db import models
class Todo(models.Model):
task = models.CharField(max_length=30)
def __unicode__(self):
return unicode(self.task)
# Create your models here.
|
tests/runtime/test_nutterfixure_fullroundtriptests.py | cganta/dbtest | 130 | 12675525 | <reponame>cganta/dbtest<filename>tests/runtime/test_nutterfixure_fullroundtriptests.py
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
"""
import sys
import pytest
from runtime.nutterfixture import NutterFixture, tag
from common.testresult import TestResult
from tests.runtime.testnutterfixtur... |
llvm/tools/opt-viewer/optpmap.py | medismailben/llvm-project | 4,812 | 12675532 | import sys
import multiprocessing
_current = None
_total = None
def _init(current, total):
global _current
global _total
_current = current
_total = total
def _wrapped_func(func_and_args):
func, argument, should_print_progress, filter_ = func_and_args
if should_print_progress:
wit... |
third_party/google-endpoints/oauth2client/devshell.py | tingshao/catapult | 2,151 | 12675544 | # Copyright 2015 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.0
#
# Unless required by applicable law or ... |
xautodl/procedures/optimizers.py | D-X-Y/NAS-Projects | 378 | 12675559 | #####################################################
# Copyright (c) <NAME> [GitHub D-X-Y], 2019.01 #
#####################################################
import math, torch
import torch.nn as nn
from bisect import bisect_right
from torch.optim import Optimizer
class _LRScheduler(object):
def __init__(self, opt... |
Computer Vision/motion_detection.py | sattwik21/Hacktoberfest2021-1 | 215 | 12675566 | # we need to store the current frame of the video as soon as the video starts , we need to store that numpy array in variable , and have that variable static , so we don't want to change the value of the variable while the while loop runs in the script. as it will be set as the background.
# when the motion occur it ... |
fuzzers/symcc_aflplusplus/fuzzer.py | che30122/fuzzbench | 800 | 12675576 | <reponame>che30122/fuzzbench
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
src/sort.py | lady0528/Face-Track-Detect-Extract | 505 | 12675602 | <filename>src/sort.py<gh_stars>100-1000
"""
As implemented in https://github.com/abewley/sort but with some modifications
"""
from __future__ import print_function
import lib.utils as utils
import numpy as np
from src.data_association import associate_detections_to_trackers
from src.kalman_tracker import KalmanBoxTra... |
third_party/blink/renderer/bindings/scripts/web_idl/namespace.py | chromium/chromium | 14,668 | 12675606 | <reponame>chromium/chromium<filename>third_party/blink/renderer/bindings/scripts/web_idl/namespace.py
# Copyright 2019 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.
import itertools
from .attribute import Attribute
from... |
tracking/argmax_tracker.py | mhd-medfa/SiamR-CNN | 195 | 12675615 | import cv2
import random
import numpy as np
from got10k.trackers import Tracker
from config import config as cfg, finalize_configs
from tensorpack import PredictConfig, get_model_loader, OfflinePredictor, logger
from train import ResNetFPNModel
from common import CustomResize, box_to_point8, point8_to_box
class Prec... |
mask-rcnn/mask_rcnn.py | mimigreg/basketballVideoAnalysis | 203 | 12675620 | <filename>mask-rcnn/mask_rcnn.py
# USAGE
# python mask_rcnn.py --mask-rcnn mask-rcnn-coco --image images/example_01.jpg
# python mask_rcnn.py --mask-rcnn mask-rcnn-coco --image images/example_03.jpg --visualize 1
# import the necessary packages
import numpy as np
import argparse
import random
import time
import cv2
im... |
rllab/envs/mujoco/swimmer_env.py | ICRA-2018/gcg | 120 | 12675621 | from rllab.envs.base import Step
from rllab.misc.overrides import overrides
from .mujoco_env import MujocoEnv
import numpy as np
from rllab.core.serializable import Serializable
from rllab.misc import logger
from rllab.misc import autoargs
class SwimmerEnv(MujocoEnv, Serializable):
FILE = 'swimmer.xml'
@aut... |
torrent_file/get_files.py | DazEB2/SimplePyScripts | 117 | 12675627 | <filename>torrent_file/get_files.py<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import effbot_bencode
import another_bencode
import bencode_py3
with open('_.torrent', 'rb') as f:
torrent_file_bytes = f.read()
torrent_file_text = torrent_file_bytes.decode('latin1')
torrent = effbot_benc... |
tests/tile_test.py | jnice-81/dace | 227 | 12675630 | <reponame>jnice-81/dace
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from __future__ import print_function
import argparse
import dace
import math
import numpy as np
W = dace.symbol('W')
H = dace.symbol('H')
TW = dace.symbol('TW')
TH = dace.symbol('TH')
@dace.program
def transpose_ti... |
dask/bytes/tests/test_local.py | aeisenbarth/dask | 9,684 | 12675631 | <gh_stars>1000+
import gzip
import os
import pathlib
import sys
from functools import partial
from time import sleep
import cloudpickle
import pytest
from fsspec.compression import compr
from fsspec.core import open_files
from fsspec.implementations.local import LocalFileSystem
from packaging.version import parse as p... |
tests/components/cover/test_device_action.py | liangleslie/core | 30,023 | 12675667 | <reponame>liangleslie/core
"""The tests for Cover device actions."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.cover import (
DOMAIN,
SUPPORT_CLOSE,
SUPPORT_CLOSE_TILT,
SUPPORT_OPEN,
SUPPORT_OPEN_TILT,
SUPPORT_SET_POSITION,
SUPPORT_... |
skidl/libs/wiznet_sklib.py | arjenroodselaar/skidl | 700 | 12675677 | from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
wiznet = SchLib(tool=SKIDL).add_parts(*[
Part(name='W5100',dest=TEMPLATE,tool=SKIDL,keywords='Wiznet Ethernet controller',description='WizNet W5100 10/100Mb Ethernet controller with TCP/IP stack',ref_prefix='U',num_units=1,fplist... |
tests/test_extraction_metrics.py | pwang00/PrivacyRaven | 121 | 12675682 | # This test code was modified from code written by the `hypothesis.extra.ghostwriter` module
# and is provided under the Creative Commons Zero public domain dedication.
import argparse
import numpy as np
import pytest
import torch
from hypothesis import assume, given
from hypothesis import strategies as st
from hypot... |
SoftLayer/fixtures/SoftLayer_Billing_Invoice.py | dvzrv/softlayer-python | 126 | 12675683 | getInvoiceTopLevelItems = [
{
'categoryCode': 'sov_sec_ip_addresses_priv',
'createDate': '2018-04-04T23:15:20-06:00',
'description': '64 Portable Private IP Addresses',
'id': 724951323,
'oneTimeAfterTaxAmount': '0',
'recurringAfterTaxAmount': '0',
'hostName': ... |
Docs/torch_code_examples/model_validator_code_example.py | lipovsek/aimet | 945 | 12675742 | # /usr/bin/env python3.5
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification,... |
tests/importer/onnx_/basic/test_expand.py | xhuohai/nncase | 510 | 12675744 | # Copyright 2019-2021 Canaan 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 to in writ... |
ndscheduler/corescheduler/datastore/base.py | JonathanCalderon/ndscheduler | 1,038 | 12675748 | """Base class to represent datastore."""
import dateutil.tz
import dateutil.parser
from apscheduler.jobstores import sqlalchemy as sched_sqlalchemy
from sqlalchemy import desc, select, MetaData
from ndscheduler.corescheduler import constants
from ndscheduler.corescheduler import utils
from ndscheduler.corescheduler.d... |
src/tests/analyzer_helpers.py | swellander/tryceratops | 269 | 12675752 | import ast
import os
from typing import Iterable
from tryceratops.violations import Violation
def read_sample(filename: str) -> ast.AST:
ref_dir = f"{os.path.dirname(__file__)}/samples/violations/"
path = f"{ref_dir}{filename}.py"
with open(path) as sample:
content = sample.read()
loaded... |
scale/error/__init__.py | kaydoh/scale | 121 | 12675761 | <filename>scale/error/__init__.py
"""The standard interface for errors in scale"""
default_app_config = 'error.apps.ErrorConfig'
|
rfcn/function/train_rpn.py | YAMLONG/Deformable-ConvNets | 344 | 12675764 | <reponame>YAMLONG/Deformable-ConvNets
# --------------------------------------------------------
# Deformable Convolutional Networks
# Copyright (c) 2016 by Contributors
# Copyright (c) 2017 Microsoft
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Modified by <NAME>
# ------------------------------... |
modules/people.py | groovychoons/yoda | 747 | 12675765 | from __future__ import absolute_import
from builtins import str
from builtins import input
import datetime
from .config import get_config_file_paths
from .util import *
# config file path
PEOPLE_CONFIG_FILE_PATH = get_config_file_paths()["PEOPLE_CONFIG_FILE_PATH"]
PEOPLE_CONFIG_FOLDER_PATH = get_folder_path_from_file_... |
armada_backend/runtime_settings.py | firesoft/armada | 281 | 12675775 | from armada_backend import consul_config
from armada_backend.models.ships import get_ship_name, get_other_ship_ips
from armada_backend.utils import get_current_datacenter, is_ship_commander, \
setup_sentry, get_logger
from armada_command.dockyard import alias
from armada_command.scripts.compat import json
def _sa... |
terrascript/data/AdrienneCohea/nomadutility.py | mjuenema/python-terrascript | 507 | 12675778 | # terrascript/data/AdrienneCohea/nomadutility.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:22:45 UTC)
__all__ = []
|
test/functional/interface_zmq_dash.py | Easonyule/dash | 1,573 | 12675798 | #!/usr/bin/env python3
# Copyright (c) 2018-2021 The Dash Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the dash specific ZMQ notification interfaces."""
import configparser
from enum import Enum
import i... |
convlab/modules/nlu/multiwoz/svm/corpora/scripts/score.py | ngduyanhece/ConvLab | 405 | 12675800 | from __future__ import print_function
# Modified by Microsoft Corporation.
# Licensed under the MIT license.
###############################################################################
# PyDial: Multi-domain Statistical Spoken Dialogue System Software
###############################################################... |
nemo_text_processing/inverse_text_normalization/de/taggers/fraction.py | hamjam/NeMo | 4,145 | 12675825 | # Copyright (c) 2021, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
pypy/module/_pypyjson/test/test__pypyjson.py | nanjekyejoannah/pypy | 333 | 12675829 | # -*- encoding: utf-8 -*-
import pytest
from pypy.module._pypyjson.interp_decoder import JSONDecoder, Terminator, MapBase
from rpython.rtyper.lltypesystem import lltype, rffi
class TestJson(object):
def test_skip_whitespace(self):
s = ' hello '
dec = JSONDecoder(self.space, s)
assert d... |
instant/tests/base.py | synw/django-instant | 103 | 12675844 | from pathlib import Path
from django.test import TestCase
from django.test.client import RequestFactory
from django.contrib.auth.models import User
from django.conf import settings
from instant.models import Channel
class InstantBaseTest(TestCase):
user = None
def setUp(self):
self.factory = Reques... |
software/fpga/ov3/sim/test_sdramctlmux.py | twam/ov_ftdi | 247 | 12675862 | from migen import *
from ovhw.sdram_mux import SDRAMMux
import unittest
import sim.sdram_test_util
class SDRAMMultiTester(sim.sdram_test_util.SDRAMUTFramework):
class TestBench(Module):
"""
Test module consisting of the Emulated SDRAM + Controller complex, and an
SDRAM mux.
For ea... |
components/partition_table/tests/gen_esp32part_tests.py | ghsecuritylab/git_hub_other | 104 | 12675868 | #!/usr/bin/env python
import unittest
import struct
import csv
import sys
import subprocess
import tempfile
import os
sys.path.append("..")
from gen_esp32part import *
SIMPLE_CSV = """
# Name,Type,SubType,Offset,Size,Flags
factory,0,2,65536,1048576,
"""
LONGER_BINARY_TABLE = ""
# type 0x00, subtype 0x00,
# offset 64K... |
examples/27_get_module_properties.py | drbitboy/pylogix | 350 | 12675875 | <gh_stars>100-1000
'''
the following import is only necessary because eip.py is not in this directory
'''
import sys
sys.path.append('..')
'''
Get the properties of a module in the specified slot
In this example, we're getting the slot 0 module
properties
'''
from pylogix import PLC
with PLC() as comm:
comm.IPAd... |
plotdevice/lib/cocoa.py | plotdevice/plotdevice | 110 | 12675900 | # all the NSBits and NSPieces
from Quartz import CALayer, CGColorCreate, CGContextAddPath, CGContextAddRect, CGContextBeginPath, \
CGContextBeginTransparencyLayer, CGContextBeginTransparencyLayerWithRect, \
CGContextClip, CGContextClipToMask, CGContextDrawPath, CGContextEOClip, \
... |
tests/python/unittest/test_contrib_krprod.py | Vikas-kum/incubator-mxnet | 228 | 12675911 | <reponame>Vikas-kum/incubator-mxnet
# 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 ... |
tools/perf/page_sets/blank_page_with_large_profile.py | google-ar/chromium | 777 | 12675931 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from page_sets import pregenerated_large_profile_shared_state
from telemetry.page import page as page_module
from telemetry import story
class BlankPageWith... |
GP/Assets/code/extensions/IOV2.py | EnviralDesign/GeoPix | 134 | 12675973 | <gh_stars>100-1000
import os
TDF = op.TDModules.mod.TDFunctions
TDJ = op.TDModules.mod.TDJSON
# define IO globals.
# IO_BACKEND = op.IOV2
# IO_TEMPLATES = op.IO_templates
# IO_SCENE = parent.IO.par.Scenegeocomp.eval()
# IO_TOOLS = op.IO_logic
# IO_VIEWPORT = op.IOV2.op('Graph')
# IO_NOTIFICATIONS = op.IO_notif_center... |
cogdl/data/__init__.py | YuHuang42/cogdl | 824 | 12675982 | <gh_stars>100-1000
from .data import Data
from .batch import Batch
from .dataset import Dataset
from .dataloader import DataLoader, DataListLoader, DenseDataLoader
from .download import download_url
from .extract import extract_tar, extract_zip, extract_bz2, extract_gz
__all__ = [
"Data",
"Batch",
"Dataset... |
milk/tests/test_normalise.py | luispedro/milk | 284 | 12675984 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2012, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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 w... |
mmcv/video/__init__.py | WanEnNg/mmcv | 384 | 12676045 | <reponame>WanEnNg/mmcv
from .io import Cache, VideoReader, frames2video
from .processing import convert_video, resize_video, cut_video, concat_video
from .optflow import (flowread, flowwrite, quantize_flow, dequantize_flow,
flow_warp)
__all__ = [
'Cache', 'VideoReader', 'frames2video', 'conve... |
become_yukarin/config/config.py | nameless-writer/become-yukarin | 562 | 12676059 | <gh_stars>100-1000
import json
from pathlib import Path
from typing import Dict
from typing import List
from typing import NamedTuple
from typing import Optional
from typing import Union
from become_yukarin.param import Param
class DatasetConfig(NamedTuple):
param: Param
input_glob: Path
target_glob: Pat... |
configs/pointnet2/pointnet2_msg_16x2_cosine_80e_s3dis_seg-3d-13class.py | Guangyun-Xu/mmdetection3d | 2,216 | 12676076 | <reponame>Guangyun-Xu/mmdetection3d<gh_stars>1000+
_base_ = [
'../_base_/datasets/s3dis_seg-3d-13class.py',
'../_base_/models/pointnet2_msg.py',
'../_base_/schedules/seg_cosine_50e.py', '../_base_/default_runtime.py'
]
# data settings
data = dict(samples_per_gpu=16)
evaluation = dict(interval=2)
# model s... |
mara_pipelines/incremental_processing/processed_files.py | timgates42/mara-pipelines | 1,398 | 12676098 | <gh_stars>1000+
"""Functions for keeping track whether an input file has already been 'processed' """
import datetime
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
import mara_db.config
import mara_db.dbs
import mara_db.postgresql
Base = declarative_base()
class ProcessedFile(Base):
... |
saleor/giftcard/events.py | MertIV/saleor | 15,337 | 12676099 | from typing import Iterable, List, Optional, Tuple
from ..account.models import User
from ..app.models import App
from ..core.utils.validators import user_is_valid
from . import GiftCardEvents
from .models import GiftCard, GiftCardEvent
UserType = Optional[User]
AppType = Optional[App]
def gift_card_issued_event(
... |
tests/functional/context_methods/first_dependency.py | tomasfarias/dbt-core | 799 | 12676120 | <gh_stars>100-1000
import pytest
from dbt.tests.fixtures.project import write_project_files
first_dependency__dbt_project_yml = """
name: 'first_dep'
version: '1.0'
config-version: 2
profile: 'default'
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["ma... |
vigranumpy/examples/graph_smoothing.py | BSeppke/vigra | 316 | 12676139 | <reponame>BSeppke/vigra
import vigra
from vigra import graphs
# parameter:
filepath = '12003.jpg' # input image path
sigmaGradMag = 2.0 # sigma Gaussian gradient
superpixelDiameter = 10 # super-pixel size
slicWeight = 10.0 # SLIC color - spatial weight
gamma = 0.15 # exp(-gamma * edgeIndica... |
spacy/tests/lang/vi/test_serialize.py | rynoV/spaCy | 22,040 | 12676143 | <reponame>rynoV/spaCy
from spacy.lang.vi import Vietnamese
from ...util import make_tempdir
def test_vi_tokenizer_serialize(vi_tokenizer):
tokenizer_bytes = vi_tokenizer.to_bytes()
nlp = Vietnamese()
nlp.tokenizer.from_bytes(tokenizer_bytes)
assert tokenizer_bytes == nlp.tokenizer.to_bytes()
asser... |
orochi/website/migrations/0025_dump_banner.py | garanews/orochi | 121 | 12676145 | <reponame>garanews/orochi<filename>orochi/website/migrations/0025_dump_banner.py
# Generated by Django 3.1.3 on 2020-11-06 16:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0024_auto_20200930_1428'),
]
operations = [
migr... |
syfertext/data/units/token_meta.py | Dat-Boi-Arjun/SyferText | 204 | 12676168 | <reponame>Dat-Boi-Arjun/SyferText<gh_stars>100-1000
class TokenMeta:
"""This class holds some meta data about a token from the text held by a Doc object.
This allows to create a Token object when needed.
"""
def __init__(self, text: str, space_after: bool):
"""Initializes a TokenMeta object
... |
test/unit/agent/collectors/plus/stream.py | dp92987/nginx-amplify-agent | 308 | 12676186 | # -*- coding: utf-8 -*-
from hamcrest import *
from test.base import BaseTestCase
from amplify.agent.common.context import context
from amplify.agent.objects.plus.object import NginxStreamObject
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "... |
tools/bin/ext/figleaf/annotate.py | YangHao666666/hawq | 450 | 12676188 | """
Common functions for annotating files with figleaf coverage information.
"""
import sys, os
from optparse import OptionParser
import ConfigParser
import re
import logging
import figleaf
thisdir = os.path.dirname(__file__)
try: # 2.3 compatibility
logging.basicConfig(format=... |
muddery/launcher/upgrader/upgrader_0_6_4.py | dongwudanci/muddery | 127 | 12676208 | <reponame>dongwudanci/muddery<gh_stars>100-1000
"""
Upgrade custom's game dir to the latest version.
"""
import traceback
import os
import django.core.management
from evennia.server.evennia_launcher import init_game_directory
from muddery.launcher.upgrader.base_upgrader import BaseUpgrader
from muddery.launcher.upgrad... |
bookwyrm/migrations/0110_auto_20211015_1734.py | mouse-reeve/fedireads | 270 | 12676223 | <filename>bookwyrm/migrations/0110_auto_20211015_1734.py<gh_stars>100-1000
# Generated by Django 3.2.5 on 2021-10-15 17:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("bookwyrm", "0109_status_edited_date"),
]
operations = [
migration... |
src/UQpy/Distributions/collection/uniform.py | marrov/UQpy | 132 | 12676227 | import scipy.stats as stats
from UQpy.Distributions.baseclass import DistributionContinuous1D
class Uniform(DistributionContinuous1D):
"""
Uniform distribution having probability density function
.. math:: f(x|a, b) = \dfrac{1}{b-a}
where :math:`a=loc` and :math:`b=loc+scale`
**Inputs:**
*... |
examples/pubsub.py | eoghanmurray/aredis | 832 | 12676239 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import aredis
import asyncio
import concurrent.futures
import time
import logging
async def wait_for_message(pubsub, timeout=2, ignore_subscribe_messages=False):
now = time.time()
timeout = now + timeout
while now < timeout:
message = await pubsub.get_mes... |
Models/dataloader/cub/grid/cub.py | icoz69/DeepEMD | 444 | 12676241 | <gh_stars>100-1000
import os
import os.path as osp
import random
import torch
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
from torchvision import transforms
class CUB(Dataset):
def __init__(self, setname, args=None):
IMAGE_PATH = os.path.join(args.data_dir, 'cub/')
... |
exercises/twelve-days/twelve_days.py | kishankj/python | 1,177 | 12676244 | def recite(start_verse, end_verse):
pass
|
airflow/api_connexion/schemas/enum_schemas.py | ChaseKnowlden/airflow | 15,947 | 12676280 | <gh_stars>1000+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"... |
tools/pythonpkg/tests/fast/arrow/test_timestamps.py | AldoMyrtaj/duckdb | 2,816 | 12676315 | import duckdb
import os
import datetime
import pytest
try:
import pyarrow as pa
import pandas as pd
can_run = True
except:
can_run = False
class TestArrowTimestamps(object):
def test_timestamp_types(self, duckdb_cursor):
if not can_run:
return
data = (pa.array([datetime.... |
resource_tracker/migrations/0003_auto_20211006_1722.py | LaudateCorpus1/squest | 112 | 12676318 | # Generated by Django 3.2.7 on 2021-10-06 15:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('resource_tracker', '0002_auto_20210929_2131'),
]
operations = [
migrations.AlterField(
model_na... |
wav2clip/pre_training/model.py | LianQi-Kevin/wav2clip-changed | 102 | 12676337 | <reponame>LianQi-Kevin/wav2clip-changed
import pytorch_lightning as pl
import torch
from ..model.encoder import MLPLayers
from ..model.resnet import BasicBlock
from ..model.resnet import ResNet
from .loss import CLIPLoss1D
class LightningBase(pl.LightningModule):
def training_step(self, batch, batch_idx):
... |
docs/build/main.py | cclauss/python-devtools | 487 | 12676350 | <filename>docs/build/main.py<gh_stars>100-1000
#!/usr/bin/env python3
import re
import sys
from importlib.machinery import SourceFileLoader
from pathlib import Path
THIS_DIR = Path(__file__).parent
PROJECT_ROOT = THIS_DIR / '..' / '..'
def main():
history = (PROJECT_ROOT / 'HISTORY.md').read_text()
history =... |
core/REST_views.py | gcnoopy/YaraGuardian | 178 | 12676394 | import re
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.generics import ListAPIView, RetrieveAPIView
from rest_framework.response import Response
from rest_framework.permissions ... |
examples/language_model/gpt/predict.py | JeremyZhao1998/PaddleNLP | 7,091 | 12676400 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
# Copyright (c) 2020 TsinghuaAI 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... |
flask_reddit/users/views.py | huhansan666666/flask_reddit | 461 | 12676434 | # -*- coding: utf-8 -*-
"""
"""
from flask import (Blueprint, request, render_template, flash, g, session,
redirect, url_for, abort)
from flask_reddit import db
from flask_reddit.users.models import User
from flask_reddit.frontends.views import get_subreddits
from flask_reddit.users.decorators import requires_logi... |
examples/advanced_tensorflow/server.py | Chris-george-anil/flower | 895 | 12676440 | from typing import Any, Callable, Dict, List, Optional, Tuple
import flwr as fl
import tensorflow as tf
def main() -> None:
# Load and compile model for
# 1. server-side parameter initialization
# 2. server-side parameter evaluation
model = tf.keras.applications.EfficientNetB0(
input_shape=(3... |
examples/Redfish/set_ethernet_management_iface_static_ip.py | JohnAZoidberg/python-ilorest-library | 214 | 12676449 | # Copyright 2020 Hewlett Packard Enterprise Development LP
#
# 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 ... |
mapper_examples/postgresql_hostname_tenant_mapper.py | leapoli/django-db-multitenant | 126 | 12676450 | """
https://gist.github.com/stephane/08b649ea818bd9dce2ff33903ba94aba
Maps a request to a tenant using the first part of the hostname.
For example:
foo.example.com:8000 -> foo
bar.baz.example.com -> bar
This is a simple example; you should probably verify tenant names
are valid against a whitelist before returnin... |
app/tests/service_container_test.py | golem4300/quattran | 183 | 12676457 | <filename>app/tests/service_container_test.py
import unittest
import pytest
from mock import Mock
from app import ServiceContainer
from app.exceptions import ServiceNotFoundException, ContainerAlreadyBootedException
class PluginsTest(unittest.TestCase):
@staticmethod
def test_register_singleton():
s... |
airbyte-integrations/bases/base-normalization/integration_tests/test_ephemeral.py | weltam/airbyte | 6,215 | 12676458 | <gh_stars>1000+
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import json
import os
import pathlib
import re
import shutil
import tempfile
from distutils.dir_util import copy_tree
from typing import Any, Dict
import pytest
from integration_tests.dbt_integration_test import DbtIntegrationTest
from norma... |
src/modules/mod_socketcontrol.py | albertz/music-player | 132 | 12676473 | # -*- coding: utf-8 -*-
# MusicPlayer, https://github.com/albertz/music-player
# Copyright (c) 2013, <NAME>, www.az2000.de
# All rights reserved.
# This code is under the 2-clause BSD license, see License.txt in the root directory of this project.
import sys, os
import appinfo
import utils
import binstruct
def _hand... |
tests/integration/test_replicated_database/test.py | mrk-andreev/ClickHouse | 8,629 | 12676476 | <reponame>mrk-andreev/ClickHouse
import os
import shutil
import time
import re
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import assert_eq_with_retry, assert_logs_contain
from helpers.network import PartitionManager
test_recover_staled_replica_run = 1
cluster = ClickHouseClus... |
torch_geometric/nn/pool/__init__.py | NucciTheBoss/pytorch_geometric | 2,350 | 12676489 | <filename>torch_geometric/nn/pool/__init__.py
from torch import Tensor
from torch_geometric.typing import OptTensor
from .max_pool import max_pool, max_pool_x, max_pool_neighbor_x
from .avg_pool import avg_pool, avg_pool_x, avg_pool_neighbor_x
from .graclus import graclus
from .voxel_grid import voxel_grid
from .topk_... |
python/009 Palindrome Number.py | allandproust/leetcode-share | 156 | 12676490 | '''
Determine whether an integer is a palindrome. Do this without extra space.
Could negative integers be palindromes? (ie, -1)
If you are thinking of converting the integer to string, note the restriction of using extra space.
You could also try reversing an integer. However, if you have solved the problem "Reverse... |
stonesoup/hypothesiser/tests/test_distance.py | Red-Portal/Stone-Soup-1 | 157 | 12676492 | # -*- coding: utf-8 -*-
from operator import attrgetter
import datetime
import numpy as np
from ..distance import DistanceHypothesiser
from ...types.detection import Detection
from ...types.state import GaussianState
from ...types.track import Track
from ... import measures
def test_mahalanobis(predictor, updater):... |
compiler/gdsMill/sram_examples/newcell.py | bsg-external/OpenRAM | 335 | 12676533 | #!/usr/bin/env python
import gdsMill
#we are going to make an array of instances of an existing layout
#assume that we designed the "base cell" in cadence
#step 1 is to stream it out of cadence into a GDS to work with
# creater a streamer object to interact with the cadence libraries
gds_file_in = "sram_lib2.gds" #"... |
app/src/thirdparty/telemetry/internal/platform/profiler/android_systrace_profiler.py | ta2edchimp/big-rig | 925 | 12676557 | <filename>app/src/thirdparty/telemetry/internal/platform/profiler/android_systrace_profiler.py
# Copyright 2013 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.
import os
import StringIO
import subprocess
import zipfile
fr... |
tensorflow/contrib/nccl/python/ops/nccl_ops_test.py | AlexChrisF/udacity | 384 | 12676575 | <gh_stars>100-1000
# Copyright 2016 The TensorFlow 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.