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 |
|---|---|---|---|---|
somaticseq/utilities/dockered_pipelines/bamSimulator/bamSurgeon/convert_nonStandardBasesInVcfs.py | bioinform/somaticseq | 159 | 12698491 | #!/usr/bin/env python3
import sys, re
for line_i in sys.stdin:
if line_i.startswith('#'):
print(line_i, end='')
else:
item = line_i.rstrip().split('\t')
item[3] = re.sub(r'[^gctanGCTAN,0-9]', 'N', item[3])
item[4] = re.sub(r'[^gctanGCTAN,0-9]', 'N'... |
src/amuse/community/ph4/binary_hist.py | rknop/amuse | 131 | 12698524 | from pylab import *
import sys
import re
if __name__ == '__main__':
if len(sys.argv) != 3:
print("usage: python binary_hist.py <input filename> <time of histogram>")
sys.exit(1)
else:
fname = sys.argv[1]
time = float(sys.argv[2])
f = open(fname, "r")
inblock = Fa... |
xmodaler/modeling/layers/positionwise_feedforward.py | cclauss/xmodaler | 830 | 12698527 | """
From original at https://github.com/aimagelab/meshed-memory-transformer/blob/master/models/transformer/utils.py
Original copyright of AImageLab code below, modifications by <NAME>, Copyright 2021.
"""
# Copyright (c) 2019, AImageLab
import torch
import torch.nn as nn
import torch.nn.functional as F
__all__ = ["Po... |
ulid/api/microsecond.py | xkortex/ulid | 303 | 12698535 | <reponame>xkortex/ulid<gh_stars>100-1000
"""
ulid/api/microsecond
~~~~~~~~~~~~~~~~~~~~
Contains the public API of the `ulid` package using the microsecond provider.
"""
from .. import consts, providers, ulid
from . import api
API = api.Api(providers.MICROSECOND)
create = API.create
from_bytes = API.from_... |
supervised-oie-benchmark/oie_readers/propsReader.py | acoli-repo/OpenIE_Stanovsky_Dagan | 117 | 12698550 | from oie_readers.oieReader import OieReader
from oie_readers.extraction import Extraction
class PropSReader(OieReader):
def __init__(self):
self.name = 'PropS'
def read(self, fn):
d = {}
with open(fn) as fin:
for line in fin:
if not line.strip():
... |
scripts/external_libs/scapy-2.4.3/scapy/contrib/automotive/uds.py | timgates42/trex-core | 956 | 12698577 | #! /usr/bin/env python
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
# scapy.contrib.description = Unified Diagnostic Service (UDS)
# scapy.contrib.status = loads
import struct
from scapy... |
venv/Lib/site-packages/statsmodels/tsa/interp/tests/test_denton.py | EkremBayar/bayar | 6,931 | 12698598 | <reponame>EkremBayar/bayar
import numpy as np
from statsmodels.tsa.interp import dentonm
def test_denton_quarterly():
# Data and results taken from IMF paper
indicator = np.array([98.2, 100.8, 102.2, 100.8, 99.0, 101.6,
102.7, 101.5, 100.5, 103.0, 103.5, 101.5])
benchmark = np.ar... |
unit_testing_course/lesson2/task2/comparison_assertions.py | behzod/pycharm-courses | 213 | 12698605 | <gh_stars>100-1000
import random
import unittest
from tested_code import random_not_42, find_foo, \
random_float_between_inclusive, random_float_between_noninclusive
class TestRandomNot42(unittest.TestCase):
def test_many_values(self):
"""call the function 100 times and make sure the result isn't 42"... |
tests/test_reactjs.py | Dhandarah/dukpy | 363 | 12698636 | # -*- coding: utf-8 -*-
import unittest
import dukpy
class TestReactJS(unittest.TestCase):
def test_hello_world(self):
jsx = dukpy.jsx_compile('var react_hello = <h1>Hello, world!</h1>;')
jsi = dukpy.JSInterpreter()
result = jsi.evaljs([
'''
var React = require('re... |
src/lib/error_logger.py | chrismayemba/covid-19-open-data | 430 | 12698639 | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
tests/unit/systems/nfs/server_test.py | gamechanger/dusty | 421 | 12698719 | <gh_stars>100-1000
import os
import tempfile
from mock import Mock, patch
from dusty.systems.nfs import server
from dusty import constants
from ....testcases import DustyTestCase
class TestNFSServer(DustyTestCase):
def setUp(self):
super(TestNFSServer, self).setUp()
def tearDown(self):
super... |
finding cycle in linked list/cycle.py | love-ode/cs-algorithms | 239 | 12698739 | class Node:
# Constructor to initialize the node object
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
# Function to initialize head
def __init__(self):
self.head = None
# Function to insert a new node at the beginning
de... |
gui/rqt_quad_gui/src/rqt_quad_gui/quad_widget_common.py | danielemorra98/rpg_quadrotor_control | 419 | 12698777 | #!/usr/bin/env python
from python_qt_binding import loadUi
qt_version_below_5 = False
try:
# Starting from Qt 5 QWidget is defined in QtWidgets and not QtGui anymore
from python_qt_binding import QtWidgets
from python_qt_binding.QtWidgets import QWidget
except:
from python_qt_binding import QtGui
fr... |
synapse_btcv_abdominal_ct_segmentation/train.py | andythai/models | 128 | 12698824 | <reponame>andythai/models<filename>synapse_btcv_abdominal_ct_segmentation/train.py
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
import argparse
import os
import numpy as np
import pandas as pd
import tensorflow as tf
from dltk.core.metrics import dice
from dltk.core.l... |
src/probflow/data/data_generator.py | chiragnagpal/probflow | 134 | 12698829 | <gh_stars>100-1000
import multiprocessing as mp
from abc import abstractmethod
from probflow.utils.base import BaseDataGenerator
class DataGenerator(BaseDataGenerator):
"""Abstract base class for a data generator, which uses multiprocessing
to load the data in parallel.
TODO
User needs to implement... |
deep_sort-master/evaluate_motchallenge.py | riciche/SimpleCVReproduction | 923 | 12698830 | # vim: expandtab:ts=4:sw=4
import argparse
import os
import deep_sort_app
def parse_args():
""" Parse command line arguments.
"""
parser = argparse.ArgumentParser(description="MOTChallenge evaluation")
parser.add_argument(
"--mot_dir", help="Path to MOTChallenge directory (train or test)",
... |
examples/benchmark.py | Cam2337/snap-python | 242 | 12698865 | #!/usr/bin/python
# benchmark.py
#
# Author: <NAME>, Spring 2013
# Description:
# - Loads SNAP as a Python module.
# - Randomly generates a graph of specified size and type, and saves
# or loads the graph if it has already been created.
# - Benchmarks a number of "is this a good graph?" tests on the... |
automation/batch.py | CrackerCat/HexraysToolbox | 346 | 12698878 | #!/usr/bin/env python
try:
from idaapi import *
except:
import sys, os, argparse, subprocess, logging, threading, time, signal
sigint_count = 0
cur_thread_count = 0
def sig_handler(signum, frame):
global sigint_count
global cur_thread_count
msg = "SIGINT: "
... |
loggibud/v1/plotting/plot_solution.py | thiagopbueno/loggibud | 143 | 12698892 | <reponame>thiagopbueno/loggibud
"""Plots solution routes"""
from typing import List, Iterable, Optional
import folium
import numpy as np
import polyline
import requests
from loggibud.v1.types import CVRPSolution, Point
from loggibud.v1.distances import OSRMConfig
# All available map colors
MAP_COLORS = (
"black... |
utils/mobjects/DelaunayTrianglation.py | AStarySky/manim_sandbox | 366 | 12698898 | # from @有一种悲伤叫颓废
"""
注:
1. 主要用来求三角剖分和维诺图,算法的思路可以看我的这期视频:https://www.bilibili.com/video/BV1Ck4y1z7VT
2. 时间复杂度O(nlogn),一般情况应该够用,如发现bug请联系颓废
3. 只需导入两个函数:DelaunayTrianglation(求德劳内三角剖分), Voronoi(求维诺图)
"""
import numpy as np
from manimlib.mobject.types.vectorized_mobject import VGroup
from manimlib... |
zentral/contrib/monolith/migrations/0001_initial.py | janheise/zentral | 634 | 12698901 | <reponame>janheise/zentral
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-19 10:55
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
... |
posthog/migrations/0161_property_defs_search.py | csmatar/posthog | 7,409 | 12698915 | # Generated by Django 3.1.12 on 2021-07-16 13:04
from django.contrib.postgres.indexes import GinIndex
from django.contrib.postgres.operations import TrigramExtension
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("posthog", "0160_organization_domain_whitelist")... |
Algo and DSA/LeetCode-Solutions-master/Python/minimum-skips-to-arrive-at-meeting-on-time.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12698942 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/minimum-skips-to-arrive-at-meeting-on-time.py
# Time: O(n^2)
# Space: O(n)
class Solution(object):
def minSkips(self, dist, speed, hoursBefore):
"""
:type dist: List[int]
:type speed: int
:type hoursBefore: int
:rtype:... |
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/error.py | jeikabu/lumberyard | 1,738 | 12698946 | <filename>dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/error.py
from __future__ import print_function, absolute_import, division
class CudaDriverError(Exception):
pass
class CudaSupportError(ImportError):
pass
class NvvmError(Exception):
def __str__(self):
return '\n'.j... |
raspberryio/userprofile/admin.py | cvautounix/raspberryio | 113 | 12698947 | from django.contrib import admin
from raspberryio.userprofile import models as userprofile
class ProfileAdmin(admin.ModelAdmin):
model = userprofile.Profile
admin.site.register(userprofile.Profile, ProfileAdmin)
|
python/fate_arch/federation/transfer_variable/_transfer_variable.py | hubert-he/FATE | 3,787 | 12698986 | <gh_stars>1000+
#
# Copyright 2019 The FATE 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 r... |
crawler/spiders/cnproxy.py | xelzmm/proxy_server_crawler | 112 | 12699002 | from scrapy.spiders import Spider
from scrapy.http import Request
from scrapy.selector import Selector
from crawler.items import ProxyIPItem
class CnProxySpider(Spider):
name = "cnproxy"
allowed_domains = ["cn-proxy.com"]
start_urls = [
"http://cn-proxy.com/",
"http://cn-proxy.com/archives/... |
nebullvm/installers/__init__.py | nebuly-ai/nebullvm | 821 | 12699011 | # flake8: noqa
from nebullvm.installers.installers import (
install_tvm,
install_tensor_rt,
install_openvino,
install_onnxruntime,
)
__all__ = [k for k in globals().keys() if not k.startswith("_")]
|
clearly/client/client.py | lowercase00/clearly | 344 | 12699023 | <gh_stars>100-1000
import functools
from collections import namedtuple
from datetime import datetime
from typing import Any, Callable, Iterable, Optional, Tuple, Union
import grpc
from about_time import about_time
from about_time.core import HandleStats
# noinspection PyProtectedMember
from celery.states import FAILUR... |
Find_Stocks/stock_data_sms.py | vhn0912/Finance | 441 | 12699037 | import smtplib
import datetime
import numpy as np
import pandas as pd
from email.mime.text import MIMEText
from yahoo_fin import stock_info as si
from pandas_datareader import DataReader
from email.mime.multipart import MIMEMultipart
from bs4 import BeautifulSoup
from urllib.request import urlopen, Request
from nltk.se... |
larq/snapshots/snap_quantized_variable_test.py | sfalkena/larq | 496 | 12699080 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import Snapshot
snapshots = Snapshot()
snapshots['test_repr[eager] 1'] = "<QuantizedVariable 'x:0' shape=() dtype=float32 quantizer=<lambda> numpy=0.0>"
snapshots['test_rep... |
examples/logical_interconnects.py | doziya/hpeOneView | 107 | 12699131 | # -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limi... |
scanners/zap-advanced/scanner/zapclient/context/__init__.py | kevin-yen/secureCodeBox | 488 | 12699148 | <reponame>kevin-yen/secureCodeBox
# SPDX-FileCopyrightText: 2021 iteratec GmbH
#
# SPDX-License-Identifier: Apache-2.0
"""
context
A Python package containing secureCodeBox specific ZAPv2 Client extensions to configure ZAP API contexts.
"""
__all__ = ['zap_context', 'zap_context_authentication']
from .zap_context im... |
ira/configuration.py | ShuaiW/kaggle-heart | 182 | 12699154 | <reponame>ShuaiW/kaggle-heart
import importlib
_config = None
_subconfig = None
def set_configuration(config_name):
global _config
_config = importlib.import_module("configurations.%s" % config_name)
print "loaded", _config
def set_subconfiguration(config_name):
global _subconfig
_subconfig = i... |
tests/test_commands/test_package_show.py | OliverHofkens/dephell | 1,880 | 12699163 | <reponame>OliverHofkens/dephell
# built-in
import json
# external
import pytest
# project
from dephell.commands import PackageShowCommand
from dephell.config import Config
@pytest.mark.allow_hosts()
def test_package_show_command(capsys):
config = Config()
config.attach({
'level': 'WARNING',
... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/o/old_division_floats.py | ciskoinch8/vimrc | 463 | 12699175 | from __future__ import print_function
print(float(1) / 2)
|
stp_core/loop/motor.py | andkononykhin/plenum | 148 | 12699185 | <gh_stars>100-1000
from stp_core.common.log import getlogger
from stp_core.loop.looper import Prodable
from stp_core.loop.startable import Status
logger = getlogger()
# TODO: move it to plenum-util repo
class Motor(Prodable):
"""
Base class for Prodable that includes status management.
Subclasses are re... |
src/ralph/data_center/__init__.py | DoNnMyTh/ralph | 1,668 | 12699189 | default_app_config = 'ralph.data_center.apps.DataCenterConfig'
|
setup.py | zwlanpishu/MCD | 158 | 12699211 | #!/usr/bin/python
"""A setuptools-based script for distributing and installing mcd."""
# Copyright 2014, 2015, 2016, 2017 <NAME>
# This file is part of mcd.
# See `License` for details of license and warranty.
import os
import numpy as np
from setuptools import setup
from setuptools.extension import Extension
from s... |
dataflows/helpers/iterable_loader.py | cschloer/dataflows | 160 | 12699220 | import itertools
import decimal
import datetime
from datapackage import Package, Resource
from tableschema.storage import Storage
from .. import DataStreamProcessor
class iterable_storage(Storage):
SAMPLE_SIZE = 100
def __init__(self, iterable):
super(iterable_storage, self).__init__()
sel... |
ppgan/models/generators/drn.py | wangna11BD/PaddleGAN | 6,852 | 12699230 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
#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... |
backend/logs/analyze_analytics_logs.py | sleepingAnt/viewfinder | 645 | 12699231 | # Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Run analysis over all merged user analytics logs.
Computes speed percentiles for full asset scans (only those lasting more than 1s for more accurate numbers).
Automatically finds the list of merged logs in S3. If --start_date=YYYY-MM-DD is specified, only anal... |
src/picktrue/gui/pinry_importer.py | winkidney/PickTrue | 118 | 12699235 | <reponame>winkidney/PickTrue<gh_stars>100-1000
import time
import tkinter as tk
from picktrue.gui.toolkit import ProgressBar, StatusBar, NamedInput, FileBrowse, info, FilePathBrowse, PasswordInput
from picktrue.pinry.importer import PinryImporter
from picktrue.utils import run_as_thread
class PinryImporterGUI(tk.Fra... |
datapackage_pipelines/lib/add_resource.py | gperonato/datapackage-pipelines | 109 | 12699238 | from datapackage_pipelines.wrapper import ingest, spew
import os
from datapackage_pipelines.utilities.resources import PATH_PLACEHOLDER, PROP_STREAMED_FROM
parameters, datapackage, res_iter = ingest()
if datapackage is None:
datapackage = {}
datapackage.setdefault('resources', [])
for param in ['url', 'name']... |
enaml/qt/docking/dock_overlay.py | xtuzy/enaml | 1,080 | 12699254 | <filename>enaml/qt/docking/dock_overlay.py<gh_stars>1000+
#------------------------------------------------------------------------------
# Copyright (c) 2013-2017, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this s... |
tradingview_ta/__init__.py | fluxguardian/python-tradingview-ta | 294 | 12699310 | from .main import TA_Handler, TradingView, Analysis, Interval, Exchange, get_multiple_analysis, __version__
from .technicals import Recommendation, Compute
|
deploy/app/main/views.py | wuchaohua/WeeklyReport | 131 | 12699321 | <reponame>wuchaohua/WeeklyReport
#coding:utf-8
from datetime import date
from flask import request, Response, redirect, url_for, current_app
from flask_admin.model import typefmt
from flask_admin.contrib.sqla import ModelView
from flask_babelex import lazy_gettext as _
from flask_login import current_user
import os
fro... |
monailabel/utils/others/generic.py | IntroAI-termproject/MONAILabel | 214 | 12699340 | <reponame>IntroAI-termproject/MONAILabel
# Copyright 2020 - 2021 MONAI Consortium
# 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 requi... |
src/JPDA_matching.py | reinforcementdriving/JRMOT_ROS | 112 | 12699344 | # vim: expandtab:ts=4:sw=4
from __future__ import absolute_import
import numpy as np
from linear_assignment import min_marg_matching
import pdb
def get_unmatched(all_idx, matches, i, marginalization=None):
assigned = [match[i] for match in matches]
unmatched = set(all_idx) - set(assigned)
if marginalizati... |
CondTools/Hcal/test/HcalInterpolatedPulseDBReader_cfg.py | ckamtsikis/cmssw | 852 | 12699363 | <filename>CondTools/Hcal/test/HcalInterpolatedPulseDBReader_cfg.py<gh_stars>100-1000
database = "sqlite_file:hcalPulse.db"
tag = "test"
outputfile = "hcalPulse_dbread.bbin"
import FWCore.ParameterSet.Config as cms
process = cms.Process('HcalInterpolatedPulseDBRead')
process.source = cms.Source('EmptySource')
proces... |
cfgov/v1/management/commands/sync_document_storage.py | Colin-Seifer/consumerfinance.gov | 156 | 12699400 | <filename>cfgov/v1/management/commands/sync_document_storage.py
from django.core.management.base import BaseCommand
from wagtail.documents import get_document_model
from ._sync_storage_base import SyncStorageCommandMixin
class Command(SyncStorageCommandMixin, BaseCommand):
def get_storage_directories(self):
... |
packages/pyright-internal/src/tests/samples/self5.py | Jasha10/pyright | 3,934 | 12699425 | <filename>packages/pyright-internal/src/tests/samples/self5.py
# This sample tests the use of `Self` when used within a property
# or class property.
from typing_extensions import Self
class A:
@property
def one(self) -> Self:
...
@classmethod
@property
def two(cls) -> type[Self]:
... |
gammapy/scripts/tests/test_main.py | JohannesBuchner/gammapy | 155 | 12699436 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from gammapy import __version__
from gammapy.scripts.main import cli
from gammapy.utils.testing import run_cli
def test_cli_no_args():
# No arguments should print help
result = run_cli(cli, [])
assert "Usage" in result.output
def test_cli_h... |
utildialog/numinputdialog.py | dragondjf/QMarkdowner | 115 | 12699498 | <reponame>dragondjf/QMarkdowner
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from qframer.qt import QtGui
from qframer.qt import QtCore
from basedialog import BaseDialog
class numinputDialog(BaseDialog):
def __init__(self, styleoptions, parent=None):
super(numinputDialog, self).__init__... |
clib/clib_mininet_test.py | boldsort/faucet | 393 | 12699505 | <reponame>boldsort/faucet
#!/usr/bin/env python3
"""Mininet tests for clib client library functionality.
* must be run as root
* you can run a specific test case only, by adding the class name of the test
case to the command. Eg ./clib_mininet_test.py FaucetUntaggedIPv4RouteTest
It is strongly recommended to ru... |
jraph/examples/basic.py | baskaransri/jraph | 871 | 12699510 | <gh_stars>100-1000
# Copyright 2020 DeepMind Technologies 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applica... |
bikeshed/stringEnum/__init__.py | saschanaz/bikeshed | 775 | 12699516 | from .StringEnum import StringEnum
|
qf_lib/backtesting/contract/contract_to_ticker_conversion/ib_bloomberg_mapper.py | webclinic017/qf-lib | 198 | 12699518 | # 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... |
ghostwriter/reporting/migrations/0016_auto_20201017_0014.py | bbhunter/Ghostwriter | 601 | 12699553 | <reponame>bbhunter/Ghostwriter
# Generated by Django 3.0.10 on 2020-10-17 00:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reporting', '0015_auto_20201016_1756'),
]
operations = [
migrations.RemoveF... |
boto3_type_annotations_with_docs/boto3_type_annotations/organizations/paginator.py | cowboygneox/boto3_type_annotations | 119 | 12699555 | <gh_stars>100-1000
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class ListAWSServiceAccessForOrganization(Paginator):
def paginate(self, PaginationConfig: Dict = None) -> Dict:
"""
Creates an iterator that will paginate through responses from :py:meth:`Or... |
test/test_numpy_utils.py | tirkarthi/mathics-core | 1,920 | 12699567 | <reponame>tirkarthi/mathics-core<filename>test/test_numpy_utils.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from mathics.builtin.numpy_utils import (
stack,
unstack,
concat,
vectorize,
conditional,
clip,
array,
choose,
)
from mathics.builtin.numpy_utils import (
... |
tests/conftest.py | BrendaH/django-machina | 572 | 12699572 | import os
import shutil
import pytest
from . import settings
@pytest.yield_fixture(scope='session', autouse=True)
def empty_media():
""" Removes the directories inside the MEDIA_ROOT that could have been filled during tests. """
yield
for candidate in os.listdir(settings.MEDIA_ROOT):
path = os.p... |
tests/rest/test_api_execute_logs.py | DmitryRibalka/monitorrent | 465 | 12699579 | <filename>tests/rest/test_api_execute_logs.py
from builtins import range
import json
import falcon
from mock import MagicMock
from ddt import ddt, data
from tests import RestTestBase
from monitorrent.rest.execute_logs import ExecuteLogs
class ExecuteLogsTest(RestTestBase):
def test_get_all(self):
entries ... |
_old/BeetlejuiceMachine/beetlejuicemachine.py | tigefa4u/reddit | 444 | 12699584 | #/u/GoldenSights
import praw # simple interface to the reddit API, also handles rate limiting of requests
import time
import sqlite3
'''USER CONFIGURATION'''
APP_ID = ""
APP_SECRET = ""
APP_URI = ""
APP_REFRESH = ""
# https://www.reddit.com/comments/3cm1p8/how_to_make_your_bot_use_oauth2/
USERAGENT = ""
#This is a sho... |
pyfacebook/api/instagram_business/resource/comment.py | sns-sdks/python-facebook | 181 | 12699588 | """
Apis for comment.
"""
from typing import Dict, Optional, Union
import pyfacebook.utils.constant as const
from pyfacebook.api.base_resource import BaseResource
from pyfacebook.models.ig_business_models import IgBusComment, IgBusReply, IgBusReplies
from pyfacebook.utils.params_utils import enf_comma_separated
... |
cassandra_snapshotter/utils.py | kadamanas93/cassandra_snapshotter | 203 | 12699592 | import sys
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import argparse
import functools
import subprocess
LZOP_BIN = 'lzop'
PV_BIN = 'pv'
S3_CONNECTION_HOSTS = {
'us-east-1': 's3.amazonaws.com',
'us-east-2': 's3-us-east-2.amazonaws.com',
'us-west-2': 's3-... |
test/integration/test_multiple_model_endpoint.py | ipanepen/sagemaker-scikit-learn-container | 105 | 12699599 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... |
data/transcoder_evaluation_gfg/python/SUBARRAYS_DISTINCT_ELEMENTS.py | mxl1n/CodeGen | 241 | 12699605 | <gh_stars>100-1000
# 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 ( arr , n ) :
s = [ ]
j = 0
ans = 0
for i in range ( n ) :
while ( j < n a... |
tests/test_resolvers/test_environment_variable.py | dennisconrad/sceptre | 493 | 12699606 | # -*- coding: utf-8 -*-
from mock import patch
from sceptre.resolvers.environment_variable import EnvironmentVariable
class TestEnvironmentVariableResolver(object):
def setup_method(self, test_method):
self.environment_variable_resolver = EnvironmentVariable(
argument=None
)
@p... |
utils/ema.py | yoxu515/aot-benchmark | 105 | 12699623 | <reponame>yoxu515/aot-benchmark
from __future__ import division
from __future__ import unicode_literals
import torch
def get_param_buffer_for_ema(model,
update_buffer=False,
required_buffers=['running_mean', 'running_var']):
params = model.parameters()
... |
needl/adapters/__init__.py | NeuroWinter/Needl | 413 | 12699624 | import requests
from requests.packages.urllib3 import poolmanager
__all__ = (
'poolmanager'
) |
bodymocap/utils/geometry.py | Paultool/frankmocap | 1,612 | 12699637 | <filename>bodymocap/utils/geometry.py
# Original code from SPIN: https://github.com/nkolot/SPIN
import torch
from torch.nn import functional as F
import numpy as np
import torchgeometry
"""
Useful geometric operations, e.g. Perspective projection and a differentiable Rodrigues formula
Parts of the code are taken fr... |
baselines/CACB/.old/build-cacb-tree.py | sordonia/HierarchicalEncoderDecoder | 116 | 12699665 | """
__author__ <NAME>
"""
import logging
import cPickle
import os
import sys
import argparse
import cacb
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('cluster_file', type=str, help='Pickled cluster fi... |
07_compiling/cffi/diffusion_2d_cffi.py | siddheshmhatre/high_performance_python | 698 | 12699687 | #!/usr/bin/env python2.7
import numpy as np
import time
from cffi import FFI, verifier
grid_shape = (512, 512)
ffi = FFI()
ffi.cdef(
r''' void evolve(int Nx, int Ny, double **in, double **out, double D, double dt); ''')
lib = ffi.dlopen("../diffusion.so")
def evolve(grid, dt, out, D=1.0):
X, Y = grid_shape... |
grappa/empty.py | sgissinger/grappa | 137 | 12699700 | # -*- coding: utf-8 -*-
class Empty(object):
"""
Empty object represents emptyness state in `grappa`.
"""
def __repr__(self):
return 'Empty'
def __len__(self):
return 0
# Object reference representing emptpyness
empty = Empty()
|
animalai/animalai/communicator_objects/__init__.py | southpawac/AnimalAI-Olympics | 607 | 12699725 | from .arenas_configurations_proto_pb2 import *
from .arena_configuration_proto_pb2 import *
from .items_to_spawn_proto_pb2 import *
from .vector_proto_pb2 import *
from .__init__ import *
|
slybot/slybot/fieldtypes/url.py | rmcwilliams2004/PAscrape | 6,390 | 12699774 | import re
from six.moves.urllib.parse import urljoin
from scrapely.extractors import url as strip_url
from scrapy.utils.url import safe_download_url
from scrapy.utils.markup import unquote_markup
from slybot.baseurl import get_base_url
disallowed = re.compile('[\x00-\x1F\x7F]')
class UrlFieldTypeProcessor(object):
... |
utility/audiosegment.py | jasonaidm/Speech_emotion_recognition_BLSTM | 245 | 12699791 | <reponame>jasonaidm/Speech_emotion_recognition_BLSTM
"""
This module simply exposes a wrapper of a pydub.AudioSegment object.
"""
from __future__ import division
from __future__ import print_function
import collections
import functools
import itertools
import math
import numpy as np
import pickle
import pydub
import o... |
PyOpenGLExample/mouse.py | DazEB2/SimplePyScripts | 117 | 12699800 | <reponame>DazEB2/SimplePyScripts
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
"""
Mouse interaction
This piece of code will capture mouse clicks by the user. Every time the user
presses the left mouse the current point is pushed onto an array, when the right
mouse button is pressed the ... |
autotest/test_gwf_auxvars02.py | MODFLOW-USGS/modflow6 | 102 | 12699805 | import os
import pytest
import sys
import numpy as np
try:
import pymake
except:
msg = "Error. Pymake package is not available.\n"
msg += "Try installing using the following command:\n"
msg += " pip install https://github.com/modflowpy/pymake/zipball/master"
raise Exception(msg)
try:
import fl... |
kernel_tuner/kernelbuilder.py | cffbots/kernel_tuner | 104 | 12699806 | import numpy as np
from kernel_tuner import core
from kernel_tuner.interface import Options, _kernel_options
from kernel_tuner.integration import TuneResults
class PythonKernel(object):
def __init__(self, kernel_name, kernel_string, problem_size, arguments, params=None, inputs=None, outputs=None, device=0, plat... |
test/optimizers/test_optimizers.py | dynamicslab/pysindy | 613 | 12699891 | """
Unit tests for optimizers.
"""
import numpy as np
import pytest
from numpy.linalg import norm
from scipy.integrate import odeint
from sklearn.base import BaseEstimator
from sklearn.exceptions import ConvergenceWarning
from sklearn.exceptions import NotFittedError
from sklearn.linear_model import ElasticNet
from skl... |
rman_sg_nodes/rman_sg_emitter.py | N500/RenderManForBlender | 432 | 12699922 | from .rman_sg_node import RmanSgNode
class RmanSgEmitter(RmanSgNode):
def __init__(self, rman_scene, sg_node, db_name):
super().__init__(rman_scene, sg_node, db_name)
self.matrix_world = None
self.npoints = -1
self.render_type = ''
self.sg_particles_node = None
@proper... |
windows_packages_gpu/torch/utils/__init__.py | codeproject/DeepStack | 353 | 12699928 | from __future__ import absolute_import, division, print_function, unicode_literals
from .throughput_benchmark import ThroughputBenchmark
import os.path as _osp
# Set the module for a given object for nicer printing
def set_module(obj, mod):
if not isinstance(mod, str):
raise TypeError("The mod a... |
analysis/regex_test.py | maxwellyin/arxiv-public-datasets | 217 | 12699929 | <gh_stars>100-1000
"""
regex_test.py
author: <NAME>
date: 2019-03-16
This module samples the fulltext of the arxiv, pulls out some arxiv IDs, and
then checks these IDs against valid ones in our set of metadata, producing
a report of bad id's found so that we can improve the citation extraction.
"""
import os
import... |
rkqc/tools/gui/items/TransformationBasedSynthesisItem.py | clairechingching/ScaffCC | 158 | 12699932 | # RevKit: A Toolkit for Reversible Circuit Design (www.revkit.org)
# Copyright (C) 2009-2011 The RevKit Developers <<EMAIL>>
#
# This program 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 o... |
sprocket/speech/synthesizer.py | zhouming-hfut/sprocket | 500 | 12699941 | # -*- coding: utf-8 -*-
import numpy as np
import pyworld
import pysptk
from pysptk.synthesis import MLSADF
class Synthesizer(object):
"""
Speech synthesizer with several acoustic features
Parameters
----------
fs: int, optional
Sampling frequency
Default set to 16000
fftl: i... |
pyabc/sampler/redis_eps/work.py | ICB-DCM/pyABC | 144 | 12699943 | """Function to work on a population in dynamic mode."""
import sys
from redis import StrictRedis
import cloudpickle as pickle
from time import sleep, time
import logging
from ..util import any_particle_preliminary
from .cmd import (
N_EVAL, N_ACC, N_REQ, N_FAIL, ALL_ACCEPTED, N_WORKER, N_LOOKAHEAD_EVAL,
SSA, ... |
opytimizer/optimizers/swarm/pso.py | gugarosa/opytimizer | 528 | 12700032 | <reponame>gugarosa/opytimizer
"""Particle Swarm Optimization-based algorithms.
"""
import copy
import numpy as np
import opytimizer.math.random as r
import opytimizer.utils.constant as c
import opytimizer.utils.exception as e
import opytimizer.utils.logging as l
from opytimizer.core import Optimizer
logger = l.get_... |
effdet/data/dataset.py | AgentVi/efficientdet-pytorch | 1,386 | 12700034 | <gh_stars>1000+
""" Detection dataset
Hacked together by <NAME>
"""
import torch.utils.data as data
import numpy as np
from PIL import Image
from .parsers import create_parser
class DetectionDatset(data.Dataset):
"""`Object Detection Dataset. Use with parsers for COCO, VOC, and OpenImages.
Args:
par... |
zentral/contrib/santa/migrations/0022_auto_20210121_1745.py | gwhitehawk/zentral | 634 | 12700061 | # Generated by Django 2.2.17 on 2021-01-21 17:45
from django.db import migrations
POLICY_DICT = {
"BLACKLIST": 2,
"WHITELIST": 1,
"SILENT_BLACKLIST": 3,
}
def convert_santa_probes(apps, schema_editor):
ProbeSource = apps.get_model("probes", "ProbeSource")
Tag = apps.get_model("inventory", "Tag"... |
third_party/catapult/experimental/qbot/qbot/api.py | zipated/src | 2,151 | 12700083 | <reponame>zipated/src
# Copyright 2017 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 httplib2
import json
from oauth2client import service_account # pylint: disable=no-name-in-module
import os
import sys
DEFAULT... |
lib/python/treadmill/cli/run.py | krcooke/treadmill | 133 | 12700085 | """Manage Treadmill app manifest.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import shlex
import click
import six
from six.moves import urllib_parse
from treadmill import cli
from t... |
pyexcel/internal/utils.py | quis/pyexcel | 1,045 | 12700105 | def default_getter(attribute=None):
"""a default method for missing renderer method
for example, the support to write data in a specific file type
is missing but the support to read data exists
"""
def none_presenter(_, **__):
"""docstring is assigned a few lines down the line"""
r... |
aliyun-python-sdk-moguan-sdk/aliyunsdkmoguan_sdk/request/v20210415/RegisterDeviceRequest.py | yndu13/aliyun-openapi-python-sdk | 1,001 | 12700121 | <reponame>yndu13/aliyun-openapi-python-sdk
# 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, V... |
dialogue-engine/test/programytest/rdf/test_creation.py | cotobadesign/cotoba-agent-oss | 104 | 12700160 | <gh_stars>100-1000
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, mer... |
count.py | kamata1729/shiftresnet-cifar | 132 | 12700183 | <reponame>kamata1729/shiftresnet-cifar<gh_stars>100-1000
from models import ResNet20
from models import ShiftResNet20
from models import ResNet56
from models import ShiftResNet56
from models import ResNet110
from models import ShiftResNet110
import torch
from torch.autograd import Variable
import numpy as np
import arg... |
test_models/create.py | nktch1/tfgo | 2,010 | 12700219 | # Copyright (C) 2017-2020 <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
# Exhibit B is not attached; this software is compatible with the
# licenses... |
tests/transformers/xslt_test.py | elifesciences/sciencebeam | 272 | 12700224 | <filename>tests/transformers/xslt_test.py
from lxml import etree
from sciencebeam.transformers.xslt import _to_xslt_input
class TestToXsltInput:
def test_should_tolerate_duplicate_ids(self):
result: etree.ElementBase = _to_xslt_input(
'''
<xml>
<item xml:id="id1">item ... |
tests/basics/tuple_compare.py | peterson79/pycom-micropython-sigfox | 303 | 12700226 | <reponame>peterson79/pycom-micropython-sigfox
print(() == ())
print(() > ())
print(() < ())
print(() == (1,))
print((1,) == ())
print(() > (1,))
print((1,) > ())
print(() < (1,))
print((1,) < ())
print(() >= (1,))
print((1,) >= ())
print(() <= (1,))
print((1,) <= ())
print((1,) == (1,))
print((1,) != (1,))
print((1,) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.