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 |
|---|---|---|---|---|
corehq/apps/userreports/urls.py | dimagilg/commcare-hq | 471 | 12634321 | <reponame>dimagilg/commcare-hq
from django.conf.urls import include, url
from corehq.apps.userreports.reports.view import (
DownloadUCRStatusView,
ucr_download_job_poll,
)
from corehq.apps.userreports.views import (
CreateConfigReportView,
CreateDataSourceFromAppView,
CreateDataSourceView,
Data... |
sporco/cupy/pgm/__init__.py | vishalbelsare/sporco | 217 | 12634355 | <reponame>vishalbelsare/sporco
# -*- coding: utf-8 -*-
# Copyright (C) 2018-2020 by <NAME> <<EMAIL>>
# All rights reserved. BSD 3-clause License.
# This file is part of the SPORCO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
"""Construct va... |
tools/please_pex/pex_import_test.py | samwestmoreland/please | 1,992 | 12634379 | # Test for importing certain modules with the new incremental pex
# rules. These have proven tricky, seemingly around requests doing
# "from . import utils" etc (which is perfectly fine, and was working
# previously, this just helps investigate & make sure it's fixed).
import unittest
class PexImportTest(unittest.Te... |
ch18/ch18_part1.py | ericgarza70/machine-learning-book | 655 | 12634414 | # coding: utf-8
import sys
from python_environment_check import check_packages
import networkx as nx
import numpy as np
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
# # Machine Learning with PyTorch ... |
voctocore/lib/errors/configuration_error.py | 0xflotus/voctomix | 521 | 12634422 | <filename>voctocore/lib/errors/configuration_error.py
class ConfigurationError(RuntimeError):
"""Problem in the Configuration"""
|
vumi/transports/tests/test_base.py | seidu626/vumi | 199 | 12634425 | <filename>vumi/transports/tests/test_base.py
from twisted.internet.defer import inlineCallbacks
from vumi.tests.helpers import VumiTestCase
from vumi.transports.base import Transport
from vumi.transports.tests.helpers import TransportHelper
from vumi.tests.utils import LogCatcher
class TestBaseTransport(VumiTestCase... |
suds/reader.py | Ndn1618/interactive-tutorials | 2,750 | 12634462 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... |
tools/nets/mobilenet_test.py | wqdun/MobileNet | 1,698 | 12634473 | # Copyright 2016 The TensorFlow 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 ... |
lib-src/lv2/suil/waflib/extras/proc.py | joshrose/audacity | 7,892 | 12634580 | #! /usr/bin/env python
# per rosengren 2011
from os import environ, path
from waflib import TaskGen, Utils
def options(opt):
grp = opt.add_option_group('Oracle ProC Options')
grp.add_option('--oracle_home', action='store', default=environ.get('PROC_ORACLE'), help='Path to Oracle installation home (has bin/lib)')
g... |
descarteslabs/common/tasks/exporttask.py | carderne/descarteslabs-python | 167 | 12634608 | import time
from descarteslabs.client.exceptions import NotFoundError
from descarteslabs.client.services.storage import Storage
from descarteslabs.common.tasks import FutureTask, TransientResultError, TimeoutError
class ExportTask(FutureTask):
"""
An export task. Accessing any attributes before the task is c... |
spotpy/algorithms/mcmc.py | cheginit/spotpy | 182 | 12634635 | # -*- coding: utf-8 -*-
'''
Copyright (c) 2018 by <NAME>
This file is part of Statistical Parameter Optimization Tool for Python(SPOTPY).
:author: <NAME>
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from . impor... |
saas/aiops/api/aiops-server/common/log_filter.py | iuskye/SREWorks | 407 | 12634651 | <gh_stars>100-1000
#!/usr/bin/env python
# encoding: utf-8
""" """
__author__ = 'sreworks'
import logging
from flask import request
from common import trace_id_generator
class TraceIdFilter(logging.Filter):
def filter(self, record):
try:
trace_id = request.environ.get("HTTP_TRACE_ID", "None")... |
syzygy/scripts/benchmark/chrome_utils.py | nzeh/syzygy | 343 | 12634736 | <reponame>nzeh/syzygy<gh_stars>100-1000
#!python
# Copyright 2011 Google Inc. 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/LICE... |
pyannote/audio/pipeline/speech_turn_clustering.py | avramandrei/pyannote-audio | 1,543 | 12634740 | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2018-2020 CNRS
# 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 limita... |
examples/example_unicode.py | alexbzg/picoweb | 428 | 12634770 | <gh_stars>100-1000
#
# This is a picoweb example showing rendering of template
# with Unicode (UTF-8) characters.
#
import picoweb
app = picoweb.WebApp(__name__)
@app.route("/")
def index(req, resp):
yield from picoweb.start_response(resp)
data = {"chars": "абвгд", "var1": "α", "var2": "β", "var3": "γ"}
... |
pywemo/ouimeaux_device/motion.py | sullivanmj/pywemo | 102 | 12634771 | <reponame>sullivanmj/pywemo<gh_stars>100-1000
"""Representation of a WeMo Motion device."""
from . import Device
class Motion(Device):
"""Representation of a WeMo Motion device."""
|
cort/core/corpora.py | leonardoboliveira/cort | 141 | 12634777 | """ Represent and manipulate text collections as a list of documents."""
from collections import defaultdict
import multiprocessing
from cort.analysis import data_structures
from cort.core import documents
from cort.core import spans
__author__ = 'smartschat'
def from_string(string):
return documents.CoNLLDocu... |
viewflow/parsers/parse_r.py | pietervans/viewflow | 106 | 12634784 | import pathlib
import yaml
import re
from typing import Any, Dict
def parse_r(file: pathlib.Path) -> Dict[str, Any]:
content = file.read_text().split("\n")
l = [i for i, x in enumerate(content) if re.search(r"# ---", x)]
temp = "\n".join(content[l[0] + 1 : l[1]])
yml = re.sub(r"# ", "", temp)
task... |
opta/commands/init_templates/variables/name.py | riddopic/opta | 595 | 12634801 | <reponame>riddopic/opta<gh_stars>100-1000
import os
from opta.commands.init_templates.helpers import dictionary_deep_set
from opta.commands.init_templates.template import TemplateVariable
from opta.layer import Layer
def apply(d: dict, v: str) -> dict:
set_path = dictionary_deep_set(["name"])
set_path(d, v)
... |
tests/test_cases/test_discovery/test_discovery.py | lavanyajagan/cocotb | 350 | 12634807 | <reponame>lavanyajagan/cocotb
# Copyright (c) 2013 Potential Ventures Ltd
# Copyright (c) 2013 SolarFlare Communications 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... |
setup.py | spokestack/spokestack-python | 139 | 12634812 | import os
import subprocess
import sys
from setuptools import Extension, find_packages, setup
from setuptools.command.build_py import build_py
try:
from numpy import get_include
except ImportError:
subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy==1.19.2"])
from numpy import get_incl... |
lightning_transformers/__init__.py | mariomeissner/lightning-transformers | 451 | 12634816 | """Root package info."""
import os
__ROOT_DIR__ = os.path.dirname(os.path.dirname(__file__))
__version__ = "0.1.0"
__author__ = "PyTorchLightning et al."
__author_email__ = "<EMAIL>"
__license__ = "Apache-2.0"
__copyright__ = f"Copyright (c) 2020-2020, {__author__}."
__homepage__ = "https://github.com/PyTorchLightnin... |
alipay/aop/api/domain/AlipayOverseasOpenPreorderCreateModel.py | antopen/alipay-sdk-python-all | 213 | 12634825 | <reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.TuitionISVAgentInfoDTO import TuitionISVAgentInfoDTO
from alipay.aop.api.domain.TuitionISVPayerInfoDTO import TuitionISVPay... |
examples/pxScene2d/external/breakpad-chrome_55/gyp/test/win/gyptest-link-update-manifest.py | madanagopaltcomcast/pxCore | 2,151 | 12634829 | <filename>examples/pxScene2d/external/breakpad-chrome_55/gyp/test/win/gyptest-link-update-manifest.py
#!/usr/bin/env python
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure binary is relinked when ... |
systemdlogger/systemdlogger.py | techjacker/systemdlogger | 102 | 12634835 | #!/usr/bin/env python3
import argparse
from systemdlogger.runner import Runner
def main():
parser = argparse.ArgumentParser(
description=(
'Exports systemd logs to different storage backends'
', eg cloudwatch/elasticsearch.'
)
)
parser.add_argument(
'config'... |
Tests/test_Align_nexus.py | lukasz-kozlowski/biopython | 2,856 | 12634848 | # Copyright 2021 by <NAME>. All rights reserved.
#
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for Bio.Align.nexus module."""
import unittest
from io import StringIO
from Bio.Align.nexu... |
tests/checks/test_blank_row.py | jdaviscooke/goodtables-py | 243 | 12634871 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from goodtables.checks.blank_row import blank_row
import goodtables.cells
# Check
def test_check_blank_row(log):
cells =... |
robogym/robot/factories.py | 0xflotus/robogym | 288 | 12634882 | from typing import Callable, Optional
import numpy as np
from robogym.robot.robot_interface import ControlMode, RobotControlParameters
from robogym.robot.ur16e.mujoco.free_dof_tcp_arm import (
FreeDOFTcpArm,
FreeRollYawTcpArm,
FreeWristTcpArm,
)
from robogym.robot.ur16e.mujoco.simulation.base import ArmSi... |
modelchimp/models/__init__.py | samzer/modelchimp-server | 134 | 12634911 | from modelchimp.models.project import Project
from modelchimp.models.membership import Membership
from modelchimp.models.experiment import Experiment
from modelchimp.models.comment import Comment
from modelchimp.models.profile import Profile
from modelchimp.models.user import User
from modelchimp.models.invitation imp... |
exercises/practice/dot-dsl/dot_dsl_test.py | Stigjb/python | 1,177 | 12634923 | import unittest
from dot_dsl import Graph, Node, Edge, NODE, EDGE, ATTR
class DotDslTest(unittest.TestCase):
def test_empty_graph(self):
g = Graph()
self.assertEqual(g.nodes, [])
self.assertEqual(g.edges, [])
self.assertEqual(g.attrs, {})
def test_graph_with_one_node(self):
... |
config/m600/rotors.py | leozz37/makani | 1,178 | 12634956 | # Copyright 2020 Makani Technologies 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... |
tests/data/expected/parser/openapi/openapi_parser_parse_any/output.py | languitar/datamodel-code-generator | 891 | 12634960 | from __future__ import annotations
from typing import Any, Optional
from pydantic import BaseModel
class Item(BaseModel):
bar: Optional[Any] = None
foo: str
|
nipy/utils/utilities.py | bpinsard/nipy | 236 | 12634962 | <reponame>bpinsard/nipy
""" Collection of utility functions and classes
Some of these come from the matplotlib ``cbook`` module with thanks.
"""
from functools import reduce
from operator import mul
def is_iterable(obj):
""" Return True if `obj` is iterable
"""
try:
iter(obj)
except TypeErro... |
quarkc/test/ffi/expected/py/signatures/generics/pkg/__init__.py | datawire/quark | 112 | 12634971 | <filename>quarkc/test/ffi/expected/py/signatures/generics/pkg/__init__.py
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from builtins import str as unicode
from quark_runtime import *
_lazyImport.plug("generics.pkg")... |
tests/test_core.py | kianmeng/keyring | 834 | 12634975 | <reponame>kianmeng/keyring
import keyring.core
def test_init_recommended(monkeypatch):
"""
Test filtering of backends to recommended ones (#117, #423).
"""
monkeypatch.setattr(keyring.core, 'set_keyring', lambda kr: None)
keyring.core.init_backend(keyring.core.recommended)
|
tests/base/__init__.py | ssato/python-anyconfig | 213 | 12634987 | <reponame>ssato/python-anyconfig
#
# Copyright (C) 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
r"""Common test Utility functions, constants and global variables, etc.
"""
from .constants import TESTS_DIR, RES_DIR, NULL_CNTNR
from .collector import TDataCollector
from .datatypes import TData
from .utils impor... |
azure-devops/azext_devops/devops_sdk/v5_1/graph/models.py | keithlemon/azure-devops-cli-extension | 326 | 12635008 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------------------------------------... |
official/vision/beta/projects/yolo/modeling/heads/yolo_head_test.py | NasTul/models | 82,518 | 12635031 | <gh_stars>1000+
# Copyright 2021 The TensorFlow 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 req... |
tests/unit/test_is_decompressed_message.py | vishalbelsare/jina | 15,179 | 12635033 | <gh_stars>1000+
import time
from jina.helper import random_identity
from jina.logging.predefined import default_logger
from jina.parsers import set_pea_parser
from jina.peapods.runtimes.zmq.zed import ZEDRuntime
from jina.peapods.peas import BasePea
from jina.peapods.zmq import Zmqlet
from jina.types.message import Me... |
pkg/win32/Python27/Lib/site-packages/klei/imgutil.py | hexgear-studio/ds_mod_tools | 112 | 12635034 | from PIL import Image, ImageOps
def Expand( im, border_size ):
new_img = ImageOps.expand( im, border = border_size )
for i in range( border_size ):
left = border_size - i
right = border_size + im.size[0] + i
top = border_size - i
bottom = border_size + im.size[1] + i -... |
tests/collisions/apps.py | KazakovDenis/django-extensions | 4,057 | 12635061 | <filename>tests/collisions/apps.py
# -*- coding: utf-8 -*-
from django.apps import AppConfig
class FooConfig(AppConfig):
name = 'tests.collisions'
app_label = 'collisions'
|
zhihu_user_info_spider/data_analysis/test/pandas_test.py | Yourrrrlove/spider_collection | 178 | 12635065 | <filename>zhihu_user_info_spider/data_analysis/test/pandas_test.py
import pandas as pd
import numpy as np
df = pd.read_csv(
r"D:\pycharm\PyCharm 2020.1.1\workplace\zhihu_user_info\zhihu_user_info_spider\result\userInfo\2021\10\17\user_info_low_cleaned.csv")
df1 = df.drop_duplicates(subset="id")
print(df1.groupby(... |
src/GridCal/Gui/GIS/gui.py | mzy2240/GridCal | 284 | 12635069 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'gui.ui',
# licensing of 'gui.ui' applies.
#
# Created: Mon Dec 9 12:39:51 2019
# by: pyside2-uic running on PySide2 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PySide2 import QtCore, QtGui,... |
tests/integrationv2/test_pq_handshake.py | hongxu-jia/s2n-tls | 4,256 | 12635078 | <gh_stars>1000+
import pytest
import os
from configuration import available_ports, PROVIDERS, PROTOCOLS
from common import Ciphers, ProviderOptions, Protocols, data_bytes, KemGroups, Certificates, pq_enabled
from fixtures import managed_process
from providers import Provider, S2N, OpenSSL
from utils import invalid_tes... |
configs/models/aotl.py | yoxu515/aot-benchmark | 105 | 12635081 | <reponame>yoxu515/aot-benchmark<filename>configs/models/aotl.py
import os
from .default import DefaultModelConfig
class ModelConfig(DefaultModelConfig):
def __init__(self):
super().__init__()
self.MODEL_NAME = 'AOTL'
self.MODEL_LSTT_NUM = 3
self.TRAIN_LONG_TERM_MEM_GAP = 2
... |
02_advanced/02_debugging/ex_01_compute_test_value.py | johny-c/theano_exercises | 711 | 12635083 | # Run
# python 01_compute_test_value.py
# It should raise an exception when it tries to execute the call to fn.
# The exception doesn't make it easy to tell which line of the python script
# first created an invalid expression though.
# Modify the script to use compute_test_value to find the first bad line.
import nump... |
test/swig/nnScalarOperators.py | AyishaR/deepC | 223 | 12635116 | # 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... |
tests/api/test_communities.py | LEv145/python-twitch-client | 171 | 12635172 | <filename>tests/api/test_communities.py
import json
import pytest
import responses
from twitch.client import TwitchClient
from twitch.constants import BASE_URL
from twitch.exceptions import TwitchAttributeException
from twitch.resources import Community, User
example_community = {
"_id": "e9f17055-810f-4736-ba40... |
lib/coloraide/spaces/xyz.py | facelessuser/ColorHelper | 253 | 12635178 | """XYZ D65 class."""
from ..spaces import Space, RE_DEFAULT_MATCH, GamutUnbound
import re
class XYZ(Space):
"""XYZ D65 class."""
SPACE = "xyz"
SERIALIZE = ("xyz", "xyz-d65")
CHANNEL_NAMES = ("x", "y", "z", "alpha")
DEFAULT_MATCH = re.compile(RE_DEFAULT_MATCH.format(color_space='|'.join(SERIALIZE)... |
homeassistant/components/kulersky/const.py | MrDelik/core | 30,023 | 12635182 | <filename>homeassistant/components/kulersky/const.py
"""Constants for the Kuler Sky integration."""
DOMAIN = "kulersky"
DATA_ADDRESSES = "addresses"
DATA_DISCOVERY_SUBSCRIPTION = "discovery_subscription"
|
tests/template_tests/templatetags/tag_27584.py | ni-ning/django | 61,676 | 12635212 | <filename>tests/template_tests/templatetags/tag_27584.py
from django import template
register = template.Library()
@register.tag
def badtag(parser, token):
parser.parse(('endbadtag',))
parser.delete_first_token()
return BadNode()
class BadNode(template.Node):
def render(self, context):
rais... |
vol2/vol2-python-examples/examples/example_crossover.py | Sun-Joong/aifh | 777 | 12635230 | <gh_stars>100-1000
#!/usr/bin/env python
"""
Artificial Intelligence for Humans
Volume 2: Nature-Inspired Algorithms
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2014 by <NAME>
Licensed under the Apache ... |
tests/ut/python/pass/test_helptiling.py | tianjiashuo/akg | 286 | 12635231 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... |
stonesoup/detector/tests/test_tensorflow.py | Red-Portal/Stone-Soup-1 | 157 | 12635246 | # -*- coding: utf-8 -*
import pytest
try:
from stonesoup.detector.tensorflow import TensorFlowBoxObjectDetector
except ImportError:
# Catch optional dependencies import error
pytest.skip(
"Skipping due to missing optional dependencies. Usage of the TensorFlow detectors "
"requires that Tens... |
libs/input_modules/get_datasets.py | dylancashman/metaqnn | 136 | 12635252 | <gh_stars>100-1000
import numpy as np
import os
import pickle
import shutil
import struct
import tarfile
import urllib
import ssl
from scipy import io, misc
def get_caltech101(save_dir=None, root_path=None):
assert((save_dir is not None and root_path is None) or (save_dir is None and root_path is not None))
... |
Chapter03/eval.py | jvstinian/Python-Reinforcement-Learning-Projects | 114 | 12635263 | <reponame>jvstinian/Python-Reinforcement-Learning-Projects<gh_stars>100-1000
'''
Created on Mar 28, 2018
@author: ywz
'''
import os
import argparse
import tensorflow as tf
from q_learning import DQN
from config import ATARI, DEMO
from environment import new_atari_game, new_demo
def main():
parser = argparse... |
PyInstaller/hooks/hook-sphinx.py | hawkhai/pyinstaller | 9,267 | 12635301 | <filename>PyInstaller/hooks/hook-sphinx.py
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# ... |
tests/test_real_pins.py | codecademy-engineering/gpiozero | 743 | 12635302 | <gh_stars>100-1000
# vim: set fileencoding=utf-8:
#
# GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins
#
# Copyright (c) 2016-2021 <NAME> <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: BSD-3-Clause
import os
import errno
from time import time, sleep
from math import isclo... |
src/olympia/addons/migrations/0021_auto_20200909_1302.py | osamamagdy/addons-server | 843 | 12635304 | # Generated by Django 2.2.16 on 2020-09-09 13:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("addons", "0020_auto_20200805_1350"),
]
operations = [
migrations.AlterField(
model_name="addon",
name="total_downlo... |
tensorflow/contrib/solvers/python/ops/linear_equations.py | AlexChrisF/udacity | 522 | 12635305 | <reponame>AlexChrisF/udacity
# Copyright 2016 The TensorFlow 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
#... |
gallery/scatter_annotate/scatter_annotate.py | zachfox/dnaplotlib | 267 | 12635375 | #!/usr/bin/env python
"""
Annotation of standard scatter plot with genetic constructs
"""
import numpy as np
import matplotlib.pyplot as plt
import dnaplotlib as dpl
import csv
__author__ = '<NAME> <<EMAIL>>, Voigt Lab, MIT'
__license__ = 'MIT'
__version__ = '1.0'
# Read some data points for the scatter plot
filen... |
deepconsensus/preprocess/preprocess.py | pichuan/deepconsensus | 106 | 12635376 | <filename>deepconsensus/preprocess/preprocess.py
# Copyright (c) 2021, Google 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:
#
# 1. Redistributions of source code must retain the above cop... |
labgraph/examples/simple_viz_zmq.py | Yunusbcr/labgraph | 124 | 12635392 | <filename>labgraph/examples/simple_viz_zmq.py
#!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
# Built-in imports
import asyncio
from labgraph.zmq_node.zmq_message import ZMQMessage
from labgraph.zmq_node.zmq_poller_node import ZMQPollerConfig
import time
from dataclasses import field
fro... |
consulate/models/base.py | Beahmer89/consulate | 309 | 12635396 | <gh_stars>100-1000
# coding=utf-8
"""
Base Model
"""
import collections
class Model(collections.Iterable):
"""A model contains an __attribute__ map that defines the name,
its type for type validation, an optional validation method, a method
used to
.. python::
class MyModel(Model):
... |
examples/batch_normalization/mnist_baseline.py | uaca/deepy | 260 | 12635407 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment setting is described in http://arxiv.org/pdf/1502.03167v3.pdf.
MNIST MLP baseline model.
Gaussian initialization described in the paper did not convergence, I have no idea.
"""
import logging, os
logging.basicConfig(level=logging.INFO)
from deepy.data... |
src/super_gradients/common/decorators/deci_logger.py | Deci-AI/super-gradients | 308 | 12635422 | <filename>src/super_gradients/common/decorators/deci_logger.py
def deci_func_logger(_func=None, *, name: str = 'abstract_decorator'):
"""
This decorator is used to wrap our functions with logs.
It will log every enter and exit of the functon with the equivalent parameters as extras.
It will also log exc... |
examples/http_redirect.py | Varriount/sanic | 1,883 | 12635440 | from sanic import Sanic, response, text
from sanic.handlers import ErrorHandler
from sanic.server.async_server import AsyncioServer
HTTP_PORT = 9999
HTTPS_PORT = 8888
http = Sanic("http")
http.config.SERVER_NAME = f"localhost:{HTTP_PORT}"
https = Sanic("https")
https.config.SERVER_NAME = f"localhost:{HTTPS_PORT}"
... |
library/source1/bsp/lumps/vertex_lump.py | BlenderAddonsArchive/SourceIO | 199 | 12635527 | import numpy as np
from .. import Lump, lump_tag
@lump_tag(3, 'LUMP_VERTICES')
class VertexLump(Lump):
def __init__(self, bsp, lump_id):
super().__init__(bsp, lump_id)
self.vertices = np.array([])
def parse(self):
reader = self.reader
self.vertices = np.frombuffer(reader.read... |
dfvfs/compression/bzip2_decompressor.py | dfjxs/dfvfs | 176 | 12635533 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""The BZIP2 decompressor implementation."""
import bz2
from dfvfs.compression import decompressor
from dfvfs.compression import manager
from dfvfs.lib import definitions
from dfvfs.lib import errors
class BZIP2Decompressor(decompressor.Decompressor):
"""BZIP2 decompress... |
tests/protocols/http/twisted_web_test_utils.py | paradiseng/jasmin | 750 | 12635534 | # https://gist.github.com/1873035#file_twisted_web_test_utils.py
import json
from io import StringIO
from twisted.internet.defer import succeed
from twisted.web import server, http_headers
from twisted.web.test.test_web import DummyRequest
from twisted.web.http import Request
class SmartDummyRequest(DummyRequest):
... |
tests/extra/polar.py | aluhrs13/HPI | 1,026 | 12635575 | <gh_stars>1000+
from pathlib import Path
import sys
from importlib import reload
from my.core.common import get_valid_filename
ROOT = Path(__file__).parent.absolute()
OUTPUTS = ROOT / 'outputs'
import pytest # type: ignore
def test_hpi(prepare: str) -> None:
from my.polar import get_entries
assert len(list... |
webhook/plugins/base.py | nobgr/xray | 7,086 | 12635580 | import logging
from cached_property import cached_property
from model.plugin import PluginMeta
from model.vuln import Statistics, WebVuln, ServiceVuln
class BasePlugin:
@cached_property
def meta(self) -> PluginMeta:
raise NotImplementedError("you should implement this method in your subclass")
... |
chocolate/mo/__init__.py | Intelecy/chocolate | 105 | 12635621 | from collections import defaultdict
import numpy
try:
# try importing the C version and set docstring
from .hv import hypervolume as __hv
except ImportError:
# fallback on python version
from .pyhv import hypervolume as __hv
def argsortNondominated(losses, k, first_front_only=False):
"""Sort inp... |
docs/release/changelog.py | oneconvergence/katib | 1,177 | 12635644 | from github import Github
import argparse
REPO_NAME = "kubeflow/katib"
CHANGELOG_FILE = "CHANGELOG.md"
parser = argparse.ArgumentParser()
parser.add_argument("--token", type=str, help="GitHub Access Token")
parser.add_argument("--range", type=str, help="Changelog is generated for this release range")
args = parser.pa... |
mahotas/tests/test_freeimage.py | odidev/mahotas | 541 | 12635646 | import numpy as np
from os import path
try:
from mahotas.io import freeimage
except OSError:
import pytest
pytestmark = pytest.mark.skip
def test_freeimage(tmpdir):
img = np.arange(256).reshape((16,16)).astype(np.uint8)
fname = tmpdir.join('mahotas_test.png')
freeimage.imsave(fname, img)
... |
tests/strings/string_format_i.py | MoonStarCZW/py2rb | 124 | 12635651 |
a = 1.123456
b = 10
c = -30
d = 34
e = 123.456
f = 19892122
# form 0
s = "b=%i" % b
print(s)
# form 1
s = "b,c,d=%i+%i+%i" % (b,c,d)
print(s)
# form 2
s = "b=%(b)i and c=%(c)i and d=%(d)i" % { 'b':b,'c':c,'d':d }
print(s)
# width,flags
s = "e=%020i e=%+i e=%20i e=%-20i (e=%- 20i)" % (e,e,e,e,e)
print(s)
|
人工智能/AI_Reversi/board.py | yunwei37/ZJU-CS-GIS-ClassNotes | 397 | 12635654 | #!/usr/bin/Anaconda3/python
# -*- coding: utf-8 -*-
class Board(object):
"""
Board 黑白棋棋盘,规格是8*8,黑棋用 X 表示,白棋用 O 表示,未落子时用 . 表示。
"""
def __init__(self):
"""
初始化棋盘状态
"""
self.empty = '.' # 未落子状态
self._board = [[self.empty for _ in range(8)] for _ in range(8)] # 规格... |
pipe-cli/src/api/folder.py | msleprosy/cloud-pipeline | 126 | 12635660 | <reponame>msleprosy/cloud-pipeline
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
Algo and DSA/LeetCode-Solutions-master/Python/sort-features-by-popularity.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 12635675 | # Time: O(nlogn)
# Space: O(n)
import collections
class Solution(object):
def sortFeatures(self, features, responses):
"""
:type features: List[str]
:type responses: List[str]
:rtype: List[str]
"""
features_set = set(features)
order = {word: i for i, word ... |
anime_dl/sites/supporters/sub_fetcher.py | tiagotda/anime-dl | 246 | 12635678 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import anime_dl.common
from anime_dl.external.aes import aes_cbc_decrypt
from anime_dl.external.compat import compat_etree_fromstring
from anime_dl.external.utils import bytes_to_intlist, intlist_to_bytes
import re
import logging
import os
import base64
import zlib
from ha... |
src/oic/utils/sanitize.py | kschu91/pyoidc | 373 | 12635710 | <filename>src/oic/utils/sanitize.py
import re
from collections.abc import Mapping
from textwrap import dedent
SENSITIVE_THINGS = {
"password",
"<PASSWORD>",
"client_secret",
"code",
"authorization",
"access_token",
"refresh_token",
}
REPLACEMENT = "<REDACTED>"
SANITIZE_PATTERN = r"""
... |
poodle-exploit.py | RootDev4/POODLE-PoC | 207 | 12635731 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Poodle attack implementation
Author: mpgn <<EMAIL>>
Created: 03/2018 - Python3
License: MIT
'''
import argparse
import binascii
import os
import re
import select
import socket
import socketserver
import struct
import sys
import threading
class bcolor... |
model-optimizer/unit_tests/extensions/ops/interpolate_test.py | monroid/openvino | 2,406 | 12635736 | <filename>model-optimizer/unit_tests/extensions/ops/interpolate_test.py
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
import numpy as np
from generator import generator, generate
from extensions.ops.interpolate import Interpolate
from mo.front.common.partial_infer.... |
subdivnet/utils.py | 565353780/jittor-subdivnet | 145 | 12635739 | <reponame>565353780/jittor-subdivnet
import os
import json
from pathlib import Path
import numpy as np
import trimesh
import jittor as jt
from .mesh_tensor import MeshTensor
segment_colors = np.array([
[0, 114, 189],
[217, 83, 26],
[238, 177, 32],
[126, 47, 142],
[117, 142, 48],
[76, 190, 2... |
alipay/aop/api/response/AlipayOpenAppAppcontentPoiSyncResponse.py | antopen/alipay-sdk-python-all | 213 | 12635748 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenAppAppcontentPoiSyncResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenAppAppcontentPoiSyncResponse, self).__init__()
self._alipay_poi_id = None
... |
plugins/Operations/Misc/emulate_code_dialog.py | nmantani/FileInsight-plugins | 120 | 12635778 | <filename>plugins/Operations/Misc/emulate_code_dialog.py
#
# Emulate code - Emulate selected region as an executable or shellcode
# with Qiling Framework (the whole file if not selected)
#
# Copyright (c) 2020, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
... |
tests/unit/commands/status_test.py | gamechanger/dusty | 421 | 12635796 | from mock import patch, Mock, call
from ...testcases import DustyTestCase
from dusty.commands.status import _has_active_container, get_dusty_status
from dusty.schemas.base_schema_class import DustySchema
from ..utils import get_app_dusty_schema, get_bundle_dusty_schema, get_lib_dusty_schema
class TestStatusCommands(D... |
corehq/ex-submodules/casexml/apps/phone/tests/test_sync_purge.py | omari-funzone/commcare-hq | 471 | 12635805 | <filename>corehq/ex-submodules/casexml/apps/phone/tests/test_sync_purge.py
import uuid
from django.test import TestCase
from testil import eq
from casexml.apps.case.xml import V1
from casexml.apps.phone.exceptions import MissingSyncLog
from casexml.apps.phone.models import get_alt_device_id
from casexml.apps.phone.te... |
Scripts/Bots/runPython_bot/start.py | ShivangiPatel102/Python_and_the_Web | 437 | 12635815 | from bot import run_python_bot
import logging
from pytz import timezone
from datetime import datetime
TIMEZONE = "Asia/Kolkata"
logging.Formatter.converter = lambda *args: datetime.now(
tz=timezone(TIMEZONE)
).timetuple()
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
... |
WebMirror/management/rss_parser_funcs/feed_parse_extractTandQ.py | fake-name/ReadableWebProxy | 193 | 12635827 | def extractTandQ(item):
"""
T&Q
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
bad = [
'#K-drama',
'fashion',
'C-Drama',
'#Trending',
'Feature',
'#Trailer',
'#Eng Sub',
'M... |
tests/py/test_security.py | kant/gratipay.com | 517 | 12635845 | from __future__ import absolute_import, division, print_function, unicode_literals
import struct
import datetime
from aspen import Response
from aspen.http.request import Request
from base64 import urlsafe_b64decode
from cryptography.fernet import Fernet, InvalidToken
from gratipay import security
from gratipay.model... |
mailchimp3/entities/listsignupforms.py | michaelwalkerfl/python-mailchimp | 311 | 12635848 | # coding=utf-8
"""
The List Signup Forms API endpoint
Documentation: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/signup-forms/
Schema: https://api.mailchimp.com/schema/3.0/Lists/SignupForms/Instance.json
"""
from __future__ import unicode_literals
from mailchimp3.baseapi import BaseApi
cl... |
apps/base/models.py | kaustubh-s1/EvalAI | 1,470 | 12635852 | from __future__ import unicode_literals
import logging
from django.db import models
# Get an instance of a logger
logger = logging.getLogger(__name__)
class TimeStampedModel(models.Model):
"""
An abstract base class model that provides self-managed `created_at` and
`modified_at` fields.
"""
cr... |
venv/lib/python3.7/site-packages/allauth/socialaccount/providers/vimeo_oauth2/urls.py | vikram0207/django-rest | 6,342 | 12635891 | """URLs for Patreon Provider"""
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import VimeoOAuth2Provider
urlpatterns = default_urlpatterns(VimeoOAuth2Provider)
|
sdk/formrecognizer/azure-ai-formrecognizer/tests/test_to_dict_v2.py | vincenttran-msft/azure-sdk-for-python | 2,728 | 12635913 | # 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.
# ---------------------------------------------------------------------... |
Validation/HGCalValidation/python/HFNoseDigiClient_cfi.py | ckamtsikis/cmssw | 852 | 12635943 | <reponame>ckamtsikis/cmssw<filename>Validation/HGCalValidation/python/HFNoseDigiClient_cfi.py
import FWCore.ParameterSet.Config as cms
from Validation.HGCalValidation.HGCalDigiClient_cfi import *
hfnoseDigiClient = hgcalDigiClientEE.clone(
DetectorName = cms.string("HGCalHFNoseSensitive"))
|
blender/MapsModelsImporter/operators.py | r23/MapsModelsImporter | 1,401 | 12635948 | # Copyright (c) 2019 <NAME>
#
# 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, modify, merge, publish, distribute, ... |
opendeep/optimization/loss/__init__.py | vitruvianscience/OpenDeep | 252 | 12635966 | <filename>opendeep/optimization/loss/__init__.py
from __future__ import division, absolute_import, print_function
from opendeep.optimization.loss.loss import *
from opendeep.optimization.loss.binary_crossentropy import *
from opendeep.optimization.loss.categorical_crossentropy import *
from opendeep.optimization.loss... |
docs/test/shadow_particle_test.py | longgangfan/underworld2 | 116 | 12635997 | import h5py
if h5py.get_config().mpi == False:
import warnings
warnings.warn("h5py not MPI enabled. Discontinuing test.")
import sys
sys.exit(0)
import underworld as uw
import numpy as np
mesh = uw.mesh.FeMesh_Cartesian(elementRes=(128,128))
swarm = uw.swarm.Swarm(mesh)
# create some variables to tra... |
tools/win/sizeviewer/sizeviewer.py | zealoussnow/chromium | 14,668 | 12636002 | # Copyright 2013 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.
from __future__ import print_function
import base64
import codecs
import json
import os
import string
import subprocess
import sys
BASE_DIR = os.path.dirn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.