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 |
|---|---|---|---|---|
cea/resources/radiation_daysim/geometry_generator.py | rdmolony/CityEnergyAnalyst | 121 | 9589946 | """
Geometry generator from
Shapefiles (buiding footprint)
and .tiff (terrain)
into 3D geometry with windows and roof equivalent to LOD3
"""
import os
import pickle
from itertools import repeat
from osgeo import gdal, osr
import geopandas as gpd
import cea
cea.suppress_3rd_party_debug_loggers()
import math
import... |
ctypeslib/codegen/__init__.py | shawwn/ctypeslib | 130 | 9589960 | <filename>ctypeslib/codegen/__init__.py<gh_stars>100-1000
# the ctypeslib.codegen package
|
cortex/_lib/utils.py | tsirif/cortex | 109 | 9589983 | <gh_stars>100-1000
'''Utility methods
'''
import logging
import os
import numpy as np
import torch
__author__ = '<NAME>'
__author_email__ = '<EMAIL>'
logger = logging.getLogger('cortex.util')
try:
_, _columns = os.popen('stty size', 'r').read().split()
_columns = int(_columns)
except ValueError:
_colu... |
tensorhive/models/Group.py | roscisz/TensorHive | 129 | 9589989 | <gh_stars>100-1000
import datetime
import logging
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.hybrid import hybrid_property
from tensorhive.database import Base
from tensorhive.exceptions.InvalidRequestException impo... |
test/test_pipeline/test_optimization_algorithm.py | mens-artis/Auto-PyTorch | 1,657 | 9589999 | <reponame>mens-artis/Auto-PyTorch<filename>test/test_pipeline/test_optimization_algorithm.py
__author__ = "<NAME>, <NAME> and <NAME>"
__version__ = "0.0.1"
__license__ = "BSD"
import unittest
import netifaces
import logging
import numpy as np
import torch
import ConfigSpace as CS
import ConfigSpace.hyperparameters a... |
examples/linguee.py | nidhaloff/deep_translator | 118 | 9590011 | <filename>examples/linguee.py
from deep_translator import LingueeTranslator
res = LingueeTranslator(source="de", target="en").translate("laufen", return_all=False)
print(res)
|
juriscraper/opinions/united_states/federal_appellate/ca11_p.py | EvandoBlanco/juriscraper | 228 | 9590068 | # Editor: mlr
# Maintenance log
# Date | Issue
# 2013-01-28 | InsanityException due to the court adding busted share links.
# 2014-07-02 | New website required rewrite.
from datetime import datetime
from juriscraper.OpinionSite import OpinionSite
from juriscraper.lib.string_utils import clean_string
class ... |
2018/quals/web-js-safe-2/src/solve.py | iicarus-bit/google-ctf | 2,757 | 9590081 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
homeassistant/components/control4/director_utils.py | tbarbette/core | 30,023 | 9590093 | """Provides data updates from the Control4 controller for platforms."""
import logging
from pyControl4.account import C4Account
from pyControl4.director import C4Director
from pyControl4.error_handling import BadToken
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF... |
tests/test_formats.py | NitronBeenGrinding/deonedits | 223 | 9590185 | from pytest import fixture
import json
from bs4 import BeautifulSoup
from deon.parser import Checklist, Section, Line
from deon.formats import Format, Markdown, JupyterNotebook, JupyterNotebookMulticell, Html, Rst
import assets
@fixture
def checklist():
s1 = Section(
"First section",
"A",
... |
tests/test_vlrs.py | CCInc/laspy | 240 | 9590194 | <reponame>CCInc/laspy<filename>tests/test_vlrs.py
from pathlib import Path
import pytest
import laspy
from tests import test_common
def test_adding_classification_lookup():
simple = laspy.read(test_common.simple_las)
classification_lookup = laspy.vlrs.known.ClassificationLookupVlr()
assert len(classifi... |
exercises/practice/grade-school/.meta/example.py | samr1ddh1/python-1 | 1,177 | 9590201 | from collections import defaultdict
class School:
def __init__(self):
self.db = {}
self.add = []
def added(self):
result = self.add[:]
self.add = []
return result
def add_student(self, name, grade):
if not self.db.get(name, 0):
self.db[name] =... |
Configuration/Generator/python/Pythia6CUEP6S1Settings_cfi.py | ckamtsikis/cmssw | 852 | 9590205 | import FWCore.ParameterSet.Config as cms
pythia6CUEP6S1SettingsBlock = cms.PSet(
pythia6CUEP6S1Settings = cms.vstring('MSTU(21)=1 ! Check on possible errors during program execution',
'MSTJ(22)=2 ! Decay those unstable particles',
'PARJ(71)=10 . ! for which ctau 10 mm',
... |
src/browser/test/test_repo_views.py | RogerTangos/datahub-stub | 192 | 9590220 | <reponame>RogerTangos/datahub-stub<filename>src/browser/test/test_repo_views.py
import os
from mock import patch
import factory
from django.db.models import signals
from django.test import TestCase
from django.core.urlresolvers import resolve
from django.contrib.auth.models import User
import browser.views
class C... |
data/datasets/classification/imagenet.py | apple/ml-cvnets | 209 | 9590222 | <gh_stars>100-1000
#
# For licensing see accompanying LICENSE file.
# Copyright (C) 2022 Apple Inc. All Rights Reserved.
#
from torchvision.datasets import ImageFolder
from typing import Optional, Tuple, Dict, List, Union
import torch
import argparse
from utils import logger
from .. import register_dataset
from ..da... |
CommitMessages/custom_newline.py | halcyondude/datasets | 283 | 9590235 | class CustomNewlineReader:
def __init__(self, fileobj, newline):
self.fileobj = fileobj
if len(newline) != 1:
raise ValueError("newline must be exactly one character long")
self.newline = newline
self.buffer_size = 1 << 18
self._chunks = []
def __enter__(self... |
examples/CSCI-4968-MBE/challenges/crackme0x02/solve.py | Alex97/angr-doc | 833 | 9590247 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Author: <NAME> <<EMAIL>>
# Modern Binary Exploitation
# http://security.cs.rpi.edu/courses/binexp-spring2015/
import angr
FIND_ADDR = 0x0804845f # Statement right after the OK printf.
AVOID_ADDR = 0x08048461 # dword [esp] = str.Invalid_Password__n ; [0x804857f:4]=0x61... |
lib/tool_shed/webapp/model/migrate/versions/0013_add_review_tables.py | rhpvorderman/galaxy | 1,085 | 9590252 | <gh_stars>1000+
"""
Migration script to add the repository_review, component_review and component tables and the Repository Reviewer group and role.
"""
import datetime
import logging
import sys
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
# Need our custom types, but ... |
gimp-plugins/colorpalette.py | sunlin7/GIMP-ML | 1,077 | 9590264 | <reponame>sunlin7/GIMP-ML
import os
baseLoc = os.path.dirname(os.path.realpath(__file__)) + '/'
from gimpfu import *
import sys
sys.path.extend([baseLoc + 'gimpenv/lib/python2.7', baseLoc + 'gimpenv/lib/python2.7/site-packages',
baseLoc + 'gimpenv/lib/python2.7/site-packages/setuptools'])
import cv2
i... |
libs/configs/DOTA2.0/fcos/cfgs_res50_dota2.0_fcos_v1.py | Artcs1/RotationDetection | 850 | 9590282 | <filename>libs/configs/DOTA2.0/fcos/cfgs_res50_dota2.0_fcos_v1.py
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import numpy as np
from libs.configs._base_.models.retinanet_r50_fpn import *
from libs.configs._base_.datasets.dota_detection import *
from libs.configs._base_.sc... |
tests/test_attacks.py | iArunava/scratchai | 101 | 9590286 | import scratchai
import torch
import torch.nn as nn
import unittest
import requests
import zipfile
import io
import numpy as np
from torchvision import models, transforms
from PIL import Image
from inspect import isfunction
import matplotlib.pyplot as plt
from scratchai import *
NOISE = 'noise'
SEMANTIC = 'semantic'
... |
models/Models.py | PorscheTan/Siam-NestedUNet | 122 | 9590287 | <filename>models/Models.py<gh_stars>100-1000
# <NAME>
# https://github.com/likyoo
#
import torch.nn as nn
import torch
class conv_block_nested(nn.Module):
def __init__(self, in_ch, mid_ch, out_ch):
super(conv_block_nested, self).__init__()
self.activation = nn.ReLU(inplace=True)
self.conv1... |
Scripts/Web_Scrappers/Google Search Using Python/code.py | ShivangiPatel102/Python_and_the_Web | 437 | 9590299 | <gh_stars>100-1000
# We will be using the search() function from the googlesearch module.
from googlesearch import search
def query_finder(query):
for item in search(query, tld="co.in", num=10, stop=10, pause=2):
print(item)
if __name__ == "__main__":
query = input(
"Enter your query : "
... |
modules/ducktests/tests/ignitetest/services/utils/ducktests_service.py | vvteplygin/ignite | 4,339 | 9590300 | # 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 use ... |
ssseg/modules/models/segmentors/dmnet/__init__.py | zhizhangxian/sssegmentation | 411 | 9590350 | <filename>ssseg/modules/models/segmentors/dmnet/__init__.py
'''initialize'''
from .dmnet import DMNet
from .dcm import DynamicConvolutionalModule |
tests/common/plugins/conditional_mark/issue.py | lolyu/sonic-mgmt | 132 | 9590382 | """For checking issue state based on supplied issue URL.
"""
import logging
import multiprocessing
import os
import re
import yaml
import requests
from abc import ABCMeta, abstractmethod
logger = logging.getLogger(__name__)
CREDENTIALS_FILE = 'credentials.yaml'
class IssueCheckerBase(object):
"""Base class fo... |
ch04/4.2.2.1.py | AaronZhengkk/SpiderBook | 990 | 9590402 | #coding:utf-8
import re
# 将正则表达式编译成Pattern对象
pattern = re.compile(r'\d+')
# 使用re.match匹配文本,获得匹配结果,无法匹配时将返回None
result1 = re.match(pattern,'192abc')
if result1:
print result1.group()
else:
print '匹配失败1'
result2 = re.match(pattern,'abc192')
if result2:
print result2.group()
else:
print '匹配失败2'
|
graphql/core/language/location.py | gabriel-laet/graphql-py | 118 | 9590421 | <filename>graphql/core/language/location.py<gh_stars>100-1000
from collections import namedtuple
__all__ = ['get_location', 'SourceLocation']
SourceLocation = namedtuple('SourceLocation', 'line column')
def get_location(source, position):
lines = source.body[:position].splitlines()
if lines:
line = ... |
wakatime/packages/ntlm_auth/des_c.py | Anton-Latukha/wakatime | 1,198 | 9590427 | <gh_stars>1000+
# This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/
# Copyright 2001 <NAME> <<EMAIL>>
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software F... |
vardbg/output/video_writer/config.py | Mu-L/vardbg | 946 | 9590433 | import collections.abc
from pathlib import Path
import toml
from pygments.formatter import Formatter
from pygments.styles.monokai import MonokaiStyle
from pygments.token import Token
FILE_PATH = Path(__file__).parent
ASSETS_PATH = FILE_PATH / ".." / ".." / "assets"
DEFAULT_CFG_PATH = FILE_PATH / "default_config.toml"... |
剑指offer/31_GreatestSumOfSubarrays(连续子数组最大和).py | PegasusWang/python_data_structures_and_algorithms | 2,468 | 9590447 | """
面试题31:连续子数组的最大和
题目:输入一个整型数组,数组里有正数也有负数。数组中一个或连续的多个整数组成一个子数组。
求所有子数组的和的最大值。 要求时间复杂度为O(n)。
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanation: [4,-1,2,1] has the larg... |
data/transcoder_evaluation_gfg/python/UGLY_NUMBERS.py | mxl1n/CodeGen | 241 | 9590454 | <gh_stars>100-1000
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( n ) :
ugly = [ 0 ] * n
ugly [ 0 ] = 1
i2 = i3 = i5 = 0
next_multiple_of_2 = 2
... |
revise/libs/python/pyste/src/Pyste/EnumExporter.py | DD-L/deel.boost.python | 198 | 9590476 | # Copyright <NAME> 2003. Use, modification and
# distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
from Exporter import Exporter
from settings import *
import utils
#===============================... |
alex/applications/PublicTransportInfoCS/test_hdc_policy.py | oplatek/alex | 184 | 9590485 | # encoding: utf8
from unittest import TestCase
import alex.applications.PublicTransportInfoCS.hdc_policy as hdc_policy
from alex.utils.config import Config, as_project_path
import alex.applications.PublicTransportInfoCS.directions as directions
import alex.utils
from alex.components.dm.dddstate import DeterministicD... |
sdk/python/pulumi_azure/management/lock.py | henriktao/pulumi-azure | 109 | 9590491 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
covid_19/legacy/seir_bayes.py | ramonfontes/Mathematical-and-Statistical-Modeling-of-COVID19-in-Brazil | 248 | 9590503 | <filename>covid_19/legacy/seir_bayes.py
import pandas as pd
import numpy as np
import numpy.random as npr
from scipy.stats import norm, expon
import matplotlib.pyplot as plt
import dask.bag as db
DEFAULT_PARAMS = {
'fator_subr': 40.0,
# these are 95% confidence intervals
# for a lognormal
'gamma': (7.... |
climpred/relative_entropy.py | rom-py/climpred | 104 | 9590508 | <reponame>rom-py/climpred<gh_stars>100-1000
import warnings
import numpy as np
import xarray as xr
try:
from eofs.xarray import Eof
except ImportError:
Eof = None
def _relative_entropy_formula(sigma_b, sigma_x, mu_x, mu_b, neofs):
"""
Compute the relative entropy formula given in Branstator and Teng... |
api/curve/v1/test/data_test.py | QiliangFan/Baidu-Curve | 478 | 9590519 | <reponame>QiliangFan/Baidu-Curve
# -*- coding: utf-8 -*-
"""
Testing
~~~~
data operation test
:copyright: (c) 2017-2018 by Baidu, Inc.
:license: Apache, see LICENSE for more details.
"""
import uuid
from .base import IcurveTestCase, StringIO
class DataTestCase(IcurveTestCase):
"""
data o... |
CommonTools/ParticleFlow/python/ParticleSelectors/pfSelectedPhotons_cfi.py | ckamtsikis/cmssw | 852 | 9590542 | <filename>CommonTools/ParticleFlow/python/ParticleSelectors/pfSelectedPhotons_cfi.py
import FWCore.ParameterSet.Config as cms
#FIXME: It needs to be in the chain of Top projector: for example, src=pfNoElectron
pfSelectedPhotons = cms.EDFilter(
"GenericPFCandidateSelector",
src = cms.InputTag("pfAllPhotons"),
... |
general/recording-and-playing-audio/audio_player_pydub.py | caesarcc/python-code-tutorials | 1,059 | 9590567 | from pydub import AudioSegment
from pydub.playback import play
import sys
# read MP3 file
song = AudioSegment.from_mp3(sys.argv[1])
# song = AudioSegment.from_wav("audio_file.wav")
# you can also read from other formats such as MP4
# song = AudioSegment.from_file("audio_file.mp4", "mp4")
play(song)
|
huey/tests/test_signals.py | qyqx233/huey | 3,676 | 9590572 | import datetime
from huey.signals import *
from huey.tests.base import BaseTestCase
class TestSignals(BaseTestCase):
def setUp(self):
super(TestSignals, self).setUp()
self._state = []
@self.huey.signal()
def signal_handle(signal, task, *args):
self._state.append((sign... |
tools/c7n_gcp/tests/test_logging.py | al3pht/cloud-custodian | 2,415 | 9590613 | # Copyright The Cloud Custodian Authors.
# SPDX-License-Identifier: Apache-2.0
from googleapiclient.errors import HttpError
from gcp_common import BaseTest, event_data
class LogProjectSinkTest(BaseTest):
def test_query(self):
project_id = 'cloud-custodian'
factory = self.replay_flight_data('log... |
styleguide/urls.py | mepsd/CLAC | 126 | 9590632 | from django.conf.urls import url, include
from . import (
views, ajaxform_example, date_example, radio_checkbox_example,
email_examples, fullpage_example
)
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^docs/$', views.docs, name='docs'),
url(r'^fullpage-example/' + fullpage_example... |
menpo/test/test_lazylist.py | apapaion/menpo | 311 | 9590649 | <reponame>apapaion/menpo
import collections.abc as collections_abc
from unittest.mock import Mock
import numpy as np
from pytest import raises
from menpo.base import LazyList
def test_lazylist_get():
mock_func = Mock()
mock_func.return_value = 1
ll = LazyList([mock_func] * 10)
assert len(ll) == 10
... |
tests/terraform/checks/resource/gcp/test_GoogleFolderMemberDefaultServiceAccount.py | antonblr/checkov | 4,013 | 9590656 | <reponame>antonblr/checkov
import unittest
import hcl2
from checkov.terraform.checks.resource.gcp.GoogleFolderMemberDefaultServiceAccount import check
from checkov.common.models.enums import CheckResult
class TestGoogleFolderMemberDefaultServiceAccount(unittest.TestCase):
def test_failure_binding(self):
... |
calvin/actorstore/systemactors/net/UDPListener.py | gabrielcercel/calvin-base | 334 | 9590667 | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... |
tests/process_test_set.py | comptonben/spur.py | 217 | 9590671 | <gh_stars>100-1000
# coding=utf8
import errno
import io
import time
import signal
import functools
import posixpath
from nose.tools import istest, nottest, assert_equal, assert_not_equal, assert_raises, assert_true
import spur
__all__ = ["ProcessTestSet"]
@nottest
def test(test_func):
@functools.wraps(test_f... |
imapfw/controllers/fake.py | paralax/imapfw | 492 | 9590702 | <reponame>paralax/imapfw
# The MIT License (MIT).
# Copyright (c) 2015, <NAME> & contributors.
from imapfw.types.folder import Folders, Folder
from imapfw.types.message import Messages, Message
from .controller import Controller
class FakeDriver(Controller):
conf = None
ImapConf = {
'folders': [b'... |
configs/resnest/cascade_rcnn_s101_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py | evgps/mmdetection_trashcan | 367 | 9590709 | _base_ = './cascade_rcnn_s50_fpn_syncbn-backbone+head_mstrain-range_1x_coco.py'
model = dict(
pretrained='open-mmlab://resnest101',
backbone=dict(stem_channels=128, depth=101))
|
jike/qr_code.py | waysup/Jike-Metro | 193 | 9590721 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
QR code that be scanned to allow login
"""
import qrcode
import tempfile
import webbrowser
from decimal import Decimal
from qrcode.image.svg import SvgImage
from .constants import JIKE_URI_SCHEME_FMT, RENDER2BROWSER_HTML_TEMPLATE
def make_qrcode(uuid, render_choice='br... |
torch/nn/quantized/dynamic/modules/rnn.py | jsun94/nimble | 206 | 9590799 | import numbers
import warnings
import torch
import torch.nn as nn
from torch import Tensor # noqa: F401
from torch._jit_internal import Tuple, Optional, List, Union, Dict # noqa: F401
from torch.nn.utils.rnn import PackedSequence
from torch.nn.quantized.modules.utils import _quantize_weight
def apply_permutation(te... |
rplugin/python3/denite/source/help.py | gamoutatsumi/denite.nvim | 2,249 | 9590848 | <gh_stars>1000+
# ============================================================================
# FILE: help.py
# AUTHOR: <NAME> <<EMAIL> at <EMAIL>>
# License: MIT license
# ============================================================================
from os import sep
from pathlib import Path
from pynvim import Nvim
... |
tests/test_gcs.py | karthik20122001/docker-python | 2,030 | 9590857 | <reponame>karthik20122001/docker-python
import unittest
from unittest.mock import Mock
from kaggle_gcp import KaggleKernelCredentials, init_gcs
from test.support import EnvironmentVarGuard
from google.cloud import storage
def _make_credentials():
import google.auth.credentials
return Mock(spec=google.auth.cr... |
examples/misc/djangoweb/media/HTMLDialog.py | takipsizad/pyjs | 739 | 9590858 | from pyjamas.ui.HTML import HTML
from pyjamas.ui.Button import Button
from pyjamas.ui.HTMLPanel import HTMLPanel
from pyjamas.ui.DockPanel import DockPanel
from pyjamas.ui.ScrollPanel import ScrollPanel
from pyjamas.ui.DialogBox import DialogBox
from pyjamas.ui import HasAlignment
class HTMLDialog(DialogBox):
def ... |
WebMirror/management/rss_parser_funcs/feed_parse_extractGuhehe.py | fake-name/ReadableWebProxy | 193 | 9590881 | <gh_stars>100-1000
def extractGuhehe(item):
"""
# guhehe.TRANSLATIONS
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'ShominSample' in item['tags']:
return buildReleaseMessageWithType(item, 'Ore ga Ojou-s... |
algorithm/binary_search_examples.py | ganeshskudva/Algorithm_Templates | 190 | 9590897 | import bisect
# [367] https://leetcode.com/problems/valid-perfect-square/
# Given a positive integer num, write a function which returns True if num is a perfect square else False.
#
# standard scenario
def is_perfect_square(num: 'int') -> 'bool':
low, high = 1, num // 2
while low <= high:
mid = low +... |
cacreader/swig-4.0.2/Examples/test-suite/python/preproc_runme.py | kyletanyag/LL-Smartcard | 1,031 | 9590944 | <gh_stars>1000+
import preproc
if preproc.endif != 1:
raise RuntimeError
if preproc.define != 1:
raise RuntimeError
if preproc.defined != 1:
raise RuntimeError
if 2 * preproc.one != preproc.two:
raise RuntimeError
if preproc.methodX(99) != 199:
raise RuntimeError
t1 = preproc.tcxMessageTest()
... |
dac/create_demos.py | deepneuralmachine/google-research | 23,901 | 9590957 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
Lib/test/test_compiler/testcorpus/80_func_kwonlyargs2.py | diogommartins/cinder | 1,886 | 9590977 | <reponame>diogommartins/cinder
def foo(z, *y, x=1, **c):
a
|
tools/profiling/microbenchmarks/bm_diff/bm_build.py | warlock135/grpc | 36,552 | 9590982 | <reponame>warlock135/grpc
#!/usr/bin/env python3
#
# Copyright 2017 gRPC 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... |
test/test.py | Datatope/mod_python | 183 | 9590998 | #
# Copyright (C) 2000, 2001, 2013 <NAME>
# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Apache Software 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... |
cfripper/rules/kms_key_wildcard_principal.py | lpmi-13/cfripper | 360 | 9591010 | <reponame>lpmi-13/cfripper<filename>cfripper/rules/kms_key_wildcard_principal.py
__all__ = ["KMSKeyWildcardPrincipalRule"]
import logging
import re
from typing import Dict, Optional
from pycfmodel.model.cf_model import CFModel
from pycfmodel.model.resources.kms_key import KMSKey
from cfripper.model.enums import RuleG... |
test/test_check.py | dstansby/asv | 476 | 9591011 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import re
import pytest
from asv import util
from . import tools
from .test_dev import basic_conf
def test_check(cap... |
wo/core/addswap.py | dacsec-org/WordOps | 902 | 9591016 | """WordOps Swap Creation"""
import os
import psutil
from wo.core.aptget import WOAptGet
from wo.core.fileutils import WOFileUtils
from wo.core.logging import Log
from wo.core.shellexec import WOShellExec
class WOSwap():
"""Manage Swap"""
def __init__():
"""Initialize """
pass
def add(s... |
sarpy/io/complex/sicd_elements/SCPCOA.py | ngageoint/sarpy | 119 | 9591020 | <filename>sarpy/io/complex/sicd_elements/SCPCOA.py
"""
The SCPCOAType definition.
"""
__classification__ = "UNCLASSIFIED"
__author__ = "<NAME>"
import logging
import numpy
from numpy.linalg import norm
from sarpy.io.xml.base import Serializable
from sarpy.io.xml.descriptors import StringEnumDescriptor, FloatDescri... |
nodes/0.9.x/python/FamilyInstance.RemoveCoping.py | jdehotin/Clockworkfordynamo | 147 | 9591047 | <gh_stars>100-1000
import clr
import System
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocume... |
selfdrive/dragonpilot/otisserv.py | matt12eagles/dragonpilot | 251 | 9591048 | <filename>selfdrive/dragonpilot/otisserv.py
#!/usr/bin/env python3.8
# The MIT License
#
# Copyright (c) 2019-, <NAME>, dragonpilot community, and a number of other of contributors.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (th... |
src/awkward/_v2/operations/structure/concatenate.py | scikit-hep/awkward-1.0 | 519 | 9591066 | <reponame>scikit-hep/awkward-1.0<gh_stars>100-1000
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
from __future__ import absolute_import
import awkward as ak
np = ak.nplike.NumpyMetadata.instance()
# @ak._connect._numpy.implements("concatenate")
def concatenate(
arrays,... |
pyNastran/bdf/bdf_interface/subcase_cards_int.py | ACea15/pyNastran | 293 | 9591079 | <reponame>ACea15/pyNastran<gh_stars>100-1000
from pyNastran.bdf.bdf_interface.subcase_cards import IntCard
class ADACT(IntCard):
type = 'ADACT'
#def __init__(self, value):
#super().__init__(value)
class ADAPT(IntCard):
type = 'ADAPT'
#def __init__(self, value):
#super().__init__(value... |
tools/bin/pythonSrc/pexpect-4.2/tests/test_log.py | YangHao666666/hawq | 2,132 | 9591089 | <reponame>YangHao666666/hawq
#!/usr/bin/env python
'''
PEXPECT LICENSE
This license is approved by the OSI and FSF as GPL-compatible.
http://opensource.org/licenses/isc-license.txt
Copyright (c) 2012, <NAME> <<EMAIL>>
PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
PUR... |
rendering_example.py | BigDataHa/Nonlinear_Face_3DMM | 565 | 9591098 | from utils import *
from rendering_ops import *
import tensorflow as tf
import numpy as np
VERTEX_NUM = 53215
def main(_):
batch_size = 16
output_size = 224
texture_size = [192, 224]
mDim = 8
vertexNum = VERTEX_NUM
channel_num = 3
data = np.load('sample_data.npz')
gpu_options = tf.... |
learning_rates.py | Blind-Aid/sentiment-discovery | 1,093 | 9591105 | from torch.optim.lr_scheduler import _LRScheduler
import math
class LinearLR(_LRScheduler):
"""
A scheduler for linear learning rate decay to 0 over a specified number of steps.
Args:
optimizer (Optimizer): Wrapped optimizer.
max_iters (int): Period of learning rate decay. When last_iter==m... |
src/genie/libs/parser/asa/show_crypto_ikev2_sa.py | balmasea/genieparser | 204 | 9591108 | <reponame>balmasea/genieparser
"""
show_crypto_ikev2_sa.py
Parser for the following command:
* show crypto ikev2 sa
"""
import re
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import (Schema, Any, Optional)
class ShowCryptoIkev2SaSchema(MetaParser):
"""Schema for
* s... |
model-optimizer/mo/ops/pooling.py | monroid/openvino | 2,406 | 9591122 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from mo.front.common.partial_infer.utils import tf_window_op_pad_infer, int64_array, float_array, shape_array, \
dynamic_dimension_value, dynamic_dimension
from mo.front.onnx.extractors.utils import get_backend_pa... |
setup.py | comptonben/spur.py | 217 | 9591159 | #!/usr/bin/env python
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='spur',
version='0.3.22',
description='Run commands and manipulate files locally or over SSH using the same interface',
long_description=rea... |
tests/integration/concurrent_clients/test_concurrent_clients.py | vishalbelsare/jina | 15,179 | 9591170 | import pytest
from jina import Flow, Executor, Client, requests, DocumentArray, Document
from jina.types.request import Response
import threading
import random
import time
from functools import partial
class MyExecutor(Executor):
@requests(on='/ping')
def ping(self, docs: DocumentArray, **kwargs):
ti... |
pytorch_sift.py | ducha-aiki/pytorch-sift | 149 | 9591173 | <filename>pytorch_sift.py
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
def getPoolingKernel(kernel_size = 25):
half_size = float(kernel_size)/2.0
xc2 = []
for i in range(kernel_size):
xc2.append(half_size - abs(float(i)+0.5-half_size))
xc2 = ... |
alipay/aop/api/response/AlipayEbppProdmodeAgreementUploadResponse.py | snowxmas/alipay-sdk-python-all | 213 | 9591179 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayEbppProdmodeAgreementUploadResponse(AlipayResponse):
def __init__(self):
super(AlipayEbppProdmodeAgreementUploadResponse, self).__init__()
self._is_success = No... |
checkov/terraform/module_loading/registry.py | niradler/checkov | 4,013 | 9591185 | <reponame>niradler/checkov<gh_stars>1000+
import logging
import os
import hashlib
from typing import Optional, List, TYPE_CHECKING, Set
from checkov.common.util.consts import DEFAULT_EXTERNAL_MODULES_DIR
from checkov.terraform.module_loading.content import ModuleContent
if TYPE_CHECKING:
from checkov.terraform.mo... |
src/tests/base/test_taxrules.py | fabm3n/pretix | 1,248 | 9591194 | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free... |
src/amuse/test/suite/ext_tests/test_sink.py | rknop/amuse | 131 | 9591217 | <filename>src/amuse/test/suite/ext_tests/test_sink.py
import numpy
from amuse.test.amusetest import TestCase
from amuse.support.exceptions import AmuseWarning, AmuseException
from amuse.units import units, nbody_system, generic_unit_system, quantities
from amuse.units.generic_unit_converter import ConvertBetweenGeneri... |
tests/unit/bokeh/core/property/test_nullable.py | TheLaw1337/bokeh | 15,193 | 9591266 | <filename>tests/unit/bokeh/core/property/test_nullable.py
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------... |
h2o-py/tests/testdir_algos/gam/pyunit_PUBDEV_7367_gridsearch_specific.py | vishalbelsare/h2o-3 | 6,098 | 9591273 | from __future__ import division
from __future__ import print_function
from past.utils import old_div
import sys
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
from h2o.grid.grid_search import H2OGridSearch
# In this test, we chec... |
packages/pyright-internal/src/tests/samples/overload7.py | debonte/pyright | 3,934 | 9591276 | # This sample tests the verification that overload implementation signatures
# are a superset of their associated overload signatures.
from typing import (
Any,
Awaitable,
Callable,
Dict,
Generic,
Iterable,
List,
Literal,
NoReturn,
Optional,
ParamSpec,
Protocol,
Tupl... |
tensorflow_privacy/privacy/estimators/binary_class_head_test.py | amad-person/privacy | 2,327 | 9591278 | # Copyright 2020, The TensorFlow 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 applicable law or agreed t... |
adminlteui/__init__.py | tyagonunes/ohana | 249 | 9591282 | version = '1.5.1'
default_app_config = 'adminlteui.apps.AdminlteUIConfig'
|
examples/wide_and_deep_dataset/reader.py | sandyhouse/FleetX | 170 | 9591331 | import paddle
import paddle.distributed.fleet as fleet
import os
import sys
cont_min_ = [0, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
cont_max_ = [20, 600, 100, 50, 64000, 500, 100, 50, 500, 10, 10, 10, 50]
cont_diff_ = [20, 603, 100, 50, 64000, 500, 100, 50, 500, 10, 10, 10, 50]
hash_dim_ = 1000001
continuous_range_ = ran... |
CircuitPython_Templates/capacitive_touch_LED_control/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 9591351 | <filename>CircuitPython_Templates/capacitive_touch_LED_control/code.py
# SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
# SPDX-License-Identifier: Unlicense
"""
CircuitPython Touch Input Example - Blinking an LED using a capacitive touch pad.
This example is meant for boards that have capacitive touch pad... |
docs/conf.py | MBKayro/kolibri | 545 | 9591380 | # -*- coding: utf-8 -*-
#
# Kolibri 'developer docs' build configuration file
#
# This file is execfile()d with the current directory set to its containing dir.
import inspect
import os
import sys
from datetime import datetime
import django
from django.utils.encoding import force_text
from django.utils.html import str... |
cinder/zonemanager/drivers/fc_zone_driver.py | lightsey/cinder | 571 | 9591384 | # (c) Copyright 2014 Brocade Communications Systems Inc.
# All Rights Reserved.
#
# Copyright 2014 OpenStack 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
#
# ... |
integration_tests/tests/forseti/scripts/update_server_config.py | aarontp/forseti-security | 921 | 9591400 | # 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 agreed to in writing, ... |
tools/stereo_rectify.py | Kitware/VAIME | 127 | 9591454 | #!/usr/bin/env python
"""ckwg +29
* Copyright 2019 by Kitware, 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 code must retain the above copyright no... |
src/tests/test_utils.py | josephbajor/triage_NN | 160 | 9591460 | <gh_stars>100-1000
import datetime
import unittest
from triage.util.conf import convert_str_to_relativedelta, parse_delta_string
class test_convert_str_to_relativedelta(unittest.TestCase):
def test_valid_input(self):
date = datetime.datetime(2016, 1, 1, 0, 0)
for test in (
{
... |
backend/src/subscriber/processing/user/query.py | rutvikpadhiyar000/github-trends | 157 | 9591481 | from datetime import date, timedelta
from typing import Optional
import requests
from src.constants import BACKEND_URL, DOCKER, LOCAL_PUBLISHER, PROD
from src.data.mongo.secret import update_keys
from src.data.mongo.user import lock_user, update_user_raw_data
from src.subscriber.aggregation import get_user_data
from ... |
Python3/1150.py | rakhi2001/ecom7 | 854 | 9591485 | __________________________________________________________________________________________________
class Solution:
def isMajorityElement(self, nums: List[int], target: int) -> bool:
occur = sum(x == target for x in nums)
return occur > len(nums) // 2
_________________________________________________... |
REL/mulrel_ranker.py | theblackcat102/REL | 210 | 9591503 | <filename>REL/mulrel_ranker.py
import numpy as np
import torch
import torch.nn.functional as F
from torch.autograd import Variable
"""
PreRank class is used for preranking entities for a given mention by multiplying entity vectors with
word vectors
"""
class PreRank(torch.nn.Module):
def __init__(sel... |
tests/libs/build_api_v2_test.py | covid-projections/covid-data-model | 155 | 9591515 | import datetime
import pytest
import structlog
from covidactnow.datapublic.common_fields import DemographicBucket
from covidactnow.datapublic.common_fields import CommonFields
from api.can_api_v2_definition import Actuals
from api.can_api_v2_definition import FieldAnnotations
from api.can_api_v2_definition import Fie... |
src/gamesbyexample/checkers.py | Hacker-Boy9999/PythonStdioGames | 736 | 9591516 | <reponame>Hacker-Boy9999/PythonStdioGames
"""Checkers, by <NAME> <EMAIL>
The classic checkers board game. In this version, capturing is mandatory
and if you are blocked from moving, you lose.
This and other games are available at https://nostarch.com/XX
Tags: extra-large, board game, game, two-player"""
__version__ = 0... |
examples/digit-recognizer/dataset.py | sUeharaE4/mlcomp | 166 | 9591518 | <reponame>sUeharaE4/mlcomp
import pandas as pd
import numpy as np
from torch.utils.data import Dataset
class MnistDataset(Dataset):
def __init__(
self,
file: str,
fold_csv: str = None,
fold_number: int = 0,
is_test: bool = False,
max_count: int = None,
tran... |
lib/pymedphys/_trf/decode/delivery.py | ethanio12345/pymedphys | 207 | 9591524 | <gh_stars>100-1000
# Copyright (C) 2018 Cancer Care Associates
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.