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 |
|---|---|---|---|---|
tests/rest/test_api_topics.py | DmitryRibalka/monitorrent | 465 | 11027321 | from builtins import object
import json
import falcon
from mock import MagicMock, Mock
from ddt import ddt, data
from tests import RestTestBase
from monitorrent.rest.topics import TopicCollection, TopicParse, Topic, TopicResetStatus, TopicPauseState
from monitorrent.plugins.trackers import TrackerSettings
from monitorr... |
tests/test_examples.py | nerevu/riko | 1,716 | 11027351 | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
tests.test_examples
~~~~~~~~~~~~~~~~~~~
Provides example pipeline tests.
"""
import nose.tools as nt
from importlib import import_module
from decimal import Decimal
def setup_module():
"""site initialization"""
global initialized
initialized = True
... |
cassiopeia/datastores/riotapi/common.py | LukePeltier/cassiopeia | 437 | 11027384 | import time
import copy
import functools
import collections.abc
from abc import abstractmethod, ABC
from typing import MutableMapping, Any, Union, TypeVar, Iterable, Type, List, Tuple, Dict, Callable
from datapipelines import DataSource, PipelineContext
from merakicommons.ratelimits import FixedWindowRateLimiter, Mult... |
ask-sdk-local-debug/ask_sdk_local_debug/util/response_util.py | nikhilym/alexa-skills-kit-sdk-for-python | 496 | 11027398 | <filename>ask-sdk-local-debug/ask_sdk_local_debug/util/response_util.py
# -*- coding: utf-8 -*-
#
# Copyright 2020 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... |
src/StreamDeck/DeviceManager.py | jakobbuis/python-elgato-streamdeck | 517 | 11027418 | # Python Stream Deck Library
# Released under the MIT license
#
# dean [at] fourwalledcubicle [dot] com
# www.fourwalledcubicle.com
#
from .Devices.StreamDeckMini import StreamDeckMini
from .Devices.StreamDeckOriginal import StreamDeckOriginal
from .Devices.StreamDeckOriginalV2 import StreamDeck... |
tests/fs/test_composite.py | ukwa/mrjob | 1,538 | 11027428 | <filename>tests/fs/test_composite.py
# Copyright 2019 Yelp
#
# 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... |
napari/_qt/qt_resources/__init__.py | MaksHess/napari | 1,345 | 11027447 | import warnings
from pathlib import Path
from typing import List, Optional
from ._icons import (
_register_napari_resources,
_unregister_napari_resources,
compile_qt_svgs,
register_napari_themes,
)
from ._svg import QColoredSVGIcon
__all__ = [
'get_stylesheet',
'QColoredSVGIcon',
'_registe... |
flaskshop/checkout/forms.py | maquinuz/flask-shop | 141 | 11027475 | from flask_wtf import FlaskForm
from wtforms import TextAreaField, StringField
class NoteForm(FlaskForm):
note = TextAreaField("ADD A NOTE TO YOUR ORDER")
class VoucherForm(FlaskForm):
code = StringField()
|
gn/copy_git_directory.py | fourgrad/skia | 6,304 | 11027490 | #! /usr/bin/env python
# Copyright 2019 Google LLC.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import shutil
import subprocess
import sys
def copy_git_directory(src, dst, out=None):
'''
Makes a copy of `src` directory in `dst` directory. If fil... |
tests/test_mp_length.py | DeathGOD7/pythonnet | 3,183 | 11027530 | # -*- coding: utf-8 -*-
"""Test __len__ for .NET classes implementing ICollection/ICollection<T>."""
import System
import pytest
from Python.Test import MpLengthCollectionTest, MpLengthExplicitCollectionTest, MpLengthGenericCollectionTest, MpLengthExplicitGenericCollectionTest
def test_simple___len__():
... |
packages/pyright-internal/src/tests/samples/codeFlow2.py | sasano8/pyright | 4,391 | 11027571 | # This sample tests the case where a symbol that exists in
# an outer scope is redeclared within a class but is referenced
# within the class before it is declared.
import stat
class FakeOsModule(object):
# The symbol "stat" is a module even though
# it is redeclared below in this scope as
# a method.
... |
doc/source/plots/hankel2_c.py | dimpase/mpmath | 625 | 11027575 | # Hankel function H2_n(z) in the complex plane
cplot(lambda z: hankel2(1,z), [-8,8], [-8,8], points=50000)
|
examples/wrf3.py | yang69can/pyngl | 125 | 11027606 | <reponame>yang69can/pyngl
#
# File:
# wrf3.py
#
# Synopsis:
# Draws contours of a WRF diagnostic variable calculated using
# wrf-python.
#
# Categories:
# Contouring
#
# Author:
# <NAME>
#
# Date of initial publication:
# April 2015
#
# Description:
# This example shows how to calculate the... |
youtube_dl/extractor/manyvids.py | hackarada/youtube-dl | 66,635 | 11027638 | <reponame>hackarada/youtube-dl<gh_stars>1000+
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
str_to_int,
urlencode_postdata,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvi... |
env/lib/python3.6/site-packages/asn1crypto/version.py | anthowen/duplify | 5,079 | 11027662 | # coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
__version__ = '0.24.0'
__version_info__ = (0, 24, 0)
|
medspacy/io/db.py | lusterck/medspacy | 197 | 11027670 | <filename>medspacy/io/db.py
from .db_connect import DbConnect
from .db_reader import DbReader
from .db_writer import DbWriter
from .pipeline import Pipeline
|
run_on_sequence.py | alekpikl/segmentation | 278 | 11027677 | import numpy as np
import cPickle
import tensorflow as tf
import cv2
import os
from utilities import label_img_to_color
from model import ENet_model
project_dir = "/root/segmentation/"
data_dir = project_dir + "data/"
model_id = "sequence_run"
batch_size = 4
img_height = 512
img_width = 1024
model = ENet_model(m... |
sympy/polys/solvers.py | dqnykamp/sympy | 319 | 11027698 | <reponame>dqnykamp/sympy<gh_stars>100-1000
"""Low-level linear systems solver. """
from __future__ import print_function, division
from sympy.matrices import Matrix, zeros
class RawMatrix(Matrix):
_sympify = staticmethod(lambda x: x)
def eqs_to_matrix(eqs, ring):
"""Transform from equations to matrix form. ... |
tools/cygprofile/process_profiles_unittest.py | sarang-apps/darshan_browser | 575 | 11027749 | <filename>tools/cygprofile/process_profiles_unittest.py<gh_stars>100-1000
#!/usr/bin/env vpython
# Copyright 2017 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.
"""Tests for process_profiles.py."""
import collections
imp... |
tests/tasks/kafka/test_kafka_batch_tasks.py | nicolasiltis/prefect | 8,633 | 11027760 | import pytest
from unittest import mock
from prefect.tasks.kafka.kafka import KafkaBatchConsume, KafkaBatchProduce
class TestKafkaBatchConsume:
def test_construction(self):
task = KafkaBatchConsume("localhost:9092", "1")
assert task.bootstrap_servers == "localhost:9092"
assert task.group_i... |
data/example.py | makim0n/SSRFmap | 1,795 | 11027761 | <filename>data/example.py
# NOTE: do not try this at home - highly vulnerable ! (SSRF and RCE)
# NOTE: this file should become a simple ssrf example in order to test SSRFmap
# FLASK_APP=example.py flask run
from flask import Flask, abort, request
import json
import re
import subprocess
app = Flask(__name__)
@app.ro... |
server/dataplay/filesvc/__init__.py | data2068/dataplay3 | 153 | 11027801 | import os
from sanic import Blueprint
from sanic.log import logger
file_svc = Blueprint('file_svc')
dir_path = os.path.dirname(os.path.realpath(__file__))
static_path = os.path.join(dir_path, '..', 'static')
logger.info(f'using static path {static_path}')
file_svc.static('/ui', static_path)
|
data/turkey-data/crawler.py | HiteshMah-Jan/covid19 | 356 | 11027807 | import os
import datetime
import tabula
import re
import requests
from bs4 import BeautifulSoup
from pathlib import Path
folder = 'data/turkey-data/'
data_files = os.listdir(folder)
url = 'https://sbsgm.saglik.gov.tr/TR,66559/gunluk-rapor--daily-report.html'
regions = [
'Istanbul', 'Western Marmara', 'Aegean', '... |
src/biotite/sequence/phylo/__init__.py | danijoo/biotite | 208 | 11027812 | # This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
"""
This subpackage provides functions and data structures for creating
(phylogenetic) trees.
The :class:`Tree` is the central class in this subpackage.
It wraps a... |
Section 3 - Python Crash Course/Python 3 - Loops.py | kungfumas/bahasa-alami | 169 | 11027819 | # Introduction to Python
# Two types of loops in Python
# While Loop
"""
while condition:
Statements
"""
i = 1;
while i <= 10:
print(i)
i += 1
# For loop
for i in range(1,11):
print(i)
# Nested Loops
"""
12345
12345
12345
12345
"""
for i in range(1,5):
for j in range(1,6):
... |
fastuser/migrations/0003_merge_20200813_1655.py | FuxiongYang/faster | 227 | 11027820 | <gh_stars>100-1000
# Generated by Django 2.1.11 on 2020-08-13 16:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('fastuser', '0002_auto_20200509_1122'),
('fastuser', '0002_auto_20200428_0124'),
]
operations = [
]
|
ledfx/effects/modulate.py | broccoliboy/LedFx | 524 | 11027825 | <filename>ledfx/effects/modulate.py
import logging
import numpy as np
import voluptuous as vol
from ledfx.effects import Effect
_LOGGER = logging.getLogger(__name__)
_rate = 60
@Effect.no_registration
class ModulateEffect(Effect):
"""
Extension of TemporalEffect that applies brightness modulation
over ... |
neuralhydrology/modelzoo/customlstm.py | DavidChoi76/neuralhydrology | 144 | 11027838 | import math
from collections import defaultdict
from typing import Dict, Union
import torch
import torch.nn as nn
from neuralhydrology.modelzoo.basemodel import BaseModel
from neuralhydrology.modelzoo.cudalstm import CudaLSTM
from neuralhydrology.modelzoo.embcudalstm import EmbCudaLSTM
from neuralhydrology.modelzoo.... |
tests/checks/test_non_matching_header.py | SrividhyaGuru/goodtables-py | 243 | 11027841 | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from tableschema import Field
from goodtables.checks.non_matching_header import NonMatchingHeader
import goodtables.cells
# Check
def test_chec... |
deepmath/treegen/cnf_utils.py | LaudateCorpus1/deepmath | 830 | 11027843 | # Copyright 2017 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 a... |
pytorch_toolbelt/modules/decoders/deeplab.py | azkalot1/pytorch-toolbelt | 1,281 | 11027903 | from collections import OrderedDict
from typing import List, Tuple, Union, Type
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from .common import DecoderModule
from ..dsconv import DepthwiseSeparableConv2d
from ..activations import instantiate_activation_block, ACT_RELU
__all__ = ["ASPPMo... |
tests/components/group/test_notify.py | MrDelik/core | 30,023 | 11027973 | <reponame>MrDelik/core<filename>tests/components/group/test_notify.py
"""The tests for the notify.group platform."""
from unittest.mock import MagicMock, patch
from homeassistant import config as hass_config
import homeassistant.components.demo.notify as demo
from homeassistant.components.group import SERVICE_RELOAD
i... |
contacts/serializer.py | sunrise1234321/Django-CRM | 1,334 | 11027993 | <reponame>sunrise1234321/Django-CRM<filename>contacts/serializer.py
from rest_framework import serializers
from contacts.models import Contact
from common.serializer import (
ProfileSerializer,
BillingAddressSerializer,
AttachmentsSerializer,
OrganizationSerializer
)
from teams.serializer import TeamsSe... |
engine/core/portscan.py | pianomanx/pwndora | 112 | 11027997 | <filename>engine/core/portscan.py
import socket
from loguru import logger
from core.tags import get_web_technologies
'''
The portscan class receives an ip address and the ports to be validated using sockets.
If the connection is successful, it tries to get the hostname, the banners and calls a function to detect web t... |
nanobrok/blueprints/webui/routes/events.py | retr0-13/nanobroK | 142 | 11028021 | <reponame>retr0-13/nanobroK
from flask import render_template, redirect, url_for
from nanobrok.models import User, PacketData
from flask_login import login_required
from nanobrok.blueprints.webui.utils import checkUserIsAuthenticated
# This file is part of the Nanobrok Open Source Project.
# nanobrok is licensed unde... |
earth_enterprise/src/server/wsgi/serve/push/stream/stream_push_servlet.py | ezeeyahoo/earthenterprise | 2,661 | 11028026 | #!/usr/bin/env python2.7
#
# Copyright 2017 Google 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 l... |
saleor/shipping/migrations/0019_remove_shippingmethod_meta.py | fairhopeweb/saleor | 15,337 | 11028035 | <gh_stars>1000+
# Generated by Django 3.1 on 2020-08-10 14:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("shipping", "0018_default_zones_countries"),
]
operations = [
migrations.RemoveField(
model_name="shippingmethod",
... |
tests/create_sorted_sets.py | gczheng/redis-rdb-tools | 3,691 | 11028051 | <gh_stars>1000+
import string
import redis
import random
r = redis.StrictRedis()
def main():
for x in range(5000):
create_sorted_set()
def create_sorted_set():
key = random_string(random.randint(10,25))
num_items = random.randint(5, 1000)
pipe = r.pipeline()
for x in range(num_items):
... |
src/grad_times_image.py | HesterLim/pytorch-cnn-visualizations | 6,725 | 11028076 | <gh_stars>1000+
"""
Created on Wed Jun 19 17:12:04 2019
@author: <NAME> - github.com/utkuozbulak
"""
from misc_functions import (get_example_params,
convert_to_grayscale,
save_gradient_images)
from vanilla_backprop import VanillaBackprop
# from guided_backprop im... |
imgviz/nchannel.py | penguinflys/imgviz | 171 | 11028100 | import numpy as np
from . import normalize
class Nchannel2RGB(object):
"""Convert nchannel array to rgb by PCA.
Parameters
----------
pca: sklearn.decomposition.PCA
PCA.
"""
def __init__(self, pca=None):
self._pca = pca
# for uint8
self._min_max_value = (No... |
ArtGAN/utils/utils.py | cs-chan/painting-classification | 304 | 11028111 | import numpy as np
import unicodedata
import os
class OneHot(object):
def __init__(self, be, nclasses):
self.be = be
self.output = be.iobuf(nclasses, parallelism='Data')
def transform(self, t):
self.output[:] = self.be.onehot(t, axis=0)
return self.output
def image_reshape(i... |
moneywagon/blocktime_adjustments.py | cst13/canstel | 147 | 11028125 | <reponame>cst13/canstel
adjustments = {
'btc': [
[0, 13.96560340528603],
[18716, 16.259799102372302],
[37432, 8.165139452874547],
[56148, 7.0654386621072875],
[74864, 7.610079611027998],
[93580, 7.8645971361402],
[112296, 7.755035798247489],
[131012, 9.60702162142908],
[149728, 10.02... |
tests/components/advantage_air/test_config_flow.py | tbarbette/core | 30,023 | 11028151 | <gh_stars>1000+
"""Test the Advantage Air config flow."""
from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.advantage_air.const import DOMAIN
from tests.components.advantage_air import TEST_SYSTEM_DATA, TEST_SYSTEM_URL, USER_INPUT
async def test... |
ROBOTIS/DynamixelSDK/python/tests/protocol_combined.py | uptopia/timda_dual_arm | 361 | 11028159 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2017 ROBOTIS CO., LTD.
#
# 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 cop... |
axeman/__init__.py | korrosivesec/Axeman | 151 | 11028184 | __version__ = '1.14'
if __name__ == "__main__":
from .core import main
main()
|
PyGreSQL-5.0/tests/test_dbapi20.py | wang502/slack-sql | 123 | 11028185 | #! /usr/bin/python
# -*- coding: utf-8 -*-
# $Id: test_dbapi20.py 849 2016-02-09 13:14:26Z cito $
try:
import unittest2 as unittest # for Python < 2.7
except ImportError:
import unittest
import pgdb
try:
from . import dbapi20
except (ImportError, ValueError, SystemError):
import dbapi20
# We need a... |
tests/backend/unit/models/dtos/test_project_dto.py | KathmanduLivingLabs/tasking-manager | 421 | 11028194 | from schematics.exceptions import DataError
from backend.models.dtos.project_dto import ProjectDTO
from tests.backend.base import BaseTestCase
class TestProjectDTO(BaseTestCase):
def test_project_with_unknown_mapping_type_is_invalid(self):
project_dto = ProjectDTO()
project_dto.mapping_types = ["... |
dired.py | laggingreflex/SublimeFileBrowser | 382 | 11028229 | # coding: utf-8
'''Main module; launch and navigation related stuff'''
from __future__ import print_function
import sublime
from sublime import Region
from sublime_plugin import WindowCommand, TextCommand
import os
from os.path import basename, dirname, isdir, exists, join
ST3 = int(sublime.version()) >= 3000
if ST... |
scripts/lef_copy_annotation.py | kareefardi/OpenLane | 354 | 11028234 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright 2020 Efabless Corporation
#
# 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 ... |
Web/fluid_properties/Validation/NelsonValidation.py | pauliacomi/CoolProp | 520 | 11028254 | <filename>Web/fluid_properties/Validation/NelsonValidation.py
from CoolProp.HumidAirProp import HAProps
print("Validation against <NAME> and <NAME>,\"Formulation for High-Temperature Properties for Moist Air\", HVAC&R Research v.8 #3, 2002")
print("Note: More accurate formulation employed than in Nelson. Just for sa... |
mmdet/models/seg_heads/panoptic_fusion_heads/__init__.py | Brym-Gyimah/mmdetection | 20,190 | 11028267 | # Copyright (c) OpenMMLab. All rights reserved.
from .base_panoptic_fusion_head import \
BasePanopticFusionHead # noqa: F401,F403
from .heuristic_fusion_head import HeuristicFusionHead # noqa: F401,F403
|
tests/regression_tests/sourcepoint_latest/test.py | janmalec/openmc | 262 | 11028269 | <reponame>janmalec/openmc<filename>tests/regression_tests/sourcepoint_latest/test.py
import os
import sys
from tests.testing_harness import TestHarness
class SourcepointTestHarness(TestHarness):
def _test_output_created(self):
"""Make sure statepoint.* and source* have been created."""
TestHarnes... |
kinto/views/collections.py | vincentfretin/kinto | 4,618 | 11028311 | <filename>kinto/views/collections.py
import colander
from pyramid.events import subscriber
from kinto.core import resource, utils
from kinto.core.events import ACTIONS, ResourceChanged
from kinto.schema_validation import JSONSchemaMapping, validate_from_bucket_schema_or_400
class CollectionSchema(resource.ResourceSc... |
core/src/main/resources/tf_algos/deepar_entry.py | starburst-project/Alink | 3,301 | 11028322 | <gh_stars>1000+
import tensorflow as tf
from akdl.models.tf.deepar import deepar_main
from akdl.runner.config import TrainTaskConfig
if tf.__version__ >= '2.0':
tf = tf.compat.v1
def main(task_config: TrainTaskConfig):
deepar_main.main(task_config)
|
asq/_types.py | sixty-north/asq | 175 | 11028336 | <filename>asq/_types.py
'''
Predicate functions for testing Python objects to determine their type.
'''
from asq import _portability
__author__ = "<NAME>"
def is_iterable(obj):
'''Determine if an object is iterable.
Args:
obj: The object to be tested for supporting iteration.
Retu... |
tests/components/wemo/test_switch.py | liangleslie/core | 30,023 | 11028345 | """Tests for the Wemo switch entity."""
import pytest
import pywemo
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.components.wemo.switch import (
ATTR_CURRENT_STATE_D... |
rasa/nlu/tokenizers/tokenizer.py | fintzd/rasa | 9,701 | 11028350 | import abc
import logging
import re
from typing import Text, List, Dict, Any, Optional
from rasa.engine.graph import ExecutionContext, GraphComponent
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
from rasa.shared.nlu.training_data.training_data import TrainingD... |
wagtailmenus/tests/migrations/0007_auto_20160423_1348.py | pierremanceaux/wagtailmenus | 329 | 11028391 | <reponame>pierremanceaux/wagtailmenus<filename>wagtailmenus/tests/migrations/0007_auto_20160423_1348.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-23 12:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [... |
dffml/util/testing/consoletest/cli.py | agriyakhetarpal/dffml | 171 | 11028445 | import pathlib
import argparse
import contextlib
from typing import List
from .parser import parse_nodes
from .runner import run_nodes
from .util import code_block_to_dict, literalinclude_to_dict
async def main(argv: List[str]) -> None:
"""
Run consoletest on the file provided
"""
parser = argparse.A... |
tests/python/kaolin/render/mesh/test_utils.py | mcx/kaolin | 3,747 | 11028472 | <filename>tests/python/kaolin/render/mesh/test_utils.py
# 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
#
# h... |
python/GafferSceneTest/ClosestPointSamplerTest.py | ddesmond/gaffer | 561 | 11028498 | <filename>python/GafferSceneTest/ClosestPointSamplerTest.py
##########################################################################
#
# Copyright (c) 2020, <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following ... |
torch/jit/_serialization.py | Hacky-DH/pytorch | 60,067 | 11028529 | """Serialization
This module contains functionality for serializing TorchScript modules, notably:
* torch.jit.save
* torch.jit.load
This is not intended to be imported directly; please use the exposed
functionalities in `torch.jit`.
"""
import os
import pathlib
import torch
from torch._six import string_clas... |
alipay/aop/api/domain/VoucherTimeRule.py | antopen/alipay-sdk-python-all | 213 | 11028562 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class VoucherTimeRule(object):
def __init__(self):
self._days = None
self._end_time = None
self._start_time = None
self._time_typ... |
dexbot/views/create_wallet.py | fakegit/DEXBot | 249 | 11028563 | from PyQt5.QtWidgets import QDialog
from dexbot.views.errors import gui_error
from dexbot.views.notice import NoticeDialog
from dexbot.views.ui.create_wallet_window_ui import Ui_Dialog
class CreateWalletView(QDialog, Ui_Dialog):
def __init__(self, controller):
self.controller = controller
super()... |
stanza/models/langid/create_ud_data.py | asears/stanza | 3,633 | 11028570 | <filename>stanza/models/langid/create_ud_data.py<gh_stars>1000+
"""
Script for producing training/dev/test data from UD data or sentences
Example output data format (one example per line):
{"text": "Hello world.", "label": "en"}
"""
import argparse
import json
import logging
import os
import re
import sys
from pat... |
sdk/agfood/azure-mgmt-agfood/azure/mgmt/agfood/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 11028578 | <reponame>rsdoherty/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R... |
cisco-ios-xe/ydk/models/cisco_ios_xe/BGP4_MIB.py | CiscoDevNet/ydk-py | 177 | 11028580 | """ BGP4_MIB
The MIB module for BGP\-4.
"""
from collections import OrderedDict
from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64
from ydk.filters import YFilter
from ydk.errors import YError, YModelError
from ydk.errors.error_handler impo... |
recommender/Recommender_Kubeflow.py | gabrielclimb/intro-to-ml-with-kubeflow-examples | 150 | 11028586 | <filename>recommender/Recommender_Kubeflow.py
#!/usr/bin/env python
# coding: utf-8
# # This is implementation of the Recommender training
#
# This implementation takes a list of users and their purchasing history to calculate prediction
# on the probability that they would by a certain product.
# The implementation i... |
csv2keychain/csv2keychain.py | idoo/csv2keychain | 328 | 11028607 | <filename>csv2keychain/csv2keychain.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
"""csv2keychain.csv2keychain: primary module within the csv2keychain package."""
from urllib.parse import urlparse
from subprocess import call
from sys import argv
import csv
class Csv2Keychain:
def addkey(self, params, update):
... |
uliweb_apijson/__init__.py | zhangchunlin/uliweb-apijson | 103 | 11028615 | __version__ = '0.2.2'
__url__ = 'https://github.com/zhangchunlin/uliweb-apijson'
__author__ = '<NAME>'
__email__ = '<EMAIL>'
|
tests/common/events.py | growlix/composer | 945 | 11028644 | # Copyright 2022 MosaicML Composer authors
# SPDX-License-Identifier: Apache-2.0
from typing import Any, Dict
from composer.core import Callback, Event, State
from composer.loggers import Logger
class EventCounterCallback(Callback):
def __init__(self) -> None:
self.event_to_num_calls: Dict[Event, int] ... |
examples/examples.py | hattan/yelpapi | 120 | 11028672 | <reponame>hattan/yelpapi
#!/usr/bin/env python
"""
Copyright (c) 2013, Triad National Security, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code ... |
rodnet/core/radar_processing/chirp_ops.py | WanxinT/Balanced-RODNet | 109 | 11028726 | <gh_stars>100-1000
import numpy as np
def chirp_amp(chirp, radar_data_type):
"""
Calculate amplitude of a chirp
:param chirp: radar data of one chirp (w x h x 2) or (2 x w x h)
:param radar_data_type: current available types include 'RI', 'RISEP', 'AP', 'APSEP'
:return: amplitude map for the input... |
PhysicsTools/SelectorUtils/python/tools/DataFormat.py | ckamtsikis/cmssw | 852 | 11028741 | <reponame>ckamtsikis/cmssw
# Define constants for data formats for VID and anyone else who needs them
class DataFormat:
AOD = 1
MiniAOD = 2
|
Chapter12/c12_29_2stock_efficient_frontier_simulation.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 11028769 | <reponame>John-ye666/Python-for-Finance-Second-Edition
"""
Name : c12_29_2stock_efficient_forntier_simulation.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import numpy as np
import scipy as... |
sdk/python/tests/performance_tests.py | yhwang/kfp-tekton | 102 | 11028792 | <reponame>yhwang/kfp-tekton<filename>sdk/python/tests/performance_tests.py
#!/usr/bin/env python3
# Copyright 2021 kubeflow.org
#
# 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:... |
Hackerrank_problems/Sherlock and valid strings/solution2.py | gbrls/CompetitiveCode | 165 | 11028795 | #Problem link in the md file
def isValid(s):
dic = {} #dictionary for counting the frequency of each character in given string
dic1 = {} #dictionary for counting the frequency of counts from the above dictionary (frequency of frequency)
#Below for loop stores data in dic
for i in s:
if i not ... |
DockerHubPackages/code/analyzer/analyzers/native_packages.py | halcyondude/datasets | 283 | 11028798 | from ..utils import run
import logging
logger = logging.getLogger(__name__)
def get_package_info(package, distro, path):
"""Get details about one precise native package in the given image for the given distro.
:param distro: expected distribution.
:type distro: string
:param package: name of the pyth... |
pyswagger/scanner/v2_0/validate.py | gavrie/pyswagger | 199 | 11028807 | from __future__ import absolute_import
from ...scan import Dispatcher
from ...spec.v2_0.objects import (
Schema
)
import six
class Validate(object):
"""
"""
class Disp(Dispatcher): pass
def __init__(self):
self.errs = []
@Disp.result
def result(self, result):
""" aggr... |
tests/test_keep_output_tags.py | TeoZosa/nbstripout | 892 | 11028813 | from copy import deepcopy
import os
import re
import nbformat
import pytest
from nbstripout import strip_output, MetadataError
directory = os.path.dirname(__file__)
@pytest.fixture
def orig_nb():
fname = 'test_keep_output_tags.ipynb'
return nbformat.read(os.path.join(directory, fname), nbformat.NO_CONVERT)... |
tests/unit/anchore_engine/subsys/test_caching.py | rbrady/anchore-engine | 1,484 | 11028828 | #!usr/bin/env python3
import threading
import time
from typing import Optional
import pytest
from anchore_engine.subsys.caching import (
TTLCache,
local_named_cache,
thread_local_cache,
)
@pytest.fixture
def ttl_cache(request):
cache: TTLCache = TTLCache()
value: str = "test_value"
cache.ca... |
flask_reddit/wsgi.py | huhansan666666/flask_reddit | 461 | 11028834 | #!/usr/bin/env python
"""
"""
import sys
sys.path.insert(0, '/home/lucas/www/reddit.lucasou.com/reddit-env')
from werkzeug.contrib.fixers import ProxyFix # needed for http server proxies
from werkzeug.debug import DebuggedApplication
from flask_reddit import app # as application
app.wsgi_app = ProxyFix(app.wsgi_app)... |
enaml/qt/q_pixmap_painter.py | xtuzy/enaml | 1,080 | 11028905 | <reponame>xtuzy/enaml<gh_stars>1000+
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#-----------... |
nlpgnn/models/GCN.py | ojipadeson/NLPGNN | 263 | 11028906 | <filename>nlpgnn/models/GCN.py
#! encoding="utf-8"
import tensorflow as tf
from nlpgnn.gnn.GCNConv import GraphConvolution
from nlpgnn.gnn.utils import GNNInput
class GCNLayer(tf.keras.Model):
def __init__(self, hidden_dim, num_class, dropout_rate=0.5, **kwargs):
super(GCNLayer, self).__init__(**kwargs)
... |
packages/pyright-internal/src/tests/samples/import10.py | Jasha10/pyright | 3,934 | 11028910 | # This sample tests the handling of an unresolved import.
# It should report a single error but not have cascading
# errors when the unresolved symbol is used.
# This should generate an error.
import unresolved_import
def test_zero_division():
with unresolved_import.raises(ZeroDivisionError):
v = 1 / 0
|
Configuration/StandardSequences/python/DD4hep_GeometrySimPhase2_cff.py | ckamtsikis/cmssw | 852 | 11028933 | import FWCore.ParameterSet.Config as cms
from Configuration.Geometry.GeometryDD4hepExtended2026D49_cff import *
|
verification/tutorial_global_oce_in_p/input/gendata.py | mitgcm/mitgcm | 247 | 11028946 | #!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
######################## -*- coding: utf-8 -*-
# simple script to generate p-coordinate specific input from standard experiment
# but unfortunately this script does not reproduce the values in
# tutorial_global_oce_in_p, yet
import numpy as np
import sys, os
# requi... |
fixtures/setup_py/setup.py | takebayashi/python-buildpack | 127 | 11028960 | from setuptools import setup
setup(
name="my-app",
version="1.0.0",
long_description="sample setup.py",
packages=['funniest'],
include_package_data=True,
zip_safe=False,
)
|
docs/examples/compute/ec2/create_provisioned_iops_volume.py | zimventures/libcloud | 1,435 | 11029009 | from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.EC2)
driver = cls('access key', 'secret key', region='us-east-i1')
volume = driver.create_volume(size=100, name='Test IOPS volume',
ex_volume_type='io1', ex_iops=1000)
|
flink-ml-python/pyflink/ml/tests/test_stage.py | yunfengzhou-hub/flink-ml | 142 | 11029021 | ################################################################################
# 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... |
tests/pytests/unit/states/test_libcloud_dns.py | markgras/salt | 9,425 | 11029041 | """
:codeauthor: <NAME> <<EMAIL>>
"""
import pytest
import salt.states.libcloud_dns as libcloud_dns
from salt.modules.libcloud_dns import _simple_record, _simple_zone
class DNSTestZone:
def __init__(self, id, domain):
self.id = id
self.type = "master"
self.ttl = 4400
self.dom... |
pypy/module/_cffi_backend/wrapper.py | nanjekyejoannah/pypy | 333 | 11029063 | <gh_stars>100-1000
from pypy.interpreter.error import oefmt
from pypy.interpreter.baseobjspace import W_Root
from pypy.interpreter.typedef import TypeDef, interp_attrproperty
from pypy.interpreter.typedef import GetSetProperty
from pypy.interpreter.gateway import interp2app
from rpython.rlib import jit
from pypy.modul... |
fhir/resources/STU3/tests/test_detectedissue.py | cstoltze/fhir.resources | 144 | 11029065 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/DetectedIssue
Release: STU3
Version: 3.0.2
Revision: 11917
Last updated: 2019-10-24T11:53:00+11:00
"""
from pydantic.validators import bytes_validator # noqa: F401
from .. import fhirtypes # noqa: F401
from .. import dete... |
src/tests/agenda/views/test_agenda_featured.py | lili668668/pretalx | 418 | 11029074 | import pytest
from django_scopes import scope
@pytest.mark.django_db
@pytest.mark.parametrize("featured", ("always", "never", "pre_schedule"))
def test_featured_invisible_because_setting(
client, django_assert_max_num_queries, event, featured, confirmed_submission
):
with scope(event=event):
event.set... |
updater/reports/ReportPRByOrg.py | eisenhowerj/hubble | 146 | 11029085 | from .Report import *
# Lists the number of merged and new pull requests for each organization in the last 30 days
# Ordered by the number of merged pull requests in descending order
class ReportPRByOrg(Report):
def name(self):
return "pull-requests-by-organization"
# The data is overwritten every day, so skip re... |
rlcard/agents/human_agents/gin_rummy_human_agent/gui_gin_rummy/configurations.py | randombenj/rlcard | 1,735 | 11029122 | '''
Project: Gui Gin Rummy
File name: configurations.py
Author: <NAME>
Date created: 3/14/2020
'''
import os
from configparser import ConfigParser
#
# Gin Rummy parameters
#
GOING_OUT_DEADWOOD_COUNT = 10
#
# RLCard Gin Rummy parameters
#
MAX_DRAWN_CARD_COUNT = 52
DISCARD_PILE_TAG = "discard_p... |
Recognition-Algorithms/Recognition Using LBP_SVM/model.py | swapnilgarg7/Face-X | 175 | 11029148 | import cv2
import os
import glob
from skimage import feature
import numpy as np
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
class LocalBinaryPatterns:
def __init__(self, numPoints, radius):
# store the number of points and radius
self.numPoints = numPoints
... |
src/pretix/base/migrations/0066_auto_20170708_2102.py | pajowu/pretix | 1,248 | 11029176 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-08 21:02
from __future__ import unicode_literals
import django.db.models.deletion
import i18nfield.fields
from django.db import migrations, models
import pretix.base.models.base
import pretix.base.models.event
class Migration(migrations... |
tests/examples/test_gcd_hls.py | psumesh/siliconcompiler | 424 | 11029186 | import siliconcompiler
import os
import pytest
@pytest.mark.eda
@pytest.mark.quick
def test_py(setup_example_test):
setup_example_test('gcd_hls')
import gcd_hls
gcd_hls.main()
assert os.path.isfile('build/gcd/job0/export/0/outputs/gcd.gds')
|
tests/test_variable_filter.py | KIKOcaoyue/blocks | 1,067 | 11029212 | from nose.tools import raises
from blocks.bricks import Bias, Linear, Logistic
from blocks.bricks.parallel import Merge
from blocks.filter import VariableFilter
from blocks.graph import ComputationGraph
from blocks.roles import BIAS, FILTER, PARAMETER, OUTPUT
from theano import tensor
def test_variable_filter():
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.