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 |
|---|---|---|---|---|
scripts/proppr-helpers/pronghorn-wrapper.py | TeamCohen/ProPPR | 138 | 12774845 | <reponame>TeamCohen/ProPPR<gh_stars>100-1000
import sys
import os
import shutil
import getopt
import logging
import subprocess
import util as u
def makebackup(f):
bi=1
backup = "%s.%d" % (f,bi)
#backup_parent = "./"
#if f[0] == "/": backup_parent=""
#if f.rfind("/") > 0: backup_parent += f[:f.rfind... |
moonlight/score/reader_test.py | lithomas1/moonlight | 288 | 12774855 | <reponame>lithomas1/moonlight
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
python/py-set-add.py | gajubadge11/HackerRank-1 | 340 | 12774878 | #!/usr/bin/env python3
if __name__ == "__main__":
N = int(input().strip())
stamps = set()
for _ in range(N):
stamp = input().strip()
stamps.add(stamp)
print(len(stamps)) |
inselect/lib/templates/__init__.py | NaturalHistoryMuseum/inselect | 128 | 12774895 | """Metadata templates
"""
|
data_structures/sets/quick_find_union_find.py | vinta/fuck-coding-interviews | 590 | 12774896 | # coding: utf-8
"""
Union-Find (Disjoint Set)
https://en.wikipedia.org/wiki/Disjoint-set_data_structure
"""
class QuickFindUnionFind:
def __init__(self, union_pairs=()):
self.num_groups = 0
self.auto_increment_id = 1
self.element_groups = {
# element: group_id,
}
... |
fabfile.py | khamidou/kite | 136 | 12774900 | <filename>fabfile.py
# fabfile for update and deploy
# it's necessary to specify an host
from fabric.api import *
from fabric.contrib.project import rsync_project
from fabric.contrib.files import upload_template
from setup_config import *
PACKAGES = ('rsync', 'puppet')
def update_sources():
rsync_project("~", "..... |
alipay/aop/api/domain/AlipayBossOrderDiagnosisGetModel.py | snowxmas/alipay-sdk-python-all | 213 | 12774917 | <reponame>snowxmas/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayBossOrderDiagnosisGetModel(object):
def __init__(self):
self._code = None
self._end_time = None
self._find_operator = None
... |
fatiando/seismic/tests/test_seismic_conv.py | XuesongDing/fatiando | 179 | 12774951 | from __future__ import absolute_import, division
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_allclose
from pytest import raises
from fatiando.seismic import conv
def test_impulse_response():
"""
conv.convolutional_model raises the source wavelet as result when the model
... |
odin/metrics/performance_summary.py | gsamarakoon/Odin | 103 | 12774964 | <reponame>gsamarakoon/Odin<filename>odin/metrics/performance_summary.py
import pandas as pd
from .compute_drawdowns import compute_drawdowns
from .compute_sharpe_ratio import compute_sharpe_ratio
def performance_summary(history, portfolio_id):
"""This function computes common performance metrics for a time-series... |
src/filter.py | Boyploy/IMF | 108 | 12775005 | <filename>src/filter.py
# Copyright (c) 2017 <NAME> and <NAME> at SoftSec, KAIST
#
# See the file LICENCE for copying permission.
import os
import utils
import sys
def parse_name(data):
return data.split('\'')[1]
def parse_selector(data):
if 'selector' in data:
ret = data.split('selector')[1].split('... |
onnx_tf/handlers/backend/conv_transpose.py | malisit/onnx-tensorflow | 1,110 | 12775016 | from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import partial_support
from onnx_tf.handlers.handler import ps_description
from .conv_mixin import ConvMixin
@onnx_op("ConvTranspose")
@partial_support(True)
@ps_description("ConvTran... |
PWGJE/EMCALJetTasks/Tracks/analysis/test/PlotScaledTriggered.py | maroozm/AliPhysics | 114 | 12775024 | '''
Created on 22.09.2014
@author: markusfasel
'''
from PWGJE.EMCALJetTasks.Tracks.analysis.base.Graphics import SinglePanelPlot, GraphicsObject, Style, Frame
from PWGJE.EMCALJetTasks.Tracks.analysis.correction.TriggeredSpectrumScaler import TriggeredSpectrumScaler
from PWGJE.EMCALJetTasks.Tracks.analysis.correction.... |
Chapter14/data_preprocessing.py | andriitugai/Learning-Python-data-structures | 202 | 12775072 |
import numpy as np
import pandas
from sklearn.preprocessing import MinMaxScaler, StandardScaler, Binarizer
#handle the missing values
data = pandas.DataFrame([
[4., 45., 984.],
[np.NAN, np.NAN, 5.],
[94., 23., 55.],
])
#print original data
print(data)
#fill the missing values with... |
test/EN.py | miaopei/deep_landmark | 327 | 12775102 | <reponame>miaopei/deep_landmark
#!/usr/bin/env python2.7
# coding: utf-8
"""
This file use Caffe model to predict landmarks and evaluate the mean error.
"""
import os, sys
import time
import cv2
import numpy as np
from numpy.linalg import norm
from common import getDataFromTxt, logger, processImage, getCNNs
TXT ... |
mistral/scheduler/scheduler_server.py | soda-research/mistral | 205 | 12775116 | <reponame>soda-research/mistral
# Copyright 2018 - Nokia Networks.
#
# 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 re... |
migen/fomu.py | Freax13/fomu-workshop | 127 | 12775131 | <filename>migen/fomu.py
""" Fomu board definitions (mapping of I/O pins, clock, etc.) """
from migen import *
from migen.build.generic_platform import *
from migen.build.lattice import LatticePlatform
class FomuPvtPlatform(LatticePlatform):
""" Based on
https://github.com/litex-hub/litex-boards/blob/mast... |
tests/proxy/test_proxy.py | jodal/pykka | 796 | 12775151 | <filename>tests/proxy/test_proxy.py
import pytest
import pykka
from pykka import ActorDeadError, ActorProxy
class NestedObject:
pass
@pytest.fixture(scope="module")
def actor_class(runtime):
class ActorForProxying(runtime.actor_class):
a_nested_object = pykka.traversable(NestedObject())
a_c... |
third_party/Paste/paste/auth/multi.py | tingshao/catapult | 5,079 | 12775162 | # (c) 2005 <NAME>
# This module is part of the Python Paste Project and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
# This code was written with funding by http://prometheusresearch.com
"""
Authentication via Multiple Methods
In some environments, the choice of authenticatio... |
src/pipelinex/extras/ops/allennlp_ops.py | MarchRaBBiT/pipelinex | 188 | 12775174 | class AllennlpReaderToDict:
def __init__(self, **kwargs):
self.kwargs = kwargs
def __call__(self, *args_ignore, **kwargs_ignore):
kwargs = self.kwargs
reader = kwargs.get("reader")
file_path = kwargs.get("file_path")
n_samples = kwargs.get("n_samples")
instances... |
L1Trigger/TrackTrigger/python/TTStubAlgorithmRegister_cfi.py | ckamtsikis/cmssw | 852 | 12775177 | import FWCore.ParameterSet.Config as cms
# First register all the hit matching algorithms, then specify preferred ones at end.
# The stub windows used has been optimized for for PU200 events
# We use by default the tight tuning
#
# Definition is presented here:
#
# https://indico.cern.ch/event/681577/#4-update-of-the... |
recipes/Python/577491_Observer_Design_Pattern_pythgevent_coroutine/recipe-577491.py | tdiprima/code | 2,023 | 12775188 | __author__ = "<NAME>"
__email__ = "<EMAIL>"
import gevent
from gevent import core
from gevent.hub import getcurrent
from gevent.event import Event
from gevent.pool import Pool
import functools
def wrap(method, *args, **kargs):
if method is None:
return None
if args or kargs:
method = functool... |
canopen/sdo/__init__.py | mlederhi/canopen | 301 | 12775189 | <gh_stars>100-1000
from .base import Variable, Record, Array
from .client import SdoClient
from .server import SdoServer
from .exceptions import SdoAbortedError, SdoCommunicationError
|
kansha/services/mail.py | AnomalistDesignLLC/kansha | 161 | 12775215 | <gh_stars>100-1000
# -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
import smtplib
from email.mime.text import MIMEText
from... |
tests/components/opnsense/__init__.py | domwillcode/home-assistant | 30,023 | 12775241 | """Tests for the opnsense component."""
|
recipes/Python/577218_Sphere/recipe-577218.py | tdiprima/code | 2,023 | 12775243 | <gh_stars>1000+
#On the name of ALLAH and may the blessing and peace of Allah
#be upon the Messenger of Allah <NAME>.
#Author : <NAME>
#Date : 06/05/10
#version :2.6
"""
Sphere class represents a geometric sphere and a completing_the_squares
function is used for the purpose, while an utility _checksign function
is us... |
app_config.py | huhansan666666/flask_reddit | 461 | 12775248 | #!/usr/bin/env python2.7
"""
app_config.py will be storing all the module configs.
Here the db uses mysql.
"""
import os
_basedir = os.path.abspath(os.path.dirname(__file__))
DEBUG = False
ADMINS = frozenset(['<EMAIL>'])
SECRET_KEY = ''
SQLALCHEMY_DATABASE_URI = 'DATABASE://USERNAME:PASSWORD@localhost/YOUR_DB_NAME'... |
flask_table/__init__.py | nullptrT/flask_table | 215 | 12775274 | from .table import Table, create_table
from .columns import (
Col,
BoolCol,
DateCol,
DatetimeCol,
LinkCol,
ButtonCol,
OptCol,
NestedTableCol,
BoolNaCol,
)
|
tests/test_parser.py | kittinan/twitter_media_downloader | 161 | 12775305 | # coding: utf-8
"""
Unit tests for the parser module.
"""
from ..src.parser import parse_tweet
# pylint: disable=old-style-class,too-few-public-methods
class Struct:
"""Basic class to convert a struct to a dict."""
def __init__(self, **entries):
self.__dict__.update(entries)
USER = Struct(**{
... |
optimus/engines/pandas/functions.py | ironmussa/Optimus | 1,045 | 12775311 | <reponame>ironmussa/Optimus
import numpy as np
import pandas as pd
from optimus.engines.base.pandas.functions import PandasBaseFunctions
from optimus.engines.base.dataframe.functions import DataFrameBaseFunctions
class PandasFunctions(PandasBaseFunctions, DataFrameBaseFunctions):
_engine = pd
@staticmetho... |
iexfinance/tests/stocks/test_market_movers.py | jto-d/iexfinance | 653 | 12775350 | <filename>iexfinance/tests/stocks/test_market_movers.py
import pandas as pd
import pytest
from iexfinance.stocks import (
get_market_gainers,
get_market_iex_percent,
get_market_iex_volume,
get_market_losers,
get_market_most_active,
)
class TestMarketMovers(object):
def test_market_gainers(sel... |
ztag/annotations/FtpKebi.py | justinbastress/ztag | 107 | 12775353 | <gh_stars>100-1000
import re
from ztag.annotation import Annotation
from ztag.annotation import OperatingSystem
from ztag import protocols
import ztag.test
class FtpKebi(Annotation):
protocol = protocols.FTP
subprotocol = protocols.FTP.BANNER
port = None
impl_re = re.compile("^220- Kebi FTP Server", ... |
sp_api/auth/credentials.py | lionsdigitalsolutions/python-amazon-sp-api | 213 | 12775374 | import os
class Credentials:
def __init__(self, refresh_token, credentials):
self.client_id = credentials.lwa_app_id
self.client_secret = credentials.lwa_client_secret
self.refresh_token = refresh_token or credentials.refresh_token
|
tests.py | qiang123/regal | 432 | 12775383 | from unittest import TestCase
from regal import BaseInfo
from regal.grouping import GroupAlgorithm
from regal.check_interface import AlgorithmABC
# Run Method: python -m unittest -v tests.py
class TestBaseInfoInitial(TestCase):
def test_empty_info(self):
ab = BaseInfo('', '', '')
with self.assert... |
neural_compressor/ux/utils/workload/tuning.py | intel/neural-compressor | 172 | 12775409 | # -*- coding: utf-8 -*-
# Copyright (c) 2021-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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
tests/domain/book/test_book.py | tamanobi/dddpy | 170 | 12775422 | import pytest
from dddpy.domain.book import Book, Isbn
class TestBook:
def test_constructor_should_create_instance(self):
book = Book(
id="book_01",
isbn=Isbn("978-0321125217"),
title="Domain-Driven Design: Tackling Complexity in the Heart of Softwares",
pa... |
lackey/KeyCodes.py | Inobitec/lackey | 599 | 12775456 | <reponame>Inobitec/lackey
class Button():
LEFT = 0
CENTER = 1
RIGHT = 2
class Key():
""" Key codes for InputEmulation.Keyboard object.
Can be entered directly or concatenated with an existing string, e.g. ``type(Key.TAB)`` """
ENTER = "{ENTER}"
ESC = "{ESC}"
BACKSPACE = "{BACKSPAC... |
Blender Export/objc-export-2.5/objc_blend_2.5.6/export_objc.py | JavaZava/iOS-OpenGLES-Stuff | 199 | 12775463 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
src/ydata_quality/utils/modelling.py | poga/ydata-quality | 242 | 12775477 | """
Utilities based on building baseline machine learning models.
"""
from typing import Union, Optional
from pandas import DataFrame, Series
from numpy import mean, tile, empty, std, square, sqrt, log as nplog, reciprocal
from scipy.stats import boxcox, normaltest, mode
from sklearn.compose import ColumnTransformer
f... |
aggregables/sequences/suffix_trees/suffix_trees/test/test_simple.py | nevesnunes/aggregables | 106 | 12775482 | <filename>aggregables/sequences/suffix_trees/suffix_trees/test/test_simple.py
from suffix_trees import STree
def test_lcs():
a = ["abeceda", "abecednik", "abeabecedabeabeced",
"abecedaaaa", "aaabbbeeecceeeddaaaaabeceda"]
st = STree.STree(a)
assert st.lcs() == "abeced", "LCS test"
def test_missi... |
Tests/image_tests/renderpasses/graphs/ForwardRendering.py | wsqjny/Falcor | 1,615 | 12775491 | from falcor import *
def render_graph_ForwardRendering():
loadRenderPassLibrary("DepthPass.dll")
loadRenderPassLibrary("ForwardLightingPass.dll")
loadRenderPassLibrary("BlitPass.dll")
testForwardRendering = RenderGraph("ForwardRenderer")
DepthPass = createPass("DepthPass", {'depthFormat': ResourceF... |
tests/lib/collectors/bigquery.py | dfjxs/dftimewolf | 191 | 12775535 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests the BigQuery collector."""
import unittest
import mock
from dftimewolf.lib import state
from dftimewolf.lib.collectors import bigquery
from dftimewolf import config
class BigQueryCollectorTest(unittest.TestCase):
"""Tests for the BigQuery collector."""
d... |
tests/r/test_engel.py | hajime9652/observations | 199 | 12775552 | <reponame>hajime9652/observations<gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.engel import engel
def test_engel():
"""Test module engel.py by downloading
engel.csv and... |
dvc/parsing/versions.py | lucasalavapena/dvc | 9,136 | 12775586 | <reponame>lucasalavapena/dvc
import enum
from collections.abc import Mapping
from voluptuous import validators
SCHEMA_KWD = "schema"
META_KWD = "meta"
def lockfile_version_schema(value):
expected = [LOCKFILE_VERSION.V2.value] # pylint: disable=no-member
msg = "invalid schema version {}, expected one of {}"... |
tcapy_examples/gen/mongo_aws_examples.py | Ahrvo-Trading-Systems/tcapy | 189 | 12775616 | <reponame>Ahrvo-Trading-Systems/tcapy
"""This shows how we can connect to an instance of MongoDB Atlas to read/write market tick data
Note, that you will need to get a MongoDB Atlas cloud account, and change the connection string below for it to work
"""
__author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 202... |
atlas/foundations_rest_api/src/foundations_rest_api/versioning.py | DeepLearnI/atlas | 296 | 12775651 | from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution('foundations_rest_api').version
except DistributionNotFound:
__version__ = None |
allennlp_models/tagging/predictors/sentence_tagger.py | matt-peters/allennlp-models | 402 | 12775658 | from allennlp.predictors.sentence_tagger import SentenceTaggerPredictor # noqa: F401
# This component lives in the main repo because we need it there for tests.
|
pycoind/blockchain/transaction.py | peerchemist/pycoind | 120 | 12775697 | <gh_stars>100-1000
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# 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 us... |
Examples/Python/ImageCreateAndSet.py | nathantspencer/SimpleElastix | 350 | 12775699 | <reponame>nathantspencer/SimpleElastix
#!/usr/bin/env python
#=========================================================================
#
# Copyright NumFOCUS
#
# 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... |
examples/registration/demo.py | mli0603/lietorch | 360 | 12775725 | import sys
sys.path.append('../core')
import argparse
import torch
import cv2
import numpy as np
from viz import sim3_visualization
from lietorch import SO3, SE3, Sim3
from networks.sim3_net import Sim3Net
def normalize_images(images):
images = images[:, :, [2,1,0]]
mean = torch.as_tensor([0.485, 0.456, 0.40... |
ci/delete_old_binaries.py | NoahR02/Odin | 2,690 | 12775751 | import subprocess
import sys
import json
import datetime
import urllib.parse
import sys
def main():
files_by_date = {}
bucket = sys.argv[1]
days_to_keep = int(sys.argv[2])
print(f"Looking for binaries to delete older than {days_to_keep} days")
files_lines = execute_cli(f"b2 ls --long --versions {b... |
pybitcoin/transactions/scripts.py | sea212/pybitcoin | 220 | 12775755 | <filename>pybitcoin/transactions/scripts.py
# -*- coding: utf-8 -*-
"""
pybitcoin
~~~~~
:copyright: (c) 2014 by Halfmoon Labs
:license: MIT, see LICENSE for more details.
"""
from .opcodes import *
from .utils import count_bytes
from ..constants import MAX_BYTES_AFTER_OP_RETURN
from ..b58check import ... |
vectorhub/encoders/video/sampler.py | boba-and-beer/vectorhub | 385 | 12775798 | <gh_stars>100-1000
from math import ceil
import numpy as np
import os
import tempfile
from ...import_utils import *
if is_all_dependency_installed('encoders-video'):
import librosa
import soundfile as sf
from cv2 import cv2
from moviepy.video.io.ffmpeg_reader import ffmpeg_parse_infos
from moviepy.... |
cnn_train.py | sg-nm/Operation-wise-attention-network | 102 | 12775864 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
from torch.utils.data import DataLoader
import torchvision.transforms as transfor... |
sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_resource_management_client_enums.py | rsdoherty/azure-sdk-for-python | 2,728 | 12775874 | <reponame>rsdoherty/azure-sdk-for-python<filename>sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_resource_management_client_enums.py
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved... |
wouso/games/challenge/urls.py | AlexandruGhergut/wouso | 117 | 12775921 | <gh_stars>100-1000
from django.conf.urls.defaults import *
urlpatterns = patterns('wouso.games.challenge.views',
url(r'^$', 'index', name='challenge_index_view'),
url(r'^(?P<id>\d+)/$', 'challenge', name='view_challenge'),
url(r'^launch/(?P<to_id>\d+)/$', 'launch', name='challenge_launch'),
url(r'^refu... |
extraPackages/matplotlib-3.0.3/examples/lines_bars_and_markers/vline_hline_demo.py | dolboBobo/python3_ios | 130 | 12775943 | <reponame>dolboBobo/python3_ios
"""
=================
hlines and vlines
=================
This example showcases the functions hlines and vlines.
"""
import matplotlib.pyplot as plt
import numpy as np
t = np.arange(0.0, 5.0, 0.1)
s = np.exp(-t) + np.sin(2 * np.pi * t) + 1
nse = np.random.normal(0.0, 0.3, t.shape) *... |
v7.0/map_analyze.py | jsstwright/osumapper | 296 | 12775982 | # -*- coding: utf-8 -*-
#
# JSON osu! map analysis
#
import numpy as np;
def get_map_timing_array(map_json, length=-1, divisor=4):
if length == -1:
length = map_json["obj"][-1]["time"] + 1000; # it has an extra time interval after the last note
if map_json["obj"][-1]["type"] & 8: # spinner end
... |
extra/test_multi.py | ragnariock/DeepFashion | 255 | 12775984 | ### IMPORTS
from __future__ import print_function
import os
import fnmatch
import numpy as np
import skimage.data
import cv2
import sys
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from PIL import Image
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
fr... |
tensorflow_graphics/rendering/tests/splat_with_opengl_test.py | sarvex/graphics | 2,759 | 12775993 | <filename>tensorflow_graphics/rendering/tests/splat_with_opengl_test.py<gh_stars>1000+
# Copyright 2020 The TensorFlow 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
#
# https://w... |
Python/neon_numbers.py | MjCode01/DS-Algo-Point | 1,148 | 12776001 | # Neon number --> If the sum of digits of the squared numbers are equal to the orignal number , the number is said to be Neon number. Example 9
ch=int(input("Enter 1 to do it with loop and 2 without loop :\n"))
n= int(input("Enter the number :\n"))
def number(n):
sq= n**2
digisum=0
while sq>0:
r... |
src/python/nimbusml/linear_model/symsgdbinaryclassifier.py | michaelgsharp/NimbusML | 134 | 12776039 | # --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------------------------
# - Generated by tools/entrypoint_co... |
homeassistant/components/derivative/__init__.py | domwillcode/home-assistant | 22,481 | 12776049 | """The derivative component."""
|
Codes/gracekoo/interview_8.py | ghoslation/algorithm | 256 | 12776092 | # -*- coding: utf-8 -*-
# @Time: 2020/7/16 11:38
# @Author: GraceKoo
# @File: interview_8.py
# @Desc: https://www.nowcoder.com/practice/8c82a5b80378478f9484d87d1c5f12a4?tpId=13&rp=1&ru=%2Fta%2Fcoding-interviews&qr
# u=%2Fta%2Fcoding-interviews%2Fquestion-ranking
class Solution:
def climbStairs(self, n: int) -> in... |
tests/components/slack/__init__.py | tbarbette/core | 22,481 | 12776095 | <reponame>tbarbette/core
"""Slack notification tests."""
|
LeetCode/python3/47.py | ZintrulCre/LeetCode_Archiver | 279 | 12776107 | <reponame>ZintrulCre/LeetCode_Archiver<gh_stars>100-1000
class Solution:
def permuteUnique(self, nums: List[int]) -> List[List[int]]:
def BackTrack(m, per: list):
if m == n:
if per not in permutation:
permutation.append(per)
return per
... |
Trakttv.bundle/Contents/Libraries/Shared/oem/media/show/__init__.py | disrupted/Trakttv.bundle | 1,346 | 12776127 | <reponame>disrupted/Trakttv.bundle
from oem.media.show.identifier import EpisodeIdentifier # NOQA
from oem.media.show.mapper import ShowMapper # NOQA
from oem.media.show.match import EpisodeMatch # NOQA
|
tests/fork/conftest.py | AqualisDAO/curve-dao-contracts | 217 | 12776163 | <gh_stars>100-1000
import pytest
from brownie_tokens import MintableForkToken
class _MintableTestToken(MintableForkToken):
def __init__(self, address):
super().__init__(address)
@pytest.fixture(scope="session")
def MintableTestToken():
yield _MintableTestToken
@pytest.fixture(scope="module")
def U... |
bleurt/score_test.py | yongchanghao/bleurt | 416 | 12776167 | <reponame>yongchanghao/bleurt
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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/LICEN... |
alphamind/portfolio/meanvariancebuilder.py | rongliang-tech/alpha-mind | 186 | 12776189 | # -*- coding: utf-8 -*-
"""
Created on 2017-6-27
@author: cheng.li
"""
from typing import Dict
from typing import Optional
from typing import Tuple
from typing import Union
import numpy as np
from alphamind.portfolio.optimizers import (
QuadraticOptimizer,
TargetVolOptimizer
)
from alphamind.exceptions.excep... |
code_sender/rstudio/__init__.py | fredcallaway/SendCode | 177 | 12776198 | import sublime
import os
from ..clipboard import clipboard
plat = sublime.platform()
if plat == "osx":
from ..applescript import osascript
RSTUDIOAPPLESCRIPT = os.path.join(os.path.dirname(__file__), "rstudio.applescript")
def send_to_rstudio(cmd):
osascript(RSTUDIOAPPLESCRIPT, cmd)
elif plat =... |
2_writeups/3_robot_exploitation/tutorial7/example5.py | araujorayza/robot_hacking_manual | 141 | 12776236 | #!/usr/bin/env python
from pwn import *
import os
# Exploiting vulnerable code narnia1.c:
#
# #include <stdio.h>
#
# int main(){
# int (*ret)();
#
# if(getenv("EGG")==NULL){
# printf("Give me something to execute at the env-variable EGG\n");
# exit(1);
# }
#
# printf("Trying to execute EGG!\n");
# ret = geten... |
metaflow/plugins/aws/aws_utils.py | Netflix/metaflow | 5,821 | 12776238 | <gh_stars>1000+
import re
def get_docker_registry(image_uri):
"""
Explanation:
(.+?(?:[:.].+?)\/)? - [GROUP 0] REGISTRY
.+? - A registry must start with at least one character
(?:[:.].+?)\/ - A registry must have ":" or "." and end with "/"
? ... |
textx/scoping/__init__.py | stanislaw/textX | 346 | 12776240 | <reponame>stanislaw/textX
#######################################################################
# Name: scoping.__init__.py
# Purpose: Meta-model / scope providers.
# Author: <NAME>
# License: MIT License
#######################################################################
import glob
import os
import errno
from ... |
mpi4jax/_src/flush.py | Thenerdstation/mpi4jax | 122 | 12776281 | <reponame>Thenerdstation/mpi4jax
import jax
def flush(platform):
"""Wait for all pending XLA operations"""
devices = jax.devices(platform)
for device in devices:
# as suggested in jax#4335
noop = jax.device_put(0, device=device) + 0
noop.block_until_ready()
|
dask/dataframe/io/orc/__init__.py | Juanlu001/dask | 9,684 | 12776284 | <filename>dask/dataframe/io/orc/__init__.py
from .core import read_orc, to_orc
|
ioflo/base/__init__.py | BradyHammond/ioflo | 128 | 12776308 | <filename>ioflo/base/__init__.py
""" base package
"""
#print("Package at {0}".format(__path__[0]))
import importlib
_modules = ['globaling', 'excepting', 'interfacing',
'registering', 'storing', 'skedding',
'tasking', 'framing', 'logging', 'serving', 'monitoring',
'acting', 'poking',... |
tools/writeBurlyWeights.py | fsanges/glTools | 165 | 12776339 | import maya.mel as mm
import maya.cmds as mc
import maya.OpenMaya as OpenMaya
import glTools.utils.base
import glTools.utils.mesh
import glTools.utils.skinCluster
import os.path
def writeBurlyWeights(mesh,skinCluster,influence,filePath):
'''
'''
# Get basic procedure information
burly = 'dnBurlyDeformer1'
vtxCo... |
src/swiftlet/azext_swiftlet/vendored_sdks/swiftlet/operations/_virtual_machine_operations.py | Mannan2812/azure-cli-extensions | 207 | 12776373 | <gh_stars>100-1000
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Genera... |
Face Reconstruction/Self-Supervised Monocular 3D Face Reconstruction by Occlusion-Aware Multi-view Geometry Consistency/src_common/geometry/render/api_tf_mesh_render.py | swapnilgarg7/Face-X | 302 | 12776414 | <filename>Face Reconstruction/Self-Supervised Monocular 3D Face Reconstruction by Occlusion-Aware Multi-view Geometry Consistency/src_common/geometry/render/api_tf_mesh_render.py<gh_stars>100-1000
# system
from __future__ import print_function
# python lib
import math
from copy import deepcopy
import numpy as np
# t... |
cupyx/fallback_mode/__init__.py | prkhrsrvstv1/cupy | 6,180 | 12776416 | <reponame>prkhrsrvstv1/cupy
from cupy import _util
# Attributes and Methods for fallback_mode
# Auto-execute numpy method when corresponding cupy method is not found
# "NOQA" to suppress flake8 warning
from cupyx.fallback_mode.fallback import numpy # NOQA
_util.experimental('cupyx.fallback_mode.numpy')
|
tick/solver/history/__init__.py | sumau/tick | 411 | 12776419 | # License: BSD 3 clause
# import tick.base
from .history import History
__all__ = ["History"]
|
tests/test_api.py | chrononyan/ok | 148 | 12776431 | <filename>tests/test_api.py
import datetime as dt
import dateutil.parser
import json
import random
from server.models import (Client, db, Assignment, Backup, Course, User,
Version, Group, )
from server.utils import encode_id
from tests import OkTestCase
class TestApi(OkTestCase):
def _... |
rollbar/examples/flask/app.py | arthurio/pyrollbar | 177 | 12776450 | <filename>rollbar/examples/flask/app.py
# NOTE: pyrollbar requires both `Flask` and `blinker` packages to be installed first
from flask import Flask
from flask import got_request_exception
import rollbar
import rollbar.contrib.flask
app = Flask(__name__)
@app.before_first_request
def init_rollbar():
rollbar.in... |
qa/L0_stability_steps/check_results.py | MarkMoTrin/model_analyzer | 115 | 12776460 | <filename>qa/L0_stability_steps/check_results.py<gh_stars>100-1000
# Copyright (c) 2021 NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#... |
custom_components/bhyve/util.py | jdreamerz/bhyve-home-assistant | 122 | 12776468 | from homeassistant.util import dt
def orbit_time_to_local_time(timestamp: str):
if timestamp is not None:
return dt.as_local(dt.parse_datetime(timestamp))
return None
def anonymize(device):
device["address"] = "REDACTED"
device["full_location"] = "REDACTED"
device["location"] = "REDACTED... |
cx_Freeze/initscripts/SharedLib.py | TechnicalPirate/cx_Freeze | 358 | 12776474 | """
Initialization script for cx_Freeze which behaves similarly to the one for
console based applications but must handle the case where Python has already
been initialized and another DLL of this kind has been loaded. As such it
does not block the path unless sys.frozen is not already set.
"""
import sys
if not hasa... |
python_solutions/chapter_08_recursion_and_dynamic_programming/problem_08_08_permutations_with_dups.py | isayapin/cracking-the-coding-interview | 560 | 12776494 | def permutations_with_dups(string):
hash_table = {}
permutations = []
for character in string:
if character in hash_table:
hash_table[character] += 1
else:
hash_table[character] = 1
helper('', hash_table, permutations)
return permutations
def helper(string, ... |
bin/commands/corpus.py | davidmcclure/open-syllabus-project | 220 | 12776520 |
import os
import click
import csv
import random
import sys
from osp.common import config
from osp.common.utils import query_bar
from osp.corpus.corpus import Corpus
from osp.corpus.models import Document
from osp.corpus.models import Document_Format
from osp.corpus.models import Document_Text
from osp.corpus.jobs im... |
pysph/tools/pysph_to_vtk.py | nauaneed/pysph | 293 | 12776522 | <reponame>nauaneed/pysph
''' convert pysph .npz output to vtk file format '''
from __future__ import print_function
import os
import re
from enthought.tvtk.api import tvtk, write_data
from numpy import array, c_, ravel, load, zeros_like
def write_vtk(data, filename, scalars=None, vectors={'V':('u','v','w')}, tensors... |
brml/multpots.py | herupraptono/pybrml | 136 | 12776553 | <reponame>herupraptono/pybrml
#!/usr/bin/env python
"""
MULTPOTS Multiply potentials into a single potential
newpot = multpots(pots)
multiply potentials : pots is a cell of potentials
potentials with empty tables are ignored
if a table of type 'zero' is encountered, the result is a table of type
'zero' with table 0, ... |
Chapter06/Ch6/demo/indexing.py | henrryyanez/Tkinter-GUI-Programming-by-Example | 127 | 12776563 | import tkinter as tk
win = tk.Tk()
current_index = tk.StringVar()
text = tk.Text(win, bg="white", fg="black")
lab = tk.Label(win, textvar=current_index)
def update_index(event=None):
cursor_position = text.index(tk.INSERT)
cursor_position_pieces = str(cursor_position).split('.')
cursor_line = cursor_pos... |
python/234_Palindrome_Linked_List.py | dvlpsh/leetcode-1 | 4,416 | 12776583 | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
# def __init__(self):
# self.curr_head = None
#
# def isPalindrome(self, head):
# """
# :type head: ListNode
# ... |
inst/python/rpytools/help.py | flyaflya/reticulate | 1,476 | 12776592 |
import sys
import types
import inspect
def isstring(s):
# if we use Python 3
if (sys.version_info[0] >= 3):
return isinstance(s, str)
# we use Python 2
return isinstance(s, basestring)
def normalize_func(func):
# return None for builtins
if (inspect.isbuiltin(func)):
return N... |
bibliopixel/commands/devices.py | rec/leds | 253 | 12776594 | <reponame>rec/leds
"""
Find serial devices and update serial device IDs
"""
from .. util import log
CONNECT_MESSAGE = """
Connect just one Serial device (AllPixel) and press enter..."""
def run(args):
from ..drivers.serial.driver import Serial
from ..drivers.serial.devices import Devices
import serial
... |
chapter13/asyncgmaps.py | lixin940207/expert_python_programming | 189 | 12776622 | <reponame>lixin940207/expert_python_programming<gh_stars>100-1000
# -*- coding: utf-8 -*-
import aiohttp
session = aiohttp.ClientSession()
async def geocode(place):
params = {
'sensor': 'false',
'address': place
}
async with session.get(
'https://maps.googleapis.com/maps/api/geoco... |
stinger_client.py | wisdark/pystinger | 973 | 12776649 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# @File : client.py
# @Date : 2019/8/28
# @Desc :
# @license : Copyright(C), funnywolf
# @Author: funnywolf
# @Contact : github.com/FunnyWolf
import argparse
import struct
import threading
import time
from socket import AF_INET, SOCK_STREAM
from threading import Thread
i... |
module/caffe/module.py | dividiti/ck-caffe | 212 | 12776667 | #
# Collective Knowledge (caffe CK front-end)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: cTuning foundation, <EMAIL>, http://cTuning.org
#
cfg={} # Will be updated by CK (meta description of this module)
work={} # Will be updated by CK (temporal data)
ck=N... |
Dijkstra's_Shortest_Path/Python/paveldedik/dijkstra.py | Mynogs/Algorithm-Implementations | 1,184 | 12776686 | <reponame>Mynogs/Algorithm-Implementations
def initialize(G, s):
"""Initialize graph G and vertex s."""
V, E = G
d = {v: float('inf') for v in V}
p = {v: None for v in V}
d[s] = 0
return d, p
def dijkstra(G, w, s):
"""Dijkstra's algorithm for shortest-path search."""
d, p = initialize(... |
tests/test_excel.py | hacklabr/django-rest-pandas | 1,097 | 12776688 | <gh_stars>1000+
from rest_framework.test import APITestCase
from tests.testapp.models import TimeSeries
from wq.io import load_file
class ExcelTestCase(APITestCase):
def setUp(self):
data = (
('2014-01-01', 0.5),
('2014-01-02', 0.4),
('2014-01-03', 0.6),
('2... |
dsio/dashboard/kibana.py | ufoioio/datastream.io | 897 | 12776692 | <filename>dsio/dashboard/kibana.py<gh_stars>100-1000
import elasticsearch
from kibana_dashboard_api import Visualization, Dashboard
from kibana_dashboard_api import VisualizationsManager, DashboardsManager
from ..exceptions import KibanaConfigNotFoundError
def generate_dashboard(es_conn, sensor_names, index_name, t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.