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 |
|---|---|---|---|---|---|---|---|---|---|---|
modules/utorrent.py | scambra/HTPC-Manager | 422 | 136713 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'quentingerome'
import requests
from cherrypy.lib.auth2 import require, member_of
import logging
import htpc
import cherrypy
from HTMLParser import HTMLParser
from htpc.helpers import striphttp
logger = logging.getLogger('modules.utorrent')
class AuthTok... | 0 | 0 | 0 | 0 | 0 | 0 |
SimG4Core/PrintGeomInfo/python/g4PrintGeomSummary_cfi.py | ckamtsikis/cmssw | 852 | 136752 | <filename>SimG4Core/PrintGeomInfo/python/g4PrintGeomSummary_cfi.py
import FWCore.ParameterSet.Config as cms
def printGeomSummary(process):
process.load("SimGeneral.HepPDTESSource.pdt_cfi")
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi")
process.load("Geometry.MuonNumbering.m... | 0 | 0 | 0 | 0 | 0 | 0 |
mirage/libs/common/sdr/hackrf_definitions.py | tlechien/mirage | 123 | 136767 | <gh_stars>100-1000
from ctypes import *
import subprocess
from os.path import isfile
'''
This file contains the definitions used by HackRF one, e.g. library path or constants.
'''
HACKRFLIB_AVAILABLE = False
# Autofind the path of libhackrf.so
possiblePaths = [
"/usr/local/lib/libhackrf.so",
"/usr/lib/x86_64-linux-... | 0 | 0 | 0 | 0 | 0 | 0 |
pyfr/solvers/baseadvecdiff/elements.py | carlospereiraf/PyFR | 126 | 136770 | # -*- coding: utf-8 -*-
from pyfr.backends.base.kernels import ComputeMetaKernel
from pyfr.polys import get_polybasis
from pyfr.solvers.baseadvec import BaseAdvectionElements
class BaseAdvectionDiffusionElements(BaseAdvectionElements):
@property
def _scratch_bufs(self) -> object:
bufs = {'scal_fpts',... | 0 | 5 | 0 | 0 | 5 | 0 |
tests/test_zero/test_mem_collector.py | RichardoLuo/ColossalAI | 1,630 | 136779 | <gh_stars>1000+
import torch
import colossalai
import pytest
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
from colossalai.utils.cuda import get_current_device
from colossalai.utils.memory import colo_device_memory_capacity, colo_set_process_memory_fraction
from coloss... | 0 | 0 | 0 | 0 | 0 | 0 |
kafka_influxdb/encoder/collectd_json_encoder.py | gldnspud/kafka-influxdb | 224 | 136834 | <reponame>gldnspud/kafka-influxdb
try:
import ujson as json
except ImportError:
import json
import logging
try:
# Test for mypy support (requires Python 3)
from typing import List, Text
except:
pass
class Encoder(object):
"""
An encoder for the Collectd JSON format
See https://collec... | 0 | 0 | 0 | 0 | 0 | 0 |
dataset/merge.py | Pandinosaurus/roadtracer | 171 | 136880 | import numpy
from PIL import Image
import scipy.ndimage
import sys
path = sys.argv[1]
region = sys.argv[2]
x_start = int(sys.argv[3])
y_start = int(sys.argv[4])
x_end = int(sys.argv[5])
y_end = int(sys.argv[6])
out_fname = sys.argv[7]
x_len = x_end - x_start
y_len = y_end - y_start
merged_im = numpy.zeros((x_len * 4... | 0 | 0 | 0 | 0 | 0 | 0 |
ufora/FORA/python/PurePython/LogisticRegressionTests.py | ufora/ufora | 571 | 136902 | <reponame>ufora/ufora<gh_stars>100-1000
# Copyright 2015 Ufora 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 r... | 0 | 0 | 0 | 0 | 0 | 0 |
dojo/tools/nessus_was/parser.py | axelpavageau/django-DefectDojo | 1,772 | 136934 | <reponame>axelpavageau/django-DefectDojo<filename>dojo/tools/nessus_was/parser.py
import csv
import io
import logging
import re
import sys
from defusedxml import ElementTree
from dojo.models import Endpoint, Finding, Test
LOGGER = logging.getLogger(__name__)
class NessusWASCSVParser(object):
def _convert_severi... | 0 | 0 | 0 | 0 | 0 | 0 |
hubspot/crm/extensions/accounting/models/invoice_pdf_response.py | Ronfer/hubspot-api-python | 117 | 136936 | # coding: utf-8
from __future__ import annotations
"""
Accounting Extension
These APIs allow you to interact with HubSpot's Accounting Extension. It allows you to: * Specify the URLs that HubSpot will use when making webhook requests to your external accounting system. * Respond to webhook calls made to your ... | 3 | 7 | 2 | 3 | 15 | 0 |
extraPackages/Pillow-6.0.0/Tests/test_image_getdata.py | dolboBobo/python3_ios | 130 | 136937 | <reponame>dolboBobo/python3_ios<filename>extraPackages/Pillow-6.0.0/Tests/test_image_getdata.py
from .helper import PillowTestCase, hopper
class TestImageGetData(PillowTestCase):
def test_sanity(self):
data = hopper().getdata()
len(data)
list(data)
self.assertEqual(data[0], (20... | 0 | 0 | 0 | 0 | 0 | 0 |
mvpa2/cmdline/cmd_plotmotionqc.py | nno/PyMVPA | 227 | 136962 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... | 3 | 2 | 0 | 0 | 5 | 0 |
app/src/s3_cleanup.py | troydieter/aws-auto-cleanup | 322 | 136973 | <reponame>troydieter/aws-auto-cleanup
import sys
import threading
import boto3
from src.helper import Helper
class S3Cleanup:
def __init__(self, logging, whitelist, settings, execution_log):
self.logging = logging
self.whitelist = whitelist
self.settings = settings
self.execution... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_distributed_splunk_image.py | ridvan70/docker-splunk | 535 | 136996 | #!/usr/bin/env python
# encoding: utf-8
import pytest
import time
import re
import os
import tarfile
import requests
import tarfile
import docker
import json
import urllib
import yaml
import subprocess
from shutil import copy, copytree, rmtree
from executor import Executor
from docker.types import Mount
# Code to supp... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter05/5_8_verify_email.py | shamir456/Python-Network-Programming-Cookbook-Second-Edition | 125 | 136997 | <reponame>shamir456/Python-Network-Programming-Cookbook-Second-Edition<filename>Chapter05/5_8_verify_email.py
#!/usr/bin/env python
# Python Network Programming Cookbook, Second Edition -- Chapter - 5
# This program is optimized for Python 2.7.12 and Python 3.5.2.
# It may run on any other version with/without modifica... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/testing/core/helpers.py | wsqjny/Falcor | 1,615 | 136999 | '''
Module with various helpers functions.
'''
import os
import re
import subprocess
import time
import socket
from urllib.parse import urlparse
class GitError(Exception):
pass
def get_git_head_branch(path) -> object:
'''
Return the git HEAD branch name by reading from .git/HEAD file.
'''
try:
... | 1 | 5 | 0 | 0 | 6 | 0 |
senseact_mod/senseact/devices/dxl/dxl_driver_v1.py | homayoonfarrahi/cycle-time-study | 188 | 137053 | <filename>senseact_mod/senseact/devices/dxl/dxl_driver_v1.py
# Copyright (c) 2018, The SenseAct Authors.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
Requires DynamixelSDK repo written by Robotis- https://g... | 0 | 0 | 0 | 0 | 0 | 0 |
cv2/display-button/main-for-old_cv2.py | whitmans-max/python-examples | 140 | 137069 | #!/usr/bin/env python
from __future__ import annotations
from __future__ import print_function
import cv2
class Button(object):
def __init__(self, text, x, y, width, height, command: object | None=None):
self.text = text
self.x = x
self.y = y
self.width = width
self.heigh... | 1 | 0 | 0 | 2 | 3 | 0 |
challenge_1/python/carter010/reverse.py | rchicoli/2017-challenges | 271 | 137073 | <gh_stars>100-1000
# python3 --3.5
message = "Hello"
print(message[::-1]
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_envvars.py | vikas0212git/iotedgedev | 111 | 137084 | import os
from unittest import mock
import pytest
from iotedgedev.envvars import EnvVars
from iotedgedev.output import Output
pytestmark = pytest.mark.unit
def test_get_envvar__valid():
envvars = EnvVars(Output())
deployment_template = envvars.get_envvar("DEPLOYMENT_CONFIG_TEMPLATE_FILE")
assert deploym... | 0 | 0 | 0 | 0 | 0 | 0 |
Hackerrank/Apple and Orange/Apple and Orange.py | arushmangal/Hack-CP-DSA | 205 | 137085 | <filename>Hackerrank/Apple and Orange/Apple and Orange.py
#!/bin/python3
import math
import os
import random
import re
import sys
# The function accepts following parameters:
# 1. INTEGER s = start point
# 2. INTEGER t = End point
# 3. INTEGER a = location of apple tree
# 4. INTEGER b = location of orange tree
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/profile/management/commands/reimport_stripe_history.py | Paul3MK/NewsBlur | 3,073 | 137146 | <filename>apps/profile/management/commands/reimport_stripe_history.py
import stripe, datetime, time
from django.conf import settings
from django.core.management.base import BaseCommand
from utils import log as logging
from apps.profile.models import Profile
class Command(BaseCommand):
def add_arguments(self, pa... | 0 | 0 | 0 | 0 | 0 | 0 |
ambari-common/src/main/python/ambari_commons/unicode_tolerant_fs.py | likenamehaojie/Apache-Ambari-ZH | 1,664 | 137157 | <reponame>likenamehaojie/Apache-Ambari-ZH<gh_stars>1000+
"""
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 Li... | 0 | 0 | 0 | 0 | 0 | 0 |
haven/haven_results/images_fig.py | mariatippler/haven-ai | 145 | 137191 | <filename>haven/haven_results/images_fig.py
import copy
import glob
import os
import sys
import pprint
from itertools import groupby
from textwrap import wrap
import numpy as np
import pandas as pd
import pylab as plt
import tqdm
from . import plots_line
from .. import haven_utils as hu
try:
from IPython.display i... | 0 | 0 | 0 | 0 | 0 | 0 |
helpers/labml_helpers/datasets/csv.py | elgalu/labml | 463 | 137210 | import pandas as pd
import torch
from typing import Callable, List
from torch.utils.data import TensorDataset
class CsvDataset(TensorDataset):
data: pd
y_cols: List
x_cols: List
transform: Callable
test_fraction: float = 0.0
train: bool
def __init__(self, file_path: str, y_cols: List, x... | 7 | 0 | 6 | 0 | 13 | 0 |
spytest/apis/routing/evpn.py | shubav/sonic-mgmt | 132 | 137212 | <reponame>shubav/sonic-mgmt
import re
from spytest.utils import filter_and_select
from spytest import st, utils
import apis.system.port as port1
from apis.system.rest import get_rest,delete_rest,config_rest
from utilities.utils import get_interface_number_from_name
def config_bgp_evpn(dut, **kwargs):
"""
Au... | 0 | 0 | 0 | 0 | 0 | 0 |
mujoco/vtrace_main.py | mrbermell/seed_rl | 733 | 137219 | # coding=utf-8
# Copyright 2019 The SEED 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 agre... | 0 | 2 | 0 | 0 | 2 | 0 |
bcbio/cwl/main.py | a113n/bcbio-nextgen | 418 | 137228 | """Main entry point for running preparation of CWL inputs.
"""
from bcbio.pipeline import run_info
from bcbio.cwl import create
def run(args):
"""Run a CWL preparation pipeline.
"""
dirs, config, run_info_yaml = run_info.prep_system(args.sample_config, args.systemconfig)
integrations = args.integration... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/bin/ext/figleaf/internals.py | YangHao666666/hawq | 450 | 137232 | <gh_stars>100-1000
"""
Coverage tracking internals.
"""
import sys
import threading
err = sys.stderr
import types, symbol
# use builtin sets if in >= 2.4, otherwise use 'sets' module.
try:
set()
except NameError:
from sets import Set as set
def get_interesting_lines(code):
"""
Count 'interesting' l... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/sample_getcontextlogs.py | topdown618/aliyun-log-python-sdk | 130 | 137249 | <gh_stars>100-1000
# encoding: utf-8
from __future__ import print_function
from aliyun.log import *
import time
import os
def extract_pack_info(log):
contents = log.get_contents()
return contents.get('__tag__:__pack_id__', None), contents.get('__pack_meta__', None)
# @log_enter_exit
def sample_get_context_l... | 0 | 0 | 0 | 0 | 0 | 0 |
anaconda_project/internal/cli/activate.py | kathatherine/anaconda-project | 188 | 137258 | <reponame>kathatherine/anaconda-project
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2016, Anaconda, Inc. All rights reserved.
#
# Licensed under the terms of the BSD 3-Clause License.
# The full license is in the file LICENSE.txt, distributed w... | 0 | 0 | 0 | 0 | 0 | 0 |
bert-quantization/bert-tf-quantization/run_pretraining.py | dujiangsu/FasterTransformer | 777 | 137267 | <filename>bert-quantization/bert-tf-quantization/run_pretraining.py<gh_stars>100-1000
# coding=utf-8
# Copyright (c) 2019 NVIDIA CORPORATION. All rights reserved.
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except ... | 0 | 0 | 0 | 0 | 0 | 0 |
env/Lib/site-packages/plotly/validators/layout/uniformtext/_mode.py | andresgreen-byte/Laboratorio-1--Inversion-de-Capital | 11,750 | 137282 | <reponame>andresgreen-byte/Laboratorio-1--Inversion-de-Capital
import _plotly_utils.basevalidators
class ModeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(self, plotly_name="mode", parent_name="layout.uniformtext", **kwargs):
super(ModeValidator, self).__init__(
plo... | 0 | 0 | 0 | 0 | 0 | 0 |
ikalog/inputs/filters/warp.py | fetus-hina/IkaLog | 285 | 137338 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# IkaLog
# ======
# Copyright (C) 2015 <NAME>
# Copyright (C) 2015 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http... | 3 | 7 | 0 | 0 | 10 | 0 |
tests/models/speech_encoder_decoder/test_modeling_flax_speech_encoder_decoder.py | bugface/transformers | 8,028 | 137339 | # coding=utf-8
# Copyright 2022 HuggingFace Inc. team.
#
# 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... | 4 | 12 | 0 | 0 | 16 | 0 |
securityheaders/models/xframeoptions/__init__.py | th3cyb3rc0p/securityheaders | 151 | 137375 | from .xframeoptionsdirective import XFrameOptionsDirective
from .xframeoptions import XFrameOptions
__all__ = ['XFrameOptionsDirective','XFrameOptions']
| 0 | 0 | 0 | 0 | 0 | 0 |
AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py | loftwah/appscale | 790 | 137377 | from django.core.exceptions import ValidationError
from django.db import models
from django.utils.unittest import TestCase
class ValidationMessagesTest(TestCase):
def test_autofield_field_raises_error_message(self):
f = models.AutoField(primary_key=True)
self.assertRaises(ValidationError, f.clean... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/emukit/quadrature/test_warpings.py | EmuKit/Emukit | 272 | 137388 | from collections import namedtuple
import numpy as np
import pytest
from numpy.testing import assert_allclose
from pytest_lazyfixture import lazy_fixture
from emukit.quadrature.methods.warpings import IdentityWarping, SquareRootWarping
def create_fixture_parameters() -> object:
return [pytest.param(lazy_fixture... | 0 | 4 | 0 | 0 | 4 | 0 |
tests/models/archival_test.py | MSLars/allennlp | 11,433 | 137411 | import copy
import os
import tempfile
import tarfile
import pytest
import torch
from allennlp.version import _MAJOR, _MINOR
from allennlp.commands.train import train_model
from allennlp.common import Params
from allennlp.common.meta import Meta
from allennlp.common.checks import ConfigurationError
from allennlp.commo... | 0 | 0 | 0 | 0 | 0 | 0 |
meshpy/meshpy/image_converter.py | huikul/Dexterous_grasp | 193 | 137429 | <filename>meshpy/meshpy/image_converter.py
"""
Classes to convert binary images to extruded meshes
Author: <NAME>
"""
import IPython
import logging
import numpy as np
import os
from PIL import Image, ImageDraw
import sklearn.decomposition
import sys
import matplotlib.pyplot as plt
import skimage.morphology as morph
f... | 0 | 0 | 0 | 0 | 0 | 0 |
jionlp/algorithm/summary/__init__.py | ji3g4m6zo6/JioNLP | 1,063 | 137437 | <reponame>ji3g4m6zo6/JioNLP
# -*- coding=utf-8 -*-
# library: jionlp
# author: dongrixinyu
# license: Apache License 2.0
# Email: <EMAIL>
# github: https://github.com/dongrixinyu/JioNLP
# description: Preprocessing tool for Chinese NLP
from .extract_summary import ChineseSummaryExtractor
extract_summary = ChineseSu... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/contrib/xkcd.py | klorel/or-tools | 279 | 137447 | # Copyright 2010 <NAME> <EMAIL>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 0 | 0 | 0 | 0 | 0 | 0 |
config_system/generator/generate.py | ambrop72/aprinter | 133 | 137453 | <filename>config_system/generator/generate.py
# Copyright (c) 2015 <NAME>
# 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
# ... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/terraform/checks/resource/linode/test_user_email_set.py | jamesholland-uk/checkov | 4,013 | 137454 | import unittest
import hcl2
from checkov.terraform.checks.resource.linode.user_email_set import check
from checkov.common.models.enums import CheckResult
class Testuser_email_set(unittest.TestCase):
def test_success(self):
hcl_res = hcl2.loads("""
resource "linode_user" "test" {
email="<... | 0 | 0 | 0 | 0 | 0 | 0 |
pyprob/__init__.py | SRagy/pyprob | 125 | 137458 | <reponame>SRagy/pyprob
__version__ = '1.3.0.dev7'
from .util import TraceMode, PriorInflation, InferenceEngine, InferenceNetwork, Optimizer, LearningRateScheduler, ObserveEmbedding, set_verbosity, set_device, seed
from .state import sample, observe, factor, tag
from .address_dictionary import AddressDictionary
from .m... | 0 | 0 | 0 | 0 | 0 | 0 |
py/testdir_multi_jvm/notest_import_covtype_parse_4jvm_fvec.py | gigliovale/h2o | 882 | 137464 | <reponame>gigliovale/h2o
import unittest, sys, random, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_browse as h2b, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
pass
print "Wil... | 0 | 0 | 0 | 0 | 0 | 0 |
OpenAttack/victim/classifiers/__init__.py | e-tornike/OpenAttack | 444 | 137507 | from .base import Classifier
from .transformers import TransformersClassifier | 0 | 0 | 0 | 0 | 0 | 0 |
cocos/numerics/_algorithm.py | michaelnowotny/cocos | 101 | 137519 | import arrayfire as af
import typing as tp
from ._array import ndarray, _wrap_af_array
def count_nonzero(a: ndarray,
axis: tp.Optional[int] = None) \
-> tp.Union[int, ndarray]:
return _wrap_af_array(af.count(a._af_array, dim=axis))
def diff(a: ndarray,
n: int = 1,
ax... | 18 | 7 | 0 | 0 | 25 | 0 |
test/datasets/test_dukemtmc.py | Tianyu97/Person-Re-identification-Research-Based-on-Deep-Learning | 1,341 | 137520 | from unittest import TestCase
class TestDukeMTMC(TestCase):
def test_all(self):
import os.path as osp
from reid.datasets import DukeMTMC
from reid.utils.serialization import read_json
root, split_id, num_val = '/tmp/open-reid/dukemtmc', 0, 100
dataset = DukeMTMC(root, spli... | 0 | 0 | 0 | 0 | 0 | 0 |
propeller/__init__.py | ColeFang/MOCO_ERNIE | 3,712 | 137531 | # Copyright (c) 2019 PaddlePaddle 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 app... | 0 | 0 | 0 | 0 | 0 | 0 |
habu/cli/cmd_crack_snmp.py | optimustoaster/habu | 461 | 137532 | #!/usr/bin/env python3
import logging
import os
import sys
from pathlib import Path
import click
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import ASN1_OID, IP, SNMP, UDP, SNMPget, SNMPvarbind, conf, sr1
@click.command()
@click.argument('ip')
@click.option('-p', 'port', default=161,... | 0 | 1 | 0 | 0 | 1 | 0 |
RecoJets/JetAnalyzers/test/JetIdExample.py | ckamtsikis/cmssw | 852 | 137533 | # PYTHON configuration file for class: JetIdExample
# Description: Example showing how to conveniently select collection
# of jets in the event which pass the jet id criteria ("loose",
# "medium", "tight",..etc) using a simple one-line plugin.
#
# Author: <NAME>
# Date: 18 - January - 2011
import FWCore.ParameterSet... | 0 | 0 | 0 | 0 | 0 | 0 |
cctbx/xray/targets/tst_shelxl_wght_ls.py | dperl-sol/cctbx_project | 155 | 137539 | from __future__ import absolute_import, division, print_function
import cctbx.xray.targets
from cctbx.array_family import flex
from libtbx.test_utils import approx_equal
from six.moves import range
def calc_k(f_obs, i_calc) -> object:
fc = flex.sqrt(i_calc)
num = flex.sum(f_obs * fc)
den = flex.sum(fc * fc)
as... | 0 | 5 | 0 | 0 | 5 | 0 |
xdoctest/_old_pkgutil_code.py | MatsLanGoH/xdoctest | 142 | 137544 | <filename>xdoctest/_old_pkgutil_code.py
def _pkgutil_submodule_names(modpath, with_pkg=False, with_mod=True):
"""
Ignore:
x = sorted(submodule_paths(modname_to_modpath('ubelt')))
y = sorted(_pkgutil_submodule_names(modname_to_modpath('ubelt')))
x = [modpath_to_modname(p, hide_init=False... | 0 | 0 | 0 | 0 | 0 | 0 |
PhysicsTools/IsolationAlgos/python/highPtTrackIsolations_cff.py | ckamtsikis/cmssw | 852 | 137553 | import FWCore.ParameterSet.Config as cms
from PhysicsTools.IsolationAlgos.tkIsoDeposits_cff import *
EcalIsolationForTracks = cms.EDProducer("IsolationProducerForTracks",
highPtTracks = cms.InputTag("highPtTracks"),
tracks = cms.InputTag("goodTracks"),
isoDeps = cms.InputTag("tkIsoDepositCalByAssociatorTow... | 0 | 0 | 0 | 0 | 0 | 0 |
apps/dash-deck-explorer/demos/usage-heatmap-layer.py | JeroenvdSande/dash-sample-apps | 2,332 | 137643 | <filename>apps/dash-deck-explorer/demos/usage-heatmap-layer.py
"""
Adapted from: https://pydeck.gl/gallery/heatmap_layer.html
Location of livestock raised in New Mexico in the United States in 2006,
via the United Nations and FAOSTAT, with the source data viewable here:
http://www.fao.org/faostat/en/
Locations for po... | 0 | 0 | 0 | 0 | 0 | 0 |
zentral/core/secret_engines/backends/base.py | janheise/zentral | 634 | 137649 | <reponame>janheise/zentral<filename>zentral/core/secret_engines/backends/base.py
class BaseSecretEngine:
def __init__(self, config_d):
self.name = config_d['secret_engine_name']
self.default = config_d.get("default", False)
def encrypt(self, data, **context):
raise NotImplementedError
... | 0 | 0 | 0 | 0 | 0 | 0 |
contrib/nn/layers.py | cjgalvin/deepchem | 3,782 | 137650 | <gh_stars>1000+
"""Custom Keras Layers.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "<NAME> and <NAME>"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import warnings
import numpy as np
import tensorflow as t... | 0 | 0 | 0 | 0 | 0 | 0 |
orchestra/workflow/directory.py | code-review-doctor/orchestra | 444 | 137660 | <reponame>code-review-doctor/orchestra
import json
import os
from orchestra.core.errors import WorkflowError
def parse_workflow_directory(workflow_directory):
parsed = {
'versions': [],
}
# Verify that the directory exists.
if not os.path.exists(workflow_directory):
raise WorkflowErr... | 0 | 0 | 0 | 0 | 0 | 0 |
saleor/product/migrations/0093_auto_20190521_0124.py | elwoodxblues/saleor | 15,337 | 137668 | <reponame>elwoodxblues/saleor
# Generated by Django 2.2.1 on 2019-05-21 06:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("product", "0092_auto_20190507_0309")]
operations = [
migrations.AddField(
model_name="collectionproduct",
... | 0 | 0 | 0 | 0 | 0 | 0 |
aognet/loader/cifar100.py | xilaili/AOGNet | 148 | 137673 | import os
import sys
import mxnet as mx
def cifar100_iterator(cfg, kv) -> tuple[object, object]:
train_rec = os.path.join(cfg.dataset.data_dir, "cifar100_train.rec")
val_rec = os.path.join(cfg.dataset.data_dir, "cifar100_test.rec")
mean = [129.31, 124.11, 112.4]
std = [68.21, 65.41, 70.41]
trai... | 0 | 1 | 0 | 0 | 1 | 0 |
service_catalog/views/operation_list_view.py | LaudateCorpus1/squest | 112 | 137733 | from django.urls import reverse
from django_filters.views import FilterView
from django_tables2.views import SingleTableMixin
from guardian.mixins import LoginRequiredMixin
from service_catalog.filters.operation_filter import OperationFilter
from service_catalog.models import Operation, Service
from service_catalog.ta... | 0 | 2 | 2 | 0 | 4 | 0 |
mmcv/runner/hooks/sampler_seed.py | XinYangDong/mmcv-0.2.10 | 384 | 137741 | <reponame>XinYangDong/mmcv-0.2.10<filename>mmcv/runner/hooks/sampler_seed.py
from .hook import Hook
class DistSamplerSeedHook(Hook):
def before_epoch(self, runner):
runner.data_loader.sampler.set_epoch(runner.epoch)
| 0 | 0 | 0 | 0 | 0 | 0 |
bulma/apps.py | makiolo/django-bulma | 330 | 137759 | from django.apps import AppConfig
class BulmaConfig(AppConfig):
name: str = 'bulma'
| 0 | 0 | 1 | 0 | 1 | 0 |
scripts/examples/OpenMV/02-Board-Control/adc_read_int_channel.py | jiskra/openmv | 1,761 | 137763 | <reponame>jiskra/openmv
# ADC Internal Channels Example
#
# This example shows how to read internal ADC channels.
import time, pyb
adc = pyb.ADCAll(12)
print("VREF = %.1fv VREF = %.1fv Temp = %d" % (adc.read_core_vref(), adc.read_core_vbat(), adc.read_core_temp()))
| 0 | 0 | 0 | 0 | 0 | 0 |
fastai_do_not_use/callbacks/general_sched.py | anhquan0412/fastai_v1 | 115 | 137766 | <gh_stars>100-1000
from ..core import *
from ..callback import *
from ..basic_train import Learner
__all__ = ['GeneralScheduler', 'TrainingPhase']
@dataclass
class TrainingPhase():
"Schedule lr,mom according to `lr_anneal` and `mom_anneal` across a `length` schedule"
length:int
lrs:Floats
moms:Floats
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/type_whisperer/file_descriptor_set_text_gen.py | lopter-dbx/envoy | 218 | 137796 | <gh_stars>100-1000
# Generate a text proto from a given list of FileDescriptorSets.
# TODO(htuch): switch to base64 encoded binary output in the future,
# this will avoid needing to deal with option preserving imports below.
import sys
from google.protobuf import descriptor_pb2
# Needed to avoid annotation option st... | 0 | 0 | 0 | 0 | 0 | 0 |
frappe-bench/env/lib/python2.7/site-packages/faker/providers/address/nl_NL/__init__.py | ibrahmm22/library-management | 412 | 137797 | # coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
building_number_formats: tuple[str, str, str, str, str, str] = ('#', '##', '###', '#', '##', '###')
street_suffixes: tuple[str, str, str, str, str, str, str, str, str, str, str... | 0 | 2 | 10 | 0 | 12 | 0 |
frontera/worker/components/batch_generator.py | buildfail/frontera | 1,267 | 137799 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import threading
from time import asctime, time
from collections import defaultdict
from logging import DEBUG
from frontera.exceptions import NotConfigured
from frontera.utils.url import parse_domain_from_url_fast
from . import DBWorkerThr... | 0 | 0 | 0 | 0 | 0 | 0 |
Tests/compat/sbs_exceptions/while_loop.py | cwensley/ironpython2 | 1,078 | 137804 | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information.
from common import runtests
from .shared import while_loop_maker
from .shared import setGenerator, setKnownFail... | 0 | 0 | 0 | 0 | 0 | 0 |
support/compute-powers.py | ldanko/fmt | 13,148 | 137832 | <gh_stars>1000+
#!/usr/bin/env python
# Compute 10 ** exp with exp in the range [min_exponent, max_exponent] and print
# normalized (with most-significant bit equal to 1) significands in hexadecimal.
from __future__ import print_function
min_exponent = -348
max_exponent = 340
step = 8
significand_size = 64
exp_offset... | 0 | 0 | 0 | 0 | 0 | 0 |
test/python/test_push.py | yiranwang52/makisu | 2,355 | 137876 | <reponame>yiranwang52/makisu
import os
import subprocess
import tempfile
from .utils import new_image_name, docker_save_image, makisu_push_image, docker_run_image
def test_push_simple(registry1, registry2, storage_dir, tmpdir):
new_image = new_image_name()
replica_image = new_image_name()
_, image_tar_p... | 0 | 0 | 0 | 0 | 0 | 0 |
hedera-node/forensics/start-investigation.py | tinker-michaelj/hedera-services | 164 | 137880 | import os
import re
import sys
import shutil
import filecmp
from functools import reduce
fcm_types = ['accounts', 'storage', 'topics']
avail_nodes = []
dumps_root_dir = ''
investigation_name = 'iss'
rounds_avail = {}
account_fcm_pattern = re.compile(r'accounts-round(\d+)[.]fcm')
first_round_post_iss = 0
def prepare_... | 0 | 4 | 0 | 0 | 4 | 0 |
examples/aiohttp_fetch.py | zerotypic/asyncqt | 158 | 137882 | import sys
import asyncio
import aiohttp
from asyncqt import QEventLoop, asyncSlot, asyncClose
# from PyQt5.QtWidgets import (
from PySide2.QtWidgets import (
QApplication, QWidget, QLabel, QLineEdit, QTextEdit, QPushButton,
QVBoxLayout)
class MainWindow(QWidget):
"""Main window."""
_DEF_URL: str =... | 0 | 0 | 2 | 0 | 2 | 0 |
spacy/tests/lang/ja/test_lemmatization.py | g4brielvs/spaCy | 22,040 | 137885 | <filename>spacy/tests/lang/ja/test_lemmatization.py
import pytest
@pytest.mark.parametrize(
"word,lemma",
[("新しく", "新しい"), ("赤く", "赤い"), ("すごく", "すごい"), ("いただきました", "いただく"), ("なった", "なる")],
)
def test_ja_lemmatizer_assigns(ja_tokenizer, word, lemma):
test_lemma = ja_tokenizer(word)[0].lemma_
assert te... | 0 | 0 | 0 | 0 | 0 | 0 |
localflavor/au/forms.py | Malomalsky/django-localflavor | 619 | 137905 | from __future__ import annotations
"""Australian-specific Form helpers."""
from django.forms.fields import CharField, RegexField, Select
from django.utils.translation import gettext_lazy as _
from .au_states import STATE_CHOICES
from .validators import AUBusinessNumberFieldValidator, AUCompanyNumberFieldValidator, AU... | 2 | 5 | 4 | 0 | 11 | 0 |
rotkehlchen/chain/ethereum/modules/gitcoin/__init__.py | rotkehlchenio/rotkehlchen | 137 | 137924 | <reponame>rotkehlchenio/rotkehlchen
from .accountant import GitcoinAccountant # noqa: F401
from .decoder import GitcoinDecoder # noqa: F401
| 0 | 0 | 0 | 0 | 0 | 0 |
knifey.py | bogianoithonda/tensoflow_tutorial | 9,714 | 137953 | ########################################################################
#
# Functions for downloading the Knifey-Spoony data-set from the internet
# and loading it into memory. Note that this only loads the file-names
# for the images in the data-set and does not load the actual images.
#
# Implemented in Python 3.5
#... | 0 | 1 | 0 | 0 | 1 | 0 |
src/genie/libs/parser/iosxr/tests/ShowPlacementProgramAll/cli/equal/golden_output_2_expected.py | balmasea/genieparser | 204 | 137957 |
expected_output = {
"program": {
"auto_ip_ring": {
"instance": {
"default": {
"active": "0/RSP1/CPU0",
"active_state": "RUNNING",
"group": "central-services",
"jid": "1156",
"sta... | 0 | 0 | 0 | 0 | 0 | 0 |
GramAddict/core/bot_flow.py | GramAddict/bot | 323 | 138022 | import logging
import random
from datetime import datetime, timedelta
from sys import exit
from time import sleep
from colorama import Fore, Style
from GramAddict.core.config import Config
from GramAddict.core.device_facade import create_device, get_device_info
from GramAddict.core.filter import load_config as load_f... | 0 | 1 | 0 | 0 | 1 | 0 |
src/visitpy/visit_flow/flow/src/filters/pyocl_kernels.py | visit-dav/vis | 226 | 138051 | # Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
# Project developers. See the top-level LICENSE file for dates and other
# details. No copyright assignment is required to contribute to VisIt.
"""
file: pyocl_kernels.py
author: <NAME> <<EMAIL>>
created: 9/6/2012
description:
"""
# Guar... | 0 | 1 | 0 | 0 | 1 | 0 |
timemachines/skatertools/offlinetesting/optimizerandomskater.py | iklasky/timemachines | 253 | 138059 | <reponame>iklasky/timemachines
from timemachines.skatertools.tuning.hyper import optimal_r
from timemachines.skatertools.data.synthetic import brownian_with_exogenous
from timemachines.skaters.localskaters import SKATERS_R1, SKATERS_R2, SKATERS_R3
import time
import random
from pprint import pprint
from timemachines.sk... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_attr_access.py | pdxjohnny/rpyc | 238 | 138062 | import rpyc
import copy
import unittest
from rpyc.utils.server import ThreadedServer
class MyClass(object):
def __add__(self, other) -> object:
return self.foo() + str(other)
def foo(self) -> str:
return "foo"
def bar(self) -> str:
return "bar"
def spam(self) -> str:
... | 1 | 16 | 0 | 2 | 19 | 0 |
tests/commands/test__vi_f.py | my-personal-forks/Vintageous | 1,146 | 138065 | <reponame>my-personal-forks/Vintageous<gh_stars>1000+
from collections import namedtuple
from Vintageous.tests import ViewTest
from Vintageous.vi.utils import modes
test_data = namedtuple('test_data', 'text startRegion findChar mode expectedRegion msg')
NORMAL_CASES = (
test_data('0a23x5', (1, 1), 'x', modes.NOR... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/pytests/unit/modules/test_zfs_solaris10.py | markgras/salt | 9,425 | 138076 | """
Tests for salt.modules.zfs on Solaris
"""
import pytest
import salt.config
import salt.loader
import salt.modules.zfs as zfs
import salt.utils.zfs
from tests.support.mock import MagicMock, patch
from tests.support.zfs import ZFSMockData
@pytest.fixture
def utils_patch() -> object:
return ZFSMockData().get_pa... | 0 | 2 | 0 | 0 | 2 | 0 |
europilot/__version__.py | kc8055/europilot | 1,069 | 138082 | __title__ = 'europilot'
__description__ = 'End to end driving simulation inside Euro Truck Simulator 2'
__version__ = '0.0.1'
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_odict.py | thomasrockhu-codecov/aws-cfn-template-flip | 904 | 138091 | """
Copyright 2016-2017 Amazon.com, Inc. or its 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. A copy of the License is located at
http://aws.amazon.com/apache2.0/
or in the "license" file accompany... | 0 | 0 | 0 | 0 | 0 | 0 |
bin/api_connector_splunk/solnlib/packages/schematics/datastructures.py | CyberGRX/api-connector-splunk | 106 | 138154 | <filename>bin/api_connector_splunk/solnlib/packages/schematics/datastructures.py
# -*- coding: utf-8 -*-
# pylint: skip-file
from __future__ import unicode_literals, absolute_import
from collections import MutableMapping, KeysView, ValuesView, ItemsView
from copy import deepcopy
from operator import eq
from .common ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/gonla/nlabin/nladbm/nladbm.py | RudSmith/beluganos | 119 | 138181 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Nippon Telegraph and Telephone Corporation.
#
# 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/l... | 0 | 2 | 0 | 0 | 2 | 0 |
demo/objsearch/objsearch.py | dgtlmoon/deepdetect | 1,672 | 138221 | import os, sys, argparse
from os import listdir
from os.path import isfile, join
from os import walk
from dd_client import DD
from annoy import AnnoyIndex
import shelve
import cv2
parser = argparse.ArgumentParser()
parser.add_argument("--index",help="repository of images to be indexed")
parser.add_argument("--index-ba... | 0 | 0 | 0 | 0 | 0 | 0 |
psdaq/psdaq/pyxpm/surf/dsp/fixed/_FirFilterMultiChannel.py | ZhenghengLi/lcls2 | 134 | 138225 | <gh_stars>100-1000
#-----------------------------------------------------------------------------
# This file is part of the 'SLAC Firmware Standard Library'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanfor... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/converters/nastran/test_nastran_gui.py | luzpaz/pyNastran | 293 | 138274 | from __future__ import annotations
"""tests the NastranIO class"""
import os
from copy import deepcopy
import unittest
import numpy as np
try:
import matplotlib
matplotlib.use('Agg')
IS_MATPLOTLIB = True
except ModuleNotFoundError: # pyparsing is missing
IS_MATPLOTLIB = False
#except ImportError:
... | 1 | 0 | 0 | 0 | 1 | 0 |
pptutils.py | TomWildenhain/pptcc | 448 | 138284 | <reponame>TomWildenhain/pptcc<filename>pptutils.py
def hex_to_int(hex):
assert hex.startswith('0x')
hex = hex[2:]
total = 0
for h in hex:
total *= 16
total += '0123456789abcdef'.index(h)
return total
def byte_to_uint(byte):
total = 0
for c in byte:
total *= 2
... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/tests/test_ip_netns_exec_namespace_lsof.py | lhuett/insights-core | 121 | 138294 | from insights.parsers import SkipException
from insights.parsers import ip_netns_exec_namespace_lsof
from insights.parsers.ip_netns_exec_namespace_lsof import IpNetnsExecNamespaceLsofI
from insights.tests import context_wrap
import doctest
import pytest
IP_NETNS_EXEC_NAMESPACE_LSOF_I = """
COMMAND PID USER FD ... | 0 | 0 | 0 | 0 | 0 | 0 |
build/apple/xcrun.py | zealoussnow/chromium | 2,219 | 138308 | <gh_stars>1000+
#!/usr/bin/python3
# Copyright 2020 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.
"""
Wrapper around xcrun adding support for --developer-dir parameter to set
the DEVELOPER_DIR environment variable, and fo... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_session.py | jmsking/pykube | 116 | 138330 | <gh_stars>100-1000
"""
pykube.http unittests
"""
import copy
import logging
import tempfile
from pathlib import Path
from . import TestCase
BASE_CONFIG = {
"clusters": [
{"name": "test-cluster", "cluster": {"server": "http://localhost:8080"}}
],
"contexts": [
{
"name": "test-cl... | 0 | 0 | 0 | 0 | 0 | 0 |
test/rpc-tests/dao/when/iSubmitAPaymentRequest.py | chasingkirkjufell/navcoin-core | 103 | 138346 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2019 The Navcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Expanded helper routines for regression testing of the NAV Coin community fund
#
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
oatomobile/tf/types.py | jannikwagner/oatomobile | 152 | 138348 | <filename>oatomobile/tf/types.py
# Copyright 2020 The OATomobile 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 | 0 | 0 | 0 | 0 | 0 |
examples/acrobot_a2c.py | PuzeLiu/mushroom-rl | 344 | 138354 | <filename>examples/acrobot_a2c.py
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from mushroom_rl.algorithms.actor_critic import A2C
from mushroom_rl.core import Core, Logger
from mushroom_rl.environments import Gym
from mushroom_rl.policy import BoltzmannTorchPolicy
from mushroom_rl... | 0 | 0 | 0 | 0 | 0 | 0 |
ulmo/ncdc/cirs/__init__.py | sblack-usu/ulmo | 123 | 138378 | <reponame>sblack-usu/ulmo
"""
`National Climatic Data Center`_ `Climate Index Reference Sequential
(CIRS)`_ drought dataset
.. _National Climatic Data Center: http://www.ncdc.noaa.gov
.. _Climate Index Reference Sequential (CIRS): http://www1.ncdc.noaa.gov/pub/data/cirs/
"""
from .core import get_data... | 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.