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 |
|---|---|---|---|---|---|---|---|---|---|---|
loudml/loudml/dummystorage.py | jkbrandt/loudml | 245 | 1749713 | <reponame>jkbrandt/loudml<gh_stars>100-1000
from .storage import Storage
class DummyStorage(Storage):
"""
Dummy Loud ML storage for testing
"""
def model_exists(self, name):
return False
def template_exists(self, name):
return False
def get_model_data(self, name, ckpt_name=N... | 0 | 0 | 0 | 0 | 0 | 0 |
astrality/tests/test_compiler.py | fossabot/astrality | 111 | 1749727 | """Tests for the compiler module."""
import logging
import os
from pathlib import Path
import pytest
from jinja2 import UndefinedError
from astrality.compiler import (
compile_template,
compile_template_to_string,
jinja_environment,
)
from astrality.context import Context
@pytest.fixture
def test_templ... | 0 | 2 | 0 | 0 | 2 | 0 |
notebook/json_example.py | vhn0912/python-snippets | 174 | 1749749 | <reponame>vhn0912/python-snippets<gh_stars>100-1000
import json
from collections import OrderedDict
import pprint
s = r'{"C": "\u3042", "A": {"i": 1, "j": 2}, "B": [{"X": 1, "Y": 10}, {"X": 2, "Y": 20}]}'
print(s)
# {"C": "\u3042", "A": {"i": 1, "j": 2}, "B": [{"X": 1, "Y": 10}, {"X": 2, "Y": 20}]}
d = json.loads(s)... | 0 | 0 | 0 | 0 | 0 | 0 |
development/release-notes/generateReleaseNotes.py | bubenheimer/androidx | 3,799 | 1749756 | #!/usr/bin/python3
#
# Copyright (C) 2020 The Android Open Source Project
#
# 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 requir... | 0 | 5 | 0 | 0 | 5 | 0 |
test/req_test.py | yangyuexiong/Flask_BestPractices | 141 | 1749759 | # -*- coding: utf-8 -*-
# @Time : 2019-05-15 15:56
# @Author : ShaHeTop-Almighty-ares
# @Email : <EMAIL>
# @File : req_test.py
# @Software: PyCharm
import requests
base_url = 'http://0.0.0.0:9999/'
api = base_url + 'api/'
cms = base_url + 'cms/'
r = requests.get(api)
print(r.json())
r1 = requests.get(cms)... | 0 | 0 | 0 | 0 | 0 | 0 |
seahub/organizations/api_urls.py | samuelduann/seahub | 420 | 1749761 | <filename>seahub/organizations/api_urls.py
# Copyright (c) 2012-2016 Seafile Ltd.
from django.conf.urls import url
from .api.address_book.groups import (
AdminAddressBookGroups, AdminAddressBookGroup
)
from .api.group_libraries import AdminGroupLibraries, AdminGroupLibrary
from .api.group_owned_libraries import (... | 0 | 0 | 0 | 0 | 0 | 0 |
tutorials/eboutique/microservices/notifier/src/aggregates.py | bhardwajRahul/minos-python | 247 | 1749795 | <reponame>bhardwajRahul/minos-python
from uuid import (
UUID,
)
from minos.aggregate import (
Aggregate,
RootEntity,
)
class Notifier(RootEntity):
"""Notifier RootEntity class."""
class NotifierAggregate(Aggregate[Notifier]):
"""NotifierAggregate class."""
@staticmethod
async def creat... | 0 | 0 | 0 | 0 | 0 | 0 |
eval/multi_bin/bdg_bins/binary_dependency_graph/plugins/environment.py | cpbscholten/karonte | 294 | 1749807 | <reponame>cpbscholten/karonte
import angr
from __init__ import Plugin
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(abspath(__file__))))
from taint_analysis.utils import ordered_agument_regs
from binary_dependency_graph.utils import *
from binary_dependency_graph.bdp_enum import *
im... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_subcommands.py | jamezpolley/begins | 120 | 1749809 | <filename>tests/test_subcommands.py
from __future__ import absolute_import, division, print_function
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
import pkg_resources
import begin
class TestSubCommand(unittest.TestCase):
def tearDown(self):
for collector in... | 0 | 0 | 0 | 0 | 0 | 0 |
aws_lambda_powertools/utilities/parser/pydantic.py | Sordie/aws-lambda-powertools-python | 1,208 | 1749819 | <reponame>Sordie/aws-lambda-powertools-python
# Pydantic has many utilities that some advanced customers typically use.
# Importing what's currently in the docs would likely miss something.
# As Pydantic export new types, new utilities, we will have to keep up
# with a project that's not used in our core functionalitie... | 0 | 0 | 0 | 0 | 0 | 0 |
{{cookiecutter.project_name}}/tests/test_apps/test_main/test_views/test_index_view.py | oxyum/wemake-django-template | 1,489 | 1749832 | from django.test import Client
from django.urls import reverse
def test_main_page(client: Client, main_heading: str) -> None:
"""This test ensures that main page works."""
response = client.get('/')
assert response.status_code == 200
assert main_heading in str(response.content)
def test_hello_page(... | 4 | 2 | 0 | 0 | 6 | 0 |
QPT_client/Python/Lib/site-packages/qpt/smart_opt.py | Scxw010516/Smart_container | 150 | 1749837 | <reponame>Scxw010516/Smart_container
# Author: <NAME>
# Datetime:2021/6/24
# Copyright belongs to the author.
# Please indicate the source for reprinting.
# 设置镜像源
import os
from qpt import Logging
from qpt.kernel.qinterpreter import PIPTerminal, PipTools
from qpt.memory import QPT_MEMORY
def set_default_pip_source... | 0 | 0 | 0 | 0 | 0 | 0 |
vq_f16.py | dome272/MaskGIT-pytorch | 163 | 1749844 | from __future__ import annotations
import torch
import torch.nn as nn
from vq_modules import Encoder, Decoder
from vq_modules import VectorQuantizer2 as VectorQuantizer
class VQModel(nn.Module):
def __init__(self, ckpt_path: object | None=None):
super().__init__()
ddconfig = {'double_z':... | 2 | 5 | 0 | 0 | 7 | 0 |
websauna/system/user/__init__.py | stevepiercy/websauna | 286 | 1749859 | <reponame>stevepiercy/websauna
"""Default user models, login and sign up, federated authentication integration views."""
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/svm_classifier_feature_scaling.py | vipavlovic/pyprobml | 4,895 | 1749870 |
# SVM for binary classification in 2d
# Code is based on
# https://github.com/ageron/handson-ml2/blob/master/05_support_vector_machines.ipynb
import superimport
import numpy as np
import matplotlib.pyplot as plt
from sklearn.svm import SVC
from sklearn import datasets
from sklearn.datasets import make_moons
fro... | 0 | 0 | 0 | 0 | 0 | 0 |
vol1/python-examples/examples/example_readcsv.py | Sun-Joong/aifh | 777 | 1749879 | <reponame>Sun-Joong/aifh
#!/usr/bin/env python
"""
Artificial Intelligence for Humans
Volume 1: Fundamental Algorithms
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2013 by <NAME>
Licensed under the Apach... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/pointers.py | dikshakumari5643/Pybelt | 474 | 1749899 | <gh_stars>100-1000
import re
import urllib2
import socket
import subprocess
from urllib2 import HTTPError
from requests.exceptions import ConnectionError
# Libraries
from lib.core.dork_check import DorkScanner
from lib.core.errors import GoogleBlockException
from lib.core.hash_cracking import HashCracker
from lib.core... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/source/extensions/githublinks/__init__.py | Yurzs/boto | 5,079 | 1749915 | """Add github roles to sphinx docs.
Based entirely on <NAME>'s bitbucket version, but
adapted for Github.
(https://bitbucket.org/dhellmann/sphinxcontrib-bitbucket/)
"""
from urlparse import urljoin
from docutils import nodes, utils
from docutils.parsers.rst.roles import set_classes
def make_node(rawtext, app, type... | 4 | 3 | 0 | 0 | 7 | 0 |
examples/models/wide_deep.py | ShaunHeNJU/tensornet | 273 | 1749925 | # -*- coding: utf-8 -*-
import tensorflow as tf
import tensornet as tn
from common.config import Config as C
from common.layers import FMLayer
from common.feature_column import tn_category_columns_builder, embedding_columns_builder, create_emb_model
def create_sub_model(linear_embs, deep_embs, deep_hidden_units) -> ... | 1 | 2 | 0 | 0 | 3 | 0 |
tests/nn/architectures/test_resnet.py | hectorcarrion/sleap | 156 | 1749950 | import numpy as np
import tensorflow as tf
from sleap.nn.system import use_cpu_only
use_cpu_only() # hide GPUs for test
from sleap.nn.architectures import upsampling
from sleap.nn.architectures import resnet
from sleap.nn.config import ResNetConfig
class ResnetTests(tf.test.TestCase):
def test_resnet50(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/gitspindle/monkey.py | seveas/git-spindle | 147 | 1749954 | <filename>lib/gitspindle/monkey.py<gh_stars>100-1000
# Set the spindle attribute
import github3.gists
# Monkeypatch github3.gists.Gist to behave more like a repo
github3.gists.gist._Gist.ssh_url = property(lambda self: 'git@gist.github.com:/%s.git' % self.id)
github3.gists.gist._Gist.clone_url = property(lambda self: ... | 0 | 0 | 0 | 0 | 0 | 0 |
models.py | VishnuAvNair/ICIAR2018 | 185 | 1749967 | <filename>models.py<gh_stars>100-1000
#!/usr/bin/env python3
"""Implement several encoder classes"""
from keras.applications.resnet50 import ResNet50, preprocess_input as preprocess_resnet, decode_predictions
from keras.applications.inception_v3 import InceptionV3, preprocess_input as preprocess_inception
from keras.a... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/math/general_purpose.py | anukaal/opytimizer | 528 | 1749973 | <reponame>anukaal/opytimizer
import opytimizer.math.general as g
# Creates a list for pairwising
individuals = [1, 2, 3, 4]
# Creates pairwise from list
for pair in g.n_wise(individuals, 2):
# Outputting pairs
print(f'Pair: {pair}')
# Performs a tournmanet selection over list
selected = g.tournament_selectio... | 0 | 0 | 0 | 0 | 0 | 0 |
pythran/tests/test_named_parameters.py | jeanlaroche/pythran | 1,647 | 1750012 | from pythran.tests import TestEnv
from pythran.syntax import PythranSyntaxError
class TestNamedParameters(TestEnv):
def test_call_with_named_argument(self):
self.run_test("""
def foo(a):
return a
def call_with_named_argument(n):
return foo(a=n)""", 1, call_with_named_argument=[int])
def test_... | 0 | 0 | 0 | 0 | 0 | 0 |
basic/inlines/admin.py | neechadi/django-basic-apps | 548 | 1750023 | from django.contrib import admin
from basic.inlines.models import *
admin.site.register(InlineType) | 0 | 0 | 0 | 0 | 0 | 0 |
data/transcoder_evaluation_gfg/python/COUNT_BINARY_STRINGS_K_TIMES_APPEARING_ADJACENT_TWO_SET_BITS.py | mxl1n/CodeGen | 241 | 1750077 | <filename>data/transcoder_evaluation_gfg/python/COUNT_BINARY_STRINGS_K_TIMES_APPEARING_ADJACENT_TWO_SET_BITS.py
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( n ,... | 0 | 0 | 0 | 0 | 0 | 0 |
components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/api/poddefault.py | zhyon404/kubeflow | 9,272 | 1750096 | <filename>components/crud-web-apps/common/backend/kubeflow/kubeflow/crud_backend/api/poddefault.py
from .. import authz
from . import custom_api
def list_poddefaults(namespace):
authz.ensure_authorized("list", "kubeflow.org", "v1alpha1", "poddefaults",
namespace)
return custom_api.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/timeseers/__init__.py | maxthemillion/timeseers | 233 | 1750115 | <filename>src/timeseers/__init__.py
from timeseers.linear_trend import LinearTrend
from timeseers.timeseries_model import TimeSeriesModel
from timeseers.fourier_seasonality import FourierSeasonality
from timeseers.logistic_growth import LogisticGrowth
from timeseers.indicator import Indicator
from timeseers.constant im... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter04/even_integers.py | 4n3i5v74/Python-3-Object-Oriented-Programming-Third-Edition | 393 | 1750129 | class EvenOnly(list):
def append(self, integer):
if not isinstance(integer, int):
raise TypeError("Only integers can be added")
if integer % 2:
raise ValueError("Only even numbers can be added")
super().append(integer)
| 0 | 0 | 0 | 0 | 0 | 0 |
lstms/container.py | denizetkar/lstms.pth | 130 | 1750132 | <reponame>denizetkar/lstms.pth
#!/usr/bin/env python
"""
A helper class to contruct multi-layered LSTMs.
"""
import math
from typing import List, Tuple, Type
import torch as th
import torch.nn as nn
from .lstm import LSTM
class MultiLayerLSTM(nn.Module):
"""
MultiLayer LSTM of any type.
Note: Dropout ... | 0 | 0 | 0 | 0 | 0 | 0 |
baidutieba/add_reply.py | TheRealMilesLee/Spider-Crack-JS | 993 | 1750134 | import execjs
import requests
import re
import random
import time
class Reply(object):
def __init__(self):
self.headers: dict[str,object] = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
' (KHTML, like Gecko) Chrome/76.0.3809.132 Safar... | 0 | 3 | 0 | 3 | 6 | 0 |
Smart_container/PaddleClas/deploy/python/test.py | thomas-yanxin/Smart_container | 150 | 1750138 | <filename>Smart_container/PaddleClas/deploy/python/test.py
#图片处理
import base64
import binascii
import hashlib
import json
import os
from typing import Container
import memcache
import pymysql
import requests
from django.http import JsonResponse
from django.shortcuts import HttpResponse, render
#检索
from fuzzywuzzy impo... | 0 | 0 | 0 | 0 | 0 | 0 |
archivebox/core/migrations/0001_initial.py | sarvex/ArchiveBox | 6,340 | 1750149 | <reponame>sarvex/ArchiveBox<gh_stars>1000+
# Generated by Django 2.2 on 2019-05-01 03:27
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Snapshot',
... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/woapp.py | haygcao/UnicomDailyTask | 148 | 1750151 | <reponame>haygcao/UnicomDailyTask<filename>utils/woapp.py
# -*- coding: utf8 -*-
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
from utils.toutiao_sdk import md5
def encrypt_params(value):
if not isinstance(value, bytes):
data = str(value).encode('utf8')
cipher = AES.n... | 0 | 0 | 0 | 0 | 0 | 0 |
test/Configure/SConscript.py | moroten/scons | 1,403 | 1750153 | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | 0 | 0 | 0 | 0 | 0 | 0 |
bindings/python/pyonmttok/version.py | OpenNMT/Tokenizer | 186 | 1750158 | """Version information."""
__version__ = "1.30.0"
| 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/System/ComponentModel/__init___parts/INotifyPropertyChanging.py | htlcnn/ironpython-stubs | 182 | 1750177 | class INotifyPropertyChanging:
""" Notifies clients that a property value is changing. """
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
PropertyChanging: None = None
| 0 | 0 | 1 | 0 | 1 | 0 |
rlmeta/utils/moolib_utils.py | stjordanis/rlmeta | 258 | 1750204 | <filename>rlmeta/utils/moolib_utils.py<gh_stars>100-1000
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import uuid
def generate_random_name() -> str:
return str(uuid.uuid4())
def... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/webtests/api/test_gist.py | mubashshirjamal/code | 1,582 | 1750257 | # encoding: utf-8
from base import APITestCase
from vilya.libs.store import store
from vilya.models.gist_comment import GistComment
class GistTest(APITestCase):
def setUp(self):
store.execute('delete from gist_stars where id<10')
super(GistTest, self).setUp()
self.gist1 = self._add_gist(
... | 0 | 0 | 0 | 0 | 0 | 0 |
cvpods/modeling/roi_heads/disalign_fast_rcnn.py | tonysy/cvpods | 548 | 1750261 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Copyright (c) Megvii@BaseDetection and its affiliates. All Rights Reserved
import numpy as np
import torch
from torch import nn
from cvpods.layers import cat, NormalizedLinear
class DisAlignFastRCNNOutputLayers(nn.Module):
"""
Two line... | 7 | 3 | 0 | 0 | 10 | 0 |
tests/strings/strip.py | MoonStarCZW/py2rb | 124 | 1750290 | <filename>tests/strings/strip.py
s1 = "\n\nabc\n\n\n"
s2 = "\t abc\n\t \n"
s3 = " abc "
for s in [s1,s2,s3]:
print("original("+s+")")
print("strip("+s.strip()+")")
| 0 | 0 | 0 | 0 | 0 | 0 |
src/gluonnlp/models/xlmr.py | leezu/gluon-nlp | 2,461 | 1750309 | <reponame>leezu/gluon-nlp
# 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
#... | 0 | 0 | 0 | 0 | 0 | 0 |
jaxfg/sparse/_sparse_matrix.py | AvanDavad/jaxfg | 120 | 1750325 | <filename>jaxfg/sparse/_sparse_matrix.py
from typing import Tuple
import jax_dataclasses
import scipy
from jax import numpy as jnp
from .. import hints
@jax_dataclasses.pytree_dataclass
class SparseCooCoordinates:
rows: hints.Array
"""Row indices of non-zero entries. Shape should be `(*, N)`."""
cols: h... | 0 | 0 | 0 | 0 | 0 | 0 |
count_program.py | sattwik21/Hacktoberfest2021-1 | 215 | 1750351 | <reponame>sattwik21/Hacktoberfest2021-1
import statistics
import numpy as np
# fungsi untuk mengurutkan bilangan
def sort(num):
num.sort()
print("Urutkan angka: ", end = "")
for i in num:
if i < len(num):
print(i, end=", ")
else:
print(i)
# fungsi untuk menghitung rata-rata
def average(num):
result = su... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/pi/pi_img.py | Ryoich/python_zero | 203 | 1750367 | import random
from PIL import Image, ImageDraw
size = 256
trial = 100
im = Image.new("RGB", (size, size), 'white')
draw = ImageDraw.Draw(im)
draw.ellipse((-size, -size, size, size),
fill='white', outline='black')
for _ in range(trial):
x = random.random()
y = random.random()
s = 4
color ... | 0 | 0 | 0 | 0 | 0 | 0 |
build-support/gen_version_info.py | attilabukor/kudu | 1,538 | 1750371 | #!/usr/bin/env python
#
# 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
# "... | 0 | 2 | 0 | 0 | 2 | 0 |
opensanctions/migrate/versions/c68189468263_initial.py | quantumchips/opensanctions | 102 | 1750374 | """initial
Revision ID: c68189468263
Revises:
Create Date: 2021-06-06 14:10:39.120187
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "c68189468263"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
tbl = "statement"
op.create... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | vpaul-dev/pycaption-github-release-notes | 183 | 1750379 | #!/usr/bin/env python
import os
from setuptools import setup, find_packages
README_PATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)),
'README.rst',
)
dependencies = [
'beautifulsoup4>=4.8.1,<4.10',
'lxml>=4.6.3,<4.7',
'cssutils>=2.0.0,<2.4',
]
setup(
name='pycaption',
versio... | 0 | 0 | 0 | 0 | 0 | 0 |
bentoml/yatai/locking/lock.py | niits/BentoML | 3,451 | 1750395 | <reponame>niits/BentoML
from contextlib import contextmanager
from bentoml.exceptions import LockUnavailable
import logging
import random
import time
from bentoml.yatai.db.stores.lock import LockStore, LOCK_STATUS
logger = logging.getLogger(__name__)
DEFAULT_TIMEOUT_SECONDS = 10
DEFAULT_TIMEOUT_JITTER_SECONDS = 1
D... | 0 | 0 | 0 | 0 | 0 | 0 |
src/ralph/assets/migrations/0017_processor.py | DoNnMyTh/ralph | 1,668 | 1750400 | <reponame>DoNnMyTh/ralph<gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('assets', '0016_fibrechannelcard'),
]
operations = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/dataset_configs.py | nnmhuy/flownet2-tf | 438 | 1750405 | <reponame>nnmhuy/flownet2-tf
"""
Add dataset configurations here. Each dataset must have the following structure:
NAME = {
IMAGE_HEIGHT: int,
IMAGE_WIDTH: int,
ITEMS_TO_DESCRIPTIONS: {
'image_a': 'A 3-channel image.',
'image_b': 'A 3-channel image.',
'flow': 'A 2-channel optical flo... | 0 | 0 | 0 | 0 | 0 | 0 |
notebook/math_exp_log.py | vhn0912/python-snippets | 174 | 1750415 | import math
print(math.e)
# 2.718281828459045
print(2**4)
# 16
print(pow(2, 4))
# 16
print(math.pow(2, 4))
# 16.0
print(pow(1 + 1j, 2))
# 2j
# print(math.pow(1 + 1j, 2))
# TypeError: can't convert complex to float
print(pow(2, 4, 5))
# 1
print(2**0.5)
# 1.4142135623730951
print(math.sqrt(2))
# 1.41421356237309... | 0 | 0 | 0 | 0 | 0 | 0 |
keanu-python/tests/test_gradient_optimization.py | rs992214/keanu | 153 | 1750433 | <filename>keanu-python/tests/test_gradient_optimization.py
import pytest
from py4j.protocol import Py4JJavaError
from examples import thermometers
from keanu import BayesNet, Model
from keanu.algorithm import GradientOptimizer, ConjugateGradient, Adam
@pytest.fixture
def model() -> Model:
model = thermometers.mo... | 0 | 0 | 0 | 0 | 0 | 0 |
sim/sim_new_nowave.py | DuBirdFly/TinyRISCV_Learn | 251 | 1750448 | import sys
import filecmp
import subprocess
import sys
import os
# 主函数
def main():
#print(sys.argv[0] + ' ' + sys.argv[1] + ' ' + sys.argv[2])
# 1.将bin文件转成mem文件
cmd = r'python ../tools/BinToMem_CLI.py' + ' ' + sys.argv[1] + ' ' + sys.argv[2]
f = os.popen(cmd)
f.close()
# 2.编译rtl文件
cmd = ... | 0 | 0 | 0 | 0 | 0 | 0 |
wechat_django/tests/test_admin_permission.py | UltraVacuum/wechat-django | 166 | 1750458 | # -*- coding: utf-8 -*-
from __future__ import annotations
from __future__ import unicode_literals
from uuid import uuid4 as uuid
from django.contrib.admin import site
from django.contrib.auth.models import ContentType, Permission, User
from django.urls import ResolverMatch
from ..models import permission as pm, WeC... | 3 | 1 | 0 | 0 | 4 | 0 |
OpenHowNet/version.py | yangalan123/OpenHowNet_python | 346 | 1750472 | VERSION = "test"
| 0 | 0 | 0 | 0 | 0 | 0 |
unyt/tests/test_unit_registry.py | mkhorton/unyt | 291 | 1750475 | <gh_stars>100-1000
"""
Test unit lookup tables and registry
"""
# -----------------------------------------------------------------------------
# Copyright (c) 2018, yt Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the LICENSE file, distributed with this ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/einsteinpy/plotting/__init__.py | Aditya7799/einsteinpy | 485 | 1750502 | <reponame>Aditya7799/einsteinpy<gh_stars>100-1000
from einsteinpy.plotting.fractal import fractal
from einsteinpy.plotting.geodesic.core import GeodesicPlotter
from einsteinpy.plotting.geodesic.interactive import InteractiveGeodesicPlotter
from einsteinpy.plotting.geodesic.static import StaticGeodesicPlotter
from einst... | 0 | 0 | 0 | 0 | 0 | 0 |
boto3_type_annotations/boto3_type_annotations/robomaker/paginator.py | cowboygneox/boto3_type_annotations | 119 | 1750591 | <reponame>cowboygneox/boto3_type_annotations
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class ListDeploymentJobs(Paginator):
def paginate(self, filters: List = None, PaginationConfig: Dict = None) -> Dict:
pass
class ListFleets(Paginator):
def paginate(se... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_pv2qdf.py | jamesmlane/galpy | 147 | 1750623 | # Tests of the quasiisothermaldf module
from __future__ import print_function, division
import numpy
#fiducial setup uses these
from galpy.potential import MWPotential, vcirc, omegac, epifreq, verticalfreq
from galpy.actionAngle import actionAngleAdiabatic, actionAngleStaeckel
from galpy.df import quasiisothermaldf
aAA... | 0 | 10 | 0 | 0 | 10 | 0 |
tests/oauth1/rfc5849/test_client.py | braedon/oauthlib | 954 | 1750627 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from oauthlib.common import Request
from oauthlib.oauth1 import (
SIGNATURE_HMAC_SHA1, SIGNATURE_HMAC_SHA256, SIGNATURE_PLAINTEXT,
SIGNATURE_RSA, SIGNATURE_TYPE_BODY, SIGNATURE_TYPE_QUERY,
)
from oauthlib.oauth1.rfc5849 import Client
from tests.unittest import TestCas... | 0 | 0 | 0 | 0 | 0 | 0 |
fbrp/examples/07_rosmsg/frun.py | ali-senguel/fairo | 669 | 1750633 | <reponame>ali-senguel/fairo<filename>fbrp/examples/07_rosmsg/frun.py
import fbrp
fbrp.process(
name="proc",
runtime=fbrp.Conda(
channels=[
"conda-forge",
"robostack",
],
dependencies=[
"python>=3.7",
"ros-common-msgs",
],
r... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/build_helper.py | Kashif-Nadeem/seafile-client | 387 | 1750659 | <filename>scripts/build_helper.py
#!/usr/bin/env python
import subprocess, sys, os
import re
from multiprocessing import cpu_count
num_cpus=cpu_count()
def get_dependencies_by_otool(path):
if path.endswith('.app') and os.path.isdir(path):
path = os.path.join(path, 'Contents', 'MacOS', os.path.basename(pat... | 0 | 0 | 0 | 0 | 0 | 0 |
regexp_examples/split_by_case.py | DazEB2/SimplePyScripts | 117 | 1750672 | <reponame>DazEB2/SimplePyScripts
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def split_by_case(text: str) -> list:
import re
return re.findall(r'[a-zA-Z][a-z]+', text)
if __name__ == '__main__':
print(split_by_case('fadeInLeft'))
print(split_by_case('CharSequence'))
p... | 0 | 0 | 0 | 0 | 0 | 0 |
scipy/_lib/tests/test_deprecation.py | Ennosigaeon/scipy | 9,095 | 1750700 | import pytest
def test_cython_api_deprecation():
match = ("`scipy._lib._test_deprecation_def.foo_deprecated` "
"is deprecated, use `foo` instead!\n"
"Deprecated in Scipy 42.0.0")
with pytest.warns(DeprecationWarning, match=match):
from .. import _test_deprecation_call
ass... | 0 | 0 | 0 | 0 | 0 | 0 |
openbook_communities/migrations/0022_auto_20190502_1804.py | TamaraAbells/okuna-api | 164 | 1750706 | <filename>openbook_communities/migrations/0022_auto_20190502_1804.py
# Generated by Django 2.2 on 2019-05-02 16:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_communities', '0021_auto_20190502_1754'),
]
operations = [
migra... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/host/test_ping.py | g-r-a-n-t/py-libp2p | 315 | 1750728 | import secrets
import pytest
import trio
from libp2p.host.ping import ID, PING_LENGTH
from libp2p.tools.factories import host_pair_factory
@pytest.mark.trio
async def test_ping_once(security_protocol):
async with host_pair_factory(security_protocol=security_protocol) as (
host_a,
host_b,
):
... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/urllib3/packages/rfc3986/builder.py | iilness2/bash-lambda-layer-custom | 1,894 | 1750739 | <reponame>iilness2/bash-lambda-layer-custom<filename>bin/urllib3/packages/rfc3986/builder.py
# -*- coding: utf-8 -*-
# Copyright (c) 2017 <NAME>
# 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
... | 0 | 0 | 0 | 0 | 0 | 0 |
neurolib/utils/saver.py | Ronjaa95/neurolib | 258 | 1750809 | """
Saving model output.
"""
import json
import pickle
from copy import deepcopy
import os
import numpy as np
import xarray as xr
def save_to_pickle(datafield, filename):
"""
Save datafield to pickle file. Keep in mind that restoring a pickle
requires that the internal structure of the types for the pi... | 0 | 2 | 0 | 0 | 2 | 0 |
test/pytest.py | Elainehxx/python.js | 214 | 1750863 |
def test_01(value):
print value
return value * 2
def test_02(value):
print value
return value * 1.5
def test_03(value):
print value
return value + ', hello python'
def test_04(value):
print value
return not value
def test_05(value):
print value
if value is None:
return None
else:
raise Exception()
... | 0 | 0 | 0 | 0 | 0 | 0 |
faketests/animals/test_one_failing_test.py | Djailla/pytest-sugar | 418 | 1750868 | import pytest
def test_dog1():
assert True
def test_dog2():
assert True
def test_dog3():
assert True
def test_dog4():
assert True
def test_dog5_failing():
assert False
def test_dog6():
assert True
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_utils.py | maxthemillion/timeseers | 233 | 1750874 | <reponame>maxthemillion/timeseers
import numpy as np
from hypothesis import given
from hypothesis import strategies as st
from hypothesis.extra.numpy import arrays, array_shapes
from hypothesis.extra.pandas import data_frames, column, series, range_indexes
from timeseers.utils import MinMaxScaler
@given(
arrays(... | 0 | 0 | 0 | 0 | 0 | 0 |
qualcoder/save_sql_query.py | ilippert/QualCoder | 150 | 1750890 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
Copyright (c) 2021 <NAME>
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 restriction, including without limitation the righ... | 1 | 0 | 3 | 0 | 4 | 0 |
pulumi/infra/nomad_job.py | insanitybit/grapl | 313 | 1750902 | <gh_stars>100-1000
import json
from pathlib import Path
from typing import Any, Mapping, Optional, Union, cast, get_args
import pulumi_nomad as nomad
from infra.config import STACK_NAME
from infra.nomad_service_postgres import NomadServicePostgresDbArgs
import pulumi
_ValidNomadVarTypePrimitives = Union[str, bool, i... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/ptvsd/server/test_vs_specific.py | int19h/ptvsd | 349 | 1750945 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import pytest
from tests import debug
from tests.patterns import some
from tests.... | 0 | 0 | 0 | 0 | 0 | 0 |
toollib/tcli/option.py | atpuxiner/toollib | 113 | 1751037 | """
@author axiner
@version v1.0.0
@created 2022/2/27 11:20
@abstract
@description
@history
"""
import typing as t
from toollib.validator import Attr
class Arg:
def __init__(self,
*name_or_flags: str,
action: str = None,
nargs: t.Union[int, str] = None,
... | 13 | 2 | 3 | 0 | 18 | 0 |
all/approximation/feature_network_test.py | drozzy/autonomous-learning-library | 584 | 1751048 | import unittest
import torch
from torch import nn
import torch_testing as tt
from all.core import State
from all.approximation.feature_network import FeatureNetwork
STATE_DIM = 2
class TestFeatureNetwork(unittest.TestCase):
def setUp(self):
torch.manual_seed(2)
self.model = nn.Sequential(nn.Linea... | 0 | 0 | 0 | 0 | 0 | 0 |
dirty_cat/test/test_target_encoder.py | dirty-cat/categorical-encoding | 374 | 1751055 | import numpy as np
import pytest
from dirty_cat import target_encoder
def test_target_encoder():
lambda_ = target_encoder.lambda_
X1 = np.array(['Red',
'red',
'green',
'blue',
'green',
'green',
'... | 0 | 2 | 0 | 0 | 2 | 0 |
src/fonduer/utils/visualizer.py | annelhote/fonduer | 379 | 1751057 | """Fonduer visualizer."""
import logging
import os
import subprocess
import warnings
from builtins import object
from collections import defaultdict
from typing import DefaultDict, List, Optional, Tuple
from bs4 import BeautifulSoup
from IPython.display import DisplayHandle, display
from wand.color import Color
from w... | 15 | 7 | 2 | 0 | 24 | 0 |
tests/fail/runtest.py | v8786339/NyuziProcessor | 1,388 | 1751063 | #!/usr/bin/env python3
#
# Copyright 2011-2015 <NAME>
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
aioprocessing/connection.py | davesteele/aioprocessing | 517 | 1751064 | from concurrent.futures import ThreadPoolExecutor
from .mp import connection as _connection
from .executor import CoroBuilder
from .util import run_in_executor
__all__ = ["AioConnection"]
class AioConnection(metaclass=CoroBuilder):
coroutines: list[str] = [
"recv",
"poll",
"send_bytes",
... | 0 | 7 | 2 | 0 | 9 | 0 |
tests/test.simbody.py | XCaellaX/osim-rl | 867 | 1751090 | <gh_stars>100-1000
from osim.env import ProstheticsEnv
import numpy as np
import unittest
class SimulationTest(unittest.TestCase):
def test1(self):
env = ProstheticsEnv(visualize=True)
observation = env.reset()
simbody_state = env.osim_model.get_state()
print(simbody_state... | 0 | 0 | 0 | 0 | 0 | 0 |
src/backend/common/queries/dict_converters/award_converter.py | bovlb/the-blue-alliance | 266 | 1751119 | import json
from typing import Dict, List, NewType
from google.appengine.ext import ndb
from backend.common.consts.api_version import ApiMajorVersion
from backend.common.models.award import Award
from backend.common.models.event import Event
from backend.common.models.team import Team
from backend.common.queries.dict... | 6 | 4 | 1 | 0 | 11 | 0 |
pypyr/context.py | Reskov/pypyr | 261 | 1751160 | <gh_stars>100-1000
"""pypyr context class. Dictionary ahoy."""
from collections import namedtuple
from collections.abc import Mapping, Set
from pypyr.dsl import SpecialTagDirective
from pypyr.errors import KeyInContextHasNoValueError, KeyNotInContextError
from pypyr.formatting import RecursiveFormatter
from pypyr.modu... | 0 | 0 | 0 | 0 | 0 | 0 |
python/examples/reverse_crc32_algo_poc.py | justinforbes/depthcharge | 133 | 1751174 | #!/usr/bin/env python3
#
# This simple proof-of-concept example demonstrates the underlying "Reverse CRC32"
# approach used by depthcharge.hunter.ReverseCRC32Hunter to produce depthcharge.Stratagem
# objects, which in turn are used by depthcharge.memory.CRC32MemoryWriter.
#
# In order to provide a readily accessible ex... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_callables.py | connorjward/loopy | 436 | 1751208 | <reponame>connorjward/loopy
__copyright__ = "Copyright (C) 2018 <NAME>"
__license__ = """
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 restriction, including without limitation the righ... | 0 | 0 | 0 | 0 | 0 | 0 |
djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/openid/migrations/0001_initial.py | DemarcusL/django_wiki_lab | 6,342 | 1751220 | <reponame>DemarcusL/django_wiki_lab
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = []
operations = [
migrations.CreateModel(
name="OpenIDNonce",
fields=[
... | 0 | 0 | 0 | 0 | 0 | 0 |
gui/util/cron.py | ednt/dsiprouter | 130 | 1751231 | <filename>gui/util/cron.py
from crontab import CronTab, CronSlices
from cron_descriptor import ExpressionDescriptor
# TODO: we should propagate exceptions from here so we can
# better handle them at the API level
def getTaggedCronjob(tag):
"""
Get a cronjob from current user's crontab by its tag
:p... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577015_Parse_HTTP_datetime_string/recipe-577015.py | tdiprima/code | 2,023 | 1751258 | <reponame>tdiprima/code
from datetime import datetime
from email.utils import parsedate
def _parse_http_datetime(s):
return datetime(*parsedate(s)[:6])
| 0 | 0 | 0 | 0 | 0 | 0 |
internals/__init__.py | brandon-leapyear/SublimeHaskell | 452 | 1751275 | # Empty __init__.py for pylint
| 0 | 0 | 0 | 0 | 0 | 0 |
atlas/make_config.py | CedricMidoux/atlas | 204 | 1751279 | <reponame>CedricMidoux/atlas
import logging
logger = logging.getLogger(__file__)
import multiprocessing
import os
import sys
import tempfile
from snakemake.io import load_configfile
from snakemake.utils import update_config as snakemake_update_config
from .default_values import *
def make_default_config():
"""g... | 0 | 0 | 0 | 0 | 0 | 0 |
bitcoinetl/btc_utils.py | BTCGPU/bitcoin-etl | 274 | 1751355 | import math
from decimal import Decimal
def bitcoin_to_satoshi(bitcoin_value) -> object:
if bitcoin_value is None:
return bitcoin_value
if isinstance(bitcoin_value, Decimal):
return int(bitcoin_value * (Decimal(10) ** 8).to_integral_value())
else:
return int(bitcoin_value * math.p... | 0 | 1 | 0 | 0 | 1 | 0 |
Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/zmumudistribution_cfg.py | ckamtsikis/cmssw | 852 | 1751375 | <reponame>ckamtsikis/cmssw<filename>Alignment/MillePedeAlignmentAlgorithm/test/ZMuMuMassConstraintParameterFinder/zmumudistribution_cfg.py
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing
options = VarParsing ("analysis")
options.parseArguments()
process = cms.Process("ZM... | 0 | 0 | 0 | 0 | 0 | 0 |
vn.datayes/errors.py | BigMouseLHY/vnpy_vm | 101 | 1751381 | <gh_stars>100-1000
class VNPAST_ConfigError(Exception):
"""
Config file error, raised when config.json or python object
is broken or invalid.
"""
pass
class VNPAST_RequestError(Exception):
"""
HTTP Request Error, raised when response is not properly gotten:
* GET response.status code != 200.
* ... | 0 | 0 | 0 | 0 | 0 | 0 |
pkg/codegen/internal/test/testdata/aws-secret-pp/python/aws-secret.py | pcen/pulumi | 12,004 | 1751391 | import pulumi
import pulumi_aws as aws
db_cluster = aws.rds.Cluster("dbCluster", master_password=pulumi.secret("<PASSWORD>"))
| 0 | 0 | 0 | 0 | 0 | 0 |
pysmi/reader/zipreader.py | itsmehara/pysmi | 121 | 1751395 | <reponame>itsmehara/pysmi<gh_stars>100-1000
#
# This file is part of pysmi software.
#
# Copyright (c) 2015-2020, <NAME> <<EMAIL>>
# License: http://snmplabs.com/pysmi/license.html
#
import os
import sys
import time
import datetime
import zipfile
from pysmi.reader.base import AbstractReader
from pysmi.mibinfo import Mi... | 0 | 0 | 0 | 0 | 0 | 0 |
api_tests/share/test_share_node.py | gaybro8777/osf.io | 628 | 1751409 | <gh_stars>100-1000
import json
import pytest
import responses
from unittest.mock import patch
from api.share.utils import serialize_registration
from osf.models import CollectionSubmission, SpamStatus
from osf_tests.factories import (
AuthUserFactory,
IdentifierFactory,
NodeFactory,
ProjectFactory,
... | 0 | 0 | 0 | 0 | 0 | 0 |
rllib/examples/env/utils/mixins.py | mgelbart/ray | 21,382 | 1751429 | ##########
# Contribution by the Center on Long-Term Risk:
# https://github.com/longtermrisk/marltoolbox
##########
from abc import ABC
from ray.rllib.examples.env.utils.interfaces import InfoAccumulationInterface
class TwoPlayersTwoActionsInfoMixin(InfoAccumulationInterface, ABC):
"""
Mixin class to add log... | 0 | 2 | 0 | 0 | 2 | 0 |
log.py | hemant224/transperf | 144 | 1751433 | # Copyright 2019 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 0 |
halyard-deploy/src/main/resources/services/vault/client/startup/mount-config.py | jmalvarezf-lmes/halyard | 307 | 1751482 | #!/usr/bin/env python
import argparse
import base64
import json
import logging
import subprocess
import os
import grp
import pwd
import time
def mkdirs(path):
subprocess.check_call(["mkdir", "-p", path])
def subprocess_retry(supplier, retries, process_cmd) -> object:
if retries < 0:
logging.fatal("A... | 0 | 2 | 0 | 0 | 2 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.