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 |
|---|---|---|---|---|
mechanisms/swig/mechanisms/mbtbDefaultOptions.py | fperignon/sandbox | 137 | 11011994 | """"Default values for bodies and contact parameters.
Should be change in bodydef.py if needed.
"""
from siconos.mechanisms import mbtb
import numpy as np
import array
mbtb.MBTB_MAX_BODIES_NUMBER
mbtb.MBTB_MAX_CONTACTS_NUMBER
mbtb.MBTB_MAX_JOINTS_NUMBER
initVel = np.array([(0, 0, 0, 0, 0, 0)
for i... |
utils/data/structures/boxlist_ops.py | rs9899/Parsing-R-CNN | 289 | 11011997 | <reponame>rs9899/Parsing-R-CNN<filename>utils/data/structures/boxlist_ops.py
import torch
import numpy as np
from utils.data.structures.bounding_box import BoxList
from models.ops import nms as _box_nms
from models.ops import ml_nms as _box_ml_nms
from models.ops import boxes as box_utils
def boxlist_nms(boxlist, nm... |
scripts/setup.py | kbuffington/foo_spider_monkey_panel | 189 | 11012006 | #!/usr/bin/env python3
import argparse
import importlib
import importlib.util
import sys
import traceback
from pathlib import Path
from typing import Union
import call_wrapper
import download_submodules
import configure_scintilla
import patch_submodules
import unpack_mozjs
PathLike = Union[str, Path]
def call_decor... |
scripts/automation/regression/stateless_tests/stl_benchmark_test.py | timgates42/trex-core | 956 | 11012022 | <filename>scripts/automation/regression/stateless_tests/stl_benchmark_test.py
#!/router/bin/python
from .stl_general_test import CStlGeneral_Test, CTRexScenario
from trex_stl_lib.api import *
import os, sys
from collections import deque
from time import time, sleep
import pprint
class STLBenchmark_Test(CStlGeneral_Tes... |
notebook/datetime_now_today.py | vhn0912/python-snippets | 174 | 11012025 | <gh_stars>100-1000
import datetime
dt_now = datetime.datetime.now()
print(dt_now)
# 2019-02-04 21:04:15.412854
print(type(dt_now))
# <class 'datetime.datetime'>
print(dt_now.tzinfo)
# None
print(dt_now.strftime('%Y年%m月%d日 %H:%M:%S'))
# 2019年02月04日 21:04:15
print(type(dt_now.strftime('%Y年%m月%d日 %H:%M:%S')))
# <cla... |
examples/rgb.py | tgolsson/appJar | 666 | 11012063 | <filename>examples/rgb.py
import sys
sys.path.append("../")
from appJar import gui
# funciton to handle the button presses
def btnPress(btnName):
if btnName == "Reset":
app.setSpinBox("redSpin", 0)
app.setSpinBox("greSpin", 0)
app.setSpinBox("bluSpin", 0)
elif btnName == "Log":
... |
drf_admin/apps/information/urls.py | guohaihan/myproject | 228 | 11012088 | # -*- coding: utf-8 -*-
"""
@author : <NAME>
@github : https://github.com/tianpangji
@software : PyCharm
@file : urls.py
@create : 2020/11/7 14:05
"""
from django.urls import path
from information.views import centre
urlpatterns = [
path('change-password/', centre.ChangePasswordAPIView.as_view()), #... |
sdk/batch/azure-batch/azure/batch/models/_batch_service_client_enums.py | rsdoherty/azure-sdk-for-python | 2,728 | 11012091 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
refinery/bnpy/bnpy-dev/bnpy/data/__init__.py | csa0001/Refinery | 103 | 11012117 | from .DataObj import DataObj
from .XData import XData
from .WordsData import WordsData
from .GraphData import GraphData
from .MinibatchIterator import MinibatchIterator
from .AdmixMinibatchIterator import AdmixMinibatchIterator
from .AdmixMinibatchIteratorDB import AdmixMinibatchIteratorDB
__all__ = ['DataObj', 'Words... |
docs/user_guide/device_iterations.py | gglin001/poptorch | 128 | 11012119 | # Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import sys
import poptorch
if not poptorch.ipuHardwareIsAvailable():
print("Replicated top level graphs are not supported on the IPU model")
sys.exit(0)
# pylint: disable=unused-variable, wrong-import-position, reimported, ungrouped-imports, wrong-import... |
tests/tasks/twisted_command.py | facebook/sparts | 220 | 11012130 | # Copyright (c) 2014, Facebook, Inc. 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. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
from sparts.tasks.twisted_comman... |
examples/ami/sd0/local/experiment.py | jerryuhoo/PaddleSpeech | 1,379 | 11012163 | <gh_stars>1000+
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... |
dashboard/dashboard/pinpoint/models/exploration_test.py | tingshao/catapult | 1,894 | 11012175 | <filename>dashboard/dashboard/pinpoint/models/exploration_test.py<gh_stars>1000+
# Copyright 2019 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
from __future__ import division
from __... |
qf_lib/common/utils/factorization/data_models/rolling_window_estimation.py | webclinic017/qf-lib | 198 | 11012181 | <filename>qf_lib/common/utils/factorization/data_models/rolling_window_estimation.py
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... |
gluon/gluoncv2/models/jasper.py | naviocean/imgclsmob | 2,649 | 11012182 | <gh_stars>1000+
"""
Jasper/DR for ASR, implemented in Gluon.
Original paper: 'Jasper: An End-to-End Convolutional Neural Acoustic Model,' https://arxiv.org/abs/1904.03288.
"""
__all__ = ['Jasper', 'jasper5x3', 'jasper10x4', 'jasper10x5', 'get_jasper', 'MaskConv1d', 'NemoAudioReader',
'NemoMelSpecExt... |
tests/unit/lib/utilities/test_si_units.py | swatishs/liota | 361 | 11012191 | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------#
# Copyright © 2017 VMware, Inc. All Rights Reserved. #
# #
# Licensed under the BSD 2-Clause License (the “License”); y... |
src/lambda_codebase/initial_commit/bootstrap_repository/adf-bootstrap/deployment/lambda_codebase/initial_commit/tests/test_initial_commit.py | StewartW/aws-deployment-framework | 490 | 11012197 | <reponame>StewartW/aws-deployment-framework
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# pylint: skip-file
from mock import Mock, patch
from initial_commit import (
FileToDelete,
get_files_to_delete,
)
FILES_IN_UPSTREAM_REPO = [
'some.yml',... |
Behavioral/TemplateMethod/python/prepare_shake.py | jerryshueh/design-patterns | 294 | 11012244 | class ShakePreparationTemplate:
def add_sugar(self): pass
def add_main_ingredients(self): pass
def prepare_ice(self):
print("Crushing Ice for shake")
def serve(self):
print("Hello customer, here is your freshly made shake!");
def blend(self):
print("Revving up the blende... |
sdk/python/lib/pulumi/runtime/resource_cycle_breaker.py | pcen/pulumi | 12,004 | 11012264 | <reponame>pcen/pulumi
# Copyright 2016-2021, Pulumi Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
configs/_base_/det_datasets/ctw1500.py | yuexy/mmocr | 2,261 | 11012279 | dataset_type = 'IcdarDataset'
data_root = 'data/ctw1500'
train = dict(
type=dataset_type,
ann_file=f'{data_root}/instances_training.json',
img_prefix=f'{data_root}/imgs',
pipeline=None)
test = dict(
type=dataset_type,
ann_file=f'{data_root}/instances_test.json',
img_prefix=f'{data_root}/im... |
notebook/sys_argv_test.py | vhn0912/python-snippets | 174 | 11012284 | import sys
print('sys.argv : ', sys.argv)
print('type(sys.argv) : ', type(sys.argv))
print('len(sys.argv) : ', len(sys.argv))
print()
print('sys.argv[0] : ', sys.argv[0])
print('sys.argv[1] : ', sys.argv[1])
print('sys.argv[2] : ', sys.argv[2])
print('type(sys.argv[0]): ', type(sys.argv[0... |
tests/test_shell_util.py | neuralvis/SmartSim | 117 | 11012303 | import psutil
import pytest
from smartsim.launcher.util.shell import *
def test_execute_cmd():
returncode, out, err = execute_cmd(["hostname"])
assert isinstance(returncode, int)
assert isinstance(out, str)
assert isinstance(err, str)
def test_execute_async_cmd():
proc = execute_async_cmd(["ho... |
rst2pdf/nodehandlers.py | idryzhov/rst2pdf | 493 | 11012317 | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
# Import all node handler modules here.
# The act of importing them wires them in.
from . import genelements # noqa
from . import genpdftext # noqa
# sphinxnodes needs these
from .genpdftext import NodeHandler, FontHandler, HandleEmphasis # noqa
# cre... |
Algo and DSA/LeetCode-Solutions-master/Python/find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11012331 | <filename>Algo and DSA/LeetCode-Solutions-master/Python/find-the-minimum-number-of-fibonacci-numbers-whose-sum-is-k.py<gh_stars>1000+
# Time: O(logk)
# Space: O(1)
class Solution(object):
def findMinFibonacciNumbers(self, k):
"""
:type k: int
:rtype: int
"""
result, a, b = ... |
crf_predict.py | HCY123902/Bert-BiLSTM-CRF-pytorch | 158 | 11012338 | # -*- encoding: utf-8 -*-
'''
@File : predict.py
@Time : 2019/12/27 19:20:51
@Author : <NAME>
@Version : 1.0
@Contact : <EMAIL>
@License : (C)Copyright 2018-2019, MILAB_SCU
@Desc : BERT-BILSTM-CRF FOR BER
'''
import torch
import os
import sys
# sys.path.append('/root/workspace/Bert-BiLSTM-CRF-p... |
panel/template/fast/grid/__init__.py | datalayer-contrib/holoviz-panel | 1,130 | 11012390 | <reponame>datalayer-contrib/holoviz-panel
"""
The Fast GridTemplate provides a grid layout based on React Grid
Layout similar to the Panel ReactTemplate but in the Fast.design style
and enabling the use of Fast components.
"""
import pathlib
import param
from ..base import FastGridBaseTemplate
from ..theme import Fas... |
contrib/libs/onnx/onnx/backend/base.py | HeyLey/catboost | 6,989 | 11012397 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from typing import Text, Sequence, Any, Type, Tuple, NewType, Optional, Dict
import six
import numpy # type: ignore
import onnx.chec... |
剑指offer/28_StringPermutation(字符串全排列).py | PegasusWang/python_data_structures_and_algorithms | 2,468 | 11012404 | """
面试题28:字符串的排列
题目:输入一个字符串,打印出该字符串中字符的所有排列。
例如输入字符串abc,则打印出由字符a、b、c所能排列出来的所有字符串abc、acb、bac、bca、cab和cba。
https://leetcode.com/problems/permutations/
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[... |
telemetry/telemetry/command_line/parser.py | Martijnve23/catapult | 1,894 | 11012413 | # 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.
"""Builds the command line parser, processes args, and runs commands."""
from __future__ import absolute_import
import argparse
import logging
import sys
fr... |
generator/src/googleapis/codegen/php_generator.py | romulobusatto/google-api-php-client-services | 709 | 11012435 | #!/usr/bin/python2.7
# 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 requi... |
Python/ml_metrics/auc.py | aidiot/Metrics | 1,411 | 11012441 |
def tied_rank(x):
"""
Computes the tied rank of elements in x.
This function computes the tied rank of elements in x.
Parameters
----------
x : list of numbers, numpy array
Returns
-------
score : list of numbers
The tied rank f each element in x
"""
sorted_x... |
ott/core/momentum.py | theouscidda6/ott | 110 | 11012450 | <reponame>theouscidda6/ott
# coding=utf-8
# Copyright 2022 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 b... |
src/rewriter/rewriter.gyp | dextero/mozc | 1,144 | 11012456 | <reponame>dextero/mozc
# Copyright 2010-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:
#
# * Redistributions of source code must retain the above copyright
# notice, this ... |
test/test_slimta_queue_dict.py | nanojob/python-slimta | 141 | 11012468 | import unittest
import re
from slimta.queue.dict import DictStorage
from slimta.envelope import Envelope
class TestDictStorage(unittest.TestCase):
id_pattern = re.compile(r'[0-9a-fA-F]{32}')
def setUp(self):
self.env = {}
self.meta = {}
self.dict = DictStorage(self.env, self.meta)
... |
elliot/evaluation/metrics/novelty/EFD/__init__.py | gategill/elliot | 175 | 11012498 | <reponame>gategill/elliot
from .efd import EFD
from .extended_efd import ExtendedEFD |
ioflo/aio/udp/udping.py | BradyHammond/ioflo | 128 | 11012505 | """
udp async (nonblocking) io module
"""
from __future__ import absolute_import, division, print_function
import sys
import os
import socket
import errno
from binascii import hexlify
# Import ioflo libs
from ...aid.sixing import *
from ...aid.consoling import getConsole
console = getConsole()
UDP_MAX_DATAGRAM_SIZ... |
luigi/freezing.py | shouldsee/luigi | 14,755 | 11012532 | <filename>luigi/freezing.py
"""Internal-only module with immutable data structures.
Please, do not use it outside of Luigi codebase itself.
"""
from collections import OrderedDict
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
import operator
import functools
c... |
data/routesonline/extract_newsletter.py | mtrampont/opentraveldata | 208 | 11012536 | #!/usr/bin/env python3
import requests
import datetime
from bs4 import BeautifulSoup
import re
import sys
SEP = "â"
def is_schedule_line(line):
if not SEP in line:
return False
# remove double spaces
line = re.sub(' +', ' ', line)
blocks = [block.strip() for block in line.split(SEP)]
# w... |
modelchimp/admin.py | samzer/modelchimp-server | 134 | 11012544 | from django.contrib import admin
from .models.experiment import Experiment
from .models.comment import Comment
from .models.profile import Profile
from .models.invitation import Invitation
from .models.user import User
from modelchimp.models.experiment_custom_object import ExperimentCustomObject
from modelchimp.models.... |
topicnet/cooking_machine/cubes/greedy_strategy.py | DmitriyValetov/TopicNet | 123 | 11012546 | import numpy as np
from .strategy import BaseStrategy
class GreedyStrategy(BaseStrategy):
"""
Allows to visit nodes of parameters' grid in a particular order.
The rough idea:
We are given grid of (values1 x values2 x values3).
This strategy will find best value among points of form [v... |
apps/beeswax/src/beeswax/server/hive_metastore_server.py | yetsun/hue | 5,079 | 11012552 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... |
models/__init__.py | chnoguchi/superpixel_fcn | 291 | 11012568 | <reponame>chnoguchi/superpixel_fcn
from .Spixel_single_layer import *
|
packs/icinga2/sensors/lib/client.py | userlocalhost2000/st2contrib | 164 | 11012571 | <gh_stars>100-1000
# pylint: disable=no-member
import json
import urllib
import signal
import time
import pycurl
POST_PARAMS = {}
class Client:
def __init__(self, sensor, api_url, api_user, api_password):
if sensor is not None:
self._sensor = sensor
else:
self._sensor = No... |
code/visualize.py | hyungkwonko/DanbooRegion | 292 | 11012589 | from tricks import *
def vis(region_map, color_map):
color = d_resize(color_map, region_map.shape)
indexs = (region_map.astype(np.float32)[:, :, 0] * 255 + region_map.astype(np.float32)[:, :, 1]) * 255 + region_map.astype(np.float32)[:, :, 2]
result = np.zeros_like(color, dtype=np.uint8)
for ids in [n... |
tests/integration/misc/test_render.py | daattali/dashR | 396 | 11012590 | <reponame>daattali/dashR
def click_undo(self):
undo_selector = "._dash-undo-redo span:first-child div:last-child"
undo = self.wait_for_element_by_css_selector(undo_selector)
self.wait_for_text_to_equal(undo_selector, "undo")
undo.click()
def click_redo(self):
redo_selector = "._dash-undo-redo span... |
DQM/HLTEvF/test/hlt_dqm_sourceclient-file_cfg.py | ckamtsikis/cmssw | 852 | 11012597 | <filename>DQM/HLTEvF/test/hlt_dqm_sourceclient-file_cfg.py
import FWCore.ParameterSet.Config as cms
process = cms.Process("DQM")
process.load("DQMServices.Core.DQM_cfg")
process.load("DQM.HLTEvF.HLTMonitor_cff")
process.load("DQM.HLTEvF.HLTMonitorClient_cff")
process.load("DQM.TrigXMonitor.HLTScalers_cfi")
process.lo... |
applications/ShapeOptimizationApplication/python_scripts/loggers/design_logger_vtk.py | lkusch/Kratos | 778 | 11012599 | # ==============================================================================
# KratosShapeOptimizationApplication
#
# License: BSD License
# license: ShapeOptimizationApplication/license.txt
#
# Main authors: <NAME>, https://github.com/dbaumgaertner
# <NAME>, https:... |
third_party/gsutil/gslib/tests/test_hashing_helper.py | tingshao/catapult | 2,151 | 11012602 | # -*- coding: utf-8 -*-
# Copyright 2014 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 require... |
hydrus/app_factory.py | Dhairya3124/hydrus | 214 | 11012609 | <reponame>Dhairya3124/hydrus
from flask import Flask
def app_factory(api_name: str = "api", vocab_route: str = "vocab") -> Flask:
"""
Create an app object
:param api_name : Name of the api
:param vocab_route : The route at which the vocab of the apidoc is present
:return : API with all routes dire... |
ofa/stereo_matching/networks/estimation.py | blackjack2015/once-for-all | 388 | 11012623 | <filename>ofa/stereo_matching/networks/estimation.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class DisparityEstimation(nn.Module):
def __init__(self, max_disp, match_similarity=True):
super(DisparityEstimation, self).__init__()
self.max_disp = max_disp
self.matc... |
mlfromscratch/supervised_learning/particle_swarm_optimization.py | leeh8911/ML-From-Scratch | 22,453 | 11012674 | from __future__ import print_function, division
import numpy as np
import copy
class ParticleSwarmOptimizedNN():
""" Particle Swarm Optimization of Neural Network.
Parameters:
-----------
n_individuals: int
The number of neural networks that are allowed in the population at a time.
model_b... |
tools/win/split_link/check_installed.py | kjthegod/chromium | 231 | 11012675 | <filename>tools/win/split_link/check_installed.py
# Copyright (c) 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.
import os
import sys
def IsAvailable():
_winreg = None
if sys.platform == 'win32':
import _wi... |
make_wordvectors.py | baajur/wordvectors | 2,188 | 11012683 | # coding: utf-8
#!/usr/bin/python2
import nltk
import os
import codecs
import argparse
import numpy as np
# arguments setting
parser = argparse.ArgumentParser()
parser.add_argument('--lcode', help='ISO 639-1 code of target language. See `lcodes.txt`.')
parser.add_argument('--vector_size', type=int, default=100, help=... |
print_constant.py | manailin/tensorflow___examples | 156 | 11012702 | <gh_stars>100-1000
#!/usr/bin/env python
import tensorflow as tf
print("Run TensorFlow to multiple numbers")
import pudb;pudb.set_trace()
number = tf.constant(3)
with tf.Session() as sess:
print(sess.run(number))
print("End of TensorFlow")
|
Game28/modules/__init__.py | ttkaixin1998/pikachupythongames | 4,013 | 11012711 | <reponame>ttkaixin1998/pikachupythongames
'''初始化'''
from .interfaces import *
from .gamelevels import GameLevels |
pylib/poly.py | akiernan/ntpsec | 201 | 11012743 | # -*- coding: utf-8 -*-
# SPDX-License-Identifier: BSD-2-Clause
"""Handle bytes and strings in a polyglot fashion.
copied from ../ntpclient/ntpq.py which got it from
https://gitlab.com/esr/practical-python-porting/blob/master/polystr-inclusion.py
see http://www.catb.org/esr/faqs/practical-python-porting/ for more inf... |
tests/components/shelly/test_logbook.py | MrDelik/core | 22,481 | 11012747 | """The tests for Shelly logbook."""
from homeassistant.components import logbook
from homeassistant.components.shelly.const import (
ATTR_CHANNEL,
ATTR_CLICK_TYPE,
ATTR_DEVICE,
DOMAIN,
EVENT_SHELLY_CLICK,
)
from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.setup import async_setup_co... |
lyrebird/mock/plugin_manager/plugin_view.py | echoyang7/lyrebird | 223 | 11012766 | <reponame>echoyang7/lyrebird
from jinja2 import Environment, PackageLoader
from flask import send_from_directory
import sys
import os
import inspect
import codecs
class Rule:
"""
视图路由规则
"""
def __init__(self, rule, endpotion, view_func=None, **options):
self.rule = rule
self.endpoint... |
angr/engines/pcode/arch/ArchPcode_80390_BE_24_default.py | matthewpruett/angr | 6,132 | 11012782 | ###
### This file was automatically generated
###
from archinfo.arch import register_arch, Endness, Register
from .common import ArchPcode
class ArchPcode_80390_BE_24_default(ArchPcode):
name = '80390:BE:24:default'
pcode_arch = '80390:BE:24:default'
description = '80390 in flat mode'
bits = 16
... |
union_arrays.py | deepak5998/Py | 726 | 11012794 | <reponame>deepak5998/Py
# Problem: Given two sorted array of sizes m and n
# in which all elements are distinct. Find the
# union between them
# Constraints: in O(m+n) complexity.
def unionArrays(x, y, m, n):
union_arr = []
for i in range(m):
union_arr.append(x[i])
for j in range(n):
if y[j] not in u... |
contributions/tests/parser.py | t170815518/contributions-graph | 106 | 11012809 | #!/usr/bin/env python
"""
Unit tests for contributions.parser.
"""
from collections import defaultdict
import datetime
import logging
import os
import sys
import unittest
sys.path.append(os.getcwd())
from contributions import parser
logging.disable(logging.CRITICAL)
def _testfile(filename):
return os.path.join(... |
tests/components/fritzbox/test_diagnostics.py | MrDelik/core | 30,023 | 11012811 | <reponame>MrDelik/core
"""Tests for the AVM Fritz!Box integration."""
from __future__ import annotations
from unittest.mock import Mock
from aiohttp import ClientSession
from homeassistant.components.diagnostics import REDACTED
from homeassistant.components.fritzbox.const import DOMAIN as FB_DOMAIN
from homeassistan... |
src/wechaty/user/favorite.py | PIG208/python-wechaty | 640 | 11012844 | <filename>src/wechaty/user/favorite.py
"""
Python Wechaty - https://github.com/wechaty/python-wechaty
Authors: <NAME> (李卓桓) <https://github.com/huan>
<NAME> (吴京京) <https://github.com/wj-Mcat>
2020-now @ Copyright Wechaty
Licensed under the Apache License, Version 2.0 (the 'License');
you may not use t... |
webpage/migrations/versions/236b966ecd2f_.py | mckinziebrandon/seq2seq_projects | 341 | 11012846 | <gh_stars>100-1000
"""empty message
Revision ID: 236b966ecd2f
Revises:
Create Date: 2017-05-03 14:27:37.853971
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '236b966ecd2f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ###... |
questions/60354837/main.py | LoicGRENON/stackoverflow | 302 | 11012847 | import configparser
from PyQt5 import QtCore, QtGui, QtWidgets
from main_ui import Ui_MainWindow
from autobowgui import AutoBowGui
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.Auto... |
kats/tests/detectors/test_robust_stat_detection.py | iamxiaodong/Kats | 3,580 | 11012867 | <filename>kats/tests/detectors/test_robust_stat_detection.py
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-unsafe
import math
import re
from operator import attrgetter
from unittest ... |
boost/libs/mpi/example/python/hello_world.py | randolphwong/mcsema | 12,278 | 11012877 | <filename>boost/libs/mpi/example/python/hello_world.py
# Copyright (C) 2006 <NAME> <<EMAIL>g.gregor -at- gmail.com>.
# Use, modification and distribution is subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import boost.para... |
tests/issues/test_issue502.py | abhicantdraw/pandas-profiling | 8,107 | 11012896 | <filename>tests/issues/test_issue502.py
"""
Test for issue 502:
https://github.com/pandas-profiling/pandas-profiling/issues/502
"""
import pandas as pd
from pandas_profiling.model.summary import describe_1d
def test_issue502(config, summarizer, typeset):
series = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 1... |
plenum/test/audit_ledger/conftest.py | andkononykhin/plenum | 148 | 11012898 | import pytest
from plenum.common.constants import CONFIG_LEDGER_ID, DOMAIN_LEDGER_ID, POOL_LEDGER_ID, AUDIT_LEDGER_ID
from plenum.server.batch_handlers.audit_batch_handler import AuditBatchHandler
@pytest.fixture(scope="module")
def node(txnPoolNodeSet):
return txnPoolNodeSet[0]
@pytest.fixture(scope="module")
d... |
torcms/handlers/static_handler.py | bukun/TorCMS | 243 | 11012944 | # -*- coding:utf-8 -*-
'''
All other static pages.
'''
import os
from torcms.core.base_handler import BaseHandler
class StaticHandler(BaseHandler):
'''
All other static pages.
'''
def initialize(self):
super().initialize()
def get(self, *args, **kwargs):
url_str = args[0]
... |
Calibration/EcalAlCaRecoProducers/python/ALCARECOEcalRecalIsolElectron_cff.py | ckamtsikis/cmssw | 852 | 11012982 | import FWCore.ParameterSet.Config as cms
import HLTrigger.HLTfilters.hltHighLevel_cfi
ALCARECOEcalRecalElectronHLT = HLTrigger.HLTfilters.hltHighLevel_cfi.hltHighLevel.clone(
andOr = True, # choose logical OR between Triggerbits
eventSetupPathsKey = 'EcalRecalElectron',
throw = False # tolerate triggers st... |
samples/main_menu_simple.py | hannahaih/ursina | 1,431 | 11012983 | from ursina import *
# Main Menu Example, or it can be any kind of menu, like Inventory, Quest journal, etc.
# Created by Doctor
# 09 Feb 21
# Class of game menu
class MenuMenu(Entity):
def __init__(self, **kwargs):
super().__init__(parent=camera.ui, ignore_paused=True)
# Create empty entities th... |
streamalert_cli/config.py | agoswami0915/streamalert | 2,770 | 11012985 | """
Copyright 2017-present Airbnb, 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 writing, sof... |
pyroomacoustics/doa/utils.py | Womac/pyroomacoustics | 915 | 11012993 | """
This module contains useful functions to compute distances and errors on on
circles and spheres.
"""
from __future__ import division
import numpy as np
def circ_dist(azimuth1, azimuth2, r=1.0):
"""
Returns the shortest distance between two points on a circle
Parameters
----------
azimuth1:
... |
qiskit/util.py | Roshan-Thomas/qiskit-terra | 1,599 | 11013006 | <reponame>Roshan-Thomas/qiskit-terra<filename>qiskit/util.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017.
#
# 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... |
orator/migrations/migration_creator.py | wjzero/orator | 1,484 | 11013012 | # -*- coding: utf-8 -*-
import os
import inflection
import datetime
import errno
from .stubs import CREATE_STUB, UPDATE_STUB, BLANK_STUB
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
... |
terraform/stacks/bot/lambdas/python/slack_automation_bot/slack_sdk/socket_mode/__init__.py | houey/cloud-sniper | 160 | 11013059 | <filename>terraform/stacks/bot/lambdas/python/slack_automation_bot/slack_sdk/socket_mode/__init__.py
from .builtin import SocketModeClient # noqa
|
pythran/tests/cases/blacksholes.py | davidbrochart/pythran | 1,647 | 11013079 | #runas BlackScholes(list(range(1,100)), list(range(1,100)), list(range(1,100)), 0.5, 0.76, 12)
#bench BlackScholes(list(range(1,400001)), list(range(1,400001)), list(range(1,400001)), 0.5, 0.76, 400000)
#pythran export BlackScholes(float list, float list, float list, float, float, int)
#pythran export BlackScholes(int ... |
src/acrtransfer/azext_acrtransfer/utility_functions.py | Mannan2812/azure-cli-extensions | 207 | 11013103 | <filename>src/acrtransfer/azext_acrtransfer/utility_functions.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ---... |
typic/__init__.py | wyfo/typical | 157 | 11013109 | <filename>typic/__init__.py
# flake8: noqa
from . import types, constraints
from .checks import *
from .constraints import *
from .ext.schema import *
from .klass import klass, field
from .types import *
from .util import *
# NOTE: This import must come *last*
from .api import *
al = typed
__version__ = "2.8.0"
|
ibm_watson/common.py | knishika/watson-developer-cloud-python-sdk | 1,579 | 11013143 | <filename>ibm_watson/common.py
# coding: utf-8
# Copyright 2019 IBM 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
#... |
test/test_bam.py | kmoad/GenomicSQLite | 114 | 11013148 | import os
import subprocess
import sqlite3
import genomicsqlite
HERE = os.path.dirname(__file__)
BUILD = os.path.abspath(os.path.join(HERE, "..", "build"))
def sam_into_sqlite(infilename, outfilename, *options):
cmd = (
[os.path.join(BUILD, "loaders/sam_into_sqlite")] + list(options) + [infilename, outfi... |
x_temporal/models/stresnet.py | Xlsean/X-Temporal | 492 | 11013162 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
from torch.nn.modules.utils import _triple
__all__ = [
'ResNet', 'stresnet10', 'stresnet18', 'stresnet34', 'stresnet50', 'stresnet101',
'stresnet152', 'stresnet200'
... |
testrpc/rpc.py | kanzure/eth-testrpc | 164 | 11013163 | <reponame>kanzure/eth-testrpc
import sys
import logging
import rlp
try:
from sha3 import keccak_256
except ImportError:
from sha3 import sha3_256 as keccak_256
from ethereum import blocks
from ethereum.tester import (
languages,
)
from .client import EthTesterClient
from .client.utils import (
force... |
questions/55685163/python-modules/plugin_loader.py | sesu089/stackoverflow | 302 | 11013178 | <reponame>sesu089/stackoverflow
#!/usr/bin/python
# -*- coding: utf-8 -*-
import importlib
import os
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from DialogoImprimir import DialogoImprimir
def iniciar(ruta):
print(ruta)
app = QtWidgets.QApplication.instance()
if app is None:
app = QtWidgets.QApplicatio... |
rl_coach/tests/conftest.py | Lpallett4/coach | 1,960 | 11013208 | #
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
yangify/__init__.py | chadell/yangify | 109 | 11013210 | <filename>yangify/__init__.py
from typing import Any, Dict, List
from yangson import instance
from yangson.datamodel import DataModel
def obj_from_raw(
library: str, paths: List[str], raw: Dict[str, Any]
) -> instance.RootNode:
dm = DataModel.from_file(library, paths)
return dm.from_raw(raw)
__all__ = ... |
audioBook/downloader.py | Yourrrrlove/spider_collection | 178 | 11013211 | import time
import requests
import parsel
import re
import os
import json
from ThreadPool import ThreadPool
class Downloader(object):
base_url="https://www.ishuyin.com"
php_url="https://www.ishuyin.com/e/extend/url.php?code="
def __init__(self, cl,id):
self.search_url="https://www.ishuyin.com/{... |
esphome/__main__.py | OttoWinter/esphomeyaml | 249 | 11013227 | import argparse
import functools
import logging
import os
import re
import sys
from datetime import datetime
from esphome import const, writer, yaml_util
import esphome.codegen as cg
from esphome.config import iter_components, read_config, strip_default_ids
from esphome.const import (
ALLOWED_NAME_CHARS,
CONF_... |
test/unit/master/test_atomizer.py | rsennewald/ClusterRunner | 164 | 11013328 | from unittest.mock import Mock
from app.master.atomizer import Atomizer, AtomizerError
from app.project_type.project_type import ProjectType
from app.util.process_utils import get_environment_variable_setter_command
from test.framework.base_unit_test_case import BaseUnitTestCase
_FAKE_ATOMIZER_COMMAND = 'find . -nam... |
.github/actions/PR_has_a_valid_issue/main.py | iamakkkhil/Rotten-Scripts | 1,127 | 11013338 | import os, re, requests
# Used pattern to search for Issues.
pattern = "#\d+"
# PR body
body = os.getenv("INPUT_PRBODY")
# PR URL
url = os.getenv("INPUT_PRURL")
issue_num = re.search(pattern, body)[0].replace("#", "")
# url list will be something like this
# ['https:', '', 'api.github.com', 'repos', 'owner', 'repo... |
xarray/core/dask_array_ops.py | mlhenderson/xarray | 2,257 | 11013339 | from . import dtypes, nputils
def dask_rolling_wrapper(moving_func, a, window, min_count=None, axis=-1):
"""Wrapper to apply bottleneck moving window funcs on dask arrays"""
import dask.array as da
dtype, fill_value = dtypes.maybe_promote(a.dtype)
a = a.astype(dtype)
# inputs for overlap
if a... |
parsers/GE.py | Macquaria/electricitymap-contrib | 1,582 | 11013343 | import logging
import datetime
import pandas as pd
import arrow
import requests
def fetch_production(zone_key='GE', session=None, target_datetime: datetime.datetime=None,
logger: logging.Logger=None) -> dict:
"""Requests the last known production mix (in MW) of a given country."""
r = ses... |
examples/situational-awareness/tools.py | chrisinmtown/PyMISP | 307 | 11013357 | <filename>examples/situational-awareness/tools.py<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from json import JSONDecoder
import pygal
from pygal.style import Style
import pandas
import numpy
from scipy import stats
from pytaxonomies import Taxonomies
import re
import matplotlib.pyplot as plt
from... |
examples/v3arch/asyncore/manager/ntfrcv/regexp-community-name.py | RKinsey/pysnmp | 492 | 11013358 | <reponame>RKinsey/pysnmp
"""
Serve SNMP Community names defined by regexp
++++++++++++++++++++++++++++++++++++++++++++
Receive SNMP TRAP/INFORM messages with the following options:
* SNMPv1/SNMPv2c
* with any SNMP community matching regexp '.*love.*'
* over IPv4/UDP, listening at 127.0.0.1:162
* print received data o... |
sagify/template/sagify_base/lambda/lambda_handler.py | rfdickerson/sagify | 352 | 11013364 | <filename>sagify/template/sagify_base/lambda/lambda_handler.py
import json
import os
import boto3
sagemaker_client = boto3.client('sagemaker-runtime', region_name=os.environ.get('REGION_NAME'))
sqs_client = boto3.client('sqs', region_name=os.environ.get('REGION_NAME'))
def lambda_handler(event, context):
record... |
src/ostorlab/apis/scan_list.py | bbhunter/ostorlab | 113 | 11013367 | """Lists the remote scans."""
from typing import Dict, Optional
import json
from ostorlab.apis import request
class ScansListAPIRequest(request.APIRequest):
"""Lists the remote scans."""
def __init__(self, page: int, elements: int):
self._page = page
self._elements = elements
@property... |
test/test_pipeline/components/feature_preprocessing/test_densifier.py | Louquinze/auto-sklearn | 6,390 | 11013374 | <reponame>Louquinze/auto-sklearn
import numpy as np
from autosklearn.pipeline.components.feature_preprocessing.densifier import Densifier
from autosklearn.pipeline.util import _test_preprocessing, PreprocessingTestCase
class DensifierComponentTest(PreprocessingTestCase):
def test_default_configuration(self):
... |
letstest/setup.py | aarongable/certbot | 16,789 | 11013386 | from setuptools import find_packages
from setuptools import setup
setup(
name='letstest',
version='1.0',
description='Test Certbot on different AWS images',
url='https://github.com/certbot/certbot',
author='Certbot Project',
author_email='<EMAIL>',
license='Apache License 2.0',
python_r... |
core/src/autogluon/core/searcher/bayesopt/tuning_algorithms/default_algorithm.py | zhiqiangdon/autogluon | 4,462 | 11013404 | <filename>core/src/autogluon/core/searcher/bayesopt/tuning_algorithms/default_algorithm.py
from typing import Optional, List
import logging
import numpy as np
from .base_classes import NextCandidatesAlgorithm
from ..autogluon.gp_fifo_searcher import GET_CONFIG_RANDOM_RETRIES, \
encode_state, create_initial_candida... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.