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 |
|---|---|---|---|---|
Codeforces/Python/B_Borze.py | chetnalal/Daily-Coding-DS-ALGO-Practice | 289 | 63922 | <filename>Codeforces/Python/B_Borze.py<gh_stars>100-1000
# Ternary numeric notation is quite popular in Berland. To telegraph the ternary number the Borze alphabet is used. Digit 0 is transmitted as «.», 1 as «-.» and 2 as «--». You are to decode the Borze code, i.e. to find out the ternary number given its representat... |
attic/decorators/fibonacci.py | banjin/FluentPython-example | 5,651 | 63938 | <gh_stars>1000+
# source: http://oeis.org/A000045
fibo_seq = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610,
987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025,
121393, 196418, 317811, 514229, 832040, 1346269, 2178309,
3524578, 5702887, 9227465, 14930352, 2... |
PythonAPI/docs/snipets/carla.World.load_map_layer.py | zakur0/carla | 7,883 | 63974 | <gh_stars>1000+
# This recipe toggles on several layers in our "_Opt" maps
# Load town one with only minimum layout (roads, sidewalks, traffic lights and traffic signs)
world = client.load_world('Town01_Opt', carla.MapLayer.None)
# Toggle all buildings on
world.load_map_layer(carla.MapLayer.Buildings)
# Toggle all f... |
unsupervisedRR/utils/io.py | Sebastian-Jung/unsupervisedRR | 105 | 63978 | """
Some useful I/O functions
"""
import os
import pickle
import shutil
# get all directories in a specific directory
def get_directories(path):
return [f for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))]
# get all the files in a specific directory
# extension can be string or tuple of strings
... |
facebook_business/utils/version.py | MyrikLD/facebook-python-business-sdk | 576 | 64001 | # Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... |
auto_ts/models/ar_based/__init__.py | barrosm/Auto_TS | 423 | 64031 | from .build_arima import BuildArima
from .build_sarimax import BuildSarimax
from .build_autoarimax import BuildAutoSarimax
from .build_var import BuildVAR
|
applications/MetisApplication/tests/test_MetisApplication_mpi.py | clazaro/Kratos | 778 | 64042 | <reponame>clazaro/Kratos
# import Kratos
import KratosMultiphysics
import KratosMultiphysics.MetisApplication
if not KratosMultiphysics.IsDistributedRun():
raise Exception("This test script can only be executed in MPI!")
# Import Kratos "wrapper" for unittests
import KratosMultiphysics.KratosUnittest as KratosUni... |
library/scrollphat/IS31FL3730.py | fejao/scroll-phat | 115 | 64055 | <filename>library/scrollphat/IS31FL3730.py
MODE_5X11 = 0b00000011
class I2cConstants:
def __init__(self):
self.I2C_ADDR = 0x60
self.CMD_SET_MODE = 0x00
self.CMD_SET_BRIGHTNESS = 0x19
self.MODE_5X11 = 0b00000011
class IS31FL3730:
def __init__(self, smbus, font):
self.bus... |
server/src/shared_helpers/tests/services_tests.py | dashhudson/go-links | 176 | 64076 | import datetime
import unittest
from flask import Blueprint, request, jsonify
from freezegun import freeze_time
from mock import Mock, patch
import jwt
from requests.exceptions import HTTPError
from shared_helpers import services
from testing import TrottoTestCase, LIVE_APP_HOST
class TestFunctions(unittest.TestCas... |
wikipedia-sentences/app.py | nikosNalmpantis/examples | 434 | 64085 | <reponame>nikosNalmpantis/examples
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"
import os
import sys
import click
import random
from jina import Flow, Document, DocumentArray
from jina.logging.predefined import default_logger as logger
MAX_DOCS = int(os.environ... |
examples/table_validate.py | vincentchevrier/tableschema-py | 224 | 64088 | from tableschema import Table
# Data from WEB, schema from MEMORY
SOURCE = 'https://raw.githubusercontent.com/frictionlessdata/tableschema-py/master/data/data_infer.csv'
SCHEMA = {'fields': [{'name': 'id', 'type': 'integer'}, {'name': 'age', 'type': 'integer'}, {'name': 'name', 'type': 'string'}] }
# If schema is not... |
lib/plugins/3dcart.py | ikstream/Zeus-Scanner | 841 | 64160 | import re
import lib.core.common
__product__ = "3dcart"
__description__ = (
"The 3dcart Shopping Cart Software is a complete e-commerce solution for anyone."
)
def search(html, **kwargs):
html = str(html)
headers = kwargs.get("headers", None)
plugin_detection_schema = (
re.compile(r"3dcart.... |
pykg2vec/test/test_hp_loader.py | baxtree/pykg2vec | 430 | 64171 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module is for testing unit functions of the hyperparameter loader
"""
import os
import pytest
from pykg2vec.common import KGEArgParser
from pykg2vec.common import HyperparameterLoader
def test_load_default_hyperparameter_file():
hp_loader = HyperparameterLoade... |
src/genie/libs/parser/iosxe/tests/ShowClnsIsNeighborsDetail/cli/equal/golden_output_3_expected.py | balmasea/genieparser | 204 | 64179 | expected_output = {
"tag": {
"test": {
"system_id": {
"R2_xr": {
"type": {
"L1L2": {
"area_address": ["49.0001"],
"circuit_id": "R1_xe.01",
"format": "P... |
benchmarks/test_headless_time.py | TheRakeshPurohit/wasmer-python | 900 | 64185 | from wasmer import engine, Store, Module, Instance
from wasmer_compiler_cranelift import Compiler as Cranelift
from wasmer_compiler_llvm import Compiler as LLVM
from wasmer_compiler_singlepass import Compiler as Singlepass
TEST_BYTES = open('benchmarks/nbody.wasm', 'rb').read()
def test_benchmark_headless_time_nbody_... |
tests/data/cli_args.py | festeh/docker-pretty-ps | 241 | 64189 | <filename>tests/data/cli_args.py
class CliArgs(object):
def __init__(self):
self.search = []
self.all = False
self.slim = False
self.include = False
self.order = False
self.reverse = False
self.json = False
self.version = False
|
physics_aware_training/model_architectures/SplitInputParameterNet.py | mcmahon-lab/Physics-Aware-Training | 182 | 64240 | import torch
import torch.nn as nn
import physics_aware_training.digital_twin_utils
class SplitInputParameterNet(nn.Module):
def __init__(self,
input_dim,
nparams,
output_dim,
parameterNunits = [100,100,100],
internalNunits =... |
dusty/commands/shell.py | gamechanger/dusty | 421 | 64245 | <reponame>gamechanger/dusty
from ..compiler.spec_assembler import get_specs
from . import utils
from ..systems.docker import get_dusty_container_name
def execute_shell(app_or_service_name):
specs = get_specs()
if app_or_service_name not in [spec.name for spec in specs.get_apps_and_services()]:
raise Ke... |
Chapter08/07_dqn_distrib.py | haohaoxiao/Deep-Reinforcement-Learning-Hands-On-Second-Edition | 621 | 64258 | #!/usr/bin/env python3
import gym
import ptan
import argparse
import random
import numpy as np
import torch
import torch.optim as optim
import torch.nn.functional as F
from ignite.engine import Engine
from lib import common, dqn_extra
NAME = "07_distrib"
def calc_loss(batch, net, tgt_net, gamma, device="cpu"):
... |
library/test/test_compiler/sbs_code_tests/06_funcall_varargs_kwargs.py | creativemindplus/skybison | 278 | 64297 | <gh_stars>100-1000
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
c = (a, b)
d = {e: 1, f: 2}
fun(a, b, *c, **d)
# EXPECTED:
[
...,
BUILD_TUPLE(2),
...,
BUILD_TUPLE_UNPACK_WITH_CALL(2),
...,
CALL_FUNCTION_EX(1),
...,
]
|
tests/urls.py | sergioisidoro/django-robots | 252 | 64299 | <reponame>sergioisidoro/django-robots<gh_stars>100-1000
import django.contrib.sitemaps.views
import django.views.i18n
import django.views.static
from django.conf import settings
from django.contrib import admin
from django.contrib.sitemaps.views import sitemap as sitemap_view
from django.urls import include
from django... |
acoustics/aio.py | cnheider/python-acoustics | 371 | 64303 | """
Cirrus
======
Handle Cirrus data.
"""
import csv
import io
import re
import pandas as pd
def read_csv_cirrus(filename): # pylint: disable=too-many-locals
"""Read a Cirrus CSV file. Currently exists support for some types of
CSV files extracted with NoiseTools. There is no support for CSVs related
... |
tensorflow_federated/python/examples/stateful_clients/stateful_fedavg_tf.py | zhihansh/federated-oss | 1,918 | 64328 | <reponame>zhihansh/federated-oss
# Copyright 2020, The TensorFlow Federated 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
#
# Un... |
colossalai/engine/schedule/_non_pipeline_schedule.py | RichardoLuo/ColossalAI | 1,630 | 64337 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
from typing import Iterable
import torch
from ._base_schedule import BaseSchedule
from colossalai.utils import conditional_context
class NonPipelineSchedule(BaseSchedule):
"""A helper schedule class for no pipeline parallelism running environment.
During one ... |
examples/genetic_rl.py | matrig/genrl | 390 | 64349 | <reponame>matrig/genrl<filename>examples/genetic_rl.py<gh_stars>100-1000
import argparse
from genrl import A2C, PPO1
from genrl.deep.common import OnPolicyTrainer
from genrl.deep.common.actor_critic import MlpActorCritic
from genrl.deep.common.utils import get_env_properties
from genrl.environments import VectorEnv
fr... |
examples/genetic_alg/simple_gen.py | AravindaDP/gym-donkeycar | 106 | 64354 | """
file: simple_gen.py
author: <NAME>
date: 17 May 2020
notes: a most basic implementation of genetic cross breeding and mutation to attempt to improve
a neural network. Assumes the standard Keras model from Donkeycar project.
Lower score means less loss = better.
"""
import argparse
import json
import... |
model_docsum.py | EdinburghNLP/Refresh | 265 | 64378 | <gh_stars>100-1000
####################################
# Author: <NAME>
# Date: September 2016
# Project: Document Summarization
# H2020 Summa Project
####################################
"""
Document Summarization Modules and Models
"""
from __future__ import absolute_import
from __future__ import division
from __f... |
utils/measure/powermeter/shelly.py | mooonsee/homeassistant-powercalc | 219 | 64382 | <reponame>mooonsee/homeassistant-powercalc
from __future__ import annotations
import logging
import requests
import time
from .errors import ConnectionError
from .powermeter import PowerMeasurementResult, PowerMeter
_LOGGER = logging.getLogger("measure")
class ShellyApi:
status_endpoint = "/status"
meter_en... |
Section 7 - Text Classification/Text Classification Part 2 - Pickling and Unpickling dataset.py | kungfumas/bahasa-alami | 169 | 64389 | # Text Classifiation using NLP
# Importing the libraries
import numpy as np
import re
import pickle
import nltk
from nltk.corpus import stopwords
from sklearn.datasets import load_files
nltk.download('stopwords')
# Importing the dataset
reviews = load_files('txt_sentoken/')
X,y = reviews.data,reviews.target
# Pic... |
bootcamp/feeds/tests.py | elviva404/bootcamp | 115 | 64406 | from django.test import TestCase, Client
from django.contrib.auth.models import User
from .models import Feed
class FeedViewsTest(TestCase):
def setUp(self):
self.client = Client()
user = User.objects.create_user(
username='test_user',
email='<EMAIL>',
password... |
Algo and DSA/LeetCode-Solutions-master/Python/validate-ip-address.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 64428 | # Time: O(1)
# Space: O(1)
import string
class Solution(object):
def validIPAddress(self, IP):
"""
:type IP: str
:rtype: str
"""
blocks = IP.split('.')
if len(blocks) == 4:
for i in xrange(len(blocks)):
if not blocks[i].isdigit() or not... |
test/test_Util/test_image_util.py | lucateo/lenstronomy | 107 | 64458 | <reponame>lucateo/lenstronomy<filename>test/test_Util/test_image_util.py
__author__ = 'sibirrer'
import lenstronomy.Util.util as util
import pytest
import unittest
import numpy as np
import numpy.testing as npt
import lenstronomy.Util.image_util as image_util
def test_add_layer2image_odd_odd():
grid2d = np.zeros... |
sphinxext/suites.py | zmoon/scipy-lecture-notes | 2,538 | 64481 | def fib(n):
"return nth term of Fibonacci sequence"
a, b = 0, 1
i = 0
while i<n:
a, b = b, a+b
i += 1
return b
def linear_recurrence(n, (a,b)=(2,0), (u0, u1)=(1,1)):
"""return nth term of the sequence defined by the
linear recurrence
u(n+2) = a*u(n+1) + b*u(n)"""
... |
dataset_code/pred_proba_XGB.py | mapicccy/Stock-Market-Trend-Analysis-Using-HMM-LSTM | 147 | 64492 | import numpy as np
from public_tool.form_index import form_index
from XGB_HMM.form_B_matrix_by_XGB import form_B_matrix_by_XGB
from XGB_HMM.predict import self_pred
def pred_proba_XGB(A, model, pi, O, allow_flag, lengths):
# 对dataset形成pred_proba,注意这里的dataset是solve_on_raw_data后的结果,即附带allow_flag的数据
# ou... |
tests/SampleApps/python/django-react-boilerplate/exampleapp/models.py | samruddhikhandale/Oryx | 403 | 64506 | from __future__ import unicode_literals
from django.db import models # noqa
# Create your models here.
|
src/test.py | chaitanya100100/VAE | 115 | 64507 | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import cPickle
from keras.layers import Input, Dense, Lambda, Flatten, Reshape, Layer
from keras.layers import Conv2D, Conv2DTranspose
from keras.models import Model
from keras import backend as K
from keras import metrics
from keras impor... |
crabageprediction/venv/Lib/site-packages/pandas/io/formats/__init__.py | 13rianlucero/CrabAgePrediction | 28,899 | 64514 | <gh_stars>1000+
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# import modules that have public classes/functions
from pandas.io.formats import style
# and mark only those modules as public
__all__ = ["style"]
|
tests/ut/conftest.py | rspadim/aiocache | 213 | 64524 | <filename>tests/ut/conftest.py
import pytest
import asynctest
from aiocache.base import BaseCache, API
from aiocache import caches, RedisCache, MemcachedCache
from aiocache.plugins import BasePlugin
from aiocache.serializers import BaseSerializer
def pytest_configure():
"""
Before pytest_namespace was being ... |
tests/tests/test_storage.py | karlwnw/django-pipeline | 598 | 64580 | <filename>tests/tests/test_storage.py
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.management import call_command
from django.test import TestCase
from django.test.utils import override_settings
from django.test.utils import modify_s... |
interval_bound_propagation/tests/loss_test.py | cknabs/interval-bound-propagation | 140 | 64583 | # coding=utf-8
# Copyright 2019 The Interval Bound Propagation 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 ... |
nova/tests/functional/compute/test_instance_list.py | zjzh/nova | 1,874 | 64594 | # 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
# d... |
examples/python/abstract_json.py | rafael-santiago/LIEF | 2,999 | 64596 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Description
# -----------
# Dump abstract informations in a JSON format
# see: abstract_reader.py
import argparse
import sys
import lief
import json
def main():
parser = argparse.ArgumentParser()
parser.add_argument('binary', help = 'A binary')
args = parse... |
bcs-ui/backend/resources/workloads/cronjob/client.py | laodiu/bk-bcs | 599 | 64619 | <reponame>laodiu/bk-bcs
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this ... |
trax/tf_numpy/public_symbol_test.py | dedsec-9/trax | 7,220 | 64630 | <gh_stars>1000+
# coding=utf-8
# Copyright 2021 The Trax 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 app... |
lib/modules/python/persistence/osx/launchdaemonexecutable.py | Strazzom/Empire | 230 | 64638 | <gh_stars>100-1000
import base64
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'LaunchDaemon',
# list of one or m... |
cinder/tests/unit/scheduler/test_capacity_weigher.py | helenwalsh/cinder | 571 | 64668 | # Copyright 2011-2012 OpenStack Foundation
# 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... |
components/isceobj/IsceProc/runGeocode.py | vincentschut/isce2 | 1,133 | 64673 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2014 California Institute of Technology. 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 th... |
src/transformers/models/deberta_v2/tokenization_deberta_v2_fast.py | techthiyanes/transformers | 8,028 | 64705 | # coding=utf-8
# Copyright 2020 Microsoft and the HuggingFace Inc. team.
#
# 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... |
runway/utils/_version.py | onicagroup/runway | 134 | 64712 | """Version utilities."""
from __future__ import annotations
import packaging.version
class Version(packaging.version.Version):
"""Customize packagining.version.Version."""
def __init__(self, version: str) -> None:
"""Instantiate class.
Args:
version: Version string. (e.g. 1.0.0,... |
colour/models/rgb/ictcp.py | colour-science/colour | 1,380 | 64723 | # -*- coding: utf-8 -*-
"""
:math:`IC_TC_P` Colour Encoding
===============================
Defines the :math:`IC_TC_P` colour encoding related transformations:
- :func:`colour.RGB_to_ICtCp`
- :func:`colour.ICtCp_to_RGB`
- :func:`colour.XYZ_to_ICtCp`
- :func:`colour.ICtCp_to_XYZ`
References
----------
- :c... |
function-images/image_rotate_s3/server.py | tom-kuchler/vhive | 138 | 64750 | from concurrent import futures
import logging
import os
import grpc
from PIL import Image, ImageOps
import helloworld_pb2
import helloworld_pb2_grpc
from minio import Minio
minioEnvKey = "MINIO_ADDRESS"
image_name = 'img2.jpeg'
image2_name = 'img3.jpeg'
image_path = '/pulled_' + image_name
image_path2 = '/pulled_' ... |
zerver/migrations/0230_rename_to_enable_stream_audible_notifications.py | TylerPham2000/zulip | 17,004 | 64768 | # Generated by Django 1.11.20 on 2019-06-12 06:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("zerver", "0229_stream_message_retention_days"),
]
operations = [
migrations.RenameField(
model_name="userprofile",
old_nam... |
gs/monitor2/apps/dashboard/views.py | leozz37/makani | 1,178 | 64789 | # Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
questions/increasing-order-search-tree/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 64797 | <filename>questions/increasing-order-search-tree/Solution.py
"""
Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child.
Example 1:
Input: root = [5,3,6,2,4,null,8,1,null,nu... |
annotator/views.py | ljames1/BeaverDam | 201 | 64815 | <gh_stars>100-1000
from django.shortcuts import render, redirect
from django.conf import settings
from django.http import HttpResponse, Http404, HttpResponseBadRequest, HttpResponseForbidden
from django.views.generic import View
from django.views.decorators.clickjacking import xframe_options_exempt
from django.contrib.... |
basic/messages/admin.py | neechadi/django-basic-apps | 548 | 64832 | <reponame>neechadi/django-basic-apps<filename>basic/messages/admin.py
from django.contrib import admin
from basic.messages.models import Message
class MessageAdmin(admin.ModelAdmin):
list_display = ('from_user', 'to_user', 'subject', 'to_status', 'from_status', 'created', 'content_type', 'object_id')
admin.site.r... |
scripts/examples/Arduino/Portenta-H7/03-Drawing/line_drawing.py | jiskra/openmv | 1,761 | 64846 | <gh_stars>1000+
# Line Drawing
#
# This example shows off drawing lines on the OpenMV Cam.
import sensor, image, time, pyb
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE) # or GRAYSCALE...
sensor.set_framesize(sensor.QVGA) # or QQVGA...
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
cloc... |
packages/pyright-internal/src/tests/samples/annotatedVar2.py | sasano8/pyright | 4,391 | 64849 | # This sample tests annotated types on global variables.
# This should generate an error because the declared
# type below does not match the assigned type.
glob_var1 = 4
# This should generate an error because the declared
# type doesn't match the later declared type.
glob_var1 = Exception() # type: str
glob_var1 ... |
mpf/devices/segment_display/transitions.py | haggispinball/mpf_fathom_fast | 163 | 64855 | """Text transitions used for segment displays."""
import abc
from typing import Optional, List
from mpf.core.placeholder_manager import TextTemplate
from mpf.core.rgb_color import RGBColor
from mpf.devices.segment_display.segment_display_text import SegmentDisplayText, UncoloredSegmentDisplayText
STEP_OUT_OF_RANGE_ER... |
d3net/music-source-separation/data.py | ishine/ai-research-code | 199 | 64860 | # 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
#
# Unless required by applicable law or agreed to ... |
src/exabgp/environment/setup.py | pierky/exabgp | 1,560 | 64901 | <reponame>pierky/exabgp<filename>src/exabgp/environment/setup.py<gh_stars>1000+
# encoding: utf-8
"""
setup.py
Created by <NAME> on 2014-12-23.
Copyright (c) 2014-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from exabgp.environment import parsing
from exabgp.environment... |
tests/grafana_dashboards/test_exporter.py | Rvhappen/grafana-dashboard-builder | 131 | 64906 | # -*- coding: utf-8 -*-
# Copyright 2015-2019 grafana-dashboard-builder contributors
#
# 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 ... |
python/fcdd/datasets/offline_supervisor.py | kyungmin96/myfcdd | 152 | 64918 | from typing import List
import torch
from torch.utils.data.dataset import Dataset
def noise(outlier_classes: List[int], generated_noise: torch.Tensor, norm: torch.Tensor,
nom_class: int, train_set: Dataset, gt: bool = False) -> Dataset:
"""
Creates a dataset based on the nominal classes of a given ... |
test/test_LensModel/test_Profiles/test_flexion.py | heather999/lenstronomy | 107 | 64932 | __author__ = 'sibirrer'
from lenstronomy.LensModel.Profiles.flexion import Flexion
from lenstronomy.LensModel.lens_model import LensModel
import numpy as np
import numpy.testing as npt
import pytest
class TestExternalShear(object):
"""
tests the Gaussian methods
"""
def setup(self):
self.fl... |
aw_nas/weights_manager/headers/bifpn.py | Harald-R/aw_nas | 195 | 64943 | from aw_nas.weights_manager.wrapper import BaseHead
from .classifiers import BiFPNClassifier
__all__ = ["BiFPNHead"]
class BiFPNHead(BaseHead):
NAME = "bifpn_head"
def __init__(
self,
device,
num_classes,
feature_channels,
bifpn_out_channels,
activation="swis... |
docs/conf.py | richardsheridan/anyio | 749 | 64956 | #!/usr/bin/env python3
import pkg_resources
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx_autodoc_typehints'
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'AnyIO'
author = '<NAME>'
copyright = '2018, ' + author
v = pkg_resources.get_distr... |
doc/source/plots/spherharm42.py | dimpase/mpmath | 625 | 64973 | <reponame>dimpase/mpmath<filename>doc/source/plots/spherharm42.py
# Real part of spherical harmonic Y_(4,2)(theta,phi)
def Y(l,m):
def g(theta,phi):
R = abs(fp.re(fp.spherharm(l,m,theta,phi)))
x = R*fp.cos(phi)*fp.sin(theta)
y = R*fp.sin(phi)*fp.sin(theta)
z = R*fp.cos(theta)
... |
main.py | RowitZou/Lexicon-nn | 134 | 64975 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Last Modified by: <NAME>, Contact: <EMAIL>
import time
import sys
import argparse
import random
import torch
import gc
import pickle
import os
import torch.autograd as autograd
import torch.optim as optim
import numpy as np
from utils.metric import g... |
scripts/hello.py | LukeB42/Emissary | 193 | 64992 | # _*_ coding: utf-8 _*_
#
# This script creates a named pipe (if it doesn't exist)
# and writes the feed name, article title and url to it
# whenever an article is saved to the database.
#
# This is useful for composing systems that constantly read
# the FIFO and do things like emit the data to IRC channels.
#
# You c... |
third_party/blink/tools/blinkpy/web_tests/port/port_testcase.py | zealoussnow/chromium | 14,668 | 64997 | <gh_stars>1000+
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of cond... |
videos/lagrange.py | ryu577/pyray | 715 | 65015 | import numpy as np
from pyray.shapes.twod.paraboloid import *
from pyray.shapes.twod.functional import *
from pyray.rotation import *
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import matplotlib as mpl... |
bots/stocks/technical_analysis/adosc.py | tehcoderer/GamestonkTerminal | 255 | 65025 | import logging
import plotly.graph_objects as go
from bots import imps, load_candle
from openbb_terminal.common.technical_analysis import volume_model
from openbb_terminal.decorators import log_start_end
# pylint: disable=R0913
logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def adosc_command(
... |
test-framework/test-suites/integration/tests/list/test_list_host_firmware_mapping.py | anooprajendra/stacki | 123 | 65026 | <reponame>anooprajendra/stacki<gh_stars>100-1000
import json
import pytest
@pytest.mark.parametrize(
"hosts, expected_results",
(
(
"",
[
{"host": "backend-0-0", "version": "1.2.3", "make": "mellanox", "model": "m7800"},
{"host": "backend-0-1", "version": "1.2.3.4", "make": "dell", "model": "x1052-so... |
supervisor/discovery/validate.py | pnjongang/supervisor | 597 | 65030 | """Validate services schema."""
from importlib import import_module
from pathlib import Path
import voluptuous as vol
from ..const import ATTR_ADDON, ATTR_CONFIG, ATTR_DISCOVERY, ATTR_SERVICE, ATTR_UUID
from ..utils.validate import schema_or
from ..validate import uuid_match
def valid_discovery_service(service):
... |
modules/benchmarks/e2e_test.bzl | John-Cassidy/angular | 95,154 | 65047 | load("//tools:defaults.bzl", "protractor_web_test_suite")
"""
Macro that can be used to define a e2e test in `modules/benchmarks`. Targets created through
this macro differentiate from a "benchmark_test" as they will run on CI and do not run
with `@angular/benchpress`.
"""
def e2e_test(name, server, **kwargs):
... |
tech_project/lib/python2.7/site-packages/filer/migrations/0005_auto_20160623_1425.py | priyamshah112/Project-Descripton-Blog | 134 | 65049 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-23 18:25
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('filer', '0004_auto_20160328... |
mmcv/runner/fp16_utils.py | lyttonhao/mmcv | 549 | 65054 | <gh_stars>100-1000
import functools
from collections import OrderedDict, abc
from inspect import getfullargspec
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
from torch._utils import (_flatten_dense_tensors, _take_tensors,
_unflatten_dense_tensors)
d... |
testcontainers/google/__init__.py | singerjess/testcontainers-python | 465 | 65056 | """
Google Cloud Emulators
======================
Allows to spin up google cloud emulators, such as PubSub.
"""
from .pubsub import PubSubContainer # noqa
|
chrome/test/chromedriver/embed_mobile_devices_in_cpp.py | zipated/src | 2,151 | 65057 | <reponame>zipated/src
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Embeds standalone JavaScript snippets in C++ code.
The script requires the Source/devtools/front_end/emulated... |
chatette/parsing/lexing/rule_arg_decl.py | SimGus/Chatette | 263 | 65063 | <reponame>SimGus/Chatette
# coding: utf-8
"""
Module `chatette.parsing.lexing.rule_arg_decl`
Contains the definition of the class that represents the lexing rule
to tokenize the declaration of an argument in a unit declaration.
"""
from chatette.parsing.lexing.lexing_rule import LexingRule
from chatette.parsing.lexing... |
ckanext/example_isignal/plugin.py | gg2/ckan | 2,805 | 65074 | # -*- coding: utf-8 -*-
import ckan.plugins as p
def x2(sender):
return sender * 2
def x10(sender):
return sender * 10
class ExampleISignalPlugin(p.SingletonPlugin):
p.implements(p.ISignal)
# ISignal
def get_signal_subscriptions(self):
return {
p.toolkit.signals.ckanext.... |
zenml/steps/evaluator/tfma_module.py | ramitsurana/zenml | 1,275 | 65076 | from typing import Dict, Optional, Text, List
import apache_beam as beam
import tensorflow_model_analysis as tfma
from tensorflow_model_analysis import config
from tensorflow_model_analysis import constants
from tensorflow_model_analysis import model_util
from tensorflow_model_analysis import types
from tensorflow_mod... |
Python/LongestSubstringWithoutRepeatingCharactersTest.py | TonnyL/Windary | 205 | 65081 | <filename>Python/LongestSubstringWithoutRepeatingCharactersTest.py
from unittest import TestCase
from LongestSubstringWithoutRepeatingCharacters import LongestSubstringWithoutRepeatingCharacters
class TestLongestSubstringWithoutRepeatingCharacters(TestCase):
def test_lengthOfLongestSubstring(self):
lswrc... |
example/python/permissions/can_detach_role.py | akshatkarani/iroha | 1,467 | 65092 | #
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
from iroha import Iroha, IrohaCrypto
from iroha import primitive_pb2
import commons
admin = commons.new_user('admin@test')
alice = commons.new_user('alice@test')
iroha = Iroha(admin['id'])
@commons.hex
def genesis_tx():
... |
venv/Lib/site-packages/notebook/terminal/handlers.py | BoxicaLion/BasicMathFormulas | 445 | 65106 | #encoding: utf-8
"""Tornado handlers for the terminal emulator."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
import terminado
from notebook._tz import utcnow
from ..base.handlers import IPythonHandler
from ..base.zmqhandlers import Web... |
cclib/bridge/cclib2pyquante.py | chemistry-scripts/cclib | 224 | 65115 | <reponame>chemistry-scripts/cclib
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Bridge for using cclib data in PyQuante (http://pyquante.sourceforge.net)."""
... |
poetry/core/_vendor/tomlkit/source.py | avoltz/poetry-core | 18,636 | 65118 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import itertools
from copy import copy
from typing import Any
from typing import Optional
from typing import Tuple
from typing import Type
from ._compat import PY2
from ._compat import unicode
from .exceptions import ParseError
from .exceptions import U... |
modules/vc_decoder.py | shaun95/cotatron | 202 | 65130 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .cond_bn import ConditionalBatchNorm1d
# adopted Generator ResBlock from https://arxiv.org/abs/1909.11646
class GBlock(nn.Module):
def __init__(self, in_channels, out_channels, condition_dim):
super().__init__()
self.cond_bn ... |
setup.py | codalab/codalab-worksheets | 236 | 65152 | from setuptools import setup, find_packages
from setuptools.command.install import install
import os
import setuptools
import sys
# should match codalab/common.py#CODALAB_VERSION
CODALAB_VERSION = "1.1.4"
class Install(install):
_WARNING_TEMPLATE = (
'\n\n\033[1m\033[93mWarning! CodaLab was installed a... |
old/relu_static.py | flint-stone/OpenTPU | 248 | 65154 | <filename>old/relu_static.py
# Function: Relu and normalization
# Comments: offset defined during design phase (not runtime)
import pyrtl
# relu and normalization
def relu_nrml(din, offset=0):
assert len(din) == 32
assert offset <= 24
dout = pyrtl.WireVector(32)
with pyrtl.conditional_assignment:
with din[-1... |
adb/systrace/catapult/devil/devil/utils/cmd_helper_test.py | mohanedmoh/TBS | 2,151 | 65169 | <gh_stars>1000+
#!/usr/bin/env python
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests for the cmd_helper module."""
import unittest
import subprocess
import sys
import time
from devil import dev... |
spaghetti/tests/test_api_network.py | gegen07/spaghetti | 182 | 65183 | <filename>spaghetti/tests/test_api_network.py<gh_stars>100-1000
""" Testing for the spaghetti api import structure.
"""
import unittest
from .network_unittest_classes import TestNetwork
from .network_unittest_classes import TestNetworkPointPattern
from .network_unittest_classes import TestNetworkAnalysis
# api impor... |
lib/django-1.4/django/core/management/commands/sqlcustom.py | MiCHiLU/google_appengine_sdk | 790 | 65185 | from optparse import make_option
from django.core.management.base import AppCommand
from django.core.management.sql import sql_custom
from django.db import connections, DEFAULT_DB_ALIAS
class Command(AppCommand):
help = "Prints the custom table modifying SQL statements for the given app name(s)."
option_list... |
examples/pytorch/text_classification/data/trec/data_preparation.py | cminusQAQ/graph4nlp | 1,269 | 65195 | <reponame>cminusQAQ/graph4nlp<gh_stars>1000+
import sys
import chardet
fin = open(sys.argv[1], "rb")
fout = open(sys.argv[2], "w")
for line in fin:
try:
line = line.decode("utf-8")
except Exception:
line = line.decode(chardet.detect(line)["encoding"])
data = line.strip().split()
text ... |
cesium/features/common_functions.py | acrellin/cesium | 603 | 65211 | <filename>cesium/features/common_functions.py<gh_stars>100-1000
import numpy as np
from scipy import stats
def max_slope(t, x):
"""Compute the largest rate of change in the observed data."""
slopes = np.diff(x) / np.diff(t)
return np.max(np.abs(slopes))
def maximum(x):
"""Maximum observed value."""
... |
infra/config/PRESUBMIT.py | chromium/chromium | 14,668 | 65214 | <filename>infra/config/PRESUBMIT.py
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Enforces luci-milo.cfg consistency.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for m... |
sfepy/homogenization/coefficients.py | BubuLK/sfepy | 510 | 65232 | <reponame>BubuLK/sfepy
from __future__ import absolute_import
import numpy as nm
from sfepy.base.base import ordered_iteritems, Struct, basestr
from sfepy.base.ioutils import read_dict_hdf5, write_dict_hdf5
from sfepy.homogenization.utils import iter_sym
import six
from six.moves import range
def coef_arrays_to_dicts... |
pwnables/kpets/challenge.py | cclauss/fbctf-2019-challenges | 213 | 65253 | #!/usr/bin/python
import struct
import os
import sys
import tempfile
import subprocess
useragent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36'
def main():
try:
p = subprocess.Popen('./pow.py ask 3'.split())
p.communicate()
... |
tests/r/test_pension.py | hajime9652/observations | 199 | 65257 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.pension import pension
def test_pension():
"""Test module pension.py by downloading
pension.csv and testing shape of
extracted data has 19... |
observations/r/randu.py | hajime9652/observations | 199 | 65266 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def randu(path):
"""Random Numbers from Congruential G... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.