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 |
|---|---|---|---|---|
portia_server/portia_dashboard/urls.py | rmdes/portia-dashboard | 223 | 11004705 | from django.conf.urls import url, include
from . import views
#from portia_api import urls
from . import feeds
from django.conf.urls.static import static
urlpatterns = [
url(r'job/list$', views.job_list),
url(r'job/log', views.job_log),
url(r'job/cancel', views.job_cancel),
url(r'job/delete', views.jo... |
test/torchaudio_unittest/backend/common.py | popcornell/audio | 1,718 | 11004708 | <filename>test/torchaudio_unittest/backend/common.py
from torchaudio_unittest.common_utils import sox_utils
def get_encoding(ext, dtype):
exts = {
"mp3",
"flac",
"vorbis",
}
encodings = {
"float32": "PCM_F",
"int32": "PCM_S",
"int16": "PCM_S",
"uint8... |
mars/oscar/backends/mars/backend.py | hxri/mars | 2,413 | 11004710 | <reponame>hxri/mars<filename>mars/oscar/backends/mars/backend.py
# Copyright 1999-2021 Alibaba Group Holding 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.or... |
tests/python/relay/test_pass_eta_expand.py | robo-corg/incubator-tvm | 286 | 11004736 | # 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... |
ormar/queryset/reverse_alias_resolver.py | naterenegar/ormar | 905 | 11004737 | <gh_stars>100-1000
from typing import Dict, List, TYPE_CHECKING, Type, cast
if TYPE_CHECKING: # pragma: no cover
from ormar import ForeignKeyField, Model
from ormar.models.excludable import Excludable, ExcludableItems
class ReverseAliasResolver:
"""
Class is used to reverse resolve table aliases int... |
example/rnn/old/gru_bucketing.py | Vikas-kum/incubator-mxnet | 228 | 11004751 | <reponame>Vikas-kum/incubator-mxnet
# 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 ... |
test/python/test_main.py | faizol/babelfish_extensions | 115 | 11004760 | import logging
from file_handler import file_handler
import pytest
from utils.base import add_files, ignored_files
from utils.config import config_dict as cfg
import os
from datetime import datetime
from pathlib import Path
def get_files():
lst = add_files()
for item in lst:
yield item
@pytest.fixture... |
Scripts/Miscellaneous/HTML_to_Markdown/main.py | ShivangiPatel102/Python_and_the_Web | 437 | 11004770 | <gh_stars>100-1000
# Importing required libraries/modules
import os
import html2text
# Empty string to add html source to it
html = ""
# Reading index.html file line by line
for line in open("index.html").readlines():
# Adding lines of html file to 'html'
html += line.strip()
# Using 'html2text' function in ... |
coherence/upnp/core/test/test_action.py | stonewell/Coherence | 112 | 11004781 | # -*- coding: utf-8 -*-
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2014, <NAME> <<EMAIL>>
"""
Test cases for L{upnp.core.action}
"""
import time
from twisted.trial import unittest
from twisted.internet import protocol
from twisted.internet.defer import Deferred, D... |
compilebot/tests/unit/reply.py | renfredxh/compilebot | 152 | 11004784 | <reponame>renfredxh/compilebot
from __future__ import unicode_literals, print_function
import unittest
import compilebot as cb
import socket
import errno
from sys import modules
from mock import Mock, patch
from tests import helpers
"""
Unit test cases for functions, methods, and classes that format, create,
and edit ... |
s3prl/upstream/byol_a/hubconf.py | hhhaaahhhaa/s3prl | 856 | 11004793 | <gh_stars>100-1000
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ upstream/byol_a/hubconf.py ]
# Synopsis [ the BYOL-A torch hubconf ]
# Author [ S3PRL ]
# Copyright [ Copyleft(c), Speech Lab, NTU, Taiwa... |
task4/dataset/check_data.py | sukh1222/cts_2018_baseline | 132 | 11004813 | <reponame>sukh1222/cts_2018_baseline
# -*- coding: utf-8 -*-
#########################################################################
# Initial software
# Copyright <NAME>, <NAME>, <NAME>, <NAME>, 2018, v1.0
# This software is distributed under the terms of the License MIT
#############################################... |
venv/lib/python3.9/site-packages/google/auth/transport/urllib3.py | qarik-hanrattyjen/apache-airflow-backport-providers-google-2021.3.3 | 348 | 11004816 | <gh_stars>100-1000
# Copyright 2016 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
src/causallift/context/base_context.py | Minyus/causallift | 265 | 11004834 | # Copyright 2018-2019 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS"... |
language/xsp/model/loss.py | naveenjafer/language | 1,199 | 11004845 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
hackerrank/womenscup/possible-maximum.py | Ashindustry007/competitive-programming | 506 | 11004849 | #!/usr/bin/env python2
# https://www.hackerrank.com/contests/womenscup/challenges/possible-maximum
for _ in range(input()):
n, k = map(int, raw_input().split())
m = 0
for i in xrange(1, n + 1):
for j in xrange(i + 1, n + 1):
if i & j < k:
m = max(m, i & j)
print m
|
tests/utils/test_scout_requests.py | Clinical-Genomics/scout | 111 | 11004871 | <reponame>Clinical-Genomics/scout
"""Tests for scout requests"""
import tempfile
import zlib
from urllib.error import HTTPError
import pytest
import requests
import responses
from scout.utils import scout_requests
def test_get_request_json_error():
"""Test the function that sends a GET request that returns an e... |
Codes/Python32/Lib/unittest/test/support.py | eyantra/FireBird_Swiss_Knife | 652 | 11004876 | import unittest
class TestEquality(object):
"""Used as a mixin for TestCase"""
# Check for a valid __eq__ implementation
def test_eq(self):
for obj_1, obj_2 in self.eq_pairs:
self.assertEqual(obj_1, obj_2)
self.assertEqual(obj_2, obj_1)
# Check for a valid __ne__ impl... |
sdk/tests/deqp/functional/gles3/uniformbuffers/uniformbuffers_test_generator.py | dyna-dot/WebGL | 2,103 | 11004916 | #!/usr/bin/env python
# Copyright (c) 2019 The Khronos Group Inc.
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE.txt file.
"""
Generator for uniformbuffers* tests.
This file needs to be run in its folder.
"""
import sys
_DO_NOT_EDIT_WARNING = """<!--
This file ... |
acme/tests/jose_test.py | vivithemage/certbot | 16,789 | 11004943 | <filename>acme/tests/jose_test.py<gh_stars>1000+
"""Tests for acme.jose shim."""
import importlib
import unittest
class JoseTest(unittest.TestCase):
"""Tests for acme.jose shim."""
def _test_it(self, submodule, attribute):
if submodule:
acme_jose_path = 'acme.jose.' + submodule
... |
ludwig/datasets/mushroom_edibility/__init__.py | dantreiman/ludwig | 7,739 | 11004967 | #! /usr/bin/env python
# Copyright (c) 2021 Uber 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.0
#
# Unless required by a... |
job-server-python/src/python/example_jobs/session_window/__init__.py | rayabhisek22/spark-jobserver | 2,957 | 11004973 | from sparkjobserver.api import SparkJob, build_problems
from pyspark.sql import SparkSession
class SessionWindowJob(SparkJob):
def validate(self, context, runtime, config):
problems = []
job_data = None
if not isinstance(context, SparkSession):
problems.append('Expected a Spar... |
src/encoded/commands/alembic.py | procha2/encoded | 102 | 11004980 | import sys
import alembic.config
def main():
'''
Simple wrapper for alembic CLI.
Example usage:
1. alembic revision --autogenerate -m 'Migration message here'
2. alembic upgrade head
'''
alembic.config.main(sys.argv[1:])
if __name__ == '__main__':
main()
|
tests/st_profile.py | zul126/minemeld-core | 147 | 11005002 | #!/usr/bin/env python
# Copyright 2015 Palo Alto Networks, 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... |
model/edsr.py | Gummary/denet | 343 | 11005010 | """
CutBlur
Copyright 2020-present NAVER corp.
MIT license
Referenced from EDSR-PyTorch, https://github.com/thstkdgus35/EDSR-PyTorch
"""
import torch.nn as nn
from model import ops
class Net(nn.Module):
def __init__(self, opt):
super().__init__()
self.sub_mean = ops.MeanShift(255)
self.add... |
cakechat/dialog_model/inference/service_tokens.py | sketscripter/emotional-chatbot-cakechat | 1,608 | 11005020 | <reponame>sketscripter/emotional-chatbot-cakechat
from cakechat.config import NON_PENALIZABLE_TOKENS
from cakechat.utils.offense_detector.config import OFFENSIVE_PHRASES_PATH
from cakechat.utils.offense_detector import OffenseDetector
from cakechat.utils.text_processing import SPECIAL_TOKENS
_offense_detector = Offens... |
mayan/apps/mirroring/tests/literals.py | nattangwiwat/Mayan-EDMS-recitation | 343 | 11005054 | # -*- coding: utf-8 -*-
TEST_CACHE_KEY_BAD_CHARACTERS = ' \r\n!@#$%^&*()+_{}|:"<>?-=[];\',./'
TEST_DOCUMENT_PK = 99
TEST_KEY_UNICODE = 'áéíóúüäåéë¹²³¤'
TEST_KEY_UNICODE_HASH = 'ba418878794230c3f4308e66c70db31dd83f1def4d9381f379c50f42eb88989c'
TEST_NODE_EXPRESSION = 'level_1'
TEST_NODE_EXPRESSION_INVALID = 'level/1'
TE... |
python/tests/unittest/test_udf_app.py | GoldenLeaves/GraphScope | 1,521 | 11005072 | <filename>python/tests/unittest/test_udf_app.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Alibaba Group Holding Limited. 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 ... |
utils/loss.py | AIprogrammer/Detailed-virtual-try-on | 160 | 11005075 | import torch
import torch.nn as nn
from torch.nn import BCEWithLogitsLoss
from torch.nn import CrossEntropyLoss
from torchvision import models
import numpy as np
from .transforms import create_part
# class AttentionLoss(nn.Module):
# def __init__(self):
# super(AttentionLoss, self).__init__()
# def fo... |
reid/evaluation_metrics/__init__.py | ZengYingJun97/IECN | 330 | 11005079 | <filename>reid/evaluation_metrics/__init__.py
from __future__ import absolute_import
from .classification import accuracy
from .ranking import cmc, mean_ap, map_cmc
__all__ = [
'accuracy',
'cmc',
'mean_ap',
'map_cmc',
]
|
jhkaggle/jhkaggle/util.py | DATA602/jh-kaggle-util | 273 | 11005080 | <gh_stars>100-1000
# <NAME>'s Kaggle Utilities
# Copyright 2019 by <NAME>, Open Source, Released under the Apache License
# For more information: https://github.com/jeffheaton/jh-kaggle-util
#
# Utility functions.
#
import jhkaggle.const
import codecs
import math
import csv
import pandas as pd
import numpy as np
impor... |
finmath/termstructure/curve_models.py | gusamarante/Quantequim | 296 | 11005088 | <gh_stars>100-1000
"""
Author: <NAME>
"""
from typing import Union, Collection, Optional, Tuple
import pandas as pd
import numpy as np
from calendars import DayCounts
from calendars.custom_date_types import Date, TODAY
import scipy.optimize as opt
import warnings
ANBIMA_LAMBDAS = np.array([2.2648, 0.3330])
def forw... |
telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py | Martijnve23/catapult | 1,894 | 11005104 | # Copyright 2009 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 law or ... |
tests/unit/objects/test_sourcecontrol.py | myungseokang/aws-elastic-beanstalk-cli | 110 | 11005143 | <reponame>myungseokang/aws-elastic-beanstalk-cli
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.co... |
tests/test_models.py | RobertCraigie/prisma-client-py | 518 | 11005148 | <filename>tests/test_models.py
import pytest
from prisma.models import User
from prisma.errors import UnsupportedSubclassWarning
async def create_user() -> User:
user = await User.prisma().create(
data={
'name': 'Robert',
},
)
assert isinstance(user, User)
return user
@py... |
reward_function.py | soumya195/EMCSProject | 202 | 11005170 | """
This function is intended to wrap the rewards returned by the CityLearn RL environment, and is meant to
be modified at will.
This reward_function takes all the electrical demands of all the buildings and turns them into one or multiple rewards for the agent(s)
The current code of reward_functioin_ma computes a re... |
tensorflow_federated/python/simulation/baselines/stackoverflow/word_prediction_tasks.py | zhihansh/federated-oss | 1,918 | 11005186 | <reponame>zhihansh/federated-oss
# Copyright 2021, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
tests/basic/models.py | emihir0/django-schema-graph | 316 | 11005198 | <reponame>emihir0/django-schema-graph
from django.db import models
class SelfReference(models.Model):
parent = models.ForeignKey("self", on_delete=models.CASCADE)
class Target(models.Model):
pass
class OutgoingManyToMany(models.Model):
connected = models.ManyToManyField(Target)
class OutgoingForeign... |
core/admin/start.py | Diman0/Mailu_Fork | 3,620 | 11005214 | #!/usr/bin/python3
import os
import logging as log
import sys
log.basicConfig(stream=sys.stderr, level=os.environ.get("LOG_LEVEL", "INFO"))
os.system("flask mailu advertise")
os.system("flask db upgrade")
account = os.environ.get("INITIAL_ADMIN_ACCOUNT")
domain = os.environ.get("INITIAL_ADMIN_DOMAIN")
password = <P... |
data-processing/common/types.py | hhchi13/scholarphi | 285 | 11005218 | <reponame>hhchi13/scholarphi
from dataclasses import dataclass
from typing import Callable, Dict, List, NamedTuple, Optional, Set, Union
from typing_extensions import Literal
"""
FILE PROCESSING
"""
ArxivId = str
Path = str
AbsolutePath = str
RelativePath = str
@dataclass(frozen=True)
class FileContents:
path... |
canvasapi/outcome.py | damianfs/canvasapi | 386 | 11005222 | from canvasapi.canvas_object import CanvasObject
from canvasapi.paginated_list import PaginatedList
from canvasapi.util import combine_kwargs, obj_or_id
class Outcome(CanvasObject):
def __str__(self):
return "{} ({})".format(self.title, self.url)
def update(self, **kwargs):
"""
Modify... |
gpxtrackposter/github_drawer.py | jmetzz/GpxTrackPoster | 262 | 11005230 | # Copyright 2020-2021 <NAME> & Contributors. All rights reserved.
#
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import calendar
import datetime
import locale
import svgwrite # type: ignore
from gpxtrackposter import utils
from gpxtrackposter.exceptions impor... |
tests/test_exceptions.py | tdhopper/cruft | 293 | 11005232 | from pathlib import Path
from cruft import exceptions
def test_invalid_cookiecutter_repository():
instance = exceptions.InvalidCookiecutterRepository(".")
assert isinstance(instance, exceptions.CruftError)
assert instance.cookiecutter_repo == "."
def test_unable_to_find_cookiecutter_template():
ins... |
torchtext/data/pipeline.py | cwarny/text | 2,361 | 11005243 | <reponame>cwarny/text<gh_stars>1000+
class Pipeline(object):
"""Defines a pipeline for transforming sequence data.
The input is assumed to be utf-8 encoded `str` (Python 3) or
`unicode` (Python 2).
Attributes:
convert_token: The function to apply to input sequence data.
pipes: The Pipe... |
mayan/apps/ocr/links.py | atitaya1412/Mayan-EDMS | 343 | 11005251 | from django.utils.translation import ugettext_lazy as _
from mayan.apps.navigation.classes import Link
from .icons import (
icon_entry_list, icon_document_type_ocr_settings,
icon_document_type_submit,
icon_document_version_ocr_content_delete_multiple,
icon_document_version_ocr_content_delete_single,
... |
clinica/iotools/abstract_converter.py | MatthieuJoulot/clinica | 135 | 11005259 | import abc
class Converter:
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def convert_images(self, src, dst):
pass
@abc.abstractmethod
def convert_clinical_data(self, src, dst):
pass
|
rnn/chatbot/settings.py | llichengtong/yx4 | 128 | 11005266 | # -*- coding: UTF-8 -*-
from __future__ import absolute_import, division, print_function
VOCAB_DICT_FILE = './data.snippet/vocab100000'
SEQ2SEQ_MODEL_DIR = './data.snippet/'
SEQ2SEQ_SIZE = 1000
|
c7n/resources/__init__.py | jagjeetsm/cloud-custodian | 1,787 | 11005271 | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
#
# AWS resources to manage
#
from c7n.provider import clouds
LOADED = set()
def load_resources(resource_types=('*',)):
pmap = {}
for r in resource_types:
parts = r.split('.', 1)
# support aws.*
if parts[-1... |
docstring_parser/tests/__init__.py | admdev8/docstring_parser | 110 | 11005299 | """Tests for docstring parser."""
|
openfermioncirq/optimization/black_box.py | unpilbaek/OpenFermion-Cirq | 278 | 11005305 | <gh_stars>100-1000
# 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... |
cacreader/swig-4.0.2/Examples/test-suite/python/cpp11_decltype_runme.py | kyletanyag/LL-Smartcard | 1,031 | 11005316 | import cpp11_decltype
a = cpp11_decltype.A()
a.i = 5
if a.i != 5:
raise RuntimeError, "Assignment to a.i failed."
a.j = 10
if a.j != 10:
raise RuntimeError, "Assignment to a.j failed."
b = a.foo(5)
if b != 10:
raise RuntimeError, "foo(5) should return 10."
b = a.foo(6)
if b != 0:
raise RuntimeError,... |
src/video/scalers/hq_gen.py | D15C0DE/openMSX | 320 | 11005325 | <filename>src/video/scalers/hq_gen.py
from functools import reduce
# Edges in the same order as the edge bits in "case".
# 0 | 1 | 2
# ---+---+---
# 3 | 4 | 5
# ---+---+---
# 6 | 7 | 8
edges = (
(1, 5), (5, 7), (3, 7), (1, 3), # first 4 are cross-edges
(0, 4), (1, 4), (2, 4), (3, 4), # followed by 8 star... |
06. Chapter_6/pandas/plot_min_max_slopes.py | Mikma03/High-performance-Python | 223 | 11005327 | <reponame>Mikma03/High-performance-Python<filename>06. Chapter_6/pandas/plot_min_max_slopes.py
import pandas as pd
import numpy as np
import matplotlib.pyplot
from utility import ols_lstsq
#%matplotlib
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
if "df" not in dir():
print("R... |
tests/modular_multiplicative_inverse_test.py | williamsmj/prakhar1989-algorithms | 2,797 | 11005334 | <filename>tests/modular_multiplicative_inverse_test.py
import os, sys
import unittest
sys.path.append(os.path.join(os.getcwd(), os.path.pardir))
from misc import modular_multiplicative_inverse as mmi
class TestLCS(unittest.TestCase):
def test_modular_multiplicative_inverse(self):
self.assertEqual(mmi.modular_... |
modules/Stateless_module.py | androdev4u/XFLTReaT | 315 | 11005335 | # MIT License
# Copyright (c) 2017 <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... |
neupy/layers/reshape.py | FrostByte266/neupy | 801 | 11005344 | import numpy as np
import tensorflow as tf
from neupy.utils import as_tuple
from neupy.exceptions import LayerConnectionError
from neupy.core.properties import TypedListProperty
from .base import BaseLayer
__all__ = ('Reshape', 'Transpose')
class Reshape(BaseLayer):
"""
Layer reshapes input tensor.
Pa... |
arch/arm/tests/arm_dp_imm.py | Samsung/ADBI | 312 | 11005358 | <filename>arch/arm/tests/arm_dp_imm.py
import random
from test import *
from branch import *
INSN = 'and eor sub rsb add adc sbc rsc tst teq cmp cmn orr mov bic mvn'.split()
NORN = 'mov mvn'.split()
NORD = 'cmp cmn tst teq'.split()
def rotate(val, c):
return ((val >> c) | (val << (32 - c))) & 0xffffffff
def t... |
tests/test_scheduler.py | mrozigor/incremental-reading | 162 | 11005364 | <gh_stars>100-1000
from unittest import TestCase
from unittest.mock import MagicMock, patch
class SchedulerTests(TestCase):
def setUp(self):
modules = {
'PyQt5': MagicMock(),
'PyQt5.QtCore': MagicMock(),
'PyQt5.QtWidgets': MagicMock(),
'anki': MagicMock(),
... |
recipes/Python/198078_Wrapping_method_calls_metaclass/recipe-198078.py | tdiprima/code | 2,023 | 11005379 | <gh_stars>1000+
import re
log = open('log','w')
indent = 0
indStr = ' '
def logmethod(methodname):
def _method(self,*argl,**argd):
global indent
#parse the arguments and create a string representation
args = []
for item in argl:
args.append('%s' % str(item))
f... |
datasets/detmot.py | megvii-model/MOTR | 191 | 11005380 | <gh_stars>100-1000
# ------------------------------------------------------------------------
# Copyright (c) 2021 megvii-model. All Rights Reserved.
# ------------------------------------------------------------------------
# Modified from Deformable DETR (https://github.com/fundamentalvision/Deformable-DETR)
# Copyri... |
src/websockets/version.py | BeLuckyDaf/websockets | 3,909 | 11005398 | version = "10.0"
|
PhysicsTools/PatUtils/python/tools/muonRecoMitigation.py | Purva-Chaudhari/cmssw | 852 | 11005407 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from PhysicsTools.PatAlgos.tools.ConfigToolBase import *
from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
def muonRecoMitigation(process,
pfCandCollection,
runOnMiniAOD,
... |
examples/blocks/exploding_with_attribs.py | jkjt/ezdxf | 515 | 11005420 | # Copyright (c) 2020, <NAME>
# License: MIT License
from typing import cast, Tuple
from pathlib import Path
import ezdxf
import random
DIR = Path("~/Desktop/Outbox").expanduser()
def get_random_point() -> Tuple[int, int]:
"""Returns random x, y coordinates."""
x = random.randint(-100, 100)
y = random.ra... |
app.py | danishfastian/cert-issuer | 356 | 11005439 | #!/usr/bin/python3
import json
from flask import Flask, jsonify, request, abort
from subprocess import call
import cert_issuer.config
from cert_issuer.blockchain_handlers import bitcoin
import cert_issuer.issue_certificates
app = Flask(__name__)
config = None
def get_config():
global config
if config == None... |
python/micropython/tests/pyb/spi.py | r-lyeh/scriptorium | 303 | 11005455 | from pyb import SPI
# test we can correctly create by id or name
for bus in (-1, 0, 1, 2, 3, "X", "Y", "Z"):
try:
SPI(bus)
print("SPI", bus)
except ValueError:
print("ValueError", bus)
spi = SPI(1)
print(spi)
spi = SPI(1, SPI.MASTER)
spi = SPI(1, SPI.MASTER, baudrate=500000)
spi = SPI... |
pystock_crawler/tests/test_cmdline.py | breakhearts/pystock-crawler | 320 | 11005463 | import os
import shutil
import unittest
import pystock_crawler
from envoy import run
TEST_DIR = './test_data'
# Scrapy runs on another process where working directory may be different with
# the process running the test. So we have to explicitly set PYTHONPATH to
# the absolute path of the current working directo... |
monai/apps/utils.py | Project-MONAI/MONAI | 2,971 | 11005466 | <reponame>Project-MONAI/MONAI
# Copyright 2020 - 2021 MONAI Consortium
# 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 appl... |
tests/plugins/utf8.py | Bladez1753/lightning | 2,288 | 11005474 | #!/usr/bin/env python3
from pyln.client import Plugin
plugin = Plugin()
@plugin.method("utf8")
def echo(plugin, utf8):
assert '\\u' not in utf8
return {'utf8': utf8}
plugin.run()
|
parlai/crowdsourcing/tasks/model_chat/utils.py | zl930216/ParlAI | 552 | 11005480 | <filename>parlai/crowdsourcing/tasks/model_chat/utils.py
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import base64
import datetime
import json
import os
import rand... |
example_project/main/common/mixins.py | BrendaH/django-machina | 572 | 11005486 | import inspect
class MenuItemMixin(object):
"""
This mixins injects attributes that start with the 'menu_' prefix into the context generated by
the view it is applied to. This behavior can be used to highlight an item of a navigation
component.
"""
def get_context_data(self, **kwargs):
... |
autotest/gdrivers/netcdf_cfchecks.py | jpapadakis/gdal | 3,100 | 11005497 | #!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test NetCDF driver CF compliance.
# Author: <NAME> <<EMAIL>>
#
###############################################################################
# No copyright in or... |
dfvfs/lib/gpt.py | dfjxs/dfvfs | 176 | 11005525 | <filename>dfvfs/lib/gpt.py
# -*- coding: utf-8 -*-
"""Helper functions for GUID Partition Table (GPT) support."""
def GPTPathSpecGetEntryIndex(path_spec):
"""Retrieves the entry index from the path specification.
Args:
path_spec (PathSpec): path specification.
Returns:
int: entry index or None if not ... |
projects/siamfc-pytorch/siamfc/pair_dataset.py | JerryX1110/VFS | 106 | 11005551 | import random
import cv2
import numpy as np
from torch.utils.data import Dataset
from .pytorch_utils import from_numpy
def fliplr(x):
# Copy because needs to be contiguous with positive stride
return np.fliplr(x).copy()
class PairDataset(Dataset):
def __init__(self,
seqs,
... |
bin/botocore/waiter.py | iilness2/bash-lambda-layer-custom | 1,738 | 11005566 | # Copyright 2012-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... |
tests/test_identification.py | Bing1012/3 | 1,040 | 11005569 | <filename>tests/test_identification.py
from unittest.mock import Mock
import pytest
from pyscaffold.exceptions import InvalidIdentifier
from pyscaffold.identification import (
dasherize,
deterministic_name,
deterministic_sort,
get_id,
is_valid_identifier,
levenshtein,
make_valid_identifier... |
benchs/bench_index_flat.py | ScriptBox99/facebook-faiss | 17,006 | 11005581 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import time
import os
import numpy as np
import faiss
from faiss.contrib.datasets import SyntheticDataset
os.system... |
components/policy/tools/generate_policy_source.py | iplo/Chain | 231 | 11005583 | <gh_stars>100-1000
#!/usr/bin/env python
# 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.
'''python %prog [options] platform chromium_os_flag template
platform specifies which platform source is being ... |
noxfiles/dev_nox.py | ethyca/fides | 153 | 11005608 | <reponame>ethyca/fides<gh_stars>100-1000
"""Contains the nox sessions for running development environments."""
import nox
from constants_nox import RUN, START_APP_EXTERNAL, START_APP_UI
from docker_nox import build
@nox.session()
def dev(session: nox.Session) -> None:
"""Spin up the entire application and open a ... |
DQM/SiTrackerPhase2/python/Phase2OTMonitorCluster_cff.py | ckamtsikis/cmssw | 852 | 11005610 | <filename>DQM/SiTrackerPhase2/python/Phase2OTMonitorCluster_cff.py
import FWCore.ParameterSet.Config as cms
from DQM.SiTrackerPhase2.Phase2OTMonitorCluster_cfi import Phase2OTMonitorCluster
clusterMonitorOT = Phase2OTMonitorCluster.clone()
|
R/tests/autoGen/writeFUs.py | gigliovale/h2o | 882 | 11005615 | ##
# A wrapper script to loop over tasks and produce RUnits
# Each line of tasks is a set of params for building the RUnit
##
import os
from writers import *
from makeTestTasks import genTasks
from GenUtils import setup_random_seed
import GenUtils
def writeFU(FU, data, dataPath, dataTask, taskType, FUParams):
wt ... |
packages/syft/src/syft/core/smpc/protocol/spdz/__init__.py | vishalbelsare/PySyft | 8,428 | 11005707 | <reponame>vishalbelsare/PySyft
"""SPDZ multiplication mechanism."""
# relative
from . import spdz
__all__ = ["spdz"]
|
tensorflow_examples/lite/model_maker/core/optimization/warmup.py | duy-maimanh/examples | 6,484 | 11005716 | <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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... |
properties/nodes.py | Mango-3/blenderseed | 256 | 11005722 | <filename>properties/nodes.py
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2018-2019 The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any perso... |
python-for-beginners/14 - Function parameters/code_challenge.py | vijayraavi/c9-python-getting-started | 8,041 | 11005731 | <reponame>vijayraavi/c9-python-getting-started
# Create a calculator function
# The function should accept three parameters:
# first_number: a numeric value for the math operation
# second_number: a numeric value for the math operation
# operation: the word 'add' or 'subtract'. The default operation is 'add'
# the func... |
tests/conftest.py | awais786/django-stdimage | 274 | 11005742 | <reponame>awais786/django-stdimage<filename>tests/conftest.py
import io
import pytest
from django.core.files.uploadedfile import SimpleUploadedFile
from PIL import Image
@pytest.fixture
def imagedata():
img = Image.new("RGB", (250, 250), (255, 55, 255))
output = io.BytesIO()
img.save(output, format="JPE... |
btk20_src/lib/utils.py | musiclvme/distant_speech_recognition | 136 | 11005748 | #
# Beamforming Toolkit
# (btk)
#
# Module: btk.utils
# Purpose: Utility routines.
# Author: <NAME>
from __future__ import generators
from _utils import *
import time
class FGet:
"""Replicates the Janus 'fgets' functionality."""
def __init__(self,... |
test/cts/tool/CTSConverter/src/nn/specs/V1_1/strided_slice_quant8_6.mod.py | zhaoming0/webml-polyfill | 255 | 11005758 | model = Model()
i1 = Input("input", "TENSOR_QUANT8_ASYMM", "{4}, 1.0, 0")
begins = Parameter("begins", "TENSOR_INT32", "{1}", [1])
ends = Parameter("ends", "TENSOR_INT32", "{1}", [3])
strides = Parameter("strides", "TENSOR_INT32", "{1}", [1])
beginMask = Int32Scalar("beginMask", 0)
endMask = Int32Scalar("endMask", 1)
s... |
detection/configs/mask_rcnn_crossformer_s_fpn_1x_coco.py | cheerss/CrossFormer | 204 | 11005788 | _base_ = [
'../configs/_base_/models/mask_rcnn_r50_fpn.py',
'../configs/_base_/datasets/coco_instance.py',
'../configs/_base_/default_runtime.py'
]
model = dict(
pretrained=None,
backbone=dict(
type='CrossFormer_S',
group_size=[7, 7, 7, 7],
crs_interval=[8, 4, 2, 1]),
nec... |
opentraj/toolkit/loaders/loader_kitti.py | fengzileee/OpenTraj | 232 | 11005793 | # Author: Pat
# Email: <EMAIL>
#loader for KITTI, in global frame--origin is defined as the imu position at the first frame in that scene
import pandas as pd
import numpy as np
import glob
from toolkit.core.trajdataset import TrajDataset
import math
from math import cos, sin, tan, pi
from copy import deepcopy
def lo... |
src/mcedit2/rendering/scenegraph/scenenode.py | elcarrion06/mcedit2 | 673 | 11005794 | """
scenegraph
"""
from __future__ import absolute_import, division, print_function
import logging
import weakref
from mcedit2.rendering.scenegraph import rendernode
log = logging.getLogger(__name__)
class Node(object):
RenderNodeClass = rendernode.RenderNode
def __init__(self, name=None):
supe... |
pywsd/tokenize.py | goodmami/pywsd | 581 | 11005799 | #!/usr/bin/env python -*- coding: utf-8 -*-
#
# Python Word Sense Disambiguation (pyWSD): Tokenizer
#
# Copyright (C) 2014-2020 alvations
# URL:
# For license information, see LICENSE.md
import re
from nltk import sent_tokenize
class MacIntyreContractions:
"""
List of contractions adapted from <NAME>'s token... |
tests/test_algebra_onnx_operators_opset.py | xiaowuhu/sklearn-onnx | 323 | 11005813 | # SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from numpy.testing import assert_almost_equal
import onnx
import onnxruntime as ort
from skl2onnx.algebra.onnx_ops import OnnxPad # noqa
class TestOnnxOperatorsOpset(unittest.TestCase):
@unittest.skipIf(onnx.defs.onnx_opset_version() < 10... |
fhir/resources/contract.py | cstoltze/fhir.resources | 144 | 11005818 | # -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Contract
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
import typing
from pydantic import Field, root_validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from pydantic.... |
sdk/textanalytics/azure-ai-textanalytics/samples/sample_recognize_entities.py | rsdoherty/azure-sdk-for-python | 2,728 | 11005819 | # 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.
# --------------------------------------------------------------------... |
tests/regressiontests/generic_relations_regress/tests.py | kix/django | 790 | 11005823 | from django.db.models import Q
from django.test import TestCase
from .models import (Address, Place, Restaurant, Link, CharLink, TextLink,
Person, Contact, Note, Organization, OddRelation1, OddRelation2)
class GenericRelationTests(TestCase):
def test_inherited_models_content_type(self):
"""
... |
configs/example/gem5_library/riscv-fs.py | hyu-iot/gem5 | 765 | 11005849 | <gh_stars>100-1000
# Copyright (c) 2021 The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright... |
Src/StdLib/Lib/test/test_index.py | cwensley/ironpython2 | 2,209 | 11005858 | <gh_stars>1000+
import unittest
from test import test_support
import operator
from sys import maxint
maxsize = test_support.MAX_Py_ssize_t
minsize = -maxsize-1
class oldstyle:
def __index__(self):
return self.ind
class newstyle(object):
def __index__(self):
return self.ind
class TrapInt(int):... |
labs/scaling-ec2-using-sqs/receive_messages.py | dominik-lenda/Course-Certified-Solutions-Architect-Associate | 152 | 11005884 | #!/usr/bin/env python3
import logging
import time
import boto3
from botocore.exceptions import ClientError
QUEUE_NAME = "Messages"
logging.basicConfig(format="[%(levelname)s] %(message)s", level="INFO")
sqs = boto3.client("sqs")
try:
logging.info(f"Getting queue URL for queue: {QUEUE_NAME}")
response = sqs... |
whotracksme/data/db.py | philipp-classen/whotracks.me | 158 | 11005895 | <reponame>philipp-classen/whotracks.me
import json
import requests
import sqlite3
import pkg_resources
import itertools
import io
import csv
from hashlib import md5
def asset_string(name):
return pkg_resources.resource_string(
'whotracksme.data',
f'assets/{name}').decode('utf-8')
def load_tracker... |
tests/test_packages/test_skills/test_weather_station/test_dummy_weather_station_data.py | bryanchriswhite/agents-aea | 126 | 11005897 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may ob... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.