max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/test_check_errors.py | GrayedFox/pytest-check | 180 | 3323385 | def test_setup_failure(testdir):
testdir.makepyfile(
"""
import pytest
import pytest_check as check
@pytest.fixture()
def a_fixture():
check.equal(1, 2)
def test_1(a_fixture):
pass
"""
)
result = testdir.runpytest()
result... | 0 | 0 | 0 | 0 | 0 | 0 |
qiskit/transpiler/synthesis/aqc/approximate.py | Roshan-Thomas/qiskit-terra | 1,599 | 3323403 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 6 | 9 | 0 | 1 | 16 | 0 |
geocoder/mapzen_reverse.py | termim/geocoder | 1,506 | 3323425 | <reponame>termim/geocoder
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
import logging
from geocoder.mapzen import MapzenResult, MapzenQuery
from geocoder.location import Location
class MapzenReverseResult(MapzenResult):
@property
def ok(self):
return bool(self.address)
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/sync_drive.py | nicx/icloud-drive-docker | 196 | 3323450 | <gh_stars>100-1000
__author__ = "<NAME> (<EMAIL>)"
import os
import re
import time
from pathlib import Path
from shutil import copyfileobj, rmtree
from pyicloud import exceptions
from src import config_parser
def wanted_file(filters, file_path, verbose=False):
if not file_path:
return False
if not f... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/Train_TIN_VCOCO.py | enlighten0707/Transferable-Interactiveness-Network | 227 | 3323468 | # --------------------------------------------------------
# Tensorflow TIN
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import _init_pa... | 0 | 1 | 0 | 0 | 1 | 0 |
Python3/767.py | rakhi2001/ecom7 | 854 | 3323517 | <filename>Python3/767.py
__________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def reorganizeString(self, S: str) -> str:
tmp = []
for c, x in sorted((S.count(x), x) for x in set(S)):
if c > (len(S)+1)/2... | 0 | 0 | 0 | 0 | 0 | 0 |
gis4wrf/core/constants.py | XavierCLL/gis4wrf | 111 | 3323550 | <filename>gis4wrf/core/constants.py
# GIS4WRF (https://doi.org/10.5281/zenodo.1288569)
# Copyright (c) 2018 <NAME> and <NAME>. Licensed under MIT.
WRF_EARTH_RADIUS = 6370000
WRF_PROJ4_SPHERE = '+a={radius} +b={radius}'.format(radius=WRF_EARTH_RADIUS)
'''
v1:
Initial version
v2:
Add stand_lon to Lambert projections.
... | 0 | 0 | 0 | 0 | 0 | 0 |
fixtures/python_output/post_basic_auth_url_encoded_data.py | martinsirbe/curlconverter | 4,955 | 3323572 | <reponame>martinsirbe/curlconverter<gh_stars>1000+
import requests
data = {
'grant_type': 'client_credentials'
}
response = requests.post('http://localhost/api/oauth/token/', data=data, auth=('foo', 'bar'))
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/pxScene2d/external/libnode-v0.12.7/tools/closure_linter/closure_linter/javascriptlintrules.py | madanagopaltcomcast/pxCore | 2,494 | 3323667 | <filename>examples/pxScene2d/external/libnode-v0.12.7/tools/closure_linter/closure_linter/javascriptlintrules.py
#!/usr/bin/env python
#
# Copyright 2008 The Closure Linter Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | 0 | 0 | 0 | 0 | 0 | 0 |
app/analyzers/indicators/rsi.py | williamliee/crptobotwill | 1,857 | 3323684 | <reponame>williamliee/crptobotwill<gh_stars>1000+
""" RSI Indicator
"""
import math
import pandas
from talib import abstract
from analyzers.utils import IndicatorUtils
class RSI(IndicatorUtils):
def analyze(self, historical_data, period_count=14,
signal=['rsi'], hot_thresh=None, cold_thresh=Non... | 0 | 0 | 0 | 0 | 0 | 0 |
build/scripts/overnight/python/host.py | brezillon/opensplice | 133 | 3323691 | <reponame>brezillon/opensplice
import json
import os
import subprocess
import platform
"""
Class holding details of the host on which the example is running
"""
class host(object):
def __init__(self):
"""
Get the name of the host - not always set the same when
running overnight
... | 0 | 0 | 0 | 0 | 0 | 0 |
python/django/python-guestbook/src/message/migrations/0001_initial.py | davidponder/cloud-code-samples | 319 | 3323701 | <reponame>davidponder/cloud-code-samples
# Generated by Django 2.2 on 2019-06-03 22:50
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Message',
fields=[
... | 0 | 0 | 0 | 0 | 0 | 0 |
selenium/pyvirtualdisplay-download-without-headless/example-chrome.py | whitmans-max/python-examples | 140 | 3323706 | <filename>selenium/pyvirtualdisplay-download-without-headless/example-chrome.py
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
from pyvirtualdisplay import Display
start_time = time.time()
print('[INFO] start', time.time() - start_time)
display = Display(visible=0, s... | 0 | 0 | 0 | 0 | 0 | 0 |
reversing/rsz/emulation-dumper.py | amir-120/RE2-Mod-Framework | 170 | 3323708 | from __future__ import annotations
from ctypes import addressof
import os
import fire
import pefile
import sys
import numpy as np
import pickle
import json
from unicorn import *
from unicorn.x86_const import *
from capstone import *
from capstone.x86_const import *
BASE = 0x140000000
EMU_START = 0x1461743F0
EMU_END ... | 2 | 9 | 0 | 0 | 11 | 0 |
HTMLEscapeNumbersFuzzing.py | marcostolosa/Bypassing-Web-Application-Firewalls | 257 | 3323729 | # Created an ascii file filled with all combinations of HTML escape characters
# Based on the theory that some browsers parse wierd HTML escape combinations in unexpected ways
# which may allow for web application firewall (WAF) bypass
import argparse
parser = argparse.ArgumentParser(description='Created an ascii... | 0 | 0 | 0 | 0 | 0 | 0 |
compiler_opt/rl/policy_saver.py | Colibrow/ml-compiler-opt | 130 | 3323731 | <gh_stars>100-1000
# coding=utf-8
# Copyright 2020 Google 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 applic... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/vsphere/common/sample_cli.py | VictorGardi/vsphere-automation-sdk-python | 589 | 3323735 | """
* *******************************************************
* Copyright (c) VMware, Inc. 2016. All Rights Reserved.
* SPDX-License-Identifier: MIT
* *******************************************************
*
* DISCLAIMER. THIS PROGRAM IS PROVIDED TO YOU "AS IS" WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, WHETHER O... | 0 | 1 | 0 | 0 | 1 | 0 |
fluids/optional/spa.py | celikten/fluids | 218 | 3323771 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""
irradiance.py from pvlib
========================
Stripped down, vendorized version from:
https://github.com/pvlib/pvlib-python/
Calculate the solar position using the NREL SPA algorithm either using
numpy arrays or compiling the code to machine language w... | 3 | 49 | 0 | 0 | 52 | 0 |
kAFL-Fuzzer/fuzzer/node.py | SafeBreach-Labs/hAFL2 | 102 | 3323791 | <reponame>SafeBreach-Labs/hAFL2<gh_stars>100-1000
# Copyright 2017-2019 <NAME>, <NAME>, <NAME>
# Copyright 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Fuzz inputs are managed as nodes in a queue. Any persistent metadata is stored here as node attributes.
"""
import lz4.frame
import ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/flava/train.py | facebookresearch/multimodal | 128 | 3323842 | # Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from callbacks.multimodal_eval import MultimodalEvalCallback
from data import ImageDataModule, MLMDataModule, M... | 0 | 0 | 1 | 0 | 1 | 0 |
pyctuator/environment/scrubber.py | TheCodingLand/pyctuator | 118 | 3323861 | <filename>pyctuator/environment/scrubber.py
import re
from typing import Any, Dict
_keys_to_scrub = re.compile("^(.*[^A-Za-z])?key([^A-Za-z].*)?$|.*secret.*|.*password.*|.*token.*", re.IGNORECASE)
_url_keys_to_scrub = re.compile(".*url.*", re.IGNORECASE)
def scrub_secrets(mapping: Dict) -> Dict:
"""Scrubs secret... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/issues/issue560.py | tgolsson/appJar | 666 | 3323863 | import sys
sys.path.append("../../")
from appJar import gui
def test(): print("test")
with gui() as app:
app.label('hello world')
app.addToolbar(['help', 'save', 'open'], test, True)
app.button('PRESS', test, icon='help')
| 0 | 0 | 0 | 0 | 0 | 0 |
zget/get.py | nils-werner/gynt | 527 | 3323869 | #!/usr/bin/env python
from __future__ import annotations
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import sys
import time
import socket
import six.moves.urllib as urllib
import hashlib
import logging
from zeroconf import ServiceBrowser, Zeroconf
from . import u... | 4 | 0 | 3 | 0 | 7 | 0 |
sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2019_04_01/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 3323899 | <gh_stars>1000+
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
whitewater/view/util/__init__.py | awthomp/Persimmon | 206 | 3323921 | <filename>whitewater/view/util/__init__.py
from .types import Type, BlockType, AbstractWidget
from .connection import Connection
from .filedialog import FileDialog
from .notification import Notification
from .play_button import PlayButton
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/sharepoint/files/get_file_properties.py | theodoriss/Office365-REST-Python-Client | 544 | 3323930 | import json
from office365.sharepoint.client_context import ClientContext
from tests import test_team_site_url, test_client_credentials
ctx = ClientContext(test_team_site_url).with_credentials(test_client_credentials)
file_url = '/sites/team/Shared Documents/big_buck_bunny.mp4'
file = ctx.web.get_file_by_server_relat... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractEndOnline.py | fake-name/ReadableWebProxy | 193 | 3323949 | <gh_stars>100-1000
def extractEndOnline(item):
"""
"""
title = item['title']
for tag in item['tags']:
if 'volume' in tag.lower():
title = tag + ' ' + title
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(title)
if not (chp or vol) or 'published' in item['title'].lower():
return None
tagmap ... | 0 | 0 | 0 | 0 | 0 | 0 |
openmmtools/data/cb7-viologen/molecules/create-viologen.py | sroet/openmmtools | 135 | 3323990 | <gh_stars>100-1000
"""
Create mol2 file for substituted viologen.
"""
from openeye.oechem import *
from openeye.oeomega import *
from openeye.oequacpac import *
smiles = "OC(=O)CCCCC[n+](cc1)ccc1-c2cc[n+](cc2)CCCCCC(=O)O" # substituted viologen
output_filename = 'viologen.tripos.mol2'
def assign_am1bcc_charges(mol... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_Test.py | vishwanath1306/mltrace | 328 | 3324059 | import unittest
from mltrace import Test, Component, set_db_uri
class TestTest(unittest.TestCase):
def setUp(self):
set_db_uri("test")
def testRunsAllTestFunc(self) -> None:
class DummyTest(Test):
def __init__(self):
super().__init__("Dummy")
def testC... | 7 | 4 | 0 | 0 | 11 | 0 |
L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py | ckamtsikis/cmssw | 852 | 3324068 | <reponame>ckamtsikis/cmssw<filename>L1TriggerConfig/L1TConfigProducers/python/L1TCaloParamsOnline_cfi.py
import FWCore.ParameterSet.Config as cms
#from L1Trigger.L1TCalorimeter.caloStage2Params_2016_v3_3_HI_cfi import *
from CondCore.CondDB.CondDB_cfi import CondDB
CondDB.connect = cms.string('oracle://cms_orcon_prod... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_datasets/test_grow_scale_img_dataset.py | plutoyuxie/mmgeneration | 718 | 3324113 | import os.path as osp
import pytest
from mmgen.datasets import GrowScaleImgDataset
class TestGrowScaleImgDataset:
@classmethod
def setup_class(cls):
cls.imgs_root = osp.join(osp.dirname(__file__), '..', 'data/image')
cls.imgs_roots = {
'4': cls.imgs_root,
'8': osp.jo... | 0 | 0 | 0 | 0 | 0 | 0 |
tree_queries/models.py | Lord-Elrond/django-tree-queries | 127 | 3324115 | <gh_stars>100-1000
from __future__ import unicode_literals
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext_lazy as _
from .fields import TreeNodeForeignKey
from .query import TreeQuerySet
class TreeNode(models.Model):
parent = TreeNode... | 0 | 0 | 0 | 0 | 0 | 0 |
test/integration/test_default_permissions.py | rhpvorderman/galaxy | 1,085 | 3324118 | from galaxy_test.base.populators import (
DatasetPopulator
)
from galaxy_test.driver import integration_util
class DefaultPermissionsIntegrationTestCase(integration_util.IntegrationTestCase):
expected_access_status_code: int = 200
def setUp(self):
super().setUp()
self.dataset_populator = ... | 0 | 0 | 5 | 0 | 5 | 0 |
modules/providers/aws.py | m4rvxpn/overlord | 509 | 3324140 | <reponame>m4rvxpn/overlord
class main():
#Redirector
def redirector(c):
if c["redirector_id"] == "localhost" and c["type"]== "dns":
output = f"""
module "redirector_{c["id"]}" {{
source = "../../redbaron/modules/{c["provider"]}/{c["type"]}-local-rdir"
redirect_to = ["localhost"]
i... | 0 | 0 | 0 | 0 | 0 | 0 |
distrib/kotlin_kernel/env_names.py | strangepleasures/kotlin-jupyter | 512 | 3324179 | <reponame>strangepleasures/kotlin-jupyter<filename>distrib/kotlin_kernel/env_names.py<gh_stars>100-1000
# standard JVM options environment variable
JAVA_OPTS = "JAVA_OPTS"
# specific JVM options environment variable
KERNEL_JAVA_OPTS = "KOTLIN_JUPYTER_JAVA_OPTS"
# additional JVM options to add to either JAVA_OPTS or K... | 0 | 0 | 0 | 0 | 0 | 0 |
net/resnet.py | bupticybee/icyChessZero | 272 | 3324203 | from __future__ import annotations
import tensorflow as tf
import numpy as np
from matplotlib import pyplot as plt
import random
import time
import scipy
import pandas as pd
import tflearn
import copy
import os
import sys
currentpath = os.path.dirname(os.path.realpath(__file__))
project_basedir = os.path.join(currentp... | 14 | 9 | 0 | 0 | 23 | 0 |
moto/elasticbeanstalk/exceptions.py | symroe/moto | 5,460 | 3324220 | from moto.core.exceptions import RESTError
class InvalidParameterValueError(RESTError):
def __init__(self, message):
super().__init__("InvalidParameterValue", message)
class ResourceNotFoundException(RESTError):
def __init__(self, message):
super().__init__("ResourceNotFoundException", messa... | 0 | 0 | 0 | 0 | 0 | 0 |
app/lib/models/sessions.py | didi9575/crackerjack | 237 | 3324236 | from app import db
import datetime
class SessionModel(db.Model):
__tablename__: str = 'sessions'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, default=0, index=True, nullable=True)
name = db.Column(db.String, default='', index=True, nullable=True)
description = db.Co... | 0 | 0 | 2 | 0 | 2 | 0 |
docs/scripts/update_state_diagram.py | nicolasiltis/prefect | 8,633 | 3324239 | <reponame>nicolasiltis/prefect
"""
Updates `.vuepress/public/state_inheritance_diagram.svg` after a state hierarchy change.
"""
import os
import graphviz
from prefect.engine.state import State
graph = graphviz.Digraph(format="svg")
state_nodes = set()
def create_node(state):
if state not in state_nodes:
... | 0 | 0 | 0 | 0 | 0 | 0 |
guidance_plugin_validator/src/guidance_plugin_validator/main.py | usdot-fhwa-stol/carma-platform | 112 | 3324255 | <reponame>usdot-fhwa-stol/carma-platform
#!/usr/bin/env python
"""
* Copyright (C) 2021 LEIDOS.
*
* 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/LICE... | 0 | 0 | 0 | 0 | 0 | 0 |
cup/util/misc.py | 0xflotus/CUP | 900 | 3324296 | <reponame>0xflotus/CUP
#!/usr/bin/env python
# -*- coding: utf-8 -*
# Copyright: [CUP] - See LICENSE for details.
# Authors: <NAME> (@mythmgn),
"""
misc classes for internal use
"""
import os
import sys
class CAck(object):
"""
ack class
"""
def __init__(self, binit=False):
self._rev = binit
... | 0 | 0 | 0 | 0 | 0 | 0 |
swifter/base.py | vishthemenon/swifter | 2,001 | 3324322 | from __future__ import annotations
import sys
import logging
from os import devnull
from math import ceil
from psutil import cpu_count, virtual_memory
from contextlib import contextmanager, redirect_stderr, redirect_stdout
ERRORS_TO_HANDLE = [AttributeError, ValueError, TypeError, KeyError]
try:
from numba.core.er... | 4 | 2 | 0 | 1 | 7 | 0 |
blaze/binding/python/pyblaze/qed.py | Ru-Xiang/x-deeplearning | 4,071 | 3324361 | <gh_stars>1000+
# coding: utf-8
from __future__ import absolute_import
import ctypes
from .base import LIB, check_call, c_str
def sparse2qed_fp32(path, meta, output_file, thread_num):
""" convert sparse raw param -> fp32 qed bin
"""
check_call(LIB.Blaze_QuickEmbeddingBuildFp32(c_str(path),
... | 0 | 0 | 0 | 0 | 0 | 0 |
imagetagger/imagetagger/images/migrations/0016_settag_test.py | jbargu/imagetagger | 212 | 3324373 | <gh_stars>100-1000
# Generated by Django 2.0.7 on 2018-07-10 22:30
from django.db import migrations
def set_test_tag(apps, schema_editor):
SetTag = apps.get_model('images', 'SetTag')
db_alias = schema_editor.connection.alias
if SetTag.objects.using(db_alias).filter(name='test').exists():
test_t... | 0 | 0 | 0 | 0 | 0 | 0 |
app/grandchallenge/core/templatetags/meta_attr.py | njmhendrix/grand-challenge.org | 101 | 3324383 | from django import template
register = template.Library()
@register.filter
def meta_attr(obj, key) -> object:
"""Returns an attribute of an objects _meta class"""
return getattr(obj._meta, key, "")
| 0 | 1 | 0 | 0 | 1 | 0 |
utils/depth_io.py | yihui-he2020/epipolar-transformers | 360 | 3324445 | <gh_stars>100-1000
import numpy as np
import cv2, re
""" Load depth
"""
def load_depth_from_tiff(tiff_file_path, div_factor=1000.0):
depth = cv2.imread(tiff_file_path, cv2.IMREAD_ANYDEPTH).astype(np.float32)
return depth / div_factor
def load_depth_from_png(png_file_path, div_factor=1000.0):
depth = cv2... | 0 | 0 | 0 | 0 | 0 | 0 |
tool_collections/galaxy_sequence_utils/tabular_to_fastq/tabular_to_fastq.py | ic4f/tools-iuc | 142 | 3324446 | <reponame>ic4f/tools-iuc
# <NAME>
from __future__ import print_function
import sys
def main():
input_filename = sys.argv[1]
output_filename = sys.argv[2]
identifier_col = int(sys.argv[3]) - 1
sequence_col = int(sys.argv[4]) - 1
quality_col = int(sys.argv[5]) - 1
max_col = max(identifier_col,... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/report/ReportGenerator.py | MrT3acher/Android-Malware-Sandbox | 218 | 3324447 | <filename>lib/report/ReportGenerator.py
from lib.model.Analysis import Analysis
import base64
import jinja2
import os
dirname = os.path.realpath(os.path.dirname(os.path.realpath(__file__))+'/../../')
class ReportGenerator:
@staticmethod
def b64encode(text):
return base64.b64encode(text).decode('utf... | 0 | 0 | 0 | 0 | 0 | 0 |
inselect/gui/recent_documents.py | NaturalHistoryMuseum/inselect | 128 | 3324451 | from pathlib import Path
from PyQt5.QtCore import QSettings
from inselect.lib.utils import debug_print
class RecentDocuments(object):
KEY: str = 'recent_documents'
MAX_RECENT_DOCS: int = 5
def read_paths(self) -> object:
"""Returns a list of up to MAX_RECENT_DOCS Paths. The most recently
... | 0 | 2 | 2 | 0 | 4 | 0 |
serverless/pytorch/facebookresearch/detectron2/retinanet/nuclio/main.py | gitibharatibiswal/cvat-adas-team | 4,197 | 3324470 | <reponame>gitibharatibiswal/cvat-adas-team
import json
import base64
import io
from PIL import Image
import torch
from detectron2.model_zoo import get_config
from detectron2.data.detection_utils import convert_PIL_to_numpy
from detectron2.engine.defaults import DefaultPredictor
from detectron2.data.datasets.builtin_me... | 0 | 0 | 0 | 0 | 0 | 0 |
unicorn/tests/regress/mips_syscall_pc.py | clayne/unicorn_pe | 491 | 3324499 | <reponame>clayne/unicorn_pe
#!/usr/bin/python
from unicorn import *
from unicorn.mips_const import *
import regress
def intr_hook(uc, intno, data):
print 'interrupt=%d, v0=%d, pc=0x%08x' % (intno, uc.reg_read(UC_MIPS_REG_V0), uc.reg_read(UC_MIPS_REG_PC))
class MipsSyscall(regress.RegressTest):
def test(self... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/structures/test_comparisons.py | akubera/batavia | 1,256 | 3324501 | from ..utils import TranspileTestCase
class ComparisonTests(TranspileTestCase):
def test_is(self):
self.assertCodeExecution("""
x = 1
if x is 1:
print('Correct')
else:
print('Incorrect')
print('Done.')
""")
... | 0 | 0 | 0 | 0 | 0 | 0 |
tick/prox/prox_l1w.py | sumau/tick | 411 | 3324504 | <gh_stars>100-1000
# License: BSD 3 clause
# -*- coding: utf8 -*-
import numpy as np
from .base import Prox
from .build.prox import ProxL1wDouble as _ProxL1wDouble
from .build.prox import ProxL1wFloat as _ProxL1wFloat
__author__ = '<NAME>'
dtype_map = {
np.dtype("float64"): _ProxL1wDouble,
np.dtype("float32... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_scenic.py | BehaviorPredictionTestingPlatform/VerifAI | 109 | 3324527 |
import pytest
from dotmap import DotMap
from verifai.samplers.scenic_sampler import ScenicSampler
from verifai.scenic_server import ScenicServer
from verifai.falsifier import generic_falsifier
from tests.utils import sampleWithFeedback, checkSaveRestore
## Basic
def test_objects():
sampler = ScenicSampler.fromS... | 0 | 2 | 0 | 0 | 2 | 0 |
examples/hangman/HangMan.py | takipsizad/pyjs | 739 | 3324537 | <filename>examples/hangman/HangMan.py<gh_stars>100-1000
import pyjd # dummy in pyjs
from HangManWidget import HangManWidget
from pyjamas.ui.RootPanel import RootPanel
class HangMan:
def onModuleLoad(self):
self.webspace=HangManWidget()
RootPanel().add(self.webspace)
if __name__ == '__main__':
... | 0 | 0 | 0 | 0 | 0 | 0 |
alerta/version.py | nilver/alerta | 1,233 | 3324563 | __version__ = '8.7.0'
| 0 | 0 | 0 | 0 | 0 | 0 |
util.py | duduainankai/pencil-python | 127 | 3324575 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
import numpy as np
def im2double(I):
Min = I.min()
Max = I.max()
dis = float(Max - Min)
m, n = I.shape
J = np.zeros((m, n), dtype="float")
for x in range(m):
for y in range(n):
a = I[x, y]
if a != 255 a... | 0 | 0 | 0 | 0 | 0 | 0 |
cfgov/data_research/management/commands/conference_notify.py | cfpb/cfgov-refresh | 156 | 3324592 | <reponame>cfpb/cfgov-refresh
from django.core.management.base import BaseCommand
from data_research.research_conference import (
ConferenceNotifier,
get_conference_details_from_page,
)
class Command(BaseCommand):
help = "Exports conference registration attendees via email"
def add_arguments(self, pa... | 0 | 0 | 0 | 0 | 0 | 0 |
akshare/reits/__init__.py | lisong996/akshare | 4,202 | 3324594 | # -*- coding:utf-8 -*-
#!/usr/bin/env python
"""
Date: 2021/8/27 15:49
Desc:
"""
| 0 | 0 | 0 | 0 | 0 | 0 |
common/__init__.py | miaopei/deep_landmark | 327 | 3324631 | # coding: utf-8
from .cnns import getCNNs
from .level import level1, level2, level3
from .utils import getPatch, getDataFromTxt
from .utils import logger, createDir, shuffle_in_unison_scary
from .utils import drawLandmark, processImage, dataArgument
| 0 | 0 | 0 | 0 | 0 | 0 |
openbook_common/responses.py | TamaraAbells/okuna-api | 164 | 3324638 | <reponame>TamaraAbells/okuna-api
from rest_framework.response import Response
from rest_framework import status
class ApiMessageResponse(Response):
"""
A generic API Response
"""
def __init__(self, message, status=status.HTTP_200_OK, template_name=None, headers=None, content_type=None):
super... | 0 | 0 | 0 | 0 | 0 | 0 |
Codeforces/78 Beta Division 1/Problem B/B.py | VastoLorde95/Competitive-Programming | 170 | 3324662 | <reponame>VastoLorde95/Competitive-Programming
from math import *
from fractions import *
p = [1]
for i in xrange(1, 20001):
p.append(p[i-1]*2)
d = [0 for i in xrange(10001)]
def add(x, y, a, b):
num = x*b + y*a
den = y*b
return num, den
def solve():
n = int(raw_input())
t = n
cnt = 0
while t%2 == 0:
t ... | 0 | 0 | 0 | 0 | 0 | 0 |
samples/rainbow/distr_test.py | ChengUVa/ptan | 492 | 3324669 | import numpy as np
from lib import common
import matplotlib as mpl
mpl.use("Agg")
import matplotlib.pyplot as plt
Vmax = 10
Vmin = -10
N_ATOMS = 51
DELTA_Z = (Vmax - Vmin) / (N_ATOMS - 1)
def save_distr(vec, name):
plt.cla()
p = np.arange(Vmin, Vmax+DELTA_Z, DELTA_Z)
plt.bar(p, vec, width=0.5)
plt... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/ex_color_detection_image/ex_color_detection_image_multi.py | KayaDevSolutions/deepgaze | 1,653 | 3324690 | #!/usr/bin/env python
#The MIT License (MIT)
#Copyright (c) 2016 <NAME>
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIG... | 0 | 0 | 0 | 0 | 0 | 0 |
python/326_Power_of_Three.py | dvlpsh/leetcode-1 | 4,416 | 3324695 | from __future__ import annotations
class Solution(object):
# def isPowerOfThree(self, n):
# """
# :type n: int
# :rtype: bool
# """
# import math
# if n <= 0:
# return False
# # use round to check
# log_res = round(math.log(n, 3), 10)
#... | 0 | 1 | 0 | 0 | 1 | 0 |
test/test_normalization.py | dongsc1994/sql-metadata | 313 | 3324749 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from sql_metadata.parser import Parser
def test_generalization_of_sql():
assert Parser().generalize == ""
assert (
Parser("SELECT /* Test */ foo FROM BAR").without_comments
== "SELECT foo FROM BAR"
)
... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/detect.py | GzuPark/EXTD_Pytorch | 190 | 3324804 | #-*- coding:utf-8 -*-
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import os
import torch
import argparse
import torch.nn as nn
import torch.utils.data as data
import torch.backends.cudnn as cudnn
import torchvision.transforms as transforms
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/api/test_can_predictions.py | phc-health/covid-data-model | 155 | 3324845 | from api.can_api_v2_definition import AggregateRegionSummaryWithTimeseries
from libs import dataset_deployer
def test_remove_root():
value = AggregateRegionSummaryWithTimeseries(__root__=[]).dict()
assert value == {"__root__": []}
result = dataset_deployer.remove_root_wrapper(value)
assert result == ... | 0 | 0 | 0 | 0 | 0 | 0 |
train_segmentation.py | saiabinesh/EdgeNets | 392 | 3324888 | # ============================================
__author__ = "<NAME>"
__license__ = "MIT"
__maintainer__ = "<NAME>"
# ============================================
import argparse
import os
import torch
import torch.nn as nn
import torch.optim as optim
from utilities.utils import save_checkpoint, model_parameters, compu... | 0 | 0 | 0 | 0 | 0 | 0 |
src/test/python/algorithms/datastructures/binarysearchtree/BinarySearchTreeTest.py | pratikadarsh/Algorithms | 558 | 3324907 | '''
* @file BinarySearchTreeTest.py
* @author (original JAVA) <NAME>, <EMAIL>
* (conversion to Python) <NAME>, <EMAIL>
* @date 27 Jun 2020
* @version 0.1
* @brief A BinarySearchTree unit test.
'''
import unittest
from collections import deque
import array as arr
import random
from BinarySearchTree ... | 0 | 7 | 0 | 0 | 7 | 0 |
setup.py | orena1/statannotations | 110 | 3324919 | <filename>setup.py
from distutils.core import setup
from setuptools import find_packages
import re
with open("README.md", "r") as f:
long_description = f.read()
VERSIONFILE = "statannotations/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", verstrli... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/builtins/test_complex.py | akubera/batavia | 1,256 | 3324949 | from .. utils import TranspileTestCase, BuiltinFunctionTestCase
class ComplexTests(TranspileTestCase):
pass
class BuiltinComplexFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
function: str = "complex"
| 0 | 0 | 1 | 0 | 1 | 0 |
deploy-agent/tests/unit/deploy/common/test_config.py | brennentsmith/teletraan | 2,449 | 3324957 | # Copyright 2016 Pinterest, 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 to in... | 0 | 0 | 0 | 0 | 0 | 0 |
neo/test/rawiotest/rawio_compliance.py | Mario-Kart-Felix/python-neo | 199 | 3324991 | """
Here a list for testing neo.rawio API compliance.
This is called automatically by `BaseTestRawIO`
All rules are listed as function so it should be easier to:
* identify the rawio API
* debug
* discuss rules
"""
import time
if not hasattr(time, 'perf_counter'):
time.perf_counter = time.time
import loggi... | 1 | 3 | 0 | 0 | 4 | 0 |
tools/inline-imports.py | vinaykapadia/statblock5e | 319 | 3324996 | <reponame>vinaykapadia/statblock5e<gh_stars>100-1000
#!/usr/bin/env python
import argparse
import os.path as p
import re
from bs4 import BeautifulSoup
DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( __file__ ) )
def getDocument( content ):
return BeautifulSoup( content, 'html5lib', from_encoding = 'utf-8' )
def genera... | 0 | 0 | 0 | 0 | 0 | 0 |
book/smc_samplers/logistic_reg.py | cqlc94/SMC_test | 234 | 3324999 | <filename>book/smc_samplers/logistic_reg.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Numerical experiment of Chapter 17 (SMC samplers).
Compare IBIS and SMC tempering for approximating:
* the normalising constant (marginal likelihood)
* the posterior expectation of the p coefficients
for a logistic regress... | 0 | 0 | 0 | 0 | 0 | 0 |
build-cross.py | guusw/wasm3 | 163 | 3325009 | <reponame>guusw/wasm3<filename>build-cross.py<gh_stars>100-1000
#!/usr/bin/env python3
# Author: <NAME>
import argparse
import subprocess
import multiprocessing
from pathlib import Path
import time
musl_targets = [
{ "name": "linux-x86_64" , "arch": "x86_64-linux-musl" },
{ "name": "linux-i686" ... | 0 | 0 | 0 | 0 | 0 | 0 |
t/undo_eviction_test.py | rohankumardubey/orioledb | 947 | 3325054 | <filename>t/undo_eviction_test.py
#!/usr/bin/env python3
# coding: utf-8
import unittest
import os
from .base_test import BaseTest
class UndoEvictionTest(BaseTest):
def setUp(self):
super().setUp()
node = self.node
node.append_conf('postgresql.conf',
"orioledb.main_buffers = 64MB\n")
node.start()
n... | 0 | 0 | 0 | 0 | 0 | 0 |
deploy/comm/__init__.py | bright60/WeBASE | 462 | 3325063 | #!/usr/bin/env python3
import sys
if sys.version_info.major == 3:
import pymysql
pymysql.install_as_MySQLdb() | 0 | 0 | 0 | 0 | 0 | 0 |
leetcode/algorithms/spiral-matrix/solution.py | palash24/algorithms | 113 | 3325065 | #!/usr/bin/env python
from __future__ import annotations
class Solution(object):
def spiralOrder(self, matrix) -> list[object] | object:
"""
Returns the clockwise spiral order traversal of the matrix starting at
(0, 0). Modifies the matrix to contain all None values.
:type matrix:... | 0 | 1 | 0 | 0 | 1 | 0 |
database_settings_dev.py | plympton/newsdiffs | 317 | 3325075 | location = 'sqlite:///newsdiffs.db'
| 0 | 0 | 0 | 0 | 0 | 0 |
CalibTracker/SiPixelGainCalibration/python/SiPixelCalibDigiProducer_cfi.py | ckamtsikis/cmssw | 852 | 3325092 | <filename>CalibTracker/SiPixelGainCalibration/python/SiPixelCalibDigiProducer_cfi.py
import FWCore.ParameterSet.Config as cms
siPixelCalibDigis = cms.EDProducer("SiPixelCalibDigiProducer",
src = cms.InputTag("siPixelDigis"),
# force the producer to use the event numbers as in the data. If false the producer wi... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_scrambling.py | NVlabs/sionna | 163 | 3325101 | <filename>test/test_scrambling.py
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
try:
import sionna
except ImportError as e:
import sys
sys.path.append("../")
import unittest
import numpy as np
import tensorf... | 0 | 0 | 0 | 0 | 0 | 0 |
features/steps/api_with_persona_steps.py | simpsonw/atmosphere | 197 | 3325132 | import collections
import datetime
import decimal
import json
import time
import unittest
import uuid
from unittest import TestCase
from unittest.util import safe_repr
import dateutil.parser
import django.test
import django.urls
import django.utils.timezone
import mock
import rest_framework.test
# noinspection PyUnres... | 0 | 0 | 0 | 0 | 0 | 0 |
libs/series_utils.py | phc-health/covid-data-model | 155 | 3325138 | from datetime import timedelta
import datetime
import pandas as pd
import numpy as np
def smooth_with_rolling_average(
series: pd.Series,
window: int = 7,
include_trailing_zeros: bool = True,
exclude_negatives: bool = True,
) -> object:
"""Smoothes series with a min period of 1.
Series must h... | 8 | 4 | 0 | 0 | 12 | 0 |
torchtoolbox/tools/mixup.py | deeplearningforfun/torch-tools | 353 | 3325152 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Author : PistonYang(<EMAIL>)
from torch import nn
import numpy as np
import torch
import random
__all__ = ['mixup_data', 'mixup_criterion', 'cutmix_data', 'MixingDataController']
def cut_mix_rand_bbox(size, lam):
H = size[2]
W = size[3]
cut_rat = np.sqrt(1.... | 0 | 0 | 0 | 0 | 0 | 0 |
Tools/usb_serialload.py | wms124/PX4_1.4.1_Back-up | 4,224 | 3325177 | import serial, time
port = serial.Serial('/dev/ttyACM0', baudrate=57600, timeout=2)
data = '01234567890123456789012345678901234567890123456789'
#data = 'hellohello'
outLine = 'echo %s\n' % data
port.write('\n\n\n')
port.write('free\n')
line = port.readline(80)
while line != '':
print(line)
line = port.readl... | 0 | 0 | 0 | 0 | 0 | 0 |
notebook/dir_import_test/dir/main_sys_path_append.py | vhn0912/python-snippets | 174 | 3325188 | import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import mod1
from dir_for_mod import mod2
mod1.func()
mod2.func()
| 0 | 0 | 0 | 0 | 0 | 0 |
libgen/exceptions.py | priccis/libgen.py | 248 | 3325192 | """Exceptions module."""
class NoResults(Exception):
"""Search didn't return any results."""
def __init__(self) -> None:
msg = "Search didn't return any results."
Exception.__init__(self, msg)
class NoAvailableMirror(Exception):
"""No mirrors are available to process request."""
def ... | 1 | 3 | 0 | 0 | 4 | 0 |
securetea/lib/antivirus/__init__.py | neerajv18/SecureTea-Project | 257 | 3325253 | """Summary."""
from . import antivirus_logger
from . import core_engine
from . import secureTeaAntiVirus
from .update import helper
from .update import update_hash
from .update import update_yara
from .tools import file_gather
from .tools import utils
from .scanner import clamav_scanner
from .scanner import hash_scanne... | 0 | 0 | 0 | 0 | 0 | 0 |
e2e-tests/test_group.py | aayaffe/splitwise | 105 | 3325275 | <filename>e2e-tests/test_group.py
import unittest
import os
from splitwise import Splitwise
from splitwise.group import Group
from splitwise.exception import SplitwiseUnauthorizedException
class GroupTestCase(unittest.TestCase):
def setUp(self):
consumer_key = os.environ['CONSUMER_KEY']
consumer_... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_entity_linking.py | willmaclean/MedCAT | 243 | 3325284 | from __future__ import annotations
import unittest
from medcat.cat import CAT
from medcat.config import Config
from medcat.utils.model_creator import create_models
from pathlib import Path
class EntityLinkingTest(unittest.TestCase):
"""Test entity linking after creating MedCAT CDB and Vocab models.
During cl... | 1 | 0 | 0 | 0 | 1 | 0 |
tests/roots/test-ext-autodoc/target/metadata.py | samdoran/sphinx | 4,973 | 3325293 | <reponame>samdoran/sphinx
def foo():
""":meta metadata-only-docstring:"""
| 0 | 0 | 0 | 0 | 0 | 0 |
Pico_RP2040_Motor_Party/code.py | gamblor21/Adafruit_Learning_System_Guides | 665 | 3325314 | # SPDX-FileCopyrightText: 2021 jedgarpark for Adafruit Industries
# SPDX-License-Identifier: MIT
# Pico motor party demo board
# Hardware setup:
# Servo on GP0
# DC motor via L9110 H-bridge driver on GP28, GP27 (they're on different PWM channels)
# Stepper motor via DRV8833 driver breakout on GP21, GP20, GP19, G... | 0 | 0 | 0 | 0 | 0 | 0 |
exercises/de/exc_01_08_02.py | Jette16/spacy-course | 2,085 | 3325319 | import spacy
nlp = spacy.load("de_core_news_sm")
text = "Apple wurde 1976 von <NAME>, <NAME> und <NAME> gegründet."
# Verarbeite den Text
doc = ____
# Iteriere über die vorhergesagten Entitäten
for ent in ____.____:
# Drucke den Text und das Label der Entität
print(ent.____, ____.____)
| 0 | 0 | 0 | 0 | 0 | 0 |
monitor/portal/migrations/0001_initial.py | zbonce/PromAnsible | 210 | 3325393 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-12-01 10:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/torch/nn/parallel/tensor_parallel/_parallel_2d/test_linear_2d.py | lipovsek/oslo | 249 | 3325394 | <filename>tests/torch/nn/parallel/tensor_parallel/_parallel_2d/test_linear_2d.py
import torch
import torch.distributed as dist
from copy import deepcopy
from oslo.torch.distributed import ParallelContext, ParallelMode
from oslo.torch.nn import Linear2D
from _utils import split_2d, split_1d_twice, gather_2d, gather_1d_t... | 0 | 0 | 0 | 0 | 0 | 0 |
sdk/python/tests/compiler/testdata/artifacts_of_ops_with_long_names.py | shrivs3/kfp-tekton | 102 | 3325507 | # Copyright 2021 kubeflow.org.
#
# 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 writing,... | 5 | 3 | 1 | 0 | 9 | 0 |
tests/r/test_va_lung_cancer.py | hajime9652/observations | 199 | 3325538 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.va_lung_cancer import va_lung_cancer
def test_va_lung_cancer():
"""Test module va_lung_cancer.py by downloading
va_lung_ca... | 0 | 0 | 0 | 0 | 0 | 0 |
openrec/tf1/modules/interactions/pointwise_mlp_ce.py | pbaiz/openrec | 399 | 3325549 | <filename>openrec/tf1/modules/interactions/pointwise_mlp_ce.py<gh_stars>100-1000
import tensorflow as tf
from openrec.tf1.modules.extractions import MultiLayerFC
def PointwiseMLPCE(user, item, dims, subgraph, item_bias=None, extra=None,
l2_reg=None, labels=None, dropout=None, train=None, scope=None... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.