max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
Contents/Libraries/Shared/stevedore/tests/test_hook.py | jippo015/Sub-Zero.bundle | 1,553 | 1730928 | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed u... | 0 | 0 | 0 | 0 | 0 | 0 |
src/research/power_flow/newton_svc.py | mzy2240/GridCal | 284 | 1730932 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE_MATPOWER file.
# Copyright 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#... | 3 | 4 | 0 | 0 | 7 | 0 |
utils/swift_build_support/tests/test_tar.py | YogeshBharate/Swift | 825 | 1730939 | # test_tar.py - Unit tests for swift_build_support.tar -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for lice... | 0 | 0 | 0 | 0 | 0 | 0 |
utest/utils/test_versioncomparator.py | ludovicurbain/SWIFT-RIDE | 775 | 1730940 | <reponame>ludovicurbain/SWIFT-RIDE
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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://w... | 0 | 0 | 0 | 0 | 0 | 0 |
plato/agent/component/dialogue_policy/reinforcement_learning/reward_function.py | avmi/plato-research-dialogue-system | 899 | 1730965 | <reponame>avmi/plato-research-dialogue-system<filename>plato/agent/component/dialogue_policy/reinforcement_learning/reward_function.py
"""
Copyright (c) 2019-2020 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You... | 0 | 0 | 0 | 0 | 0 | 0 |
misc/doc/sources/apis/ja-http/example_send_gsm0338.py | paradiseng/jasmin | 750 | 1730977 | # Python example
# http://jasminsms.com
import urllib.request, urllib.error, urllib.parse
import urllib.request, urllib.parse, urllib.error
baseParams = {'username':'foo', 'password':'<PASSWORD>', 'to':'+336222172', 'content':'Hello'}
# Send an SMS-MT with minimal parameters
urllib.request.urlopen("http://127.0.0.1:1... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/social/management/commands/popular_stories.py | louis-pre/NewsBlur | 3,073 | 1731003 | <reponame>louis-pre/NewsBlur
from django.core.management.base import BaseCommand
from apps.social.models import MSharedStory
class Command(BaseCommand):
def handle(self, *args, **options):
MSharedStory.share_popular_stories() | 0 | 0 | 0 | 0 | 0 | 0 |
samples/pyvmomi-to-suds.py | ArpitSharma2800/pyvmomi-community-samples | 931 | 1731040 | <reponame>ArpitSharma2800/pyvmomi-community-samples
#!/usr/bin/env python
import cookielib
import suds
from tools import cli, service_instance
# pyvmomi-to-suds.py
#
# Demonstrates how to move a session between the pyVmomi client and the
# generated SOAP suds client. We leverage the suds library's use of cookielib
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
video_auto/制作GIF视频/gif_make_video.py | liusongtao99/tools_python | 130 | 1731043 | <filename>video_auto/制作GIF视频/gif_make_video.py
#!/usr/bin/env python
# encoding: utf-8
"""
@version: v1.0
@author: xag
@license: Apache Licence
@contact: <EMAIL>
@site: http://www.xingag.top
@software: PyCharm
@file: gif_make_video.py
@time: 5/26/19 22:22
@description:抓取一些gif,转为视频
"""
from moviepy.editor import *
imp... | 0 | 0 | 0 | 0 | 0 | 0 |
capstone/capdb/migrations/0033_auto_20180409_2117.py | rachelaus/capstone | 134 | 1731065 | # Generated by Django 2.0.2 on 2018-04-09 21:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('capdb', '0032_auto_20180409_0113'),
]
operations: list[object] = [
# migrations.RunSQL(
# sql='CREATE EXTENSION I... | 0 | 0 | 2 | 0 | 2 | 0 |
cesium/tests/fixtures.py | acrellin/cesium | 603 | 1731076 | <reponame>acrellin/cesium<gh_stars>100-1000
import shutil
import tempfile
import uuid
from contextlib import contextmanager
from itertools import cycle, islice
from os.path import join as pjoin
import numpy as np
import pandas as pd
from cesium.time_series import TimeSeries
def sample_values(size=51, channels=1):
... | 0 | 0 | 0 | 0 | 0 | 0 |
okta/jwt.py | corylevine/okta-sdk-python | 145 | 1731084 | from __future__ import annotations
from Crypto.PublicKey import RSA
from ast import literal_eval
import jose.jwk as jwk
import jose.jwt as jwt
import time
import uuid
import os
class JWT():
"""
This class creates a JWT from the Okta Client configuration.
"""
OAUTH_ENDPOINT: str = "/oauth2/v1/token"
... | 0 | 2 | 4 | 0 | 6 | 0 |
gtfspy/test/test_gtfs.py | Leo-Ryu/gtfspy | 118 | 1731177 | from __future__ import unicode_literals
import datetime
import os
import sqlite3
import unittest
import numpy
from six import string_types
import pandas
from gtfspy.gtfs import GTFS
from gtfspy.util import wgs84_distance
from gtfspy.route_types import BUS, TRAM, ALL_ROUTE_TYPES
class TestGTFS(unittest.TestCase):
... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/Cython/Profiling/quad_pure.py | Gjacquenot/training-material | 115 | 1731184 | <filename>Python/Cython/Profiling/quad_pure.py
from math import sin
def integrate(f, a, b, n=1000):
dx = (b - a)/n
total = 0.0
for i in range(n):
total += f(a + i*dx)
return total*dx
def sin2(x):
return sin(x)**2
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/SpiDetectionDetail.py | antopen/alipay-sdk-python-all | 213 | 1731211 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class SpiDetectionDetail(object):
def __init__(self):
self._code = None
self._content = None
self._data_id = None
self._details =... | 0 | 0 | 0 | 0 | 0 | 0 |
jesse/indicators/ui.py | slipperlobster/flipper | 3,999 | 1731237 | <gh_stars>1000+
from typing import Union
import numpy as np
import talib
from jesse.helpers import get_candle_source
from jesse.helpers import slice_candles
def ui(candles: np.ndarray, period: int = 14, scalar: float = 100, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]:
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
oslo/torch/nn/parallel/pipeline_parallel/__init__.py | lipovsek/oslo | 249 | 1731273 | <reponame>lipovsek/oslo<filename>oslo/torch/nn/parallel/pipeline_parallel/__init__.py
from oslo.torch.nn.parallel.pipeline_parallel.pipeline_parallel import (
PipelineParallel,
)
__ALL__ = [PipelineParallel]
| 0 | 0 | 0 | 0 | 0 | 0 |
src/_dependencies/graph.py | dry-python/dependencies | 175 | 1731288 | from _dependencies.analyze import _make_dependency_spec
from _dependencies.exceptions import DependencyError
class _Graph:
def __init__(self):
self.specs: dict[object,object] = {}
def get(self, name) -> object:
return self.specs.get(name)
def assign(self, name, dependency):
_chec... | 0 | 3 | 0 | 1 | 4 | 0 |
photologue/apps.py | erdnaxe/django-photologue | 364 | 1731364 | <gh_stars>100-1000
from django.apps import AppConfig
class PhotologueConfig(AppConfig):
default_auto_field = 'django.db.models.AutoField'
name = 'photologue'
| 0 | 0 | 0 | 0 | 0 | 0 |
onioningestor/operators/onionscan.py | TIA568B/OnionIngestor | 185 | 1731376 | import json
import traceback
import subprocess
from threading import Timer
from json.decoder import JSONDecodeError
from concurrent.futures import ProcessPoolExecutor
import requests
from stem.control import Controller
from stem import Signal
from onioningestor.operators import Operator
class Plugin(Operator):
... | 0 | 2 | 0 | 0 | 2 | 0 |
2019_12_16/FunkSVD.py | justbeat99/ML_Practice | 154 | 1731419 | <filename>2019_12_16/FunkSVD.py<gh_stars>100-1000
import numpy as np
import pandas as pd
import os
import matplotlib.pyplot as plt
from datetime import date,datetime
import logging
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
device = torch.device("cuda" if torch.cuda... | 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/MybankCreditLoanapplyQrcodeCreateModel.py | antopen/alipay-sdk-python-all | 213 | 1731434 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MybankCreditLoanapplyQrcodeCreateModel(object):
def __init__(self):
self._bank_card_category = None
self._beneficiary_account = None
self._beneficiary_n... | 0 | 0 | 0 | 0 | 0 | 0 |
machine_learning/resampling_solution.py | gautard/pystatsml | 123 | 1731455 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 18 10:40:44 2017
@author: <EMAIL>
"""
"""
Exercise
Given the logistic regression presented above and its validation given a 5 folds CV.
Compute the p-value associated with the prediction accuracy using a permutation test.
Compute the p-v... | 0 | 0 | 0 | 0 | 0 | 0 |
seahub/admin_log/signals.py | weimens/seahub | 420 | 1731470 | <reponame>weimens/seahub
# Copyright (c) 2012-2017 Seafile Ltd.
import django.dispatch
admin_operation = django.dispatch.Signal(providing_args=["admin_name", "operation", "detail"])
| 0 | 0 | 0 | 0 | 0 | 0 |
elex/api/utils.py | jameswilkerson/elex | 183 | 1731475 | from __future__ import annotations
"""
Utility functions to record raw election results and handle low-level HTTP
interaction with the Associated Press Election API.
"""
from __future__ import print_function
import os
import sys
import six
import elex
import ujson as json
import time
import datetime
from elex import ca... | 1 | 3 | 0 | 0 | 4 | 0 |
anpylar/binding.py | anpylar/anpylar | 180 | 1731482 | <reponame>anpylar/anpylar
###############################################################################
# Copyright 2018 The AnPyLar Team. All Rights Reserved.
# Use of this source code is governed by an MIT-style license that
# can be found in the LICENSE file at http://anpylar.com/mit-license
######################... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/django-0.96/django/utils/translation/__init__.py | MiCHiLU/google_appengine_sdk | 790 | 1731491 | from django.conf import settings
if settings.USE_I18N:
from trans_real import *
else:
from trans_null import *
del settings
| 0 | 0 | 0 | 0 | 0 | 0 |
utils/vis.py | fabienbaradel/object_level_visual_reasoning | 157 | 1731493 | # Copyright (c) 2017-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... | 13 | 2 | 0 | 0 | 15 | 0 |
examples/python/kitti_pipeline.py | Willyzw/vdbfusion | 119 | 1731521 | <reponame>Willyzw/vdbfusion<filename>examples/python/kitti_pipeline.py<gh_stars>100-1000
#!/usr/bin/env python3
# @file kitti_pipeline.py
# @author <NAME> [<EMAIL>]
#
# Copyright (c) 2021 <NAME>, all rights reserved
import argh
from datasets import KITTIOdometryDataset as Dataset
from vdbfusion_pipeline imp... | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode.com/python/1092_Shortest_Common_Supersequence.py | vansh-tiwari/coding-interview-gym | 713 | 1731536 | <reponame>vansh-tiwari/coding-interview-gym
class Solution(object):
def shortestCommonSupersequence(self, str1, str2):
"""
:type str1: str
:type str2: str
:rtype: str
"""
str1Len, str2Len = len(str1), len(str2)
dp = [["" for _ in range(str1Len + 1)] for _ in r... | 0 | 0 | 0 | 0 | 0 | 0 |
Stock/Trade/AccountManager/Broker/DyStockGtjaAccountManager.py | Leonardo-YXH/DevilYuan | 135 | 1731549 | <gh_stars>100-1000
from ..DyStockAccountManager import *
from ....Common.DyStockCommon import *
class DyStockGtjaAccountManager(DyStockAccountManager):
"""
国泰君安Web管理类
由于Web接口不同数据之间的异步性,推送券商原始数据时,一定要保证顺序。
委托->成交->资金->持仓
"""
broker = 'gtja'
brokerName = '国泰君安'
headerName... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/nose-1.3.7/setup3lib.py | kokosing/hue | 5,079 | 1731559 | <reponame>kokosing/hue
import sys
from setuptools import setup as _setup
py3_args = ['use_2to3', 'convert_2to3_doctests', 'use_2to3_fixers', 'test_dirs', 'test_build_dir', 'doctest_exts', 'pyversion_patching']
if sys.version_info < (3,):
# Remove any Python-3.x-only arguments (so they don't generate complaints
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cluecode/data/ics/markdown-markdown-extensions/tables.py | s4-2/scancode-toolkit | 1,511 | 1731631 | <filename>tests/cluecode/data/ics/markdown-markdown-extensions/tables.py
Content Cell | Content Cell
Content Cell | Content Cell
Copyright 2009 - [<NAME>](http://achinghead.com)
"""
import markdown | 0 | 0 | 0 | 0 | 0 | 0 |
pyclustering/nnet/tests/legion_templates.py | JosephChataignon/pyclustering | 1,013 | 1731652 | <reponame>JosephChataignon/pyclustering
"""!
@brief Templates for tests of Local Excitatory Global Inhibitory Oscillatory Network (LEGION).
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""
from pyclustering.nnet.legion import legion_network;
from pyclustering.nnet import conn_type;... | 0 | 0 | 0 | 0 | 0 | 0 |
torch_mimicry/nets/dcgan/__init__.py | houliangict/mimicry | 560 | 1731689 | from .dcgan_128 import *
from .dcgan_32 import *
from .dcgan_48 import *
from .dcgan_64 import *
from .dcgan_base import *
from .dcgan_cifar import *
| 0 | 0 | 0 | 0 | 0 | 0 |
mushroom_rl/distributions/__init__.py | PuzeLiu/mushroom-rl | 344 | 1731718 | <reponame>PuzeLiu/mushroom-rl<filename>mushroom_rl/distributions/__init__.py<gh_stars>100-1000
from .distribution import Distribution
from .gaussian import GaussianDistribution, GaussianDiagonalDistribution, \
GaussianCholeskyDistribution
__all__ = ['Distribution',
'GaussianDistribution', 'GaussianDiago... | 0 | 0 | 0 | 0 | 0 | 0 |
YouTube-Video-Downloader/youtube_vid_dl.py | avinashkranjan/PraticalPythonProjects | 930 | 1731845 | <reponame>avinashkranjan/PraticalPythonProjects<filename>YouTube-Video-Downloader/youtube_vid_dl.py<gh_stars>100-1000
from tkinter import *
from pytube import YouTube
root = Tk()
root.geometry('700x300')
root.resizable(0, 0)
root.title("YouTube Video Downloader")
Label(root, text='Copy the link of the video you want ... | 0 | 0 | 0 | 0 | 0 | 0 |
gcloud/tests/taskflow3/models/taskflow/test_group_by_instance_node.py | brookylin/bk-sops | 881 | 1731881 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | 0 | 3 | 0 | 0 | 3 | 0 |
z3/k4p2_graceful_graph.py | Wikunia/hakank | 279 | 1731887 | #!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# K4P2 Graceful Graph in Z3
#
# http://www.csplib.org/Problems/prob053/
# """
# Proposed by <NAME>
# A labelling f of the nodes of a graph with q edges is graceful if f assigns each node a unique label
# from 0,1,...,q and when each edge xy is labelled with |f(x)-f(y)|,... | 0 | 0 | 0 | 0 | 0 | 0 |
google/cloud/firestore_bundle/_helpers.py | Arushi201296/python-firestore | 140 | 1731934 | from google.cloud.firestore_v1.base_query import BaseQuery
from google.cloud.firestore_bundle.types import BundledQuery
def limit_type_of_query(query: BaseQuery) -> int:
"""BundledQuery.LimitType equivalent of this query.
"""
return (
BundledQuery.LimitType.LAST
if query._limit_to_last
... | 1 | 1 | 0 | 0 | 2 | 0 |
src/genie/libs/parser/iosxe/tests/ShowPortSecurity/cli/equal/golden_output2_expected.py | balmasea/genieparser | 204 | 1732012 | <reponame>balmasea/genieparser
expected_output = {
'interfaces': {
'Te2/0/4': {
'max_secure_addr_cnt': 5,
'current_addr_cnt': 3,
'security_violation_cnt': 0,
'security_action': 'Shutdown'
},
'Tw3/0/4': {
'max_secure_addr_cnt': 4,
... | 0 | 0 | 0 | 0 | 0 | 0 |
muddery/server/quests/base_quest_status.py | dongwudanci/muddery | 127 | 1732016 | """
Quest dependency's base class.
"""
class BaseQuestStatus(object):
"""
Quest status's base class.
"""
key: str = ""
name: str = ""
def match(self, caller, quest_key) -> bool:
"""
If the quest matches status.
"""
return True
| 0 | 1 | 2 | 0 | 3 | 0 |
tests/test_explain.py | sobolevn/kiss-headers | 103 | 1732022 | import unittest
from kiss_headers import (
AltSvc,
CacheControl,
ContentEncoding,
ContentLength,
ContentType,
Date,
Expires,
Header,
Server,
SetCookie,
StrictTransportSecurity,
XFrameOptions,
XXssProtection,
explain,
)
class MyExplainTestCase(unittest.TestCase)... | 0 | 0 | 0 | 0 | 0 | 0 |
watsor/config/loader.py | firefly2442/watsor | 123 | 1732034 | import os
import re
import yaml
import cerberus
import logging
from watsor.config.schema import schema
_LOGGER = logging.getLogger(__name__)
_ENV_pattern = re.compile('.*?\${(\w+)}.*?')
SECRETS_YAML = "secrets.yaml"
__SECRET_CACHE = {}
def _load_yaml(filename: str, loader: yaml.Loader = yaml.SafeLoader):
_LOG... | 0 | 0 | 0 | 0 | 0 | 1 |
autobahn/wamp/gen/wamp/proto/Unregister.py | rapyuta-robotics/autobahn-python | 1,670 | 1732046 | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: proto
from __future__ import annotations
import flatbuffers
class Unregister(object):
__slots__: list[str] = ['_tab']
@classmethod
def GetRootAsUnregister(cls, buf, offset) -> object:
n = flatbuffers.encode.Get(fla... | 0 | 4 | 1 | 0 | 5 | 0 |
snippets/06 - Reshaping data51.py | joshuagottardogalvani/pandas-tutorial | 183 | 1732120 | <reponame>joshuagottardogalvani/pandas-tutorial<filename>snippets/06 - Reshaping data51.py
sel = cast[(cast.character == 'Superman') | (cast.character == 'Batman')]
sel = sel.groupby(['year', 'character']).size()
sel = sel.unstack()
sel = sel.fillna(0)
sel.head() | 0 | 0 | 0 | 0 | 0 | 0 |
tester/test_model/test_app_rel.py | bukun/TorCMS | 243 | 1732125 | # -*- coding:utf-8 -*-
from torcms.core import tools
from torcms.model.abc_model import MHelper
from torcms.model.category_model import MCategory
from torcms.model.core_tab import TabRel
from torcms.model.label_model import MLabel
from torcms.model.post2catalog_model import MPost2Catalog
from torcms.model.post_model im... | 0 | 0 | 0 | 0 | 0 | 0 |
skompiler/fromskast/excel.py | odinsemvosem/SKompiler | 112 | 1732127 | <gh_stars>100-1000
"""
SKompiler: Generate Sympy expressions from SKAST.
"""
#pylint: disable=protected-access
import warnings
from collections import OrderedDict
from itertools import product, chain, takewhile, count
import re
import numpy as np
from ._common import ASTProcessor, is_, StandardOps, VectorsAsLists, id_g... | 0 | 0 | 0 | 0 | 0 | 0 |
model/trainer_mi.py | LCF2764/tf-kaldi-speaker | 154 | 1732165 | from __future__ import annotations
import tensorflow as tf
import os
import sys
import time
import numpy as np
from model.trainer import Trainer
from dataset.data_loader import KaldiMultiDataRandomQueue, KaldiMultiDataSeqQueue, DataOutOfRange
from model.common import l2_scaling
from model.loss import softmax
from model... | 11 | 7 | 0 | 3 | 21 | 0 |
trainers/coretrainer.py | ParikhKadam/HybridPose | 369 | 1732187 | import torch
import torch.nn.functional as F
import time
import os
import cv2
import numpy as np
from sklearn.neighbors import KDTree
from random import sample
from lib.utils import save_session, AverageMeter
from lib.ransac_voting_gpu_layer.ransac_voting_gpu import ransac_voting_layer_v3
from lib.ransac_voting_gpu_lay... | 4 | 6 | 0 | 0 | 10 | 0 |
configs/_base_/datasets/pw3d.py | ykk648/mmhuman3d | 472 | 1732219 | # dataset settings
dataset_type = 'PW3D'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
data_keys = [
'has_smpl', 'smpl_body_pose', 'smpl_global_orient', 'smpl_betas',
'smpl_transl'
]
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='Random... | 0 | 0 | 0 | 0 | 0 | 0 |
stonesoup/metricgenerator/basicmetrics.py | Red-Portal/Stone-Soup-1 | 157 | 1732244 | <reponame>Red-Portal/Stone-Soup-1<filename>stonesoup/metricgenerator/basicmetrics.py
# -*- coding: utf-8 -*-
from .base import MetricGenerator
from ..types.metric import TimeRangeMetric
from ..types.time import TimeRange
class BasicMetrics(MetricGenerator):
"""Calculates simple metrics like number of tracks, tru... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/rng.py | CosmosHua/iGAN | 4,167 | 1732246 | <filename>lib/rng.py
from numpy.random import RandomState
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
from random import Random
from time import time
seed = int(time())
py_rng = Random(seed)
np_rng = RandomState(seed)
t_rng = RandomStreams(seed)
def set_seed(n):
global seed, py_rng, np_r... | 0 | 0 | 0 | 0 | 0 | 0 |
src/radish/step_testing/matcher.py | radish-bdd/radish2 | 182 | 1732254 | <gh_stars>100-1000
"""
radish
~~~~~~
The root from red to green. BDD tooling for Python.
:copyright: (c) 2019 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
from pathlib import Path
from typing import List, Dict, Any
from unittest import mock
from collections import OrderedDict, defaultdict
imp... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_models_capitalised.py | nschlemm/django-tagulous | 307 | 1732260 | <gh_stars>100-1000
"""
Test models with capitalised names in the database (#60)
"""
from django.test import TestCase
from tests.lib import TagTestManager
from tests.tagulousTestsApp3 import models as test_models
class CapitalisedModelTest(TagTestManager, TestCase):
"""
Test model with capitalised table name
... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/ShallowWaterApplication/python_scripts/postprocess/compute_froude_process.py | clazaro/Kratos | 778 | 1732261 | import KratosMultiphysics as KM
import KratosMultiphysics.ShallowWaterApplication as SW
def Factory(settings, Model) -> object:
if not isinstance(settings, KM.Parameters):
raise Exception("expected input shall be a Parameters object, encapsulating a json string")
return ComputeFroudeProcess(Model, sett... | 0 | 1 | 0 | 0 | 1 | 0 |
notify/tests/urls.py | bstepa/django-notify-x | 203 | 1732320 | try:
from django.conf.urls import url, include
except ImportError:
from django.urls import url, include
urlpatterns = [
url(r'^', include('notify.urls', namespace='notifications')),
]
| 0 | 0 | 0 | 0 | 0 | 0 |
monoscene/data/kitti_360/collate.py | Teaksters/MonoScene | 122 | 1732397 | import torch
def collate_fn(batch) -> object:
data = {}
imgs = []
frame_ids = []
img_paths = []
sequences = []
cam_ks = []
T_velo_2_cams = []
scale_3ds = batch[0]["scale_3ds"]
for scale_3d in scale_3ds:
data["projected_pix_{}".format(scale_3d)] = []
data["fov_mask... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/test_core.py | PSFC-HEDP/Orion | 543 | 1732416 | import os
import numpy as np
import pandas as pd
from mlblocks.discovery import load_pipeline
from orion.core import Orion
class TestOrion:
@classmethod
def setup_class(cls):
cls.clean = pd.DataFrame({
'timestamp': list(range(100)),
'value': [1] * 100,
})
cls... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/devops_tasks/set_tox_environment.py | rsdoherty/azure-sdk-for-python | 2,728 | 1732483 | <filename>scripts/devops_tasks/set_tox_environment.py
#!/usr/bin/env python
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license inform... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils.py | ShaveenR/script.module.inputstreamhelper | 127 | 1732495 | <reponame>ShaveenR/script.module.inputstreamhelper<gh_stars>100-1000
# -*- coding: utf-8 -*-
# MIT License (see LICENSE.txt or https://opensource.org/licenses/MIT)
"""Implements various helper functions"""
from __future__ import absolute_import, division, unicode_literals
import inputstreamhelper
def delete_cached()... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | daniel55411/peewee-async | 713 | 1732496 | <reponame>daniel55411/peewee-async<filename>setup.py<gh_stars>100-1000
"""
Asynchronous interface for peewee ORM powered by asyncio.
"""
from setuptools import setup
VERSION = ''
with open('peewee_async.py') as module_fp:
for line in module_fp:
if line.startswith('__version__'):
VERSION = line... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unittests/util/test_process_utils.py | zhanghan177/mycroft-core | 6,099 | 1732524 | <gh_stars>1000+
from unittest import TestCase, mock
from mycroft.util.process_utils import (_update_log_level, bus_logging_status,
create_daemon, ProcessStatus,
StatusCallbackMap)
class TestCreateDaemon(TestCase):
def test_create(sel... | 0 | 0 | 0 | 0 | 0 | 0 |
python/test/utils/test_graph_converters/ref_graphs/resnets.py | daniel-falk/nnabla | 2,792 | 1732562 | # Copyright 2018,2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group 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
#... | 114 | 30 | 0 | 0 | 144 | 0 |
CommonTools/ParticleFlow/python/Isolation/pfMuonIsolation_cff.py | ckamtsikis/cmssw | 852 | 1732601 | import FWCore.ParameterSet.Config as cms
# iso deposits and isolation values, defined by the Muon POG
from RecoMuon.MuonIsolation.muonPFIsolation_cff import *
# computing the isolation for the muons produced by PF2PAT, and not for reco muons
sourceMuons = 'pfSelectedMuons'
muPFIsoDepositCharged.src = sourceMuons
m... | 0 | 0 | 0 | 0 | 0 | 0 |
vim/rplugin/python3/denite/filter/converter/devicons.py | petobens/dotfiles | 131 | 1732608 | """Converter to prepend devicons to denite candidates."""
from pathlib import Path
from denite.base.filter import Base
DEFAULT_ICON = ''
DIR_ICON = ''
FILENAMES = {
'.bash_profile': '',
'.bashrc': '',
'.gitignore': '',
'.vimrc': '',
'dockerfile': '',
'license': '',
}
EXTENSIONS = {
... | 0 | 2 | 0 | 1 | 3 | 0 |
mozi/layers/misc.py | hycis/Mozi | 122 | 1732610 | <filename>mozi/layers/misc.py
import theano
import theano.tensor as T
from mozi.layers.template import Template
import numpy as np
class Flatten(Template):
def _train_fprop(self, state_below):
size = T.prod(state_below.shape) / state_below.shape[0]
nshape = (state_below.shape[0], size)
re... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/test_models/test_full_battery_models/test_lithium_ion/test_spme_half_cell.py | manjunathnilugal/PyBaMM | 330 | 1732621 | #
# Tests for the lithium-ion half-cell SPMe model
# This is achieved by using the {"working electrode": "positive"} option
#
import pybamm
import unittest
from tests import BaseUnitTestLithiumIonHalfCell
class TestSPMeHalfCell(BaseUnitTestLithiumIonHalfCell, unittest.TestCase):
def setUp(self):
self.mode... | 0 | 0 | 0 | 0 | 0 | 0 |
requests__examples/post_file.py | DazEB2/SimplePyScripts | 117 | 1732628 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: http://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file
import requests
url = 'https://httpbin.org/post'
abs_file_name = __file__
files = {'file': open(abs_file_name, 'rb')}
rs = requests.post(url,... | 0 | 0 | 0 | 0 | 0 | 0 |
pydsa/bfs.py | mish24/pydsa | 126 | 1732636 | <filename>pydsa/bfs.py
# Breadth First Search
# Complexity: O(V+E)
def bfs(graph, start):
"""
Traverses a graph using Breadth First Search Algorithm.
It returns a set of nodes traversed.
"""
visited, queue = set(), [start]
while queue:
node = queue.pop(0)
if node not in visited... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/snippets/storage_delete_bucket_notification.py | micahjsmith/python-storage | 187 | 1732642 | #!/usr/bin/env python
# Copyright 2021 Google LLC. 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... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/test_thread_exception.py | spMohanty/marlo | 214 | 1732680 |
import marlo
import time
@marlo.threaded
def run(i):
time.sleep(3 + i)
print("hick " + str(i))
if i % 2 == 1:
raise IOError("testing")
thread_handlers = [run(i) for i in range(0, 2)]
marlo.utils.join_all(thread_handlers)
| 0 | 0 | 0 | 0 | 0 | 0 |
extras/gcs/python/debugging.py | sujanabasnet/Hackflight | 200 | 1732712 | <filename>extras/gcs/python/debugging.py
'''
Debugging support for Hackflight GCS
Copyright (C) <NAME> 2021
MIT License
'''
from sys import stdout
def debug(msg):
print(msg)
stdout.flush()
| 0 | 0 | 0 | 0 | 0 | 0 |
pororo/models/tts/synthesizer.py | jayten42/pororo | 1,137 | 1732736 | import json
from typing import Tuple
import librosa
import torch
from pororo.models.tts.hifigan.checkpoint import load_checkpoint
from pororo.models.tts.hifigan.model import Generator
from pororo.models.tts.synthesis import synthesize
from pororo.models.tts.tacotron.params import Params as tacotron_hp
from pororo.mod... | 20 | 6 | 0 | 2 | 28 | 0 |
src/sellers/views.py | damansinghh/digital-marketplace | 104 | 1732756 | from django.shortcuts import render
from django.views.generic import View
from django.views.generic.base import RedirectView
from django.views.generic.edit import FormMixin
from django.views.generic.list import ListView
from django.shortcuts import get_object_or_404
from billing.models import Transaction
from digital... | 0 | 5 | 3 | 0 | 8 | 0 |
python/paddle_fl/paddle_fl/examples/dpsgd_demo/fl_master.py | barrierye/PaddleFL | 379 | 1732771 | # Copyright (c) 2020 PaddlePaddle 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 required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
data-prepro/MSCOCO_preprocess/preprocess_token.py | tsenghungchen/show-adapt-and-tell | 166 | 1732795 | import re
import json
import numpy as np
from tqdm import tqdm
import pdb
import os
import pickle
import cPickle
import string
import sys
def unpickle(p):
return cPickle.load(open(p,'r'))
def load_json(p):
return json.load(open(p,'r'))
def clean_words(data):
dict = {}
freq = {}
# start with 1
idx = 1
sentence... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/states/rabbitmq/test_policy.py | babs/salt | 9,425 | 1732821 | """
:codeauthor: <NAME> <<EMAIL>>
"""
import pytest
import salt.states.rabbitmq_policy as rabbitmq_policy
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules() -> dict[object,dict[object,object]]:
return {rabbitmq_policy: {}}
# 'present' function tests: 1
def test... | 0 | 1 | 0 | 0 | 1 | 0 |
test_project/tests/models.py | epoiate/django-autocomplete-light | 1,368 | 1732834 | <reponame>epoiate/django-autocomplete-light
from django.contrib.auth.models import User
from django.db.models.signals import post_migrate
def test_user(sender, *args, **kwargs):
if sender.name != 'django.contrib.auth':
return
user, c = User.objects.get_or_create(username='test')
user.is_staff = T... | 0 | 0 | 0 | 0 | 0 | 0 |
src/stage1/retinanet.py | gathierry/FashionAI-KeyPointsDetectionOfApparel | 174 | 1732838 | <filename>src/stage1/retinanet.py
import math
import torch
import torch.nn as nn
from fpn import FPN101
class RetinaNet(nn.Module):
def __init__(self, config, num_classes):
super(RetinaNet, self).__init__()
self.fpn = FPN101(pretrained=True)
if num_classes > 2:
s... | 0 | 0 | 0 | 0 | 0 | 0 |
HX711_Python3/__init__.py | iViniSWAT/MecMaq-master | 103 | 1732846 | from . import hx711
| 0 | 0 | 0 | 0 | 0 | 0 |
dffml/util/testing/consoletest/__main__.py | Saanidhyavats/dffml | 171 | 1732847 | <filename>dffml/util/testing/consoletest/__main__.py
import sys
import asyncio
from .cli import main
if __name__ == "__main__":
asyncio.run(main(sys.argv[1:]))
| 0 | 0 | 0 | 0 | 0 | 0 |
test/core/028-dynamic-hierarchy/generate_inner_diamond_workflow.py | ahnitz/pegasus | 127 | 1732872 | #!/usr/bin/env python3
from Pegasus.api import *
# --- Workflow -----------------------------------------------------------------
fa = File("f.a")
fb1 = File("f.b1")
fb2 = File("f.b2")
fc1 = File("f.c1")
fc2 = File("f.c2")
fd = File("f.d")
wf = Workflow("diamond")
preprocess_job = Job("preprocess")\
... | 0 | 0 | 0 | 0 | 0 | 0 |
torchrec/metrics/throughput.py | xing-liu/torchrec | 814 | 1732905 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#!/usr/bin/env python3
import math
import time
from collections import deque
from typin... | 4 | 4 | 12 | 3 | 23 | 0 |
vispy/scene/widgets/tests/test_colorbar.py | 3DAlgoLab/vispy | 2,617 | 1732907 | # -*- coding: utf-8 -*-
"""Tests for ColorbarVWidget.
All images are of size (100,100) to keep a small file size
"""
from vispy.scene.widgets import ColorBarWidget
from vispy.testing import (requires_application, TestingCanvas,
run_tests_if_main)
from vispy.testing.image_tester import ass... | 1 | 1 | 0 | 0 | 2 | 0 |
2018/CVE-2018-7467/poc/pocsploit/CVE-2018-7467.py | hjyuan/reapoc | 421 | 1732941 | from __future__ import annotations
import requests
# Vuln Base Info
def info() -> dict[str,dict[str,str] | list[str] | str]:
return {
"author": "cckuailong",
"name": '''AxxonSoft Axxon Next Directory Traversal''',
"description": '''AxxonSoft Axxon Next suffers from a directory traversal vu... | 0 | 5 | 0 | 0 | 5 | 0 |
Week11/684.py | bobsingh149/LeetCode | 101 | 1732991 | <filename>Week11/684.py<gh_stars>100-1000
class Solution:
def findRedundantConnection(self, edges: List[List[int]]) -> List[int]:
parent=[i for i in range(len(edges)+1)]
rank=[0 for i in range(len(edges)+1)]
def findpath(u,parent):
if parent[u]!=u:
parent[u]=findp... | 0 | 0 | 0 | 0 | 0 | 0 |
application/models/order/order_stat.py | mutalisk999/bibi | 1,037 | 1733044 | <filename>application/models/order/order_stat.py<gh_stars>1000+
# -*- coding: utf-8 -*-
from application.extensions import db
__all__ = ['OrderStat']
class OrderStat(db.Document):
meta = {
'db_alias': 'order_db',
'indexes': ['user_id']
}
user_id = db.ObjectIdField(required=True)
order... | 0 | 0 | 0 | 0 | 0 | 0 |
core/logger.py | evandrocoan/Javatar | 142 | 1733053 | <gh_stars>100-1000
class _Logger:
NONE = 0
INFO = 1
WARNING = 2
ERROR = 3
DEBUG = 4
@classmethod
def instance(cls):
if not hasattr(cls, "_instance"):
cls._instance = cls()
return cls._instance
def reset(self):
"""
Reset all changes (used on r... | 0 | 0 | 0 | 0 | 0 | 0 |
Python3/963.py | rakhi2001/ecom7 | 854 | 1733059 | <reponame>rakhi2001/ecom7<gh_stars>100-1000
__________________________________________________________________________________________________
sample 80 ms submission
import itertools
import math
class Solution:
def minAreaFreeRect(self, points: List[List[int]]) -> float:
points = [complex(*z) for z in poin... | 0 | 0 | 0 | 0 | 0 | 0 |
python/veles/dis/mem.py | pombredanne/veles | 918 | 1733080 | <filename>python/veles/dis/mem.py<gh_stars>100-1000
# Copyright 2017 CodiLime
#
# 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 require... | 0 | 0 | 0 | 0 | 0 | 0 |
django_example/blog/auth.py | kundius/cancan | 449 | 1733115 | <reponame>kundius/cancan
import cancan
from django.core.exceptions import PermissionDenied
from .models import Article
class Ability(cancan.Ability):
def __init__(self, user):
self.user = user
if user is None or user.is_anonymous:
self.init_guest_ability()
elif user.is_superus... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/clone_vm.py | ArpitSharma2800/pyvmomi-community-samples | 931 | 1733149 | #!/usr/bin/env python
"""
Written by <NAME>
Github: https://github.com/whereismyjetpack
Email: <EMAIL>
Clone a VM from template example
"""
from pyVmomi import vim
from tools import cli, service_instance, pchelper
from add_nic_to_vm import add_nic
def wait_for_task(task) -> object:
""" wait for a vCenter task t... | 0 | 1 | 0 | 0 | 1 | 0 |
lfs/customer_tax/tests.py | michael-hahn/django-lfs | 345 | 1733159 | <filename>lfs/customer_tax/tests.py
# django imports
from django.contrib.auth.models import AnonymousUser
from django.test import TestCase
# test imports
from lfs.tests.utils import create_request
# lfs imports
from lfs.catalog.models import Product
from lfs.core.models import Country
from lfs.criteria.models import ... | 0 | 0 | 0 | 0 | 0 | 0 |
wetectron/modeling/registry.py | akobiisr/wetectron | 332 | 1733200 | <reponame>akobiisr/wetectron<gh_stars>100-1000
# --------------------------------------------------------
# Copyright (C) 2020 NVIDIA Corporation. All rights reserved.
# Nvidia Source Code License-NC
# --------------------------------------------------------
# Copyright (c) Facebook, Inc. and its affiliates. All Rights... | 0 | 0 | 0 | 0 | 0 | 0 |
termius/main.py | Leo-Ryu/termius-cli | 169 | 1733222 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
"""Entrypoint for CLI tool."""
import sys
import os
import warnings
from termius.app import TermiusApp
if os.getenv('TERMIUS_CLI_DEBUG'):
warnings.filterwarnings(
'ignore', r'Python 2 is no longer supported by the Python core... | 1 | 1 | 0 | 0 | 2 | 0 |
cointrader/strategy.py | 3con/cointrader | 103 | 1733229 | <reponame>3con/cointrader<filename>cointrader/strategy.py
#!/usr/bin/env python
import datetime
import logging
from cointrader.indicators import (
WAIT, BUY, SELL, Signal, macdh_momententum, macdh, double_cross
)
log = logging.getLogger(__name__)
class Strategy(object):
"""Docstring for Strategy. """
d... | 0 | 0 | 0 | 0 | 0 | 0 |
fbpic/particles/deposition/particle_shapes.py | wilds9/fbpic | 131 | 1733249 | # Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This file is part of the Fourier-Bessel Particle-In-Cell code (FB-PIC)
It defines the linear and cubic particle shape factors for the deposition.
"""
import math
# -------------------------------
# Particle shape Fa... | 0 | 4 | 0 | 0 | 4 | 0 |
leetcode.com/python/90_Subsets_II.py | vansh-tiwari/coding-interview-gym | 713 | 1733264 | <gh_stars>100-1000
# Source: https://tinyurl.com/wfkx3jt
class Solution(object):
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
totalSubsets = []
totalSubsets.append([])
startIndex, endIndex = 0, 0
... | 0 | 0 | 0 | 0 | 0 | 0 |
KG-Search-Flask/forms.py | jizongFox/Knowledge-Graph-And-Visualization-Demo | 111 | 1733318 | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField, TextAreaField, ValidationError, HiddenField, \
BooleanField, PasswordField, DateField
from wtforms.validators import InputRequired, Email, Length, Optional, URL, Regexp
class KeywordSearchForm(FlaskForm):
keyword = Str... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.