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 |
|---|---|---|---|---|
shorttext/metrics/embedfuzzy/__init__.py | vishalbelsare/PyShortTextCategorization | 481 | 115345 | <gh_stars>100-1000
from .jaccard import jaccardscore_sents |
llvm/utils/lit/tests/lld-features.py | mkinsner/llvm | 2,338 | 115354 | <reponame>mkinsner/llvm<filename>llvm/utils/lit/tests/lld-features.py
## Show that each of the LLD variants detected by use_lld comes with its own
## feature.
# RUN: %{lit} %{inputs}/lld-features 2>&1 | FileCheck %s -DDIR=%p
# CHECK: Passed: 4
|
pyEX/platform/platform.py | vishalbelsare/pyEX | 107 | 115379 | # *****************************************************************************
#
# Copyright (c) 2021, the pyEX authors.
#
# This file is part of the pyEX library, distributed under the terms of
# the Apache License 2.0. The full license can be found in the LICENSE file.
#
from functools import wraps
import json
impo... |
pil_pillow__examples/crop.py | DazEB2/SimplePyScripts | 117 | 115412 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install Pillow
from PIL import Image
image_file = "blur/input.jpg"
img = Image.open(image_file)
cropped_img = img.crop((175, 42, 336, 170))
cropped_img.show()
|
ebcli/operations/platform_version_ops.py | sdolenc/aws-elastic-beanstalk-cli | 110 | 115542 | <filename>ebcli/operations/platform_version_ops.py
# Copyright 2015 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.... |
tests/spectral/test_S2_conv.py | machism0/lie_learn | 140 | 115560 | <reponame>machism0/lie_learn<filename>tests/spectral/test_S2_conv.py
import numpy as np
import lie_learn.spaces.S2 as S2
import lie_learn.spaces.S3 as S3
import lie_learn.groups.SO3 as SO3
from lie_learn.representations.SO3.spherical_harmonics import sh
from lie_learn.spectral.S2_conv import naive_S2_conv, spectral_S... |
etl/parsers/etw/HidEventFilter.py | IMULMUL/etl-parser | 104 | 115564 | <reponame>IMULMUL/etl-parser
# -*- coding: utf-8 -*-
"""
HidEventFilter
GUID : dde50426-fa77-4088-8e0c-f2f553fb6843
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from etl.dtyp impor... |
test/Actions/addpost-link-fixture/strip.py | moroten/scons | 1,403 | 115586 | <reponame>moroten/scons
import sys
print("strip.py: %s" % " ".join(sys.argv[1:]))
|
common/trainers/trecqa_trainer.py | karkaroff/castor | 132 | 115593 | <gh_stars>100-1000
from .qa_trainer import QATrainer
class TRECQATrainer(QATrainer):
pass
|
benchmark/bench_redirect_from_logging.py | YoavCohen/logbook | 771 | 115608 | """Tests redirects from logging to logbook"""
from logging import getLogger
from logbook import StreamHandler
from logbook.compat import redirect_logging
from cStringIO import StringIO
redirect_logging()
log = getLogger('Test logger')
def run():
out = StringIO()
with StreamHandler(out):
for x in xra... |
liota/dccs/dcc.py | giyyanan/liota | 361 | 115621 | <filename>liota/dccs/dcc.py
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------#
# Copyright © 2015-2016 VMware, Inc. All Rights Reserved. #
# #
# Licensed under the BSD 2-... |
tests/ut/python/privacy/evaluation/test_membership_inference.py | hboshnak/mindarmour | 139 | 115640 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
e4e_projection.py | Harry45/JoJoGAN | 1,051 | 115670 | <gh_stars>1000+
import os
import sys
import numpy as np
from PIL import Image
import torch
import torchvision.transforms as transforms
from argparse import Namespace
from e4e.models.psp import pSp
from util import *
@ torch.no_grad()
def projection(img, name, device='cuda'):
model_path = 'models/e4e_ffhq_encode.p... |
tutorial/stage0/setup.py | cloudmatrix/esky | 190 | 115727 | <gh_stars>100-1000
import sys
# for windows
# > python setup.py py2exe
if sys.argv[1] == 'py2exe':
import py2exe
from distutils.core import setup
setup(
name = "example-app",
version = "0.0",
console = ["example.py"]
)
# for mac
# > python setup.py py2app
elif sys.argv[1] ==... |
Ryven/packages/auto_generated/selectors/nodes.py | tfroehlich82/Ryven | 2,872 | 115742 |
from NENV import *
import selectors
class NodeBase(Node):
pass
class _Can_Use_Node(NodeBase):
"""
Check if we can use the selector depending upon the
operating system. """
title = '_can_use'
type_ = 'selectors'
init_inputs = [
NodeInputBP(label='method'),
]
init_ou... |
utils/management/commands/rqworker.py | schiederme/peering-manager | 173 | 115777 | from django.conf import settings
from django_rq.management.commands.rqworker import Command as C
class Command(C):
"""
Subclass django_rq's built-in rqworker to listen on all configured queues if none
are specified (instead of only the 'default' queue).
"""
def handle(self, *args, **options):
... |
examples/outliers/alibi-detect-combiner/pipeline/outliersdetector/Detector.py | jsreid13/seldon-core | 3,049 | 115815 | <reponame>jsreid13/seldon-core
import logging
import dill
import os
import numpy as np
dirname = os.path.dirname(__file__)
class Detector:
def __init__(self, *args, **kwargs):
with open(os.path.join(dirname, "preprocessor.dill"), "rb") as prep_f:
self.preprocessor = dill.load(prep_f)
... |
src/extract_n_solve/grid_detector.py | krishnabagaria/sudoku-solver | 615 | 115825 | import cv2
from settings import *
from src.solving_objects.MyHoughLines import *
from src.solving_objects.MyHoughPLines import *
def line_intersection(my_line1, my_line2):
line1 = [[my_line1[0], my_line1[1]], [my_line1[2], my_line1[3]]]
line2 = [[my_line2[0], my_line2[1]], [my_line2[2], my_line2[3]]]
xdi... |
tests/roots/test-ext-autodoc/target/imported_members.py | samdoran/sphinx | 4,973 | 115833 | from .partialfunction import func2, func3
|
avatar2/protocols/jlink.py | ispras/avatar2 | 415 | 115861 | import sys
import pylink
from time import sleep
from threading import Thread, Event, Condition
import logging
import re
if sys.version_info < (3, 0):
import Queue as queue
# __class__ = instance.__class__
else:
import queue
from avatar2.archs.arm import ARM
from avatar2.targets import TargetStates
from av... |
f5/multi_device/cluster/test/functional/teardown_exist.py | nghia-tran/f5-common-python | 272 | 115869 | from f5.bigip import ManagementRoot
from f5.cluster.cluster_manager import ClusterManager
a = ManagementRoot('10.190.20.202', 'admin', 'admin')
b = ManagementRoot('10.190.20.203', 'admin', 'admin')
c = ManagementRoot('10.190.20.204', 'admin', 'admin')
cm = ClusterManager([a, b], 'testing_cluster', 'Common', 'sync-fai... |
will/backends/io_adapters/hipchat.py | Ashex/will | 349 | 115910 | from datetime import datetime
import json
import logging
from multiprocessing.queues import Empty
from multiprocessing import Process, Queue
import random
import re
import requests
import pickle
import sys
import time
import threading
import traceback
from sleekxmpp import ClientXMPP
from sleekxmpp.exceptions import I... |
tracing/tracing_build/vulcanize_histograms_viewer.py | tingshao/catapult | 2,151 | 115926 | <reponame>tingshao/catapult<filename>tracing/tracing_build/vulcanize_histograms_viewer.py
# 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 tracing_project
from py_vulcanize import generate
from trac... |
examples/gaussian/main.py | trevorcampbell/hilbert-coresets | 118 | 115944 | <gh_stars>100-1000
import numpy as np
import scipy.linalg as sl
import pickle as pk
import os, sys
import argparse
import time
#make it so we can import models/etc from parent folder
import bayesiancoresets as bc
sys.path.insert(1, os.path.join(sys.path[0], '../common'))
import model_gaussian as gaussian
import results... |
results-processor/processor_test.py | lucacasonato/wpt.fyi | 122 | 115979 | # Copyright 2019 The WPT Dashboard Project. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import unittest
from unittest.mock import call, patch
from werkzeug.datastructures import MultiDict
import test_util
import wptreport
from... |
bin/evaluate-dataset-Adult.py | e-orlov/autosklearn-zeroconf | 176 | 115991 | <reponame>e-orlov/autosklearn-zeroconf
# -*- coding: utf-8 -*-
"""
Copyright 2017 <NAME>
Created on Sun Apr 23 11:52:59 2017
@author: ekobylkin
This is an example on how to prepare data for autosklearn-zeroconf.
It is using a well known Adult (Salary) dataset from UCI https://archive.ics.uci.edu/ml/datasets/Adult .
""... |
pipeline/python/ion/reports/plotKey.py | konradotto/TS | 125 | 115992 | # Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved
import os
from ion.reports.plotters import plotters
from numpy import median
class KeyPlot:
def __init__(self, key, floworder, title=None):
self.data = None
self.key = key
self.floworder = floworder
self.title = ti... |
retail-of-the-future-demo/IgniteSolution/modules/CameraStream/camera-stream/camera.py | piyushka17/azure-intelligent-edge-patterns | 176 | 115993 | import cv2
import os, logging, time, json
import requests, base64
from flask import Flask, jsonify, request, Response
import numpy as np
# for HTTP/1.1 support
from werkzeug.serving import WSGIRequestHandler
app = Flask(__name__)
logging.basicConfig(format='%(asctime)s %(levelname)-10s %(message)s', datefmt="%Y-%m-... |
main/neigh_samplers.py | RuYunW/Graph2Seq-master | 210 | 116005 | from layers import Layer
import tensorflow as tf
class UniformNeighborSampler(Layer):
"""
Uniformly samples neighbors.
Assumes that adj lists are padded with random re-sampling
"""
def __init__(self, adj_info, **kwargs):
super(UniformNeighborSampler, self).__init__(**kwargs)
s... |
homeassistant/components/dnsip/const.py | MrDelik/core | 30,023 | 116006 | <reponame>MrDelik/core<gh_stars>1000+
"""Constants for dnsip integration."""
from homeassistant.const import Platform
DOMAIN = "dnsip"
PLATFORMS = [Platform.SENSOR]
CONF_HOSTNAME = "hostname"
CONF_RESOLVER = "resolver"
CONF_RESOLVER_IPV6 = "resolver_ipv6"
CONF_IPV4 = "ipv4"
CONF_IPV6 = "ipv6"
DEFAULT_HOSTNAME = "myi... |
diagrams/k8s/podconfig.py | Shimpei-GANGAN/diagrams | 17,037 | 116008 | # This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _K8S
class _Podconfig(_K8S):
_type = "podconfig"
_icon_dir = "resources/k8s/podconfig"
class CM(_Podconfig):
_icon = "cm.png"
class Secret(_Podconfig):
_icon = "secret.png"
# Aliases
ConfigMap = CM
|
envi/qt/config.py | rnui2k/vivisect | 716 | 116017 | <reponame>rnui2k/vivisect<gh_stars>100-1000
'''
A widget for editing EnviConfig options.
'''
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import *
class EnviConfigOption:
def __init__(self, config, name, value):
self.econfig = config
self.ename = name
self.evalue = value... |
data/transforms/utils.py | apple/ml-cvnets | 209 | 116019 | <reponame>apple/ml-cvnets<gh_stars>100-1000
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from typing import Any
import numpy as np
def setup_size(size: Any, error_msg="Need a tuple of length 2"):
if isinstance(size, int):
return size, size
i... |
suplemon/modules/diff.py | johnmbaughman/suplemon | 912 | 116043 | <gh_stars>100-1000
# -*- encoding: utf-8
import difflib
from suplemon.suplemon_module import Module
class Diff(Module):
"""View a diff of the current file compared to it's on disk version."""
def run(self, app, editor, args):
curr_file = app.get_file()
curr_path = curr_file.get_path()
... |
cachebrowser/settings/development.py | zhenyihan/cachebrowser | 1,206 | 116050 | <gh_stars>1000+
from cachebrowser.settings.base import CacheBrowserSettings
class DevelopmentSettings(CacheBrowserSettings):
def set_defaults(self):
self.host = "0.0.0.0"
self.port = 8080
self.ipc_port = 9000
self.database = 'db.sqlite'
self.bootstrap_sources = [
... |
tests/components/freedompro/test_init.py | MrDelik/core | 30,023 | 116067 | """Freedompro component tests."""
import logging
from unittest.mock import patch
from homeassistant.components.freedompro.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from tests.common import MockConfigEntry
LOGGER = logging.getLogger(__name__)
ENTITY_ID = f"{DOMAIN}.fake_name"
as... |
test/hlt/pytest/python/com/huawei/iotplatform/client/dto/ServiceCapabilityDTO.py | yuanyi-thu/AIOT- | 128 | 116089 | from com.huawei.iotplatform.client.dto.ServiceCommand import ServiceCommand
from com.huawei.iotplatform.client.dto.ServiceProperty import ServiceProperty
class ServiceCapabilityDTO(object):
commands = ServiceCommand()
properties = ServiceProperty()
def __init__(self):
self.serviceId = None
... |
matminer/featurizers/site/external.py | ncfrey/matminer | 326 | 116138 | <gh_stars>100-1000
"""
Site featurizers requiring external libraries for core functionality.
"""
from monty.dev import requires
from pymatgen.io.ase import AseAtomsAdaptor
from sklearn.exceptions import NotFittedError
from pymatgen.core import Structure
from matminer.featurizers.base import BaseFeaturizer
# SOAPFeatu... |
codes/python/basics_in_machine_learning/dataaugmentation.py | agnes-yang/TensorFlow-Course | 7,040 | 116150 | <filename>codes/python/basics_in_machine_learning/dataaugmentation.py
# -*- coding: utf-8 -*-
"""dataaugmentation.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1ibfKtpxC_hIhZlPbefCoqpAS7jTdyiFw
"""
import tensorflow as tf
import tensorflow_data... |
pyNastran/bdf/mesh_utils/mpc_dependency.py | ACea15/pyNastran | 293 | 116176 | """
defines methods to access MPC/rigid element data:
- get_mpc_node_ids( mpc_id, stop_on_failure=True)
- get_mpc_node_ids_c1( mpc_id, stop_on_failure=True)
- get_rigid_elements_with_node_ids(self, node_ids)
- get_dependent_nid_to_components(self, mpc_id=None, stop_on_failure=True)
- get_lines_rigid(model: BD... |
python/GafferImageUI/ImageReaderPathPreview.py | ddesmond/gaffer | 561 | 116193 | ##########################################################################
#
# Copyright (c) 2017, Image Engine Design 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:
#
# * Redistrib... |
__scraping__/transfermarkt.co.uk/main.py | whitmans-max/python-examples | 140 | 116230 | #!/usr/bin/env python3
# date: 2020.03.05
#
import requests
from bs4 import BeautifulSoup
url = "http://www.S/ederson/profil/spieler/238223"
response = requests.get(url, headers={'user-agent':"Mozilla/5.0"})
soup = BeautifulSoup(response.text, 'html.parser')
table = soup.find('table', {'class': 'auflistung'})
d... |
tests/components/nuheat/test_init.py | tbarbette/core | 30,023 | 116233 | <reponame>tbarbette/core<filename>tests/components/nuheat/test_init.py
"""NuHeat component tests."""
from unittest.mock import patch
from homeassistant.components.nuheat.const import DOMAIN
from .mocks import MOCK_CONFIG_ENTRY, _get_mock_nuheat
from tests.common import MockConfigEntry
VALID_CONFIG = {
"nuheat":... |
payment/filter.py | wh8983298/GreaterWMS | 1,063 | 116264 | <filename>payment/filter.py
from django_filters import FilterSet
from .models import TransportationFeeListModel
class TransportationFeeListFilter(FilterSet):
class Meta:
model = TransportationFeeListModel
fields = {
"id": ['exact', 'iexact', 'gt', 'gte', 'lt', 'lte', 'isnull', 'in', 'ra... |
tests/syntax/def_list_as_arg_2.py | matan-h/friendly | 287 | 116269 | def test(x, [y]): # list as second argument, after comma
pass |
scripts/build_config.py | Simon-Will/neuralmonkey | 446 | 116278 | <gh_stars>100-1000
#!/usr/bin/env python3
"""Loads and builds a given config file in memory.
Can be used for checking that a model can be loaded successfully, or for
generating a vocabulary from a dataset, without the need to run the model.
"""
import argparse
import collections
from typing import Any, Dict
import n... |
Exec/radiation_tests/RadSuOlsonMG/python/read_gnu.py | MargotF/Castro | 178 | 116286 | #!/usr/bin/python
from numpy import *
def read_gnu_file(filenm):
x = []
y = []
f = open(filenm, 'r')
line = f.readline()
t = float(line.split('"')[1].split('=')[2])
for line in f.readlines():
if not line[0] == ";":
words = line.split()
x.append(float(words[0]))
... |
python/cuxfilter/charts/panel_widgets/panel_widgets.py | ajschmidt8/cuxfilter | 201 | 116294 | <reponame>ajschmidt8/cuxfilter
from ctypes import ArgumentError
from .plots import (
Card,
NumberChart,
RangeSlider,
DateRangeSlider,
IntSlider,
FloatSlider,
DropDown,
MultiSelect,
DataSizeIndicator,
)
from ..constants import CUDF_TIMEDELTA_TYPE
def range_slider(
x,
width=4... |
pyxb/bundles/opengis/misc/xAL.py | eLBati/pyxb | 123 | 116320 | from pyxb.bundles.opengis.misc.raw.xAL import *
|
Training/MOOC Tensorflow 2.0/BeiDa/class1/p22_random.uniform.py | church06/Pythons | 177 | 116321 | import tensorflow as tf
f = tf.random.uniform([2, 2], minval=0, maxval=1)
print("f:", f)
|
sequana/resources/data/__init__.py | vladsaveliev/sequana | 138 | 116329 | <reponame>vladsaveliev/sequana
"""
Some useful data sets to be used in the analysis
The command :func:`sequana.sequana_data` may be used to retrieved data from
this package. For example, a small but standard reference (phix) is used in
some NGS experiments. The file is small enough that it is provided within
sequa... |
Calibration/TkAlCaRecoProducers/python/ALCARECOPromptCalibProdSiStrip_cff.py | ckamtsikis/cmssw | 852 | 116339 | <reponame>ckamtsikis/cmssw
import FWCore.ParameterSet.Config as cms
import HLTrigger.HLTfilters.hltHighLevel_cfi
ALCARECOPromptCalibProdSiStripHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
andOr = True, ## choose logical OR between Triggerbits
eventSetupPathsKey = 'PromptCalibProdSiStrip',
... |
textbox/evaluator/abstract_evaluator.py | StevenTang1998/TextBox | 347 | 116379 | # @Time : 2020/11/14
# @Author : <NAME>, <NAME>
# @Email : <EMAIL>
# UPDATE
# @Time : 2021/4/12
# @Author : <NAME>
# @Email : <EMAIL>
"""
textbox.evaluator.abstract_evaluator
#####################################
"""
import numpy as np
class AbstractEvaluator(object):
""":class:`AbstractEvaluator` is an ... |
research/glue/model.py | legacyai/tf-transformers | 116 | 116404 | <reponame>legacyai/tf-transformers
from transformers import AlbertTokenizer
from tf_transformers.core import Trainer
from tf_transformers.models import AlbertModel as Model
from tf_transformers.optimization import create_optimizer
MODEL_NAME = "albert-base-v2"
def get_model(return_all_layer_outputs, is_training, us... |
demos/app-server/apps/base.py | wecatch/app-turbo | 157 | 116428 | <filename>demos/app-server/apps/base.py<gh_stars>100-1000
# -*- coding:utf-8 -*-
from .settings import (
LANG as _LANG,
)
import turbo.app
from store import actions
class MixinHandler(turbo.app.BaseHandler):
pass
class BaseHandler(MixinHandler):
_session = None
def initialize(self):
supe... |
py3nvml/__init__.py | m5imunovic/py3nvml | 216 | 116446 | <gh_stars>100-1000
from __future__ import absolute_import
from py3nvml import py3nvml
from py3nvml import nvidia_smi
from py3nvml.utils import grab_gpus, get_free_gpus, get_num_procs
__all__ = ['py3nvml', 'nvidia_smi', 'grab_gpus', 'get_free_gpus', 'get_num_procs']
__version__ = "0.2.6"
|
examples/context_eddystone_beacon.py | ddunmire/python-bleson | 103 | 116460 | #!/usr/bin/env python3
import sys
from time import sleep
from bleson import get_provider, EddystoneBeacon
# Get the wait time from the first script argument or default it to 10 seconds
WAIT_TIME = int(sys.argv[1]) if len(sys.argv)>1 else 10
with EddystoneBeacon(get_provider().get_adapter(), 'https://www.bluetooth.co... |
filaments/teamviewer_remote_file_copy.py | Monkeyman21/fibratus | 1,604 | 116461 | # Copyright 2019-2020 by <NAME> (RabbitStack)
# All Rights Reserved.
# http://rabbitstack.github.io
# 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... |
flaskerize/schematics/flask-api/files/{{ name }}.template/app/widget/model.py | ehoeffner/flaskerize | 119 | 116484 | <filename>flaskerize/schematics/flask-api/files/{{ name }}.template/app/widget/model.py
from sqlalchemy import Integer, Column, String
from app import db # noqa
from .interface import WidgetInterface
class Widget(db.Model): # type: ignore
"""A snazzy Widget"""
__tablename__ = "widget"
widget_id = Colu... |
devel/test_timeout.py | saidbakr/darkhttpd | 788 | 116509 | #!/usr/bin/env python3
# This is run by the "run-tests" script.
import unittest
import signal
import socket
class TestTimeout(unittest.TestCase):
def test_timeout(self):
port = 12346
s = socket.socket()
s.connect(("0.0.0.0", port))
# Assumes the server has --timeout 1
signal... |
src/holodeck/__init__.py | LaudateCorpus1/holodeck | 518 | 116518 | <reponame>LaudateCorpus1/holodeck<gh_stars>100-1000
"""Holodeck is a high fidelity simulator for reinforcement learning.
"""
__version__ = "0.3.2.dev0"
from holodeck.holodeck import make
from holodeck.packagemanager import *
__all__ = [
"agents",
"environments",
"exceptions",
"holodeck",
"make",
... |
nboost/plugins/prerank.py | rajeshkp/nboost | 646 | 116531 | <reponame>rajeshkp/nboost
from nboost.plugins import Plugin
from nboost.delegates import ResponseDelegate
from nboost.database import DatabaseRow
import numpy as np
from multiprocessing import Pool, cpu_count
import math
from nltk.stem import PorterStemmer
from nltk.tokenize import word_tokenize
from nltk.corpus import... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/r/redefine_loop.py | ciskoinch8/vimrc | 463 | 116539 | <gh_stars>100-1000
"""Test case for variable redefined in inner loop."""
for item in range(0, 5):
print("hello")
for item in range(5, 10): #[redefined-outer-name]
print(item)
print("yay")
print(item)
print("done")
|
tests/test_futures.py | PyO3/tokio | 239 | 116550 | <filename>tests/test_futures.py
# Copied from the uvloop project. If you add a new unittest here,
# please consider contributing it to the uvloop project.
#
# Portions copyright (c) 2015-present MagicStack Inc. http://magic.io
import asyncio
import concurrent.futures
import re
import sys
import threading
from asynci... |
2021/CVE-2021-45232/poc/others/apisix_dashboard_rce.py | hjyuan/reapoc | 421 | 116552 | #!/usr/bin/env python3
import zlib
import json
import random
import requests
import string
import sys
eval_config = {
"Counsumers": [],
"Routes": [
{
"id": str(random.randint(100000000000000000, 1000000000000000000)),
"create_time": 1640674554,
"update_time": 164067... |
apps/base/views/product_brand.py | youssriaboelseod/pyerp | 115 | 116590 | <reponame>youssriaboelseod/pyerp<filename>apps/base/views/product_brand.py
# Django Library
from django.contrib.auth.mixins import LoginRequiredMixin
from django.utils.translation import ugettext_lazy as _
# Localfolder Library
from ..models import PyProductBrand
from .web_father import (
FatherCreateView, FatherD... |
sdk/storage/azure-storage-blob/tests/perfstress_tests/T1_legacy_tests/upload_block.py | rsdoherty/azure-sdk-for-python | 2,728 | 116599 | <reponame>rsdoherty/azure-sdk-for-python<filename>sdk/storage/azure-storage-blob/tests/perfstress_tests/T1_legacy_tests/upload_block.py<gh_stars>1000+
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed und... |
angr/concretization_strategies/range.py | Kyle-Kyle/angr | 6,132 | 116614 | from . import SimConcretizationStrategy
class SimConcretizationStrategyRange(SimConcretizationStrategy):
"""
Concretization strategy that resolves addresses to a range.
"""
def __init__(self, limit, **kwargs): #pylint:disable=redefined-builtin
super(SimConcretizationStrategyRange, self).__init... |
nnef_tools/io/nnef/helpers.py | dvorotnev/NNEF-Tools | 193 | 116638 | # Copyright (c) 2020 The Khronos Group Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
examples/blocks/get_block_reward.py | adamzhang1987/py-etherscan-api | 458 | 116660 | from etherscan.blocks import Blocks
import json
with open('../../api_key.json', mode='r') as key_file:
key = json.loads(key_file.read())['key']
api = Blocks(api_key=key)
reward = api.get_block_reward(2165403)
print(reward)
|
rsbook_code/utilities/search.py | patricknaughton01/RoboticSystemsBook | 116 | 116692 | """
Includes Dijkstra's algorithm and two A* implementations.
"""
from __future__ import print_function,division
import heapq #for a fast priority queue implementation
def predecessor_traverse(p,s,g):
"""Used by dijkstra's algorithm to traverse a predecessor dictionary"""
L = []
v = g
while v is not... |
1-Introduction/basic_operations.py | haigh1510/TensorFlow2.0-Examples | 1,775 | 116694 | <filename>1-Introduction/basic_operations.py
#! /usr/bin/env python
# coding=utf-8
#================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : VIM
# File name : basic_operations.py
# Author : YunYang1994
# Created date: 2019-03-08... |
setup.py | epfml/collaborative-attention | 125 | 116723 | <filename>setup.py<gh_stars>100-1000
import setuptools
setuptools.setup(
name="collaborative-attention",
version="0.1.0",
author="<NAME>",
author_email="<EMAIL>",
description="",
url="https://github.com/collaborative-attention",
packages=["collaborative_attention"],
package_dir={"": "sr... |
python/tests/artm/test_regularizer_topic_selection.py | MelLain/bigartm | 638 | 116735 | <reponame>MelLain/bigartm
# Copyright 2017, Additive Regularization of Topic Models.
import shutil
import glob
import tempfile
import os
import pytest
from six.moves import range
import artm
def test_func():
topic_selection_tau = 0.5
num_collection_passes = 3
num_document_passes = 10
num_topics = 1... |
tools/grit/grit/format/chrome_messages_json_unittest.py | zealoussnow/chromium | 14,668 | 116742 | <gh_stars>1000+
#!/usr/bin/env python3
# Copyright (c) 2012 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.
"""Unittest for chrome_messages_json.py.
"""
from __future__ import print_function
import json
import os
import ... |
csa/examples/alpha_zero.py | CYHSM/chess-surprise-analysis | 197 | 116808 | """
Run the analysis on all alpha zero games and save the resulting plot
"""
from csa import csa
# Load Game from PGN
for game_id in range(1, 11):
path_to_pgn = './games/alphazero/alphazero-vs-stockfish_game{}.pgn'.format(game_id)
chess_game = csa.load_game_from_pgn(path_to_pgn)
# Evaluate Game
depths... |
tests/resources/mlflow-test-plugin/mlflow_test_plugin/request_header_provider.py | PeterSulcs/mlflow | 10,351 | 116869 | from mlflow.tracking.request_header.abstract_request_header_provider import RequestHeaderProvider
class PluginRequestHeaderProvider(RequestHeaderProvider):
"""RequestHeaderProvider provided through plugin system"""
def in_context(self):
return False
def request_headers(self):
return {"te... |
kombu/asynchronous/aws/sqs/ext.py | 7Geese/kombu | 5,079 | 116885 | # -*- coding: utf-8 -*-
"""Amazon SQS boto3 interface."""
from __future__ import absolute_import, unicode_literals
try:
import boto3
except ImportError:
boto3 = None
|
ptop/statistics/__init__.py | deeps-nars/ptop | 327 | 116894 | from .statistics import Statistics |
deal/introspection/__init__.py | orsinium/condition | 311 | 116902 | <gh_stars>100-1000
"""
The module provides `get_contracts` function which enumerates
contracts wrapping the given function. Every contract is returned
in wrapper providing a stable interface.
Usage example:
```python
import deal
@deal.pre(lambda x: x > 0)
def f(x):
return x + 1
contracts = deal.introspection.ge... |
setup.py | yespon/Chinese-Annotator | 915 | 116913 | from setuptools import setup, find_packages
setup(name='chi_annotator', version='1.0', packages=find_packages()) |
third_party/tests/YosysTests/architecture/synth_xilinx_srl/generate.py | parzival3/Surelog | 156 | 116915 | <gh_stars>100-1000
#!/usr/bin/python3
import re, glob
N = 131
def assert_static_area(fp, i, name):
if i < 3:
srl32,srl16,fd = (0,0,i)
else:
srl32 = i // 32
if (i % 32) == 0:
srl16 = 0
fd = 0
elif (i % 32) == 1:
srl16 = 0
fd = 1
... |
tests/boundaries/test_boundary_integrals.py | ngodber/discretize | 123 | 116918 | <gh_stars>100-1000
import numpy as np
import scipy.sparse as sp
import discretize
def u(*args):
if len(args) == 1:
x = args[0]
return x**3
if len(args) == 2:
x, y = args
return x**3 + y**2
x, y, z = args
return x**3 + y**2 + z**4
def v(*args):
if len(args) == 1:
... |
labs/08_frameworks/solutions/momentum_optimizer.py | soufiomario/labs-Deep-learning | 1,398 | 116986 | class MomentumGradientDescent(GradientDescent):
def __init__(self, params, lr=0.1, momentum=.9):
super(MomentumGradientDescent, self).__init__(params, lr)
self.momentum = momentum
self.velocities = [torch.zeros_like(param, requires_grad=False)
for param in params]... |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/t/too/too_many_arguments_overload.py | ciskoinch8/vimrc | 463 | 117003 | <reponame>ciskoinch8/vimrc
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring
# pylint: disable=too-few-public-methods
from typing import overload
class ClassA:
@classmethod
@overload
def method(cls, arg1):
pass
@classmethod
@overload
def met... |
third_party/atlas/workspace.bzl | jzjonah/apollo | 22,688 | 117017 | <reponame>jzjonah/apollo<gh_stars>1000+
"""Loads the atlas library"""
# Sanitize a dependency so that it works correctly from code that includes
# Apollo as a submodule.
def clean_dep(dep):
return str(Label(dep))
# Installed via atlas-dev
def repo():
# atlas
native.new_local_repository(
name = "at... |
yelp/client.py | ricwillis98/yelp-python | 195 | 117026 | <reponame>ricwillis98/yelp-python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
import requests
import six
from yelp.config import API_ROOT_URL
from yelp.endpoint.business import BusinessEndpoints
from yelp.errors import YelpError
class Client(object):
de... |
tests/test_save.py | jinwyp/image-background-remove-tool | 585 | 117034 | <filename>tests/test_save.py
"""
Name: tests
Description: This file contains the test code
Version: [release][3.2]
Source url: https://github.com/OPHoperHPO/image-background-remove-tool
Author: Anodev (OPHoperHPO)[https://github.com/OPHoperHPO] .
License: Apache License 2.0
License:
Copyright 2020 OPHoperHPO
Lic... |
Lib/objc/_CloudPhotoLibrary.py | snazari/Pyto | 701 | 117078 | """
Classes from the 'CloudPhotoLibrary' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
CPLDateFormatter = _Class("CPLDateFormatter")
CPLP... |
interview-preparation-kit/minimum-time-required.py | gajubadge11/HackerRank-1 | 340 | 117103 | <filename>interview-preparation-kit/minimum-time-required.py
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import Counter
def calculate_days(day, cnt):
res = 0
for el in cnt.items():
res += el[1] * (day // el[0])
return res
# Complete the minTime func... |
tests/unit/test_nova_client.py | abdullahzamanbabar/syntribos | 277 | 117152 | # Copyright 2016 Intel
#
# 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, softwar... |
esphome/components/zyaura/sensor.py | OttoWinter/esphomeyaml | 249 | 117170 | import esphome.codegen as cg
import esphome.config_validation as cv
from esphome import pins
from esphome.components import sensor
from esphome.const import (
CONF_ID,
CONF_CLOCK_PIN,
CONF_DATA_PIN,
CONF_CO2,
CONF_TEMPERATURE,
CONF_HUMIDITY,
DEVICE_CLASS_CARBON_DIOXIDE,
DEVICE_CLASS_HUMI... |
samples/python/15.handling-attachments/bots/__init__.py | Aliacf21/BotBuilder-Samples | 1,998 | 117216 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from .attachments_bot import AttachmentsBot
__all__ = ["AttachmentsBot"]
|
src/scripts/merge_pandas_conll.py | acoli-repo/OpenIE_Stanovsky_Dagan | 117 | 117220 | """ Usage:
merge_pandas_conll --out=OUTPUT_FN <filenames>...
Merge a list of data frames in csv format and print to output file.
"""
from docopt import docopt
import pandas as pd
import logging
logging.basicConfig(level = logging.DEBUG)
if __name__ == "__main__":
args = docopt(__doc__)
logging.debug(args)... |
example/example_puredp.py | samellem/autodp | 158 | 117226 | from autodp.mechanism_zoo import PureDP_Mechanism
from autodp.transformer_zoo import Composition
# Example: pure DP mechanism and composition of it
eps = 0.3
mech = PureDP_Mechanism(eps, name='Laplace')
import matplotlib.pyplot as plt
fpr_list, fnr_list = mech.plot_fDP()
plt.figure(1)
plt.plot(fpr_list,fnr_list,... |
secularize/token.py | PlutNom/HolyC-for-Linux | 266 | 117305 | from json import load, dumps
from .utils import populate_ast
class TokenStream(object):
def __init__(self, input_):
self.input = input_
self.current = None
self.keywords = 'if then else true false'.split()
self.datatypes = ['U0', 'U8', 'U16', 'U32', 'U64',
... |
python/acpi.py | 3mdeb/bits | 215 | 117319 | <gh_stars>100-1000
# Copyright (c) 2015, Intel Corporation
# 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 code must retain the above copyright notice,
# ... |
057_BiSeNetV2/02_celebamaskhq/01_float32/08_saved_model_to_coreml.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 117340 | <gh_stars>1000+
### tensorflow==2.3.0
import tensorflow as tf
import coremltools as ct
mlmodel = ct.convert('saved_model_256x256', source='tensorflow')
mlmodel.save("bisenetv2_celebamaskhq_256x256_float32.mlmodel")
mlmodel = ct.convert('saved_model_448x448', source='tensorflow')
mlmodel.save("bisenetv2_celebamaskhq_... |
docs/snippets/ov_caching.py | kurylo/openvino | 1,127 | 117351 | <filename>docs/snippets/ov_caching.py
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
from openvino.runtime import Core
device_name = 'GNA'
xml_path = '/tmp/myModel.xml'
# ! [ov:caching:part0]
core = Core()
core.set_property({'CACHE_DIR': '/path/to/cache/dir'})
model = core.read_mo... |
06_reproducibility/test_sigmoid.py | fanchi/ml-design-patterns | 1,149 | 117361 | <reponame>fanchi/ml-design-patterns<gh_stars>1000+
#!/usr/bin/env python3
import unittest
import numpy as np
def sigmoid(x):
return 1.0 / (1 + np.exp(-x))
class TestSigmoid(unittest.TestCase):
def test_zero(self):
self.assertAlmostEqual(sigmoid(0), 0.5)
def test_neginf(self):
self.as... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.