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 time
import pyperclip
import csv
import subprocess
import serial
ser = serial.Serial('/dev/cu.usbmodemFD131', baudrate=9600, timeout=None)
clipboard_old = pyperclip.paste()
musicFile = "music/yes_1.mp3"
musicFile_rick = "music/rickroll.mp3"
failText = "Fail. No, bubbles, for you."
rickText = "Fail. But don't wo... | 32.163043 | 98 | 0.56438 | [
"MIT"
] | chrislintott/GZMaze | qrcodetoclassification.py | 2,959 | Python |
import numpy as np
import pytest
from astropy.cosmology import default_cosmology
from skypy.linear.eisenstein_hu import power_spectrum
def test_eisenstein_hu():
""" Test Eisenstein & Hu Linear matter power spectrum with
and without wiggles using astropy default cosmology"""
cosmology = default_cosmology.g... | 44.349206 | 79 | 0.644596 | [
"BSD-3-Clause"
] | Lucia-Fonseca/skypy | skypy/linear/tests/test_eisenstein_hu.py | 2,794 | Python |
"""Contains the CLI."""
import sys
import json
import logging
import oyaml as yaml
import click
# For the profiler
import pstats
from io import StringIO
# To enable colour cross platform
import colorama
from sqlfluff.cli.formatters import (
format_rules,
format_violation,
format_linting_result_header,... | 33.644928 | 104 | 0.598148 | [
"MIT"
] | tmastny/sqlfluff | src/sqlfluff/cli/commands.py | 23,233 | Python |
from .__init__ import *
def compoundInterestFunc(maxPrinciple=10000,
maxRate=10,
maxTime=10,
maxPeriod=10):
p = random.randint(100, maxPrinciple)
r = random.randint(1, maxRate)
t = random.randint(1, maxTime)
n = random.randint(... | 34.526316 | 70 | 0.525915 | [
"MIT"
] | anshitabaid/mathgenerator | mathgenerator/funcs/compoundInterestFunc.py | 656 | Python |
import tensorflow as tf
import numpy as np
def body(x):
a = tf.random_uniform(shape=[2, 2], dtype=tf.int32, maxval=100)
b = tf.constant(np.array([[1, 2], [3, 4]]), dtype=tf.int32)
c = a + b
return tf.nn.relu(x + c)
def condition(x):
return tf.reduce_sum(x) < 100
x = tf.Variable(tf.constant(0, ... | 24.947368 | 67 | 0.628692 | [
"MIT"
] | babaozhouy5/tensorflow_learning | 08_midi_generate/test.py | 474 | Python |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
A1 = [1, 2, 4, 5, 6, 6, 8, 9]
A2 = [2, 5, 6, 7, 8, 8, 9]
def find_closest_num(A, target):
min_diff = float("inf")
low = 0
high = len(A) - 1
closest_num = None
# Edge cases for empty list of list
# with only one element:
if len(A) == 0:
... | 21.776119 | 58 | 0.5305 | [
"MPL-2.0"
] | grvkmrpandit/data-structures-and-algorithms | dsa/closestnumber.py | 1,459 | Python |
from threading import Thread
from time import sleep
from pytezos import pytezos
import argparse
contract_dict = {}
def contract_origin_search(p, contract_hash, verbose = 0):
start = 0
end = p.shell.head.header()["level"]
contract = p.contract(contract_hash)
found = -1
data = None
while found =... | 40.416357 | 200 | 0.565121 | [
"MIT"
] | boltlabs-inc/libzkchannels | tezos-sandbox/watchtower/delphinet/passive_watchtower.py | 10,872 | Python |
from functools import partial
from dictknife.langhelpers import as_jsonpointer as _as_jsonpointer
from dictknife.langhelpers import as_path_node as _as_path_node
from dictknife import accessing
from dictknife import naming
def _make_key(k0, k1, *, sep="/"):
if k1 is None:
return _as_jsonpointer(str(k0))
... | 28.418605 | 73 | 0.575832 | [
"MIT"
] | podhmo/dictknife | dictknife/transform.py | 3,666 | Python |
# Copyright (C) 2019 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import asyncio
import base64
from distutils.version import StrictVersion
from PyQt5.QtCore import Qt, QThread, pyqtSignal
from PyQt5.QtWi... | 41.897959 | 154 | 0.639877 | [
"MIT"
] | PACGlobalOfficial/electrum-pac | electrum_dash/gui/qt/update_checker.py | 6,159 | Python |
import asyncio
import random
from async_pipeline.stage import PipelineStage, pipeline_operation
class Loader(PipelineStage):
def __init__(self, conf, *args, **kwargs) -> None:
self._operation = conf["load"]
super().__init__(*args, **kwargs)
@pipeline_operation
async def print(self, messa... | 27.375 | 71 | 0.680365 | [
"MIT"
] | zar3bski/async_pipeline_experiment | async_pipeline/loader.py | 438 | Python |
# Copyright 2018-2021 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or... | 33.576378 | 98 | 0.582853 | [
"Apache-2.0"
] | AlaricCheng/pennylane | pennylane/devices/tests/test_gates.py | 21,321 | Python |
# Generated by Django 3.0.3 on 2020-08-03 15:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ecommerce_platform', '0010_userprofile_address'),
]
operations = [
migrations.RemoveField(
model_name='userprofile',
... | 20.166667 | 60 | 0.584022 | [
"MIT"
] | kapkan7/Ecommerce-Website | obsidian_traders/ecommerce_platform/migrations/0011_remove_userprofile_address.py | 363 | Python |
import pandas as pd
import numpy as np
def optimize_feature_power(df, output_column_name=None, exponents=[2., 1., .8, .5, .25, .1, .01]):
""" Plot the correlation coefficient for various exponential scalings of input features
>>> np.random.seed(314159)
>>> df = pd.DataFrame()
>>> df['output'] = np.ra... | 40.769231 | 105 | 0.647799 | [
"MIT"
] | AAAI-DISIM-UnivAQ/nlpia | src/nlpia/features.py | 1,590 | Python |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 40.79235 | 80 | 0.717616 | [
"Apache-2.0"
] | backwardn/clusterfuzz | src/python/bot/tasks/regression_task.py | 14,930 | Python |
# -*- coding: utf-8 -*-
"""
@Remark: 自定义视图集
"""
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import action
from rest_framework.viewsets import ModelViewSet
from utils.filters import DataLevelPermissionsFilter
from utils.jsonResponse import SuccessResponse,... | 41.337662 | 103 | 0.696199 | [
"Apache-2.0"
] | lybbn/django-vue-lyadmin | backend/utils/viewset.py | 6,746 | Python |
# -*- coding: utf-8 -*-
from base.log import *
import os
def get_url(trackId,trackPointId,type1,seq,imageType):
cmd = 'http://10.11.5.34:13100/krs/image/get?trackPointId=%s&type=%s&seq=%s&imageType=%s' %(trackPointId,type1,seq,imageType)
return cmd
def main():
url = get_url('123', '123', '00', '004', 'jpg')
p... | 21.470588 | 127 | 0.663014 | [
"MIT"
] | wangzishuo111/doraemon | mesh_krs_imagequery.py | 365 | Python |
enum = 0
enum1 = 0
enum2 = 0
prob = 0
p1 = 0
p2 = 0
parity = 0
for z1 in range(1, 6):
for y1 in range(z1+1, 7):
for z2 in range(1, z1+1):
for y2 in range(z2+1, y1+1):
""" for y2 in range(1, y1):
for z2 in range(y2, z1+1):
for z3 in ran... | 28.981481 | 49 | 0.256869 | [
"Apache-2.0"
] | belerico/spqrisiko-abm | src/compute_probs.py | 1,565 | Python |
import datetime
import logging
import multiprocessing
import os
import re
import subprocess
import sys
import tempfile
import time
from typing import Any, Dict, List, Optional
import dateutil.parser
import pytest
import requests
from determined import experimental
from determined.common import api, yaml
from determin... | 35.463788 | 100 | 0.669049 | [
"Apache-2.0"
] | liamcli/determined | e2e_tests/tests/experiment/experiment.py | 25,463 | Python |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <headingcell level=1>
# Reading outputs from E+
# <codecell>
# some initial set up
# if you have not installed epp, and only downloaded it
# you will need the following lines
import sys
# pathnameto_eppy = 'c:/eppy'
pathnameto_eppy = '../'
sys.path.append(pathnam... | 27.046569 | 430 | 0.720616 | [
"MIT"
] | lymereJ/eppy | docs/Outputs_Tutorial.py | 11,037 | Python |
#!/usr/bin/python3
import time
from calcul import *
import sys
import os
max_exec = 10
red = "\033[31m"
white = "\033[39m"
cyan = "\033[36m"
green = "\033[32m"
save = sys.stdout
so = open("file.log", 'w')
sys.stdout = so
def rectangle_time(n):
time_rect = []
i = 0
while i < max_exec:
start_time =... | 29.883333 | 108 | 0.594255 | [
"MIT"
] | ltabis/epitech-projects | 110borwein_2017/compare.py | 3,588 | Python |
# -*- coding: utf-8 -*-
#
# pysteps documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 31 01:11:37 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | 32.284211 | 96 | 0.691066 | [
"BSD-3-Clause",
"MIT"
] | RubenImhoff/Large_Sample_Nowcasting_Evaluation | pysteps/doc/conf.py | 6,134 | Python |
import typing
import strawberry
def test_fetch_entities():
global Product
@strawberry.federation.type(keys=["upc"])
class Product:
upc: str
@classmethod
def resolve_reference(cls, upc):
return Product(upc)
@strawberry.federation.type(extend=True)
class Query... | 21.446809 | 79 | 0.549603 | [
"MIT"
] | patrick91/strawberry | tests/federation/test_entities.py | 1,008 | Python |
# Automatically generated from poetry/pyproject.toml
# flake8: noqa
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['c7n_trailcreator']
package_data = \
{'': ['*']}
install_requires = \
['argcomplete (>=1.11.1,<2.0.0)',
'attrs (>=19.3.0,<20.0.0)',
'boto3 (>=1.12.20,<2.0.0)',
'botocore (>=1.15.2... | 107.122807 | 4,623 | 0.698002 | [
"Apache-2.0"
] | rushrecon/cloud-custodian | tools/c7n_trailcreator/setup.py | 6,106 | Python |
# 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 Apache License, Version 2.0 (the
# "License"); you may not u... | 33.958974 | 83 | 0.663395 | [
"Apache-2.0"
] | Zandut/Superset-Funnel | superset/models/sql_lab.py | 6,622 | Python |
import random
import time
def dead_state(width, height):
board = []
line = []
for i in range(width):
for j in range(height):
line.append(0)
board.append(line)
line = []
return board
def random_state(width, height):
state = dead_state(width, height)
for i in... | 26.839161 | 74 | 0.496352 | [
"MIT"
] | Joes-BitGit/LearnPython | Projects/Game of Life/gol.py | 3,838 | Python |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 29 15:56:35 2019
@author: logancross
"""
from mvpa2.suite import *
from os import listdir
import time
def make_targets(subj, glm_ds_file, mask_name, runs2use, class_dict, homedir, ana_name):
start_time = time.time()
print 'Starting making ... | 46.90303 | 178 | 0.680708 | [
"CC0-1.0"
] | munoztd0/OBIWAN | ANALYSIS/T0/MVPA/PYmvpa/cross_decoding/mvpa_utils_pav.py | 7,739 | Python |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
router.register('profile', views.UserProfileViewSet) #No base_name needed for we have a queryse... | 32.470588 | 108 | 0.768116 | [
"MIT"
] | ncadet-dev/profiles-rest-api | profiles_api/urls.py | 552 | Python |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""User profiles module for Invenio."""
from __future__ import absolute_import, prin... | 31.686567 | 72 | 0.617051 | [
"MIT"
] | 0x2b3bfa0/invenio-userprofiles | invenio_userprofiles/ext.py | 2,123 | Python |
from onegov.election_day.collections.data_sources import DataSourceCollection
from onegov.election_day.collections.data_sources import \
DataSourceItemCollection
from onegov.election_day.collections.notifications import \
NotificationCollection
from onegov.election_day.collections.archived_results import \
... | 38.137931 | 79 | 0.833635 | [
"MIT"
] | politbuero-kampagnen/onegov-cloud | src/onegov/election_day/collections/__init__.py | 1,106 | Python |
from flask import Flask
from flask_mail import Mail
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from config import config_options
bootstrap = Bootstrap()
db = SQLAlchemy()
migrate = Migrate()
login_manager = Logi... | 23.97619 | 70 | 0.771599 | [
"MIT"
] | Benardakaka/Blog-Site | app/__init__.py | 1,007 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | 36.328859 | 168 | 0.638925 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/netapp/v20190601/_inputs.py | 10,826 | Python |
from disco.test import TestCase, TestJob
from disco.compat import bytes_to_str
class SimpleJob(TestJob):
@staticmethod
def map(e, params):
yield int(e), (bytes_to_str(e)).strip()
@staticmethod
def reduce(iter, out, params):
for k, v in sorted(iter):
out.add(k, v)
class Sim... | 27.8 | 76 | 0.634121 | [
"BSD-3-Clause"
] | DavidAlphaFox/disco | tests/test_simple.py | 973 | Python |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------------
# Copyright 2020 VMware, Inc. All rights reserved.
# AUTO GENERATED FILE -- DO NOT MODIFY!
#
# vAPI stub file for package com.vmware.vmc.orgs.sddcs.networks.edges.firewall.
#-------------------------------------------... | 38.201018 | 117 | 0.563112 | [
"MIT"
] | adammillerio/vsphere-automation-sdk-python | com/vmware/vmc/orgs/sddcs/networks/edges/firewall_client.py | 15,013 | Python |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | 39.339109 | 80 | 0.664758 | [
"Apache-2.0"
] | 5andeepNambiar/oppia | core/domain/subtopic_page_domain.py | 15,893 | Python |
import pytest
def test_cython_api_deprecation():
match = ("`scipy._lib._test_deprecation_def.foo_deprecated` "
"is deprecated, use `foo` instead!\n"
"Deprecated in Scipy 42.0.0")
with pytest.warns(DeprecationWarning, match=match):
from .. import _test_deprecation_call
ass... | 33.090909 | 65 | 0.678571 | [
"BSD-3-Clause"
] | 0x0L/scipy | scipy/_lib/tests/test_deprecation.py | 364 | Python |
import urllib.request
import json
response = urllib.request.urlopen('https://raw.githubusercontent.com/Kitware/ParaView/master/ParaViewCore/' +
'ServerManager/Rendering/ColorMaps.json')
data = json.loads(response.read().decode('utf8'))
file = open('paraview_color_maps.py', 'w')
for ... | 34.48 | 119 | 0.525522 | [
"MIT"
] | Gulaabihaathee/K3D-jupyter | k3d/colormaps/generate_praview_color_maps.py | 862 | Python |
def tsd_section_name(pagename):
articlename = pagename.split('/')[1]
sectionname_new = ''
if 'ДО' in pagename.split('/'):
sectionname_new = articlename
else:
if articlename.endswith((' 1', ' 2', ' 3', ' 4')):
sectionname_new = articlename + '-1'
else:
sect... | 42.603448 | 119 | 0.591259 | [
"MIT"
] | vladiscripts/WS_text_formatter_and_uploader_to_Page_NS | scripts/tsd.py | 3,202 | Python |
# Copyright 2017 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 35.542045 | 80 | 0.712185 | [
"Apache-2.0"
] | AishwaryaVarma/tensorflow | tensorflow/python/eager/benchmarks_test.py | 31,277 | Python |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# =============================================================================
# title : magicblueshell.py
# description : Python tool to control Magic Blue bulbs over Bluetooth
# author : Benjamin Piouffle
# date : 23/11/2015
# usage ... | 39.785714 | 79 | 0.527664 | [
"MIT"
] | mouth4war/magicblue | magicblue/magicblueshell.py | 12,254 | Python |
from typing import Optional
from unittest.mock import Mock
from unittest.mock import patch
import pytest
from python_todopago.helpers import Authorization
from python_todopago.helpers import OperationStatus
from payments import PaymentError
from payments import PaymentStatus
from payments import PurchasedItem
from pa... | 30.765517 | 141 | 0.691549 | [
"BSD-3-Clause"
] | Natureshadow/django-payments | payments/todopago/test_todopago.py | 4,461 | Python |
from pyopenproject.business.root_service import RootService
from pyopenproject.business.services.command.root.find import Find
class RootServiceImpl(RootService):
def __init__(self, connection):
"""Constructor for class RootServiceImpl, from RootService
:param connection: The connection data
... | 27.125 | 66 | 0.723502 | [
"MIT"
] | Flying-Free/pyopenproject | pyopenproject/business/services/root_service_impl.py | 434 | Python |
import os
import shutil
from datetime import timedelta
from django.contrib.admin.sites import AdminSite
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import User
from django.utils import timezone
from allauth.account.models import EmailAddress
from rest_framework.test ... | 33.043478 | 79 | 0.640789 | [
"BSD-3-Clause"
] | Mukul2000/EvalAI | tests/unit/jobs/test_admin.py | 5,320 | Python |
import geohash
import redis
from addok.config import config
from addok.db import DB
from addok.ds import get_document
from . import iter_pipe, keys, yielder
VALUE_SEPARATOR = '|~|'
def preprocess(s):
if s not in _CACHE:
_CACHE[s] = list(iter_pipe(s, config.PROCESSORS))
return _CACHE[s]
_CACHE = {}
... | 29.986239 | 75 | 0.583601 | [
"MIT"
] | addok/addok | addok/helpers/index.py | 6,537 | Python |
import pandas as pd
import numpy as np
from pandas.util.testing import rands
groups = np.arange(10)
str_groups = np.array(list("0123456789"))
np.random.seed(1)
for size in [1e2, 1e3, 1e4, 1e5, 1e6]:
size = int(size)
g = np.random.choice(groups, size)
sg = np.random.choice(str_groups, size)
v = np.rand... | 33.666667 | 106 | 0.693894 | [
"MIT"
] | koaning/polars | pandas_cmp/create_data.py | 1,212 | Python |
from jsonobject import *
class ReconstructableJsonObject(JsonObject):
@classmethod
def from_json(cls, data):
return cls._from_json(cls, data)
@classmethod
def _from_json(cls, root: JsonObject.__class__, data):
if root is None:
return data
for key, type in root._p... | 44.544218 | 119 | 0.738241 | [
"MIT"
] | amitassaraf/py-prime-trust | src/primetrust/models.py | 6,548 | Python |
# Config
NODE_ID = ${NODE_ID}
# hour,set 0 to disable
SPEEDTEST = ${SPEEDTEST}
CLOUDSAFE = ${CLOUDSAFE}
ANTISSATTACK = ${ANTISSATTACK}
AUTOEXEC = ${AUTOEXEC}
MU_SUFFIX = "${MU_SUFFIX}"
MU_REGEX = "${MU_REGEX}"
SERVER_PUB_ADDR = "127.0.0.1" # mujson_mgr need this to generate ssr link
API_INTERFACE = "${API_INTERFACE... | 20.93617 | 75 | 0.707317 | [
"Apache-2.0"
] | topjohncian/cian-ssrmu | apiconfig.py | 984 | Python |
# Copyright 2018 The Cornac 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 applicable ... | 41.043478 | 119 | 0.658633 | [
"Apache-2.0"
] | linksboy/cornac | cornac/experiment/experiment.py | 3,776 | Python |
import connexion
from openapi_server.annotator.phi_types import PhiType
from openapi_server.get_annotations import get_annotations
from openapi_server.models.error import Error # noqa: E501
from openapi_server.models.text_id_annotation_request import TextIdAnnotationRequest # noqa: E501
from openapi_server.models.tex... | 39.16129 | 110 | 0.737232 | [
"Apache-2.0"
] | cascadianblue/phi-annotator | server/openapi_server/controllers/text_id_annotation_controller.py | 1,214 | Python |
#!/usr/bin/env python3
self_description = """
gridradar2influx is a tiny daemon written to fetch data from the gridradar.net-API and
writes it to an InfluxDB instance.
"""
# import standard modules
from argparse import ArgumentParser, RawDescriptionHelpFormatter
import configparser
import logging
import os
import sig... | 34.323944 | 131 | 0.650185 | [
"MIT"
] | Wuifi/gridradar2influx | gridradar2influx.py | 4,874 | Python |
class Developer:
def __init__(self,name):
self.name = name
def coding(self):
print(self.name+' is developer!')
class PythonDevloper(Developer):
def coding(self):
print(self.name + ' is Python developer!')
class JavaDevloper(Developer):
def coding(self):
print(self.name... | 21.444444 | 50 | 0.651123 | [
"MIT"
] | min9288/Multicampus | Python/python_programming_stu/chapter09_class/9-5.developer_polymorphism.py | 579 | Python |
import logging
import odoo.http
from odooku.request import WebRequestMixin
_logger = logging.getLogger(__name__)
class WebSocketRequest(WebRequestMixin, odoo.http.WebRequest):
def __init__(self, httprequest):
super(WebSocketRequest, self).__init__(httprequest)
def dispatch(self):
raise Not... | 33.898551 | 131 | 0.619496 | [
"Apache-2.0"
] | 12thmar/marodooku | odooku/services/websocket/requests.py | 2,339 | Python |
#!/usr/bin/env python3
from itertools import product
if __name__ == "__main__":
arr1 = list(map(int, input().strip().split(' ')))
arr2 = list(map(int, input().strip().split(' ')))
for el in product(arr1, arr2):
print("{} ".format(el), end='')
| 24.909091 | 53 | 0.569343 | [
"MIT"
] | 1BM18CS069/HackerRank | python/itertools-product.py | 274 | Python |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from . import views
urlpatterns = [
# URL pattern for the UserListView
url(
regex=r'^$',
view=views.UserListView.as_view(),
name='list'
),
# URL pattern for the ... | 20.552632 | 56 | 0.581306 | [
"MIT"
] | jondelmil/artinvestor-server | artinvestor_server/users/urls.py | 781 | Python |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/messages/get_inventory_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _me... | 33.785714 | 228 | 0.796195 | [
"MIT"
] | 123FLO321/pgoapi | pgoapi/protos/pogoprotos/networking/requests/messages/get_inventory_message_pb2.py | 2,365 | Python |
import app.constants as const
class Config:
def __init__(self, shape=const.DEFAULT_CONFIG_SHAPE,
size=const.DEFAULT_CONFIG_SIZE,
max_thick=const.MAXIMUM_CONFIG_THICKNESS,
min_thick=const.MINIMUM_CONFIG_THICKNESS,
use_border=const.DEFAULT_CONFIG_B... | 34.333333 | 68 | 0.643204 | [
"MIT"
] | calemolech/lithophanes | app/config.py | 824 | Python |
#!/usr/bin/env python3
# encoding: utf-8
# Copyright 2020 Hnaynag University (Jae-Hong Lee)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import argparse
import codecs
import json
import logging
import re
import random
from pathlib import Path
from tqdm import tqdm
from nltk import tokenize
from espn... | 38.670886 | 112 | 0.609165 | [
"Apache-2.0"
] | j-pong/HYnet2-summachine | egs/linersum/asr1/local/data_prep.py | 6,110 | Python |
'''define the config file for voc and resnet101os16'''
from .base_cfg import *
# modify dataset config
DATASET_CFG = DATASET_CFG.copy()
DATASET_CFG['train'].update(
{
'type': 'voc',
'set': 'trainaug',
'rootdir': 'data/VOCdevkit/VOC2012',
}
)
DATASET_CFG['test'].update(
{
't... | 24.274194 | 94 | 0.627243 | [
"MIT"
] | skydengyao/sssegmentation | ssseg/cfgs/annnet/cfgs_voc_resnet101os16.py | 1,505 | Python |
# Write a Python function to sum all the numbers in a list
# Sample List : [8, 2, 3, 0, 7]
# Expected Output : 20
def sum_list(list):
sum = 0
for i in list:
sum += i
return sum
list = [8, 2, 3, 0, 7]
print(sum_list(list)) | 17.5 | 58 | 0.587755 | [
"Apache-2.0"
] | kevorkkeheian/learn-python | introduction/exercise/ex9.py | 245 | Python |
from django.apps import AppConfig
class SignalsConfig(AppConfig):
name = 'signals.apps.signals'
verbose_name = 'Signals'
def ready(self):
# Import Django signals to connect receiver functions.
import signals.apps.signals.signal_receivers # noqa
| 25.181818 | 62 | 0.714801 | [
"MPL-2.0"
] | CBuiVNG/signals | api/app/signals/apps/signals/config.py | 277 | Python |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""tf2onnx.onnx_opset module"""
from . import common, controlflow, generator, logical, math, misc, nn, quantize, reduction, rnn, tensor, traditionalml
| 41 | 118 | 0.764228 | [
"MIT"
] | NikolasMarkou/tensorflow-onnx | tf2onnx/onnx_opset/__init__.py | 246 | Python |
# -*- coding:utf-8 -*-
# Author: RubanSeven
# import cv2
import numpy as np
# from transform import get_perspective_transform, warp_perspective
from .warp_mls import WarpMLS
def distort(src, segment):
img_h, img_w = src.shape[:2]
cut = img_w // segment
thresh = cut // 3
# thresh = img_h // segment /... | 32.75641 | 106 | 0.604501 | [
"Apache-2.0"
] | WenmuZhou/crnn.pytorch | data_loader/modules/Text_Image_Augmentation_python/augment.py | 5,110 | Python |
class Student:
def __init__(self):
self.surname = None
self.name = None
self.patronymic = None
self.age = 19
self.birthday = None
self.group = None
class Teacher:
def __init__(self):
self.surname = None
self.name = None
self.patronymic = ... | 21.986301 | 91 | 0.611838 | [
"MIT"
] | Floou/python-basics | 201005/home_task.py | 1,612 | Python |
"""
Examples of loading all information about an object or set of objects from the
database.
"""
from __future__ import absolute_import
from __future__ import print_function
from owmeta_core.context import Context
from owmeta_core.command import OWM
from owmeta.connection import Connection
from owmeta.neuron import N... | 30.66129 | 92 | 0.643346 | [
"MIT"
] | cheelee/owmeta | examples/test_bgp.py | 1,901 | Python |
#!/usr/bin/env python3
# Copyright (c) 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.
from segwit import send_to_witness
from test_framework.test_framework import BitcoinTestFramework
from test_fr... | 44.629969 | 121 | 0.71036 | [
"MIT"
] | citrixrep/rec | qa/rpc-tests/bumpfee.py | 14,594 | Python |
#!/usr/bin/env python3
def main():
pattern = input().upper()
genome = input().upper()
mismatches = int(input())
occurrences = approximate_occurrences(genome, pattern, mismatches)
for o in occurrences:
print(o, end=' ')
print()
LIST_A = ['C', 'T', 'G']
LIST_C = ['A', 'T', 'G']
LIST_T... | 30.258824 | 89 | 0.618585 | [
"MIT"
] | leskin-in/mipt-bioalgo | hw1/approximate_occurrences.py | 2,572 | Python |
# -*- coding: utf-8 -*-
'''
Runs MultiprocessTest with all warnings including traceback...
'''
#
# https://stackoverflow.com/questions/22373927/get-traceback-of-warnings
import traceback
import warnings
import sys
from . import multiprocess
def warn_with_traceback(message, category, filename, lineno, file=None, line... | 24.571429 | 83 | 0.741279 | [
"BSD-3-Clause"
] | dhmit/dh_testers | dh_testers/warningMultiprocess.py | 688 | Python |
version = '0.1.1'
title = 'Cloud::Auth'
api_version = 'v1'
api_prefix = '/api/' + api_version
# $ echo -n 'Once upon a time...' | openssl.exe dgst -sha256
# (stdin)= 7cc6caf901b894033626981cd102021727aa59c2548d79e59382649b2c6f50f2
ADMIN_TOKEN = 'd7981fb00d6f071e1a8b454c47b378d815b53541621e22dc4b3dbf5a6b9c8b1d'
USER_... | 32.916667 | 80 | 0.802532 | [
"MIT"
] | sergio-rudenko/cloudauth | src/app/conf.py | 395 | Python |
from __future__ import division
from __future__ import print_function
from __future__ import with_statement
from replacers import *
import pandas as pd
import nltk
import subprocess
def findFreqWord(fuzzyDF):
f1 = fuzzyDF # pd.read_csv("SubmittedCSV/fuzzy.csv")
f2 = pd.DataFrame(columns=['Tweets', 'Classifi... | 42.404412 | 114 | 0.469221 | [
"Apache-2.0"
] | 1MT3J45/ML-DroughtAnalysisNLP | freqWordSelection.py | 5,767 | Python |
# -*- coding: utf8 -*-
# Copyright 2019 JSALT2019 Distant Supervision Team
#
# 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
#
# U... | 35.439189 | 79 | 0.659295 | [
"Apache-2.0"
] | distsup/DistSup | distsup/configuration/__init__.py | 5,245 | Python |
'''
use case handlers package
'''
from .find_average_temperature_handler import FindAverageTemperatureHandler
__all__ = [
'FindAverageTemperatureHandler'
]
| 17.888889 | 75 | 0.801242 | [
"MIT"
] | joaquinquintas/shipwell_backend_ricardo | core/handlers/__init__.py | 161 | Python |
#
# 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
#
# Unless required by appli... | 37.248756 | 182 | 0.605583 | [
"Apache-2.0"
] | Alice-6161/FATE | python/fate_flow/tests/check_fate_python_requirement.py | 7,487 | Python |
import itertools
import logging
import warnings
from abc import abstractmethod
from collections import Counter
from pathlib import Path
from typing import Union, List, Tuple, Dict, Optional
import torch.nn
from torch.utils.data.dataset import Dataset
from tqdm import tqdm
import flair
from flair import file_utils
fro... | 45.285953 | 128 | 0.598907 | [
"MIT"
] | MaxDall/flair | flair/nn/model.py | 27,081 | Python |
#!/usr/bin/python
import sys
import json
import numpy as np
import cv2
import zmq
import time
from keras.models import Sequential
from keras.layers.core import Dense, Dropout
from keras.optimizers import sgd
from os import listdir
from os.path import isfile, join
#-- Constants
imageSize = (128, 128)
hidden_size=200... | 18.666667 | 109 | 0.636792 | [
"MIT"
] | ArefMq/SoccerBallDetection | src/modules/bd.py | 2,968 | Python |
import unittest
import pytest
import numpy as np
from deepchem.utils.molecule_graph import MoleculeGraphData, BatchMoleculeGraphData
class TestMoleculeGraph(unittest.TestCase):
def test_molecule_graph_data(self):
num_nodes, num_node_features = 4, 32
num_edges, num_edge_features = 6, 32
node_features = ... | 35.308511 | 83 | 0.637843 | [
"MIT"
] | cpfpengfei/deepchem | deepchem/utils/test/test_molecule_graph.py | 3,319 | Python |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import pulumi
import pulumi.runtime
from typing import Union
from .. import utilities, tables
class Databa... | 44.717172 | 169 | 0.663655 | [
"ECL-2.0",
"Apache-2.0"
] | 23doors/pulumi-gcp | sdk/python/pulumi_gcp/sql/database.py | 4,427 | Python |
"""
Django settings for django_app project.
Generated by 'django-admin startproject' using Django 3.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from path... | 25.791667 | 91 | 0.697577 | [
"CC0-1.0"
] | jorgeassis/darwinCoreGUI | django_app/settings.py | 3,095 | Python |
# -*- coding: utf-8 -*-
SET_SUGGESTIONS = '='
| 11.75 | 23 | 0.531915 | [
"Apache-2.0"
] | qazbnm456/VWGen | core/shell/shellSuggestion.py | 47 | Python |
#!/usr/bin/env python
import sys
sys.dont_write_bytecode = True
import build
build.run(True, True, True)
| 12 | 30 | 0.75 | [
"Apache-2.0"
] | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | Working Disassembly/Build Scripts/buildAndVerify.py | 108 | Python |
# Copyright 2017 Google.
#
# 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 law or agreed to in writing, sof... | 33.960938 | 94 | 0.68484 | [
"Apache-2.0"
] | google/genomics-protos | setup.py | 4,347 | Python |
# This sample verifies that the exception type validation
# handles the case where the exception type is a Type[X] object.
from typing import Type
exc: Type[Exception] = Exception
try:
1 / 0
except exc:
print("exc")
| 18.461538 | 65 | 0.683333 | [
"MIT"
] | MerHS/pytea | packages/pyright-internal/src/tests/samples/tryExcept3.py | 240 | Python |
import argparse
import copy
import os
import pickle
import random
import sys
from types import SimpleNamespace
import numpy as np
from domains.npuzzle import NPuzzle, macros
from experiments import search, iw, bfws
def parse_args():
"""Parse input arguments
Use --help to see a pretty description of the argu... | 37.930556 | 136 | 0.622483 | [
"ECL-2.0",
"Apache-2.0"
] | camall3n/focused-macros | experiments/npuzzle/solve.py | 5,462 | Python |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import formatdate, fmt_money, flt, cstr, cint, format_datetime, format_time, format_duration
from frappe.model.meta import get_fiel... | 31.70297 | 119 | 0.710181 | [
"MIT"
] | EHASUN/frappe | frappe/utils/formatters.py | 3,202 | Python |
import re
from videos_id.platform import Platform
class Vimeo(Platform):
def __init__(self):
self.platform = "Vimeo"
def check_url(self, url):
pattern = r'https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:$|\... | 27.823529 | 164 | 0.534884 | [
"MIT"
] | RentFreeMedia/python-video-ids | videos_id/provider/vimeo.py | 473 | Python |
import FWCore.ParameterSet.Config as cms
from RecoEgamma.PhotonIdentification.isolationCalculator_cfi import *
from RecoEgamma.PhotonIdentification.mipVariable_cfi import *
from RecoEcal.EgammaClusterProducers.hybridSuperClusters_cfi import *
from RecoEcal.EgammaClusterProducers.multi5x5BasicClusters_cfi import *
#
# ... | 52.222222 | 123 | 0.694618 | [
"Apache-2.0"
] | Abd-Elrazek/cmssw | RecoEgamma/EgammaPhotonProducers/python/photons_cfi.py | 7,990 | Python |
import tensorflow as tf
import pandas
import numpy as np
DATAFILE_TRAIN = 'mock_kaggle_edit_train.csv'
DATAFILE_VALIDATE = 'mock_kaggle_edit_validate.csv'
TRAINED_MODEL_PATH = 'savedModel'
TIME_STEPS = 10
NUMBER_OF_DAYS_TO_FORECAST = 1
BATCH_SIZE = 100
NUM_EPOCHS = 100
LSTM_UNITS = ... | 27.266129 | 228 | 0.721779 | [
"Apache-2.0"
] | anuragbms/Sales-forecasting-with-RNNs | MetamorphicTests/mutants_of_interest/sales_forecasting_file/257_bug.py | 10,143 | Python |
#
# 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
#
# Unless required by appli... | 34.958333 | 96 | 0.582439 | [
"Apache-2.0"
] | FutaoJia97/FATE | python/fate_arch/storage/mysql/_table.py | 5,034 | Python |
import requests
from . import FeedSource, _request_headers
# pylint: disable=no-member
class WorldCoinIndex(FeedSource): # Weighted average from WorldCoinIndex
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.timeout = getattr(self, 'timeout', 15)
if not hasattr... | 46.08 | 113 | 0.598958 | [
"MIT"
] | Zapata/bitshares-pricefeed | bitshares_pricefeed/sources/worldcoinindex.py | 1,152 | Python |
# Copyright 2016, VIXL authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the ... | 37.168539 | 82 | 0.739117 | [
"BSD-3-Clause"
] | bwasti/vixl | tools/known_test_failures.py | 3,308 | Python |
from batchgenerators.utilities.file_and_folder_operations import *
import numpy as np
if __name__ == '__main__':
# input_file = '/home/fabian/data/nnUNet_preprocessed/Task004_Hippocampus/nnUNetPlansv2.1_plans_3D.pkl'
# output_file = '/home/fabian/data/nnUNet_preprocessed/Task004_Hippocampus/nnUNetPlansv2.1_LIS... | 69.041667 | 117 | 0.639107 | [
"Apache-2.0"
] | Jiawei-Yang/TumorCP | nnunet/experiment_planning/change_batch_size.py | 1,657 | Python |
import sys
from flask import Flask, jsonify, request, url_for
from flask_login import LoginManager, login_required, current_user
from marshmallow import ValidationError
from slugify import slugify
from entity import User, db
from model import user_schema, ma, users_schema
login_manager = LoginManager()
app = Flask(... | 26.12766 | 89 | 0.658252 | [
"Apache-2.0"
] | tuannguyendang/montypython | controller/user_controller.py | 3,684 | Python |
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import RK45
f_out = "E:\\1\\P_rk4.txt" # address file for output
f2 = open(f_out,"w+")
def du_dx(x,y):
wa=1 # atomic frequency
wp=0.6 # field frequency
g=0.6 # coupling strength
n = 1 # number of photons
A = n*... | 23.457143 | 76 | 0.476248 | [
"MIT"
] | Mahdi-Asadi/Python_Thesis | RK45 - Copy.py | 1,642 | Python |
"""
Utility functions for the btcpayserver client
"""
import pickle
from app.db import get_db
from config import Config
def get_client():
"""
Loads the serialized client from database
"""
db = get_db()
pickled_client = db.execute(
"SELECT pickled_client FROM btc_pay_server_client ORDER BY ... | 25.864407 | 142 | 0.621887 | [
"MIT"
] | psqnt/flask-btcpay-example | app/btcpayserver_helper.py | 1,526 | Python |
DEFAULT_INIT = "variance_scaling_initializer(mode='fan_in', distribution='uniform', scale=0.78)"
# Patchining in some alternate conformer arcitectures
def add_SE_block(network, in_layer, name_prefix, se_act="swish"):
# This adds and SE block anywhere
# Returns the output layer name
network[name_prefix + "_SE_r... | 36.580846 | 149 | 0.553296 | [
"MPL-2.0"
] | dierkes-j/i6_experiments | users/schupp/hybrid_hmm_nn/network_builders/layers/conformer_SE_block_layer_dynamic_oneact.py | 29,411 | Python |
# --------------------------------------------------------------------------
# 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 cause incor... | 37.866667 | 76 | 0.558099 | [
"MIT"
] | tbyfield/azure-cli-extensions | src/fidalgo/azext_fidalgo/generated/_params.py | 568 | Python |
import torch
import numpy as np
def map_per_batch(fun, values, batch_indices):
result = []
for start, stop, value_slice in sliced_per_batch(values, batch_indices):
result.append(fun(start, stop, value_slice))
return torch.cat(result)
def sliced_per_batch(values, batch_indices):
slices = torc... | 32.615385 | 76 | 0.673349 | [
"MIT"
] | penguinmenac3/leanai | leanai/core/indexed_tensor_helpers.py | 848 | Python |
import os
import re
import json
import uuid
from string import Template
from iocbuilder.iocinit import IocDataStream
def debug_print(message, level):
if int(os.getenv("ODIN_BUILDER_DEBUG", 0)) >= level:
print(message)
ADODIN_ROOT = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__))... | 30.801527 | 101 | 0.628748 | [
"Apache-2.0"
] | dls-controls/ADOdin | etc/builder/util.py | 4,035 | Python |
"""
Remote platform
This platform uses physical ethernet interfaces.
"""
# Update this dictionary to suit your environment.
remote_port_map = {
(0, 0): "eth0",
(0, 1): "eth1",
(0, 2): "eth2",
(0, 3): "eth3",
(0, 4): "eth4",
(0, 5): "eth5",
(0, 6): "eth6",
(0, 7): "eth7",
(0, 8): "e... | 20.849057 | 60 | 0.489593 | [
"Apache-2.0"
] | PJHsieh/MarkHsieh_ptf | src/ptf/platforms/remote.py | 1,105 | Python |
import numpy as np
import pandas as pd
import torch
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LogisticRegression
from sklearn import svm
from torch.utils.data import DataLoader
from sklearn.ensemble import ExtraTreesClassifier
from parameters import *
from training.evaluation i... | 41.634615 | 119 | 0.742725 | [
"MIT"
] | TonyMTH/Resume-Ranking | training/train.py | 4,330 | Python |
import argparse
import configparser
import pexpect
import re
import os
from ipykernel.kernelbase import Kernel
from . import __version__
""" Macaulay2 Jupyter Kernel
"""
class M2Config:
""""""
def __init__(self, execpath, configpath=os.getenv('M2JK_CONFIG')):
""""""
parser = argparse.Argume... | 36.977918 | 120 | 0.524484 | [
"MIT"
] | MWhybrow92/Macaulay2-Jupyter-Kernel | m2_kernel/kernel.py | 11,722 | Python |
#!/usr/bin/env python3
import argparse
import common
import functools
import multiprocessing
import os
import os.path
import pathlib
import re
import subprocess
import stat
import sys
import traceback
import shutil
import paths
EXCLUDED_PREFIXES = ("./generated/", "./thirdparty/", "./build", "./.git/", "./bazel-", ".... | 41.82471 | 125 | 0.691805 | [
"Apache-2.0"
] | isholaomotayo/envoy | tools/check_format.py | 39,608 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.