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 |
|---|---|---|---|---|
desktop/core/ext-py/kerberos-1.3.0/pysrc/kerberos.py | yetsun/hue | 5,079 | 66601 | ##
# Copyright (c) 2006-2018 Apple 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 l... |
sdks/python/http_client/v1/polyaxon_sdk/api/tags_v1_api.py | polyaxon/polyaxon | 3,200 | 66631 | #!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... |
tests/benchmark/generate_libsvm.py | bclehmann/xgboost | 23,866 | 66655 | """Generate synthetic data in LIBSVM format."""
import argparse
import io
import time
import numpy as np
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
RNG = np.random.RandomState(2019)
def generate_data(args):
"""Generates the data."""
print("Generati... |
maskrcnn_benchmark/modeling/rpn/fcos/loss.py | Yuliang-Liu/bezier_curve_text_spotting | 423 | 66666 | """
This file contains specific functions for computing losses of FCOS
file
"""
import torch
from torch import nn
from torch.nn import functional as F
from maskrcnn_benchmark.layers import IOULoss
from maskrcnn_benchmark.layers import SigmoidFocalLoss
from maskrcnn_benchmark.utils.comm import reduce_sum, get_world_si... |
optimum/utils/preprocessing/text_classification.py | huggingface/optimum | 414 | 66675 | <reponame>huggingface/optimum
from functools import partial
from typing import Dict, List
from datasets import Dataset, Metric, load_dataset
from transformers import PretrainedConfig, PreTrainedTokenizerBase, TextClassificationPipeline
from transformers.pipelines.text_classification import ClassificationFunction
from... |
pypy/module/_io/interp_textio.py | m4sterchain/mesapy | 381 | 66700 | <gh_stars>100-1000
import sys
from pypy.interpreter.baseobjspace import W_Root
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
from pypy.interpreter.typedef import (
GetSetProperty, TypeDef, generic_new_descr, interp_attrproperty... |
tests/nest_test.py | cheginit/nest_asyncio | 362 | 66705 | import asyncio
import sys
import unittest
import nest_asyncio
def exception_handler(loop, context):
print('Exception:', context)
class NestTest(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_event_loop()
nest_asyncio.apply(self.loop)
asyncio.set_event_loop(self.loop)
... |
widgy/contrib/widgy_mezzanine/site.py | isopets/django-widgy | 168 | 66709 | <gh_stars>100-1000
from mezzanine.utils.sites import current_site_id, has_site_permission
from widgy.models import Content
class MultiSitePermissionMixin(object):
def _can_edit_content(self, request, obj):
if isinstance(obj, Content):
owners = obj.get_root().node.versiontracker_set.get().owner... |
gryphon/lib/exchange/itbit_btc_usd.py | scooke11/gryphon | 1,109 | 66717 | <filename>gryphon/lib/exchange/itbit_btc_usd.py<gh_stars>1000+
"""
Exchange documentation: https://api.itbit.com/docs
"""
# -*- coding: utf-8 -*-
import base64
from collections import OrderedDict, defaultdict
import hashlib
import hmac
import json
import time
import urllib
import cdecimal
from cdecimal import Decimal... |
rpython/rlib/test/test_signature.py | nanjekyejoannah/pypy | 333 | 66729 | import py
from rpython.rlib.signature import signature, finishsigs, FieldSpec, ClassSpec
from rpython.rlib import types
from rpython.annotator import model
from rpython.rtyper.llannotation import SomePtr
from rpython.annotator.signature import SignatureError
from rpython.translator.translator import TranslationContext,... |
kivy/input/providers/linuxwacom.py | VICTORVICKIE/kivy | 13,889 | 66757 | <filename>kivy/input/providers/linuxwacom.py
'''
Native support of Wacom tablet from linuxwacom driver
=====================================================
To configure LinuxWacom, add this to your configuration::
[input]
pen = linuxwacom,/dev/input/event2,mode=pen
finger = linuxwacom,/dev/input/event3,m... |
dagobah/daemon/api.py | usertesting/dagobah | 574 | 66788 | <reponame>usertesting/dagobah<filename>dagobah/daemon/api.py
""" HTTP API methods for Dagobah daemon. """
import StringIO
import json
from flask import request, abort, send_file
from flask_login import login_required
from .daemon import app
from .util import validate_dict, api_call, allowed_file
dagobah = app.confi... |
lit_nlp/lib/utils_test.py | eichinflo/lit | 2,854 | 66790 | <gh_stars>1000+
# 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 ... |
alipay/aop/api/response/AlipayCommerceEducateXuexinIdentityQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 66800 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayCommerceEducateXuexinIdentityQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayCommerceEducateXuexinIdentityQueryResponse, self).__init_... |
Lib/heapq.py | pelotoncycle/cpython-fork | 332 | 66812 | """Heap queue algorithm (a.k.a. priority queue).
Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
all k, counting elements from 0. For the sake of comparison,
non-existing elements are considered to be infinite. The interesting
property of a heap is that a[0] is always its smallest element.
Usag... |
src/VerifyEmailAddress.py | MyPersonalUserSF/Python-Email-Verification-Script | 166 | 66836 | import re
import smtplib
import dns.resolver
# Address used for SMTP MAIL FROM command
fromAddress = '<EMAIL>'
# Simple Regex for syntax checking
regex = '^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$'
# Email address to verify
inputAddress = input('Please enter the emailAddress to verify:')... |
conans/test/unittests/util/detect_test.py | fanStefan/conan | 6,205 | 66862 | <filename>conans/test/unittests/util/detect_test.py
import mock
import unittest
from mock import Mock
from parameterized import parameterized
from conans.client import tools
from conans.client.conf.detect import detect_defaults_settings
from conans.paths import DEFAULT_PROFILE_NAME
from conans.test.utils.mocks import... |
GardenPi/utilities/power_controller.py | rjsears/GardenPi | 220 | 66873 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
power_controller.py for usage with neptune/GardenPi V1.0.0
Manages all of our power zones.
"""
VERSION = "V1.0.0 (2020-07-31)"
import sys
sys.path.append('/var/www/gardenpi_control/gardenpi')
from sqlalchemy import update, select, and_, create_engine
import system_in... |
skhep/utils/__init__.py | scikit-hep/scikit-hep | 150 | 66875 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license, see LICENSE.
"""
Module for miscellaneous and general utilities.
"""
from .exceptions import *
|
misc/scripts/vocoder/straight/extract_features_for_merlin.py | G-Thor/merlin | 1,305 | 66911 | <filename>misc/scripts/vocoder/straight/extract_features_for_merlin.py
import os
import sys
import shutil
import glob
import time
import multiprocessing as mp
if len(sys.argv)!=5:
print("Usage: ")
print("python extract_features_for_merlin.py <path_to_merlin_dir> <path_to_wav_dir> <path_to_feat_dir> <sampling r... |
plugins/honeypot.py | Appnet1337/OSINT-SAN | 313 | 66920 | #Developer by Bafomet
# -*- coding: utf-8 -*-
import requests
from settings import shodan_api
# color
R = "\033[31m" # Red
G = "\033[1;34m" # Blue
C = "\033[1;32m" # Green
W = "\033[0m" # white
O = "\033[45m" # Purple
def honeypot(inp):
url = f"https://api.shodan.io/labs/honeyscore/{inp}"
try:
... |
src/nlpia/loaders.py | AAAI-DISIM-UnivAQ/nlpia | 532 | 66940 | <filename>src/nlpia/loaders.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Loaders and downloaders for data files and models required for the examples in NLP in Action
>>> df = get_data('cities_us')
>>> df.iloc[:3,:2]
geonameid city
131484 4295856 Indian Hills Cherokee Secti... |
Chapter09/state_2.py | shoshan/Clean-Code-in-Python | 402 | 66943 | """Clean Code in Python - Chapter 9: Common Design Patterns
> State
"""
import abc
from log import logger
from state_1 import InvalidTransitionError
class MergeRequestState(abc.ABC):
def __init__(self, merge_request):
self._merge_request = merge_request
@abc.abstractmethod
def open(self):
... |
tools/test_apps/system/panic/app_test.py | lovyan03/esp-idf | 8,747 | 66953 | #!/usr/bin/env python
import sys
import panic_tests as test
from test_panic_util.test_panic_util import panic_test, run_all
# test_task_wdt
@panic_test(target=['ESP32', 'ESP32S2'])
def test_panic_task_wdt(env, _extra_data):
test.task_wdt_inner(env, 'panic')
@panic_test()
def test_coredump_task_wdt_uart_elf_crc... |
tests/test_gitlab.py | trathborne/nvchecker | 320 | 66966 | <reponame>trathborne/nvchecker<filename>tests/test_gitlab.py
# MIT licensed
# Copyright (c) 2013-2020 lilydjwg <<EMAIL>>, et al.
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.needs_net]
async def test_gitlab(get_version):
ver = await get_version("example", {
"source": "gitlab",
"git... |
orochi/users/migrations/0003_user_services.py | garanews/orochi | 121 | 66981 | # Generated by Django 3.1 on 2020-08-05 13:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0012_service'),
('users', '0002_alter_user_first_name'),
]
operations = [
migrations.AddField(
model_name='user... |
src/benchmark_metrics.py | Yixiao99/deep-learning-containers | 383 | 66998 | <filename>src/benchmark_metrics.py
from packaging.specifiers import SpecifierSet
from packaging.version import Version
# TensorFlow
# Throughput, unit: images/second
TENSORFLOW_TRAINING_CPU_SYNTHETIC_THRESHOLD = {"<2.0": 50, ">=2.0": 50}
TENSORFLOW_TRAINING_GPU_SYNTHETIC_THRESHOLD = {"<2.0": 5000, ">=2.0": 7000}
TENS... |
h2o-docs/src/booklets/v2_2015/source/GBM_Vignette_code_examples/gbm_uploadfile_example.py | ahmedengu/h2o-3 | 6,098 | 67010 | <gh_stars>1000+
import h2o
h2o.init()
weather_hex = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/junit/weather.csv")
# Get a summary of the data
weather_hex.describe()
|
samples/vsphere/vcenter/topologysvc/list_replication_status.py | JKraftman/vsphere-automation-sdk-python | 589 | 67033 | #!/usr/bin/env python
"""
* *******************************************************
* Copyright (c) VMware, Inc. 2020. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS... |
mmhuman3d/core/cameras/camera_parameters.py | yl-1993/mmhuman3d | 472 | 67045 | import json
import warnings
from enum import Enum
from typing import Any, List, Tuple, Union
import numpy as np
import torch
from mmhuman3d.core.cameras.cameras import PerspectiveCameras
from mmhuman3d.core.conventions.cameras.convert_convention import (
convert_camera_matrix,
convert_K_3x3_to_4x4,
conver... |
modules/dbnd/src/dbnd/_vendor/tenacity/tests/test_tornado.py | busunkim96/dbnd | 224 | 67051 | <reponame>busunkim96/dbnd
# coding: utf-8
# Copyright 2017 <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 applica... |
pwnables/rusty_shop/solve.py | cclauss/fbctf-2019-challenges | 213 | 67067 | from pwn import *
# Create item
print('1')
FUNC = 0x701e40
#FUNC = 0x41414141 + 0x18
vtable_ptr = FUNC-0x18
print(p64(vtable_ptr) * 8) # name - pointer to fake vtable
print('bob') # description
print('1.23') # price
# Add item to basket
print('4')
print('1') # second item, added above
print('28823037615171174... |
open_seq2seq/encoders/encoder.py | VoiceZen/OpenSeq2Seq | 1,459 | 67076 | # Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import abc
import copy
import six
import tensorflow as tf
from open_seq2seq.optimizers.mp_wrapper import mp_regularizer_wrapper
from open_seq2seq.utils.utils import check_p... |
timeflux/nodes/sequence.py | HerySon/timeflux | 123 | 67083 | """timeflux.nodes.sequence: generate a sequence"""
from timeflux.core.node import Node
class Sequence(Node):
def __init__(self):
"""Generate a sequence"""
self._current = 0
def update(self):
self.o.set([self._current])
self._current += 1
|
utils/vim-lldb/python-vim-lldb/lldb_controller.py | nathawes/swift-lldb | 427 | 67085 |
#
# This file defines the layer that talks to lldb
#
import os
import re
import sys
import lldb
import vim
from vim_ui import UI
# =================================================
# Convert some enum value to its string counterpart
# =================================================
# Shamelessly copy/pasted from ... |
openproblems/api/load.py | dburkhardt/SingleCellOpenProblems | 134 | 67087 | <filename>openproblems/api/load.py
from . import utils
def load_dataset(task_name, function_name, test):
"""Load a dataset for a task."""
fun = utils.get_function(task_name, "datasets", function_name)
return fun(test=test)
def main(args):
"""Run the ``load`` subcommand."""
adata = load_dataset(a... |
src/lib/detectors/ddd.py | nerminsamet/houghnet | 161 | 67088 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import numpy as np
from progress.bar import Bar
import time
import torch
from src.lib.external.nms import soft_nms
from src.lib.models.decode import ddd_decode
from src.lib.models.utils import flip_... |
docs/conch/benchmarks/buffering_mixin.py | Khymeira/twisted | 4,612 | 67090 | <gh_stars>1000+
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Benchmarks comparing the write performance of a "normal" Protocol instance
and an instance of a Protocol class which has had L{twisted.conch.mixin}'s
L{BufferingMixin<twisted.conch.mixin.BufferingMixin>} mixed in to perform
Nag... |
show-adapt-tell/pretrain_CNN_D.py | tsenghungchen/show-adapt-and-tell | 166 | 67110 | <gh_stars>100-1000
from __future__ import division
import os
import time
import tensorflow as tf
import numpy as np
from tqdm import tqdm
from highway import *
import pdb
class D_pretrained():
def __init__(self, sess, dataset, negative_dataset, D_info, conf=None, l2_reg_lambda=0.2):
self.sess = sess
... |
content/test/gpu/gpu_tests/maps.py | iplo/Chain | 231 | 67114 | <filename>content/test/gpu/gpu_tests/maps.py<gh_stars>100-1000
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs a Google Maps pixel test.
Performs several common navigation actions on the map (pan, ... |
python/runtime/dbapi/__init__.py | hebafer/sqlflow | 4,742 | 67119 | # Copyright 2020 The SQLFlow 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 required by applicable law o... |
OthertCrawler/0x08fofa/Fofa_spider.py | wangbl11/ECommerceCrawlers | 3,469 | 67120 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__author__ = 'AJay'
__mtime__ = '2019/5/13 0013'
"""
import base64
import random
import time
import pymongo
from pyquery import PyQuery as pq
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdrive... |
examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/preload-pysnmp-mibs.py | flaviut/pysnmp | 492 | 67137 | """
Preload PySNMP MIBs
+++++++++++++++++++
Send a series of SNMP GETNEXT requests using the following options:
* with SNMPv3 with user 'usr-md5-des', MD5 auth and DES privacy protocols
* over IPv4/UDP
* to an Agent at demo.snmplabs.com:161
* for all OIDs starting from 1.3.6
* preload all Python MIB modules found in ... |
utime/hypnogram/__init__.py | aluquecerp/U-Time | 138 | 67139 | <gh_stars>100-1000
from .hypnograms import SparseHypnogram, DenseHypnogram
|
bootstrapvz/common/tools.py | zeridon/bootstrap-vz | 207 | 67162 | from __future__ import print_function
import os
def log_check_call(command, stdin=None, env=None, shell=False, cwd=None):
status, stdout, stderr = log_call(command, stdin, env, shell, cwd)
from subprocess import CalledProcessError
if status != 0:
e = CalledProcessError(status, ' '.join(command), '... |
test/models/test_gin.py | rlckd159/deep-graph-matching-consensus | 194 | 67179 | from itertools import product
import torch
from dgmc.models import GIN
def test_gin():
model = GIN(16, 32, num_layers=2, batch_norm=True, cat=True, lin=True)
assert model.__repr__() == ('GIN(16, 32, num_layers=2, batch_norm=True, '
'cat=True, lin=True)')
x = torch.randn(1... |
pyvcloud/vcd/api_extension.py | lrivallain/pyvcloud | 168 | 67195 | # VMware vCloud Director Python SDK
# Copyright (c) 2018 VMware, 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
#... |
tests/utils/test_extendable_enum.py | ZackPashkin/toloka-kit | 153 | 67209 | <gh_stars>100-1000
import pytest
from enum import Enum
from toloka.client._converter import converter
from toloka.util._extendable_enum import extend_enum, ExtendableStrEnum
from toloka.client.primitives.base import BaseTolokaObject
@pytest.fixture
def test_enum():
class TestEnum(Enum):
A = 'a'
B... |
alipay/aop/api/domain/AlipayEbppIndustryBillNettingRefundModel.py | snowxmas/alipay-sdk-python-all | 213 | 67213 | <filename>alipay/aop/api/domain/AlipayEbppIndustryBillNettingRefundModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.IndustryExtendField import IndustryExtendField
class AlipayEbppIndustryBillNettingRefundModel(object):
... |
terrascript/spotinst/__init__.py | hugovk/python-terrascript | 507 | 67266 | # terrascript/spotinst/__init__.py
import terrascript
class spotinst(terrascript.Provider):
pass
|
wetectron/data/transforms/build.py | akobiisr/wetectron | 332 | 67270 | # --------------------------------------------------------
# Copyright (C) 2020 NVIDIA Corporation. All rights reserved.
# Nvidia Source Code License-NC
# --------------------------------------------------------
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from . import transform... |
Chapter10/url_response_header.py | add54/ADMIN_SYS_PYTHON | 116 | 67290 | <reponame>add54/ADMIN_SYS_PYTHON
import urllib.request
x = urllib.request.urlopen('https://www.imdb.com/')
print(x.info())
|
deepchem/dock/tests/test_pose_scoring.py | cjgalvin/deepchem | 3,782 | 67296 | <filename>deepchem/dock/tests/test_pose_scoring.py
"""
Tests for Pose Scoring
"""
import logging
import unittest
import numpy as np
from deepchem.dock.pose_scoring import vina_nonlinearity
from deepchem.dock.pose_scoring import vina_hydrophobic
from deepchem.dock.pose_scoring import vina_gaussian_first
from deepchem.... |
tests/gen_vectors/gen_uint128_intrinsics_vectors.py | cryspen/hacl-star | 201 | 67311 | import os
import random
import itertools
vector_template = '''static uint64_t {}[{}] =
{{
{}
}};
'''
max_u64 = 0xffffffffffffffff
max_u64_str = str(hex(max_u64))
def get_random_u64 (size):
return '0x' + (os.urandom(size).hex() if size != 0 else '0')
def print_vectors (name, l):
return vector_template.f... |
src/genie/libs/parser/iosxe/tests/ShowRunInterface/cli/equal/golden_output12_expected.py | balmasea/genieparser | 204 | 67314 | <reponame>balmasea/genieparser<filename>src/genie/libs/parser/iosxe/tests/ShowRunInterface/cli/equal/golden_output12_expected.py
expected_output={
"interfaces": {
"Tunnel100": {
"autoroute_announce": "enabled",
"src_ip": "Loopback0",
"tunnel_bandwidth": 500,
"tunnel_dst": "2.2.2.2"... |
src/fidesctl/cli/commands/generate.py | ethyca/fides | 153 | 67321 | <filename>src/fidesctl/cli/commands/generate.py
"""Contains the generate group of CLI commands for Fidesctl."""
import click
from fidesctl.cli.options import (
aws_access_key_id_option,
aws_region_option,
aws_secret_access_key_option,
connection_string_option,
credentials_id_option,
include_nu... |
tests/test_options.py | gliptak/pyfinance | 278 | 67327 | # flake8: noqa
# Test cases taken from:
# - Thomas Ho Company LTD: financial models,
# http://www.thomasho.com/mainpages/analysoln.asp
# - Analysis of Derivatives for the Chartered Financial Analyst® Program,
# <NAME>, PhD, CFA, ©2003 CFA Institute
import types
import numpy as np
import pandas as pd
from pyfina... |
src/oci/file_storage/models/snapshot.py | Manny27nyc/oci-python-sdk | 249 | 67330 | <filename>src/oci/file_storage/models/snapshot.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.com/licenses/upl or Apache License 2.0 as shown at htt... |
neupy/architectures/mixture_of_experts.py | FrostByte266/neupy | 801 | 67333 | import tensorflow as tf
from neupy import layers
from neupy.utils import tf_utils, as_tuple
from neupy.layers.base import BaseGraph
__all__ = ('mixture_of_experts',)
def check_if_network_is_valid(network, index):
if not isinstance(network, BaseGraph):
raise TypeError(
"Invalid input, Mixtur... |
python/coqtop.py | Lysxia/Coqtail | 160 | 67334 | # -*- coding: utf8 -*-
# Author: <NAME>
"""Coqtop interface with functions to send commands and parse responses."""
import datetime
import logging
import signal
import subprocess
import threading
import time
from concurrent import futures
from queue import Empty, Queue
from tempfile import NamedTemporaryFile
from typi... |
edafa/ClassPredictor.py | andrewekhalel/tf_predictor | 134 | 67353 | <reponame>andrewekhalel/tf_predictor<gh_stars>100-1000
from .BasePredictor import BasePredictor
from .exceptions import UnsupportedDataType
import numpy as np
class ClassPredictor(BasePredictor):
def __init__(self,conf):
"""
Initialize class
:param conf: configuration (json string or file path)
"""
super... |
lib/python2.7/site-packages/scipy/optimize/tests/test_lsq_linear.py | wfehrnstrom/harmonize | 6,989 | 67356 | import numpy as np
from numpy.linalg import lstsq
from numpy.testing import (assert_allclose, assert_equal, assert_,
run_module_suite, assert_raises)
from scipy.sparse import rand
from scipy.sparse.linalg import aslinearoperator
from scipy.optimize import lsq_linear
A = np.array([
[0.17... |
courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/tagme/admin.py | Nahid-Hassan/fullstack-software-development | 297 | 67369 | <gh_stars>100-1000
from django.contrib import admin
# Register your models here.
from tagme.models import Forum, Comment
admin.site.register(Forum)
admin.site.register(Comment)
|
libcxx/utils/run.py | mkinsner/llvm | 2,338 | 67390 | <gh_stars>1000+
#!/usr/bin/env python
#===----------------------------------------------------------------------===##
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
... |
plugins/dbnd-test-scenarios/src/dbnd_test_scenarios/test_common/targets/base_target_test_mixin.py | ipattarapong/dbnd | 224 | 67415 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import abc
import os
import random
import pandas as pd
import pytest
from pandas.util.testing import assert_frame_equal
from pytest import fixture
import targets
import targets.errors
import targets.pipes
from dbnd.testing.helpers_pyte... |
dvc/command/ls/ls_colors.py | indhupriya/dvc | 9,136 | 67422 | <gh_stars>1000+
import os
class LsColors:
default = "rs=0:di=01;34:ex=01;32"
def __init__(self, lscolors=None):
self._extensions = {}
self._codes = {}
self._load(lscolors or os.environ.get("LS_COLORS") or LsColors.default)
def _load(self, lscolors):
for item in lscolors.s... |
scripts/build_singularity_container.py | mens-artis/Auto-PyTorch | 1,657 | 67447 | import os, subprocess
if __name__ == "__main__":
move_into_container = list()
if input("Do you want to move some of your local files into to container? This will overwrite files from origin/master. (y/n) ").startswith("y"):
for f in sorted(os.listdir()):
if input("Move %s into container (y/... |
configs/kitti_config.py | wqdun/MobileNet | 1,698 | 67454 | from easydict import EasyDict as edict
import numpy as np
config = edict()
config.IMG_HEIGHT = 375
config.IMG_WIDTH = 1242
# TODO(shizehao): infer fea shape in run time
config.FEA_HEIGHT = 12
config.FEA_WIDTH = 39
config.EPSILON = 1e-16
config.LOSS_COEF_BBOX = 5.0
config.LOSS_COEF_CONF_POS = 75.0
config.LOSS_COEF_... |
tools/visualize_results_v2.py | kruda/DetectAndTrack | 1,007 | 67458 | <reponame>kruda/DetectAndTrack
##############################################################
# Copyright (c) 2018-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.
####################################... |
talos/reducers/forrest.py | zazula/talos | 1,536 | 67472 | def forrest(self):
'''Random Forrest based reduction strategy. Somewhat more
aggressive than for example 'spearman' because there are no
negative values, but instead the highest positive correlation
is minused from all the values so that max value is 0, and then
values are turned into positive. The... |
python/setup.py | wangmiao1981/sparkMeasure | 453 | 67485 | <filename>python/setup.py<gh_stars>100-1000
#!/usr/bin/env python
from setuptools import setup, find_packages
description = 'Python API for sparkMeasure, a tool for performance troubleshooting of Apache Spark workloads'
long_description = """SparkMeasure is a tool for performance troubleshooting of Apache Spark work... |
web/test/test.py | thekad/clusto | 216 | 67497 | <filename>web/test/test.py<gh_stars>100-1000
from rest import request
from pprint import pprint
from traceback import format_exc
try: import json
except ImportError: import simplejson as json
BASE_URL = 'http://localhost:9999'
def test_default_delegate():
status, headers, data = request('GET', BASE_URL + '/')
... |
example_nodes/math_node.py | 996268132/NodeGraphQt | 582 | 67506 | <filename>example_nodes/math_node.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import example_nodes.wrappers.math as math
import inspect
from functools import partial
from NodeGraphQt import BaseNode
class MathFunctionsNode(BaseNode):
"""
Math functions node.
"""
# set a unique node identifier.
_... |
ryu/ofproto/nx_match.py | hiArvin/ryu | 269 | 67507 | # Copyright (C) 2011, 2012 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2011, 2012 <NAME> <yamahata at valinux co jp>
# Copyright (C) 2012 <NAME> <horms ad verge net au>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
... |
fuxi/web/views/blue_view.py | cocobear/fuxi | 731 | 67513 | <filename>fuxi/web/views/blue_view.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : jeffzhang
# @Time : 2019/1/21
# @File : blue_views.py
# @Desc : ""
from fuxi.web.flask_app import flask_app
from flask import jsonify
from flask import request, Blueprint, render_template
from fu... |
scripts/external_libs/scapy-2.4.5/scapy/layers/tuntap.py | dariusgrassi/trex-core | 250 | 67518 | <filename>scripts/external_libs/scapy-2.4.5/scapy/layers/tuntap.py
# -*- mode: python3; indent-tabs-mode: nil; tab-width: 4 -*-
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under... |
angr/analyses/class_identifier.py | matthewpruett/angr | 6,132 | 67533 | <filename>angr/analyses/class_identifier.py
from ..sim_type import SimCppClass, SimTypeCppFunction
from ..analyses import AnalysesHub
from . import Analysis
class ClassIdentifier(Analysis):
"""
This is a class identifier for non stripped or partially stripped binaries, it identifies classes based on ... |
subadmin/templatetags/subadmin_tags.py | inueni/django-subadmin | 133 | 67542 | from django.urls import reverse
from django.contrib.admin.templatetags.admin_modify import submit_row
from django.utils.encoding import force_text
from django.template import Library
register = Library()
@register.inclusion_tag('subadmin/breadcrumbs.html', takes_context=True)
def subadmin_breadcrumbs(context):
r... |
tests/test_chi_library.py | joshagoldstein/city-scrapers | 255 | 67572 | from datetime import datetime
from os.path import dirname, join
from unittest.mock import MagicMock
import pytest
from city_scrapers_core.constants import BOARD, TENTATIVE
from city_scrapers_core.utils import file_response
from freezegun import freeze_time
from city_scrapers.spiders.chi_library import ChiLibrarySpide... |
ffcv/memory_managers/process_cache/page_reader.py | neuroailab/ffcv | 1,969 | 67574 | from threading import Thread
from queue import Queue
import numpy as np
from ...libffcv import read
class PageReader(Thread):
def __init__(self, fname:str, queries: Queue, loaded: Queue,
memory: np.ndarray):
self.fname: str = fname
self.queries: Queue = queries
self.mem... |
pyhanko/pdf_utils/filters.py | peteris-zealid/pyHanko | 161 | 67575 | <reponame>peteris-zealid/pyHanko
"""
Implementation of stream filters for PDF.
Taken from PyPDF2 with modifications. See :ref:`here <pypdf2-license>`
for the original license of the PyPDF2 project.
Note that not all decoders specified in the standard are supported.
In particular ``/Crypt`` and ``/LZWDecode`` are miss... |
PytoTests/test_pyto.py | snazari/Pyto | 701 | 67576 | <gh_stars>100-1000
"""
Tests for Pyto before submitting to the App Store.
"""
import unittest
import runpy
import sys
import os
class TestPyto(unittest.TestCase):
def test_lib(self):
from Lib import (apps, location, mainthread, motion,
multipeer, music, notification_center, notifications,
... |
vergeml/plots/roc.py | vergeml/VergeML | 324 | 67582 | <reponame>vergeml/VergeML
from vergeml.command import command, CommandPlugin
from vergeml.option import option
from vergeml.plots import load_labels
import os.path
import csv
from vergeml.utils import VergeMLError
import numpy as np
@command('roc', descr="Plot a ROC curve.")
@option('@AI')
@option('class', type='Opti... |
Kerning/KernCrash Current Glyph.py | jpt/Glyphs-Scripts | 283 | 67612 | <reponame>jpt/Glyphs-Scripts<filename>Kerning/KernCrash Current Glyph.py
#MenuTitle: KernCrash Current Glyph
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Opens a new tab containing kerning combos with the current glyph that collide in the current fontmaster.
"""
... |
flocker/common/process.py | stackriot/flocker | 2,690 | 67653 | <gh_stars>1000+
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Subprocess utilities.
"""
from subprocess import PIPE, STDOUT, CalledProcessError, Popen
from eliot import Message, start_action
from pyrsistent import PClass, field
class _CalledProcessError(CalledProcessError):
"""
Just like ``C... |
brml/myzeros.py | herupraptono/pybrml | 136 | 67672 | #!/usr/bin/env python
"""
same as myzeros() in MATLAB
MYZEROS same as zeros(x) but if x is a scalar interprets as zeros([x 1])
"""
import numpy as np
def myzeros(x):
print "x =", x
x = np.array(x)
if x.size > 1:
out=np.zeros(x)
else:
out=np.zeros((x,1))
return out
|
ppci/lang/sexpr.py | windelbouwman/ppci | 161 | 67725 | <reponame>windelbouwman/ppci<filename>ppci/lang/sexpr.py
""" Functionality to tokenize and parse S-expressions.
"""
import io
from .common import SourceLocation
from .tools.handlexer import HandLexerBase
from .tools.recursivedescent import RecursiveDescentParser
__all__ = ("parse_sexpr",)
def tokenize_sexpr(text):... |
examples/faster/faster_generation/samples/gpt_sample.py | JeremyZhao1998/PaddleNLP | 7,091 | 67749 | # Copyright (c) 2021 PaddlePaddle 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 required by appli... |
tests/utils/test_fs.py | andriyor/cement | 826 | 67755 |
import os
from pytest import raises
from cement.utils import fs
def test_abspath(tmp):
path = fs.abspath('.')
assert path.startswith('/')
def test_join(tmp, rando):
full_path = os.path.abspath(os.path.join(tmp.dir, rando))
assert fs.join(tmp.dir, rando) == full_path
def test_join_exists(tmp, rand... |
tutorials/W2D5_GenerativeModels/solutions/W2D5_Tutorial1_Solution_f63c0e9f.py | justynaekert/course-content-dl | 473 | 67760 |
"""
An Autoencoder accepts input, compresses it, and recreates it. On the other hand,
VAEs assume that the source data has some underlying distribution and attempts
to find the distribution parameters. So, VAEs are similar to GANs
(but note that GANs work differently, as we will see in the next tutorials).
"""; |
generate-GTFS-shapes/scripts/Step1_MakeShapesFC.py | d-wasserman/public-transit-tools | 130 | 67769 | ###############################################################################
## Tool name: Generate GTFS Route Shapes
## Step 1: Generate Shapes on Map
## Creator: <NAME>, Esri
## Last updated: 4 September 2019
###############################################################################
''' This tool genera... |
sympy/physics/quantum/constants.py | shipci/sympy | 319 | 67778 | """Constants (like hbar) related to quantum mechanics."""
from __future__ import print_function, division
from sympy.core.numbers import NumberSymbol
from sympy.core.singleton import Singleton
from sympy.core.compatibility import u, with_metaclass
from sympy.printing.pretty.stringpict import prettyForm
import sympy.m... |
pymatgen/core/tests/test_ion.py | chunweizhu/pymatgen | 921 | 67787 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import random
import unittest
from pymatgen.core.composition import Composition
from pymatgen.core.ion import Ion
from pymatgen.core.periodic_table import Element
class IonTest(unittest.TestCase):
def s... |
src/mnist/ops.py | val-iisc/deligan | 117 | 67807 | import numpy as np
import tensorflow as tf
class batch_norm(object):
"""Code modification of http://stackoverflow.com/a/33950177"""
def __init__(self, epsilon=1e-5, momentum = 0.9, name="batch_norm"):
with tf.variable_scope(name):
self.epsilon = epsilon
self.momentum = momentum
... |
setup.py | gekco/commandment | 138 | 67815 | from setuptools import setup, find_packages
setup(
name="commandment",
version="0.1",
description="Commandment is an Open Source Apple MDM server with support for managing iOS and macOS devices",
packages=['commandment'],
include_package_data=True,
author="mosen",
license="MIT",
url="htt... |
examples/python/contextual_optimization.py | CQCL/pytket | 249 | 67824 | # # Contextual optimisation
# This notebook will illustrate the techniques of "contextual optimisation" available in TKET.
# See the user manaul for an introduction to the concept and methods. Here we will present an example showing how we can save some gates at the beginnning and end of a circuit, making no assumpti... |
pytorch_toolkit/face_recognition/model/blocks/mobilenet_v2_blocks.py | AnastasiaaSenina/openvino_training_extensions | 158 | 67867 | <filename>pytorch_toolkit/face_recognition/model/blocks/mobilenet_v2_blocks.py
"""
Copyright (c) 2018 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... |
s3prl/downstream/voxceleb2_ge2e/model.py | hhhaaahhhaa/s3prl | 856 | 67873 | <filename>s3prl/downstream/voxceleb2_ge2e/model.py
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ model.py ]
# Synopsis [ the linear model ]
# Author [ S3PRL ]
# Copyright [ Copyleft(c), Speech Lab, NTU,... |
Stock/Common/Ui/Deal/Basic/DyStockDealDetailsWidget.py | Leonardo-YXH/DevilYuan | 135 | 67905 | <gh_stars>100-1000
from DyCommon.Ui.DyStatsTableWidget import *
class DyStockDealDetailsWidget(DyStatsTableWidget):
colNames = ['时间', '价格', '成交量(手)', '类型']
def __init__(self, dataEngine):
super().__init__(None, True, False, autoScroll=False)
self._ticksEngine = dataEngine.ticksEngine
... |
research/carls/dynamic_embedding_ops.py | srihari-humbarwadi/neural-structured-learning | 939 | 67911 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.