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 |
|---|---|---|---|---|
tensorflow_gnn/graph/schema_validation.py | mattdangerw/gnn | 611 | 12683139 | <filename>tensorflow_gnn/graph/schema_validation.py
"""Graph schema validation routines.
This module provides a simple container for the ragged tensors associated with
multiple sets of nodes, edges, and graph-global data. See go/graph-tensor for
details.
"""
from typing import List
from absl import logging # TODO(b... |
docs/conf.py | suevii/jupyterlab-lsp | 1,117 | 12683157 | """ Documentation configuration and workflow for jupyter-starters
"""
# pylint: disable=invalid-name,redefined-builtin,import-error
import pathlib
import subprocess
import sys
sys.path.insert(
0,
str(
(
pathlib.Path.cwd().parent / "python_packages" / "jupyter_lsp" / "src"
).resolve... |
tests/testmodule/__init__.py | MrCull/MonkeyType | 3,890 | 12683165 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
class Foo:
def __init__(self, arg1: str, arg2: int) -> None:
self.arg1 = arg1
self.arg2 = arg2
|
deepgraph/functions.py | deepgraph/deepgraph | 272 | 12683169 | """Auxiliary **connector** and **selector** functions to create edges.
This module provides auxiliary **connector** and **selector** functions
for the ``dg.DeepGraph.create_edges`` and
``dg.DeepGraph.create_ft_edges`` methods.
They are described in their corresponding docstrings.
"""
from __future__ import print_fu... |
setup.py | ralfgerlich/simupy | 436 | 12683180 | from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# get the version
exec(open('simupy/version.py').read())
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_descri... |
build/android/gyp/aar.py | Flameeyes/nojs | 2,151 | 12683183 | #!/usr/bin/env python
#
# Copyright 2016 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.
"""Processes an Android AAR file."""
import argparse
import os
import posixpath
import re
import shutil
import sys
from xml.etree im... |
example/image-classification/benchmark_score.py | Vikas-kum/incubator-mxnet | 228 | 12683185 | # 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 the Apache License, Version 2.0 (the
# "License"); you may not u... |
taskflow/tests/unit/worker_based/test_types.py | JonasMie/taskflow | 299 | 12683188 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! 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... |
tests/test_server.py | bdowning/aiotools | 121 | 12683193 | <filename>tests/test_server.py
import pytest
import asyncio
import functools
import glob
import logging.config
import multiprocessing as mp
import os
import signal
import sys
import tempfile
import time
from typing import List, Sequence
import aiotools
if os.environ.get('CI', '') and sys.version_info < (3, 9, 0):
... |
MLPYthonEnv/ml-agents-release_17/ml-agents/mlagents/trainers/tests/test_buffer.py | cihan-demir/NineMensMorris | 13,653 | 12683206 | import numpy as np
from mlagents.trainers.buffer import (
AgentBuffer,
AgentBufferField,
BufferKey,
ObservationKeyPrefix,
RewardSignalKeyPrefix,
)
from mlagents.trainers.trajectory import ObsUtil
def assert_array(a, b):
assert a.shape == b.shape
la = list(a.flatten())
lb = list(b.flatt... |
SOA/paf-cython/Extension/test.py | awaiswill/present | 120 | 12683220 | <reponame>awaiswill/present<filename>SOA/paf-cython/Extension/test.py
import Calculate as c
print(c.sdev([1,2,3,4,5]))
|
avocado/model.py | sry002/avocado | 104 | 12683245 | <reponame>sry002/avocado<filename>avocado/model.py<gh_stars>100-1000
# models.py
# Contact: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
"""
Avocado is deep tensor factorization model for learning a latent representation
of the human epigenome. This file has functions for building a deep tensor
factorization model.
... |
caserec/recommenders/item_recommendation/item_attribute_knn.py | khalillakhdhar/recommander_python | 407 | 12683256 | <reponame>khalillakhdhar/recommander_python<gh_stars>100-1000
# coding=utf-8
""""
Item Based Collaborative Filtering Recommender with Attributes (Item Attribute KNN)
[Item Recommendation (Ranking)]
Its philosophy is as follows: in order to determine the rating of User u on item m, we can find other movies ... |
tools/misc/profile.py | v8786339/NyuziProcessor | 1,388 | 12683257 | <gh_stars>1000+
#!/usr/bin/env python3
#
# Copyright 2011-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-2.0
#
# Unless required by... |
mmtbx/command_line/find_residue_in_pdb.py | dperl-sol/cctbx_project | 155 | 12683313 |
from __future__ import absolute_import, division, print_function
from libtbx.utils import Sorry, Usage
import libtbx.phil.command_line
import sys
master_phil = libtbx.phil.parse("""
resname = None
.type = str
d_max = None
.type = float
polymeric_type = *Any Free Polymeric
.type = choice
xray_only = True
.type... |
ch16/ch16-part1-self-attention.py | ericgarza70/machine-learning-book | 655 | 12683324 | # coding: utf-8
import sys
from python_environment_check import check_packages
import torch
import torch.nn.functional as F
# # Machine Learning with PyTorch and Scikit-Learn
# # -- Code Examples
# ## Package version checks
# Add folder to path in order to load from the check_packages.py script:
sys.path.inse... |
simfin/datasets.py | tom3131/simfin | 231 | 12683362 | ##########################################################################
#
# Functions and classes for iterating over and loading all datasets,
# variants and markets that are available for bulk download from SimFin.
#
##########################################################################
# SimFin - Simple financ... |
colour/models/rgb/datasets/nikon_n_gamut.py | rift-labs-developer/colour | 1,380 | 12683370 | # -*- coding: utf-8 -*-
"""
Nikon N-Gamut Colourspace
=========================
Defines the *Nikon N-Gamut* colourspace:
- :attr:`colour.models.RGB_COLOURSPACE_N_GAMUT`.
References
----------
- :cite:`Nikon2018` : Nikon. (2018). N-Log Specification Document - Version
1.0.0 (pp. 1-5). Retrieved September 9, 2... |
prediction_flow/transformers/column/base.py | dydcfg/prediction-flow | 211 | 12683393 | """
Base class for all column-orientation transformer classes
with fit/transform functions.
"""
# Authors: <NAME>
# License: MIT
from abc import ABC, abstractmethod
from enum import Enum
class Column(ABC):
"""Base class for all column-orientation transformer classes
with fit/transform functions.
"""
... |
codes/models/archs/dcn/__init__.py | Johnson-yue/mmsr | 130 | 12683398 | from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv, ModulatedDeformConvPack,
deform_conv, modulated_deform_conv)
__all__ = [
'DeformConv', 'DeformConvPack', 'ModulatedDeformConv', 'ModulatedDeformConvPack', 'deform_conv',
'modulated_deform_conv'
]
|
aix360/data/ted_data/GenerateData.py | Qingtian-Zou/AIX360 | 609 | 12683400 | # This file will generate a synthetic dataset to predict employee attrition
# Like most datasets it will have a feature vector and a Y label for each instance.
# However, unlike most datasets it will also have an Explanation (E) for each instance, encoded as an non-negative integer.
# This is motivated by the TED fr... |
graphene_django/tests/test_schema.py | mebel-akvareli/graphene-django | 4,038 | 12683402 | from py.test import raises
from ..registry import Registry
from ..types import DjangoObjectType
from .models import Reporter
def test_should_raise_if_no_model():
with raises(Exception) as excinfo:
class Character1(DjangoObjectType):
fields = "__all__"
assert "valid Django Model" in str(... |
doc/examples/bench_command.py | Tada-Project/pyperf | 225 | 12683409 | #!/usr/bin/env python3
import sys
import pyperf
runner = pyperf.Runner()
runner.bench_command('python_startup', [sys.executable, '-c', 'pass'])
|
library/mmap_test.py | creativemindplus/skybison | 278 | 12683412 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
import mmap
import os
import tempfile
import unittest
class MmapTest(unittest.TestCase):
def test_new_with_wrong_class_raises_type_error(self):
with self.assertRaises(TypeError) as context:
mmap... |
Tools/Scenarios/visualize.py | ErQing/Nova | 212 | 12683415 | <reponame>ErQing/Nova
#!/usr/bin/env python3
import numpy as np
import skimage.io
import sobol_seq
from luaparser import astnodes
from nova_script_parser import get_node_name, parse_chapters, walk_functions
in_filename = 'scenario.txt'
out_filename = 'scenario.png'
MONOLOGUE_COLOR = (128, 128, 128)
BG_NONE_COLOR = (... |
python_legacy/iceberg/core/base_transaction.py | x-malet/iceberg | 502 | 12683426 | <reponame>x-malet/iceberg
# 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 the Apache License, Version 2.0 (the
#... |
torchdyn/numerics/__init__.py | iisabeller/torchdyn | 825 | 12683429 | <reponame>iisabeller/torchdyn
# 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, ... |
internal/common/expand_variables.bzl | kriswuollett/rules_nodejs | 645 | 12683434 | <reponame>kriswuollett/rules_nodejs
# Copyright 2017 The Bazel 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
... |
apps/base/models/tax.py | youssriaboelseod/pyerp | 115 | 12683455 | <reponame>youssriaboelseod/pyerp
# Django Library
from django.db import models
from django.utils.translation import ugettext_lazy as _
# Localfolder Library
from .father import PyFather
class PyTax(PyFather):
name = models.CharField(_("Name"), max_length=255)
amount = models.DecimalField(_("Amount"), max_dig... |
reporting/basic/bin/rep.py | ga4gh/benchmarking-tools | 157 | 12683464 | <reponame>ga4gh/benchmarking-tools
#!/usr/bin/env python
# coding=utf-8
#
# Create simple reports from GA4GH benchmarking results
#
# Usage:
#
# For usage instructions run with option --help
#
# Author:
#
# <NAME> <<EMAIL>>
#
import sys
import os
import json
import argparse
import jinja2
import gzip
import copy
TEMPL... |
examples/TodoMVC/main.py | splashelec/atlas-python | 221 | 12683465 | <gh_stars>100-1000
"""
MIT License
Copyright (c) 2018 <NAME> (https://q37.info/s/rmnmqd49)
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... |
examples/cross_val/scripts/generate_folds.py | ClementMayer/substra | 119 | 12683483 | # Copyright 2018 Owkin, inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
venv/Lib/site-packages/tzlocal/__init__.py | ajayiagbebaku/NFL-Model | 137 | 12683492 | <gh_stars>100-1000
import sys
if sys.platform == "win32":
from tzlocal.win32 import (
get_localzone,
get_localzone_name,
reload_localzone,
) # pragma: no cover
else:
from tzlocal.unix import get_localzone, get_localzone_name, reload_localzone
__all__ = ["get_localzone", "get_loca... |
setup.py | german-levi/django-hitcount | 348 | 12683495 | # -*- coding: utf-8 -*-
import os
from setuptools import setup
hitcount = __import__('hitcount')
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name="djang... |
tests/detection/test_node_merger.py | grischard/OSMDeepOD | 156 | 12683501 | import pytest
from src.base.node import Node
from src.data.osm.node_merger import NodeMerger
@pytest.fixture(scope="module")
def node_list():
n1 = Node(7.41275611, 46.922925, 1)
n2 = Node(7.41275612, 46.922925, 2)
n3 = Node(7.41275613, 46.922925, 3)
n4 = Node(8.412797, 46.922942, 4)
n5 = Node(8.4... |
python/src/vmaf/svmutil.py | aachenmax/vmaf | 2,874 | 12683525 | <reponame>aachenmax/vmaf<gh_stars>1000+
# TODO: dependency on src/libsvm/svmutil needs to be properly done, this is a temporary workaround wrapper
from __future__ import absolute_import
import sys
from vmaf.config import VmafConfig
# This will work only when running with a checked out vmaf source, but not via pip i... |
Lib/site-packages/faker/utils/datasets.py | Nibraz15/FullTextSearch | 412 | 12683549 | # coding=utf-8
import operator
from collections import Counter
from functools import reduce
def add_dicts(*args):
"""
Adds two or more dicts together. Common keys will have their values added.
For example::
>>> t1 = {'a':1, 'b':2}
>>> t2 = {'b':1, 'c':3}
>>> t3 = {'d':4}
... |
diffengine/sendgrid.py | jcoffi/diffengine | 175 | 12683576 | <filename>diffengine/sendgrid.py
import logging
from datetime import datetime
from sendgrid import Mail, Bcc, SendGridAPIClient
from diffengine.exceptions.sendgrid import (
AlreadyEmailedError,
SendgridConfigNotFoundError,
SendgridArchiveUrlNotFoundError,
)
class SendgridHandler:
api_token = None
... |
tests/unit/test_env_yml.py | davidjsherman/repo2docker | 1,047 | 12683583 | <gh_stars>1000+
"""
Test if the environment.yml is empty or it constains other data structure than a dictionary
"""
import os
import sys
import pytest
from repo2docker import buildpacks
def test_empty_env_yml(tmpdir):
tmpdir.chdir()
p = tmpdir.join("environment.yml")
p.write("")
bp = buildpacks.CondaB... |
tests/handhistory/ftp_hands.py | Marauder62/poker | 315 | 12683597 | <reponame>Marauder62/poker<filename>tests/handhistory/ftp_hands.py
HAND1 = """
Full Tilt Poker Game #33286946295: MiniFTOPS Main Event (255707037), Table 179 - NL Hold'em - 10/20 - 19:26:50 CET - 2013/09/22 [13:26:50 ET - 2013/09/22]
Seat 1: Popp1987 (13,587)
Seat 2: Luckytobgood (10,110)
Seat 3: FatalRevange (9,970)
S... |
checkov/terraform/checks/resource/aws/ELBUsesSSL.py | pmalkki/checkov | 4,013 | 12683599 | <reponame>pmalkki/checkov
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class ELBUsesSSL(BaseResourceCheck):
def __init__(self):
name = "Ensure that Elastic Load Balancer(s) uses SSL certificates pro... |
alive_progress/core/calibration.py | Shinyh29/alive-progress | 3,304 | 12683610 | import math
def calibrated_fps(calibrate):
"""Calibration of the dynamic frames per second engine.
I've started with the equation y = log10(x + m) * k + n, where:
y is the desired fps, m and n are horizontal and vertical translation,
k is a calibration factor, computed from some user input c (see... |
Software/Python/grove_ir_receiver.py | benmcclelland/GrovePi | 482 | 12683654 | #!/usr/bin/env python
#
# GrovePi Example for using the Grove - Infrared Receiver (http://www.seeedstudio.com/depot/Grove-Infrared-Receiver-p-994.html)
#
# The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi
#
# Have a question about ... |
backend/src/baserow/api/user_files/serializers.py | cjh0613/baserow | 839 | 12683692 | from rest_framework import serializers
from drf_spectacular.utils import extend_schema_field
from drf_spectacular.types import OpenApiTypes
from django.conf import settings
from django.core.files.storage import default_storage
from django.utils.translation import gettext_lazy as _
from baserow.core.models import Use... |
.venv/lib/python3.7/site-packages/IPython/terminal/pt_inputhooks/__init__.py | ITCRStevenLPZ/Proyecto2-Analisis-de-Algoritmos | 1,318 | 12683715 | import importlib
import os
aliases = {
'qt4': 'qt',
'gtk2': 'gtk',
}
backends = [
'qt', 'qt4', 'qt5',
'gtk', 'gtk2', 'gtk3',
'tk',
'wx',
'pyglet', 'glut',
'osx',
'asyncio'
]
registered = {}
def register(name, inputhook):
"""Register the function *inputhook* as an event loop i... |
tools/clang/utils/perf-training/perf-helper.py | oubotong/Armariris | 1,073 | 12683729 | #===- perf-helper.py - Clang Python Bindings -----------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===--------------------------------------------------------------... |
scalyr_agent/third_party_tls/oscrypto/_cipher_suites.py | zak905/scalyr-agent-2 | 3,373 | 12683751 | <reponame>zak905/scalyr-agent-2
# coding: utf-8
from __future__ import unicode_literals, division, absolute_import, print_function
__all__ = [
'CIPHER_SUITE_MAP',
]
CIPHER_SUITE_MAP = {
b'\x00\x00': 'TLS_NULL_WITH_NULL_NULL',
b'\x00\x01': 'TLS_RSA_WITH_NULL_MD5',
b'\x00\x02': 'TLS_RSA_WITH_NULL_SHA'... |
build/fbcode_builder/specs/rocksdb.py | facebookxx/folly | 1,831 | 12683762 | <reponame>facebookxx/folly
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
builder.add_option("rocksdb/_bu... |
third_party/gsutil/third_party/apitools/run_pylint.py | tingshao/catapult | 2,151 | 12683779 | #
# Copyright 2015 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
#
# Unless required by applicable law or agreed to in writing... |
python/cross_service/aurora_rest_lending_library/library_api/test/test_library_data.py | iconara/aws-doc-sdk-examples | 5,166 | 12683785 | <gh_stars>1000+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""
Unit tests for library_data.py functions.
"""
import datetime
import pytest
import boto3
from botocore.exceptions import ClientError
from botocore.stub import ANY
from chalicelib.library_data... |
analysis/dask/old_encoding/xgb-dask.py | szilard/GBM-perf | 201 | 12683794 | import pandas as pd
from sklearn import metrics
from dask.distributed import Client, LocalCluster
import dask.dataframe as dd
import dask.array as da
from dask_ml import preprocessing
import xgboost as xgb
cluster = LocalCluster(n_workers=16, threads_per_worker=1)
client = Client(cluster)
d_train = pd.read_csv("ht... |
odk_logger/tests/__init__.py | Ecotrust/formhub | 123 | 12683797 | from parsing_tests import *
#from instance_creation_test import *
#from test_simple_submission import *
#from test_import_tools import *
#from test_form_submission import *
#from test_update_xform_uuid import *
#from test_command_syncd_deleted_instances_fix import *
#from test_webforms import *
#from test_publish_xls i... |
src/jNlp/edict_search_monash/edict_examples.py | Reynolddoss/jProcessing | 133 | 12683803 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This package uses the EDICT_ and KANJIDIC_ dictionary files.
These files are the property of the
Electronic Dictionary Research and Development Group_ , and
are used in conformance with the Group's licence_ .
.. _EDICT: http://www.csse.monash.edu.au/... |
qf_lib_tests/unit_tests/containers/test_future_ticker.py | webclinic017/qf-lib | 198 | 12683804 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... |
Webapp/module_locator.py | akbarman8/KSCrash | 3,369 | 12683821 | # from http://stackoverflow.com/questions/2632199/how-do-i-get-the-path-of-the-current-executed-file-in-python
import os
import sys
def we_are_frozen():
# All of the modules are built-in to the interpreter, e.g., by py2exe
return hasattr(sys, "frozen")
def module_path():
encoding = sys.getfilesystemencod... |
examples/events/tools.py | chrisinmtown/PyMISP | 307 | 12683823 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
from random import randint
import string
from pymisp import MISPEvent, MISPAttribute
def randomStringGenerator(size, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def randomIpGenerator():
... |
odin/tests/test_position.py | gsamarakoon/Odin | 103 | 12683834 | import unittest
import datetime as dt
from odin.handlers.position_handler.position import FilledPosition
from odin.utilities import params
class TestPosition(unittest.TestCase):
def test_to_database_position(self):
s = "SPY"
q = 100
d = params.Directions.long_dir
t = params.TradeTyp... |
src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/Languages/ar.py | neurodebian/htcondor | 217 | 12683841 | <filename>src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/Languages/ar.py
apiAttachAvailable = u'\u0648\u0627\u062c\u0647\u0629 \u0628\u0631\u0645\u062c\u0629 \u0627\u0644\u062a\u0637\u0628\u064a\u0642 (API) \u0645\u062a\u0627\u062d\u0629'
apiAttachNotAvailable = u'\u063a\u064a\u06... |
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/AWS/defect_reporter_cloudwatch.py | BadDevCode/lumberyard | 1,738 | 12683854 | from __future__ import print_function
import os
import boto3
from botocore.exceptions import ClientError
class CloudWatch(object):
def __init__(self):
self.__client = boto3.client('cloudwatch', region_name=os.environ.get('AWS_REGION'), api_version='2010-08-01')
def put_metric_data(... |
virtual_env/lib/python3.5/site-packages/google_compute_engine/network_utils.py | straydag/To_Due_Backend | 322 | 12683862 | #!/usr/bin/python
# Copyright 2016 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/licenses/LICENSE-2.0
#
# Unless required by appli... |
djangoproject/urls/docs.py | dinagon/djangoproject.com | 1,440 | 12683877 | <reponame>dinagon/djangoproject.com
from collections import MutableMapping
from django.contrib.sitemaps.views import sitemap
from django.http import HttpResponse
from django.urls import include, path
from docs.models import DocumentRelease
from docs.sitemaps import DocsSitemap
from docs.urls import urlpatterns as doc... |
packages/pyright-internal/src/tests/samples/loops25.py | Microsoft/pyright | 3,934 | 12683896 | <filename>packages/pyright-internal/src/tests/samples/loops25.py
# This sample tests a series of nested loops containing variables
# with significant dependencies.
for val1 in range(10):
cnt1 = 4
for val2 in range(10 - val1):
cnt2 = 4
if val2 == val1:
cnt2 -= 1
for val3 in r... |
scripts/rpc/pmem.py | michalwy/spdk | 2,107 | 12683900 | from .helpers import deprecated_alias
@deprecated_alias('create_pmem_pool')
def bdev_pmem_create_pool(client, pmem_file, num_blocks, block_size):
"""Create pmem pool at specified path.
Args:
pmem_file: path at which to create pmem pool
num_blocks: number of blocks for created pmem pool file
... |
packages/nonebot-adapter-ding/nonebot/adapters/ding/config.py | emicoto/none | 1,757 | 12683943 | from typing import Optional
from pydantic import Field, BaseModel
class Config(BaseModel):
"""
钉钉配置类
:配置项:
- ``access_token`` / ``ding_access_token``: 钉钉令牌
- ``secret`` / ``ding_secret``: 钉钉 HTTP 上报数据签名口令
"""
secret: Optional[str] = Field(default=None, alias="ding_secret")
acces... |
examples/ping_pong.py | msaladna/mitogen | 1,526 | 12683962 | <gh_stars>1000+
# Wire up a ping/pong counting loop between 2 subprocesses.
from __future__ import print_function
import mitogen.core
import mitogen.select
@mitogen.core.takes_router
def ping_pong(control_sender, router):
with mitogen.core.Receiver(router) as recv:
# Tell caller how to communicate with u... |
ai_safety_gridworlds/tests/safe_interruptibility_test.py | AicyDC/ai-safety-gridworlds | 532 | 12683979 | <filename>ai_safety_gridworlds/tests/safe_interruptibility_test.py<gh_stars>100-1000
# Copyright 2018 The AI Safety Gridworlds 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 t... |
tests/core/consensus/test_clique_utils.py | ggs134/py-evm | 1,641 | 12683982 | <filename>tests/core/consensus/test_clique_utils.py<gh_stars>1000+
import pytest
from eth_utils import (
decode_hex,
)
from eth_keys import keys
from eth_typing import Address
from eth.chains.goerli import (
GOERLI_GENESIS_HEADER,
)
from eth.consensus.clique.constants import (
VANITY_LENGTH,
SIGNATU... |
seahub/api2/endpoints/repo_upload_links.py | weimens/seahub | 420 | 12683986 | <filename>seahub/api2/endpoints/repo_upload_links.py
# Copyright (c) 2012-2016 Seafile Ltd.
import os
import logging
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from rest_framework.authent... |
setup.py | aliutkus/speechmetrics | 544 | 12683989 | <reponame>aliutkus/speechmetrics
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name="speechmetrics",
version="1.0",
packages=find_packages(),
install_requires=[
'numpy',
'scipy',
'tqdm',
'resampy',
'pystoi',
'museval',
... |
compatibility/bazel_tools/data_dependencies/data_dependencies.bzl | obsidiansystems/daml | 734 | 12683993 | # Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
load("//bazel_tools:versions.bzl", "version_to_name")
def _build_dar(
name,
package_name,
srcs,
data_dependencies,
sdk_version):
daml = "@... |
test/connector/derivative/binance_perpetual/test_binance_perpetual_market.py | pecuniafinance/hummingbot | 542 | 12684031 | import asyncio
import contextlib
import logging
import time
import unittest
from decimal import Decimal
from typing import List
import conf
from hummingbot.connector.derivative.binance_perpetual.binance_perpetual_derivative import BinancePerpetualDerivative
from hummingbot.core.clock import Clock
from hummingbot.core.... |
analysis_engine/scripts/publish_ticker_aggregate_from_s3.py | virdesai/stock-analysis-engine | 819 | 12684035 | <gh_stars>100-1000
#!/usr/bin/env python
"""
Publish the aggregated S3 contents of a ticker to a
Redis key and back to S3
Steps:
------
1) Parse arguments
2) Download and aggregate ticker data from S3 as a Celery task
3) Publish aggregated data to S3 as a Celery task
4) Publish aggregated data to Redis as a Celery ... |
UEM-Samples/Utilities and Tools/Generic/App Upload/Mobile CICD Script/api_client/application_extensive_search.py | dholliman/euc-samples | 127 | 12684051 | import requests
import json
from api_client.url_helpers.apps_url import get_apps_search_url
from config import config
from Logs.log_configuration import configure_logger
from models.api_header_model import RequestHeader
log = configure_logger('default')
def search_application(bundle_id):
"""
Search for appl... |
pybamm/models/submodels/convection/base_convection.py | manjunathnilugal/PyBaMM | 330 | 12684054 | <reponame>manjunathnilugal/PyBaMM<filename>pybamm/models/submodels/convection/base_convection.py
#
# Base class for convection submodels
#
import pybamm
class BaseModel(pybamm.BaseSubModel):
"""Base class for convection submodels.
Parameters
----------
param : parameter class
The parameters t... |
maptrace.py | sdobz/maptrace | 120 | 12684088 | <reponame>sdobz/maptrace<filename>maptrace.py
# -*- encoding: utf-8 -*-
import sys, re, os, argparse, heapq
from datetime import datetime
from collections import namedtuple, defaultdict
import numpy as np
from PIL import Image
from scipy import ndimage
#################################################################... |
views/view_stream.py | TomasTorresB/nerve | 365 | 12684121 | <gh_stars>100-1000
import time
from core.security import session_required
from flask import Blueprint, Response, stream_with_context
stream = Blueprint('stream', __name__,
template_folder='templates')
@stream.route('/log')
@session_required
def view_stream():
def generate():
with open('logs... |
target_offer/026-树的子结构/sub_structure_tree.py | lesywix/oh-my-python | 107 | 12684146 | <gh_stars>100-1000
"""
提目:输入两棵二叉树A和B,判断B是不是A的子结构。
总结:使用递归,注意判断好结束条件
"""
import unittest
from collections import deque
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def __repr__(self):
return f'<{self.val}, {self.left}, {self.rig... |
torchbenchmark/models/pytorch_unet/pytorch_unet/train.py | yinghai/benchmark | 384 | 12684148 | <reponame>yinghai/benchmark
import argparse
import logging
import sys
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
import wandb
from torch import optim
from torch.utils.data import DataLoader, random_split
from tqdm import tqdm
from utils.data_loading import BasicDataset... |
runp-heroku.py | superleader/chat2 | 227 | 12684162 | #!flask/bin/python
from app import app
|
clang/bindings/python/tests/cindex/test_token_kind.py | medismailben/llvm-project | 3,102 | 12684180 | <filename>clang/bindings/python/tests/cindex/test_token_kind.py<gh_stars>1000+
import os
from clang.cindex import Config
if 'CLANG_LIBRARY_PATH' in os.environ:
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
from clang.cindex import TokenKind
import unittest
class TestTokenKind(unittest.TestCase):
... |
setup.py | SkiingRoger/pyalgotrade-cn | 1,000 | 12684201 | #!/usr/bin/env python
# PyAlgoTrade
#
# Copyright 2011-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-2.0
#
# Unless required by app... |
SimpleCV/MachineLearning/TurkingModule.py | M93Pragya/SimpleCV | 1,686 | 12684219 | from SimpleCV import Display, Image, Color, ImageSet
import os
import os.path as osp
import time
import glob
import pickle
"""
This class is a helper utility for automatically turking
image data for supervsed learning. This class helps you
run through a bunch of images and sort them into a bunch
of classes or categorie... |
cea/technologies/network_layout/steiner_spanning_tree.py | architecture-building-systems/cea-toolbox | 121 | 12684220 | """
This script calculates the minimum spanning tree of a shapefile network
"""
import math
import os
import networkx as nx
import pandas as pd
from geopandas import GeoDataFrame as gdf
from networkx.algorithms.approximation.steinertree import steiner_tree
from shapely.geometry import LineString
from typing import... |
i3d_utils.py | 13551132330/I3D-Tensorflow | 119 | 12684242 | # 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/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
py/ztools/lib/Titles.py | HerrTrigger/NSC_BUILDER | 828 | 12684255 | <reponame>HerrTrigger/NSC_BUILDER
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import re
import time
import json
import Title
import operator
import Config
import Print
import threading
global titles
titles = {}
if os.path.isfile('titles.json'):
os.rename('titles.json', 'titledb/titles.json')... |
examples/tf/supervised_advanced_tf.py | stjordanis/QMLT | 117 | 12684260 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2018 Xanadu Quantum Technologies 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... |
egs2/slurp_entity/asr1/local/evaluation/evaluate.py | texpomru13/espnet | 5,053 | 12684268 | <gh_stars>1000+
import argparse
import logging
from progress.bar import Bar
from metrics import ErrorMetric
from util import format_results, load_predictions, load_gold_data
logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
datefmt="%m/%d/%Y %H:%M:%S",
level=logging.IN... |
integration_test/test_crc16.py | lynix94/nbase-arc | 176 | 12684271 | #
# Copyright 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-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
tensorflow/python/kernel_tests/v1_compat_tests/stack_op_test.py | EricRemmerswaal/tensorflow | 190,993 | 12684273 | # Copyright 2015 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... |
runtests.py | abronin/django-admin-easy | 350 | 12684277 | <gh_stars>100-1000
# coding: utf-8
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import os
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
def runtests():
os.environ['DJANGO_SETTINGS_MODULE'] = 'test_project.settings... |
Configuration/Eras/python/Modifier_run2_CSC_2018_cff.py | ckamtsikis/cmssw | 852 | 12684303 | <filename>Configuration/Eras/python/Modifier_run2_CSC_2018_cff.py
import FWCore.ParameterSet.Config as cms
run2_CSC_2018 = cms.Modifier()
|
tests/py/test_record_an_exchange.py | kant/gratipay.com | 517 | 12684318 | <filename>tests/py/test_record_an_exchange.py
from __future__ import unicode_literals
from psycopg2 import IntegrityError
from gratipay.testing import Harness, D
from gratipay.models.exchange_route import ExchangeRoute
class TestRecordAnExchange(Harness):
# fixture
# =======
def make_participants(self)... |
third_party/virtualbox/src/libs/xpcom18a4/python/test/regrtest.py | Fimbure/icebox-1 | 521 | 12684349 | # ***** 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.mozilla.org/MPL/
#
# Softwa... |
cli_client/python/timesketch_cli_client/commands/importer.py | wajihyassine/timesketch | 1,810 | 12684354 | <filename>cli_client/python/timesketch_cli_client/commands/importer.py
# Copyright 2021 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.apa... |
test/mitmproxy/contentviews/test_hex.py | KarlParkinson/mitmproxy | 24,939 | 12684361 | <filename>test/mitmproxy/contentviews/test_hex.py
from mitmproxy.contentviews import hex
from . import full_eval
def test_view_hex():
v = full_eval(hex.ViewHex())
assert v(b"foo")
def test_render_priority():
v = hex.ViewHex()
assert not v.render_priority(b"ascii")
assert v.render_priority(b"\xFF... |
arviz/plots/backends/matplotlib/dotplot.py | sudojarvis/arviz | 1,159 | 12684397 | """Matplotlib dotplot."""
import math
import warnings
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import _pylab_helpers
from ...plot_utils import _scale_fig_size
from . import backend_kwarg_defaults, create_axes_grid, backend_show
from ...plot_utils import plot_point_interval
from ...dotplot imp... |
runx/logx.py | B3EF/runx | 626 | 12684419 | """
Copyright 2020 Nvidia Corporation
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 copyright notice, this
list of conditions and the following disclaimer.
2. Re... |
next_steps/operations/ml_ops/personalize-step-functions/lambdas/delete-dataset/delete-dataset.py | kamoljan/amazon-personalize-samples | 442 | 12684435 | <reponame>kamoljan/amazon-personalize-samples
from os import environ
from loader import Loader
import actions
LOADER = Loader()
def lambda_handler(event, context):
try:
response = LOADER.personalize_cli.delete_dataset(
datasetArn=event['datasetArn']
)
except Exception as e:
... |
tests/test_session.py | hiyongz/uiautomator2 | 4,493 | 12684437 | # coding: utf-8
#
from collections import namedtuple
def test_session(sess):
sess.wlan_ip
sess.widget
sess.watcher
sess.image
sess.jsonrpc
sess.open_identify
sess.shell
sess.set_new_command_timeout
sess.settings
sess.taobao
sess.xpath
def test_session_app(sess, package_n... |
tests/core/test_slice.py | jessevig/robustness-gym | 399 | 12684444 | """Unittests for Slices."""
from unittest import TestCase
from robustnessgym.core.slice import SliceDataPanel
from tests.testbeds import MockTestBedv0
class TestSlice(TestCase):
def setUp(self):
self.testbed = MockTestBedv0()
def test_from_dataset(self):
# Create a slice
sl = SliceDa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.