max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
sky/crawler/crawl.py | amititash/sky | 325 | 142884 | #!/usr/bin/env python3
from __future__ import annotations
"""A simple web crawler -- main driver program."""
import asyncio
import logging
import sys
import os
from sky.crawler.crawling import Crawler
from sky.crawler.reporting import report
def get_config(config, loop) -> object:
for i in range(len(config["se... | 4 | 1 | 0 | 0 | 5 | 0 |
dragonfly/opt/unittest_euclidean_multiobjective_gp_bandit.py | hase1128/dragonfly | 675 | 142910 | <gh_stars>100-1000
"""
Unit tests for multi-objective optimisation using GP Bandits.
-- <EMAIL>
"""
import unittest
from . import multiobjective_gp_bandit
from .unittest_euclidean_random_multiobjective_optimiser import \
EuclideanMultiObjectiveOptimiserBaseTestCase
from ..utils.base_test_class import BaseTestCla... | 0 | 0 | 0 | 0 | 0 | 0 |
vulnerabilities/migrations/0002_add_patched_package.py | bhuvi11/vulnerablecode | 257 | 142929 | # Generated by Django 3.0.13 on 2021-04-04 06:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("vulnerabilities", "0001_initial"),
]
operations: list[object] = [
migrations.AddFie... | 0 | 0 | 2 | 0 | 2 | 0 |
Bokeh/bubble_plot.py | NoonienSoong/Data-Science-45min-Intros | 1,406 | 142939 | <filename>Bokeh/bubble_plot.py
from collections import OrderedDict
import pandas as pd
import numpy as np
from jinja2 import Template
from bokeh.embed import components
from bokeh.models import (
ColumnDataSource, Plot, Circle, Range1d,
LinearAxis, HoverTool, Text,
SingleIntervalTicker, Slider, Callback
)... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/number-of-lines-to-write-string.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 142944 | # Time: O(n)
# Space: O(1)
class Solution(object):
def numberOfLines(self, widths, S) -> object:
"""
:type widths: List[int]
:type S: str
:rtype: List[int]
"""
result = [1, 0]
for c in S:
w = widths[ord(c)-ord('a')]
result[1] += w
... | 0 | 1 | 0 | 0 | 1 | 0 |
blocks/bricks/recurrent/__init__.py | KIKOcaoyue/blocks | 1,067 | 142955 | <filename>blocks/bricks/recurrent/__init__.py<gh_stars>1000+
from .base import BaseRecurrent, recurrent
from .architectures import SimpleRecurrent, LSTM, GatedRecurrent
from .misc import Bidirectional, RecurrentStack, RECURRENTSTACK_SEPARATOR
__all__ = ("BaseRecurrent", "recurrent", "SimpleRecurrent", "LSTM",
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/admin/clush-tests/TaskDistantPdshMixin.py | utdsimmons/ohpc | 692 | 142956 | <reponame>utdsimmons/ohpc
#!/usr/bin/env python
# ClusterShell (distant, pdsh worker) test suite
# Written by <NAME>
"""Unit test for ClusterShell Task (distant, pdsh worker)"""
import copy
import shutil
import sys
sys.path.insert(0, '../lib')
from TLib import HOSTNAME, make_temp_filename, make_temp_dir
from Clust... | 0 | 0 | 0 | 0 | 0 | 0 |
setup.py | VivumLab/py_cui | 654 | 142985 | import setuptools
from sys import platform
# Use README for long description
with open('README.md', 'r') as readme_fp:
long_description = readme_fp.read()
with open('requirements.txt', 'r') as req_fp:
required_libs = req_fp.readlines()
# py_cui setup
setuptools.setup(
name='py_cui',
description='A w... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integ/test_concurrent_insert.py | jurecuhalev/snowflake-connector-python | 311 | 143007 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Snowflake Computing Inc. All rights reserved.
#
from concurrent.futures.thread import ThreadPoolExecutor
from logging import getLogger
import pytest
import snowflake.connector
from snowflake.connector.errors import ProgrammingError
try:
f... | 0 | 1 | 0 | 0 | 1 | 0 |
wafhelpers/rtems_trace.py | fakecoinbase/ntpsecslashntpsec | 201 | 143010 | <reponame>fakecoinbase/ntpsecslashntpsec
from waflib.TaskGen import feature, after_method
@feature("rtems_trace")
@after_method('apply_link')
def rtems_trace(self):
if self.env.RTEMS_TEST_ENABLE:
self.link_task.env.LINK_CC = self.env.BIN_RTEMS_TLD \
+ self.env.RTEMS_TEST_FLAGS + ['--']
| 0 | 0 | 0 | 0 | 0 | 0 |
win-client/src/external/nanogui/icons/materialicons/util/gen_icon_symbols.py | keshon/samuno | 157 | 143021 | <gh_stars>100-1000
import os
success = False
with open("../materialicons.go", "w") as output:
output.write("""package materialicons
import "github.com/shibukawa/nanogui.go"
// generated by util/gen_icon_symbols.py
const (
""")
for line in open("./codepoints").readlines():
name, codepoint = line.spl... | 0 | 0 | 0 | 0 | 0 | 0 |
test/tests/api-cit/v2_0/skupack_tests.py | arunrordell/RackHD | 451 | 143031 | <filename>test/tests/api-cit/v2_0/skupack_tests.py
"""
Copyright (c) 2016-2017 Dell Inc. or its subsidiaries. All Rights Reserved.
"""
import fit_path # NOQA: unused import
import fit_common
import time
import requests
import tarfile
import shutil
import os
import flogging
from config.api2_0_config import config
from... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/simple/server.py | khadas/android_external_python_pyopenssl | 5,079 | 143039 | <reponame>khadas/android_external_python_pyopenssl
# -*- coding: latin-1 -*-
#
# Copyright (C) AB Strakt
# Copyright (C) <NAME>
# See LICENSE for details.
"""
Simple echo server, using nonblocking I/O
"""
from __future__ import print_function
import os
import select
import socket
import sys
from OpenSSL import SSL,... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_estimators/test_randomregressor.py | lahdjirayhan/scikit-lego | 784 | 143042 | import numpy as np
import pytest
from sklego.common import flatten
from sklego.dummy import RandomRegressor
from tests.conftest import nonmeta_checks, regressor_checks, general_checks, select_tests
@pytest.mark.parametrize(
"test_fn",
select_tests(
flatten([general_checks, nonmeta_checks, regressor_c... | 0 | 0 | 0 | 0 | 0 | 0 |
django_quicky/context_processors.py | sametmax/django-quicky | 149 | 143043 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from django.views.debug import get_safe_settings
class SafeSettings(object):
"""
Map attributes to values in the safe settings dict
"""
def __init__(self):
self._settings = get_safe_settings()
def __getatt... | 0 | 2 | 0 | 0 | 2 | 0 |
HunterAdminApi/api/authentication/auth_module_factory.py | tt9133github/hunter | 322 | 143069 | <filename>HunterAdminApi/api/authentication/auth_module_factory.py
#!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://sec.zto.com/
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
src/connectors/cisco_umbrella.py | sfc-gh-kmaurya/SnowAlert | 144 | 143082 | <reponame>sfc-gh-kmaurya/SnowAlert
"""Cisco Umbrella
Collect Cisco Umbrella information using a Client ID and Secret
"""
from runners.helpers import db, log
from runners.helpers.dbconfig import ROLE as SA_ROLE
import requests
from datetime import datetime
from .utils import yaml_dump
PAGE_SIZE = 500
CONNECTION_OPT... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter9/listing9_3.py | hohsieh/osgeopy-code | 160 | 143083 | <reponame>hohsieh/osgeopy-code
# Script to extract a spatial subset from a raster.
import os
from osgeo import gdal
# Coordinates for the bounding box to extract.
vashon_ulx, vashon_uly = 532000, 5262600
vashon_lrx, vashon_lry = 548500, 5241500
# Don't forget to change the directory.
os.chdir(r'D:\osgeopy-data\Lands... | 0 | 0 | 0 | 0 | 0 | 0 |
preprocess/crop_image_sequences.py | ashish-roopan/fsgan | 599 | 143088 | <reponame>ashish-roopan/fsgan<gh_stars>100-1000
import os
import pickle
import numpy as np
import cv2
from fsgan.utils.bbox_utils import scale_bbox, crop_img
from fsgan.utils.video_utils import Sequence
def main(input_path, output_dir=None, cache_path=None, seq_postfix='_dsfd_seq.pkl', out_postfix='.jpg', resolution=... | 0 | 0 | 0 | 0 | 0 | 0 |
chaospy/distributions/collection/gamma.py | utsekaj42/chaospy | 333 | 143091 | """Gamma distribution."""
import numpy
from scipy import special
from ..baseclass import SimpleDistribution, ShiftScaleDistribution
class gamma(SimpleDistribution):
def __init__(self, a: int=1):
super(gamma, self).__init__(dict(a=a))
def _pdf(self, x, a) -> object:
return x**(a-1)*numpy.e**... | 6 | 7 | 0 | 0 | 13 | 0 |
modules/dataset.py | MeowTheCat/esrgan-tf2 | 101 | 143094 | <reponame>MeowTheCat/esrgan-tf2<filename>modules/dataset.py
import tensorflow as tf
def _parse_tfrecord(gt_size, scale, using_bin, using_flip, using_rot):
def parse_tfrecord(tfrecord):
if using_bin:
features = {
'image/img_name': tf.io.FixedLenFeature([], tf.string),
... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/script.py | jack1142/zxpy | 418 | 143100 | <gh_stars>100-1000
#! /usr/bin/env zxpy
~'echo Hello world!'
def print_file_count():
file_count = ~'ls -1 | wc -l'
~"echo -n 'file count is: '"
print(file_count)
print_file_count()
| 0 | 0 | 0 | 0 | 0 | 0 |
src/deep/custom_layers.py | DataForces/CV_LUNA | 207 | 143117 | import theano
import theano.tensor as T
import lasagne as nn
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
class SpatialDropoutLayer(Layer):
"""Spatial dropout layer
Sets whole filter activations to zero with probability p. See notes for
disabling dropout during testing.
Paramet... | 3 | 1 | 0 | 0 | 4 | 0 |
qcodes_contrib_drivers/drivers/ZurichInstruments/__init__.py | ThorstenGroh/Qcodes_contrib_drivers | 223 | 143139 | <filename>qcodes_contrib_drivers/drivers/ZurichInstruments/__init__.py
# empty __init__ file
| 0 | 0 | 0 | 0 | 0 | 0 |
cocos/scientific/kde.py | michaelnowotny/cocos | 101 | 143154 | #-------------------------------------------------------------------------------
#
# Define classes for (uni/multi)-variate kernel density estimation.
#
# Currently, only Gaussian kernels are implemented.
#
# Copyright 2004-2005 by Enthought, Inc.
#
# The code has been adapted by <NAME> to work with GPUs
# using C... | 46 | 29 | 5 | 0 | 80 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractLasciviousImouto.py | fake-name/ReadableWebProxy | 193 | 143168 | from __future__ import annotations
def extractLasciviousImouto(item) -> bool | object | None:
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'].replace('-', '.'))
if not (chp or vol) or 'preview' in item['title'].lower():
return None
if 'The Beast of the 17th District' in item['ta... | 0 | 1 | 0 | 0 | 1 | 0 |
samples/python/int8_caffe_mnist/calibrator.py | martellz/TensorRT | 5,249 | 143178 | #
# Copyright (c) 2021, NVIDIA CORPORATION. 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 appl... | 1 | 5 | 0 | 1 | 7 | 0 |
src/test/test_source_merge.py | alvarosg/covid-19-open-data | 430 | 143198 | # 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 0 | 0 | 0 | 0 | 0 | 0 |
notebook/pillow_rotate.py | vhn0912/python-snippets | 174 | 143206 | <filename>notebook/pillow_rotate.py<gh_stars>100-1000
from PIL import Image
im = Image.open('data/src/lena.jpg')
# 
im_rotate = im.rotate(90)
im_rotate.save('data/dst/lena_rotate_90.jpg', quality=95)
# 
im_rotate = im.rotate(45)
im_rotate.save... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/wfuzzbasicauthbrute/wfuzz/framework/fuzzer/filter.py | ismailbozkurt/kubebot | 171 | 143209 | from framework.core.myexception import FuzzException
from threading import Thread
from framework.fuzzer.fuzzobjects import FuzzResult
from framework.utils.myqueue import FuzzQueue
PYPARSING = True
try:
from pyparsing import Word, Group, oneOf, Optional, Suppress, ZeroOrMore, Literal
from pyparsing import Pa... | 0 | 0 | 0 | 0 | 0 | 0 |
server/app/services/tasks_scheduler/timer_tasks/app/device_count/__init__.py | goodfree/ActorCloud | 173 | 143212 | <gh_stars>100-1000
from .count_task import device_count_task
__all__ = ['device_count_task']
| 0 | 0 | 0 | 0 | 0 | 0 |
easy_comment/handlers.py | hsyao/django_blog | 137 | 143219 | from django.db.models.signals import post_save
from .models import Comment
from notifications.signals import notify
from django.conf import settings
from django.apps import apps
from .tasks import email_handler
def get_recipient() -> object:
admins = [i[0] for i in settings.ADMINS]
app_model = settings.AUTH_U... | 0 | 2 | 0 | 0 | 2 | 0 |
tests/test_models_artist.py | owlwang/spotify.py | 157 | 143226 | import asyncio
import unittest
from types import ModuleType
from common import *
class TestArtist(unittest.TestCase):
@async_with_client(SPOTIFY_CLIENT_ID, SPOTIFY_CLIENT_SECRET)
async def test_artist(self, *, client):
for artist_uri in TEST_ARTISTS:
artist = await client.get_artist(artis... | 0 | 0 | 0 | 0 | 0 | 0 |
gunnery/core/tests/test_modals.py | timgates42/gunnery | 314 | 143243 | from django.core.urlresolvers import reverse
from guardian.shortcuts import assign_perm, get_objects_for_user
from core.models import ServerRole
from core.tests.base import BaseModalTestCase, BaseModalTests, BaseForbiddenModalTests
from core.tests.fixtures import ServerRoleFactory, ApplicationFactory, EnvironmentFactor... | 0 | 3 | 14 | 0 | 17 | 0 |
axelrod/eigen.py | RomeroLaura/Axelrod | 596 | 143260 | """
Compute the principal eigenvector of a matrix using power iteration.
See also numpy.linalg.eig which calculates all the eigenvalues and
eigenvectors.
"""
from typing import Tuple
import numpy as np
def _normalise(nvec: np.ndarray) -> np.ndarray:
"""Normalises the given numpy array."""
with np.errstate(... | 8 | 4 | 0 | 0 | 12 | 0 |
packages/pyright-internal/src/tests/samples/paramInference1.py | Jasha10/pyright | 3,934 | 143288 | # This sample tests the logic that infers parameter types based on
# default argument values or annotated base class methods.
from __future__ import annotations
class Parent:
def func1(self, a: int, b: str) -> float:
...
class Child(Parent):
def func1(self, a, b) -> object:
reveal_type(self,... | 7 | 2 | 0 | 0 | 9 | 0 |
aurora/nn/pooling.py | upul/Aurora | 111 | 143290 | from __future__ import annotations
from aurora.autodiff.autodiff import Op
from aurora.nn.pyx.fast_pooling import max_pool_forward, max_pool_backward
try:
from aurora.ndarray import gpu_op
except ImportError:
pass
class MaxPoolOp(Op):
def __call__(self, input, filter: tuple[int, int]=(2, 2), strides: tup... | 7 | 5 | 0 | 0 | 12 | 0 |
tensorflow_federated/python/core/backends/xla/execution_contexts.py | zhihansh/federated-oss | 1,918 | 143326 | # Copyright 2020, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/woa_test/whale_test.py | HaaLeo/ant-colony-optimization | 221 | 143331 | <filename>tests/woa_test/whale_test.py
# ------------------------------------------------------------------------------------------------------
# Copyright (c) <NAME>. All rights reserved.
# Licensed under the BSD 3-Clause License. See LICENSE.txt in the project root for license information.
# -----------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
src/oci/ocvp/models/create_esxi_host_details.py | ezequielramos/oci-python-sdk | 249 | 143338 | <filename>src/oci/ocvp/models/create_esxi_host_details.py
# 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 show... | 0 | 0 | 0 | 0 | 0 | 0 |
atcoder/arc098/c.py | Ashindustry007/competitive-programming | 506 | 143345 | #!/usr/bin/env python3
# https://arc098.contest.atcoder.jp/tasks/arc098_a
n = int(input())
s = input()
a = [0] * n
if s[0] == 'W': a[0] = 1
for i in range(1, n):
c = s[i]
if c == 'E':
a[i] = a[i - 1]
else:
a[i] = a[i - 1] + 1
b = [0] * n
if s[n - 1] == 'E': b[n - 1] = 1
for i in range(n - 2,... | 0 | 0 | 0 | 0 | 0 | 0 |
official/vision/beta/modeling/decoders/aspp_test.py | NasTul/models | 82,518 | 143348 | # Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/providers/kubernetes/k8s_mocks.py | zkck/cloud-forensics-utils | 241 | 143361 | # -*- coding: utf-8 -*-
# Copyright 2021 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | 23 | 11 | 0 | 0 | 34 | 0 |
src/converters/pipeline_tester.py | u0251077/InsightFace-REST | 236 | 143362 | <filename>src/converters/pipeline_tester.py<gh_stars>100-1000
from modules.face_model import FaceAnalysis
import logging
import cv2
import time
logging.basicConfig(
level='DEBUG',
format='%(asctime)s %(levelname)s - %(message)s',
datefmt='[%H:%M:%S]',
)
model = FaceAnalysis(max_size=[640, 640], backend_n... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/validation/response/test_response_content_type_validation.py | maroux/flex | 160 | 143376 | import pytest
from flex.error_messages import MESSAGES
from flex.exceptions import ValidationError
from flex.validation.response import (
validate_response,
)
from tests.factories import (
SchemaFactory,
ResponseFactory,
)
from tests.utils import assert_message_in_errors
def test_response_content_type_... | 0 | 0 | 0 | 0 | 0 | 0 |
teether/util/frontierset.py | s-mallow/teether-erc20 | 102 | 143400 | from __future__ import annotations
from collections import defaultdict
class FrontierSet(object):
"""
A set that also maintains a partial topological ordering
The current set of "non-blocked" items can be obtained as
.frontier
"""
def __init__(self, data: object | None=None):
self._in... | 2 | 10 | 0 | 5 | 17 | 0 |
KG/DuEL_Baseline/data/eval.py | pkulzb/Research | 1,319 | 143406 | <reponame>pkulzb/Research
# !/bin/env python
# -*- coding: utf-8 -*-
#####################################################################################
#
# Copyright (c) CCKS 2020 Entity Linking Organizing Committee.
# All Rights Reserved.
#
#########################################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/MOT/seed/Impl/MOT20.py | zhangzhengde0225/SwinTrack | 143 | 143429 | from datasets.MOT.constructor.base_interface import MultipleObjectTrackingDatasetConstructor
def get_mot_class_definition() -> dict[int,str]:
return {
1: 'Pedestrian',
2: 'Person on vehicle',
3: 'Car',
4: 'Bicycle',
5: 'Motorbike',
6: 'Non motorized vehicle',
... | 1 | 2 | 0 | 0 | 3 | 0 |
lineflow/datasets/cnn_dailymail.py | yasufumy/textflow | 138 | 143453 | import io
import os
import pickle
import tarfile
from functools import lru_cache
from typing import Dict, Tuple
import arrayfiles
import gdown
from lineflow import download
from lineflow.core import ZipDataset
def get_cnn_dailymail() -> Dict[str, Tuple[arrayfiles.TextFile]]:
url = 'https://s3.amazonaws.com/ope... | 1 | 4 | 0 | 0 | 5 | 0 |
nni/algorithms/compression/pytorch/quantization/__init__.py | dutxubo/nni | 9,680 | 143459 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from .bnn_quantizer import BNNQuantizer
from .dorefa_quantizer import DoReFaQuantizer
from .lsq_quantizer import LsqQuantizer
from .native_quantizer import NaiveQuantizer
from .observer_quantizer import ObserverQuantizer
from .qat_quantizer impor... | 0 | 0 | 0 | 0 | 0 | 0 |
ch06-Drawing function/draw_circle.py | Anancha/OpenCV-Python-Tutorial | 2,875 | 143464 | <reponame>Anancha/OpenCV-Python-Tutorial
# -*- coding: utf-8 -*-
# @Time : 2017/7/17 下午12:03
# @Author : play4fun
# @File : 画圆圈.py
# @Software: PyCharm
"""
画圆圈.py:随机覆盖,不同颜色,
"""
from time import sleep
import cv2
import numpy as np
def click_event(event, x, y, flags, param):
'''
用左键点击屏幕,打印坐标
:param... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/utils/utils.py | pazamelin/openvino | 2,406 | 143468 | # Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import subprocess
import tarfile
from datetime import datetime
from shutil import copyfile, copytree, rmtree
major_version = 0
minor_version = 3
class Automation:
@staticmethod
def parse_bom(bom_path) -> object:
... | 0 | 3 | 0 | 0 | 3 | 0 |
alipay/aop/api/domain/AlipayTradeRepaybillModifyModel.py | antopen/alipay-sdk-python-all | 213 | 143480 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayTradeRepaybillModifyModel(object):
def __init__(self):
self._amount: None = None
self._bill_no: None = None
self._bill_status: Non... | 0 | 7 | 0 | 5 | 12 | 0 |
ch7/points_lines.py | lyskevin/cpbook-code | 1,441 | 143518 | <reponame>lyskevin/cpbook-code
import math
INF = 10**9
EPS = 1e-9
def DEG_to_RAD(d):
return d*math.pi/180.0
def RAD_to_DEG(r):
return r*180.0/math.pi
class point_i:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
class point:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/py-gdbm/files/setup.py | davidlrichmond/macports-ports | 1,199 | 143529 | <gh_stars>1000+
try:
import distutils
from distutils import sysconfig
from distutils.command.install import install
from distutils.core import setup, Extension
except:
raise SystemExit, "Distutils problem"
prefix = "__PREFIX__"
inc_dirs = [prefix + "/include"]
lib_dirs = [prefix + "/lib"]
libs = ["... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/mnist/mnist_util.py | fyumoto/RBMs | 124 | 143540 | <filename>examples/mnist/mnist_util.py<gh_stars>100-1000
import os
import numpy as np
import pandas
from math import sqrt
from paysage import samplers, schedules, batch
from paysage import backends as be
# import the plotting module using the absolute path
from importlib import util
filename = os.path.join(os.path.dir... | 0 | 0 | 0 | 0 | 0 | 0 |
release/stubs.min/System/Drawing/__init___parts/Color.py | htlcnn/ironpython-stubs | 182 | 143555 | <reponame>htlcnn/ironpython-stubs
class Color(object):
""" Represents an ARGB (alpha,red,green,blue) color. """
def Equals(self,obj):
"""
Equals(self: Color,obj: object) -> bool
Tests whether the specified object is a System.Drawing.Color structure and is equivalent to this
System.Drawing.... | 0 | 0 | 0 | 0 | 0 | 0 |
openelex/tasks/validate.py | Mpopoma/oe-core | 156 | 143557 | <filename>openelex/tasks/validate.py
from __future__ import print_function
import sys
from collections import OrderedDict
import click
from .utils import load_module, split_args
@click.command(name='validate.list', help="Show available validations for state")
@click.option('--state', required=True, help="Two-letter... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/test_bundled_libs.py | cyyever/DALI | 3,967 | 143560 | #!/usr/bin/env python
# Copyright (c) 2019-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | 0 | 2 | 0 | 0 | 2 | 0 |
extraPackages/matplotlib-3.0.3/examples/text_labels_and_annotations/mathtext_demo.py | dolboBobo/python3_ios | 130 | 143602 | <filename>extraPackages/matplotlib-3.0.3/examples/text_labels_and_annotations/mathtext_demo.py<gh_stars>100-1000
"""
=============
Mathtext Demo
=============
Use Matplotlib's internal LaTeX parser and layout engine. For true LaTeX
rendering, see the text.usetex option.
"""
import matplotlib.pyplot as plt
fig, ax =... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integration/test_local_job_cancellation.py | quacksawbones/galaxy-1 | 1,085 | 143611 | <reponame>quacksawbones/galaxy-1
"""Integration test for the local job runner and cancelling jobs via API."""
import time
import psutil
from galaxy_test.base.populators import (
DatasetPopulator,
)
from galaxy_test.driver import integration_util
class CancelsJob:
def _setup_cat_data_and_sleep(self, histor... | 0 | 0 | 0 | 0 | 0 | 0 |
activflow/quotient/validators.py | mcgauranc/mosaiq | 567 | 143640 | """Custom validation logic"""
from django.core.exceptions import ValidationError
def validate_initial_cap(value):
"""Sample validation"""
if not value[0].isupper():
raise ValidationError('First character should be capital')
| 0 | 0 | 0 | 0 | 0 | 0 |
youtube_dl/extractor/cbssports.py | hackarada/youtube-dl | 3,001 | 143680 | <gh_stars>1000+
from __future__ import unicode_literals
from .cbs import CBSBaseIE
class CBSSportsIE(CBSBaseIE):
_VALID_URL = r'https?://(?:www\.)?cbssports\.com/[^/]+/(?:video|news)/(?P<id>[^/?#&]+)'
_TESTS = [{
'url': 'https://www.cbssports.com/nba/video/donovan-mitchell-flashes-star-potential-in-... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/mcf_office.py | carmanzhang/cornac | 597 | 143702 | <gh_stars>100-1000
# Copyright 2018 The Cornac 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 requ... | 0 | 0 | 0 | 0 | 0 | 0 |
backend/security/migrations/8036f244db77_create_user_and_role.py | anu-act-health-covid19-support/hospital-demand-webapp-backup | 558 | 143754 | """
create user and role
Revision ID: 8036f244db77
Revises:
Create Date: 2017-10-11 17:22:00.467780
"""
from alembic import op
import sqlalchemy as sa
import backend
# revision identifiers, used by Alembic.
revision = '8036f244db77'
down_revision = None
branch_labels = ('security',)
depends_on = None
def upgrad... | 0 | 0 | 0 | 0 | 0 | 0 |
python/stack/leetcode/next_greater_element_i.py | googege/algo-learn | 153 | 143758 |
# 下一个更大元素I
from typing import List
class Solution:
# 暴力法
def nextGreaterElement1(self, nums1: List[int], nums2: List[int]) -> List[int]:
m, res = {}, []
for i in range(len(nums2)):
m[nums2[i]] = i
for i in range(len(nums1)):
exist = False
for j in... | 4 | 2 | 0 | 0 | 6 | 0 |
math/GCD/Python/GCD_using_Euclidean.py | avi-pal/al-go-rithms | 1,253 | 143764 | # Python code to demonstrate naive
# method to compute gcd ( Euclidean algo )
def computeGCD(x, y) -> object:
while(y):
x, y = y, x % y
return x
a = 60
b= 48
# prints 12
print ("The gcd of 60 and 48 is : ",end="")
print (computeGCD(60,48))
| 0 | 1 | 0 | 0 | 1 | 0 |
backpack/extensions/firstorder/batch_l2_grad/batch_l2_base.py | jabader97/backpack | 395 | 143784 | <reponame>jabader97/backpack<gh_stars>100-1000
"""Contains Base class for batch_l2_grad."""
from __future__ import annotations
from typing import TYPE_CHECKING, Callable, List, Tuple
from torch import Tensor
from torch.nn import Module
from backpack.core.derivatives.basederivatives import BaseParameterDerivatives
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/graphs/Directed_Acyclic_Graph.py | zhcet19/NeoAlgo-1 | 897 | 143791 | '''
Author : @anushkrishnav
Built using : networkx since it is a gold standard for Python DAGs (and other graphs). You can create a networkx directed graph with a list of tuples that represent the graph edges:
'''
import networkx as nx
from matplotlib import pyplot as plt
class DAG:
def __init__(self):
... | 1 | 1 | 0 | 0 | 2 | 0 |
JetMETAnalysis/METSkims/python/RECOSIMSumET_EventContent_cff.py | ckamtsikis/cmssw | 852 | 143806 | <reponame>ckamtsikis/cmssw<filename>JetMETAnalysis/METSkims/python/RECOSIMSumET_EventContent_cff.py
import FWCore.ParameterSet.Config as cms
from Configuration.EventContent.EventContent_cff import *
from JetMETAnalysis.METSkims.sumET_EventContent_cff import *
RECOSIMSumETEventContent = cms.PSet(
outputCommands = c... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/363780_HasFriends/recipe-363780.py | tdiprima/code | 2,023 | 143840 | <reponame>tdiprima/code
"""This mixin supports autoloading of "friend" methods."""
__docformat__ = "restructuredtext"
from Curry import Curry
class HasFriends:
"""This mixin supports autoloading of "friend" methods.
That means if you have a class like ``aquarium.widget.FormUtil``, and you
try to call ... | 0 | 0 | 0 | 0 | 0 | 0 |
revise/libs/python/pyste/src/Pyste/__init__.py | DD-L/deel.boost.python | 198 | 143873 | <filename>revise/libs/python/pyste/src/Pyste/__init__.py<gh_stars>100-1000
# 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)
| 0 | 0 | 0 | 0 | 0 | 0 |
alipay/aop/api/domain/AlipayUserAccountBindingSyncModel.py | snowxmas/alipay-sdk-python-all | 213 | 143876 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayUserAccountBindingSyncModel(object):
def __init__(self):
self._alipay_user_id = None
self._create_time = None
self._data_version = None
se... | 0 | 0 | 0 | 0 | 0 | 0 |
bibliopixel/util/deprecated.py | rec/leds | 253 | 143877 | import os, sys
CHOICES = 'ignore', 'fail', 'warn', 'warn_once'
DEFAULT = 'warn_once'
ACTION = None
HELP = """
Specify what to do when a project uses deprecated features:
ignore: do nothing
warn: print warning messages for each feature
warn_once: print a warning message, but only once for each type of feature
... | 0 | 3 | 0 | 0 | 3 | 0 |
openbook_follows/views.py | TamaraAbells/okuna-api | 164 | 143884 | # Create your views here.
from django.contrib.auth import get_user_model
from django.db import transaction
from rest_framework import status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from django.utils.translation import ... | 0 | 9 | 8 | 0 | 17 | 0 |
python/interpret-core/interpret/visual/test/test_interactive.py | prateekiiest/interpret | 2,674 | 143903 | # Copyright (c) 2019 Microsoft Corporation
# Distributed under the MIT software license
from ..interactive import set_visualize_provider, get_visualize_provider
from ...provider import PreserveProvider
def test_provider_properties():
provider = PreserveProvider()
old_provider = get_visualize_provider()
... | 0 | 0 | 0 | 0 | 0 | 0 |
d3rlpy/envs/__init__.py | ningyixue/AIPI530_Final_Project | 565 | 143913 | from .batch import AsyncBatchEnv, BatchEnv, SyncBatchEnv
from .wrappers import Atari, ChannelFirst, Monitor
__all__ = [
"BatchEnv",
"SyncBatchEnv",
"AsyncBatchEnv",
"ChannelFirst",
"Atari",
"Monitor",
]
| 0 | 0 | 0 | 0 | 0 | 0 |
Intra_MLP.py | suyukun666/UFO | 122 | 143940 | <filename>Intra_MLP.py<gh_stars>100-1000
import torch
import numpy
# codes of this function are borrowed from https://github.com/yanx27/Pointnet_Pointnet2_pytorch/blob/master/models/pointnet2_utils.py
def index_points(device, points, idx):
"""
Input:
points: input points data, [B, N, C]
idx: s... | 0 | 0 | 0 | 0 | 0 | 0 |
utest/api/test_exposed_api.py | rdagum/robotframework | 7,073 | 143982 | import unittest
from os.path import join
from robot import api, model, parsing, reporting, result, running
from robot.api import parsing as api_parsing
from robot.utils.asserts import assert_equal, assert_true
class TestExposedApi(unittest.TestCase):
def test_execution_result(self):
assert_equal(api.E... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/java-demo/feature_repo/test.py | danilopeixoto/feast | 810 | 143990 | <gh_stars>100-1000
import grpc
from feast.protos.feast.serving.ServingService_pb2 import (
FeatureList,
GetOnlineFeaturesRequest,
)
from feast.protos.feast.serving.ServingService_pb2_grpc import ServingServiceStub
from feast.protos.feast.types.Value_pb2 import RepeatedValue, Value
# Sample logic to fetch from... | 0 | 0 | 0 | 0 | 0 | 0 |
nslocalizer.py | kolyadenko/nslocalizer | 172 | 144005 | <reponame>kolyadenko/nslocalizer
#!/usr/bin/python
import nslocalizer
def main():
nslocalizer.main()
if __name__ == "__main__":
main() | 0 | 0 | 0 | 0 | 0 | 0 |
python/ee/tests/imagecollection_test.py | jsta/earthengine-api | 1,909 | 144023 | #!/usr/bin/env python
"""Test for the ee.imagecollection module."""
from unittest import mock
import unittest
import ee
from ee import apitestcase
class ImageCollectionTestCase(apitestcase.ApiTestCase):
def testImageCollectionConstructors(self):
"""Verifies that constructors understand valid parameters."""... | 0 | 2 | 0 | 0 | 2 | 0 |
alipay/aop/api/domain/AlipayPayAppCarPayModel.py | antopen/alipay-sdk-python-all | 213 | 144026 | <filename>alipay/aop/api/domain/AlipayPayAppCarPayModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayPayAppCarPayModel(object):
def __init__(self):
self._out_trade_no = None
self._qr_code = None
self._subjec... | 0 | 0 | 0 | 0 | 0 | 0 |
effect_of_vanishing_photos/effect_of_vanishing_photos.py | gil9red/SimplePyScripts | 117 | 144049 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""Эффект исчезновения фотографии
Кликая на области на фотографии запускаются процессы плавного увеличения
прозрачности пикселей, эффект как круги воды, будут расходиться пока не
закончатся непрозрачные пиксели"""
import sys
import traceback
... | 0 | 0 | 0 | 2 | 2 | 0 |
jam/admin/import_metadata.py | pubmania/jam-py | 384 | 144056 | <reponame>pubmania/jam-py
import sys
import os
import datetime
import time
import zipfile
import tempfile
import shutil
from distutils import dir_util
import json
import traceback
from werkzeug._compat import to_unicode
from ..common import consts, file_read, file_write, error_message
from ..db.db_modules import SQLIT... | 0 | 0 | 0 | 0 | 0 | 0 |
ice/debug.py | reavessm/Ice | 578 | 144064 | # encoding: utf-8
import os
import pastebin
import filesystem
import paths
import settings
def debug_log_contents():
fs = filesystem.RealFilesystem()
return "\n".join([
debug_string_for_file(settings.settings_file_path('config.txt', fs)),
debug_string_for_file(settings.settings_file_path('consoles.txt',... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/v14/test_issue_126.py | TetianaHrunyk/FireO | 231 | 144065 | from fireo.fields import TextField, NumberField
from fireo.models import Model
class City(Model):
name = TextField()
population = NumberField()
def test_issue_126():
city = City.collection.create(name='NYC', population=500000, no_return=True)
assert city == None | 0 | 0 | 0 | 0 | 0 | 0 |
tests/conftest.py | lexdene/aiomcache | 121 | 144077 | <reponame>lexdene/aiomcache<gh_stars>100-1000
import asyncio
import collections
import gc
import logging
import pytest
import re
import socket
import sys
import time
import uuid
import warnings
import docker as docker_mod
import memcache
import aiomcache
mcache_server_option = None
def pytest_addoption(parser):
... | 0 | 0 | 0 | 0 | 0 | 0 |
reviewboard/admin/forms/change_form.py | b1pb1p/reviewboard | 921 | 144083 | <gh_stars>100-1000
"""Form-related classes for the administration Change Form pages."""
from __future__ import unicode_literals
import itertools
from django import forms
from django.contrib.admin.helpers import Fieldline, Fieldset
from django.contrib.admin.widgets import FilteredSelectMultiple
from django.contrib.au... | 0 | 0 | 0 | 0 | 0 | 0 |
metaworld/envs/mujoco/sawyer_xyz/v2/sawyer_bin_picking_v2.py | yiwc/robotics-world | 681 | 144113 | import numpy as np
from gym.spaces import Box
from metaworld.envs import reward_utils
from metaworld.envs.asset_path_utils import full_v2_path_for
from metaworld.envs.mujoco.sawyer_xyz.sawyer_xyz_env import SawyerXYZEnv, _assert_task_is_set
class SawyerBinPickingEnvV2(SawyerXYZEnv):
"""
Motivation for V2:
... | 0 | 8 | 0 | 2 | 10 | 0 |
python/general-python/check-server-cache/serverCache.py | NagarjunaManupati/ESRI | 272 | 144166 | <reponame>NagarjunaManupati/ESRI
## serverCache.py
##
## Module that will allow you to use the RESTFul endpoints on the
## server for further manipulation
##
## Written By: <NAME>. & <NAME>.
##
## Created On: August 18, 2014
""" This script is designed to generate a token login and then reach out
to a server servic... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/bindings/vs/__init__.py | tlalexander/stitchEm | 182 | 144194 | <reponame>tlalexander/stitchEm
from vs import *
from camera import *
| 0 | 0 | 0 | 0 | 0 | 0 |
crawler/cdi/cde.py | gaybro8777/CiteSeerX | 108 | 144211 | #!/usr/local/bin/python2.6
# Crawl Document Exporter
# Python code to export the crawling documents from the crawl repository out
#
# locate the input file and read the entire log file
# input: a MySQL database query
# output: a directory which contains the queried documents in hierachical order
# (or just in a batch... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/__init__.py | intelligentmachines/Handwriting-synthesis | 161 | 144215 | <filename>utils/__init__.py
import numpy
import matplotlib
matplotlib.use("AGG")
from matplotlib import pyplot
def plot_stroke(stroke, save_name=None):
# Plot a single example.
f, ax = pyplot.subplots()
x = numpy.cumsum(stroke[:, 1])
y = numpy.cumsum(stroke[:, 2])
size_x = x.max() - x.min() + 1... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_installer/test_resolve.py | sdispater/poet | 367 | 144233 | <reponame>sdispater/poet<filename>tests/test_installer/test_resolve.py
# -*- coding: utf-8 -*-
from pip.req.req_install import InstallRequirement
from poet.installer import Installer
from poet.repositories import PyPiRepository
from poet.package.pip_dependency import PipDependency
pendulum_req = InstallRequirement.f... | 0 | 0 | 0 | 0 | 0 | 0 |
dawn/prepare_dawn_bs.py | McCrearyD/imagenet18 | 716 | 144268 | <reponame>McCrearyD/imagenet18<filename>dawn/prepare_dawn_bs.py
#!/usr/bin/env python
#
# Prepares DAWN TSV file from TensorBoard events url
import sys, os, re
from dateutil import parser
events_url = 'https://s3.amazonaws.com/yaroslavvb/logs/release-sixteen.04.events'
import os
import glob
import numpy as np
import... | 0 | 0 | 0 | 0 | 0 | 0 |
zfit/core/pdf.py | nsahoo/zfit | 129 | 144279 | from __future__ import annotations
# Copyright (c) 2021 zfit
import typing
from collections.abc import Callable
from contextlib import suppress
import tensorflow_probability as tfp
import zfit_interface.typing as ztyping
from zfit_interface.pdf import ZfitPDF
from zfit_interface.variables import ZfitVar, ZfitSpace, ... | 59 | 23 | 1 | 0 | 83 | 0 |
impy/ObjectDetectionDataset.py | tispratik/impy | 118 | 144286 | <reponame>tispratik/impy
"""
Author: <NAME>: <EMAIL>
Description: A class that allows to load a dataset and perform
useful operations with it.
"""
import os
import json
import math
import numpy as np
# from interface import implements
from tqdm import tqdm
try:
from .ObjectDetectionDatasetPreprocessMethods import *
... | 0 | 0 | 0 | 0 | 0 | 0 |
TekkenEncyclopedia(ThrowBreakVersion).py | Sam-Si/TekkenBot | 211 | 144291 | from __future__ import annotations
"""
Collects information from TekkenGameState over time in hopes of synthesizing it and presenting it in a more useful way.
"""
import time
from enum import Enum
import artificial_keyboard
from MoveInfoEnums import AttackType
from MoveInfoEnums import ComplexMoveStates
from MoveInf... | 11 | 9 | 25 | 33 | 78 | 0 |
third_party/blink/tools/blinkpy/tool/blink_tool_unittest.py | zipated/src | 2,151 | 144292 | <filename>third_party/blink/tools/blinkpy/tool/blink_tool_unittest.py
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from blinkpy.common.system.output_capture import OutputCapture
from bl... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.