code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# main game file for Python on Rails
import copy
from collections import defaultdict
import pyglet
import settings
import menu
import gamelevel
import sounds
import music
import cutscene
import highscores
# all scenes need to implement a start method and a stop method
class Game(object):
def __init__(self):
... | rozifus/TeamStrong13_4 | por/main.py | Python | mit | 2,861 |
import numpy as np
import numpy.core.multiarray as ma
encoding = 'utf8'
unicode_errors = 'strict'
import scipy.spatial.distance as dist
totalcount = 0
alignedcount = 0
from math import *
def square_rooted(x):
return round(sqrt(sum([a * a for a in x])), 3)
def cosine_similarity(x, y):
numerator = sum(a * b ... | eabdullin/nlp_mthesis | wordvectormix.py | Python | mit | 2,152 |
#!/usr/bin/python
# requirements
from SSAPLib import *
from termcolor import *
from lib.Subreq import *
from smart_m3.m3_kp import *
from xml.sax import make_parser
##############################################################
#
# REQUESTS
#
##############################################################
# REGISTER... | desmovalvo/virtualsib | virtualiser/lib/treplies.py | Python | lgpl-3.0 | 30,776 |
"""Translation helper functions."""
from __future__ import unicode_literals
import locale
import os
import re
import sys
import gettext as gettext_module
from threading import local
from django.utils.importlib import import_module
from django.utils.encoding import force_str, force_text
from django.utils._os import up... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/django-1.5/django/utils/translation/trans_real.py | Python | bsd-3-clause | 22,827 |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 28 14:19:26 2013
Author: Josef Perktold
"""
import numpy as np
from scipy import stats
from statsmodels.base.model import GenericLikelihoodModel
from numpy.testing import assert_array_less, assert_almost_equal, assert_allclose
class MyPareto(GenericLikelihoodModel):
... | hlin117/statsmodels | statsmodels/miscmodels/tests/test_generic_mle.py | Python | bsd-3-clause | 4,473 |
import unittest
import numpy
from world import World
from brain import Brain
from bot import Bot
class QueueBrain(Brain):
def __init__(self, name, ninputs, nactions):
super().__init__(name, ninputs, nactions)
self.actlam = lambda _: 'still'
self.repeat = True
def think(self, inputs):... | Renmusxd/RSwarm | tests/attack_unittest.py | Python | mit | 1,559 |
""" Skeleton for an elemental transformation of the signal
This includes some exception and metaclass handling, but the most important part
is the :class:`~pySPACE.missions.nodes.base_node.BaseNode`.
.. note::
This module includes a reimplementation of the MDP node class that
is better suited for the purposes... | Crespo911/pyspace | pySPACE/missions/nodes/base_node.py | Python | gpl-3.0 | 69,059 |
# -*- coding: utf-8 -*-
from django.db import models
from django_orm.core.sql import SqlFunction
"""
Functions for varchar and text fields.
"""
class Unaccent(SqlFunction):
sql_function = 'unaccent'
class BitLength(SqlFunction):
sql_function = "bit_length"
| cr8ivecodesmith/django-orm-extensions-save22 | django_orm/postgresql/functions.py | Python | bsd-3-clause | 272 |
#!/usr/bin/env python
from general import fastaToList
from sys import argv
from collections import defaultdict
import itertools
def getPossibilities(k = 4):
kmer_counts = defaultdict(lambda: 0)
for i in itertools.product("ATGC", repeat = k):
kmer_counts["".join(i)]
return kmer_counts
if __n... | Jorisvansteenbrugge/advbioinf | rosalind/python/kmer.py | Python | gpl-3.0 | 696 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Helpful routines for regression testing."""
from base64 import b64encode
from binascii import hexlify,... | merelcoin/merelcoin | test/functional/test_framework/util.py | Python | mit | 22,133 |
Experiment(description='First attempt at Trend-Cyclical-Irregular extrapolation experiment',
data_dir='../data/tsdlr_9010/',
max_depth=10,
random_order=False,
k=1,
debug=False,
local_computation=False,
n_rand=9,
sd=2,
... | codeaudit/gpss-research | experiments/2013-11-11-extrap-TCI.py | Python | mit | 1,065 |
# -*- coding: utf-8 -*-
#
# © 2014 Ian Eure
# Author: Ian Eure <ian.eure@gmail.com>
#
"""Data I/O serial interface."""
import array
import logging
import serial
import sys
import time
from . import format
from yar.cksum import *
import yar.io as io
EOL = "\r"
# Error handling
ERRS = ((2**31, "Error:"),
(... | ieure/yar | yar/control.py | Python | bsd-3-clause | 10,128 |
{
'name' : 'Store product images in filestore',
'version' : '1.0.0',
'author' : 'Ivan Yelizariev',
'category' : 'Custom',
'website' : 'https://yelizariev.github.io',
'summary': 'Check WARNING before installing \ uninstalling!',
'depends' : ['product'],
'data':[],
'installable': True
... | litnimax/addons-yelizariev | product_image_filestore/__openerp__.py | Python | lgpl-3.0 | 322 |
from pdf2txt import pdfTotxt1, pdfTotxt2
import os
def AllPdftoTxt(stock_dir, dir, root_txt_path):
'''
function: translate all pdf file to txt file in stock_dir directory
stock_dir:the stock number list
dir: the root directory of all reports
root_txt_path: the target directory where the result txt... | FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code | luowang/Data_Processing/AllPdfToTxt.py | Python | apache-2.0 | 2,612 |
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
Tests for the Flocker REST API client.
"""
from uuid import uuid4
from bitmath import GiB
from zope.interface.verify import verifyObject
from pyrsistent import pmap
from eliot import ActionType
from eliot.testing import capture_logging, assertHasAction... | agonzalezro/flocker | flocker/apiclient/test/test_client.py | Python | apache-2.0 | 19,377 |
# Copyright 2013 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 agre... | citrix-openstack-build/oslo.reports | oslo_reports/views/xml/generic.py | Python | apache-2.0 | 3,190 |
from theano import tensor
from theano.tensor.nnet import conv2d
def weights_std(weights, mask_outputs=None):
positions = tensor.arange(weights.shape[2])
expected = (weights * positions).sum(axis=2)
expected2 = (weights * positions ** 2).sum(axis=2)
result = (expected2 - expected ** 2) ** 0.5
if mas... | rizar/attention-lvcsr | lvsr/expressions.py | Python | mit | 2,325 |
# Copyright (C) 2105 wysiwyng
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is d... | wysiwyng/sr14 | mai_sr14/debug.py | Python | gpl-3.0 | 1,130 |
########################################################################
#
# File: compiler_table.py
# Author: Mark Mitchell
# Date: 04/16/2003
#
# Contents:
# CompilerTable
#
# Copyright (c) 2003 by CodeSourcery, LLC. All rights reserved.
#
######################################################################... | stefanseefeld/qmtest | qm/test/classes/compiler_table.py | Python | gpl-2.0 | 5,243 |
# Copyright (C) 2020 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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 License, or
# (at your option) any later version.
#
# ycmd... | vheon/ycmd | ycmd/tests/go/server_management_test.py | Python | gpl-3.0 | 4,464 |
import oscar.apps.shipping.apps as apps
class ShippingConfig(apps.ShippingConfig):
name = 'apps.shipping'
| lpakula/django-oscar-paypal | sandbox/apps/shipping/apps.py | Python | bsd-3-clause | 112 |
# ELBE - Debian Based Embedded Rootfilesystem Builder
# Copyright (c) 2019 Olivier Dion <dion@linutronix.de>
#
# SPDX-License-Identifier: GPL-3.0-or-later
import os
from elbepack.debianize.panels.uboot import UBoot
from elbepack.debianize.panels.kernel import Kernel
from elbepack.debianize.panels.barebox import Bare... | Linutronix/elbe | elbepack/debianize/panels/factory.py | Python | gpl-3.0 | 633 |
#!/usr/bin/env python
"""
Copyright (C) 2012 by Adam Ewing (adam.ewing@gmail.com)
Released under the MIT license, see LICENSE.txt
configtest.py checks required configuration options and files
"""
import ConfigParser
import sys
import os
def checkfile(file):
try:
open(file)
return True
ex... | adamewing/GRIPper | lib/configtest.py | Python | mit | 1,660 |
import re, string
from nltk import word_tokenize, pos_tag
from nltk.corpus import stopwords
_en_stops = stopwords.words(fileids='english')
_r_punctuation = re.compile(r"[^ \w]")
##################
## Query frames ##
##################
_r_queries = {
"decision_past_have":
re.compile(r"^have you (.+)$",fla... | spacenut/chatbots | query.py | Python | gpl-2.0 | 1,142 |
from .Separator import *
from .DockWidget import *
__all__ = ["Separator", "DockWidget"]
| pkkm/image-sorter | src/MyQt/__init__.py | Python | gpl-3.0 | 90 |
# coding: utf-8
"""
EVE Swagger Interface
An OpenAPI for EVE Online
OpenAPI spec version: 0.4.6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class GetCorporationsCorporationIdStructuresForbidden(object):
... | minlexx/pyevemon | esi_client/models/get_corporations_corporation_id_structures_forbidden.py | Python | gpl-3.0 | 3,125 |
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business involves the administration of students, teachers,
# courses, progr... | uclouvain/OSIS-Louvain | education_group/tests/factories/first_year_bachelor.py | Python | agpl-3.0 | 1,787 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | beernarrd/gramps | gramps/gen/filters/rules/media/__init__.py | Python | gpl-2.0 | 1,805 |
# -*- coding: utf-8 -*-
"""Test for LTI Xmodule functional logic."""
from mock import Mock, patch, PropertyMock
import textwrap
from lxml import etree
from webob.request import Request
from copy import copy
import urllib
from xmodule.lti_module import LTIDescriptor
from xmodule.lti_2_util import LTIError
from . imp... | olexiim/edx-platform | common/lib/xmodule/xmodule/tests/test_lti_unit.py | Python | agpl-3.0 | 21,109 |
from __future__ import division
from behave import *
import json
import nose.tools
import numpy
import toyplot.color
import toyplot.testing
@given(u'a broadcast color {value}')
def step_impl(context, value):
context.color = eval(value)
@given(u'a broadcast shape {value}')
def step_impl(context, value):
con... | cmorgan/toyplot | features/steps/color.py | Python | bsd-3-clause | 14,708 |
import inspect
import importlib
from abc import ABCMeta, abstractmethod
from six import add_metaclass
@add_metaclass(ABCMeta)
class BaseForsetiCommand(object):
@abstractmethod
def run(self, configuration, cli_arguments):
raise NotImplementedError
@abstractmethod
def cli_command_name(self):
... | ticketea/forseti | forseti/commands/base.py | Python | isc | 897 |
# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware imp... | liangwang/m5 | src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py | Python | bsd-3-clause | 2,420 |
from bs4 import BeautifulSoup
from django.test import TestCase
from wagtail.documents.rich_text import (
DocumentLinkHandler as FrontendDocumentLinkHandler,
)
from wagtail.documents.rich_text.editor_html import (
DocumentLinkHandler as EditorHtmlDocumentLinkHandler,
)
class TestEditorHtmlDocumentLinkHandler(... | wagtail/wagtail | wagtail/documents/tests/test_rich_text.py | Python | bsd-3-clause | 1,972 |
#!/usr/bin/env python
'''
This uses both posture and orientation control to make Dreamer shake hands.
'''
import sys, getopt # for getting and parsing command line arguments
import time
import math
import threading
import rospy
from std_msgs.msg import Float64, Float64MultiArray, MultiArrayDimension, Bool, Int32... | liangfok/controlit_demos | dreamer_controlit_demos/nodes/Demo5_HandShake.py | Python | lgpl-2.1 | 17,279 |
#!/usr/bin/env python3
#
# Copyright (C) 2016-2019 Dmitry Marakasov <amdmi3@amdmi3.ru>
#
# This file is part of repology
#
# repology 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 Lic... | AMDmi3/repology | repology-update.py | Python | gpl-3.0 | 15,849 |
# coding=utf-8
import datetime
import logging
from django.db import models
from django.db.models import Count, Case, When, F
from news.utils.nltkutils import get_nltk_stop_words
__author__ = 'ilov3'
logger = logging.getLogger(__name__)
class TagQuerySet(models.QuerySet):
def tracked(self):
return self.... | kwameboame/newsdex | news/models/nltk.py | Python | bsd-2-clause | 3,036 |
# -*- coding:utf-8 -*-
import json
from owlmixin import OwlMixin, TList
from jumeaux.addons.dump import DumpExecutor
from jumeaux.models import DumpAddOnPayload
class Config(OwlMixin):
default_encoding: str = 'utf8'
force: bool = False
class Executor(DumpExecutor):
def __init__(self, config: dict):
... | tadashi-aikawa/gemini | jumeaux/addons/dump/json.py | Python | mit | 987 |
import os
from configurations.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "morgoth.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Production")
application = DjangoWhiteNoise(get_wsgi_application())
| rehandalal/morgoth | morgoth/wsgi.py | Python | mpl-2.0 | 296 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | dennisobrien/bokeh | bokeh/sampledata/tests/test_browsers.py | Python | bsd-3-clause | 2,286 |
from __future__ import print_function
import logging
import os
import sys
from six import MAXSIZE
_LEVEL_STRING = {"DEBUG": 10, "INFO": 20, "WARNING": 30, "ERROR": 40}
_CMT_LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
def log_level_string_to_int(level):
if level.upper() in ["TRUE", "YES"... | csdms/pymt | deprecated/utils/verbose.py | Python | mit | 3,264 |
import pytest
from riotwatcher.Handlers import IllegalArgumentError, SanitationHandler
@pytest.mark.common
@pytest.mark.unit
class TestSanitationHandler:
@pytest.mark.parametrize(
"region", ["na1", "Na1", "aN1", "enue", "americas", "europe", "euw1"]
)
def test_valid_region_passes(self, region):
... | pseudonym117/Riot-Watcher | tests/Handlers/test_SanitationHandler.py | Python | mit | 710 |
"""
Testing Recursive feature elimination
"""
import warnings
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
from nose.tools import assert_equal
from scipy import sparse
from sklearn.feature_selection.rfe import RFE, RFECV
from sklearn.datasets import load_iris
from sklear... | Eric89GXL/scikit-learn | sklearn/feature_selection/tests/test_rfe.py | Python | bsd-3-clause | 3,356 |
"""
Tests for quadsums.py
"""
import numpy as np
from numpy.testing import assert_allclose
from quantecon.quadsums import var_quadratic_sum, m_quadratic_sum
def test_var_simplesum():
beta = .95
A = 1.
C = 0.
H = 1.
x0 = 1.
val = var_quadratic_sum(A, C, H, beta, x0)
assert abs(val-20) < ... | QuantEcon/QuantEcon.py | quantecon/tests/test_quadsum.py | Python | bsd-3-clause | 1,055 |
# Copyright (C) 2017-2018 Red Hat, Inc.
#
# 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 distribut... | rpm-software-management/dnf | dnf/module/module_base.py | Python | gpl-2.0 | 41,537 |
from enigma import eActionMap
class ActionMap:
def __init__(self, contexts = [ ], actions = { }, prio=0):
self.actions = actions
self.contexts = contexts
self.prio = prio
self.p = eActionMap.getInstance()
self.bound = False
self.exec_active = False
self.enabled = True
def setEnabled(self, enabled):
... | fairbird/OpenPLI-BlackHole | lib/python/Components/ActionMap.py | Python | gpl-2.0 | 2,554 |
"""PyTest fixtures and test helpers."""
from unittest import mock
import blebox_uniapi
import pytest
from homeassistant.components.blebox.const import DOMAIN
from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.setup import async_setup_component
from tests.async_mock import AsyncMock, PropertyMoc... | tchellomello/home-assistant | tests/components/blebox/conftest.py | Python | apache-2.0 | 3,402 |
N, M = map(int, input().split())
ans = 1
for i in range(2, int((M + 1) ** 0.5) + 1):
if M % i == 0:
if M / i >= N:
ans = max(ans, i)
if M / (M / i) >= N:
ans = max(ans, M / i)
print(ans)
| taiki-okano/Competitive-Programming | Atcoder/ABC112/Q4.py | Python | mit | 233 |
"""
Module is here for work with GRASS GIS environmental variables and
locations and mapsets
"""
# Author: Jachym Cepicky
# http://les-ejk.cz
# License:
#
# Web Processing Service implementation
# Copyright (C) 2006 Jachym Cepicky
#
# This program is free software; you can redistribute it and/or modify
# it und... | 3liz/qgis-wps4server | filters/PyWPS/pywps/Grass.py | Python | gpl-3.0 | 6,947 |
from ctypes import *
import unittest
class StringBufferTestCase(unittest.TestCase):
def test_buffer(self):
b = create_string_buffer(32)
self.failUnlessEqual(len(b), 32)
self.failUnlessEqual(sizeof(b), 32 * sizeof(c_char))
self.failUnless(type(b[0]) is bytes)
b = create_str... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/ctypes/test/test_buffers.py | Python | mit | 2,696 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('payroll', '0009_auto_20160722_1720'),
]
operations = [
migrations.AddField(
model_name='netsalary',
... | KenanBek/rslservices | app/payroll/migrations/0010_auto_20160803_1622.py | Python | gpl-3.0 | 1,650 |
# -*- coding: utf-8 -*-
"""
General description
-------------------
As the csv-reader was removed with version 0.2 this example shows how to create
an excel-reader. The example is equivalent to the old csv-reader example.
Following the example one can customise the excel reader to ones own needs.
The pandas package s... | oemof/examples | oemof_examples/oemof.solph/v0.3.x/excel_reader/dispatch.py | Python | gpl-3.0 | 12,121 |
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.button import Button
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.label import Label
from kivy.properties import (ListProperty, NumericProperty)
class HeightButton(Button):
pass
class HeightLabel(Label):
pass
class HomeScreenButton(... | inclement/Pyonic-interpreter | pyonic/widgets.py | Python | gpl-3.0 | 810 |
"""Tests for distutils.msvc9compiler."""
import sys
import unittest
import os
from distutils.errors import DistutilsPlatformError
from distutils.tests import support
from test.support import run_unittest
# A manifest with the only assembly reference being the msvcrt assembly, so
# should have the assembly completely ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.3.0/Lib/distutils/tests/test_msvc9compiler.py | Python | mit | 6,051 |
#!/usr/bin/env python
#mf2outline version 20180503
#This program has been written by Linus Romer for the
#Metaflop project by Marco Mueller and Alexis Reigel.
#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 Softwar... | metaflop/metaflop-www | bin/mf2outline.py | Python | gpl-3.0 | 64,047 |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2015 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | EarToEarOak/RTLSDR-Scanner | rtlsdr_scanner/toolbars.py | Python | gpl-3.0 | 21,103 |
# -*- coding: utf-8 -*-
#
# PySPED - Python libraries to deal with Brazil's SPED Project
#
# Copyright (C) 2010-2012
# Copyright (C) Aristides Caldeira <aristides.caldeira at tauga.com.br>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Library General Public Lic... | kmee/PySPED | pysped/xml_sped/base.py | Python | lgpl-2.1 | 35,791 |
"""Wrapper functions for Tcl/Tk.
Tkinter provides classes which allow the display, positioning and
control of widgets. Toplevel widgets are Tk and Toplevel. Other
widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton,
Checkbutton, Scale, Listbox, Scrollbar, OptionMenu. Properties of the widgets are
specif... | atmark-techno/atmark-dist | user/python/Lib/lib-tk/Tkinter.py | Python | gpl-2.0 | 133,097 |
from django.forms import ModelForm
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import resolve, reverse
from ..views import UserUpdateView
class MyAccountTestCase(TestCase):
def setUp(self):
self.username = 'john'
self.password = 'secret123'
... | sibtc/django-beginners-guide | accounts/tests/test_view_my_account.py | Python | mit | 3,187 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2016 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import os
import string
from lib.core.enums import PRIORITY
from lib.core.common import singleTimeWarnMessage
__priority__ = PRIORITY.LOW
def dependencies():
singleTime... | glaudsonml/kurgan-ai | tools/sqlmap/tamper/percentage.py | Python | apache-2.0 | 1,386 |
import base64
import datetime
import unittest.mock
from django.test import TestCase, override_settings
from django.utils import timezone
from sesame import packers
from sesame.tokens_v2 import (
TIMESTAMP_OFFSET,
create_token,
detect_token,
get_revocation_key,
parse_token,
)
from .mixins import C... | aaugustin/django-sesame | tests/test_tokens_v2.py | Python | bsd-3-clause | 14,825 |
# 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 ... | Kim-Seonghyeon/youtube_8m | scene_train.py | Python | apache-2.0 | 28,194 |
# -*- coding: utf-8 -*-
#
# parse_travis_log.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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 Licens... | uahic/nest-simulator | extras/parse_travis_log.py | Python | gpl-2.0 | 8,909 |
from django.contrib import admin
from cab.models import Language, Snippet, SnippetFlag
class LanguageAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ['name']}
class SnippetAdmin(admin.ModelAdmin):
list_display = ('id', 'title', 'author', 'rating_score', 'pub_date')
list_filter = ('language',)
... | aggrent/cab | cab/admin.py | Python | bsd-3-clause | 959 |
from polyphony import testbench
shift_n = 7
#shift_n = 20
def round(x):
return x
def abs(x):
if x < 0 :
return -x
else:
return x
def i_mul_floor(x, y):
tmp = x * y
return tmp >> shift_n
def i_mul_ceil(x, y):
tmp = x * y
d = tmp & (1 << shift_n - 1)
tmp >>= shift_n
... | ryos36/polyphony-tutorial | Tutorial_1/root.py | Python | mit | 1,098 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Invoke-Phant0m',
# list... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/collection/invoke-phant0m.py | Python | bsd-3-clause | 3,502 |
'''
This file is part of python-libdeje.
python-libdeje 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.
python-libdeje is distribute... | campadrenalin/python-libdeje | deje/quorum.py | Python | gpl-3.0 | 5,211 |
import unittest
from GeneratePrimeNumbers import GeneratePrimeNumbers
class TestPrimeGenerator(unittest.TestCase):
def TestCorrectness(self):
#test whether the function generates correct prime numbers
self.assertEqual(GeneratePrimeNumbers(20), [2, 3, 5, 7, 11, 13, 17, 19])
def TestZero(sel... | jimkiiru/james-kiiru-bc17-week1 | day1/TestPrimeNumbers.py | Python | mit | 1,018 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complianc... | afrolov1/nova | nova/virt/libvirt/firewall.py | Python | apache-2.0 | 12,909 |
#!/usr/bin/python3
import os
import io
import re
import sys
import time
import datetime
import configparser
from subprocess import Popen, PIPE
class Todo:
config = None
projectKeys = ['p', 'prj', 'project']
priorityKeys = ['t', 'top', 'priority']
idKeys = ['i', 'id']
nameKeys = ['n', 'name']
... | todo-projects/todo-python | todo.py | Python | unlicense | 13,074 |
#!/usr/bin/env python3
import logging
import time
import os
import urllib.parse
import urllib.request
import urllib.error
from slugify import slugify
from sys import platform
from SimpleWebSocketServer import SimpleWebSocketServer, WebSocket
import threading
import test
import subprocess
from http.server import Simple... | romaneckert/robot | archive/bionics_old/core.py | Python | mit | 7,117 |
#!/usr/bin/python
import gtk
import os
from datetime import datetime
# Get the GStreamer version
if os.system ('gst-typefind-0.10 --version') == 0:
# List the formats of the last files played
last_visited = 0
recent_manager = gtk.recent_manager_get_default ()
for recent in recent_manager.get_items ():
if recent.... | gfunkmonk2/mate-movie-player | data/idol-bugreport.py | Python | gpl-2.0 | 716 |
# Copyright (C) 2013 Jaedyn K. Draper
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, di... | ShadauxCat/csbuild | csbuild/toolchain_msvc.py | Python | mit | 27,820 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
def power(x, n=2):
return x ** n
print('power(5) =', power(5))
print('power(5, 2) =', power(5, 2))
print('power(5, 4) =', power(5, 4))
| BuleHell/Learn-ProgrammingLanguage | Python/py3/function/params.py | Python | gpl-3.0 | 188 |
# proxy module
from traitsui.wx.themed_vertical_notebook_editor import *
| enthought/etsproxy | enthought/traits/ui/wx/themed_vertical_notebook_editor.py | Python | bsd-3-clause | 73 |
# -*- coding: utf-8 -*-
#
# Copyright © 2014 René Samselnig
#
# This file is part of Database Navigator.
#
# Database Navigator 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 License, ... | resamsel/dbnavigator | src/dbmanagr/driver/postgresql/databaseconnection.py | Python | gpl-3.0 | 3,275 |
#!/usr/bin/python2
'''
Created on 18th July 2015
@author: Andrew Dean
Motion Notify v1.0 - uploads images and video to Google Drive and sends notification via email.
Detects whether someone is home by checking the local network for an IP address or MAC address and only sends email if nobody is home.
Allows hours to b... | amdean/motion-notify | motion-notify.py | Python | gpl-3.0 | 4,904 |
#
# 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... | apache/qpid-dispatch | tests/test_command.py | Python | apache-2.0 | 5,752 |
from django.contrib import admin
from models import Questions
class QuestionsAdmin(admin.ModelAdmin):
fields = ('question','a','b','c','d','anwser')
list_filter=('question','a','b','c','d','anwser')
list_display=('question','a','b','c','d','anwser')
admin.site.register(Questions, QuestionsAdmin) | wasit7/tutorials | django/Pieng/myclass/myquiz/admin.py | Python | mit | 309 |
#! /usr/bin/env python
from openturns import *
TESTPREAMBLE()
RandomGenerator().SetSeed(0)
try :
# Instanciate one distribution object
R = CorrelationMatrix(3)
R[0, 1] = 0.5
R[0, 2] = 0.25
collection = CopulaCollection(3)
collection[0] = FrankCopula(3.0)
collection[1] = NormalCopula(R)
... | dbarbier/privot | python/test/t_ComposedCopula_std.py | Python | lgpl-3.0 | 2,989 |
from __future__ import absolute_import, unicode_literals
from django import http
from django.utils.six.moves.urllib.parse import urlparse
from wagtail.wagtailredirects import models
def get_redirect(request, path):
try:
return models.Redirect.get_for_site(request.site).get(old_path=path)
except mode... | kurtw/wagtail | wagtail/wagtailredirects/middleware.py | Python | bsd-3-clause | 1,883 |
# PROBLEM: We have a list of addresses with varying lengths tied up in an HTML page, but it's
# not in a table. Luckily they follow a pretty predictable format; we need to parse them into
# different columns and stick them in a delimited file.
#
# HOW WE'RE GOING TO DEAL WITH IT:
# - Use line breaks to split one big ... | ireapps/coding-for-journalists | 3_parse_addresses/payday.py | Python | mit | 3,656 |
# Author: duramato <matigonkas@outlook.com>
# URL: https://github.com/SiCKRAGETV/sickrage
#
# This file is part of SickRage.
#
# SickRage 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... | giggsey/SickRage | sickbeard/providers/torrentproject.py | Python | gpl-3.0 | 6,074 |
from django.template import RequestContext
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.decorators.http import require_http_methods
from django.http import HttpResponse
from genewiki.mapping.model... | SuLab/genewiki | genewiki/wiki/views.py | Python | mit | 4,425 |
# 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.
'''Base types for nodes in a GRIT resource tree.
'''
from __future__ import print_function
import ast
import os
import struct
import sys
from xml.sax i... | nwjs/chromium.src | tools/grit/grit/node/base.py | Python | bsd-3-clause | 24,714 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | viggates/nova | nova/tests/api/openstack/compute/test_flavors.py | Python | apache-2.0 | 28,230 |
# -*- coding: utf-8 -*-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Time Series Analysis -- Generate statistical weigts from scatter
#
# Author: Jakob Rørsted Mosumgaard
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##############################... | jakobmoss/tsa | utils/makeweights.py | Python | mit | 2,350 |
#
# 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... | markflyhigh/incubator-beam | sdks/python/apache_beam/examples/streaming_wordcount_it_test.py | Python | apache-2.0 | 4,547 |
# environment variables
ATOM_PROGRAM = '/home/ssozykin/distr/siesta/atom-4.0.2/atm'
ATOM_UTILS_DIR ='/home/ssozykin/distr/siesta/atom-4.0.2/Tutorial/Utils/'
element = "C"
# general calculation parameters
calc = {"element": element,
"alat": 2.468,
"vectors": [[0.866025, -0.50000, 0.000000],
... | ansobolev/PseudoGenerator | settings/settings.py | Python | mit | 1,159 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Functionality for creating and working with NTOR keys.
For a description of the NTOR handshake protocol, as well as its requisite
keys, see §5.1.4 of `tor-spec.txt`_, as well as the NTOR handshake proposal_.
.. _tor-spec.txt: https://gitweb.torproject.org/torspec.git/... | isislovecruft/leekspin | leekspin/ntor.py | Python | mit | 4,684 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20151105_0513'),
]
operations = [
migrations.CreateModel(
name='Devicegroup',
fields=[
('id', models.AutoField(verbose_name='ID', ... | vIiRuS/Lagerregal | devicegroups/migrations/0001_initial.py | Python | bsd-3-clause | 798 |
#!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Tests things related to debug information generation.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
test = TestGyp.Tes... | ibc/MediaSoup | worker/deps/gyp/test/mac/gyptest-debuginfo.py | Python | isc | 1,152 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __BEGIN_LICENSE__
# Copyright (c) 2009-2013, United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration. All
# rights reserved.
#
# The NGT platform is licensed under the Apache License, Version 2.0 (the
# "Lic... | sdrdis/iarpa_contest_submission | lib_exec/StereoPipeline/bin/lronac2mosaic.py | Python | mit | 19,228 |
'''
irafaria.py
Irafaria is a random lyric generator which bases
lyrics off lyrics from the Icelandic pop group Irafar.
Sentences are generated using a prior sampling routine on a
MDP based of a trigram language model.
The twitter account @irafarirafaria tweets newly generated
sentences every hour or so.
I... | multivac61/irafaria | irafaria.py | Python | mit | 5,015 |
"""A contents manager that uses the local file system for storage."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import base64
import errno
import io
import os
import shutil
from contextlib import contextmanager
import mimetypes
from tornado import web
from ... | mattvonrocketstein/smash | smashlib/ipy3x/html/services/contents/filemanager.py | Python | mit | 22,850 |
#!/usr/bin/env python
"""
A basic adaptive bot. This is part of the second worksheet.
"""
from api import State, util
import random, os
from sklearn.externals import joblib
DEFAULT_MODEL = os.path.dirname(os.path.realpath(__file__)) + '/mlrandregular-model.pkl'
class Bot:
__max_depth = -1
__randomize = Tr... | GreenGear5/planet-wars | bots/mlrandregular/mlrandregular.py | Python | mit | 4,318 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-01-29 18:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('confirmation', '0005_confirmation_realm'),
]
operations = [
migrations.AddF... | jackrzhang/zulip | confirmation/migrations/0006_realmcreationkey_presume_email_valid.py | Python | apache-2.0 | 480 |
"""Support for Xiaomi Miio binary sensors."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Callable
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
DEVICE_CLASS_PLUG,
DEVICE_CLASS_PROBLEM,
BinarySensorEntity,
BinarySensorEn... | lukas-hetzenecker/home-assistant | homeassistant/components/xiaomi_miio/binary_sensor.py | Python | apache-2.0 | 6,649 |
# -*- coding: utf-8 -*-
"""systemd_set_default command.
@author: Tobias Hunger <tobias.hunger@gmail.com>
"""
from cleanroom.command import Command
from cleanroom.exceptions import GenerateError
from cleanroom.helper.file import isfile
from cleanroom.location import Location
from cleanroom.systemcontext import System... | hunger/cleanroom | cleanroom/commands/systemd_set_default.py | Python | gpl-3.0 | 2,251 |
#!/usr/bin/env python
"""
Convert all recipes into feedstocks.
This script is to be run in a TravisCI context, with all secret environment
variables defined (BINSTAR_TOKEN, GH_TOKEN)
Such as:
export GH_TOKEN=$(cat ~/.conda-smithy/github.token)
"""
from __future__ import print_function
from conda_build.metadata... | petrushy/staged-recipes | .travis_scripts/create_feedstocks.py | Python | bsd-3-clause | 16,910 |
#!/usr/bin/env python
# Copyright 2016 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.
"""Download necessary mac toolchain files under certain conditions. If
xcode-select is already set and points to an external folder
(e... | axinging/chromium-crosswalk | build/mac_toolchain.py | Python | bsd-3-clause | 7,012 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.