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 |
|---|---|---|---|---|---|---|---|---|
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | 41.125 | 99 | 0.658663 | [
"Apache-2.0"
] | Horizon-95/st2 | st2reactor/st2reactor/rules/tester.py | 6,580 | Python |
"""
Support for the Dyson 360 eye vacuum cleaner robot.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/vacuum.dyson/
"""
import logging
from homeassistant.components.vacuum import (
SUPPORT_BATTERY, SUPPORT_FAN_SPEED, SUPPORT_PAUSE, SUPPORT_RETURN_HOME... | 34.655502 | 79 | 0.654701 | [
"Apache-2.0"
] | FlorianLudwig/home-assistant | homeassistant/components/dyson/vacuum.py | 7,243 | Python |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the PyMVPA package for the
# copyright and license terms.
#
### ### ### ### ###... | 29 | 78 | 0.612619 | [
"MIT"
] | mortonne/PyMVPA | mvpa2/tests/test_misc_plot.py | 1,363 | Python |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
from collections import OrderedDict
import numpy as np
import warnings
import scipy.constants
import re
__author__ = "S... | 37.365779 | 129 | 0.56681 | [
"BSD-3-Clause"
] | pyiron/pyiron_atomistic | pyiron_atomistics/vasp/outcar.py | 36,471 | Python |
"""
All things CloudFormation Init.
"""
from paco.models.base import Named
from paco.models import schemas
from zope.interface import implementer
from zope.schema.fieldproperty import FieldProperty
import troposphere.cloudformation
def export_attrs_as_dicts(obj, attrs):
out = {}
for name in attrs:
va... | 37.749175 | 109 | 0.687358 | [
"MPL-2.0"
] | waterbear-cloud/aim.models | src/paco/models/cfn_init.py | 11,438 | Python |
import numpy as np
import os, time
import random
import tensorflow as tf
from lookalike_model.trainer.model_new import Model
import argparse
random.seed(1234)
# adding arguments for tfrecord directory and the checkpoint directory
parser = argparse.ArgumentParser()
parser.add_argument("--data_dir", type=str, help="inp... | 42.510638 | 152 | 0.654905 | [
"Apache-2.0"
] | Faezehvaseghi/incubator-bluemarlin | Model/lookalike-model/lookalike_model/trainer/lookalike_trainer_tfrecords.py | 3,996 | Python |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import numpy
import copy
from dcase_util.ui import FancyStringifier, FancyLogger
from dcase_util.containers import ContainerMixin
from dcase_util.data import DataBuffer
def get_keras_data_sequence_class():
# Use... | 34.787167 | 120 | 0.519951 | [
"MIT"
] | AlexBruBuxo/TFG--ASC-Deep-Learning | venv/Lib/site-packages/dcase_util/keras/data.py | 22,229 | Python |
class Action():
()
| 7.666667 | 15 | 0.478261 | [
"MIT"
] | nickswalker/counterpoint-reinforcement-learning | rl/action.py | 23 | Python |
import dataclasses
import os
from typing import List
import hydra
@dataclasses.dataclass
class ModelConfig:
"""Configuration for the model.
Note that `block_sizes` must be specified using the `dataclasses.field`
function, as you are not allowed to supply default values for mutable fields.
Instead, t... | 28.595745 | 84 | 0.72247 | [
"MIT"
] | wendazhou/cds-bootcamp | lecture3/bootcamp3/script.py | 1,344 | Python |
import numpy as np
import h5py as py
import matplotlib.pyplot as plt
import sys
hdf5_file = py.File("..\\Build\\TestsWithGL\\t2d_mpm_chm_t_bar_conference_restart.hdf5", "r")
frame_id = 0
th_grp = hdf5_file['TimeHistory']['penetration']
pcl_dset = th_grp['frame_%d' % frame_id]['ParticleData']
pcl_num = pcl_dset.attrs[... | 29.055556 | 93 | 0.664436 | [
"MIT"
] | MingAtUWA/SimpleMPM2 | PyUtilities/hdf5_stress_range.py | 1,046 | Python |
from flask import render_template
from app import app
from app.forms import LoginForm
# ...
@app.route('/login')
def login():
form = LoginForm()
return render_template('login.html', title='Sign In', form=form) | 21.9 | 68 | 0.712329 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | 1586-ItSolSchool/Pythonodavy | app/routes.py | 219 | Python |
from datetime import datetime, timedelta
import requests
from decouple import config
from django.contrib.auth.models import User
from django.test import TestCase
from django.utils import timezone
from .models import Socio
class ModelTest(TestCase):
def setUp(self):
Socio(
user=User.objects.c... | 33.041667 | 90 | 0.533733 | [
"MIT"
] | leonunesbs/aaafuria-rebon-backend | core/tests.py | 3,174 | Python |
# Script to convert json into proprietary .mat files
# Licensed under Apache v2 (see LICENSE)
import sys
import os
import glob
import json
from scipy.io import savemat
def main(json_dir, out_dir):
""" Script to convert all .json files in json_dir into corresponding .mat
files in out_dir
.mat files ... | 29.815789 | 93 | 0.661077 | [
"Apache-2.0"
] | CobiELF/opensauce-python | tools/convert_json_to_mat.py | 1,133 | Python |
"""Model module for images."""
from django.db import models
from django.contrib.auth.models import User
from imager_profile.models import ImagerProfile
# Create your models here.
class ImageBaseClass(models.Model):
"""Base class for Photo and Album classes."""
PRIVATE = 'PRVT'
SHARED = 'SHRD'
PUBLIC ... | 29.625 | 77 | 0.65642 | [
"MIT"
] | Loaye/django-imager-group | imagersite/imager_images/models.py | 1,659 | Python |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import Authenticatio... | 45.082826 | 340 | 0.514184 | [
"MIT"
] | DoctorSlimm/ccxt | python/ccxt/async_support/bitvavo.py | 74,026 | Python |
# 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 required by applicable law or ag... | 37.039735 | 79 | 0.734311 | [
"Apache-2.0"
] | bopopescu/searchparty | google-cloud-sdk/lib/googlecloudsdk/command_lib/crash_handling.py | 5,593 | Python |
import inspect
import textwrap
import pytest
from _pytest.compat import MODULE_NOT_FOUND_ERROR
from _pytest.doctest import _get_checker
from _pytest.doctest import _is_mocked
from _pytest.doctest import _patch_unwrap_mock_aware
from _pytest.doctest import DoctestItem
from _pytest.doctest import DoctestModule
from _pyt... | 29.477516 | 109 | 0.46041 | [
"MIT"
] | NNRepos/pytest | testing/test_doctest.py | 41,317 | Python |
from statistics import mean
with open("input.txt") as f:
values = [int(i) for i in f.readline().split(",")]
m_values = int(mean(values))
print(min(
sum(sum(range(1, abs(pos - i) + 1)) for pos in values)
for i in range(m_values - 1, m_values + 1)
))
| 22 | 58 | 0.625 | [
"MIT"
] | Ashwin-op/Advent_of_Code | 2021/Day 7 - The Treachery of Whales/2.py | 264 | Python |
symbols = [ '1288.HK', '3988.HK', '0883.HK', '0939.HK', '2628.HK', '3968.HK', '0941.HK', '0688.HK', '0386.HK', '1088.HK', '0728.HK', '0762.HK', '1398.HK', '0857.HK', '2318.HK', '0700.HK', 'GAZPq.L', 'LKOHyq.L', 'NKELyq.L', 'NVTKq.L', 'RELIq.L', 'ROSNq.L', 'SNGSyq.L', 'TATNxq.L', 'BSBR.N', 'BBD.N', 'ABV.N', 'CIG.N', 'S... | 44.882353 | 430 | 0.596767 | [
"MIT"
] | K0414/metaos | src/attic/attic-python/test/test-secondorder.py | 2,289 | Python |
"""Example reStructuredText from Sphinx-Needs project.
From http://sphinxcontrib-needs.readthedocs.io/en/latest/
but will not work in isolation - cut down just to trigger
RST304.
**Some text**
Wohooo, we have created :need:`req_001`,
which is linked by :need_incoming:`req_001`.
"""
print("sphinx-needs defines its ... | 23.333333 | 61 | 0.76 | [
"MIT"
] | Smirenost/flake8-rst-docstrings | tests/RST304/sphinx-roles.py | 350 | Python |
import requests
from bs4 import BeautifulSoup
"""
Bu modül burçlar ile ilgilenen arkadaşlarımın işine yarayacaktır.
Çok basit bir kullanımı mevcuttur.
Bir sorunuz olursa seve seve yardım etmek isterim profilimdeki linklerden bana ulaşabilirsiniz.
"""
def makeAPIRequest(path: str, type: str) -> str:
... | 31.71875 | 96 | 0.619704 | [
"MIT"
] | The-Special/Burc-api | burclar/__init__.py | 4,090 | Python |
# -*- coding: utf-8 -*-
from guillotina import configure
from guillotina.catalog.utils import get_index_fields
from guillotina.component import get_utilities_for
from guillotina.content import IResourceFactory
from guillotina.utils import get_dotted_name
from packaging import version
import aioelasticsearch
ES_CLIEN... | 33.291667 | 98 | 0.629537 | [
"BSD-2-Clause"
] | vjove/guillotina_elasticsearch | guillotina_elasticsearch/__init__.py | 2,397 | Python |
import nltk
import numpy as np
#nltk.download('punkt') #downloading a package with a pretrained tokenizer
from nltk.stem.porter import PorterStemmer
stemmer = PorterStemmer()
def tokenize(sentence): #splitting a string into meaningful units
return nltk.word_tokenize(sentence)
def stem(word): ... | 26.615385 | 80 | 0.703757 | [
"MIT"
] | Serkanbezek/Chatbot-NLP-PyTorch | nltk_utils.py | 692 | Python |
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team and authors from University of Illinois at Chicago.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with... | 42.100719 | 134 | 0.641319 | [
"Apache-2.0"
] | AndrewSchoeller/BERT-for-RRC-ABSA | pytorch-pretrained-bert/src/gen_pt_squad.py | 5,852 | Python |
from logging import getLogger
import gokart
import luigi
import swifter # noqa
from dajare_detector.utils.base_task import DajareTask
from dajare_detector.preprocessing.make_kana_pattern import MakeKanaPattern
from dajare_detector.preprocessing.make_splited_pattern import MakeSplitedPattern
from dajare_detector.prep... | 39.75 | 85 | 0.715584 | [
"MIT"
] | vaaaaanquish/dajare-detector | dajare_detector/featurize/make_decide_kana_feature.py | 1,461 | Python |
#!/usr/bin/python3
# System imports
import argparse
import sys
import serial
# Data processing imports
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import seaborn as sns
def checkparams(pwm_freq, pwm_duty, num_samples):
check_ok = True
if pwm_freq < 20 or pwm_freq > 100:
... | 25.504065 | 73 | 0.613006 | [
"MIT"
] | dumpram/stm32_real_time_test | scripts/test.py | 3,141 | Python |
# -*- coding: utf-8 -*-
# 留言板
# 1、新建目录下一定要有__init__.py文件,否则不能被其它文件引用、不能沿路径读写文件。from ... 。
# 2、urls.py中,设置第一级路由名ask。 在.../mysite/mysite/urls.py中 url(r'^ask/', include('account.ask.urls')),
# 3、admin.py中,设置数据库显示。在.../mysite/account/admin.py中 @admin.register(Technologyask) ...
# 4、templates中,增加模板文件目录/ask
import datetime... | 43.088889 | 114 | 0.690304 | [
"Apache-2.0"
] | wcl6005/testgit | mysite/guestbook/guestbook.py | 4,146 | Python |
"""This module contains the HelpCommandHandler class."""
from telegram import Update
from telegram.ext import CommandHandler, CallbackContext
import utils.helper as helper
class HelpCommandHandler(CommandHandler):
"""Handler for /help command"""
def __init__(self):
CommandHandler.__init__(self, "hel... | 27.944444 | 59 | 0.747515 | [
"MIT"
] | walkerjens/telegram.ongabot | ongabot/handler/helpcommand.py | 503 | Python |
#!/usr/bin/python
# Copyright 2019 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 required by ... | 31 | 74 | 0.730921 | [
"Apache-2.0"
] | rainwangphy/pysc2 | pysc2/bin/battle_net_maps.py | 1,271 | Python |
#!/usr/bin/env python3
import fnmatch
import os
import re
import ntpath
import sys
import argparse
excluded_files = []
def check_config_style(filepath):
bad_count_file = 0
def pushClosing(t):
closingStack.append(closing.expr)
closing << Literal( closingFor[t[0]] )
def popClosing():
... | 45.651899 | 164 | 0.539859 | [
"MIT"
] | jdoxley/Swamp-Aux | tools/config_style_checker.py | 7,213 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import django.dispatch
# Signal to inform application about ready .mo files, so server will know
# when to restart itself.
post_compilemessages = django.dispatch.Signal()
| 24.333333 | 73 | 0.739726 | [
"MIT"
] | VorskiImagineering/django-C3PO | django_c3po/signals.py | 219 | Python |
# Copyright 2019 BlueCat Networks. All rights reserved.
import ipaddress
from flask import request, g, abort, jsonify
from bluecat.api_exception import PortalException, APIException
from bluecat import route, util
from main_app import app
# application config
# Define global variable to hold handle to API object
api... | 41.13141 | 129 | 0.623003 | [
"Apache-2.0"
] | npatellumeta/gateway-workflows | Community/AssetManagement/lumeta_workflow_page.py | 12,833 | Python |
import dmc2gym
from domains.wrappers import ConcatObs
def mdp():
return dmc2gym.make(domain_name="cartpole", task_name="swingup", keys_to_exclude=[], frame_skip=5, track_prev_action=False)
def p():
return dmc2gym.make(domain_name="cartpole", task_name="swingup", keys_to_exclude=['velocity'], frame_skip=5, t... | 26.909091 | 137 | 0.741554 | [
"MIT"
] | zhihanyang2022/CleanRL | offpcc/domains/dmc_cartpole_su.py | 592 | Python |
import logging
from .Container import Container
class MqttBrokerContainer(Container):
def __init__(self, name, vols, network, image_store, command=None):
super().__init__(name, 'mqtt-broker', vols, network, image_store, command)
def get_startup_finished_log_entry(self):
return "mosquitto vers... | 32.76 | 82 | 0.634921 | [
"Apache-2.0"
] | rustammendel/nifi-minifi-cpp | docker/test/integration/minifi/core/MqttBrokerContainer.py | 819 | Python |
# Generated by Django 2.2.1 on 2019-07-10 04:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('investment_bot', '0005_amount_restrictions'),
]
operations = [
migrations.CreateModel(
name='Section_Deduction',
fie... | 31.48 | 114 | 0.584498 | [
"MIT"
] | dreamvrutik/Investment-Chatbot | Chatbot_investment/chatbot/investment_bot/migrations/0006_section_deduction.py | 787 | Python |
####################
# ES-DOC CIM Questionnaire
# Copyright (c) 2017 ES-DOC. All rights reserved.
#
# University of Colorado, Boulder
# http://cires.colorado.edu/
#
# This project is distributed according to the terms of the MIT license [http://www.opensource.org/licenses/MIT].
####################
from djan... | 46.941606 | 195 | 0.664438 | [
"MIT"
] | ES-DOC/esdoc-questionnaire | Q/questionnaire/q_urls.py | 6,431 | Python |
def pattern_sixteen(steps):
''' Pattern sixteen
9
9 8
9 8 7
9 8 7 6
9 8 7 6 5
9 8 7 6 5 4
9 8 7 6 5 4 3
9 8 7 6 5 4 3 2
9 8 7 6 5 4 3 2 1
'''
get_range = [str(i) for i in range(1, steps + 1)][::-1] # Getting range of nu... | 21.857143 | 112 | 0.48366 | [
"MIT"
] | chandthash/nppy | Project Pattern/pattern_16.py | 612 | Python |
from __future__ import absolute_import, division, print_function
from tensorflow.python.keras.layers import Input, Dense
from tensorflow.python.keras.layers.normalization import BatchNormalization
from tensorflow.python.keras.models import Model
# 第一種架構: 深度前饋網路(deep feedforward network)
# 也叫做前饋神經網路(feedforward neura... | 36.085714 | 75 | 0.672605 | [
"MIT"
] | swcjack6931677/ERINN | erinn/python/models/DFN.py | 2,578 | Python |
from rest_framework import serializers, generics
from snippets.models import Snippet, LANGUAGE_CHOICES, STYLE_CHOICES
from users.models import UserProfile
# class SnippetSerializer(serializers.Serializer):
# id = serializers.IntegerField(read_only=True)
# title = serializers.CharField(required=False, allow_bl... | 41.577778 | 92 | 0.691074 | [
"Apache-2.0"
] | minicloudsky/MxShop | apps/snippets/serializers.py | 1,951 | Python |
"""Support for sending data to StatsD."""
import logging
import statsd
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT, CONF_PREFIX, EVENT_STATE_CHANGED
from homeassistant.helpers import state as state_helper
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogg... | 31.126316 | 86 | 0.630369 | [
"Apache-2.0"
] | 0x00-0xFF/home-assistant | homeassistant/components/statsd/__init__.py | 2,957 | Python |
import os
from pathlib import Path
DB_NAME = "chatapp.db"
PROJECT_PATH = Path(__file__).parents[1]
DB_PATH = os.path.join(PROJECT_PATH, "resource", DB_NAME)
PORT_MIN = 1024
PORT_MAX = 65535
DEBUG = os.getenv("CHAT_APP_DEBUG", False)
if DEBUG:
TIMEOUT = 30
else:
TIMEOUT = 0.5
| 16.941176 | 57 | 0.71875 | [
"MIT"
] | xckomorebi/ChatApp | ChatApp/settings.py | 288 | Python |
import base64
from datetime import timedelta
import logging
import time
import uuid
import warnings
import httpx
from ably.types.capability import Capability
from ably.types.tokendetails import TokenDetails
from ably.types.tokenrequest import TokenRequest
from ably.util.exceptions import AblyException, IncompatibleCli... | 38.025 | 106 | 0.633867 | [
"Apache-2.0"
] | ably/ably-python | ably/rest/auth.py | 13,689 | Python |
from urllib.parse import urlparse
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.shortcuts import resolve_url
from gate.views import redirect_to_gate
from gate import REDIRECT_FIELD_NAME
class GateLockMixin:
gate_url = None
permission_d... | 34.468354 | 109 | 0.658465 | [
"MIT"
] | n-serrette/wedding-website | gate/mixin.py | 2,723 | Python |
import random
import string
from discord import TextChannel
from discord.ext import commands
from discord.ext.tasks import loop
from discord_components import Button, ButtonStyle
from config import settings
from util.Match import Match
class Matchmaking(commands.Cog):
def __init__(self, bot):
self.bot ... | 33.475 | 135 | 0.668658 | [
"MIT"
] | DevvyDont/CraneDuels | cogs/Matchmaking.py | 4,023 | Python |
import PySimpleGUI as sg
layout = [
[sg.Text('text')],
[sg.Input('input', key= 'input1')],
[sg.Input('input', key='input2')],
[sg.Button('button', key='button1')]
]
window = sg.Window('list values - list or dict', layout)
while True:
event, values = window.Read()
if event == 'button1':
print(values[... | 18 | 58 | 0.627572 | [
"MIT"
] | CrazyJ36/python | pysimplegui/values_from_some_elements.py | 486 | Python |
from MonetDBtesting.sqltest import SQLTestCase
try:
from MonetDBtesting import process
except ImportError:
import process
with process.server(args=[],
mapiport='0',
stdin=process.PIPE,
stdout=process.PIPE,
stderr=process.PIPE) as... | 55.75 | 146 | 0.637668 | [
"MPL-2.0",
"MPL-2.0-no-copyleft-exception"
] | MonetDB/MonetDB | sql/test/mserver5-sql-readonly/Tests/mserver5-sql-readonly-view.py | 2,230 | Python |
import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
import h5py
import numpy as np
from skimage.transform import resize as skResize
from util.util import normalize, adaptive_instance_normalization
class UnalignedDataset(... | 41.290909 | 122 | 0.625055 | [
"BSD-3-Clause"
] | sinhaharsh/pytorch-CycleGAN-and-pix2pix | data/unaligned_dataset.py | 4,542 | Python |
##
# The MIT License (MIT)
#
# Copyright (c) 2016 Stefan Wendler
#
# 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,... | 26.074074 | 79 | 0.646591 | [
"MIT"
] | wendlers/edubot-snap | src/edubot/client.py | 3,520 | Python |
from project.hardware.hardware import Hardware
class HeavyHardware(Hardware):
TYPE = "Heavy"
def __init__(self, name, capacity, memory):
super().__init__(name, self.TYPE, capacity * 2, int(memory * 0.75))
| 24.888889 | 75 | 0.691964 | [
"MIT"
] | geodimitrov/Python-OOP-SoftUni | Exam-Prep/Exam_16-Aug-20/project/hardware/heavy_hardware.py | 224 | Python |
import logging, ast, os
from bisect import bisect_left, bisect
import louie as dispatcher
from twisted.internet import reactor
from rdflib import Literal
from light9 import showconfig
from light9.namespaces import L9, RDF, RDFS
from rdfdb.patch import Patch
log = logging.getLogger()
# todo: move to config, consolidate... | 33.025974 | 78 | 0.562407 | [
"MIT"
] | drewp/light9 | light9/curvecalc/curve.py | 12,715 | Python |
import paddle
import paddle.nn as nn
class ContrastiveLoss(nn.Layer):
"""
Compute contrastive loss
"""
def __init__(self, margin=0, max_violation=False):
super(ContrastiveLoss, self).__init__()
self.margin = margin
self.max_violation = max_violation
def forward(self, score... | 32.921053 | 84 | 0.620304 | [
"Apache-2.0"
] | njustkmg/PaddleMM | paddlemm/models/retrieval/layers/contrastive.py | 1,251 | Python |
# coding=utf-8
import json
import falcon
from ..db import db
class LogTheError(object):
def on_post(self, req, resp):
os = str(req.body['os']).lower()
account_addr = str(req.body['account_addr']).lower()
error_str = str(req.body['error_str']).lower()
log_type = 'error'
_... | 22.7 | 60 | 0.543319 | [
"MIT"
] | baymax19/Sentinel | master-node-docker/sentinel/logs/errors.py | 681 | Python |
# Enter your code for "Degree Distribution" here.
import csv
degrees = []
students = []
for l in csv.DictReader(open("degrees.csv")):
degrees.append(l)
for l in csv.DictReader(open("students.csv")):
students.append(l)
students = sorted(students, key=lambda x: float(x["score"]))
students.reverse()
print(st... | 18.222222 | 60 | 0.698171 | [
"BSD-2-Clause"
] | monkee52/NCSSChallenge | Degree Distribution.py | 328 | 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | 35.509728 | 134 | 0.60103 | [
"ECL-2.0",
"Apache-2.0"
] | pulumi/pulumi-aws | sdk/python/pulumi_aws/ecs/tag.py | 9,126 | Python |
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
import io
import os
import platform
import sys
import time
import unittest
import common
sys.path.append(os.path.joi... | 33.545455 | 80 | 0.716433 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | jnpatel2811/chromium | tools/chrome_proxy/webdriver/variations_combinations.py | 4,059 | Python |
# Link for the problem : https://leetcode.com/problems/next-permutation/
class Solution(object):
def nextPermutation(self, nums):
found = False
i = len(nums)-2
while i >=0:
if nums[i] < nums[i+1]:
found =True
break
i-=1
if not found:
... | 23.371429 | 72 | 0.462103 | [
"MIT"
] | 5l1v3r1/CompetitiveProgrammingQuestionBank | DSA 450 GFG/next_permutation.py | 818 | Python |
#
# blood_graph.py
#
# vanilla_core execution visualizer.
#
# input: vanilla_operation_trace.csv
# vanilla_stats.csv (for timing)
# output: blood graph file (blood_abstrat/detailed.png)
# blood graph key (key_abstract/detailed.png)
#
# @author Tommy, Borna
#
# How to use:
# python bl... | 41.784232 | 133 | 0.445482 | [
"SHL-0.51"
] | XQc0214/bsg_manycore | software/py/vanilla_parser/blood_graph.py | 20,140 | Python |
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
bin_path = os.path.join(... | 23.058824 | 54 | 0.632653 | [
"MIT"
] | 0x8000-0000/conan-center-index | recipes/freetype/all/test_package/conanfile.py | 392 | Python |
colors = {"clean": "\033[m",
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"purple": "\033[35m",
"cian": "\033[36m"}
n1 = float(input("Enter how many money do you have in your wallet(in Real): R$"))
print("You have {}R${:.2f... | 42.866667 | 81 | 0.479005 | [
"MIT"
] | MiguelChichorro/PythonExercises | World 1/First attempts/ex010 - Real to Dollar.py | 643 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Submits files or a URL to Cuckoo"""
from builtins import input
from argparse import ArgumentParser
from distutils.util import strtobool
from io import BytesIO
from time import sleep
from glob import glob
from zipfile import ZipFile
from os.path import basename
from cu... | 35.243902 | 113 | 0.655363 | [
"Apache-2.0"
] | seanthegeek/cuckoo-modified-utils | submit-to-cuckoo.py | 4,335 | Python |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | 35.754622 | 95 | 0.512363 | [
"Apache-2.0"
] | AzizNgoueya/qiskit-terra | qiskit/visualization/gate_map.py | 21,274 | Python |
#1KiB
with open("Makeflow1KiB","w+") as f:
f.write("CORES=1\nMEMORY=1000\nDISK=1\n\n")
for x in range(100):
f.write("out%i.txt:generate\n\t./generate out%i.txt %i\n\n"%(x,x,1024*1))
#10KiB
with open("Makeflow10KiB","w+") as f:
f.write("CORES=1\nMEMORY=1000\nDISK=1\n\n")
for x in range(100):
... | 34.877551 | 100 | 0.600936 | [
"MIT"
] | Nekel-Seyew/mpi-paper-tests | generation/generateMakeflows.py | 1,709 | Python |
# ##### 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... | 32.709278 | 107 | 0.67026 | [
"MIT"
] | calculusrobotics/RNNs-for-Bayesian-State-Estimation | Blender 2.91/2.91/scripts/startup/bl_ui/properties_physics_cloth.py | 15,864 | Python |
from django.template import Library
from django.utils import timezone
import datetime
register = Library()
@register.filter
def utcoffset(value):
# Yeap, it's strange, but tags are so ugly.. So I defined not use value, but get current timezone from utils
tz = timezone.get_current_timezone()
utc_offset = ... | 28.833333 | 112 | 0.695568 | [
"MIT"
] | 0MazaHacka0/drapo | src/web/drapo/templatetags/timezones.py | 519 | Python |
#
# Autogenerated by Thrift Compiler (0.10.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py:tornado
#
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
import sys
from th... | 25.214286 | 93 | 0.798867 | [
"Apache-2.0"
] | BSlience/fastweb | examples/service/fastweb_thrift_async/HelloService/ttypes.py | 353 | Python |
"""
Tests for pagination template tags and filters.
"""
from mock import Mock
from django import template
from tests import case
class PaginateTest(case.DBTestCase):
"""Tests for paginate template tag."""
def test_paginate(self):
"""Places Pager object in context with size/num from request."""
... | 32.756757 | 77 | 0.625413 | [
"BSD-2-Clause"
] | UCL/moztrap | tests/view/lists/templatetags/test_pagination.py | 2,424 | Python |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name='name', parent_name='streamtube', **kwargs):
super(NameValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edi... | 31.214286 | 79 | 0.647597 | [
"MIT"
] | 180Studios/LoginApp | venv/lib/python3.7/site-packages/plotly/validators/streamtube/_name.py | 437 | Python |
import copy
import numpy as np
from math import cos, sin, pi, atan2
import warnings
import matplotlib.patches as mpatches
from matplotlib.path import Path
from matplotlib.lines import Line2D
from matplotlib.transforms import Affine2D, Bbox, IdentityTransform
from matplotlib.text import Annotation
def rotated_polygon(... | 36.069409 | 93 | 0.480721 | [
"MIT"
] | keflavich/pyregion | pyregion/mpl_helper.py | 14,031 | Python |
# SPDX-FileCopyrightText: 2021 Arthur Breitman
# SPDX-License-Identifier: LicenseRef-MIT-Arthur-Breitman
import math
from collections import defaultdict
from pycfmm.data import AutoRepr
infinity = 10 ** 100
class Tick(AutoRepr):
"""
An initialized tick, marking the beginning or end of a position
"""
... | 34.007547 | 120 | 0.552818 | [
"MIT",
"Unlicense"
] | serokell/segmented-cfmm | python/scfmm/__init__.py | 9,012 | Python |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | 44.20595 | 100 | 0.604255 | [
"Apache-2.0"
] | JFurness1/pyscf | pyscf/mcscf/test/test_addons.py | 19,318 | Python |
# Copyright (c) 2016-2017, Jani Nikula <jani@nikula.org>
# Licensed under the terms of BSD 2-Clause, see LICENSE for details.
"""
Hawkmoth
========
Sphinx C Domain autodoc directive extension.
"""
import glob
import os
import re
import stat
import subprocess
import sys
from docutils import nodes, statemachine
from d... | 34.316832 | 82 | 0.634737 | [
"BSD-2-Clause"
] | mv0/hawkmoth | hawkmoth/__init__.py | 3,466 | Python |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
from .source import SourceOrb
__all__ = ["SourceOrb"]
| 13.111111 | 56 | 0.694915 | [
"MIT"
] | 52-entertainment/airbyte | airbyte-integrations/connectors/source-orb/source_orb/__init__.py | 118 | Python |
# Copyright 2017 gRPC 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 applicable law or agreed to in writing... | 54.76383 | 118 | 0.661875 | [
"Apache-2.0"
] | 4con/grpc-win-xp | tools/run_tests/performance/massage_qps_stats.py | 25,739 | Python |
from tocenv.components.position import Position
class DirectionType:
# Clock-wise numbering
Up = 0
Down = 2
Left = 1
Right = 3
class Direction(object):
def __init__(self):
pass
class Direction(object):
def __init__(self, direction_type):
self.direction = direction_... | 23.514706 | 57 | 0.595372 | [
"Apache-2.0"
] | KevinJeon/The-Tragedy-of-the-commons | tocenv/components/direction.py | 1,599 | Python |
from http import cookies
from io import StringIO
import pytest
def log_entry(entry):
return StringIO(entry)
@pytest.fixture
def cookie_zip_code():
cookie = cookies.SimpleCookie()
cookie.load(rawdata='zip=98101')
return cookie
@pytest.fixture
def cookie_empty():
cookie = cookies.SimpleCookie()... | 75.943182 | 569 | 0.748466 | [
"Apache-2.0"
] | gabriel4649/aws-log-parser | test/conftest.py | 6,683 | Python |
#!/home/observer/miniconda2/bin/python
import numpy as N
import sys, os
import logging as L
import subprocess as S
from collections import namedtuple
from sigpyproc.Readers import FilReader as F
sys.path.append("/home/vgupta/Codes/Fake_FRBs/")
from Furby_reader import Furby_reader
class FileNotFound(Exception):
pas... | 34.079268 | 281 | 0.643049 | [
"MIT"
] | vg2691994/mock_frb_injection_results | helpers.py | 11,178 | Python |
# -*- coding: utf-8 -*-
import scrapy
class scrapyshkmbab39Spider(scrapy.Spider):
name = "scrapyshkmbab39"
allowed_domains = ["ganjoor.net"]
if 1 == 1:
start_urls = ["https://ganjoor.net/hojviri/kashfol-mahjoob/kmbab39/sh"]
else:
start_urls = ["https://ganjoor.net/hojviri/kashfol-mahjoo... | 59.5 | 215 | 0.466514 | [
"MIT"
] | amirmasoud/ganjoor-crawler | ganjoor/spiders/hojviri/kashfol-mahjoob/scrapyshkmbab39.py | 3,971 | Python |
import psycopg2
import psycopg2.extras
class DBHandler:
"""
Handles I/O concerning the database to hide its implementation from client services.
"""
def __init__(self,
postgres_username=None,
postgres_password=None,
db_username='dbpedia_ap... | 36.549407 | 128 | 0.583324 | [
"MIT"
] | jdwinkler/dbpedia_service | database_query_handler.py | 9,247 | Python |
# Copyright Contributors to the Amundsen project.
# SPDX-License-Identifier: Apache-2.0
import unittest
from unittest.mock import ANY
from databuilder.models.graph_serializable import (
RELATION_END_KEY, RELATION_END_LABEL, RELATION_REVERSE_TYPE, RELATION_START_KEY, RELATION_START_LABEL,
RELATION_TYPE,
)
from... | 46.038217 | 118 | 0.596292 | [
"Apache-2.0"
] | JacobSMoller/amundsendatabuilder | tests/unit/models/test_user.py | 7,228 | Python |
from django.contrib import admin
from .models import *
from django.contrib.auth.models import User
class ImageAdmin(admin.ModelAdmin):
fields = ( 'image','name','caption','profile','post_date', 'user', )
readonly_fields = ('profile', 'post_date', 'user',)
#registering the models
# admin.site.register(Image, Image... | 29.2 | 70 | 0.755708 | [
"MIT"
] | MachariaMark/fakeinsta | insta/admin.py | 438 | Python |
"""Registry for the TF Encrypted Converter."""
import array
import logging
import os
from typing import Any, List
from collections import OrderedDict
import yaml
import numpy as np
import tensorflow as tf
from ..layers import Conv2D, Relu, Sigmoid, Dense, AveragePooling2D, MaxPooling2D
from ..protocol.pond import Pon... | 29.144399 | 99 | 0.677348 | [
"Apache-2.0"
] | capeprivacy/tf-encrypted | tf_encrypted/convert/register.py | 21,596 | Python |
from lldbsuite.test.lldbtest import *
import os
import vscode
class VSCodeTestCaseBase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
def create_debug_adaptor(self):
'''Create the Visual Studio Code debug adaptor'''
self.assertTrue(os.path.exists(self.lldbVSCodeExec),
'lld... | 44.139319 | 86 | 0.58694 | [
"Apache-2.0"
] | Diatrus/llvm-project | lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py | 14,257 | Python |
from django.apps import AppConfig
class TestConfig(AppConfig):
name = "test_app"
| 14.5 | 33 | 0.747126 | [
"MIT"
] | eamigo86/django3_asgi | test_app/apps.py | 87 | Python |
"""Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import re
from scipy ... | 41.678078 | 124 | 0.573119 | [
"MIT"
] | HangJie720/keras | keras/preprocessing/image.py | 69,394 | Python |
import sys
import os
from win32com.shell import shell
import logging
import argparse
from Tkinter import *
import tkMessageBox
from config import default_config_url
from ui import InstallerUI
from installer_api import InstallerAPI
def get_logfile_path():
profile = os.getenv('USERPROFILE')
company_name... | 39.206897 | 183 | 0.660803 | [
"Apache-2.0"
] | PeachyPrinter/peachyinstaller | windows/src/install.py | 3,411 | Python |
import re
from streamlink.compat import urlparse, parse_qsl
from streamlink.plugin import Plugin, PluginError
from streamlink.plugin.api import http, validate
from streamlink.plugin.api.utils import parse_query
from streamlink.stream import HTTPStream, HLSStream
from streamlink.compat import parse_qsl
from streamlink.... | 30.951557 | 101 | 0.541643 | [
"BSD-2-Clause"
] | nxkbd/streamlink | src/streamlink/plugins/youtube.py | 8,945 | 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, ... | 36.056497 | 80 | 0.733469 | [
"Apache-2.0"
] | anukaal/struct2tensor | struct2tensor/expression_impl/reroot.py | 6,382 | Python |
class GEDAColor:
""" Enumeration of gEDA colors """
BACKGROUND_COLOR = 0
PIN_COLOR = 1
NET_ENDPOINT_COLOR = 2
GRAPHIC_COLOR = 3
NET_COLOR = 4
ATTRIBUTE_COLOR = 5
LOGIC_BUBBLE_COLOR = 6
DOTS_GRID_COLOR = 7
DETACHED_ATTRIBUTE_COLOR = 8
TEXT_COLOR = 9
BUS_COLOR = 10
SELE... | 28.921708 | 69 | 0.621632 | [
"Apache-2.0"
] | lehaianh1986/schematic-file-converter | upconvert/parser/geda_commands.py | 8,127 | Python |
"""
Django settings for doiainn project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build path... | 25.640777 | 71 | 0.702385 | [
"MIT"
] | bbenko/doiainn | code/doiainn/doiainn/settings.py | 2,641 | Python |
import logging
import pyrebase
from requests.exceptions import HTTPError
class Node:
def __init__(self, nodeName):
self._nodeName = nodeName
self._next = None
def child(self, nodeName):
if self._next == None:
self._next = Node(nodeName)
else:
self._nex... | 24.336066 | 74 | 0.584035 | [
"MIT"
] | txsmith/p1-sensor | src/firebaseops.py | 2,969 | Python |
# -*- coding: utf-8 -*-
"""
User database models
--------------------
"""
import enum
import logging
import uuid
from flask import current_app
from sqlalchemy_utils import types as column_types
from flask_login import current_user # NOQA
from app.extensions import db, FeatherModel
from app.extensions.auth import sec... | 34.561497 | 112 | 0.609005 | [
"Apache-2.0"
] | karenc/houston | app/modules/users/models.py | 25,852 | Python |
# Copyright 2019 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 applic... | 36.921569 | 124 | 0.709506 | [
"Apache-2.0"
] | HubBucket-Team/io | tests/test_pcap_eager.py | 1,883 | Python |
import fnmatch
import io
import logging
from uuid import UUID
import requests
from requests.exceptions import ConnectionError, HTTPError
from .cromwell_metadata import CromwellMetadata
logger = logging.getLogger(__name__)
def requests_error_handler(func):
"""Re-raise ConnectionError with help message.
Cont... | 33.334532 | 95 | 0.563721 | [
"MIT"
] | ENCODE-DCC/caper | caper/cromwell_rest_api.py | 18,534 | Python |
import cv2
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from data import lab_gamut
import numpy as np
class GUIGamut(QWidget):
def __init__(self, gamut_size=110):
QWidget.__init__(self)
self.gamut_size = gamut_size
self.win_size = gamut_size * 2 # divided by 4
self.setFixe... | 32.626263 | 96 | 0.581734 | [
"BSD-2-Clause"
] | 3Demonica/colorization | interactive-deep-colorization/ui/gui_gamut.py | 3,230 | Python |
# coding: utf-8
__author__ = "Jerry He"
import dash_bootstrap_components as dbc
from dash import dcc, no_update
from dash_extensions.enrich import Dash, Output, Input, State, html
import flask
from flask import jsonify
from flask_cors import CORS
from dash import dash_table
import dash_ace
server = flask.Flask(__name_... | 31.575 | 147 | 0.582344 | [
"MIT"
] | xiangjerryhe/sql-ui-dash | dash_sql_client_ui.py | 5,052 | Python |
import numpy as np
import matplotlib.pyplot as plt
import time
from copy import copy
import os
from single_pitch import single_pitch
from channel import channel
from pseudo_speech import Pseudospeech_Synthetizer_class
from encryption import Encryption_class
from speech_analyzer import Speech_Analyzer_class
from speec... | 29.579439 | 177 | 0.740916 | [
"MIT"
] | PiotrKrasnowski/Speech_Encryption | a_full_model.py | 3,165 | Python |
#!/usr/bin/env python -u
"""
All commands that can be run in this project are available through this unified interface.
This should be run with the ./plaster.sh helper to get into the correct context.
"""
import tempfile
import numpy as np
import time
import os
import sys
import pandas as pd
import json
from pathlib im... | 31.690519 | 130 | 0.556816 | [
"MIT"
] | erisyon/plaster | plaster/main.py | 17,715 | Python |
# -*- coding: utf-8 -*-
#
# 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
... | 37.552632 | 80 | 0.700771 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | findpace/incubator-airflow | airflow/operators/generic_transfer.py | 2,854 | Python |
#For the whatsapp statuses url given below
#COOL
import requests
from bs4 import BeautifulSoup
url_to_scrape = 'https://www.appstatustxt.com/cool-whatsapp-status/'
r = requests.get(url_to_scrape)
soup = BeautifulSoup(r.text,"html5lib")
status_object=[]
statuses=[]
title=soup.title.string
print(title)
status_... | 29.8 | 69 | 0.695302 | [
"MIT"
] | anay97/python-scraper | cool.py | 745 | Python |
"""
Author: Nathan Clack
Date : 2009
Copyright (c) 2009 HHMI. Free downloads and distribution are allowed for any
non-profit research and educational purposes as long as proper credit is given
to the author. All other rights reserved.
"""
from .tests import plot_whiskers
from ui.whiskerdata.trace import Whisker_Seg
f... | 32.529221 | 99 | 0.550155 | [
"BSD-3-Clause"
] | aiporre/whisk | whisk/test_merge3.py | 20,038 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.