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 |
|---|---|---|---|---|
components/isceobj/Alos2Proc/runPreprocessor.py | yuankailiu/isce2 | 1,133 | 69320 | #
# Author: <NAME>
# Copyright 2015-present, NASA-JPL/Caltech
#
import os
import glob
import logging
import datetime
import numpy as np
import isceobj
import isceobj.Sensor.MultiMode as MultiMode
from isceobj.Planet.Planet import Planet
from isceobj.Alos2Proc.Alos2ProcPublic import runCmd
from isceobj.Alos2Proc.Alos2... |
qcodes/instrument_drivers/ZI/ZIUHFLI.py | riju-pal/QCoDeS_riju | 223 | 69344 | <reponame>riju-pal/QCoDeS_riju
import logging
import math
import time
from functools import partial
from math import sqrt
from typing import Any, Callable, Dict, List, Optional, Sequence, Union, cast
import numpy as np
from qcodes.utils.helpers import create_on_off_val_mapping
try:
import zhinst.utils
except Imp... |
api/__init__.py | bnbwebexpertise/linkr | 124 | 69365 | # flake8: noqa: F401
from auth import *
from link import *
from misc import *
from user import *
|
iepy/preprocess/stanford_preprocess.py | francolq/iepy | 813 | 69376 | <reponame>francolq/iepy<gh_stars>100-1000
from collections import defaultdict
from itertools import chain, groupby
import logging
import tempfile
from iepy.preprocess import corenlp
from iepy.preprocess.pipeline import BasePreProcessStepRunner, PreProcessSteps
from iepy.preprocess.ner.base import FoundEntity
from iepy... |
couler/core/templates/template.py | dmerrick/couler | 700 | 69379 | <filename>couler/core/templates/template.py
# Copyright 2021 The Couler 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-... |
alipay/aop/api/response/AlipayPcreditLoanCollateralCarQueryResponse.py | snowxmas/alipay-sdk-python-all | 213 | 69380 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayPcreditLoanCollateralCarQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayPcreditLoanCollateralCarQueryResponse, self).__init__()
self._address = N... |
testcases/elichika_tests/node/Unpooling2D.py | vermashresth/chainer-compiler | 116 | 69393 | <filename>testcases/elichika_tests/node/Unpooling2D.py
# coding: utf-8
import chainer
import chainer.functions as F
class Unpooling2D(chainer.Chain):
def forward(self, x):
y = F.unpooling_2d(x, 2, cover_all=False)
return y
class Unpooling2D_3x4(chainer.Chain):
def forward(self, x):
... |
seamseg/config/__init__.py | gladcolor/seamseg | 282 | 69414 | <filename>seamseg/config/__init__.py<gh_stars>100-1000
from .config import load_config, DEFAULTS
|
2020/CVE-2020-16139/poc/pocsploit/CVE-2020-16139.py | hjyuan/reapoc | 421 | 69445 | <filename>2020/CVE-2020-16139/poc/pocsploit/CVE-2020-16139.py
import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''Cisco 7937G Denial-of-Service Reboot Attack''',
"description": '''A denial-of-service in Cisco Unified IP Conference Station 7937G 1-4-4-0 ... |
chrome/installer/mini_installer/generate_previous_version_mini_installer.py | zipated/src | 2,151 | 69517 | <reponame>zipated/src
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generates a mini_installer with a lower version than an existing one."""
import argparse
import subprocess
import sys
def main():... |
neurodsp/sim/aperiodic.py | JanCBrammer/neurodsp | 154 | 69532 | """Simulating time series, with aperiodic activity."""
import numpy as np
from scipy.stats import zscore
from scipy.linalg import toeplitz, cholesky
from neurodsp.filt import filter_signal, infer_passtype
from neurodsp.filt.fir import compute_filter_length
from neurodsp.filt.checks import check_filter_definition
from... |
pytext/metric_reporters/word_tagging_metric_reporter.py | baronrustamov/pytext | 6,199 | 69534 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import itertools
import re
from collections import Counter
from typing import Dict, List, NamedTuple
from pytext.common.constants import DatasetFieldName, SpecialTokens, Stage
from pytext.data import CommonMetadata
from pytex... |
network.py | sjoerdvansteenkiste/Neural-EM | 116 | 69559 | <gh_stars>100-1000
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import tensorflow as tf
import tensorflow.contrib.slim as slim
from sacred import Ingredient
from tensorflow.contrib.rnn import RNNCell
from utils import ACTIVATION_FUNCTIONS
net = Ingredient('n... |
python/080 Remove Duplicates from Sorted Array II.py | allandproust/leetcode-share | 156 | 69564 | <gh_stars>100-1000
'''
Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?
For example,
Given sorted array nums = [1,1,1,2,2,3],
Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3. It doesn't matter what you leave beyond the new leng... |
tests/test_visitors/test_ast/test_classes/test_getter_setter.py | notpushkin/wemake-python-styleguide | 1,931 | 69576 | <reponame>notpushkin/wemake-python-styleguide<filename>tests/test_visitors/test_ast/test_classes/test_getter_setter.py<gh_stars>1000+
import pytest
from wemake_python_styleguide.violations.oop import (
UnpythonicGetterSetterViolation,
)
from wemake_python_styleguide.visitors.ast.classes import WrongClassBodyVisito... |
python/ql/test/library-tests/frameworks/peewee/sql_execution.py | madhurimamandal/codeql | 4,036 | 69584 | import peewee
import playhouse.pool
# This is just one example of one of the support databases
# see https://docs.peewee-orm.com/en/latest/peewee/database.html
db = peewee.MySQLDatabase()
conn = db.connection()
cursor = conn.cursor()
cursor.execute("sql") # $ getSql="sql"
cursor = db.cursor()
cursor.execute("sql") ... |
lib/renderer/camera.py | YuliangXiu/ICON | 486 | 69588 |
# -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someon... |
pico8/map/map.py | lifning/picotool | 310 | 69610 | <reponame>lifning/picotool
"""The map section of a PICO-8 cart.
The map region consists of 4096 bytes. The .p8 representation is 32
lines of 256 hexadecimal digits (128 bytes).
The map is 128 tiles wide by 64 tiles high. Each tile is one of the
256 tiles from the spritesheet. Map memory describes the top 32 rows
(128... |
atlas/aws_utils/src/integration/config.py | DeepLearnI/atlas | 296 | 69628 | <filename>atlas/aws_utils/src/integration/config.py<gh_stars>100-1000
from uuid import uuid4
# separates test runs
TEST_UUID = str(uuid4())
def _code_bucket():
return 'foundations-code-test'
def make_code_bucket():
from foundations import PrefixedBucket
from foundations_aws import AWSBucket
retur... |
src/transformers/data/data_collator.py | manuelciosici/transformers | 8,028 | 69629 | <reponame>manuelciosici/transformers
# Copyright 2020 The HuggingFace Team. 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... |
tests/test_requests.py | q0w/BlackSheep | 420 | 69635 | <filename>tests/test_requests.py<gh_stars>100-1000
import pytest
from blacksheep import Content, Request, scribe
from blacksheep.contents import FormPart, MultiPartFormData
from blacksheep.exceptions import BadRequestFormat
from blacksheep.messages import get_absolute_url_to_path, get_request_absolute_url
from blacksh... |
subjects/hello/hello.py | powerdev0510/pythonc | 405 | 69689 | <filename>subjects/hello/hello.py
# Some code below
def hello():
print "Hello World"
|
towhee/dataframe/dataframe_v2.py | L-Net-1992/towhee | 365 | 69700 | <filename>towhee/dataframe/dataframe_v2.py
# Copyright 2021 Zilliz. 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
#
#... |
rpython/jit/backend/aarch64/test/test_list.py | nanjekyejoannah/pypy | 333 | 69704 | <reponame>nanjekyejoannah/pypy
from rpython.jit.metainterp.test.test_list import ListTests
from rpython.jit.backend.aarch64.test.test_basic import JitAarch64Mixin
class TestList(JitAarch64Mixin, ListTests):
# for individual tests see
# ====> ../../../metainterp/test/test_list.py
pass
|
var/spack/repos/builtin/packages/pacparser/package.py | LiamBindle/spack | 2,360 | 69716 | <gh_stars>1000+
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Pacparser(MakefilePackage):
"""pacparser is a library to parse proxy auto-... |
recipes/Python/252178_Reorder_sequence_uses_generators/recipe-252178.py | tdiprima/code | 2,023 | 69733 | <reponame>tdiprima/code<gh_stars>1000+
def all_perms(str):
if len(str) <=1:
yield str
else:
for perm in all_perms(str[1:]):
for i in range(len(perm)+1):
#nb str[0:1] works in both string and list contexts
yield perm[:i] + str[0:1] + perm[i:]
|
src/chia_log/log_handler.py | Connor-Knabe/chiadog | 503 | 69749 | <gh_stars>100-1000
# std
from typing import Optional
# project
from src.chia_log.handlers.daily_stats.stats_manager import StatsManager
from src.chia_log.handlers.harvester_activity_handler import HarvesterActivityHandler
from src.chia_log.handlers.partial_handler import PartialHandler
from src.chia_log.handlers.block... |
muzero/core_test.py | xxdreck/google-research | 23,901 | 69766 | <reponame>xxdreck/google-research<filename>muzero/core_test.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 at
#
# http://www.... |
mod_pbxproj.py | xwf20050250/mod-pbxproj | 991 | 69770 | # MIT License
#
# Copyright (c) 2016 <NAME> aka kronenthaler
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... |
usaspending_api/accounts/migrations/0001_initial.py | g4brielvs/usaspending-api | 217 | 69777 | <filename>usaspending_api/accounts/migrations/0001_initial.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-11 16:17
from __future__ import unicode_literals
import django.db.models.deletion
from django.db import migrations, models
from usaspending_api.common.helpers.generic_helper ... |
coapthon/resources/remoteResource.py | urbas/CoAPthon3 | 237 | 69793 | <reponame>urbas/CoAPthon3
from coapthon.resources.resource import Resource
__author__ = '<NAME>'
class RemoteResource(Resource):
def __init__(self, name, remote_server, remote_path, coap_server=None, visible=True, observable=True, allow_children=True):
super(RemoteResource, self).__init__(name, coap_serv... |
tests/python/unittest/test_pass_vectorize.py | mingwayzhang/tvm | 286 | 69820 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
python_code/hash_chapter1_reimpl_js.py | possnfiffer/inside_python_dict | 124 | 69826 | from js_reimpl_common import run_op_chapter1_chapter2
def run_op(keys, op, **kwargs):
return run_op_chapter1_chapter2("chapter1", None, keys, op, **kwargs)
def create_new(numbers):
return run_op(None, "create_new", array=numbers)
def create_new_broken(numbers):
return run_op(None, "create_new_broken",... |
noisemaker/effects_registry.py | Kulinark/py-noisemaker | 106 | 69832 | <reponame>Kulinark/py-noisemaker<gh_stars>100-1000
"""Effect decorator for Noisemaker Composer Presets"""
import inspect
EFFECTS = {}
def effect(*args):
"""Function decorator for declaring composable effects."""
def decorator_fn(func):
argspec = inspect.getfullargspec(func)
params = argspe... |
tests/network/transaction/test_required_confirmations.py | ActorForth/brownie | 1,595 | 69837 | import threading
import time
import pytest
import brownie
def send_and_wait_for_tx():
tx = brownie.accounts[0].transfer(
brownie.accounts[1], "0.1 ether", required_confs=0, silent=True
)
tx.wait(2)
assert tx.confirmations >= 2
assert tx.status == 1
@pytest.fixture
def block_time_networ... |
setup.py | annlor/energy-usage | 141 | 69855 | from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
NAME = "energyusage"
VERSION = "0.0.13"
DESCRIPTION = "Measuring the environmental impact of computation"
LONG_DESCRIPTION = long_description
LONG_DESCRIPTION_CONTENT_TYPE = 'text/markdown'
URL = "https:/... |
learn2learn/gym/envs/mujoco/humanoid_direction.py | Brikwerk/learn2learn | 1,774 | 69866 | <gh_stars>1000+
#!/usr/bin/env python3
import gym
import numpy as np
from gym.error import DependencyNotInstalled
try:
from gym.envs.mujoco.mujoco_env import MujocoEnv
except DependencyNotInstalled:
from learn2learn.gym.envs.mujoco.dummy_mujoco_env import MujocoEnv
from learn2learn.gym.envs.meta_env import M... |
api/v2/views/provider_type.py | simpsonw/atmosphere | 197 | 69882 | from core.models import ProviderType
from api.v2.serializers.details import ProviderTypeSerializer
from api.v2.views.base import AuthModelViewSet
class ProviderTypeViewSet(AuthModelViewSet):
"""
API endpoint that allows instance actions to be viewed or edited.
"""
queryset = ProviderType.objects.all()... |
docs/demos/theme_explorer/form.py | glsdown/dash-bootstrap-components | 776 | 69883 | import dash_bootstrap_components as dbc
from dash import html
from .util import make_subheading
form = html.Div(
[
make_subheading("Form", "form"),
dbc.Form(
[
html.Div(
[
dbc.Label("Username"),
dbc.Inp... |
backend/boards/tests/test_api.py | aibek79/Django-React-knboard | 665 | 69909 | import pytest
from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from boards.models import Column, Board, Task
User = get_user_model()
@pytest.fixture
def board(create_user):
user = create_user()
uni_board = Board.objects.create(name="University", owner=user)
uni_b... |
pylearn2/sandbox/cuda_convnet/base_acts.py | ikervazquezlopez/Pylearn2 | 2,045 | 69949 | """
Base class for wrapping
"""
__authors__ = "<NAME>"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["<NAME>", "<NAME>"]
__license__ = "3-clause BSD"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
"""
This module may contain code copied directly or modified from cuda-convnet.
The copyri... |
tests/test_yandex.py | termim/geocoder | 1,506 | 69958 | # coding: utf8
import geocoder
location = 'Ottawa'
coordinates = {'lat': 41.005407, 'lng': 28.978349}
def test_yandex():
g = geocoder.yandex(location)
assert g.ok
def test_yandex_reverse():
g = geocoder.yandex(coordinates, method='reverse')
assert g.ok
def test_multi_results():
g = geocoder.... |
ca-hostpathogen.py | RachidStat/PyCX | 176 | 69972 | <reponame>RachidStat/PyCX
import pycxsimulator
from pylab import *
width = 50
height = 50
initProb = 0.01
infectionRate = 0.85
regrowthRate = 0.15
def initialize():
global time, config, nextConfig
time = 0
config = zeros([height, width])
for x in range(width):
for y in ra... |
caffe2/python/db_test.py | KevinKecc/caffe2 | 585 | 69973 | # Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
testing/example_scripts/fixtures/fill_fixtures/test_extend_fixture_conftest_module/conftest.py | markshao/pytest | 9,225 | 69983 | import pytest
@pytest.fixture
def spam():
return "spam"
|
tests/unit/lib/cookiecutter/test_question.py | torresxb1/aws-sam-cli | 859 | 70027 | from typing import List, Union, Dict
from unittest import TestCase
from unittest.mock import ANY, patch, Mock
from parameterized import parameterized
from samcli.lib.cookiecutter.question import Question, QuestionKind, Choice, Confirm, Info, QuestionFactory
class TestQuestion(TestCase):
_ANY_TEXT = "any text"
... |
airflow/providers/amazon/aws/example_dags/example_salesforce_to_s3.py | ChaseKnowlden/airflow | 15,947 | 70070 | <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 License, Version 2.0 (the
# "License"... |
deps/libjpeg/libjpeg.gyp | jiabinf/node-phash | 131 | 70071 | {
'includes': [ '../common.gyp' ],
'targets': [
{
'target_name': 'libjpeg',
'type': 'static_library',
'include_dirs': [
'.',
],
'sources': [
'ckconfig.c',
'jcapimin.c',
'jcapistd.c',
'jccoefct.c',
'jccolor.c',
'jcdctmgr.c',
... |
inference/inference_matting.py | spy14414/facexlib | 164 | 70078 | import argparse
import cv2
import numpy as np
import torch.nn.functional as F
from torchvision.transforms.functional import normalize
from facexlib.matting import init_matting_model
from facexlib.utils import img2tensor
def main(args):
modnet = init_matting_model()
# read image
img = cv2.imread(args.img... |
library/iptables.py | pgraziano/ursula | 193 | 70085 | <reponame>pgraziano/ursula<filename>library/iptables.py<gh_stars>100-1000
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, <NAME> <<EMAIL>>
#
# This file is part of Ansible
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... |
tests/test_protocol.py | ShadowJonathan/txredisapi | 104 | 70101 | <filename>tests/test_protocol.py
# coding: utf-8
# Copyright 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
pygame_menu/utils.py | ppizarror/pygame-menu | 419 | 70102 | """
pygame-menu
https://github.com/ppizarror/pygame-menu
UTILS
Utility functions.
License:
-------------------------------------------------------------------------------
The MIT License (MIT)
Copyright 2017-2021 <NAME>. @ppizarror
Permission is hereby granted, free of charge, to any person obtaining a
copy of this ... |
examples/acados_python/getting_started/ocp/minimal_example_ocp_reuse_code.py | schwieni/acados | 322 | 70109 | # Minimal example showing how to reuse the exported c-code with
# different time-steps.
#
# There are two use-cases demonstrated here. One use-case is to change
# the length of the time-stamp vector (this results in a different
# N). Another use-case is to change the final time but keep the number
# of shooting nodes i... |
source/lib/waflibv2.py | subanishaik27/aws-waf | 678 | 70171 | ######################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... |
boto3_type_annotations_with_docs/boto3_type_annotations/datapipeline/paginator.py | cowboygneox/boto3_type_annotations | 119 | 70175 | <filename>boto3_type_annotations_with_docs/boto3_type_annotations/datapipeline/paginator.py<gh_stars>100-1000
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class DescribeObjects(Paginator):
def paginate(self, pipelineId: str, objectIds: List, evaluateExpressions: bool = N... |
example/cifar_resnet.py | chakpongchung/tinyflow | 2,035 | 70179 | import tinyflow as tf
from tinyflow.datasets import get_cifar10
import numpy as np
num_epoch = 10
num_batch = 600
batch_size = 100
def conv_factory(x, filter_size, in_filters, out_filters):
x = tf.nn.conv2d(x, num_filter=out_filters,
ksize=[1, filter_size, filter_size, 1], padding='SAME')
x = t... |
kivymd/uix/pickers/colorpicker/__init__.py | marvelous-benji/KivyMD | 1,111 | 70202 | from .colorpicker import MDColorPicker # NOQA F401
|
pyjswidgets/pyjamas/chart/TouchedPointUpdateOption.py | takipsizad/pyjs | 739 | 70220 | """
* Copyright 2007,2008,2009 <NAME>
* Copyright (C) 2009 <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... |
backends/ubpf/tests/ptf/ipv4_actions_test.py | anasyrmia/p4c-1 | 487 | 70226 | #!/usr/bin/env python
# Copyright 2019 Orange
#
# 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... |
packages/3d_plotting/examples/compute_field.py | zmoon/scipy-lecture-notes | 2,538 | 70251 | """
Helmoltz coils
==============
A script that computes the magnetic field generated by a pair of Helmoltz
coils.
"""
import numpy as np
from scipy import special, linalg
##############################################################################
# Function to caculate the field of a loop
def base_vectors(n):
... |
tests/licensedcode/data/datadriven/external/fossology-tests/CC/matching.py | s4-2/scancode-toolkit | 1,511 | 70255 | <gh_stars>1000+
# matching.py - bipartite graph maximum matching algorithms
#
# Copyright 2015 <NAME> <<EMAIL>>.
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
# information.
#
# This module uses material from the Wikipedia article Hopcroft--Karp algorithm
#... |
alf/examples/tutorial/off_policy_states_conf.py | www2171668/alf | 175 | 70275 | # Copyright (c) 2021 Horizon Robotics and ALF Contributors. 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... |
Stock/Trade/Broker/WebTrader.py | Leonardo-YXH/DevilYuan | 135 | 70280 | <reponame>Leonardo-YXH/DevilYuan
import ssl
import random
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
from .DyTrader import *
class Ssl3HttpAdapter(HTTPAdapter):
def init_poolmanager(self, connections, maxsize, block=False):
self... |
corehq/motech/tests/test_repeater_helpers.py | andyasne/commcare-hq | 471 | 70296 | <gh_stars>100-1000
from django.test.testcases import TestCase
from mock import patch
from corehq.form_processor.models import CommCareCaseSQL
from datetime import datetime
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.motech.repeater_helpers import get_relevant_case_updates_from_for... |
scripts/license.py | LiuFang07/bk-cmdb | 4,695 | 70299 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import getopt
import os
license_content = '''/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 TH<NAME>, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you ma... |
RecoPPS/Local/python/PPSTimingCalibrationModeEnum_cff.py | ckamtsikis/cmssw | 852 | 70319 | class PPSTimingCalibrationModeEnum:
CondDB = 0
JSON = 1
SQLite = 2
|
httpd.py | bshah2016/web-processing | 250 | 70335 | #!/usr/bin/env python
PORT = 9914
SERVER = '127.0.0.1'
import SimpleHTTPServer
import BaseHTTPServer
import SocketServer
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
class Server(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
pass
httpd = Server((SERVER, PORT), Handler)
print "Web Server lis... |
unittest/scripts/py_devapi/validation/mysqlx_collection_remove_prepared.py | mueller/mysql-shell | 119 | 70348 | #@<PROTOCOL> First execution is normal
>>>> SEND Mysqlx.Crud.Delete {
collection {
name: "test_collection"
schema: "prepared_stmt"
}
data_model: DOCUMENT
criteria {
type: OPERATOR
operator {
name: "=="
param {
type: IDENT
identifier {
document_path {
... |
python/turbodbc_test/test_data_types.py | arikfr/turbodbc | 537 | 70355 | import turbodbc.data_types
from turbodbc import STRING, BINARY, NUMBER, DATETIME, ROWID
ALL_TYPE_CODES = [turbodbc.data_types._BOOLEAN_CODE,
turbodbc.data_types._INTEGER_CODE,
turbodbc.data_types._FLOATING_POINT_CODE,
turbodbc.data_types._STRING_CODE,
... |
lhotse/recipes/timit.py | stachu86/lhotse | 353 | 70365 | <filename>lhotse/recipes/timit.py
#!/usr/bin/env python3
# Copyright 2021 Xiaomi Corporation (Author: <NAME>)
# Apache 2.0
import glob
import logging
import zipfile
from collections import defaultdict
from concurrent.futures.thread import ThreadPoolExecutor
from pathlib import Path
from typing import Dict, Optional, ... |
python/kwiver/vital/util/VitalPIL.py | mwoehlke-kitware/kwiver | 176 | 70383 | """
ckwg +31
Copyright 2017 by Kitware, Inc.
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 code must retain the above copyright notice,
this list of conditions and the ... |
pydis_site/apps/api/viewsets/bot/offensive_message.py | Transfusion/site | 700 | 70450 | from rest_framework.mixins import (
CreateModelMixin,
DestroyModelMixin,
ListModelMixin
)
from rest_framework.viewsets import GenericViewSet
from pydis_site.apps.api.models.bot.offensive_message import OffensiveMessage
from pydis_site.apps.api.serializers import OffensiveMessageSerializer
class Offensive... |
impala/_thrift_gen/Metrics/ttypes.py | wzhou-code/impyla | 661 | 70461 | #
# Autogenerated by Thrift Compiler (0.11.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:new_style,no_utf8strings
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
fr... |
modules/api/functional_test/live_tests/batch/approve_batch_change_test.py | slandry90/vinyldns | 333 | 70462 | from hamcrest import *
from utils import *
@pytest.mark.serial
@pytest.mark.manual_batch_review
def test_approve_pending_batch_change_success(shared_zone_test_context):
"""
Test approving a batch change succeeds for a support user
"""
client = shared_zone_test_context.ok_vinyldns_client
approver =... |
pygaggle/qa/span_selection.py | Elfsong/pygaggle | 166 | 70473 | <gh_stars>100-1000
import numpy as np
from collections import defaultdict
from .base import Answer
from .utils import normalize_answer
class SpanSelection:
def reset(self):
pass
def score(self, span, text):
pass
def add_answers(self, spans_by_text, texts):
pass
def top_answ... |
environments/mujoco/rand_param_envs/mujoco_py/__init__.py | lfeng1999/varibad | 119 | 70492 | <reponame>lfeng1999/varibad<filename>environments/mujoco/rand_param_envs/mujoco_py/__init__.py
from .config import init_config, get_key_path
init_config()
from .mjviewer import MjViewer
from .mjcore import MjModel
from .mjcore import register_license
from .mjconstants import *
from .platname_targdir import targdir
r... |
share/tools/ubi_reader/ubifs/defines.py | zengzhen1994k/leonsioy | 143 | 70508 | <reponame>zengzhen1994k/leonsioy<filename>share/tools/ubi_reader/ubifs/defines.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################
# Adapted in part from linux-source-3.2/fs/ubi/ubi-media.h
# for use in Python.
# Oct. 2013 by <NAME>
#
# Original copyright notic... |
scripts/03-predict.py | LaudateCorpus1/salgan | 243 | 70522 | <reponame>LaudateCorpus1/salgan
import os
import numpy as np
from tqdm import tqdm
import cv2
import glob
from utils import *
from constants import *
from models.model_bce import ModelBCE
def test(path_to_images, path_output_maps, model_to_test=None):
list_img_files = [k.split('/')[-1].split('.')[0] for k in glob... |
dbaas/workflow/steps/util/database_upgrade_patch.py | amintasvrp/database-as-a-service | 303 | 70523 | <reponame>amintasvrp/database-as-a-service<gh_stars>100-1000
# -*- coding: utf-8 -*-
from workflow.steps.util.base import BaseInstanceStep
import os
import logging
LOG = logging.getLogger(__name__)
class CantUpgradePatch(Exception):
pass
class DatabaseUpgradePatchStep(BaseInstanceStep):
def __init__(self, ... |
recipes/Python/498110_Memoize_decorator_O1_lengthlimited_LRU_cache/recipe-498110.py | tdiprima/code | 2,023 | 70528 | import cPickle
__all__ = ['memoize']
# This would usually be defined elsewhere
class decoratorargs(object):
def __new__(typ, *attr_args, **attr_kwargs):
def decorator(orig_func):
self = object.__new__(typ)
self.__init__(orig_func, *attr_args, **attr_kwargs)
return self
return decorator
class memoi... |
Examples/Legacy/Ising1d/ising1d.py | gpescia/MyNetKet | 352 | 70539 | # Copyright 2020 The Netket Authors. - All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
tcp_exploit.py | sandlib/pythonpentest | 174 | 70559 | #!/us/bin/env python
'''
Author: <NAME>
Date: May 2015
Name: tcp_exploit.py
Purpose: An sample exploit for testing TCP services
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... |
socfaker/__init__.py | priamai/soc-faker | 122 | 70560 | <reponame>priamai/soc-faker<gh_stars>100-1000
from .socfaker import SocFaker
|
scripts/execute_notebook.py | kyteinsky/OmniNet | 525 | 70572 | <reponame>kyteinsky/OmniNet
#!/usr/bin/env python
import glob
import os
if __name__ == '__main__':
print('Searching for notebooks in the notebooks directory')
# maybe executing like execute_notebook.py
notebook_dir = '../notebooks'
result_dir = '../results'
if not os.path.exists(notebook_dir):
... |
code/vectormomentum/Code/Python/Libraries/__init__.py | ninamiolane/quicksilver | 126 | 70582 | <reponame>ninamiolane/quicksilver
#from CAvmHGMCommon import *
#from CAvmCommon import *
|
supervised/utils/learning_curves.py | stjordanis/mljar-supervised | 1,882 | 70583 | import os
import logging
import numpy as np
import pandas as pd
logger = logging.getLogger(__name__)
from supervised.utils.config import LOG_LEVEL
from supervised.utils.common import learner_name_to_fold_repeat
from supervised.utils.metric import Metric
logger.setLevel(LOG_LEVEL)
import matplotlib.pyplot as plt
impo... |
lib/rucio/daemons/reaper/dark_reaper.py | jamesp-epcc/rucio | 187 | 70607 | # -*- coding: utf-8 -*-
# Copyright 2016-2021 CERN
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
web/index/migrations/0003_auto_20200407_1756.py | laozhudetui/LSpider | 311 | 70615 | <reponame>laozhudetui/LSpider<gh_stars>100-1000
# Generated by Django 3.0.1 on 2020-04-07 09:56
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('index', '0002_scantask_last_scan_time'),
]
ope... |
backend/post/cache.py | restato/bunnybook | 131 | 70622 | import datetime as dt
import json
from typing import List, Optional
from uuid import UUID
from fastapi.encoders import jsonable_encoder
from injector import singleton, inject
from common.cache import fail_silently, hash_cache_key
from common.injection import Cache
from database.utils import map_to
from post.models im... |
Ch3/mnist.py | jason-168/MLCode | 146 | 70639 |
# Code from Chapter 3 of Machine Learning: An Algorithmic Perspective (2nd Edition)
# by <NAME> (http://stephenmonika.net)
# You are free to use, change, or redistribute the code in any way you wish for
# non-commercial purposes, but please maintain the name of the original author.
# This code comes with no warranty ... |
graph_explorer/test/test_structured_metrics.py | farheenkaifee/dashboard_3 | 284 | 70648 | <reponame>farheenkaifee/dashboard_3
from graph_explorer import structured_metrics
def test_load():
s_metrics = structured_metrics.StructuredMetrics()
errors = s_metrics.load_plugins()
assert len(errors) == 0
|
mols2grid/molgrid.py | cbouy/mol2grid | 105 | 70662 | from typing import Type
import warnings
from base64 import b64encode
from html import escape
import json
import pandas as pd
import numpy as np
from rdkit import Chem
from rdkit.Chem import Draw
from .utils import (env,
requires,
tooltip_formatter,
mol_to_reco... |
tests/nnapi/specs/V1_2/select_v1_2.mod.py | periannath/ONE | 255 | 70675 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... |
filerelay.py | mountainstorm/MobileDevice | 136 | 70677 | #!/usr/bin/python
# coding: utf-8
# Copyright (c) 2013 Mountainstorm
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... |
src/whoosh/query/positional.py | matchup-ir/whooshy | 270 | 70689 | <reponame>matchup-ir/whooshy
# Copyright 2007 <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 notice,
# this li... |
alipay/aop/api/domain/AlipayBusinessOrderScenicTrafficSyncModel.py | antopen/alipay-sdk-python-all | 213 | 70690 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ScenicTrafficUserInfo import ScenicTrafficUserInfo
from alipay.aop.api.domain.ScenicExtInfo import ScenicExtInfo
from alipay.aop.api.domain.ScenicTrafficTicketInfo import ScenicTraf... |
RecoEgamma/EgammaPhotonProducers/python/allConversions_cfi.py | ckamtsikis/cmssw | 852 | 70708 | <reponame>ckamtsikis/cmssw<filename>RecoEgamma/EgammaPhotonProducers/python/allConversions_cfi.py
import FWCore.ParameterSet.Config as cms
allConversions = cms.EDProducer('ConversionProducer',
AlgorithmName = cms.string('mixed'),
#src = cms.VInputTag(cms.InputTag("generalTracks")),
src = cms.InputTag("gsfG... |
scripts/perf/model_size.py | cclauss/archai | 344 | 70711 | <filename>scripts/perf/model_size.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from archai.nas.model_desc import ModelDesc
from archai.common.common import common_init
from archai.nas.model import Model
from archai.algos.petridish.petridish_model_desc_builder import PetridishModelB... |
tests/compiler/test_source_map.py | upgradvisor/vyper | 1,471 | 70713 | <filename>tests/compiler/test_source_map.py
from vyper.compiler import compile_code
from vyper.compiler.output import _compress_source_map
from vyper.compiler.utils import expand_source_map
TEST_CODE = """
@internal
def _baz(a: int128) -> int128:
b: int128 = a
for i in range(2, 5):
b *= i
if b... |
python/fate_flow/tests/grpc/server.py | hubert-he/FATE | 3,787 | 70736 | #
# Copyright 2019 The FATE 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.