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 |
|---|---|---|---|---|
Python/Seaborn/generate_data.py | Gjacquenot/training-material | 115 | 12749472 | <filename>Python/Seaborn/generate_data.py
#!/usr/bin/env python
import numpy as np
nr_data = 100
gaussian = np.random.normal(loc=1.5, scale=2.0, size=nr_data)
poisson = np.random.poisson(lam=5.0, size=nr_data)
labels = np.random.choice(['A', 'B', 'C', 'D'], size=nr_data)
x = np.linspace(0.0, 100.0, nr_data)
y = 1.3*x... |
Chapter3/queens.py | trenton3983/ClassicComputerScienceProblemsInPython | 792 | 12749494 | <filename>Chapter3/queens.py<gh_stars>100-1000
# queens.py
# From Classic Computer Science Problems in Python Chapter 3
# 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... |
corehq/util/__init__.py | omari-funzone/commcare-hq | 471 | 12749515 | import json as stdlib_json # Don't conflict with `corehq.util.json`
from traceback import format_exception_only
from django.utils.functional import Promise
from .couch import get_document_or_404 # noqa: F401
from .view_utils import reverse # noqa: F401
def flatten_list(elements):
return [item for sublist in ... |
src/awkward/_v2/operations/convert/to_arrow.py | scikit-hep/awkward-1.0 | 519 | 12749541 | <reponame>scikit-hep/awkward-1.0<filename>src/awkward/_v2/operations/convert/to_arrow.py
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import distutils
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
def _import_pyarrow(... |
tests/test_finance.py | GabrielWen/spartan | 156 | 12749542 | import unittest
import sys
import test_common
from spartan import expr, util
from spartan.expr import eager
from spartan.examples import finance
maturity = 10.0
rate = 0.005
volatility = 0.001
class TestFinance(test_common.ClusterTest):
def setUp(self):
if not hasattr(self, 'current'):
self.current = ea... |
deploy-agent/deployd/types/ping_report.py | brennentsmith/teletraan | 2,449 | 12749564 | # Copyright 2016 Pinterest, 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 to in... |
anglepy/funcs.py | strin/nips14-ssl | 496 | 12749593 | import numpy as np
import anglepy.ndict as ndict
# FuncLikelihood
class FuncLikelihood():
def __init__(self, x, model, n_batch):
self.x = x
self.model = model
self.n_batch = n_batch
self.n_datapoints = x.itervalues().next().shape[1]
if self.n_datapoints%(self.n_batch) != 0:
print self.n_datapoints, sel... |
processor/__init__.py | SeongSuKim95/Re-ID-baseline | 297 | 12749640 | from .processor import do_train, do_inference |
pclpy/tests/test_eigen.py | toinsson/pclpy | 293 | 12749661 | import pytest
import numpy as np
import pclpy
def test_eigen_vectorxf():
a = np.array([1, 1, 1, 1], "f")
vec = pclpy.pcl.vectors.VectorXf(a)
assert np.allclose(np.array(vec), a)
|
tbx/core/wagtail_hooks.py | elviva404/wagtail-torchbox | 103 | 12749668 | from django.core.files.storage import get_storage_class
from django.shortcuts import redirect
from django.utils.cache import add_never_cache_headers
from storages.backends.s3boto3 import S3Boto3Storage
from wagtail.core import hooks
from wagtail.documents import get_document_model
from wagtail.documents.models import ... |
tests/plugins/custommsg_a.py | Bladez1753/lightning | 2,288 | 12749669 | #!/usr/bin/env python3
from pyln.client import Plugin
plugin = Plugin()
@plugin.hook('custommsg')
def on_custommsg(peer_id, payload, plugin, message=None, **kwargs):
plugin.log("Got custommessage_a {msg} from peer {peer_id}".format(
msg=payload,
peer_id=peer_id
))
return {'result': 'conti... |
config.prod.py | R-fred/awesome-streamlit | 1,194 | 12749718 | <filename>config.prod.py
"""Configuration file for production Development"""
DEBUG = False
|
alipay/aop/api/domain/ComplextMockModel.py | snowxmas/alipay-sdk-python-all | 213 | 12749730 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.SimpleMockModel import SimpleMockModel
class ComplextMockModel(object):
def __init__(self):
self._biz_model = None
self._biz_num = None
self._biz_type... |
openmmtools/tests/test_alchemy.py | sroet/openmmtools | 135 | 12749731 | <filename>openmmtools/tests/test_alchemy.py
#!/usr/bin/python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Tests for alchemical factory in `alchemy.py`.
"""
# ==================... |
tests/test_sync.py | P-EB/aiosmtplib | 265 | 12749733 | """
Sync method tests.
"""
import pytest
from aiosmtplib.sync import async_to_sync
def test_sendmail_sync(
event_loop, smtp_client_threaded, sender_str, recipient_str, message_str
):
errors, response = smtp_client_threaded.sendmail_sync(
sender_str, [recipient_str], message_str
)
assert not ... |
lib/python/flag_types.py | leozz37/makani | 1,178 | 12749748 | <filename>lib/python/flag_types.py
# 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 requ... |
deeptables/fe/__init__.py | daBawse167/deeptables | 828 | 12749758 | # -*- coding:utf-8 -*-
__author__ = 'yangjian'
|
DiffAugment-biggan-imagenet/compare_gan/metrics/fid_score.py | Rian-T/data-efficient-gans | 1,902 | 12749762 | # coding=utf-8
# Copyright 2018 Google LLC & <NAME>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
tests/test_platform_telegram.py | romulocollopy/bottery | 250 | 12749775 | import pytest
from bottery.message import Message
from bottery.telegram import reply
from bottery.telegram.engine import TelegramChat, TelegramEngine, TelegramUser
@pytest.fixture
def engine():
return TelegramEngine
@pytest.fixture
def user():
return TelegramUser
@pytest.fixture
def chat():
return Te... |
validation_tests/analytical_exact/transcritical_without_shock/plot_results.py | samcom12/anuga_core | 136 | 12749788 | <gh_stars>100-1000
"""
Quick plot for the outputs of transcritical flow without shock
"""
import anuga.utilities.plot_utils as util
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot as pyplot
from analytical_without_shock import *
from numpy import ones
p_st = util.get_output('transcritical.sw... |
main.py | pumon/untouched | 906 | 12749794 | <reponame>pumon/untouched
import argparse
import glob
import os
import time
import cv2
import imutils
from imutils.object_detection import non_max_suppression
subject_label = 1
font = cv2.FONT_HERSHEY_SIMPLEX
list_of_videos = []
cascade_path = "face_cascades/haarcascade_profileface.xml"
face_cascade = cv2.CascadeClas... |
fixit/cli/utils.py | sk-/Fixit | 313 | 12749795 | <filename>fixit/cli/utils.py
# 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.
def print_color(code: int, message: str) -> None:
print(f"\033[{code}m{message}\033[00m")
def print_green(... |
test/test_merged_dataset.py | alexanu/quandl-python | 1,178 | 12749822 | import unittest
from test.helpers.httpretty_extension import httpretty
import six
import datetime
import pandas
from quandl.model.dataset import Dataset
from quandl.model.data import Data
from quandl.model.merged_data_list import MergedDataList
from quandl.model.merged_dataset import MergedDataset
from mock import patc... |
s3prl/utility/data.py | hhhaaahhhaa/s3prl | 856 | 12749840 | from torch.distributed.distributed_c10d import is_initialized
from torch.utils.data import Dataset, DistributedSampler
def get_ddp_sampler(dataset: Dataset, epoch: int):
"""
This function will create a DistributedSampler if DDP is initialized,
and will just return None if DDP is not initialized.
"""
... |
core/sdfrenderer/renderer_deepsdf.py | hyunynim/DIST-Renderer | 176 | 12749850 | <filename>core/sdfrenderer/renderer_deepsdf.py
import os, sys
import torch
import numpy as np
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from renderer import SDFRenderer
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..'))
from core.utils.decoder_utils import decode_sdf... |
chainercv/chainer_experimental/datasets/sliceable/getter_dataset.py | beam2d/chainercv | 1,600 | 12749884 | <reponame>beam2d/chainercv
from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset \
import _as_key_indices
from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset \
import _is_iterable
from chainercv.chainer_experimental.datasets.sliceable import SliceableDataset
class Gette... |
recipes/Python/286223_ohmysqldump/recipe-286223.py | tdiprima/code | 2,023 | 12749967 | <filename>recipes/Python/286223_ohmysqldump/recipe-286223.py
#!/export/home/www.netuni.nl/local/bin/python
import sys, os, getopt, getpass
import MySQLdb
def ohmysqldump(db, user, passwd, excluded, options, host=''):
conn = MySQLdb.connect(host='', db=db, user=user, passwd=passwd)
c = conn.cursor()
sql = ... |
tbx/events/migrations/0002_auto_20210623_1428.py | elviva404/wagtail-torchbox | 103 | 12749971 | # Generated by Django 2.2.24 on 2021-06-23 13:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("events", "0001_initial"),
]
operations = [
migrations.AlterModelOptions(name="event", options={},),
]
|
lingvo/tasks/car/waymo/waymo_ap_metric_test.py | allenwang28/lingvo | 2,611 | 12749980 | # Lint as: python3
# 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/LICENSE-2.0
#
# Unless ... |
tests/unittesting/actions/default/cli/test_cli_worker.py | shepilov-vladislav/aiotasks | 462 | 12750062 | import click
from click.testing import CliRunner
from aiotasks.actions.cli import worker
import aiotasks.actions.cli
def _launch_aiotasks_worker_in_console(blah, **kwargs):
click.echo("ok")
def test_cli_worker_runs_show_help():
runner = CliRunner()
result = runner.invoke(worker)
assert 'Usage: w... |
c2_python-operating-system/7_final-project/project/exercise2.py | chaiyeow/google-it-automation | 220 | 12750071 | <filename>c2_python-operating-system/7_final-project/project/exercise2.py
#!/usr/bin/env python3
import operator
fruit = {"oranges": 3, "apples": 5, "bananas": 7, "pears": 2}
sorted(fruit.items())
# Output: sorted(fruit.items())
sorted(fruit.items(), key=operator.itemgetter(0))
# Output: [('apples', 5), ('bananas', ... |
gitplus/git.py | tkrajina/git-plus | 170 | 12750077 | import os.path as mod_path
import sys as mod_sys
import subprocess
from typing import *
def assert_in_git_repository() -> None:
success, lines = execute_git('status', output=False)
if not success:
print('Not a git repository!!!')
mod_sys.exit(1)
def execute_command(cmd: Union[str, List[str]]... |
venv/lib/python3.7/site-packages/allauth/socialaccount/providers/twitch/urls.py | vikram0207/django-rest | 6,342 | 12750091 | <gh_stars>1000+
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import TwitchProvider
urlpatterns = default_urlpatterns(TwitchProvider)
|
tensorflow_datasets/core/community/cache.py | jvishnuvardhan/datasets | 3,380 | 12750093 | <filename>tensorflow_datasets/core/community/cache.py
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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.apach... |
jarbas/core/context_processors.py | vbarceloscs/serenata-de-amor | 3,001 | 12750107 | from django.conf import settings
def google_analytics(request):
return {'google_analytics': settings.GOOGLE_ANALYTICS}
|
Easy/Chef And Apple Trees/Chef_And_Apple_Trees.py | anishsingh42/CodeChef | 127 | 12750121 | <filename>Easy/Chef And Apple Trees/Chef_And_Apple_Trees.py<gh_stars>100-1000
try:
t=int(input())
for i in range(t):
n=int(input())
a=list(map(int,input().split()))
set1=list(set(a))
print(len(set1))
except:
pass |
terrascript/data/oraclepaas.py | mjuenema/python-terrascript | 507 | 12750139 | <gh_stars>100-1000
# terrascript/data/oraclepaas.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:24:00 UTC)
#
# For imports without namespace, e.g.
#
# >>> import terrascript.data.oraclepaas
#
# instead of
#
# >>> import terrascript.data.hashicorp.oraclepaas
#
# This is only available for 'officia... |
src/python/bezier/_curve_helpers.py | dibir-magomedsaygitov/bezier | 165 | 12750144 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
up/extensions/python/psroi_pool.py | ModelTC/EOD | 196 | 12750168 | <reponame>ModelTC/EOD
# Import from pod
# Import from third library
import torch
from torch.autograd import Function
from up.utils.general.log_helper import default_logger as logger
# Import from local
from .._C import psroi_pooling
class PSRoIPoolFunction(Function):
@staticmethod
def symbolic(g, features,... |
towhee/trainer/models/swin_transformer/configs.py | ThyeeZz/towhee | 365 | 12750196 | # Copyright 2021 Zilliz. 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 law or agree... |
examples/tensorflow/nlp/transformer_lt/quantization/ptq/main.py | huggingface/neural-compressor | 172 | 12750199 | #
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 Intel 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 app... |
mpf/file_interfaces/__init__.py | Scottacus64/mpf | 163 | 12750203 | <filename>mpf/file_interfaces/__init__.py<gh_stars>100-1000
"""Contains config file interfaces."""
|
zfit/util/cache.py | nsahoo/zfit | 129 | 12750209 | <reponame>nsahoo/zfit<gh_stars>100-1000
"""Module for caching.
The basic concept of caching in Zfit builds on a "cacher", that caches a certain value and that
is dependent of "cache_dependents". By implementing `ZfitCachable`, an object will be able to play both
roles. And most importantly, it has a `_cache` dict, tha... |
models/gates.py | xxxnell/how-do-vits-work | 438 | 12750225 | <reponame>xxxnell/how-do-vits-work
"""
This model is based on the implementation of https://github.com/Jongchan/attention-module.
"""
from functools import partial
import torch
import torch.nn as nn
from einops import reduce, rearrange
import models.layers as layers
class ChannelGate(nn.Module):
def __init__(... |
lvsr/graph.py | dendisuhubdy/attention-lvcsr | 295 | 12750232 | '''
Functions similar to blocks.graph
'''
import logging
import numpy
import theano
from theano import tensor
from theano.sandbox.rng_mrg import MRG_RandomStreams
from blocks.config import config
from blocks.bricks.base import Brick, application
from picklable_itertools.extras import equizip
from blocks.graph impo... |
vilya/views/uis/browsefiles.py | mubashshirjamal/code | 1,582 | 12750235 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import json
from vilya.libs.template import st
from vilya.models.project import CodeDoubanProject
_q_exports = []
class BrowsefilesUI:
_q_exports = ['setting']
def __init__(self, proj_name):
self.proj = proj_name
def _q_access(sel... |
tools/accuracy_checker/openvino/tools/accuracy_checker/postprocessor/resize_style_transfer.py | TolyaTalamanov/open_model_zoo | 2,201 | 12750238 | <reponame>TolyaTalamanov/open_model_zoo<gh_stars>1000+
"""
Copyright (c) 2018-2022 Intel 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... |
pandapower/pypower/qps_pypower.py | yougnen/pandapower | 104 | 12750251 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Quadratic Program Solver for PYPOWER.
"""
import sys
from pandapower.pypower.qps_pips import qps_pips
#from pandapower.pypower.qps_ipopt import qps_ipopt
#fro... |
websockets/handlers/set-cookies-samesite_wsh.py | ziransun/wpt | 575 | 12750270 | <filename>websockets/handlers/set-cookies-samesite_wsh.py
from six.moves import urllib
def web_socket_do_extra_handshake(request):
url_parts = urllib.parse.urlsplit(request.uri)
max_age = ""
if "clear" in url_parts.query:
max_age = "; Max-Age=0"
value = "1"
if "value" in url_parts.query:
... |
moldesign/_tests/test_wfn.py | Autodesk/molecular-design-toolkit | 147 | 12750271 | <filename>moldesign/_tests/test_wfn.py
import pytest
import numpy as np
import moldesign as mdt
from moldesign import units as u
from moldesign.interfaces.pyscf_interface import basis_values
from .molecule_fixtures import *
from . import helpers
__PYTEST_MARK__ = 'wfn'
TESTSYSTEMS = ['h2_rhf_augccpvdz', 'h2_rhf_st... |
tests/functional/make_triangle_locate_images.py | dibir-magomedsaygitov/bezier | 165 | 12750283 | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... |
python/depthcharge/payload_map.py | justinforbes/depthcharge | 133 | 12750285 | <filename>python/depthcharge/payload_map.py
# SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
Implements PayloadMap - Although technically "public" this module
isn't documented in the API because its utility is tightly coupled
to internals of the Depthcharge class.
""... |
fastrunner/utils/relation.py | FuxiongYang/faster | 227 | 12750334 | # !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Author:ๆขจ่ฑ่
# @File: relation.py
# @Time : 2019/5/27 10:16
# @Email: <EMAIL>
# @Software: PyCharm
# apiๆจกๅๅๆฐๆฎๅบapi่กจrelationๅฏนๅบๅ
ณ็ณป
API_RELATION = {"default": 66,
"energy.ball": 67,
"manage": 68,
"app_manage": 68,
... |
example/generic/get_exchange_info.py | bailzx5522/huobi_Python | 611 | 12750340 | <gh_stars>100-1000
from huobi.client.generic import GenericClient
from huobi.utils import *
generic_client = GenericClient()
list_obj = generic_client.get_exchange_info()
LogInfo.output("---- Supported symbols ----")
for symbol in list_obj.symbol_list:
LogInfo.output(symbol.symbol)
LogInfo.output("---- Supported... |
examples/source1.py | haypo/trollius | 175 | 12750354 | """Like source.py, but uses streams."""
from __future__ import print_function
import argparse
import sys
from trollius import *
from trollius import test_utils
ARGS = argparse.ArgumentParser(description="TCP data sink example.")
ARGS.add_argument(
'--tls', action='store_true', dest='tls',
default=False, help... |
conv-eng/conv.py | mjabrams/docs | 204 | 12750371 | import re
import sys
depRelHeader="""\
## %s : %s
"""
oneDepFig="""
<div class="sd-parse">
%s
%s(%s, %s)
</div>
"""
header="""\
---
layout: base
title: '%(relname)s'
shortdef : '%(shortdef)s'
---
"""
footer=""
### {\emph{advcl}: adverbial clause modifier}
relRe=re.compile(r"\{\\emph\{(.*?)\}:\s+(.*)\}\\\\$") #... |
projects/DensePose/densepose/data/samplers/densepose_confidence_based.py | mmabrouk/detectron2 | 21,274 | 12750436 | # Copyright (c) Facebook, Inc. and its affiliates.
import random
from typing import Optional, Tuple
import torch
from densepose.converters import ToChartResultConverterWithConfidences
from .densepose_base import DensePoseBaseSampler
class DensePoseConfidenceBasedSampler(DensePoseBaseSampler):
"""
Samples D... |
tests/nonrealtime/test_nonrealtime_Session_pickle.py | butayama/supriya | 191 | 12750447 | <gh_stars>100-1000
import pickle
import supriya
def test_01():
old_session = supriya.Session()
new_session = pickle.loads(pickle.dumps(old_session))
old_bundles = old_session.to_osc_bundles()
new_bundles = new_session.to_osc_bundles()
assert old_bundles == new_bundles
def test_02():
old_ses... |
silo/benchmarks/stats_runner.py | anshsarkar/TailBench | 274 | 12750454 | <reponame>anshsarkar/TailBench<filename>silo/benchmarks/stats_runner.py
#!/usr/bin/env python
import itertools as it
import platform
import math
import subprocess
import sys
import time
import multiprocessing as mp
import os
BUILDDIR='../out-perf.ectrs'
if __name__ == '__main__':
(_, out) = sys.argv
args = [
... |
tensorflow/lite/tools/test_utils.py | EricRemmerswaal/tensorflow | 190,993 | 12750496 | <reponame>EricRemmerswaal/tensorflow<filename>tensorflow/lite/tools/test_utils.py
# Copyright 2020 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... |
django_quicky/namegen/__init__.py | sametmax/django-quicky | 149 | 12750504 | <gh_stars>100-1000
import pkg_resources
pkg_resources.declare_namespace(__name__)
from .namegen import NameGenerator
namegen = NameGenerator()
|
indent.py | Hengle/MemoryProfiler | 184 | 12750526 | <reponame>Hengle/MemoryProfiler<filename>indent.py
#!/usr/bin/env python3
import os
import os.path as p
def iter_dir(base_path:str, indent:str):
node_list = os.listdir(base_path)
for n in range(len(node_list)):
name = node_list[n]
nest_path = p.join(base_path, name)
if n + 1 < len(node_... |
tests/torch/pruning/filter_pruning/test_set_pruning_rate.py | sarthakpati/nncf | 310 | 12750555 | <reponame>sarthakpati/nncf<gh_stars>100-1000
"""
Copyright (c) 2021 Intel 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 requ... |
plaso/parsers/networkminer.py | cugu-stars/plaso | 1,253 | 12750565 | <filename>plaso/parsers/networkminer.py
# -*- coding: utf-8 -*-
"""Parser for NetworkMiner .fileinfos files."""
from dfdatetime import time_elements as dfdatetime_time_elements
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
from plaso.parsers import dsv_... |
chapter05/dags/02_branch_task.py | add54/Data_PipeLine_Apache_Airflow | 303 | 12750571 | import airflow
from airflow import DAG
from airflow.operators.dummy import DummyOperator
from airflow.operators.python import PythonOperator
ERP_CHANGE_DATE = airflow.utils.dates.days_ago(1)
def _fetch_sales(**context):
if context["execution_date"] < ERP_CHANGE_DATE:
_fetch_sales_old(**context)
else... |
tests/layer_tests/onnx_tests/test_squeeze.py | ryanloney/openvino-1 | 1,127 | 12750573 | <gh_stars>1000+
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import pytest
from common.onnx_layer_test_class import Caffe2OnnxLayerTest
class TestSqueeze(Caffe2OnnxLayerTest):
def create_squeeze_net(self, axes, input_shape, output_shape, ir_version):
"""
... |
mayan/apps/views/fields.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 12750594 | from django import forms
from django.core.exceptions import ImproperlyConfigured
from mayan.apps.acls.models import AccessControlList
class FilteredModelFieldMixin:
def __init__(self, *args, **kwargs):
self.source_model = kwargs.pop('source_model', None)
self.permission = kwargs.pop('permission',... |
lib/modules/python/persistence/osx/mail.py | Gui-Luz/Empire | 5,720 | 12750630 | <gh_stars>1000+
from time import time
from random import choice
from string import ascii_uppercase
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
... |
orchestra/migrations/0055_auto_20160429_0823.py | code-review-doctor/orchestra | 444 | 12750642 | <reponame>code-review-doctor/orchestra
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-29 08:23
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('... |
visual/dataset.py | eliasyin/MUStARD | 206 | 12750648 | import json
import os
from typing import Callable, Dict
import PIL.Image
import torch
import torch.utils.data
class SarcasmDataset(torch.utils.data.Dataset):
"""Dataset of Sarcasm videos."""
FRAMES_DIR_PATH = '../data/frames/utterances_final'
def __init__(self, transform: Callable = None, videos_data_pa... |
python/download_trained_model.py | linnostrom/DeepMVS | 301 | 12750656 | <filename>python/download_trained_model.py
import os
import sys
import subprocess
def download_trained_model(path = None):
if path is None:
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "model")
if not os.path.isdir(path):
os.mkdir(path)
print "Downloading trained model..."
subprocess.c... |
anaconda_project/internal/rename.py | kathatherine/anaconda-project | 188 | 12750659 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------... |
aliyun-python-sdk-live/aliyunsdklive/__init__.py | leafcoder/aliyun-openapi-python-sdk | 1,001 | 12750703 | __version__ = '3.9.10' |
lib/python/treadmill/syscall/__init__.py | vrautela/treadmill | 133 | 12750714 | """Linux direct system call interface.
"""
|
examples/dataset_concatenation.py | bomber8013/h5py | 1,657 | 12750724 | <filename>examples/dataset_concatenation.py
'''Concatenate multiple files into a single virtual dataset
'''
import h5py
import numpy as np
import sys
import os
def concatenate(file_names_to_concatenate):
entry_key = 'data' # where the data is inside of the source files.
sh = h5py.File(file_names_to_concatena... |
segmentation/model/decoder/__init__.py | RajasekharChowdary9/panoptic-deeplab | 506 | 12750727 | <reponame>RajasekharChowdary9/panoptic-deeplab<gh_stars>100-1000
from .aspp import ASPP
from .deeplabv3 import DeepLabV3Decoder
from .deeplabv3plus import DeepLabV3PlusDecoder
from .panoptic_deeplab import PanopticDeepLabDecoder
|
Python-3/basic_examples/python_breakpoint_examples.py | ghiloufibelgacem/jornaldev | 1,139 | 12750756 | <reponame>ghiloufibelgacem/jornaldev
x = 10
y = 'Hi'
z = 'Hello'
print(y)
# breakpoint() is introduced in Python 3.7
breakpoint()
print(z)
# Execution Steps
# Default:
# $python3.7 python_breakpoint_examples.py
# Disable Breakpoint:
# $PYTHONBREAKPOINT=0 python3.7 python_breakpoint_examples.py
# Using Other Debug... |
src/breakpad/src/tools/gyp/test/hello/gyptest-regyp.py | ant0ine/phantomjs | 263 | 12750766 | <gh_stars>100-1000
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies that Makefiles get rebuilt when a source gyp file changes.
"""
import TestGyp
# Regenerating build files w... |
modules/nltk_contrib/hadoop/tf_idf/tfidf_map1.py | h4ck3rm1k3/NLP-project | 123 | 12750767 | from hadooplib.mapper import MapperBase
from hadooplib.inputformat import KeyValueInput
class TFIDFMapper1(MapperBase):
"""
keep only the word in the key field
remove filename from key and put it into value
(word filename, number) -> (word, filename number)
e.g. (dog 1.txt, 1) -> (dog, 1.txt 1)
... |
Korpora/korpus_aihub_kspon_speech.py | oikosohn/Korpora | 449 | 12750775 | <gh_stars>100-1000
import os
import re
from glob import glob
from dataclasses import dataclass
from typing import Dict
from .korpora import Korpus, KorpusData
from .utils import default_korpora_path
description = """ AI Hub ์์๋ ํ์ต์ฉ ๋ฐ์ดํฐ๋ฅผ ์ ๊ณตํฉ๋๋ค.
๋ฐ์ดํฐ๋ฅผ ํ์ฉํ๊ธฐ ์ํด์๋ ์๋ ์ฃผ์์ ํํ์ด์ง์์ "AI๋ฐ์ดํฐ" ํด๋ฆญ ํ,
์ด์ฉํ๋ ค๋ ๋ฐ์ดํฐ๋ง๋ค ์ง์ ์ ์ฒญ์... |
bruges/attribute/__init__.py | mycarta/bruges | 209 | 12750787 | <reponame>mycarta/bruges<filename>bruges/attribute/__init__.py
# -*- coding: utf-8 -*-
"""
:copyright: 2015 Agile Geoscience
:license: Apache 2.0
"""
from .energy import energy
from .similarity import similarity
from .dipsteer import dipsteer
from .spectrogram import spectrogram
from .spectraldecomp import spectral... |
inselect/gui/user_template_popup_button.py | NaturalHistoryMuseum/inselect | 128 | 12750788 | from PyQt5.QtWidgets import QAction, QFileDialog, QMenu, QPushButton
from inselect.lib.user_template import UserTemplate
from inselect.lib.utils import debug_print
from .user_template_choice import user_template_choice
from .utils import load_icon, reveal_path
class UserTemplatePopupButton(QPushButton):
"User t... |
MicroPython_BUILD/components/internalfs_image/image/examples/thread_example.py | FlorianPoot/MicroPython_ESP32_psRAM_LoBo | 838 | 12750792 | <gh_stars>100-1000
import machine, _thread, time
import micropython, gc
import bme280
# Setup the LED pins
bled = machine.Pin(4, mode=machine.Pin.OUT)
#rled = machine.Pin(0, mode=machine.Pin.OUT)
#gled = machine.Pin(2, mode=machine.Pin.OUT)
bled.value(0)
#gled.value(0)
#rled.value(0)
# Setup I2C to be used ... |
tests/test_metaheader.py | 1Q1-Open-Source/django-data-wizard | 279 | 12750812 | from .base import BaseImportTestCase
class MetaHeaderTestCase(BaseImportTestCase):
serializer_name = "tests.naturalkey_app.wizard.NoteMetaSerializer"
def test_manual(self):
run = self.upload_file("naturalkey_meta.xlsx")
# Inspect unmatched columns and select choices
self.check_column... |
adanet/core/timer.py | eustomaqua/adanet | 3,323 | 12750814 | """A simple timer implementation.
Copyright 2018 The AdaNet 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
https://www.apache.org/licenses/LICENSE-2.0
Unless re... |
tests/test_stimulus.py | Ronjaa95/neurolib | 258 | 12750820 | """
Tests of noise input.
"""
import unittest
import numpy as np
from chspy import CubicHermiteSpline
from neurolib.models.aln import ALNModel
from neurolib.utils.stimulus import (
ConcatenatedStimulus,
ExponentialInput,
LinearRampInput,
OrnsteinUhlenbeckProcess,
RectifiedInput,
SinusoidalInpu... |
make/release.py | frznvm0/Kanmail | 1,118 | 12750825 | from os import path
import click
from .settings import NEW_BUILDS_DIRNAME
from .util import print_and_run, read_version_data
def _wait_for_build(filename):
click.echo('Build the client in another window, and return here afterwards')
version = read_version_data()['version']
filename = path.join(NEW_BUIL... |
textclf/config/ml_model.py | lswjkllc/textclf | 146 | 12750832 | <reponame>lswjkllc/textclf
"""ๅ็งๆจกๅ็่ฎพ็ฝฎ"""
from typing import Union, Optional, Dict
from .base import ConfigBase
class MLModelConfig(ConfigBase):
pass
class LogisticRegressionConfig(MLModelConfig):
"""ๅ่:https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html"""
# p... |
tools/third_party/pywebsocket3/mod_pywebsocket/handshake/__init__.py | spao234/wpt | 575 | 12750838 | <filename>tools/third_party/pywebsocket3/mod_pywebsocket/handshake/__init__.py
# Copyright 2011, 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 c... |
examples/gepetto-viewer.py | Sreevis/pinocchio | 716 | 12750857 | # NOTE: this example needs gepetto-gui to be installed
# usage: launch gepetto-gui and then run this test
import pinocchio as pin
import numpy as np
import sys
import os
from os.path import dirname, join, abspath
from pinocchio.visualize import GepettoVisualizer
# Load the URDF model.
# Conversion with str seems to ... |
deslib/util/dfp.py | vishalbelsare/DESlib | 310 | 12750884 | <filename>deslib/util/dfp.py
"""Implementation of the Dynamic Frienemy Pruning (DFP) algorithm for online
pruning of base classifiers.
References
----------
<NAME>., <NAME>. and <NAME>., Online Pruning
of Base Classifiers for Dynamic Ensemble Selection,
Pattern Recognition, vol. 72, December 2017, pp 44-58.
Cruz, <NA... |
src/hg/makeDb/genbank/src/lib/py/genbank/fileOps.py | andypohl/kent | 171 | 12750893 | """Miscellaneous file operations"""
import os,os.path,errno
def ensureDir(dir):
"""Ensure that a directory exists, creating it (and parents) if needed."""
try:
os.makedirs(dir)
except OSError, e:
if e.errno != errno.EEXIST:
raise e
def ensureFileDir(fname):
"""Ensure that... |
pororo/models/brainbert/JaBERTa.py | jayten42/pororo | 1,137 | 12750906 | <gh_stars>1000+
# Copyright (c) Facebook, Inc., its affiliates and Kakao Brain. All Rights Reserved
from typing import Dict, Union
import torch
from fairseq.models.roberta import RobertaModel
from fairseq.models.roberta.hub_interface import RobertaHubInterface
from transformers import BertJapaneseTokenizer
from poro... |
neutron/plugins/common/constants.py | congnt95/neutron | 1,080 | 12750912 | # Copyright 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 req... |
lvsr/bricks/readouts.py | Fatman003/Actor | 178 | 12750913 | import logging
import theano
from theano.gradient import disconnected_grad
from theano import tensor
from blocks.graph import ComputationGraph
from blocks.filter import VariableFilter
from blocks.bricks import Linear, NDimensionalSoftmax
from blocks.bricks.base import application
from blocks.roles import OUTPUT, add_r... |
upvote/gae/cron/exemption_upkeep.py | iwikmai/upvote | 453 | 12750962 | # Copyright 2017 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
apps/sqoop/src/sqoop/client/connector.py | yetsun/hue | 5,079 | 12750980 | <reponame>yetsun/hue<gh_stars>1000+
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "Lic... |
mcrouter/test/test_logical_routing_policies.py | kiaplayer/mcrouter | 2,205 | 12751009 | <gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from mcrouter.test.MCProcess import *
from mcrouter.test.McrouterTestCase import McrouterTestCase
clas... |
src/healthcareapis/azext_healthcareapis/manual/custom.py | haroonf/azure-cli-extensions | 207 | 12751014 | # --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint:... |
examples/opengl/opengl_core.py | HenrYxZ/pyglet | 1,160 | 12751037 | import pyglet
from pyglet.gl import *
# pyglet.options['debug_gl_shaders'] = True
window = pyglet.window.Window(width=540, height=540, resizable=True)
batch = pyglet.graphics.Batch()
print("OpenGL Context: {}".format(window.context.get_info().version))
##########################################################
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.