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 |
|---|---|---|---|---|
recipes/Python/579056_Run_OS_commtimeout_list_files__using_several/recipe-579056.py | tdiprima/code | 2,023 | 12690266 | <reponame>tdiprima/code
#process a filtered list of files by calling reapeatedly a
#console app(no console opens) in two parallel threads with a timeout
#<NAME> 2015
import os
import threading
import subprocess
def my_thread():
global files,path,timeout,options
myname= threading.currentThread().getName()
while... |
GoogleSearchKeyword/xgoogle/sponsoredlinks.py | imaging8896/google-parse | 109 | 12690269 | #!/usr/bin/python
#
# <NAME> (<EMAIL>)
# http://www.catonmat.net -- good coders code, great reuse
#
# http://www.catonmat.net/blog/python-library-for-google-sponsored-links-search/
#
# Code is licensed under MIT license.
#
import re
import urllib
import random
from htmlentitydefs import name2codepoint
... |
utils/game_utils.py | morozig/muzero | 111 | 12690289 | <gh_stars>100-1000
"""
File to define utilities for Game handling. The GameState data structures serve as the states that preserve the
information of an environment and is used within the Coach classes to handle environment data.
"""
from dataclasses import dataclass
import typing
import gym
from gym import Env, space... |
ptan/common/utils.py | ChengUVa/ptan | 492 | 12690319 | <reponame>ChengUVa/ptan
import sys
import time
import operator
from datetime import timedelta
import numpy as np
import collections
import torch
import torch.nn as nn
class SMAQueue:
"""
Queue of fixed size with mean, max, min operations
"""
def __init__(self, size):
self.queue = collections.... |
tests/scanner/scanners/data/fake_firewall_rules.py | aarontp/forseti-security | 921 | 12690327 | <filename>tests/scanner/scanners/data/fake_firewall_rules.py
# Copyright 2017 The Forseti Security 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://... |
igibson/utils/data_utils/ext_object/scripts_wip/link_annotation_tool.py | suresh-guttikonda/iGibson | 360 | 12690364 | import itertools
import json
import os
import numpy as np
import pybullet as p
from bddl.object_taxonomy import ObjectTaxonomy
from pynput import keyboard
import igibson
from igibson.objects.articulated_object import URDFObject
from igibson.objects.visual_marker import VisualMarker
from igibson.scenes.empty_scene imp... |
eval/segment_metrics.py | swafe/DeepSegmentor | 150 | 12690385 | # Author: <NAME> <<EMAIL>>
"""
Calculate Segmentation metrics:
- GlobalAccuracy
- MeanAccuracy
- Mean MeanIoU
"""
import numpy as np
from data_io import imread
def cal_semantic_metrics(pred_list, gt_list, thresh_step=0.01, num_cls=2):
final_accuracy_all = []
for thresh in np.arange(0.0, 1.0, thresh_step)... |
plugin.video.fanfilm/resources/lib/sources/disabled/dizimag_tv.py | mrknow/filmkodi | 105 | 12690393 | # -*- coding: utf-8 -*-
'''
FanFilm Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... |
training/training_code/utils/Loss_functions.py | sergeyprokudin/HDNet_TikTok | 257 | 12690395 | <gh_stars>100-1000
import tensorflow as tf
# import tensorflow_graphics as tfg
import numpy as np
import skimage.data
from PIL import Image, ImageDraw, ImageFont
import math
from tensorflow.python.platform import gfile
import scipy.misc
IMAGE_HEIGHT = 256
IMAGE_WIDTH = 256
# *****************************************... |
wrappers/Python/CoolProp/Plots/ConsistencyPlots_pcsaft.py | pauliacomi/CoolProp | 520 | 12690404 | <reponame>pauliacomi/CoolProp<gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import matplotlib.pyplot as plt
import numpy as np
import time, timeit
import six
import pandas
import CoolProp as CP
from math import ceil
CP.CoolProp.set_debug_level(00)
from mat... |
examples/python/datasets/bunny.py | Willyzw/vdbfusion | 119 | 12690414 | <reponame>Willyzw/vdbfusion<gh_stars>100-1000
#!/usr/bin/env python3
import glob
import os
import numpy as np
import open3d as o3d
class BunnyDataset:
"""The bun.conf does not specify how to work with the trasnformation, after hours of tyring to
debug how to use it, I couldn't find how to use the 1996 datase... |
setup.py | bbhunter/CORScanner | 767 | 12690436 | <filename>setup.py<gh_stars>100-1000
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='cors',
version='1.0.1',
description='Fast CORS misconfiguration vulnerabilities scanner',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
... |
sdk/servermanager/azure-mgmt-servermanager/azure/mgmt/servermanager/operations/session_operations.py | rsdoherty/azure-sdk-for-python | 2,728 | 12690438 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
mmpose/datasets/datasets/fashion/__init__.py | jlgzb/mmpose | 367 | 12690454 | <reponame>jlgzb/mmpose
from .deepfashion_dataset import DeepFashionDataset
__all__ = ['DeepFashionDataset']
|
armi/cli/cleanTemps.py | keckler/armi | 162 | 12690466 | # Copyright 2019 TerraPower, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
model_zoo/evaluater.py | ModelZoo/ModelZoo | 191 | 12690476 | from model_zoo.logger import get_logger
from model_zoo.utils import load_config, load_model, find_model_class
from absl import flags
# ========== Checkpoint ================
flags.DEFINE_string('checkpoint_dir', 'checkpoints', help='Data source dir', allow_override=True)
flags.DEFINE_string('checkpoint_name', 'model.c... |
features.py | Umesh-01/NavigateMe | 145 | 12690508 | # pass in a sentence, pass out it's features
import nltk
import pandas as pd
import sys
import hashlib
import re
import string
import itertools
from nltk import word_tokenize
from nltk.corpus import stopwords
import logging
import logger_config
log = logging.getLogger(__name__)
log.info("Entered module: %s" % __name__... |
example_video_smart_resize.py | viddik13/katna | 125 | 12690523 | <filename>example_video_smart_resize.py
import os
import os.path
import cv2
from Katna.video import Video
import multiprocessing
import Katna.config as app_config
# change these paths
# usually autoflip build is located here : /mediapipe/repo/bazel-build/mediapipe/examples/desktop/autoflip
# usually mediapipe model i... |
script-coinbasepro-webhooks.py | Joel-max-s/pycryptobot | 1,447 | 12690530 | import json, time
from threading import Thread
from websocket import create_connection, WebSocketConnectionClosedException
def main():
ws = None
thread = None
thread_running = False
thread_keepalive = None
def websocket_thread():
global ws
ws = create_connection("wss://ws-feed.pr... |
finetuning/v2/save-model.py | wietsedv/bertje | 104 | 12690536 | import os
import sys
from transformers import ModelCard, AutoTokenizer, BertForTokenClassification, BertForSequenceClassification, TokenClassificationPipeline, TextClassificationPipeline
if len(sys.argv) < 4:
print('usage: "python save-model.py basename name type task" where "basename" is the original model name (... |
env/Lib/site-packages/OpenGL/GL/ARB/conditional_render_inverted.py | 5gconnectedbike/Navio2 | 210 | 12690539 | '''OpenGL extension ARB.conditional_render_inverted
This module customises the behaviour of the
OpenGL.raw.GL.ARB.conditional_render_inverted to provide a more
Python-friendly API
Overview (from the spec)
This extension adds new modes to BeginConditionalRender which invert
the condition used to determine whethe... |
ansible/roles/lib_gcloud/build/src/gcloud_compute_zones.py | fahlmant/openshift-tools | 164 | 12690542 | # pylint: skip-file
# pylint: disable=too-many-instance-attributes
class GcloudComputeZones(GcloudCLI):
''' Class to wrap the gcloud compute zones command'''
# pylint allows 5
# pylint: disable=too-many-arguments
def __init__(self, region=None, verbose=False):
''' Constructor for gcloud resour... |
lenskit/metrics/topn.py | keener101/lkpy | 210 | 12690572 | <reponame>keener101/lkpy<filename>lenskit/metrics/topn.py
"""
Top-N evaluation metrics.
"""
import logging
import numpy as np
import pandas as pd
_log = logging.getLogger(__name__)
def bulk_impl(metric):
def wrap(impl):
metric.bulk_score = impl
return impl
return wrap
def precision(recs, ... |
accounts/admin.py | mirsazzathossain/SPMS-Project | 190 | 12690576 | <reponame>mirsazzathossain/SPMS-Project
from django.contrib import admin
from .models import User
admin.site.register(User)
|
ML/keras/augmentation/augmentation_example.py | saneravi/ML_Stuff | 209 | 12690608 | <gh_stars>100-1000
#!/usr/bin/env python
import matplotlib.pyplot as plt
from keras.datasets import cifar10
from keras.preprocessing.image import ImageDataGenerator
(X_train_raw, y_train_raw), (X_test, y_test) = cifar10.load_data()
n = 10
X_train = X_train_raw[:n] / 255.
y_train = y_train_raw[:n]
da = {}
da['hue_sh... |
tests/test_diffeq/test_perturbed/test_step/test_perturbedstepsolution.py | mmahsereci/probnum | 226 | 12690611 | import numpy as np
import pytest
from scipy.integrate._ivp import rk
import probnum.problems.zoo.diffeq as diffeq_zoo
from probnum import _randomvariablelist, diffeq
@pytest.fixture
def steprule():
return diffeq.stepsize.AdaptiveSteps(0.1, atol=1e-4, rtol=1e-4)
@pytest.fixture
def perturbed_solution(steprule):... |
examples/docs_snippets_crag/docs_snippets_crag_tests/concepts_tests/partitions_schedules_sensors_tests/test_partitioned_job_test.py | dagster-io/dagster | 4,606 | 12690616 | from docs_snippets_crag.concepts.partitions_schedules_sensors.partitioned_job_test import ( # pylint: disable=unused-import
test_do_stuff_partitioned,
)
|
egg/zoo/simple_autoenc/features.py | vengalraoguttha/EGG | 254 | 12690670 | # 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
import pickle
import numpy as np
import torch
import torch.nn.parallel
import torch.utils.data as data
class _OneHotIterator:
... |
dnanexus/shell/resources/usr/local/lib/python2.7/dist-packages/MACS2/IO/BinKeeper.py | strattan/test-merge2 | 108 | 12690684 | # Time-stamp: <2011-03-14 17:52:00 Tao Liu>
"""Module Description: BinKeeper for Wiggle-like tracks.
Copyright (c) 2008 <NAME> <<EMAIL>>
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file COPYING included with
the distribution).
@status: experiment... |
srop-examples/srop2/harness.py | security-notes/pwntools-write-ups | 456 | 12690693 | #!/usr/bin/env python
from pwn import *
import os, signal
context.log_level = 1000
with tempfile.NamedTemporaryFile() as fd:
s = randoms(12)+"\n"
fd.write(s)
fd.flush()
try:
p = process(["python", "doit.py", "FLAG=%s"%fd.name])
#p.sendline(fd.name)
flagenc = p.recvline(timeout=... |
zhihu/activity.py | enjoy233/zhihu-py3 | 1,321 | 12690733 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import datetime
from .acttype import ActType
from .answer import Answer
from .author import Author, ANONYMOUS
from .collection import Collection
from .column import Column
from .common import *
from .post import Post
from .question import Question
from .top... |
server/mturk/views/external.py | paulu/opensurfaces | 137 | 12690736 | """
Tasks viewed from the mturk website nested in an iframe
"""
import json
import random
import datetime
from ua_parser import user_agent_parser
from django.conf import settings
from django.core.context_processors import csrf
from django.views.decorators.http import require_POST
from django.views.decorators.csrf imp... |
python/spinn/data/mt/load_mt_data.py | pramitmallick/spinn | 103 | 12690740 | <filename>python/spinn/data/mt/load_mt_data.py
import numpy as np
import json
import codecs
import re
import csv
FIXED_VOCABULARY = None
SENTENCE_PAIR_DATA = False
#source: ( That ( ( 's ( ( a lot ) ( to ( pack ( into ( 18 minutes ) ) ) ) ) ) . ) )
#target: وأخرج ملتحفا فوطتي، كان الجميع يراني .
def load_data(source_p... |
tests/orm/utils/test_serialize.py | mkrack/aiida-core | 153 | 12690748 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
demo/plot_wavelets.py | SalvoCas/pywt | 1,435 | 12690756 | <reponame>SalvoCas/pywt<filename>demo/plot_wavelets.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Plot scaling and wavelet functions for db, sym, coif, bior and rbio families
import itertools
import matplotlib.pyplot as plt
import pywt
plot_data = [('db', (4, 3)),
('sym', (4, 3)),
(... |
naive-dense-unet.py | zhiqiangdon/CU-Net | 213 | 12690788 | <reponame>zhiqiangdon/CU-Net
# <NAME>, May 2017
import sys, warnings, traceback, torch
def warn_with_traceback(message, category, filename, lineno, file=None, line=None):
sys.stderr.write(warnings.formatwarning(message, category, filename, lineno, line))
traceback.print_stack(sys._getframe(2))
warnings.showwarn... |
sneakers/tests/test_all.py | jayvdb/sneaky-creeper | 146 | 12690838 | import unittest
import json
import random
import string
import os
from unittest.case import SkipTest
from nose.tools import assert_equals, assert_in
from functools import partial
from twython import TwythonError
import sneakers
basePath = os.path.dirname(os.path.abspath(sneakers.__file__))
def unit_channel(channel,... |
src/genie/libs/parser/comware/tests/DisplayInterfaces/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 12690858 | expected_output = {
"GigabitEthernet3/8/0/38": {
"auto_negotiate": True,
"counters": {
"normal": {
"in_broadcast_pkts": 1093,
"in_mac_pause_frames": 0,
"in_multicast_pkts": 18864,
"in_octets": 0,
"in_pkts": 7... |
pymatgen/util/tests/test_num_utils.py | wangyusu/pymatgen | 921 | 12690861 | # coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import random
import unittest
from pymatgen.util.num import abs_cap, min_max_indexes, round_to_sigfigs
__author__ = "<NAME>"
__copyright__ = "Copyright 2013, The Materials Project"
__version__ = "0.1"
__maint... |
ryu/tests/unit/packet/test_bmp.py | umkcdcrg01/ryu_openflow | 269 | 12690863 | <filename>ryu/tests/unit/packet/test_bmp.py
# Copyright (C) 2014 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/licen... |
app/apiv2/plans/plans.py | Joey-Wondersign/Staffjoy-suite-Joey | 890 | 12690865 | from flask_restful import Resource
from app.constants import API_ENVELOPE, PLAN_PUBLIC_KEYS
from app.plans import plans
class PlansApi(Resource):
# Public (for authenticated users)
def get(self):
# Flatten dict to an array to match rest of api style
output = []
for plan_id, value in p... |
CV/CLPI-Collaborative-Learning-for-Diabetic-Retinopathy-Grading/parser.py | zhangyimi/Research | 1,319 | 12690866 | # 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... |
SRT/exps/BASE-eval-image.py | yerang823/landmark-detection | 612 | 12690869 | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
# For the regression-based detector:
# python exps/BASE-eval-image.py --image ./cache_data/cache/self.jpeg --face 250 150 ... |
PyFlow/UI/CompileUiQt.py | luzpaz/PyFlow | 1,463 | 12690901 | ## Copyright 2015-2019 <NAME>, <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://www.apache.org/licenses/LICENSE-2.0
## Unless required by applicable law or agreed to i... |
src/numbers_parser/_unpack_numbers.py | jessie-murray/numbers-parser | 110 | 12690932 | <filename>src/numbers_parser/_unpack_numbers.py
# vi: ft=python
import argparse
import os
import json
import re
import sys
from numbers_parser.unpack import read_numbers_file
from numbers_parser import _get_version
from numbers_parser.iwafile import IWAFile
from numbers_parser.exceptions import FileFormatError
def ... |
examples/plugins/robustness/test_distance_attack.py | Harald-R/aw_nas | 195 | 12690963 | # pylint: disable-all
"""
Test a final model with distance attacks
"""
import os
import copy
import argparse
import subprocess
import yaml
if __name__ == "__main__":
TEST_TYPES = {
"BIM_L2": {
"adversary_type": "L2BasicIterativeAttack",
"distance_type": "MeanSquaredDistance",
... |
tests/gem5/memory/test.py | hyu-iot/gem5 | 765 | 12690971 | <filename>tests/gem5/memory/test.py<gh_stars>100-1000
# Copyright (c) 2018 The Regents of the University of California.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source ... |
tests/sighash_single_test.py | jaschadub/pycoin | 1,210 | 12690979 | <gh_stars>1000+
import unittest
from pycoin.ecdsa.secp256k1 import secp256k1_generator
from pycoin.encoding.hexbytes import b2h, b2h_rev
from pycoin.intbytes import int2byte
from pycoin.networks.registry import network_for_netcode
from pycoin.satoshi.der import sigdecode_der, sigencode_der
PRIV_KEYS = (
23309496... |
alipay/aop/api/domain/InsOffilneProduct.py | snowxmas/alipay-sdk-python-all | 213 | 12690996 | <reponame>snowxmas/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class InsOffilneProduct(object):
def __init__(self):
self._biz_data = None
self._prod_code = None
self._prod_name = None
@property
... |
Codes/gracekoo/85_maximal-rectangle.py | liuxiaohui1221/algorithm | 256 | 12691020 | <filename>Codes/gracekoo/85_maximal-rectangle.py
# -*- coding: utf-8 -*-
# @Time: 2020/3/30 22:22
# @Author: GraceKoo
# @File: 85_maximal-rectangle.py
# @Desc:https://leetcode-cn.com/problems/maximal-rectangle/
from typing import List
class Solution:
def maximalRectangle(self, matrix: List[List[str]]) -> int:
... |
RecoParticleFlow/PFProducer/python/pfConcretePFCandidateProducer_cfi.py | ckamtsikis/cmssw | 852 | 12691075 | import FWCore.ParameterSet.Config as cms
pfConcretePFCandidateProducer = cms.EDProducer("PFConcretePFCandidateProducer",
src = cms.InputTag('particleFlow')
)
|
Python3/795.py | rakhi2001/ecom7 | 854 | 12691079 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 372 ms submission
# look at every usb array individually and compare elements to L and R -> O(n^3)
# use stack
# iterate through A
# keep track of max of the current stack
# if max <
# i... |
HRI/TFVT_HRI/scripts/plot_valence_arousal_plain.py | WorldEditors/PaddleRobotics | 146 | 12691096 | import os
import codecs
import numpy as np
import matplotlib.pyplot as plt
Has_Header = True
CSV = 'data/valence_arousal_exp.csv'
def calculate_mean_variance(data):
theta = np.arctan(data[:, 0] / data[:, 1])
m_x = np.mean(np.cos(theta))
m_y = np.mean(np.sin(theta))
mu = np.arctan(m_y / m_x)
R = ... |
ddpg/results/plot_reward.py | q110110543/deep-rl | 113 | 12691097 | import numpy
import matplotlib.pyplot as plt
FILE_NAME = 'rewards_nonshare.npz'
def smooth(reward_vec, filter_size):
l = len(reward_vec) - filter_size + 1
print(len(reward_vec))
smooth_reward_vec = numpy.zeros(l)
for i in range(l):
reward = numpy.mean(reward_vec[i:i+filter_size])
smoot... |
Basic/Calculate Factorial of A Number/SolutionByVaishnavi.py | rajethanm4/Programmers-Community | 261 | 12691121 | #To find factorial of number
num = int(input('N='))
factorial = 1
if num<0:
print('Number is not accepted')
elif num==0:
print(1)
else:
for i in range(1,num+1):
factorial = factorial * i
print(factorial)
|
neat/eval.py | sisl/neat | 183 | 12691171 | import argparse
import json
import os
import sys
from tqdm import tqdm
from PIL import Image, ImageDraw
import numpy as np
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
import torch.nn.functional as F
torch.backends.cudnn.benchmark = True
from config import GlobalConfig
from archite... |
examples/cve_2016_3308_bsod.py | plowsof/mayhem | 214 | 12691214 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ms16_098_bsod.py
#
# Copyright 2016 <NAME> <<EMAIL>>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above c... |
pybamm/input/parameters/lithium_ion/electrolytes/lipf6_Ramadass2004/electrolyte_diffusivity_Ramadass2004.py | manjunathnilugal/PyBaMM | 330 | 12691236 | <reponame>manjunathnilugal/PyBaMM
from pybamm import exp, constants
def electrolyte_diffusivity_Ramadass2004(c_e, T):
"""
Diffusivity of LiPF6 in EC:DMC as a function of ion concentration.
References
----------
.. [1] <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. "Development of First Principles Ca... |
build/build.py | babel/6to5-sublime | 3,565 | 12691263 | import sublime
import sublime_plugin
__all__ = ['BuildBabelPackageCommand']
BABEL_CONFIGURATION = {
'name': 'JavaScript (Babel)',
'scope': 'source.js',
'file_extensions': [ 'js', 'jsx', 'es6', 'babel' ],
'flow_types': True,
'jsx': True,
'string_object_keys': True,
'custom_templates': {
... |
src/create_config.py | SamadiPour/iran-hosted-domains | 173 | 12691341 | <filename>src/create_config.py<gh_stars>100-1000
import json
from typing import Iterable
import constants as consts
import utils
def shadowrocket(domains: Iterable[str]):
config = (
"#Shadowrocket\n"
"[General]\n"
"bypass-system = true\n"
"skip-proxy = 192.168.0.0/16, 10.0.0.0/8, ... |
odin/utilities/__init__.py | gsamarakoon/Odin | 103 | 12691343 | from .odin_init import odin_init
from .compute_days_elapsed import compute_days_elapsed
from .fund_actions import period_dict
|
03-dict-set/py3.10/creator.py | SeirousLee/example-code-2e | 990 | 12691354 | """
Pattern matching with mapping—requires Python ≥ 3.10
# tag::DICT_MATCH_TEST[]
>>> b1 = dict(api=1, author='<NAME>',
... type='book', title='Gödel, Escher, Bach')
>>> get_creators(b1)
['<NAME>']
>>> from collections import OrderedDict
>>> b2 = OrderedDict(api=2, type='book',
... title='Python in a N... |
src/tf_transformers/models/t5/convert.py | legacyai/tf-transformers | 116 | 12691367 | import numpy as np
import tensorflow as tf
from absl import logging
from tf_transformers.core import keras_utils
def convert_t5_pt(model, config, model_name):
"""PT converter
Args:
model_hf: HuggingFace Model (TF)
model: tf_transformers model/layer
config: dict
Returns:
a ... |
test/__init__.py | cmutel/json2html | 236 | 12691370 | '''
Unit Test Cases for JSON2HTML
Description - python wrapper for converting JSON to HTML Table format
(c) 2013 <NAME>. MIT License
'''
__author__ = '<NAME>'
__version__ = '1.1.1'
__license__ = 'MIT'
|
scripts/demo.py | mathkann/understanding-random-forests | 353 | 12691374 | """
Understanding variable importances in forests of randomized trees.
<NAME>, <NAME>, <NAME> and <NAME>
NIPS, Lake Tahoe, United States, 2013
http://orbi.ulg.ac.be/handle/2268/155642
This demo reproduces Table 2 from the paper. It also shows that using Extra-
Trees from Scikit-Learn, or an ensemble of randomized ID3 ... |
CalibMuon/Configuration/python/CSC_FakeDBConditions_cff.py | ckamtsikis/cmssw | 852 | 12691390 | <filename>CalibMuon/Configuration/python/CSC_FakeDBConditions_cff.py
import FWCore.ParameterSet.Config as cms
from CalibMuon.CSCCalibration.CSCFakeDBGains_cfi import *
from CalibMuon.CSCCalibration.CSCFakeDBPedestals_cfi import *
from CalibMuon.CSCCalibration.CSCFakeDBNoiseMatrix_cfi import *
from CalibMuon.CSCCalibra... |
scripts/generate_rtd_images/gen_bounding_boxes.py | marsbroshok/imgaug-doc | 134 | 12691398 | <reponame>marsbroshok/imgaug-doc<filename>scripts/generate_rtd_images/gen_bounding_boxes.py
from __future__ import print_function, division
from .utils import save, grid
def main():
"""Generate all example images for the chapter `Examples: Bounding Boxes`
in the documentation."""
chapter_examples_boundin... |
risk/admin.py | dekoder/LogESP | 130 | 12691400 | <gh_stars>100-1000
from django.contrib import admin
# Register your models here.
from .models import AdvThreatSrcCategory, AdvThreatSrcType
from .models import AdvThreatSource
from .models import NonAdvThreatSrcClass, NonAdvThreatSrcCategory
from .models import NonAdvThreatSrcType, NonAdvThreatSource
from .models impo... |
templatetags/htk_tags.py | goztrk/django-htk | 206 | 12691417 | <reponame>goztrk/django-htk
# Python Standard Library Imports
import base64
import datetime
import json
import re
# Third Party (PyPI) Imports
import six.moves.urllib as urllib
# Django Imports
from django import template
from django.template.defaultfilters import stringfilter
from django.urls import reverse
from dja... |
tests/extension/resolver_/nested_module/resolver_nested_module.py | akmaru/veriloggen | 232 | 12691426 | <filename>tests/extension/resolver_/nested_module/resolver_nested_module.py
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirn... |
social_rl/multiagent_tfagents/joint_attention/joint_attention_train_eval.py | DionysisChristopoulos/google-research | 23,901 | 12691478 | <filename>social_rl/multiagent_tfagents/joint_attention/joint_attention_train_eval.py
# coding=utf-8
# Copyright 2021 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 may obtain a copy of the License... |
tests/integrations/modules/test_modules.py | cmalek/sentry-python | 1,213 | 12691479 | import sentry_sdk
from sentry_sdk.integrations.modules import ModulesIntegration
def test_basic(sentry_init, capture_events):
sentry_init(integrations=[ModulesIntegration()])
events = capture_events()
sentry_sdk.capture_exception(ValueError())
(event,) = events
assert "sentry-sdk" in event["mod... |
test/dropout_test.py | alimhanif/blocksparse | 903 | 12691481 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
import blocksparse as bs
from tensorflow.python.ops import gradient_checker
def ceil_div(x, y):
return -(-x // y)
shapes = [
# ... |
plugins/quetz_transmutation/quetz_transmutation/jobs.py | maresb/quetz | 108 | 12691499 | import json
import logging
import os
import shutil
from pathlib import Path
from tempfile import TemporaryDirectory
from conda_package_handling.api import _convert
from quetz.condainfo import calculate_file_hashes_and_size
from quetz.dao import Dao
from quetz.pkgstores import PackageStore
logger = logging.getLogger(... |
binary_tree_zigzag_level_order_traversal/solution.py | mahimadubey/leetcode-python | 528 | 12691529 | <gh_stars>100-1000
"""
Given a binary tree, return the zigzag level order traversal of its nodes'
values. (ie, from left to right, then right to left for the next level and
alternate between).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ \
9 20
/ \
15 7
return its zigzag level order traver... |
tests/benchmarks/string-methods/format.py | abeaumont/Dictu | 116 | 12691536 | <filename>tests/benchmarks/string-methods/format.py
import time
start = time.perf_counter()
for _ in range(10000):
x = "{} {}".format("test", "test")
print(time.perf_counter() - start) |
bbcm/utils/logger.py | okcd00/BertBasedCorrectionModels | 158 | 12691540 | """
@Time : 2021-01-21 11:50:55
@File : logger.py
@Author : Abtion
@Email : <EMAIL>
"""
import logging
import os
import sys
def setup_logger(name, save_dir, distributed_rank):
logger = logging.getLogger(name)
logger.setLevel(logging.DEBUG)
# don't log results for the non-master process
if... |
loop_if_else_break.py | NightmareQAQ/python-notes | 106 | 12691551 | def contains_magic_number(list1, magic_number):
for i in list1:
if i == magic_number:
print("This list contains the magic number")
# if not add break , will run more meaningless loop
break
else:
print("This list does NOT contain the magic number")
if... |
startup.py | ExE-Boss/mdn-samples-server | 900 | 12691553 | <reponame>ExE-Boss/mdn-samples-server
#!/usr/bin/python
#
# MDN Sample Server
# Start up samples as needed.
#
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
#
import os
import sys
import subprocess
import pwd
#
# startService
#
# Given a path, start up the servi... |
tests/test_client_subscription.py | vivekhub/razorpay-python | 125 | 12691554 | <filename>tests/test_client_subscription.py
import responses
import json
from .helpers import mock_file, ClientTestCase
class TestClientSubscription(ClientTestCase):
def setUp(self):
super(TestClientSubscription, self).setUp()
self.base_url = '{}/subscriptions'.format(self.base_url)
self... |
plenario/api/jobs.py | vforgione/plenario | 109 | 12691568 | <reponame>vforgione/plenario
import pickle
from flask import jsonify
from plenario.database import postgres_base, postgres_engine as engine
from plenario.utils.helpers import reflect
def get_job(ticket: str):
celery_taskmeta = reflect('celery_taskmeta', postgres_base.metadata, engine)
query = celery_taskmet... |
maggot/config.py | ex4sperans/mag | 107 | 12691599 | from collections import OrderedDict
from maggot import get_current_separator
from maggot.containers import NestedContainer
class Config(NestedContainer):
@property
def identifier(self):
"""
Maps config parameters into a single string that shortly
summarrizes the content of config`s f... |
scripts/configure-file.py | kasymovga/taisei | 573 | 12691606 | #!/usr/bin/env python3
import taiseilib.common
import taiseilib.configure
taiseilib.common.run_main(taiseilib.configure.main)
|
psonic/effects.py | m-roberts/python-sonic | 263 | 12691612 | <reponame>m-roberts/python-sonic
"""Effects"""
class FxName:
"""FX name"""
def __init__(self, name):
self.name = name
BITCRUSHER = FxName('bitcrusher')
COMPRESSOR = FxName('compressor')
ECHO = FxName('echo')
FLANGER = FxName('flanger')
KRUSH = FxName('krush')
LPF = FxName('lpf')
PAN = FxName('pan')
... |
lib/translator.py | damonchen/vim | 699 | 12691629 | <filename>lib/translator.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#======================================================================
#
# translator.py - 命令行翻译(谷歌,必应,百度,有道,词霸)
#
# Created by skywind on 2019/06/14
# Version: 1.0.2, Last Modified: 2019/06/18 18:40
#
#================================... |
Data/Algorithm/Python/bubbleSort.py | jecqiang/PHPer | 376 | 12691638 | def bubble_sort(arry):
n = len(arry) #获得数组的长度
for i in range(n):
for j in range(1,n-i):
if arry[j-1] > arry[j] : #如果前者比后者大
arry[j-1],arry[j] = arry[j],arry[j-1] #则交换两者
return arry
|
dev/Gems/CloudGemFramework/v1/AWS/common-code/Utils/test/test_unit_aws_sts.py | BadDevCode/lumberyard | 1,738 | 12691644 | #
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... |
src/utils/utils.py | TheodoreGalanos/DALLE-mtf | 385 | 12691648 | <reponame>TheodoreGalanos/DALLE-mtf
import json
from collections import defaultdict
from urllib.parse import urlparse
from shutil import rmtree
import os
import tensorflow.compat.v1 as tf
import tensorflow.compat.v2 as tf2
import mesh_tensorflow as mtf
import logging
import sys
from mesh_tensorflow.ops import Operatio... |
packages/pyright-internal/src/tests/samples/genericTypes4.py | sasano8/pyright | 4,391 | 12691682 | <reponame>sasano8/pyright
# This sample tests type inference and TypeVar matching.
from typing import Union
m = int(1)
n = float(1.1)
p = "hello"
a = dict(x=m, y=m)
a1: int = a["x"]
b = dict(x=n, y=n)
# This should generate an error because b should be
# typed as dict[Any, float], and b["x"] is a float.
b1: int = b... |
third_party/gsutil/third_party/rsa/tests/test_common.py | tingshao/catapult | 5,079 | 12691690 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 <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
#
# https://www.apache.org/licenses/... |
models/flow_model.py | fyviezhao/dressing-in-order | 172 | 12691726 | from .dior_model import *
from utils.util import StoreList, StoreDictKeyPair
from models.networks.block_extractor.block_extractor import BlockExtractor
class FlowModel(DIORModel):
def __init__(self, opt):
opt.frozen_flownet = False
DIORModel.__init__(self, opt)
self.netE_opt = opt.netE
... |
crits/domains/tests.py | dutrow/crits | 738 | 12691748 | from django.test import SimpleTestCase
from django.test.client import RequestFactory
import crits.domains.views as views
import crits.domains.handlers as handlers
from crits.core.user import CRITsUser
from crits.core.handlers import add_new_source
from crits.core.source_access import SourceAccess
TSRC = "TestSource"
... |
autogoal/datasets/yeast.py | lsuarez98/autogoal | 157 | 12691776 | <filename>autogoal/datasets/yeast.py<gh_stars>100-1000
import numpy as np
import os
from autogoal.datasets import datapath, download
from sklearn.feature_extraction import DictVectorizer
def load():
"""
Loads corpora from [Yeast uci dataset](https://archive.ics.uci.edu/ml/datasets/Yeast).
##### Examples
... |
www/src/Lib/logging/brython_handlers.py | raspberrypieman/brython | 5,926 | 12691777 | import logging
from browser.ajax import ajax
class XMLHTTPHandler(logging.Handler):
"""
A class which sends records to a Web server, using either GET or
POST semantics.
"""
def __init__(self, url, method="GET"):
"""
Initialize the instance with the host, the request URL, and the m... |
pybamm/models/submodels/tortuosity/bruggeman_tortuosity.py | manjunathnilugal/PyBaMM | 330 | 12691790 | #
# Class for Bruggeman tortuosity
#
import pybamm
from .base_tortuosity import BaseModel
class Bruggeman(BaseModel):
"""Submodel for Bruggeman tortuosity
Parameters
----------
param : parameter class
The parameters to use for this submodel
phase : str
The material for the model ... |
tests/test_testbase/test_retry.py | molayxu/QTAF | 452 | 12691795 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with t... |
mining/controllers/api/widget.py | nuaadot/mining | 785 | 12691802 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bottle import Bottle
from bottle.ext.mongo import MongoPlugin
from mining.utils import conf
from .base import get, post, put, delete
collection = 'widget'
widget_app = Bottle()
mongo = MongoPlugin(
uri=conf("mongodb")["uri"],
db=conf("mong... |
notebooks/mrisensesim.py | ckolbPTB/torchkbnufft | 122 | 12691891 | import numpy as np
def mrisensesim(size, ncoils=8, array_cent=None, coil_width=2, n_rings=None, phi=0):
"""Apply simulated sensitivity maps. Based on a script by <NAME>.
Args:
size (tuple): Size of the image array for the sensitivity coils.
nc_range (int, default: 8): Number of coils to simul... |
demo_gl.py | wangqr/VNect-tensorflow | 489 | 12691914 | <filename>demo_gl.py
import caffe
import argparse
import os
import cv2
import numpy as np
import time
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
import utils
parser = argparse.ArgumentParser()
parse... |
CodeChef/SHORT/COOK63/Problem A/A.py | VastoLorde95/Competitive-Programming | 170 | 12691932 | <gh_stars>100-1000
from math import *
from fractions import *
def solve():
n = input()
w = raw_input().split()
l = len(w[0])
lis = []
for i in xrange(l):
for j in xrange(i+1,l):
t = w[0][i:j+1]
ok = True
for st in w:
# print t, st
if t not in st:
ok = False
break
if ok:
lis.appe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.