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 |
|---|---|---|---|---|
aix360/algorithms/lbbe.py | PurplePean/AIX360 | 609 | 11103357 | import abc
import sys
# Ensure compatibility with Python 2/3
if sys.version_info >= (3, 4):
ABC = abc.ABC
else:
ABC = abc.ABCMeta(str('ABC'), (), {})
class LocalBBExplainer(ABC):
"""
LocalBBExplainer is the base class for local post-hoc black-box explainers (LBBE).
Such explainers are ... |
extra_tests/snippets/stdlib_re.py | mainsail-org/RustPython | 11,058 | 11103368 |
import re
haystack = "Hello world"
needle = 'ello'
mo = re.search(needle, haystack)
print(mo)
# Does not work on python 3.6:
assert isinstance(mo, re.Match)
assert mo.start() == 1
assert mo.end() == 5
assert re.escape('python.exe') == 'python\\.exe'
p = re.compile('ab')
s = p.sub('x', 'abcabca')
# print(s)
assert... |
wagtailmenus/apps.py | pierremanceaux/wagtailmenus | 329 | 11103374 | from django.apps import AppConfig
class WagtailMenusConfig(AppConfig):
name = 'wagtailmenus'
verbose_name = 'WagtailMenus'
|
examples/issues/so_recursion.py | tgolsson/appJar | 666 | 11103432 | import sys
sys.path.append("../../")
from appJar import gui
def loginButton(button):
if button == "Cancel":
app.stop()
else:
usr = app.getEntry("Username")
pwd = app.getEntry("Password")
login(usr,pwd)
def login(usr,pwd):
if usr == "1" and pwd == "1":
app.hide()
... |
scripts/automation/trex_control_plane/interactive/trex/wireless/examples/trex_path.py | timgates42/trex-core | 956 | 11103434 | import sys, os
cur_dir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(cur_dir, os.pardir))
sys.path.insert(0, os.path.join(cur_dir, os.pardir, os.pardir))
sys.path.insert(0, os.path.join(cur_dir, os.pardir, os.pardir, os.pardir)) |
bmtk/tests/builder/auxi/test_node_params.py | aaberbach/bmtk | 216 | 11103507 | <reponame>aaberbach/bmtk
import pytest
import numpy as np
from bmtk.builder.auxi.node_params import positions_columinar, positions_cuboid, positions_list
def test_positions_columinar():
np.random.seed(1)
points = positions_columinar(N=10, center=[0.0, 0.0, 0.0], height=10.0, min_radius=1.0, max_radius=2.0)
... |
tests/test_service_catalog/test_views/test_customer/test_instance/test_instance_request_operation.py | Sispheor/squest | 112 | 11103542 | <gh_stars>100-1000
from django.urls import reverse
from service_catalog.models import Request
from service_catalog.models.instance import InstanceState
from tests.test_service_catalog.base_test_request import BaseTestRequest
class TestCustomerInstanceRequestOperation(BaseTestRequest):
def setUp(self):
s... |
kuryr_kubernetes/handlers/health.py | digitalsimboja/kuryr-kubernetes | 155 | 11103638 | <reponame>digitalsimboja/kuryr-kubernetes
# Copyright 2018 <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
ee/connectors/db/loaders/clickhouse_loader.py | nogamenofun98/openreplay | 3,614 | 11103646 | <reponame>nogamenofun98/openreplay
def insert_to_clickhouse(db, df, table: str):
df.to_sql(table, db.engine, if_exists='append', index=False)
|
src/dispatch/report/enums.py | roor0/dispatch | 3,417 | 11103669 | from dispatch.enums import DispatchEnum
class ReportTypes(DispatchEnum):
tactical_report = "Tactical Report"
executive_report = "Executive Report"
|
moviemon/__init__.py | toxygen/moviemon | 207 | 11103680 | <reponame>toxygen/moviemon
from .moviemon import main
|
naomi/__main__.py | kowo-zahl/Naomi | 194 | 11103701 | # -*- coding: utf-8 -*-
import sys
import logging
import argparse
from . import application
from . import app_utils
from . import coloredformatting as cf
from . import i18n
from . import paths
from . import profile
logo = cf.naomidefaults.logo
sto = cf.naomidefaults.sto
USE_STANDARD_MIC = application.USE_STANDARD_MIC... |
api/chalicelib/core/errors.py | nogamenofun98/openreplay | 3,614 | 11103708 | import json
from chalicelib.core import sourcemaps, sessions
from chalicelib.utils import pg_client, helper, dev
from chalicelib.utils.TimeUTC import TimeUTC
from chalicelib.utils.metrics_helper import __get_step_size
def get(error_id, family=False):
if family:
return get_batch([error_id])
with pg_cl... |
tests/resources/test_worklog.py | Glushiator/jira | 1,639 | 11103709 | from tests.conftest import JiraTestCase
class WorklogTests(JiraTestCase):
def setUp(self):
JiraTestCase.setUp(self)
self.issue_1 = self.test_manager.project_b_issue1
self.issue_2 = self.test_manager.project_b_issue2
self.issue_3 = self.test_manager.project_b_issue3
def test_wo... |
buildroot/support/testing/tests/package/test_perl_html_parser.py | superm1/operating-system | 349 | 11103725 | <filename>buildroot/support/testing/tests/package/test_perl_html_parser.py
from tests.package.test_perl import TestPerlBase
class TestPerlHTMLParser(TestPerlBase):
"""
package:
HTML-Parser XS
direct dependencies:
HTML-Tagset
"""
config = TestPerlBase.config + \
"""
... |
djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/spotify/provider.py | DemarcusL/django_wiki_lab | 6,342 | 11103748 | from allauth.socialaccount import app_settings
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class SpotifyAccount(ProviderAccount):
def get_profile_url(self):
return self.account.extra_data.get("external_urls").g... |
sequana/freebayes_bcf_filter.py | khourhin/sequana | 138 | 11103752 | #
# This file is part of Sequana software
#
# Copyright (c) 2016-2021 - Sequana Development Team
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# website: https://github.com/sequana/sequana
# documentation: http://sequana.r... |
xyjxyf/show_me_the_code.py | saurabh896/python-1 | 3,976 | 11103771 | # coding = utf-8
from tools import imager
from PIL import ImageFont
# 第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字
def add_num(image_path):
im = imager.open_image(image_path)
if im is not None:
font = ImageFont.truetype('Arial.ttf', 20)
w, h = im.size
point = (w - 10, 0)
imager.draw_t... |
veles/loader/saver.py | AkshayJainG/veles | 1,007 | 11103786 | <gh_stars>1000+
# -*- coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Jan 23, 2015
Defines classes to save... |
sfaira/data/interactive/loader.py | theislab/sfaira | 110 | 11103792 | <reponame>theislab/sfaira
import anndata
from typing import Union
from sfaira.data import DatasetBase
class DatasetInteractive(DatasetBase):
def __init__(
self,
data: anndata.AnnData,
organism: str,
organ: str,
gene_symbol_col: Union[str, None] = 'inde... |
tests/test_choices_display_option.py | mfogel/django-timezone-field | 263 | 11103796 | import pytest
import pytz
from django import forms
from django.db import models
from timezone_field import TimeZoneField, TimeZoneFormField
common_tz_names = tuple(tz for tz in pytz.common_timezones)
common_tz_objects = tuple(pytz.timezone(tz) for tz in pytz.common_timezones)
class ChoicesDisplayForm(forms.Form):... |
enferno/public/views.py | rovak73/enferno | 373 | 11103808 | from flask import Flask, request, abort, Response, redirect, url_for, flash, Blueprint, send_from_directory
from flask.templating import render_template
from flask_security.decorators import roles_required, login_required
bp_public = Blueprint('public',__name__, static_folder='../static')
@bp_public.after_request
def ... |
数值分析/t22.py | jasnzhuang/Personal-Homework | 463 | 11103820 | import scipy.optimize
def newton(f, fp, x0, delta=1e-4):
cnt = 0
x = x0
print('x0 = %.10lf' % x0)
while abs(f(x)) > delta or abs(x - x0) > delta:
s = f(x) / fp(x)
x0, x = x, x - s
lbd = 1
while abs(f(x)) >= abs(f(x0)):
x = x0 - lbd * s
lbd /= 2
cnt += 1
print('x%d = %.10lf, lambda = %.10lf' % (cn... |
experiment/__init__.py | Octavian-ai/mac-graph | 116 | 11103847 | <filename>experiment/__init__.py
from .args import get_args
from .estimator_worker_test import EstimatorWorkerTestCase
|
setup.py | sha256/python-var-dump | 147 | 11103848 | from distutils.core import setup
setup(
name='var_dump',
version='1.2',
packages=['var_dump'],
url='http://github.com/sha256/python-var-dump',
license='BSD',
author='<NAME>',
author_email='<EMAIL>',
description='var_dump for python',
download_url='http://github.com/sha256... |
backend/cloud_inquisitor/data/migrations/versions/cfb0ed4cced9_new_accounts_table.py | MrSecure/cloud-inquisitor | 462 | 11103863 | """New accounts table
Revision ID: cfb0ed4cced9
Revises: <PASSWORD>cdfbc<PASSWORD>
Create Date: 2018-07-10 13:26:01.588708
"""
from json import dumps as to_json
from alembic import op
import sqlalchemy as sa
from sqlalchemy import text, inspect
from sqlalchemy.dialects import mysql
# revision identifiers, used by ... |
src/GridCal/Engine/Devices/templates.py | mzy2240/GridCal | 284 | 11103892 | # This file is part of GridCal.
#
# GridCal is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GridCal is distributed in the hope that... |
src/oci/database_management/models/cluster_cache_metric.py | Manny27nyc/oci-python-sdk | 249 | 11103912 | <reponame>Manny27nyc/oci-python-sdk<filename>src/oci/database_management/models/cluster_cache_metric.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.... |
wip/extract_dependencies/createS3Bucket.py | nitish-raj/data-science-on-aws | 163 | 11103963 | #!/usr/bin/env python
# coding: utf-8
# # Create S3 Bucket
# In[ ]:
#from IPython import get_ipython
import boto3
import sagemaker
import pandas as pd
import numpy as np
import tensorflow
session = boto3.session.Session()
region = session.region_name
sagemaker_session = sagemaker.Session()
bucket = sagemaker_sess... |
nabu/scripts/data.py | AzizCode92/nabu | 117 | 11103970 | '''@file data.py
does the data preperation'''
import os
from six.moves import configparser
import gzip
import tensorflow as tf
from nabu.processing.processors import processor_factory
from nabu.processing.tfwriters import tfwriter_factory
def main(expdir):
'''main function'''
#read the data conf file
par... |
src/deepsparse/lib.py | Willtor/deepsparse | 460 | 11103979 | # Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... |
plugins/lib/__init__.py | otherbeast/hackers-tool-kit | 1,103 | 11103985 | <reponame>otherbeast/hackers-tool-kit<filename>plugins/lib/__init__.py
__all__ = ["markup", "graphs", "hostchecker"]
|
mistral/tests/unit/test_command_dispatcher.py | soda-research/mistral | 205 | 11103987 | # Copyright 2013 - Mirantis, Inc.
# Copyright 2015 - StackStorm, 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
#
# Unl... |
enaml/qt/docking/xbms.py | xtuzy/enaml | 1,080 | 11104009 | #------------------------------------------------------------------------------
# Copyright (c) 2013-2018, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------... |
robel/utils/testing/mock_time.py | Del9fina/robel | 109 | 11104042 | # Copyright 2019 The ROBEL 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 applicable law or agreed to in wr... |
tests/test_linter.py | Jean-Daniel/kapitan | 1,413 | 11104050 | #!/usr/bin/env python3
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <<EMAIL>>
#
# SPDX-License-Identifier: Apache-2.0
"linter tests"
import logging
import unittest
from kapitan.lint import start_lint
logging.basicConfig(level=logging.CRITICAL, format="%(message)s")
logger... |
python/veles/async_conn/tracer.py | pombredanne/veles | 918 | 11104056 | <reponame>pombredanne/veles<gh_stars>100-1000
# Copyright 2017 CodiLime
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
pwndbg/commands/version.py | R2S4X/pwndbg | 287 | 11104077 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Displays gdb, python and pwndbg versions.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import gdb
import pwndbg
import pwndbg.color
import pwndbg.c... |
benchmarks/export.py | sethvargo/vaex | 337 | 11104088 | <reponame>sethvargo/vaex
import tempfile
import os
import numpy as np
import vaex
df = None
def setup_df(N, M):
global df
x = [np.arange(N, dtype=np.float64) for _ in range(M)]
df = vaex.from_dict({
f'c{i}': x[i] for i in range(M)
})
def time_export_plain(N, M):
with tempfile.Temporary... |
public-engines/image-classification-engine/tests/training/test_metrics_evaluator.py | tallandroid/incubator-marvin | 101 | 11104100 | #!/usr/bin/env python
# coding=utf-8
try:
import mock
except ImportError:
import unittest.mock as mock
import numpy as np
from marvin_image_classification_engine.training import MetricsEvaluator
@mock.patch('marvin_image_classification_engine.training.metrics_evaluator.sk_metrics.accuracy_score')
@mock.pat... |
man/src/filter_demo_output.py | stdft112/depot_tools | 2,151 | 11104118 | <reponame>stdft112/depot_tools
#!/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.
import collections
import os
import re
import sys
from xml.sax.saxutils import escape
from cStringIO i... |
emissary/controllers/log.py | LukeB42/Emissary | 193 | 11104143 | <reponame>LukeB42/Emissary<filename>emissary/controllers/log.py<gh_stars>100-1000
"""
This file provides a generic logging class.
It could do with automatic file rotation and syslog support.
<NAME> 2015
MIT License.
"""
import logging, time
class Log(object):
def __init__(self, program, log_file=None, log_stdout=Fal... |
climlab/dynamics/adv_diff_numerics.py | nfeldl/climlab | 160 | 11104145 | r'''
The 1D advection-diffusion problem
----------------------------------
The equation to be solved is
.. math::
\frac{\partial}{\partial t} \psi(x,t) &= -\frac{1}{w(x)} \frac{\partial}{\partial x} \left[ w(x) ~ \mathcal{F}(x,t) \right] + \dot{\psi}\\
\mathcal{F} &= U(x) \psi(x) -K(x) ~ \frac{\partial \psi}... |
ida_plugin/uefi_analyser/dep_browser.py | fengjixuchui/UEFI_RETool | 240 | 11104158 | # SPDX-License-Identifier: MIT
import json
import ida_kernwin
import idaapi
import idautils
import idc
from idaapi import Choose
from .utils import get_dep_json
NAME = "UEFI_RETool"
class chooser_handler_t(idaapi.action_handler_t):
def __init__(self, thing):
idaapi.action_handler_t.__init__(self)
... |
examples/decorators/decorator_count_exceptions.py | JacobHenner/aioprometheus | 104 | 11104167 | <reponame>JacobHenner/aioprometheus<filename>examples/decorators/decorator_count_exceptions.py
#!/usr/bin/env python
"""
.. code-block:: python
$ python decorator_count_exceptions.py
The example script can be tested using ``curl``.
.. code-block:: console
$ curl :8000/metrics
# HELP request_handler_exc... |
housekeep.py | kasimov-maxim/aiosmtpd | 257 | 11104170 | #!/usr/bin/env python3
# Copyright 2014-2021 The aiosmtpd Developers
# SPDX-License-Identifier: Apache-2.0
import argparse
import inspect
import os
import pprint
import shutil
import sys
from pathlib import Path
try:
# noinspection PyPackageRequirements
from colorama import ( # pytype: disable=import-error
... |
DevTools/glueToStrip.py | spiiin/CadEditor | 164 | 11104173 | <reponame>spiiin/CadEditor<gh_stars>100-1000
#Script for glue all png images inside folder to one strip file with name "strip.png"
#Uses python clr module and PIL library
import sys, os
cadEditorDir = os.path.abspath("../CadEditor/") + "/"
sys.path.append(cadEditorDir)
import clr
clr.AddReference("CadEditor")
clr.Ad... |
tests/v1/nodes.py | tombry/virlutils | 133 | 11104179 | <filename>tests/v1/nodes.py<gh_stars>100-1000
from . import BaseTest
from click.testing import CliRunner
import requests_mock
from virl.cli.main import virl
class NodesTest(BaseTest):
def mock_response(self):
sim_response = {
"guest|TEST_ENV|virl|router1": {
"Status": "ACTIVE"... |
function_scheduling_distributed_framework/function_result_web/app.py | ydf0509/distributed_framework | 333 | 11104197 | <reponame>ydf0509/distributed_framework
# -*- coding: utf-8 -*-
# @Author : ydf
# @Time : 2019/9/18 0018 14:46
import datetime
import json
from flask import render_template, Flask, request, url_for, jsonify, flash, redirect
from flask_bootstrap import Bootstrap
from flask_wtf import FlaskForm
from wtforms import ... |
protonfixes/gamefixes/253230.py | Citiroller/protonfixes | 213 | 11104217 | <reponame>Citiroller/protonfixes
""" Game fix for A Hat in Time
"""
#pylint: disable=C0103
from protonfixes import util
from protonfixes.protonversion import DeprecatedSince
@DeprecatedSince("5.0-3")
def main():
""" Enables D9VK
"""
util.enable_d9vk()
|
python-for-multimedia/extract-frames-from-video/extract_frames_opencv.py | caesarcc/python-code-tutorials | 1,059 | 11104237 | from datetime import timedelta
import cv2
import numpy as np
import os
# i.e if video of duration 30 seconds, saves 10 frame per second = 300 frames saved in total
SAVING_FRAMES_PER_SECOND = 10
def format_timedelta(td):
"""Utility function to format timedelta objects in a cool way (e.g 00:00:20.05)
omitting ... |
nebullvm/inference_learners/__init__.py | nebuly-ai/nebullvm | 821 | 11104245 | # flake8: noqa
from nebullvm.inference_learners.base import (
BaseInferenceLearner,
LearnerMetadata,
PytorchBaseInferenceLearner,
TensorflowBaseInferenceLearner,
InferenceLearnerWrapper,
)
from nebullvm.inference_learners.onnx import (
ONNXInferenceLearner,
PytorchONNXInferenceLearner,
... |
QAdemo_base1/tmodel2.py | WenRichard/QAmodel-for-Retrivalchatbot | 403 | 11104282 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Time : 2019/4/4 15:03
# @Author : Alan
# @Email : <EMAIL>
# @File : tmodel2.py
# @Software: PyCharm
""" 利用倒排表进行优化 """
import pandas as pd
import matplotlib as mpl
import numpy as np
from nltk.probability import FreqDist
import time
from jiebaSegment import *
fro... |
examples/constrained_decoding/tok.py | kayoyin/DialogueMT | 143 | 11104291 | #!/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 sys
import sacremoses
def main(args):
"""Tokenizes, preserving tabs"""
mt = sacremoses.MosesTokenize... |
examples/code/data/corpus_twenty_news.py | chschroeder/small-text | 218 | 11104322 | <reponame>chschroeder/small-text<gh_stars>100-1000
from sklearn.datasets import fetch_20newsgroups
def get_twenty_newsgroups_corpus(categories=['rec.sport.baseball', 'rec.sport.hockey']):
train = fetch_20newsgroups(subset='train', remove=('headers', 'footers', 'quotes'),
categories... |
tests/misc/sys_settrace_subdir/sys_settrace_generic.py | sebastien-riou/micropython | 13,648 | 11104324 | <reponame>sebastien-riou/micropython<filename>tests/misc/sys_settrace_subdir/sys_settrace_generic.py
print("Now comes the language constructions tests.")
# function
def test_func():
def test_sub_func():
print("test_function")
test_sub_func()
# closure
def test_closure(msg):
def make_closure():
... |
contrib/to-rm-mx-contrib-text/d2lzh/text/vocab.py | luzhongqiu/d2l-zh | 27,074 | 11104331 | class Vocabulary:
def __init__(self, counter, min_freq=0, reserved_tokens=None):
if reserved_tokens is None:
reserved_tokens = []
# Sort according to frequencies
self.token_freqs = sorted(counter.items(), key=lambda x: x[0])
self.token_freqs.sort(key=lambda x: x[1], rever... |
recipes/Python/52208_Replace_if_while_statement_expressions/recipe-52208.py | tdiprima/code | 2,023 | 11104351 | Before:
if i < 1:
doSomething()
After:
if 0: # i< 1
doSomething()
|
crawler/tests/test_log_retry_middleware.py | shinji-s/scrapy-cluster | 1,108 | 11104390 | <reponame>shinji-s/scrapy-cluster<gh_stars>1000+
'''
Offline tests
'''
from unittest import TestCase
import mock
from mock import MagicMock
from crawling.log_retry_middleware import LogRetryMiddleware
class TestLogRetryMiddlewareStats(TestCase):
@mock.patch('crawling.log_retry_middleware.LogRetryMiddleware' \
... |
pl_bolts/models/rl/sac_model.py | lavoiems/lightning-bolts | 504 | 11104398 | <reponame>lavoiems/lightning-bolts
"""Soft Actor Critic."""
import argparse
from typing import Dict, List, Tuple
import numpy as np
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from torch import Tensor, optim
from torch.nn ... |
tests/test_jupyter.py | traviscook21/rich | 33,622 | 11104455 | from rich.console import Console
def test_jupyter():
console = Console(force_jupyter=True)
assert console.width == 93
assert console.color_system == "truecolor"
|
lv_set/potential_func.py | Ramesh-X/Level-Set | 122 | 11104505 | <reponame>Ramesh-X/Level-Set
"""
This python code demonstrates an edge-based active contour model as an application of the
Distance Regularized Level Set Evolution (DRLSE) formulation in the following paper:
<NAME>, <NAME>, <NAME>, <NAME>, "Distance Regularized Level Set Evolution and Its Application to Image Segmen... |
obsei/process_workflow.py | kuutsav/obsei | 359 | 11104516 | <gh_stars>100-1000
import logging
from obsei.configuration import ObseiConfiguration
logger = logging.getLogger(__name__)
# Extract config via yaml file using `config_path` and `config_filename`
obsei_configuration = ObseiConfiguration()
# Initialize objects using configuration
source_config = obsei_configuration.i... |
test/small_test.py | screamingskulls/sofi | 402 | 11104536 | <gh_stars>100-1000
from sofi.ui import Small
def test_basic():
assert(str(Small()) == "<small></small>")
def test_text():
assert(str(Small("text")) == "<small>text</small>")
def test_custom_class_ident_style_and_attrs():
assert(str(Small("text", cl='abclass', ident='123', style="font-size:0.9em;", attrs=... |
src/listeners/hover_description.py | PranjalPansuriya/JavaScriptEnhancements | 690 | 11104540 | import sublime, sublime_plugin
import cgi, os, re
from ..libs import NodeJS
from ..libs.popup_manager import popup_manager
from .completion import load_default_autocomplete
from ..libs import FlowCLI
from ..libs import util
hover_description_css = ""
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "... |
kpm/api/info.py | ericchiang/kpm | 121 | 11104554 | <filename>kpm/api/info.py
from flask import (jsonify, request, Blueprint, redirect, render_template, current_app, url_for)
import kpm
import appr
info_app = Blueprint('info', __name__) # pylint: disable=C0103
@info_app.before_app_request
def pre_request_logging():
jsonbody = request.get_json(force=True, silent=... |
xfdnn/rt/xdnn_opt.py | yarenty/ml-suite | 334 | 11104597 | #!/usr/bin/env python
#
# // SPDX-License-Identifier: BSD-3-CLAUSE
#
# (C) Copyright 2018, Xilinx, Inc.
#
import copy
import pydot
import sys
from json import loads as _loads
from collections import defaultdict, OrderedDict
from os.path import exists as _exists
from six import string_types as _string_types
import opera... |
Connectors/src/PostgreSql/scaffold/cloudfoundry.py | aTiKhan/Samples-1 | 643 | 11104628 | <reponame>aTiKhan/Samples-1<gh_stars>100-1000
from pysteel import cloudfoundry
def setup(context):
"""
:type context: behave.runner.Context
"""
cf = cloudfoundry.CloudFoundry(context)
# remove previous app
app = 'postgres-connector'
cf.delete_app(app)
# create service
service = 'po... |
lldb/packages/Python/lldbsuite/test/lang/cpp/nested-class-other-compilation-unit/TestNestedClassWithParentInAnotherCU.py | medismailben/llvm-project | 2,338 | 11104645 | <gh_stars>1000+
"""
Test that the expression evaluator can access members of nested classes even if
the parents of the nested classes were imported from another compilation unit.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class Tes... |
trpo/fxn_approx.py | DanielTakeshi/rl_algorithms | 150 | 11104654 | <reponame>DanielTakeshi/rl_algorithms<filename>trpo/fxn_approx.py
"""
This will make some function approximators that we can use, particularly: linear
and neural network value functions. Instantiate instances of these in other
pieces of the code base.
(c) April 2017 by <NAME>, built upon `starter code` from <NAME>.
""... |
tests/cupyx_tests/scipy_tests/special_tests/test_erf.py | svlandeg/cupy | 6,180 | 11104658 | import unittest
import numpy
import cupy
from cupy import testing
import cupyx.scipy.special # NOQA
def _boundary_inputs(boundary, rtol, atol):
left = boundary * (1 - numpy.copysign(rtol, boundary)) - atol
right = boundary * (1 + numpy.copysign(rtol, boundary)) + atol
return [left, boundary, right]
c... |
test/interop/python/multilocale/use_checkMultipleLocales.py | jhh67/chapel | 1,602 | 11104665 | <reponame>jhh67/chapel
import checkMultipleLocales
checkMultipleLocales.chpl_setup(4)
checkMultipleLocales.foo(2)
checkMultipleLocales.chpl_cleanup()
|
platypush/message/response/chat/telegram.py | RichardChiang/platypush | 228 | 11104723 | <gh_stars>100-1000
import datetime
from typing import Optional, List
from platypush.message.response import Response
class TelegramMessageResponse(Response):
def __init__(self,
message_id: int,
chat_id: int,
creation_date: Optional[datetime.datetime],
... |
tests/node_converters/concat_test.py | niobeus/onnx2torch | 144 | 11104725 | <filename>tests/node_converters/concat_test.py
from itertools import product
from typing import List
import numpy as np
import onnx
from onnx.helper import make_tensor_value_info
from onnx.mapping import NP_TYPE_TO_TENSOR_TYPE
from tests.utils.common import check_onnx_model
from tests.utils.common import make_model_f... |
anki_vector/messaging/__init__.py | rmcolbert/vector-python-sdk | 516 | 11104794 | <reponame>rmcolbert/vector-python-sdk<gh_stars>100-1000
# Copyright (c) 2018 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.or... |
{{cookiecutter.project_slug}}/backend/app/app/main.py | Gjacquenot/full-stack-fastapi-couchbase | 353 | 11104829 | from fastapi import FastAPI
from starlette.middleware.cors import CORSMiddleware
from app.api.api_v1.api import api_router
from app.core import config
app = FastAPI(title=config.PROJECT_NAME, openapi_url="/api/v1/openapi.json")
# CORS
origins = []
# Set all CORS enabled origins
if config.BACKEND_CORS_ORIGINS:
o... |
python/tests/wrapper/test_10_attach_model.py | MelLain/bigartm | 638 | 11104836 | <filename>python/tests/wrapper/test_10_attach_model.py
# Copyright 2017, Additive Regularization of Topic Models.
from __future__ import print_function
import os
import tempfile
import shutil
import pytest
from six.moves import range, zip
import artm.wrapper
import artm.wrapper.messages_pb2 as messages
import artm.... |
audio_distance.py | mbinkowski/DeepSpeechDistances | 114 | 11104847 | <filename>audio_distance.py
"""
Main Audio distance computation module.
"""
import os
import time
import numpy as np
from glob import glob
import tensorflow.compat.v1 as tf
from tqdm import tqdm
from tensorflow_gan.python.eval.classifier_metrics import kernel_classifier_distance_and_std_from_activations as kernel_dis... |
src/curt/curt/module.py | sanyaade-teachings/cep | 108 | 11104875 | """
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
class Module:
def __init__(self, module_type, config_channel, task_channel, output_channel, worker_list, load):
self.module_type = module_type
self.config_channel = config_channel
self.t... |
caffe2/python/operator_test/resize_op_test.py | KevinKecc/caffe2 | 585 | 11104918 | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
examples/pytorch/sagpool/grid_search.py | ketyi/dgl | 9,516 | 11104932 | <reponame>ketyi/dgl
import json
import os
from copy import deepcopy
from main import main, parse_args
from utils import get_stats
def load_config(path="./grid_search_config.json"):
with open(path, "r") as f:
return json.load(f)
def run_experiments(args):
res = []
for i in range(args.num_trials):
... |
tensorforce/core/parameters/parameter.py | DLPerf/tensorforce | 1,132 | 11104938 | # Copyright 2020 Tensorforce Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
src/tests/simian/auth/x509_test.py | tristansgray/simian | 326 | 11104946 | <filename>src/tests/simian/auth/x509_test.py
#!/usr/bin/env python
#
# Copyright 2018 Google Inc. 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.apach... |
docs/gallery-examples/example5_oec.py | hdevillepoix/astroquery | 577 | 11104950 | from astroquery import open_exoplanet_catalogue as oec
from astroquery.open_exoplanet_catalogue import findvalue
cata = oec.get_catalogue()
kepler68b = cata.find(".//planet[name='Kepler-68 b']")
print(findvalue(kepler68b, 'mass'))
"""
0.02105109
"""
|
data_collection/gazette/spiders/sc_presidente_nereu.py | kaiocp/querido-diario | 454 | 11104952 | <filename>data_collection/gazette/spiders/sc_presidente_nereu.py
from gazette.spiders.base.fecam import FecamGazetteSpider
class ScPresidenteNereuSpider(FecamGazetteSpider):
name = "sc_presidente_nereu"
FECAM_QUERY = "cod_entidade:212"
TERRITORY_ID = "4214102"
|
ding/torch_utils/tests/test_ckpt_helper.py | sailxjx/DI-engine | 464 | 11104992 | <reponame>sailxjx/DI-engine
import os
import time
import pytest
import torch
import torch.nn as nn
import uuid
from ding.torch_utils.checkpoint_helper import auto_checkpoint, build_checkpoint_helper, CountVar
from ding.utils import read_file, save_file
class DstModel(nn.Module):
def __init__(self):
sup... |
simba/outlier_scripts/movement/rw_dfs.py | justinshenk/simba | 172 | 11105002 | import pandas as pd
def read_df(currentFilePath, wfileType):
if wfileType == 'csv':
currDf = pd.read_csv(currentFilePath)
if wfileType == 'parquet':
currDf = pd.read_parquet(currentFilePath)
return currDf
def save_df(currDf, wfileType, path):
if wfileType == 'csv':
c... |
data/transcoder_evaluation_gfg/python/FAST_MULTIPLICATION_METHOD_WITHOUT_USING_MULTIPLICATION_OPERATOR_RUSSIAN_PEASANTS_ALGORITHM.py | mxl1n/CodeGen | 241 | 11105021 | # Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( a , b ) :
res = 0
while ( b > 0 ) :
if ( b & 1 ) :
res = res + a
a = a << 1
... |
plenario/apiary/validators.py | vforgione/plenario | 109 | 11105028 | from collections import defaultdict
from wtforms import ValidationError
from plenario.database import postgres_session
from plenario.models.SensorNetwork import FeatureMeta, NetworkMeta
def validate_sensor_properties(observed_properties):
if not observed_properties:
raise ValidationError('No observed pr... |
tests/dopamine/jax/agents/full_rainbow/full_rainbow_agent_test.py | kuldeepbrd1/dopamine | 9,825 | 11105059 | <reponame>kuldeepbrd1/dopamine
# coding=utf-8
# Copyright 2021 The Dopamine 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... |
apps/base/urls/parameter.py | youssriaboelseod/pyerp | 115 | 11105070 | <filename>apps/base/urls/parameter.py
"""The store routes
"""
# Django Library
from django.urls import path
# Localfolder Library
from ..views.parameter import (
ParameterCreateView, ParameterDeleteView, ParameterDetailView,
ParameterListView, ParameterUpdateView)
app_name = 'PyParameter'
urlpatterns = [
... |
xfel/command_line/FEE_average_plot.py | dperl-sol/cctbx_project | 155 | 11105105 | <filename>xfel/command_line/FEE_average_plot.py
from __future__ import absolute_import, division, print_function
from six.moves import range
from psana import *
import numpy as np
from libtbx import easy_pickle
import iotbx.phil, sys
import libtbx.load_env
from libtbx.utils import Sorry, Usage
master_phil = """
disp... |
Programming Languages/Python/Theory/100_Python_Exercises/Exercises/Exercise 43/43.py | jaswinder9051998/Resources | 101 | 11105126 | #Create a script that generates a file where all letters of English alphabet are listed two in each line
import string
with open("letters.txt", "w") as file:
for letter1, letter2 in zip(string.ascii_lowercase[0::2], string.ascii_letters[1::2]):
file.write(letter1 + letter2 + "\n")
|
src/fit.py | dusekjan/VI1_midi_file | 367 | 11105127 | <gh_stars>100-1000
import cv2
import numpy as np
from box import Box
from train import *
import os
import pickle
def predict(img):
if not os.path.exists('trained_models/nn_trained_model_hog.sav'):
print('Please wait while training the NN-HOG model....')
train('NN', 'hog', 'nn_trained_model_hog')
... |
amadeus/airport/predictions/_on_time.py | akshitsingla/amadeus-python | 125 | 11105133 | <filename>amadeus/airport/predictions/_on_time.py<gh_stars>100-1000
from amadeus.client.decorator import Decorator
class AirportOnTime(Decorator, object):
def get(self, **params):
'''
Returns a percentage of on-time flight departures
.. code-block:: python
amadeus.airport.pre... |
tests/unit/test_ncaaf_teams.py | MArtinherz/sportsipy | 221 | 11105170 | <reponame>MArtinherz/sportsipy
from flexmock import flexmock
from mock import PropertyMock
from sportsipy.ncaaf.schedule import Schedule
from sportsipy.ncaaf.teams import Team
class TestNCAAFTeams:
def setup_method(self, *args, **kwargs):
flexmock(Team) \
.should_receive('_parse_team_data') \
... |
mars/dataframe/indexing/set_axis.py | hxri/mars | 2,413 | 11105171 | # Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# 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 a... |
tutorials/W2D3_BiologicalNeuronModels/solutions/W2D3_Tutorial1_Solution_27d69c89.py | eduardojdiniz/CompNeuro | 2,294 | 11105191 | def isi_cv_LIF(spike_times):
"""
Calculates the inter-spike intervals (isi) and
the coefficient of variation (cv) for a given spike_train
Args:
spike_times : (n, ) vector with the spike times (ndarray)
Returns:
isi : (n-1,) vector with the inter-spike intervals (ms)
cv : coeffic... |
elodie/plugins/runtimeerror/runtimeerror.py | lancelotj/elodie | 964 | 11105234 | """
RuntimeError plugin object used for tests.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from __future__ import print_function
from elodie.plugins.plugins import PluginBase
class RuntimeError(PluginBase):
__name__ = 'ThrowError'
"""A dummy class to execute plugin actions for tests."""
def __init__(self):
... |
tests/runexp.py | SymbioticLab/Salus | 104 | 11105264 | #! /usr/bin/env python
from __future__ import print_function, absolute_import, division
import os
import sys
from subprocess import Popen
import csv
import argparse
from operator import attrgetter
import shlex
import time
from datetime import datetime
try:
from pathlib import Path
except ImportError:
from path... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.