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 |
|---|---|---|---|---|
python/django/app/views.py | mattiapenati/web-frameworks | 5,710 | 87665 | from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
def index(request):
return HttpResponse(status=200)
def get_user(request, id):
return HttpResponse(id)
@csrf_exempt
def create_user(request):
return HttpResponse(status=200)
|
baselines/EMNLP2019/general_inputter.py | ParikhKadam/knowledge-net | 240 | 87718 | """Define inputters reading from TFRecord files."""
import tensorflow as tf
from opennmt.inputters.inputter import Inputter
from opennmt.utils import compat
import numpy as np
from collections import defaultdict
import yaml
class Feature:
def __init__(self, name, shape, where):
self.name = name
s... |
scripts/shared_qvm.py | karlosz/qvm | 321 | 87729 | #!/usr/bin/env python
### shared_qvm.py
###
### Author: <NAME>
###
### Copyright (c) 2017 Rigetti Computing
### This file shows a minimal example of how to use the --shared
### option with QVM from Python.
from __future__ import print_function
import posix_ipc as pos
import mmap
import ctypes
import numpy as np
impo... |
python/np-linear-algebra.py | gajubadge11/HackerRank-1 | 340 | 87738 | import numpy as np
n = int(input().strip())
array = np.array([[float(x) for x in input().strip().split()] for _ in range(n)], dtype = float)
print(np.linalg.det(array)) |
src/third_party/flac/flac.gyp | goochen/naiveproxy | 2,151 | 87781 | <gh_stars>1000+
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'libflac',
'product_name': 'flac',
'type': 'static_library',
'sources': [
... |
tests/server_test.py | Adrijaned/weechat-matrix | 773 | 87800 | from matrix.server import MatrixServer
from matrix._weechat import MockConfig
import matrix.globals as G
G.CONFIG = MockConfig()
class TestClass(object):
def test_address_parsing(self):
homeserver = MatrixServer._parse_url("example.org", 8080)
assert homeserver.hostname == "example.org"
as... |
esphome/components/pmsa003i/sensor.py | OttoWinter/esphomeyaml | 249 | 87821 | <gh_stars>100-1000
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import i2c, sensor
from esphome.const import (
CONF_ID,
CONF_PM_1_0,
CONF_PM_2_5,
CONF_PM_10_0,
CONF_PMC_0_5,
CONF_PMC_1_0,
CONF_PMC_2_5,
CONF_PMC_10_0,
UNIT_MICROGRAMS_PER_... |
pudzu/sandbox/tureen.py | Udzu/pudzu | 119 | 87844 | import itertools
import operator
import re
import bs4
from pudzu.utils import *
# Various utilities for BeautifulSoup
# helper functions since: (a) bs4 tags need to be compared with is, not eq; (b) they're iterable
def remove_duplicate_tags(l):
"""Remove duplicate tags from a list (using object identity rather... |
Python/SingleNumber.py | TonnyL/Windary | 205 | 87846 | <reponame>TonnyL/Windary
# Given an array of integers, every element appears twice except for one. Find that single one.
#
# Note:
# Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
#
# Python, Python3 all accepted.
class SingleNumber:
def singleNumber(sel... |
src/head_detector_vgg16.py | bill-lin/FCHD-Fully-Convolutional-Head-Detector | 648 | 87850 | <gh_stars>100-1000
import torch as t
from torch import nn
from torchvision.models import vgg16
from src.region_proposal_network import RegionProposalNetwork
from src.head_detector import Head_Detector
from src.config import opt
def decom_vgg16():
""" Load the default PyTorch model or the pre-trained caffe model. ... |
rman_translators/rman_alembic_translator.py | fxjeane/RenderManForBlender | 312 | 87852 | from .rman_translator import RmanTranslator
from ..rman_sg_nodes.rman_sg_alembic import RmanSgAlembic
from ..rfb_utils import transform_utils
from ..rfb_utils import string_utils
from ..rfb_logger import rfb_log
class RmanAlembicTranslator(RmanTranslator):
def __init__(self, rman_scene):
super().__init__(... |
model/sep_conv.py | leoriohope/RandWireNN | 757 | 87865 | <reponame>leoriohope/RandWireNN
import torch
import torch.nn as nn
class SeparableConv2d(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0,
dilation=1, bias=False):
super(SeparableConv2d,self).__init__()
self.conv1 = nn.Conv2d(in_chann... |
thrift/compiler/test/fixtures/namespace/gen-py3lite/my/namespacing/extend/test/extend/lite_clients.py | killight98/fbthrift | 2,112 | 87872 | #
# Autogenerated by Thrift
#
# DO NOT EDIT
# @generated
#
import typing as _typing
import folly.iobuf as _fbthrift_iobuf
from thrift.py3lite.client import (
AsyncClient as _fbthrift_py3lite_AsyncClient,
SyncClient as _fbthrift_py3lite_SyncClient,
Client as _fbthrift_py3lite_Client,
)
import thrift.py3li... |
plugins/k8s/test/test_args.py | MrMarvin/cloudkeeper | 316 | 87887 | from resotolib.args import get_arg_parser, ArgumentParser
from resoto_plugin_k8s import KubernetesCollectorPlugin
def test_args():
arg_parser = get_arg_parser()
KubernetesCollectorPlugin.add_args(arg_parser)
arg_parser.parse_args()
assert len(ArgumentParser.args.k8s_context) == 0
assert ArgumentPa... |
vut/lib/python3.8/site-packages/pipenv/vendor/passa/cli/_base.py | dan-mutua/djangowk1 | 6,263 | 87895 | # -*- coding=utf-8 -*-
from __future__ import absolute_import, unicode_literals
import argparse
import os
import sys
from .options import project
class BaseCommand(object):
"""A CLI command.
"""
name = None
description = None
default_arguments = [project]
arguments = []
def __init__(se... |
utils.py | dendisuhubdy/ALAE | 3,477 | 87915 | # Copyright 2019-2020 <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, sof... |
tueplots/axes.py | not-a-feature/tueplots | 110 | 87924 | <reponame>not-a-feature/tueplots
"""Axes behaviour."""
def lines(
*,
base_width=0.5,
line_base_ratio=2.0,
tick_major_base_ratio=1.0,
tick_minor_base_ratio=0.5,
tick_size_width_ratio=3.0,
tick_major_size_min=3.0,
tick_minor_size_min=2.0,
axisbelow=True,
):
"""Adjust linewidth(s)... |
dm_alchemy/event_tracker.py | locross93/dm_alchemy | 182 | 87948 | # 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
funcy/tree.py | ruancomelli/funcy | 1,914 | 87964 | from collections import deque
from .types import is_seqcont
__all__ = ['tree_leaves', 'ltree_leaves', 'tree_nodes', 'ltree_nodes']
def tree_leaves(root, follow=is_seqcont, children=iter):
"""Iterates over tree leaves."""
q = deque([[root]])
while q:
node_iter = iter(q.pop())
for sub in n... |
integration_test/test_denyoom.py | lynix94/nbase-arc | 176 | 87979 | <gh_stars>100-1000
#
# 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 agree... |
test/tests/rackhd20/test_rackhd20_api_schemas.py | arunrordell/RackHD | 451 | 87980 | '''
Copyright 2016, EMC, Inc.
Author(s):
<NAME>
'''
import fit_path # NOQA: unused import
import os
import sys
import subprocess
import fit_common
# Select test group here using @attr
from nose.plugins.attrib import attr
@attr(all=True, regression=True, smoke=True)
class rackhd20_api_schemas(fit_common.unittest.Te... |
tests/terraform/checks/resource/aws/test_MSKClusterEncryption.py | antonblr/checkov | 4,013 | 87988 | import unittest
from checkov.common.models.enums import CheckResult
from checkov.terraform.checks.resource.aws.MSKClusterEncryption import check
class TestMSKClusterEncryption(unittest.TestCase):
def test_failure(self):
resource_conf = {
"name": "test-project",
}
scan_result ... |
scripts/edsk_double_step.py | Bytedecode72/flashfloppy | 847 | 88017 | # edsk_double_step.py
#
# Create a double-step EDSK image by doubling up cylinders.
#
# Written & released by <NAME> <<EMAIL>>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import struct, sys, random
def main(arg... |
starthinker/task/cm_to_dv/preview_li.py | arbrown/starthinker | 138 | 88019 | <filename>starthinker/task/cm_to_dv/preview_li.py
###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy o... |
tools/generate_exceptions.py | baltitenger/asyncpg | 5,714 | 88074 | #!/usr/bin/env python3
#
# Copyright (C) 2016-present the asyncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
import argparse
import builtins
import re
import string
import textwrap
from as... |
tools/fsd/fsd_regions.py | ErasmusMC-Bioinformatics/tools-iuc | 142 | 88078 | #!/usr/bin/env python
# Family size distribution of tags which were aligned to the reference genome
#
# Author: <NAME> & <NAME>, Johannes-Kepler University Linz (Austria)
# Contact: <EMAIL>
#
# Takes at least one TABULAR file with tags before the alignment to the SSCS,
# a BAM file with tags of reads that overlap the ... |
itests/lorem.py | skivis/BlackSheep | 482 | 88081 | <filename>itests/lorem.py
LOREM_IPSUM = """
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in vo... |
25-tables/python/tables.py | tourdedave/selenium-tips | 251 | 88086 | <filename>25-tables/python/tables.py
# -*- coding: utf-8 -*-
"""
Implementation of http://elementalselenium.com/tips/25-tables
"""
import unittest
from selenium import webdriver
class Tables(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def tearDown(self):
self.driv... |
LeetCode/python3/70.py | ZintrulCre/LeetCode_Archiver | 279 | 88091 | class Solution:
def climbStairs(self, n: int) -> int:
if n == 1 or n == 0:
return 1
prev, curr = 1, 1
for i in range(2, n + 1):
temp = curr
curr += prev
prev = temp
return curr
|
backend/apps/mails/migrations/0001_initial.py | KuanWeiLee/froggy-service | 174 | 88092 | # Generated by Django 2.1.5 on 2019-01-09 14:01
from django.db import migrations
from django.contrib.postgres.operations import HStoreExtension
class Migration(migrations.Migration):
dependencies = [
]
operations = [
HStoreExtension(),
]
|
deephyper/core/analytics/_analytics.py | felixeperez/deephyper | 185 | 88097 | <reponame>felixeperez/deephyper
"""Analytics command line interface for DeepHyper.
It can be used with:
.. code-block:: console
$ deephyper-analytics --help
Command line to analysis the outputs produced by DeepHyper.
positional arguments:
{notebook,quickplot,topk}
Kind o... |
WebMirror/management/rss_parser_funcs/feed_parse_extractBinhjamin.py | fake-name/ReadableWebProxy | 193 | 88106 | <reponame>fake-name/ReadableWebProxy<gh_stars>100-1000
def extractBinhjamin(item):
"""
# Binhjamin
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (vol or chp or frag or postfix):
return False
if ('SRKJ' in item['title'] or 'SRKJ-Sayonara Ryuu' in item['tags']) and (chp or ... |
testing/scripts/gyp_flag_compare.py | jason-simmons/flutter_buildroot | 2,151 | 88108 | <reponame>jason-simmons/flutter_buildroot
#!/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.
"""Wrap //tools/gn/bin/gyp_flag_compare.py for the bots.
This script wraps the GN test scrip... |
nalaf/features/relations/context.py | ashish-narwal/nalaf | 103 | 88117 | <filename>nalaf/features/relations/context.py
from nalaf.features.relations import EdgeFeatureGenerator
from nltk.stem import PorterStemmer
class LinearDistanceFeatureGenerator(EdgeFeatureGenerator):
"""
The absolute distance between the two entities in the edge.
If distance is greater than 5 (default), a... |
modules/until_module.py | Fork-for-Modify/UniVL | 161 | 88121 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# Copyright (c) 2018, <NAME>PORATION. 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 ... |
alipay/aop/api/domain/KoubeiMarketingCampaignOpenDeliveryDeleteModel.py | snowxmas/alipay-sdk-python-all | 213 | 88138 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiMarketingCampaignOpenDeliveryDeleteModel(object):
def __init__(self):
self._delivery_type = None
self._partner_id = None
self._shop_id = None
@property
def ... |
dropbox_problem/problem_8.py | loftwah/Daily-Coding-Problem | 129 | 88157 | """This problem was asked by Dropbox.
Given a list of words, determine whether the words can be chained to form a circle.
A word X can be placed in front of another word Y in a circle if the last character
of X is same as the first character of Y.
For example, the words ['chair', 'height', 'racket', touch', 'tunic'... |
main.py | wisdark/520apkhook | 390 | 88184 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import re
import sys
import time
import argparse
import subprocess
try:
import rich, Crypto
except ModuleNotFoundError as e:
print('\n[!] 遇到致命错误!')
print('\n[!] 模块rich, pycryptodome未安装, 请在终端中执行命令`pip3 install rich pycryptodome`进行安装.\n')
print('[!] 程... |
data/flatfileparser.py | MonashTS/lbimproved | 101 | 88205 |
def readFlat(filename, delimiter):
f = open(filename)
ans = []
for line in f:
ans.append(map(lambda x:float(x), filter(lambda x:len(x)>0,line.split(delimiter))))
return ans
|
platypush/plugins/printer/cups.py | RichardChiang/platypush | 228 | 88207 | <filename>platypush/plugins/printer/cups.py
import os
from typing import Optional, Dict, Any, List
from platypush.message.response.printer.cups import PrinterResponse, PrintersResponse, PrinterJobAddedResponse
from platypush.plugins import Plugin, action
class PrinterCupsPlugin(Plugin):
"""
A plugin to inte... |
pyautogui__keyboard__examples/input_and_delete__typewrite_press_keyDown_keyUp.py | DazEB2/SimplePyScripts | 117 | 88216 | <filename>pyautogui__keyboard__examples/input_and_delete__typewrite_press_keyDown_keyUp.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# SOURCE: http://pyautogui.readthedocs.io/en/latest/keyboard.html#the-press-keydown-and-keyup-functions
# pip install pyautogui
import pyautogui
TEXT =... |
pretrain/modules/__init__.py | xiling42/VL-BERT | 671 | 88260 | <reponame>xiling42/VL-BERT
from .resnet_vlbert_for_pretraining import ResNetVLBERTForPretraining
from .resnet_vlbert_for_pretraining_multitask import ResNetVLBERTForPretrainingMultitask
from .resnet_vlbert_for_attention_vis import ResNetVLBERTForAttentionVis
|
website/project/views/comment.py | gaybro8777/osf.io | 628 | 88267 | # -*- coding: utf-8 -*-
import markdown
from django.utils import timezone
from flask import request
from api.caching.tasks import ban_url
from osf.models import Guid
from framework.postcommit_tasks.handlers import enqueue_postcommit_task
from website import settings
from addons.base.signals import file_updated
from o... |
RePoE/parser/modules/cluster_jewels.py | brather1ng/RePoE | 224 | 88309 | from RePoE.parser.util import call_with_default_args, write_json
from RePoE.parser import Parser_Module
class cluster_jewels(Parser_Module):
@staticmethod
def write(file_system, data_path, relational_reader, translation_file_cache, ot_file_cache):
skills = {}
for row in relational_reader["Pass... |
vendor/src/github.com/Workiva/go-datastructures/fibheap/Test Generator/Merge.py | ylankgz/amazon-ssm-agent | 6,943 | 88322 | import random
l1 = []
l2 = []
for i in range(20):
l1.append(random.uniform(-1E10, 1E10))
l2.append(random.uniform(-1E10, 1E10))
print(l1)
print(l2)
l = []
l.extend(l1)
l.extend(l2)
print(sorted(l))
'''
[6015943293.071386, -3878285748.0708866, 8674121166.062424, -1528465047.6118088,
7584260716.4948... |
cape_webservices/app/app_saved_reply_endpoints.py | edwardmjackson/cape-webservices | 164 | 88341 | <gh_stars>100-1000
# Copyright 2018 BLEMUNDSBURY 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
dojo/db_migrations/0013_jira_info_level.py | mtcolman/django-DefectDojo | 1,772 | 88345 | # Generated by Django 2.2.1 on 2019-08-01 16:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dojo', '0012_jira_finding_age'),
]
operations = [
migrations.AddField(
model_name='jira_conf',
name='info_mapping_se... |
docs/tools/chineselink.py | nbl97/nni | 2,305 | 88388 | """
This is to keep Chinese doc update to English doc. Should be run regularly.
There is no sane way to check the contents though. PR review should enforce contributors to update the corresponding translation.
See https://github.com/microsoft/nni/issues/4298 for discussion.
Under docs, run
python tools/chineselin... |
create_data.py | pengzhou93/dancenet | 499 | 88396 | <gh_stars>100-1000
import cv2
import numpy as np
VIDEO_PATH = 'data.mkv'
kernel = np.ones((2,2),np.uint8)
cap = cv2.VideoCapture(VIDEO_PATH)
data = []
count = 1
limit = 0
while(cap.isOpened()):
ret, image_np = cap.read()
if ret == False:
break
if limit == 3:
limit = 0
#image_np = 255 - image_np
image_np ... |
Lib/objc/_CoreFollowUp.py | snazari/Pyto | 701 | 88418 | """
Classes from the 'CoreFollowUp' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
FLApprovedItemsFilter = _Class("FLApprovedItemsFilter")... |
net/data/path_builder_unittest/self_issued_prioritization/generate-certs.py | zealoussnow/chromium | 14,668 | 88420 | #!/usr/bin/env python
# Copyright 2021 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.
"""
A chain with a self-signed Root1 and a Root1 cross signed by Root2. The
cross-signed root has a newer notBefore date than the self-s... |
ParlAI/parlai/tasks/hotpotqa/build.py | UmaTaru/run | 163 | 88450 | <gh_stars>100-1000
#!/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.
# Download and build the data if it does not exist.
import parlai.core.build_data as build_data
impor... |
ijson/backends/yajl2_c.py | simonw/ijson | 394 | 88451 | <gh_stars>100-1000
#
# Contributed by <NAME> <<EMAIL>>
#
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2016
# Copyright by UWA (in the framework of the ICRAR)
#
'''
Wrapper for _yajl2 C extension module
'''
from ijson import common, compat, utils
from . im... |
predefined_functions/initialisation.py | g-make-it/IG_Trading_Algo_Scripts_Python | 186 | 88456 | <reponame>g-make-it/IG_Trading_Algo_Scripts_Python
from trading_ig import IGService
from trading_ig.config import config
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
# if you need to cache to DB your requests
from datetime import timedelta
import requests_cache
class Initialisa... |
tests/pydecompile-test/decompiler-baselines/string_length.py | jaydeetay/pxt | 977 | 88459 | <gh_stars>100-1000
x = "Okay"
y = len(x) |
tests/e2e/kcs/test_noobaa_rebuild.py | annagitel/ocs-ci | 130 | 88471 | <reponame>annagitel/ocs-ci<filename>tests/e2e/kcs/test_noobaa_rebuild.py<gh_stars>100-1000
import logging
import pytest
from ocs_ci.framework.testlib import (
ignore_leftovers,
E2ETest,
tier3,
skipif_openshift_dedicated,
skipif_external_mode,
)
from ocs_ci.helpers.sanity_helpers import Sanity
fro... |
tests/test_new.py | Mayitzin/ahrs | 184 | 88491 | <gh_stars>100-1000
#! /usr/bin/python3
# -*- coding: utf-8 -*-
"""
Pytest-based testing
====================
This file performs automated tests with pytest. It does not generate charts
or output to be reviewed.
Run with: pytest-3 tests/test_new.py
Run with: pytest-3 tests/test_new.py -s -vv --cov=ahrs for coverage + v... |
trains/backend_api/session/__init__.py | doliveralg/trains | 112 | 88513 | <reponame>doliveralg/trains
from .session import Session
from .datamodel import DataModel, NonStrictDataModel, schema_property, StringEnum
from .request import Request, BatchRequest, CompoundRequest
from .response import Response
from .token_manager import TokenManager
from .errors import TimeoutExpiredError, ResultNot... |
graph4nlp/pytorch/modules/prediction/generation/TreeBasedDecoder.py | cminusQAQ/graph4nlp | 1,269 | 88530 | <gh_stars>1000+
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from graph4nlp.pytorch.modules.utils.tree_utils import Tree, to_cuda
from .attention import Attention
from .base import RNNTreeDecoderBase
class StdTreeDecoder(RNNTreeDecoderBase):
r"""StdTreeDeco... |
crowdsourcing/validators/utils.py | AKSHANSH47/crowdsource-platform2 | 138 | 88538 | <filename>crowdsourcing/validators/utils.py
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import ValidationError
class EqualityValidator(object):
message = _('The fields {field_names} must be equal.')
missing_message = _('This fi... |
plugins/hypervisors/ovm/src/main/scripts/vm/hypervisor/ovm/OvmCommonModule.py | ycyun/ablestack-cloud | 1,131 | 88569 | # 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... |
model_hub/examples/huggingface/question-answering/qa_beam_search_trial.py | shiyuann/determined | 1,729 | 88586 | <filename>model_hub/examples/huggingface/question-answering/qa_beam_search_trial.py
"""
This example is largely based on the question-answering example in the huggingface
transformers library. The license for the transformer's library is reproduced below.
===============================================================... |
frappe/modules/__init__.py | Don-Leopardo/frappe | 3,755 | 88596 |
from .utils import * |
tests/extension/types_/axi_/slave_readwrite_lite_simultaneous/test_types_axi_slave_readwrite_lite_simultaneous.py | jesseclin/veriloggen | 232 | 88605 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import types_axi_slave_readwrite_lite_simultaneous
expected_verilog = """
module test;
reg CLK;
reg RST;
wire [32-1:0] sum;
reg [32-1:0] myaxi_awaddr;
reg [4-1:0] myaxi_awcache;
reg [3-1:0] myaxi_awprot;
reg m... |
RecoEgamma/ElectronIdentification/python/Identification/cutBasedElectronID_Spring15_25ns_V1_cff.py | ckamtsikis/cmssw | 852 | 88614 | <gh_stars>100-1000
from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry
# Common functions and classes for ID definition are imported here:
from RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_tools import *
#
# This is the first round of Spring15 25ns cuts, optimized on S... |
kattis/addingwords.py | Ashindustry007/competitive-programming | 506 | 88621 | #!/usr/bin/env python2
# https://open.kattis.com/problems/addingwords
a = {}
b = {}
while True:
try:
line = raw_input()
except:
break
fs = line.split()
if fs[0] == 'def':
n = fs[1]
v = int(fs[2])
if n in a: del(b[a[n]])
a[n] = v
b[v] = n
elif f... |
dace/codegen/instrumentation/report.py | jnice-81/dace | 227 | 88631 | # Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
""" Implementation of the performance instrumentation report. """
import json
import numpy as np
import re
class InstrumentationReport(object):
@staticmethod
def get_event_uuid(event):
uuid = (-1, -1, -1)
if 'args' in... |
mriqc/data/config.py | apiccirilli/mriqc | 176 | 88640 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright 2021 The NiPreps Developers <<EMAIL>>
#
# 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 ... |
libs/core/operators.py | PINTO0309/Fast_Seg | 201 | 88653 | # Common Segmentation Operator implemented by Pytorch
# XiangtaiLi(<EMAIL>)
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import BatchNorm2d
upsample = lambda x, size: F.interpolate(x, size, mode='bilinear', align_corners=True)
def conv3x3(in_planes, out_planes, stride=1):
""... |
classification/tools.py | badheshchauhan/python | 204 | 88658 | <filename>classification/tools.py
from matplotlib.image import imread
import matplotlib.pyplot as plt
from math import sqrt
import math
import random
import numpy
import operator
from scipy.spatial.distance import cdist
from scipy.linalg import norm
import datetime
def Histogram(path):
image = imread(path)
if... |
parlai/tasks/self_chat/agents.py | zl930216/ParlAI | 9,228 | 88688 | #!/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.
"""
Model self chat.
"""
from parlai.core.teachers import Teacher
class DefaultTeacher(Teacher):
def __init__(self... |
lib/rtorrent/__init__.py | Slashbunny/maraschino | 137 | 88692 | <filename>lib/rtorrent/__init__.py<gh_stars>100-1000
# Copyright (c) 2013 <NAME>, <<EMAIL>>
# 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... |
src/tcclib/codesign.py | CollectiveDS/tccprofile | 244 | 88699 | <gh_stars>100-1000
"""Codesign."""
import re
import subprocess
from os import remove
from pathlib import Path, PurePath
from tempfile import gettempdir
def _xxd(blob):
"""XXD"""
result = None
# Note, this requires input passed in via 'stdin', so include 'stdin' for piping input.
_cmd = ['/usr/bin/x... |
tdb/interface.py | KEVINYZY/tdb | 1,527 | 88704 | """
top-level interface methods so user doesn't need to directly construct
a dbsession
"""
import debug_session
# default session
_dbsession=None
def debug(evals,feed_dict=None,breakpoints=None,break_immediately=False,session=None):
"""
spawns a new debug session
"""
global _dbsession
_dbsession=debug_session.D... |
supersuit/__init__.py | PettingZoo-Team/SuperSu | 237 | 88742 | from .generic_wrappers import * # NOQA
from .lambda_wrappers import action_lambda_v1, observation_lambda_v0, reward_lambda_v0 # NOQA
from .multiagent_wrappers import agent_indicator_v0, black_death_v2, \
pad_action_space_v0, pad_observations_v0 # NOQA
from supersuit.generic_wrappers import frame_skip_v0, color_redu... |
galaxy/main/models/task.py | bmclaughlin/galaxy | 904 | 88760 | <reponame>bmclaughlin/galaxy<filename>galaxy/main/models/task.py
# (c) 2012-2019, Ansible by Red Hat
#
# This file is part of Ansible Galaxy
#
# Ansible Galaxy is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by
# the Apache Software Foundation, either vers... |
tributary/__init__.py | Ferev/tributary | 357 | 88765 | <filename>tributary/__init__.py
from ._version import __version__ # noqa: F401, E402
from .lazy import LazyGraph, LazyNode, node # noqa: F401, E402
from .streaming import * # noqa: F401, F403, E402
from .utils import LazyToStreaming # noqa: F401, E402
|
atest/testresources/listeners/ListenImports.py | rdagum/robotframework | 7,073 | 88774 | import os
try:
basestring
except NameError:
basestring = str
class ListenImports:
ROBOT_LISTENER_API_VERSION = 2
def __init__(self, imports):
self.imports = open(imports, 'w')
def library_import(self, name, attrs):
self._imported("Library", name, attrs)
def resource_import(... |
svtools/breakpoint.py | NeolithEra/svtools | 120 | 88778 | <gh_stars>100-1000
import sys
import l_bp
from exceptions import MissingProbabilitiesException
class BreakpointInterval(object):
'''
Class for storing the range and probability distribution
of a breakpoint
'''
# Constant value for slop padding
SLOP_PROB = 1e-100
def __init__(self, chrom, ... |
examples/trials/systems_auto_tuning/opevo/src/compiler_auto_tune_stable.py | dutxubo/nni | 9,680 | 88783 | #!/usr/bin/env python3
## TODO: optimize c-mcpu metric; early-stop handler; fp16/int8; Kill pyRPC;
import numpy as np
import tvm
import logging
import math
import re
import sys, time, subprocess, os, random, hashlib
from tvm import autotvm
import topi
import json
from topi.util import get_const_tuple
import importlib... |
pybrain/structure/connections/__init__.py | sveilleux1/pybrain | 2,208 | 88819 | <filename>pybrain/structure/connections/__init__.py
from pybrain.structure.connections.full import FullConnection
from pybrain.structure.connections.identity import IdentityConnection
from pybrain.structure.connections.shared import SharedFullConnection, MotherConnection, SharedConnection
from pybrain.structure.connect... |
examples/alias.py | wyfo/apimodel | 118 | 88830 | <filename>examples/alias.py
from dataclasses import dataclass, field
from apischema import alias, deserialize, serialize
from apischema.json_schema import deserialization_schema
@dataclass
class Foo:
class_: str = field(metadata=alias("class"))
assert deserialization_schema(Foo) == {
"$schema": "http://jso... |
llvm/utils/lit/tests/Inputs/googletest-upstream-format/DummySubDir/OneTest.py | medismailben/llvm-project | 4,812 | 88834 | <reponame>medismailben/llvm-project
#!/usr/bin/env python
import sys
if len(sys.argv) != 2:
raise ValueError("unexpected number of args")
if sys.argv[1] == "--gtest_list_tests":
print("""\
Running main() from gtest_main.cc
FirstTest.
subTestA
subTestB
ParameterizedTest/0.
subTest
ParameterizedTest/1.
... |
examples/ssd/datasets/ingest_pascalvoc.py | rsketine/neon | 4,415 | 88849 | <reponame>rsketine/neon<gh_stars>1000+
#!/usr/bin/env python
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... |
Model_TextCNN/old_code/model.py | DmytroBabenko/Text-Classification-Models-Pytorch | 481 | 88858 | # model.py
import torch
from torch import nn
from torch import Tensor
from torch.autograd import Variable
import numpy as np
from sklearn.metrics import accuracy_score
class CNNText(nn.Module):
def __init__(self, config):
super(CNNText, self).__init__()
self.config = config
# Conv... |
applications/tensorflow2/image_classification/test/test_models.py | payoto/graphcore_examples | 260 | 88883 | <filename>applications/tensorflow2/image_classification/test/test_models.py<gh_stars>100-1000
# Copyright (c) 2021 Graphcore Ltd. All rights reserved.
import unittest
from pathlib import Path
import sys
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.python import ipu
sys.path.... |
api/tests/opentrons/tools/test_pipette_memory.py | anuwrag/opentrons | 235 | 88921 | from mock import AsyncMock
import pytest
from opentrons.drivers.smoothie_drivers import SmoothieDriver
from opentrons.tools import write_pipette_memory
@pytest.fixture
def mock_driver() -> AsyncMock:
return AsyncMock(spec=SmoothieDriver)
async def test_write_identifiers(mock_driver: AsyncMock) -> None:
"""... |
Tests/test_python25.py | cwensley/ironpython2 | 1,078 | 88932 | <filename>Tests/test_python25.py
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
import exceptions
import sys
import unittest
from iptest import is_cli, run_t... |
example.py | gaojiuli/xweb | 357 | 88944 | from xweb import App, Model, RESTController
class UserModel(Model):
schema = {
"type": "object",
"properties": {
"username": {"type": "string"},
"password": {"type": "string"},
},
"required": ['username']
}
class EventController(RESTController):
as... |
allennlp/nn/parallel/__init__.py | MSLars/allennlp | 11,433 | 88956 | <filename>allennlp/nn/parallel/__init__.py
from allennlp.nn.parallel.sharded_module_mixin import ShardedModuleMixin
from allennlp.nn.parallel.ddp_accelerator import (
DdpAccelerator,
DdpWrappedModel,
TorchDdpAccelerator,
)
from allennlp.nn.parallel.fairscale_fsdp_accelerator import (
FairScaleFsdpAccele... |
Arrays/longest_increasing_subarray.py | techsavvyy/coding-problems | 2,647 | 89002 | <filename>Arrays/longest_increasing_subarray.py<gh_stars>1000+
'''
Longest Increasing Subarray
Find the longest increasing subarray (subarray is when all elements are neighboring in the original array).
Input: [10, 1, 3, 8, 2, 0, 5, 7, 12, 3]
Output: 4
=========================================
Only in one iteration,... |
asq/test/test_to_set.py | sixty-north/asq | 175 | 89007 | import unittest
from asq.queryables import Queryable
__author__ = "<NAME>"
class TestToSet(unittest.TestCase):
def test_to_set(self):
a = [1, 2, 4, 8, 16, 32]
b = Queryable(a).to_set()
c = set([1, 2, 4, 8, 16, 32])
self.assertEqual(b, c)
def test_to_set_closed(self):
... |
grumpy-tools-src/grumpy_tools/grumpc.py | Srinivas11789/grumpy | 386 | 89015 | <filename>grumpy-tools-src/grumpy_tools/grumpc.py
#!/usr/bin/env python
# coding=utf-8
# 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
#
# ... |
tests/pytest_docker_compose_tests/test_module_scoping_fixtures.py | mathieu-lemay/pytest-docker-compose | 142 | 89026 | import time
import requests
from urllib.parse import urljoin
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
import pytest
pytest_plugins = ["docker_compose"]
@pytest.fixture(scope="module")
def wait_for_api(module_scoped_container_getter):
"""Wait for the api from my_api_service ... |
ltr/helpers/solr_escape.py | tanjie123/hello-ltr | 109 | 89029 | <filename>ltr/helpers/solr_escape.py
def esc_kw(kw):
""" Take a keyword and escape all the
Solr parts we want to escape!"""
kw = kw.replace('\\', '\\\\') # be sure to do this first, as we inject \!
kw = kw.replace('(', '\(')
kw = kw.replace(')', '\)')
kw = kw.replace('+', '\+')
kw = kw.r... |
blackmamba/lib/rope/base/pyscopes.py | oz90210/blackmamba | 463 | 89030 | <filename>blackmamba/lib/rope/base/pyscopes.py
import rope.base.builtins
import rope.base.codeanalyze
import rope.base.pynames
from rope.base import ast, exceptions, utils
class Scope(object):
def __init__(self, pycore, pyobject, parent_scope):
self.pycore = pycore
self.pyobject = pyobject
... |
src/fastapi_quickcrud/__init__.py | aebrahim/FastAPIQuickCRUD | 123 | 89051 | from .misc.utils import sqlalchemy_to_pydantic
from .crud_router import crud_router_builder
from .misc.type import CrudMethods
|
src/oci/log_analytics/models/create_log_analytics_object_collection_rule_details.py | ezequielramos/oci-python-sdk | 249 | 89073 | # 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... |
testfixtures/tests/test_outputcapture.py | abcdenis/testfixtures | 184 | 89104 | from __future__ import print_function
import sys
from subprocess import call
from unittest import TestCase
from testfixtures import OutputCapture, compare
from .test_compare import CompareHelper
class TestOutputCapture(CompareHelper, TestCase):
def test_compare_strips(self):
with OutputCapture() as o:
... |
tests/test_systems.py | ShaunMerritt/systems | 203 | 89124 | <filename>tests/test_systems.py
"Test systems.py"
import unittest
from systems.errors import IllegalSourceStock
import systems.models
import systems.parse
import systems.lexer
class TestModels(unittest.TestCase):
def test_stock_maximum_rate(self):
m = systems.models.Model("Maximum")
a = m.infinit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.