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 |
|---|---|---|---|---|
monai/_extensions/loader.py | tatuanb/monai_V1 | 2,971 | 24275 | # 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 applicable law or agreed to in wri... |
tests/ext/test_paginator.py | Descent098/hyde | 804 | 24283 | <filename>tests/ext/test_paginator.py
# -*- coding: utf-8 -*-
"""
Use nose
`$ pip install nose`
`$ nosetests`
"""
from textwrap import dedent
from hyde.generator import Generator
from hyde.site import Site
from fswrap import File
TEST_SITE = File(__file__).parent.parent.child_folder('_test')
class TestPaginator(ob... |
veros/setups/global_flexible/global_flexible.py | AkasDutta/veros | 115 | 24299 | <gh_stars>100-1000
#!/usr/bin/env python
import os
import h5netcdf
import scipy.ndimage
from veros import veros_routine, veros_kernel, KernelOutput, VerosSetup, runtime_settings as rs, runtime_state as rst
from veros.variables import Variable, allocate
from veros.core.utilities import enforce_boundaries
from veros.co... |
sagemaker/ssedata.py | cleveranjos/Rapid-ML-Gateway | 147 | 24303 | <gh_stars>100-1000
from enum import Enum
class ArgType(Enum):
"""
Represents data types that can be used
as arguments in different script functions.
"""
Undefined = -1
Empty = 0
String = 1
Numeric = 2
Mixed = 3
class ReturnType(Enum):
"""
Represents return types that can
... |
ferminet/utils/system.py | shishaochen/ferminet | 469 | 24304 | <reponame>shishaochen/ferminet
# Lint as: python3
# Copyright 2020 DeepMind Technologies 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 copy of the License at
#
# https://www.apac... |
awx/main/tests/unit/test_signals.py | gitEdouble/awx | 11,396 | 24308 | from awx.main import signals
class TestCleanupDetachedLabels:
def test_cleanup_detached_labels_on_deleted_parent(self, mocker):
mock_labels = [mocker.MagicMock(), mocker.MagicMock()]
mock_instance = mocker.MagicMock()
mock_instance.labels.all = mocker.MagicMock()
mock_instance.labe... |
data/data_augment.py | ZHANGHeng19931123/MutualGuide | 124 | 24327 | <reponame>ZHANGHeng19931123/MutualGuide
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cv2
import numpy as np
import random
import math
import torch
def _crop(image, boxes, labels, p=0.75, min_iou=0.75, max_iou=0.25):
def matrix_iou(a, b):
lt = np.maximum(a[:, np.newaxis, :2], b[:, :2])
rb = n... |
preprocessing/reid_preprocessing.py | Mithilesh1609/assembled-cnn | 363 | 24345 | <gh_stars>100-1000
# This code is adapted from the https://github.com/tensorflow/models/tree/master/official/r1/resnet.
# ==========================================================================================
# NAVER’s modifications are Copyright 2020 NAVER corp. All rights reserved.
# =============================... |
src/robot/libdocpkg/jsonbuilder.py | rdagum/robotframework | 7,073 | 24348 | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... |
src/ros/rosmake/test/test_parallel_build.py | jungleni/ros_code_reading | 742 | 24354 | <filename>src/ros/rosmake/test/test_parallel_build.py
#!/usr/bin/env python
# Copyright (c) 2009, <NAME>, Inc.
# 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... |
qiskit_optimization/converters/linear_inequality_to_penalty.py | X-Libor/qiskit-optimization | 109 | 24369 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/draugiem/urls.py | DemarcusL/django_wiki_lab | 6,342 | 24371 | from django.urls import path
from . import views
urlpatterns = [
path("draugiem/login/", views.login, name="draugiem_login"),
path("draugiem/callback/", views.callback, name="draugiem_callback"),
]
|
Python/venv/lib/python3.7/site-packages/IPython/core/inputtransformer2.py | HenriqueBuzin/TCC | 445 | 24372 | <gh_stars>100-1000
"""Input transformer machinery to support IPython special syntax.
This includes the machinery to recognise and transform ``%magic`` commands,
``!system`` commands, ``help?`` querying, prompt stripping, and so forth.
Added: IPython 7.0. Replaces inputsplitter and inputtransformer which were
deprecat... |
integration/bazel_workspace_tests/bazel_ngtsc_plugin/packages.bzl | John-Cassidy/angular | 95,154 | 24397 | <filename>integration/bazel_workspace_tests/bazel_ngtsc_plugin/packages.bzl
ANGULAR_PACKAGES_CONFIG = [
("@angular/animations", struct(entry_points = ["browser"])),
("@angular/common", struct(entry_points = ["http/testing", "http", "testing"])),
("@angular/compiler", struct(entry_points = ["testing"])),
... |
cogdl/layers/gin_layer.py | cenyk1230/cogdl | 1,072 | 24413 | import torch
import torch.nn as nn
from cogdl.utils import spmm
class GINLayer(nn.Module):
r"""Graph Isomorphism Network layer from paper `"How Powerful are Graph
Neural Networks?" <https://arxiv.org/pdf/1810.00826.pdf>`__.
.. math::
h_i^{(l+1)} = f_\Theta \left((1 + \epsilon) h_i^{l} +
... |
mmselfsup/models/algorithms/cae.py | mitming/mmselfsup | 355 | 24421 | <reponame>mitming/mmselfsup
# Copyright (c) OpenMMLab. All rights reserved.
from typing import Sequence
import torch
from torchvision.transforms import Normalize
from ..builder import ALGORITHMS, build_backbone, build_head, build_neck
from .base import BaseModel
@ALGORITHMS.register_module()
class CAE(BaseModel):
... |
pyperformance/run.py | brandtbucher/pyperformance | 255 | 24426 | <reponame>brandtbucher/pyperformance<gh_stars>100-1000
from collections import namedtuple
import hashlib
import sys
import time
import traceback
import pyperformance
from . import _utils, _python, _pythoninfo
from .venv import VenvForBenchmarks, REQUIREMENTS_FILE
from . import _venv
class BenchmarkException(Exceptio... |
Python_10_Plot_Bokeh_Candlestick.py | rogerolowski/SimpleStockAnalysisPython | 195 | 24457 | <reponame>rogerolowski/SimpleStockAnalysisPython
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 27 08:09:11 2020
@author: Tin
"""
# Plot Candlestick in bokeh
import pandas as pd # Dataframe Library
from math import pi
from bokeh.plotting import figure, show, output_file
pd.set_option('max_columns', None) #... |
atlas/foundations_contrib/src/test/test_lazy_bucket.py | DeepLearnI/atlas | 296 | 24494 |
import unittest
from mock import Mock
from foundations_spec.helpers.spec import Spec
from foundations_spec.helpers import let, let_mock, set_up
class TestLazyBucket(Spec):
@let
def lazy_bucket(self):
from foundations_contrib.lazy_bucket import LazyBucket
return LazyBucket(self.bucket_constru... |
plugins/vad/snr_vad/test_snr_vad.py | kowo-zahl/Naomi | 194 | 24530 | # -*- coding: utf-8 -*-
from naomi import testutils
from . import snr_vad
class TestSNR_VADPlugin(testutils.Test_VADPlugin):
def setUp(self):
super(TestSNR_VADPlugin, self).setUp()
self.plugin = testutils.get_plugin_instance(
snr_vad.SNRPlugin,
self._test_input
)
... |
texel/keys.py | Xen0byte/texel | 119 | 24570 | <filename>texel/keys.py
import curses
class Key:
def __init__(self, *values):
self.values = values
self._hash = hash(values)
self._keyset = set(values)
def __eq__(self, other):
return self._hash == other._hash
def __hash__(self):
return self._hash
class Keys:
... |
tests/tokenizers.py | theeluwin/textrankr | 219 | 24596 | import json
import requests
from typing import List
from konlpy.tag import Okt
from requests.models import Response
class OktTokenizer:
"""
A POS-tagger based tokenizer functor. Note that these are just examples. The `phrases` function usually gives a better result than an ordinary POS tokenizer.
... |
dbs/dal/Whiteport.py | xinghejd/opencanary_web | 633 | 24609 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Author: pirogue
Purpose: 白名单端口表操作
Site: http://pirogue.org
Created: 2018-08-03 17:32:54
"""
from dbs.initdb import DBSession
from dbs.models.Whiteport import Whiteport
from sqlalchemy import desc,asc
from sqlalchemy.exc import InvalidRequestError
# import s... |
pwndbg/color/__init__.py | R2S4X/pwndbg | 287 | 24644 | <reponame>R2S4X/pwndbg
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import re
import pwndbg.memoize
NORMAL = "\x1b[0m"
BLACK = "\x1b[30m"
RED ... |
tools/debug_discovery.py | s1rd4v3/homebridge-tuya-web-es6-js | 172 | 24657 | <reponame>s1rd4v3/homebridge-tuya-web-es6-js<filename>tools/debug_discovery.py
# The script is intended to get a list of all devices available via Tuya Home Assistant API endpoint.
import requests
import pprint
# CHANGE THIS - BEGINNING
USERNAME = ""
PASSWORD = ""
REGION = "eu" # cn, eu, us
COUNTRY_CODE = "1" # Your a... |
examples/demo_classic.py | ria02/InquirerPy | 120 | 24677 | # NOTE: Following example requires boto3 package.
import boto3
from InquirerPy import prompt
from InquirerPy.exceptions import InvalidArgument
from InquirerPy.validator import PathValidator
client = boto3.client("s3")
def get_bucket(_):
return [bucket["Name"] for bucket in client.list_buckets()["Buckets"]]
de... |
lv_set/Main.py | Ramesh-X/Level-Set | 122 | 24686 | """
This python code demonstrates an edge-based active contour model as an application of the
Distance Regularized Level Set Evolution (DRLSE) formulation in the following paper:
<NAME>, <NAME>, <NAME>, <NAME>, "Distance Regularized Level Set Evolution and Its Application to Image Segmentation",
IEEE Trans. Ima... |
examples/hashtrees.py | ascribe/transactions | 124 | 24741 | # -*- coding: utf-8 -*-
"""
Inspired by:
* https://gist.github.com/shirriff/c9fb5d98e6da79d9a772#file-merkle-py
* https://github.com/richardkiss/pycoin
"""
from __future__ import absolute_import, division, unicode_literals
from builtins import range
import binascii
import hashlib
def merkleroot(hashes):
... |
pwncat/modules/linux/enumerate/system/selinux.py | Mitul16/pwncat | 1,454 | 24751 | #!/usr/bin/env python3
from typing import Dict
import rich.markup
from pwncat.db import Fact
from pwncat.platform.linux import Linux
from pwncat.modules.enumerate import Schedule, EnumerateModule
class SELinuxState(Fact):
def __init__(self, source, state, status):
super().__init__(source=source, types=[... |
tempest/lib/services/placement/base_placement_client.py | rishabh20111990/tempest | 254 | 24792 | <reponame>rishabh20111990/tempest<filename>tempest/lib/services/placement/base_placement_client.py
# Copyright (c) 2019 Ericsson
#
# 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
#
# ... |
solutions/problem_122.py | ksvr444/daily-coding-problem | 1,921 | 24794 | <reponame>ksvr444/daily-coding-problem
def get_max_coins_helper(matrix, crow, ccol, rows, cols):
cval = matrix[crow][ccol]
if crow == rows - 1 and ccol == cols - 1:
return cval
down, right = cval, cval
if crow < rows - 1:
down += get_max_coins_helper(
matrix, crow + 1, ccol... |
streamer/output_stream.py | meryacine/shaka-streamer | 154 | 24820 | <gh_stars>100-1000
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... |
deepchem/data/tests/test_shape.py | deloragaskins/deepchem | 3,782 | 24823 | import deepchem as dc
import numpy as np
import os
def test_numpy_dataset_get_shape():
"""Test that get_shape works for numpy datasets."""
num_datapoints = 100
num_features = 10
num_tasks = 10
# Generate data
X = np.random.rand(num_datapoints, num_features)
y = np.random.randint(2, size=(num_datapoints,... |
src/oci/apigateway/models/execution_log_policy.py | Manny27nyc/oci-python-sdk | 249 | 24828 | # coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
Programs/Evernote/PackMemo/PackMemo.py | Psiphonc/EasierLife | 203 | 24882 | <filename>Programs/Evernote/PackMemo/PackMemo.py
from EvernoteController import EvernoteController
from Memo import Memo
MEMO_NAME = 'Memo'
MEMO_DIR = 'Memo'
MEMO_STORAGE_DIR = 'S-Memo'
def f(fn, *args, **kwargs):
try:
fn(*args, **kwargs)
except:
pass
m = Memo()
e = EvernoteCont... |
test/src/testing/universal/uart.py | Jcc99/Adafruit_Blinka | 294 | 24886 | <filename>test/src/testing/universal/uart.py
import gc
from unittest import TestCase
from testing import await_true
gc.collect()
class TestGPSInteractive(TestCase):
def test_read_value(self):
import adafruit_blinka
adafruit_blinka.patch_system() # needed before adafruit_gps imports time
... |
src/masonite/presets/React.py | cercos/masonite | 1,816 | 24889 | <reponame>cercos/masonite
"""React Preset"""
import shutil
import os
from .Preset import Preset
from ..utils.filesystem import make_directory
from ..utils.location import resources_path, views_path
class React(Preset):
"""
Configure the front-end scaffolding for the application to use ReactJS
Will also ... |
docker/dempcap/pcapminey/core/ThreadPool/Pool.py | JakubOrzol/dockerfiles | 203 | 24927 | <reponame>JakubOrzol/dockerfiles
# -*- coding: utf8 -*-
__author__ = '<NAME>'
from Queue import Queue
from Worker import Worker
class Pool:
def __init__(self, size):
self.size = size
self.workers = []
self.tasks = Queue()
def _removeDeadWorkers(self):
self.workers = [w for w i... |
Codes/gracekoo/interview_33.py | ghoslation/algorithm | 256 | 24931 | # -*- coding: utf-8 -*-
# @Time: 2020/7/3 10:21
# @Author: GraceKoo
# @File: interview_33.py
# @Desc: https://leetcode-cn.com/problems/chou-shu-lcof/
class Solution:
def nthUglyNumber(self, n: int) -> int:
if n <= 0:
return 0
dp, a, b, c = [1] * n, 0, 0, 0
for i in range(1, n):... |
tests/import/module_getattr.py | sebi5361/micropython | 198 | 24938 | <reponame>sebi5361/micropython
# test __getattr__ on module
# ensure that does_not_exist doesn't exist to start with
this = __import__(__name__)
try:
this.does_not_exist
assert False
except AttributeError:
pass
# define __getattr__
def __getattr__(attr):
if attr == 'does_not_exist':
return Fal... |
setup.py | gsgoncalves/K-NRM | 198 | 24947 | # Copyright (c) 2017, Carnegie Mellon University. All rights reserved.
#
# Use of the K-NRM package is subject to the terms of the software license set
# forth in the LICENSE file included with this software, and also available at
# https://github.com/AdeDZY/K-NRM/blob/master/LICENSE
from setuptools import setup
from ... |
docqa/triviaqa/answer_detection.py | Willyoung2017/doc-qa | 422 | 24992 | import re
import string
import numpy as np
from tqdm import tqdm
from typing import List
from docqa.triviaqa.read_data import TriviaQaQuestion
from docqa.triviaqa.trivia_qa_eval import normalize_answer, f1_score
from docqa.utils import flatten_iterable, split
"""
Tools for turning the aliases and answer strings from... |
examples/vacuum_send_command.py | giuseppeg88/lovelace-xiaomi-vacuum-map-card | 798 | 24994 | <filename>examples/vacuum_send_command.py
entity_id = data.get('entity_id')
command = data.get('command')
params = str(data.get('params'))
parsedParams = []
for z in params.replace(' ', '').replace('],[', '|').replace('[', '').replace(']', '').split('|'):
rect = []
for c in z.split(','):
rect.append(in... |
extras/createTestBlocksForReadBlkUpdate.py | Manny27nyc/BitcoinArmory | 505 | 25008 | from sys import path
path.append('..')
from armoryengine import *
TheBDM.setBlocking(True)
TheBDM.setOnlineMode(True)
if not os.path.exists('testmultiblock'):
os.mkdir('testmultiblock')
fout = []
fout.append([0, 101, 'testmultiblock/blk00000.dat'])
fout.append([0, 102, 'testmultiblock/blk00000_test1.dat']) #... |
tests/common/devices/vmhost.py | emilmih/sonic-mgmt | 132 | 25087 | from tests.common.devices.base import AnsibleHostBase
class VMHost(AnsibleHostBase):
"""
@summary: Class for VM server
For running ansible module on VM server
"""
def __init__(self, ansible_adhoc, hostname):
AnsibleHostBase.__init__(self, ansible_adhoc, hostname)
@property
def e... |
python/paddle/fluid/tests/unittests/dygraph_to_static/test_isinstance.py | zmxdream/Paddle | 17,085 | 25100 | # Copyright (c) 2020 PaddlePaddle 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 appli... |
tests/test_weightings.py | matchup-ir/whooshy | 319 | 25103 | <reponame>matchup-ir/whooshy
from __future__ import with_statement
import inspect
from random import choice, randint
import sys
from whoosh import fields, query, scoring
from whoosh.compat import u, xrange, permutations
from whoosh.filedb.filestore import RamStorage
def _weighting_classes(ignore):
# Get all the ... |
rest_framework_auth0/models.py | robindebois/djangorestframework-auth0 | 107 | 25111 | # Just to keep things like ./manage.py test happy
from django.contrib.auth.models import AbstractUser
# class Group(models.Model):
# """
# Groups are a generic way of categorizing users to apply permissions, or
# some other label, to those users. A user can belong to any number of
# groups.
# A use... |
algs4/max_pq.py | dumpmemory/algs4-py | 230 | 25120 | <reponame>dumpmemory/algs4-py
class MaxPQ:
def __init__(self):
self.pq = []
def insert(self, v):
self.pq.append(v)
self.swim(len(self.pq) - 1)
def max(self):
return self.pq[0]
def del_max(self, ):
m = self.pq[0]
self.pq[0], self.pq[-1] = self.pq[-1], s... |
metric/metric.py | wyu-du/MultiTurnDialogZoo | 145 | 25144 | <filename>metric/metric.py<gh_stars>100-1000
from nltk.translate.bleu_score import sentence_bleu, corpus_bleu
from nltk.translate.bleu_score import SmoothingFunction
from nltk.collocations import BigramCollocationFinder
from nltk.probability import FreqDist
from .bleu import Bleu
import argparse
import codecs
import nu... |
neutron/tests/functional/agent/l3/test_metadata_proxy.py | congnt95/neutron | 1,080 | 25166 | <filename>neutron/tests/functional/agent/l3/test_metadata_proxy.py
# 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/L... |
glue/core/exceptions.py | HPLegion/glue | 550 | 25177 | <gh_stars>100-1000
class IncompatibleAttribute(Exception):
pass
class IncompatibleDataException(Exception):
pass
class UndefinedROI(Exception):
pass
class InvalidSubscriber(Exception):
pass
class InvalidMessage(Exception):
pass
|
tests/test_version.py | datatags/pyCraft | 759 | 25241 | from distutils.version import StrictVersion as SV
import unittest
import minecraft
class VersionTest(unittest.TestCase):
def test_module_version_is_a_valid_pep_386_strict_version(self):
SV(minecraft.__version__)
def test_protocol_version_is_an_int(self):
for version in minecraft.SUPPORTED_PR... |
src/models/sequence_predictor_model.py | rajatdiptabiswas/NN_compression | 211 | 25264 | from __future__ import print_function
import os
import time
import tensorflow as tf
import numpy as np
import sys
from zoneout_wrapper import ZoneoutWrapper
class SequencePredictor():
def add_placeholders(self):
"""Generates placeholder variables to represent the input tensors
"""
self.inp... |
dialogue-engine/test/programytest/security/linking/test_aiml.py | cotobadesign/cotoba-agent-oss | 104 | 25281 | <gh_stars>100-1000
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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, mer... |
baselines/profiling/profile_main.py | Worm4047/TVR | 106 | 25327 | """
Profile the time needed for retrieval.
We consider retrieval in a corpus of 1M videos, 1K videos are added, 10K queries are retrieved.
Calculate the time needed for adding 1K videos, and performing retrieval for 10K queries.
1, Data Loading time is ignored, consider it is hidden by computation time.
2, Sort time i... |
egs/wmt14_en_de/nlp1/local/generate_stand_vocab.py | didichuxing/delta | 1,442 | 25354 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# 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/LI... |
test/knxip_tests/hpai_test.py | iligiddi/xknx | 179 | 25375 | <filename>test/knxip_tests/hpai_test.py<gh_stars>100-1000
"""Unit test for KNX/IP HPAI objects."""
import pytest
from xknx.exceptions import ConversionError, CouldNotParseKNXIP
from xknx.knxip import HPAI
class TestKNXIPHPAI:
"""Test class for KNX/IP HPAI objects."""
def test_hpai(self):
"""Test pars... |
timemachines/skaters/nproph/nprophetiskaterfactory.py | iklasky/timemachines | 253 | 25385 | <filename>timemachines/skaters/nproph/nprophetiskaterfactory.py
from timemachines.skaters.nproph.nprophetinclusion import using_neuralprophet, NeuralProphet
if using_neuralprophet:
import pandas as pd
from typing import List, Tuple, Any
from timemachines.skatertools.utilities.conventions import wrap
fro... |
api-reference-examples/python/pytx/pytx/threat_descriptor.py | b-bold/ThreatExchange | 997 | 25398 | <filename>api-reference-examples/python/pytx/pytx/threat_descriptor.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .common import Common
from .vocabulary import ThreatDescriptor as td
from .vocabulary import ThreatExchange as t
class ThreatDescriptor(Common):
_URL = t.URL + t.VERS... |
test/lib-clay/externals/abi/newtypes/run.py | jb55/clay | 185 | 25428 | import sys
sys.path.append('..')
import external_test
external_test.runExternalTest()
|
scripts/sg-toolbox/SG-Glyph-CopyLayer.py | tphinney/science-gothic | 104 | 25455 | <gh_stars>100-1000
#FLM: Glyph: Copy Layer (TypeRig)
# ----------------------------------------
# (C) <NAME>, 2019 (http://www.kateliev.com)
# (C) Karandash Type Foundry (http://www.karandash.eu)
#-----------------------------------------
# www.typerig.com
# No warranties. By using this you agree
# that you use it at ... |
tests/core/test_base_component.py | strickvl/zenml | 1,275 | 25475 | <reponame>strickvl/zenml
# Copyright (c) ZenML GmbH 2021. 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
#
# U... |
tests/unit/local/lambdafn/test_config.py | torresxb1/aws-sam-cli | 859 | 25500 | <reponame>torresxb1/aws-sam-cli<filename>tests/unit/local/lambdafn/test_config.py
from unittest import TestCase
from unittest.mock import Mock
from parameterized import parameterized
from samcli.lib.utils.packagetype import ZIP
from samcli.local.lambdafn.config import FunctionConfig
from samcli.commands.local.cli_com... |
examples/lolcode_rockstar.py | hoojaoh/rockstar | 4,603 | 25502 | <filename>examples/lolcode_rockstar.py
from rockstar import RockStar
lolcode_code = """HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE"""
rock_it_bro = RockStar(days=400, file_name='helloworld.lol', code=lolcode_code)
rock_it_bro.make_me_a_rockstar()
|
test/unit/agent/common/util/math.py | dp92987/nginx-amplify-agent | 308 | 25519 | # -*- coding: utf-8 -*-
from amplify.agent.common.util.math import median
from unittest import TestCase
from hamcrest import *
__author__ = "<NAME>"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
class MathTestCase(TestCase):
de... |
aea/cli/utils/formatting.py | bryanchriswhite/agents-aea | 126 | 25529 | <filename>aea/cli/utils/formatting.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2020 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... |
blender/arm/logicnode/math/LN_separate_xyz.py | onelsonic/armory | 2,583 | 25535 | <reponame>onelsonic/armory<filename>blender/arm/logicnode/math/LN_separate_xyz.py<gh_stars>1000+
from arm.logicnode.arm_nodes import *
class SeparateVectorNode(ArmLogicTreeNode):
"""Splits the given vector into X, Y and Z."""
bl_idname = 'LNSeparateVectorNode'
bl_label = 'Separate XYZ'
arm_section = 'v... |
ml3d/torch/utils/helper_torch.py | inkyusa/Open3D-ML | 447 | 25537 | <filename>ml3d/torch/utils/helper_torch.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class conv2d_transpose(nn.Module):
def __init__(self,
batchNorm,
in_planes,
out_planes,
kernel_size=1,
stride=1,
... |
service-workers/service-worker/resources/update-max-aged-worker.py | meyerweb/wpt | 14,668 | 25549 | import time
import json
from wptserve.utils import isomorphic_decode, isomorphic_encode
def main(request, response):
headers = [(b'Content-Type', b'application/javascript'),
(b'Cache-Control', b'max-age=86400'),
(b'Last-Modified', isomorphic_encode(time.strftime(u"%a, %d %b %Y %H:%M:... |
djangae/contrib/googleauth/backends/base.py | sleepyjames/djangae | 467 | 25585 | <gh_stars>100-1000
"""
This is duplicated from Django 3.0 to avoid
starting an import chain that ends up with
ContentTypes which may not be installed in a
Djangae project.
"""
class BaseBackend:
def authenticate(self, request, **kwargs):
return None
@classmethod
def can_authentica... |
tests/cell_fabric/test_rect.py | mabrains/ALIGN-public | 119 | 25586 | <filename>tests/cell_fabric/test_rect.py
from align.cell_fabric.transformation import Rect
def test_toList():
r = Rect( 0, 0, 1, 1)
assert r.toList() == [0, 0, 1, 1]
def test_canonical():
r = Rect( 1, 1, 0, 0)
assert r.canonical().toList() == [0, 0, 1, 1]
def test_repr():
r = Rect( 0, 0, 1, 1) ... |
Segment Tree Query II.py | RijuDasgupta9116/LintCode | 321 | 25604 | <filename>Segment Tree Query II.py
"""
For an array, we can build a SegmentTree for it, each node stores an extra attribute count to denote the number of
elements in the the array which value is between interval start and end. (The array may not fully filled by elements)
Design a query method with three parameters roo... |
hearthbreaker/cards/spells/neutral.py | souserge/hearthbreaker | 429 | 25628 | from hearthbreaker.cards.base import SpellCard
from hearthbreaker.constants import CHARACTER_CLASS, CARD_RARITY
from hearthbreaker.tags.base import BuffUntil, Buff
from hearthbreaker.tags.event import TurnStarted
from hearthbreaker.tags.status import Stealth, Taunt, Frozen
import hearthbreaker.targeting
class TheCoin... |
scripts/cloud/aws/ops-ec2-add-snapshot-tag-to-ebs-volumes.py | fahlmant/openshift-tools | 164 | 25638 | #!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
"""
This is a script that can be used to tag EBS volumes in OpenShift v3.
This script assume that your AWS credentials are setup in ~/.aws/credentials like this:
[default]
aws_access_key_id = xxxx
aws_secret_access_key = xxxx
Or that environmen... |
extra_tests/snippets/stdlib_subprocess.py | dbrgn/RustPython | 11,058 | 25644 | import subprocess
import time
import sys
import signal
from testutils import assert_raises
is_unix = not sys.platform.startswith("win")
if is_unix:
def echo(text):
return ["echo", text]
def sleep(secs):
return ["sleep", str(secs)]
else:
def echo(text):
return ["cmd", "/C", f"echo {... |
webs/douban/tasks/__init__.py | billvsme/videoSpider | 216 | 25654 | from . import get_main_movies_base_data
from . import get_main_movies_full_data
from . import get_celebrities_full_data
from . import down_video_images
from . import down_celebrity_images
|
samples/waitforupdates.py | ArpitSharma2800/pyvmomi-community-samples | 931 | 25678 | <reponame>ArpitSharma2800/pyvmomi-community-samples
#!/usr/bin/env python
#
# VMware vSphere Python SDK
# Copyright (c) 2008-2021 VMware, 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 co... |
doubly_stochastic_dgp/layer_initializations.py | ayush29/Doubly-Stochastic-DGP | 126 | 25712 |
import tensorflow as tf
import numpy as np
from gpflow.params import DataHolder, Minibatch
from gpflow import autoflow, params_as_tensors, ParamList
from gpflow.models.model import Model
from gpflow.mean_functions import Identity, Linear
from gpflow.mean_functions import Zero
from gpflow.quadrature import mvhermgauss... |
anchore/anchore_policy.py | berez23/anchore | 401 | 25798 | import os
import json
import re
import sys
import logging
import hashlib
import uuid
import jsonschema
import tempfile
import controller
import anchore_utils
import anchore_auth
from anchore.util import contexts
_logger = logging.getLogger(__name__)
default_policy_version = '1_0'
default_whitelist_version = '1_0'
de... |
dbModel.py | eric033014/Line-bot | 104 | 25826 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = Flask(__name__)
app.config[
'SQLALCHEMY_DATABASE_URI'] = 'postgres://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
manage... |
GlueCustomConnectors/glueJobValidation/glue_job_validation_update.py | xy1m/aws-glue-samples | 925 | 25875 | <gh_stars>100-1000
# Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
import sys
from awsglue.utils import getResolvedOptions
from awsglue.transforms import *
from pyspark.context import SparkContext
from awsglue.context import GlueContext
from awsglue.job ... |
code/utils/losses_2.py | mantuoluozk/MFC | 161 | 25887 | <filename>code/utils/losses_2.py
# import torch
# from torch.nn import functional as F
import numpy as np
from scipy.ndimage import distance_transform_edt as distance
from skimage import segmentation as skimage_seg
def compute_dtm(img_gt, out_shape, normalize=False, fg=False):
"""
compute the distance transfor... |
dayu_widgets/radio_button.py | ZSD-tim/dayu_widgets | 157 | 25902 | <reponame>ZSD-tim/dayu_widgets
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: <NAME>
# Date : 2019.2
# Email : <EMAIL>
###################################################################
"""
MRadioButton
"""
from dayu_widgets.mixin import cur... |
desktop/core/ext-py/docutils-0.14/test/test_parsers/test_parser.py | kokosing/hue | 5,079 | 25936 | <filename>desktop/core/ext-py/docutils-0.14/test/test_parsers/test_parser.py
#! /usr/bin/env python
# $Id: test_parser.py 7463 2012-06-22 19:49:51Z milde $
# Author: <NAME> <strank(AT)strank(DOT)info>
# Copyright: This module has been placed in the public domain.
"""
Tests for basic functionality of parser classes.
"... |
ros/genpy/src/genpy/msg/__init__.py | numberen/apollo-platform | 742 | 25968 | <reponame>numberen/apollo-platform
from ._TestFillEmbedTime import *
from ._TestFillSimple import *
from ._TestManyFields import *
from ._TestMsgArray import *
from ._TestPrimitiveArray import *
from ._TestString import *
|
models/treebased/data/data_generator.py | ziyoujiyi/PaddleRec | 2,739 | 25973 | <gh_stars>1000+
# Copyright (c) 2021 PaddlePaddle 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 r... |
third_party/liblouis/copy_tables.py | google-ar/chromium | 2,151 | 26018 | #!/usr/bin/env python
# Copyright 2015 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.
'''Copies the liblouis braille translation tables to a destination.'''
import liblouis_list_tables
import optparse
import os
import sh... |
netbox/dcim/migrations/0133_port_colors.py | TheFlyingCorpse/netbox | 4,994 | 26022 | <reponame>TheFlyingCorpse/netbox
from django.db import migrations
import utilities.fields
class Migration(migrations.Migration):
dependencies = [
('dcim', '0132_cable_length'),
]
operations = [
migrations.AddField(
model_name='frontport',
name='color',
... |
reppy/util.py | PLPeeters/reppy | 137 | 26032 | <reponame>PLPeeters/reppy
'''Utility functions.'''
import email
def parse_date(string):
'''Return a timestamp for the provided datestring, described by RFC 7231.'''
parsed = email.utils.parsedate_tz(string)
if parsed is None:
raise ValueError("Invalid time.")
parsed = list(parsed)
# Defau... |
autograd/__init__.py | mattjj/autograd_tutorial | 704 | 26034 | <gh_stars>100-1000
from .differential_operators import make_vjp, grad
|
data_filter_azure/data_filter_azure/documentdb_server.py | abhushansahu/contrib | 238 | 26054 | <filename>data_filter_azure/data_filter_azure/documentdb_server.py
#!/usr/bin/env python
import requests
import base64
import json
from flask import Flask,redirect, jsonify, abort, make_response, g
import config
from flask_bootstrap import Bootstrap
import azure.common
from data_filter_azure import opa
import azure.cos... |
absl/flags/tests/argparse_flags_test_helper.py | alexhagen/abseil-py | 1,969 | 26089 | <reponame>alexhagen/abseil-py
# Copyright 2018 The Abseil 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 a... |
test/win/compiler-flags/calling-convention.gyp | chlorm-forks/gyp | 2,151 | 26106 | <reponame>chlorm-forks/gyp
# Copyright (c) 2014 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'test_cdecl',
'type': 'loadable_module',
'msvs_settings': {
'VCCLCompiler... |
RecoEgamma/EgammaPhotonProducers/python/propOppoMomentumWithMaterialForElectrons_cfi.py | ckamtsikis/cmssw | 852 | 26129 | import FWCore.ParameterSet.Config as cms
import TrackingTools.MaterialEffects.OppositeMaterialPropagator_cfi
#PropagatorWithMaterialESProducer
oppositeToMomElePropagator = TrackingTools.MaterialEffects.OppositeMaterialPropagator_cfi.OppositeMaterialPropagator.clone(
Mass = 0.000511,
ComponentName = '... |
test/__init__.py | gjhiggins/rdflib-sqlalchemy | 112 | 26130 | from rdflib import plugin
from rdflib import store
plugin.register(
"SQLAlchemy",
store.Store,
"rdflib_sqlalchemy.store",
"SQLAlchemy",
)
|
isc_dhcp_leases/test_lease6.py | dholl/python-isc-dhcp-leases | 111 | 26137 | <gh_stars>100-1000
import datetime
from unittest import TestCase
from isc_dhcp_leases.iscdhcpleases import Lease6, utc
from freezegun import freeze_time
__author__ = '<NAME> <<EMAIL>>'
class TestLease6(TestCase):
def setUp(self):
self.lease_time = datetime.datetime(2015, 8, 18, 16, 55, 37, tzinfo=utc)
... |
spectacles/validators/validator.py | felipefrancisco/spectacles | 150 | 26143 | <reponame>felipefrancisco/spectacles
from typing import Optional, List
from abc import ABC, abstractmethod
from spectacles.client import LookerClient
from spectacles.lookml import Project, Model, Dimension
from spectacles.select import is_selected
from spectacles.exceptions import LookMlNotFound
class Validator(ABC):... |
saas/aiops/api/anomalydetection/main/anomaly_detection.py | iuskye/SREWorks | 407 | 26179 | <filename>saas/aiops/api/anomalydetection/main/anomaly_detection.py
import pandas as pd
import json
import time
from bentoml import env, artifacts, api, BentoService
from bentoml.adapters import DataframeInput, JsonInput, StringInput
from bentoml.frameworks.sklearn import SklearnModelArtifact
@env(infer_pip_packages... |
test cases/windows/10 vs module defs generated custom target/subdir/make_def.py | kira78/meson | 4,047 | 26180 | <reponame>kira78/meson
#!/usr/bin/env python3
import sys
with open(sys.argv[1], 'w') as f:
print('EXPORTS', file=f)
print(' somedllfunc', file=f)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.