content stringlengths 7 928k | avg_line_length float64 3.5 33.8k | max_line_length int64 6 139k | alphanum_fraction float64 0.08 0.96 | licenses list | repository_name stringlengths 7 104 | path stringlengths 4 230 | size int64 7 928k | lang stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|
import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Concat(function.Function):
"""Concatenate multiple tensors towards specified axis."""
# concat along the channel dimension by default
def __init__(self, axis=1):
self.axis = axis
d... | 29.425926 | 79 | 0.600378 | [
"MIT"
] | umitanuki/chainer | chainer/functions/concat.py | 1,589 | Python |
import cv2
def mean(image):
return cv2.medianBlur(image, 5)
def gaussian(image):
return cv2.GaussianBlur(image, (5, 5), 0)
| 13.5 | 45 | 0.674074 | [
"MIT"
] | Lukasz1928/DICOM-viewer | viewer/images/edits/blur.py | 135 | Python |
class BluePrint:
def __init__(self, build_config, build_class, name="", run_end_of_year=False):
self.run_end_of_year = run_end_of_year
self.name = name
self.build_config = build_config
self.build_class = build_class
| 36 | 82 | 0.698413 | [
"MIT"
] | tnikodem/futureplaner | fup/core/config.py | 252 | Python |
import faker
from unittest import mock
from unittest.mock import patch
from foundations_spec import *
from foundations_core_cli.command_line_interface import CommandLineInterface
from foundations_atlas_cli.sub_parsers.atlas.atlas_parser import AtlasParser
class TestAtlasParser(Spec):
class MockSleep(object):
... | 40.398034 | 190 | 0.713478 | [
"Apache-2.0"
] | DeepLearnI/atlas | atlas/foundations_atlas_cli/src/test/sub_parsers/test_atlas_parser.py | 16,442 | Python |
# 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... | 38.634146 | 80 | 0.728325 | [
"Apache-2.0"
] | 04mayukh/google-research | covid_epidemiology/src/models/encoders/variable_encoder_builder.py | 4,752 | Python |
class Solution:
def singleNumber(self, nums: List[int]) -> int:
a = set()
for i in nums:
if i in a:
a.remove(i)
else:
a.add(i)
for i in a:
return i | 23.636364 | 51 | 0.373077 | [
"MIT"
] | FAPractice/leetcode | amazonSingleNumber.py | 260 | Python |
#! /usr/bin/env python
# -*- coding: utf8 -*-
'''
Copyright 2018 University of Liège
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 requir... | 31.3375 | 95 | 0.64659 | [
"Apache-2.0"
] | AxelDechamps/CUPyDO | tests/SU2_RBM/PitchPlungeAirfoil_BGS_parallel_fsi.py | 2,508 | Python |
import functools
import jinja2
import json
import threading
from hashlib import sha256
from ..caserunconfiguration import CaseRunConfiguration, ConfigurationsList, CaseRunConfigurationsList
#from ..exceptions import UnknownEventSubTypeExpression
from .functions import dotted_startswith
from .structures.factory import ... | 40.456522 | 148 | 0.679742 | [
"MIT"
] | rhinstaller/permian | libpermian/events/base.py | 5,583 | Python |
# coding: utf-8
"""
FlashArray REST API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typing
from .... | 29.895161 | 109 | 0.551929 | [
"BSD-2-Clause"
] | Flav-STOR-WL/py-pure-client | pypureclient/flasharray/FA_2_1/models/retention_policy.py | 3,707 | Python |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 48.032313 | 214 | 0.659455 | [
"MIT"
] | Hamster-Huey/azure-cli-extensions | src/datamigration/azext_datamigration/vendored_sdks/datamigration/aio/operations/_tasks_operations.py | 28,243 | Python |
from django.apps import AppConfig
class ComputecalcConfig(AppConfig):
name = 'computecalc'
| 16.166667 | 35 | 0.773196 | [
"MIT"
] | mojosan7/cloudcalc | src/computecalc/apps.py | 97 | Python |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 29 16:02:11 2019
@author: Christian Zwinkels-Valero
"""
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
# Activation functions
def sigmoid(z):
return 1 / (1 + np.exp(z))
def d_sigmoid(z):
return sigmoid(z)*(1 - sigmoid(z))
def relu(... | 26.327103 | 76 | 0.555911 | [
"MIT"
] | Christian-Zwinkels-CAS/Machine-Learning-Attempt | Supervised_Learning/Neural_Network/NN.py | 2,817 | Python |
"""Get example scripts, notebooks, and data files."""
import argparse
from datetime import datetime, timedelta
from glob import glob
import json
import os
import pkg_resources
from progressbar import ProgressBar
try:
# For Python 3.0 and later
from urllib.request import urlopen
except ImportError:
# Fall b... | 34.486301 | 81 | 0.664548 | [
"MIT"
] | becgorton/parcels | parcels/scripts/get_examples.py | 5,035 | Python |
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 40.081608 | 86 | 0.697329 | [
"Apache-2.0"
] | BobiGilburd/gsutil | gslib/commands/notification.py | 32,907 | Python |
from spyre import server
import pickle
class StockExample(server.App):
title = "Historical Stock Prices"
inputs = [{
"input_type": 'dropdown',
"label": 'Company',
"options": [
{"label": "Google", "value": "GOOG"},
{"label": "Yahoo", "value": "YHOO"},
... | 24.238095 | 70 | 0.535363 | [
"MIT"
] | adamhajari/spyre | tutorial/quickstart/stocks_example_no_internet_simple2.py | 1,018 | Python |
#!/bin/env python3
import os
import time
import socket
import pickle
from optparse import OptionParser
if __name__=='__main__':
parser = OptionParser(usage="%prog: [options]")
parser.add_option("", "--fname", dest="fname", type="string",
help="Send a file, can also put filename at en... | 28.40678 | 84 | 0.592482 | [
"MIT"
] | Fullaxx/RapidBuilds | RapidBuild64/003-interp/RLBFILES/rootcopy/usr/bin/rl_mcastsend.py | 1,676 | Python |
from os import path
from setuptools import find_packages, setup
here = path.abspath(path.dirname(__file__))
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name="calver",
description="Setuptools extension for CalVer package versions",
long_descripti... | 28.628571 | 67 | 0.651697 | [
"Apache-2.0"
] | di/calver | setup.py | 1,002 | Python |
import tensorflow as tf
from google.protobuf import json_format, text_format
from tensorflow.contrib import graph_editor as ge
def save():
with tf.Graph().as_default() as g:
x = tf.placeholder(tf.float32, name="input")
a = tf.Variable(5.0)
res: tf.Tensor = tf.multiply(a, x, name="mul")
... | 30.225 | 96 | 0.547974 | [
"MIT"
] | nmiculinic/minion-basecaller | mincall/_experiments/load_save_modify.py | 2,418 | Python |
from one import abc
print("Hello")
abc.abc() | 14.666667 | 19 | 0.727273 | [
"MIT"
] | Maurya232Abhishek/Python-repository-for-basics | Interchange.py | 44 | Python |
import base64
try:
import json
except ImportError:
try:
import simplejson as json
except ImportError:
import django.utils.simplejson as json
import boto.sqs.message
from django.contrib.contenttypes.models import ContentType
class ModelInstanceMessage(boto.sqs.message.RawMessage):
""... | 28.034483 | 74 | 0.603936 | [
"BSD-3-Clause"
] | mpasternacki/django-sqs | django_sqs/message.py | 1,626 | Python |
from __future__ import print_function
import sys
from operator import add
from pyspark import SparkContext
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
import sys
import requests
from operator import add
from pyspark.sql.types import *
from pyspark.sql import functions as... | 35.092409 | 168 | 0.622966 | [
"BSD-3-Clause"
] | AvantikaDG/MET-CS777 | Spark-Example-TPCH/TPCH-Example_Solution_Dataframe.py | 10,633 | Python |
__copyright__ = "Copyright 2016-2018, Netflix, Inc."
__license__ = "Apache, Version 2.0"
"""
Run embedded doctests
"""
import doctest
from vmaf.tools import misc
from vmaf.tools import stats
def test_doctest():
doctest.testmod(misc)
doctest.testmod(stats)
| 16.75 | 52 | 0.735075 | [
"Apache-2.0"
] | 2uropa/vmaf | python/test/doctest_test.py | 268 | Python |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the ... | 36.730769 | 80 | 0.604188 | [
"Apache-2.0"
] | marcofavorito/agents-aea | packages/fetchai/skills/gym/__init__.py | 955 | Python |
dist = int(input())
clubs = int(input())
clublist = []
strokes = [0]*(dist+1)
for i in range(clubs):
clublist.append(int(input()))
for i in range(1, dist+1):
min_club = 1000000
for j in range(clubs):
if i - clublist[j] >= 0:
min_club = min(min_club, strokes[i-clublist[j]]+1)
str... | 20.521739 | 62 | 0.612288 | [
"MIT"
] | Togohogo1/Programming-Problems | CCC/CCC_00_S4_Golf.py | 472 | Python |
from vyxal.parse import parse
from vyxal.transpile import transpile
def test_if():
# TODO(user/cgccuser) try with more branches
vy = """[ 1 | 2 ]"""
py = transpile(vy)
expected = """condition = pop(stack, 1, ctx=ctx)
if boolify(condition, ctx):
stack.append(1)
else:
stack.append(2)
"""
ass... | 21.1875 | 52 | 0.640118 | [
"MIT"
] | a-stone-arachnid/Vyxal | tests/test_transpiler.py | 339 | Python |
# 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 t... | 39.224138 | 79 | 0.675824 | [
"Apache-2.0"
] | 10088/keystone | keystone/tests/unit/credential/test_backend_sql.py | 4,550 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Twinboundary plot
This module provide various kinds of plot related to twin boudnary.
"""
import numpy as np
from copy import deepcopy
from twinpy.plot.base import line_chart
def plot_plane(ax,
distances:list,
z_coords:list,
... | 28.034091 | 78 | 0.502635 | [
"MIT"
] | kei0822kei/twinpy | twinpy/plot/twinboundary.py | 4,934 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tools
import db
import time
import re
import json
from plugins import base
# from plugins import lista
from plugins import listb
from plugins import dotpy
class Iptv (object):
def __init__ (self) :
self.T = tools.Tools()
self.DB = db.DataBase()... | 26.276786 | 86 | 0.458716 | [
"MIT"
] | SchumyHao/iptv-m3u-maker | main.py | 2,991 | Python |
# isort:skip_file
from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
import torch_glow
from torch_glow import InputMeta, CompilationOptions, GlowCompileSpec
import torch
class Model(torch.nn.Module):
def __init__(self):
super(Model, self).__init__()
... | 26.723404 | 82 | 0.696656 | [
"Apache-2.0"
] | 842974287/glow | torch_glow/tests/functionality/randomize_constants_test.py | 1,256 | Python |
from .convert_index_to_indices import convert_index_to_indices as index_to_indices
from .convert_indices_to_index import convert_indices_to_index as indices_to_index
from .convert_indices_to_zip_type import convert_indices_to_zip_type as indices_to_zip_type
from .convert_zip_type_to_indices import convert_zip_type_to_i... | 70 | 91 | 0.92 | [
"MIT"
] | cantbeblank96/kevin_toolbox | kevin/machine_learning/patch_for_numpy/axis_and_dim/convert/__init__.py | 350 | Python |
"""
##################################################################################################
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : test.py
# Abstract : The common testing api for video text recognition, track, quality ... | 32.052632 | 98 | 0.539135 | [
"Apache-2.0"
] | hikopensource/DAVAR-Lab-OCR | davarocr/davarocr/davar_videotext/apis/test.py | 1,827 | Python |
# -*- coding: utf-8 -*-
"""
pyQode is a source code editor widget for PyQt5
pyQode is a **namespace package**.
"""
import pkg_resources
pkg_resources.declare_namespace(__name__)
| 19.888889 | 47 | 0.731844 | [
"MIT"
] | SunChuquin/pyqode.qt | pyqode/__init__.py | 179 | Python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*- #
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
# If your site is available via HTTPS, make sure SITEURL begins with https://
SITEURL = ''
RELA... | 22.541667 | 77 | 0.733826 | [
"MIT"
] | jandolezal/planetavos | publishconf.py | 541 | Python |
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = | 15.076923 | 40 | 0.77551 | [
"MIT"
] | mjhow4/attendance-app | Court-APP/users/__init__.py | 196 | Python |
from pyspedas import tnames
from pytplot import get_data, store_data, options
def mms_load_fpi_calc_pad(probe='1', level='sitl', datatype='', data_rate='', suffix='', autoscale=True):
"""
Calculates the omni-directional pitch angle distribution (summed and averaged)
from the individual tplot variables
... | 38.122807 | 118 | 0.577773 | [
"MIT"
] | shihikoo/pyspedas | pyspedas/mms/fpi/mms_load_fpi_calc_pad.py | 4,346 | Python |
# -*- coding: utf-8 -*-
# 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 agr... | 32.437173 | 88 | 0.704786 | [
"Apache-2.0"
] | LaudateCorpus1/python-dataproc | docs/conf.py | 12,391 | Python |
from collections import defaultdict
from advent_2021.helpers import get_input
def dfs(
caves: dict[str, list[str]],
current: str,
visited: set[str] | None = None,
) -> int:
if current == "end":
return 1
nb_paths = 0
if visited is None:
visited = set()
for cave in caves[cu... | 23.484848 | 78 | 0.580645 | [
"MIT"
] | mgesbert/advent | src/advent_2021/day_12/part_1.py | 775 | Python |
#!/usr/bin/env python
# Copyright (c) 2019 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
import sys; assert sys.version_info < (3,), ur"This script does not run under Python 3. Please use Python 2.7.x."
fr... | 38.520833 | 113 | 0.660718 | [
"MIT"
] | Cabecinha84/fluxd | qa/rpc-tests/wallet_persistence.py | 5,547 | Python |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as f
from torch.autograd import Variable
import os
import numpy as np
from tqdm import tqdm
def reparameterize(mu, logvar):
eps = Variable(torch.randn(mu.size(0), mu.size(1))).cuda()
z = mu + eps * torch.exp(... | 47.161111 | 114 | 0.624102 | [
"MIT"
] | CHUJianchun/VAE_MLP_PSO | VAE_MLP/VAE_MLP_cat_model.py | 8,489 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Corrfunc is a set of high-performance routines for
computing clustering statistics on a distribution of
points.
"""
from __future__ import (division, print_function, absolute_import,
unicode_literals)
import os
__version__ = "0.0.5"
__author__ ... | 28.728972 | 76 | 0.611256 | [
"MIT"
] | dfm/suave | Corrfunc/__init__.py | 3,074 | Python |
"""The token kinds currently recognized."""
from shivyc.tokens import TokenKind
keyword_kinds = []
symbol_kinds = []
bool_kw = TokenKind("_Bool", keyword_kinds)
char_kw = TokenKind("char", keyword_kinds)
short_kw = TokenKind("short", keyword_kinds)
int_kw = TokenKind("int", keyword_kinds)
long_kw = TokenKind("long",... | 34.378049 | 50 | 0.736077 | [
"MIT"
] | Arter3r/ShivyC | shivyc/token_kinds.py | 2,819 | Python |
# -*- coding:utf-8 -*-
from os import system
from re import search, findall
from time import sleep
from requests import Session, get, post
from PIL import Image
from cfscrape import get_cookie_string
# from traceback import format_exc
# 功能:请求各大jav网站和arzon的网页
# 参数:网址url,请求头部header/cookies,代理proxy
# 返回:网页html... | 38.307692 | 174 | 0.484974 | [
"MIT"
] | Aevlp/javsdt | functions_requests.py | 16,888 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiple RPC users."""
from test_framework.test_framework import BitcoinTestFramework
from test_f... | 38.559322 | 129 | 0.643956 | [
"MIT"
] | CryptoBackups/polis | qa/rpc-tests/multi_rpc.py | 4,550 | Python |
from __future__ import unicode_literals
import unittest
from django.conf.urls import url
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from django.shortcuts import redirect
from django.test import override_settings
from django.utils.decorators import method_decorator
... | 34.338521 | 94 | 0.592521 | [
"BSD-2-Clause"
] | Asset-Map/django-rest-framework | tests/test_requests_client.py | 8,825 | Python |
from tkinter import *
from tkinter import messagebox
import tkinter.ttk as ttk
import datetime
def init(top, gui):
global w, top_level, root
w = gui
top_level = top
root = top
def start_gui():
global w, root
root = Tk()
root.iconbitmap("index.ico")
top = main_level(roo... | 41.738758 | 259 | 0.598605 | [
"MIT"
] | SoldierSolo24/Bus-Ticketing-System- | Bus Ticketing system MAIN final.py | 19,492 | Python |
import jinja2
class SPMObject(object):
""" Abstract Base Class for all SPM objects.
Even though SPM objects are not Spire tasks (as some of them will modify
in-place their file_dep, which is not compatible with doit's task
semantics), they nonetheless include task-related properti... | 30.204082 | 80 | 0.641216 | [
"MIT"
] | lamyj/spire | spire/spm/spm_object.py | 1,480 | Python |
{
"name": """POS: Refunds analysis""",
"summary": """Waiter specifies refund reason to avoid serving mistakes in future.""",
"category": "Point of Sale",
"images": ["images/pos_order_cancel_restaurant.png"],
"version": "13.0.1.5.0",
"application": False,
"author": "IT-Projects LLC, Dinar Gab... | 38.16 | 89 | 0.631027 | [
"MIT"
] | BrayhanJC/pos-addons | pos_order_cancel_restaurant/__manifest__.py | 954 | Python |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeElements(self, head, val):
"""
:type head: ListNode
:type val: int
:rtype: ListNode
"""
while head:
if... | 20.647059 | 40 | 0.428775 | [
"Apache-2.0"
] | sonymoon/algorithm | src/main/python/leetcode-python/easy/203.Remove Linked List Elements.py | 702 | Python |
# author : Sam Rapier
from deploy_django_to_azure.settings.base import *
DEBUG = False
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = 'https://exeblobstorage.blob.core.windows.net/static-files/'
# Database
# https://docs.djangoproject.com/en/1.11/... | 26.571429 | 73 | 0.625 | [
"MIT"
] | Thoma1999/exe_orientation_Q | deploy_django_to_azure/settings/production.py | 744 | Python |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... | 32.611111 | 213 | 0.636519 | [
"MIT"
] | Vibaswan/ixnetwork_restpy | ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/protocols/switchconfiglearnedinformation_e983ca5da0eadbba93d1ce1d2903a5b7.py | 6,457 | Python |
# -*- coding: utf-8 -*-
"""Cisco DNA Center Claim a Device to a Site data model.
Copyright (c) 2019-2021 Cisco Systems.
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, includ... | 31.811765 | 78 | 0.58395 | [
"MIT"
] | cisco-en-programmability/dnacentersdk | dnacentersdk/models/validators/v1_2_10/jsd_5889fb844939a13b.py | 2,704 | Python |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_HTTPError
from ..utils import (
ExtractorError,
int_or_none,
urlencode_postdata,
)
class AtresPlayerIE(InfoExtractor):
_VALID_URL = r"https?://(?:www\.)?atresplayer\.com/[^... | 35.84127 | 169 | 0.550044 | [
"MIT"
] | Pagasis/YouTua | youtuatools/extractor/atresplayer.py | 4,517 | Python |
#!/usr/bin/python
import sys
import cgi
import cgitb
import sqlite3
reload(sys)
sys.setdefaultencoding('utf-8')
cgitb.enable()
# html
print("Content-type: text/html\n")
print('<meta charset="utf-8">')
print("<html><head>")
print('''<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1... | 39.887755 | 175 | 0.672806 | [
"MIT"
] | DivyaGSun/BRITE_REU_database | assign_candidate.py | 7,818 | Python |
"""Test the UniFi Protect switch platform."""
# pylint: disable=protected-access
from __future__ import annotations
from unittest.mock import AsyncMock, Mock
import pytest
from pyunifiprotect.data import (
Camera,
Light,
RecordingMode,
SmartDetectObjectType,
VideoMode,
)
from homeassistant.compon... | 31.723014 | 88 | 0.738701 | [
"Apache-2.0"
] | LW-Ho/home-assistant | tests/components/unifiprotect/test_switch.py | 15,576 | Python |
#!/usr/bin/env python3
'''
Model for Riemannian feature calculation and classification for EEG data
'''
import numpy as np
from sklearn.svm import LinearSVC, SVC
from riemannian_multiscale import RiemannianMultiscale, QuantizedRiemannianMultiscale
from filters import load_filterbank
from utilities import quantize
... | 31.993958 | 118 | 0.580642 | [
"Apache-2.0"
] | pulp-platform/multispectral-riemannian | multiscale_bci_python/riemannian_model.py | 10,590 | Python |
import logging
import os
import random
import time
from functools import lru_cache
import cv2
import numpy as np
import imgreco.main
from Arknights.helper import logger
from addons.activity import ActivityAddOn, get_stage_map
from addons.base import BaseAddOn, pil2cv, crop_cv_by_rect, show_img
from addons.common_cach... | 40.737864 | 118 | 0.604743 | [
"MIT"
] | Konano/ArknightsAutoHelper | addons/start_sp_stage/__init__.py | 8,440 | Python |
import os
import sys
sys.path.append(os.path.dirname(__file__))
class AbstractSystemMeter:
"""Common system meter interface for all resource monitorings.
For each system resource to monitor, a wrapper class will be written as subclass of this one. This way we have
a common "interface" for all system resou... | 26.666667 | 114 | 0.6975 | [
"MIT"
] | surfmachine/language-detection | measure/system/AbstractSystemMeter.py | 800 | Python |
#!/usr/bin/python
from __future__ import division
import sys
import math
import cmath
import numpy as np
from numpy import genfromtxt
import csv
from decimal import Decimal
import os
import random
from lyrics import *
# BEATLES: Bundle of Essential and Assistive Tools Library for Electronic Structure
# A tri... | 34.443277 | 594 | 0.499665 | [
"MIT"
] | HassanHarb92/BEATLES | BEATLES.py | 49,185 | Python |
"""Utility functions related to file operations."""
import copy
import logging
import os
import subprocess
import sys
from argparse import Namespace
from collections import OrderedDict
from contextlib import contextmanager
from pathlib import Path
from tempfile import NamedTemporaryFile
from typing import TYPE_CHECKING... | 32.849817 | 87 | 0.614184 | [
"MIT"
] | ssato/ansible-lint | src/ansiblelint/file_utils.py | 8,968 | Python |
# -*- coding: utf-8 -*-
import gzip
import bz2
import numpy as np
def advanced_open(filepath, *args, **kwargs):
""" Open function interface for files with different extensions.
Parameters
----------
filepath: str
File path with extension.
args: list
Non-key arguments
kwargs: ... | 21.702703 | 77 | 0.608966 | [
"MIT"
] | hpi-sam/GNN-Effectants | benchmarking/libkge/libkge/io/base.py | 1,606 | Python |
import _plotly_utils.basevalidators
class TickformatstopdefaultsValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(
self,
plotly_name="tickformatstopdefaults",
parent_name="histogram2d.colorbar",
**kwargs,
):
super(TickformatstopdefaultsValidator, s... | 28.136364 | 86 | 0.602585 | [
"MIT"
] | labaran1/plotly.py | packages/python/plotly/plotly/validators/histogram2d/colorbar/_tickformatstopdefaults.py | 619 | Python |
from flask import render_template
from app import app
@app.errorhandler(404)
def page_not_found(e):
return render_template('http404.html'), 404
@app.errorhandler(403)
def page_not_found(e):
return render_template('http403.html'), 403
@app.errorhandler(500)
def page_not_found(e):
return render_template... | 19 | 47 | 0.75731 | [
"MIT"
] | c1c1/network-config-generator | app/views/errorhandler_views.py | 342 | Python |
import os
import requests
import datetime
from django.http import HttpResponseRedirect, HttpResponse, JsonResponse, Http404
from django.template import loader
from django.contrib.auth import login
from django.conf import settings
from django.http import Http404
from django.utils import timezone
from requests import st... | 35.331395 | 171 | 0.63946 | [
"MIT"
] | FiniteSingularity/tau-railway | tau/core/views.py | 12,154 | Python |
def find_words(string, word_set):
if string == "" or not word_set:
return None
if string in word_set: # O(1)
return [string]
#"bedbathbeyondunk"
#{'bed', 'bath', 'bedbath', 'and', 'beyond'}
tmp = "" # bedbathbeyondunk
out = [] # []
retro = False # True
i = 0
while i ... | 22.630435 | 52 | 0.483189 | [
"MIT"
] | xXHachimanXx/Daily-Coding | reconstruct-words.py | 1,041 | Python |
from . import test_s3
| 11 | 21 | 0.772727 | [
"MIT"
] | GlodoUK/misc-addons | ir_attachment_s3/tests/__init__.py | 22 | Python |
import json
import yaml
from pathlib import Path
from brownie import *
from substrateinterface import Keypair
from hashlib import blake2b
import base58
def get_derivative_account(root_account, index):
seed_bytes = b'modlpy/utilisuba'
root_account_bytes = bytes.fromhex(Keypair(root_account).public_key[2:])
... | 33.825243 | 134 | 0.735075 | [
"MIT"
] | mixbytes/lido-dot-ksm | scripts/prepare_env.py | 3,484 | Python |
import datetime
from dateutil.parser import parse
from decimal import Decimal
import re
import importlib
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.utils import datetime_safe
from tastypie.bundle import Bundle
from tastypie.exceptions import ApiFieldError, NotFound
from t... | 34.659328 | 177 | 0.608137 | [
"BSD-3-Clause"
] | handshake/django-tastypie | tastypie/fields.py | 29,911 | Python |
from setuptools import setup, find_packages
setup(
name='bigquery-downloader',
version='3.0.0',
description="A script for downloading BigQuery data sets that are organized by day",
install_requires=[
'google-cloud-bigquery>=1.24.0',
'click>=6.0'
],
packages=find_packages(),
... | 20.846154 | 88 | 0.630996 | [
"MIT"
] | DeveloperGao16/bigquery-downloader | setup.py | 542 | Python |
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class CouponFreeItemAndShipping... | 30.26556 | 112 | 0.621744 | [
"Apache-2.0"
] | gstingy/uc_python_api | ultracart/models/coupon_free_item_and_shipping_with_subtotal.py | 7,294 | Python |
import RPi.GPIO as GPIO
import time,sys, datetime, json, requests
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
'''
Configure raspberry
'''
GPIO.setmode(GPIO.BCM)
inpt = 13
GPIO.setup(inpt,GPIO.IN)
'''
Configure some global variables
'''
current_input = GPIO.input(inpt) ... | 36.758333 | 140 | 0.65382 | [
"Apache-2.0"
] | ggreeve/add-pwo | software/read-sensor-python/waterFlow/waterFlowMeter.py | 4,411 | Python |
import re
import traceback
import subprocess
from serviceDB import ServiceDB
class NeadmServiceWrapper:
_service_list_cmd = ['/opt/nedge/neadm/neadm', 'service', 'list']
# _status_cmd = ['/opt/nedge/neadm/fake-neadm-status.sh']
_service_list_header = re.compile("^.*TYPE.*NAME.*SERVERID.*STATUS.*$")
#... | 36.598706 | 79 | 0.58564 | [
"Apache-2.0"
] | Nexenta/JujuCharm | nexentaedge/neadmServiceWrapper.py | 11,309 | Python |
#!/usr/bin/env python3
#
# Copyright (c) 2019 LG Electronics, Inc.
#
# This software contains code licensed as described in LICENSE.
#
import os
import lgsvl
import random
import time
from pathlib import Path
import json
sim = lgsvl.Simulator(os.environ.get("SIMULATOR_HOST", "127.0.0.1"), 8181)
layer_mask = 0
layer_... | 24.977273 | 100 | 0.681984 | [
"MIT"
] | rubis-lab/Autoware_NDT | autoware.ai/autoware_files/lgsvl_file/scripts/testbed_scenario/sanfrancisco.py | 2,198 | Python |
"""
Space object.
Refer: https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/space
"""
from dataclasses import dataclass, field
from typing import List, Optional
from .base import BaseModel
@dataclass
class Space(BaseModel):
"""
A class representing the space object.
... | 35.8125 | 95 | 0.71466 | [
"MIT"
] | MerleLiuKun/python-twitter | pytwitter/models/space.py | 1,146 | Python |
"""Make / Download Telegram Sticker Packs without installing Third Party applications
Available Commands:
.kangsticker [Optional Emoji]
.packinfo
.getsticker"""
from telethon import events
from io import BytesIO
from PIL import Image
import asyncio
import datetime
from collections import defaultdict
import math
import ... | 38.401813 | 142 | 0.636771 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | FaisAFG/faisafg | stdplugins/stickers.py | 12,714 | Python |
import json
from hail.expr.types import hail_type
from hail.typecheck import *
from hail.utils.java import escape_str, escape_id
from .base_ir import *
from .matrix_writer import MatrixWriter
class I32(IR):
@typecheck_method(x=int)
def __init__(self, x):
super().__init__()
self.x = x
def... | 29.46363 | 129 | 0.590349 | [
"MIT"
] | chrisvittal/hail | hail/python/hail/ir/ir.py | 40,100 | Python |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test processing of unrequested blocks.
Setup: two nodes, node0+node1, not connected to each other. Nod... | 44.003086 | 113 | 0.675598 | [
"MIT"
] | ultraEX/UEX | test/functional/p2p_unrequested_blocks.py | 14,257 | Python |
import networkx
import random
def regularize_graph(graph,d):
regularized = True
for node_id in list(graph.nodes()):
if graph.in_degree(node_id)!=d or graph.out_degree(node_id)!=d:
regularized = False
break
while not regularized:
lost_in_degree_ids = []
full_in_degree_ids = []
for node... | 39.967213 | 85 | 0.694422 | [
"CC0-1.0"
] | mablem8/dandelion-simulations-py | exact-2-regular-k/regularize_graph.py | 2,438 | Python |
#!/usr/bin/env python
# Brief: This node subscribes to /tracked_humans and publishes the predicted goal to humans based on their trajectory
# Author: Phani Teja Singamaneni
import numpy as np
import rospy
import tf
from geometry_msgs.msg import Point, PoseStamped
from human_msgs.msg import TrackedHumans, TrackedHuman... | 45.507692 | 205 | 0.624577 | [
"BSD-3-Clause"
] | sphanit/CoHAN | human_path_prediction/scripts/predict_goal.py | 5,916 | Python |
# Copyright (c) 2016 Google Inc. (under http://www.apache.org/licenses/LICENSE-2.0)
def f1(x):
return 1
def f1(x):
return 'foo'
def f2(x):
pass
def f2(x,y):
pass
def f3(x):
return 1+x
def f3(x):
return 'asd'+x
| 14.75 | 83 | 0.59322 | [
"Apache-2.0"
] | Arvind2222/pytype | pytype/tools/merge_pyi/test_data/redefine.py | 236 | Python |
# -*- coding: utf-8 -*-
"""Tests for various magic functions.
Needs to be run by nose (to make ipython session available).
"""
import io
import os
import re
import sys
import warnings
from unittest import TestCase
from importlib import invalidate_caches
from io import StringIO
import nose.tools as nt
import shlex
... | 29.739774 | 98 | 0.596207 | [
"MIT"
] | Eviekim/waning-keyboard | env/lib/python3.6/site-packages/IPython/core/tests/test_magic.py | 34,178 | Python |
# Copyright 2021 DAI Foundation
#
# 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,... | 34.627451 | 87 | 0.65402 | [
"Apache-2.0"
] | tmierzwa/Ethtx | ethtx/decoders/decoders/semantics.py | 3,532 | Python |
"""
Support for Xiaomi Yeelight Wifi color bulb.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.yeelight/
"""
import logging
import voluptuous as vol
from homeassistant.util.color import (
color_temperature_mired_to_kelvin as mired_to_kelvin,... | 34.885149 | 79 | 0.604586 | [
"Apache-2.0"
] | DevRGT/home-assistant | homeassistant/components/light/yeelight.py | 17,617 | Python |
import numpy as np
import sys
class RBF():
def __init__(self, Input, Output, Ptypes, Nclasses):
self.input = Input
self.hidden = Ptypes * Nclasses
self.output = Output
self.ptypes = Ptypes
self.nclasses = Nclasses
self.protos = 0
self.weights = 0
s... | 26.614379 | 85 | 0.525049 | [
"MIT"
] | LucasAntognoni/SCC0270 | Assignment 3/rbf.py | 4,072 | Python |
#-------------------------------------------------------------------------------
# Name:GUI Calculator
# Purpose:Simple calculator with GUI using tkinter
#
# Author: Daniel Campos
#
# Created: Monday Dec 1st, 2014
#-------------------------------------------------------------------------------
from tkinter import *
imp... | 54.360825 | 127 | 0.62564 | [
"MIT"
] | spacemanidol/RPICS | ProgrammingInPython/proj08_daniel_campos.py | 5,273 | Python |
"""
URLConf for Satchmo Contacts.
"""
from django.conf.urls.defaults import patterns
from signals_ahoy.signals import collect_urls
from satchmo_store import contact
from satchmo_store.shop.satchmo_settings import get_satchmo_setting
ssl = get_satchmo_setting('SSL', default_value=False)
urlpatterns = patterns('satchm... | 31.473684 | 85 | 0.752508 | [
"BSD-3-Clause"
] | twidi/satchmo | satchmo/apps/satchmo_store/contact/urls.py | 598 | Python |
from pathlib import Path
CONFIG_ENV_NAME = "CYBERBOX_CONFIG_FILE"
CYBERBOX_DIR = Path(__file__).parent.resolve()
CYBERBOX_TEST_DB_URL = "CYBERBOX_TEST_DB_URL"
| 20.25 | 46 | 0.820988 | [
"MIT"
] | artslob/cyberbox | cyberbox/const.py | 162 | Python |
import sys
import requests
import argparse
import json
import os
import configparser
import arrow
from colorama import init
import traceback
def get_color(color_code):
return '\x1b[%sm' % color_code
def parse_brief(brief):
sentences = None
if args.news:
sentences = json.loads(
reque... | 36.653333 | 109 | 0.541288 | [
"MIT"
] | AntiSomnus/iDict-cmd | win_python/idict.py | 5,642 | Python |
# Python
import unittest
from copy import deepcopy
from unittest.mock import Mock
# ATS
from ats.topology import Device
# Genie
from genie.libs.ops.igmp.iosxe.igmp import Igmp
from genie.libs.ops.igmp.iosxe.tests.igmp_output import IgmpOutput
# Parser
from genie.libs.parser.iosxe.show_igmp import ShowIpIgmpInterface... | 41.369048 | 103 | 0.683597 | [
"Apache-2.0"
] | kecorbin/genielibs | pkgs/ops-pkg/src/genie/libs/ops/igmp/iosxe/tests/test_igmp.py | 6,950 | Python |
#!/usr/bin/python
#
# linearize-hashes.py: List blocks in a linear, no-fork version of the chain.
#
# Copyright (c) 2013 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import json
import struct
impor... | 25.803738 | 78 | 0.673669 | [
"MIT"
] | empyrean-project/Empyrean | contrib/linearize/linearize-hashes.py | 2,761 | Python |
import os
import yaml
import hashlib
from .util import json_dumps
class PhishingTrackerFile:
def __init__(self, __logger=None):
global logger
logger = __logger
def load_config(self, filename=None):
config = {}
try:
with open(filename, 'r') as f:
... | 27.837209 | 113 | 0.591479 | [
"BSD-2-Clause"
] | ndejong/phishing-tracker | PhishingTracker/file.py | 1,197 | Python |
from itertools import chain
import logging
import sys
from pyspark.sql import functions as f
from pyspark.sql.session import SparkSession
from pyspark.sql.window import Window
from pyspark.sql.types import ArrayType, StringType
spark = SparkSession.builder.getOrCreate()
spark.conf.set("spark.sql.execution.arrow.enabl... | 43.138462 | 164 | 0.740371 | [
"Apache-2.0"
] | gma-coretechs/hccpy | hccpy/misc_scripts/forever_codes_dropped.py | 2,804 | Python |
{"filter":false,"title":"kabutan_scraping.py","tooltip":"/kabutan_scraping.py","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":2},{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["",""]}... | 33,798 | 33,798 | 0.533967 | [
"MIT"
] | Grawor/auto_bot | .c9/metadata/environment/kabutan_scraping.py | 33,818 | Python |
ROOT_SCOPE_METHOD( MD( 'Not', 'NOT_CLAUSE_FACTORY_single()' ) )
TEST( """ if [ Not @ ( Integer ) consume [ 1 2 3 ] ] then [ . 1 ] else [ . 2 ] == 2 """ )
TEST( """ Not @ ( Word ) consume [ 1 2 3 ] next value == 1 """ )
OBJECT( 'NOT_CLAUSE_FACTORY',
methods = [
MS( ARG( CW( '@' ), CG( 'CLAUSE', 'clause' ) ),... | 25.434783 | 113 | 0.524786 | [
"MIT"
] | thomasmf/nomenine | src/core/runtime/clause/not_clause.py | 1,170 | Python |
import dash_bootstrap_components as dbc
import dash_html_components as html
from utils import UrlIndex
def NavBar(pathname=None):
return dbc.Nav([
dbc.NavItem(
dbc.NavLink(
html.H4("Home", className='mt-1', style={'color': (
'white' if pathname == UrlIndex.H... | 36.690141 | 120 | 0.503263 | [
"BSD-3-Clause"
] | rigdenlab/conkit-web | components/navbar.py | 2,605 | Python |
#!/usr/bin/env python
"""
Functions for estimating quantities from nested sampling runs.
Each estimator function should have arguments:
.. code-block:: python
def estimator_func(self, ns_run, logw=None, simulate=False):
...
Any additional arguments required for the function should be keyword
arguments.
... | 31.695402 | 78 | 0.640163 | [
"MIT"
] | ThomasEdwardRiley/nestcheck | nestcheck/estimators.py | 11,030 | Python |
class ServiceMedia:
def __init__(self, org_id, service_id, service_row_id, url, order, file_type, asset_type, alt_text, ipfs_url):
self._service_row_id = service_row_id
self._org_id = org_id
self._service_id = service_id
self._url = url
self._order = order
self._file_... | 23.458333 | 114 | 0.618117 | [
"MIT"
] | Karthi96/snet-marketplace-service | contract_api/domain/models/service_media.py | 2,252 | Python |
"""Database schema functions and information for Toron node files.
Toron nodes are stored as individual files. The file format is
managed, internally, as a relational database. The schema for this
database is shown below as a simplified ERD (entity relationship
diagram). SQL foreign key relationships are represented w... | 36.952675 | 106 | 0.595189 | [
"Apache-2.0"
] | shawnbrown/gpn | toron/_node_schema.py | 18,111 | Python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 5 09:10:56 2018
@author: gtucker
"""
import numpy as np
import datetime
from grainhill import GrainFacetSimulator
from grainhill import SlopeMeasurer
import landlab
from landlab.io.native_landlab import save_grid
import os
def create_folder(dire... | 29.556818 | 108 | 0.619377 | [
"MIT"
] | gregtucker/facetmorphology | ModelRunScripts/SensitivityAnalysisDandV/run_v_w.py | 2,601 | Python |
from Jumpscale import j
import re
# ACTIONS
## R = Regex Replace
## RI = Regex Replace case insensitive
DO = """
RI| j.application.JSBase$ | j.baseclasses.object
RI| j.data.cache. | j.core.cache.
RI| j.data.text. | j.core.text.
RI| from jumpscale import j | from Jumpscale import j
RI| j.application.jsbase_get_class(... | 33.564103 | 115 | 0.580087 | [
"Apache-2.0"
] | threefoldtech/sandbox_threebot_linux64 | sandbox/lib/jumpscale/JumpscaleLibs/tools/fixer/FixerReplace.py | 3,927 | Python |
"""Client for Triton Inference Server using REST API.
References:
-
https://github.com/kubeflow/kfserving/blob/master/docs/predict-api/v2/required_api.md#httprest
-
https://github.com/triton-inference-server/client/tree/master/src/python/examples
-
https://github.com/triton-inference-server/client/blob/master/src/pyth... | 36.597561 | 154 | 0.726425 | [
"MIT"
] | vlasenkoalexey/tensorflow_serving_benchmark | clients/triton_rest.py | 3,001 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.