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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# Tuxemon
# Copyright (C) 2014, William Edwards <shadowapex@gmail.com>,
# Benjamin Bean <superman2k5@gmail.com>
#
# This file is part of Tuxemon.
#
# Tuxemon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | treetrnk/Tuxemon | tuxemon/core/states/world/worldstate.py | Python | gpl-3.0 | 31,699 |
from math import *
#import psycho
#psyco.full()
class memoize:
def __init__(self, function):
self.function = function
self.memoized = {}
def __call__(self, *args):
try:
return self.memoized[args]
except KeyError:
if(len(self.memoized) > 100000):
return self.function(*args... | jdavidberger/project-euler | prob179.py | Python | lgpl-3.0 | 791 |
from django import forms
from django.forms.widgets import Textarea, DateInput, NumberInput
from core import forms as cf
from core import models as cm
from widgets import forms as wf
class ParticipateForm(forms.Form):
def __init__(self, item, *args, **kwargs):
super(ParticipateForm, self).__init__(*args, **... | better-dem/portal | ballot_decider/forms.py | Python | agpl-3.0 | 4,917 |
# striplog documentation build configuration file.
#
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
# -- Setup function ----------------------------------------------------------
# Defines custom steps in the process.
def autodoc_skip_member(app, what, name, obj, skip, options):
"""Exclude all ... | agile-geoscience/striplog | docs/conf.py | Python | apache-2.0 | 3,309 |
#!/usr/bin/env python3
from linklist import *
class Solution:
def removeElements(self, head, val):
if head == None:
return head
if head.val == val:
head = self.removeElements(head.next, val)
else:
head.next = self.removeElements(head.next, val)
r... | eroicaleo/LearningPython | interview/leet/203_Remove_Linked_List_Elements.py | Python | mit | 513 |
import plugin_super_class
import threading
import time
from PyQt5 import QtCore, QtWidgets
from subprocess import check_output
import json
class InvokeEvent(QtCore.QEvent):
EVENT_TYPE = QtCore.QEvent.Type(QtCore.QEvent.registerEventType())
def __init__(self, fn, *args, **kwargs):
QtCore.QEvent.__init... | ingvar1995/toxygen_plugins | AutoAwayStatusLinux/awayl.py | Python | gpl-3.0 | 3,320 |
from django.views.generic import CreateView, DetailView
from .models import TestModel
class TestCreateView(CreateView):
template_name = 'test_tinymce/create.html'
fields = ('content',)
model = TestModel
class TestDisplayView(DetailView):
template_name = 'test_tinymce/display.html'
context_object... | romanvm/django-tinymce4-lite | test_tinymce/views.py | Python | mit | 363 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label = '%s.... | google-code-export/evennia | src/players/migrations/0003_auto__add_field_playerdb_db_cmdset_storage.py | Python | bsd-3-clause | 7,359 |
import parsley, hexchat
from random import randint
__module_name__ = 'dice'
__module_version__ = '1.0.0'
__module_description__ = 'Allows one to do emote dice rolls'
__module_author__ = 'Vlek'
def say(msg):
"""Says msg in chat within current context"""
context = hexchat.find_context()
context.command('say... | Vlek/plugins | HexChat/dice.py | Python | mit | 1,742 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-28 10:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0014_course_views'),
]
operations = [
migrations.AlterField(
... | sonic182/portfolio3 | courses/migrations/0015_auto_20161028_1057.py | Python | mit | 445 |
"""
=======================================================
Reconstruction with Constrained Spherical Deconvolution
=======================================================
This example shows how to use Constrained Spherical Deconvolution (CSD)
introduced by Tournier et al. [Tournier2007]_.
This method is mainly usefu... | maurozucchelli/dipy | doc/examples/reconst_csd.py | Python | bsd-3-clause | 3,601 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2014 The OctoPrint Project - Released under terms... | foosel/OctoPrint | src/octoprint/server/util/sockjs.py | Python | agpl-3.0 | 18,118 |
#!/usr/bin/env python3
import os
from pathlib import Path
import numpy as np
from pysisyphus.helpers import geom_from_xyz_file
from pysisyphus.stocastic.align import matched_rmsd
THIS_DIR = Path(os.path.dirname(os.path.realpath(__file__)))
def test_matched_rmsd():
geom1 = geom_from_xyz_file(THIS_DIR / "eins.x... | eljost/pysisyphus | tests_staging/test_matched_rmsd/test_matched_rmsd.py | Python | gpl-3.0 | 816 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-09 20:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('compta', '0004_compte_epargne'),
]
operations = [
... | mfalaize/carnet-entretien | compta/migrations/0005_auto_20170809_2224.py | Python | gpl-3.0 | 577 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013-2014 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and... | ingadhoc/openerp-travel | travel/__init__.py | Python | agpl-3.0 | 1,092 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
# Nexcess.net TwoFactorAuth Extension for Magento
# Copyright (C) 2014 Nexcess.net L.L.C.
# 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; eith... | nexcess/magento-two-factor-auth | build/build_package.py | Python | gpl-2.0 | 17,309 |
from __future__ import unicode_literals
import json
import re
import time
import warnings
import hashlib
from django import forms
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import login as django_login, get_backends
from django.contrib.auth import logout as django_lo... | Alexander-M-Waldman/local_currency_site | lib/python2.7/site-packages/allauth/account/adapter.py | Python | gpl-3.0 | 17,306 |
"""Functions for reading/writing to protobufs."""
import struct
from typing import Union
from typing.io import BinaryIO
from google.protobuf.reflection import GeneratedProtocolMessageType
import numpy
def read_proto(
path: str,
Proto: GeneratedProtocolMessageType
) -> 'Protobuf':
"""Reads a prot... | chengsoonong/acton | acton/proto/io.py | Python | bsd-3-clause | 5,189 |
from GuitarScene import * | EdPassos/fofix | src/views/GuitarScene/__init__.py | Python | gpl-2.0 | 25 |
#!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/ext/ndb/django_middleware.py | Python | bsd-3-clause | 2,158 |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | sjohannes/exaile | xlgui/widgets/menuitems.py | Python | gpl-2.0 | 10,232 |
def answer(population, x, y, strength):
max_y = len(population)
max_x = len(population[0])
visited = []
to_visit = [(y, x)]
def next_coords():
for coords in to_visit:
yield coords
for y, x in next_coords():
if population[y][x] <= strength:
print popu... | smartypants2712/python | zombie_infection.py | Python | mit | 1,015 |
# Copyright (c) 2010-2015 Benjamin Peterson
#
# 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, publi... | endlessm/chromium-browser | third_party/catapult/third_party/six/six.py | Python | bsd-3-clause | 30,142 |
# Copyright (C) 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMIN... | bl4ckmesa/bound | dnspython-1.11.1/tests/dnssec.py | Python | mit | 10,453 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 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
# ... | Triv90/Nova | nova/virt/vmwareapi/driver.py | Python | apache-2.0 | 23,942 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Task 11"""
ESCAPE_STRING = "\\n\'\""
| MJVarghese/is210-week-03-warmup | task_11.py | Python | mpl-2.0 | 87 |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2018 Chris Lamb <lamby@debian.org>
#
# diffoscope 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,... | ReproducibleBuilds/diffoscope | tests/test_source.py | Python | gpl-3.0 | 1,066 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | eliasdesousa/indico | indico/modules/cephalopod/controllers.py | Python | gpl-3.0 | 5,171 |
import os
import re
from pip.backwardcompat import urlparse
from pip.util import rmtree, display_path, call_subprocess
from pip.log import logger
from pip.vcs import vcs, VersionControl
_svn_xml_url_re = re.compile('url="([^"]+)"')
_svn_rev_re = re.compile('committed-rev="(\d+)"')
_svn_url_re = re.compile(r'URL: (.+)'... | Ivoz/pip | pip/vcs/subversion.py | Python | mit | 10,491 |
import unittest
import os
import sys
from kalliope.core.Utils.FileManager import FileManager
class TestFileManager(unittest.TestCase):
"""
Class to test FileManager
"""
def setUp(self):
pass
def create_file_manager(self):
file_manager = FileManager()
self.assertIsInstanc... | kalliope-project/kalliope | Tests/test_file_manager.py | Python | gpl-3.0 | 6,902 |
# -*- coding: utf-8 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import re
from operator import itemgetter
from django import forms
from django.core.exceptions i... | ericawright/bedrock | bedrock/newsletter/forms.py | Python | mpl-2.0 | 11,976 |
from datetime import datetime
from time import sleep
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings
from dimagi.utils.parsing import string_to_datetime, json_format_datetime
from dimagi.utils.couch.cache import cache_core
from dimagi.u... | gmimano/commcaretest | hqscripts/generic_queue.py | Python | bsd-3-clause | 4,471 |
import tempfile
import os.path
from pip.util import call_subprocess
from pip.util import display_path, rmtree
from pip.vcs import vcs, VersionControl
from pip.log import logger
from pip.compat import url2pathname, urlparse
urlsplit = urlparse.urlsplit
urlunsplit = urlparse.urlunsplit
class Git(VersionControl):
... | 1stvamp/pip | pip/vcs/git.py | Python | mit | 7,461 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/modules/rb/models/reservations.py | Python | gpl-3.0 | 30,995 |
# -*- coding: utf-8 -*-
import gxf
from gxf.formatting import Token, Formattable
@gxf.register()
class Registers(gxf.DataCommand):
'''
Shows registers.
'''
def setup(self, parser):
parser.add_argument("-m", "--mark", action='append', default=[],
help="Highlight s... | wapiflapi/gxf | gxf/extensions/registers.py | Python | mit | 1,628 |
import pdb
import os.path
import os
import multiprocessing as mp
import itertools
from sklearn.externals import joblib
from data.psym import event_class_set, non_class, gold_annotation, intermediate_annotation, pos_class, reg_class_set, candidate_entity
#from data.event import Trigger
from utils.path import loadModul... | XiaoLiuAI/RUPEE | src/python/intg/pipeline.py | Python | gpl-2.0 | 29,500 |
# Copyright 2015 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... | 4Quant/tensorflow | tensorflow/python/ops/control_flow_ops.py | Python | apache-2.0 | 76,917 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import cgi
import sqlite3, re, string, codecs, os
def cercaurbano(cNominativo):
c = sqlite3.connect('./data/catasto.db')
cur = c.cursor()
cSele = "select distinct (id_i.foglio || '-' || id_i.numero ||'-'|| id_i.subalterno), \
'<a href=\"http://nominatim.openstreetmap.o... | marcobra/opencatamap | cgi-bin/genera_html_su_urbano.py | Python | gpl-3.0 | 3,614 |
from django.core.exceptions import ValidationError
from django.test import TestCase
from squad.core import models
class TestEmailTemplateTest(TestCase):
def setUp(self):
self.email_template = models.EmailTemplate()
self.email_template.name = 'fooTemplate'
self.email_template.plain_text ... | Linaro/squad | test/core/test_emailtemplate.py | Python | agpl-3.0 | 878 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014, 2015 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redist... | adrienpacifico/openfisca-france-data | openfisca_france_data/input_data_builders/build_openfisca_survey_data/step_01_pre_processing.py | Python | agpl-3.0 | 10,072 |
# $Id$
#
# pjsua Setup script for Visual Studio
#
# Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
#
# 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, o... | xhook/asterisk-v11 | res/pjproject/pjsip-apps/src/python/setup-vc.py | Python | gpl-2.0 | 2,533 |
table = []
for i in range(8):
input()
table += [list(map(lambda x: x[1:-1], input().split('|')[1:-1]))]
input()
table.reverse()
pieces = {'K': [], 'Q': [], 'R': [], 'B': [], 'N': [], 'P': [], 'k': [], 'q': [], 'r': [], 'b': [], 'n': [], 'p': []}
for i in range(8):
for j in range(8):
if table[i][j]... | JonSteinn/Kattis-Solutions | src/Help Me With The Game/Python 3/helpgame.py | Python | gpl-3.0 | 955 |
#/***********************************************************************
# * Licensed Materials - Property of IBM
# *
# * IBM SPSS Products: Statistics Common
# *
# * (C) Copyright IBM Corp. 1989, 2020
# *
# * US Government Users Restricted Rights - Use, duplication or disclosure
# * restricted by GSA ADP Schedule Co... | IBMPredictiveAnalytics/STATS_DATASET | src/STATS_DATASET.py | Python | apache-2.0 | 9,091 |
from google.appengine.ext.deferred import defer
from google.appengine.runtime import DeadlineExceededError
def _process_shard(model, instance_ids, callback):
for instance in model.objects.filter(pk__in=instance_ids):
callback(instance)
def _shard(model, query, callback, shard_size, queue, offset=0):
... | Ali-aqrabawi/ezclinic | lib/djangae/contrib/mappers/defer.py | Python | mit | 2,243 |
class OutResourcesError (Exception):
""" Out of free resources """
pass
class NotFoundError (Exception):
""" Not found resource in allocated """
pass
| AHAPX/resm | src/errors.py | Python | gpl-3.0 | 168 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from rml2txt import parseString, parseNode
""" This engine is the minimalistic renderer of RML documents into text files,
using spaces and newlines to format.
It was needed in some special applications, where ... | vileopratama/vitech | src/openerp/report/render/rml2txt/__init__.py | Python | mit | 395 |
# -*- coding: utf-8 -*-
"""This module contains some Sobol functions.
"""
__author__ = 'Fei Xie'
__all__ = []
def getconstant(name='',**kwarg):
"""Get constants from file by name."""
from . import __path__ as path
from numpy import load
from os.path import join
from os import listdir
path = ... | wzmao/fmath | fmath/Random/Constant.py | Python | gpl-2.0 | 530 |
from docker.api import APIClient
from docker.errors import APIError
from docker.types import SwarmSpec
from .resource import Model
class Swarm(Model):
"""
The server's Swarm state. This a singleton that must be reloaded to get
the current state of the Swarm.
"""
id_attribute = 'ID'
def __init... | shakamunyi/docker-py | docker/models/swarm.py | Python | apache-2.0 | 5,852 |
"""Long enough spam checker backend for Zinnia"""
from zinnia.settings import COMMENT_MIN_WORDS
def backend(comment, content_object, request):
"""
Backend checking if the comment posted is long enough to be public.
Generally a comments with few words is useless.
The will avoid comments like this:
... | pczhaoyun/obtainfo | zinnia/spam_checker/backends/long_enough.py | Python | apache-2.0 | 452 |
import os
import sys
import re
if __name__ == '__main__':
script, workingDir, jdkDir, outputPath, logPath = sys.argv
os.chdir(workingDir)
outputDir = os.path.dirname(outputPath)
if not os.path.exists(outputDir):
os.makedirs(outputDir)
oldPathEnv = os.environ['PATH']
os.environ['PATH']... | fifoforlifo/pynja | packages/pynja/scripts/jar-invoke.py | Python | apache-2.0 | 728 |
###############################################################################################
# $Id: ttest.py,v 1.1 2003/09/14 04:31:39 riq Exp $
###############################################################################################
import pygame
from pygame.locals import *
import twidget
from tbutton ... | JeroenDeDauw/teg | python/client/gui/ttest.py | Python | gpl-3.0 | 1,186 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Licen... | cylc/cylc | tests/unit/cycling/test_integer.py | Python | gpl-3.0 | 7,781 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | vlegoff/tsunami | src/secondaires/magie/editeurs/spedit/__init__.py | Python | bsd-3-clause | 9,326 |
"""Convert a MiSeq samplesheet to a valid HiSeq samplesheet
"""
import argparse
from scilifelab.illumina.miseq import MiSeqSampleSheet
from scilifelab.illumina.hiseq import HiSeqSampleSheet
def main(miseq_samplesheet, hiseq_samplesheet):
m_samplesheet = MiSeqSampleSheet(miseq_samplesheet)
h_samplesheet = HiS... | SciLifeLab/scilifelab | scripts/mi2hi_samplesheet.py | Python | mit | 858 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Dimitrios Tydeas Mengidis <tydeas.dr@gmail.com>
# This file is part of Ansible
#
# Ansible 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... | slank/ansible | lib/ansible/modules/packaging/language/composer.py | Python | gpl-3.0 | 8,639 |
"""
This block defines a Staff Graded Assignment. Students are shown a rubric
and invited to upload a file which is then graded by staff.
"""
import datetime
import hashlib
import json
import logging
import mimetypes
import os
import pkg_resources
import pytz
from functools import partial
from courseware.models impo... | RPI-OPENEDX/edx-sga | edx_sga/sga.py | Python | agpl-3.0 | 23,821 |
import os
from setuptools import setup, find_packages
with open(
os.path.join(os.path.dirname(__file__), 'README.md'),
encoding='utf-8'
) as fh:
long_description = fh.read()
setup(name='damn-simple-jsonrpc-server',
version='0.4.4.post1',
description='Damn simple, framework-agnostic JSON-RPC ... | marcinn/json-rpc-server | setup.py | Python | bsd-2-clause | 1,124 |
# Copyright (c) 2013 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 ... | blueboxgroup/neutron | neutron/plugins/ml2/managers.py | Python | apache-2.0 | 31,930 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the `BugContextMenu`."""
__metaclass__ = type
from zope.component import getUtility
from lp.bugs.browser.bug import BugContextMenu
from lp.bugs.enums import BugNoti... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/bugs/browser/tests/test_bug_context_menu.py | Python | agpl-3.0 | 3,360 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import reversion
from django.core.exceptions import ImproperlyConfigured
from django.core.paginator import InvalidPage, Paginator
from django.db.models.query import QuerySet
from django.http import Http404
from django.utils import six
from django.utils.tr... | luzfcb/django-reversion-extras | reversion_extras/views.py | Python | bsd-3-clause | 7,718 |
from django.db import models
from django.test import TestCase
from django.utils import six
from .. import utils
from ..views import IndexView
class UtilsTestModel(models.Model):
field1 = models.CharField(max_length=23)
field2 = models.CharField('second field', max_length=42)
def simple_method(self):
... | hnakamur/django-admin2 | djadmin2/tests/test_utils.py | Python | bsd-3-clause | 5,246 |
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: TTbar_Tauola_13TeV_cfi.py --conditions auto:startup -n 1000 --eventcontent FEVTDEBUG --relval 9000,100 -s GEN,SIM --datatier GEN-SIM --no_e... | rovere/productions | TTbar_Tauola_13TeV_cfi_py_GEN_SIM.py | Python | gpl-3.0 | 5,681 |
from GUIComponent import GUIComponent
from VariableText import VariableText
from os import statvfs
from enigma import eLabel
# TODO: Harddisk.py has similiar functions, but only similiar.
# fix this to use same code
class DiskInfo(VariableText, GUIComponent):
FREE = 0
USED = 1
SIZE = 2
def __init__(self, path, t... | bally12345/enigma2 | lib/python/Components/DiskInfo.py | Python | gpl-2.0 | 1,054 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | belokop/indico_bare | indico/modules/rb/views/user/rooms.py | Python | gpl-3.0 | 5,749 |
# (c) Copyright IBM Corp. 2021
# (c) Copyright Instana Inc. 2018
from __future__ import absolute_import
from distutils.version import LooseVersion
import opentracing
import opentracing.ext.tags as ext
import wrapt
from ..log import logger
from ..util.traceutils import get_active_tracer
try:
import suds # noqa... | instana/python-sensor | instana/instrumentation/sudsjurko.py | Python | mit | 1,613 |
from collections import deque
class Solution(object):
magic = 250
height = 0
length = 0
def updateMatrix(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: List[List[int]]
"""
if len(matrix) == 0:
return matrix
self.height, self.lengt... | liupangzi/codekata | leetcode/Algorithms/542.01Matrix/Solution.py | Python | mit | 1,479 |
'''
Created on 2015/10/28
@author: michael
'''
__title__ = 'NewsDog'
__version__ = '0.1'
__author__ = 'Michael Findlater'
__license__ = 'GNU V2'
__copyright__ = 'Copyright 2015 Michael Findlater'
from .newsdog import NewsDog | michaelfindlater/NewsDog | NewsDog/__init__.py | Python | gpl-2.0 | 227 |
# -*- coding:utf-8 -*-
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 re... | couchbasedeps/git-repo | subcmds/stage.py | Python | apache-2.0 | 3,034 |
from __future__ import division, print_function, absolute_import
from decimal import Decimal
from numpy.testing import (TestCase, run_module_suite, assert_equal,
assert_almost_equal, assert_array_equal, assert_array_almost_equal,
assert_raises, assert_allclose, assert_, dec)
import scipy.signal as signal
fro... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/scipy/signal/tests/test_signaltools.py | Python | agpl-3.0 | 40,574 |
from setuptools import setup
setup(
name="master",
version="0.0.0",
packages=["master"],
install_requires=[
"buildbot==0.8.9",
"psycopg2"
]
)
| pyfarm/pyfarm-build | master/setup.py | Python | apache-2.0 | 179 |
from __future__ import absolute_import
from django import forms
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from sentry import roles
f... | alexm92/sentry | src/sentry/web/frontend/organization_settings.py | Python | bsd-3-clause | 7,227 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-18 22:59
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('about', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_... | Arlefreak/ApiArlefreak | about/migrations/0002_remove_entry_notes.py | Python | mit | 377 |
"""
Checks that Pylint does not complain about foreign key sets on models
"""
# pylint: disable=missing-docstring consider-using-f-string
from django.db import models
class SomeModel(models.Model):
name = models.CharField(max_length=20)
timestamp = models.DateTimeField()
class OtherModel(models.Model):
... | landscapeio/pylint-django | pylint_django/tests/input/func_noerror_foreign_key_attributes.py | Python | gpl-2.0 | 632 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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... | chungg/aodh | aodh/api/__init__.py | Python | apache-2.0 | 1,224 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models, _
class ResCompany(models.Model):
_inherit = "res.company"
@api.model
def create(self, vals):
new_company = super(ResCompany, self).create(vals)
ProductPriceli... | ChawalitK/odoo | addons/product/res_company.py | Python | gpl-3.0 | 1,090 |
from gpiozero import LED
from time import sleep
g_led = LED(22)
y_led = LED(23)
r_led = LED(24)
g_time = 5
y_time = 2
r_time = 5
while True:
g_led.on()
y_led.off()
r_led.off()
sleep(g_time)
g_led.off()
y_led.on()
r_led.off()
sleep(y_time)
g_led.off()
y_led.off()
r_led.on()... | rdonelli/futurelearn-raspberry | week2/blink_traffic_light.py | Python | gpl-2.0 | 339 |
from flask import current_app, request as current_request
from werkzeug.wrappers import BaseResponse
from . import renderers as _renderers, normalizers
from .renderers import RendererNotFound, UnrenderedResponse
from functools import wraps
from collections import defaultdict
import logging
import datetime
from typ... | teozkr/Flask-Pushrod | flask_pushrod/resolver.py | Python | mit | 9,877 |
# Licensed under the MIT license
# http://opensource.org/licenses/mit-license.php
# Copyright 2006, Frank Scholz <coherence@beebits.net>
class RenderingControlClient:
def __init__(self, service):
self.service = service
self.namespace = service.get_type()
self.url = service.get_control_ur... | furbrain/Coherence | coherence/upnp/services/clients/rendering_control_client.py | Python | mit | 3,458 |
"""
Python 3 client library for the PayTrace Payment Gateway public API.
The PayTrace API is documented in a single PDF file available here:
https://paytrace.com/manuals/PayTraceAPIUserGuideXML.pdf (dated July, 2011)
Section references in doc strings below refer to this document.
"""
import sys
from datetime imp... | jdnier/paytrace | paytrace.py | Python | mit | 25,479 |
#!/usr/bin/env python3
# Copyright 2020 David Robillard <d@drobilla.net>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THIS SOFTWARE IS PROVIDE... | OpenMusicKontrollers/midi_matrix.lv2 | subprojects/nk_pugl/pugl/scripts/dox_to_sphinx.py | Python | artistic-2.0 | 21,230 |
"""
WSGI config for detectme project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | mingot/detectme_server | detectme/detectme/wsgi.py | Python | mit | 2,103 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-data-qna | samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_async.py | Python | apache-2.0 | 1,680 |
c = get_config()
c.IPythonWidget.execute_on_complete_input = False
c.FrontendWidget.lexer_class = 'pygments.lexers.FSharpLexer'
| npmurphy/IfSharp | ipython-profile/ipython_qtconsole_config.py | Python | bsd-3-clause | 128 |
from __future__ import absolute_import
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from django.conf import settings
class Command(BaseCommand):
help = """Send some stats to statsd."""
def add_arguments(self, parser):
# type: (Argumen... | sonali0901/zulip | zerver/management/commands/send_stats.py | Python | apache-2.0 | 1,017 |
import inspect
#public symbols
__all__ = ["Factory"]
class Factory(object):
"""Base class for objects that know how to create other objects
based on a type argument and several optional arguments (version,
server id, and resource description).
"""
def __init__(self):
pass
def create(... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.main-0.13.0-py2.7.egg/openmdao/main/factory.py | Python | gpl-2.0 | 2,382 |
'''
- login and get token
- process 2FA if 2FA is setup for this account
- Get list of child accounts for a parent user
- if the user is a regular customer then get a list of child accounts for this user
- if the user is a partner_admin then get a list of child accounts for the first user from the list of users this pa... | Mesitis/community | sample-code/Python/05 Child Accounts/get_children.py | Python | mit | 2,968 |
"""
WiFi Positioning System
Wrappers around the SkyHook and Google Locations APIs to resolve
wireless routers' MAC addresses (BSSID) to physical locations.
"""
try:
from json import dumps, loads
except:
from simplejson import dumps, loads
from urllib2 import Request, urlopen
from urllib import urlencode
clas... | cnHackintosh/theHarvester | discovery/shodan/wps.py | Python | gpl-2.0 | 1,917 |
from odoo import models, fields, api
class ResPartner(models.Model):
_inherit = 'res.partner'
is_service_provider = fields.Boolean(string='Is Service Provider', default=False)
| thinkwelltwd/care_center | service_partner/models/res_partner.py | Python | lgpl-3.0 | 188 |
import os
from ernest.utils import truthiness
# Whether or not we're in DEBUG mode. DEBUG mode is good for
# development and BAD BAD BAD for production.
DEBUG = truthiness(os.environ.get('DEBUG', True))
# ------------------------------------------------
# Required things to set
# ----------------------------------... | willkg/ernest | ernest/settings.py | Python | mpl-2.0 | 1,587 |
# coding=utf-8
# Copyright 2020 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | googleinterns/cabby | cabby/model/text/s2cellid_prediction/__init__.py | Python | apache-2.0 | 587 |
# Copyright (C)
#
# Author :
from GIC.Channels.GenericChannel import *
class ChannelTest (GenericChannel):
# mandatory fields to work on LibreGeoSocial search engine
MANDATORY_FIELDS = ["latitude", "longitude", "radius", "category"]
CATEGORIES = [{"id" : "0", "name" : "all", "desc" : "All supported ... | kgblll/libresoft-gymkhana | libs/ChannelTemplate.py | Python | gpl-2.0 | 822 |
#!/usr/bin/env python
# Encoding: utf-8
import re
import subprocess
def get_last_version_from_tags():
versions = subprocess.check_output(["git", "tag"])
versions = versions.split('\n')
version_regex = re.compile(r'(\d+)\.(\d+)\.(\d+)')
versions = [map(int, v.split('.')) for v in versions if version_r... | dmugtasimov/django_audit_trail | bump_version.py | Python | apache-2.0 | 1,908 |
from __future__ import absolute_import
from collections import Callable
__all__ = ['get_or_create', 'RememberingSet']
class RememberingSet(set):
def __init__(self, *args, **kwargs):
super(RememberingSet, self).__init__(*args, **kwargs)
self._memory = set()
def add(self, value):
if ... | katakumpo/nicedjango | nicedjango/utils/py/collections.py | Python | mit | 861 |
# GenCumulativeSkyMtx
#
# Ladybug: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Ladybug.
#
# Copyright (c) 2013-2015, Mostapha Sadeghipour Roudsari <Sadeghipour@gmail.com>
# Ladybug is free software; you can redistribute it and/or modify
# it under the ... | boris-p/ladybug | src/Ladybug_GenCumulativeSkyMtx.py | Python | gpl-3.0 | 16,430 |
# cairo.py
#
# Copyright (C) 2011 Carlos Garcia Campos <carlosgc@gnome.org>
#
# 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 ver... | tsdgeos/poppler_mirror | regtest/backends/cairo.py | Python | gpl-2.0 | 1,636 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_pysplotter.ui'
#
# Created: Thu Nov 3 17:38:24 2011
# by: PyQt4 UI code generator 4.8.6
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except A... | iancze/Pysplotter | ui_pysplotter.py | Python | mit | 8,252 |
# todo: warn on no default, or something
# todo: get default collection name for picklestorage, mongostorage constructors
# todo: requirements.txt
import pprint
from modularodm import StoredObject
from modularodm.storedobject import ContextLogger
from modularodm import fields
from modularodm import storage
from modul... | sloria/modular-odm | main.py | Python | apache-2.0 | 9,277 |
import subprocess
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
def is_gold_linker_available():
if not config.gold_executable:
return False
try:
ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE)
ld_out = ld_cmd.st... | endlessm/chromium-browser | third_party/llvm/compiler-rt/test/profile/Linux/lit.local.cfg.py | Python | bsd-3-clause | 1,115 |
import pytest
from tests.support.asserts import assert_success
from tests.support.image import png_dimensions
from tests.support.inline import iframe, inline
from . import element_rect
DEFAULT_CSS_STYLE = """
<style>
div, iframe {
display: block;
border: 1px solid blue;
width: 10em... | nnethercote/servo | tests/wpt/web-platform-tests/webdriver/tests/take_element_screenshot/iframe.py | Python | mpl-2.0 | 1,780 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2019 Philipp Wolfer
#
# 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 Licen... | Sophist-UK/Sophist_picard | test/formats/test_ac3.py | Python | gpl-2.0 | 4,137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.