text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
# coding=utf-8
"""
Bridges calls made inside of a Python environment to the Cmd2 host app
while maintaining a reasonable degree of isolation between the two.
"""
import sys
from contextlib import (
redirect_stderr,
redirect_stdout,
)
from typing import (
IO,
TYPE_CHECKING,
Any,
List,
NamedT... | python-cmd2/cmd2 | cmd2/py_bridge.py | Python | mit | 4,605 | 0.001303 |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
class TransposicionGrupo(object):
"""
"""
def __init__(self, cadena=None, clave=None):
self.cadena = cadena #Recibe una lista, la longitud de cada elemento es a longitud de la clave
self.clave = clave
self.textoClaro = ""
self.textoCifrado = ""
self.caracterR... | pordnajela/AlgoritmosCriptografiaClasica | Transposicion/TransposicionGrupo.py | Python | apache-2.0 | 3,845 | 0.036468 |
import ctypes
from . import cmarkgfm
from ..util.TypedTree import TypedTree
cmarkgfm.document_to_html.restype = ctypes.POINTER(ctypes.c_char)
class CmarkDocument(object):
def __init__(self, txt, encoding='utf_8'):
if not isinstance(txt, bytes):
txt = txt.encode(encoding=encoding)
sel... | daryl314/markdown-browser | pycmark/cmarkgfm/CmarkDocument.py | Python | mit | 3,664 | 0.002729 |
#!/usr/bin/python
# =======================================================================
# This file is part of MCLRE.
#
# MCLRE 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 3 of the Lice... | augustoqm/MCLRE | src/recommender_execution/run_rec_mrbpr.py | Python | gpl-3.0 | 5,871 | 0.002044 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from tipi.compat import unicode
from tipi.html import HTMLFragment
__all__ = ('Replacement', 'replace')
class Replacement(object):
"""Replacement representation."""
skipped_tags = (
'code', 'kbd', 'pre', 'samp', 'script', 'style', 't... | honzajavorek/tipi | tipi/repl.py | Python | mit | 2,146 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/sql/azure-mgmt-sql/azure/mgmt/sql/operations/_recoverable_databases_operations.py | Python | mit | 10,559 | 0.004072 |
import pytest
@pytest.mark.parametrize("text", ["ca.", "m.a.o.", "Jan.", "Dec.", "kr.", "jf."])
def test_da_tokenizer_handles_abbr(da_tokenizer, text):
tokens = da_tokenizer(text)
assert len(tokens) == 1
@pytest.mark.parametrize("text", ["Jul.", "jul.", "Tor.", "Tors."])
def test_da_tokenizer_handles_ambigu... | explosion/spaCy | spacy/tests/lang/da/test_exceptions.py | Python | mit | 1,824 | 0.000551 |
import _plotly_utils.basevalidators
class LegendrankValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="legendrank", parent_name="scatter", **kwargs):
super(LegendrankValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter/_legendrank.py | Python | mit | 406 | 0.002463 |
#
# 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 us... | chenc10/Spark-PAF | examples/src/main/python/mllib/gradient_boosting_regression_example.py | Python | apache-2.0 | 2,443 | 0.001637 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
# flake8: noqa
from __future__ import unicode_literals
from django.test import TestCase
from unittest import expectedFailure
class SettingTests(TestCase):
@expectedFailure
def test_fails(self):
self.assertTrue(False)
| django-bmf/django-bmf | tests/appapis/test_sites_setting.py | Python | bsd-3-clause | 285 | 0 |
#!/usr/bin/env python
# Copyright 2012 Johns Hopkins University (author: Daniel Povey)
# Generate a topology file. This allows control of the number of states in the
# non-silence HMMs, and in the silence HMMs. This is a modified version of
# 'utils/gen_topo.pl' that generates a different type of topology, one tha... | keighrim/kaldi-yesno-tutorial | steps/nnet3/chain/gen_topo3.py | Python | apache-2.0 | 1,879 | 0.008515 |
import random
class Decision(object):
def __init__(self, name, min_val, max_val):
self.name = name
self.min_val = min_val
self.max_val = max_val
def generate_valid_val(self):
return random.uniform(self.min_val, self.max_val)
def get_range(self):
return (self.min_... | rchakra3/generic-experiment-loop | model/helpers/decision.py | Python | gpl-2.0 | 339 | 0 |
#!/usr/bin/env python
# coding: utf-8
class CheckGear():
def __init__(self):
pass
def proc(self):
print 'test'
| sou-komatsu/checkgear | checkgear/checkgear.py | Python | mit | 138 | 0.007246 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | bgxavier/nova | nova/objects/instance.py | Python | apache-2.0 | 57,332 | 0.000157 |
from datetime import timedelta
import markus
from django.conf import settings
from django.core.management.base import BaseCommand
from django.db.models import Q
from django.utils import timezone
from normandy.recipes.models import Recipe
from normandy.recipes.exports import RemoteSettings
metrics = markus.get_metri... | mozilla/normandy | normandy/recipes/management/commands/update_recipe_signatures.py | Python | mpl-2.0 | 2,612 | 0.001914 |
import platform
def is_windows():
"""Returns true if current platform is windows"""
return any(platform.win32_ver()) | huvermann/MyPiHomeAutomation | HomeAutomation/thingUtils.py | Python | mit | 125 | 0.016 |
import threading
import Queue
import statvent
jobs = Queue.Queue()
done = Queue.Queue()
def do_inc():
while True:
job = jobs.get()
if job is None:
done.put(None)
break
statvent.incr('thread.test')
def test_10k_iterations_in_N_threads_results_in_10k_incrs():
n... | dowski/statvent | tests/test_thread_safety.py | Python | bsd-2-clause | 677 | 0.004431 |
import logging
import colorlog
from logging.config import fileConfig
import json
class mylogger():
def __init__(self, sdict, logfn):
fileConfig('./logging_config.ini', defaults={'logfilename': logfn})
self.logger = logging.getLogger()
self.sdict = sdict
#save or open from json file
... | balbinot/arghphot | arghphot/logutil.py | Python | mit | 652 | 0.010736 |
class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):
if not prices:
return 0
n = len(prices)
m1 = [0] * n
m2 = [0] * n
max_profit1 = 0
min_price1 = prices[0]
max_profit2 = 0
max_price2... | JiaminXuan/leetcode-python | best_time_to_buy_and_sell_stock_iii/solution.py | Python | bsd-2-clause | 846 | 0 |
import sys
import argparse
import numpy as np
def parseArgument():
# Parse the input
parser = argparse.ArgumentParser(description="Process results from LOLA")
parser.add_argument("--lolaResultsFileNameListFileName", required=True, help="List of file names with LOLA results")
parser.add_argument("--lolaHeadersFileN... | imk1/IMKTFBindingCode | processLolaResults.py | Python | mit | 4,260 | 0.026761 |
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Base class for RPC testing
# Add python-bitcoinrpc to module search path:
import os
import sys
sys.path.app... | bankonme/MUE-Src | qa/rpc-tests/test_framework.py | Python | mit | 4,729 | 0.003383 |
"""
Django signals for the app.
"""
import logging
from django.db.models.signals import post_save
from django.conf import settings
from django.contrib.sites.models import Site
from .models import Response, UnitLesson
from .ct_util import get_middle_indexes
from core.common.mongo import c_milestone_orct
from core.com... | cjlee112/socraticqs2 | mysite/ct/signals.py | Python | apache-2.0 | 5,199 | 0.002693 |
from abc import ABCMeta
from recommenders.similarity.weights_similarity_matrix_builder import \
WeightsSimilarityMatrixBuilder
from tripadvisor.fourcity import extractor
from recommenders.base_recommender import BaseRecommender
from utils import dictionary_utils
__author__ = 'fpena'
class MultiCriteriaBaseReco... | melqkiades/yelp | source/python/recommenders/multicriteria/multicriteria_base_recommender.py | Python | lgpl-2.1 | 3,524 | 0.001703 |
from django.apps import AppConfig
class MineralsConfig(AppConfig):
name = 'minerals'
| squadran2003/filtering-searching-mineral-catalogue | filtering-searching-mineral-catalogue/minerals/apps.py | Python | mit | 91 | 0 |
from pycukes import BeforeAll, AfterAll, BeforeEach, AfterEach
@BeforeAll
def add_message1_attr(context):
context.counter = 1
@BeforeEach
def add_message_attr(context):
context.counter += 1
setattr(context, 'message%d' % context.counter, 'msg')
@AfterEach
def increment_one(context):
context.counter... | hltbra/pycukes | specs/console_examples/stories_with_hooks/support/env.py | Python | mit | 392 | 0.005102 |
# -*- coding: utf-8 -*-
"""
jinja2.testsuite.filters
~~~~~~~~~~~~~~~~~~~~~~~~
Tests for the jinja filters.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import unittest
from jinja2.testsuite import JinjaTestCase
from jinja2 import Markup, Environment
fro... | josephlewis42/magpie | magpie/lib/jinja2/testsuite/filters.py | Python | bsd-3-clause | 19,379 | 0.000929 |
# -*- coding: utf-8 -*-
"""
Bit Reading Request/Response messages
--------------------------------------
"""
import struct
from pymodbus3.pdu import ModbusRequest
from pymodbus3.pdu import ModbusResponse
from pymodbus3.pdu import ModbusExceptions
from pymodbus3.utilities import pack_bitstring, unpack_bitstring
clas... | gregorschatz/pymodbus3 | pymodbus3/bit_read_message.py | Python | bsd-3-clause | 8,239 | 0 |
"""SCons.Debug
Code for debugging SCons internal things. Not everything here is
guaranteed to work all the way back to Python 1.5.2, and shouldn't be
needed by most users.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# Permission is hereby granted, free of charge... | kuiche/chromium | third_party/scons/scons-local/SCons/Debug.py | Python | bsd-3-clause | 6,593 | 0.00546 |
# -*- coding: utf-8; -*-
"""
Copyright (C) 2007-2013 Guake authors
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 progra... | mouseratti/guake | guake/main.py | Python | gpl-2.0 | 15,344 | 0.001369 |
# -*- coding: utf-8 -*-
from django import template
from ..utils import su_login_callback
register = template.Library()
@register.inclusion_tag('su/login_link.html', takes_context=False)
def login_su_link(user):
return {'can_su_login': su_login_callback(user)}
| adamcharnock/django-su | django_su/templatetags/su_tags.py | Python | mit | 270 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-19 07:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('photos', '0002_auto_20160919_0737'),
]
operations = [
migrations.CreateMode... | WillWeatherford/mars-rover | photos/migrations/0003_rover.py | Python | mit | 852 | 0.001174 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.stanza.error import Error
from sleekxmpp.stanza.stream_error import StreamError
from sleekxmpp.stanza.iq import Iq
from sleekxmp... | destroy/SleekXMPP-gevent | sleekxmpp/stanza/__init__.py | Python | mit | 399 | 0 |
from __future__ import unicode_literals
import base64
import json
import re
import six
from moto.core.responses import BaseResponse
from .models import kms_backends
from .exceptions import NotFoundException, ValidationException, AlreadyExistsException, NotAuthorizedException
reserved_aliases = [
'alias/aws/ebs',... | whummer/moto | moto/kms/responses.py | Python | apache-2.0 | 14,169 | 0.003882 |
import unittest
from pythoncardx.crypto import Cipher
from pythoncard.security import CryptoException, RSAPublicKey, KeyBuilder, KeyPair
class testCipher(unittest.TestCase):
def testInit(self):
c = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, False)
self.assertEqual(Cipher.ALG_RSA_NOPAD, c.getAlgorith... | benallard/pythoncard | test/testCipher.py | Python | lgpl-3.0 | 3,613 | 0.016883 |
# This file is part of Lerot.
#
# Lerot is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Lerot is distributed in the hope tha... | hubert667/AIR | src/python/ranker/AbstractRankingFunction.py | Python | gpl-3.0 | 2,935 | 0.003407 |
import config, json, cgi, sys, Websheet, re, os
def grade(reference_solution, student_solution, translate_line, websheet, student):
if not re.match(r"^\w+$", websheet.classname):
return ("Internal Error (Compiling)", "Invalid overridden classname <tt>" + websheet.classname + " </tt>")
dump = {
... | dz0/websheets | grade_java.py | Python | agpl-3.0 | 5,860 | 0.014164 |
#!/usr/bin/env python
import re
from livestreamer.plugin import Plugin
from livestreamer.stream import HDSStream
_channel = dict(
at="servustvhd_1@51229",
de="servustvhdde_1@75540"
)
STREAM_INFO_URL = "http://hdiosstv-f.akamaihd.net/z/{channel}/manifest.f4m"
_url_re = re.compile(r"http://(?:www.)?servustv.co... | chrippa/livestreamer | src/livestreamer/plugins/servustv.py | Python | bsd-2-clause | 758 | 0.001319 |
#!/usr/bin/env ambari-python-wrap
'''
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 (th... | arenadata/ambari | ambari-server/src/main/python/ambari_server/BackupRestore.py | Python | apache-2.0 | 6,601 | 0.009998 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2017 Fedele Mantuano (https://www.linkedin.com/in/fmantuano/)
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/... | SpamScope/spamscope | tests/test_phishing.py | Python | apache-2.0 | 4,631 | 0 |
import platform
import pip
from django import get_version
from django.shortcuts import render
def home(request):
"""
renders the deployment server details on the screen.
:param request: The django formatted HttpRequest
:return: renders context c with the demo template.
"""
c = dict(python_ver... | Kesel/django | demo/views.py | Python | mit | 459 | 0.002179 |
from django.template import loader
from regulations.generator.layers.base import InlineLayer
from regulations.generator.section_url import SectionUrl
from regulations.generator.layers import utils
from ..node_types import to_markup_id
class DefinitionsLayer(InlineLayer):
shorthand = 'terms'
data_source = 'te... | 18F/regulations-site | regulations/generator/layers/definitions.py | Python | cc0-1.0 | 1,632 | 0 |
#-*- coding: utf-8 -*-
# Author: Matt Earnshaw <matt@earnshaw.org.uk>
from __future__ import absolute_import
import os
import sys
import sunpy
from PyQt4.QtGui import QApplication
from sunpy.gui.mainwindow import MainWindow
from sunpy.io import UnrecognizedFileTypeError
class Plotman(object):
""" Wraps a MainWin... | jslhs/sunpy | sunpy/gui/__init__.py | Python | bsd-2-clause | 1,811 | 0.005522 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# status_page.py - Copyright (C) 2012 Red Hat, Inc.
# Written by Fabian Deutsch <fabiand@redhat.com>
#
# 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;... | sdoumbouya/ovirt-node | src/ovirt/node/setup/core/status_page.py | Python | gpl-2.0 | 8,877 | 0.000113 |
"""
CeilometerConf - file ``/etc/ceilometer/ceilometer.conf``
=========================================================
The ``/etc/ceilometer/ceilometer.conf`` file is in a standard '.ini' format,
and this parser uses the IniConfigFile base class to read this.
Given a file containing the following test data::
[D... | wcmitchell/insights-core | insights/parsers/ceilometer_conf.py | Python | apache-2.0 | 1,890 | 0.000529 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
""" Generator for C++ style thunks """
import glob
import os
import re
import sys
from idl_log import ErrOut, InfoOut, WarnOut
fr... | timopulkkinen/BubbleFish | ppapi/generators/idl_thunk.py | Python | bsd-3-clause | 16,821 | 0.009036 |
# Copyright 2016 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 a... | google/grumpy | lib/itertools_test.py | Python | apache-2.0 | 5,660 | 0.011131 |
#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
from downloadCommon import DownloadCommon, getSeqName
from DdlCommonInterface import DdlCommonInterface
import re
class FbDownloader(DownloadCommon):
def __init__(self):
self.strDbms = 'firebird'
def connect(self, info):
try:
... | BackupTheBerlios/xml2ddl-svn | xml2ddl/FirebirdInterface.py | Python | gpl-2.0 | 15,609 | 0.010635 |
from django.contrib import admin
from .models import (
Image, NutritionalDataDish, NutritionalDataGuess, Dish, Guess)
class ImageInline(admin.StackedInline):
model = Image
class NutritionalDataDishInline(admin.StackedInline):
model = NutritionalDataDish
class DishAdmin(admin.ModelAdmin):
list_dis... | grigoryk/calory-game-server | dishes/admin.py | Python | gpl-2.0 | 727 | 0 |
import numpy as np
import numpy.ma as ma
from numpy import linalg as LA
import matplotlib.pyplot as plt
import itertools
import collections
from scipy import stats
def acf(x, lags=500, exclude=None):
if exclude is None:
exclude = np.zeros(x.shape)
exclude = np.cumsum(exclude.astype(int))
# from s... | stephenhelms/WormTracker | python/tsstats.py | Python | apache-2.0 | 8,100 | 0.006667 |
import os
import matplotlib.pyplot as plt
def plot_hist(history, model_name=None):
plt.plot(history['loss'], linewidth=3, label='train')
plt.plot(history['val_loss'], linewidth=3, label='valid')
plt.grid()
plt.legend()
plt.xlabel('epoch')
plt.ylabel('loss')
plt.ylim(1e-4, 1e-2)
plt.yscale('log')
if ... | nipe0324/kaggle-keypoints-detection-keras | plotter.py | Python | apache-2.0 | 1,057 | 0.02176 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Defines several helpers to add rules to Iptables
"""
from configparser import SectionProxy
from contextlib import suppress
from ipaddress import ip_address, ip_network
import re
import socket
from pyptables.iptables import Iptables, Ip6tables, IptablesRule
__author... | BenjaminSchubert/Pyptables | pyptables/executors.py | Python | mit | 6,181 | 0.00178 |
#!/usr/bin/env python
import unittest
from app.md5py import MD5
class TddInPythonExample(unittest.TestCase):
def test_object_program(self):
m = MD5()
m.update("1234")
hexdigest = m.hexdigest()
self.assertEqual("81dc9bdb52d04dc20036dbd8313ed055", hexdigest)
if __name__ == ... | davidam/python-examples | security/md5/test/test_md5py.py | Python | gpl-3.0 | 352 | 0.008523 |
class ListResource(object):
def __init__(self, version):
"""
:param Version version:
"""
self._version = version
""" :type: Version """
| tysonholub/twilio-python | twilio/base/list_resource.py | Python | mit | 180 | 0 |
"""
maxminddb.decoder
~~~~~~~~~~~~~~~~~
This package contains code for decoding the MaxMind DB data section.
"""
from __future__ import unicode_literals
import struct
from maxminddb.compat import byte_from_int, int_from_bytes
from maxminddb.errors import InvalidDatabaseError
class Decoder(object): # pylint: disa... | kikinteractive/MaxMind-DB-Reader-python | maxminddb/decoder.py | Python | apache-2.0 | 5,904 | 0 |
"""Test suite for abdt_branch."""
# =============================================================================
# TEST PLAN
# -----------------------------------------------------------------------------
# Here we detail the things we are concerned to test and specify which tests
# c... | cs-shadow/phabricator-tools | py/abd/abdt_branch__t.py | Python | apache-2.0 | 10,066 | 0 |
#! /usr/bin/python
# Derived from dupinator.py.
#
# This program takes a list of pathnames to audio files and moves them to a central archive.
# It replaces the original with a symbolic link to the archived version.
# The archived version will have several names (all hard-linked): the MD5 hash (with the extension)
# a... | jemenake/LogicProjectTools | AudioArchiver.py | Python | mit | 5,075 | 0.021084 |
# Copyright (c) 2008-2016 VMware, 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 applicabl... | wknet123/harbor | tools/migration/migration_harbor/versions/0_4_0.py | Python | apache-2.0 | 2,016 | 0.008433 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import nowdate, cstr, flt, now, getdate, add_months
from frappe import throw, _
from frappe.utils import formatdate
imp... | gmarke/erpnext | erpnext/accounts/utils.py | Python | agpl-3.0 | 16,635 | 0.025008 |
# -*- coding: utf-8 -*-
#
# This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for
# more information about the licensing of this file.
""" Course page """
import web
from inginious.frontend.pages.utils import INGIniousPage
class CoursePage(INGIniousPage):
""" Course page """
def get_... | JuezUN/INGInious | inginious/frontend/pages/course.py | Python | agpl-3.0 | 4,665 | 0.00493 |
import discord
import os.path
import json
from discord.ext import commands
class Character():
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context = True)
async def char (self, ctx):
"""Character Creation. Asks for all information then builds Json file."""
... | padilin/Discord-RPG-Bot | character.py | Python | mit | 2,055 | 0.008273 |
# coding=utf-8
#
# Copyright 2016 F5 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 a... | F5Networks/f5-common-python | f5/bigip/tm/net/tunnels.py | Python | apache-2.0 | 3,153 | 0 |
# -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2009 Rene Liebscher
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later ver... | arruda/pyfuzzy | fuzzy/set/ZFunction.py | Python | lgpl-3.0 | 1,985 | 0.009068 |
# -*- coding: utf-8 -*-
import urllib
from . import admin
from flask import request
from flask import url_for
from flask import redirect
from flask import render_template
from flask_login import UserMixin
from flask_login import login_user
from flask_login import logout_user
from flask_login import login_required
from... | moxuanchen/BMS | core/views/admin/login.py | Python | apache-2.0 | 1,670 | 0.000599 |
#!/usr/bin/python3
import machine
from update_display import update_display as update_display_function
config = {
"gateway": {
# "type": "electrodragon-wifi-iot-relay-board-spdt-based-esp8266"
"id": "thermostat"
# "description": "Thermostat Control near Kitchen"
},
"devices": [
{
"type": "Di... | Morteo/kiot | devices/thermostat/config.py | Python | mit | 1,329 | 0.009782 |
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2020, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
import re
import time
import math
import threading
try:
from multiprocessing.pool import ThreadPool
except... | xArm-Developer/xArm-Python-SDK | xarm/x3/base.py | Python | bsd-3-clause | 102,034 | 0.002388 |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="violin", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_... | plotly/python-api | packages/python/plotly/plotly/validators/violin/_width.py | Python | mit | 472 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==============================================================================
# author :Ghislain Vieilledent
# email :ghislain.vieilledent@cirad.fr, ghislainv@gmail.com
# web :https://ecology.ghislainv.fr
# python_version :>=2.7
# license... | ghislainv/deforestprob | test/test_get_started.py | Python | gpl-3.0 | 9,570 | 0 |
# -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
salt.utils.validate.path
~~~~~~~~~~~~~~~~~~~~~~~~
Several path related validators
''... | MadeiraCloud/salt | sources/salt/utils/validate/path.py | Python | apache-2.0 | 1,466 | 0 |
# Copyright (C) 2017 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | Debian/openjfx | modules/web/src/main/native/Tools/Scripts/webkitpy/tool/steps/checkpatchrelevance.py | Python | gpl-2.0 | 2,708 | 0 |
# Copyright 2017 Vector Creations Ltd
#
# 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 ... | matrix-org/synapse | synapse/handlers/read_marker.py | Python | apache-2.0 | 2,249 | 0.001334 |
from model_mommy import mommy
from django.test import TestCase
from ..models import Department, Employee
class DepartmentTestMommy(TestCase):
"""Department's modle test case."""
def test_department_creation_mommy(self):
"""Test create department's model."""
new_department = mommy.make('employ... | maurobaraldi/ll_interview_application | luizalabs/employees/tests/tests_models.py | Python | gpl-3.0 | 866 | 0.001155 |
import datetime
import mock
from django.utils import timezone
from mock import Mock, call, PropertyMock
from django.test import TestCase
from django.contrib.sessions.models import Session
from mysite.celery import send_outcome, check_anonymous
class CeleryTasksTest(TestCase):
@mock.patch('mysite.celery.UserSess... | raccoongang/socraticqs2 | mysite/mysite/tests/celery.py | Python | apache-2.0 | 2,987 | 0.002343 |
#
# Copyright (c) 2009-2019 Tom Keffer <tkeffer@gmail.com> and
# Gary Roderick
#
# See the file LICENSE.txt for your full rights.
#
"""Module to interact with Cumulus monthly log files and import raw
observational data for use with weeimport.
"""
from __future__ import with_statement
f... | weewx/weewx | bin/weeimport/cumulusimport.py | Python | gpl-3.0 | 20,404 | 0.000784 |
__author__ = 'joseph'
import statistics
import numpy as np
class AccelData(object):
def __init__(self,Accel):
#Static accelerometer data
self.Accel = Accel
def applyCalib(self,params,Accel):
ax = params['ax']
ay = params['ay']
az = params['az']
scaling_Matrix ... | jchrismer/PiQuad | Calibration/Inertial_Calibration.py | Python | gpl-3.0 | 9,316 | 0.012988 |
from sympy import (
Symbol, gamma, I, oo, nan, zoo, factorial, sqrt, Rational, log,
polygamma, EulerGamma, pi, uppergamma, S, expand_func, loggamma, sin,
cos, O, cancel, lowergamma, exp, erf, beta, exp_polar, harmonic, zeta,
factorial)
from sympy.core.function import ArgumentIndexError
from sympy.utilit... | lidavidm/mathics-heroku | venv/lib/python2.7/site-packages/sympy/functions/special/tests/test_gamma_functions.py | Python | gpl-3.0 | 12,392 | 0.000484 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/lok/shared_mining_cave_01.iff"
result.attribute_template_id = -1
r... | obi-two/Rebelion | data/scripts/templates/object/building/lok/shared_mining_cave_01.py | Python | mit | 440 | 0.047727 |
# -*- coding: utf-8 -*-
"""
2020-09-07 Cornelius Kölbel <cornelius.koelbel@netknights.it>
Add exception
2017-04-26 Friedrich Weber <friedrich.weber@netknights.it>
Make it possible to check for correct LDAPS/STARTTLS settings
2017-01-08 Cornelius Kölbel <cornelius.koelbel@netknights.it>
... | privacyidea/privacyidea | tests/ldap3mock.py | Python | agpl-3.0 | 28,972 | 0.002106 |
import os, random, struct, sys
from Crypto.Cipher import AES
import getpass
from optparse import OptionParser
import hashlib
parser = OptionParser()
parser.add_option("-p")
(options, args) = parser.parse_args()
if(len(sys.argv) < 2):
print "usage: python aes_cmdl.py input_file_name <output_file_name> -p <pa... | Bergurth/aes_cmdl.py | aes_cmdl.py | Python | gpl-3.0 | 2,518 | 0.004369 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ccx', '0026_auto_20170831_0420'),
('ccx', '0026_auto_20170831_0554'),
]
operations = [
]
| mbareta/edx-platform-ft | lms/djangoapps/ccx/migrations/0027_merge.py | Python | agpl-3.0 | 289 | 0 |
# File: htmllib-example-1.py
import htmllib
import formatter
import string
class Parser(htmllib.HTMLParser):
# return a dictionary mapping anchor texts to lists
# of associated hyperlinks
def __init__(self, verbose=0):
self.anchors = {}
f = formatter.NullFormatter()
htmllib.HTMLPa... | gregpuzzles1/Sandbox | htmllib-example-1.py | Python | gpl-3.0 | 812 | 0.002463 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'GeoImage.name'
db.delete_column('lizard_damage_geoimage', 'name')
# Adding fiel... | lizardsystem/lizard-damage | lizard_damage/migrations/0004_auto__del_field_geoimage_name__add_field_damageevent_landuse_slugs__ad.py | Python | gpl-3.0 | 10,066 | 0.007451 |
# encoding: utf-8
# module PyKDE4.kdecore
# from /usr/lib/python3/dist-packages/PyKDE4/kdecore.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtNetwork as __PyQt4_QtNetwork
from .KTimeZone import KTimeZone
class KTzfileTimeZone(KTimeZone):
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyKDE4/kdecore/KTzfileTimeZone.py | Python | gpl-2.0 | 414 | 0.009662 |
# coding=utf-8
"""Auto pull request pep8 plugin"""
import subprocess
from git import Repo
from . import MASTER_BRANCH
from .base import AutoPullRequestPluginInterface, section_order
from ..nodes import NumberedList, DescriptionNode, CodeNode, NodeList, HeaderNode
class Pep8Plugin(AutoPullRequestPluginInterface):
... | gxx/auto_pull_request | auto_pull_request/plugins/pep8_info.py | Python | gpl-2.0 | 1,315 | 0.001521 |
from __future__ import print_function
from __future__ import division
import numpy as np
import torch
class GPRRFA:
"""Random Feature Approximation for Gaussian Process Regression
Estimation and prediction of Bayesian linear regression models
Basic usage::
R = GPRRFA()
hyp = R.estimate(... | amarquand/nispat | pcntoolkit/model/rfa.py | Python | gpl-3.0 | 7,985 | 0.007013 |
# -*- coding: utf-8 -*-
from django.http import HttpResponse, HttpRequest, QueryDict, HttpResponseRedirect
import json
import conekta
from store.models import *
from store.forms import *
### PETICIONES API PARA EL CARRITO
def delBasket(request):
id = str(request.GET.get('id'))
if request.GET.ge... | zeickan/Django-Store | store/api.py | Python | apache-2.0 | 3,203 | 0.029044 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | larsbutler/swift | swift/container/replicator.py | Python | apache-2.0 | 12,083 | 0 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.desk.notifications import delete_notification_count_for
from frappe.core.doctype.user.user import STANDARD_USERS
from frappe.utils.u... | vCentre/vFRP-6233 | frappe/desk/page/messages/messages.py | Python | mit | 3,886 | 0.024447 |
import re
import sublime
import sublime_plugin
from ..show_error import show_error
from ..settings import pc_settings_filename
class AddChannelCommand(sublime_plugin.WindowCommand):
"""
A command to add a new channel (list of repositories) to the user's machine
"""
def run(self):
self.windo... | koery/win-sublime | Data/Packages/Package Control/package_control/commands/add_channel_command.py | Python | mit | 1,328 | 0.003012 |
# Copyright 2017 The Abseil 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 ... | ryfeus/lambda-packs | Keras_tensorflow_nightly/source2.7/absl/logging/__init__.py | Python | mit | 35,420 | 0.007143 |
"""Test queues inspection SB APIs."""
from __future__ import print_function
import unittest2
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestQueues(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUn... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/macosx/queues/TestQueues.py | Python | bsd-3-clause | 17,019 | 0.001351 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import os
from devpi_common.request import new_requests_session
from devpi_slack import __version__
def devpiserver_indexconfig_defaults():
return {"slack_icon": None, "slack_hook": None, "slack_user": None}
def devpiserver_on_upload... | innoteq/devpi-slack | devpi_slack/main.py | Python | bsd-3-clause | 1,761 | 0 |
########################################################################
# $Header: /var/local/cvsroot/4Suite/Ft/Lib/Terminal.py,v 1.6.4.1 2006/09/18 17:05:25 jkloth Exp $
"""
Provides some of the information from the terminfo database.
Copyright 2005 Fourthought, Inc. (USA).
Detailed license and copyright information... | Pikecillo/genna | external/4Suite-XML-1.0.2/Ft/Lib/Terminal.py | Python | gpl-2.0 | 11,043 | 0.002083 |
# Copyright 2015 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... | annarev/tensorflow | tensorflow/python/keras/regularizers.py | Python | apache-2.0 | 12,860 | 0.003421 |
#!/usr/bin/python2
import check
from fractions import gcd
# Algorithm taken from en.wikipedia.org/wiki/Line-line-_intersection
# All code written by Joel Williamson
## intersection: Int Int Int Int Int Int Int Int -> (union "parallel" (tuple Int Int Int Int))
##
## Purpose: Treating the input as 4 pairs of integers,... | joelwilliamson/cs234 | a1/a01q2b.py | Python | gpl-2.0 | 3,280 | 0.051829 |
# Copyright (c) "Neo4j"
# Neo4j Sweden AB [http://neo4j.com]
#
# This file is part of Neo4j.
#
# 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... | neo4j/neo4j-python-driver | tests/integration/examples/test_config_unencrypted_example.py | Python | apache-2.0 | 1,486 | 0.000673 |
#!/usr/bin/python
# coding: utf8
from __future__ import absolute_import
from geocoder.osm import Osm
from geocoder.w3w import W3W
from geocoder.bing import Bing
from geocoder.here import Here
from geocoder.yahoo import Yahoo
from geocoder.baidu import Baidu
from geocoder.tomtom import Tomtom
from geocoder.arcgis impo... | miraculixx/geocoder | geocoder/api.py | Python | mit | 11,482 | 0 |
# 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... | tebeka/arrow | python/examples/plasma/sorting/sort_df.py | Python | apache-2.0 | 6,843 | 0 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals, print_function
import abc
import re
import os
import glob
import shutil
import warnings
from itertools import chain
from copy import deepcopy
import six
impo... | tallakahath/pymatgen | pymatgen/io/vasp/sets.py | Python | mit | 58,824 | 0.000357 |
# Copyright 2016 Cisco Systems, 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 o... | Tehsmash/networking-cisco | networking_cisco/db/migration/alembic_migrations/versions/mitaka/expand/b29f1026b281_add_support_for_ucsm_vnic_templates.py | Python | apache-2.0 | 1,374 | 0.002183 |
import subprocess
import time
import sys
import re
class checkIfUp:
__shellPings = []
__shell2Nbst = []
__ipsToCheck = []
checkedIps = 0
onlineIps = 0
unreachable = 0
timedOut = 0
upIpsAddress = []
computerName = []
completeMacAddress = []
executionTime = 0
... | mixedup4x4/Speedy | Contents/LanScan.py | Python | gpl-3.0 | 7,956 | 0.007793 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.