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 |
|---|---|---|---|---|
litex/soc/cores/cpu/femtorv/__init__.py | osterwood/litex | 1,501 | 12715289 | <filename>litex/soc/cores/cpu/femtorv/__init__.py<gh_stars>1000+
from litex.soc.cores.cpu.femtorv.core import FemtoRV
|
device/ESP8266_NodeMcu_Slave/tools/mkfs.py | zhang49/All | 205 | 12715307 | #!/usr/bin/env python3
#
import sys
import struct
import math
import time
import argparse
import os
import subprocess
import zlib
import gzip
class MKFS:
def __init__(self, src, dest):
self._src = src
self._dest = dest
self._fileCount = 0
self.data=bytearray()
self.offset=0
def output_writeln(self,li... |
airbyte-integrations/bases/source-acceptance-test/unit_tests/test_asserts.py | OTRI-Unipd/OTRI-airbyte | 6,215 | 12715313 | <gh_stars>1000+
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import pytest
from airbyte_cdk.models import (
AirbyteRecordMessage,
AirbyteStream,
ConfiguredAirbyteCatalog,
ConfiguredAirbyteStream,
DestinationSyncMode,
SyncMode,
)
from source_acceptance_test.utils.asserts import v... |
validation_tests/analytical_exact/runup_on_beach/produce_results.py | samcom12/anuga_core | 136 | 12715320 | <gh_stars>100-1000
import anuga
from anuga.validation_utilities import produce_report
args = anuga.get_args()
produce_report('numerical_runup.py', args=args)
|
tests/unit/tensorflow/modules/test_sequential.py | chiragnagpal/probflow | 134 | 12715330 | import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from probflow.modules import Dense, Sequential
from probflow.parameters import Parameter
from probflow.utils.settings import Sampling
tfd = tfp.distributions
def is_close(a, b, tol=1e-3):
return np.abs(a - b) < tol
def test_Sequen... |
src/robusta/integrations/receiver.py | robusta-dev/robusta | 273 | 12715356 | <filename>src/robusta/integrations/receiver.py
import base64
import hashlib
import hmac
import logging
import time
from typing import Optional, Dict, Any
from uuid import UUID
import websocket
import json
import os
from threading import Thread
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.p... |
addons/s3/tests/utils.py | gaybro8777/osf.io | 628 | 12715395 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from addons.base.tests.base import OAuthAddonTestCaseMixin, AddonTestCase
from addons.s3.tests.factories import S3AccountFactory
from addons.s3.provider import S3Provider
from addons.s3.serializer import S3Serializer
class S3AddonTestCase(OAuthAddonTestCaseMixin, AddonTestCas... |
admin/preprints/forms.py | gaybro8777/osf.io | 628 | 12715396 | from django import forms
from osf.models import Preprint
class ChangeProviderForm(forms.ModelForm):
class Meta:
model = Preprint
fields = ('provider',)
|
corehq/apps/hqadmin/tests/test_corrupt_couch.py | dimagilg/commcare-hq | 471 | 12715437 | from testil import eq
from ..corrupt_couch import find_missing_ids
def test_find_missing_ids():
def test(result_sets, expected_missing, expected_tries, min_tries=5):
def get_ids():
while len(results) > 1:
return results.pop()
return results[0]
results = li... |
onir/bin/eval.py | tgeral68/OpenNIR | 140 | 12715457 | <filename>onir/bin/eval.py
import os
os.environ['ONIR_IGNORE_ARGV'] = 'true'
import json
import argparse
from onir import metrics
def main():
parser = argparse.ArgumentParser()
parser.add_argument('qrels')
parser.add_argument('run')
parser.add_argument('--each_topic', '-q', action='store_true')
pa... |
forge/ethyr/torch/optim.py | wwxFromTju/neural-mmo | 1,450 | 12715469 | <filename>forge/ethyr/torch/optim.py
import numpy as np
import torch
from torch import optim
from torch.autograd import Variable
from pdb import set_trace as T
from forge.ethyr import rollouts
from forge.ethyr.torch import loss
from forge.ethyr.torch import param
class ManualAdam(optim.Adam):
def step(self, grads)... |
quarkchain/experimental/pbft.py | QuarkChain/pyquarkchain | 237 | 12715481 | <gh_stars>100-1000
import asyncio
import hashlib
from event_driven_simulator import Connection
RPC_TIMEOUT_MS = 100
class ClientRequest:
def __init__(self, data):
self.data = data
def digest(self):
m = hashlib.sha256()
m.update(self.data)
return m.digest()
class PrePrepare... |
tests/unit/butterfree/hooks/schema_compatibility/test_cassandra_table_schema_compatibility_hook.py | fossabot/butterfree | 208 | 12715514 | from unittest.mock import MagicMock
import pytest
from butterfree.clients import CassandraClient
from butterfree.hooks.schema_compatibility import CassandraTableSchemaCompatibilityHook
class TestCassandraTableSchemaCompatibilityHook:
def test_run_compatible_schema(self, spark_session):
cassandra_client ... |
tests/tools/protocol/requests/test_offset_fetch_v1.py | akashvacher/kafka-tools | 578 | 12715518 | <reponame>akashvacher/kafka-tools<gh_stars>100-1000
import unittest
from kafka.tools.protocol.requests import ArgumentError
from kafka.tools.protocol.requests.offset_fetch_v2 import OffsetFetchV2Request
class OffsetFetchV2RequestTests(unittest.TestCase):
def test_process_arguments(self):
val = OffsetFetc... |
PyFin/Math/Timeseries/__init__.py | rpatil524/Finance-Python | 325 | 12715520 | # -*- coding: utf-8 -*-
u"""
Created on 2015-8-8
@author: cheng.li
"""
__all__ = ['Timeseries',
'Normalizer']
from PyFin.Math.Timeseries.Timeseries import Timeseries
from PyFin.Math.Timeseries.Normalizers import Normalizer
|
__scraping__/fileinfo.com/main.py | whitmans-max/python-examples | 140 | 12715552 | #!/usr/bin/env python3
# date: 2020.04.19
# https://stackoverflow.com/questions/61298422/extracting-specific-elements-in-a-table-with-selenium-in-python/
import selenium.webdriver
driver = selenium.webdriver.Firefox()
# --- video ---
url = 'https://fileinfo.com/filetypes/video'
driver.get(url)
all_items =... |
tests/core/meta/meta.py | akmaru/veriloggen | 232 | 12715587 | <reponame>akmaru/veriloggen
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
from veriloggen import *
# ... |
test/Clean/mkfifo.py | moroten/scons | 1,403 | 12715624 | <reponame>moroten/scons
#!/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, ... |
challenge_4/python/tvanderwal/src/challenge_4.py | rchicoli/2017-challenges | 271 | 12715664 | #Challenge 4: Take a binary tree and reverse it
#I decided to create two classes. One to hold the node, and one to act as the Binary Tree.
#Node class
#Only contains the information for the node. Val is the value of the node, left is the left most value, and right is the right value
class Node:
def __init__(self, ... |
tests/pnr/test_hpwl.py | pretl/ALIGN-public | 119 | 12715670 | <gh_stars>100-1000
import json
import pathlib
from align.pnr.hpwl import gen_netlist, calculate_HPWL_from_placement_verilog_d, Interval, SemiPerimeter
from align.pnr.render_placement import standalone_overlap_checker
def test_interval():
i = Interval()
i.add( 7)
assert 0 == i.dist()
i.add( 3)
a... |
boto3_type_annotations_with_docs/boto3_type_annotations/cloudformation/waiter.py | cowboygneox/boto3_type_annotations | 119 | 12715718 | <gh_stars>100-1000
from typing import Dict
from botocore.waiter import Waiter
class ChangeSetCreateComplete(Waiter):
def wait(self, ChangeSetName: str, StackName: str = None, NextToken: str = None, WaiterConfig: Dict = None):
"""
Polls :py:meth:`CloudFormation.Client.describe_change_set` every 30 ... |
xv_leak_tools/test_components/cleanup/cleanup.py | UAEKondaya1/expressvpn_leak_testing | 219 | 12715730 | from abc import ABCMeta, abstractmethod
from xv_leak_tools.test_components.component import Component
class Cleanup(Component, metaclass=ABCMeta):
@abstractmethod
def cleanup(self):
pass
|
aiogram/types/invoice.py | andrew-ld/aiogram | 2,744 | 12715744 | from . import base
from . import fields
class Invoice(base.TelegramObject):
"""
This object contains basic information about an invoice.
https://core.telegram.org/bots/api#invoice
"""
title: base.String = fields.Field()
description: base.String = fields.Field()
start_parameter: base.Strin... |
tests/test_network/test_net_6.py | amih90/bacpypes | 240 | 12715765 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test Network Number Discovery
-----------------------------
"""
import unittest
from bacpypes.debugging import bacpypes_debugging, ModuleLogger, btox, xtob
from bacpypes.core import deferred
from bacpypes.comm import Client, Server, bind
from bacpypes.pdu import PDU... |
DQM/SiStripMonitorPedestals/python/SiStripMonitorRawData_cfi.py | ckamtsikis/cmssw | 852 | 12715773 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
RawDataMon = DQMEDAnalyzer('SiStripMonitorRawData',
OutputMEsInRootFile = cms.bool(False),
DigiProducer = cms.string('siStripDigis'),
OutputFileName = cms.string('SiStripRawData.root')
)
|
api/curve/v1/models/__init__.py | QiliangFan/Baidu-Curve | 478 | 12715795 | # -*- coding: utf-8 -*-
"""
Models
~~~~
:copyright: (c) 2017-2018 by Baidu, Inc.
:license: Apache, see LICENSE for more details.
"""
from .data_abstract import DataAbstract
from .raw import Raw
from .point import Point
from .thumb import Thumb
from .band_item import BandItem
from .user import User
|
demos/cta_step_by_step/04_DataKit.py | NoTravel/wtpy | 164 | 12715803 | <gh_stars>100-1000
# 1、配置04_DataKit/config.ini
# 2、python 04_DataKit.py
# 3、程序自动生成Common/commodities.json Common/contracts.json
# 4、请注意simnow只能在开盘时间运行
# todo: statemonitor.json 硬编码无法移到配置文件目录中,等群主发功
# todo: 不支持 code:"CFFEX.T.HOT"或 code:"CFFEX.T",等群主发功
from wtpy import WtDtEngine
if __name__ == "__main__":
#创建一个运... |
models/image_models_test.py | google-research/pathdreamer | 115 | 12715890 | <reponame>google-research/pathdreamer
# Copyright 2021 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... |
script-get_fees.py | dthevenin/pycryptobot | 1,447 | 12715917 | <filename>script-get_fees.py
from models.PyCryptoBot import PyCryptoBot
from models.exchange.binance import AuthAPI as BAuthAPI
from models.exchange.coinbase_pro import AuthAPI as CAuthAPI
# Coinbase Pro fees
app = PyCryptoBot(exchange='coinbasepro')
api = CAuthAPI(app.getAPIKey(), app.getAPISecret(), app.getAPIPassph... |
pycls/core/builders.py | KelvinYang0320/nas-without-training | 385 | 12715998 | <filename>pycls/core/builders.py<gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Model and loss construction functions."""
import torch
from pyc... |
src/notifier/script_notifier.py | Umiiii/chiadog | 503 | 12715999 | # std
import logging
import os
import subprocess
from typing import List
# project
from . import Notifier, Event
class ScriptNotifier(Notifier):
def __init__(self, title_prefix: str, config: dict):
logging.info("Initializing script notifier.")
super().__init__(title_prefix, config)
try:
... |
tests/utils.py | PSSF23/graspologic | 148 | 12716017 | # Copyright (c) Microsoft Corporation and contributors.
# Licensed under the MIT License.
import os
def data_file(filename):
return os.path.join(os.path.dirname(__file__), "test_data", filename)
|
src/garage/sampler/__init__.py | blacksph3re/garage | 1,500 | 12716048 | """Samplers which run agents in environments."""
# yapf: disable
from garage.sampler._dtypes import InProgressEpisode
from garage.sampler._functions import _apply_env_update
from garage.sampler.default_worker import DefaultWorker
from garage.sampler.env_update import (EnvUpdate,
E... |
lib/hachoir/core/language.py | 0x20Man/Watcher3 | 320 | 12716086 | <filename>lib/hachoir/core/language.py
import functools
from hachoir.core.iso639 import ISO639_2
@functools.total_ordering
class Language:
def __init__(self, code):
code = str(code)
if code not in ISO639_2:
raise ValueError("Invalid language code: %r" % code)
self.code = code
... |
tests/pyunit/util/pyunit_convert_check.py | hyu-iot/gem5 | 765 | 12716103 | <filename>tests/pyunit/util/pyunit_convert_check.py
#!/usr/bin/env python3
#
# Copyright (c) 2021 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intelle... |
cooka/common/util.py | DataCanvasIO/Cooka | 222 | 12716156 | <filename>cooka/common/util.py
import datetime
import time
import six
from uuid import uuid4
import json
from json import JSONEncoder
import math
import re
from cooka.common import consts
from os import path as P
MAX_BUFFER_SIZE = 1024
UUID_CHARS = ("a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k",... |
plugins/dbnd-docker/setup.py | busunkim96/dbnd | 224 | 12716169 | from os import path
import setuptools
from setuptools.config import read_configuration
BASE_PATH = path.dirname(__file__)
CFG_PATH = path.join(BASE_PATH, "setup.cfg")
config = read_configuration(CFG_PATH)
version = config["metadata"]["version"]
setuptools.setup(
name="dbnd-docker",
package_dir={"": "src"}... |
uq360/utils/batch_features/batch_basic_pointwise_hist.py | Sclare87/UQ360 | 148 | 12716216 |
import numpy as np
from uq360.utils.batch_features.histogram_feature import SingleHistogramFeature
from uq360.utils.transformers.confidence_delta import ConfidenceDeltaTransformer
from uq360.utils.transformers.confidence_top import ConfidenceTopTransformer
from uq360.utils.transformers.confidence_entropy import Confi... |
tests/common/test_meter.py | dk25021999/mmf | 3,252 | 12716243 | # Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import torch
from mmf.common.meter import Meter
from mmf.common.report import Report
from mmf.common.sample import SampleList
class TestMeter(unittest.TestCase):
def test_meter_update_from_report(self):
meter = Meter()
prepared_ba... |
notifications/tests/sample_notifications/apps.py | pandafy/django-notifications | 1,354 | 12716259 | from notifications.apps import Config as NotificationConfig
class SampleNotificationsConfig(NotificationConfig):
name = 'notifications.tests.sample_notifications'
label = 'sample_notifications'
|
timemachines/skaters/rvr/rvrinclusion.py | iklasky/timemachines | 253 | 12716274 | <filename>timemachines/skaters/rvr/rvrinclusion.py
try:
import river
using_river = True
except ImportError:
using_river = False |
bonobo/util/collections.py | Playfloor/bonobo | 1,573 | 12716291 | <filename>bonobo/util/collections.py
import bisect
import functools
from collections import Sequence
class sortedlist(list):
"""
A list with an insort() method that wan be used to maintain sorted lists. The list by itself is not sorted, it's
up to the user to not insert unsorted elements.
"""
def... |
src/vanguards/pathverify.py | mikeperry-tor/vanguards | 132 | 12716294 | """ Simple checks against bandwidth side channels """
import stem
from . import control
from .logger import plog
_ROUTELEN_FOR_PURPOSE = {
"HS_VANGUARDS" : 4,
"HS_CLIENT_HSDIR" : 5,
"HS_CLIENT_INTRO" : 5,
"HS_CL... |
structures/UserIdentity.py | houey/SkyWrapper | 106 | 12716301 | from parsers import UserIdentityParser
# User identity properties
USER_IDENTITY_TYPE = "type"
USER_IDENTITY_PRINCIPAL_ID = "principalid"
USER_IDENTITY_ARN = "arn"
USER_IDENTITY_ACCOUNT_ID = "accountid"
USER_IDENTITY_INVOKED_BY = "invokedby"
USER_IDENTITY_ACCESS_KEY_ID = "accesskeyid"
USER_IDENTITY_USERNAME = "username... |
lib/galaxy_test/selenium/test_history_panel_pagination.py | quacksawbones/galaxy-1 | 1,085 | 12716302 | import pytest
from galaxy_test.base.populators import flakey
from .framework import (
selenium_test,
SeleniumTestCase
)
class HistoryPanelPaginationTestCase(SeleniumTestCase):
ensure_registered = True
@selenium_test
@flakey # The next button doesn't always work - maybe a delay in JS callback r... |
dfirtrack_api/tests/dfirtrack_artifacts/artifactstatus/test_artifactstatus_api_views.py | thomas-kropeit/dfirtrack | 273 | 12716306 | import urllib.parse
from django.contrib.auth.models import User
from django.test import TestCase
from dfirtrack_artifacts.models import Artifactstatus
class ArtifactstatusAPIViewTestCase(TestCase):
"""artifactstatus API view tests"""
@classmethod
def setUpTestData(cls):
# create object
... |
PyObjCTest/test_nsconnection.py | Khan/pyobjc-framework-Cocoa | 132 | 12716411 | from PyObjCTools.TestSupport import *
from Foundation import *
try:
unicode
except NameError:
unicode = str
class TestNSConnectionHelper (NSObject):
def makeNewConnection_sender_(self, a, b): return 1
def connection_shouldMakeNewConnection_(self, a, b): return 1
def authenticateComponents_withDat... |
nnef_tools/conversion/nnef_to_tflite.py | KhronosGroup/NNEF-Tools | 193 | 12716424 | <gh_stars>100-1000
# Copyright (c) 2020 The Khronos Group 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 applic... |
vul/4-thinkphp-getshell.py | zx273983653/vulscan | 582 | 12716448 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2015 pocsuite developers (http://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
#命令行
from pocsuite import pocsuite_cli
#验证模块
from pocsuite import pocsuite_verify
#攻击模块
from pocsuite import pocsuite_attack
#控制台模式
from pocsuite impo... |
experiments/arima_prophet_adapter/src/evaluation.py | Nixtla/statsforecast | 483 | 12716463 | from itertools import product
import numpy as np
import pandas as pd
from neuralforecast.losses.numpy import mape, rmse, smape, mae, mase
from neuralforecast.data.datasets.m4 import M4Evaluation, M4Info
from src.data import get_data, dict_datasets
def evaluate(lib: str, dataset: str, group: str):
try:
f... |
waveform_analysis/tests/test_ABC_weighting.py | pirun/waveform_analysis | 125 | 12716464 | import pytest
from scipy import signal
from scipy.interpolate import interp1d
import numpy as np
from numpy import pi
# This package must first be installed with `pip install -e .` or similar
from waveform_analysis import ABC_weighting, A_weighting, A_weight
# It will plot things for sanity-checking if MPL is install... |
GUI/maidfiddler/util/logger.py | mix5003/COM3D2.MaidFiddler | 121 | 12716477 | <reponame>mix5003/COM3D2.MaidFiddler
import logging
from maidfiddler.util.util import BASE_DIR
import os.path
logger = logging.getLogger("MaidFiddler")
def setup_logger():
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s [%(levelname)s] : %(message)s')
conoutCh = logging.StreamH... |
pybamm/input/parameters/lithium_ion/positive_electrodes/LiNiCoO2_Ecker2015/nco_ocp_Ecker2015_function.py | manjunathnilugal/PyBaMM | 330 | 12716507 | from pybamm import tanh
def nco_ocp_Ecker2015_function(sto):
"""
NCO OCP as a function of stochiometry [1, 2, 3].
References
----------
.. [1] <NAME>, et al. "Parameterization of a physico-chemical model of
a lithium-ion battery i. determination of parameters." Journal of the
Electrochemi... |
tekore/_model/paging.py | Allerter/tekore | 135 | 12716515 | <filename>tekore/_model/paging.py
from typing import Sequence
from dataclasses import dataclass
from .serialise import Model
@dataclass(repr=False)
class Paging(Model):
"""Paging base."""
href: str
items: Sequence[Model]
limit: int
next: str
@dataclass(repr=False)
class OffsetPaging(Paging):
... |
tests/test_multitrack.py | p42ul/medleydb | 125 | 12716523 | import unittest
import os
import yaml
from medleydb import multitrack
from medleydb import AUDIO_PATH
from medleydb import MIXING_COEFFICIENTS
class TestMultitrack(unittest.TestCase):
def setUp(self):
self.mtrack = multitrack.MultiTrack("NightPanther_Fire")
self.mtrack2 = multitrack.MultiTrack("Ph... |
projects/manipulathor_baselines/armpointnav_baselines/models/base_models.py | brandontrabucco/allenact | 187 | 12716528 | <filename>projects/manipulathor_baselines/armpointnav_baselines/models/base_models.py
import torch
import torch.nn as nn
class LinearActorHeadNoCategory(nn.Module):
def __init__(self, num_inputs: int, num_outputs: int):
super().__init__()
self.linear = nn.Linear(num_inputs, num_outputs)
n... |
vumi/tests/test_sentry.py | seidu626/vumi | 199 | 12716536 | """Tests for vumi.sentry."""
import logging
import base64
import json
import sys
import traceback
from twisted.internet.defer import inlineCallbacks, Deferred
from twisted.web import http
from twisted.python.failure import Failure
from twisted.python.log import LogPublisher
from vumi.tests.utils import MockHttpServe... |
mmhuman3d/data/data_converters/amass.py | ykk648/mmhuman3d | 472 | 12716545 | <gh_stars>100-1000
import glob
import os
import numpy as np
from tqdm import tqdm
from mmhuman3d.data.data_structures.human_data import HumanData
from .base_converter import BaseConverter
from .builder import DATA_CONVERTERS
all_sequences = [
'ACCAD',
'BioMotionLab_NTroje',
'CMU',
'EKUT',
'Eyes_J... |
config.py | masonsxu/red-flask | 161 | 12716546 | <reponame>masonsxu/red-flask<gh_stars>100-1000
# -*- coding: utf-8 -*-
# @ Time : 2020/9/8 14:56
# @ Author : Redtree
# @ File : config.py
# @ Desc :
VERSION = 'V0.1'
'''
database_setting
'''
DIALCT = "mysql"
DRIVER = "pymysql"
USERNAME = "mysql-username"
PASSWORD = "<PASSWORD>"
HOST = "数据库连接地址"
PORT = "数据库服务端口... |
AutotestWebD/apps/littletool/views/tool.py | yangjourney/sosotest | 422 | 12716561 | <reponame>yangjourney/sosotest<filename>AutotestWebD/apps/littletool/views/tool.py
from django.shortcuts import render,HttpResponse
def jsoncn(request):
print(str(request))
context = {"jsonstr":request.GET.get("json","")}
return render(request, "littletool/jsoncn.html", context)
|
back/restapi/apps.py | ramonakira/piclodio3 | 120 | 12716587 | import sys
from django.apps import AppConfig
from utils.scheduler_manager import SchedulerManager
class RestapiConfig(AppConfig):
name = 'restapi'
def __init__(self, app_name, app_module):
super().__init__(app_name, app_module)
def ready(self):
argv = sys.argv
print(argv)
... |
cgt/tests/test_examples.py | rohanraja/cgt_distributed | 698 | 12716589 | <reponame>rohanraja/cgt_distributed<gh_stars>100-1000
import subprocess, os.path as osp
from nose.plugins.skip import SkipTest
thisdir = osp.dirname(__file__)
def run_example(cmd, filedepends=None):
if filedepends and not osp.exists(filedepends):
raise SkipTest(cmd)
else:
subprocess.check_call... |
etcmodel/layers/attention_test.py | deepneuralmachine/google-research | 23,901 | 12716616 | # coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
features/steps/data-table.py | eaton-lab/toyplot | 438 | 12716629 | <filename>features/steps/data-table.py
# Copyright 2014, Sandia Corporation. Under the terms of Contract
# DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain
# rights in this software.
from behave import *
import nose.tools
import numpy.testing
import collections
import io
import numpy
imp... |
pydoro/pydoro_core/sound.py | Liupold/pydoro | 403 | 12716633 | """
This file was copied from
https://github.com/TaylorSMarks/playsound
playsound.py - For playing audio file, Copyright (c) 2016 <NAME>
MIT License
----
I've added async play for linux using a thread, changed names to be more pythonic
I've also added a thin wrapper around pygame as well
"""
from platform import syste... |
fastreid/layers/activation.py | tenghehan/reid_without_id | 2,194 | 12716719 | # encoding: utf-8
"""
@author: <NAME>
@contact: <EMAIL>
"""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = [
'Mish',
'Swish',
'MemoryEfficientSwish',
'GELU']
class Mish(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x... |
test_network_tensorflow.py | lFatality/tensorflow2caffe | 115 | 12716732 | <gh_stars>100-1000
import numpy as np
import cv2
from model import vgg_net_19, vgg_net_19_activations
MODEL_SAVE_PATH = 'vgg_net_19.model'
IMG_NAME = 'test_img.png'
WIDTH = 112
HEIGHT = 112
#for testing a vector output
def test_model_vector_output():
#load architecture and parameters
model = vgg_net_19(WID... |
Maximum_Subarray/Python/shivam5992/kadane.py | Mynogs/Algorithm-Implementations | 1,184 | 12716742 | <filename>Maximum_Subarray/Python/shivam5992/kadane.py
from random import shuffle
'''
The maximum subarray problem is the task of finding the contiguous subarray within a
1D array of numbers (containing at least one positive number) which has the largest sum.
following implementation is the Dynamic Programming Approa... |
tests/engine/test_engine.py | hanqiu-hq/cvpods | 758 | 12716749 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import torch
from torch import nn
from cvpods.engine import SimpleRunner
from torch.utils.data import Dataset
class SimpleDataset(Dataset):
def __init__(self, length=100):
self.data_list = torch.rand(length, 3, 3)
... |
neo/Network/flightinfo.py | volekerb/neo-python | 387 | 12716847 | from datetime import datetime
class FlightInfo:
def __init__(self, node_id, height):
self.node_id: int = node_id
self.height: int = height
self.start_time: int = datetime.utcnow().timestamp()
def reset_start_time(self):
self.start_time = datetime.utcnow().timestamp()
|
quaternion/setup3d.py | IhorNehrutsa/micropython-samples | 268 | 12716849 | <reponame>IhorNehrutsa/micropython-samples
# setup3d.py
# Hardware specific setup for 3D demos
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2020 <NAME>
from machine import I2C, SPI, Pin
import gc
# This module must export the following functions
# fill(color) Fill the buffer with a color
# l... |
banpei/utils.py | Mee-Panyar-Clinic/banpei | 274 | 12716857 | <reponame>Mee-Panyar-Clinic/banpei
import numpy as np
def power_method(A, iter_num=1):
"""
Calculate the first singular vector/value of a target matrix based on the power method.
Parameters
----------
A : numpy array
Target matrix
iter_num : int
Number of iterations
... |
hummingbot/connector/exchange/coinbase_pro/coinbase_pro_api_order_book_data_source.py | BGTCapital/hummingbot | 3,027 | 12716873 | #!/usr/bin/env python
import asyncio
import logging
import time
from decimal import Decimal
from typing import AsyncIterable, Dict, List, Optional
import pandas as pd
from hummingbot.connector.exchange.coinbase_pro import coinbase_pro_constants as CONSTANTS
from hummingbot.connector.exchange.coinbase_pro.coinbase_pr... |
emails/admin.py | Jordzman/explorer | 917 | 12716879 | <filename>emails/admin.py
from django.contrib import admin
from emails.models import SentEmail
class SentEmailAdmin(admin.ModelAdmin):
list_display = (
'id',
'sent_at',
'from_email',
'from_name',
'to_email',
'to_name',
'body_temp... |
Payload_Type/Nimplant/mythic/agent_functions/curl.py | cybernomad1/Nimplant | 152 | 12716880 | <gh_stars>100-1000
from CommandBase import *
import json
class CurlArguments(TaskArguments):
def __init__(self, command_line):
super().__init__(command_line)
self.args = {
"url": CommandParameter(
name="url",
type=ParameterType.String,
de... |
chainerrl/misc/init_like_torch.py | ConnectionMaster/chainerrl | 923 | 12716889 | <reponame>ConnectionMaster/chainerrl
from chainer import links as L
import numpy as np
def init_like_torch(link):
# Mimic torch's default parameter initialization
# TODO(muupan): Use chainer's initializers when it is merged
for li in link.links():
if isinstance(li, L.Linear):
out_chann... |
sympy/physics/units/definitions/__init__.py | giorgosgiapis/sympy | 445 | 12716890 | from .unit_definitions import (
percent, percents,
permille,
rad, radian, radians,
deg, degree, degrees,
sr, steradian, steradians,
mil, angular_mil, angular_mils,
m, meter, meters,
kg, kilogram, kilograms,
s, second, seconds,
A, ampere, amperes,
K, kelvin, kelvins,
mol, ... |
app/src/main/python/package1/package12/python.py | Tanita2529/chaquopy | 336 | 12716896 | x = "python 12"
|
tf_coder/tf_coder_main.py | hstrohm/PyTorch-Coder-cheat | 245 | 12716902 | <reponame>hstrohm/PyTorch-Coder-cheat
# Copyright 2021 The TF-Coder Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
caql/gaussian_noise_policy_test.py | deepneuralmachine/google-research | 23,901 | 12716932 | <reponame>deepneuralmachine/google-research<filename>caql/gaussian_noise_policy_test.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the Licen... |
silk/__init__.py | eduzen/django-silk | 2,027 | 12716959 | import django
from pkg_resources import DistributionNotFound, get_distribution
try:
__version__ = get_distribution("django-silk").version
except DistributionNotFound:
pass
if django.VERSION < (3, 2):
default_app_config = "silk.apps.SilkAppConfig"
|
onnxmltools/convert/coreml/operator_converters/neural_network/Concat.py | xhochy/onnxmltools | 623 | 12716980 | <gh_stars>100-1000
# SPDX-License-Identifier: Apache-2.0
from ....common._apply_operation import apply_concat
from ....common._registration import register_converter
def convert_concat(scope, operator, container):
if operator.raw_operator.concat.sequenceConcat:
axis = 0
else:
axis = 1
ap... |
coloranalytics.py | lihao2333/cubr | 300 | 12717036 | # coloranalytics.py
# <NAME>
# CMU S13 15-112 Term Project
from math import e
class Profile(object):
def __init__(self, color, meanSat, meanHue, meanVal, meanSqSat, meanSqHue, meanSqVal):
self.color = color
self.meanSat = meanSat
self.meanHue = meanHue
self.meanVal = meanVal
... |
apis/models/base.py | IndraP24/katana | 102 | 12717058 | from pydantic import BaseModel
class TrainingStatusResponse(BaseModel):
trainingId: str = "056b5d3d-f983-4cd3-8fbd-20b8dad24e0f"
status: str = "Training queued"
|
services/internal/protocol/lobby_custom_pb2.py | yanxianhe/go-xserver | 160 | 12717060 | <gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: lobby_custom.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... |
src/tests/test_crashing.py | fabm3n/pretix | 1,248 | 12717069 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free... |
ML/Pytorch/GANs/StyleGAN/model.py | shimon-c/Machine-Learning-Collection | 3,094 | 12717072 | <filename>ML/Pytorch/GANs/StyleGAN/model.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from math import log2
factors = [1, 1, 1, 1, 1 / 2, 1 / 4, 1 / 8, 1 / 16, 1 / 32]
class PixelNorm(nn.Module):
def __init__(self):
super(PixelNorm, self).__init__()
self.epsilon = 1e-8
... |
Ryven/packages/auto_generated/_strptime/nodes.py | tfroehlich82/Ryven | 2,872 | 12717110 | <reponame>tfroehlich82/Ryven<filename>Ryven/packages/auto_generated/_strptime/nodes.py
from NENV import *
import _strptime
class NodeBase(Node):
pass
class _Calc_Julian_From_U_Or_W_Node(NodeBase):
"""
Calculate the Julian day based on the year, week of the year, and day of
the week, with week_star... |
eventsourcing/examples/aggregate8/test_snapshotting_intervals.py | ParikhKadam/eventsourcing | 107 | 12717120 | from unittest import TestCase
from eventsourcing.examples.aggregate8.application import DogSchool
from eventsourcing.examples.aggregate8.domainmodel import Dog
class SubDogSchool(DogSchool):
snapshotting_intervals = {Dog: 1}
class TestDogSchool(TestCase):
def test_dog_school(self) -> None:
# Constr... |
winapi__windows__ctypes/winapi__get_usb_list.py | DazEB2/SimplePyScripts | 117 | 12717197 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def locate_usb() -> list:
import win32file
from winapi__get_logical_drives import get_logical_drives
usb_list = list()
for drive_name in get_logical_drives():
drive_type = win32file.GetDriveType(drive_name)
if d... |
torchlambda/_version.py | medric49/torchlambda | 104 | 12717242 | __version__ = "NON-CI"
|
tests/test_migrate/models.py | agilentia/django-salesforce | 251 | 12717246 | <gh_stars>100-1000
"""Backward compatible behaviour with primary key 'Id' and upper-case field names"""
from salesforce import models
from salesforce.models import SalesforceModel
class User(SalesforceModel):
username = models.CharField(max_length=80)
email = models.CharField(max_length=100)
last_name = ... |
tests/__main__.py | otherJL0/Preql | 522 | 12717247 | <gh_stars>100-1000
import sys
import unittest
import logging
logging.basicConfig(level=logging.INFO)
from .test_basic import *
from .test_autocomplete import AutocompleteTests
minimal = [
AutocompleteTests,
TestTypes,
TestFlow,
TestFunctions,
BasicTests_0_Normal_Lt,
]
TESTS_SUITES = {
'minima... |
tensorflow_gnn/graph/graph_tensor_io_test.py | mattdangerw/gnn | 611 | 12717248 | """Tests for gt.GraphTensor extension type (go/tf-gnn-api)."""
import functools
from typing import Any, Callable, Iterable, List, Mapping, Optional
from absl.testing import parameterized
import google.protobuf.text_format as pbtext
import tensorflow as tf
from tensorflow_gnn.graph import adjacency as adj
from tensorf... |
datamol/scaffold/__init__.py | hengwei-chan/fragmentation_and_assemble | 130 | 12717256 | <gh_stars>100-1000
from ._fuzzy import trim_side_chain
from ._fuzzy import fuzzy_scaffolding
|
examples/belief_mdp_example.py | david-abel/mdps | 230 | 12717274 | <reponame>david-abel/mdps
# Other imports.
from simple_rl.tasks.maze_1d.Maze1DPOMDPClass import Maze1DPOMDP
from simple_rl.pomdp.BeliefMDPClass import BeliefMDP
from simple_rl.planning.BeliefSparseSamplingClass import BeliefSparseSampling
def main():
pomdp = Maze1DPOMDP()
belief_mdp = BeliefMDP(pomdp)
bss = Belief... |
uc_http/uchttp.py | phiberoptick/My-Shodan-Scripts | 845 | 12717279 | #!/usr/bin/env python
#
# uc-http.py
# Search SHODAN for uc-http path traversial.
#
# Author: random_robbie
import shodan
import json
import requests
import sys
# Configuration
API_KEY = "YOURSHODANAPIKEY"
SEARCH_FOR = 'Server: uc-httpd 1.0.0'
session = requests.Session()
def grab_file (IP,PORT):
try:
print ("[*... |
src/towncrier/__main__.py | hawkowl/towncrier | 252 | 12717313 | <gh_stars>100-1000
from towncrier._shell import cli
cli()
|
tests/proj3/proj3/__init__.py | maphew/nimporter | 656 | 12717319 | from proj3.proj3 import foo, bar, baz
import proj3.lib3
|
tests/test_cli_fileops.py | mimakaev/cooler | 106 | 12717325 | from __future__ import absolute_import, division
import os.path as op
from click.testing import CliRunner
from cooler.cli import cli
testdir = op.realpath(op.dirname(__file__))
datadir = op.join(testdir, "data")
def test_cp():
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.