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 |
|---|---|---|---|---|
tests/messages_data/error_emails/missing_content_disposition.py | unqx/imap_tools | 344 | 11146157 | import datetime
from imap_tools import EmailAddress
DATA = dict(
subject='Redacted',
from_='<EMAIL>',
to=('<EMAIL>',),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2002, 1, 22, 14, 35, 28, tzinfo=datetime.timezone.utc),
date_str='Tue, 22 Jan 2002 14:35:28 UT',
text='',
htm... |
test/integration/expected_out_single_line/simple_format.py | Inveracity/flynt | 487 | 11146190 | <gh_stars>100-1000
var = 5
a = f"my string {var:.2f}" |
hickle/legacy_v3/helpers.py | texadactyl/hickle | 402 | 11146207 | <filename>hickle/legacy_v3/helpers.py
import re
import six
def get_type_and_data(h_node):
""" Helper function to return the py_type and data block for a HDF node """
py_type = h_node.attrs["type"][0]
data = h_node[()]
# if h_node.shape == ():
# data = h_node.value
# else:
# data = h_no... |
tools/jenkins-scripts/configs/cocostudiox-daily-build.py | wzhengsen/engine-x | 113 | 11146224 | <reponame>wzhengsen/engine-x
import os
import platform
if(os.path.exists('CocoStudio/CSX/CSX/CSX.pro') == False):
node_name = os.environ['NODE_NAME']
source_dir = '../../../cocostudiox-base-repo/node/' + node_name
if(platform.system() == 'Windows'):
source_dir = source_dir.replace("/", os.sep)
... |
tools/third_party/hyper/hyper/packages/rfc3986/uri.py | ziransun/wpt | 2,479 | 11146231 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Rackspace
# Copyright (c) 2015 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... |
tests/common/test_builder_state.py | sarthakpati/nncf | 310 | 11146241 | <reponame>sarthakpati/nncf<gh_stars>100-1000
"""
Copyright (c) 2021 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless requ... |
homeassistant/components/media_player/const.py | liangleslie/core | 30,023 | 11146335 | """Provides the constants needed for component."""
from enum import IntEnum
# How long our auth signature on the content should be valid for
CONTENT_AUTH_EXPIRY_TIME = 3600 * 24
ATTR_APP_ID = "app_id"
ATTR_APP_NAME = "app_name"
ATTR_ENTITY_PICTURE_LOCAL = "entity_picture_local"
ATTR_GROUP_MEMBERS = "group_members"
AT... |
Algo and DSA/LeetCode-Solutions-master/Python/baseball-game.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11146392 | # Time: O(n)
# Space: O(n)
class Solution(object):
def calPoints(self, ops):
"""
:type ops: List[str]
:rtype: int
"""
history = []
for op in ops:
if op == '+':
history.append(history[-1] + history[-2])
elif op == 'D':
... |
python/tests/api/types/test_comparable_comparator.py | moulimukherjee/incubator-iceberg | 2,161 | 11146398 | <filename>python/tests/api/types/test_comparable_comparator.py
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under t... |
perfzero/lib/perfzero/process_info_tracker.py | chensusu11/benchmarks | 1,073 | 11146406 | <filename>perfzero/lib/perfzero/process_info_tracker.py<gh_stars>1000+
# Copyright 2019 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
#
# ht... |
configs/_base_/datasets/deepfashion_full.py | nightfuryyy/mmpose | 1,775 | 11146419 | <reponame>nightfuryyy/mmpose<filename>configs/_base_/datasets/deepfashion_full.py
dataset_info = dict(
dataset_name='deepfashion_full',
paper_info=dict(
author='<NAME> and <NAME> and <NAME> '
'and <NAME> and <NAME>',
title='DeepFashion: Powering Robust Clothes Recognition '
'and ... |
validators/hashes.py | vphilippon/validators | 586 | 11146464 | import re
from .utils import validator
md5_regex = re.compile(
r"^[0-9a-f]{32}$",
re.IGNORECASE
)
sha1_regex = re.compile(
r"^[0-9a-f]{40}$",
re.IGNORECASE
)
sha224_regex = re.compile(
r"^[0-9a-f]{56}$",
re.IGNORECASE
)
sha256_regex = re.compile(
r"^[0-9a-f]{64}$",
re.IGNORECASE
)
sha5... |
src/python/strelka/scanners/scan_json.py | weslambert/strelka | 513 | 11146468 | import json
from strelka import strelka
class ScanJson(strelka.Scanner):
"""Collects keys from JSON files."""
def scan(self, data, file, options, expire_at):
self.event.setdefault('keys', [])
try:
self._get_keys(self, json.loads(data.decode()))
except UnicodeDecodeError:... |
Sierra-RV50X-logger.py | danlshields/scream | 137 | 11146483 | <reponame>danlshields/scream
import requests
import json
import datetime
import time
import socket
# OUT_FILE = 'data.txt'
# This simple application logs the Sierra RV50X (possibly other Sierra modems too)
# The data is echoed to 127.0.0.1:35000, the SCReAM wrappers can get the data this
# way and then include it th... |
Trakttv.bundle/Contents/Libraries/Shared/stash/main.py | disrupted/Trakttv.bundle | 1,346 | 11146489 | <gh_stars>1000+
from stash.core.modules.manager import ModuleManager
from collections import MutableMapping
from threading import Lock
class Stash(MutableMapping):
def __init__(self, archive, algorithm='lru:///', serializer='none:///', cache='memory:///', key_transform=None):
# Construct modules
... |
desktop/core/ext-py/docutils-0.14/tools/quicktest.py | kokosing/hue | 5,079 | 11146495 | #!/usr/bin/env python
# $Id: quicktest.py 8126 2017-06-23 09:34:28Z milde $
# Authors: <NAME> <<EMAIL>>;
# <NAME> <<EMAIL>>
# Copyright: This module has been placed in the public domain.
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
import sys
import os
import getopt
import... |
model/utils.py | yashkant/Vision-Language-Transformer | 132 | 11146515 | <gh_stars>100-1000
import keras.backend as K
import tensorflow as tf
def expand_and_tile(x, outsize):
x = K.expand_dims(x, axis=1)
x = K.expand_dims(x, axis=1)
x = K.tile(x, [1, outsize, outsize, 1])
return x
def expand_and_tile_1(x, outchannels):
x = K.expand_dims(x, axis=-1)
x... |
tools/bagging.py | zake7749/DeepToxic | 206 | 11146528 | <gh_stars>100-1000
import sys
import numpy as np
import pandas as pd
from sklearn import *
from scipy.special import expit,logit
ensembeled = sys.argv[1:]
print("Going ensemble on",)
subs = []
for e in ensembeled:
print(e)
subs.append(pd.read_csv(e))
classes = ['toxic', 'severe_toxic', 'obscene', 'threat', 'insult'... |
src/features/migrations/0015_auto_20190916_1338.py | nixplay/bullet-train-api | 1,259 | 11146555 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-09-16 13:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('features', '0014_auto_20190607_1642'),
... |
rotkehlchen/crypto.py | rotkehlchenio/rotkehlchen | 137 | 11146581 | <reponame>rotkehlchenio/rotkehlchen
import base64
import os
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from rotkehlchen.errors.misc import UnableToDecryptRemoteData
AES_BLOCK_SIZE = 16
# AES encrypt/decrypt taken from here: https:/... |
test/example_thirdparty/example_thirdparty/__init__.py | timgates42/pybbm | 134 | 11146598 | <gh_stars>100-1000
# coding=utf-8
from __future__ import unicode_literals |
basis_set_exchange/tests/test_bundle_slow.py | ltalirz/basis_set_exchange | 108 | 11146611 | <reponame>ltalirz/basis_set_exchange
"""
Tests for creating bundles/archives of formatted data
"""
import pytest
from .test_bundle import _run_test_bundles, _bundle_exts
# yapf: disable
@pytest.mark.slow
@pytest.mark.parametrize('ext', _bundle_exts)
@pytest.mark.parametrize('fmt, reffmt', [('nwchem', 'bib'),
... |
IoT Edge anomaly detection tutorial/iot_score.py | kgremban/ai-toolkit-iot-edge | 184 | 11146629 | # This script generates the scoring file
# with the init and run functions needed to
# operationalize the anomaly detection sample
import pickle
import json
import pandas
from sklearn.externals import joblib
from sklearn.linear_model import Ridge
from azureml.core.model import Model
def init():
globa... |
cos/training/network.py | abidlabs/cone-of-silence | 113 | 11146637 | <reponame>abidlabs/cone-of-silence
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
def rescale_conv(conv, reference):
"""
Rescale a convolutional module with `reference`.
"""
std = conv.weight.std().detach()
scale = (std / reference)**0.5
conv.weight.data /= scal... |
ggplot/scales/scale_reverse.py | themiwi/ggplot | 1,133 | 11146638 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from .scale import scale
from copy import deepcopy
class scale_y_reverse(scale):
"""
Reverse y axis
Examples
--------
>>> ggplot(diamonds, aes(x='price')) + geom_histogram() + scale_y_reve... |
back/tests/test_views/test_player_views/test_get.py | ramonakira/piclodio3 | 120 | 11146639 | from rest_framework import status
from rest_framework.reverse import reverse
from rest_framework.test import APITestCase
from unittest.mock import patch
from restapi.models import WebRadio
from utils.player_manager import PlayerManager
class TestGet(APITestCase):
def setUp(self):
super(TestGet, self).se... |
boundary_layer/schemas/internal/operators.py | aksswami/boundary-layer | 252 | 11146674 | <reponame>aksswami/boundary-layer<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright 2018 Etsy 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/L... |
api/tacticalrmm/checks/migrations/0024_auto_20210606_1632.py | infinite8co/tacticalrmm | 903 | 11146722 | <filename>api/tacticalrmm/checks/migrations/0024_auto_20210606_1632.py
# Generated by Django 3.2.1 on 2021-06-06 16:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('checks', '0023_check_run_interval'),
]
operations = [
migrations.Remo... |
rex/crash_tracer/__init__.py | shellphish/rex | 471 | 11146742 | import logging
from abc import abstractmethod
import archr
from angr import sim_options as so
l = logging.getLogger("rex.CrashTracer")
class NonCrashingInput(Exception):
pass
class CrashTracerError(Exception):
pass
class TraceMode:
DUMB = "dumb"
HALFWAY = "halfway"
FULL_... |
frontend/templatetags/qunit_fixture_data.py | mepsd/CLAC | 126 | 11146751 | <reponame>mepsd/CLAC<filename>frontend/templatetags/qunit_fixture_data.py
import json
from django import template
from django import forms
from django.utils.safestring import mark_safe
from ..upload import UploadWidget
register = template.Library()
class UploadTestsForm(forms.Form):
file = forms.FileField(widg... |
plenum/common/config_helper.py | andkononykhin/plenum | 148 | 11146795 | import os
from common.exceptions import PlenumValueError, ValueUndefinedError
class PConfigHelper:
def __init__(self, config, *, chroot=None):
if config is None:
raise ValueUndefinedError('config')
if chroot is not None and not chroot.startswith("/"):
raise PlenumValueErr... |
earth_enterprise/src/fusion/portableglobe/servers/fileunpacker/build_and_test.py | ezeeyahoo/earthenterprise | 2,661 | 11146819 | <reponame>ezeeyahoo/earthenterprise
#!/usr/bin/env python2.7
#
# Copyright 2017 Google 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... |
d2go/data/keypoint_metadata_registry.py | wenliangzhao2018/d2go | 687 | 11146855 | #!/usr/bin/env python3
from typing import NamedTuple, List, Tuple
from detectron2.utils.registry import Registry
KEYPOINT_METADATA_REGISTRY = Registry("KEYPOINT_METADATA")
KEYPOINT_METADATA_REGISTRY.__doc__ = "Registry keypoint metadata definitions"
class KeypointMetadata(NamedTuple):
names: List[str]
fli... |
app/main.py | keller-mark/conda-starlette-docker | 129 | 11146865 | import sys
from starlette.applications import Starlette
from starlette.responses import JSONResponse
version = f"{sys.version_info.major}.{sys.version_info.minor}"
app = Starlette()
@app.route("/")
async def homepage(request):
message = f"Hello world! From Starlette running on Uvicorn with Gunicorn. Using Pyth... |
tests/tools/protocol/requests/test_api_versions_v0.py | akashvacher/kafka-tools | 578 | 11146904 | <filename>tests/tools/protocol/requests/test_api_versions_v0.py
import unittest
from kafka.tools.protocol.requests import ArgumentError
from kafka.tools.protocol.requests.api_versions_v0 import ApiVersionsV0Request
class ApiVersionsV0RequestTests(unittest.TestCase):
def test_process_arguments(self):
asse... |
autogl/module/hpo/suggestion/algorithm/quasi_random_search.py | general502570/AutoGL | 824 | 11146916 | from ...suggestion.algorithm.base_chocolate_algorithm import BaseChocolateAlgorithm
class QuasiRandomSearchAlgorithm(BaseChocolateAlgorithm):
"""
The implementation is based on https://github.com/tobegit3hub/advisor
Get the new suggested trials with quasi random search algorithm.
"""
def __init__... |
model_zoo/exceptions.py | ModelZoo/ModelZoo | 191 | 11146924 | <gh_stars>100-1000
class DefineException(Exception):
pass
class LoadException(Exception):
pass |
docs_src/examples/use_cases/example_cg_newton.py | jabader97/backpack | 395 | 11146938 | <gh_stars>100-1000
r"""Matrix-free second-order optimization
=========================================
This example walks you through a second-order optimizer that uses the conjugate
gradient (CG) method and matrix-free multiplication with the block diagonal of
different curvature matrices to solve for the Newton step... |
examples/midifiles/play_midi_file.py | fooker/mido | 658 | 11146952 | <reponame>fooker/mido
#!/usr/bin/env python
"""
Play MIDI file on output port.
Run with (for example):
./play_midi_file.py 'SH-201 MIDI 1' 'test.mid'
"""
import sys
import mido
import time
from mido import MidiFile
filename = sys.argv[1]
if len(sys.argv) == 3:
portname = sys.argv[2]
else:
portname = None... |
src/sqlfluff/testing/__init__.py | pvonglehn/sqlfluff | 3,024 | 11146983 | """Testing utils we want to expose for usage by plugins."""
|
SqlmapCelery/model/hunter_model.py | tt9133github/hunter | 322 | 11147027 | #!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://www.zto.com/
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
algoexpert.io/python/Lowest_Common_Manager.py | mamane19/coding-interview-gym | 713 | 11147050 | class OrgInfo:
def __init__(self, lowestCommonManager, numImportantReports):
self.lowestCommonManager = lowestCommonManager
self.numImportantReports = numImportantReports
class Node:
def __init__(self, directReports):
self.directReports = directReports
# O(n) time | O(d) spaces
def ge... |
generate-standalone-package.py | mblack20/flintrock | 615 | 11147077 | import os
import platform
import shutil
import subprocess
from flintrock import __version__ as flintrock_version
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
if __name__ == '__main__':
operating_system = platform.system()
if operating_system.lower() == 'darwin':
operating_system = 'macOS'
... |
cogdl/wrappers/model_wrapper/node_classification/node_classification_mw.py | THUDM/cogdl | 1,072 | 11147107 | <reponame>THUDM/cogdl
import torch
from cogdl.wrappers.model_wrapper import ModelWrapper, register_model_wrapper
@register_model_wrapper("node_classification_mw")
class NodeClfModelWrapper(ModelWrapper):
def __init__(self, model, optimizer_config):
super(NodeClfModelWrapper, self).__init__()
self.... |
actions/update_ticket_status.py | kodithuw/stackstorm-zendesk | 164 | 11147133 | from lib.zendesk import ZendeskAction
__all__ = [
'UpdateTicketStatusAction'
]
class UpdateTicketStatusAction(ZendeskAction):
def run(self, ticket_id, status):
return self.update_ticket_status(ticket_id, status)
|
tests/test_reading_1_4.py | CCInc/laspy | 240 | 11147139 | <filename>tests/test_reading_1_4.py
import pytest
import laspy
from tests.test_common import test1_4_las
@pytest.fixture()
def file():
return laspy.read(test1_4_las)
def test_unscaled_x(file):
assert file.X.max() == 1751224820
assert file.X.min() == 1320803567
def test_unscaled_y(file):
assert fi... |
svtools/lmerge.py | NeolithEra/svtools | 120 | 11147151 | import sys
import svtools.l_bp as l_bp
from svtools.breakpoint import Breakpoint
import svtools.logspace as ls
from svtools.vcf.file import Vcf
from svtools.vcf.variant import Variant
from svtools.utils import parse_bnd_alt_string, InputStream
from svtools.exceptions import MissingProbabilitiesException
import sys
im... |
pykafka/protocol/offset_commit.py | Instamojo/pykafka | 1,174 | 11147189 | # - coding: utf-8 -
import struct
from collections import namedtuple, defaultdict
from .base import Request, Response
from ..utils import struct_helpers
from ..utils.compat import iteritems
class GroupCoordinatorRequest(Request):
"""A consumer metadata request
Specification::
GroupCoordinatorRequest ... |
configs/selfsup/simmim/simmim_swin-base_8xb256-coslr-100e_in1k-192.py | mitming/mmselfsup | 355 | 11147215 | _base_ = 'simmim_swin-base_16xb128-coslr-100e_in1k.py'
# data
data = dict(samples_per_gpu=256)
|
vumi/dispatchers/endpoint_dispatchers.py | seidu626/vumi | 199 | 11147232 | # -*- test-case-name: vumi.dispatchers.tests.test_endpoint_dispatchers -*-
"""Basic tools for building dispatchers."""
from twisted.internet.defer import gatherResults, maybeDeferred
from vumi.worker import BaseWorker
from vumi.config import ConfigDict, ConfigList
from vumi import log
class DispatcherConfig(BaseWo... |
tests/spectral/test_S2FFT_NFFT.py | machism0/lie_learn | 140 | 11147242 | <filename>tests/spectral/test_S2FFT_NFFT.py
import lie_learn.spaces.S2 as S2
from lie_learn.spectral.S2FFT_NFFT import S2FFT_NFFT
from lie_learn.representations.SO3.spherical_harmonics import *
def test_S2FFT_NFFT():
"""
Testing S2FFT NFFT
"""
b = 8
convention = 'Gauss-Legendre'
#convention = ... |
examples/twisted/wamp/app/keyvalue/store.py | rapyuta-robotics/autobahn-python | 1,670 | 11147244 | ###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... |
setup.py | joannadiong/zEpid | 101 | 11147257 | <reponame>joannadiong/zEpid<filename>setup.py
from setuptools import setup
exec(compile(open('zepid/version.py').read(),
'zepid/version.py', 'exec'))
with open("README.md") as f:
descript = f.read()
setup(name='zepid',
version=__version__,
description='Tool package for epidemiologic an... |
tutorials/eboutique/microservices/cart/src/commands/services.py | bhardwajRahul/minos-python | 247 | 11147266 | from minos.cqrs import (
CommandService,
)
from minos.networks import (
Request,
Response,
ResponseException,
enroute,
)
from minos.saga import (
SagaContext,
SagaStatus,
)
from ..aggregates import (
CartAggregate,
)
from .saga.add_cart import (
ADD_CART_ITEM,
)
class CartCommandS... |
examples/d2/roessler.py | manu-mannattil/nolitsa | 118 | 11147283 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""D2 of the Rössler oscillator.
The estimates here match the "accepted" value of 1.991 quite closely.
"""
import numpy as np
import matplotlib.pyplot as plt
from nolitsa import d2, data, utils
x0 = [-3.2916983, -1.42162302, 0.02197593]
x = utils.rescale(data.roessler(l... |
openprompt/utils/calibrate.py | puraminy/OpenPrompt | 979 | 11147300 |
from yacs.config import CfgNode
from openprompt.data_utils import FewShotSampler
from torch.utils.data.dataset import Dataset
from transformers.data.processors.utils import InputExample
from openprompt.pipeline_base import PromptDataLoader, PromptModel, PromptForClassification
from typing import *
import torch
from tq... |
packages/pegasus-python/src/Pegasus/cli/pegasus-submitdir.py | ahnitz/pegasus | 127 | 11147309 | <filename>packages/pegasus-python/src/Pegasus/cli/pegasus-submitdir.py<gh_stars>100-1000
#!/usr/bin/env python3
from Pegasus.submitdir import main
main()
|
cape_privacy/audit/__init__.py | vismaya-Kalaiselvan/cape-python | 144 | 11147326 | <filename>cape_privacy/audit/__init__.py
from cape_privacy.audit.audit import AuditLogger, APPLY_POLICY_EVENT
__all__ = [
"AuditLogger",
"APPLY_POLICY_EVENT"
] |
unit_tests/appzoo_tests/test_ez_serialization.py | johnson7788/EasyTransfer | 806 | 11147335 | <reponame>johnson7788/EasyTransfer
# coding=utf-8
# Copyright (c) 2019 Alibaba PAI 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... |
example/example/dynamic_preferences_registry.py | EliotBerriot/django-dynamic-preferences | 244 | 11147358 | <reponame>EliotBerriot/django-dynamic-preferences<gh_stars>100-1000
from dynamic_preferences.types import *
from dynamic_preferences.registries import global_preferences_registry
from dynamic_preferences.users.registries import user_preferences_registry
from .models import MyModel
_section = Section("section")
@glo... |
unittests/test_exceptions.py | CLIP-HPC/reframe | 167 | 11147368 | # Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import pytest
import reframe.core.exceptions as exc
def assert_args(exc_type, *args):
e = exc_type(*args)
assert ar... |
seriously/test/tests.py | Mego/Seriously | 104 | 11147416 | <filename>seriously/test/tests.py
#!/usr/bin/env python3
import argparse
import collections
import contextlib
import math
import random
from io import StringIO
import os
import sys
import unittest
from seriouslylib.cp437 import CP437
from seriouslylib.iterable import as_list
from seriouslylib.nicenames import nice_name... |
adapter/protobuf/test/protobuf/consume.py | higherkindness/mu-haskell | 286 | 11147420 | from example_pb2 import *
import sys
f = open(sys.argv[1], "rb")
example_person = person()
example_person.ParseFromString(f.read())
f.close()
print(example_person)
|
hubspot/crm/extensions/calling/__init__.py | Ronfer/hubspot-api-python | 117 | 11147486 | # coding: utf-8
# flake8: noqa
"""
Calling Extensions API
Provides a way for apps to add custom calling options to a contact record. This works in conjunction with the [Calling SDK](#), which is used to build your phone/calling UI. The endpoints here allow your service to appear as an option to HubSpot users... |
test/optimizer/benchmark/main.py | Dee-Why/lite-bo | 184 | 11147496 | import os
import sys
import time
import pickle
import argparse
import tabulate
import numpy as np
sys.path.append(os.getcwd())
parser = argparse.ArgumentParser()
dataset_set = 'dna,pollen,abalone,splice,madelon,spambase,wind,page-blocks(1),pc2,segment'
parser.add_argument('--datasets', type=str, default=dataset_set)... |
tests/common/test_op/ascend/matmul4d_ad.py | tianjiashuo/akg | 286 | 11147516 | <filename>tests/common/test_op/ascend/matmul4d_ad.py
# Copyright 2019-2021 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/LICE... |
lib/python/frugal/tests/aio/transport/test_nats_transport.py | ariasheets-wk/frugal | 144 | 11147546 | # Copyright 2017 Workiva
# 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, software
#... |
examples/ex03_proc/ubmark/proc_ubmark_cksum_roll_data.py | kevinyuan/pymtl3 | 152 | 11147554 | #=========================================================================
# proc_ubmark_cksum_roll_data.py
#=========================================================================
dataset_size = 150
mask = [ 0x0000ffff ]
ref = [ 0x9f6b0de5 ]
src = [
0x01510248, 0x02cb03f5, 0x001c0387,
0x00010264, 0x000e0090,... |
src/python/phyre/check_solutions.py | aallaire91/phyre | 432 | 11147558 | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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... |
third_party/virtualbox/src/libs/xpcom18a4/python/test/test_component/py_test_component.py | Fimbure/icebox-1 | 521 | 11147612 | <reponame>Fimbure/icebox-1
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (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.... |
docs/examples/compute/cloudframes/auth_kwargs.py | dupontz/libcloud | 1,435 | 11147641 | from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
CloudFrames = get_driver(Provider.CLOUDFRAMES)
driver = CloudFrames(key='admin', secret='admin', secure=False,
host='cloudframes', port=80)
|
dags/ethereumetl_airflow/parse/parse_logic.py | datawaves-xyz/ethereum-etl-airflow | 204 | 11147660 | <reponame>datawaves-xyz/ethereum-etl-airflow<filename>dags/ethereumetl_airflow/parse/parse_logic.py
import json
import logging
import re
import time
from eth_utils import event_abi_to_log_topic, function_abi_to_4byte_selector
from google.cloud import bigquery
from google.api_core.exceptions import Conflict
from ethe... |
Recommender_System/algorithm/MKR/layer.py | Holldean/Recommender-System | 348 | 11147675 | import tensorflow as tf
class CrossLayer(tf.keras.layers.Layer):
def call(self, inputs):
v, e = inputs # (batch, dim)
v = tf.expand_dims(v, axis=2) # (batch, dim, 1)
e = tf.expand_dims(e, axis=1) # (batch, 1, dim)
c_matrix = tf.matmul(v, e) # (batch, dim, dim)
... |
models/model_variants.py | Minsoo2022/Pose-Transfer | 692 | 11147706 | import torch.nn as nn
import functools
import torch
import functools
import torch.nn.functional as F
from torch.autograd import Variable
class PATBlock(nn.Module):
def __init__(self, dim, padding_type, norm_layer, use_dropout, use_bias, cated_stream2=False):
super(PATBlock, self).__init__()
self.co... |
qmpy/configuration/vasp_settings/__init__.py | tachyontraveler/qmpy | 103 | 11147727 | import yaml
import os, os.path
from .inputs import *
from qmpy import INSTALL_PATH
vs_path = os.path.dirname(os.path.abspath(__file__))
thubbards = yaml.safe_load(open(vs_path + "/hubbards.yml").read())
hubbards = {}
for setting, data in list(thubbards.items()):
hubbards[setting] = {}
for k, v in list(data.ite... |
cloudbaseinit/tests/plugins/windows/test_winrmlistener.py | andia10240/cloudbase-init | 160 | 11147730 | # Copyright 2013 Cloudbase Solutions Srl
#
# 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... |
tests/test_client_tasks.py | FiyaFly/python-asana | 266 | 11147743 | from .helpers import *
class TestClientTasks(ClientTestCase):
def test_tasks_create(self):
req = {
"data": {
"assignee": 1235,
"followers": [5678],
"name": "<NAME>.",
"notes": "How are you today?",
"workspace": 149... |
py/mistql/gardenwall.py | adamtrilling/mistql | 263 | 11147761 | from typing import Any
from mistql.runtime_value import RuntimeValue
def input_garden_wall(data: Any) -> RuntimeValue:
return RuntimeValue.of(data)
def output_garden_wall(data: RuntimeValue) -> Any:
return data.to_python()
|
atomic_reactor/utils/flatpak_util.py | qixiang/atomic-reactor | 113 | 11147784 | <filename>atomic_reactor/utils/flatpak_util.py<gh_stars>100-1000
"""
Copyright (c) 2022 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import logging
from typing import Any, Dict, List, Optional
import gi
from f... |
bigflow_python/python/bigflow/transform_impls/test/intersection_test.py | advancedxy/bigflow_python | 1,236 | 11147795 | <reponame>advancedxy/bigflow_python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Baidu, 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
#
# ... |
tests/test_calendar_event.py | damianfs/canvasapi | 386 | 11147805 | import unittest
import requests_mock
from canvasapi import Canvas
from canvasapi.calendar_event import CalendarEvent
from tests import settings
from tests.util import register_uris
@requests_mock.Mocker()
class TestCalendarEvent(unittest.TestCase):
def setUp(self):
self.canvas = Canvas(settings.BASE_URL... |
zentral/core/queues/backends/kombu.py | arubdesu/zentral | 634 | 11147843 | from importlib import import_module
import logging
import time
from zentral.conf import settings
from kombu import Connection, Consumer, Exchange, Queue
from kombu.mixins import ConsumerMixin, ConsumerProducerMixin
from kombu.pools import producers
from zentral.utils.json import save_dead_letter
logger = logging.getL... |
chrome/common/extensions/docs/server2/caching_file_system.py | google-ar/chromium | 2,151 | 11147844 | <reponame>google-ar/chromium
# 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.
import logging
import posixpath
import sys
from file_system import FileSystem, StatInfo, FileNotFoundError
from future impo... |
histoqc/_worker.py | kaczmarj/HistoQC | 140 | 11147872 | <gh_stars>100-1000
"""histoqc worker functions"""
import os
import shutil
from histoqc.BaseImage import BaseImage
from histoqc._pipeline import load_pipeline
from histoqc._pipeline import setup_plotting_backend
# --- worker functions --------------------------------------------------------
def worker_setup(c):
... |
examples/PYBV11/toasters/toasters.py | jdtsmith/st7789_mpy | 153 | 11147887 | '''
toasters.py
An example using bitmap to draw sprites on a ST7789 TFT display
connected to a pyboard1.1.
spritesheet from CircuitPython_Flying_Toasters
https://learn.adafruit.com/circuitpython-sprite-animation-pendant-mario-clouds-flying-toasters
'''
import time
import random
from pyb import SPI, P... |
imodels/tree/figs.py | csinva/interpretability-implementations-demos | 102 | 11147924 | from copy import deepcopy
from typing import List
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn.datasets
from sklearn import datasets
from sklearn import tree
from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin
from sklearn.model_selection import train_test_s... |
riptable/rt_sort_cache.py | 972d5defe3218bd62b741e6a2f11f5b3/riptable | 307 | 11147941 | __all__ = ['SortCache', ]
import numpy as np
from .rt_numpy import lexsort, crc64
from .rt_enum import TypeRegister
class SortCache(object):
'''
Global sort cache for uid - unique ids which are often generated from GetTSC (CPU time stamp counter)
to ensure that the values have not changed und... |
src/setup.py | kevinsigwart/ArcREST | 208 | 11147970 | <reponame>kevinsigwart/ArcREST
"""
ArcREST Setup Code
"""
from distutils.core import setup
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
packages = ['arcresthelper','arcresthelper/packages',
'arcrest','arcrest/agol','arcrest/agol/helperservices', 'arcrest/ags', ... |
model_analyzer/reports/report_manager.py | MarkMoTrin/model_analyzer | 115 | 11147975 | <gh_stars>100-1000
# Copyright (c) 2021 NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.... |
api/util.py | AmbiteamProject/spleeter-web | 202 | 11148020 | <filename>api/util.py
import re
def get_valid_filename(s):
"""
Return the given string converted to a string that can be used for a clean
filename. Remove leading and trailing spaces; remove anything that is not an
alphanumeric, dash, whitespace, comma, bracket, underscore, or dot.
>>> get_valid_fi... |
2017/quals/2017-crypto-selfhash/challenge/challenge.py | tonghuaroot/google-ctf | 2,757 | 11148021 | <filename>2017/quals/2017-crypto-selfhash/challenge/challenge.py
#!/usr/bin/python
#
# 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... |
scripts/content/playlist.py | sudheer09441/Saavn-Downloader | 119 | 11148074 | <filename>scripts/content/playlist.py<gh_stars>100-1000
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
import json
from ..download_manager import Manager
class Playlist():
def __init__(self, proxies, headers, url=None):
requests.packages.urllib3.disable_warnings(I... |
Lesson02/cyclic_rotation.py | nawang87/codility_lessons | 114 | 11148076 | """
Task:CyclicRotation
An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7] (elements are shifted right by one i... |
tests/kafkatest/tests/streams/streams_broker_down_resilience_test.py | mitchell-h/kafka | 126 | 11148085 | <filename>tests/kafkatest/tests/streams/streams_broker_down_resilience_test.py
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file t... |
third_party/chromite/cros_bisect/manual_evaluator_unittest.py | zipated/src | 2,151 | 11148096 | <reponame>zipated/src<gh_stars>1000+
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Test manual_evaluator module."""
from __future__ import print_function
import os
from c... |
dynamic_rcnn/utils/pyt_utils.py | yyzq1/bigwork | 177 | 11148098 | <reponame>yyzq1/bigwork
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import errno
import os
import cv2
def mkdir(path):
try:
os.makedirs(path)
except OSError as e:
if e.errno != errno.EEXIST:
raise
def link_file(src, target):
"""symbol link the sour... |
lullaby/tools/generate_entity_schema.py | dherbst/lullaby | 1,198 | 11148109 | """Append Lullaby-specific Entity Schema to a client Component Schema."""
from __future__ import absolute_import
import argparse
from shutil import copyfile
def main():
parser = argparse.ArgumentParser(description='Create an entity schema fbs.')
parser.add_argument('--infile', '-i', help='Input component fbs file... |
finetune_src/tagging_eval.py | yangshoujian/CoSPA | 119 | 11148141 | <reponame>yangshoujian/CoSPA
#-*-coding:utf8-*-
import sys, os
import numpy as np
import tensorflow as tf
import modeling
import optimization
import time
os.environ["PYTHONIOENCODING"] = "utf-8"
tf.logging.set_verbosity(tf.logging.ERROR)
def score_f(ans, print_flg=False, only_check=False, out_dir=''):
fout = open... |
utils/date.py | ujlbu4/vas3k.club | 496 | 11148142 | from datetime import datetime
def first_day_of_next_month(dt):
if dt.month == 12:
return datetime(year=dt.year + 1, month=1, day=1, tzinfo=dt.tzinfo)
else:
return datetime(year=dt.year, month=dt.month + 1, day=1, tzinfo=dt.tzinfo)
|
tests/integration/test_tmle.py | ronikobrosly/causal-curve | 212 | 11148147 | """ Integration tests of the tmle.py module """
import pandas as pd
from causal_curve import TMLE_Regressor
def test_full_tmle_flow(continuous_dataset_fixture):
"""
Tests the full flow of the TMLE tool
"""
tmle = TMLE_Regressor(
random_seed=100,
verbose=True,
)
tmle.fit(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.