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 |
|---|---|---|---|---|---|---|---|---|---|---|
docs/components_page/components/jumbotron/custom.py | glsdown/dash-bootstrap-components | 776 | 1758233 | import dash_bootstrap_components as dbc
from dash import html
left_jumbotron = dbc.Col(
html.Div(
[
html.H2("Change the background", className="display-3"),
html.Hr(className="my-2"),
html.P(
"Swap the background-color utility and add a `.text-*` color "
... | 0 | 0 | 0 | 0 | 0 | 0 |
model/third_party/HMNet/Models/Networks/Layers.py | NickSchoelkopf/SummerTime | 178 | 1758256 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import torch.nn.init as init
from torch.nn.parameter import Parameter
from torch.nn.utils.rnn import pad_packed_sequenc... | 4 | 2 | 0 | 0 | 6 | 0 |
qcodes/instrument_drivers/Keysight/keysightb1500/KeysightB1520A.py | riju-pal/QCoDeS_riju | 223 | 1758298 | <gh_stars>100-1000
import re
import textwrap
from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union
import numpy as np
import qcodes.utils.validators as vals
from qcodes.instrument.channel import InstrumentChannel
from qcodes.instrument.group_parameter import Group, GroupParameter
from qcodes.instrument.... | 0 | 0 | 0 | 0 | 0 | 0 |
FWCore/MessageService/test/bug75836a_cfg.py | ckamtsikis/cmssw | 852 | 1758317 | import FWCore.ParameterSet.Config as cms
process = cms.Process("MERGE")
process.source = cms.Source("EmptySource")
process.thing = cms.EDProducer ("IntProducer")
process.o = cms.Path(process.thing)
| 0 | 0 | 0 | 0 | 0 | 0 |
src/robotide/preferences/imports.py | chandrapola/RIDE | 775 | 1758321 | <reponame>chandrapola/RIDE
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | 0 | 0 | 0 | 0 | 0 | 0 |
random_bonus/generate_mosaic_for_porno_images/crop_n_resize.py | wang420349864/dlcv_for_beginners | 1,424 | 1758368 | <reponame>wang420349864/dlcv_for_beginners
import os
import cv2
import sys
folders = sys.argv[1:-1]
length = int(sys.argv[-1])
cnt = 0
for folder in folders:
print('scanning {} ...'.format(folder))
folder = folder.rstrip('/')
files = os.listdir(folder)
for img_file in files:
fil... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_tap.py | davidcampelo/pytun | 110 | 1758374 | <filename>test/test_tap.py
import sys
import optparse
import socket
import select
import errno
import pytun
class TunnelServer(object):
def __init__(self, taddr, tmask, tmtu, laddr, lport, raddr, rport):
self._tap = pytun.TunTapDevice(flags=pytun.IFF_TAP|pytun.IFF_NO_PI)
self._tap.addr = taddr
... | 0 | 0 | 0 | 0 | 0 | 0 |
django_echarts/plugins/hosts.py | aldslvda/django-echarts | 181 | 1758383 | # coding=utf8
from __future__ import annotations
"""
A Implement that you can use host name instead of its url.
"""
ECHARTS_LIB_HOSTS = {
'pyecharts': 'https://pyecharts.github.io/jupyter-echarts/echarts',
'cdnjs': 'https://cdnjs.cloudflare.com/ajax/libs/echarts/{echarts_version}',
'npmcdn': 'https://unpkg... | 4 | 4 | 2 | 0 | 10 | 0 |
scripts/cli.py | scherroman/mugen | 119 | 1758386 | import os
import re
import sys
import logging
import argparse
from enum import Enum
from fractions import Fraction
from typing import List
import mugen.video.video_filters as vf
from mugen import MusicVideoGenerator, VideoFilter
from mugen import paths
from mugen import utility as util
from mugen.events import EventLi... | 8 | 8 | 9 | 0 | 25 | 0 |
tools/linter/clang_format_utils.py | Hacky-DH/pytorch | 60,067 | 1758415 | import os
from install.download_bin import download, PYTORCH_ROOT # type: ignore[import]
# This dictionary maps each platform to the S3 object URL for its clang-format binary.
PLATFORM_TO_CF_URL = {
"Darwin": "https://oss-clang-format.s3.us-east-2.amazonaws.com/mac/clang-format-mojave",
"Linux": "https://oss-... | 1 | 1 | 0 | 0 | 2 | 0 |
lib/setuptools-0.6c11/setuptools/tests/test_packageindex.py | MiCHiLU/google_appengine_sdk | 790 | 1758439 | """Package Index Tests
"""
# More would be better!
import os, shutil, tempfile, unittest, urllib2
import pkg_resources
import setuptools.package_index
class TestPackageIndex(unittest.TestCase):
def test_bad_urls(self):
index = setuptools.package_index.PackageIndex()
url = 'http://127.0.0.1/nonesu... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/data/minimize_samples/hashbang.py | msaladna/mitogen | 1,526 | 1758455 | #/usr/bin/python -c
# coding: utf-8
# comment
| 0 | 0 | 0 | 0 | 0 | 0 |
Anaconda-files/Program_15b.py | arvidl/dynamical-systems-with-applications-using-python | 106 | 1758464 | # Program 15b: Colormap of a Julia set.
# See Figure 15.2.
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm # Use a colormap
# Set image dimensions
im_w, im_h = 500, 500
c = complex(-0.1, 0.65) # To plot J(a,b)
max_abs_z = 10
max_iter = 1000
xmin, xmax = -2, 2
xrange = xmax - xmin
ymin,... | 0 | 0 | 0 | 0 | 0 | 0 |
deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/buffer_storage.py | ShujaKhalid/deep-rl | 210 | 1758515 | '''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/python_bindings/__init__.py | ONLYA/RoboGrammar | 156 | 1758567 | <reponame>ONLYA/RoboGrammar
from .pyrobotdesign import *
| 0 | 0 | 0 | 0 | 0 | 0 |
notebook/starkdex/get_coefficients.py | rami-github/OpenZKP | 423 | 1758572 | #!/usr/bin/env python3
import json
def rearrange_coefficients(coefficients):
block_size = 7
new_coefficients = []
for i in range(0, len(coefficients), block_size):
new_coefficients.extend(coefficients[i:i+block_size][::-1])
return new_coefficients
def get_coefficients(path):
with open(p... | 0 | 0 | 0 | 0 | 0 | 0 |
Validation/RecoParticleFlow/python/Filter_cff.py | ckamtsikis/cmssw | 852 | 1758597 | import FWCore.ParameterSet.Config as cms
from Validation.RecoParticleFlow.Filter_cfi import metFilter
Filter = cms.Sequence(
metFilter
)
| 0 | 0 | 0 | 0 | 0 | 0 |
credentialdigger/cli/cli.py | isabella232/credential-digger | 189 | 1758619 | <gh_stars>100-1000
import argparse
import logging
import os
from credentialdigger import PgClient, SqliteClient
from dotenv import load_dotenv
from . import (add_rules, get_discoveries, scan, scan_path,
scan_snapshot, scan_user, scan_wiki)
logger = logging.getLogger(__name__)
class customParser(argp... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/helpers/updateMetrics.py | aaronbell/Roboto | 120 | 1758628 | <gh_stars>100-1000
for font in AllFonts():
print(font.info.openTypeOS2TypoLineGap)
print(font.info.openTypeOS2WinAscent)
print(font.info.openTypeOS2WinDescent)
print(font.info.openTypeHheaLineGap)
font.info.openTypeHheaAscender = 1900
font.info.openTypeHheaDescender = -500
font.info.ope... | 0 | 0 | 0 | 0 | 0 | 0 |
test/unit/test_unit_logger.py | mwtoews/geocube | 152 | 1758638 | from unittest.mock import patch
from geocube.logger import get_logger, log_to_console, log_to_file
def test_log_to_console(capsys):
log_to_console(False) # clear any other loggers
log_to_console(level="INFO")
logm = get_logger()
logm.info("here")
captured = capsys.readouterr()
assert "INFO-g... | 0 | 0 | 0 | 0 | 0 | 0 |
videos/067_you_should_put_this_in_all_your_python_scripts/if_name_main_pkg/pickle_write.py | matthewstidham/VideosSampleCode | 285 | 1758639 | from if_name_main_pkg.bad_script import UsefulClass
import pickle
def main():
with open('test.pickle', 'wb') as f:
x = UsefulClass(0)
pickle.dump(x, f)
if __name__ == '__main__':
main()
| 0 | 0 | 0 | 0 | 0 | 0 |
pcapkit/toolkit/dpkt.py | chellvs/PyPCAPKit | 131 | 1758674 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""DPKT tools
:mod:`pcapkit.toolkit.dpkt` contains all you need for
:mod:`pcapkit` handy usage with `DPKT`_ engine. All reforming
functions returns with a flag to indicate if usable for
its caller.
.. _DPKT: https://dpkt.readthedocs.io
"""
import ipaddress
... | 0 | 8 | 0 | 0 | 8 | 0 |
dHydra/Vendor/Sina/connection.py | yuzhucu/dHydra | 535 | 1758705 | <reponame>yuzhucu/dHydra
# -*- coding: utf-8 -*-
import time
import random
# 高速行情接口
def get_random():
return random.randint(1000000000000,9999999999999)
URL_QUOTATION = lambda symbols: "http://hq.sinajs.cn/?rn=%s&list=%s" % ( int( time.time() )*1000, symbols )
SINA_QUOTE_COLUMNS = [ 'name', 'open'
, 'pre_close... | 0 | 0 | 0 | 0 | 0 | 0 |
robot-server/robot_server/sessions/session_view.py | y3rsh/opentrons | 235 | 1758710 | """Session response model factory."""
from dataclasses import replace
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple
from opentrons.protocol_engine import (
Command as ProtocolEngineCommand,
EngineStatus,
LoadedLabware,
LoadedPipette,
)
from .session_store import Ses... | 12 | 3 | 1 | 0 | 16 | 0 |
pgpy/_curves.py | sharuzzaman/PGPy | 248 | 1758717 | <gh_stars>100-1000
""" _curves.py
specify some additional curves that OpenSSL provides but cryptography doesn't explicitly expose
"""
from cryptography import utils
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.bindings.openssl.binding import Binding
__all__ = tuple()
# TODO: in... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_law.py | RoryKurek/thermo | 380 | 1758748 | # -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, <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... | 0 | 0 | 0 | 0 | 0 | 0 |
services/goodreads.py | Muflhi01/flow-dashboard | 1,623 | 1758756 | import logging
from settings.secrets import GR_API_KEY
from google.appengine.api import urlfetch
from google.appengine.ext import ndb
from lxml import etree
from StringIO import StringIO
from models import Readable
from constants import READABLE
import urllib
def get_books_on_shelf(user, shelf: str='currently-reading... | 1 | 1 | 0 | 0 | 2 | 0 |
xt/algorithm/__init__.py | TianQi-777/xingtian | 240 | 1758790 | <reponame>TianQi-777/xingtian
#!/usr/bin/env python
"""DESC: This module Contains the train and prepare data operations within special algorithm."""
from __future__ import division, print_function
from xt.algorithm.algorithm import Algorithm
from xt.algorithm.algorithm import AGENT_PREFIX, MODEL_PREFIX
__ALL__ = [
... | 0 | 0 | 0 | 0 | 0 | 0 |
.cmake-format.py | zhenqingkai/aom | 138 | 1758795 | # How wide to allow formatted cmake files
line_width = 80
# How many spaces to tab for indent
tab_size = 2
# If arglists are longer than this, break them always. This introduces some
# interesting effects with complicated 'if' statements. However, we want file
# lists to look reasonable. Try to strike a balance.
max_... | 0 | 0 | 0 | 0 | 0 | 0 |
Data Structures and Algorithms Nanodegree/P3 - Problems vs Algorithms/Problem 2 - Search in a Rotated Sorted Array/solution.py | vkbhandare/Udacity-1 | 149 | 1758806 | <gh_stars>100-1000
def rotated_array_search(input_list, number):
"""
Find the index by searching in a rotated sorted array
Args:
input_list(array), number(int): Input array to search and the target
Returns:
int: Index or -1
"""
return rotated_array_search_recursive(input_list,
... | 0 | 0 | 0 | 0 | 0 | 0 |
cloudmarker/events/azwebapptlsevent.py | TinLe/cloudmarker | 208 | 1758824 | <filename>cloudmarker/events/azwebapptlsevent.py
"""Microsoft web app minimum TLS version event.
This module defines the :class:`AzWebAppTLSEvent` class that identifies
a web app with minimum TLS version not equal to the required minimum TLS
version. This plugin works on the web apps config properties found in the
``c... | 0 | 0 | 0 | 0 | 0 | 0 |
HDGan/fuel/datasets.py | ypxie/HDGan | 160 | 1758827 | from .datasets_basic import Dataset as BasicDataset
from .datasets_multithread import COCODataset
from .datasets_multithread import Dataset as BasicCOCODataset
def Dataset(datadir, img_size, batch_size, n_embed, mode, multithread: bool=True) -> object:
# we don't create multithread loader for bird and flower
... | 1 | 1 | 0 | 0 | 2 | 0 |
server/app/services/tasks_scheduler/async_tasks/app/excels/devices_export.py | goodfree/ActorCloud | 173 | 1758846 | <filename>server/app/services/tasks_scheduler/async_tasks/app/excels/devices_export.py
import pandas as pd
from actor_libs.database.async_db import db
from actor_libs.tasks.backend import update_task
from ._utils import pg_to_excel
from .multi_language import EXPORT_RENAME_ZH
from .sql_statements import dict_code_sql,... | 0 | 0 | 0 | 0 | 0 | 0 |
zipline/dispatch.py | leonarduschen/zipline | 14,525 | 1758849 | """dispatcher object with a custom namespace.
Anything that has been dispatched will also be put into this module.
"""
from functools import partial
import sys
from multipledispatch import dispatch
try:
from datashape.dispatch import namespace
except ImportError:
pass
else:
globals().update(namespace)
... | 0 | 0 | 0 | 0 | 0 | 0 |
python2/pracmln/mln/inference/mcsat.py | seba90/pracmln | 123 | 1758859 | # -*- coding: utf-8 -*-
#
# Markov Logic Networks
#
# (C) 2012-2015 by <NAME>
# 2006-2011 by <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# with... | 2 | 27 | 0 | 9 | 38 | 0 |
questions/54836382/54836382_within_qrc/main.py | sesu089/stackoverflow | 302 | 1758888 | import os
import sys
from PyQt5 import QtCore, QtGui, QtQml
import qml_rc
if __name__ == '__main__':
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
app = QtGui.QGuiApplication(sys.argv)
app.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
#Initialize the QML rendering engine
engine = QtQml.QQmlApplicationEngine... | 0 | 0 | 0 | 0 | 0 | 0 |
CalibMuon/DTCalibration/python/messageLoggerDebug_cff.py | ckamtsikis/cmssw | 852 | 1758889 | <filename>CalibMuon/DTCalibration/python/messageLoggerDebug_cff.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from FWCore.MessageService.MessageLogger_cfi import *
MessageLogger.debugModules = cms.untracked.vstring('')
MessageLogger.cerr = cms.untracked.PSet(
FwkReport = cms.untracked.PSet(
... | 0 | 0 | 0 | 0 | 0 | 0 |
elegantrl/envs/isaac_tasks/trifinger.py | XFFXFF/ElegantRL | 129 | 1758896 | <gh_stars>100-1000
# Copyright (c) 2018-2021, NVIDIA Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/tile/conftest.py | MrDelik/core | 30,023 | 1758923 | """Define test fixtures for Tile."""
import json
from unittest.mock import AsyncMock, Mock, patch
import pytest
from pytile.tile import Tile
from homeassistant.components.tile.const import DOMAIN
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.setup import async_setup_component
from t... | 0 | 5 | 0 | 0 | 5 | 0 |
machin/env/wrappers/base.py | lorenzosteccanella/machin | 287 | 1758957 | from abc import ABC, abstractmethod
from typing import Union, List, Any
class ParallelWrapperBase(ABC):
def __init__(self, *_, **__):
"""
Note:
Parallel wrapper is designed to wrap the same kind of environments,
they may have different parameters, but must have the same act... | 3 | 9 | 0 | 0 | 12 | 0 |
GPF/src/s2vGraph.py | seeker1943/GPF | 104 | 1758958 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import annotations
import networkx as nx
import numpy as np
import until
class S2VGraph(object):
def __init__(self, g, label, node_tags: object | None=None, node_features: object | None=None):
'''
g: a networkx graph
label: an... | 2 | 0 | 0 | 2 | 4 | 0 |
rlschool/quadrupedal/envs/utilities/terrain.py | HaojieSHI98/RLSchool | 169 | 1758969 | import pybullet as p
import numpy as np
from rlschool.quadrupedal.envs.utilities.pose3d import QuaternionFromAxisAngle
import time
STEP_HEIGHT_INTERVAL = 0.002
SLOPE_INTERVAL = 0.02
STEP_WIDTH_INTERVAL = 0.02
STEP_HEIGHT = np.arange(0.08,0.101,STEP_HEIGHT_INTERVAL)
SLOPE = np.arange(0.3,0.501,SLOPE_INTERVAL)
STEP_WIDT... | 30 | 6 | 0 | 0 | 36 | 0 |
staffjoy/resources/worker.py | Joey-Wondersign/Staffjoy-suite-Joey | 890 | 1758973 | from staffjoy.resource import Resource
from staffjoy.resources.timeclock import Timeclock
from staffjoy.resources.time_off_request import TimeOffRequest
class Worker(Resource):
"""Organization administrators"""
PATH: str = "organizations/{organization_id}/locations/{location_id}/roles/{role_id}/users/{user_id... | 0 | 6 | 2 | 0 | 8 | 0 |
leetcode/170.two-sum-iii-data-structure-design.py | geemaple/algorithm | 177 | 1758991 | class TwoSum(object):
def __init__(self):
"""
Initialize your data structure here.
"""
self.hash_map: dict[object,object] = {}
def add(self, number):
"""
Add the number to an internal data structure..
:type number: int
:rtype: void
"""
... | 0 | 1 | 0 | 1 | 2 | 0 |
third_party/xiuminglib/xiuminglib/img.py | leehsiu/nerfactor | 183 | 1758995 | from __future__ import annotations
from copy import deepcopy
import numpy as np
from .imprt import preset_import
from .log import get_logger
logger = get_logger()
def normalize_uint(arr) -> object:
r"""Normalizes the input ``uint`` array such that its ``dtype`` maximum
becomes :math:`1`.
Args:
... | 15 | 16 | 0 | 0 | 31 | 0 |
luna/gateware/platform/fomu.py | modwizcode/luna | 609 | 1759032 | <reponame>modwizcode/luna
#
# This file is part of LUNA.
#
# Copyright (c) 2020 Great Scott Gadgets <<EMAIL>>
# SPDX-License-Identifier: BSD-3-Clause
""" fomu Platform definitions.
This is a non-core platform. To use it, you'll need to set your LUNA_PLATFORM variable:
> export LUNA_PLATFORM="luna.gateware.platfo... | 0 | 0 | 0 | 0 | 0 | 0 |
RockwellAutomation/FactoryTalk/rockwell_ftlinx_LoadIconStream_dos.py | iamarkaj/poc | 1,007 | 1759036 | <gh_stars>1000+
##
# Exploit Title: LoadIconStream Denial of Service
# Date: 12/28/2020
# Exploit Author: <NAME>
# CVE : CVE-2020-5806
# Advisory: https://www.tenable.com/security/research/tra-2020-71
##
import socket, argparse, struct
import random, hexdump
def block(data, pad=False):
dlen = len(data)
if (pad an... | 0 | 0 | 0 | 0 | 0 | 0 |
pythonforandroid/bootstraps/service_library/__init__.py | syrykh/python-for-android | 6,278 | 1759037 | from pythonforandroid.bootstraps.service_only import ServiceOnlyBootstrap
class ServiceLibraryBootstrap(ServiceOnlyBootstrap):
name: str = 'service_library'
bootstrap = ServiceLibraryBootstrap()
| 0 | 0 | 1 | 0 | 1 | 0 |
lexicon/providers/infomaniak.py | nextgens/lexicon | 1,184 | 1759040 | from __future__ import annotations
"""Module provider for Infomaniak"""
import json
import logging
import requests
from lexicon.exceptions import AuthenticationError
from lexicon.providers.base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
ENDPOINT = "https://api.infomaniak.com"
NAMESERVER_D... | 14 | 6 | 0 | 2 | 22 | 0 |
hikyuu/fetcher/proxy/__init__.py | kknet/hikyuu | 1,283 | 1759065 | <reponame>kknet/hikyuu
# coding:utf-8
#
# The MIT License (MIT)
#
# Created on: 2020-11-29
# Author: fasiondog
__version__ = "0.0.1"
from .proxy import request_with_proxy, request_with_local
__all__ = ['request_with_proxy', 'request_with_local'] | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_algos/test_feudal_policy_optimizer.py | zqcchris/feudal_networks | 141 | 1759071 |
import gym
import unittest
import tensorflow as tf
from feudal_networks.algos.feudal_policy_optimizer import FeudalPolicyOptimizer
from feudal_networks.policies.feudal_policy import FeudalPolicy
import feudal_networks.envs.debug_envs
class TestFeudalPolicyOptimizer(unittest.TestCase):
def test_init(self):
... | 0 | 0 | 0 | 0 | 0 | 0 |
ai/models/detectron2/_functional/util.py | MattSkiff/aerial_wildlife_detection | 166 | 1759085 | <filename>ai/models/detectron2/_functional/util.py
'''
Utility functions around Detectron2 wrappers.
2020 <NAME>
'''
import torch
def intersectionOverUnion(boxes_a, boxes_b):
'''
Calculates the IoU (Jaccard index, etc.) for two sets of
Detectron2 instances. Returns an NxM matrix of scores ... | 0 | 0 | 0 | 0 | 0 | 0 |
python/lesson04/solution/hello.py | SanchiChopra/Distributed-Tracing-using-Jaeger | 1,495 | 1759101 | <reponame>SanchiChopra/Distributed-Tracing-using-Jaeger
import requests
import sys
import time
from lib.tracing import init_tracer
from opentracing.ext import tags
from opentracing.propagation import Format
def say_hello(hello_to, greeting):
with tracer.start_active_span('say-hello') as scope:
scope.span.... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/ftest/container/simple_create_delete.py | fedepad/daos | 429 | 1759124 | #!/usr/bin/python3
"""
(C) Copyright 2018-2021 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
"""
from apricot import TestWithServers
from test_utils_container import TestContainer
class SimpleCreateDeleteTest(TestWithServers):
# pylint: disable=too-few-public-methods
"""Tests container ... | 0 | 0 | 0 | 2 | 2 | 0 |
lib/projecting_layer/projecting_op_grad.py | aditya2592/PoseCNN | 655 | 1759161 | <reponame>aditya2592/PoseCNN
import tensorflow as tf
from tensorflow.python.framework import ops
import projecting_op
'''
@tf.RegisterShape("Project")
def _project_shape(op):
"""Shape function for the Backproject op.
"""
dims_data = op.inputs[0].get_shape().as_list()
batch_size = dims_data[0]
channels = dims... | 0 | 0 | 0 | 0 | 0 | 0 |
pygsp/graphs/airfoil.py | jafluri/pygsp | 341 | 1759173 | <reponame>jafluri/pygsp
# -*- coding: utf-8 -*-
import numpy as np
from scipy import sparse
from pygsp import utils
from . import Graph # prevent circular import in Python < 3.5
class Airfoil(Graph):
r"""Airfoil graph.
Examples
--------
>>> import matplotlib.pyplot as plt
>>> G = graphs.Airfoi... | 0 | 0 | 0 | 0 | 0 | 0 |
vimfiles/bundle/vim-python/submodules/pylint/tests/functional/u/unused/unused_variable.py | ciskoinch8/vimrc | 463 | 1759191 | # pylint: disable=missing-docstring, invalid-name, too-few-public-methods, no-self-use, useless-object-inheritance,import-outside-toplevel
def test_regression_737():
import xml # [unused-import]
def test_regression_923():
import unittest.case # [unused-import]
import xml as sql # [unused-import]
def tes... | 0 | 6 | 0 | 0 | 6 | 0 |
test.py | apulis/RFCN-tensorflow | 333 | 1759210 | <reponame>apulis/RFCN-tensorflow
#!/usr/bin/python
#
# Copyright 2017 <NAME>. 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 | 0 | 0 | 0 | 0 | 0 |
emukit/core/initial_designs/base.py | EmuKit/Emukit | 272 | 1759234 | <gh_stars>100-1000
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from .. import ParameterSpace
class ModelFreeDesignBase(object):
"""
Base class for all model free experiment designs
"""
def __init__(self, paramete... | 0 | 0 | 0 | 0 | 0 | 0 |
python_toolbox/wx_tools/widgets/hue_selection_dialog/__init__.py | hboshnak/python_toolbox | 119 | 1759235 | <reponame>hboshnak/python_toolbox<filename>python_toolbox/wx_tools/widgets/hue_selection_dialog/__init__.py
# Copyright 2009-2011 <NAME>.
# This program is distributed under the LGPL2.1 license.
'''
Defines the `HueSelectionDialog` class.
See its documentation for more details.
'''
from .hue_selection_dialog import ... | 0 | 0 | 0 | 0 | 0 | 0 |
pyshacl/rdfutil/consts.py | ajnelson-nist/pySHACL | 167 | 1759241 | <filename>pyshacl/rdfutil/consts.py
# -*- coding: utf-8 -*-
#
from rdflib import RDF, RDFS, Namespace
RDFS_Resource = RDFS.Resource
RDF_first = RDF.first
SH = Namespace('http://www.w3.org/ns/shacl#')
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/pulumi_azure/appservice/get_certificate_order.py | henriktao/pulumi-azure | 109 | 1759255 | <reponame>henriktao/pulumi-azure
# 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, Sequenc... | 0 | 0 | 0 | 0 | 0 | 0 |
blackwidow/tests/test_error.py | stitch/BlackWidow | 131 | 1759261 | from blackwidow import error
def test_blackwidow_error():
assert isinstance(error.BlackWidowIOError(), IOError)
| 0 | 0 | 0 | 0 | 0 | 0 |
python/src/Lib/plat-mac/macresource.py | vlinhd11/vlinhd11-android-scripting | 2,293 | 1759262 | <gh_stars>1000+
"""macresource - Locate and open the resources needed for a script."""
from warnings import warnpy3k
warnpy3k("In 3.x, the macresource module is removed.", stacklevel=2)
from Carbon import Res
import os
import sys
import MacOS
import macostools
class ArgumentError(TypeError): pass
class ResourceFileN... | 0 | 0 | 0 | 0 | 0 | 0 |
functools/functools.py | AEMICS/pycopy-lib | 126 | 1759264 | from __future__ import annotations
def partial(func, *args, **kwargs) -> object:
def _partial(*more_args, **more_kwargs) -> object:
kw = kwargs.copy()
kw.update(more_kwargs)
return func(*(args + more_args), **kw)
return _partial
def update_wrapper(wrapper, wrapped, assigned: object | N... | 5 | 12 | 0 | 0 | 17 | 0 |
netaddr/tests/strategy/test_ipv6_strategy.py | Rockly/netaddr | 416 | 1759268 | <gh_stars>100-1000
import platform
import sys
import pytest
from netaddr import AddrFormatError
from netaddr.strategy import ipv6
def test_strategy_ipv6():
b = '0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:0000000000000000:1111111111111111:1111111111111110'
i = 429496... | 0 | 0 | 0 | 0 | 0 | 0 |
openai/api_resources/error_object.py | abdulwahid789/openai-python | 404 | 1759269 | <reponame>abdulwahid789/openai-python
from __future__ import absolute_import, division, print_function
from openai.util import merge_dicts
from openai.openai_object import OpenAIObject
class ErrorObject(OpenAIObject):
def refresh_from(
self,
values,
api_key=None,
partial=False,
... | 0 | 0 | 0 | 0 | 0 | 0 |
neurodsp/tests/filt/test_checks.py | pranaysy/neurodsp | 154 | 1759286 | <filename>neurodsp/tests/filt/test_checks.py
"""Tests for neurodsp.filt.checks."""
import warnings
from pytest import raises
from neurodsp.tests.settings import FS
from neurodsp.filt.fir import design_fir_filter
from neurodsp.filt.checks import *
####################################################################... | 0 | 0 | 0 | 0 | 0 | 0 |
src/super_gradients/training/datasets/detection_datasets/__init__.py | Deci-AI/super-gradients | 308 | 1759292 | from super_gradients.training.datasets.detection_datasets.detection_dataset import DetectionDataSet
from super_gradients.training.datasets.detection_datasets.coco_detection import COCODetectionDataSet
from super_gradients.training.datasets.detection_datasets.pascal_voc_detection import PascalVOCDetectionDataSet
__all_... | 0 | 0 | 0 | 0 | 0 | 0 |
api/caching/tasks.py | gaybro8777/osf.io | 628 | 1759293 | from __future__ import annotations
from future.moves.urllib.parse import urlparse
from django.db import connection
from django.db.models import Sum
import requests
import logging
from django.apps import apps
from api.caching.utils import storage_usage_cache
from framework.postcommit_tasks.handlers import enqueue_post... | 1 | 4 | 0 | 0 | 5 | 0 |
cliport/tasks/towers_of_hanoi_seq.py | wx-b/cliport | 110 | 1759319 | """Towers of Hanoi task."""
import numpy as np
from cliport.tasks.task import Task
from cliport.utils import utils
import pybullet as p
import random
class TowersOfHanoiSeqUnseenColors(Task):
"""Towers of Hanoi Sequence base class and task."""
def __init__(self):
super().__init__()
self.max_... | 0 | 5 | 0 | 3 | 8 | 0 |
chachaddos/decrypt_second_stage.py | H1d3r/malware-research | 322 | 1759326 | <reponame>H1d3r/malware-research
#!/usr/bin/env python
#
# This script decrypt the 2nd stage of Linux/ChachaDDoS by emulating the
# decryption function (ChaCha) in first stage samples.
#
# For feedback or questions contact us at: <EMAIL>
# https://github.com/eset/malware-research/
#
# Author: <NAME> <<EMAIL>>
#
# This ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/vm-repair/azext_vm_repair/encryption_types.py | Mannan2812/azure-cli-extensions | 207 | 1759344 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | 0 | 0 | 4 | 0 | 4 | 0 |
lib/grizzled/grizzled/collections/__init__.py | MiCHiLU/google_appengine_sdk | 790 | 1759363 | <reponame>MiCHiLU/google_appengine_sdk
#!/usr/bin/env python
#
# $Id: 553a79b802962eda9d41fa7c7568abbc5840d07e $
# ---------------------------------------------------------------------------
"""
``grizzled.collections`` provides some useful Python collection classes.
"""
__docformat__ = "restructuredtext en"
# ------... | 0 | 0 | 0 | 0 | 0 | 0 |
zget/put.py | nils-werner/gynt | 527 | 1759377 | #!/usr/bin/env python
from __future__ import annotations
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import sys
import time
import socket
import six.moves.urllib as urllib
import hashlib
import logging
from zeroconf import ServiceInfo, Zeroconf
from six.moves.Base... | 7 | 2 | 4 | 0 | 13 | 0 |
parsifal/apps/reviews/planning/urls.py | ShivamPytho/parsifal | 342 | 1759401 | from django.urls import path
from parsifal.apps.reviews.planning import views
app_name = "planning"
urlpatterns = [
path("save_source/", views.save_source, name="save_source"),
path("remove_source/", views.remove_source_from_review, name="remove_source_from_review"),
path("suggested_sources/", views.sugg... | 0 | 0 | 0 | 0 | 0 | 0 |
applications/tensorflow/bert/tests/test_run_squad_runtime.py | payoto/graphcore_examples | 260 | 1759417 | # Copyright (c) 2021 Graphcore Ltd. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 0 | 1 | 0 | 0 | 1 | 0 |
demo/guide-python/callbacks.py | GinkoBalboa/xgboost | 23,866 | 1759427 | '''
Demo for using and defining callback functions
==============================================
.. versionadded:: 1.3.0
'''
import xgboost as xgb
import tempfile
import os
import numpy as np
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from matplotlib impor... | 0 | 2 | 0 | 1 | 3 | 0 |
scanner/plugins/cms/ecshop/ecshop_flow_orderid_sqli.py | UgOrange/onlinetools | 1,207 | 1759435 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
'''
name: ecshop3.0 flow.php 参数order_id注入
referer: http://www.wooyun.org/bugs/wooyun-2016-0212882
author: Lucifer
description: 文件flow.php中,参数order_id存在SQL注入。
'''
import sys
import json
import requests
class ecshop_flow_orderid_sqli_Base... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/python/unittest/test_tir_schedule_set_scope.py | psrivas2/relax | 4,640 | 1759454 | # 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... | 8 | 4 | 0 | 0 | 12 | 0 |
tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/parse/parser.py | bluetiger9/Vitis-AI | 848 | 1759479 |
#
# Copyright 2019 Xilinx 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 or agreed to in writi... | 2 | 7 | 0 | 2 | 11 | 0 |
test/pyom_consistency/friction_test.py | AkasDutta/veros | 111 | 1759484 | <reponame>AkasDutta/veros
from veros.core import friction
from veros.pyom_compat import get_random_state
from test_base import compare_state
TEST_SETTINGS = dict(
nx=70,
ny=60,
nz=50,
dt_tracer=3600,
dt_mom=3600,
enable_cyclic_x=True,
enable_conserve_energy=True,
enable_bottom_frictio... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/157034_Clike_iostream_syntax_in_Python/recipe-157034.py | tdiprima/code | 2,023 | 1759492 | from __future__ import annotations
import sys
class IOManipulator:
def __init__(self, function: object | None=None):
self.function = function
def do(self, output):
self.function(output)
class OStream:
def __init__(self, output: object | None=None):
if output is None:
... | 2 | 1 | 0 | 0 | 3 | 0 |
tests/components/camera/conftest.py | mtarjoianu/core | 30,023 | 1759502 | """Test helpers for camera."""
from unittest.mock import PropertyMock, patch
import pytest
from homeassistant.components import camera
from homeassistant.components.camera.const import StreamType
from homeassistant.setup import async_setup_component
from .common import WEBRTC_ANSWER
@pytest.fixture(name="mock_came... | 0 | 0 | 0 | 0 | 0 | 0 |
noise/__init__.py | jarret/noiseprotocol | 169 | 1759512 | <filename>noise/__init__.py
__all__ = ['connection']
| 0 | 0 | 0 | 0 | 0 | 0 |
sdk/cosmos/azure-mgmt-cosmosdb/tests/disable_test_cli_mgmt_cosmosdb_notebook_workspace.py | rsdoherty/azure-sdk-for-python | 2,728 | 1759520 | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/worldtests.py | alex4200/NBT | 241 | 1759524 | #!/usr/bin/env python
import sys,os
import tempfile, shutil
from io import BytesIO
import logging
import random
import time
import zlib
import unittest
try:
from unittest import skip as _skip
except ImportError:
# Python 2.6 has an older unittest API. The backported package is available from pypi.
import u... | 0 | 0 | 0 | 0 | 0 | 0 |
aries_cloudagent/protocols/out_of_band/v1_0/handlers/reuse_accept_handler.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 1759541 | <filename>aries_cloudagent/protocols/out_of_band/v1_0/handlers/reuse_accept_handler.py
"""Handshake Reuse Accepted Message Handler under RFC 0434."""
from .....messaging.base_handler import BaseHandler
from .....messaging.request_context import RequestContext
from .....messaging.responder import BaseResponder
from ..... | 0 | 0 | 0 | 0 | 0 | 0 |
Dynamic Programming/474. Ones and Zeroes.py | beckswu/Leetcode | 138 | 1759545 | <gh_stars>100-1000
#Bottom-up
class Solution:
def findMaxForm(self, strs, m, n):
"""
:type strs: List[str]
:type m: int
:type n: int
:rtype: int
"""
dp = [[0 for _ in range(n+1)] for _ in range(m+1)]
for s in strs:
c0 = s.cou... | 0 | 0 | 0 | 0 | 0 | 0 |
src/metric/__init__.py | zzangjinsun/NLSPN_ECCV20 | 181 | 1759581 | <gh_stars>100-1000
"""
Non-Local Spatial Propagation Network for Depth Completion
<NAME>, <NAME>, <NAME>, <NAME> and <NAME>
European Conference on Computer Vision (ECCV), Aug 2020
Project Page : https://github.com/zzangjinsun/NLSPN_ECCV20
Author : <NAME> (<EMAIL>)
============================... | 0 | 0 | 0 | 0 | 0 | 0 |
descarteslabs/workflows/interactive/widgets/input.py | descarteslabs/descarteslabs-python | 167 | 1759590 | <filename>descarteslabs/workflows/interactive/widgets/input.py
from typing import TypeVar, Generic, T, ClassVar
from ._ipywidgets import ipywidgets
from descarteslabs.common.proto.widgets import widgets_pb2
from ...types import Int, Float, Str
from ...types.widget import Widget
class Input(Widget, Generic[T]):
... | 0 | 0 | 0 | 0 | 0 | 0 |
substra/sdk/backends/base.py | eliaskousk/substra | 119 | 1759619 | <filename>substra/sdk/backends/base.py
import abc
class BaseBackend(abc.ABC):
def login(self, username, password):
pass
def get(self, asset_type, key):
raise NotImplementedError
def list(self, asset_type, filters=None):
raise NotImplementedError
def add(self, spec, spec_opt... | 0 | 0 | 0 | 0 | 0 | 0 |
modoboa/transport/factories.py | HarshCasper/modoboa | 1,602 | 1759622 | <filename>modoboa/transport/factories.py
"""Transport factories."""
import factory
from . import models
class TransportFactory(factory.django.DjangoModelFactory):
"""Factory for Transport."""
class Meta:
model = models.Transport
django_get_or_create = ("pattern", )
pattern = factory.Se... | 0 | 0 | 0 | 0 | 0 | 0 |
src/lightning_classes/datamodule_mnist.py | Bencpr/lightning_hydra_template | 122 | 1759657 | <gh_stars>100-1000
from typing import Dict
import pytorch_lightning as pl
from omegaconf import DictConfig
from torch.utils.data import random_split, DataLoader
from torchvision import transforms
from torchvision.datasets import MNIST
from src.datasets.mnist_dataset import MnistDataset
class MNISTDataModule(pl.Ligh... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/testapp/serializers.py | vicpopov/django-partial-index | 114 | 1759670 | from rest_framework import serializers
from testapp.models import RoomBookingText, RoomBookingQ
class RoomBookingTextSerializer(serializers.ModelSerializer):
"""Always fails with ImproperlyConfigured error, because mixin cannot be used with text-based conditions."""
class Meta:
model = RoomBookingTex... | 0 | 0 | 4 | 0 | 4 | 0 |
tutorials/W3D1_RealNeurons/solutions/W3D1_Tutorial4_Solution_07dba4f3.py | raxosiris/course-content | 2,294 | 1759681 | <gh_stars>1000+
"""
Discussion:
1. Yes. Because
a. area under the STDP curve is negative
b. synapses are set to their maximum possible weight.
c. presynaptic neurons have a variance in their firing rates because of Poisson nature
2. g_E will fluctuate even when synapses do not show any STDP because of the Poisson
na... | 0 | 0 | 0 | 0 | 0 | 0 |
Filters/General/Testing/Python/pointsPrecisions.py | forestGzh/VTK | 1,755 | 1759734 | <gh_stars>1000+
import unittest
from vtk.vtkCommonCore import vtkPoints, vtkDoubleArray, vtkIdList
from vtk.vtkCommonDataModel import vtkPlane,\
vtkUnstructuredGrid,\
vtkStructuredGrid,\
vtkPolyData
from vtk.vtkFil... | 0 | 0 | 0 | 0 | 0 | 0 |
dask_cuda/benchmarks/utils.py | pentschev/dask-cuda | 191 | 1759759 | <gh_stars>100-1000
import argparse
import os
from datetime import datetime
from dask.distributed import SSHCluster
from dask.utils import parse_bytes
from dask_cuda.local_cuda_cluster import LocalCUDACluster
def parse_benchmark_args(description="Generic dask-cuda Benchmark", args_list=[]):
parser = argparse.Arg... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/source/basic_functionality/camera/Camera01.py | mjpolak/K3D-jupyter | 704 | 1759764 | <reponame>mjpolak/K3D-jupyter<gh_stars>100-1000
import k3d
from k3d.platonic import Icosahedron
import numpy as np
from numpy import sin, cos, pi
def generate():
plot = k3d.plot()
plot += Icosahedron().mesh
plot += Icosahedron((0, 2, 1), size=0.3).mesh
plot.snapshot_type = 'inline'
return plot.g... | 0 | 0 | 0 | 0 | 0 | 0 |
experiments/chaotic_artist/initialize.py | enjalot/adventures_in_opencl | 152 | 1759782 | <gh_stars>100-1000
from OpenGL.GL import *
import numpy as np
import timing
timings = timing.Timing()
#@timings
def ca_np(ntracers):
pos = np.ones((ntracers, 4), dtype=np.float32)
col = np.ones((ntracers, 4), dtype=np.float32)
time = np.zeros((ntracers, 4), dtype=np.float32)
props = np.zeros((ntrace... | 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.