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 |
|---|---|---|---|---|
Python3/480.py | rakhi2001/ecom7 | 854 | 106911 | __________________________________________________________________________________________________
sample 120 ms submission
class Solution:
def medianSlidingWindow(self, nums: List[int], k: int) -> List[float]:
window = sorted(nums[:k])
res = []
if k % 2 == 0:
res.append((window[... |
inside/Driver/Driver_Manage.py | kangzai228/learning-power | 318 | 106925 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Author : lisztomania
# @Date : 2021/1/16
# @Software : Pycharm
# @Version : Python 3.8.5
# @File : Driver_Manage.py
# @Function : 驱动管理
import os
from selenium.webdriver.chrome.webdriver import WebDriver
from inside.Config.Api import API
from inside.Config.Pa... |
rls/envs/unity/wrappers/wrappers.py | StepNeverStop/RLs | 371 | 106949 | #!/usr/bin/env python3
# encoding: utf-8
from collections import defaultdict
from copy import deepcopy
from typing import Dict, List
import numpy as np
from mlagents_envs.environment import UnityEnvironment
from mlagents_envs.side_channel.engine_configuration_channel import \
EngineConfigurationChannel
... |
co2meter/__init__.py | alpxp/co2meter | 232 | 106953 | <filename>co2meter/__init__.py
# Top level __init__ file
from .co2meter import *
from ._version import __version__
|
models/wideresnet_noise_conditional.py | addisand/NSCN | 533 | 106956 | # Code adapted from https://github.com/google-research/google-research/tree/master/flax_models/cifar
# Original copyright statement:
# Copyright 2020 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 ... |
light_cnns/Transformer/__init__.py | murufeng/awesome_lightweight_networks | 318 | 106957 | <reponame>murufeng/awesome_lightweight_networks
from .mobile_vit import *
from .levit import *
from .ConvNeXt import *
|
pclib/cl/InValRdyRandStallAdapter.py | belang/pymtl | 206 | 106959 | #=========================================================================
# InValRdyRandStallAdapter
#=========================================================================
# Randomly stalls an input interface.
from copy import deepcopy
from random import Random
from pymtl import *
#------------... |
data/operator/bbox/spatial/xywh2cxcywh.py | zhangzhengde0225/SwinTrack | 143 | 106976 | <reponame>zhangzhengde0225/SwinTrack
def bbox_xywh2cxcywh(bbox):
cx = bbox[0] + bbox[2] / 2
cy = bbox[1] + bbox[3] / 2
return (cx, cy, bbox[2], bbox[3])
|
source/playbooks/AFSBP/ssmdocs/scripts/afsbp_parse_input.py | sybeck2k/aws-security-hub-automated-response-and-remediation | 129 | 106991 | <filename>source/playbooks/AFSBP/ssmdocs/scripts/afsbp_parse_input.py
#!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
corehq/apps/userreports/ui/widgets.py | dimagilg/commcare-hq | 471 | 107027 | <filename>corehq/apps/userreports/ui/widgets.py
import json
from django import forms
class JsonWidget(forms.Textarea):
def render(self, name, value, attrs=None, renderer=None):
if isinstance(value, str):
# It's probably invalid JSON
return super(JsonWidget, self).render(name, val... |
src/odb/test/python/16-db-read-write-octilinear-def_test.py | erictaur/OpenROAD | 525 | 107028 | import opendbpy as odb
import os
current_dir = os.path.dirname(os.path.realpath(__file__))
tests_dir = os.path.abspath(os.path.join(current_dir, os.pardir))
opendb_dir = os.path.abspath(os.path.join(tests_dir, os.pardir))
data_dir = os.path.join(tests_dir, "data")
db = odb.dbDatabase.create()
odb.read_lef(db, os.pat... |
envi/tests/msp430/icmp.py | rnui2k/vivisect | 716 | 107058 | <reponame>rnui2k/vivisect
from envi.archs.msp430.regs import *
checks = [
# CMP
(
'CMP r14, r15 (src == dst)',
{ 'regs': [(REG_R14, 0xaaaa), (REG_R15, 0xaaaa)], 'flags': [(SR_N, 0), (SR_Z, 0), (SR_C, 0), (SR_V, 0)], 'code': "0f9e", 'data': "" },
{ 'regs': [(REG_R14, 0xaaaa), (REG_R15, 0... |
Supervised Learning with scikit-learn/Chapter 1 - Classification.py | nabeelsana/DataCamp-courses | 464 | 107060 | <gh_stars>100-1000
#==============================================================================================================================#
#Chapter 1 Classification
#==============================================================================================================================#
#k-Nearest Ne... |
test/visuals/_test_inline.py | colinmford/coldtype | 142 | 107082 | <reponame>colinmford/coldtype
from test._test_inline2 import * #INLINE
from coldtype import *
@renderable()
def stub(r):
return test_function(r).f(0.3)
return (DATPen()
.oval(r.inset(50))
.f(0.8)) |
examples/cifar10_tensorflow/cifar10.py | jurgisp/xmanager | 392 | 107154 | # Copyright 2021 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 to... |
rdkit/sping/PS/__init__.py | kazuyaujihara/rdkit | 1,609 | 107158 | # package
from .pidPS import *
|
flexxamples/howtos/python_side_widget2.py | levinbgu/flexx | 1,662 | 107177 | <filename>flexxamples/howtos/python_side_widget2.py
from flexx import flx
class UserInput(flx.PyWidget):
def init(self):
with flx.VBox():
self.edit = flx.LineEdit(placeholder_text='Your name')
flx.Widget(flex=1)
@flx.reaction('edit.user_done')
def update_user(self, *events... |
music21/tree/verticality.py | cuthbertLab/music21 | 1,449 | 107183 | <gh_stars>1000+
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Name: tree/verticality.py
# Purpose: Object for dealing with vertical simultaneities in a
# fast way w/o Chord's overhead
#
# Authors: <NAME>
# <NAME>
#
... |
vendor/cuda/configure.bzl | redoclag/plaidml | 4,535 | 107186 | <filename>vendor/cuda/configure.bzl
_CUDA_TOOLKIT_PATH = "CUDA_TOOLKIT_PATH"
_VAI_CUDA_REPO_VERSION = "VAI_CUDA_REPO_VERSION"
_VAI_NEED_CUDA = "VAI_NEED_CUDA"
_DEFAULT_CUDA_TOOLKIT_PATH = "/usr/local/cuda"
# Lookup paths for CUDA / cuDNN libraries, relative to the install directories.
#
# Paths will be tried out in... |
ML/nlp/reuters_analysis.py | saneravi/ML_Stuff | 209 | 107210 | #!/usr/bin/env python
from collections import defaultdict
import numpy as np
from nltk.corpus import reuters
def analyze_data_distribution(cat2count):
i = 1
most_frequent_words = sorted(cat2count.items(),
key=lambda n: n[1]['train'],
reverse=... |
lineage/query_history_stats.py | yu-iskw/elementary | 282 | 107223 | <reponame>yu-iskw/elementary
from collections import defaultdict
from lineage.query_context import QueryContext
class QueryHistoryStats(object):
def __init__(self):
self._query_type_stats = defaultdict(lambda: 0)
self._roles = set()
self._users = set()
def update_stats(self, query_con... |
preprocess-nmt.py | iYUYUE/struct-attn | 261 | 107232 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Create the data for the LSTM.
"""
import os
import sys
import argparse
import numpy as np
import h5py
import itertools
from collections import defaultdict
class Indexer:
def __init__(self, symbols = ["<blank>","<unk>","<s>","</s>"]):
self.vocab = defaultdi... |
035_BodyPix/saved_model_to_coreml.py | IgiArdiyanto/PINTO_model_zoo | 1,529 | 107281 | import coremltools as ct
def model_convert(model_name, stride_num, H, W):
saved_model_path = f'{model_name}/{stride_num}/saved_model_{H}x{W}'
input = ct.TensorType(name='sub_2', shape=(1, H, W, 3))
mlmodel = ct.convert(saved_model_path, inputs=[input], source='tensorflow')
mlmodel.save(f'{saved_model_p... |
admin/internet_archive/views.py | gaybro8777/osf.io | 628 | 107302 | <filename>admin/internet_archive/views.py
from django.views.generic import TemplateView, View, FormView
from django.contrib import messages
from osf.management.commands.archive_registrations_on_IA import (
archive_registrations_on_IA,
)
from osf.management.commands.populate_internet_archives_collections import (
... |
data/transcoder_evaluation_gfg/python/SPLIT_ARRAY_ADD_FIRST_PART_END.py | mxl1n/CodeGen | 241 | 107383 | # 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 ( arr , n , k ) :
for i in range ( 0 , k ) :
x = arr [ 0 ]
for j in range ( 0 , n - 1 ) :
... |
oct2py/ipython/tests/test_octavemagic.py | adityaapte/oct2py | 195 | 107386 | """Tests for Octave magics extension."""
import codecs
import unittest
import sys
from IPython.display import SVG
from IPython.testing.globalipapp import get_ipython
import numpy as np
from oct2py.ipython import octavemagic
from oct2py import Oct2PyError
class OctaveMagicTest(unittest.TestCase):
@classmethod
... |
tests/sequence/test_annotation.py | danijoo/biotite | 208 | 107425 | # This source code is part of the Biotite package and is distributed
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
# information.
import biotite.sequence as seq
from biotite.sequence import Location, Feature, Annotation, AnnotatedSequence
import biotite.sequence.io.genbank as gb
import numpy a... |
src/masonite/stubs/events/Listener.py | cercos/masonite | 1,816 | 107456 | class __class__:
def handle(self, event):
pass
|
cbpro/__init__.py | shokitaka/coinbasepro-python | 1,023 | 107471 | <filename>cbpro/__init__.py<gh_stars>1000+
from cbpro.authenticated_client import AuthenticatedClient
from cbpro.public_client import PublicClient
from cbpro.websocket_client import WebsocketClient
from cbpro.order_book import OrderBook
from cbpro.cbpro_auth import CBProAuth
|
src/poliastro/earth/util.py | Carlosbogo/poliastro | 634 | 107481 | <filename>src/poliastro/earth/util.py<gh_stars>100-1000
import numpy as np
from astropy import units as u
from astropy.coordinates import get_sun
from poliastro import constants
from poliastro.util import wrap_angle
@u.quantity_input(ltan=u.hourangle)
def raan_from_ltan(epoch, ltan=12.0):
"""RAAN angle from LTAN... |
utils_nlp/interpreter/Interpreter.py | Anita1017/nlp-recipes | 4,407 | 107492 | <filename>utils_nlp/interpreter/Interpreter.py<gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Utilities that enables you to explain every hidden state in your model"""
import torch
from torch import nn
from torch import optim
from tqdm import tqdm
impor... |
rest-service/manager_rest/update_rest_db_config.py | ilan-WS/cloudify-manager | 124 | 107496 | <filename>rest-service/manager_rest/update_rest_db_config.py
#!/opt/manager/env/bin/python
import argparse
import grp
import json
import logging
import os
import pwd
import re
import shutil
import sys
import yaml
def _copy(src, dest, username, groupname):
"""Copy src to dest and chown to uid:gid"""
shutil.co... |
iwant/core/messagebaker.py | nirvik/iWant | 323 | 107514 | <gh_stars>100-1000
import json
from functools import wraps
import time_uuid
from constants import INDEXED, LEADER_NOT_READY,\
ERROR_LIST_ALL_FILES, LEADER,\
HASH_DUMP, FILE_SYS_EVENT, SEARCH_REQ, SEARCH_RES, \
LOOKUP, IWANT_PEER_FILE, PEER_LOOKUP_RESPONSE,\
SEND_PEER_DETAILS, FILE_DETAILS_RESP, INIT_FIL... |
tensorflow/contrib/slim/python/slim/data/dataset.py | connectthefuture/tensorflow | 101 | 107524 | # Copyright 2016 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 applicable ... |
users/signals.py | ThusharaX/mumbleapi | 187 | 107538 | from django.db.models.signals import post_save, pre_save, post_delete
from django.contrib.auth.models import User
from .models import UserProfile
def create_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(
user=instance,
name=instance.username,
username=instan... |
tests/agents/turtleagent/finish.py | LaudateCorpus1/holodeck | 518 | 107624 | """
Script that will navigate the "maze" in testworld
"""
def navigate(env, callback):
for _ in range(100):
callback(env.step([0, 0]))
for _ in range(11):
callback(env.step([0, -30]))
for _ in range(10):
callback(env.step([0, 0]))
for _ in range(123):
callback(env.s... |
pytest-webdriver/tests/unit/test_webdriver.py | RaiVaibhav/pytest-plugins | 167 | 107627 | from mock import Mock, sentinel, patch
import pytest
import selenium
import pytest_webdriver
def test_browser_to_use():
caps = Mock(CHROME=sentinel.chrome, UNKNOWN=None)
wd = Mock(DesiredCapabilities = Mock(return_value = caps))
assert pytest_webdriver.browser_to_use(wd, 'chrome') == sentinel.chrome
... |
code/general.py | hanseungwook/Stylized-ImageNet | 443 | 107645 | <reponame>hanseungwook/Stylized-ImageNet<filename>code/general.py
#!/usr/env/python
"""
General definitions and paths
"""
import argparse
import os
from os.path import join as pjoin
###########################################################
# SETTINGS THAT NEED TO BE CHANGED BY USER
#############################... |
scripts/dump_checkpoint_vars.py | ewpatton/fast-style-transfer-deeplearnjs | 1,419 | 107649 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
openaerostruct/common/atmos_comp.py | lamkina/OpenAeroStruct | 114 | 107651 | from collections import namedtuple
import numpy as np
from scipy.interpolate import Akima1DInterpolator as Akima
import openmdao.api as om
"""United States standard atmosphere 1976 tables, data obtained from http://www.digitaldutch.com/atmoscalc/index.htm"""
USatm1976Data = namedtuple("USatm1976Data", ["al... |
test/lang/c/test_synthesis.py | rakati/ppci-mirror | 161 | 107652 | import unittest
import io
from ppci import ir
from ppci.irutils import verify_module
from ppci.lang.c import CBuilder
from ppci.lang.c.options import COptions
from ppci.arch.example import ExampleArch
from ppci.lang.c import CSynthesizer
class CSynthesizerTestCase(unittest.TestCase):
def test_hello(self):
... |
deepvariant/realigner/python/ssw_misc_test.py | serge2016/deepvariant | 2,553 | 107661 | # Copyright 2017 Google LLC.
#
# 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 list of conditions and the following disclaimer.
#
#... |
Radar/radar_angle_radius_axis.py | pyecharts/pyecharts_gallery | 759 | 107663 | <filename>Radar/radar_angle_radius_axis.py
from pyecharts import options as opts
from pyecharts.charts import Radar
data = [{"value": [4, -4, 2, 3, 0, 1], "name": "预算分配"}]
c_schema = [
{"name": "销售", "max": 4, "min": -4},
{"name": "管理", "max": 4, "min": -4},
{"name": "技术", "max": 4, "min": -4},
{"name"... |
tasks/cluster_agent_cloudfoundry.py | Jeremyyang920/datadog-agent | 1,611 | 107671 | """
Cluster Agent for Cloud Foundry tasks
"""
import os
from invoke import task
from .build_tags import get_default_build_tags
from .cluster_agent_helpers import build_common, clean_common, refresh_assets_common, version_common
# constants
BIN_PATH = os.path.join(".", "bin", "datadog-cluster-agent-cloudfoundry")
... |
examples/bamboo/bamboo_plan_directory_info.py | Kudesnick/atlassian-python-api | 779 | 107673 | # coding=utf-8
import os
from atlassian import Bamboo
BAMBOO_URL = os.environ.get("BAMBOO_URL", "http://localhost:8085")
ATLASSIAN_USER = os.environ.get("ATLASSIAN_USER", "admin")
ATLASSIAN_PASSWORD = os.environ.get("ATLASSIAN_PASSWORD", "<PASSWORD>")
bamboo = Bamboo(url=BAMBOO_URL, username=ATLASSIAN_USER, password... |
sdk/netapp/azure-mgmt-netapp/tests/test_vault.py | rsdoherty/azure-sdk-for-python | 2,728 | 107684 | <filename>sdk/netapp/azure-mgmt-netapp/tests/test_vault.py
from devtools_testutils import AzureMgmtTestCase
from test_volume import create_volume, delete_volume, delete_pool, delete_account
from setup import *
import azure.mgmt.netapp.models
class NetAppAccountTestCase(AzureMgmtTestCase):
def setUp(self):
... |
koku/api/migrations/0039_create_hive_db.py | rubik-ai/koku | 157 | 107696 | # Generated by Django 3.1.7 on 2021-03-03 19:26
import logging
import os
from django.conf import settings
from django.db import migrations
from django.db.utils import ProgrammingError
from psycopg2.errors import DuplicateDatabase
from psycopg2.errors import DuplicateObject
from psycopg2.errors import InsufficientPrivi... |
maskrcnn_benchmark/modeling/roi_heads/boundary_head/roi_boundary_predictors.py | sergiev/ContourNet | 211 | 107708 | <reponame>sergiev/ContourNet
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch import nn
from torch.nn import functional as F
from maskrcnn_benchmark.layers import Conv2d
from maskrcnn_benchmark.layers import ConvTranspose2d
from maskrcnn_benchmark import layers
class BO... |
examples/gymfc_nf/controllers/pid.py | xabierolaz/gymfc | 270 | 107717 | import numpy as np
import logging
class PID(object):
def __init__(self, kp, ki, kd):
self.kp = kp
self.ki = ki
self.kd = kd
self.reset()
def update(self, t, e):
# TODO add anti-windup logic
# Most environments have a short execution time
# the co... |
modules/viz/misc/python/test/test_viz_simple.py | ptelang/opencv_contrib | 7,158 | 107731 | import os
import numpy as np
import cv2 as cv
from tests_common import NewOpenCVTests
def generate_test_trajectory():
result = []
angle_i = np.arange(0, 271, 3)
angle_j = np.arange(0, 1200, 10)
for i, j in zip(angle_i, angle_j):
x = 2 * np.cos(i * 3 * np.pi/180.0) * (1.0 + 0.5 * np.cos(1.2 + ... |
tests/test_product.py | ExtraE113/dj-stripe | 937 | 107769 | <filename>tests/test_product.py<gh_stars>100-1000
"""
dj-stripe Product model tests
"""
from copy import deepcopy
import pytest
import stripe
from djstripe.models import Product
from djstripe.models.core import Price
from . import (
FAKE_FILEUPLOAD_ICON,
FAKE_PLATFORM_ACCOUNT,
FAKE_PRICE,
FAKE_PRICE... |
recipes/Python/114579_remotely_exit_XMLRPC_Server/recipe-114579.py | tdiprima/code | 2,023 | 107847 | <gh_stars>1000+
from SimpleXMLRPCServer import *
class MyServer(SimpleXMLRPCServer):
def serve_forever(self):
self.quit = 0
while not self.quit:
self.handle_request()
def kill():
server.quit = 1
return 1
server = MyServer(('127.0.0.1', 8000))
server.register_function(kill)
server.serve_for... |
py/moma/utils/ik_solver.py | wx-b/dm_robotics | 128 | 107881 | <reponame>wx-b/dm_robotics
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... |
tests/java/org/python/indexer/data/pkgload.py | jeff5/jython-whinchat | 577 | 107888 | <reponame>jeff5/jython-whinchat
# test loading a package by dirname
import pkg
|
plenum/test/node_request/message_request/test_node_requests_missing_preprepares_and_prepares.py | jandayanan/indy-plenum | 148 | 107898 | <filename>plenum/test/node_request/message_request/test_node_requests_missing_preprepares_and_prepares.py<gh_stars>100-1000
from plenum.server.consensus.message_request.message_req_service import MessageReqService
from plenum.server.consensus.ordering_service import OrderingService
from plenum.test.delayers import dela... |
src/EKF.py | noskill/JRMOT_ROS | 112 | 107908 | # vim: expandtab:ts=4:sw=4
import numpy as np
import scipy.linalg
import pdb
"""
Table for the 0.95 quantile of the chi-square distribution with N degrees of
freedom (contains values for N=1, ..., 9). Taken from MATLAB/Octave's chi2inv
function and used as Mahalanobis gating threshold.
"""
chi2inv95 = {
1: 3.8415,... |
anymail/message.py | bhumikapahariapuresoftware/django-anymail | 1,324 | 107916 | from email.mime.image import MIMEImage
from email.utils import unquote
from pathlib import Path
from django.core.mail import EmailMessage, EmailMultiAlternatives, make_msgid
from .utils import UNSET
class AnymailMessageMixin(EmailMessage):
"""Mixin for EmailMessage that exposes Anymail features.
Use of thi... |
backend/api/views/import_export.py | skaghzz/doccano | 3,989 | 107918 | <filename>backend/api/views/import_export.py
from django.conf import settings
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
class Features(APIView):
permission_classes = (IsAuthenticated,)
def get(self, request, *a... |
tests/unit/document/test_namedscore.py | fastflair/docarray | 591 | 107935 | <gh_stars>100-1000
import pytest
from docarray.score import NamedScore
@pytest.mark.parametrize(
'init_args', [None, dict(value=123, description='hello'), NamedScore()]
)
@pytest.mark.parametrize('copy', [True, False])
def test_construct_ns(init_args, copy):
NamedScore(init_args, copy)
|
release/stubs.min/Grasshopper/Kernel/Graphs.py | htlcnn/ironpython-stubs | 182 | 107966 | <gh_stars>100-1000
# encoding: utf-8
# module Grasshopper.Kernel.Graphs calls itself Graphs
# from Grasshopper,Version=1.0.0.20,Culture=neutral,PublicKeyToken=dda4f5ec2cd80803
# by generator 1.145
""" NamespaceTracker represent a CLS namespace. """
# no imports
# functions
def GH_GraphProxyObject(n_owner): #... |
scripts/migrations/versions/45c7c3141a21_add_proto_type_settings_for_dial_vpn.py | lenz-li/FlexGW-1 | 212 | 108021 | """add proto type settings for dial vpn.
Revision ID: 45c7c3141a21
Revises: 313c830f061c
Create Date: 2014-10-10 10:22:23.395475
"""
# revision identifiers, used by Alembic.
revision = '45c7c3141a21'
down_revision = '313c830f061c'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto... |
Lib/test/lazyimports/dict_update.py | mananpal1997/cinder | 1,886 | 108053 | <reponame>mananpal1997/cinder
from __future__ import lazy_imports
import warnings
vars = {}
vars.update(globals())
print(repr(vars['warnings']))
|
python/unpickle/app.py | nobgr/vulhub | 9,681 | 108073 | import pickle
import base64
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def index():
try:
user = base64.b64decode(request.cookies.get('user'))
user = pickle.loads(user)
username = user["username"]
except:
username = "Guest"
return "Hello %s" % us... |
tools/dependency_finder.py | datalayer-contrib/jupyterwidgets-tutorial | 342 | 108080 | <gh_stars>100-1000
import re
import itertools
from pathlib import Path
import nbformat
from stdlib_list import stdlib_list
VALID_PACKAGE_CHARS = '[a-zA-Z0-9_]'
REG = re.compile(f'^\s*import ({VALID_PACKAGE_CHARS}+)|^\s*from ({VALID_PACKAGE_CHARS}+)\b+\simport', re.ASCII)
def import_statements(code_source):
"""
... |
stellargraph/utils/hyperbolic.py | DataLab-CQU/stellargraph | 2,428 | 108090 | <gh_stars>1000+
# -*- coding: utf-8 -*-
#
# Copyright 2020 Data61, CSIRO
#
# 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 b... |
codes/utils/timer.py | CJWBW/HCFlow | 123 | 108143 | <filename>codes/utils/timer.py
import time
class ScopeTimer:
def __init__(self, name):
self.name = name
def __enter__(self):
self.start = time.time()
return self
def __exit__(self, *args):
self.end = time.time()
self.interval = self.end - self.start
print(... |
python/kwiver/kwiver_tools.py | johnwparent/kwiver | 176 | 108156 | """
Console scripts for the tools provided by KWIVER.
These scripts are used in the wheel setup the environment to kwiver tools and
launch them in a subprocess.
"""
import os
import subprocess
import kwiver
import sys
from pkg_resources import iter_entry_points
from typing import Dict, List
from kwiver.vital import... |
tests/unit/plugins/filter/test_users_groups.py | manala/ansible-roles | 138 | 108157 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible_collections.community.general.tests.unit.compat import unittest
from ansible_collections.manala.roles.plugins.filter.users_groups import users_groups
from ansible.errors import AnsibleFilterError
class Test(unittest... |
tests/__init__.py | mochazi/objprint | 191 | 108176 | <gh_stars>100-1000
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/gaogaotiantian/objprint/blob/master/NOTICE.txt
|
dashboard/dashboard/graph_csv_test.py | ravitejavalluri/catapult | 2,151 | 108215 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import csv
import StringIO
import unittest
import webapp2
import webtest
from dashboard import graph_csv
from dashboard.common import datastore_hooks
from ... |
python/test.py | dugsong/libdnet | 103 | 108216 | <filename>python/test.py
#!/usr/bin/env python
import sys, unittest
from os import listdir
from interfacefinder import mac_addr,local_ip,loopback_intf
for dir in listdir('build'):
if dir.startswith('lib.'):
sys.path.insert(0, "build/" + dir)
import dnet
class AddrTestCase(unittest.TestCase):
def test_... |
backend/boards/admin.py | LucasSantosGuedes/App-Gestao | 142 | 108222 | from django.contrib import admin
from .models import Board, List, Item, Label, Comment, Attachment, Notification
admin.site.register(Board)
admin.site.register(List)
admin.site.register(Item)
admin.site.register(Label)
admin.site.register(Comment)
admin.site.register(Attachment)
admin.site.register(Notification)
|
playbooks/roles/libraries/library/docker_pull_image.py | lowang-bh/lain-1 | 524 | 108260 | <gh_stars>100-1000
#!/usr/bin/python
from subprocess import call, check_call
def main():
module = AnsibleModule(
argument_spec=dict(
image=dict(required=True),
registry=dict(default=''),
),
)
image = module.params['image']
registry = module.params['registry']
... |
learntopredict/carracing/nn.py | adafok/brain-tokyo-workshop | 1,097 | 108269 | # neural network functions and classes
import numpy as np
import random
import json
import cma
from es import SimpleGA, CMAES, PEPG, OpenES
from env import make_env
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def relu(x):
return np.maximum(x, 0)
def passthru(x):
return x
# useful for discrete actions
def sof... |
experiments/vera/combine_runs.py | Elfsong/pygaggle | 166 | 108311 | <reponame>Elfsong/pygaggle
"""Script to evaluate search engine on TREC-covid qrels."""
import argparse
import logging
import collections
from tqdm import tqdm
import numpy as np
def load_run(path, topk=1000):
"""Loads run into a dict of key: query_id, value: list of candidate doc
ids."""
# We want to pres... |
mt.py | rcmckee/BPT | 123 | 108330 | from torchtext import data
from torch.utils.data import DataLoader
from graph import MTBatcher, get_mt_dataset, MTDataset, DocumentMTDataset
from modules import make_translation_model
from optim import get_wrapper
from loss import LabelSmoothing
import numpy as np
import torch as th
import torch.optim as optim
import ... |
tests/test_base.py | iamthad/blendergltf | 343 | 108346 | def test_get_custom_properties(exporters, mocker):
blender_data = mocker.MagicMock()
vector = mocker.MagicMock()
vector.to_list.return_value = [0.0, 0.0, 1.0]
blender_data.items.return_value = [
['str', 'spam'],
['float', 1.0],
['int', 42],
['bool', False],
['vect... |
nb_third_party/dns/rdtypes/ANY/NXT.py | djprmf/namebench | 226 | 108455 | <reponame>djprmf/namebench<gh_stars>100-1000
# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear... |
utils/generate_preprocess_macro.py | kuba-kazimierczak/kaguya | 336 | 108474 |
import os
import sys
import re
import argparse
def gen_repeate_macro(out,format,count,start=1):
for num in range(start, count):
out.write(format.format(no=num,dec=num-1,inc=num+1))
out.write('\n')
def KAGUYA_PP_REPEAT(out,count):
out.write('#define KAGUYA_PP_REPEAT0(MACRO)\n')
gen_repeate... |
ghostwriter/commandcenter/migrations/0007_auto_20210616_0340.py | bbhunter/Ghostwriter | 601 | 108490 | <reponame>bbhunter/Ghostwriter
# Generated by Django 3.0.10 on 2021-06-16 03:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('commandcenter', '0006_auto_20210614_2224'),
]
operations = [
migrations.AlterField(
model_name='... |
RecoEcal/EgammaCoreTools/python/EcalSCDynamicDPhiParametersESProducer_cfi.py | ckamtsikis/cmssw | 852 | 108512 | import FWCore.ParameterSet.Config as cms
ecalSCDynamicDPhiParametersESProducer = cms.ESProducer("EcalSCDynamicDPhiParametersESProducer",
# Parameters from the analysis by <NAME> [https://indico.cern.ch/event/949294/contributions/3988389/attachments/2091573/3514649/2020_08_26_Clustering.pdf]
# dynamic dPhi para... |
tools/generate_inputs.py | juxiangyu/kaldi-onnx | 224 | 108533 | # Copyright 2019 Xiaomi, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
venv/Lib/site-packages/nipype/interfaces/mne/__init__.py | richung99/digitizePlots | 585 | 108553 | # -*- coding: utf-8 -*-
"""MNE is a software for exploring, visualizing, and analyzing human neurophysiological data."""
from .base import WatershedBEM
|
examples/devel/cgo08.py | dualword/pymol-open-source | 636 | 108574 | from pymol.cgo import *
from pymol import cmd
from random import random, seed
from chempy import cpv
# CGO cones
# first draw some walls
obj = [
COLOR, 1.0, 1.0, 1.0,
BEGIN, TRIANGLE_STRIP,
NORMAL, 0.0, 0.0, 1.0,
VERTEX, 0.0, 0.0, 0.0,
VERTEX, 10.0, 0.0, 0.0,
VERTEX, 0.0, 10.0, 0.0,
... |
rq/cli/__init__.py | dralley/rq | 4,261 | 108578 | <gh_stars>1000+
# flake8: noqa
from .cli import main
# TODO: the following imports can be removed when we drop the `rqinfo` and
# `rqworkers` commands in favor of just shipping the `rq` command.
from .cli import info, worker
|
adi_analyze/utils/ColorUtils_test.py | Bertlk/ADI | 226 | 108612 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/19 3:37 下午
# @Author : kewen
# @File : ColorUtils_test.py
import unittest
from utils.ColorUtils import toHex, get_n_rgb_colors
class Test(unittest.TestCase):
def test_toHex(self):
rgb = [244, 255, 196]
self.assertEqual(toHex(... |
loophole/polar/pb/sportprofile_mclaren_settings_pb2.py | oscarpicas/loophole | 153 | 108636 | <reponame>oscarpicas/loophole<gh_stars>100-1000
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_mclaren_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf impor... |
lib/disco/schemes/scheme_http.py | jgrnt/disco | 786 | 108666 | <gh_stars>100-1000
from disco import comm
def open(url, task=None):
return comm.open_url(url)
def input_stream(fd, sze, url, params):
"""Opens the specified url using an http client."""
import disco.worker
file = open(url, task=disco.worker.active_task)
return file, len(file), file.url
|
src/web/monitorforms/linux-service-running/__init__.py | anderson-attilio/runbook | 155 | 108667 | <gh_stars>100-1000
from wtforms import TextField, TextAreaField, SelectField
from wtforms.validators import DataRequired, Optional
from ..datacenter import DatacenterCheckForm
class CheckForm(DatacenterCheckForm):
''' Class that creates an form for the monitor Docker: Container is Running'''
title = "Linux: S... |
ansible/roles/lib_ops_utils/library/yum_repo_exclude.py | fahlmant/openshift-tools | 164 | 108668 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: expandtab:tabstop=4:shiftwidth=4
'''
See Ansible Module Documentation (Below)
'''
import re
import iniparse
DOCUMENTATION = '''
---
module: yum_repo_exclude
short_description: manage packages on a YUM repo's exclude line
description:
- Add package names or patterns... |
modelvshuman/datasets/noise_generalisation.py | TizianThieringer/model-vs-human | 158 | 108714 | <reponame>TizianThieringer/model-vs-human
from dataclasses import dataclass, field
from os.path import join as pjoin
from typing import List
from .registry import register_dataset
from .. import constants as c
from . import decision_mappings, info_mappings
from .dataloaders import PytorchLoader
from ..evaluation impor... |
tests/estimator/test_mixture_of_experts.py | LongmaoTeamTf/deep_recommenders | 143 | 108721 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
sys.dont_write_bytecode = True
import numpy as np
import tensorflow as tf
if tf.__version__ >= "2.0.0":
import tensorflow.compat.v1 as tf
tf.disable_eager_execution()
from absl.testing import parameterized
from deep_recommenders.datasets import SyntheticF... |
libsaas/services/basecamp/accesses.py | MidtownFellowship/libsaas | 155 | 108741 | <reponame>MidtownFellowship/libsaas
from libsaas import http, parsers
from libsaas.services import base
from .resource import BasecampResource
class AccessResource(BasecampResource):
path = 'accesses'
def create(self, *args, **kwargs):
raise base.MethodNotSupported()
def update(self, *args, **k... |
build/mac/should_use_hermetic_xcode.py | google-ar/chromium | 777 | 108799 | <filename>build/mac/should_use_hermetic_xcode.py
#!/usr/bin/env python
# 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.
"""Prints "1" if Chrome targets should be built with hermetic xcode. Otherwise
prints ... |
suzieq/sqobjects/routes.py | foobug/suzieq | 487 | 108818 | <filename>suzieq/sqobjects/routes.py
from suzieq.sqobjects.basicobj import SqObject
import pandas as pd
class RoutesObj(SqObject):
def __init__(self, **kwargs):
super().__init__(table='routes', **kwargs)
self._addnl_filter = 'metric != 4278198272'
self._valid_get_args = ['namespace', 'host... |
pyrival/numerical/polynomial.py | MattJDavidson/aoc2021 | 748 | 108842 | def poly(a, x):
val = 0
for ai in reversed(a):
val *= x
val += ai
return val
def diff(a):
return [a[i + 1] * (i + 1) for i in range(len(a) - 1)]
def divroot(a, x0):
b, a[-1] = a[-1], 0
for i in reversed(range(len(a) - 1)):
a[i], b = a[i + 1] * x0 + b, a[i]
a.p... |
tflib/ops/ops.py | AlexBlack2202/EigenGAN-Tensorflow | 302 | 108857 | <gh_stars>100-1000
import tensorflow as tf
def tile_concat(a_list, b_list=None):
# tile all elements of `b_list` and then concat `a_list + b_list` along the channel axis
# `a` shape: (N, H, W, C_a)
# `b` shape: can be (N, 1, 1, C_b) or (N, C_b)
if b_list is None:
b_list = []
a_list = list(... |
humor/scripts/process_amass_data.py | DalhousieAI/humor | 143 | 108894 | <reponame>DalhousieAI/humor
import sys, os
cur_file_path = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(cur_file_path, '..'))
import glob
import os
import argparse
import time
import numpy as np
import torch
import matplotlib.pyplot as plt
from sklearn.cluster import DBSCAN
from body_mod... |
PythonAPI/examples/rss/manual_control_rss.py | cpc/carla | 7,883 | 108896 | <filename>PythonAPI/examples/rss/manual_control_rss.py
#!/usr/bin/env python
# Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma de
# Barcelona (UAB).
# Copyright (c) 2019-2020 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensourc... |
test-crates/pyo3-mixed/test_pyo3_mixed.py | thedrow/maturin | 854 | 108932 | #!/usr/bin/env python3
import pyo3_mixed
def test_get_42():
assert pyo3_mixed.get_42() == 42
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.