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 |
|---|---|---|---|---|
tools/mo/openvino/tools/mo/front/create_tensor_nodes.py | ryanloney/openvino-1 | 1,127 | 11036531 | <filename>tools/mo/openvino/tools/mo/front/create_tensor_nodes.py
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openvino.tools.mo.front.common.replacement import FrontReplacementPattern
from openvino.tools.mo.front.extractor import create_tensor_nodes
from openvino.tools.mo.gra... |
cinderclient/tests/unit/utils.py | scottdangelo/cinderclient-api-microversions | 172 | 11036536 | # 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... |
hal/train.py | deepneuralmachine/google-research | 23,901 | 11036554 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
lrcurve/__init__.py | minhlab/python-lrcurve | 175 | 11036558 | <reponame>minhlab/python-lrcurve<gh_stars>100-1000
from .plot_learning_curve import PlotLearningCurve
from .keras_learning_curve import KerasLearningCurve
|
2019/05/29/Connecting to a MongoDB in Flask Using Flask-PyMongo (2019)/pymongo_example/pymongoexample/main.py | kenjitagawa/youtube_video_code | 492 | 11036594 | <reponame>kenjitagawa/youtube_video_code<gh_stars>100-1000
from flask import Blueprint
from .extensions import mongo
main = Blueprint('main', __name__)
@main.route('/')
def index():
user_collection = mongo.db.users
user_collection.insert({'name' : 'Cristina'})
user_collection.insert({'name' : ... |
tests/pyconverter-test/cases/calls.py | jaydeetay/pxt | 977 | 11036598 | <filename>tests/pyconverter-test/cases/calls.py<gh_stars>100-1000
testNamespace.defaultArguments(1)
testNamespace.defaultArguments(1, 2)
testNamespace.multipleDefaultArguments()
testNamespace.multipleDefaultArguments(1)
testNamespace.multipleDefaultArguments(1,2)
|
kgtk/cli/expand.py | vishalbelsare/kgtk | 222 | 11036619 | <reponame>vishalbelsare/kgtk
"""Copy records from the first KGTK file to the output file,
expanding | lists.
TODO: Need KgtkWriterOptions
TODO: --columns should list the columns to expand.
--key-columns should force the key columns.
"""
from argparse import Namespace, SUPPRESS
import typing
from kgtk.cli_arg... |
examples/xnli/dam/model.py | nlpaueb/GreekBERT | 117 | 11036638 | import torch
import torch.nn.functional as F
import pytorch_wrapper as pw
import pytorch_wrapper.functional as pwF
from torch import nn
class XNLIDAMModel(nn.Module):
def __init__(self,
embeddings,
mlp_num_layers=1,
mlp_hidden_size=200,
mlp_act... |
qiskit/circuit/library/generalized_gates/linear_function.py | itoko/qiskit-terra | 1,456 | 11036645 | # This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... |
custom/InlineConstructorOnSingleLine.py | MikeSilvis/spacecommander | 1,183 | 11036659 | # InlineConstructorOnSingleLine.py
# clang-format is confused when an inline constructor is split onto separate lines.
# Puts both sides of the constructor's colon (:) on a single line.
#
# If a filename is specified as a parameter, it will change that file in place.
# If input is provided through stdin, it will send t... |
train/model.py | IAmPara0x/yuno | 349 | 11036662 | from typing import List, Union, Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import RobertaModel
from .config import Config
Tensor = torch.Tensor
Triplet = Tuple[Tensor, Tensor, Tensor]
class FCN(nn.Module):
def __init__(self, layer_dims: List[int],... |
alipay/aop/api/response/AlipayCommerceLogisticsOrderIstdcancelPreconsultResponse.py | antopen/alipay-sdk-python-all | 213 | 11036682 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayCommerceLogisticsOrderIstdcancelPreconsultResponse(AlipayResponse):
def __init__(self):
super(AlipayCommerceLogisticsOrderIstdca... |
skyline/functions/pandas/timeseries_to_datetime_indexed_df.py | datastreaming/skyline-1 | 396 | 11036691 | <gh_stars>100-1000
"""
Convert a timeseries list to a datetime indexed DataFrame
"""
import logging
import traceback
import pandas as pd
# @added 20210627 - Branch #3590: inference
def timeseries_to_datetime_indexed_df(current_skyline_app, timeseries, log=False):
"""
Convert a timeseries list to a datetime i... |
angr/procedures/libc/getgid.py | Kyle-Kyle/angr | 6,132 | 11036718 | import angr
######################################
# getgid
######################################
class getgid(angr.SimProcedure):
# pylint: disable=arguments-differ
def run(self):
return 1000
|
pyNastran/femutils/coord_utils.py | ACea15/pyNastran | 293 | 11036720 | """
Defines general coordinate system related functions including:
- coords = coords_from_vector_1d(v_array)
- coords = coordinate_system_from_vector_2d_tri(xyz1, xyz2, xyz3)
- coords = coordinate_system_from_vector_2d_quad(xyz1, xyz2, xyz3, xyz4)
- coords = coordinate_system_from_vector_2d_tri_theta(xyz1, xyz2, xy... |
Bölüm 3 : Regresyon/3.4 cok degiskenli lineer regresyon/batch_gradient/ciz.py | Teknomar/Makine-Ogrenmesi | 115 | 11036734 | <gh_stars>100-1000
# coding=utf-8
""" Plotting Data
Veri Setinin Grafiginin Cizilmesi"""
import matplotlib.pyplot as plt
import numpy as np
def maliyet_devir_grafigi_ciz(toplam_devir, mse, mae, squared_error, rmse, baslik):
"""
:param toplam_devir: Toplam Devir Sayisi
:param mse: Mean Squared Error
:p... |
knowledge_repo/converters/docx.py | romj/knowledge-repo | 5,290 | 11036755 | import os
import re
import shutil
import tempfile
from ..converter import KnowledgePostConverter
class DocxConverter(KnowledgePostConverter):
_registry_keys = ['docx']
@property
def dependencies(self):
# Dependencies required for this converter on top of core knowledge-repo dependencies
... |
scale/ingest/ingest_event_serializers.py | kaydoh/scale | 121 | 11036760 | <reponame>kaydoh/scale
"""Defines the serializers for ingests"""
import rest_framework.serializers as serializers
from util.rest import ModelIdSerializer
class IngestEventBaseSerializerV6(ModelIdSerializer):
"""Converts ingest event model fields to REST output"""
type = serializers.CharField()
occurred = s... |
fredapi/tests/__init__.py | fadhilmch/fredapi | 492 | 11036763 | <filename>fredapi/tests/__init__.py
""" this file is needed for python to consider this directory a module """
|
datadog_checks_base/datadog_checks/base/utils/db/statement_metrics.py | mchelen-gov/integrations-core | 663 | 11036765 | <filename>datadog_checks_base/datadog_checks/base/utils/db/statement_metrics.py
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import logging
logger = logging.getLogger(__name__)
class StatementMetrics:
"""
This class supports normalized sta... |
tf2rl/algos/sac_ae.py | yamada-github-account/tf2rl | 453 | 11036781 | <reponame>yamada-github-account/tf2rl
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
from tf2rl.algos.sac import SAC
from tf2rl.misc.target_update_ops import update_target_variables
from tf2rl.networks.dmc_model import Encoder, Decoder
from tf2rl.tools.img_tools import center_crop, preproce... |
alipay/aop/api/response/AlipayCommerceTransportTaxiDriverstatusQueryResponse.py | antopen/alipay-sdk-python-all | 213 | 11036820 | <filename>alipay/aop/api/response/AlipayCommerceTransportTaxiDriverstatusQueryResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayCommerceTransportTaxiDriverstatusQueryResponse(AlipayResponse):
def __init__(self):
... |
pyswagger/scanner/type_reducer.py | gavrie/pyswagger | 199 | 11036826 | from __future__ import absolute_import
from ..scan import Dispatcher
from ..errs import SchemaError
from ..spec.v2_0.objects import Operation
from ..utils import scope_compose
from ..consts import private
class TypeReduce(object):
""" Type Reducer, collect Operation & Model
spreaded in Resources put in a globa... |
aiida/storage/sqlite_zip/migrator.py | aiidateam/aiida_core | 153 | 11036833 | # -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# ... |
generate_list.py | insidehand/XcodeSwiftSnippets | 1,864 | 11036843 | <filename>generate_list.py
import os
from xml.dom import minidom
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith('.codesnippet'):
xmldoc = minidom.parse(file)
keys = xmldoc.getElementsByTagName('dict')[0].getElementsByTagName('key')
summary = ""
prefix = ""
file_short = fil... |
examples/tensorflow/classification/datasets/preprocessing/imagenet.py | sarthakpati/nncf | 310 | 11036861 | """
Copyright (c) 2020 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 in writin... |
tests/check_framework/test_4_0_compatibility.py | KaushikSathvara/django | 61,676 | 11036865 | <filename>tests/check_framework/test_4_0_compatibility.py
from django.core.checks import Error
from django.core.checks.compatibility.django_4_0 import (
check_csrf_trusted_origins,
)
from django.test import SimpleTestCase
from django.test.utils import override_settings
class CheckCSRFTrustedOrigins(SimpleTestCase... |
pymtl3/passes/backends/verilog/translation/structural/test/VStructuralTranslatorL3_test.py | kevinyuan/pymtl3 | 152 | 11036877 | <reponame>kevinyuan/pymtl3<gh_stars>100-1000
#=========================================================================
# VStructuralTranslatorL3_test.py
#=========================================================================
# Author : <NAME>
# Date : May 29, 2019
"""Test the level 3 SystemVerilog structural tran... |
Python-3/basic_examples/python-import/import/utils.py | ghiloufibelgacem/jornaldev | 1,139 | 11036888 | def add(i, j):
return int(i) + int(j)
def uppercase(s):
return str(s).upper()
|
notes-to-self/loopy.py | guilledk/trio | 4,681 | 11036940 | <gh_stars>1000+
import trio
import time
async def loopy():
try:
while True:
time.sleep(0.01)
await trio.sleep(0)
except KeyboardInterrupt:
print("KI!")
async def main():
async with trio.open_nursery() as nursery:
nursery.start_soon(loopy)
nursery.sta... |
sandbox/jorvis/generate_snp_density_figure_from_vcf.py | senjoro/biocode | 355 | 11036941 | #!/usr/bin/env python3.2
'''
The goal here is to take any VCF file containing SNP data and generate a figure like
that in Figure 1a. of PMID: 22863733
In the paper, the X-axis is "Genotype quality" and has a range of 0-100, while the
Y-axis is "divergence from reference (SNPs per kb)"
Important link explaining expec... |
tnt/torchnet/meter/__init__.py | joel99/midlevel-reps | 120 | 11036966 | from .averagevaluemeter import AverageValueMeter
from .valuesummarymeter import ValueSummaryMeter
from .multivaluesummarymeter import MultiValueSummaryMeter
from .classerrormeter import ClassErrorMeter
from .confusionmeter import ConfusionMeter
from .timemeter import TimeMeter
from .msemeter import MSEMeter
from .movin... |
build/get_sdk_extras_packages.py | akbiggs/buildroot | 108 | 11037029 | #!/usr/bin/env python3
#
# Copyright (c) 2014 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 json
import os
import sys
SDK_EXTRAS_JSON_FILE = os.path.join(os.path.dirname(__file__),
... |
test/test_linux_cp.py | yasics/vpp | 751 | 11037048 | #!/usr/bin/env python3
import unittest
from scapy.layers.inet import IP, UDP
from scapy.layers.inet6 import IPv6, Raw
from scapy.layers.l2 import Ether, ARP, Dot1Q
from util import reassemble4
from vpp_object import VppObject
from framework import VppTestCase, VppTestRunner
from vpp_ipip_tun_interface import VppIpIp... |
src/azure-cli/azure/cli/command_modules/acr/tests/latest/test_split_registry_and_image.py | YuanyuanNi/azure-cli | 3,287 | 11037053 | <gh_stars>1000+
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# ----------------------------------------------------... |
concepts/0003-protocols/tictactoe-1.0/test_tictactoe.py | burdettadam/aries-rfcs | 270 | 11037058 | <gh_stars>100-1000
import unittest
import sys
import os
import random
import game
import ai
class GameTest(unittest.TestCase):
def setUp(self):
self.game = game.Game()
def test_first(self):
self.assertEqual(None, self.game.first)
self.game['b3'] = 'x'
self.assertEqual('X', self... |
neon/benchmark/benchmark.py | rsketine/neon | 4,415 | 11037069 | <filename>neon/benchmark/benchmark.py
# ******************************************************************************
# 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... |
tests/test_engine/test_update/test_update_mod_position.py | bobuk/montydb | 478 | 11037099 | import pytest
from pymongo.errors import WriteError as mongo_write_err
from montydb.errors import WriteError as monty_write_err
def test_update_mod_position_1(monty_update, mongo_update):
docs = [
{"a": [10]}
]
spec = {"$push": {"a": {"$each": [20, 30, 10], "$position": 0}}}
mongo_c = mongo_... |
mmdet/ops/fr/gradcheck.py | cameronchoi/r3det-docker | 176 | 11037118 | <gh_stars>100-1000
import os.path as osp
import sys
import math
import torch
from torch.autograd import gradcheck
# sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from . import FR # noqa: E402, isort:skip
feat_size_x = 32
feat_size_y = 32
stride = 8.0
spatial_scale = 1.0 / stride
base_size = 4.0 * stride
... |
thirdparty/tiger/test_tiger.py | fir3storm/Dagon | 188 | 11037131 | # These tests can be run using nosetests
import tiger
def round_helper(a, b, c, x, mul, new_a,new_b,new_c):
ret_values = tiger.tiger_round(a, b, c, x, mul)
assert ret_values["a"] == new_a, \
"a failed: " + str(ret_values["a"]) + " != " + str(new_a) + "\n"
assert ret_values["c"] == new_c, \
... |
newsfeed/urls.py | shriekdj/django-social-network | 368 | 11037150 | <filename>newsfeed/urls.py
from django.urls import path
from .views import *
app_name = "newsfeed"
urlpatterns = [
path('post/create', PostCreateView.as_view(), name="post-create"),
path('comment/create/<int:post_id>', create_comment, name="comment-create"),
]
|
export.py | smartlyio/slack-emojinator | 326 | 11037168 | #!/usr/bin/env python
# Export emoji in a Slack team as files
# https://github.com/smashwilson/slack-emojinator
import aiohttp
import argparse
import asyncio
import logging
import lxml.html
import os
import re
from collections import namedtuple
Emoji = namedtuple('Emoji', 'url name extension')
logging.basicConfig(l... |
config/DBsettings.py | awesome-archive/FooProxy | 235 | 11037180 | <gh_stars>100-1000
# coding:utf-8
"""
@author : linkin
@email : <EMAIL>
@date : 2018-10-05
"""
#代理连接数据库
_DB_SETTINGS = {
'backend' :'mongodb', #数据库类型选择 (MongoDB)
'host' :'localhost', #数据库主机
'port' :27017, #数据库主机服务端口
'user' :'', #数据库用户
'... |
cloudiscovery/provider/aws/all/data/omitted_resources.py | MalarvizhiK/cloudiscovery | 429 | 11037184 | <reponame>MalarvizhiK/cloudiscovery<gh_stars>100-1000
OMITTED_RESOURCES = [
"aws_cloudhsm_available_zone",
"aws_cloudhsm_hapg",
"aws_cloudhsm_hsm",
"aws_cloudhsm_luna_client",
"aws_dax_default_parameter",
"aws_dax_parameter_group",
"aws_ec2_reserved_instances_offering",
"aws_ec2_snapshot... |
recipes/fire-hpp/all/conanfile.py | rockandsalt/conan-center-index | 562 | 11037216 | <gh_stars>100-1000
from conans import ConanFile, CMake, tools
import os
class FireHppConan(ConanFile):
name = "fire-hpp"
homepage = "https://github.com/kongaskristjan/fire-hpp"
url = "https://github.com/conan-io/conan-center-index"
description = "Fire for C++: Create fully functional CLIs using functio... |
airbyte-integrations/connectors/source-recurly/source_recurly/source.py | darian-heede/airbyte | 6,215 | 11037230 | <reponame>darian-heede/airbyte
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import json
from datetime import datetime
from typing import Dict, Generator
from airbyte_protocol import (
AirbyteCatalog,
AirbyteConnectionStatus,
AirbyteMessage,
AirbyteRecordMessage,
ConfiguredAirbyteC... |
tests/test_plugins/test_metaevent.py | emicoto/none | 1,757 | 11037251 | <filename>tests/test_plugins/test_metaevent.py
from nonebot.typing import T_State
from nonebot.plugin import on_metaevent
from nonebot.adapters import Bot, Event
from nonebot.adapters.cqhttp import HeartbeatMetaEvent
async def heartbeat(bot: Bot, event: Event, state: T_State) -> bool:
return isinstance(event, Hea... |
dependencies/Intelect/Dependencies/setuptools-5.3/build/lib.linux-x86_64-2.7/_markerlib/__init__.py | Ezetowers/tp-final-fallas-I | 10,056 | 11037264 | <reponame>Ezetowers/tp-final-fallas-I
try:
import ast
from _markerlib.markers import default_environment, compile, interpret
except ImportError:
if 'ast' in globals():
raise
def default_environment():
return {}
def compile(marker):
def marker_fn(environment=None, override=Non... |
test/lib/test_util.py | Nickfagiano/SLM-Lab | 1,074 | 11037352 | from slm_lab.agent import Agent
from slm_lab.lib import util
import numpy as np
import os
import pandas as pd
import pydash as ps
import pytest
def test_calc_ts_diff():
ts1 = '2017_10_17_084739'
ts2 = '2017_10_17_084740'
ts_diff = util.calc_ts_diff(ts2, ts1)
assert ts_diff == '0:00:01'
def test_cast... |
chrome/android/host_driven_tests/DummyTest.py | kjthegod/chromium | 231 | 11037450 | <filename>chrome/android/host_driven_tests/DummyTest.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.
"""Host-driven java_tests which exercise dummy functionality.
This test class is only here to en... |
caffe2/contrib/playground/compute_topk_accuracy.py | Hacky-DH/pytorch | 60,067 | 11037494 | <filename>caffe2/contrib/playground/compute_topk_accuracy.py
import caffe2.contrib.playground.meter as Meter
from caffe2.python import workspace
import numpy as np
class ComputeTopKAccuracy(Meter.Meter):
# Python default arguments are evaluated once when the function is
# defined, not each time the funct... |
teuthology/provision/test/test_init_provision.py | varshar16/teuthology | 117 | 11037512 | from copy import deepcopy
from pytest import raises
from teuthology.config import config
import teuthology.provision
test_config = dict(
pelagos=dict(
endpoint='http://pelagos.example:5000/',
machine_types='ptype1,ptype2,common_type',
),
fog=dict(
endpoint='http://fog.example.com/f... |
returns/_internal/futures/_reader_future_result.py | ftruzzi/returns | 2,233 | 11037529 | <gh_stars>1000+
from typing import TYPE_CHECKING, Awaitable, Callable, TypeVar
from returns.primitives.hkt import Kind3, dekind
from returns.result import Result
if TYPE_CHECKING:
from returns.context import RequiresContextFutureResult # noqa: F401
_ValueType = TypeVar('_ValueType', covariant=True)
_NewValueTyp... |
rgb_track/loggers/file_logger.py | iamupd/CASIA-SURF_CeFA | 133 | 11037545 | <reponame>iamupd/CASIA-SURF_CeFA
import os
import pandas as pd
from . import logger
class TestFileLogger(logger.Logger):
def __init__(self, root, logger_config):
super().__init__()
self.root = root
self.logger_config = logger_config
self.out_path = os.path.join(self.root.test_confi... |
glucosetracker/glucoses/management/commands/load_random_glucose_data.py | arhanair/glucose-tracker-monitor | 134 | 11037566 | import sys
import random
from datetime import date, timedelta
from django.core.management.base import BaseCommand
from django.db.models.base import ObjectDoesNotExist
from django.contrib.auth.models import User
from ...models import Glucose, Category
from ...tests.factories import GlucoseFactory
class Command(BaseC... |
demo_scripts/training/train_question_answering.py | lipucky/nlp-gym | 120 | 11037578 | from nlp_gym.data_pools.custom_question_answering_pools import QASC
from nlp_gym.envs.question_answering.env import QAEnv
from nlp_gym.envs.question_answering.featurizer import InformedFeaturizer, SimpleFeaturizer
from stable_baselines.deepq.policies import MlpPolicy as DQNPolicy
from stable_baselines import DQN
from s... |
sarenka/backend/common/dict_x.py | adolabsnet/sarenka | 380 | 11037654 | class DictX(dict):
"""
Przeglądanei zagnieżdzonych jsonów narzędznie online http://jsonviewer.stack.hu/
"""
def __getattr__(self, key):
try:
return self[key]
except KeyError as k:
raise AttributeError(k)
def __setattr__(self, key, value):
self[key] = ... |
recipes/Python/303439_Tuples_with_named_elements/recipe-303439.py | tdiprima/code | 2,023 | 11037663 | <reponame>tdiprima/code<gh_stars>1000+
class NamedTuple(tuple):
"""Builds a tuple with elements named and indexed.
A NamedTuple is constructed with a sequence of (name, value) pairs;
the values can then be obtained by looking up the name or the value.
"""
def __new__(cls, seq):
return ... |
examples/tkinter_framebuffer.py | asnt/moderngl | 916 | 11037677 | from PIL import Image, ImageTk
class FramebufferImage(ImageTk.PhotoImage):
def __init__(self, master, ctx, size):
super(FramebufferImage, self).__init__(Image.new('RGB', size, (0, 0, 0)))
self.ctx = ctx
self.fbo = self.ctx.simple_framebuffer(size)
self.scope = self.ctx.scope(self.f... |
climlab/process/external_forcing.py | nfeldl/climlab | 160 | 11037695 | <reponame>nfeldl/climlab
from __future__ import absolute_import, division, print_function
from .time_dependent_process import TimeDependentProcess
class ExternalForcing(TimeDependentProcess):
"""A Process class for user-defined tendencies of state variables.
Useful for combining some prescribed external forcin... |
lav/data_paint.py | Kin-Zhang/LAV | 122 | 11037696 | import ray
import tqdm
import yaml
import numpy as np
import torch
import wandb
import matplotlib.pyplot as plt
import torch.nn.functional as F
from lav.models.rgb import RGBSegmentationModel
from lav.utils.logger import Logger
from lav.utils.datasets.point_paint_dataset import PointPaintDataset
from lav.utils import _... |
Checksum/checksum.py | elishahyousaf/Awesome-Python-Scripts | 1,026 | 11037708 | import os
import sys
import hmac
import base64
import hashlib
import argparse
def checksum(hash, seed=None):
hashs = {
"md5": hashlib.md5,
"sha1": hashlib.sha1,
"sha224": hashlib.sha224,
"sha256": hashlib.sha256,
"sha384": hashlib.sha384,
"sha512": hashlib.sha512
... |
scripts/mean_shift_clustering.py | vipavlovic/pyprobml | 4,895 | 11037714 | <reponame>vipavlovic/pyprobml
# Mean shift for clustering 2d data
# From
#https://github.com/log0/build-your-own-meanshift/blob/master/Meanshift%20In%202D.ipynb
#http://www.chioka.in/meanshift-algorithm-for-the-rest-of-us-python/
import superimport
import math
import matplotlib.pyplot as plt
import matplotlib.pylab ... |
sample-apps/redshift/sample-app/src/sampleaws.py | shiresky/aws-servicebroker | 448 | 11037727 | <reponame>shiresky/aws-servicebroker
import psycopg2
import psycopg2.extras
from os import environ
import traceback
import json
SECRETS = [
"REDSHIFT_ENDPOINT_ADDRESS",
"REDSHIFT_PORT",
"REDSHIFT_MASTER_USERNAME",
"REDSHIFT_MASTER_USER_PASSWORD",
"REDSHIFT_DB_NAME"
]
def check_secrets():
ass... |
dino/hooks/delete.py | thenetcircle/dino | 150 | 11037751 | # 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... |
pyxtal/interface/lammpslib.py | ubikpt/PyXtal | 127 | 11037777 | <reponame>ubikpt/PyXtal
"""ASE LAMMPS Calculator Library Version"""
from __future__ import print_function
import numpy as np
import ase.units
from ase.calculators.calculator import Calculator
from lammps import lammps
import os
from pkg_resources import resource_filename
from ase.optimize.fire import FIRE
from ase.opti... |
mintamazontagger/cli.py | jprouty/mint-amazon-tagger | 156 | 11037783 | <reponame>jprouty/mint-amazon-tagger
#!/usr/bin/env python3
# This script fetches Amazon "Order History Reports" and annotates your Mint
# transactions based on actual items in each purchase. It can handle orders
# that are split into multiple shipments/charges, and can even itemized each
# transaction for maximal con... |
qf_lib_tests/unit_tests/common/utils/test_index_grouping.py | webclinic017/qf-lib | 198 | 11037788 | # 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 obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... |
desktop/core/ext-py/docutils-0.14/test/test_writers/__init__.py | kokosing/hue | 5,079 | 11037808 | import os
import os.path
import sys
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
prev = ''
while sys.path[0] != prev:
try:
import DocutilsTestSupport
break
except ImportError:
prev = sys.path[0]
sys.path[0] = os.path.dirname(prev)
sys.path.pop(0)
|
example/docker/zk_setup.py | abin-coding/baidu | 2,003 | 11037815 | import argparse
import os
import subprocess
import zookeeper
import socket
import time
import traceback
def parse_input():
parser = argparse.ArgumentParser()
parser.add_argument('--servers', required=True, nargs='+', type=str, help='server list, must be in order')
parser.add_argument('--port', required=True, type=i... |
Agents/q_learning_agent.py | davidleejy/Startcraft_pysc2_minigames | 130 | 11037857 | # Q-learning agent for HallucinIce.
# The goal for the agent is to discover wich combination of Hallucination will be better to defeat Terran
# Kudos to <NAME> and to MorvanZhou
import random
import math
import numpy as np
import pandas as pd
from pysc2.agents import base_agent
from pysc2.lib import actions
from p... |
utils/mobjects/ForceDirectedGraph.py | AStarySky/manim_sandbox | 366 | 11037861 | <reponame>AStarySky/manim_sandbox
from manimlib import *
import math
# Not yet finished.
class ForceDirectedGraph(VGroup):
I = 2.5
gdata = [
[.0,I,I,.0,.0,I],
[I,.0,I,.0,.0,.0],
[I,I,.0,I,.0,.0],
[.0,.0,I,.0,I,.0],
[.0,.0,.0,I,.0,I],
... |
examples/simple/sklearn-gbt.py | Intelecy/chocolate | 105 | 11037889 | from sklearn.datasets import load_boston
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.metrics import r2_score
from sklearn.model_selection import train_test_split
import chocolate as choco
def score_gbt(X, y, params):
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,... |
tools/bin/pythonSrc/pychecker-0.8.18/pychecker2/tests/import.py | YangHao666666/hawq | 450 | 11037904 | <reponame>YangHao666666/hawq
from sys import path as foo, argv as bar# bar not used
import getopt # getopt not used
import os.path as nifty # nifty not used
from os.path import *
def f(v):
from os.path import join # duplicate import
v.append(join(foo)) ... |
nginx.bzl | florayan/esp | 275 | 11037945 | <filename>nginx.bzl
# Copyright (C) Extensible Service Proxy Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# noti... |
Algo and DSA/LeetCode-Solutions-master/Python/minimum-speed-to-arrive-on-time.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 11037979 | <gh_stars>1000+
# Time: O(nlogr), r is the range of speed
# Space: O(1)
class Solution(object):
def minSpeedOnTime(self, dist, hour):
"""
:type dist: List[int]
:type hour: float
:rtype: int
"""
def ceil(a, b):
return (a+b-1)//b
def total_time(di... |
tests/bots/economy/test_valuation.py | tehcoderer/GamestonkTerminal | 255 | 11038000 | <reponame>tehcoderer/GamestonkTerminal<gh_stars>100-1000
import pytest
try:
from bots.economy.valuation import valuation_command
except ImportError:
pytest.skip(allow_module_level=True)
@pytest.mark.bots
@pytest.mark.parametrize(
"group",
[
"sector",
"industry",
"basic_materia... |
jesse/strategies/Test02/__init__.py | noenfugler/jesse | 3,999 | 11038030 | <filename>jesse/strategies/Test02/__init__.py<gh_stars>1000+
from jesse.strategies import Strategy
# test_should_sell_and_execute_sell
class Test02(Strategy):
def should_long(self):
return False
def should_short(self):
# sell on market at first candle, and sell on the third candle
ret... |
Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/__init__.py | disrupted/Trakttv.bundle | 1,346 | 11038039 | <filename>Trakttv.bundle/Contents/Libraries/Shared/plugin/sync/core/task/__init__.py
from plugin.sync.core.task.main import SyncTask
__all__ = [
'SyncTask'
]
|
download_and_process_mnist.py | mahmud2137/adversarial-feature-augmentation | 124 | 11038045 | import numpy as np
import os
import cPickle
from PIL import Image
from tensorflow.examples.tutorials.mnist import input_data
def resize_images(image_arrays, size=[32,32]):
image_arrays = (image_arrays * 255).astype('uint8')
resized_image_arrays = np.zeros([image_arrays.shape[0]]+size)
for i, image_... |
ML/mnist/tflearn_mnist.py | saneravi/ML_Stuff | 209 | 11038062 | <reponame>saneravi/ML_Stuff<gh_stars>100-1000
#!/usr/bin/env python
"""Train a CNN model on MNIST."""
import mnist
import tflearn
from keras.utils import np_utils
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import dropout, fully_connected, input_data
from tflearn.layers.estimator im... |
trainer.py | voletiv/self-attention-GAN-pytorch | 164 | 11038088 | import datetime
import numpy as np
import os
import random
import sys
import time
import torch
import torch.nn as nn
import torchvision.utils as vutils
from torch.backends import cudnn
import utils
from sagan_models import Generator, Discriminator
class Trainer(object):
def __init__(self, config):
# C... |
service/generated_flatbuffers/tflite/TensorType.py | lcrh/falken | 213 | 11038097 | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
i3pystatus/xkblayout.py | fkusei/i3pystatus | 413 | 11038135 | <gh_stars>100-1000
import subprocess
from itertools import zip_longest
from i3pystatus import IntervalModule
from xkbgroup import XKeyboard
class Xkblayout(IntervalModule):
"""Displays and changes current keyboard layout.
``change_layout`` callback finds the current layout in the
``layouts`` setting and... |
pandas/draw-separated-plots/main-1.py | whitmans-max/python-examples | 140 | 11038154 |
# date: 2019.08.20
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({
'A': [1,2,3],
'B': [2,3,1],
'C': [2,1,3],
})
axes = df[['A','B', 'C']].plot(subplots=True)
plt.show()
|
util/jinjautil.py | giuseppe/quay | 2,027 | 11038161 | <filename>util/jinjautil.py
from app import get_app_url, avatar
from data import model
from util.names import parse_robot_username
from jinja2 import Environment, FileSystemLoader
def icon_path(icon_name):
return "%s/static/img/icons/%s.png" % (get_app_url(), icon_name)
def icon_image(icon_name):
return '<i... |
smartsheet/models/sheet.py | bromic007/smartsheet-python-sdk | 106 | 11038169 | <filename>smartsheet/models/sheet.py
# pylint: disable=C0111,R0902,R0904,R0912,R0913,R0915,E1101
# Smartsheet Python SDK.
#
# Copyright 2016 Smartsheet.com, 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... |
external/deep-object-reid/tests/sc_input_params_validation/test_ote_classification_input_params_validation.py | opencv/openvino_training_extensions | 775 | 11038171 | <filename>external/deep-object-reid/tests/sc_input_params_validation/test_ote_classification_input_params_validation.py
import numpy as np
import pytest
from ote_sdk.test_suite.e2e_test_system import e2e_pytest_unit
from ote_sdk.tests.parameters_validation.validation_helper import (
check_value_error_exception_rais... |
applications/FluidDynamicsApplication/python_scripts/apply_compressible_navier_stokes_boundary_conditions_process.py | clazaro/Kratos | 778 | 11038180 | <reponame>clazaro/Kratos
import KratosMultiphysics
from KratosMultiphysics.FluidDynamicsApplication import ApplyCompressibleNavierStokesBoundaryConditionsProcess
def Factory(settings, Model):
if not isinstance(settings, KratosMultiphysics.Parameters):
raise Exception("expected input shall be a Parameters o... |
nni/algorithms/hpo/networkmorphism_tuner/__init__.py | dutxubo/nni | 9,680 | 11038194 | <filename>nni/algorithms/hpo/networkmorphism_tuner/__init__.py
from .networkmorphism_tuner import NetworkMorphismTuner, NetworkMorphismClassArgsValidator
|
emerge/languages/javascriptparser.py | kargaranamir/emerge | 142 | 11038196 | <filename>emerge/languages/javascriptparser.py
"""
Contains the implementation of the JavaScript language parser and a relevant keyword enum.
"""
# Authors: <NAME> <<EMAIL>>
# License: MIT
import pyparsing as pp
from typing import Dict
from enum import Enum, unique
import coloredlogs
import logging
from pathlib impor... |
scripts/materials.py | chellmuth/gpu-motunui | 139 | 11038207 | import collections
import json
import pprint
from params import MoanaPath
SBTRecord = collections.namedtuple("SBTRecord", [ "name", "base_color"])
def build_sbt_manager(elements):
print("Processing materials:")
# Collect material information for SBT
sbt_manager = SBTManager()
for element_name in ele... |
jarbas/storages.py | vbarceloscs/serenata-de-amor | 3,001 | 11038297 | <filename>jarbas/storages.py
from whitenoise.storage import CompressedManifestStaticFilesStorage
class WhiteNoiseStaticFilesStorage(CompressedManifestStaticFilesStorage):
manifest_strict = False
def hashed_name(self, *args, **kwargs):
"""Skip hashing app.js because it is included in the container vol... |
v2/backend/security/models/__init__.py | jonfairbanks/rtsp-nvr | 558 | 11038355 | <filename>v2/backend/security/models/__init__.py
from .role import Role
from .user import User
from .user_role import UserRole
|
tests/commands/backfill_test.py | Yelp/Tron | 190 | 11038403 | import datetime
import mock
import pytest
from tron.commands import backfill
from tron.commands import client
TEST_DATETIME_1 = datetime.datetime.strptime("2004-07-01", "%Y-%m-%d")
TEST_DATETIME_2 = datetime.datetime.strptime("2004-07-02", "%Y-%m-%d")
TEST_DATETIME_3 = datetime.datetime.strptime("2004-07-03", "%Y-%m... |
king_phisher/server/letsencrypt.py | chachabooboo/king-phisher | 1,143 | 11038405 | <filename>king_phisher/server/letsencrypt.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/letsencrypt.py
#
# 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... |
qutip/tests/test_ptrace.py | camponogaraviera/qutip | 1,205 | 11038465 | import itertools
import numpy as np
from numpy.testing import assert_
import pytest
from qutip import *
from qutip.legacy.ptrace import _ptrace as _pt
@pytest.fixture(params=[True, False], ids=['sparse', 'dense'])
def sparse(request):
return request.param
@pytest.fixture(params=[True, False], ids=['dm', 'ket'... |
src/envs/gfootball/gfootball.py | gutsy-robot/ROMA | 117 | 11038468 | <gh_stars>100-1000
from ..multiagentenv import MultiAgentEnv
from operator import attrgetter
from copy import deepcopy
from absl import flags
import numpy as np
import pygame
import sys
import os
import math
import time
import numpy as np
import gfootball.env as football_env
from gfootball.env import config, wrappers
... |
tests/happy_numbers/external.py | raffaelfoidl/noworkflow | 108 | 11038487 | <reponame>raffaelfoidl/noworkflow<filename>tests/happy_numbers/external.py
from time import sleep
def process(number):
sleep(10)
|
src/ontology/imports/langual/langual.py | OnToologyUser/foodon | 121 | 11038494 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
**************************************************
langual.py
Author: <NAME>
Project: FoodOn
TO RUN: this needs "requests" module. Running from CONDA environment:
> source activate _test
This script uses the LanguaL.org food description thesaurus (published yearly ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.