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 |
|---|---|---|---|---|
sfepy/discrete/iga/iga.py | clazaro/sfepy | 510 | 9597617 | <reponame>clazaro/sfepy
"""
Isogeometric analysis utilities.
Notes
-----
The functions :func:`compute_bezier_extraction_1d()` and
:func:`eval_nurbs_basis_tp()` implement the algorithms described in [1].
[1] <NAME>, <NAME>, <NAME>, <NAME>:
Isogeometric finite element data structures based on Bezier extraction of
... |
tcod/image.py | hirnimeshrampuresoftware/python-tcod | 231 | 9597632 | <filename>tcod/image.py
"""Functionality for handling images.
**Python-tcod is unable to render pixels to the screen directly.**
If your image can't be represented as tiles then you'll need to use
`an alternative library for graphics rendering
<https://wiki.python.org/moin/PythonGameLibraries>`_.
"""
from __future__ i... |
passpie/history.py | bcfurtado/passpie | 700 | 9597648 | <filename>passpie/history.py
from functools import wraps
import logging
import os
from . import process
from .utils import which, tempdir
from ._compat import FileExistsError
def ensure_git(return_value=None):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
if which('g... |
reliability-v2/users/Users.py | afcollins/svt | 115 | 9597649 | <gh_stars>100-1000
import csv
import logging
class User:
def __init__(self,name,password):
self.name = name
self.password = password
self.logger = logging.getLogger('reliability')
self.project = ""
class Users:
def __init__(self):
self.users = {}
self.logger = ... |
examples/cairns/project.py | samcom12/anuga_core | 136 | 9597651 | <gh_stars>100-1000
""" Common filenames and locations for topographic data, meshes and outputs.
This file defines the parameters of the scenario you wish to run.
"""
import anuga
#------------------------------------------------------------------------------
# Runtime parameters
#--------------------------------... |
mayan/apps/sources/links.py | atitaya1412/Mayan-EDMS | 336 | 9597682 | <filename>mayan/apps/sources/links.py
import logging
from django.apps import apps
from django.utils.translation import ugettext_lazy as _
from mayan.apps.documents.permissions import (
permission_document_create, permission_document_file_new
)
from mayan.apps.navigation.classes import Link
from .icons import (
... |
src/promnesia/sources/rss.py | halhenke/promnesia | 1,327 | 9597690 | <reponame>halhenke/promnesia
from itertools import chain
from ..common import Visit, Loc, extract_urls, Results, get_logger
from datetime import datetime
import pytz
# arbitrary, 2011-11-04 00:05:23.283+00:00
default_datetime = datetime.fromtimestamp(1320365123, tz=pytz.utc)
# TODO FIXME allow for visit not to hav... |
src/lib/xml/parsers/__init__.py | DTenore/skulpt | 2,671 | 9597699 | import _sk_fail; _sk_fail._("parsers")
|
tests/report_tests/test_audio_report.py | chainer/chainerui | 185 | 9597700 | <filename>tests/report_tests/test_audio_report.py
import os
import unittest
import warnings
import numpy as np
import six
try:
import chainer # NOQA
_chainer_installed = True
except (ImportError, TypeError):
_chainer_installed = False
if _chainer_installed:
from chainerui.report import audio_report
... |
nengo/tests/test_base.py | Michaeljurado24/nengo | 762 | 9597710 | <reponame>Michaeljurado24/nengo
import pytest
import nengo
from nengo.base import NengoObjectParam
from nengo.exceptions import ValidationError
def test_nengoobjectparam():
"""NengoObjectParam must be a Nengo object and is readonly by default."""
class Test:
nop = NengoObjectParam("nop")
inst =... |
utils/bert_xlnet_inputs.py | aaj-fullfact/slot_filling_and_intent_detection_of_SLU | 361 | 9597720 | #!/usr/bin/env python3
'''
@Time : 2019-07-18 22:06:40
@Author : su.zhu
@Desc :
'''
import torch
import itertools
def prepare_inputs_for_bert_xlnet(sentences, word_lengths, tokenizer, cls_token_at_end=False, pad_on_left=False, cls_token='[CLS]', sep_token='[SEP]', pad_token=0, sequence_a_segment_id=0, cls_token... |
python/oneflow/compatible/single_client/test/ops/test_nccl_use_compute_stream.py | wangyuyue/oneflow | 3,285 | 9597726 | """
Copyright 2020 The OneFlow 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 law or agr... |
angr/storage/memory_mixins/symbolic_merger_mixin.py | mikenawrocki/angr | 6,132 | 9597744 | from typing import Iterable, Tuple, Any
from . import MemoryMixin
class SymbolicMergerMixin(MemoryMixin):
def _merge_values(self, values: Iterable[Tuple[Any,Any]], merged_size: int, **kwargs):
merged_val = self.state.solver.BVV(0, merged_size * self.state.arch.byte_width)
for tm, fv in values:
... |
mmcv/fileio/handlers/json_handler.py | lyttonhao/mmcv | 549 | 9597750 | <filename>mmcv/fileio/handlers/json_handler.py
# Copyright (c) Open-MMLab. All rights reserved.
import json
import numpy as np
from .base import BaseFileHandler
def set_default(obj):
"""Set default json values for non-serializable values.
It helps convert ``set``, ``range`` and ``np.ndarray`` data types to... |
examples/examples/src/main/python/mist_examples/sparkctx_example.py | anniyanvr/mist | 352 | 9597764 | <reponame>anniyanvr/mist
from mistpy.decorators import *
@with_args(
arg('numbers', type_hint=list_type(int)),
arg('multiplier', type_hint=int, default=2)
)
@on_spark_context
def sparkctx_example(sc, numbers, multiplier):
rdd = sc.parallelize(numbers)
result = rdd.map(lambda s: multiplier * s).collect(... |
tensorflow/lite/testing/op_tests/unroll_batch_matmul.py | EricRemmerswaal/tensorflow | 190,993 | 9597766 | <reponame>EricRemmerswaal/tensorflow
# Copyright 2019 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/LICEN... |
tests/telethon/tl/test_serialization.py | fx2hero/Telethon | 6,709 | 9597773 | <reponame>fx2hero/Telethon<gh_stars>1000+
import pytest
from telethon.tl import types, functions
def test_nested_invalid_serialization():
large_long = 2**62
request = functions.account.SetPrivacyRequest(
key=types.InputPrivacyKeyChatInvite(),
rules=[types.InputPrivacyValueDisallowUsers(users=... |
dataclass_factory/generics.py | olegtaratuhin/dataclass_factory | 189 | 9597815 | <gh_stars>100-1000
import sys
from collections import deque
from typing import Any, Dict, Generic, Type, get_type_hints, Tuple, List, Set, \
FrozenSet, Deque
from .type_detection import (
get_self_type_hints, is_generic, is_generic_concrete,
)
COMPAT_ORIGINS: Dict[Any, Any]
if sys.version_info < (3, 9):
... |
src/runner.py | gaby/msfs2020-google-map | 267 | 9597817 | <filename>src/runner.py
import os
import stat
import subprocess
import urllib3
urllib3.disable_warnings()
__domains: list[str] = ['kh.ssl.ak.tiles.virtualearth.net', 'khstorelive.azureedge.net']
host_path: str = "C:\\Windows\\System32\\drivers\\etc\\hosts"
host_entries: list[str] = [f"\n127.0.0.1 {domain}\... |
low_shot_learning/architectures/feature_extractors/wide_resnet.py | ZhenLiuBuaa/wDAE_GNN_FewShot | 150 | 9597877 | import math
import torch
import torch.nn as nn
import low_shot_learning.architectures.feature_extractors.utils as utils
import low_shot_learning.architectures.tools as tools
class BasicBlock(nn.Module):
def __init__(self, in_planes, out_planes, stride, dropRate=0.0):
super(BasicBlock, self).__init__()
... |
tests/acitoolkit_fakeapic_test.py | richardstrnad/acitoolkit | 351 | 9597893 | """acitoolkit_fakeapic_test.py Test module
"""
import unittest
import argparse
import sys
from acitoolkit import FakeSession
from os import listdir
import json
class TestFakeApic(unittest.TestCase):
"""
Tests for the Fake APIC
"""
@classmethod
def setUpClass(cls):
cls.session = FakeSession... |
packages/Python/lldbsuite/test/commands/expression/macros/TestMacros.py | xiaobai/swift-lldb | 765 | 9597912 | from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestMacros(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(
compiler="clang",
bugnumber="clang d... |
plydata/dataframe/__init__.py | has2k1/plydata | 247 | 9597936 | """
Verb implementations for the dataframe
"""
from .one_table import * # noqa
from .two_table import * # noqa
from .helpers import * # noqa
|
great_expectations/core/usage_statistics/anonymizers/batch_anonymizer.py | victorcouste/great_expectations | 6,451 | 9597982 | <reponame>victorcouste/great_expectations<gh_stars>1000+
from great_expectations.core.usage_statistics.anonymizers.anonymizer import Anonymizer
from great_expectations.core.usage_statistics.anonymizers.batch_kwargs_anonymizer import (
BatchKwargsAnonymizer,
)
from great_expectations.data_asset import DataAsset
cl... |
examples/trading/update.py | b-aeby/degiro-connector | 107 | 9597990 | # IMPORTATIONS
import json
import logging
import degiro_connector.core.helpers.pb_handler as pb_handler
import pandas as pd
from IPython.display import display
from degiro_connector.trading.api import API as TradingAPI
from degiro_connector.trading.models.trading_pb2 import Credentials, Update
# SETUP LOGGING LEVEL
l... |
wo/core/download.py | dacsec-org/WordOps | 902 | 9597991 | """WordOps download core classes."""
import os
import requests
from wo.core.logging import Log
class WODownload():
"""Method to download using urllib"""
def __init__():
pass
def download(self, packages):
"""Download packages, packages must be list in format of
[url, path, package... |
gallery/python_formatter/python_formatter.py | arvkevi/awesome-streamlit | 1,194 | 9598010 | from typing import List
import streamlit
def _autoflake_params(parent=streamlit.sidebar) -> dict:
parent.subheader(
"[Autoflake](https://github.com/myint/autoflake) Parameters")
return {
"expand_star_imports": parent.checkbox("Expand Star Imports",
... |
register_block.py | woailaosang/NeuronBlocks | 1,257 | 9598034 | <filename>register_block.py<gh_stars>1000+
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import os
import argparse
def get_block_path(block_name, path='./block_zoo'):
''' find the block_name.py file in block_zoo
Args:
block_name: the name need to be re... |
packages/jet_bridge_base/jet_bridge_base/views/mixins/retrieve.py | F2210/jet-bridge | 1,247 | 9598060 | <filename>packages/jet_bridge_base/jet_bridge_base/views/mixins/retrieve.py
from jet_bridge_base.responses.json import JSONResponse
class RetrieveAPIViewMixin(object):
def retrieve(self, request, *args, **kwargs):
instance = self.get_object(request)
serializer = self.get_serializer(request, insta... |
pipeline/structure2flow.py | jswulff/mrflow | 124 | 9598082 | #! /usr/bin/env python2
import numpy as np
import sys,os,time
import argparse
sys.path.append(os.environ['MRFLOW_HOME'])
# Local imports
from utils import flow_homography as fh
from utils import compute_figure
def structure_to_flow(structure, q, mu, H, b, params):
"""Convert structure back to full flow
""... |
tests/ut/profiler/analyser/test_analyser_aicore_detail.py | mindspore-ai/mindinsight | 216 | 9598088 | # 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... |
scripts/02_bert_ner/main.py | harri-pltr/slovnet | 147 | 9598123 | <gh_stars>100-1000
from os import getenv, environ
from os.path import exists, join, expanduser
from random import seed, sample, randint, uniform
from subprocess import run
from tqdm.notebook import tqdm as log_progress
import torch
from torch import optim
from naeval.ner.datasets import (
load_factru,
load_... |
torch/distributed/elastic/utils/data/elastic_distributed_sampler.py | Hacky-DH/pytorch | 60,067 | 9598151 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its 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.
import math
import torch
from torch.utils.data.distributed import DistributedSampler
c... |
py/torch_tensorrt/fx/test/passes/test_remove_duplicate_output_args.py | hassan11196/Torch-TensorRT | 430 | 9598161 | <reponame>hassan11196/Torch-TensorRT
# Owner(s): ["oncall: gpu_enablement"]
import logging
import torch.fx as fx
import torch.nn as nn
import torch_tensorrt.fx.passes.remove_duplicate_output_args as dedup
from torch.testing._internal.common_utils import run_tests, TestCase
_LOGGER = logging.getLogger(__name__)
c... |
ansible/library/sonic_release.py | lolyu/sonic-mgmt | 132 | 9598168 | <gh_stars>100-1000
#!/usr/bin/python
import subprocess
from ansible.module_utils.basic import *
DOCUMENTATION = '''
---
module: sonic_release
version_added: "0.1"
author: <NAME> (<EMAIL>)
short_description: Retrive os release facts from device
description:
- Retrieve sonic release facts for a device, the facts wil... |
bcs-ui/backend/templatesets/legacy_apps/configuration/migrations/0033_auto_20191103_2342.py | laodiu/bk-bcs | 599 | 9598188 | <reponame>laodiu/bk-bcs
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not us... |
buildroot/support/testing/tests/package/sample_python_attrs.py | bramkragten/operating-system | 349 | 9598189 | <reponame>bramkragten/operating-system<gh_stars>100-1000
import attr
@attr.s
class Obj(object):
x = attr.ib()
y = attr.ib(default=1)
obj1 = Obj(2)
assert(obj1.x == 2)
assert(obj1.y == 1)
obj2 = Obj(3, 4)
assert(obj2.x == 3)
assert(obj2.y == 4)
|
funsor/typing.py | fritzo/funsor | 198 | 9598198 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import functools
import sys
import typing
import weakref
import typing_extensions
from multipledispatch.variadic import Variadic as _OrigVariadic
from multipledispatch.variadic import isvariadic
#################################
# Ru... |
tests/components/push/__init__.py | domwillcode/home-assistant | 30,023 | 9598217 | <gh_stars>1000+
"""Tests for the push component."""
|
venv/Lib/site-packages/easygui/boxes/fillable_box.py | xinkangli/graphical-user-interface | 413 | 9598253 | <filename>venv/Lib/site-packages/easygui/boxes/fillable_box.py<gh_stars>100-1000
try:
from . import utils as ut
from . import global_state
from .base_boxes import bindArrows
except (SystemError, ValueError, ImportError):
import utils as ut
import global_state
from base_boxes import bindArrows
t... |
problems/tests/test_binary_search_tree_iterator.py | vinta/fuck-coding-interviews | 590 | 9598277 | <gh_stars>100-1000
# coding: utf-8
import unittest
from problems.binary_search_tree_iterator import BSTIterator
from problems.utils.leetcode import deserialize_tree_str
class TestCase(unittest.TestCase):
def setUp(self):
root = deserialize_tree_str('[7,3,15,null,null,9,20]')
self.bst_iterator = B... |
goodtables/checks/duplicate_header.py | SrividhyaGuru/goodtables-py | 243 | 9598299 | <filename>goodtables/checks/duplicate_header.py<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 ..registry import check
from ..error import Error
# Module API
@check('d... |
daemon/core/services/xorp.py | alehmannFRA-UAS/core | 463 | 9598339 | """
xorp.py: defines routing services provided by the XORP routing suite.
"""
from typing import Optional, Tuple
import netaddr
from core.nodes.base import CoreNode
from core.nodes.interface import CoreInterface
from core.services.coreservices import CoreService
class XorpRtrmgr(CoreService):
"""
XORP rout... |
st3/mdpopups/coloraide/spaces/hsv.py | evandroforks/mdpopups | 109 | 9598350 | <filename>st3/mdpopups/coloraide/spaces/hsv.py
"""HSV class."""
from ..spaces import Space, RE_DEFAULT_MATCH, Angle, Percent, GamutBound, Cylindrical
from .srgb.base import SRGB
from .hsl.base import HSL
from .. import util
import re
def hsv_to_hsl(hsv):
"""
HSV to HSL.
https://en.wikipedia.org/wiki/HSL_... |
ufora/util/RetryAssert.py | ufora/ufora | 571 | 9598367 | <gh_stars>100-1000
# Copyright 2015 Ufora 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... |
VBx/VB_diarization.py | videodanchik/VBx | 145 | 9598415 | #!/usr/bin/env python
# Copyright 2013-2019 <NAME>, <NAME> (<EMAIL>, <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 requir... |
components/isceobj/InsarProc/runShadecpx2rg.py | vincentschut/isce2 | 1,133 | 9598420 | <reponame>vincentschut/isce2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2012 California Institute of Technology. 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.
... |
mpf/devices/ball_device/pulse_coil_ejector.py | Scottacus64/mpf | 163 | 9598433 | """Standard pulse ejector."""
from typing import List
import asyncio
from mpf.devices.ball_device.ball_device_ejector import BallDeviceEjector
from mpf.devices.ball_device.default_ball_search import DefaultBallSearch
from mpf.exceptions.config_file_error import ConfigFileError
class PulseCoilEjector(DefaultBallSear... |
dcase_util/features/__init__.py | stachu86/dcase_util | 122 | 9598439 | <filename>dcase_util/features/__init__.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Features
========
Classes for feature extraction.
FeatureExtractor
----------------
*dcase_util.features.FeatureExtractor*
.. autosummary::
:toctree: generated/
FeatureExtractor
SpectralFeatureExtractor
----------... |
compiler/model_configs/shared_config.py | im-world/OpenRAM | 335 | 9598440 | model_name = "cacti"
|
features.py | dermatologist/image-similarity-clustering | 195 | 9598447 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 18 22:06:25 2020
@author: dougl
"""
import os
from pathlib import Path
from tensorflow.keras import applications, models, Model
from tensorflow.keras.applications.resnet50 import preprocess_input
from tensorflow.keras.preprocessing import image
import numpy as np
from ... |
srcs/python/quiver/partition.py | jakeKonrad/torch-quiver | 196 | 9598455 | import torch
import shutil
import os
from typing import List
import quiver.utils as quiver_util
__all__ = ["quiver_partition_feature", "load_quiver_feature_partition"]
QUIVER_MAGIC_NUMBER = 256
def partition_feature_without_replication(probs: List[torch.Tensor], chunk_size: int):
"""Partition node with node a... |
third_party/blink/renderer/bindings/scripts/web_idl/enumeration.py | zipated/src | 2,151 | 9598469 | <filename>third_party/blink/renderer/bindings/scripts/web_idl/enumeration.py
# Copyright 2017 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 .extended_attribute import ExtendedAttributeList
from .utilities import ass... |
lint.py | mdcallag/mysql-tools | 226 | 9598510 | #!/usr/bin/python2
#
# 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/LICENSE-2.0
#
# Unless required b... |
tests/models/test_bernoulli_log_prob.py | xiangze/edward | 5,200 | 9598511 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from edward.models import Bernoulli
from tensorflow.contrib import distributions as ds
class test_bernoulli_log_prob_class(tf.test.TestCase):
def _test(self, probs, n):
rv = Be... |
puncover/backtrace_helper.py | mjessome/puncover | 197 | 9598528 | <filename>puncover/backtrace_helper.py
import re
from puncover import collector
class BacktraceHelper():
def __init__(self, collector):
self.collector = collector
derive_functions_symbols_pattern = re.compile(r"\b(\w+)\b")
def derive_function_symbols(self, text):
result = []
for ... |
pylearn2/utils/tests/test_iteration.py | ikervazquezlopez/Pylearn2 | 2,045 | 9598555 | <gh_stars>1000+
"""Tests for iterators."""
from __future__ import print_function
from nose.tools import assert_raises
import numpy as np
import theano
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from pylearn2.space import VectorSpace
from pylearn2.utils.iteration import (
SubsetIterator,
... |
functions/reading/train_queue.py | hsokooti/RegNet | 187 | 9598579 | <filename>functions/reading/train_queue.py
import numpy as np
import time
import threading
from . import chunk_image
from queue import Queue
import logging
import functions.setting.setting_utils as su
class FillPatches(threading.Thread):
def __init__(self,
setting,
batch_size=Non... |
example/mininet/dhcp_linear_npt.py | shuaijunlan/floodlight | 580 | 9598628 | <reponame>shuaijunlan/floodlight
#!/usr/bin/python
import json
import httplib
import os
import subprocess
import time
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.topo import Topo
from mininet.util import ir... |
aiida/storage/psql_dos/alembic_cli.py | aiidateam/aiida_core | 153 | 9598629 | <reponame>aiidateam/aiida_core<filename>aiida/storage/psql_dos/alembic_cli.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. ... |
heat/tests/test_server_tags.py | stackriot/heat | 265 | 9598636 | <filename>heat/tests/test_server_tags.py
#
# 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 l... |
ivy/ivy/ivy_dafny_lexer.py | b1f6c1c4/cfg-enum | 113 | 9598640 | <filename>ivy/ivy/ivy_dafny_lexer.py<gh_stars>100-1000
#
# Copyright (c) Microsoft Corporation. All Rights Reserved.
#
import ply.lex as lex
tokens = (
'COMMA',
'LPAREN',
'RPAREN',
'PLUS',
'MINUS',
'TIMES',
'TILDA',
'AND',
'OR',
'EQ',
'TILDAEQ',
'SEMI',
'ASSIGN',
'DOT',
'LC... |
ports/nxp_lpc546/tests/sensors.py | ZHENGJIANG1997/OPENMV-RT106X | 181 | 9598658 | # maooled.py -- put your code here!
import pyb
import os
# I2C address:
#pressure (MPL3115A2): 0x60 (96)
#Accel (MMA8652FC): 0x1D (29)
#Accel FXAS21002_I2C_ADDR 0x20 (32)
class frdm_fxs_multi2_b:
def __init__(self, busNdx=0):
i = pyb.I2C(busNdx, baudrate=400000)
self.bus = i
self.scales = [0.0, 0.0, 0.0]
sel... |
falcon_kit/mains/task_report_pre_assembly.py | peterjc/FALCON | 216 | 9598667 | <filename>falcon_kit/mains/task_report_pre_assembly.py
from __future__ import absolute_import
import argparse
import logging
import os
import sys
from .. import io
from .. import bash
from .. import run_support
LOG = logging.getLogger()
def run(config_fn, length_cutoff_fn, raw_reads_db_fn, preads_fofn_fn, pre_assem... |
third_party/httplib2/python2/httplib2/test/test_no_socket.py | Martijnve23/catapult | 1,894 | 9598679 | """Tests for httplib2 when the socket module is missing.
This helps ensure compatibility with environments such as AppEngine.
"""
import os
import sys
import unittest
import httplib2
class MissingSocketTest(unittest.TestCase):
def setUp(self):
self._oldsocks = httplib2.socks
httplib2.socks = Non... |
mastermind/pid.py | gap892003/mastermind | 389 | 9598681 | import os
def filename(host, port):
return "/var/tmp/mastermind.{}{}.pid".format(host.replace('.', ''), port)
def get():
return os.getpid()
def create(pid_filename, pid_number):
with open(pid_filename, "w") as f:
f.write(str(pid_number))
def read(pid_filename):
with open(pid_filename, "r... |
scripts/sptk/libs/data_handler.py | unanan/setk | 280 | 9598687 | #!/usr/bin/env python
# wujian@2018
import os
import sys
import glob
import codecs
import pickle
import random
import warnings
import _thread
import threading
import subprocess
from pathlib import Path
import librosa as audio_lib
import numpy as np
import scipy.io as sio
from io import TextIOWrapper, BytesIO
from ... |
tools/Polygraphy/polygraphy/json/__init__.py | leo0519/TensorRT | 5,249 | 9598691 | <filename>tools/Polygraphy/polygraphy/json/__init__.py
from polygraphy.json.serde import *
|
src/pages/urls.py | osnippet/docker-django-example | 571 | 9598695 | <reponame>osnippet/docker-django-example
from django.urls import path
from pages import views
urlpatterns = [
path("", views.home, name="home"),
path("up", views.up, name="up"),
]
|
docs/developer/.scripts/00_set_root.py | vbarbaresi/integrations-core | 663 | 9598723 | <reponame>vbarbaresi/integrations-core<gh_stars>100-1000
import os
from datadog_checks.dev.tooling.constants import get_root, set_root
def patch(lines):
"""This ensures the root directory is set for subsequent scripts using ddev tooling."""
if not get_root():
set_root(os.getcwd())
|
evaluation/results/tr3/plot_task_solve_graph.py | cakiki/bigscience | 189 | 9598771 | <filename>evaluation/results/tr3/plot_task_solve_graph.py
import json
import os
from argparse import ArgumentParser
import numpy as np
from matplotlib import pyplot as plt
def get_args():
parser = ArgumentParser()
parser.add_argument('--input-files', type=lambda s: s.split(','), required=True, help='Input fi... |
mimic/test/test_flavors.py | ksheedlo/mimic | 141 | 9598780 | """
Tests for :mod:`nova_api` and :mod:`nova_objects` for flavors.
"""
from __future__ import absolute_import, division, unicode_literals
from twisted.trial.unittest import SynchronousTestCase
from mimic.test.helpers import json_request, request
from mimic.rest.nova_api import NovaApi
from mimic.test.fixtures import... |
hatsploit/payloads/linux/x64/reboot.py | enty8080/HatSplo | 139 | 9598811 | #!/usr/bin/env python3
#
# This payload requires HatSploit: https://hatsploit.netlify.app
# Current source: https://github.com/EntySec/HatSploit
#
from hatsploit.lib.payload import Payload
class HatSploitPayload(Payload):
details = {
'Category': "stager",
'Name': "Linux x64 Reboot",
'Pay... |
tests/scheduler/test_base.py | monosidev/monosi | 156 | 9598817 | import os
import pytest
from sqlalchemy.engine.mock import create_mock_engine
import scheduler.base as base
## JobStore Tests
@pytest.fixture
def connection_string():
db_config = {
"type": "postgresql",
"user": os.getenv('DB_USER'),
"password": os.getenv('DB_PASSWORD'),
"host": os.... |
proximal/examples/test_poisson.py | kyleaj/ProxImaL | 101 | 9598823 | # Proximal
import sys
sys.path.append('../../')
from proximal.utils.utils import *
from proximal.halide.halide import *
from proximal.lin_ops import *
from proximal.prox_fns import *
from proximal.algorithms import *
import numpy as np
from scipy import ndimage
import matplotlib.pyplot as plt
import cv2
###########... |
test/python/echo_args.py | WrkMetric/Python--NodeJS | 1,869 | 9598831 | <filename>test/python/echo_args.py
import sys
# simple argument echo script
for v in sys.argv[1:]:
print(v)
|
simglucose/analysis/report.py | pcriadoperez/simglucose | 129 | 9598846 | import glob
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
from matplotlib.collections import PatchCollection
# from pandas.plotting import lag_plot
import logging
logger = logging.getLogger(__name__)
def ensemble_BG(BG, ax=None, plot_var=False, nst... |
example_project/articles/admin.py | pnuckowski/django-guardian | 2,469 | 9598873 | <gh_stars>1000+
from django.contrib import admin
from .models import Article
class ArticleAdmin(admin.ModelAdmin):
list_display = ('title', 'slug', 'created_at')
list_filter = ('created_at',)
search_fields = ('title',)
admin.site.register(Article, ArticleAdmin)
|
oracle/datadog_checks/oracle/config_models/validators.py | mchelen-gov/integrations-core | 663 | 9598879 | # (C) Datadog, Inc. 2021-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
def initialize_instance(values, **kwargs):
# TODO: remove when deprecation is finalized https://github.com/DataDog/integrations-core/pull/9340
if 'username' not in values and 'user' in values:
... |
homeassistant/components/goodwe/sensor.py | mtarjoianu/core | 30,023 | 9598889 | <filename>homeassistant/components/goodwe/sensor.py
"""Support for GoodWe inverter via UDP."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import Any
from goodwe import Inverter, Sensor, SensorKind
from homeassistant.components.sensor import (... |
calvin/Tools/calvindoc.py | gabrielcercel/calvin-base | 334 | 9598895 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
scripts/in_container/check_junitxml_result.py | takuti/airflow | 8,092 | 9598960 | #!/usr/bin/env python
# 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
# "Li... |
Web_Scraping/bitcoin.py | heykush/Youtube | 152 | 9598964 | import requests
res = requests.get('https://www.zebapi.com/api/v1/market/ticker/btc/inr')
data = res.json()
print("Buy at : Rs", data['buy'])
print("Sell at : Rs", data['sell'])
|
python/example.py | enobufs/librtcdc | 281 | 9598973 | <filename>python/example.py
#!/usr/bin/env python
import pyrtcdc
import base64
def on_channel(peer, channel):
print 'new channel %s created' %(channel.label)
channel.on_message = on_message
def on_candidate(peer, candidate):
print 'local candidate sdp:\n%s' %(candidate)
def on_message(channel, datatype, data)... |
tests/pyscript/raises_exception.py | dhellmann/cmd2 | 469 | 9598977 | <filename>tests/pyscript/raises_exception.py
#!/usr/bin/env python
# coding=utf-8
"""
Example demonstrating what happens when a Python script raises an exception
"""
1 + 'blue'
|
examples/pybullet/gym/pybullet_envs/minitaur/agents/baseline_controller/model_predictive_control.py | felipeek/bullet3 | 9,136 | 9598989 | <reponame>felipeek/bullet3<gh_stars>1000+
# Lint as: python3
"""Classic model predictive control methods."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from typing import Sequence
import numpy as np
_MAX_ABS_RPY = 0.3
_MAX_ABS_ANGULAR_VELO... |
December-22/python_UjjwalPrahladka_Dec22.py | UjjwalPrahladka/A-December-of-Algorithms-2019 | 228 | 9598994 | def alt_balls(N, arr):
for i in range(N):
count = 1
if arr[i] == 'B':
is_previous_blue = True
else:
is_previous_blue = False
for j in range(i+1,N):
if (arr[j] == 'R' and is_previous_blue) or (arr[j] == 'B' and not is_previous_blue):
... |
src/visualization.py | 29ayush/simple_dqn | 767 | 9599009 | <filename>src/visualization.py
from neon.data import ArrayIterator
from nvis.callbacks import DeconvCallback
from nvis.figure import deconv_summary_page
from nvis.data import h5_deconv_data
import h5py
def visualize(model, data, max_fm, filename):
data_shape = data.shape
data = data.reshape((data.shape[0], -1))
... |
Fusion360CommandBase.py | tapnair/NESTER | 175 | 9599019 | <filename>Fusion360CommandBase.py
import adsk.core, adsk.fusion, traceback
handlers = []
# Removes the command control and definition
def cleanUpNavDropDownCommand(cmdId, DC_CmdId):
objArrayNav = []
dropDownControl_ = commandControlById_in_NavBar(DC_CmdId)
commandControlNav_ = commandControlById_i... |
envpool/make_test.py | sail-sg/envpool | 330 | 9599051 | # Copyright 2021 Garena Online Private Limited
#
# 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 agr... |
test/rosdistro_check_urls_test.py | JStech/rosdistro | 617 | 9599107 | #!/usr/bin/env python
import os
from rosdistro import get_index
from scripts import eol_distro_names
from scripts.check_rosdistro_urls import main as check_rosdistro_urls
from .fold_block import Fold
FILES_DIR = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
def test_rosdistro_ur... |
manage.py | candeias/django-mailer-python3 | 466 | 9599120 | #!/usr/bin/env python
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"mailer",
],
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":memory:",
... |
great_expectations/profile/json_schema_profiler.py | vanderGoes/great_expectations | 6,451 | 9599122 | import logging
from enum import Enum
from typing import Any, Dict, List, Optional
import jsonschema
from great_expectations.core.expectation_configuration import ExpectationConfiguration
from great_expectations.core.expectation_suite import ExpectationSuite
from great_expectations.profile.base import Profiler, Profil... |
run_tests.py | samyoo78/NearPy | 624 | 9599151 | #! /usr/bin/env python
import pytest
if __name__ == '__main__':
pytest.main()
|
tests/test_points.py | crsanderford/brainrender | 226 | 9599170 | from brainrender import Scene
from brainrender.actors import Points, Point, PointsDensity
import numpy as np
from brainrender.actor import Actor
import random
import pytest
def get_n_random_points_in_region(region, N):
"""
Gets N random points inside (or on the surface) of a mes
"""
region_bounds = ... |
demo_floder.py | niloofarAzari/SFSegNets | 264 | 9599190 | import os
import logging
import time
import argparse
import datetime
from PIL import Image
import numpy as np
import cv2
import torch
from torch.backends import cudnn
import torchvision.transforms as transforms
from network import get_net
from optimizer import restore_snapshot
from datasets import cityscapes
from co... |
util/siap.py | juandesant/astrometry.net | 460 | 9599213 | <gh_stars>100-1000
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE
from __future__ import print_function
from xml.dom import minidom, Node
import numpy as np
from astrometry.util.fits import *
def siap_parse_result(fn=None, txt=None):
if fn is not None:
... |
src/cfnlint/rules/functions/Join.py | Adam-sHub/cfn-lint | 1,134 | 9599256 | <gh_stars>1000+
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import six
from cfnlint.rules import CloudFormationLintRule
from cfnlint.rules import RuleMatch
from cfnlint.helpers import RESOURCE_SPECS, VALID_PARAMETER_TYPES_LIST
class Join(CloudFormationLint... |
unit2/spiders/spider_9_blog.py | nulearn3296/scrapy-training | 182 | 9599287 | <reponame>nulearn3296/scrapy-training<gh_stars>100-1000
import scrapy
class BlogCrawler(scrapy.Spider):
name = 'blog'
start_urls = ['http://blog.scrapinghub.com']
def parse(self, response):
for post_url in response.css('h2.entry-title > a::attr(href)').extract():
yield scrapy.Request(... |
applications/badslam/scripts/auto_tune_parameters.py | zimengjiang/badslam | 541 | 9599304 | <filename>applications/badslam/scripts/auto_tune_parameters.py
# coding=utf-8
# Copyright 2019 ETH Zürich, <NAME>
#
# 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 abo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.