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 |
|---|---|---|---|---|---|
#!usr/bin/python
import socket
def main():
TCP_IP = ''
TCP_PORT = 5009
BUFFER_SIZE = 20 # Normally 1024, but we want fast response
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((TCP_IP, TCP_PORT))
s.listen(1)
conn, addr = s.accept()
print 'Connection address:', addr
... | MichaelCoughlinAN/Odds-N-Ends | Python/device_discovery.py | Python | gpl-3.0 | 528 |
# Authors: Robert Luke <mail@robertluke.net>
# Frank Fishburn
#
# License: BSD (3-clause)
import numpy as np
from ... import pick_types
from ...io import BaseRaw
from ...utils import _validate_type
from ...io.pick import _picks_to_idx
def temporal_derivative_distribution_repair(raw):
"""Apply temporal... | olafhauk/mne-python | mne/preprocessing/nirs/_tddr.py | Python | bsd-3-clause | 4,673 |
# -*- coding: utf-8 -*-
import pytest
from boussole.exceptions import SettingsInvalidError
from boussole.conf.post_processor import SettingsPostProcessor
def test_001_success(settings):
"""
Validate required value on dummy value
"""
processor = SettingsPostProcessor()
result = processor._validat... | sveetch/boussole | tests/050_conf/004_postprocessor/004_required.py | Python | mit | 855 |
#
# templatetags/kwacros.py - Support for macros in Django templates
#
# Based on snippet by
# Author: Michal Ludvig <michal@logix.cz>
# http://www.logix.cz/michal
#
# modified for args and kwargs by Skylar Saveland http://skyl.org
#
"""
Usage example:
0) Save this file as <yourapp>/templatetags/kwacros.py
... | muslih/alfanous | src/alfanous-django/wui/templatetags/kwacros.py | Python | agpl-3.0 | 6,082 |
import uuid
from flask import Flask
from flask import (
request,
make_response,
render_template,
jsonify,
)
app = Flask(__name__)
counts = {}
@app.route('/')
def index():
user_id = request.cookies.get('uuid')
response = make_response(render_template(
'top.html',
count=count... | IGGG/shake-it | shake_it.py | Python | mit | 1,014 |
__author__ = 'dudevil'
import pickle
import functools
import operator
import numpy as np
import pandas as pd
import theano
import theano.tensor as T
from importlib import import_module
from theano.tensor.nnet import conv
from sklearn.metrics import confusion_matrix
import lasagne
def load_config(file):
model = im... | brotherofken/national_data_science_bowl_2 | theano/utils.py | Python | mit | 9,222 |
"""
sentry.testutils.cases
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
__all__ = (
'TestCase', 'TransactionTestCase', 'APITestCase', 'AuthProviderTestCase',
'RuleTest... | imankulov/sentry | src/sentry/testutils/cases.py | Python | bsd-3-clause | 11,244 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-02-06 16:27
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... | tiregram/Boufix | snackix/migrations/0001_initial.py | Python | agpl-3.0 | 2,164 |
import _plotly_utils.basevalidators
class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="templateitemname",
parent_name="layout.ternary.caxis.tickformatstop",
**kwargs
):
super(TemplateitemnameValidator, self)._... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/caxis/tickformatstop/_templateitemname.py | Python | mit | 534 |
# -*- coding: utf-8 -*-
"""
Train, test, predict steps for a CRF model
- CRF model is EdgeFeatureGraphCRF (unary and pairwise potentials)
- Train using SSM
- Predict using AD3
Copyright Xerox(C) 2016 JL. Meunier
Developed for the EU project READ. The READ project has received fun... | Transkribus/TranskribusDU | TranskribusDU/crf/Model_SSVM_AD3.py | Python | bsd-3-clause | 24,567 |
# 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 use ... | ollie314/kafka | tests/kafkatest/version.py | Python | apache-2.0 | 3,362 |
# -*- coding: utf-8 -*-
"""
Reegis hp main app.
"""
import pandas as pd
import logging
# from matplotlib import pyplot as plt
# Default logger of oemof
from oemof.tools import logger
from oemof.tools import helpers
# import oemof base classes to create energy system objects
import oemof.solph as solph
import reegis_h... | rl-institut/reegis_hp | reegis_hp/berlin_hp/main.py | Python | gpl-3.0 | 9,993 |
__author__ = 'Storm Shadow'
| techbliss/Python_editor | 7.0/plugins/Code editor/__init__.py | Python | unlicense | 28 |
# ==============================================================================
# Copyright (C) 2011 Diego Duclos
# Copyright (C) 2011-2018 Anton Vorobyov
#
# This file is part of Eos.
#
# Eos is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as publi... | pyfa-org/eos | tests/integration/calculator/similar_mods/test_python.py | Python | lgpl-3.0 | 5,811 |
## This file is part of conftron.
##
## Copyright (C) 2011 Matt Peddie <peddie@jobyenergy.com>
##
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (a... | peddie/conftron | settings.py | Python | gpl-2.0 | 8,250 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
from .core import Locker # NOQA
| nens/turn | turn/__init__.py | Python | gpl-3.0 | 116 |
class KeyValue(object):
def __init__(self, keyvalue):
self._pb_kv = keyvalue
@property
def key(self):
"key in bytes. An empty key is not allowed."
return self._pb_kv.key
@property
def create_revision(self):
"revision of the last creation on the key."
retu... | tjpumis/alchemy | asyncetcd/asyncetcd/model.py | Python | gpl-3.0 | 906 |
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import json
from django.contrib.gis.geos import Point
from django.test.client import RequestFactory
from manage_treemap.views.udf import (udf_list, udf_create, udf_delete,
... | maurizi/otm-core | opentreemap/manage_treemap/tests/test_udf.py | Python | agpl-3.0 | 8,665 |
import logging
import pika
from queue import Queue
class Rabbit:
def __init__(self):
self.host = "localhost"
self._queues = []
self._connected = False
self._configure_pika_logging()
def make_queue(self):
self.connect()
queue = Queue(self)
self._queues... | wconrad/rabbit_droppings | tests/captive_rabbit/rabbit.py | Python | mit | 1,158 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.conf.urls import url
from . import views
urlpatterns = [
url(
regex=r'^(?P<slug>[\w-]+)$',
view=views.ProductDetailView.as_view(),
name='detail'
), url(
regex=r'^$',
view=view... | ular/toko | toko/apps/products/urls.py | Python | mit | 379 |
# coding: utf-8
from datetime import datetime
import logging
from werkzeug import exceptions
import flask
import flask_restful
import util
class Api(flask_restful.Api):
def unauthorized(self, response):
flask.abort(401)
def handle_error(self, e):
return handle_error(e)
def handle_error(e):
logging... | gmist/ctm-5studio | main/api/helpers.py | Python | mit | 1,766 |
import logging
from bluetooth import BluetoothSocket, RFCOMM, PORT_ANY
import dbus
import select
import socket
import sys
if __name__ == "__main__":
import gi
gi.require_version('Gtk', '3.0')
from twisted.internet import gtk3reactor
gtk3reactor.install()
from twisted.internet import reactor
from tw... | gnome-keysign/gnome-keysign | keysign/bluetoothoffer.py | Python | gpl-3.0 | 6,008 |
# Copyright 2015 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 a... | dims/nova | nova/objects/request_spec.py | Python | apache-2.0 | 22,987 |
import selenium
import getpass
import time
import sys
import logging as log
import pandas as pd
from selenium import webdriver as wbd
from selenium.webdriver.common.by import By
sys.path.append('/Users/smccaffrey/Desktop/')
#from automation import test_options as prelabs
from automation import assignment_options as la... | smccaffrey/PIRT_ASU | tests/client_builds/PHY132_Fall2017/dueDates_V1.py | Python | apache-2.0 | 3,882 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "stock.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| smokingkapor/stock | manage.py | Python | mit | 248 |
# Sample extension: zoom a window to maximum height
import re
import sys
import macosxSupport
class ZoomHeight:
menudefs = [
('windows', [
('_Zoom Height', '<<zoom-height>>'),
])
]
def __init__(self, editwin):
self.editwin = editwin
def zoom_hei... | ericlink/adms-server | playframework-dist/play-1.1/python/Lib/idlelib/ZoomHeight.py | Python | mit | 1,343 |
"""setup.py: setuptools control.
Borrowed from:
https://gehrcke.de/2014/02/distributing-a-python-command-line-application/
"""
import re
from setuptools import setup
version = re.search(
"^__version__\s*=\s*\"(.*)\"",
open("bsw/__init__.py").read(),
re.M
).group(1)
with open("README.rst", "rb") a... | davb5/bsw | setup.py | Python | mit | 777 |
import random
import numpy as np
import matplotlib.pyplot as plt
xvec = {1:3, 2:2, 3:1, 4:3, 5:2, 6:1, 7:3, 8:2, 9:1}
yvec = {1:1, 2:1, 3:1, 4:2, 5:2, 6:2, 7:3, 8:3, 9:3}
neighbor = {1 : [2, 4, 1, 1], 2 : [3, 5, 1, 2], 3 : [3, 6, 2, 3],
4 : [5, 7, 4, 1], 5 : [6, 8, 4, 2], 6 : [6, 9, 5, 3],
7... | vinhqdang/my_mooc | MOOC-work/coursera/FINISHED/Statistical Mechanics Algorithms and Computations/Week 1/programs_tutorial_1/pebble_multirun_histogram.py | Python | mit | 1,093 |
# -*- coding: utf-8 -*-
from openerp import models, fields, api, _
from openerp.exceptions import UserError, ValidationError
MAP_INVOICE_TYPE_PARTNER_TYPE = {
'out_invoice': 'customer',
'out_refund': 'customer',
'in_invoice': 'supplier',
'in_refund': 'supplier',
}
# Since invoice amounts are unsigned,... | orchidinfosys/odoo | addons/account/models/account_payment.py | Python | gpl-3.0 | 24,969 |
#!/usr/bin/python
# Copyright (c) 2018 Red Hat, Inc.
# 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... | vaygr/ansible | lib/ansible/modules/net_tools/nios/nios_host_record.py | Python | gpl-3.0 | 5,979 |
from unittest import TestCase
from mock import Mock
from cloudshell.cp.openstack.domain.services.nova.nova_instance_service import NovaInstanceService
import cloudshell.cp.openstack.domain.services.nova.nova_instance_service as test_nova_instance_service
from cloudshell.cp.openstack.common.driver_helper import Cloudsh... | QualiSystems/OpenStack-Shell | package/tests/test_cp/test_openstack/test_domain/test_services/test_nova/test_nova_instance_service.py | Python | isc | 27,295 |
# ***************************************************************************
# * Copyright (c) 2016 GigaSpaces Technologies Ltd. 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 ... | cloudify-cosmo/cloudify-manager | tests/integration_tests/resources/dsl/plugin_tests/plugins/mock-plugin/mock_plugin/ops.py | Python | apache-2.0 | 940 |
from restservice.models import RestService
def call_service(parsed_instance):
# lookup service
instance = parsed_instance.instance
services = RestService.objects.filter(xform=instance.xform)
# call service send with url and instance id
for sv in services:
service = sv.get_service_definition... | eHealthAfrica/formhub | restservice/utils.py | Python | bsd-2-clause | 385 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from app_administrativo.monitor.views import *
urlpatterns = [
url(r'^$', MonitorListView.as_view(), name=u'monitor_home'),
url(r'^cadastar/$', MonitorFormView.as_view(), name=u'mon... | dparaujo/projeto | app_administrativo/monitor/urls.py | Python | gpl-3.0 | 882 |
#!/usr/bin/python
import scipy.stats as ss
import scipy as sp
import numpy as np
import sys
import os
import math
#from StringIO import StringIO
#http://stackoverflow.com/questions/2896179/fitting-a-gamma-distribution-with-python-scipy
#http://pingswept.org/2009/01/24/least-squares-polynomial-fitting-in-python/
#sys... | sauloal/pythonscripts | poly.py | Python | mit | 8,377 |
import os
import django
from django.conf import global_settings
WAGTAIL_ROOT = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(WAGTAIL_ROOT, 'test-static')
MEDIA_ROOT = os.path.join(WAGTAIL_ROOT, 'test-media')
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backen... | timheap/wagtail | wagtail/tests/settings.py | Python | bsd-3-clause | 3,975 |
# _ _ __ __
# __| |(_)__ _ _ _ __ _ ___ _ \ \ / /
# / _` || / _` | ' \/ _` / _ \_| ' \ V /
# \__,_|/ \__,_|_||_\__, \___(_)_||_\_/
# |__/ |___/
#
# INSECURE APPLICATION WARNING
#
# django.nV is a PURPOSELY INSECURE web-application
# meant to demonstrate Django security p... | nVisium/django.nV | taskManager/models.py | Python | gpl-2.0 | 3,195 |
#
# Ladybug: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
#
# This file is part of Ladybug.
#
# Copyright (c) 2013-2015, Chris Mackey <Chris@MackeyArchitecture.com>
# Ladybug is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | boris-p/ladybug | src/Ladybug_kWh2Wh.py | Python | gpl-3.0 | 2,252 |
"""
Healthscapes Geolytics Module
... | luisibanez/SahanaEden | modules/hs/graphics/defs.py | Python | mit | 4,862 |
#!/usr/bin/env python
__version__ = '0.9.9'
import os, sys, subprocess, hashlib
#import pythonjs
#import pythonjs.pythonjs
#import pythonjs.python_to_pythonjs
#import pythonjs.pythonjs_to_cpp
#import pythonjs.pythonjs_to_verilog
#import pythonjs.typedpython as typedpython
import tempfile
import webbrowser
GO_EXE = No... | kustomzone/Rusthon | rusthon.py | Python | bsd-3-clause | 43,818 |
from django.views.generic import ListView
from .models import Fighter
class FighterListView(ListView):
template_name = 'people/fighters.html'
model = Fighter
| mrclro/kbxrec | project/people/views.py | Python | mit | 167 |
# Copyright (C) 2007, 2009, 2010 Canonical Ltd
#
# 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 dis... | stewartsmith/bzr | bzrlib/tests/commands/test_cat.py | Python | gpl-2.0 | 1,932 |
from __future__ import absolute_import, unicode_literals
from django.views.generic import ListView, DetailView, CreateView, UpdateView,\
DeleteView
from django.urls import reverse_lazy
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from dja... | minimail/minimail | campaign_management/views.py | Python | mit | 15,428 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
import json
import sys
__version__ = '0.1.0'
def decode_switchy_omega(backup_text):
"""
:type backup_text: unicode
:rtype: unicode
"""
data = json.loads(backup_text, encoding='utf-8')
return... | calfzhou/dotfiles | switchy-sharp/clean_omega.py | Python | mit | 1,332 |
import sys
import os
import abc
from collections import deque
from mimircache.cache.abstractCache import cache
class MRU(cache):
def __init__(self, cache_size=1000):
super(MRU, self).__init__(cache_size)
self.cacheDict = dict()
self.last_element = None
def checkElement(self, element)... | Shureed/mimircache | mimircache/cache/MRU.py | Python | gpl-3.0 | 2,165 |
# This file is part of cloud-init. See LICENSE file for license information.
"""cloud-init Integration Test Verify Script."""
from tests.cloud_tests.testcases import base
class TestLxdBridge(base.CloudTestCase):
"""Test LXD module."""
@classmethod
def maybeSkipTest(cls):
"""Skip on cosmic for tw... | larsks/cloud-init | tests/cloud_tests/testcases/modules/lxd_bridge.py | Python | gpl-3.0 | 1,155 |
#!/bin/env python3
from src import core,file,tests,vigenere; from src.TWL06 import twl
import tkinter as tk
import string
import matplotlib, numpy, sys, math; matplotlib.use('TkAgg')
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
root = tk.Tk()
LOG = "log.txt"
clas... | tim-clifford/py-cipher | main.py | Python | mit | 10,926 |
"""
WSGI config for timingattack project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_... | jedie/django-timingattack-test | timingattack/wsgi.py | Python | gpl-3.0 | 401 |
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
@register.filter
def divisible_by(dividend, divisor):
"""
if 'dividend' can be *exactly* divided by 'divisor',
return True;
else, return False.
input parameters:
dividend: <type 'int'>
divisor: <class 'djan... | liweitianux/97dev | 97suifangqa/apps/utils/templatetags/divisible_by.py | Python | bsd-2-clause | 735 |
from unittest import TestCase
from hamcrest import *
from array_util import get_random_unique_array
from chapter11.textbook_problem11_5 import perfect_hashing_init, perfect_hashing_search
class TestTextbookProblem11_5(TestCase):
def test_perfect_hashing(self):
keys, _ = get_random_unique_array(max_valu... | wojtask/CormenPy | test/test_chapter11/test_textbook_problem11_5.py | Python | gpl-3.0 | 732 |
# Copyright (c) 2008-2009 The Hewlett-Packard Development Company
# Copyright (c) 2004-2006 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributi... | yohanko88/gem5-DC | src/python/m5/util/__init__.py | Python | bsd-3-clause | 6,995 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py | Python | mit | 4,985 |
import json, urllib.request
with urllib.request.urlopen('https://api.launchpad.net/1.0/ubuntu/series') as www:
dat = json.loads(www.read())
print(' '.join([e['name'] for e in dat['entries'] if e['active']]))
| TeXworks/texworks | .github/actions/package-launchpad/get-ubuntu-series.py | Python | gpl-2.0 | 210 |
# Author: Rojuienx <rojuinex@gmail.com http://github.com/rojuinex>
# Version: 0.1.0
# Date Created: December 28th, 2012
# Copyright (c) 2012, Rojuinex (See license agreement)
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Created using Sam Hocevar's <sam@hocevar.net> Leafify Script a... | Rojuinex/leafify | leafify.py | Python | bsd-2-clause | 4,283 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from io import open
import versioneer
from niftynet.utilities.versioning import get_niftynet_version
niftynet_version = get_niftynet_version()
# Get the summary
description = 'An open-source convolutional neural networks platform' + \
... | NifTK/NiftyNet | setup.py | Python | apache-2.0 | 2,262 |
"""Support for command line notification services."""
import logging
import subprocess
import voluptuous as vol
from homeassistant.const import CONF_COMMAND, CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (PLATFORM_SCHEMA,
... | MartinHjelmare/home-assistant | homeassistant/components/command_line/notify.py | Python | apache-2.0 | 1,486 |
#!/usr/bin/env python
# coding=utf-8
# Python Script
#
# Copyright © Manoel Vilela
#
#
from simulation import AntSimulation
matrix = AntSimulation.run()
print("Goodbye!") | panicstation14/ant-walking | Python/simulation/main.py | Python | mit | 176 |
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module defines the FeffInputSet abstract base class and a concrete
implementation for the Materials Project. The basic concept behind an input
set is to specify a scheme to generate a consistent set of Feff inputs fr... | vorwerkc/pymatgen | pymatgen/io/feff/sets.py | Python | mit | 19,267 |
#!/usr/bin/env python3
def maximumToys(prices, k):
count = 0
for x in sorted(prices):
if k >= x:
k -= x
count += 1
return count
print(maximumToys([1, 12, 5, 111, 200, 1000, 10], 50))
| CajetanP/coding-exercises | HackerRank/Interview/Sorting/mark_toys.py | Python | mit | 232 |
revision = '22f80ee91db'
down_revision = '5994be361ba'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('proposal',
sa.Column('cdeppk_cdep', sa.Integer(), nullable=True))
op.add_column('proposal',
sa.Column('cdeppk_senate', sa.Integer(), nullable=True))
def downgr... | mgax/mptracker | alembic/versions/22f80ee91db_cdeppk.py | Python | mit | 421 |
"""
Base class for ensemble-based estimators.
"""
# Authors: Gilles Louppe
# License: BSD 3 clause
import numpy as np
import numbers
from ..base import clone
from ..base import BaseEstimator
from ..base import MetaEstimatorMixin
from ..utils import _get_n_jobs, check_random_state
MAX_RAND_SEED = np.iinfo(np.int32).... | RomainBrault/scikit-learn | sklearn/ensemble/base.py | Python | bsd-3-clause | 5,396 |
# This file is part of beets.
# Copyright 2011, 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, ... | mclearc/beets | test/test_autotag.py | Python | mit | 26,580 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - XML Parser
This parser was tested with 4Suite 1.0a4 and 1.0b1.
What's new:
* much cleaner code
* stylesheet can be extended to support other format:
e.g. Docbook parser using docbook->html .xsl stylesheet
@copyright: 2001-2003 Jue... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/parser/text_xslt.py | Python | mit | 6,172 |
from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
urlpatterns = patterns('',
url(_(r'^register/$'), view, name='register'),
url(_(r'^register-without-slash$')... | waseem18/oh-mainline | vendor/packages/Django/tests/regressiontests/i18n/patterns/urls/namespace.py | Python | agpl-3.0 | 362 |
import sys
from time import sleep
# from user import weapon #Weapon? Gonna put that in chapter 0? # I guess I'll import it using my own method from the savegame.txt file
sys.path.insert(0, "/mnt/c/Users/James/Documents/projects/Adventure-Adventure-Adventure")
def dialog00(user):
print("--In the Sewer--")
... | KaptainKaleb/Adventure-Adventure-Adventure | chp/chp1.py | Python | mit | 602 |
# coding=utf-8
########################################################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "controller"
# The plugin's python pa... | cdalio1/octo_control | setup.py | Python | mit | 4,115 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('schedule', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='sc... | BuildmLearn/University-Campus-Portal-UCP | UCP/schedule/migrations/0002_auto_20160808_0552.py | Python | bsd-3-clause | 576 |
# -*- coding: utf-8 -*-
import boto3
import json
import ConfigParser
from time import gmtime, strftime
from searchkeyword import SearchKeyword
from slackclient import SlackClient
print('Loading function')
def lambda_handler(event, context):
print(strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()))
inifile = C... | sparkgene/lambda_twitter_search | lambda_function.py | Python | mit | 2,692 |
from lib1 import urlopen
def f(url):
'''Return the representation available at the URL.
'''
return urlopen(url).read()
def f_usage():
return f(14)
class C(object):
def g(self, x):
return x
class D(C):
def g(self, x, y):
return super(D, self).f(x) + y
class E(object):
... | idea4bsd/idea4bsd | python/testData/refactoring/move/function/before/src/a.py | Python | apache-2.0 | 353 |
import beeline
import logging
from django.conf import settings
from django.core.cache import caches
from django.shortcuts import redirect
from django.utils.deprecation import MiddlewareMixin
from openedx.core.djangoapps.appsembler.sites.models import AlternativeDomain
from openedx.core.djangoapps.appsembler.sites.uti... | appsembler/edx-platform | openedx/core/djangoapps/appsembler/sites/middleware.py | Python | agpl-3.0 | 3,023 |
# -*- coding: utf-8 -*-
import csv
import os
from collections import OrderedDict
from decimal import Decimal
import itertools
import time
import logging
from .app_conf import settings
from .utils import assert_decimal
log = logging.getLogger('pyFx')
class Open(object):
def __init__(self, strategy, price, side,... | jmelett/pyfx | trader/portfolio.py | Python | mit | 14,052 |
import superorganism.gui.interfaces
import urwid
import zope.interface
import zope.schema.interfaces
import zope.component.factory
class DialogButton(urwid.Button):
zope.interface.implements(superorganism.gui.interfaces.IButton)
def __init__(self, label, on_press=None, user_data=None):
self._label =... | romanofski/superorganism | src/superorganism/gui/widgets.py | Python | gpl-3.0 | 3,932 |
# This file is part of MDP-ProbLog.
# MDP-ProbLog 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.
# MDP-ProbLog is distributed in the... | thiagopbueno/mdp-problog | mdpproblog/value_iteration.py | Python | gpl-3.0 | 3,877 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.zone_hvac_radiative import ZoneHvacBaseboardRadiantConvectiveWater
log = logging.getLogger(__name__)
class TestZoneHvacBaseboardRadiantConvectiveWater(unittest.TestCase):
d... | rbuffat/pyidf | tests/test_zonehvacbaseboardradiantconvectivewater.py | Python | apache-2.0 | 5,414 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import g, session
from werkzeug.exceptions import Forbidden
from indico.core.logger import sen... | mvidalgarcia/indico | indico/legacy/services/implementation/base.py | Python | mit | 1,541 |
import colander
from pyramid import testing
from pytest import mark
from pytest import fixture
from pytest import raises
@fixture()
def integration(integration):
integration.include('adhocracy_mercator.workflows')
@mark.usefixtures('integration')
class TestIncludeme:
def test_includeme_register_title_sheet... | liqd/adhocracy3.mercator | src/adhocracy_mercator/adhocracy_mercator/sheets/test_mercator.py | Python | agpl-3.0 | 17,828 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Test Widget."""
from IPython.core.interactiveshell import InteractiveShell
from IPython.display import display
from IPython.utils.capture import capture_output
from ..widget import Widget
from ..widget_button impo... | jupyter-widgets/ipywidgets | python/ipywidgets/ipywidgets/widgets/tests/test_widget.py | Python | bsd-3-clause | 1,810 |
# Authors: Rob Crittenden <rcritten@redhat.com>
#
# Copyright (C) 2008 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 ver... | msimacek/freeipa | ipaserver/install/ldapupdate.py | Python | gpl-3.0 | 33,389 |
"""
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
from __future__ import print_function
import os
import warnings
import sys
import pkgutil
from sklearn.externals.six import PY3
fr... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/sklearn/tests/test_common.py | Python | gpl-2.0 | 8,388 |
# -*- coding: UTF8 -*-
from pupylib.PupyModule import *
import random
import pupygen
import os.path
import string
__class_name__="PersistenceModule"
class PersistenceModule(PupyModule):
""" Enables persistence via registry keys """
def init_argparse(self):
self.arg_parser = PupyArgumentParser(prog="persistence", ... | xeddmc/pupy | pupy/modules/persistence.py | Python | bsd-3-clause | 1,603 |
"""
Small utility functions
=======================
"""
import collections
def ensure_list_of_str(val, tag):
"""Ensures that the given value is a list of strings
It ensures that the given value is a list of strings and return them, or
value error will be raised. If a single string is given, a singleto... | tschijnmo/GCMCbyGULP | GCMCbyGULP/utils.py | Python | mit | 1,172 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | vatt/modeling/backbones/text/linear.py | Python | apache-2.0 | 1,421 |
#!/usr/bin/env python3
import argparse
import os
import subprocess
import sys
def setup():
global args, workdir
programs = ['ruby', 'git', 'apt-cacher-ng', 'make', 'wget']
if args.kvm:
programs += ['python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker:
dockers = ['docker.io',... | monacoinproject/monacoin | contrib/gitian-build.py | Python | mit | 12,666 |
from diesel import quickstart, quickstop, sleep
from diesel.protocols.zeromq import DieselZMQSocket, zctx, zmq
import time
def handle_messages():
insock = DieselZMQSocket(zctx.socket(zmq.DEALER), bind="inproc://foo")
for x in xrange(500000):
msg = insock.recv()
assert msg == "yo dawg %s" % x
... | dieseldev/diesel | examples/zeromq_test.py | Python | bsd-3-clause | 810 |
from .base import FormattedObject, FormattedTable, Formatter
from .models import FormattedModel, FormattedModelTable
from .fields import SortFilterField
from .formatters import *
| vivsh/django-ginger | ginger/formatters/__init__.py | Python | mit | 182 |
# Copyright 2020 Makani Technologies 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... | google/makani | gs/monitor2/apps/plugins/indicators/tests/gs_test.py | Python | apache-2.0 | 2,115 |
# Copyright (C) 2008-2012 Canonical, Ltd.
#
# The following license applies to all files (including the icons):
#
# 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, version 3 of the License.
#
# T... | Snowlinux/snowupdate | janitor/__init__.py | Python | gpl-2.0 | 904 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import re
from .bag import *
from .dog import *
class Core:
origin_url = None
url_set = set([])
bag = Bag()
def __init__(self, url):
self.origin_url = url
self.bag.put(url)
def put(self, links):
... | helloqiu/silly_spider | core/core.py | Python | mit | 571 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2017 by the Free Software Foundation, Inc.
#
# This file is part of HyperKitty.
#
# HyperKitty 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... | systers/hyperkitty | hyperkitty/models/email.py | Python | gpl-3.0 | 12,750 |
# -*- coding: utf-8 -*-
#
# Pulp Documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 27 13:39:59 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All co... | mhrivnak/pulp | docs/conf.py | Python | gpl-2.0 | 9,708 |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import
# Copyright (C) 2007 Samuel Abels
#
# This library 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 2.1 of the Li... | knipknap/SpiffWorkflow | SpiffWorkflow/specs/ThreadStart.py | Python | lgpl-3.0 | 2,049 |
# -*- coding: utf-8 -*-
# Originally based on tests for samba.kcc.ldif_import_export.
# Copyright (C) Andrew Bartlett 2015, 2018
#
# by Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | kernevil/samba | python/samba/tests/samba_tool/visualize_drs.py | Python | gpl-3.0 | 28,129 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | eric-haibin-lin/mxnet | python/mxnet/contrib/onnx/onnx2mx/_translation_utils.py | Python | apache-2.0 | 9,297 |
#!/usr/bin/env python
from flask import Flask, request, send_file, Response, render_template, url_for
import os, mimetypes, re, StringIO, datetime, user_agents, yaml
from itertools import izip_longest
from bs4 import BeautifulSoup
from PIL import Image, ImageDraw, ImageFont
app = Flask(__name__)
app.config['SEND_FILE_... | GreenZapdos/reel | reel.py | Python | gpl-3.0 | 6,345 |
from spotify.models import User, FollowList
def followlist():
all_users = User.objects.all()
for user in all_users:
new_followlist = FollowList(user=user)
new_followlist.save()
| ecatkins/instabilly | project/spotify/seed_followlist.py | Python | mit | 202 |
# -*- coding: utf-8 -*-
# Brandeis - A tool to convert plaintext court cases (from the lochner
# tool: http://gitorious.org/lochner/) to wikitext.
#
# Copyright (C) 2013 Molly White
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | molly/brandeis | __init__.py | Python | gpl-3.0 | 978 |
import datetime
import time
import string
import urllib2
import math
import redis
import json
import eto
import py_cf
import os
import base64
class Sprinkler_Control():
def __init__(self,ir_ctl ):
self.system_files = ir_ctl.system_files
self.app_files = ir_ctl.app_files
... | glenn-edgar/local_scda | apps/irrigation_ctrl.py | Python | mit | 54,661 |
from django.contrib import admin
from .models import Account
# Register your models here.
admin.site.register(Account)
| tomaszzacharczuk/social-website-django-angular | social_website_django_angular/authentication/admin.py | Python | mit | 120 |
from django.core.checks import Error
from django.conf import settings
def check_login_scopes_setting(*args, **kwargs):
errors = []
try:
assert settings.LOGIN_TOKEN_SCOPES
except (AssertionError, AttributeError):
errors.append(Error('LOGIN_TOKEN_SCOPES setting cannot be blank.',
... | Kaezon/allianceauth | allianceauth/authentication/checks.py | Python | gpl-2.0 | 434 |
import pytest
from qtpy import PYQT5, PYSIDE2
@pytest.mark.skipif(not (PYQT5 or PYSIDE2), reason="Only available in Qt5 bindings")
def test_qtqml():
"""Test the qtpy.QtQml namespace"""
from qtpy import QtQml
assert QtQml.QJSEngine is not None
assert QtQml.QJSValue is not None
assert QtQml.QJSValueI... | stonebig/winpython | winpython/_vendor/qtpy/tests/test_qtqml.py | Python | mit | 1,373 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.