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 |
|---|---|---|---|---|
shynet/analytics/migrations/0004_auto_20210328_1514.py | f97/shynet | 1,904 | 11120686 | <gh_stars>1000+
# Generated by Django 3.1.7 on 2021-03-28 19:14
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
("analytics", "0003_auto_20200502_1227"),
]
operations = [
migrations.AlterField(
mod... |
core/src/epicli/tests/cli/engine/providers/test_provider_class_loader_aws.py | bikramlmsl/epiphany | 130 | 11120690 | from cli.engine.providers.provider_class_loader import provider_class_loader
from cli.engine.providers.aws.InfrastructureBuilder import InfrastructureBuilder
from cli.engine.providers.aws.APIProxy import APIProxy
from cli.engine.providers.aws.InfrastructureConfigCollector import InfrastructureConfigCollector
def test... |
Programming Languages/Python/Theory/100_Python_Challenges/Section _1_Basic_Coding_Exercises/20. swap bits in an integer.py | jaswinder9051998/Resources | 101 | 11120709 | <filename>Programming Languages/Python/Theory/100_Python_Challenges/Section _1_Basic_Coding_Exercises/20. swap bits in an integer.py
"""
Write a function that accepts an integer and converts the integer into its binary form.
The function should then swap the two bits at positions 3 and 7 (from left) in the binary num... |
external/rocksdb/tools/advisor/test/test_db_stats_fetcher.py | cashbitecrypto/cashbite | 12,278 | 11120726 | <reponame>cashbitecrypto/cashbite<filename>external/rocksdb/tools/advisor/test/test_db_stats_fetcher.py
# Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
# This source code is licensed under both the GPLv2 (found in the
# COPYING file in the root directory) and Apache 2.0 License
# (found in the LIC... |
tfprof/server/tfprof.py | alexbriskin/taskflow | 3,457 | 11120736 | <reponame>alexbriskin/taskflow
#!/usr/bin/env python3
# program: tfprof
import logging as logger
import time
import sys
import json
import argparse
import os
import subprocess
import requests
# run_tfprof (default)
# generate profiler data in taskflow profiler format
def run_tfprof(args):
args.output = os.path.ab... |
alipay/aop/api/domain/AnttechBlockchainFinanceMylogisticfinsysContractApplyModel.py | antopen/alipay-sdk-python-all | 213 | 11120746 | <filename>alipay/aop/api/domain/AnttechBlockchainFinanceMylogisticfinsysContractApplyModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AnttechBlockchainFinanceMylogisticfinsysContractApplyModel(object):
def __init__(self):
self.... |
Recognition-Algorithms/Recognition_using_NasNet/models/__init__.py | swapnilgarg7/Face-X | 175 | 11120762 | <filename>Recognition-Algorithms/Recognition_using_NasNet/models/__init__.py
from models.nasnet import * |
dmb/data/transforms/builder.py | jiaw-z/DenseMatchingBenchmark | 160 | 11120795 | <reponame>jiaw-z/DenseMatchingBenchmark
from . import transforms as T
def build_transforms(cfg, is_train=True):
return None
|
33. Python Programs/remove_duplicate.py | Ujjawalgupta42/Hacktoberfest2021-DSA | 225 | 11120813 | def deleteDuplicates(self, head: Optional[ListNode]) -> Optional[ListNode]:
prev = head
current = head
if head:
val = head.val
head = head.next
while (head != None):
if head.val == val:
prev.next = head.next
... |
factory-ai-vision/DevTools/utils_file.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 11120816 | #!/usr/bin/env python
"""File Utilities
"""
import logging
import os
import subprocess
from logging import config
from logging_config import LOGGING_CONFIG_DEV
logger = logging.getLogger(__name__)
class FileContext:
"""File Context"""
def __init__(self, file):
self.path = os.path.realpath(file)
... |
frontera/utils/add_seeds.py | buildfail/frontera | 1,267 | 11120863 | # -*- coding: utf-8 -*-
from frontera.core.manager import LocalFrontierManager
from frontera.settings import Settings
from frontera.logger.handlers import CONSOLE
from argparse import ArgumentParser
import logging
from logging.config import fileConfig
from os.path import exists
logger = logging.getLogger(__name__)
... |
test/__init__.py | logilab/rdflib-jsonld | 1,424 | 11120874 | from rdflib import plugin
from rdflib import serializer
from rdflib import parser
assert plugin
assert serializer
assert parser
import json
|
cellrank/external/kernels/__init__.py | WeilerP/cellrank | 172 | 11120902 | <gh_stars>100-1000
from cellrank.external.kernels._wot_kernel import WOTKernel
from cellrank.external.kernels._statot_kernel import StationaryOTKernel
|
4dev/style_check.py | joschu/c | 698 | 11120915 | <reponame>joschu/c
#!/usr/bin/env python
import cgt
for (name,val) in cgt.__dict__.iteritems():
if not name.startswith("_"):
if not val.__doc__:
print "API function %s requires docstring!"%name
for (name,val) in cgt.core.__dict__.iteritems():
if isinstance(val, type) and issubclass(val, c... |
lulu/extractors/ifeng.py | fakegit/Lulu | 922 | 11120926 | <gh_stars>100-1000
#!/usr/bin/env python
from html import unescape
from lulu.common import (
match1,
url_info,
print_info,
get_content,
download_urls,
playlist_not_supported,
)
__all__ = ['ifeng_download', 'ifeng_download_by_id']
site_info = '凤凰网 ifeng.com'
def ifeng_download_by_id(_id, ti... |
2019/08/05/Flask-Praetorian Walkthrough A Library for API Security With JSON Web Tokens JWT/myapi/myapi/models.py | kenjitagawa/youtube_video_code | 492 | 11120944 | <filename>2019/08/05/Flask-Praetorian Walkthrough A Library for API Security With JSON Web Tokens JWT/myapi/myapi/models.py<gh_stars>100-1000
from .extensions import db
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(50))
password = db.Column(db.Text)... |
backend/util/environment_loader.py | Purus/LaunchKitDocker | 2,341 | 11120952 | <filename>backend/util/environment_loader.py
#
# Copyright 2016 Cluster Labs, 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
#
# Unles... |
test/pool-test.py | edisga/scalene | 3,952 | 11120990 | <gh_stars>1000+
import multiprocessing
pool = multiprocessing.Pool(processes=1)
pool.terminate()
|
junction/proposals/migrations/0003_auto_20150113_1401.py | theSage21/junction | 192 | 11120994 | <filename>junction/proposals/migrations/0003_auto_20150113_1401.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("proposals", "0002_auto_20150105_2220"),
]
opera... |
String_or_Array/PairSum_is_X.py | Amanjakhetiya/Data_Structures_Algorithms_In_Python | 195 | 11121022 | <gh_stars>100-1000
# Find a pair of elements in the array with sum = x
"""
Method 1: If unsorted array
Time Complexity: O(n)
Space Complexity: O(n)
"""
def find_pair_unsorted(arr, x):
elem_set = set({})
# To store the indexes of both the elements
pair = [-1, -1]
for value in arr:
# if x - v... |
dags/ethereum_load_dag.py | saccodd/ethereum-etl-airflow | 204 | 11121026 | <reponame>saccodd/ethereum-etl-airflow<gh_stars>100-1000
from __future__ import print_function
import logging
from ethereumetl_airflow.build_load_dag import build_load_dag
from ethereumetl_airflow.build_load_dag_redshift import build_load_dag_redshift
from ethereumetl_airflow.variables import read_load_dag_vars
from ... |
pipe-cli/src/utilities/pipeline_run_share_manager.py | AlfiyaRF/cloud-pipeline | 126 | 11121070 | <reponame>AlfiyaRF/cloud-pipeline<filename>pipe-cli/src/utilities/pipeline_run_share_manager.py
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.com/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... |
tests/test_model/test_head/test_mobilenet_v3_head.py | ZJCV/PyCls | 110 | 11121084 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
@date: 2020/12/30 下午9:42
@file: test_mobilenet_v3_head.py
@author: zj
@description:
"""
import torch
from zcls.model.heads.mobilenetv3_head import MobileNetV3Head
def test_mobilenet_v3_head():
data = torch.randn(1, 960, 7, 7)
model = MobileNetV3Head(
... |
vit/formatter/due_formatted.py | kinifwyne/vit | 179 | 11121110 | <filename>vit/formatter/due_formatted.py
from vit.formatter.due import Due
class DueFormatted(Due):
pass
|
src/cltk/corpora/lat/phi/file_utils.py | yelircaasi/cltk | 757 | 11121157 | <reponame>yelircaasi/cltk<filename>src/cltk/corpora/lat/phi/file_utils.py
"""Higher-level (i.e., user-friendly) functions for quickly reading
PHI5 data after it has been processed by ``TLGU()``.
"""
import os
import regex
from cltk.corpora.lat.phi.phi5_index import PHI5_INDEX, PHI5_WORKS_INDEX
from cltk.utils.file_o... |
python/dp/triangle.py | googege/algo-learn | 153 | 11121159 | <reponame>googege/algo-learn
# 三角形的最短路径和
import copy
from typing import List
class Solution:
def minimumTotal_1(self, triangle: List[List[int]]) -> int:
dp = copy.copy(triangle)
for i in range(len(triangle) - 2, -1, -1):
for j in range(len(triangle[i])):
dp[i][j] = min... |
tests/resources/test_service_desk.py | Glushiator/jira | 1,639 | 11121167 | import logging
from time import sleep
import pytest
from tests.conftest import JiraTestCase, broken_test
LOGGER = logging.getLogger(__name__)
class JiraServiceDeskTests(JiraTestCase):
def setUp(self):
JiraTestCase.setUp(self)
if not self.jira.supports_service_desk():
pytest.skip("Sk... |
cross3d/classes/__init__.py | vedantirb/cross3d | 129 | 11121233 | <filename>cross3d/classes/__init__.py
##
# \namespace cross3d.classes
#
# \remarks [desc::commented]
#
# \author Mikeh
# \author <NAME>
# \date 06/08/11
#
from fcurve import FCurve
from exceptions import Exceptions
from dispatch import Dispatch
from clipboard import Clipboard
from valuerange import V... |
python/paddle_fl/mpc/examples/logistic_with_mnist/train_fc_softmax.py | barrierye/PaddleFL | 379 | 11121252 | # Copyright (c) 2020 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 appli... |
src/genie/libs/parser/iosxe/tests/ShowIpNatTranslations/cli/equal/golden_output_vrf_verbose_expected.py | balmasea/genieparser | 204 | 11121260 | <gh_stars>100-1000
expected_output = {
"vrf": {
"genie": {
"index": {
1: {
"group_id": 0,
"inside_global": "---",
"inside_local": "---",
"outside_global": "10.144.0.2",
"outside_lo... |
tests/test_users.py | hishamnajam/python-wordpress-xmlrpc | 218 | 11121285 | from nose.plugins.attrib import attr
from tests import WordPressTestCase
from wordpress_xmlrpc.methods import users
from wordpress_xmlrpc.wordpress import WordPressUser, WordPressBlog, WordPressAuthor
class TestUsers(WordPressTestCase):
@attr('users')
@attr('pycompat')
def test_user_repr(se... |
ast/testdata/func_star_arg.py | MaxTurchin/pycopy-lib | 126 | 11121293 | <gh_stars>100-1000
def foo(a, b, *c):
pass
# After vararg, only kwonly's
def merge(*iterables, key=None, reverse=False):
pass
|
scripts/eval/combined_demo.py | hansheng0512/LateTemporalModeling3DCNN | 144 | 11121303 | <gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 11:49:54 2020
@author: esat
"""
import os, sys
import collections
import numpy as np
import cv2
import math
import random
import time
import argparse
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.ba... |
libs/dataclass_utils.py | phc-health/covid-data-model | 155 | 11121307 | <reponame>phc-health/covid-data-model
import dataclasses
# TODO(tom): Remove dataclass_with_default_init once we are using Python 3.9. See
# https://stackoverflow.com/a/58336722
def dataclass_with_default_init(_cls=None, *args, **kwargs):
def wrap(cls):
# Save the current __init__ and remove it so datacl... |
native_client_sdk/src/build_tools/nacl_sdk_scons/nacl_utils_test.py | Scopetta197/chromium | 212 | 11121352 | #!/usr/bin/env python
# Copyright (c) 2012 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.
"""Unit tests for nacl_utils.py."""
import fileinput
import mox
import nacl_utils
import os
import sys
import unittest
def TestM... |
runway/templates/sls-py/__init__.py | paul-duffy/runway | 134 | 11121364 | <reponame>paul-duffy/runway
"""Empty file for python import traversal.""" # pylint: disable=all
|
samples/bulk_update.py | oniram22/orionsdk-python | 177 | 11121369 | <reponame>oniram22/orionsdk-python
import requests
from orionsdk import SwisClient
npm_server = 'localhost'
username = 'admin'
password = ''
verify = False
if not verify:
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
... |
siliconcompiler/core.py | siliconcompiler/siliconcompiler | 424 | 11121401 | # Copyright 2020 Silicon Compiler Authors. All Rights Reserved.
import argparse
import base64
import time
import datetime
import multiprocessing
import tarfile
import traceback
import asyncio
from subprocess import run, PIPE
import os
import glob
import pathlib
import sys
import gzip
import re
import json
import loggi... |
uchan/lib/utils.py | alanbato/tchan | 120 | 11121407 | <filename>uchan/lib/utils.py
import time
from werkzeug.exceptions import abort
def now():
return int(time.time() * 1000)
def ip4_to_str(ip4):
outputs = []
for i in range(4):
n = (ip4 >> (3 - i) * 8) & 255
outputs.append(str(n))
return '.'.join(outputs)
def valid_id_range(id):
... |
paddlespeech/t2s/modules/residual_block.py | jerryuhoo/PaddleSpeech | 1,379 | 11121421 | <reponame>jerryuhoo/PaddleSpeech
# Copyright (c) 2021 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... |
cluster/example.py | SunGuo/500lines | 134 | 11121436 | <filename>cluster/example.py
import sys
import logging
from fleet import Ship
def key_value_state_machine(state, input_value):
print input_value, state
if input_value[0] == 'get':
return state, state.get(input_value[1], None)
elif input_value[0] == 'set':
state[input_value[1]] = input_valu... |
bibliopixel/util/platform.py | rec/leds | 253 | 11121437 | import platform, subprocess
MAC = 'Darwin'
WINDOWS = 'Windows'
CPUINFO_FILE = '/proc/cpuinfo'
class Platform:
def __init__(self):
self.platform = platform.system()
self.version = platform.version()
self.release = platform.release()
self.python_version = platform.python_version()
... |
custom_components/trakt/const.py | ProConvenience1/sensor.trakt | 288 | 11121442 | <gh_stars>100-1000
"""Constants used in the Trakt integration."""
DOMAIN = "trakt"
OAUTH2_AUTHORIZE = "https://api-v2launch.trakt.tv/oauth/authorize"
OAUTH2_TOKEN = "https://api-v2launch.trakt.tv/oauth/token"
ATTRIBUTION = "Data provided by trakt.tv"
CONF_DAYS = "days"
CONF_EXCLUDE = "exclude"
DATA_UPDATED = "trakt... |
recipes/Python/577485_Self_Extracting_Archiver/recipe-577485.py | tdiprima/code | 2,023 | 11121451 | """Command-line tool for making self-extracting Python file.
Call this program from your command line with one argument:
(1) the file that you want to pack and compress
(2) the output will be a file with a pyw ending
The output can run on Windows where Python is installed."""
#####################################... |
question/migrations/0002_down_vote_total_view.py | yazdanv/backend | 232 | 11121473 | # Generated by Django 2.1.5 on 2019-07-31 19:44
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('question', '0001_initial'),
]
operations = [
... |
mmhuman3d/data/data_converters/mpii.py | ykk648/mmhuman3d | 472 | 11121502 | <filename>mmhuman3d/data/data_converters/mpii.py
import os
from typing import List
import h5py
import numpy as np
from tqdm import tqdm
from mmhuman3d.core.conventions.keypoints_mapping import convert_kps
from mmhuman3d.data.data_structures.human_data import HumanData
from .base_converter import BaseConverter
from .b... |
algorithm/backtracking_examples.py | ganeshskudva/Algorithm_Templates | 190 | 11121506 | <gh_stars>100-1000
from collections import Counter
import re
# [46] https://leetcode.com/problems/permutations/
# Given a collection of distinct integers, return all possible permutations.
def permute(nums):
def backtrack(first=0):
# if all integers are used up
if first == n:
output.ap... |
dump_match/dataset.py | hoverinc/OANet | 209 | 11121512 | <gh_stars>100-1000
import h5py
import os
import pickle
import numpy as np
from sequence import Sequence
class Dataset(object):
def __init__(self, dataset_path, dump_dir, dump_file, seqs, mode, desc_name, vis_th, pair_num, pair_path=None):
self.dataset_path = dataset_path
self.dump_dir = dump_dir
... |
yamale/validators/__init__.py | basnijholt/Yamale | 457 | 11121602 | from .base import Validator
from .validators import *
|
Python/CodeCoverage/functions.py | Gjacquenot/training-material | 115 | 11121606 | <gh_stars>100-1000
def fac_r(n):
if n < 2:
return 1
else:
return n*fac_r(n - 1)
def fac_i(n):
result = 1
for i in range(2, n + 1):
result *= i
return result
|
utils/__init__.py | yujiatay/deep-motion-editing | 966 | 11121615 | import sys
import os
BASEPATH = os.path.dirname(__file__)
sys.path.insert(0, BASEPATH)
|
plenum/server/consensus/batch_id.py | jandayanan/indy-plenum | 148 | 11121617 |
# `view_no` is a view no is the current view_no, but `pp_view_no` is a view no when the given PrePrepare has been
# initially created and applied
# it's critical to keep the original view no to correctly create audit ledger transaction
# (since PrePrepare's view no is present there)
# An example when `view_no` != `p... |
tests/test_functional.py | filipmu/fastaudio | 152 | 11121633 | import torch
from fastai.data.all import test_eq as _test_eq
from unittest.mock import patch
from fastaudio.augment.functional import region_mask
class TestCreateRegionMask:
def test_shape(self):
_test_eq(region_mask(1, 5, 7, 10).shape, (1, 10))
_test_eq(region_mask(2, 3, 7, 12).shape, (2, 12))
... |
ztag/annotations/scannex.py | justinbastress/ztag | 107 | 11121636 | <gh_stars>100-1000
from ztag.annotation import *
class NetGearSmartSwitch(Annotation):
protocol = protocols.HTTP
subprotocol = protocols.HTTP.GET
port = None
def process(self, obj, meta):
if obj["title"] == "ip.buffer webserver":
meta.global_metadata.manufacturer = Manufacturer.SC... |
HunterCelery/model/ldap_config.py | tt9133github/hunter | 322 | 11121664 | #!/ usr/bin/env
# coding=utf-8
#
# Copyright 2019 ztosec & https://www.zto.com/
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
test/utils_tests.py | seba-1511/randopt | 115 | 11121666 | <reponame>seba-1511/randopt
#!/usr/bin/env python3
import os
import unittest
import randopt as ro
class TestUtils(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_dict_to_list(self):
dictionary = dict(asdf=23, yxcv='vcxy', qwer=1)
ref = ['asdf... |
datasets/imagenet/scripts/imagenet.py | dgtlmoon/deepdetect | 1,672 | 11121672 | import os, argparse, glob, sys, subprocess
from collections import defaultdict
def sizeof_fmt(num):
for x in ['bytes','KB','MB','GB']:
if num < 1024.0 and num > -1024.0:
return "%3.1f%s" % (num, x)
num /= 1024.0
return "%3.1f%s" % (num, 'TB')
class Synset:
'A representation of ... |
release/scripts/presets/camera/Sony_F65.py | rbabari/blender | 365 | 11121709 | <gh_stars>100-1000
import bpy
bpy.context.camera.sensor_width = 24.33
bpy.context.camera.sensor_height = 12.83
bpy.context.camera.sensor_fit = 'HORIZONTAL'
|
earthpy/tests/test_epsg.py | nkorinek/earthpy | 350 | 11121721 | import pytest
import rasterio as rio
import os.path as op
import earthpy as et
import earthpy.spatial as es
from earthpy.io import path_to_example
@pytest.fixture
def output_dir(out_path):
return op.dirname(out_path)
def test_epsg():
"""Unit test for loading EPSG to Proj4 string dictionary."""
assert e... |
survae/tests/nn/nets/autoregressive/__init__.py | alisiahkoohi/survae_flows | 262 | 11121781 | <filename>survae/tests/nn/nets/autoregressive/__init__.py
from .made import *
from .pixelcnn import *
from .transformer import *
from .sparse_transformer import *
|
test_python_toolbox/test_path_tools/test_get_root_path_of_module.py | hboshnak/python_toolbox | 119 | 11121788 | <gh_stars>100-1000
# Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
from python_toolbox.path_tools import get_root_path_of_module
def test():
''' '''
import email.charset
assert get_root_path_of_module(email) == \
get_root_path_of_module(email.charset)
imp... |
tests/test_terminal.py | edouard-lopez/colorful | 517 | 11121835 | # -*- coding: utf-8 -*-
"""
colorful
~~~~~~~~
Terminal string styling done right, in Python.
:copyright: (c) 2017 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import os
import sys
import pytest
# do not overwrite module
os.environ['COLORFUL_NO_MODULE_OVERWRITE'] = '1'
... |
usaspending_api/accounts/models/budget_authority.py | g4brielvs/usaspending-api | 217 | 11121855 | from django.db import models
class BudgetAuthority(models.Model):
agency_identifier = models.TextField(db_index=True) # aka CGAC
fr_entity_code = models.TextField(null=True, db_index=True) # aka FREC
year = models.IntegerField(null=False)
amount = models.BigIntegerField(null=True)
class Meta:
... |
RecoLocalTracker/SiStripRecHitConverter/python/SiStripRecHitConverter_cfi.py | ckamtsikis/cmssw | 852 | 11121875 | <reponame>ckamtsikis/cmssw<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
from RecoLocalTracker.SiStripRecHitConverter.siStripRecHitConverter_cfi import siStripRecHitConverter as _siStripRecHitConverter
siStripMatchedRecHits = _siStripRecHitConverter.clone()
|
tools/getsize.py | bontchev/wlscrape | 110 | 11121906 | #!/usr/bin/env python
from __future__ import print_function
import argparse
import locale
import json
import sys
__author__ = "<NAME> <<EMAIL>>"
__license__ = "GPL"
__VERSION__ = "1.00"
def error(e):
print("Error: %s." % e, file=sys.stderr)
sys.exit(-1)
def humanBytes(B):
'Return the given bytes as a hum... |
tests/basics/is_isnot.py | rxchen/micropython | 13,648 | 11121910 | print([1, 2] is [1, 2])
a = [1, 2]
b = a
print(b is a)
|
keras_cv_attention_models/convnext/convnext.py | dcleres/keras_cv_attention_models | 140 | 11121939 | <gh_stars>100-1000
from tensorflow import keras
from keras_cv_attention_models.attention_layers import (
activation_by_name,
ChannelAffine,
conv2d_no_bias,
depthwise_conv2d_no_bias,
drop_block,
layer_norm,
HeadInitializer,
add_pre_post_process,
)
from keras_cv_attention_models.download_a... |
test/fixture/python_scanner/imports_unknown_files.py | jcassagnol-public/scons | 1,403 | 11121962 | import doesntexist # noqa: F401
import notthere.something # noqa: F401
from notthere import a, few, things # noqa: F401 |
generate/build_tools/forge/__init__.py | flamencist/browser-extensions | 102 | 11121975 | VERSION = '3.3.62'
def get_version():
return VERSION
class ForgeError(Exception):
pass
settings = {
'LAST_STABLE': 'v1.4'
}
|
urduhack/normalization/tests/test_character.py | cinfotech94/urduhackk | 252 | 11122003 | <filename>urduhack/normalization/tests/test_character.py
# coding: utf8
"""Test cases for character class"""
from urduhack import normalize
from urduhack.normalization.character import normalize_characters, _CORRECT_URDU_CHARACTERS_MAPPING, \
normalize_combine_characters, \
COMBINE_URDU_CHARACTERS, replace_dig... |
pycharm2020.1.3/script/core/tool/incremental_reload.py | LaudateCorpus1/realtime-server | 465 | 11122032 | <gh_stars>100-1000
import collections
import sys
import os
from core.mobilelog.LogManager import LogManager
class ReloadRecord(object):
"""
根据上次启动、reload时记录的文件修改时间,进行增量func code reload
仅支持散包py、pyc文件,暂时不支持zipfile
"""
def __init__(self):
super(ReloadRecord, self).__init__()
self._c... |
pclib/test/TestSynchronizer_test.py | belang/pymtl | 206 | 11122040 | <filename>pclib/test/TestSynchronizer_test.py
#=========================================================================
# TestSynchronizer_test.py
#=========================================================================
from __future__ import print_function
import pytest
from pymtl import *
from pclib.test i... |
基础教程/A2-神经网络基本原理/第5步 - 非线性分类/src/ch11-NonLinearMultipleClassification/Level1_BankClassifier.py | microsoft/ai-edu | 11,094 | 11122052 | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
import numpy as np
import matplotlib.pyplot as plt
from HelperClass2.NeuralNet_2_2 import *
from HelperClass2.Visualizer_1_1 import *
train_data_name = "../../Data/ch11... |
tests/integration_tests/test_neuropod.py | dantreiman/ludwig | 7,739 | 11122053 | <reponame>dantreiman/ludwig
# Copyright (c) 2019 Uber Technologies, 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... |
pyclue/tf1/tasks/sentence_pair/siamese/predict.py | CLUEbenchmark/PyCLUE | 122 | 11122069 | #!/usr/bin/python3
"""
@Author: <NAME>
@Site: https://github.com/liushaoweihua
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import json
import numpy as np
import tensorflow as tf
from pyclue.tf1.open_sources.configs import pretrained_nam... |
libs/tracker/gric.py | SimOgaard/DF-VO | 361 | 11122093 | ''''''
'''
@Author: <NAME> (<EMAIL>)
@Date: 2020-03-01
@Copyright: Copyright (C) <NAME> 2020. All rights reserved. Please refer to the license file.
@LastEditTime: 2020-05-27
@LastEditors: <NAME>
@Description: This file contains functions related to GRIC computation
'''
import numpy as np
def compute_fundamental_res... |
platforms/tinyfpga_bx.py | auscompgeek/litex-buildenv | 198 | 11122124 | from litex.build.generic_platform import *
from litex.build.lattice import LatticePlatform
from litex.build.lattice.programmer import TinyProgProgrammer
_io = [
("user_led", 0, Pins("B3"), IOStandard("LVCMOS33")),
("usb", 0,
Subsignal("d_p", Pins("B4")),
Subsignal("d_n", Pins("A4")),
S... |
cap/BlueFuzz/bluetooth_scanner.py | Charmve/BLE-Security-Att-Def | 149 | 11122131 | <gh_stars>100-1000
import bluetooth
import subprocess
import time
import os
from obd_generator import *
SCANNER_TIME = 3
# NOTE: should be run as root
def main():
try:
# switch off subprocesses output
devs = open(os.devnull,"w")
# make directory with root privileges to store pcap output file
# tshark o... |
plugins/aws/test/test_config.py | someengineering/resoto | 126 | 11122148 | <filename>plugins/aws/test/test_config.py<gh_stars>100-1000
from resotolib.utils import num_default_threads
from resotolib.config import Config
from resoto_plugin_aws import AWSCollectorPlugin
def test_args():
config = Config("dummy", "dummy")
AWSCollectorPlugin.add_config(config)
Config.init_default_conf... |
code_sender/winauto.py | fredcallaway/SendCode | 177 | 11122154 | <reponame>fredcallaway/SendCode<gh_stars>100-1000
import ctypes
import time
import re
from ctypes import c_bool, c_uint, c_long, c_size_t, c_wchar
# most of them are derived from pywinauto
class MENUITEMINFOW(ctypes.Structure):
_fields_ = [
('cbSize', c_uint),
('fMask', c_uint),
('fType'... |
py/demo/app.py | swt2c/wave | 3,013 | 11122158 | <filename>py/demo/app.py
from h2o_wave import main, app, Q
from .dashboard_red import show_red_dashboard
from .dashboard_blue import show_blue_dashboard
from .dashboard_orange import show_orange_dashboard
from .dashboard_cyan import show_cyan_dashboard
from .dashboard_grey import show_grey_dashboard
from .dashboard_mi... |
test/speed.py | wazenmai/Python-WORLD | 113 | 11122166 | <filename>test/speed.py
# built-in imports
import timeit
# 3rd-party imports
import numpy as np
from scipy.io.wavfile import read as wavread
from scipy.io.wavfile import write
# local imports
from world import main
fs, x_int16 = wavread('test-mwm.wav')
x = x_int16 / (2 ** 15 - 1)
vocoder = main.World()
# profile
p... |
src/pathpicker/state_files.py | houbie/PathPicker | 5,167 | 11122170 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from typing import List
FPP_DIR = os.environ.get("FPP_DIR") or "~/.cache/fpp"
PICKLE_FILE = ".pickle"
SELECTION_PICKLE = ".selection... |
how-to-use-azureml/reinforcement-learning/multiagent-particle-envs/files/util.py | lobrien/MachineLearningNotebooks | 3,074 | 11122216 | <filename>how-to-use-azureml/reinforcement-learning/multiagent-particle-envs/files/util.py
import argparse
import os
import re
from rllib_multiagent_particle_env import CUSTOM_SCENARIOS
def parse_args():
parser = argparse.ArgumentParser('MADDPG with OpenAI MPE')
# Environment
parser.add_argument('--scen... |
slidedeck/create.py | SunPowered/slidedeck | 187 | 11122227 | <gh_stars>100-1000
"""Code to create a template project
"""
import os
import shutil
TEMPLATE_VARIABLE = 'SLIDEDECK_TEMPLATE'
def curdir(directory):
return os.path.abspath(os.path.join(os.path.dirname(__file__), directory))
def check_env():
'''
Check the current user's environment to return importa... |
web-scraping/pdf-url-extractor/pdf_link_extractor_regex.py | caesarcc/python-code-tutorials | 1,059 | 11122233 | <filename>web-scraping/pdf-url-extractor/pdf_link_extractor_regex.py
import fitz # pip install PyMuPDF
import re
# a regular expression of URLs
url_regex = r"https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)"
# extract raw text from pdf
# file = "1710.05006.pdf"
file... |
cort/test/core/test_external_data.py | leonardoboliveira/cort | 141 | 11122242 | from cort.core.external_data import GenderData
__author__ = 'smartschat'
import unittest
class TestGenderData(unittest.TestCase):
def setUp(self):
self.gender_data = GenderData.get_instance()
def test_look_up(self):
self.assertEqual("NEUTRAL",
self.gender_data.look_... |
securityheaders/models/xxssprotection/__init__.py | th3cyb3rc0p/securityheaders | 151 | 11122266 | <reponame>th3cyb3rc0p/securityheaders
from .xxssprotectiondirective import XXSSProtectionDirective
from .xxssprotectionkeyword import XXSSProtectionKeyword
from .xxssprotection import XXSSProtection
__all__ = ['XXSSProtectionDirective', 'XXSSProtectionKeyword','XXSSProtection']
|
tests/integration_tests_plugins/version_aware_v2/setup.py | ilan-WS/cloudify-manager | 124 | 11122308 |
from setuptools import setup
setup(
name='version_aware',
version='2.0',
packages=['version_aware'],
)
|
examples/basics/subscribe.py | muhammadvellani/Adafruit_IO_Python | 136 | 11122318 | """
'subscribe.py'
==========================
Subscribes to an Adafruit IO Feed
Author(s): <NAME>, <NAME> for Adafruit Industries
"""
# Import standard python modules.
import sys
# This example uses the MQTTClient instead of the REST client
from Adafruit_IO import MQTTClient
# Set to your Adafruit IO key.
# Remember... |
utils/loss/hnm_loss.py | ZHANGHeng19931123/MutualGuide | 124 | 11122338 | <gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
class HNMLoss(nn.Module):
def __init__(self, ratio=3.0, loss_weight=1.0):
super(HNMLoss, self).__init__()
self.ratio = ratio
self.loss_weight = loss_weight
... |
fna_det/configs/fna_ssdlite_retrain.py | BaiYuYuan/FNA | 173 | 11122340 | # model settings
input_size = 300
model = dict(
type='SingleStageDetector',
pretrained=dict(
use_load=True,
load_path='./seed_mbv2.pt',
seed_num_layers=[1, 1, 2, 3, 4, 3, 3, 1, 1] # mbv2
),
backbone=dict(
type='FNA_SSDLite',
input_size=input_size,
net... |
training/criterion.py | HappyBelief/ContraD | 168 | 11122343 | <reponame>HappyBelief/ContraD
import torch
import torch.nn as nn
import torch.nn.functional as F
from third_party.gather_layer import GatherLayer
def target_nll_loss(inputs, targets, reduction='none'):
inputs_t = -F.nll_loss(inputs, targets, reduction='none')
logit_diff = inputs - inputs_t.view(-1, 1)
lo... |
scenic/projects/vivit/train_utils.py | techthiyanes/scenic | 688 | 11122402 | """Training Utilities for ViViT."""
import functools
from typing import Callable, Dict, List, Optional, Tuple, Union
from absl import logging
from flax import jax_utils
import flax.linen as nn
import jax
from jax.experimental.optimizers import clip_grads
import jax.numpy as jnp
import jax.profiler
import matplotlib.p... |
Arduino/speedTest.py | yuliya-sm7/EvoArm | 110 | 11122414 | import serial
import sys
import threading
import binascii
import time
ser = serial.Serial('COM3', 250000)
def checksum(bytes):
sum = 0
for b in bytes:
sum += ord(b)
return chr((~sum) & 0xFF)
def genPacket(data):
try:
bytes = binascii.unhexlify(data)
num = len(bytes)+3
... |
observations/r/australian_elections.py | hajime9652/observations | 199 | 11122422 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def australian_elections(path):
"""elections to Austra... |
src/c3nav/api/apps.py | johnjohndoe/c3nav | 132 | 11122440 | <filename>src/c3nav/api/apps.py<gh_stars>100-1000
from django.apps import AppConfig
from django.conf import settings
from django.db.models.signals import post_save
class APIConfig(AppConfig):
name = 'c3nav.api'
def ready(self):
from c3nav.api.signals import remove_tokens_on_user_save
post_sav... |
tests/java.py | codelv/enaml-native | 237 | 11122466 | """
Copyright (c) 2017-2018, <NAME>.
Distributed under the terms of the MIT License.
The full license is in the file LICENSE, distributed with this software.
Created on Jan 18, 2018
@author
"""
import hashlib
from textwrap import dedent
from enamlnative.android.bridge import (
JavaBridgeObject, JavaMethod, Java... |
deepcpg/evaluation.py | cangermueller/deepcpg2 | 151 | 11122471 | """Functions for evaluating prediction performance."""
from __future__ import division
from __future__ import print_function
from collections import OrderedDict
import numpy as np
import pandas as pd
import sklearn.metrics as skm
from scipy.stats import kendalltau
from six.moves import range
from .data import CPG_N... |
sendrecv/gst-sharp/nuget.py | heftig/gstwebrtc-demos | 451 | 11122480 | #!/usr/bin/python3
import argparse
import getpass
import os
import sys
import shutil
import subprocess
from datetime import datetime
from urllib.request import urlretrieve
from zipfile import ZipFile
NUSPEC_TEMPLATE = """<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.