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 |
|---|---|---|---|---|
gist_set.py | devnoname120/gist-alfred | 113 | 29515 | #!/usr/bin/python
# encoding: utf-8
from collections import Counter
from gist import create_workflow
from pprint import pprint as pp
import sys
import workflow
from workflow import Workflow, web
from workflow.background import run_in_background, is_running
def main(wf):
arg = wf.args[0]
wf.add_item(u"Set tok... |
class_12/strategies/fixed_trade_price_strategy.py | taoranalex/course_codes | 121 | 29516 | <filename>class_12/strategies/fixed_trade_price_strategy.py
from howtrader.app.cta_strategy import (
CtaTemplate,
StopOrder,
TickData,
BarData,
TradeData,
OrderData,
BarGenerator,
ArrayManager
)
from howtrader.trader.constant import Interval
from datetime import datetime
from howtrader.... |
external/unbound/libunbound/python/examples/async-lookup.py | simplixcurrency/simplix | 1,751 | 29530 | <reponame>simplixcurrency/simplix
#!/usr/bin/python
'''
async-lookup.py : This example shows how to use asynchronous lookups
Authors: <NAME> (vasicek AT fit.vutbr.cz)
<NAME> (xvavru00 AT stud.fit.vutbr.cz)
Copyright (c) 2008. All rights reserved.
This software is open source.
Redistribution and use... |
dataloader/Dataset.py | mvemoon/TextClassificationBenchmark | 576 | 29568 | # -*- coding: utf-8 -*-
import os,urllib
class Dataset(object):
def __init__(self,opt=None):
if opt is not None:
self.setup(opt)
self.http_proxy= opt.__dict__.get("proxy","null")
else:
self.name="demo"
self.dirname="demo"
self.http_proxy="... |
recipes/Python/578344_Simple_Finite_State_Machine_class_/recipe-578344.py | tdiprima/code | 2,023 | 29633 | #! /usr/bin/env python
""" Generic finite state machine class
Initialise the class with a list of tuples - or by adding transitions
<NAME> - November 2012
Released under an MIT License - free to use so long as the author and other contributers are credited.
"""
class fsm(object):
""" A simple to use f... |
src/main/python/counts_tools/exec/deviation_analysis.py | cday97/beam | 123 | 29642 | import ConfigParser
from datetime import datetime
import os
import sys
import numpy as np
import pandas as pd
import utils.counts
import utils.counts_deviation
__author__ = '<NAME>'
# This script finds the days with the greatest deviation from some reference value (such as hourly means or medians)
if __name__ == '_... |
boltstream/responses.py | geekpii/boltstream | 1,735 | 29643 | from django.http import HttpResponse
class HttpResponseNoContent(HttpResponse):
status_code = 204
|
res/TensorFlowPythonExamples/examples/while/__init__.py | bogus-sudo/ONE-1 | 255 | 29648 | import tensorflow as tf
i = tf.compat.v1.constant(0, name="Hole")
c = lambda i: tf.compat.v1.less(i, 10)
b = lambda i: tf.compat.v1.add(i, 1)
r = tf.compat.v1.while_loop(c, b, [i], name="While")
|
recipes/mio/all/conanfile.py | rockandsalt/conan-center-index | 562 | 29654 | <reponame>rockandsalt/conan-center-index
from conans import ConanFile, tools
import os
required_conan_version = ">=1.33.0"
class MioConan(ConanFile):
name = "mio"
description = "Cross-platform C++11 header-only library for memory mapped file IO."
license = "MIT"
topics = ("mio", "mmap", "memory-mappi... |
examples/titanic/assets/dataset/opener.py | eliaskousk/substra | 119 | 29663 | <reponame>eliaskousk/substra
import os
import pandas as pd
import random
import string
import numpy as np
import substratools as tools
class TitanicOpener(tools.Opener):
def get_X(self, folders):
data = self._get_data(folders)
return self._get_X(data)
def get_y(self, folders):
data =... |
test/integration/test_natural_language_understanding_v1.py | jsstylos/waston-developer-cloud-python-sdk | 1,579 | 29664 | # coding: utf-8
from unittest import TestCase
import os
import ibm_watson
import pytest
import json
import time
from ibm_watson.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions
@pytest.mark.skipif(os.getenv('NATURAL_LANGUAGE_UNDERSTANDING_APIKEY') is None,
reason=... |
vit_jax/inference_time.py | fensence/Mixup-VT | 4,825 | 29722 | <reponame>fensence/Mixup-VT<gh_stars>1000+
# Copyright 2021 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 ... |
cloudmarker/test/test_azwebapphttp20event.py | TinLe/cloudmarker | 208 | 29726 | """Tests for AzWebAppHttp20Event plugin."""
import copy
import unittest
from cloudmarker.events import azwebapphttp20event
base_record = {
'ext': {
'record_type': 'web_app_config',
'cloud_type': 'azure',
'http20_enabled': True
},
'com': {
'cloud_type': 'azure'
}
}... |
ranking/migrations/0056_auto_20201128_2316.py | horacexd/clist | 166 | 29737 | <gh_stars>100-1000
# Generated by Django 2.2.13 on 2020-11-28 23:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ranking', '0055_auto_20201009_0735'),
]
operations = [
migrations.AddIndex(
model_name='statistics',
... |
examples/black_lives/create_progmem.py | fejiso/PxMatrix | 599 | 29754 | #!/usr/bin/python
import binascii
import sys
import glob, os
import pdb
file_no=0;
file_names=[];
RGB565=1;
out_string="";
def printrgb565(red, green, blue):
x1 = (red & 0xF8) | (green >> 5);
x2 = ((green & 0x1C) << 3) | (blue >> 3);
#pdb.set_trace()
this_string="0x" + str(binascii.hexlify(chr(x2))) + ",";
this_... |
sdk/python/pulumi_gcp/iam/workload_identity_pool_provider.py | sisisin/pulumi-gcp | 121 | 29762 | <filename>sdk/python/pulumi_gcp/iam/workload_identity_pool_provider.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing ... |
packages/core/minos-microservice-common/minos/common/setup.py | minos-framework/minos-python | 247 | 29767 | from __future__ import (
annotations,
)
import logging
import warnings
from pathlib import (
Path,
)
from typing import (
TYPE_CHECKING,
Optional,
Type,
TypeVar,
Union,
)
from .object import (
Object,
)
if TYPE_CHECKING:
from .config import (
Config,
)
logger = loggin... |
kornia/augmentation/_3d/intensity/__init__.py | Ishticode/kornia | 418 | 29771 | <gh_stars>100-1000
from kornia.augmentation._3d.intensity.equalize import RandomEqualize3D
from kornia.augmentation._3d.intensity.motion_blur import RandomMotionBlur3D
|
DataFormats/FWLite/test/RefTest_cfg.py | ckamtsikis/cmssw | 852 | 29779 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
# Configuration file for RefTest_t
import FWCore.ParameterSet.Config as cms
process = cms.Process("TEST")
process.load("FWCore.Framework.test.cmsExceptionsFatal_cff")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(2)
)
process.source = cms.So... |
options/opts.py | apple/ml-cvnets | 209 | 29794 | #
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
import argparse
from typing import Optional
from data.sampler import arguments_sampler
from data.collate_fns import arguments_collate_fn
from options.utils import load_config_file
from data.datasets import argument... |
ArtGAN/data/ingest_stl10.py | rh01/caffe-model-for-category-artgan | 304 | 29815 | from configargparse import ArgParser
from PIL import Image
import logging
import numpy as np
import os
def transform_and_save(img_arr, output_filename):
"""
Takes an image and optionally transforms it and then writes it out to output_filename
"""
img = Image.fromarray(img_arr)
img.save(output_file... |
tests/client/test_decoders.py | timgates42/apistar | 4,284 | 29825 | import os
from starlette.applications import Starlette
from starlette.responses import PlainTextResponse, Response
from starlette.testclient import TestClient
from apistar.client import Client, decoders
app = Starlette()
@app.route("/text-response/")
def text_response(request):
return PlainTextResponse("hello,... |
vaas-app/src/vaas/manager/api.py | allegro/vaas | 251 | 29849 | <filename>vaas-app/src/vaas/manager/api.py
# -*- coding: utf-8 -*-
import logging
from celery.result import AsyncResult
from tastypie.resources import ModelResource, ALL_WITH_RELATIONS, Resource
from tastypie import fields
from tastypie.fields import ListField
from tastypie.authentication import ApiKeyAuthentication,... |
homeassistant/components/launch_library/diagnostics.py | MrDelik/core | 30,023 | 29874 | """Diagnostics support for Launch Library."""
from __future__ import annotations
from typing import Any
from pylaunches.objects.event import Event
from pylaunches.objects.launch import Launch
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.... |
examples/pybullet/examples/quadruped.py | felipeek/bullet3 | 9,136 | 29881 | <filename>examples/pybullet/examples/quadruped.py
import pybullet as p
import time
import math
import pybullet_data
def drawInertiaBox(parentUid, parentLinkIndex, color):
dyn = p.getDynamicsInfo(parentUid, parentLinkIndex)
mass = dyn[0]
frictionCoeff = dyn[1]
inertia = dyn[2]
if (mass > 0):
Ixx = iner... |
tests/nnapi/specs/skip/V1_2/space_to_batch_v1_2.mod.py | periannath/ONE | 255 | 29884 | <filename>tests/nnapi/specs/skip/V1_2/space_to_batch_v1_2.mod.py
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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.apa... |
PWGJE/EMCALJetTasks/Tracks/analysis/old/ComparePeriodsTriggerToMB.py | maroozm/AliPhysics | 114 | 29894 | <filename>PWGJE/EMCALJetTasks/Tracks/analysis/old/ComparePeriodsTriggerToMB.py<gh_stars>100-1000
#! /usr/bin/env python
from ROOT import TCanvas, TGraphErrors, TLegend, TPaveText
from ROOT import kBlack, kBlue, kRed
from Helper import Frame, ReadHistList
from Graphics import Style
from SpectrumContainer import DataCon... |
pool_automation/roles/aws_manage/library/stateful_set.py | Rob-S/indy-node | 627 | 29927 | <gh_stars>100-1000
#!/usr/bin/python
import re
from itertools import cycle
from collections import namedtuple, defaultdict, OrderedDict
import boto3
from ansible.module_utils.basic import AnsibleModule
# import logging
# boto3.set_stream_logger('', logging.DEBUG)
HostInfo = namedtuple('HostInfo', 'tag_id public_ip u... |
reliability/tasks/Apps.py | RH-ematysek/svt | 115 | 29948 | from .GlobalData import global_data
from .utils.oc import oc
import requests
import time
import logging
class App:
def __init__(self, deployment, project, template, build_config,route=""):
self.project = project
self.template = template
self.deployment = deployment
self.build_conf... |
var/spack/repos/builtin/packages/liblzf/package.py | BenWibking/spack | 2,360 | 29971 | <gh_stars>1000+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Liblzf(AutotoolsPackage):
"""LibLZF is a very small data compression libra... |
apps/payroll/models/employee.py | youssriaboelseod/pyerp | 115 | 29979 | <filename>apps/payroll/models/employee.py
# Django Library
from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
# Thirdparty Library
from apps.base.models import PyFather
# Tabla de Empleados
class PyEmployee(... |
model_zoo/jag_utils/python/build_inclusive_from_exclusive.py | jonesholger/lbann | 194 | 29991 | import sys
if len(sys.argv) != 4 :
print 'usage:', sys.argv[0], 'index_fn id_mapping_fn output_fn'
exit(9)
a = open(sys.argv[1])
a.readline()
header = a.readline()
dir = a.readline()
#build map: filename -> set of bad samples
mp = {}
mp_good = {}
mp_bad = {}
for line in a :
t = line.split()
mp[t[0]] = set()
... |
model.py | ishine/Speaker_Verification | 337 | 29994 | import tensorflow as tf
import numpy as np
import os
import time
from utils import random_batch, normalize, similarity, loss_cal, optim
from configuration import get_config
from tensorflow.contrib import rnn
config = get_config()
def train(path):
tf.reset_default_graph() # reset graph
# dra... |
ur_driver/src/ur_driver/deserializeRT.py | Hugal31/universal_robot | 749 | 30042 | from __future__ import print_function
import struct
import copy
#this class handles different protocol versions
class RobotStateRT(object):
@staticmethod
def unpack(buf):
rs = RobotStateRT()
(plen, ptype) = struct.unpack_from("!IB", buf)
if plen == 756:
return RobotStateRT_V... |
text_extensions_for_pandas/jupyter/span.py | ZachEichen/text-extensions-for-pandas | 193 | 30055 | #
# Copyright (c) 2021 IBM Corp.
# 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 writi... |
support/distribute/binbuild/build/make_cert_links.py | rknop/amuse | 131 | 30081 | import os
import os.path
import subprocess
import sys
if __name__ == "__main__":
dirname = sys.argv[1]
for x in os.listdir(dirname):
if x.endswith('.crt'):
try:
filename = os.path.join(dirname, x)
filehash = subprocess.check_output(['openssl', 'x509', '-noout... |
DeformationLearningSolver/scripts/DLS/core/fnData.py | WebberHuang/DeformationLearningSolver | 160 | 30083 | <reponame>WebberHuang/DeformationLearningSolver<gh_stars>100-1000
__author__ = "<NAME>"
__contact__ = "<EMAIL>"
__website__ = "http://riggingtd.com"
import maya.cmds as cmds
import maya.OpenMaya as om
import maya.OpenMayaAnim as oma
from DLS.core import utils
class FnSkinCluster(object):
def __init__(self, ski... |
datasets/Voc_Dataset.py | DLsnowman/Deeplab-v3plus | 333 | 30117 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Time : 2018/9/21 17:21
# @Author : HLin
# @Email : <EMAIL>
# @File : Voc_Dataset.py
# @Software: PyCharm
import PIL
import random
import scipy.io
from PIL import Image, ImageOps, ImageFilter
import numpy as np
import cv2
import os
import torch
import torch.utils.d... |
src/ops.py | Elite-Volumetric-Capture-Sqad/DDRNet | 128 | 30128 | <reponame>Elite-Volumetric-Capture-Sqad/DDRNet<filename>src/ops.py
import numpy as np
import sys
import tensorflow as tf
slim = tf.contrib.slim
def convertNHWC2NCHW(data, name):
out = tf.transpose(data, [0, 3, 1, 2], name=name)
return out
def convertNCHW2NHWC(data, name):
out = tf.transpose(data, [0, 2,... |
core/plugins/hibp.py | area55git/Gitmails | 140 | 30134 | import time
import requests
from core.utils.parser import Parser
from core.utils.helpers import Helpers
from core.models.plugin import BasePlugin
class HIBP(BasePlugin):
def __init__(self, args):
self.args = args
self.base_url = "https://haveibeenpwned.com/api/v2/breachedaccount"
self.url... |
ml_metadata/workspace.bzl | zijianjoy/ml-metadata | 458 | 30136 | # Copyright 2018 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, ... |
h2o-py/tests/testdir_misc/pyunit_pubdev_7506_model_download_with_cv.py | vishalbelsare/h2o-3 | 6,098 | 30188 | <filename>h2o-py/tests/testdir_misc/pyunit_pubdev_7506_model_download_with_cv.py<gh_stars>1000+
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import h2o
import os
from h2o.estimators.gbm import H2OGradientBoostingEstimator
from tests import pyunit_utils
def model_download_with_cv():
prostate = h2o.import_file(p... |
notebook/pandas_agg.py | vhn0912/python-snippets | 174 | 30194 | import pandas as pd
import numpy as np
print(pd.__version__)
# 1.0.0
print(pd.DataFrame.agg is pd.DataFrame.aggregate)
# True
df = pd.DataFrame({'A': [0, 1, 2], 'B': [3, 4, 5]})
print(df)
# A B
# 0 0 3
# 1 1 4
# 2 2 5
print(df.agg(['sum', 'mean', 'min', 'max']))
# A B
# sum 3.0 12.0
# mean ... |
cli/mmt/mmtcli.py | Centaurioun/modernmt | 154 | 30206 | <reponame>Centaurioun/modernmt
import os
import re
from cli.mmt import MMT_HOME_DIR, MMT_LIB_DIR, MMT_BIN_DIR, MMT_JAR, MMT_PLUGINS_JARS
from cli.utils import osutils
def __get_java_version():
try:
stdout, stderr = osutils.shell_exec(['java', '-version'])
java_output = stdout + '\n' + stderr
... |
seno/wallet/trading/trade_status.py | emilson0407/seno-blockchain | 11,902 | 30226 | from enum import Enum
class TradeStatus(Enum):
PENDING_ACCEPT = 0
PENDING_CONFIRM = 1
PENDING_CANCEL = 2
CANCELED = 3
CONFIRMED = 4
FAILED = 5
|
src/test/rebaseline-p.py | visit-dav/vis | 226 | 30238 | import filecmp
import os
import sys
import shutil
import subprocess
import time
import unittest
if (sys.version_info > (3, 0)):
import urllib.request, urllib.parse, urllib.error
else:
import urllib
from optparse import OptionParser
from PyQt4 import QtCore,QtGui
parser = OptionParser()
parser.add_option("-r",... |
server/base/views.py | arubdesu/zentral | 634 | 30267 | import logging
from django.apps import apps
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404, HttpResponse, JsonResponse
from django.views.generic import TemplateView, View
from zentral.core.stores import frontend_store
logger = logging.getLogger("server.base.views")
class H... |
hs_core/discovery_form.py | tommac7/hydroshare | 178 | 30280 | from haystack.forms import FacetedSearchForm
from haystack.query import SQ
from django import forms
from hs_core.discovery_parser import ParseSQ, MatchingBracketsNotFoundError, \
FieldNotRecognizedError, InequalityNotAllowedError, MalformedDateError
FACETS_TO_SHOW = ['creator', 'contributor', 'owner', 'content_typ... |
scripts/devops_tasks/trust_proxy_cert.py | vincenttran-msft/azure-sdk-for-python | 2,728 | 30287 | <filename>scripts/devops_tasks/trust_proxy_cert.py
import requests
import os
EXISTING_ROOT_PEM = requests.certs.where()
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))
LOCAL_DEV_CERT = os.path.abspath(os.path.join(root_dir, 'eng', 'common', 'testproxy', 'dotnet-devcert.crt'))
COM... |
tests/stress/conftest.py | lolyu/sonic-mgmt | 132 | 30303 | import logging
import pytest
from tests.common.utilities import wait_until
from utils import get_crm_resources, check_queue_status, sleep_to_wait
CRM_POLLING_INTERVAL = 1
CRM_DEFAULT_POLL_INTERVAL = 300
MAX_WAIT_TIME = 120
logger = logging.getLogger(__name__)
@pytest.fixture(scope='module')
def get_function_conple... |
codeformatter/formatter.py | ephenyxshop/sublimetext-codeformatter | 676 | 30342 | # @author <NAME>
# @copyright Copyright (c) 2008-2015, <NAME> aka LONGMAN (<EMAIL>)
# @link http://longman.me
# @license The MIT License (MIT)
import os
import sys
import re
import sublime
directory = os.path.dirname(os.path.realpath(__file__))
libs_path = os.path.join(director... |
iotbx/xds/xds_cbf.py | dperl-sol/cctbx_project | 155 | 30344 | #!/usr/bin/env libtbx.python
#
# iotbx.xds.xds_cbf.py
#
# <NAME>, Diamond Light Source, 2012/OCT/16
#
# Class to read the CBF files used in XDS
#
from __future__ import absolute_import, division, print_function
class reader:
"""A class to read the CBF files used in XDS"""
def __init__(self):
pass
def re... |
tools/lttng.py | Taritsyn/ChakraCore | 8,664 | 30346 | #-------------------------------------------------------------------------------------------------------
# Copyright (C) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
#-------------------------------------------------------------... |
h2o-bindings/bin/pyunit_parser_test.py | vishalbelsare/h2o-3 | 6,098 | 30351 | <reponame>vishalbelsare/h2o-3
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Test case for pyparser."""
from __future__ import division, print_function
import os
import re
import textwrap
import tokenize
from future.builtins import open
import pyparser
def _make_tuple(op):
return lambda x: (op, x)
NL = tok... |
tools/pot/openvino/tools/pot/algorithms/quantization/accuracy_aware_common/algorithm.py | chccc1994/openvino | 2,406 | 30352 | <reponame>chccc1994/openvino
# Copyright (C) 2020-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import random
from copy import deepcopy
from sys import maxsize
import numpy as np
from .utils import create_metric_config, is_preset_performance, \
get_mixed_preset_config, evaluate_model, ge... |
tests/test8u20/main.py | potats0/javaSerializationTools | 124 | 30356 | import yaml
from javaSerializationTools import JavaString, JavaField, JavaObject, JavaEndBlock
from javaSerializationTools import ObjectRead
from javaSerializationTools import ObjectWrite
if __name__ == '__main__':
with open("../files/7u21.ser", "rb") as f:
a = ObjectRead(f)
obj = a.readContent()... |
tool/taint_analysis/summary_functions.py | cpbscholten/karonte | 294 | 30401 | """
Though karonte relies on angr's sim procedures, sometimes these add in the current state some constraints to make the
used analysis faster. For example, if a malloc has an unconstrained size, angr add the constraint
size == angr-defined.MAX_SIZE. Though this makes the analysis faster, it makes impossible to reason ... |
kenlm_training/tests/test_minify.py | ruinunca/data_tooling | 435 | 30404 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import json
from pathlib import Path
import pytest
import cc_net
import cc_net.minify as minify
from cc_net import jsonql, process_wet_fil... |
python/091-100/Interleaving String.py | KaiyuWei/leetcode | 150 | 30416 | <reponame>KaiyuWei/leetcode<filename>python/091-100/Interleaving String.py
class Solution:
# @param {string} s1
# @param {string} s2
# @param {string} s3
# @return {boolean}
def isInterleave(self, s1, s2, s3):
m = len(s1)
n = len(s2)
if m+n != len(s3):
return Fals... |
scripts/job/memcached_submit.py | Container-Projects/firmament | 287 | 30425 | from base import job_desc_pb2
from base import task_desc_pb2
from base import reference_desc_pb2
from google.protobuf import text_format
import httplib, urllib, re, sys, random
import binascii
import time
import shlex
def add_worker_task(job_name, task, binary, args, worker_id, num_workers, extra_args):
task.uid = 0... |
refinery/bnpy/bnpy-dev/tests/merge/TestMergeHDPTopicModel.py | csa0001/Refinery | 103 | 30478 | '''
Unit tests for MergeMove.py for HDPTopicModels
Verification merging works as expected and produces valid models.
Attributes
------------
self.Data : K=4 simple WordsData object from AbstractBaseTestForHDP
self.hmodel : K=4 simple bnpy model from AbstractBaseTestForHDP
Coverage
-----------
* run_many_merge_moves... |
test/run/t242.py | timmartin/skulpt | 2,671 | 30498 | class O(object): pass
class A(O): pass
class B(O): pass
class C(O): pass
class D(O): pass
class E(O): pass
class K1(A,B,C): pass
class K2(D,B,E): pass
class K3(D,A): pass
class Z(K1,K2,K3): pass
print K1.__mro__
print K2.__mro__
print K3.__mro__
print Z.__mro__
|
tests/cases/infer.py | div72/py2many | 345 | 30502 | <filename>tests/cases/infer.py
#!/usr/bin/env python3
def foo():
a = 10
# infer that b is an int
b = a
assert b == 10
print(b)
if __name__ == "__main__":
foo()
|
fnss/traffic/__init__.py | brucespang/fnss | 114 | 30520 | """Tools for creating and manipulating event schedules and traffic matrices"""
from fnss.traffic.eventscheduling import *
from fnss.traffic.trafficmatrices import *
|
djng/forms/widgets.py | ParikhKadam/django-angular | 941 | 30522 | import mimetypes
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core import signing
from django.forms import widgets
from django.forms.utils import flatatt
from django.utils.safestring import mark_safe
from django.utils.html import format_html
from django.utils.translation import ugette... |
parse_jira_logged_time/gui.py | gil9red/SimplePyScripts | 117 | 30525 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import json
import io
import sys
import traceback
import webbrowser
from contextlib import redirect_stdout
from datetime import datetime
from PyQt5.Qt import (
QApplication, QMessageBox, QThread, pyqtSignal, QMainWindow, ... |
applications/popart/faster-rcnn/nanodata/dataset/xml_dataset_for_rcnn.py | payoto/graphcore_examples | 260 | 30527 | <reponame>payoto/graphcore_examples
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
# Copyright 2021 RangiLyu.
#
# 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.apac... |
spyder_terminal/widgets/style/themes.py | mrclary/spyder-terminal | 169 | 30540 | <filename>spyder_terminal/widgets/style/themes.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Contributors
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# ----------------------------------------... |
erniekit/common/rule.py | PaddlePaddle/LARK | 1,552 | 30553 | <filename>erniekit/common/rule.py
# -*- coding: utf-8 -*
"""
some rule
"""
class MaxTruncation(object):
"""MaxTruncation:超长截断规则
"""
KEEP_HEAD = 0 # 从头开始到最大长度截断
KEEP_TAIL = 1 # 从头开始到max_len-1的位置截断,末尾补上最后一个id(词或字)
KEEP_BOTH_HEAD_TAIL = 2 # 保留头和尾两个位置,然后按keep_head方式截断
class EmbeddingType(object):... |
scripts/selenium/test.py | Mlrobinson1993/trustroots | 377 | 30557 | #!/usr/bin/env python
from browsers import browsers
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support.wait import WebDriverWait
from selenium.common.exceptions import TimeoutExc... |
demo/utils/genderdetect.py | TommyZihao/MMGEN-FaceStylor | 122 | 30562 | <reponame>TommyZihao/MMGEN-FaceStylor<gh_stars>100-1000
import random
import cv2
padding = 20
MODEL_MEAN_VALUES = (78.4263377603, 87.7689143744, 114.895847746)
genderList = ['Male', 'Female']
class GenderDetection():
def __init__(self):
faceProto = 'data/opencv_face_detector.pbtxt'
faceModel = '... |
fclib/tests/test_dcnn.py | barrosm/forecasting | 2,276 | 30566 | <gh_stars>1000+
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from fclib.models.dilated_cnn import create_dcnn_model
def test_create_dcnn_model():
mod0 = create_dcnn_model(seq_len=1) # default args
assert mod0 is not None
mod1 = create_dcnn_model(
seq_len=1, n_dyn_fea... |
Alignment/CommonAlignmentProducer/python/ALCARECOTkAlMinBias_Output_cff.py | ckamtsikis/cmssw | 852 | 30605 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# AlCaReco for track based alignment using MinBias events
OutALCARECOTkAlMinBias_noDrop = cms.PSet(
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('pathALCARECOTkAlMinBias')
),
outputCommands = cms.untracked.vstring(
... |
benchmarks/roberta/benchmark_tft.py | legacyai/tf-transformers | 116 | 30617 | """TFTBechmark scripts"""
import shutil
import tempfile
import time
import tensorflow as tf
import tqdm
from datasets import load_dataset
from transformers import RobertaTokenizerFast
from tf_transformers.models import Classification_Model
from tf_transformers.models import RobertaModel as Model
_ALLOWED_DECODER_TYP... |
test/functional/tests/initialize/test_clean_reboot.py | Ostrokrzew/open-cas-linux | 139 | 30623 | #
# Copyright(c) 2020-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
import os
import pytest
from api.cas import casadm
from api.cas.cache_config import CacheMode
from core.test_run import TestRun
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
from test_tools.dd impo... |
ml-models-analyses/readahead-mixed-workload/kmlparsing.py | drewscottt/kernel-ml | 167 | 30651 | <filename>ml-models-analyses/readahead-mixed-workload/kmlparsing.py<gh_stars>100-1000
#
# Copyright (c) 2019-2021 <NAME>
# Copyright (c) 2021-2021 <NAME>
# Copyright (c) 2021-2021 <NAME>
# Copyright (c) 2021-2021 <NAME>
# Copyright (c) 2020-2021 <NAME>
# Copyright (c) 2020-2021 <NAME>
# Copyright (c) 2019-2021 <NAME>
#... |
network/demo_espat_ap_test.py | 708yamaguchi/MaixPy_scripts | 485 | 30655 | <reponame>708yamaguchi/MaixPy_scripts
# This file is part of MaixPY
# Copyright (c) sipeed.com
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
from network_espat import wifi
wifi.reset()
print(wifi.at_cmd("AT\r\n"))
print(wifi.at_cmd("AT+GMR\r\n"))
'''
>>> reset...
b'\r\n... |
stockroom_bot/stock_products.py | amjadmajid/rosbook | 442 | 30660 | <filename>stockroom_bot/stock_products.py
#!/usr/bin/env python
import rospy, tf
from gazebo_msgs.srv import *
from geometry_msgs.msg import *
if __name__ == '__main__':
rospy.init_node("stock_products")
rospy.wait_for_service("gazebo/delete_model") # <1>
rospy.wait_for_service("gazebo/spawn_sdf_model")
delete... |
openspeech/search/beam_search_ctc.py | techthiyanes/openspeech | 207 | 30676 | <reponame>techthiyanes/openspeech<filename>openspeech/search/beam_search_ctc.py<gh_stars>100-1000
# MIT License
#
# Copyright (c) 2021 <NAME> and <NAME> and <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to ... |
spinoffs/inference_gym/inference_gym/targets/eight_schools_test.py | PavanKishore21/probability | 3,670 | 30679 | # Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
pylayers/antprop/examples/ex_meta.py | usmanwardag/pylayers | 143 | 30696 | from pylayers.gis.layout import *
from pylayers.antprop.signature import *
from pylayers.antprop.channel import *
import pylayers.signal.waveform as wvf
import networkx as nx
import numpy as np
import time
import logging
L = Layout('WHERE1_clean.ini')
#L = Layout('defstr2.ini')
try:
L.dumpr()
except:
L.build()... |
package/awesome_panel/application/services/message_service.py | Jhsmit/awesome-panel | 179 | 30712 | """This module implements the MessageService
The MessageService enables sending and receiving messages
"""
import param
class MessageService(param.Parameterized):
"""The MessageService enables sending and receiving messages"""
|
herokuapp/project_template/manage.py | urkonn/django-herokuapp | 262 | 30714 | <filename>herokuapp/project_template/manage.py
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# Load the Heroku environment.
from herokuapp.env import load_env
load_env(__file__, "{{ app_name }}")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "{{ project_name }}.settings"... |
scripts/touchup_for_web.py | BennZoll/roboto | 3,933 | 30719 | <reponame>BennZoll/roboto<gh_stars>1000+
#!/usr/bin/python
#
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... |
tests/test_losses_config.py | blazejdolicki/vissl | 2,512 | 30729 | <reponame>blazejdolicki/vissl
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import unittest
from collections import namedtuple
from classy_vision.generic.distributed_util im... |
scale/source/apps.py | kaydoh/scale | 121 | 30747 | <gh_stars>100-1000
"""Defines the application configuration for the source application"""
from __future__ import unicode_literals
from django.apps import AppConfig
class SourceConfig(AppConfig):
"""Configuration for the source app
"""
name = 'source'
label = 'source'
verbose_name = 'Source'
... |
Chapter14/c14_11_rainbow_callMaxOn2_viaSimulation.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 30759 | """
Name : c14_11_rainbow_callMaxOn2_viaSimulation.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import scipy as sp
from scipy import zeros, sqrt, shape
#
sp.random.seed(123) # fix our ra... |
maya/Tests/joint_test.py | ryu-sw/alembic | 921 | 30774 | <reponame>ryu-sw/alembic
##-*****************************************************************************
##
## Copyright (c) 2009-2011,
## <NAME> Imageworks, Inc. and
## Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd.
##
## All rights reserved.
##
## Redistribution and use in source and ... |
tools/improve_8105.py | dophist/pinyin-data | 823 | 30788 | <reponame>dophist/pinyin-data
# -*- coding: utf-8 -*-
"""补充 8105 中汉字的拼音数据"""
from collections import namedtuple
import re
import sys
from pyquery import PyQuery
import requests
re_pinyin = re.compile(r'拼音:(?P<pinyin>\S+) ')
re_code = re.compile(r'统一码\w?:(?P<code>\S+) ')
re_alternate = re.compile(r'异体字:\s+?(?P<alterna... |
api/features/exceptions.py | SolidStateGroup/Bullet-Train-API | 126 | 30791 | from rest_framework import status
from rest_framework.exceptions import APIException
class FeatureStateVersionError(APIException):
status_code = status.HTTP_400_BAD_REQUEST
class FeatureStateVersionAlreadyExistsError(FeatureStateVersionError):
status_code = status.HTTP_400_BAD_REQUEST
def __init__(self... |
tests/__init__.py | RonenTRA/faster-than-requests | 857 | 30811 | # Allow tests/ directory to see faster_than_requests/ package on PYTHONPATH
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
|
html/semantics/scripting-1/the-script-element/module/resources/delayed-modulescript.py | meyerweb/wpt | 14,668 | 30838 | <filename>html/semantics/scripting-1/the-script-element/module/resources/delayed-modulescript.py<gh_stars>1000+
import time
def main(request, response):
delay = float(request.GET.first(b"ms", 500))
time.sleep(delay / 1E3)
return [(b"Content-type", b"text/javascript")], u"export let delayedLoaded = true;"
|
src/platform/jboss/fingerprints/JBoss71Manage.py | 0x27/clusterd | 539 | 30884 | <filename>src/platform/jboss/fingerprints/JBoss71Manage.py
from src.platform.jboss.interfaces import JINTERFACES
from cprint import FingerPrint
class FPrint(FingerPrint):
def __init__(self):
self.platform = "jboss"
self.version = "7.1"
self.title = JINTERFACES.MM
self.uri = "/... |
YNet/stage2/Model.py | cancertech/-cancer_diagnosis | 126 | 30896 | <gh_stars>100-1000
#
# author: <NAME>
# Project Description: This repository contains source code for semantically segmenting WSIs; however, it could be easily
# adapted for other domains such as natural image segmentation
# File Description: This file contains the CNN models
# =======================... |
Tools/unicode/genmap_support.py | shawwn/cpython | 52,316 | 30904 | <filename>Tools/unicode/genmap_support.py
#
# genmap_support.py: Multibyte Codec Map Generator
#
# Original Author: <NAME> <<EMAIL>>
# Modified Author: <NAME> <<EMAIL>>
#
class BufferedFiller:
def __init__(self, column=78):
self.column = column
self.buffered = []
self.cline = []
... |
tests/qlayers_test.py | kshithijiyer/qkeras | 388 | 30905 | <reponame>kshithijiyer/qkeras
# Copyright 2019 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 applicabl... |
tests/test_records.py | tomfallen/python-fitparse | 548 | 30935 | #!/usr/bin/env python
import sys
from fitparse.records import Crc
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
class RecordsTestCase(unittest.TestCase):
def test_crc(self):
crc = Crc()
self.assertEqual(0, crc.value)
crc.update(b'\x0e\x10\x98\... |
backend/lost/api/user/login_manager.py | JonasGoebel/lost | 490 | 30941 | import datetime
from flask_ldap3_login import LDAP3LoginManager, AuthenticationResponseStatus
from lost.settings import LOST_CONFIG, FLASK_DEBUG
from flask_jwt_extended import create_access_token, create_refresh_token
from lost.db.model import User as DBUser, Group
from lost.db import roles
class LoginManager():
de... |
pipeline/models/nmap_model.py | ponderng/recon-pipeline | 352 | 30971 | <reponame>ponderng/recon-pipeline<filename>pipeline/models/nmap_model.py
import textwrap
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, ForeignKey, String, Boolean
from .base_model import Base
from .port_model import Port
from .ip_address_model import IPAddress
from .nse_model import ... |
examples/isinstance.py | quynhanh-ngx/pytago | 206 | 30972 | def main():
a = ["a", 1, "5", 2.3, 1.2j]
some_condition = True
for x in a:
# If it's all isinstance, we can use a type switch
if isinstance(x, (str, float)):
print("String or float!")
elif isinstance(x, int):
print("Integer!")
else:
print("... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.