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 |
|---|---|---|---|---|---|---|---|---|---|---|
Python/Tests/TestData/DebuggerProject/ComplexExceptions.py | techkey/PTVS | 404 | 1621939 | <reponame>techkey/PTVS
import cPickle
# raise an exception that's not a built-in
try:
print('raising')
raise cPickle.PickleError
except:
print('caught')
try:
print('raising')
try:
raise StopIteration
finally:
raise NameError
except:
print('caught')
try:
try:
raise StopIteration
except:
raise NameErr... | 0 | 0 | 0 | 0 | 0 | 0 |
sktime/contrib/distance_based/elastic_ensemble_from_file.py | marcio55afr/sktime | 5,349 | 1621945 | # -*- coding: utf-8 -*-
"""Elastic Ensemble classifier from file."""
__author__ = "<NAME>"
import numpy as np
import os
from sklearn.metrics import accuracy_score
from sktime.utils.data_io import write_results_to_uea_format
class ElasticEnsemblePostProcess:
"""Elastic Ensemble post processor.
Parameters
... | 7 | 1 | 0 | 8 | 16 | 0 |
S1_network_dataset_preparation.py | YechengLyu/Learning-to-Segment-3D-Point-Clouds-in-2D-Image-Space | 155 | 1621946 | # import numpy as np
import fun_provider as provider
# load common librarys
import numpy as np
import networkx as nx
from scipy.spatial.distance import pdist,squareform
from sklearn.cluster import KMeans
import time
import h5py
# load GPGL functions
from fun_GPGL import graph_cut,fun_GPGL_layout_push
#%% global set... | 0 | 2 | 0 | 0 | 2 | 0 |
google/cloud/firestore_bundle/bundle.py | noxxious/python-firestore | 140 | 1621952 | <reponame>noxxious/python-firestore
# Copyright 2021 Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | 0 | 0 | 0 | 0 | 0 | 0 |
circus/green/controller.py | BradleyKirton/circus | 820 | 1621962 | from circus.controller import Controller as _Controller
from circus.green.sighandler import SysHandler
from zmq.green.eventloop import ioloop, zmqstream
class Controller(_Controller):
def _init_syshandler(self):
self.sys_hdl = SysHandler(self)
def _init_stream(self):
self.stream = zmqstream... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_connector_webexteams.py | JiahnChoi/opsdroid.kr | 712 | 1621977 | <filename>tests/test_connector_webexteams.py<gh_stars>100-1000
"""Tests for the Connector Webex Teams class."""
import asyncio
import unittest
import asynctest
import asynctest.mock as amock
from opsdroid.core import OpsDroid
from opsdroid.connector.webexteams import ConnectorWebexTeams
from opsdroid.events import Me... | 0 | 0 | 0 | 0 | 0 | 0 |
ote_sdk/ote_sdk/usecases/tasks/interfaces/evaluate_interface.py | ntyukaev/training_extensions | 775 | 1622005 | <filename>ote_sdk/ote_sdk/usecases/tasks/interfaces/evaluate_interface.py<gh_stars>100-1000
"""This module contains the interface class for tasks that can compute performance. """
# Copyright (C) 2021-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
import abc
from typing import Optional
from ote_sdk.... | 0 | 0 | 0 | 0 | 0 | 0 |
LeetCode/1606_Find_Servers_That_Handled_Most_Number_of_Requests.py | Achyut-sudo/PythonAlgorithms | 144 | 1622012 | <gh_stars>100-1000
class Solution(object):
def busiestServers(self, k, arrival, load):
"""
:type k: int
:type arrival: List[int]
:type load: List[int]
:rtype: List[int]
"""
from sortedcontainers import SortedList
avail = SortedList()
for i ... | 0 | 0 | 0 | 0 | 0 | 0 |
test/detext/layers/test_feature_rescaler.py | StarWang/detext | 1,229 | 1622019 | <gh_stars>1000+
import tensorflow as tf
from detext.layers import feature_rescaler
from detext.utils.testing.data_setup import DataSetup
class TestFeatureRescaler(DataSetup, tf.test.TestCase):
"""Unit test for feature_rescaler.py"""
def testFeatureRescaler(self):
batch_size = 10
list_size = ... | 0 | 0 | 0 | 0 | 0 | 0 |
nova/tests/functional/api_sample_tests/test_server_topology.py | zjzh/nova | 1,874 | 1622042 | #
# 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
# ... | 0 | 1 | 5 | 0 | 6 | 0 |
scripts/run_server.py | frznvm0/Kanmail | 1,118 | 1622054 | #!/usr/bin/env python
import os
import sys
sys.path.append('.') # noqa: E402
os.environ['KANMAIL_MODE'] = 'server' # noqa: E402
from kanmail.server.app import app, boot
from kanmail.settings.constants import DEBUG, SERVER_PORT
# Bootstrap the server, but don't prep cheroot itself (we'll use Flask devserver)
boot... | 0 | 0 | 0 | 0 | 0 | 0 |
functorch/__init__.py | MathInf/functorch | 279 | 1622056 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import torch
import functools
import textwrap
from . import _C
# Top-level AP... | 5 | 4 | 0 | 0 | 9 | 0 |
api/v1/list/urls.py | RyanNoelk/OpenEats | 113 | 1622058 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import unicode_literals
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from . import views
# Create a router and register our viewsets with it.
router = DefaultRouter(schema_title='Grocery Lists')
router.register(r'lis... | 0 | 0 | 0 | 0 | 0 | 0 |
dace/libraries/pblas/__init__.py | Walon1998/dace | 227 | 1622074 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
from dace.library import register_library
from .nodes import *
from .environments import *
register_library(__name__, "pblas")
| 0 | 0 | 0 | 0 | 0 | 0 |
joelnet/train.py | joelgrus/joelnet | 312 | 1622146 | """
Here's a function that can train a neural net
"""
from joelnet.tensor import Tensor
from joelnet.nn import NeuralNet
from joelnet.loss import Loss, MSE
from joelnet.optim import Optimizer, SGD
from joelnet.data import DataIterator, BatchIterator
def train(net: NeuralNet,
inputs: Tensor,
targe... | 7 | 1 | 0 | 0 | 8 | 0 |
diffxpy/testing/correction.py | adkinsrs/diffxpy | 111 | 1622147 | <reponame>adkinsrs/diffxpy
import numpy as np
import statsmodels.stats.multitest
def correct(pvals, method="fdr_bh", alpha=0.05):
"""
Performs multiple testing corrections available in statsmodels.stats.multitest.multipletests().
:param pvals: uncorrected p-values. Must be 1-dimensional.
:param metho... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/barcode_tools/helper_functions.py | mostynb/webrtc | 139 | 1622157 | <filename>tools/barcode_tools/helper_functions.py
#!/usr/bin/env python
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property right... | 0 | 0 | 0 | 0 | 0 | 0 |
src/opendr/perception/multimodal_human_centric/rgbd_hand_gesture_learner/algorithm/data.py | ad-daniel/opendr | 217 | 1622163 | # Copyright 2020-2022 OpenDR European 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 required by applicable law or agree... | 2 | 7 | 0 | 0 | 9 | 0 |
tests/test_performance.py | deveil/mrq | 745 | 1622165 | <reponame>deveil/mrq<gh_stars>100-1000
from __future__ import division
from __future__ import print_function
from builtins import str
from builtins import range
from past.utils import old_div
import time
from mrq.queue import Queue
import pytest
import os
import random
@pytest.mark.parametrize(["p_max_latency", "p_mi... | 0 | 0 | 0 | 0 | 0 | 0 |
pangres/examples.py | ThibTrip/pangres | 139 | 1622207 | # +
import random
import datetime
import pandas as pd
from sqlalchemy import (Column, TEXT, FLOAT, BOOLEAN,
JSON, VARCHAR, DATETIME)
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class _TestsExampleTable(Base):
"""
Example table compatible with Postg... | 0 | 1 | 4 | 0 | 5 | 0 |
espnet2/layers/label_aggregation.py | texpomru13/espnet | 5,053 | 1622222 | <reponame>texpomru13/espnet<gh_stars>1000+
import torch
from typeguard import check_argument_types
from typing import Optional
from typing import Tuple
from espnet.nets.pytorch_backend.nets_utils import make_pad_mask
class LabelAggregate(torch.nn.Module):
def __init__(
self,
win_length: int = 512... | 0 | 0 | 0 | 0 | 0 | 0 |
Automaton/PushDown-Automata.py | muthusk07/cs-algorithms | 239 | 1622245 | <gh_stars>100-1000
# A Simple Implementation of Push Down Automaton:
## Defining the 6 tuples:
#> * Q-->finite set of sets
#> * Sigma-->finite set of input alphabet
#> * Gamma-->finite set of stack alphabet
#> * Delta-->transition relation
#> * Q0-->start state
#> * Z-->initial stack symbol
#> * F-->se... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_user_fav.py | mubashshirjamal/code | 1,582 | 1622246 | <filename>tests/test_user_fav.py
# -*- coding: utf-8 -*-
from tests.base import TestCase
from vilya.models.user_fav import UserFavItem
from vilya.models.consts import K_PULL, K_ISSUE
class TestUser(TestCase):
def test_add_fav(self):
user_id = "testuser"
pull_id = 1
kind = K_PULL
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/pyluxcoretools/pyluxcoretools/renderfarm/renderfarmjobsingleimage.py | julescmay/LuxCore | 826 | 1622259 | #!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
# Copyright 1998-2018 by authors (see AUTHORS.txt)
#
# This file is part of LuxCoreRender.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... | 2 | 18 | 0 | 13 | 33 | 0 |
tests/test_results.py | originell/coveragepy | 2,254 | 1622281 | <reponame>originell/coveragepy
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for coverage.py's results analysis."""
import pytest
from coverage.exceptions import CoverageException
from coverage.resul... | 0 | 0 | 0 | 0 | 0 | 0 |
backup_restore.py | lucasschoenhold/nes-py | 128 | 1622289 | from nes_py import NESEnv
import tqdm
env = NESEnv('./nes_py/tests/games/super-mario-bros-1.nes')
done = True
try:
for i in tqdm.tqdm(range(5000)):
if done:
state = env.reset()
done = False
else:
state, reward, done, info = env.step(env.action_space.sample())
... | 0 | 0 | 0 | 0 | 0 | 0 |
ax/utils/testing/pyre_strict.py | viotemp1/Ax | 1,803 | 1622293 | <reponame>viotemp1/Ax
#!/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.
import unittest
from ax.utils.common import testutils
from ax.utils.testing.manifest import Modu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_fuzzyfinder.py | amjith/fuzzyfinder | 389 | 1622332 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_fuzzyfinder
----------------------------------
Tests for `fuzzyfinder` module.
"""
import pytest
from fuzzyfinder import fuzzyfinder
@pytest.fixture
def collection():
return ['migrations.py',
'django_migrations.py',
... | 0 | 0 | 0 | 0 | 0 | 0 |
kibitzr/notifier/slack.py | paulmassen/kibitzr | 478 | 1622334 | <filename>kibitzr/notifier/slack.py
import json
from .webhook import WebHookNotify, webhook_factory
class SlackNotify(WebHookNotify):
CREDS_KEY = 'slack'
def payload(self, report):
return json.dumps({"text": report})
notify_factory = webhook_factory(SlackNotify)
| 0 | 0 | 0 | 0 | 0 | 0 |
notebooks/test_notebooks.py | angriman/network | 366 | 1622337 | #!/usr/bin/env python3
import nbformat
import os
import sys
from nbconvert.preprocessors import ExecutePreprocessor
import asyncio
def run_notebook(path) -> int:
nb_name, _ = os.path.splitext(os.path.basename(path))
dirname = os.path.dirname(path)
with open(path) as f:
nb = nbformat.read(f, as_ver... | 0 | 1 | 0 | 0 | 1 | 0 |
kedro_airflow/plugin.py | 921kiyo/kedro-airflow | 111 | 1622340 | # Copyright 2020 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS", WIT... | 1 | 0 | 0 | 0 | 1 | 0 |
dataviz/euchristmas.py | Udzu/pudzu | 119 | 1622342 | from __future__ import annotations
from pudzu.charts import *
from pudzu.sandbox.bamboo import *
from PIL import ImageEnhance
df = pd.read_csv("datasets/euchristmas.csv").set_index("country")
FONT = sans
PALETTE = {
"D25": VegaPalette10.BLUE,
"J7": VegaPalette10.GREEN,
"J6": VegaPalette10.ORANGE,
"N":... | 0 | 2 | 0 | 0 | 2 | 0 |
RecoBTag/SecondaryVertex/python/pfGhostTrackVertexTagInfos_cfi.py | ckamtsikis/cmssw | 852 | 1622343 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
from RecoBTag.SecondaryVertex.pfSecondaryVertexTagInfos_cfi import *
from RecoBTag.SecondaryVertex.ghostTrackVertexReco_cff import *
pfGhostTrackVertexTagInfos = pfSecondaryVertexTagInfos.clone(
vertexReco = ghostTrackVertexRecoBlock.vertexReco,
... | 0 | 0 | 0 | 0 | 0 | 0 |
accounts/templatetags/tags_fingerprint.py | NGXTDN/webvirtcloud | 1,246 | 1622357 | from __future__ import annotations
import base64
import hashlib
from django import template
register = template.Library()
@register.simple_tag
def ssh_to_fingerprint(line) -> object | str:
try:
key = base64.b64decode(line.strip().split()[1].encode('ascii'))
fp_plain = hashlib.md5(key).hexdigest(... | 0 | 1 | 0 | 0 | 1 | 0 |
mudpi/events/adaptors/mqtt.py | icyspace/mudpi-core | 163 | 1622364 | import json
import time
import random
import paho.mqtt.client as mqtt
from . import Adaptor
class MQTTAdaptor(Adaptor):
""" Provide pubsub events over MQTT """
key = 'mqtt'
connected = False
loop_started = False
callbacks = {}
def connect(self):
""" Make mqtt connection and setup br... | 0 | 0 | 0 | 0 | 0 | 0 |
src/loss.py | xiaoyuliu/AttentionalPoolingAction | 270 | 1622368 | <reponame>xiaoyuliu/AttentionalPoolingAction
import tensorflow as tf
slim = tf.contrib.slim
def gen_losses(
labels_action, logits_action, loss_type_action, num_action_classes,
action_loss_wt,
labels_pose, logits_pose, loss_type_pose, labels_pose_valid, pose_loss_wt,
end_points, cfg):
with tf.name_scope('Los... | 0 | 0 | 0 | 0 | 0 | 0 |
seahub/api2/endpoints/recent_added_files.py | weimens/seahub | 420 | 1622369 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import logging
from datetime import datetime, timedelta
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.authentication import SessionAuthentication
from rest_framework import status
from rest_framework.respon... | 0 | 0 | 0 | 0 | 0 | 0 |
neutron/conf/agent/l2_ext_fdb_population.py | congnt95/neutron | 1,080 | 1622376 | <filename>neutron/conf/agent/l2_ext_fdb_population.py
# Copyright (c) 2016 Mellanox Technologies, Ltd
# 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
#
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/openfermion/testing/testing_utils_test.py | Emieeel/OpenFermion | 1,291 | 1622398 | <filename>src/openfermion/testing/testing_utils_test.py
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | 0 | 0 | 0 | 0 | 0 | 0 |
s3prl/downstream/mos_prediction/expert.py | hhhaaahhhaa/s3prl | 856 | 1622411 | <reponame>hhhaaahhhaa/s3prl<filename>s3prl/downstream/mos_prediction/expert.py
import warnings
from collections import defaultdict
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.stats import pearsonr, spearmanr
import torch
import torch.nn as nn
from torch.distributed import is_initialized
... | 0 | 0 | 0 | 0 | 0 | 0 |
brambox/boxes/detections/detection.py | thesuperorange/task-conditioned | 331 | 1622429 | <gh_stars>100-1000
#
# Copyright EAVISE
#
from enum import Enum
from .. import box as b
from ..annotations import annotation as anno
__all__ = ['Detection', 'ParserType', 'Parser']
class Detection(b.Box):
""" This is a generic detection class that provides some base functionality all detections need.
It ... | 0 | 0 | 0 | 0 | 0 | 0 |
gazebo/pygazebo_classifier.py | joncamp/jetbot_ros | 319 | 1622431 | <reponame>joncamp/jetbot_ros
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import signal
import argparse
import asyncio
import pygazebo
import numpy as np
from PIL import Image
from pynput import keyboard
from datetime import datetime
from navigation_model import NavigationModel
... | 0 | 0 | 0 | 0 | 0 | 0 |
nova/tests/unit/objects/test_instance_numa.py | zjzh/nova | 1,874 | 1622436 | <reponame>zjzh/nova
# 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 writ... | 0 | 0 | 0 | 0 | 0 | 0 |
simba/tkinter_class_test_efficient_scratch.py | justinshenk/simba | 172 | 1622438 | <filename>simba/tkinter_class_test_efficient_scratch.py
import os
import subprocess
#import deeplabcut
import sys
import tkinter
from tkinter import ttk
from tkinter.filedialog import askopenfilename,askdirectory
# from tkinter_functions import greyscale,downsamplevideo,superimposeframe,colorized,shortenvideos,converta... | 0 | 0 | 0 | 0 | 0 | 0 |
workalendar/africa/nigeria.py | macharmi/workalendar | 405 | 1622439 | <reponame>macharmi/workalendar<filename>workalendar/africa/nigeria.py<gh_stars>100-1000
from datetime import date
from ..core import IslamoWesternCalendar, SAT, SUN
from ..registry_tools import iso_register
@iso_register("NG")
class Nigeria(IslamoWesternCalendar):
"Nigeria"
# Civil holidays
include_labo... | 0 | 0 | 0 | 0 | 0 | 0 |
dev/fastai2/_nbdev.py | anhquan0412/fastai_dev | 380 | 1622462 | <reponame>anhquan0412/fastai_dev<gh_stars>100-1000
#AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules"]
index = {"get_master": "18_callback_fp16.ipynb",
"to_master_grads": "18_callback_fp16.ipynb",
"to_model_params": "18_callback_fp16.ipynb",
"test_overflow": "18_callback_fp... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/datetimeParseActions.py | yawor/pyparsing | 1,499 | 1622474 | <gh_stars>1000+
# parseActions.py
#
# A sample program a parser to match a date string of the form "YYYY/MM/DD",
# and return it as a datetime, or raise an exception if not a valid date.
#
# Copyright 2012, <NAME>
#
from datetime import datetime
import pyparsing as pp
from pyparsing import pyparsing_common a... | 0 | 0 | 0 | 0 | 0 | 0 |
fairness/metrics/Diff.py | yashwarlord/fairness-comparison | 146 | 1622480 | from __future__ import annotations
from fairness.metrics.Metric import Metric
class Diff(Metric):
def __init__(self, metric1, metric2):
Metric.__init__(self)
self.metric1 = metric1
self.metric2 = metric2
self.name = "diff:" + self.metric1.get_name() + 'to' + self.metric2.ge... | 0 | 2 | 0 | 0 | 2 | 0 |
netrd/distance/distributional_nbd.py | sdmccabe/netrd | 116 | 1622481 | <reponame>sdmccabe/netrd
"""
distributional_nbd.py
------
Distributional Non-backtracking Spectral Distance.
"""
import numpy as np
import networkx as nx
import scipy.sparse as sp
from scipy.spatial.distance import euclidean, chebyshev
from ..utilities.graph import unweighted
from .base import BaseDistance
class ... | 0 | 0 | 0 | 0 | 0 | 0 |
program_synthesis/karel/dataset/edit_data_loader_test.py | kavigupta/program_synthesis | 123 | 1622483 | import os
import sys
import mock
import pytest
from program_synthesis.karel import arguments
from program_synthesis.karel.dataset import dataset
from program_synthesis.karel.dataset import edit_data_loader
from program_synthesis.karel.models import karel_edit_model
@pytest.fixture
def args() -> object:
with moc... | 0 | 1 | 0 | 0 | 1 | 0 |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/EGL/NV/depth_nonlinear.py | ShujaKhalid/deep-rl | 210 | 1622498 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | 0 | 1 | 0 | 0 | 1 | 0 |
libcloud/dns/drivers/gandi_live.py | Matir/libcloud | 1,435 | 1622538 | # 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 "License"); you may not use ... | 5 | 18 | 3 | 0 | 26 | 0 |
tensorflow_model_optimization/__init__.py | ptesan777/model-optimization | 848 | 1622541 | <reponame>ptesan777/model-optimization
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LIC... | 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib_tests/integration_tests/backtesting/alpha_model_strategy_testers/test_alpha_model_strategy_for_stop_losses_intraday.py | webclinic017/qf-lib | 198 | 1622543 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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 | 1 | 0 | 0 | 1 | 0 |
scout/commands/load/exons.py | Clinical-Genomics/scout | 111 | 1622561 | <reponame>Clinical-Genomics/scout<filename>scout/commands/load/exons.py
import logging
from datetime import datetime
from pprint import pprint as pp
import click
from flask.cli import with_appcontext
from scout.load import load_exons
from scout.server.extensions import store
from scout.utils.handle import get_file_ha... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/compilation/simple_function.py | mathandy/functorch | 279 | 1622562 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from functorch import grad, nnc_jit, make_fx, make_nnc
import torch
import time
def f(x) -> object:
return ... | 2 | 1 | 0 | 0 | 3 | 0 |
csv2ofx/utils.py | sphakka/csv2ofx | 153 | 1622572 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
csv2ofx.utils
~~~~~~~~~~~~~
Provides miscellaneous utility methods
Examples:
literal blocks::
python example_google.py
Attributes:
ENCODING (str): Default file encoding.
"""
from __future__ import (
absolute_import, d... | 3 | 5 | 0 | 0 | 8 | 0 |
contrib/bichengcao/examples/trpo_gym_Pendulum-v0.py | Bobeye/rllab | 1,838 | 1622582 | <filename>contrib/bichengcao/examples/trpo_gym_Pendulum-v0.py
from rllab.algos.trpo import TRPO
from rllab.baselines.linear_feature_baseline import LinearFeatureBaseline
from rllab.envs.gym_env import GymEnv
from rllab.envs.normalized_env import normalize
from rllab.misc.instrument import run_experiment_lite
from rllab... | 0 | 0 | 0 | 0 | 0 | 0 |
PyFunceble/data/alembic/versions/d8893cd406db_allow_whois_record_to_be_empty_null.py | Centaurioun/PyFunceble | 213 | 1622590 | <gh_stars>100-1000
"""Allow whois record to be empty/NULL
Revision ID: <KEY>
Revises: 35c79626ecb9
Create Date: 2020-08-22 17:27:52.087506
"""
from alembic import op
from sqlalchemy.dialects import mysql
# pylint: skip-file
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "35c79626ecb9"
b... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/design-an-expression-tree-with-evaluate-function.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 1622600 | <reponame>Sourav692/FAANG-Interview-Preparation
# Time: O(n)
# Space: O(h)
import abc
from abc import ABCMeta, abstractmethod
class Node:
__metaclass__ = ABCMeta
# define your fields here
@abstractmethod
def evaluate(self):
pass
import operator
class NodeIter(Node):
ops = {'+':oper... | 0 | 0 | 0 | 0 | 0 | 0 |
representations/matrix_serializer.py | ilaine/histwords | 365 | 1622603 | <reponame>ilaine/histwords
import numpy as np
import os
import ioutils as util
def load_matrix(f):
if not f.endswith('.bin'):
f += ".bin"
import pyximport
pyximport.install(setup_args={"include_dirs": np.get_include()})
from representations import sparse_io
return sparse_io.retrie... | 0 | 0 | 0 | 0 | 0 | 0 |
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_projects/signals.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 1622612 | """App signals.
"""
import logging
from django.db.models.signals import pre_save
from django.dispatch import receiver
from ..azure_settings.models import Setting
from .models import Project
logger = logging.getLogger(__name__)
@receiver(
signal=pre_save, sender=Setting, dispatch_uid="delete_project_on_setting... | 0 | 1 | 0 | 0 | 1 | 0 |
bups/fuse/bup.py | emersion/bups | 106 | 1622614 | <filename>bups/fuse/bup.py
from base import FuseBase
import time
class FuseBup(FuseBase):
def __init__(self, worker):
FuseBase.__init__(self)
self.bup = worker
def mount(self, mount_path, parent_path=None):
if parent_path is None and self.bup.get_dir() is None:
raise ValueError("Bup FUSE filesystem requir... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/fr/exc_01_11.py | Jette16/spacy-course | 2,085 | 1622650 | import spacy
# Importe le Matcher
from spacy.____ import ____
nlp = spacy.load("fr_core_news_sm")
doc = nlp("Le constructeur Citröen présente la e-Méhari Courrèges au public.")
# Initialise le matcher avec le vocabulaire partagé
matcher = ____(____.____)
# Crée un motif qui recherche les deux tokens : "e-Méhari" et... | 0 | 0 | 0 | 0 | 0 | 0 |
pogom/pgoapi/protos/POGOProtos/Inventory/InventoryDelta_pb2.py | tier4fusion/pogom-updated | 2,557 | 1622664 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Inventory/InventoryDelta.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... | 0 | 0 | 0 | 0 | 0 | 0 |
saas/system/api/resource/backend-framework/webpy/tesla-faas/teslafaas/container/loader.py | iuskye/SREWorks | 407 | 1622673 | #!/usr/bin/env python
# encoding: utf-8
""" """
from web import Storage
from teslafaas.container.webpy.context_manager import ContextManager
from teslafaas.container.webpy.http_error_process import customize_http_error
import os
import sys
import web
import json
import pkgutil
import logging
import importlib
from cod... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/core/tests/manual_urls.py | pavanv/django-tastypie | 1,570 | 1622693 | <reponame>pavanv/django-tastypie
from django.conf.urls import include, url
from core.tests.resources import NoteResource
note_resource = NoteResource()
urlpatterns = [
url(r'^', include(note_resource.urls)),
]
| 0 | 0 | 0 | 0 | 0 | 0 |
jirafs/types.py | coddingtonbear/jirafs | 119 | 1622703 | <filename>jirafs/types.py
from typing import Dict, Union
JirafsMacroAttributeValue = Union[str, float, bool]
JirafsMacroAttributes = Dict[str, JirafsMacroAttributeValue]
| 0 | 0 | 0 | 0 | 0 | 0 |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/EGL/VERSION/EGL_1_1.py | ShujaKhalid/deep-rl | 210 | 1622708 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | 0 | 1 | 0 | 0 | 1 | 0 |
rlcard/agents/__init__.py | randombenj/rlcard | 1,735 | 1622711 | import subprocess
import sys
from distutils.version import LooseVersion
reqs = subprocess.check_output([sys.executable, '-m', 'pip', 'freeze'])
installed_packages = [r.decode().split('==')[0] for r in reqs.split()]
if 'torch' in installed_packages:
from rlcard.agents.dqn_agent import DQNAgent as DQNAgent
from... | 0 | 0 | 0 | 0 | 0 | 0 |
landmark_and_pose/new_model/detect.py | qaz734913414/arcface-caffe | 296 | 1622716 | import cv2
import numpy as np
import caffe
def get_landmark_net():
net_file = './landmark.prototxt'
caffe_model = './landmark.caffemodel'
caffe.set_mode_gpu()
net = caffe.Net(net_file, caffe_model, caffe.TEST)
return net
def get_pose_landmarks(net , img):
halfheight = img.shape[0] * 0.5
... | 0 | 0 | 0 | 0 | 0 | 0 |
capstone/capdb/migrations/0118_auto_20210816_1521.py | ChefAndy/capstone | 134 | 1622726 | <gh_stars>100-1000
# Generated by Django 3.2.6 on 2021-08-16 15:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('capdb', '0117_extractedcitation_opinion_id'),
]
operations = [
migrations.AddField(
... | 0 | 0 | 0 | 0 | 0 | 0 |
corpus_builder/downloader/download_1juzi.py | JackonYang/maya | 104 | 1622755 | <reponame>JackonYang/maya
# -*- coding:utf-8 -*-
import requests
import re
import codecs
import os
from lxml import etree
from HTMLParser import HTMLParser
h = HTMLParser()
url_ptn = 'http://www.1juzi.com/new/%s.html'
starter_pid = '53377'
downloaded = set()
pid_ptn = re.compile(r'<a href="/new/(\d+).html">')
title... | 0 | 0 | 0 | 0 | 0 | 0 |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/map_buffer_range.py | ShujaKhalid/deep-rl | 210 | 1622783 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | 0 | 1 | 0 | 0 | 1 | 0 |
indra/databases/lincs_client.py | zebulon2/indra | 136 | 1622791 | from __future__ import annotations
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
__all__ = ['get_drug_target_data', 'LincsClient', 'load_lincs_csv']
import os
import sys
import json
import logging
import requests
from io import StringIO, BytesIO
from indra.uti... | 0 | 8 | 0 | 0 | 8 | 0 |
spyder/plugins/completion/providers/languageserver/conftabs/docstring.py | Earthman100/spyder | 7,956 | 1622792 | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Language Server Protocol configuration tabs.
"""
# Standard library imports
import re
# Third party imports
from qtpy.QtCore import Qt, Slot
from qtpy.QtWidgets... | 1 | 1 | 0 | 0 | 2 | 0 |
doc/bash_completion/make_bash_completion.py | zylthinking/nghttp2 | 3,239 | 1622819 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import subprocess
import io
import re
import sys
import os.path
class Option:
def __init__(self, long_opt, short_opt):
self.long_opt = long_opt
self.short_opt = short_opt
def get_all_options(cmd) -> object:
opt_pattern = re.compile(r' (?:(-.), )... | 0 | 1 | 0 | 0 | 1 | 0 |
Breathe/modify_file_names.py | xeddmc/BrainDamage | 1,520 | 1622833 | <gh_stars>1000+
# Rename file
import os
# thisFile = __file__
def local_file(path,filename,newname):
print '[*] Modifying local file'
os.rename(os.path.join(path,filename),os.path.join(path,newname))
def myself(thisFile,newname):
print '[*] Modifying itself'
os.rename(thisFile,newname)
| 0 | 0 | 0 | 0 | 0 | 0 |
graphql_compiler/schema_generation/orientdb/utils.py | manesioz/graphql-compiler | 521 | 1622840 | <reponame>manesioz/graphql-compiler
# Copyright 2019-present Kensho Technologies, LLC.
# Match query used to generate OrientDB records that are themselves used to generate GraphQL schema.
ORIENTDB_SCHEMA_RECORDS_QUERY = (
"SELECT FROM (SELECT expand(classes) FROM metadata:schema) "
"WHERE name NOT IN ['ORole',... | 0 | 0 | 0 | 0 | 0 | 0 |
evaluators/embedding/MinkowskiDistanceEvaluator/tests/test_minkowskidistance.py | carlosb1/jina-hub | 106 | 1622876 | <reponame>carlosb1/jina-hub<gh_stars>100-1000
import pytest
from .. import MinkowskiDistanceEvaluator
@pytest.mark.parametrize(
'doc_embedding, gt_embedding, expected, order',
[
([0, 0], [0, 0], 0.0, 3),
([0, 0], [0, 1], 1.0, 3),
([0, 0], [1, 0], 1.0, 3),
([0, 1], [0, 1], 0.0,... | 0 | 0 | 0 | 0 | 0 | 0 |
Sniffer-v2.0-Py3.x/Toolbox/FileTools.py | gavin-thun/Sniffer | 154 | 1622896 | <reponame>gavin-thun/Sniffer
#encoding: utf8
import os
from Toolbox.ColorTools import *
import subprocess
import time
import traceback
def InitPktsFile(sfilename):
os.mkdir('./Pkts/%s' %sfilename)
def ErrorDog(Exit):
error = '\n'.join(['\n[X]%s' %putColor('Something went wrong', 'red'),
... | 0 | 0 | 0 | 0 | 0 | 0 |
park/unittest/test_cache.py | utkarsh5k/park | 180 | 1622904 | <gh_stars>100-1000
import unittest
from park.unittest.run_env import run_env_with_random_agent
import park
from park.param import config
class TestCache(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.env_name = 'cache'
def test_trace_recency(sel... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_packages/test_skills/test_fetch_beacon/test_handlers.py | devjsc/agents-aea | 126 | 1622907 | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | 1 | 1 | 1 | 0 | 3 | 0 |
Week13/1038.py | bobsingh149/LeetCode | 101 | 1622929 | <filename>Week13/1038.py
### DO NOT REMOVE THIS
from typing import List
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
### DO NOT REMOVE THIS
# Definition for a binary tree node.
# clas... | 0 | 0 | 0 | 0 | 0 | 0 |
test cases/python/1 basic/subdir/subprog.py | kira78/meson | 4,047 | 1622938 | #!/usr/bin/env python3
# In order to run this program, PYTHONPATH must be set to
# point to source root.
from gluon import gluonator
print('Running mainprog from subdir.')
if gluonator.gluoninate() != 42:
raise ValueError("!= 42")
| 0 | 0 | 0 | 0 | 0 | 0 |
stylize_video.py | jahnog/eridgd-WCT-TF | 320 | 1622947 | # Adapted from https://github.com/lengstrom/fast-style-transfer/blob/master/evaluate.py
from __future__ import print_function,division
import argparse
import sys
import os, random, subprocess, shutil, time
import numpy as np
import json
import scipy
from utils import preserve_colors_np
from utils import get_files, get... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/decorator/function1.py | MoonStarCZW/py2rb | 124 | 1622953 |
class wrapper:
def __init__(self,fn):
self.fn = fn
def __call__(self,*args) -> object:
return "(" + self.fn(*args) + ")"
def mydecorator(x) -> object:
print("decorating " + str(x))
return wrapper(x)
def describe() -> str:
return "world"
describe = mydecorator(describe)
print(d... | 0 | 3 | 0 | 0 | 3 | 0 |
budou/__version__.py | google/budou | 1,174 | 1622957 | VERSION = (0, 9, 8)
__version__ = '.'.join(map(str, VERSION))
| 0 | 0 | 0 | 0 | 0 | 0 |
src/popper/translators/translator.py | systemslab/popper | 179 | 1622962 | class WorkflowTranslator(object):
"""Base class for translators."""
def __init__(self):
pass
def translate(self, wf):
raise NotImplementedError("Needs implementation in derived classes.")
@staticmethod
def get_translator(service_name) -> object:
from popper.translators.tra... | 0 | 1 | 0 | 0 | 1 | 0 |
experiments/urls.py | PetrDlouhy/django-experiments | 237 | 1622976 | from django.conf.urls import url
from experiments import views
urlpatterns = [
url(r'^goal/(?P<goal_name>[^/]+)/(?P<cache_buster>[^/]+)?$', views.record_experiment_goal, name="experiment_goal"),
url(r'^confirm_human/$', views.confirm_human, name="experiment_confirm_human"),
url(r'^change_alternative/(?P<ex... | 0 | 0 | 0 | 0 | 0 | 0 |
pyzx/tensor.py | mnm-team/pyzx-heuristics | 219 | 1623011 | # PyZX - Python library for quantum circuit rewriting
# and optimization using the ZX-calculus
# Copyright (C) 2018 - <NAME> and <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
... | 20 | 11 | 1 | 0 | 32 | 0 |
dassl/modeling/ops/mixup.py | weiliuxm/Dassl.pytorch | 563 | 1623034 | <filename>dassl/modeling/ops/mixup.py
import torch
def mixup(x1, x2, y1, y2, beta, preserve_order=False):
"""Mixup.
Args:
x1 (torch.Tensor): data with shape of (b, c, h, w).
x2 (torch.Tensor): data with shape of (b, c, h, w).
y1 (torch.Tensor): label with shape of (b, n).
y2 (... | 0 | 0 | 0 | 0 | 0 | 0 |
DataServer/DataServer.py | ajransaputra/geoip-attack-map | 299 | 1623049 | #!/usr/bin/python3
from __future__ import annotations
"""
AUTHOR: <NAME> - <EMAIL>
"""
# Imports
import json
#import logging
import maxminddb
#import re
import redis
import io
from const import META, PORTMAP
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from os import getuid
from sys import exit
... | 0 | 9 | 0 | 0 | 9 | 0 |
tests/core/objects/test_evaluation.py | zyfra/ebonite | 270 | 1623053 | import typing
import numpy as np
import pytest
from ebonite.core.objects import Model, ModelWrapper
from ebonite.core.objects.artifacts import Blobs
from ebonite.core.objects.core import EvaluationResults
from ebonite.core.objects.metric import Metric
from ebonite.core.objects.wrapper import PickleModelIO
class Eva... | 4 | 16 | 0 | 0 | 20 | 0 |
simpleRaft/boards/redis_board.py | cynikolai/BFTRaft | 258 | 1623066 | import redis
from board import Board
class RedisBoard(Board):
"""This will create a message board that is backed by Redis."""
def __init__(self, *args, **kwargs):
"""Creates the Redis connection."""
self.redis = redis.Redis(*args, **kwargs)
def set_owner(self, owner):
self.owner ... | 0 | 1 | 0 | 0 | 1 | 0 |
scripts/demo_datasets.py | krshrimali/Open3D-ML | 346 | 1623068 | <filename>scripts/demo_datasets.py
import logging
from open3d.ml.datasets import (SemanticKITTI, ParisLille3D, Semantic3D, S3DIS,
Toronto3D)
import argparse
import numpy as np
def parse_args():
parser = argparse.ArgumentParser(description='Read from datasets')
parser.add_argume... | 0 | 0 | 0 | 0 | 0 | 0 |
sandbox/gkahn/gcg/exploration_strategies/gaussian_strategy.py | ICRA-2018/gcg | 120 | 1623078 | import numpy as np
from rllab.core.serializable import Serializable
from rllab.exploration_strategies.base import ExplorationStrategy
from sandbox.rocky.tf.spaces.box import Box
from sandbox.gkahn.gcg.utils import schedules
class GaussianStrategy(ExplorationStrategy, Serializable):
"""
Add gaussian noise
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/ralph/networks/filters.py | DoNnMyTh/ralph | 1,668 | 1623105 | import ipaddress
import re
from django.contrib import messages
from django.contrib.admin.options import IncorrectLookupParameters
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from ralph.admin.filters import (
ChoicesListFilter,
SEARCH_OR_SEPARATORS_REGEX,
TextListF... | 0 | 5 | 2 | 0 | 7 | 0 |
roletools/settings.py | fixator10/Trusty-cogs | 148 | 1623158 | import logging
from typing import Optional, Union
from redbot.core import commands, bank
from redbot.core.i18n import Translator
from redbot.core.commands import Context
from .converter import RoleHierarchyConverter
from .abc import RoleToolsMixin, roletools
log = logging.getLogger("red.Trusty-cogs.RoleTools")
_ = T... | 19 | 7 | 0 | 0 | 26 | 0 |
extraPackages/Pillow-6.0.0/Tests/test_lib_pack.py | dolboBobo/python3_ios | 130 | 1623160 | import sys
from .helper import PillowTestCase
from PIL import Image
X = 255
class TestLibPack(PillowTestCase):
def assert_pack(self, mode, rawmode, data, *pixels):
"""
data - either raw bytes with data or just number of bytes in rawmode.
"""
im = Image.new(mode, (len(pixels), 1... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.