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 |
|---|---|---|---|---|
Trakttv.bundle/Contents/Libraries/Shared/plugin/preferences/options/pin.py | disrupted/Trakttv.bundle | 1,346 | 12721502 | from plugin.core.environment import translate as _
from plugin.managers.account import TraktAccountManager
from plugin.models import TraktAccount
from plugin.preferences.options.core.base import SimpleOption
import logging
log = logging.getLogger(__name__)
class PinOption(SimpleOption):
type = 'string'
gro... |
tensorflow_model_optimization/python/core/clustering/keras/mnist_clusterable_layer_test.py | Pandinosaurus/model-optimization | 1,318 | 12721530 | <filename>tensorflow_model_optimization/python/core/clustering/keras/mnist_clusterable_layer_test.py
# Copyright 2021 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
esmvaltool/diag_scripts/autoassess/autoassess_radiation_rms.py | yifatdzigan/ESMValTool | 148 | 12721532 | <gh_stars>100-1000
"""
Port to Version 2 with implementation of v2-specific changes.
Uses: ESMValTool v2, Python3.x
<NAME>, UREAD, July 2018
Porting replicates the functionality to minimum errors.
Original Description from Version 1 Diagnostic:
;;######################################################################... |
VMEncryption/test/console_logger.py | shridpant/azure-linux-extensions | 266 | 12721540 | #!/usr/bin/env python
#
# *********************************************************
# Copyright (c) Microsoft. All rights reserved.
#
# Apache 2.0 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
# dis... |
test/unit/shed_unit/__init__.py | rikeshi/galaxy | 1,085 | 12721542 | <filename>test/unit/shed_unit/__init__.py<gh_stars>1000+
"""
Module cannot be called tool_shed, because this conflicts with lib/tool_shed
also at top level of path.
"""
|
ggplot/scales/scale_x_discrete.py | themiwi/ggplot | 1,133 | 12721574 | <filename>ggplot/scales/scale_x_discrete.py
from .scale_x_continuous import scale_x_continuous as scale_x_discrete
|
image_transform.py | ShuaiW/kaggle-heart | 182 | 12721576 | <filename>image_transform.py
"""Library implementing the data augmentations.
"""
import numpy as np
import skimage.io
import skimage.transform
from custom_warnings import deprecated
tform_identity = skimage.transform.AffineTransform()
NO_AUGMENT_PARAMS = {
"zoom_x": 1.0,
"zoom_y": 1.0,
"rotate": 0.0,
... |
tests/test_doctests.py | brainix/pottery | 625 | 12721580 | <filename>tests/test_doctests.py<gh_stars>100-1000
# --------------------------------------------------------------------------- #
# test_doctests.py #
# #
# Copyright © 2015-2021, <N... |
etl/parsers/etw/Microsoft_Windows_DCLocator.py | IMULMUL/etl-parser | 104 | 12721581 | <reponame>IMULMUL/etl-parser
# -*- coding: utf-8 -*-
"""
Microsoft-Windows-DCLocator
GUID : cfaa5446-c6c4-4f5c-866f-31c9b55b962d
"""
from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct
from etl.utils import WString, CString, SystemTime, Guid
from e... |
src/aft_lambda/aft_customizations/aft_customizations_get_pipeline_executions.py | mondelez-ctiso/terraform-aws-control_tower_account_factory | 219 | 12721592 | <gh_stars>100-1000
# Copyright Amazon.com, Inc. or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
import inspect
from typing import TYPE_CHECKING, Any, Dict
from aft_common import aft_utils as utils
from aft_common import notifications
from aft_common.customizations import get_running_pip... |
archivebox/core/middleware.py | sarvex/ArchiveBox | 6,340 | 12721620 | __package__ = 'archivebox.core'
from django.utils import timezone
from ..config import PUBLIC_SNAPSHOTS
def detect_timezone(request, activate: bool=True):
gmt_offset = (request.COOKIES.get('GMT_OFFSET') or '').strip()
tz = None
if gmt_offset.replace('-', '').isdigit():
tz = timezone.get_fixed_ti... |
sitepackages/djangosecure/decorators.py | bitcpf/djangoage | 167 | 12721638 | from django.utils.functional import wraps
def frame_deny_exempt(view):
@wraps(view)
def inner(*args, **kwargs):
response = view(*args, **kwargs)
response._frame_deny_exempt = True
return response
return inner
|
LeetCode/python3/1031.py | ZintrulCre/LeetCode_Archiver | 279 | 12721648 | <gh_stars>100-1000
class Solution:
def maxSumTwoNoOverlap(self, A: List[int], L: int, M: int) -> int:
prefix, n, res, left = [0 for _ in range(len(A) + 1)], len(A) + 1, 0, 0
for i in range(1, n):
prefix[i] = prefix[i - 1] + A[i - 1]
for i in range(L + M, n):
left = ma... |
recipes/Python/576626_Skype_chat_to_speech/recipe-576626.py | tdiprima/code | 2,023 | 12721656 | # ----------------------------------------------------------------------------------------------------
# Python / Skype4Py example that prints out chat messages
#
# Tested with Skype4Py version 0.9.28.5 and Skype verson 192.168.3.11
import sys
import os
import time
import Skype4Py
import random
def ndsSay(ndsWords... |
others/rpi-tkinter/main.py | sesu089/stackoverflow | 302 | 12721666 | <gh_stars>100-1000
from tkinter import Tk,Label,Button
from tkinter import *
import sys
import time
import os
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setmode(GPIO.BCM)
GPIO.setup(21,GPIO.IN, pull_up_down =GPIO.PUD_DOWN)
top=Tk()
top.minsize(666,666)
top.maxsize(666,666)
#####################... |
tests/tensortrade/unit/feed/core/test_generic.py | nicomon24/tensortrade | 3,081 | 12721711 | <filename>tests/tensortrade/unit/feed/core/test_generic.py
from tensortrade.feed import Stream, DataFeed
def test_generic():
s1 = Stream.source(["hello", "my", "name", "is"], dtype="string")
s2 = Stream.source([1, 2, 3, 4, 5, 6])
g1 = s1.apply(lambda x: x[0]).rename("g1")
g2 = s2.lag().rename("g2"... |
openvqa/models/butd/tda.py | AcceptedDoge/openvqa | 274 | 12721713 | # --------------------------------------------------------
# OpenVQA
# Written by <NAME> https://github.com/ParadoxZW
# based on the implementation in https://github.com/hengyuan-hu/bottom-up-attention-vqa
# ELU is chosen as the activation function in non-linear layers due to
# the experiment results that indicate ELU ... |
rpython/jit/backend/llsupport/test/test_regalloc.py | nanjekyejoannah/pypy | 333 | 12721723 | <reponame>nanjekyejoannah/pypy<gh_stars>100-1000
import py
import sys
from rpython.jit.metainterp.history import ConstInt, INT, FLOAT
from rpython.jit.metainterp.history import BasicFailDescr, TargetToken
from rpython.jit.metainterp.resoperation import rop
from rpython.jit.metainterp.resoperation import InputArgInt, In... |
bmtk/utils/sonata/utils.py | tjbanks/bmtk | 216 | 12721725 | # Copyright 2017. <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:
#
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
# dis... |
alipay/aop/api/response/KoubeiTradeOrderAggregateRefundResponse.py | antopen/alipay-sdk-python-all | 213 | 12721736 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class KoubeiTradeOrderAggregateRefundResponse(AlipayResponse):
def __init__(self):
super(KoubeiTradeOrderAggregateRefundResponse, self).__init__()
self._gmt_refund_time = N... |
test/test_text_aug.py | ji3g4m6zo6/JioNLP | 1,063 | 12721755 | <reponame>ji3g4m6zo6/JioNLP
import unittest
import jionlp as jio
class TestTextAug(unittest.TestCase):
""" 测试文本数据增强工具 """
def test_ReplaceEntity(self):
""" test class ReplaceEntity """
# 准备的词典
entities_dict = {
"Person": {"马成宇": 1},
"Company": {"百度": 4, "国力... |
06_prepare/archive/preprocess-spark-text-to-bert.py | ichen20/oreilly_book | 2,327 | 12721757 | from __future__ import print_function
from __future__ import unicode_literals
import time
import sys
import os
import shutil
import csv
import collections
import subprocess
import sys
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'pip', '--upgrade'])
subprocess.check_call([sys.executable, '-m', 'pip',... |
examples/plot_text.py | mewbak/hypertools | 1,681 | 12721767 | <filename>examples/plot_text.py
# -*- coding: utf-8 -*-
"""
=============================
Plotting text
=============================
To plot text, simply pass the text data to the plot function. By default, the
text samples will be transformed into a vector of word counts and then modeled
using Latent Dirichlet Allo... |
packages/network/speedtest.py | madstk1/leon | 9,211 | 12721788 | <reponame>madstk1/leon
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# The SpeedTest package will give you information about your network speed
# Author: <NAME>
# Date: 2019-03-09
# Based on the package https://github.com/sivel/speedtest-cli
import utils
import os
import sys
import subprocess
import re
def run(string... |
esphome/components/xiaomi_rtcgq02lm/binary_sensor.py | OttoWinter/esphomeyaml | 249 | 12721808 | <filename>esphome/components/xiaomi_rtcgq02lm/binary_sensor.py
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import binary_sensor
from esphome.const import (
CONF_LIGHT,
CONF_MOTION,
CONF_TIMEOUT,
DEVICE_CLASS_LIGHT,
DEVICE_CLASS_MOTION,
CONF_ID,
)
f... |
test/test_uri.py | gap892003/mastermind | 389 | 12721829 | import mastermind.uri as uri
def test_is_template():
assert uri.is_template("http://localhost:8000") is False
assert uri.is_template("http://localhost:8000/{a}/") is True
def test_eq():
assert uri.eq("http://localhost:8000", "http://localhost:8000")
assert uri.eq("https://localhost", "https://localh... |
tests/lego/test_hybrid.py | nrupatunga/pynetbuilder | 381 | 12721850 | <reponame>nrupatunga/pynetbuilder
from caffe.proto import caffe_pb2
import google.protobuf as pb
from caffe import layers as L
from caffe import params as P
import caffe
import sys
sys.path.append('../netbuilder')
def test_conv_bn_relu_lego():
from lego.hybrid import ConvBNReLULego
n = caffe.NetSpec()
n.d... |
packages/core/minos-microservice-networks/tests/test_networks/test_brokers/test_publishers/test_queued/test_impl.py | sorasful/minos-python | 247 | 12721863 | <filename>packages/core/minos-microservice-networks/tests/test_networks/test_brokers/test_publishers/test_queued/test_impl.py
import unittest
from asyncio import (
sleep,
)
from unittest.mock import (
AsyncMock,
call,
)
from minos.networks import (
BrokerMessageV1,
BrokerMessageV1Payload,
Broke... |
academicstoday_project/teacher/tests/test_lecture.py | LeeDoona/EasyGrading | 146 | 12721872 | # Django & Python
from django.core.urlresolvers import resolve
from django.http import HttpRequest
from django.http import QueryDict
from django.test import TestCase
from django.test import Client
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib... |
fengshen/models/megatron_t5/tokenization_megatron_t5.py | dumpmemory/Fengshenbang-LM | 265 | 12721903 | # coding=utf-8
# Copyright 2021 The IDEA 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 a... |
test/setup.py | sanjaymsh/fast-entry_points | 121 | 12721918 | from setuptools import setup
import fastentrypoints
setup(
name='dummypkg',
version='0.0.0',
py_modules=['dummy'],
description='dummy package for the test',
entry_points={'console_scripts': ['hello=dummy:main']},
)
|
rotateMatrix180Deg.py | deepak5998/Py | 726 | 12721983 | <filename>rotateMatrix180Deg.py
def rotateMatrixby90(ipMat, size):
opMat = [[0 for i in range(size)] for j in range(size)]
for i in range(size):
for j in range(size):
opMat[j][i] = ipMat[i][j]
return opMat
def reverseMatrix(ipMat, size):
opMat = [[0 for i in range(size)] for j in range(size)]
f... |
auctioning_platform/auctions/auctions/tests/factories.py | nhdinh/smp-modulith | 299 | 12721992 | <filename>auctioning_platform/auctions/auctions/tests/factories.py
import factory
from foundation.value_objects.factories import get_dollars
from auctions.domain.entities import Auction
class AuctionFactory(factory.Factory):
class Meta:
model = Auction
id = factory.Sequence(lambda n: n)
bids = ... |
src/test/test_cmd_version.py | arshul/popper | 179 | 12721997 | <reponame>arshul/popper
from click.testing import CliRunner
from popper import __version__
from popper import _version_file
from popper.commands import cmd_version
from .test_common import PopperTest
class TestCommandVersion(PopperTest):
def test_version(self):
self.assertIsNot("0.0.0", __version__)
... |
live_demo/realsense/camera.py | AriaPs/cleargrasp | 191 | 12722037 | #!/usr/bin/env python3
import socket
import numpy as np
import cv2
import os
import time
import struct
class Camera(object):
def __init__(self):
# Data options (change me)
self.im_height = 720 # 848x480, 1280x720
self.im_width = 1280
# self.resize_height = 720
# self.res... |
benchmarks/python_e2e/cugraph_funcs.py | kaatish/cugraph | 991 | 12722073 | # Copyright (c) 2021, <NAME>.
# 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, s... |
test/testtree.py | aslisabanci/datastructures | 159 | 12722074 | import unittest
from ds2.tree import Tree
class TestTree(unittest.TestCase):
def testinit(self):
Tree(['root'])
Tree([1, [2, [3], [4]], [5, [6], [7], [8]]])
def teststr(self):
self.assertEqual(str(Tree([1, [2], [3]])), "1\n 2\n 3")
self.assertEqual(str(Tree([1, [2, [3]]])), "... |
samples/python/53.teams-messaging-extensions-action-preview/example_data.py | Aliacf21/BotBuilder-Samples | 1,998 | 12722079 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
class ExampleData(object):
def __init__(
self,
question: str = None,
is_multi_select: bool = False,
option1: str = None,
option2: str = None,
option3: str = None,
):
... |
examples/slider.py | salt-die/nurses_2 | 171 | 12722097 | """
Example slider widget.
"""
import asyncio
from nurses_2.app import App
from nurses_2.colors import BLUE, GREEN, BLACK, RED, ColorPair
from nurses_2.widgets.text_widget import TextWidget
from nurses_2.widgets.slider import Slider
GREEN_ON_BLACK = ColorPair.from_colors(GREEN, BLACK)
class MyApp(App):
async de... |
python-sorting-algorithms/Selection-sort.py | vatsla1601/Hacktoberfest2020-1 | 266 | 12722111 | def selection_sort(nums):
# This value of i corresponds to how many values were sorted
for i in range(len(nums)):
# We assume that the first item of the unsorted segment is the smallest
lowest_value_index = i
# This loop iterates over the unsorted items
for j in range(i + 1, len(... |
test_python_toolbox/test_nifty_collections/test_various_ordered_sets.py | hboshnak/python_toolbox | 119 | 12722130 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
import operator
from python_toolbox import cute_testing
from python_toolbox import logic_tools
from python_toolbox import emitting
from python_toolbox.nifty_collections import (OrderedSet, FrozenOrderedSet,
... |
blend_predict.py | wubinbai/argus-freesound | 314 | 12722150 | <gh_stars>100-1000
import numpy as np
import pandas as pd
from src.predictor import Predictor
from src.transforms import get_transforms
from src.utils import get_best_model_path, gmean_preds_blend
from src.datasets import get_test_data
from src import config
EXPERIMENTS = [
'auxiliary_009',
'auxiliary_010',
... |
Chapter07/friedman.py | eduard-sukharev/Hands-On-Genetic-Algorithms-with-Python | 156 | 12722200 | import numpy as np
from sklearn import model_selection
from sklearn import datasets
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.metrics import mean_squared_error
import matplotlib.pyplot as plt
import seaborn as sns
class Friedman1Test:
"""This class encapsulates the Friedman1 regression ... |
LSTM.py | harrys17451/CryptocurrencyPrediction | 669 | 12722217 | import pandas as pd
import numpy as numpy
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten,Reshape
from keras.layers import Conv1D, MaxPooling1D
from keras.utils import np_utils
from keras.layers import LSTM, LeakyReLU, CuDNNLSTM
from keras.callbacks import CSVLogger, Mod... |
PFPLD/data/add_type_label.py | ICpachong/nniefacelib | 505 | 12722234 |
ori_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP.txt'
save_file = '/home/unaguo/hanson/data/landmark/WFLW191104/train_data/300W_LP1.txt'
lable = '0'
ori_lines = []
with open(ori_file, 'r')as f:
ori_lines = f.readlines()
with open(save_file, 'w')as f:
for line in ori_lines:
l... |
__manifest__.py | wdw139130/wechat-mall | 108 | 12722302 | <reponame>wdw139130/wechat-mall
# -*- coding: utf-8 -*-
{
'name': "wechat_mall",
'application': True,
'summary': u"""
微信小程序商城管理后台""",
'description': u"""
微信小程序商城管理后台
""",
'author': "Gzp",
'website': "http://wechat.elfgzp.cn",
# Categories can be used to filter modules... |
tests/extension/thread_/to_thread_pool/test_thread_to_thread_pool.py | jesseclin/veriloggen | 232 | 12722321 | from __future__ import absolute_import
from __future__ import print_function
import veriloggen
import thread_to_thread_pool
expected_verilog = """
module test;
reg CLK;
reg RST;
blinkled
uut
(
.CLK(CLK),
.RST(RST)
);
initial begin
CLK = 0;
forever begin
#5 CLK = !CLK;
end
... |
calvin/actorstore/systemactors/web/Pushbullet.py | gabrielcercel/calvin-base | 334 | 12722344 | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
src/simian/mac/models/properties.py | tristansgray/simian | 326 | 12722387 | <gh_stars>100-1000
#!/usr/bin/env python
#
# Copyright 2018 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... |
Modules/RefineDet/detect.py | Passer-D/GameAISDK | 1,210 | 12722410 | # -*- 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" which is provided as part of this source code package.
Copyright... |
qanta/datasets/protobowl.py | Mshivam2409/qb | 122 | 12722414 | import os
import sys
import json
import codecs
import pickle
import pathlib
import itertools
import numpy as np
import pandas as pd
from collections import defaultdict
from functools import partial
from multiprocessing import Pool
from datetime import datetime
import matplotlib
matplotlib.use("Agg")
from plotnine impo... |
Language Skills/Python/Unit 09 Exam Statistics/01 Review/1-Lets look at those grades.py | WarHatch/Codecademy-Exercise-Answers | 346 | 12722434 | <gh_stars>100-1000
grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5]
print "Grades:", grades
|
src/pylogit/bootstrap_utils.py | mathijsvdv/pylogit | 153 | 12722435 | <filename>src/pylogit/bootstrap_utils.py
# -*- coding: utf-8 -*-
"""
@author: <NAME>
@name: Bootstrap Utilities
@summary: This module provides helpful functions for calculating the
bootstrap confidence intervals.
"""
from __future__ import absolute_import
from numbers import Number
import numpy a... |
tests/integration/test_access_for_functions/test.py | pdv-ru/ClickHouse | 15,577 | 12722469 | import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
instance = cluster.add_instance('instance')
@pytest.fixture(scope="module", autouse=True)
def started_cluster():
try:
cluster.start()
yield cluster
finally:
cluster.shutdown()
def test_... |
hwt/interfaces/agents/__init__.py | ufo2011/hwt | 134 | 12722491 | """
This package contains a UVM like simulation agents to handle IO between circuit running in simulator and the code which drives the simulation.
""" |
tools/perf/contrib/cluster_telemetry/screenshot_ct.py | zealoussnow/chromium | 14,668 | 12722496 | <filename>tools/perf/contrib/cluster_telemetry/screenshot_ct.py
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from core import perf_benchmark
from contrib.cluster_telemetry import ct_benchmarks_util
fro... |
alipay/aop/api/domain/AlipayEcoLogisticsExpressNonserviceModifyModel.py | snowxmas/alipay-sdk-python-all | 213 | 12722523 | <filename>alipay/aop/api/domain/AlipayEcoLogisticsExpressNonserviceModifyModel.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AreaCode import AreaCode
class AlipayEcoLogisticsExpressNonserviceModifyModel(object):
def _... |
tests/algo/test_quickselect.py | gony0/buffalo | 577 | 12722533 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
import time
from os import environ
environ["OMP_NUM_THREADS"] = "4"
environ["OPENBLAS_NUM_THREADS"] = "4"
environ["MKL_NUM_THREADS"] = "4"
environ["VECLIB_MAXIMUM_THREADS"] = "4"
environ["NUMEXPR_NUM_THREADS"] = "4"
import numpy as np
import unittest
from .base import TestBa... |
tutorials/tutorial-6-hodmd.py | mfarthin/PyDMD | 451 | 12722567 | import matplotlib.pyplot as plt
import numpy as np
import time
from pydmd import HODMD
def myfunc(x):
return np.cos(x)*np.sin(np.cos(x)) + np.cos(x*.2)
x = np.linspace(0, 10, 64)
y = myfunc(x)
snapshots = y
plt.plot(x, snapshots, '.')
plt.show()
hodmd = HODMD(svd_rank=0, exact=True, opt=True, d=30).fit(snapsh... |
src/aptsources_cleanup/util/collections/abc.py | DazEB/aptsources-cleanup | 461 | 12722574 | # -*- coding: utf-8
"""Like the eponymous built-in module but with additional back-ported
functonality if any.
"""
__all__ = []
from collections.abc import *
from collections import abc as _abc
__all__ += _abc.__all__
try:
from _collections_abc import _check_methods
except ImportError:
def _check_methods(C, *meth... |
sydent/validators/__init__.py | clmnin/sydent | 220 | 12722617 | <reponame>clmnin/sydent
# Copyright 2014 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
alembic/versions/71aa3c94b7f5_juiceshop_updates.py | JanSkalny/RootTheBox | 635 | 12722624 | <reponame>JanSkalny/RootTheBox<filename>alembic/versions/71aa3c94b7f5_juiceshop_updates.py
"""JuiceShop Updates
Revision ID: <KEY>
Revises: 18d11f218dfe
Create Date: 2019-11-14 08:52:52.530520
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revisio... |
examples/errors/undefined_identifiers.py | uta8a/Jikka | 139 | 12722629 | <gh_stars>100-1000
def solve(x: int) -> int:
x = y # err
z = x + 1
return y # err
|
tests/nn/alpha.py | Filco306/TopologyLayer | 250 | 12722650 | <reponame>Filco306/TopologyLayer<gh_stars>100-1000
import unittest
import topologylayer
import torch
import numpy as np
from topologylayer.util.process import remove_zero_bars, remove_infinite_bars
class AlphaTest(unittest.TestCase):
def test(self):
from topologylayer.nn import AlphaLayer
# super... |
src/gluonts/dataset/repository/_tsf_datasets.py | Xiaoxiong-Liu/gluon-ts | 2,648 | 12722707 | <gh_stars>1000+
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or... |
Packs/Ansible_Powered_Integrations/Integrations/VMwareV2/VMwareV2.py | diCagri/content | 799 | 12722717 | import json
import traceback
from typing import Dict, cast
import ansible_runner
import demistomock as demisto # noqa: F401
import ssh_agent_setup
from CommonServerPython import * # noqa: F401
# Dict to Markdown Converter adapted from https://github.com/PolBaladas/torsimany/
def dict2md(json_block, depth=0):
m... |
fake news challenge (FNC-1)/eval_fnc.py | kishormishra3/DeepLearn | 1,756 | 12722734 | '''
Evaluation code for the SICK dataset (SemEval 2014 Task 1)
'''
import numpy as np
import os.path
from util import *
from sklearn.metrics import mean_squared_error as mse
from scipy.stats import pearsonr
from scipy.stats import spearmanr
from sklearn.utils import shuffle
from utils.score import report_score
from ker... |
scripts/webgraph.py | fabratu/networkit | 366 | 12722740 | from NetworKit import *
import urllib.parse
import collections
def analyzeWebCommunities(graphPath, urlsPath):
print("reading input...")
G = readGraph(graphPath)
urls = LineFileReader().read(urlsPath)
urlmap = retrieveAttributes(G.nodes(), urls)
print("community detection...")
zeta = LabelPropagation().run(G)
... |
a_nice_mc/utils/hmc.py | tjansse2/a-nice-mc | 118 | 12722754 | <gh_stars>100-1000
import time
import numpy as np
import tensorflow as tf
from a_nice_mc.utils.logger import create_logger
logger = create_logger(__name__)
def kinetic_energy(v):
return 0.5 * tf.reduce_sum(tf.multiply(v, v), axis=1)
def hamiltonian(p, v, f):
"""
Return the value of the Hamiltonian
... |
backpack/extensions/firstorder/batch_grad/__init__.py | jabader97/backpack | 395 | 12722776 | """Contains the backpropagation extension for grad_batch: BatchGrad.
It defines the module extension for each module.
"""
from typing import List
from torch.nn import (
LSTM,
RNN,
BatchNorm1d,
BatchNorm2d,
BatchNorm3d,
Conv1d,
Conv2d,
Conv3d,
ConvTranspose1d,
ConvTranspose2d,
... |
dataset/DeepFakes/faceswap-master/lib/gui/stats.py | MrThiago/FaceForensics | 1,930 | 12722800 | #!/usr/bin python3
""" Stats functions for the GUI """
import time
import os
import warnings
from math import ceil, sqrt
import numpy as np
from lib.Serializer import PickleSerializer
class SavedSessions(object):
""" Saved Training Session """
def __init__(self, sessions_data):
self.serializer = P... |
exps/refinenet_root2/train.py | zju3dv/SMAP | 209 | 12722840 | <reponame>zju3dv/SMAP
import os
import os.path as osp
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from dataset.p2p_dataset import P2PDataset
from model.refinenet import RefineNet
from config import cfg
checkpoint_dir = cfg.CHECKPOINT_DIR
os.makedirs(checkpoint_dir, exist_ok=True)... |
kafka/tools/models/broker.py | akashvacher/kafka-tools | 578 | 12722962 | <filename>kafka/tools/models/broker.py<gh_stars>100-1000
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apa... |
kornia/losses/depth_smooth.py | Ishticode/kornia | 4,894 | 12722993 | import torch
import torch.nn as nn
# Based on
# https://github.com/tensorflow/models/blob/master/research/struct2depth/model.py#L625-L641
def _gradient_x(img: torch.Tensor) -> torch.Tensor:
if len(img.shape) != 4:
raise AssertionError(img.shape)
return img[:, :, :, :-1] - img[:, :, :, 1:]
def _grad... |
Basic/Display Factors of A Number/SolutionByVaibhavTripathi.py | rajethanm4/Programmers-Community | 261 | 12723022 | num =int(input(" Input a Number: "))
def factorsOf(num):
factors=[]
for i in range(1,num+1):
if num%i==0:
factors.append(i)
print(factors)
factorsOf(num)
|
moldesign/units/tools.py | Autodesk/molecular-design-toolkit | 147 | 12723040 | from __future__ import print_function, absolute_import, division
from future.builtins import *
from future import standard_library
standard_library.install_aliases()
# Copyright 2017 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with ... |
homeassistant/components/litejet/const.py | MrDelik/core | 30,023 | 12723053 | """LiteJet constants."""
from homeassistant.const import Platform
DOMAIN = "litejet"
CONF_EXCLUDE_NAMES = "exclude_names"
CONF_INCLUDE_SWITCHES = "include_switches"
PLATFORMS = [Platform.LIGHT, Platform.SCENE, Platform.SWITCH]
CONF_DEFAULT_TRANSITION = "default_transition"
|
python/disjointset/unoin_find.py | googege/algo-learn | 153 | 12723062 |
# 并查集的代码模板
class UnionFind:
def __init__(self, n: int):
self.count = n
self.parent = [i for i in range(n)]
def find(self, p: int):
temp = p
while p != self.parent[p]:
p = self.parent[p]
while temp != self.parent[p]:
temp, self.parent[temp] ... |
decrypt.py | mbinary/netease-music-cracker | 324 | 12723094 | <filename>decrypt.py
# coding : utf-8
import re
import os
import sys
import getpass
import urllib3
import requests
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, TIT2, TPE1, TALB, USLT
# ID3 info:
tagMap = {'cover': APIC, 'title': TIT2,
'artist': TPE1, 'al... |
examples/timesheet/libtimesheet/controller/StartupCommand.py | takipsizad/pyjs | 739 | 12723102 |
# vim: set ts=4 sw=4 expandtab:
from puremvc.patterns.command import SimpleCommand
from libtimesheet.model.TimeProxy import TimeProxy
from libtimesheet.view.DialogMediator import DialogMediator
from libtimesheet.view.MenuMediator import MenuMediator
from libtimesheet.view.DatePickerMediator import DatePickerMediato... |
mcpipy/maze.py | wangtt03/raspberryjammod | 338 | 12723104 | from mine import *
from sys import argv
from random import randint
DIRS = ((1,0),(0,1),(-1,0),(0,-1))
def generateMaze(xSize, ySize, start=(0,0), dirs=DIRS, inside=None):
if inside == None:
inside = lambda xy : 0 <= xy[0] < xSize and 0 <= xy[1] < ySize
def move(pos, dir):
r... |
src/Deform_Conv/functions/deform_psroi_pooling_func.py | Kirillova-Anastasia/LGFN | 181 | 12723125 | <gh_stars>100-1000
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import torch
from torch import nn
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from torch.autograd.function import once_diffe... |
modules/autoBump.py | logicguy1/The-all-in-one-discord-tool | 105 | 12723131 | LICNECE = """
Copyright © 2021 Drillenissen#4268
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,... |
experiments/nbody/nbody_run.py | yunmeng103/se3-transformer-public | 307 | 12723138 | from utils.utils_profiling import * # load before other local modules
import argparse
import os
import sys
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import dgl
import numpy as np
import torch
import wandb
import time
import datetime
from torch import optim
import torch.nn as nn... |
pypdb/clients/search/operators/seqmotif_operators.py | JBGreisman/pypdb | 194 | 12723146 | <filename>pypdb/clients/search/operators/seqmotif_operators.py
"""Operators associated with SeqMotif searching using RCSB Search API."""
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict
class SequenceType(Enum):
"""Type of sequence being searched for motifs."""
DNA = "pdb_... |
python/federatedml/components/secure_add_example.py | QuantumA/FATE | 715 | 12723175 | <reponame>QuantumA/FATE
#
# 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/LICENSE-2.0
#
# ... |
WebMirror/management/rss_parser_funcs/feed_parse_extractXiakeluojiao侠客落脚.py | fake-name/ReadableWebProxy | 193 | 12723201 | def extractXiakeluojiao侠客落脚(item):
"""
Xiakeluojiao 侠客落脚
"""
badwords = [
'korean drama',
'badword',
]
if any([bad in item['tags'] for bad in badwords]):
return None
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'... |
models/googlenet.py | MahimaGaur31/mlModels | 354 | 12723262 | from collections import OrderedDict
import torch
import torch.nn as nn
__all__ = ['googlenet']
class Inception_v1_GoogLeNet(nn.Module):
input_side = 227
rescale = 255.0
rgb_mean = [122.7717, 115.9465, 102.9801]
rgb_std = [1, 1, 1]
def __init__(self, num_classes=1000):
super(Inception_v1_G... |
homeassistant/components/mqtt/device_tracker/__init__.py | tbarbette/core | 22,481 | 12723265 | <reponame>tbarbette/core<filename>homeassistant/components/mqtt/device_tracker/__init__.py
"""Support for tracking MQTT enabled devices."""
from .schema_discovery import async_setup_entry_from_discovery
from .schema_yaml import PLATFORM_SCHEMA_YAML, async_setup_scanner_from_yaml
PLATFORM_SCHEMA = PLATFORM_SCHEMA_YAML
... |
vermin/formats/format.py | loganswartz/vermin | 261 | 12723271 | <filename>vermin/formats/format.py
from abc import ABCMeta, abstractmethod
class Format:
"""Format encapsulates a format for presenting minimum versions and related information during
processing."""
# Can't use `class Format(metaclass=ABCMeta)` in py2.
__metaclass__ = ABCMeta
def __init__(self, name):
se... |
models/vip.py | kevin-ssy/ViP | 107 | 12723285 | <reponame>kevin-ssy/ViP<gh_stars>100-1000
"""
ViP Architecture in PyTorch
Copyright 2021 <NAME>
"""
import math
import torch.nn.init as init
from timm.models.registry import register_model
from timm.models.layers import DropPath
from .vip_layers import *
class PatchEmbed(nn.Module):
def __init__(self, stride, ha... |
scripts/specBytesToCode.py | zouhirzz/FreeRDP | 5,941 | 12723303 | <gh_stars>1000+
#!/usr/bin/python
#
# A script to convert blob from the MS spec to array of byte to use in unitary tests
#
# 00000000 c7 01 00 01 20 54 e2
# 00000008 c7 01 00 01 20 54 e2
# taken from the spec, will give:
# 0xc7, 0x01, 0x00, 0x01, 0x20, 0x54, 0xe2,
# 0xc7, 0x01, 0x00, 0x01, 0... |
using_tor/loop_check_url.py | DazEB2/SimplePyScripts | 117 | 12723315 | <filename>using_tor/loop_check_url.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# pip install -U requests[socks]
import requests
proxies = {
'http': 'socks5://localhost:9050',
'https': 'socks5://localhost:9050',
}
# NOTE: Для смены ip нужно настроить tor
# Для этого создается to... |
leo/modes/factor.py | ATikhonov2/leo-editor | 1,550 | 12723347 | <reponame>ATikhonov2/leo-editor<gh_stars>1000+
# Leo colorizer control file for factor mode.
# This file is in the public domain.
# Properties for factor mode.
properties = {
"commentEnd": ")",
"commentStart": "(",
"doubleBracketIndent": "true",
"indentCloseBrackets": "]",
"indentNextLines... |
tests/test_core.py | abraha2d/PyVirtualDisplay | 409 | 12723352 | from time import sleep
import pytest
from pyvirtualdisplay import Display
from pyvirtualdisplay.abstractdisplay import XStartError
from pyvirtualdisplay.xephyr import XephyrDisplay
from pyvirtualdisplay.xvfb import XvfbDisplay
from pyvirtualdisplay.xvnc import XvncDisplay
from tutil import has_xvnc, rfbport
def tes... |
recipes/Python/579024_Simple_FIFO_trading_model/recipe-579024.py | tdiprima/code | 2,023 | 12723375 | <reponame>tdiprima/code
from collections import deque
import random
'''
Example below replicates
+75 MSFT 25.10
+50 MSFT 25.12
-100 MSFT 25.22
Realized P&L = 75 * (25.22 - 25.10) + 25 * (25.22 - 25.12) = $ 11.50
A Trade is split into a set of unit positions that are then dequeu... |
zentral/core/probes/migrations/0005_auto_20161104_1343.py | arubdesu/zentral | 634 | 12723414 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-04 13:43
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('probes', '0004_auto_20161103_1728'),
]
operat... |
dapper/mods/Lorenz63/extras.py | aperrin66/DAPPER | 225 | 12723415 | <gh_stars>100-1000
"""Extra functionality (not necessary for the EnKF or the particle filter)."""
import numpy as np
import dapper.mods.Lorenz63 as core
import dapper.tools.liveplotting as LP
from dapper.mods.integration import integrate_TLM
def d2x_dtdx(x):
"""Tangent linear model (TLM). I.e. the Jacobian of d... |
keepassc/control.py | thorkill/keepassc | 238 | 12723419 | # -*- coding: utf-8 -*-
import curses as cur
import logging
from curses.ascii import NL, DEL, SP
from datetime import date, datetime
from os import chdir, getcwd, getenv, geteuid, makedirs, remove
from os.path import expanduser, isfile, isdir, realpath, join
from pwd import getpwuid
from random import sample
from sock... |
wechat_django/admin/utils.py | UltraVacuum/wechat-django | 166 | 12723434 | <reponame>UltraVacuum/wechat-django
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.urls import reverse
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from six.moves import reduce
from six.moves.urllib.parse import parse_qsl
def ancho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.