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 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | 42.520563 | 79 | 0.565018 | [
"Apache-2.0"
] | LinkleYping/horizon-vul | openstack_dashboard/dashboards/identity/projects/workflows.py | 39,289 | Python |
import os
import sys
import subprocess
from subprocess import CalledProcessError
from subprocess import TimeoutExpired
import time
import re
import statistics
class MemPoint:
def __init__(self, time, heap, heap_extra, stack, heap_tree):
self.time = int(time.split("=")[1])
self.heap = int(heap.split... | 32.634731 | 130 | 0.629541 | [
"MIT"
] | Saqqe/Cream | firstsession/measurement/measure_program.py | 5,450 | Python |
import numpy as np
import matplotlib.pyplot as plt
import pprint
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.cm import ScalarMappable
results = np.load('results.npy')
ini_p1, ini_p2, final_p1, final_p2, loss = results.T
param1_lab = 'Stiffness'
#param2_lab = 'Mass'
param2_lab = '... | 35.134328 | 123 | 0.718777 | [
"ECL-2.0",
"Apache-2.0"
] | priyasundaresan/kaolin | diffsim_torch3d/pysim/plot_cloth_params_results.py | 2,354 | Python |
#!/usr/bin/python
# Copyright 2011 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 appli... | 36.142361 | 79 | 0.698626 | [
"Apache-2.0"
] | DentonGentry/gfiber-catawampus | tr/cpe_management_server.py | 10,409 | 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 ... | 43.820896 | 98 | 0.718665 | [
"MIT"
] | 16pierre/azure-sdk-for-python | sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_storage_management_client.py | 2,936 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from pyowm.commons.databoxes import ImageType, Satellite, SubscriptionType
class TestImageType(unittest.TestCase):
def test_repr(self):
instance = ImageType('PDF', 'application/pdf')
repr(instance)
class TestSatellite(unittest.TestC... | 22.307692 | 74 | 0.684483 | [
"MIT"
] | Ankuraxz/pyowm | tests/unit/commons/test_databoxes.py | 580 | Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules.loss import _Loss
from torch.autograd import Function, Variable
import numpy as np
def cross_entropy_2D(input, target, weight=None, size_average=True):
n, c, h, w = input.size()
log_p = F.log_softmax(input, dim=1)
log_p... | 36.419048 | 106 | 0.640952 | [
"MIT"
] | Myyyr/segmentation | models/layers/loss.py | 3,824 | Python |
#!/usr/bin/env python
# Copyright (c) 2017-2018 The IchibaCoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import os, sys
from subprocess import check_output
def countRelevantCommas(line):
openParensPosStack = ... | 41.912621 | 167 | 0.565207 | [
"MIT"
] | LordSoylent/ICHIBA | contrib/devtools/logprint-scanner.py | 4,317 | Python |
"""pytest style fixtures for use in Virtool Workflows.""" | 57 | 57 | 0.754386 | [
"MIT"
] | igboyes/virtool-workflow | virtool_workflow/fixtures/__init__.py | 57 | Python |
# -*- coding: utf-8 -*-
import json
import logging
from collections import defaultdict
from functools import wraps
from logging.config import dictConfig
from subprocess import call
import redis
import requests
from flask import Flask, Response, redirect, render_template, request, session, url_for
from flask_migrate im... | 32.554455 | 88 | 0.57586 | [
"MIT"
] | ayushrusiya47/quiz-extensions | views.py | 23,016 | Python |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bwtool(AutotoolsPackage):
"""bwtool is a command-line utility for bigWig files."""
ho... | 29.5 | 75 | 0.725047 | [
"ECL-2.0",
"Apache-2.0",
"MIT"
] | 1nf1n1t3l00p/spack | var/spack/repos/builtin/packages/bwtool/package.py | 531 | Python |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Extended thread dispatching support.
For basic support see reactor threading API docs.
"""
from twisted.python.compat import _PY3
if not _PY3:
import Queue
else:
import queue as Queue
from twisted.python import failure
from twisted... | 30.740157 | 79 | 0.681352 | [
"Unlicense",
"MIT"
] | adamtheturtle/twisted | src/twisted/internet/threads.py | 3,904 | Python |
from datetime import datetime
from astropy.time import Time
def read_tle_file(tlefile, **kwargs):
"""
Read in a TLE file and return the TLE that is closest to the date you want to
propagate the orbit to.
"""
times = []
line1 = []
line2 = []
from os import path
... | 25.818182 | 106 | 0.602553 | [
"MIT"
] | bwgref/nustar_lunar_pointing | nustar_lunar_pointing/tracking.py | 4,544 | Python |
from uuid import uuid4
from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except:
from django.apps import apps
user_app, user_model = settings.AUTH_USER_MODEL.... | 29.235294 | 73 | 0.622938 | [
"BSD-3-Clause"
] | jespino/django-lot | lot/models.py | 2,485 | Python |
from __future__ import unicode_literals
from future.builtins import int, range, str
from datetime import date, datetime
from os.path import join, split
from uuid import uuid4
from django import forms
from django.forms.extras import SelectDateWidget
from django.core.files.storage import FileSystemStorage
from django.c... | 42.662005 | 79 | 0.593651 | [
"BSD-3-Clause"
] | gladgod/zhiliao | zhiliao/forms/forms.py | 18,302 | Python |
# -*- coding: utf-8 -*-
import json
import datetime
class JobHeader:
"""Represents a row from the callout."""
def __init__(self, raw_data):
self.attributes = {
"contractor": json.dumps(raw_data[0]),
"job_name": json.dumps(raw_data[1]),
"is_dayshift": js... | 34.295858 | 109 | 0.514665 | [
"MIT"
] | ataboo/CalloutScrape | DataObjects.py | 5,796 | Python |
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_POST
from shop.models import Product
from .cart import Cart
from .forms import CartAddProductForm
from coupons.forms import CouponApplyForm
from shop.recommender import Recommender
@require_POST
def cart_... | 32.734694 | 68 | 0.644015 | [
"MIT"
] | AngelLiang/Django-2-by-Example | Chapter09/myshop/cart/views.py | 1,604 | Python |
import argparse
from graph4nlp.pytorch.modules.config import get_basic_args
from graph4nlp.pytorch.modules.utils.config_utils import get_yaml_config, update_values
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--dataset_yaml",
type=str,
default="examples/pyt... | 41.830189 | 120 | 0.703654 | [
"Apache-2.0"
] | RyanWangZf/graph4nlp | examples/pytorch/semantic_parsing/graph2tree/geo/src/config.py | 2,217 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
----------------------
Asynchronous SqlHelper
----------------------
TODO:
#. Transaction
Examples:
Simple Usage:
::
from kipp.aio import SqlHelper, run_until_complete, coroutine2
@coroutine2
def main():
db = SqlHel... | 23.908046 | 75 | 0.630769 | [
"MIT"
] | Laisky/kipp | kipp/aio/sqlhelper.py | 2,080 | Python |
#!/usr/bin/env python3
import argparse
import collections
import hashlib
import itertools
import os
import re
import sys
import statistics
import subprocess
import tempfile
import time
import pprint
import json
from collections import namedtuple
# Argument parser
parser = argparse.ArgumentParser(description="""
C... | 35.535411 | 151 | 0.571827 | [
"ECL-2.0",
"Apache-2.0"
] | Sascha6790/tudocomp | etc/compare.py | 12,544 | Python |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class StopAppResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and... | 26.084848 | 79 | 0.55948 | [
"Apache-2.0"
] | huaweicloud/huaweicloud-sdk-python-v3 | huaweicloud-sdk-cloudrtc/huaweicloudsdkcloudrtc/v2/model/stop_app_response.py | 4,312 | Python |
'''
Description:
Play music on Spotify with python.
Author: AlejandroV
Version: 1.0
Video: https://youtu.be/Vj64pkXtz28
'''
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
import webbrowser as web
import pyautogui
from time import sleep
# your credentials
client_id = 'YOUR_CLIEN... | 24.38 | 103 | 0.632486 | [
"MIT"
] | avmmodules/playmusic_spoty | playmusic_spoty.py | 1,219 | Python |
# Copyright 2018 The Texar 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 ... | 33.182342 | 83 | 0.624711 | [
"Apache-2.0"
] | awesomemachinelearning/texar | texar/tf/utils/utils.py | 34,576 | Python |
#!/usr/bin/env python3
from helper import lemniscate, saveImage, getImageName
from math import pi
from random import uniform
IMAGE_WIDTH_IN = 5
IMAGE_HEIGHT_IN = 2
DPI = 400
def makeImage(height, width, imageName):
k = 1.9
numSamples = 100000000
imageWidth = width
imageHeight = height
data = [... | 25.137255 | 71 | 0.585023 | [
"MIT"
] | nicholsonja/Bridges-2019 | presentation/presentation_images/genImage_07.py | 1,282 | Python |
import magma as m
from magma import *
def test_pair():
# types
A2 = Tuple[Bit, Bit]
print(A2)
assert isinstance(A2, TupleMeta)
print(str(A2))
assert A2 == A2
B2 = Tuple[In(Bit), In(Bit)]
assert isinstance(B2, TupleMeta)
assert B2 == B2
C2 = Tuple[Out(Bit), Out(Bit)]
asse... | 26.013605 | 84 | 0.582767 | [
"MIT"
] | leonardt/magma | tests/test_type/test_tuple.py | 7,648 | Python |
from django.test import TestCase
###############################################
## test resources
###############################################
class TestPlayerSerializers(TestCase):
fixtures = ['auth.json', 'team.json']
def test_registration(self):
client = APIClient()
... | 33.142857 | 80 | 0.474138 | [
"MIT"
] | vollov/aron | team/tests.py | 696 | Python |
# -*- coding: utf-8 -*-
{
'name': 'Payment - Account',
'category': 'Accounting/Accounting',
'summary': 'Account and Payment Link and Portal',
'version': '1.0',
'description': """Link Account and Payment and add Portal Payment
Provide tools for account-related payment as well as portal options to
e... | 22.863636 | 70 | 0.626243 | [
"MIT"
] | VaibhavBhujade/Blockchain-ERP-interoperability | odoo-13.0 - Copy/addons/account_payment/__manifest__.py | 503 | Python |
ximport tulip
def reader(s):
res = yield from s.read(1)
while res:
print ('got data:', res)
res = yield from s.read(1)
def main(stream):
stream2 = tulip.StreamReader()
# start separate task
t = tulip.async(reader(stream2))
while 1:
data = yield from... | 19.153846 | 46 | 0.562249 | [
"Apache-2.0"
] | bslatkin/pycon2014 | lib/asyncio-0.4.1/sched_test.py | 747 | Python |
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import ClockCycles, ReadWrite, NextTimeStep, RisingEdge, FallingEdge
from cocotb.binary import BinaryValue
import numpy as np
from matplotlib import pyplot as plt
from scipy.signal import butter, filtfilt
from fixedpoint import FixedPoint
@cocotb.test(... | 30.517241 | 89 | 0.649153 | [
"MIT"
] | edge-analytics/fpga-sleep-tracker | fpga/test/featurize/actigraphy_counts/actigraphy_counts_tb.py | 1,770 | Python |
import getpass
import logging
import os
from urlparse import urlparse
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template
from readthedocs.builds.constants import LATEST
from readthedocs.builds.constants import LATEST_VERBOSE_NAME
from ... | 26.645161 | 80 | 0.633777 | [
"MIT"
] | ank-forked/readthedocs.org | readthedocs/core/utils/__init__.py | 3,304 | Python |
from django.contrib import admin
from .models import *
class foodAdmin(admin.ModelAdmin):
class Meta:
model=Fooditem
list_display=['name']
list_filter=['name']
admin.site.register(Profile)
admin.site.register(UserFooditem)
admin.site.register(Category)
admin.site.register(Fooditem,foodAdmin)
| 22.785714 | 39 | 0.746082 | [
"MIT"
] | Akumucollins/Calorie-Counter | calories/admin.py | 319 | Python |
# -*- coding: utf-8 -*-
from music21.test.dedent import dedent
__all__ = [
'dedent',
'testDocumentation',
'testExternal',
'testPerformance',
'timeGraphs',
'testStream',
'helpers',
]
import sys
if sys.version > '3':
from music21.test import testStream
from music21.test imp... | 18.931034 | 79 | 0.570128 | [
"MIT"
] | lasconic/randomsheetmusic | lib/music21/test/__init__.py | 549 | Python |
from typing import Union, List, Optional
from pyspark.sql.types import StructType, StructField, StringType, ArrayType, DataType
# This file is auto-generated by generate_schema so do not edit it manually
# noinspection PyPep8Naming
class MedicationKnowledge_AdministrationGuidelinesSchema:
"""
Information abo... | 49.776119 | 107 | 0.568516 | [
"Apache-2.0"
] | icanbwell/SparkFhirSchemas | spark_fhir_schemas/r4/complex_types/medicationknowledge_administrationguidelines.py | 13,340 | Python |
"""
LoSetup - command ``/usr/sbin/losetup -l``
==========================================
This parser reads the output of ``/usr/sbin/losetup -l`` into a list of entries.
Each entry is a dictionary of headers:
* ``NAME`` - the path name of the loop back device (strings)
* ``SIZELIMIT`` - the data end position of back... | 29.635135 | 80 | 0.578203 | [
"Apache-2.0"
] | LightOfHeaven1994/insights-core | insights/parsers/losetup.py | 2,193 | Python |
import asyncio
import concurrent
from concurrent.futures import ThreadPoolExecutor
from unittest import TestCase
import os
import cv2
from apscheduler.schedulers.background import BackgroundScheduler
import bot
from bot.providers import trainer_matches as tm
from bot.duel_links_runtime import DuelLinkRunTime
from bo... | 37.912088 | 108 | 0.670725 | [
"MIT"
] | david252620/Yugioh-bot | tests/providers/test_steam_.py | 6,900 | Python |
from ..errors import MalformedResponseError
from ..properties import FailedMailbox, SearchableMailbox
from ..util import MNS, add_xml_child, create_element
from ..version import EXCHANGE_2013
from .common import EWSService
class GetSearchableMailboxes(EWSService):
"""MSDN:
https://docs.microsoft.com/en-us/exc... | 43.142857 | 119 | 0.690161 | [
"BSD-2-Clause"
] | cygnus9/exchangelib | exchangelib/services/get_searchable_mailboxes.py | 2,114 | Python |
#!/usr/bin/env python2
# coding=utf-8
# ^^^^^^^^^^^^ TODO remove when supporting only Python3
# Copyright (c) 2014-2015 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 test_framework.test_framework... | 44.642857 | 165 | 0.6368 | [
"MIT"
] | chavezcoin-project/chavezcoin-D | qa/rpc-tests/wallet.py | 15,632 | Python |
# coding=utf-8
# Copyright 2020 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.868132 | 79 | 0.641787 | [
"Apache-2.0"
] | MeghnaNatraj/google-research | correct_batch_effects_wdn/transform_test.py | 7,074 | Python |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.InfoArrayValidator):
def __init__(
self, plotly_name='x', parent_name='layout.ternary.domain', **kwargs
):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... | 29.870968 | 76 | 0.399568 | [
"MIT"
] | Abd-Elrazek/plotly.py | plotly/validators/layout/ternary/domain/_x.py | 926 | Python |
# -*- coding=utf-8 -*-
"""
# library: jionlp
# author: dongrixinyu
# license: Apache License 2.0
# Email: dongrixinyu.89@163.com
# github: https://github.com/dongrixinyu/JioNLP
# description: Preprocessing tool for Chinese NLP
"""
__version__ = '1.3.49'
import os
from jionlp.util.logger import set_logger
from jionl... | 52.659574 | 76 | 0.43697 | [
"Apache-2.0"
] | FYWinds/JioNLP | jionlp/__init__.py | 5,700 | Python |
"""
This module contains the lambda function code for put-storage-tags API.
This file uses environment variables in place of config; thus
sddcapi_boot_dir is not required.
"""
# pylint: disable=import-error,logging-format-interpolation,broad-except,too-many-statements,C0413,W1203,R1703,R0914
import boto3
import botoc... | 38.567164 | 116 | 0.634675 | [
"MIT-0"
] | aws-samples/boto3-proxy-api-sls | boto3_proxy/index.py | 7,752 | Python |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
def test_wait_for_db_ready(self):
"""Test waiting for db when db is available"""
with patch('django.db.utils... | 40.933333 | 79 | 0.679153 | [
"MIT"
] | anirudhs1998/recipe-app-api | app/core/tests/test_commands.py | 1,228 | Python |
#coding=utf-8
#
# Copyright (C) 2015 Feigr TECH Co., Ltd. All rights reserved.
# Created on 2013-8-13, by Junn
#
#
#import settings
from django.middleware.csrf import get_token
from django.http.response import Http404
from django.core.exceptions import PermissionDenied
from rest_framework.generics import GenericAPIVi... | 35.857143 | 79 | 0.588396 | [
"MIT"
] | dlooto/driver-vision | apps/core/views.py | 4,016 | Python |
import os
from pathlib import Path
from dataclasses import field
from typing import Dict, Tuple, Sequence
from pydantic.dataclasses import dataclass
from pydantic import StrictStr
@dataclass
class StreetViewConfig:
SIZE: str = "600x300"
HEADING: str = "151.78"
PITCH: str = "-0.76"
KEY = os.environ.ge... | 36.855072 | 149 | 0.444908 | [
"BSD-3-Clause"
] | AQ-AI/open-geo-engine | open_geo_engine/config/model_settings.py | 25,430 | Python |
#!/usr/bin/python
import argparse
import os
import subprocess
import sys
def main():
parser = argparse.ArgumentParser(
description="Update scripting grammar")
parser.add_argument("--java", type=str, help="Java executable", default="java")
parser.add_argument("--antlr", type=str, help="Antlr3 location", d... | 35.847222 | 97 | 0.598605 | [
"BSD-2-Clause"
] | WNProject/WNFramework | Libraries/WNScripting/generate_grammar.py | 2,581 | Python |
"""
Django settings for profiles project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
... | 25.5 | 91 | 0.6953 | [
"MIT"
] | Iceman8423/profiles-rest-api | profiles/settings.py | 3,213 | Python |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.pyplot as plt
# Though the following import is not directly being used, it is required
# for 3D projection to work
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cluster import KMeans
from sklearn import ... | 32.408451 | 80 | 0.610169 | [
"MIT"
] | anikaanzum/NetworkDataAnalysis | k-means.py | 2,301 | Python |
from flask import Blueprint, render_template, request, session, url_for
from CTFd.models import Tags, Users
from CTFd.utils.decorators import authed_only
from CTFd.utils.decorators.visibility import check_account_visibility
from CTFd.utils.helpers import get_errors, get_infos
from CTFd.utils.user import get_current_us... | 24.518072 | 87 | 0.644226 | [
"Apache-2.0"
] | ldecoster/Plateforme-CTF | CTFd/users.py | 2,035 | Python |
# -*- coding: utf-8 -*-
import time
import mock
import pytest
import requests
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
from anacode import codes
from anacode.api import client
from anacode.api import writers
def empty_response(*args, **kwargs):
resp = reques... | 29.762712 | 75 | 0.65186 | [
"BSD-3-Clause"
] | anacode/anacode-toolkit | tests/test_api_client.py | 5,532 | Python |
# coding: utf-8
# AUTOGENERATED BY gen_script.sh from kp1.py
# Copyright (C) Nyimbi Odero, Thu Aug 3 20:34:20 EAT 2017
import calendar
from flask import redirect, flash, url_for, Markup
from flask import render_template
from flask_appbuilder.models.sqla.interface import SQLAInterface
from flask_appbuilder.views i... | 43.02974 | 136 | 0.722925 | [
"MIT"
] | nyimbi/caseke | zarc/views_2017-08-03-21:28:54.py | 81,025 | Python |
import importlib.util
import logging
import re
import time
from collections import defaultdict
from inspect import getsource
from pathlib import Path
from types import ModuleType
from typing import Dict, List, Set, Type
import click
from flask_appbuilder import Model
from flask_migrate import downgrade, upgrade
from g... | 32.727723 | 88 | 0.644683 | [
"Apache-2.0"
] | psbsgic/rabbitai | scripts/benchmark_migration.py | 6,911 | Python |
# coding: utf-8
"""
Flat API
The Flat API allows you to easily extend the abilities of the [Flat Platform](https://flat.io), with a wide range of use cases including the following: * Creating and importing new music scores using MusicXML, MIDI, Guitar Pro (GP3, GP4, GP5, GPX, GP), PowerTab, TuxGuitar and Mus... | 59.658537 | 1,686 | 0.742845 | [
"Apache-2.0"
] | FlatIO/api-client-python | test/test_collection.py | 2,446 | Python |
from tkinter import *
from tkinter.ttk import * # styling library
from random import randint
root = Tk()
root.title("GUESS ME")
root.geometry("350x100")
root.configure(background='#AEB6BF')
#Style
style = Style()
style.theme_use('classic')
for elem in ['TLabel', 'TButton']:
style.configure(elem, background='#AEB6BF'... | 25.489362 | 81 | 0.651085 | [
"BSD-3-Clause"
] | kmranrg/GuessMe | guess.py | 1,198 | Python |
from regpfa import * | 20 | 20 | 0.8 | [
"BSD-2-Clause"
] | damianangelo1712/pred_analytics_context_dbn | regpfa/__init__.py | 20 | Python |
import copy
import json
import logging
import time
from elasticsearch import Elasticsearch
import es_search_functions
from common.mongo_client import getMongoClient
from apps.apis.search.keyword_list import keyword_list
class SuggestionCacheBuilder:
MAX_LEVEL = 2
def __init__(self, site_id, mongo_client):
... | 37.214953 | 153 | 0.583124 | [
"MIT"
] | sunliwen/poco | poco/apps/apis/search/suggestion_cache_builder.py | 3,982 | Python |
# Copyright (C) 2020 Red Hat, 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 agreed to in writ... | 28.944444 | 69 | 0.760077 | [
"Apache-2.0"
] | blockvigil/tooz | examples/group_membership_watch.py | 1,042 | Python |
# -*- coding: utf-8 -*-
# @Time: 2020/4/17 12:40
# @Author: GraceKoo
# @File: 241_different-ways-to-add-parentheses.py
# @Desc: https://leetcode-cn.com/problems/different-ways-to-add-parentheses/
from typing import List
class Solution:
def diffWaysToCompute(self, input: str) -> List[int]:
if input.isdigit... | 31.84375 | 76 | 0.47105 | [
"Apache-2.0"
] | Buddy119/algorithm | Codes/gracekoo/241_different-ways-to-add-parentheses.py | 1,027 | Python |
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'projeto_curso_2.settings')
try:
from django.core.management import execute_from_command_line
exc... | 29.173913 | 79 | 0.682563 | [
"MIT"
] | Jhonattan-rocha/Meus-Projetos | Python/Django/projeto_curso_2/manage.py | 671 | Python |
# Generated by Django 3.1.7 on 2021-03-07 11:27
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('app', '0005_auto_20210303_1338'),
]
operations = [
migrations.Create... | 27.875 | 102 | 0.723468 | [
"Apache-2.0"
] | connorkeevill/CM20257-housemates | app/migrations/0006_house.py | 669 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import select
import socket
import queue
import time
import os
class emsc_select_server:
def __init__(self):
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.server.setblocking(False)
self.server.setsockopt(socket.SOL_SOCKET... | 37.578313 | 113 | 0.506252 | [
"Apache-2.0"
] | roancsu/shadowX | run/server_select.py | 3,253 | Python |
# File: __init__.py
#
# Copyright (c) 2018-2019 Splunk 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 applicabl... | 40.266667 | 95 | 0.756623 | [
"Apache-2.0"
] | splunk-soar-connectors/hipchat | __init__.py | 604 | Python |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import os... | 37.22449 | 98 | 0.650768 | [
"MIT"
] | Co0olboi/azure-sdk-for-python | sdk/communication/azure-communication-sms/tests/test_sms_client_e2e_async.py | 1,824 | Python |
"""
Ex 012 - make an algorithm that reads the price of a product and shows it with 5% discount
"""
print('Discover how much is a product with 5% off discount')
print('-' * 50)
pp = float(input('Enter the product price: '))
pd = pp - (pp / 100) * 5
print('-' * 50)
print(f"The product price was {pp:.2f}, on promotion ... | 24.733333 | 90 | 0.652291 | [
"MIT"
] | Kevinwmiguel/PythonExercises | Ex12.py | 371 | 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
from... | 45.848837 | 158 | 0.674423 | [
"Apache-2.0"
] | AaronFriel/pulumi-aws-native | sdk/python/pulumi_aws_native/sagemaker/feature_group.py | 15,772 | Python |
import unittest
from os.path import abspath, join
from robot import api, parsing, reporting, result, running
from robot.utils.asserts import assert_equals
class TestExposedApi(unittest.TestCase):
def test_test_case_file(self):
assert_equals(api.TestCaseFile, parsing.TestCaseFile)
def test_test_da... | 30.265306 | 81 | 0.724882 | [
"ECL-2.0",
"Apache-2.0"
] | Mogztter/robotframework | utest/api/test_exposed_api.py | 1,483 | Python |
from api.views import BucketlistViewSet, ItemViewSet, UserViewSet
from django.conf.urls import url, include
from rest_framework.authtoken import views as authviews
from rest_framework_nested import routers
router = routers.SimpleRouter()
router.register(r'bucketlists', BucketlistViewSet)
router.register(r'users', User... | 36.842105 | 72 | 0.732857 | [
"Unlicense"
] | andela-mnzomo/life-list | lifelist/api/urls.py | 700 | Python |
from django.contrib import admin
from django.urls import path
from django.contrib.auth.views import LoginView
from . import views
app_name = 'users'
urlpatterns = [
# ex /users/
path('', views.index, name='index'),
# ex /users/login/
path('login/', LoginView.as_view(template_name='users/login.html'),... | 21.541667 | 72 | 0.649903 | [
"MIT"
] | Kowies/ToDo-web-app | users/urls.py | 517 | Python |
import mido
import json
import time
from math import floor
import board
import busio
import digitalio
import adafruit_tlc5947
def playMidi(song_name):
mid = mido.MidiFile('midifiles/' + song_name)
notesDict = {'songName': 'testname', 'bpm': 999, 'notes': []}
tempo = 0
length = 0
notesArray = [[]... | 28.303279 | 90 | 0.51839 | [
"Apache-2.0"
] | curtissimo41/Player-Piano-19363 | play_midi_curtis.py | 3,453 | Python |
# -*- coding: utf-8 -*-
# vim: ts=2 sw=2 et ai
###############################################################################
# Copyright (c) 2012,2013-2021 Andreas Vogel andreas@wellenvogel.net
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documen... | 32.579096 | 117 | 0.63366 | [
"MIT"
] | Littlechay/avnav | server/handler/avnuserapps.py | 11,533 | Python |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "styx"
PROJECT_SPACE_DIR = "/home/zche... | 42.333333 | 68 | 0.703412 | [
"MIT"
] | wolf-zchen/CarND-capstone-project | ros/build/styx/catkin_generated/pkg.develspace.context.pc.py | 381 | Python |
"""empty message
Revision ID: 4a83f309f411
Revises:
Create Date: 2019-06-20 23:47:24.513383
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4a83f309f411'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | 34.190476 | 71 | 0.67363 | [
"MIT"
] | stark3998/Instagram | migrations/versions/4a83f309f411_.py | 2,154 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""":Mod: views.py
:Synopsis:
:Author:
costa
servilla
ide
:Created:
7/23/18
"""
import daiquiri
from datetime import date, datetime
import html
import json
import math
import os.path
import pandas as pd
from pathlib import Path
import pickle
import reques... | 40.38112 | 174 | 0.652648 | [
"Apache-2.0"
] | mother-db/ezEMLmotherDB | webapp/home/views.py | 91,546 | Python |
#!/usr/bin/python3
import argparse
import os
import shutil
import sys
import traceback
from multiprocessing import Pool, cpu_count
from os.path import expanduser
import time
from typing import Tuple
from colorama import Fore
from atcodertools.client.atcoder import AtCoderClient, Contest, LoginError, PageNotFoundError... | 36.707101 | 118 | 0.626662 | [
"MIT"
] | anosatsuk124/atcoder-tools | atcodertools/tools/envgen.py | 12,407 | Python |
import os
import torch
import torch.nn.functional as F
import torch.nn as nn
import math
from modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
import torch.utils.model_zoo as model_zoo
def conv_bn(inp, oup, stride, BatchNorm):
return nn.Sequential(
nn.Conv2d(inp, oup, 3, stride, 1, bias=Fal... | 35.644737 | 114 | 0.568106 | [
"MIT"
] | haofengsiji/synthetic-to-real-semantic-segmentation | modeling/backbone/mobilenet.py | 5,418 | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=43
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... | 37.303371 | 77 | 0.680723 | [
"BSD-3-Clause"
] | UCLA-SEAL/QDiff | benchmark/startCirq3134.py | 3,320 | Python |
# -*- coding: utf-8 -*-
"""DBO MSSQL driver
.. module:: lib.database.dbo.drivers.mssql.driver
:platform: Unix
:synopsis: DBO MSSQL driver
.. moduleauthor:: Petr Rašek <bowman@hydratk.org>
"""
try:
import pymssql
except ImportError:
raise NotImplementedError('MSSQL client is not supported for PyPy')
fr... | 21.735714 | 143 | 0.533027 | [
"BSD-3-Clause"
] | hydratk/hydratk-lib-network | src/hydratk/lib/database/dbo/drivers/mssql/driver.py | 6,099 | Python |
import json
import pickle
import numpy as np
import pytest
import fsspec
from fsspec.implementations.ftp import FTPFileSystem
from fsspec.spec import AbstractFileSystem, AbstractBufferedFile
class DummyTestFS(AbstractFileSystem):
protocol = "mock"
_fs_contents = (
{"name": "top_level", "type": "dire... | 28.278986 | 83 | 0.574888 | [
"BSD-3-Clause"
] | DavidKatz-il/filesystem_spec | fsspec/tests/test_spec.py | 7,805 | Python |
from .base import *
ALLOWED_HOSTS = ["localhost", "0.0.0.0", "127.0.0.1"]
DATABASES = {
'default': {
'ENGINE': os.getenv('SQL_ENGINE', 'django.db.backends.sqlite3'),
'NAME': os.getenv('SQL_DATABASE', os.path.join(BASE_DIR, 'db.sqlite3')),
'USER': os.getenv('SQL_USER', 'user'),
'PAS... | 29.882353 | 80 | 0.594488 | [
"MIT"
] | andremargarin/digital-asset-management-api | digital_asset_management_api/settings/local.py | 508 | Python |
#!/usr/bin/python3
from datetime import datetime
import calendar
import sqlite3
import os
months = ['January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October',
'November', 'December']
calendar_db = 'PythonicTeamsCalendarTest/calendar.db'
def initi... | 32.6 | 152 | 0.650573 | [
"MIT"
] | druzgeorge/python-teams | PythonicTeamsCalendarTest/helpers.py | 3,749 | Python |
# 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 required by applicable law or agreed to i... | 32.592593 | 76 | 0.75 | [
"Apache-2.0"
] | avezraj/st2 | st2common/tests/unit/test_pack_management.py | 1,760 | Python |
import sys
import cv2
import os
from ast import literal_eval
from pathlib import Path
import shutil
import logging
import random
import pickle
import yaml
import subprocess
from PIL import Image
from glob import glob
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib import animatio... | 34.920177 | 138 | 0.554353 | [
"Apache-2.0"
] | VincentWang25/Kaggle_TGBR | src/util.py | 31,574 | Python |
#!/usr/bin/env python3
#
# # Copyright (c) 2021 Facebook, inc. and its affiliates. All Rights Reserved
#
#
from uimnet import utils
from uimnet import algorithms
from uimnet import workers
from omegaconf import OmegaConf
from pathlib import Path
import torch
import torch.distributed as dist
import torch.multiprocessi... | 28.466667 | 116 | 0.700494 | [
"MIT"
] | facebookresearch/uimnet | scripts/run_trainer.py | 3,843 | Python |
"""Configuration for SSDP tests."""
from typing import Optional, Sequence
from unittest.mock import AsyncMock, MagicMock, patch
from urllib.parse import urlparse
from async_upnp_client.client import UpnpDevice
from async_upnp_client.event_handler import UpnpEventHandler
from async_upnp_client.profiles.igd import Statu... | 29.666667 | 100 | 0.668134 | [
"Apache-2.0"
] | Aeroid/home-assistant-core | tests/components/upnp/conftest.py | 8,633 | Python |
# Copyright The PyTorch Lightning 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
#
# Unless required by applicable law or agreed to i... | 33.116279 | 90 | 0.746489 | [
"Apache-2.0"
] | Pandinosaurus/lightning-flash | flash/text/seq2seq/summarization/data.py | 1,424 | Python |
"""Testing utilities.
"""
import os.path
import pytest
def test():
"""Initiate poliastro testing
"""
pytest.main([os.path.dirname(os.path.abspath(__file__))])
| 12.571429 | 61 | 0.653409 | [
"MIT"
] | AunSiro/poliastro | src/poliastro/testing.py | 176 | Python |
from xml.etree import ElementTree
from django.test import TestCase
from peacecorps.util import svg as svg_util
XML_HEADER = b'<?xml version="1.0" encoding="UTF-8"?>\n'
class ValidateTests(TestCase):
def test_must_be_xml(self):
svg_bytes = b'some text n stuff'
self.assertIsNone(svg_util.validat... | 42.700787 | 77 | 0.585654 | [
"CC0-1.0"
] | 18F/peacecorps-site | peacecorps/peacecorps/tests/test_util_svg.py | 5,423 | Python |
# -*- coding: utf-8 -*-
"""Plot to demonstrate the qualitative1 colormap.
"""
import numpy as np
import matplotlib.pyplot as plt
from typhon.plots import (figsize, cmap2rgba)
x = np.linspace(0, 10, 100)
fig, ax = plt.subplots(figsize=figsize(10))
ax.set_prop_cycle(color=cmap2rgba('qualitative1', 7))
for c in np.a... | 19.818182 | 53 | 0.683486 | [
"MIT"
] | ChanJeunlam/typhon | doc/pyplots/plot_qualitative1.py | 436 | Python |
import html
import json
import random
import time
import pyowm
from datetime import datetime
from typing import Optional, List
import requests
from telegram import Message, Chat, Update, Bot, MessageEntity
from telegram import ParseMode
from telegram.ext import CommandHandler, run_async, Filters
from telegram import U... | 28.959459 | 147 | 0.692021 | [
"MIT"
] | SLdevilX/Lexter | cinderella/modules/ping.py | 2,156 | Python |
# Copyright 2014 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.
import logging
import time
from common import network_metrics
from telemetry.page import page_test
from telemetry.value import scalar
CHROME_PROXY_VIA_HEA... | 35.685185 | 80 | 0.706539 | [
"MIT"
] | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/tools/chrome_proxy/common/chrome_proxy_metrics.py | 3,854 | Python |
import logging.config
from netdisco.discovery import NetworkDiscovery
LOG = logging.getLogger(__name__)
def discover():
hue_bridges = []
LOG.info('Searching for Hue devices...')
netdis = NetworkDiscovery()
netdis.scan()
for dev in netdis.discover():
for info in netdis.get_info(dev):
... | 22.727273 | 64 | 0.616 | [
"MIT"
] | ChadiEM/philips-hue-hooks | philips_hue_hooks/discovery/hue_discovery.py | 750 | Python |
import importlib
import logging
import os
import sys
from pathlib import Path
logger = logging.getLogger('second.utils.loader')
CUSTOM_LOADED_MODULES = {}
def _get_possible_module_path(paths):
ret = []
for p in paths:
p = Path(p)
for path in p.glob("*"):
if path.suffix in ["py", ... | 32.974684 | 85 | 0.647601 | [
"MIT"
] | yukke42/SECOND | second/utils/loader.py | 2,605 | Python |
"""
This module defines the policies that will be used in order to sample the information flow
patterns to compare with.
The general approach is a function that takes in any eventual parameters and outputs a list of
pairs of DB_Ids for which the flow will be calculated.
"""
import random
import hashlib
import json
imp... | 40.075314 | 104 | 0.642723 | [
"BSD-3-Clause"
] | chiffa/BioFlow | bioflow/algorithms_bank/sampling_policies.py | 9,578 | Python |
from django.conf.urls import patterns, url
from . import views
urlpatterns = patterns('',
url(r'(?P<year>\d{4})-(?P<month>0[1-9]|1[0-2])-(?P<day>0[1-9]|[1-2][0-9]|3[0-1])/$',
views.DayLogViewer.as_view(), name="log_day"),
url(r'(?P<year>\d{4})-(?P<month>0[1-9]|1[0-2])-(?P<day>0[1-9]|[1-2][0-9]|3[0-1])... | 46.590909 | 91 | 0.600976 | [
"MIT"
] | Reception123/IRCLogBot | botbot/apps/logs/urls.py | 1,025 | Python |
# Databricks notebook source
# MAGIC %md-sandbox
# MAGIC
# MAGIC <div style="text-align: center; line-height: 0; padding-top: 9px;">
# MAGIC <img src="https://databricks.com/wp-content/uploads/2018/03/db-academy-rgb-1200px.png" alt="Databricks Learning" style="width: 600px">
# MAGIC </div>
# COMMAND ----------
# M... | 23.405172 | 192 | 0.650829 | [
"CC0-1.0"
] | Code360In/advanced-data-engineering-with-databricks | Advanced-Data-Engineering-with-Databricks/Solutions/04 - Databricks in Production/ADE 4.02 - Error Prone.py | 2,715 | Python |
from electrum_blk.i18n import _
fullname = 'Ledger Wallet'
description = 'Provides support for Ledger hardware wallet'
requires = [('btchip', 'github.com/ledgerhq/btchip-python')]
registers_keystore = ('hardware', 'ledger', _("Ledger wallet"))
available_for = ['qt', 'cmdline']
| 34.875 | 63 | 0.738351 | [
"MIT"
] | CoinBlack/electrum | electrum_blk/plugins/ledger/__init__.py | 279 | 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... | 55.048023 | 3,065 | 0.696721 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/python/pulumi_azure_native/network/v20190901/private_endpoint.py | 19,487 | Python |
"""
Time complexity: O(n^2)
This sorting algorithm puts the smallest element in the first
place after the first iteration. Similarly, after the second
iteration, the second smallest value becomes the second value
of the list. The process continues and eventually the list
becomes sorted.
"""
for i in range(n):
for ... | 26.8 | 61 | 0.706468 | [
"MIT"
] | safiulanik/useful-code-snippets | sorting-algorithms/selection_sort.py | 402 | Python |
from .sorter import Sorter
from .comparator import compare_date, compare_num, compare_str
from .parser import parser_list, parser_delimiter, parser_regex
| 38.5 | 63 | 0.850649 | [
"MIT"
] | aarteagamel/python-utils | devoutils/sorter/__init__.py | 154 | Python |
# -*- coding: utf-8 -*-
from django.conf import settings
VAPID_PUBLIC_KEY = getattr(settings, 'DJANGO_INFOPUSH_VAPID_PUBLIC_KEY', '')
VAPID_PRIVATE_KEY = getattr(settings, 'DJANGO_INFOPUSH_VAPID_PRIVATE_KEY', '')
VAPID_ADMIN_EMAIL = getattr(settings, 'DJANGO_INFOPUSH_VAPID_ADMIN_EMAIL', '')
FCM_SERVER_KEY = getattr(s... | 55.468085 | 130 | 0.801304 | [
"MIT"
] | kilgoretrout1985/django_infopush | push/settings.py | 2,607 | Python |
from django.contrib.auth import get_user_model
from django.contrib.auth.password_validation import validate_password
from rest_framework import serializers
class SignupSerializer(serializers.ModelSerializer):
class Meta:
model = get_user_model()
fields = ['username', 'first_name', 'last_name', 'em... | 29.125 | 79 | 0.67382 | [
"MIT"
] | Sarwar242/crud_templete_django | authentication/serializers.py | 699 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.