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 |
|---|---|---|---|---|
Algo and DSA/LeetCode-Solutions-master/Python/longest-substring-of-all-vowels-in-order.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11010443 | <reponame>Sourav692/FAANG-Interview-Preparation
# Time: O(n)
# Space: O(1)
class Solution(object):
def longestBeautifulSubstring(self, word):
"""
:type word: str
:rtype: int
"""
result = 0
l = cnt = 1
for i in xrange(len(word)-1):
if word[i] > wo... |
.modules/.recon-ng/recon/mixins/browser.py | termux-one/EasY_HaCk | 1,103 | 11010448 | <reponame>termux-one/EasY_HaCk
import mechanize
import socket
class BrowserMixin(object):
def get_browser(self):
'''Returns a mechanize.Browser object configured with the framework's global options.'''
br = mechanize.Browser()
# set the user-agent header
br.addheaders = [('User-age... |
lib/astc-encoder/Test/astc_trace_analysis.py | atteneder/KTX-Software | 619 | 11010459 | #!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------
# Copyright 2021 Arm 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 ... |
SRT/lib/xvision/transforms1v.py | yerang823/landmark-detection | 612 | 11010463 | <reponame>yerang823/landmark-detection
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from __future__ import division
import torch
import sys, math, random, PIL
from PIL... |
examples/fedprox/generate_configs.py | imec-int/federated-learning-lib | 294 | 11010479 | <filename>examples/fedprox/generate_configs.py
import os
from importlib import import_module
import examples.datahandlers as datahandlers
from examples.fedprox.model import MyModel
def get_fusion_config():
fusion = {
'name': 'IterAvgFusionHandler',
'path': 'ibmfl.aggregator.fusion.iter_avg_fusion... |
platypush/plugins/mail/smtp.py | RichardChiang/platypush | 228 | 11010513 | from email.message import Message
from typing import Optional, List
from smtplib import SMTP, SMTP_SSL
from platypush.plugins.mail import MailOutPlugin, ServerInfo
class MailSmtpPlugin(MailOutPlugin):
"""
Plugin to interact with a mail server over SMTP.
"""
_default_port = 25
_default_ssl_port ... |
scripts/train/download_utils.py | JSssssss/iPERCore | 2,223 | 11010519 | <filename>scripts/train/download_utils.py
# Copyright (c) 2020-2021 impersonator.org authors (<NAME> and <NAME>). All rights reserved.
import os
import sys
import requests
from urllib.request import urlopen
from tqdm import tqdm
def download_from_url(url, dst):
"""
Args:
url (str): url to download ... |
src/transformers/activations_tf.py | liminghao1630/transformers | 50,404 | 11010553 | <reponame>liminghao1630/transformers
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE... |
tests/api/test_get_insight.py | coman1024/line-bot-sdk-python | 1,563 | 11010554 | <filename>tests/api/test_get_insight.py
# -*- coding: utf-8 -*-
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... |
examples/GLGradientLegendItem.py | hishizuka/pyqtgraph | 2,762 | 11010556 | <reponame>hishizuka/pyqtgraph
import initExample
import pyqtgraph as pg
import pyqtgraph.opengl as gl
import numpy
app = pg.mkQApp()
w = gl.GLViewWidget()
w.show()
w.setWindowTitle("pyqtgraph example: GLGradientLegendItem")
w.setCameraPosition(distance=60)
gx = gl.GLGridItem()
gx.rotate(90, 0, 1, 0)
w.addItem(gx)
m... |
src/timeago/locales/create_tests.py | nmb10/timeago | 220 | 11010563 | import glob
override = True
test_text = """
def test_timeago_%s(self):
locale = '%s'
date = datetime.datetime.now()
now = date + datetime.timedelta(seconds=2)
self.assertEqual(timeago.format(date, now, locale), "%s")
now = date + datetime.timedelta(seconds=10)
... |
config/opentsdb/metrics_collector_config.py | jzmq/minos | 365 | 11010577 | metrics_url = 'http://127.0.0.1:8000/monitor/metrics'
opentsdb_bin_path = 'tsdb'
opentsdb_extra_args = ''
collect_period = 10
|
pyzo/codeeditor/textutils.py | l33tlinuxh4x0r/pyzo | 235 | 11010584 | <reponame>l33tlinuxh4x0r/pyzo
# -*- coding: utf-8 -*-
# Copyright (C) 2016, the Pyzo development team
#
# Pyzo is distributed under the terms of the 2-Clause BSD License.
# The full license can be found in 'license.txt'.
class TextReshaper:
"""Object to reshape a piece of text, taking indentation, paragraphs,
... |
helper_scripts/runner_scripts/components/__init__.py | deadly-platypus/dr_checker | 295 | 11010636 | """
All components that could be used by the common run_all.py script.
"""
from base_component import *
from driver_linker import *
from entry_point_identifier import *
from soundy_analysis_runner import *
from warnings_stats import *
from llvm_build import *
from parse_headers import *
|
packages/pyright-internal/src/tests/samples/abstractClass6.py | sasano8/pyright | 4,391 | 11010686 | <gh_stars>1000+
# This sample validates that a variable that is annotated as
# Type[X] where X refers to an abstract base class does not
# emit an error when the variable is instantiated.
from abc import ABC, abstractmethod
from typing import Type
class Base(ABC):
@abstractmethod
def foo(self, x: int) -> int... |
examples/stable_fluid.py | salt-die/nurses_2 | 171 | 11010724 | <reponame>salt-die/nurses_2
"""
Stable fluid simulation.
"""
from itertools import cycle
import numpy as np
from scipy.ndimage import map_coordinates
from scipy.ndimage.filters import convolve
from nurses_2.colors import rainbow_gradient, ABLACK
from nurses_2.io import MouseEvent, MouseButton
from nurses_2.widgets.gr... |
lib/feature_impact.py | janged/explainx | 310 | 11010763 | from imports import *
class feature_impact():
def __init__(self):
super(feature_impact, self).__init__()
self.param= None
def find(self, df):
df = pd.DataFrame(df)
print(df)
variables = [col for col in df.columns if '_impact' in col]
y = []
for i in r... |
tutorials/python/web.py | bwoodhouse322/package | 512 | 11010767 | #!/usr/bin/python
from __future__ import absolute_import
from __future__ import print_function
from six.moves import SimpleHTTPServer, socketserver
import socket
OK = 200
port = 8080
class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(OK)
self.send_h... |
dirigible/fts/tests/test_2828_GridShouldNotStealFocusOnRecalc.py | EnoX1/dirigible-spreadsheet | 168 | 11010771 | # Copyright (c) 2010 Resolver Systems Ltd.
# All Rights Reserved
#
from textwrap import dedent
import key_codes
from functionaltest import FunctionalTest, snapshot_on_error
class Test_2828_GridShouldNotStealFocusOnRecalc(FunctionalTest):
@snapshot_on_error
def test_recalc_doesnt_steal_focus_from_usercode(s... |
pymagnitude/third_party/allennlp/tests/predictors/wikitables_parser_test.py | tpeng/magnitude | 1,520 | 11010810 | # pylint: disable=no-self-use,invalid-name
from __future__ import division
from __future__ import absolute_import
import os
import pytest
from allennlp.common.testing import AllenNlpTestCase
from allennlp.models.archival import load_archive
from allennlp.predictors import Predictor
from allennlp.predictors.wikitable... |
spatialpandas/geometry/base.py | ianthomas23/spatialpandas | 207 | 11010840 | import re
from collections.abc import Container, Iterable
from numbers import Integral
import numpy as np
import pandas as pd
import pyarrow as pa
from pandas.api.extensions import ExtensionArray, ExtensionDtype
from pandas.api.types import is_array_like
from .._optional_imports import gp, sg
from ..spatialindex impo... |
tests/cpp/coordinate_map_gpu_test.py | NNstorm/MinkowskiEngine | 851 | 11010849 | <reponame>NNstorm/MinkowskiEngine
import numpy as np
import unittest
import time
import torch
import MinkowskiEngineTest._C
from utils import load_file, batched_coordinates
class CoordinateMapTestCase(unittest.TestCase):
def test_batch_insert(self):
assert torch.cuda.is_available()
coordinates =... |
src/oci/core/models/network_security_group_vnic.py | Manny27nyc/oci-python-sdk | 249 | 11010861 | <filename>src/oci/core/models/network_security_group_vnic.py
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as s... |
src/providers/base_provider.py | bbhunter/s3viewer | 381 | 11010869 | <gh_stars>100-1000
class StorageProvider():
NODE_BATCH_UPDATE_COUNT = 1
def __init__(self, url):
self.url = url
self.should_stop = False
@staticmethod
def is_provider(url):
return False
def check(self):
return True
def get_download_url(self, relative_path):
... |
notebooks/_solutions/case4_air_quality_processing21.py | rprops/Python_DS-WS | 183 | 11010889 | <filename>notebooks/_solutions/case4_air_quality_processing21.py
def read_airbase_file(filename, station):
"""
Read hourly AirBase data files.
Parameters
----------
filename : string
Path to the data file.
station : string
Name of the station.
Returns
-------... |
model/det/layers/rpn_detection_layer.py | qrsforever/torchcv | 308 | 11010901 | <filename>model/det/layers/rpn_detection_layer.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: <NAME>(<EMAIL>)
import torch
import torch.nn as nn
class RPNDetectionLayer(nn.Module):
def __init__(self, configer):
super(RPNDetectionLayer, self).__init__()
self.configer = configer
... |
gcloud/core/apis/drf/viewsets/utils.py | qqqqqie/bk-sops | 881 | 11010934 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file ... |
examples/Baselines/Halite_competition/torch/config.py | lp2333/PARL | 3,172 | 11010948 | # Copyright (c) 2021 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 required by app... |
python/federatedml/feature/binning/test/bucket_binning_test.py | hubert-he/FATE | 3,787 | 11010967 | <reponame>hubert-he/FATE<gh_stars>1000+
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... |
tests/functions/uplus.py | MoonStarCZW/py2rb | 124 | 11010984 |
x = +7623
print(x)
|
tests/functional/test_scoping/test_plain_name.py | textX/textX | 346 | 11010986 | <gh_stars>100-1000
from __future__ import unicode_literals
from pytest import raises
import textx.exceptions
import textx.scoping.providers as scoping_providers
from textx import get_children
from textx import metamodel_from_str
metamodel_str = '''
Model:
packages*=Package
;
Package:
'package' name=ID '{'
... |
tools/python/quantize/quantize_stat.py | fantasyRqg/mace | 4,756 | 11010988 | <gh_stars>1000+
# Copyright 2019 The MACE 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 ... |
tests/pytests/functional/states/test_svn.py | ifraixedes/saltstack-salt | 9,425 | 11011033 | """
Tests for the SVN state
"""
import logging
import pytest
import salt.utils.platform
log = logging.getLogger(__name__)
pytestmark = [
pytest.mark.requires_network,
pytest.mark.skip_if_binaries_missing("svn"),
]
@pytest.fixture
def repo_target(tmp_path):
return tmp_path / "svn-repo-checkout"
@pytes... |
alipay/aop/api/response/ZhimaCreditEpLawsuitRecordGetResponse.py | snowxmas/alipay-sdk-python-all | 213 | 11011049 | <filename>alipay/aop/api/response/ZhimaCreditEpLawsuitRecordGetResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.LawsuitRecord import LawsuitRecord
class ZhimaCreditEpLawsuitRecordGetResponse(AlipayRespon... |
ci/osx-build-config/extensions_build_config.bzl | giantcroc/envoy | 17,703 | 11011056 | # Should match https://github.com/envoyproxy/envoy-mobile/blob/main/envoy_build_config/extensions_build_config.bzl
# TODO(mattklein123): Actually pull this file from that repo and remove the envoy mobile specific filters.
EXTENSIONS = {
"envoy.clusters.dynamic_forward_proxy": "//source/extensions/clusters/dynamic_f... |
Coupled-Cluster/RHF/helper_cclambda.py | andyj10224/psi4numpy | 214 | 11011088 | <reponame>andyj10224/psi4numpy
# -*- coding: utf-8 -*-
"""
A simple python script to calculate RHF-CCSD lambda amplitudes
using pieces of the similarity transformed hamiltonian, Hbar.
Equations were spin-adapted using the unitary group approach.
References:
1. <NAME> and <NAME>, J. Chem. Phys., volume 103, pp. 3561-... |
demos/python/sdk_wireless_camera_control/open_gopro/api/v2_0/wifi_commands.py | Natureshadow/OpenGoPro | 210 | 11011122 | <reponame>Natureshadow/OpenGoPro
# wifi_commands.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Tue Sep 7 21:35:53 UTC 2021
"""Updates to WiFi API for Open GoPro version 2.0"""
from __future__ import annotations
import logging
fro... |
pony/orm/tests/test_declarative_join_optimization.py | ProgHaj/pony | 2,628 | 11011124 | from __future__ import absolute_import, print_function, division
import unittest
from datetime import date
from pony.orm.core import *
from pony.orm.tests.testutils import *
from pony.orm.tests import setup_database, teardown_database
db = Database()
class Department(db.Entity):
name = Required(str)
groups ... |
src/spn/structure/leaves/parametric/EM.py | tkrons/SPFlow_topdownrules | 199 | 11011130 | """
Created on March 07, 2019
@author: <NAME>
"""
import numpy as np
from scipy.special import logsumexp
from spn.structure.leaves.parametric.Parametric import Gaussian, Bernoulli
from spn.algorithms.EM import add_node_em_update
def bernoulli_em_update(node, node_lls=None, node_gradients=None, root_lls=None, data=... |
awacs/honeycode.py | michael-k/awacs | 358 | 11011146 | <gh_stars>100-1000
# Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "Amazon Honeycode"
prefix = "honeycode"
class Action(BaseAction):
def __init__(self, action: str = None) -> N... |
tools/SDKTool/src/ui/tree/tree_manager.py | Passer-D/GameAISDK | 1,210 | 11011150 | <filename>tools/SDKTool/src/ui/tree/tree_manager.py<gh_stars>1000+
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt... |
amazon_problems/problem_19.py | loftwah/Daily-Coding-Problem | 129 | 11011162 | <filename>amazon_problems/problem_19.py<gh_stars>100-1000
"""This problem was asked by Amazon.
Given a complete binary tree, count the number of nodes in faster than O(n) time.
Recall that a complete binary tree has every level filled except the last,
and the nodes in the last level are filled starting from the left.... |
research/active_learning/active_learning_methods/constants.py | dnarqq/WildHack | 402 | 11011168 | # Copyright 2017 Google 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,... |
libs/datasets/sources/cdc_testing_dataset.py | covid-projections/covid-data-model | 155 | 11011171 | import dataclasses
from functools import lru_cache
from libs.datasets import AggregationLevel
from libs.datasets import data_source
import pandas as pd
from covidactnow.datapublic.common_fields import CommonFields
from libs.datasets.sources import can_scraper_helpers as ccd_helpers
from libs.datasets.timeseries import... |
codigo/Live154/exemplo_14.py | BrunoPontesLira/live-de-python | 572 | 11011176 | <reponame>BrunoPontesLira/live-de-python
from asyncio import (
coroutine, get_event_loop, gather
)
@coroutine
def subgenerator():
return 42
@coroutine
def coro():
val1 = yield from subgenerator()
val2 = yield from subgenerator()
return val1 + val2
loop = get_event_loop()
grupo = gather(coro(),... |
changes/api/serializer/models/user.py | vault-the/changes | 443 | 11011199 | from hashlib import md5
from urllib import urlencode
from changes.api.serializer import Crumbler, register
from changes.models.user import User
def get_gravatar_url(email, size=None, default='mm'):
gravatar_url = "https://secure.gravatar.com/avatar/%s" % (
md5(email.lower()).hexdigest())
properties ... |
tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pdpd_launcher.py | TolyaTalamanov/open_model_zoo | 2,201 | 11011206 | <filename>tools/accuracy_checker/openvino/tools/accuracy_checker/launcher/pdpd_launcher.py
"""
Copyright (c) 2018-2022 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:/... |
enn/losses/vi_losses_test.py | deepmind/enn | 130 | 11011226 | <reponame>deepmind/enn
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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
#
# ... |
tests/autokeras/tasks/text_test.py | lc0/autokeras | 3,979 | 11011236 | # Copyright 2020 The AutoKeras Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
lib/__init__.py | ikust/omnisharp-sublime | 424 | 11011241 | from . import urllib3
import sublime
__all__ = ['ST2', 'ST3','Settings']
ST2 = sublime.version().startswith('2')
ST3 = not ST2
class Settings(object):
"""Helper class for accessing sublime.Settings' values.
Settings(settings, none_erases=False)
* settings (sublime.Settings)
... |
tests/nodes/io/test_io_base.py | Playfloor/bonobo | 1,573 | 11011246 | <reponame>Playfloor/bonobo
import pytest
from bonobo.nodes.io.base import filesystem_path
def test_filesystem_path_absolute():
with pytest.raises(ValueError):
filesystem_path("/this/is/absolute")
def test_filesystem_path_relative():
assert filesystem_path("this/is/relative") == "this/is/relative"
|
corehq/util/tests/test_jsonobject.py | dimagilg/commcare-hq | 471 | 11011255 | <gh_stars>100-1000
import datetime
from django.test import SimpleTestCase
from jsonobject import JsonObject as TheirJsonObject
from dimagi.ext.jsonobject import JsonObject as OurJsonObject, re_trans_datetime
from jsonobject.exceptions import BadValueError
class JsonObjectTest(SimpleTestCase):
JsonObject = TheirJ... |
python/vineyard/core/resolver.py | linlih/v6d | 417 | 11011266 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 Alibaba Group Holding 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/LI... |
wafhelpers/openssl.py | fakecoinbase/ntpsecslashntpsec | 201 | 11011329 | <reponame>fakecoinbase/ntpsecslashntpsec<filename>wafhelpers/openssl.py
SNIP_LIBSSL_TLS13_CHECK = """
#include <openssl/tls1.h>
#ifndef TLS1_3_VERSION
#error OpenSSL must have support for TLSv1.3
#endif
int main(void) {
return 0;
}
"""
def check_libssl_tls13(ctx):
ctx.check_cc(
fragment=SNIP_LIBSSL_TL... |
Algo and DSA/LeetCode-Solutions-master/Python/find-target-indices-after-sorting-array.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11011335 | # Time: O(n)
# Space: O(1)
class Solution(object):
def targetIndices(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
less = sum(x < target for x in nums)
return range(less, less+sum(x == target for x in nums))
|
src/zipline/finance/execution.py | Hertz-and-Alpha/zipline-reloaded | 254 | 11011343 | <filename>src/zipline/finance/execution.py<gh_stars>100-1000
#
# Copyright 2014 Quantopian, 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... |
UEM-Samples/Utilities and Tools/Generic/App Upload/Mobile CICD Script/testing/validate_script_execution.py | dholliman/euc-samples | 127 | 11011353 | import os
import json
import getopt
from api_client.application_details import get_app_details
from config import config
from Logs.log_configuration import configure_logger
from testing import app_deployment_tests
log = configure_logger('default')
sample_app_dir = os.getcwd()
expected_sg = {'alpha': config.ALPHA_GROU... |
app/routers/config/redis_config.py | cdlaimin/pity | 135 | 11011373 | <reponame>cdlaimin/pity
from fastapi import Depends
from starlette.background import BackgroundTasks
from app.crud.config.RedisConfigDao import PityRedisConfigDao
from app.handler.fatcory import PityResponse
from app.middleware.RedisManager import PityRedisManager
from app.models import DatabaseHelper
from app.models.... |
bin/webdevops/command/DoitCommand.py | hgati/Dockerfile | 1,405 | 11011374 | <filename>bin/webdevops/command/DoitCommand.py
#!/usr/bin/env/python
# -*- coding: utf-8 -*-
#
# (c) 2016 WebDevOps.io
#
# This file is part of Dockerfile Repository.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), ... |
neon/backends/winograd4.py | rsketine/neon | 4,415 | 11011377 | #!/usr/bin/python
# ******************************************************************************
# Copyright 2014-2018 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
#
#... |
nodes/0.9.x/python/DesignOption.DesignOptionSet.py | jdehotin/Clockworkfordynamo | 147 | 11011381 | import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
desopts = UnwrapElement(IN[0])
elementlist = list()
for item in desopts:
elementlist.append(item.Document.GetElement(item.get_Parameter(BuiltInParameter.OPTION_SET_ID).AsElementId()))
OUT = elementlist |
BCMClient.py | google/Legilimency | 116 | 11011398 | <filename>BCMClient.py<gh_stars>100-1000
# Legilimency - Memory Analysis Framework for iOS
# --------------------------------------
#
# Written and maintained by <NAME> <<EMAIL>>
#
# Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may n... |
test/test_utils.py | willthames/ansible-lint | 1,192 | 11011415 | <filename>test/test_utils.py<gh_stars>1000+
# -*- coding: utf-8 -*-
# Copyright (c) 2013-2014 <NAME> <<EMAIL>>
#
# 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, includin... |
lib/fullcontact/classes.py | goztrk/django-htk | 206 | 11011427 | <reponame>goztrk/django-htk
# Python Standard Library Imports
from collections import defaultdict
class FullContactObject(object):
def __init__(self, *args, **kwargs):
pass
class FullContactPerson(FullContactObject):
def __init__(self, email, person_data, version='v3', *args, **kwargs):
self... |
app/pylibs/osx64/Cryptodome/Cipher/AES.py | skylex77/PokeMapGT | 2,557 | 11011455 | <reponame>skylex77/PokeMapGT
# -*- coding: utf-8 -*-
#
# Cipher/AES.py : AES
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide,... |
sdk/python/pulumi_gcp/healthcare/_inputs.py | sisisin/pulumi-gcp | 121 | 11011469 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
examples_allennlp/ner/model.py | techthiyanes/luke | 467 | 11011470 | <filename>examples_allennlp/ner/model.py
from typing import List
import torch
import torch.nn as nn
from allennlp.data import Vocabulary, TextFieldTensors
from allennlp.models import Model
from allennlp.training.metrics import CategoricalAccuracy
from .modules.feature_extractor import NERFeatureExtractor
from .metric... |
test/validation/test_request_delete.py | thenetcircle/dino | 150 | 11011471 | # 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, software
# distributed under the Li... |
rectorch/evaluation.py | amitsultan/rectorch | 148 | 11011473 | <gh_stars>100-1000
r"""Module containing utility functions to evaluate recommendation engines.
"""
from functools import partial
import inspect
import random
import numpy as np
from .metrics import Metrics
__all__ = ['ValidFunc', 'evaluate', 'one_plus_random']
class ValidFunc():
"""Wrapper class for validation fu... |
aiopg/__init__.py | gistart/aiopg | 1,307 | 11011491 | <reponame>gistart/aiopg
import re
import sys
import warnings
from collections import namedtuple
from .connection import (
TIMEOUT as DEFAULT_TIMEOUT,
Connection,
Cursor,
DefaultCompiler,
IsolationCompiler,
IsolationLevel,
ReadCommittedCompiler,
RepeatableReadCompiler,
SerializableCo... |
saleor/shipping/tests/test_translation.py | fairhopeweb/saleor | 15,337 | 11011495 | import pytest
from ..models import ShippingMethodTranslation
@pytest.fixture
def shipping_method_translation_fr(shipping_method):
return ShippingMethodTranslation.objects.create(
language_code="fr", shipping_method=shipping_method, name="French name"
)
def shipping_method_translation(
settings,... |
cctbx/xray/structure_factors/gradients_direct.py | dperl-sol/cctbx_project | 155 | 11011522 | <reponame>dperl-sol/cctbx_project
from __future__ import absolute_import, division, print_function
from cctbx.xray.structure_factors.gradients_base import gradients_base
from cctbx.xray.structure_factors.manager import default_cos_sin_table
from cctbx.xray.structure_factors.misc import expensive_function_call_message
f... |
venv/Lib/site-packages/debugpy/_vendored/pydevd/pydevd_attach_to_process/winappdbg/textio.py | ajayiagbebaku/NFL-Model | 695 | 11011528 | #!~/.wine/drive_c/Python25/python.exe
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2014, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retai... |
TapasFlashTool/TapasFlashTool/__main__.py | StefanS0894/TAPAS | 104 | 11011559 | <reponame>StefanS0894/TAPAS
"""
TapasFlashTool -- This script can be used to flash a TapasBoard using the UART interface.
Author: <NAME>
BSD 3-Clause License
Copyright (c) 2017, SDI-SoftwareDefinedInverter
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are perm... |
pyscf/pbc/tdscf/krhf_slow_gamma.py | QuESt-Calculator/pyscf | 501 | 11011570 | <reponame>QuESt-Calculator/pyscf<gh_stars>100-1000
# Author: <NAME>
# flake8: noqa
"""
This and other `_slow` modules implement the time-dependent Hartree-Fock procedure. The primary performance drawback is
that, unlike other 'fast' routines with an implicit construction of the eigenvalue problem, these modules constr... |
doc/conf.py | khl02007/spikeinterface | 116 | 11011589 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
policy_sentry/command/initialize.py | zscholl/policy_sentry | 1,577 | 11011593 | <reponame>zscholl/policy_sentry
"""
Create the Policy Sentry config folder (~/.policy_sentry/) and the contents within
Create the SQLite datastore and fill it with the tables scraped from the AWS Docs
"""
import os
import shutil
import logging
import click
from policy_sentry.querying.all import get_all_service_prefixes... |
bin/test-eval09.py | Uppaal/LISA | 203 | 11011611 | import argparse
arg_parser = argparse.ArgumentParser(description='Output CoNLL-2009 file in eval09.pl format.')
arg_parser.add_argument('--input_file', type=str, help='CoNLL-2009 file to process')
arg_parser.add_argument('--output_file', type=str, help='File to write')
args = arg_parser.parse_args()
# input:
# 3 temp... |
datumaro/cli/util/errors.py | IRDonch/datumaro | 237 | 11011616 | # Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from attr import attrib, attrs
from datumaro.components.errors import DatumaroError
class CliException(DatumaroError): pass
@attrs
class WrongRevpathError(CliException):
problems = attrib()
def __str__(self):
return "Failed to... |
addons/Sprytile-6b68d00/rx/linq/observable/toasync.py | trisadmeslek/V-Sekai-Blender-tools | 733 | 11011637 | from rx.core import Observable
from rx.concurrency import timeout_scheduler
from rx.subjects import AsyncSubject
from rx.internal import extensionclassmethod
@extensionclassmethod(Observable)
def to_async(cls, func, scheduler=None):
"""Converts the function into an asynchronous function. Each invocation
of th... |
torch/distributions/multinomial.py | Hacky-DH/pytorch | 60,067 | 11011642 | <filename>torch/distributions/multinomial.py<gh_stars>1000+
import torch
from torch._six import inf
from torch.distributions.distribution import Distribution
from torch.distributions import Categorical
from torch.distributions import constraints
from torch.distributions.utils import broadcast_all
class Multinomial(Di... |
quantifiedcode/plugins/git/setup.py | marcinguy/quantifiedcode | 118 | 11011659 | <reponame>marcinguy/quantifiedcode
# -*- coding: utf-8 -*-
"""
Contains information needed to set up the plugin.
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
from .backend.tasks import hooks
from .backend.models import GitRepository, G... |
tests/test_util.py | 1aut/BayesianOptimization | 6,106 | 11011672 | import pytest
import numpy as np
from bayes_opt import BayesianOptimization
from bayes_opt.util import UtilityFunction, Colours
from bayes_opt.util import acq_max, load_logs, ensure_rng
from sklearn.gaussian_process.kernels import Matern
from sklearn.gaussian_process import GaussianProcessRegressor
def get_globals(... |
koalixcrm/crm/views/range_selection_form.py | Cataldir/koalixcrm | 290 | 11011700 | # -*- coding: utf-8 -*-
from django.contrib.admin.widgets import *
class RangeSelectionForm(forms.Form):
"""
Form which allows to select the Range in which the work item can be registered
and which define which range of work items are loaded from the database and shown
to the user
"""
from_da... |
crfnet/data_processing/fusion/rotation_helper.py | XiaoJake/CameraRadarFusionNet | 256 | 11011707 | """
This file offers some standard functions that are useful for rotations.
Two mainfunctions:
- Rotation matrix to euler angles
- Euler angles to rotation matrix
"""
import numpy as np
import math
def _isRotationMatrix(R) :
Rt = np.transpose(R)
shouldBeIdentity = np.dot(Rt, R)
I = np.identity(3, d... |
lunch/lunch/lunch/urls.py | willynpi/django-tutorial-for-programmers | 300 | 11011716 | <filename>lunch/lunch/lunch/urls.py
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from pages.views import home
from .api import v1, v2
urlpatterns = [
url(r'^$', home, name='home'),
url(r'^api/v1/', inclu... |
tests/jack/readers/test_readers.py | elyase/jack | 192 | 11011733 | # -*- coding: utf-8 -*-
"""Smoke test: train all readers for one iteration & run inference."""
from functools import partial
import numpy as np
import tensorflow as tf
from jack import readers
from jack.core.data_structures import QASetting, Answer
from jack.core.shared_resources import SharedResources
from jack.co... |
selim_sef-solution/lucid/optvis/overrides/__init__.py | Hulihrach/RoadDetector | 4,537 | 11011756 | <reponame>Hulihrach/RoadDetector<filename>selim_sef-solution/lucid/optvis/overrides/__init__.py
"""Override gradient implementations easily.
Example usages:
Fully default overrides
```
from lucid.optvis import overrides
#...
with overrides.standard_overrides():
T = render.import_model(model, param_t, para... |
SiteBroker.py | pgalola-x/SiteBroker | 361 | 11011767 | <filename>SiteBroker.py
"""
_______________.___.
\______ \__ | |
| | _// | |
| | \\____ |
|______ // ______|
\/ \/
_____ _______ ________ __________.__ ._____________ __________
/ _ \ ____ \ _ \ ____ \_____ \___ __\______ | ... |
pix2pixHD/networks.py | zhuhao-nju/Detailed3DFace | 130 | 11011778 | <filename>pix2pixHD/networks.py
### Copyright (C) 2017 NVIDIA Corporation. All rights reserved.
### Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
import torch
import torch.nn as nn
import functools
###########################################################... |
qt__pyqt__pyside__pyqode/show_QSplashScreen/main_static_image.py | gil9red/SimplePyScripts | 117 | 11011809 | <filename>qt__pyqt__pyside__pyqode/show_QSplashScreen/main_static_image.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import sys
from PyQt5.QtWidgets import QApplication, QSplashScreen
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPixmap
from _test_widget import MainWindow
app ... |
core/src/autogluon/core/utils/compression_utils.py | zhiqiangdon/autogluon | 4,462 | 11011836 | import gzip
import bz2
import lzma
compression_fn_map = {
None: {
'open': open,
'extension': '',
},
'gzip': {
'open': gzip.open,
'extension': 'gz',
},
'bz2': {
'open': bz2.open,
'extension': 'bz2',
},
'lzma': {
'open': lzma.open,
... |
setup.py | mehrdad-shokri/multidiff | 296 | 11011848 | <gh_stars>100-1000
# coding=utf8
from setuptools import setup
setup(
name='multidiff',
version='0.1',
description='Binary data diffing for multiple objects or streams of data',
url='https://github.com/juhakivekas/multidiff',
author='<NAME>',
author_email='<EMAIL>',
classifiers=[ # Optional... |
tests/components/kulersky/test_light.py | liangleslie/core | 30,023 | 11011854 | <reponame>liangleslie/core
"""Test the Kuler Sky lights."""
from unittest.mock import MagicMock, patch
import pykulersky
import pytest
from pytest import approx
from homeassistant.components.kulersky.const import (
DATA_ADDRESSES,
DATA_DISCOVERY_SUBSCRIPTION,
DOMAIN,
)
from homeassistant.components.light ... |
test/programytest/processors/pre/test_toupper.py | cdoebler1/AIML2 | 345 | 11011861 | <gh_stars>100-1000
import unittest
from programy.context import ClientContext
from programy.processors.pre.toupper import ToUpperPreProcessor
from programytest.client import TestClient
class ToUpperTests(unittest.TestCase):
def test_to_upper(self):
processor = ToUpperPreProcessor()
context = Cl... |
tf-2-data-parallelism/src/train_tf2_hvd.py | Amirosimani/amazon-sagemaker-script-mode | 144 | 11011862 | <filename>tf-2-data-parallelism/src/train_tf2_hvd.py
import argparse
import json
import os
import tensorflow as tf
import horovod.tensorflow.keras as hvd
import smdebug.tensorflow as smd
from utils import get_train_data
from model_def import get_resnet50
hook = smd.KerasHook.create_from_json_file()
if __name__ == '... |
coding_interviews/leetcode/easy/first_bad_version/first_bad_version.py | LeandroTk/Algorithms | 205 | 11011889 | <filename>coding_interviews/leetcode/easy/first_bad_version/first_bad_version.py
'''
Approach #1 (Linear Scan) [Time Limit Exceeded]
The straight forward way is to brute force it by doing a linear scan.
Complexity analysis
Time complexity : O(n)O(n). Assume that isBadVersion(version)isBadVersion(version) takes consta... |
data/task_scripts/main/task00251.py | k101w/phyre_ODE | 432 | 11011894 | <reponame>k101w/phyre_ODE
# Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 requ... |
tests/test_scanorama.py | hurleyLi/scanorama | 176 | 11011907 | import scanorama
import numpy as np
def data_gen():
X1 = np.random.rand(100, 10)
genes1 = [ 'g' + str(i) for i in range(10) ]
X2 = np.random.rand(200, 12)
genes2 = list(reversed([ 'g' + str(i) for i in range(12) ]))
return [ X1, X2 ], [ genes1, genes2 ]
def test_scanorama_integrate():
"""
... |
release/stubs/Tekla/Structures/Drawing/Tools.py | htlcnn/ironpython-stubs | 182 | 11011968 | <filename>release/stubs/Tekla/Structures/Drawing/Tools.py
# encoding: utf-8
# module Tekla.Structures.Drawing.Tools calls itself Tools
# from Tekla.Structures.Drawing, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=2f04dbe497b71114
# by generator 1.145
# no doc
# no imports
# no functions
# classes
cla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.