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 |
|---|---|---|---|---|
test/common/test_pydoop.py | timgates42/pydoop | 203 | 11020544 | <reponame>timgates42/pydoop
# BEGIN_COPYRIGHT
#
# Copyright 2009-2021 CRS4.
#
# 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 require... |
tests/extmod/ubinascii_crc32.py | Neradoc/circuitpython | 3,010 | 11020546 | try:
try:
import ubinascii as binascii
except ImportError:
import binascii
except ImportError:
print("SKIP")
raise SystemExit
try:
binascii.crc32
except AttributeError:
print("SKIP")
raise SystemExit
print(hex(binascii.crc32(b"The quick brown fox jumps over the lazy dog")))... |
diskimage_builder/block_device/tests/test_base.py | fooxlj07/diskimage-builder | 262 | 11020555 | <filename>diskimage_builder/block_device/tests/test_base.py
# 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 ... |
pandas/tests/test_msgpack/test_case.py | springcoil/pandas | 652 | 11020557 | <filename>pandas/tests/test_msgpack/test_case.py
#!/usr/bin/env python
# coding: utf-8
from pandas.msgpack import packb, unpackb
def check(length, obj):
v = packb(obj)
assert len(v) == length, \
"%r length should be %r but get %r" % (obj, length, len(v))
assert unpackb(v, use_list=0) == obj
def ... |
vivisect/qt/views.py | rnui2k/vivisect | 716 | 11020585 | <filename>vivisect/qt/views.py<gh_stars>100-1000
import vqt.tree as vq_tree
import vivisect.base as viv_base
import envi.qt.memory as e_q_memory
import vivisect.qt.ctxmenu as v_q_ctxmenu
from PyQt5.QtWidgets import QMenu
from vqt.main import *
from vqt.common import *
from vivisect.const import *
class VivNavModel(e... |
Chapter4/ex_4_13.py | zxjzxj9/PyTorchIntroduction | 205 | 11020604 | """ 本代码为示例代码,演示如何载入ImageNet的图像数据集
"""
def main_worker(gpu, ngpus_per_node, args):
# ...
# 设置数据集目录
traindir = os.path.join(args.data, 'train')
valdir = os.path.join(args.data, 'val')
# 设置预处理方法
normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[... |
cadquery/hull.py | CameronKing/cadquery | 1,423 | 11020609 | from typing import List, Tuple, Union, Iterable, Set
from math import pi, sin, cos, atan2, sqrt, inf, degrees
from numpy import lexsort, argmin, argmax
from .occ_impl.shapes import Edge, Wire
from .occ_impl.geom import Vector
"""
Convex hull for line segments and circular arcs based on
<NAME>., <NAME>., <NAME>., & <... |
Python3/230.py | rakhi2001/ecom7 | 854 | 11020626 | __________________________________________________________________________________________________
sample 40 ms submission
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Found(Exception): pass
clas... |
djangoerp/menus/signals.py | xarala221/django-erp | 345 | 11020629 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PART... |
docs/introduction/codeexamples/forms.py | tristanlatr/klein | 643 | 11020755 | <reponame>tristanlatr/klein
from twisted.web.template import slot, tags
from klein import Field, Form, Klein, Plating, Requirer, SessionProcurer
from klein.interfaces import ISession
from klein.storage.memory import MemorySessionStore
app = Klein()
sessions = MemorySessionStore()
requirer = Requirer()
@requirer.... |
CPAC/nuisance/utils/crc.py | gkiar/C-PAC | 125 | 11020768 | <gh_stars>100-1000
import base64
POLYNOMIAL = 0x1021
PRESET = 0xFFFF
def _initial(c):
crc = 0
c = c << 8
for _ in range(8):
if (crc ^ c) & 0x8000:
crc = (crc << 1) ^ POLYNOMIAL
else:
crc = crc << 1
c = c << 1
return crc
_tab = [_initial(i) for i in ran... |
tests/opengl/test_svg_mobject_opengl.py | PhotonSpheres/manim | 9,497 | 11020781 | <gh_stars>1000+
from colour import Color
from manim import *
from tests.helpers.path_utils import get_svg_resource
def test_set_fill_color(using_opengl_renderer):
expected_color = "#FF862F"
svg = SVGMobject(get_svg_resource("heart.svg"), fill_color=expected_color)
assert svg.fill_color == Color(expected_... |
exercises/es/test_03_16_01.py | Jette16/spacy-course | 2,085 | 11020783 | <filename>exercises/es/test_03_16_01.py<gh_stars>1000+
def test():
assert (
"doc = nlp.make_doc(text)" in __solution__
or "doc = nlp.tokenizer(text)" in __solution__
), "¿Solo estás convirtiendo el texto en tokens?"
__msg__.good("¡Bien hecho!")
|
var/spack/repos/builtin/packages/py-ninja/package.py | zygyz/spack | 348 | 11020789 | # 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)
import os
class PyNinja(PythonPackage):
"""Ninja is a small build system with a focus on speed."""
homepage = "... |
research/cognitive_mapping_and_planning/src/utils.py | 873040/Abhishek | 3,326 | 11020793 | # Copyright 2016 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
recipes/Python/496992_Sync_system_clock_naval_time/recipe-496992.py | tdiprima/code | 2,023 | 11020818 | #!/usr/bin/python
#
# File: nts_sync.py
# Author: <NAME>
# Date: 8/24/2006
#
# This software gets the date from a naval time server and updates the system
# clock for posix OS supporting the "date" command. It also requires an
# internet connection.
#
# WARNING: It will not work if your system clock is already off... |
wolfe/api.py | h4ck3rk3y/mrwolf | 161 | 11020844 | <gh_stars>100-1000
import requests
import webbrowser
from tabulate import tabulate
headers = {'Accept' : 'application/json'}
import os
key = os.environ.get('WOLFE_API_KEY', '<KEY>')
def stackoverflow(error):
url = 'https://api.stackexchange.com/2.2/search/advanced?order=desc&migrated=False&sort=activity&body=%s&acc... |
unittest/scripts/py_devapi/validation/mysqlx_collection.py | mueller/mysql-shell | 119 | 11020885 | <reponame>mueller/mysql-shell<filename>unittest/scripts/py_devapi/validation/mysqlx_collection.py
#@ Testing collection name retrieving
|get_name(): collection1|
|name: collection1|
#@ Testing session retrieving
|get_session(): <Session:|
|session: <Session:|
#@ Testing collection schema retrieving
|get_schema(): <Sc... |
semseg/models/segformer.py | Genevievekim/semantic-segmentation-1 | 196 | 11020913 | import torch
import math
from torch import nn, Tensor
from torch.nn import functional as F
from semseg.models.backbones import *
from semseg.models.backbones.layers import trunc_normal_
from semseg.models.heads import SegFormerHead
class SegFormer(nn.Module):
def __init__(self, backbone: str = 'MiT-B0', num_class... |
leo/plugins/obsolete/tkGui.py | ATikhonov2/leo-editor | 1,550 | 11020926 | # -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20081121110412.2: * @file ./obsolete/tkGui.py
#@@first
'''Leo's tkinter gui plugin.'''
#@@language python
#@@tabwidth -4
#@@pagewidth 80
#@+<< tkGui imports >>
#@+node:ekr.20081121110412.3: ** << tkGui imports >>
import leo.core.leoGlobals as g
import leo.core.l... |
tests/tmp-runtest.py | ribeirojose/d6tstack | 176 | 11020942 | <filename>tests/tmp-runtest.py
import pandas as pd
import numpy as np
import glob
import d6tstack.combine_csv
import importlib
importlib.reload(d6tstack.combine_csv)
import sqlalchemy
fname_list=glob.glob('test-data/input/test-data-input-csv-clean-*.csv')
fname_list=glob.glob('test-data/input/test-data-input-csv-reord... |
examples/loading_obj_files.py | 2dx/moderngl | 916 | 11020946 | <reponame>2dx/moderngl<gh_stars>100-1000
from pyrr import Matrix44
import moderngl
from ported._example import Example
class LoadingOBJ(Example):
title = "Loading OBJ"
gl_version = (3, 3)
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.obj = self.load_scene('sitting_dummy.... |
nni/retiarii/oneshot/pytorch/enas.py | nbl97/nni | 2,305 | 11020958 | <filename>nni/retiarii/oneshot/pytorch/enas.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
import warnings
from typing import cast
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import SubsetRandomSampler... |
models/train/model.py | marciopuga/sound-separation | 412 | 11020972 | <filename>models/train/model.py<gh_stars>100-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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
heat/objects/stack_lock.py | noironetworks/heat | 265 | 11021032 | <reponame>noironetworks/heat<filename>heat/objects/stack_lock.py
#
# 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 applicab... |
tests/test_bench.py | angie1148/coincurve | 113 | 11021054 | <reponame>angie1148/coincurve<filename>tests/test_bench.py<gh_stars>100-1000
from coincurve import PrivateKey, PublicKey, verify_signature
from .samples import MESSAGE, PRIVATE_KEY_BYTES, PUBLIC_KEY_COMPRESSED, SIGNATURE
def test_verify_signature_util(benchmark):
benchmark(verify_signature, SIGNATURE, MESSAGE, P... |
pythonFiles/vscode_datascience_helpers/dummyJupyter.py | ChaseKnowlden/vscode-jupyter | 615 | 11021064 | # This file can mimic juypter running. Useful for testing jupyter crash handling
import sys
import argparse
import time
def main():
print("hello from dummy jupyter")
parser = argparse.ArgumentParser()
parser.add_argument("--version", type=bool, default=False, const=True, nargs="?")
parser.add_argumen... |
hydroDL/utils/grid.py | csiro-hydroinformatics/hydroDL | 109 | 11021071 | import numpy as np
def crd2grid(y, x):
ux, indX0, indX = np.unique(x, return_index=True, return_inverse=True)
uy, indY0, indY = np.unique(y, return_index=True, return_inverse=True)
minDx = np.min(ux[1:] - ux[0:-1])
minDy = np.min(uy[1:] - uy[0:-1])
maxDx = np.max(ux[1:] - ux[0:-1])
maxDy = np... |
server/scripts/session.py | foksord/RATel | 202 | 11021079 | import time
from colorama import Fore,Style
from .other import printColor
from .other import areYouSure
from .other import printAllTarget
from .management import CheckConn
from .handler import Handler
from .sql import Sql
from .spawnshell import FakeCmd
from .other import NB_SESSION , NB_SOCKET , NB_IP , NB_PORT , ... |
examples/g800/send.py | jpoikela/z88dk | 640 | 11021086 | <reponame>jpoikela/z88dk
#!/usr/bin/env python
#coding: utf-8
COM_DEVICE='/dev/cu.usbserial-A62WWHTM' # OSX example
#COM_DEVICE='COM3' # Windows example
#COM_DEVICE='/dev/ttyS0' # linux example
import serial
from serial import *
from intelhex import IntelHex
import io as StringIO#p... |
alipay/aop/api/domain/AlipayBossContractManagementCreateModel.py | antopen/alipay-sdk-python-all | 213 | 11021095 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ContractInfo import ContractInfo
class AlipayBossContractManagementCreateModel(object):
def __init__(self):
self._biz_source = None
self._contract_batch_no = ... |
addons/bitbucket/utils.py | gaybro8777/osf.io | 628 | 11021109 | <filename>addons/bitbucket/utils.py
from future.moves.urllib.parse import unquote_plus
from rest_framework import status as http_status
from framework.exceptions import HTTPError
from addons.bitbucket.api import BitbucketClient
def get_path(kwargs, required=True):
path = kwargs.get('path')
if path:
... |
code/constants.py | ElliotMunro200/reinforcement_learning_an_introduction | 234 | 11021115 | <reponame>ElliotMunro200/reinforcement_learning_an_introduction<filename>code/constants.py<gh_stars>100-1000
#!/usr/bin/env python
"""
--------------------------------
project: code
created: 11/04/2018 18:02
---------------------------------
"""
import os
class Paths(object):
data = os.path.abspath(
... |
test/com/facebook/buck/jvm/java/testdata/prebuilt/unzip.py | Unknoob/buck | 8,027 | 11021148 | <filename>test/com/facebook/buck/jvm/java/testdata/prebuilt/unzip.py
# Copyright 2016-present Facebook, 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/lice... |
python/auth-bot/auth.py | HMG-Pro-Services/hangouts-chat-samples | 217 | 11021184 | <gh_stars>100-1000
"""Functionality related to the OAuth2 flow and storing credentials.
Credentials are persisted to Google Cloud Datastore.
"""
import logging
import os
import time
from typing import Union
import flask
import jwt
from google.cloud import datastore
from google.oauth2.credentials import Credentials
fr... |
mythril/laser/smt/expression.py | kalloc/mythril | 1,887 | 11021198 | <gh_stars>1000+
"""This module contains the SMT abstraction for a basic symbol expression."""
from typing import Optional, Set, Any, TypeVar, Generic, cast
import z3
Annotations = Set[Any]
T = TypeVar("T", bound=z3.ExprRef)
class Expression(Generic[T]):
"""This is the base symbol class and maintains functionali... |
sdk/datalake/azure-mgmt-datalake-store/tests/test_mgmt_datalake_store.py | rsdoherty/azure-sdk-for-python | 2,728 | 11021211 | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -------------------------------------------------------------------... |
appimagebuilder/commands/apt_deploy.py | goldstar611/appimage-builder | 155 | 11021219 | # Copyright 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute... |
nornir/core/helpers/__init__.py | MajesticFalcon/nornir | 955 | 11021232 | <gh_stars>100-1000
from typing import Any, Dict
def merge_two_dicts(x: Dict[Any, Any], y: Dict[Any, Any]) -> Dict[Any, Any]:
try:
z = x.copy()
except AttributeError:
z = dict(x)
z.update(y)
return z
|
train_trump_cage_64x64.py | ishandutta2007/faceswap_pytorch | 230 | 11021261 | <gh_stars>100-1000
"""
Copyright StrangeAI Authors @2019
original forked from deepfakes repo
edit and promoted by StrangeAI authors
"""
from __future__ import print_function
import argparse
import os
import cv2
import numpy as np
import torch
import torch.utils.data
from torch import nn, optim... |
modules/templates/locations/BA/config.py | whanderley/eden | 205 | 11021279 | # -*- coding: utf-8 -*-
from gluon import current
def config(settings):
"""
Template settings for Bosnia and Herzegovina
- designed to be used in a Cascade with an application template
"""
#T = current.T
# Pre-Populate
settings.base.prepopulate.append("locations/BA")
# Restr... |
torch_geometric/nn/norm/pair_norm.py | mrmotallebi/pytorch_geometric | 12,651 | 11021314 | <reponame>mrmotallebi/pytorch_geometric
from torch_geometric.typing import OptTensor
import torch
from torch import Tensor
from torch_scatter import scatter
class PairNorm(torch.nn.Module):
r"""Applies pair normalization over node features as described in the
`"PairNorm: Tackling Oversmoothing in GNNs"
<... |
tests/unit/resources/security/test_roles.py | doziya/hpeOneView | 107 | 11021328 | # -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the 'Software'), to deal
# in the Software without restriction, including without limi... |
networks/keras/examples/imdb_bidirectional_lstm.py | redoclag/plaidml | 4,535 | 11021352 | <gh_stars>1000+
'''Train a Bidirectional LSTM on the IMDB sentiment classification task.
Output after 4 epochs on CPU: ~0.8146
Time per epoch on CPU (Core i7): ~150s.
'''
from __future__ import print_function
import numpy as np
import keras.callbacks
from keras.preprocessing import sequence
from keras.models import ... |
reddit2telegram/channels/chiraqology/app.py | mainyordle/reddit2telegram | 187 | 11021411 | #encoding:utf-8
subreddit = 'Chiraqology'
t_channel = '@chiraqology'
def send_post(submission, r2t):
return r2t.send_simple(submission)
|
modoboa/lib/paginator.py | HarshCasper/modoboa | 1,602 | 11021412 | """
Custom pagination tools.
"""
class Page(object):
"""Class to represent a page."""
def __init__(self, paginator, pageid, id_start, id_stop, baseurl=None):
"""Constructor."""
self.paginator = paginator
self.number = pageid
self.id_start = id_start
self.id_stop = id_s... |
backend/light_head_rcnn/lib/detection_opr/box_utils/bbox_opr.py | zju-3dv/multi-person3dpose | 391 | 11021423 | # encoding: utf-8
"""
@author: <NAME>
@contact: <EMAIL>
"""
import numpy as np
from IPython import embed
import megbrain as mgb
import megskull as mgsk
from megskull.opr.all import Concat, CondTake, ZerosLike, Log, Exp, Max, Min
from megskull.cblk.elemwise import safelog
def _concat_new_axis(t1, t2, t3, t4, axis=1)... |
eeauditor/auditors/aws/Amazon_Kinesis_Analytics_Auditor.py | kbhagi/ElectricEye | 442 | 11021425 | <reponame>kbhagi/ElectricEye
#This file is part of ElectricEye.
#SPDX-License-Identifier: Apache-2.0
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF ... |
samples/AGS/serverDetails.py | kevinsigwart/ArcREST | 208 | 11021433 | from arcrest.security.security import AGSTokenSecurityHandler
from arcrest.manageags import AGSAdministration
def trace():
"""
trace finds the line, the filename
and error message and returns it
to the user
"""
import traceback, inspect, sys
tb = sys.exc_info()[2]
tbinfo = t... |
keylogger.py | man-from-moon/Keylogger | 1,131 | 11021463 | try:
import logging
import os
import platform
import smtplib
import socket
import threading
import wave
import pyscreenshot
import sounddevice as sd
from pynput import keyboard
from pynput.keyboard import Listener
except ModuleNotFoundError:
from subprocess import call
... |
open-codegen/opengen/constraints/no_constraints.py | elsuizo/optimization-engine | 253 | 11021489 | from .constraint import Constraint
class NoConstraints(Constraint):
def __init__(self):
pass
def distance_squared(self, u):
return 0.0
def project(self, u):
return u
def is_convex(self):
return True
def is_compact(self):
return False
|
tensorflow/lite/experimental/micro/examples/micro_speech/CMSIS/create_constants.py | abhaikollara/tensorflow | 848 | 11021492 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
venv/Lib/site-packages/nipype/tests/test_nipype.py | richung99/digitizePlots | 585 | 11021497 | import os
from .. import get_info
from ..info import get_nipype_gitversion
import pytest
def test_nipype_info():
exception_not_raised = True
try:
get_info()
except Exception:
exception_not_raised = False
assert exception_not_raised
@pytest.mark.skipif(
not get_nipype_gitversion()... |
profiles/urls.py | nathandarnell/sal | 215 | 11021498 | from django.urls import path
from . import views
urlpatterns = [
path('submit/', views.submit_profiles),
]
|
PyFunceble/query/netinfo/base.py | Centaurioun/PyFunceble | 213 | 11021582 | """
The tool to check the availability or syntax of domain, IP or URL.
::
██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ █... |
invoicenet/gui/custom_widgets.py | rdkamali/InvoiceNet | 2,009 | 11021584 | # Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, ... |
alipay/aop/api/domain/KoubeiCateringPosDeskModifyModel.py | snowxmas/alipay-sdk-python-all | 213 | 11021585 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.DeskEntity import DeskEntity
class KoubeiCateringPosDeskModifyModel(object):
def __init__(self):
self._pos_desk = None
@property
def pos_desk(self):
... |
capabilities/arp/arpSpoof.py | zezomehdawii/pina-colada | 287 | 11021597 | <filename>capabilities/arp/arpSpoof.py<gh_stars>100-1000
from util_arp import *
import os
from capability import *
#masq_ip: ip we masquerade as.
#masc_mac: Masqueraded mac address
#source_mac: Our mac address
#Dest IP: target ip
#Dest Mac: target mac address
#ex: arpSpoof("10.0.0.1", "00:0c:29:5f:e7:50", "b8:27:eb:c2... |
cgt/__init__.py | joschu/c | 698 | 11021623 | from .api import *
from .display import print_tree, print_expr, print_text, as_dot
from .compilation import function, numeric_eval, profiler
from .core import (grad, get_config, update_config, simplify, reset_config,
Device, scoped_update_config, infer_shape, count_nodes)
try:
import cycgt
except ImportError:... |
binderhub/tests/test_registry.py | sgaist/binderhub | 2,134 | 11021640 | <gh_stars>1000+
"""Tests for the registry"""
import base64
import json
import os
from tornado.web import Application, RequestHandler, HTTPError
from binderhub.registry import DockerRegistry
def test_registry_defaults(tmpdir):
registry = DockerRegistry(docker_config_path=str(tmpdir.join("doesntexist.json")))
... |
tests/test_cache.py | AetherUnbound/tldextract | 1,200 | 11021646 | """Test the caching functionality"""
import os.path
import sys
import types
import pytest
import tldextract.cache
from tldextract.cache import DiskCache, get_pkg_unique_identifier, get_cache_dir
def test_disk_cache(tmpdir):
cache = DiskCache(tmpdir)
cache.set("testing", "foo", "bar")
assert cache.get("t... |
python/depthcharge/checker/_builtins/env.py | justinforbes/depthcharge | 133 | 11021657 | # SPDX-License-Identifier: BSD-3-Clause
# Depthcharge: <https://github.com/nccgroup/depthcharge>
"""
Built-in SecurityRisk definitions associated with networking functionality.
"""
from textwrap import dedent
from .. import SecurityImpact
_BUILTIN_DEFS = (
# TODO: CONFIG_ENV_AES
# 5eb35220b2cbeac79af8d73c6... |
assets/admin.py | topicgit/seal | 132 | 11021660 | from django.contrib import admin
from assets.form import Ecs
admin.site.register(Ecs) |
www/src/Lib/site-packages/ui/progressbar.py | raspberrypieman/brython | 5,926 | 11021717 | <filename>www/src/Lib/site-packages/ui/progressbar.py
from . import widget
from browser import html
class ProgressBar(widget.Widget):
def __init__(self, id=None, label=False):
self._div_shell=html.DIV(Class="ui-progressbar ui-widget ui-widget-content ui-corner-all")
widget.Widget.__init__(self, self._div... |
care/facility/tasks/patient/discharge_report.py | gigincg/care | 189 | 11021736 | import datetime
import random
import string
import time
import celery
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.mail import EmailMessage
from django.template.loader import render_to_string
from django.utils.timezone import make_aware
from hardcopy import by... |
Python/Tests/TestData/DebuggerProject/EGGceptionOnCallBack.py | techkey/PTVS | 404 | 11021738 | import os, sys
sys.path.append(os.path.abspath('EGG.egg'))
import EGG.callback_exception
def value_error():
raise ValueError
def type_error():
raise TypeError
EGG.callback_exception.f(value_error)
EGG.callback_exception.f(type_error)
|
sarsa/cliffwalk/cliffwalk.py | AgentMaker/Paddle-RLBooks | 127 | 11021739 | <reponame>AgentMaker/Paddle-RLBooks
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import hsv_to_rgb
def change_range(values, vmin=0, vmax=1):
start_zero = values - np.min(values)
return (start_zero / (np.max(start_zero) + 1e-7)) * (vmax - vmin) + vmin
class GridWorld:
terrain_... |
native_client_sdk/src/doc/doxygen/doxy_cleanup.py | Fusion-Rom/android_external_chromium_org | 231 | 11021785 | <reponame>Fusion-Rom/android_external_chromium_org<gh_stars>100-1000
#!/usr/bin/python
# Copyright (c) 2011 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.
'''This utility cleans up the html files as emitted by doxygen so... |
utils/prioritize/prep_ccds_genes.py | kokyriakidis/cloudbiolinux | 122 | 11021806 | #!/usr/bin/env python
"""Prepare adjusted CCDS BED file.
Consensus CDS (CCDS https://www.ncbi.nlm.nih.gov/projects/CCDS/CcdsBrowse.cgi) regions with two adjustments:
- 2 bps added to internal introns to capture canonical splice acceptor/donor sites
- Multiple transcripts from a single gene are merged into a single al... |
recipes/Python/438479_AuIncrementer_Example_call/recipe-438479.py | tdiprima/code | 2,023 | 11021831 | <filename>recipes/Python/438479_AuIncrementer_Example_call/recipe-438479.py
class Inc:
def __init__(self):
self.x=0
self.inc=self.giveone()
def giveone(self):
while True:
yield self.x
self.x+=1
def __call__(self):
return self.inc.next()
inc=Inc()
fo... |
utils/bin/s19toslm-new.py | 00-01/gap_sdk | 118 | 11021839 | #!/usr/bin/env python3
# ////////////////////////////////////////////////////////////////////////////////
# // Company: Multitherman Laboratory @ DEIS - University of Bologna //
# // Viale Risorgimento 2 40136 //
# // Bologna - fax 051209378... |
tools/init_wifi.py | TopperBG/pywificontrol | 115 | 11021840 | #!/usr/bin/python
# Written by <NAME> <<EMAIL>>
#
# Copyright (c) 2017, Emlid Limited
# All rights reserved.
#
# Redistribution and use in source and binary forms,
# with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above... |
pydle/utils/irccat.py | Rixxan/pydle | 150 | 11021843 | <gh_stars>100-1000
#!/usr/bin/env python3
## irccat.py
# Simple threaded irccat implementation, using pydle.
import sys
import os
import threading
import logging
import asyncio
from asyncio.streams import FlowControlMixin
from .. import Client, __version__
from . import _args
import asyncio
class IRCCat(Client):
... |
data/scripts/sol-flow-node-type-examples-list.py | undeadinu/soletta | 266 | 11021844 | #!/usr/bin/env python3
# This file is part of the Soletta (TM) Project
#
# Copyright (C) 2016 Intel Corporation. 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
#
# ... |
tasks/__init__.py | yangapku/OFA | 367 | 11021850 | <gh_stars>100-1000
from .cv_tasks import *
from .mm_tasks import *
from .nlg_tasks import *
from .nlu_tasks import *
from .pretrain_tasks import *
from .ofa_task import OFATask |
tests/test_edit/test_jaro.py | juliangilbey/textdistance | 1,401 | 11021856 | <reponame>juliangilbey/textdistance<filename>tests/test_edit/test_jaro.py<gh_stars>1000+
# built-in
from math import isclose
# external
import pytest
# project
import textdistance
ALG = textdistance.JaroWinkler
@pytest.mark.parametrize('left, right, expected', [
('hello', 'haloa', 0.7333333333333334),
('f... |
examples/layouts/flex/lv_example_flex_4.py | nickzhuang0613/lvgl | 5,238 | 11021857 | <gh_stars>1000+
#
# Reverse the order of flex items
#
cont = lv.obj(lv.scr_act())
cont.set_size(300, 220)
cont.center()
cont.set_flex_flow(lv.FLEX_FLOW.COLUMN_REVERSE)
for i in range(6):
obj = lv.obj(cont)
obj.set_size(100, 50)
label = lv.label(obj)
label.set_text("Item: " + str(i))
label.center(... |
tests/test_dictexporter.py | odidev/anytree | 700 | 11021873 | from nose.tools import eq_
from anytree import AnyNode
from anytree import Node
from anytree import NodeMixin
from anytree.exporter import DictExporter
def test_dict_exporter():
"""Dict Exporter."""
root = AnyNode(id="root")
s0 = AnyNode(id="sub0", parent=root)
s0b = AnyNode(id="sub0B", parent=s0)
... |
exercises/poker/poker.py | kishankj/python | 1,177 | 11021900 | <filename>exercises/poker/poker.py
def best_hands(hands):
pass
|
cakechat/utils/text_processing/str_processor.py | sketscripter/emotional-chatbot-cakechat | 1,608 | 11021919 | <reponame>sketscripter/emotional-chatbot-cakechat<gh_stars>1000+
import re
import nltk.tokenize
from cakechat.utils.text_processing.config import SPECIAL_TOKENS
_END_CHARS = '.?!'
_tokenizer = nltk.tokenize.RegexpTokenizer(pattern='\w+|[^\w\s]')
def get_tokens_sequence(text, lower=True, check_unicode=True):
i... |
src/datasets/mpii.py | sssheng123/AttentionalPoolingAction | 270 | 11021958 | <filename>src/datasets/mpii.py<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import glob
import tensorflow as tf
slim = tf.contrib.slim
_FILE_PATTERN = 'mpii_%s_*.tfrecord'
SPLITS_TO_SIZES = {'trainval_train': 8219, 'trainval... |
examples/rosette.py | villadsegede/Diffraction-Simulations--Angular-Spectrum-Method | 142 | 11021982 | import diffractsim
diffractsim.set_backend("CUDA") #Change the string to "CUDA" to use GPU acceleration
from diffractsim import PolychromaticField, cf, mm, cm
F = PolychromaticField(
spectrum=7 * cf.illuminant_d65, extent_x=16 * mm, extent_y=16 * mm, Nx=800, Ny=800,
spectrum_size = 200, spectrum_divisions = 4... |
StockAnalysisSystem/core/Utility/time_utility.py | SleepySoft/StockAnalysisSystem | 138 | 11022004 | <gh_stars>100-1000
import time
import datetime
def now() -> datetime.datetime:
return datetime.datetime.now()
def today() -> datetime.datetime:
return datetime.datetime.today().replace(hour=0, minute=0, second=0, microsecond=0)
def days_ago(days: int) -> datetime.datetime:
the_date = datetime.datetime... |
examples/basic_methods.py | Radabaugh/tableau_tools | 179 | 11022030 | # -*- coding: utf-8 -*-
from tableau_tools import *
# This example shows how to build up new commands from the basic components, to implement new features or arguments or
# whatever in the future
server = 'http://127.0.0.1'
username = ''
password = ''
# Using api_version overrides the default internal API version t... |
src/app/beer_garden/events/handlers.py | Jake-Ross/beer-garden | 230 | 11022051 | <filename>src/app/beer_garden/events/handlers.py
# -*- coding: utf-8 -*-
import logging
from copy import deepcopy
from brewtils.models import Event
import beer_garden.config
import beer_garden.files
import beer_garden.garden
import beer_garden.local_plugins.manager
import beer_garden.log
import beer_garden.plugin
imp... |
lib/dcc/houdini_dcc.py | kei-iketani/plex | 153 | 11022053 | <reponame>kei-iketani/plex<filename>lib/dcc/houdini_dcc.py
#*********************************************************************
# content = Houdini
# version = 0.1.0
# date = 2019-10-06
#
# license = MIT <https://github.com/alexanderrichtertd>
# author = <NAME> <<EMAIL>>
#*******************************... |
grow/extensions/hooks/base_hook_test.py | akashkalal/grow | 335 | 11022068 | <gh_stars>100-1000
"""Tests for base hook."""
import unittest
from grow.extensions.hooks import base_hook
class BaseHookTestCase(unittest.TestCase):
"""Test the base hook."""
def test_something(self):
"""?"""
pass
|
code/utils/plots.py | shubham-goel/idr | 359 | 11022080 | <reponame>shubham-goel/idr
import plotly.graph_objs as go
import plotly.offline as offline
import numpy as np
import torch
from skimage import measure
import torchvision
import trimesh
from PIL import Image
from utils import rend_util
def plot(model, indices, model_outputs ,pose, rgb_gt, path, epoch, img_res, plot_nim... |
lib/project_contributors.py | Rehzende/project-dev-kpis | 113 | 11022106 | <reponame>Rehzende/project-dev-kpis
from prometheus_client import Gauge
from jira_util import *
from company_jira import jira
from util import *
PROJECT_CONTRIBUTORS = Gauge(
'project_contributors',
'Number of contributors to the project currently active.',
['project']
)
def monitor_project_contributor... |
test/benchmark/vqe_application.py | jakelishman/qiskit-aer | 313 | 11022110 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or d... |
tests/unit/test_role.py | jeanpommier/ldap2pg | 151 | 11022119 | <reponame>jeanpommier/ldap2pg
from __future__ import unicode_literals
from fnmatch import filter as fnfilter
import pytest
def test_role():
from ldap2pg.role import Role, RoleOptions
role = Role(name='toto')
assert 'toto' == role.name
assert 'toto' == str(role)
assert 'toto' in repr(role)
... |
src/unittest/python/utils_tests.py | Mattlk13/pybuilder | 1,419 | 11022125 | <reponame>Mattlk13/pybuilder
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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
#
# ... |
src/AgentAI/agentenv/ImitationEnv.py | Passer-D/GameAISDK | 1,210 | 11022128 | # -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this source code package.
Copyright... |
vaas-app/src/vaas/router/admin.py | allegro/vaas | 251 | 11022175 | <filename>vaas-app/src/vaas/router/admin.py
import csv
from django.contrib import admin
from vaas.external.audit import AuditableModelAdmin
from vaas.router.models import Route
from vaas.router.forms import RouteModelForm
from django.conf import settings
class RouteAdmin(AuditableModelAdmin):
form = RouteModelF... |
couchbase_v2/tests/cases/view_iterator_t.py | couchbase/couchbase-python-client | 189 | 11022182 | #
# Copyright 2013, Couchbase, 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... |
otrans/model/__init__.py | jjjjohnson/OpenTransformer | 321 | 11022184 | <reponame>jjjjohnson/OpenTransformer<gh_stars>100-1000
from .ctc import CTCModel
from .speech2text import SpeechToText
from .lm import RecurrentLanguageModel, TransformerLanguageModel
End2EndModel = {
'ctc': CTCModel,
'speech2text': SpeechToText
}
LanguageModel = {
'rnn_lm': RecurrentLanguageModel,
'... |
_examples/iface/test.py | pombredanne/go-python-gopy | 1,372 | 11022202 | <filename>_examples/iface/test.py
# Copyright 2015 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
## py2/py3 compat
from __future__ import print_function
import iface, go
### test docs
print("doc(iface): %r" % (iface.... |
lets_quiz/quiz/views.py | Arsinha89/lets-quiz | 123 | 11022269 | <reponame>Arsinha89/lets-quiz<gh_stars>100-1000
from django.shortcuts import render, get_object_or_404, redirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
fro... |
two1/bitserv/django/__init__.py | febuiles/two1-python | 415 | 11022287 | """Bitserv implementation for Django."""
try:
import django # noqa
import rest_framework # noqa
except ImportError:
raise ImportError(
'''21 Django integration requires the following packages:
django~=1.8.0
djangorestframework==3.2.3
Please install them with pip before continuing.'''
)
from... |
examples/test/run_test.py | hubert-he/FATE | 3,787 | 11022305 | import argparse
import json
import os
import time
import traceback
from atexit import register
import submit
TEST_SUITE_SUFFIX = "testsuite.json"
def search_testsuite(file_dir, suffix=TEST_SUITE_SUFFIX):
testsuites = []
for root, dirs, files in os.walk(file_dir):
for file_name in files:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.