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 -*-
# Copyright (C) 2014, David Poulter
#
# 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 p... | davebrent/consyn | tests/__init__.py | Python | gpl-3.0 | 1,193 |
"""Messages used in the procedure of deploying Askbot
"""
import os.path
from askbot.deployment import path_utils
DEPLOY_PREAMBLE = """
Deploying Askbot - Django Q&A forum application
Problems installing? -> please email admin@askbot.org
To CANCEL - hit Ctr-C at any time"""
WHERE_TO_DEPLOY = 'Where to deploy (in whi... | aavrug/askbot-devel | askbot/deployment/messages.py | Python | gpl-3.0 | 3,238 |
#!/usr/bin/env python3
import os
#
# This file contains functions for enabling and disabling ZFS compression
#
def disable(zpool_name):
'''
Call this function to disable zfs compression.
'''
os.system("sudo zfs set compression=off " + zpool_name)
def enable(zpool_name, comp_type="lz4"):
'''
... | jsirianni/zfs-auto-deploy | functions/enable_compression.py | Python | gpl-3.0 | 764 |
import os
import sys, getopt, argparse
import logging
import json
import time
import requests
class BadCallError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class LatencyTest(object):
def __init__(self):
self.latency_sum = ... | smrjan/seldon-server | docker/grpc-util/python/jsonLatencyTest.py | Python | apache-2.0 | 2,221 |
import os
import wx # type: ignore
from functools import reduce
from gooey.gui.components.widgets.core.text_input import MultilineTextInput
from gooey.gui.components.widgets.textfield import TextField
from gooey.gui.components.widgets.bases import TextContainer
from gooey.gui import formatters
from gooey.pyth... | chriskiehl/Gooey | gooey/gui/components/widgets/textarea.py | Python | mit | 1,981 |
# Copyright (c) 2018 by contributors. 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... | PKU-Cloud-Lab/xLearn | python-package/test/test_data_conversion.py | Python | apache-2.0 | 5,138 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... | biswajitsahu/kuma | vendor/packages/translate/lang/__init__.py | Python | mpl-2.0 | 1,015 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''Basic function may be used in many place'''
import os,sys,re
import json,urllib2,difflib
######################## Part 1: General Functions ############################
def strdiff(str1, str2):
'''Similarity of two string'''
return difflib.SequenceMatcher(None, st... | OAPDF/oapdftools | oapdf/basic.py | Python | mit | 6,394 |
from django import forms
from .models import CartItem
class CartItemForm(forms.ModelForm):
first_name = forms.CharField(required=True)
last_name = forms.CharField(required=True)
email = forms.EmailField(required=True)
class Meta:
model = CartItem
fields = ('first_name', 'last_name', ... | brickfiestastem/brickfiesta | shop/forms.py | Python | agpl-3.0 | 329 |
#!/usr/bin/env python
# coding=utf-8
# author: xsl
import os
import leancloud
APP_ID = os.environ['LEANCLOUD_APP_ID']
APP_KEY = os.environ['LEANCLOUD_APP_KEY']
MASTER_KEY = os.environ['LEANCLOUD_APP_MASTER_KEY']
leancloud.init(APP_ID, app_key=APP_KEY, master_key=MASTER_KEY)
leancloud.use_master_key(False)
from app... | SleenXiu/xiuxiu | wsgi.py | Python | mit | 399 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(verbo... | cloudhotspot/pypackage-docker | src/polls/migrations/0001_initial.py | Python | mit | 1,084 |
#=======================================================================
""" A set of utilities for comparing results.
"""
#=======================================================================
from __future__ import division
import matplotlib
from matplotlib.compat import subprocess
from matplotlib.testing.nosecl... | Solid-Mechanics/matplotlib-4-abaqus | matplotlib/testing/compare.py | Python | mit | 12,371 |
#!/usr/bin/python
import sys, os
os.system("sudo youtube https://www.youtube.com/watch?v=NanqJFJ3YLE")
#this URL can be changed to almost any video on youtube
| stairwaytostability/421_521_final_project | youtube.py | Python | gpl-2.0 | 161 |
from private_files.models.fields import PrivateFileField
from private_files.signals import pre_download
__all__ = ['PrivateFileField', 'pre_download'] | hzlf/openbroadcast | website/private_files/__init__.py | Python | gpl-3.0 | 151 |
import pickle
import unittest
import numpy
from sklearn.tree.tree import DecisionTreeClassifier
from emetrics.correlation_score import CorrelationScore
from emetrics.evaluation.random_subsets_experiment import RandomSubsetsExperiment
__author__ = 'Emanuele Tamponi'
class RandomSubsetsExperimentTest(unittest.TestC... | etamponi/emetrics | emetrics/evaluation/test_random_subsets_experiment.py | Python | gpl-2.0 | 2,356 |
# Copyright 2015-2017 F-Secure
# 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, ... | F-Secure/see | see/hooks.py | Python | apache-2.0 | 3,119 |
#!/usr/bin/python
# MIT License
#
# Copyright (c) 2017 John Bryan Moore
#
# 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 us... | Playaowl/artworks | showers/pi/VL53L0X.py | Python | mit | 4,031 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class GservicesConfig(AppConfig):
name = 'gservices'
| Gargarol/django-gservices | gservices/apps.py | Python | mit | 158 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2016, Silvio Peroni <essepuntato@gmail.com>
#
# 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.
... | essepuntato/opencitations | script/tools/create_nq.py | Python | isc | 4,821 |
''' 7-plot-means.py
=========================
AIM: Plots the means of 6-mean_sl.py ! Comparison for an arbitrary number of cases
INPUT: files: - <orbit_id>_misc/orbits.dat
- <orbit_id>_flux/flux_*.dat
variables: see section PARAMETERS (below)
OUTPUT: in all_figures/ : comparison for every orbit_id
CMD: python 7-... | kuntzer/SALSA-public | 7b_plot_means.py | Python | bsd-3-clause | 6,721 |
import os
import time
import random
import _thread
import txaio
txaio.use_twisted()
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue
from autobahn.util import utcnow
from autobahn.wamp.types import RegisterOptions
from autobahn.twisted.wamp import ApplicationSessi... | crossbario/crossbar-examples | scaling-microservices/simple/compute.py | Python | apache-2.0 | 2,610 |
#!/usr/bin/env python
import sys, os, random
from bup import options
from bup.helpers import *
def randblock(n):
l = []
for i in xrange(n):
l.append(chr(random.randrange(0,256)))
return ''.join(l)
optspec = """
bup damage [-n count] [-s maxsize] [-S seed] <filenames...>
--
WARNING: THIS COMMA... | shineyear/catawampus | tr/vendor/bup/cmd/damage-cmd.py | Python | apache-2.0 | 1,499 |
#
# 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... | dhuang/incubator-airflow | airflow/providers/amazon/aws/transfers/mysql_to_s3.py | Python | apache-2.0 | 5,360 |
"""
Support for MQTT vacuums.
For more details about this platform, please refer to the documentation at
https://www.home-assistant.io/components/vacuum.mqtt/
"""
import logging
import voluptuous as vol
from homeassistant.components.vacuum import DOMAIN
from homeassistant.components.mqtt import ATTR_DISCOVERY_HASH
f... | joopert/home-assistant | homeassistant/components/mqtt/vacuum/__init__.py | Python | apache-2.0 | 2,361 |
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
http://stackoverflow.com/questions/566746/how-to-get-console-window-w... | qnorsten/svtplay-dl | lib/svtplay_dl/utils/terminal.py | Python | mit | 2,572 |
#coding: utf-8
from django import template
from pymorphy.django_conf import default_morph
from pymorphy.django_utils import inflect as inflect_inplace
from pymorphy.django_utils import _process_unmarked_phrase, _process_marked_phrase
register = template.Library()
@register.filter
def inflect(phrase, form):
if n... | artemrizhov/pymorphy | pymorphy/templatetags/pymorphy_tags.py | Python | mit | 3,376 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | seankelly/buildbot | master/buildbot/process/build.py | Python | gpl-2.0 | 29,329 |
# -*- coding: utf-8 -*-
"""
Tests for metadata handling.
"""
from __future__ import print_function
from __future__ import division
import json
import os
import tempfile
import unittest
import pickle
import numpy as np
import python_jsonschema_objects as pjs
import six
import msprime
import tskit
class TestMetadata... | shajoezhu/msprime | tskit_tests/test_metadata.py | Python | gpl-3.0 | 8,995 |
from __future__ import unicode_literals
from django.contrib.gis.db import models
class Playground(models.Model):
"""Location with swings, slides, and other playground essentials"""
def __str__(self):
return self.name
location = models.PointField(srid=26918)
name = models.CharField(max_l... | notthatbreezy/phl-play | django/playgrounds/models.py | Python | apache-2.0 | 394 |
__author__ = 'alan'
class Solution(object):
def lengthLongestPath(self, input):
"""
:type input: str
:rtype: int
"""
ans = 0
stack = []
for part in input.split('\n'):
depth = part.count('\t')
name = part.lstrip('\t')
while... | alyiwang/LeetPy | LongestAbsoluteFilePath.py | Python | apache-2.0 | 768 |
# This file is part of BurnMan - a thermoelastic and thermodynamic toolkit
# for the Earth and Planetary Sciences
# Copyright (C) 2012 - 2021 by the BurnMan team, released under the GNU
# GPL v2 or later.
"""
HP_2011_ds62
^^^^^^^^^^^^
Endmember minerals from Holland and Powell 2011 and references therein.
Update to ... | bobmyhill/burnman | burnman/minerals/HP_2011_ds62.py | Python | gpl-2.0 | 164,881 |
from django.test import TestCase
from django.db import IntegrityError
from core.tests import CoreTestCase
from . import models
class PersonTestCase(CoreTestCase):
def setUp(self):
models.Person.objects.create(first_name="First", last_name='User')
models.Person.objects.create(first_name="Second", la... | sllis/mysllis-community | community/tests.py | Python | gpl-2.0 | 3,947 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutItemLabel.
.. note:: 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.
""... | nirvn/QGIS | tests/src/python/test_qgslayoutlabel.py | Python | gpl-2.0 | 3,293 |
"""This module contains the FRC robot class."""
# Imports
import wpilib
#import autoscript
import common
import drivetrain
import feeder
import lift
import logging
import logging.config
import math
import userinterface
class MyRobot(wpilib.IterativeRobot):
"""Controls the robot.
This is the main robot class... | TechnoJays/robot2015 | src/robot/robot.py | Python | apache-2.0 | 10,015 |
import ipdb
import numpy as np
import theano
from cle.cle.cost import MSE
from cle.cle.data import Iterator
from cle.cle.models import Model
from cle.cle.layers import InitCell
from cle.cle.layers.feedforward import FullyConnectedLayer
from cle.cle.layers.recurrent import SimpleRecurrent
from cle.cle.train import Trai... | ruohoruotsi/Wavelet-Tree-Synth | nnet/VRNN_nips2015/cle/tutorials/bouncingball.py | Python | gpl-2.0 | 3,653 |
__author__ = 'Sharon Lev'
__email__ = 'sharon_lev@yahoo.com'
__date__ = '10/25/16'
from logging import Logger, NOTSET
class NoneLogger(Logger):
"""
A class that supports the logging interface, but does not perform any logging (Null Object Design Pattern)
"""
def __init__(self, name, level=NOTSET):
... | sharonlev/pyLoggingExtras | src/loggingextras/NoneLogger.py | Python | gpl-3.0 | 676 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Phillip Gentry <phillip@cx.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 3 of the Licen... | mwarkentin/ansible-modules-extras | source_control/github_hooks.py | Python | gpl-3.0 | 5,982 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import six
from django.co... | suutari-ai/shoop | shuup/core/models/_addresses.py | Python | agpl-3.0 | 9,387 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
user = Table('user', post_meta,
Column('id', Integer, primary_key=True, nullable=False),
Column('social_id', String(length=64), nullable=False),
Column('name', String(length=64)... | ProjoyRoy/flask-microblog | db_repository/versions/004_migration.py | Python | mit | 903 |
import numpy as np
__all__ = ['vanDerWaalsMixing']
def vanDerWaalsMixing(kij=0):
"""Simple van der Waals mixing rules, returns a mixingrule function.
kij is an numpy array of binary interaction parameters"""
def vdw_mixing(molefraction, theta, TdthetadT, B, delta=None, epsilon=None, eta=None):
"... | selenized/clausius | clausius/eos/basicmixing.py | Python | unlicense | 877 |
# Copyright (C) 2016-present the asyncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
import asyncpg
from asyncpg import _testbase as tb
class TestExceptions(tb.ConnectedTestCase):
def... | MagicStack/asyncpg | tests/test_exceptions.py | Python | apache-2.0 | 1,773 |
# Copyright (c) 2015 Uber Technologies, Inc.
#
# 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, publ... | Willyham/tchannel-python | examples/simple/raw/server.py | Python | mit | 1,522 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Llamando este script se recargan los datos en bruto de todas las acciones
#que se encuentran en el fichero de index.csv
import mysql.connector
import sys
from datetime import datetime
import logging
import utils
from config import config
from YahooDownloader import Ydownl... | rilocer/Analyzer | bulkDownloader.py | Python | gpl-2.0 | 1,501 |
#!/usr/bin/python -tt
# Can't do this with bash why not python!
# Removes basepairs below a certain threshold, based on Phred score
# Uses fastq_quality_filter
# Website: http://hannonlab.cshl.edu/fastx_toolkit/commandline.html#fastq_quality_filter_usage
# Import OS features to run external programs
import os
import g... | calandryll/transcriptome | scripts/old/fastx_trim.py | Python | gpl-2.0 | 4,462 |
#using this for test values for config
class TestConfig:
host = "irc.rizon.net"
port = 6667
nickname = "testNickName8462"
username = "testUserName8462"
hostname = "testHostName8462"
servername = "testServerName8462"
realname = "testRealName8462"
| gentoomen/Pymn | testconfig.py | Python | mit | 264 |
from pathlib import PurePath
def get(config):
return SourcePath(config.CONTENT_SOURCE_DIR)
class SourcePath(object):
def __init__(self, source_dir):
self.source_dir = source_dir
def build_path(self, key):
return self.source_dir + '/' + key + '.md'
def build_key(self, path):
pure_path = PurePath(path)
i... | elliottmina/doctor_static | lib/source_path.py | Python | mit | 463 |
# This file is part of beets.
# Copyright 2014, Adrian Sampson.
#
# 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, ... | Wen777/beets | beets/ui/commands.py | Python | mit | 53,731 |
# -*- coding: utf-8 -*-
import os
from lutris import settings
from lutris.runners.runner import Runner
class mupen64plus(Runner):
"""Nintendo 64 emulator"""
human_name = "Mupen64Plus"
platform = "Nintendo 64"
game_options = [{
'option': 'main_file',
'type': 'file',
'label': 'RO... | malkavi/lutris | lutris/runners/mupen64plus.py | Python | gpl-3.0 | 1,602 |
# -*- coding: utf-8 -*-
import random
import openerp
from openerp import SUPERUSER_ID, tools
import openerp.addons.decimal_precision as dp
from openerp.osv import osv, orm, fields
from openerp.addons.web.http import request
from openerp.tools.translate import _
from openerp.exceptions import UserError
class sale_ord... | orchidinfosys/odoo | addons/website_sale/models/sale_order.py | Python | gpl-3.0 | 23,429 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('core', '0001_initial'),
]
operat... | HigorSilvaRosa/ForumGeolocalizado | core/migrations/0002_auto_20141118_2258.py | Python | mit | 2,464 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/application_gateway_firewall_rule_group.py | Python | mit | 1,621 |
from django import forms
class UploadTaskForm(forms.Form):
task_file = forms.FileField()
| stefantsov/blackbox3 | author/forms.py | Python | bsd-3-clause | 96 |
# -*- coding: utf-8 -*-
# Unittests for fixtures.
import os
import sys
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core import management
from django.core.management.commands.dumpdata import sort_dependencies
from django.cor... | 350dotorg/Django | tests/regressiontests/fixtures_regress/tests.py | Python | bsd-3-clause | 20,033 |
import re
USER_RE = re.compile(r"^[a-zA-Z0-9_-]{3,20}$")
PASS_RE = re.compile(r"^.{3,20}$")
EMAIL_RE = re.compile(r"^[\S]+@[\S]+.[\S]+$")
class Validate:
"""Validates inputs for username, password, and email"""
def __init__(self, string):
self.string = string
# Username validation
def userna... | joepettigrew/multi-blog | handlers/validate.py | Python | mit | 604 |
from tsadm.log import TSAdmLogger
from tsadm.views.base import TSAdmView
from tsadm.errors import TSAdmError
import tsadmuser
logger = TSAdmLogger(__name__)
class SiteView(TSAdmView):
template_name = 'tsadmsite/home.html'
def __init__(self):
logger.debug('SiteView init')
super(SiteView, self... | tsadm/webapp | src/tsadmsite/views.py | Python | bsd-3-clause | 1,409 |
# -*- coding: utf-8 -*-
import re
import urlparse
from module.plugins.internal.misc import json
from module.plugins.internal.SimpleCrypter import SimpleCrypter
class Go4UpCom(SimpleCrypter):
__name__ = "Go4UpCom"
__type__ = "crypter"
__version__ = "0.18"
__status__ = "testing"
__pattern__ = r'h... | rlindner81/pyload | module/plugins/crypter/Go4UpCom.py | Python | gpl-3.0 | 1,960 |
# This file gets run by ./manage.py (runserver|test) and also gets
# imported for the WSGI application building by wsgi/playdoh.wsgi
# for stage/prod.
#
# It holds setup that's common to both environments.
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('CELERY_LOADER', 'django')
... | lgp171188/fjord | fjord/wsgi.py | Python | bsd-3-clause | 358 |
import os
import shutil
import textwrap
import time
from multiprocessing.pool import ThreadPool
from conans.client import tools
from conans.client.conanfile.build import run_build_method
from conans.client.conanfile.package import run_package_method
from conans.client.file_copier import report_copied_files
from conans... | conan-io/conan | conans/client/installer.py | Python | mit | 36,742 |
# Copyright 2021 The Kubernetes 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 ... | kubernetes/k8s.io | images/public-log-asn-matcher/app/ip-from-pyasn.py | Python | apache-2.0 | 1,766 |
# Stephen Bonner 2016 - Durham University
# Keras deep feedforward models for multiclass classification
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import Utils as ut
from keras.models import Sequential
from keras.layers import Dense,... | sbonner0/DeepTopologyClassification | src/legacy/MultiInputModels.py | Python | gpl-3.0 | 2,553 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of captlog.
#
# captlog - The Captain's Log (secret diary and notes application)
#
# Written in 2013 by Ricardo Garcia <r@rg3.name>
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to... | rg3/captlog | setup.py | Python | cc0-1.0 | 1,110 |
import os
class Frames(object):
def __init__(self, assets):
self.assets = assets
self.starbound_folder = assets.starbound_folder
def is_frames(self, key):
return key.endswith(".frames")
def index_data(self, asset):
key = asset[0]
path = asset[1]
offset = a... | R2pChyou/starcheat | starcheat/assets/frames.py | Python | mit | 2,502 |
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2018 Red Hat
#
# 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 la... | gnocchixyz/gnocchi | gnocchi/chef.py | Python | apache-2.0 | 7,603 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='ExampleModel',
fields=[
('id', models.AutoField... | jambonrose/djangocon2015-views | src/viewsapp/migrations/0001_initial.py | Python | bsd-2-clause | 546 |
import protocol_pb2
import socket
import struct
import sys
import os
import logging
import google.protobuf
import resource
def WRAP(MESSAGE, TYPE):
wrap = protocol_pb2.WrapperMessage()
wrap.type = TYPE
wrap.payload = MESSAGE
return wrap.SerializeToString()
class SpectrumBackend:
"""
Creates new NetworkPlugin ... | dazzzl/transwhat | Spectrum2/backend.py | Python | gpl-3.0 | 20,789 |
import os
from django.conf.urls import patterns, include, url
from django.views.generic.base import TemplateView
from django.conf import settings
from django.views.static import serve
from views import *
data_dir = os.path.join(os.path.dirname(__file__), 'data')
print "Data dir %s" % data_dir
# Uncomment the next... | Vjust/pacmoney | search_app/urls.py | Python | mit | 855 |
import requests
import threading
class Worker(threading.Thread):
def __init__(self, url, auth, callback):
super(Worker, self).__init__()
self.url = url
self.auth = auth
self.on_data = callback
self._stop = threading.Event()
def stop(self):
self._stop.set()
... | twizoo/gnip-stream-with-datasift-mapper | worker.py | Python | gpl-2.0 | 745 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Satpy developers
#
# This file is part of satpy.
#
# satpy 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... | pytroll/satpy | utils/fetch_avhrr_calcoeffs.py | Python | gpl-3.0 | 4,773 |
#!/usr/bin/env python
from __future__ import division, print_function
MaxN = 4000000
Sum = 0
a, b = 1, 2
i = 0
while True:
print("iteration: %d, value A = %d, value B = %d, Sum = %d" % (i, a, b, Sum))
a, b = b, a + b # fib(n) = fib(n-1) + fib(n-2)
if a >= MaxN: break
if a % 2 == 0: # only add even number... | mellowiz/ProjectEuler | problem_002.py | Python | gpl-3.0 | 356 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c)2013 Rackspace US, 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.ap... | 0dataloss/pyrax | samples/queueing/post_message.py | Python | apache-2.0 | 2,095 |
import ShareYourSystem as SYS;SYS.DebugPrintBool=False;
MyPredicter=SYS.PredicterClass(
).predict(
_CommandVariable="#custom:#clock:50*ms:0.5*(1.*mV+1.*mV*(int(t==50*ms)+int(t==150*ms)))",#2.,
_AgentUnitsInt = 100,
_AgentRecordVariable = [0,1,2],
_DecoderVariable="#array",
... | Ledoux/ShareYourSystem | Pythonlogy/ShareYourSystem/Specials/Predicters/Predicter/tests/07_tests_plastic/11_test_spike_multiagents_gauss_onesensor_plastic_ExampleCell.py | Python | mit | 1,198 |
"""Test sorting of entity objects.
"""
import pytest
import icat
import icat.config
from conftest import getConfig
@pytest.fixture(scope="module")
def client():
client, _ = getConfig(needlogin=False)
return client
def test_sort_users(client):
"""Sort Users.
This is the most simple sorting example:... | icatproject/python-icat | tests/test_07_entity_sort.py | Python | apache-2.0 | 11,395 |
"""Test Hue setup process."""
from unittest.mock import Mock
import pytest
from homeassistant import config_entries
from homeassistant.components import hue
from homeassistant.setup import async_setup_component
from tests.async_mock import AsyncMock, patch
from tests.common import MockConfigEntry
@pytest.fixture
d... | titilambert/home-assistant | tests/components/hue/test_init.py | Python | apache-2.0 | 8,339 |
# Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
# Example 1:
# Input: "babad"
# Output: "bab"
# Note: "aba" is also a valid answer.
# Example 2:
# Input: "cbbd"
# Output: "bb"
class Solution:
# brute force
# Time Limit Exceeded
# tim... | whelan957/leetcode | python3/DynamicProgramming/leetcode005_LongestPalindromicSubstring.py | Python | gpl-3.0 | 1,557 |
# -*- coding:utf-8 -*-
from werkzeug.routing import Map, Submount
import libcloud
from libcloud_rest.api.handlers import app_handler
from libcloud_rest.api.handlers.compute import compute_handler
from libcloud_rest.api.handlers.dns import dns_handler
from libcloud_rest.api.handlers.loadbalancer import lb_handler
from ... | islamgulov/libcloud.rest | libcloud_rest/api/urls.py | Python | apache-2.0 | 704 |
"""cascade delete for period stars
Revision ID: dbf1daf55faf
Revises: 1a44b70c747
Create Date: 2016-10-08 10:14:03.852963
"""
revision = 'dbf1daf55faf'
down_revision = '1a44b70c747'
branch_labels = None
depends_on = None
from alembic import op
def upgrade():
op.drop_constraint('report_all_daily_ibfk_1', 'repo... | kkamkou/gitmostwanted.com | migration/versions/dbf1daf55faf_cascade_delete_for_period_stars.py | Python | mit | 1,378 |
"""
Site entries.
"""
from yozuch.utils import normalize_slug
def linkitems(objs, reverse=False):
previtem = None
if reverse:
objs = reversed(objs)
for obj in objs:
obj.previtem = previtem
if previtem is not None:
previtem.nextitem = obj
previtem = obj
retu... | akrylysov/yozuch | yozuch/entries.py | Python | bsd-3-clause | 1,162 |
# -*- coding: utf-8 -*-
######################## BEGIN LICENSE BLOCK ########################
# This file is part of the cygapt package.
#
# Copyright (C) 2002-2009 Jan Nieuwenhuizen <janneke@gnu.org>
# 2002-2009 Chris Cormie <cjcormie@gmail.com>
# 2012 James Nylen <jnylen... | nylen/cyg-apt | src/cygapt/copying.py | Python | gpl-3.0 | 1,119 |
from invoiced.errors import ApiError
import unittest
class TestError(unittest.TestCase):
def test_error(self):
error = ApiError("ERROR!", 500)
self.assertEqual("(500): ERROR!", str(error))
| Invoiced/invoiced-python | invoiced/test/test_error.py | Python | mit | 212 |
# Empty init file
| Rfam/rfam-production | tests/__init__.py | Python | apache-2.0 | 18 |
#!/usr/bin/env python
# coding: utf-8
#
# Usage: python -matx screenrecord -o out.avi
import os
import time
import traceback
import cv2
import numpy as np
from atx.adbkit.client import Client
from atx.adbkit.device import Device
from atx.adbkit.mixins import MinicapStreamMixin, RotationWatcherMixin
cl... | codeskyblue/AutomatorX | atx/cmds/screenrecord.py | Python | apache-2.0 | 2,858 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-04 15:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0015_auto_20161202_1807'),
]
operations = [
migrations.AddField(
... | bomjacob/htxaarhuslan | main/migrations/0016_auto_20161204_1654.py | Python | mit | 1,048 |
"""
mbed SDK
Copyright (c) 2017-2017 ARM Limited
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 wr... | mbedmicro/mbed | storage/filesystem/littlefsv2/tests/TESTS/host_tests/unexpected_reset.py | Python | apache-2.0 | 3,118 |
# Most template tags were borrowed from django-tagging.
import django
from django.db.models import get_model
from django.template import (Library, Node, TemplateSyntaxError, Variable,
resolve_variable, VariableDoesNotExist)
from django.utils.translation import ugettext as _
from django.con... | callowayproject/django-supertagging | supertagging/templatetags/supertagging_tags.py | Python | apache-2.0 | 30,914 |
# The projects controller provides an interface for version-controlled projects
# stored on the fs as subdirectories of
# ${top_internal_dir}/projects where top_internal_dir is a variable in the
# .ini file used to launch the server.
#
# The structure of these directories is assumed to be:
# name.txt -- plain ... | mtholder/phyloplumber | phyloplumber/controllers/projects.py | Python | gpl-3.0 | 8,738 |
from ImageScripter import *
from elan.functions import Get_Device_List_Simple,Diff
from elan import *
#Past_List = ['2GIG GC3', '2GIG GC3', '2GIG GC3 (3.2 firmware)', 'Ademco VISTA-128BP,250BP,FA1660C', 'Ademco VISTA-128BPT,250BPT', 'Ademco VISTA-128FBP,250FBP', 'Bosch/Radionics D7412G,D9412G', 'DSC MAXSYS', 'DSC Powe... | kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/Pools/AddRemove/1_Count_Security_Panels.py | Python | gpl-3.0 | 2,762 |
#!/usr/bin/env python
"""This script solves the Project Euler problem "Triangle containment". The
problem is: Using triangles.txt, a 27K text file containing the co-ordinates of
one thousand "random" triangles, find the number of triangles for which the
interior contains the origin.
"""
from __future__ import divisio... | iansealy/projecteuler | 102.py | Python | gpl-3.0 | 1,166 |
from contextlib import contextmanager
from datetime import datetime
from django.db import transaction, DatabaseError
import hashlib
import time
import json
import os
from django.core import serializers
from django.conf import settings
from django.db import models
from django.db.utils import IntegrityError
if not has... | aquametalabs/django-snailtracker | django_snailtracker/helpers.py | Python | bsd-3-clause | 3,578 |
"""empty message
Revision ID: 3f56c40057b7
Revises: 2f6416a498e8
Create Date: 2016-07-08 16:39:42.230191
"""
# revision identifiers, used by Alembic.
revision = '3f56c40057b7'
down_revision = '2f6416a498e8'
from alembic import op
import sqlalchemy as sa
from sqlalchemy import String, Integer
def upgrade():
op.... | vsilent/Vision | migrations/versions/3f56c40057b7_.py | Python | gpl-2.0 | 721 |
# Python3
from solution1 import isLucky as f
qa = [
(1230, True),
(239017, False),
(134008, True),
(10, False),
(11, True),
(1010, True),
(261534, False),
(100000, False),
(999999, True),
(123321, True)
]
for *q, a in qa:
for i, e in enumerate(q):
print('input{0}: ... | RevansChen/online-judge | Codefights/arcade/intro/level-3/11.isLucky/Python/test.py | Python | mit | 552 |
from __future__ import division
from builtins import range
from past.utils import old_div
import proteus
from proteus import TimeIntegration
from proteus.mprans.cRDLS import *
from proteus.Comm import globalMax
import numpy as np
from proteus.Transport import OneLevelTransport, memory
from proteus.Transport import TC_b... | erdc/proteus | proteus/mprans/RDLS.py | Python | mit | 71,150 |
import striga
class CustomContext(striga.context):
pass
| ateska/striga2-sampleapp | app/appweb/context.py | Python | unlicense | 58 |
# This file is part of taxtastic.
#
# taxtastic 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.
#
# taxtastic is distrib... | fhcrc/taxtastic | taxtastic/subcommands/new_database.py | Python | gpl-3.0 | 3,361 |
__kupfer_name__ = _("GNU Screen")
__kupfer_sources__ = ("ScreenSessionsSource", )
__description__ = _("Active GNU Screen sessions")
__version__ = ""
__author__ = "Ulrik Sverdrup <ulrik.sverdrup@gmail.com>"
import os
from kupfer.objects import Leaf, Action, Source
from kupfer.obj.helplib import FilesystemWatchMixin
fr... | cjparsons74/Kupfer-cjparsons74 | kupfer/plugin/screen.py | Python | gpl-3.0 | 2,639 |
# Copyright 2014 Jan Decaluwe
#
# This file is part of Urubu.
#
# Urubu is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Urub... | smurfix/urubu | urubu/readers.py | Python | agpl-3.0 | 1,876 |
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2018 Gaël Écorchard <galou_breizh@yahoo.fr> *
#* ... | Fat-Zer/FreeCAD_sf_master | src/Mod/AddonManager/addonmanager_utilities.py | Python | lgpl-2.1 | 11,235 |
"""
Django settings for the project.
Generated by 'django-admin startproject' using Django 1.10.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
def g... | securedirective/django-site-template | src/system/settings/base.py | Python | mit | 4,045 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-14 13:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bus', '0004_auto_20170314_1306'),
]
operations = [
migrations.AddField(
... | warlock57/bus_reservation | bus/migrations/0005_buscompany_company_status.py | Python | mit | 520 |
#!/usr/bin/python
#
# Copyright: Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'sup... | tersmitten/ansible | lib/ansible/modules/net_tools/dnsimple.py | Python | gpl-3.0 | 12,002 |
from django.apps import AppConfig
from django.conf import settings
from .utils import get_model_class, connect_signals, connect_signals_to_related
MODEL_HISTORY_SETTINGS = getattr(settings, 'MODEL_HISTORY_SETTINGS', {})
class ModelHistoryConfig(AppConfig):
name = 'model_history'
verbose_name = 'Model Histor... | shamanis/django-model-history2 | model_history/apps.py | Python | mit | 931 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.