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 |
|---|---|---|---|---|---|
from django.contrib import admin
from .models import Report
@admin.register(Report)
class ReportAdmin(admin.ModelAdmin):
fields = ('content_type', 'content_object', 'description', 'creator')
readonly_fields = ('creator', 'content_type', 'content_object')
list_display = ('__str__', 'creator', 'created')
... | liqd/adhocracy4 | adhocracy4/reports/admin.py | Python | agpl-3.0 | 350 |
import os
import textwrap
import pytest
from mock import Mock
from conan.tools.microsoft import MSBuild, MSBuildToolchain, is_msvc, is_msvc_static_runtime
from conans.model.conf import ConfDefinition, Conf
from conans.model.env_info import EnvValues
from conans.test.utils.mocks import ConanFileMock, MockSettings, Moc... | conan-io/conan | conans/test/unittests/tools/microsoft/test_msbuild.py | Python | mit | 8,610 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals, absolute_import
from celery import Celery
# initiate logger
from celery.utils.log import get_task_logger
task_logger = get_task_logger(__name__)
from datetime import timedel... | geo-poland/frappe | frappe/celery_app.py | Python | mit | 2,371 |
"""JSON encoder extension."""
import functools
import json
from .jsonpointer import JSONPointer
class JSONEncoder(json.JSONEncoder):
"""Overloaded JSON encoder with JSONPointer support."""
def default(self, o):
"""Add JSONPointer serializing support to default json.dumps."""
if isinstance(o... | vovanbo/aiohttp_json_api | aiohttp_json_api/encoder.py | Python | mit | 500 |
import logging
from pathlib import Path
from unittest.mock import MagicMock, call
import pytest
from Elevator import resolve_input_variables, resolve_input_dimensions, resolve_output_dimensions, \
create_output_dimensions, create_output_variables, destagger_dim_name, resolve_dimensions, avoid_signed_types
from ca... | Belgingur/WrfUtils | DropDigits/test_elevator.py | Python | lgpl-3.0 | 7,646 |
# -*- coding: utf-8 -*-
################################################################################
# Copyright 2014, Distributed Meta-Analysis System
################################################################################
"""
This file provides methods for handling weighting across GCMs under
delta meth... | jrising/prospectus-tools | gcp/extract/lib/weights_vcv.py | Python | mit | 3,892 |
#parser
import sp
def ax_parser():
commentaire=sp.R(r'#.*')
blancs=sp.R(r'\s+')
nom=sp.R(r'[a-zA-Z]')
nomTas=sp.R(r'\w+')
nombre=sp.R(r'[0-9]+') / int #convertit le nombre en entier
nbVirgule=sp.R(r'[0-9]+'+'.'+'[0-9]+') /float
baliseDebutTas=sp.K(r'<')
baliseDebutCapteurs... | PowerCompost/PowerCompostSoftware | old/df_compost_mieux/sdf_ax_parser.py | Python | gpl-3.0 | 6,776 |
"Thread-safe in-memory cache backend."
import pickle
import time
from collections import OrderedDict
from threading import Lock
from django.core.cache.backends.base import DEFAULT_TIMEOUT, BaseCache
# Global in-memory store of cache data. Keyed by name, to provide
# multiple named local memory caches.
_caches = {}
_e... | wkschwartz/django | django/core/cache/backends/locmem.py | Python | bsd-3-clause | 4,161 |
from django import forms, template
from django.forms.formsets import all_valid
from django.forms.models import modelform_factory, inlineformset_factory
from django.forms.models import BaseInlineFormSet
from django.contrib.contenttypes.models import ContentType
from django.contrib.admin import widgets
from django.contri... | Shrews/PyGerrit | webapp/django/contrib/admin/options.py | Python | apache-2.0 | 34,944 |
from socket import *
# 1. 创建套接字
udpSocket = socket(AF_INET, SOCK_DGRAM)
# 2. 绑定本地的相关信息
bindAddress = ('', 7788) # ip地址和端口号,ip一般不用写,表示本机的任何一个ip
udpSocket.bind(bindAddress)
num = 1
while True:
# 3. 等待接收对方发送的数据
receiveData = udpSocket.recvfrom(1024) # 1024表示本次接收的最大字节数
# 4. 将接收到的数据再发送给对方
udpSocket.sen... | Ztiany/CodeRepository | Python/Python3-Base/13_Network/UDP/UDPServer.py | Python | apache-2.0 | 708 |
from qgis.PyQt.QtWidgets import QApplication, QPushButton, QLabel, QWidget, QVBoxLayout
from qgis.PyQt.QtCore import Qt
class AuthWidget(QWidget):
def __init__(self):
super().__init__()
self.btn = QPushButton("Launch")
self.lbl_expected = QLabel()
self.lbl_expected.setAlignment(Qt... | isogeo/isogeo-plugin-qgis | tests/dev/api_auth_with_qt/external_module/ui.py | Python | gpl-3.0 | 837 |
#!/usr/bin/env python
from python.decorators import euler_timer
def main(verbose=False):
destinations = {1: 1, 89: 89}
count = 1 # 89 has already been encountered
for i in range(2, 10 ** 7):
curr = i
to_add = []
while curr not in destinations:
to_add.append(curr)
... | dhermes/project-euler | python/too_slow/no092.py | Python | apache-2.0 | 688 |
# -*- coding: utf-8 *-*
from .base import RedisBase
class NumberCommands(RedisBase):
# direct number manipulation commands
def decr(self, name, amount=1):
"""
Decrements the value of ``key`` by ``amount``. If no key exists,
the value will be initialized as 0 - ``amount``
"""
... | katakumpo/niceredis | niceredis/client/number.py | Python | mit | 1,233 |
#!/usr/bin/env python
from math import pi, sin, cos, radians
import svgwrite
plate_dia = 270
hole_dia = 15
conn_dia = 10
origin_x = plate_dia + 50
origin_y = plate_dia + 50
circle_spacing = 28
# ---
plate_r = plate_dia / 2.0
hole_r = hole_dia / 2.0
conn_r = conn_dia / 2.0
def border(dwg, radius, origin_x, origin... | mayhem/led-chandelier | stand/stand-foot.py | Python | mit | 890 |
#!/usr/bin/env python
#
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Renders one or more template files using the Jinja template engine."""
import codecs
import argparse
import os
import sys
from u... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/build/android/gyp/jinja_template.py | Python | gpl-3.0 | 5,595 |
# -*- coding: utf-8 -*-
from math import cos
from math import pi
from math import sin
import timeit
#import numpy
import ctypes
import random
from sys import argv
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
global esqdir
global cimabaixo
global aux1
global aux2
global angulo
esqdir =... | diogenesfilho/Estadio | Estádio/arqAlta.py | Python | gpl-2.0 | 13,132 |
from django.conf.urls import patterns, url
import blogging.views as view
from blogging.forms import *
urlpatterns = patterns(
'',
url(r'^$', view.index, name='section-view'),
url(r'^contact/$', view.ContactUs, name='contact-us'),
url(r'^create-post/$', view.new_post, name='create-post'),
# url(r'^cr... | PirateLearner/blogging | blogging/urls.py | Python | gpl-2.0 | 1,571 |
"""
Support for Volvo heater.
This platform uses the Telldus Live online service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.volvooncall/
"""
import logging
from homeassistant.components.volvooncall import VolvoEntity, RESOURCES
from homeass... | open-homeautomation/home-assistant | homeassistant/components/switch/volvooncall.py | Python | apache-2.0 | 1,139 |
"""Support for Logi Circle sensors."""
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTRIBUTION, ATTR_BATTERY_CHARGING, CONF_ENTITY_NAMESPACE,
CONF_MONITORED_CONDITIONS, STATE_OFF, STATE_ON)
import homeassistant.help... | jamespcole/home-assistant | homeassistant/components/logi_circle/sensor.py | Python | apache-2.0 | 5,042 |
from sqlalchemy import types as sqltypes, schema, util
from sqlalchemy.sql import compiler
class MonetDDLCompiler(compiler.DDLCompiler):
def visit_create_sequence(self, create):
text = "CREATE SEQUENCE %s AS INTEGER" % \
self.preparer.format_sequence(create.element)
if create.elemen... | gijzelaerr/sqlalchemy-monetdb | sqlalchemy_monetdb/compiler.py | Python | mit | 4,443 |
#----------------------------------------------------------------------
# Copyright (c) 2011-2016 Raytheon BBN Technologies
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and/or hardware specification (the "Work") to
# deal in the Work without restriction, including ... | tcmitchell/geni-tools | src/gcf/geni/am/aggregate.py | Python | mit | 3,386 |
#-----------------------------------------------------------------------------
# ply: yacc.py
#
# Author(s): David M. Beazley (beazley@cs.uchicago.edu)
# Department of Computer Science
# University of Chicago
# Chicago, IL 60637
#
# Copyright (C) 2001-2004, David M. Beazley
#
# $Header:... | iniverno/RnR-LLC | simics-3.0-install/simics-3.0.31/scripts/yacc.py | Python | gpl-2.0 | 96,095 |
import random
import requests
EXPECTED_RESPONSE = '{"goslow": "response"}'
def main(min_status_code, max_status_code, domain):
all_status_codes = range(min_status_code, max_status_code + 1)
status_codes_to_test = [random.choice(all_status_codes) for _ in range(10)]
for status_code in status_codes_to_te... | alexandershov/goslow | deploy/check_status_code_responses.py | Python | mit | 796 |
#!/usr/bin/env python
from __future__ import print_function
import argparse
import logging
import sys
import os
from assess_bootstrap import (
prepare_temp_metadata,
)
from utility import (
add_basic_testing_arguments,
configure_logging,
JujuAssertionError,
)
from jujupy import (
client_f... | mjs/juju | acceptancetests/assess_juju_sync_tools.py | Python | agpl-3.0 | 3,070 |
from comics.aggregator.crawler import CrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Chopping Block"
language = "en"
url = "http://choppingblock.keenspot.com/"
start_date = "2000-07-25"
end_date = "2012-08-22"
active = False
rights = "L... | jodal/comics | comics/comics/choppingblock.py | Python | agpl-3.0 | 439 |
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import views as django_auth_views
from django.http import HttpResponseRedirect, HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
fr... | forallsystems/21stbadgepathways | default_site/views.py | Python | gpl-2.0 | 4,452 |
from cattle.plugins.libvirt import enabled
if enabled():
from directory_pool import DirectoryPoolDriver
from cattle.plugins.libvirt import register_pool_driver
register_pool_driver(DirectoryPoolDriver())
| cloudnautique/cloud-cattle | code/agent/src/agents/pyagent/cattle/plugins/libvirt_directory_pool/__init__.py | Python | apache-2.0 | 218 |
# J Eisenmann 2013
# jeisenma@accad.osu.edu
class Circle:
""" A simple circle class """
def __init__(self, x, y, r):
""" x,y indicate the center of the circle
r is the radius """
self.x = x
self.y = y
self.r = r
def contains(self, x, y, tol=0):
""" ... | jeisenma/ProgrammingConcepts | 11-gui/bunchOfSliders.py | Python | bsd-3-clause | 4,050 |
# Copyright 2018 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
class TestSaleStockPickingNote(common.SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner = cls.env["res.partner"].create({"nam... | OCA/sale-workflow | sale_stock_picking_note/tests/test_sale_stock_picking_note.py | Python | agpl-3.0 | 1,374 |
from termcolor import colored
class ColorPrinter:
def __init__(self, verbose = False):
self.verbose = verbose
def puts(self, text, to_print = None, to_compare = None):
if to_print == to_compare:
if self.verbose or (to_print is None and to_compare is None):
print(colored(text, 'green'))
el... | kayaman/jararaca | lib/color_printer.py | Python | mit | 361 |
from __future__ import print_function
import os
from PyQt4 import QtCore, QtGui
def viewer2svg(viewer, basepath, onlyVisible = False, moveBy = QtCore.QPointF(0.5, 0.5)):
outvec=[]
outvec.append('<?xml version="1.0" standalone="no"?>\n')
outvec.append('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"\n')
... | dstoe/vigra | vigranumpy/lib/pyqt/viewer2svg.py | Python | mit | 5,276 |
# 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, software
# distributed under the Li... | pypa/warehouse | warehouse/migrations/versions/f404a67e0370_disable_legacy_file_types_unless_a_.py | Python | apache-2.0 | 1,517 |
OS_SLUG_MAC = "mac"
OS_SLUG_LINUX = "linux"
OS_SLUG_WINDOWS = "windows"
OS_CHOICES = (
(OS_SLUG_MAC, 'Mac'),
(OS_SLUG_LINUX, 'Linux'),
(OS_SLUG_WINDOWS, 'Windows')
)
DEFAULT_ANALYSIS_RECENT_DAYS = 7
| cilcoberlin/panoptes | panoptes/settings.py | Python | bsd-3-clause | 205 |
# python imports
import warnings
# django imports
from django.db import IntegrityError
from django.db import connection
from django.db.models import Q
from django.contrib.auth.models import User
from django.contrib.auth.models import Group
from django.contrib.contenttypes.models import ContentType
from django.core.exc... | SergioDzul/django-permissions | permissions/utils.py | Python | bsd-3-clause | 20,036 |
# Copyright (c) 2016, Kevin Rodgers
# Released subject to the New BSD License
# Please see http://en.wikipedia.org/wiki/BSD_licenses
import redis
from uuid import uuid4
UUID = 'uuid'
class SimpleRedisDb(object):
def __init__(self, host, key, port=6379):
"""
:param host: database host
:p... | kfrodgers/active-mail-filter | active_mail_filter/simple_db.py | Python | bsd-2-clause | 3,390 |
import asyncio
import logging
import os
import codecs
import time
import re
import itertools
import obrbot
from obrbot import hook
from obrbot.event import EventType
plugin_info = {
"plugin_category": "core"
}
logger = logging.getLogger('obrbot')
irc_color_re = re.compile(r"(\x03(\d+,\d+|\d)|[\x0f\x02\x16\x1f])... | obrbot/bot-clean | plugins/log.py | Python | gpl-3.0 | 8,105 |
from django import template
register = template.Library()
@register.filter(name='replace')
def replace(value, arg):
replace_this,replace_with = arg.split(',')
return value.replace(replace_this,replace_with)
| vsoch/docfish | docfish/apps/base/templatetags/string_extras.py | Python | mit | 216 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/thread_executor.py | Python | bsd-3-clause | 2,164 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/models/container_service_service_principal_profile.py | Python | mit | 1,222 |
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# 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/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | Star2Billing/cdr-stats | cdr_stats/apirest/view_user.py | Python | mpl-2.0 | 1,041 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==============================================================================
# author :Ghislain Vieilledent
# email :ghislain.vieilledent@cirad.fr, ghislainv@gmail.com
# web :https://ecology.ghislainv.fr
# python_version :>=2.7
# license... | ghislainv/deforestprob | test/test_import.py | Python | gpl-3.0 | 578 |
from __future__ import absolute_import
import graph_tool.draw as gt_draw
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import seaborn.apionly as sns
import numpy as np
import pickle
import os
from scipy.spatial.distance import pdist, squareform
import sgft.temperatures as temperatures
import sgft.g... | marianotepper/sgft | sgft/test_temperatures.py | Python | mit | 3,814 |
"""
Not my work - taken from ...
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets
from sklearn.linear_model import SGDClassifier
# import some data to play with
iris = datasets.load_iris()
print iris.data.shape
print iris.target.shape
X = iris.data[:, :2] # we only... | mathandy/Classifiers2LearnWith | experiments/visualization.py | Python | mit | 1,982 |
from random import choice
import string
def GenPasswd(length=10, chars=string.letters + string.digits):
return ''.join([choice(chars) for i in range(length)]) | Ecotrust/WhereAbout | utilities/passwords.py | Python | gpl-3.0 | 163 |
from datetime import datetime
from datetime import time
from django.core.urlresolvers import NoReverseMatch
from django.template import Context
from django.template import loader
from alert.opinion_page.views import make_citation_string
class InvalidDocumentError(Exception):
"""The document could not be formed"""... | shashi792/courtlistener | alert/search/search_indexes.py | Python | agpl-3.0 | 4,089 |
"""
WSGI config for site_library 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
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "site_library.settings")
from dja... | ToxicWar/bibliotheque | site_library/wsgi.py | Python | mit | 491 |
import os
import sublime
from sublime_plugin import WindowCommand, TextCommand
from ..git_command import GitCommand
class GsAmendCommand(WindowCommand, GitCommand):
def run(self):
self.window.run_command("gs_commit", {"amend": True})
class GsQuickStageCurrentFileAndAmendCommand(GsAmendCommand, GitComm... | ddevlin/GitSavvy | core/commands/amend.py | Python | mit | 499 |
# Copyright 2011 Eldar Nugaev
# 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 ... | afrolov1/nova | nova/tests/api/openstack/compute/plugins/v3/test_keypairs.py | Python | apache-2.0 | 18,732 |
import os.path
import platform
from nose2.compat import unittest
from nose2.tests._common import FunctionalTestCase
class TestCoverage(FunctionalTestCase):
@unittest.skipIf(
platform.python_version_tuple()[:2] == ('3', '2'),
'coverage package does not support python 3.2')
def test_run(self):
... | usc-isi-i2/WEDC | spark_dependencies/python_lib/nose2/tests/functional/test_coverage.py | Python | apache-2.0 | 878 |
from common.ciphers import Cipher
from common.tools.converters import BytesToInt, IntToBytes
class PublicKeyCipher(Cipher):
def get_public_key(self):
return self.public_key
def encrypt(self, plaintext):
return self._process_with(plaintext, self._encrypt)
def decrypt(self, ci... | lukius/mts | common/ciphers/pubkey/__init__.py | Python | mit | 1,512 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | ryanss/holidays.py | test/countries/test_angola.py | Python | mit | 2,100 |
# -*- coding: utf-8 -*-
import json
import logging
import math
from functools import partial
import re
import os
import urllib2, urlparse, urllib, requests
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.http imp... | kmoocdev2/edx-platform | cms/djangoapps/contentstore/views/assets.py | Python | agpl-3.0 | 45,505 |
"""
A set of utilities for making velocity plots.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from .general import Plot
from .utils import get_nrows_ncols
from ..data.atomic import AtomDat
from ..data.spectral import Absorber
from ..modeling.vpfit... | cwfinn/igmtools | igmtools/plot/velplot_utils.py | Python | bsd-3-clause | 26,932 |
# Copyright (C) 2015 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be u... | mulkieran/storage_alerts | storage_alerts/sources/generic/by_line/recognizers.py | Python | gpl-2.0 | 4,942 |
#!/usr/bin/env python
"""
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");... | arenadata/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HIVE/package/scripts/mysql_server.py | Python | apache-2.0 | 1,792 |
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatib... | MOA-2011/e2openplugin-OpenWebif | plugin/controllers/views/mobile/screenshot.py | Python | gpl-2.0 | 8,018 |
# coding: utf-8
#
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | brianrodri/oppia | core/controllers/recent_commits_test.py | Python | apache-2.0 | 6,058 |
from django.conf.urls.defaults import url, patterns, include
urlpatterns = patterns('',
url(r'^shop/', include('shop.urls')),
)
| philippeowagner/django-shop-viveum | tests/testapp/urls.py | Python | bsd-3-clause | 134 |
from django.conf.urls import include, url
from django.contrib import admin
from . import views
urlpatterns = [
url(r'^$', views.ViewView.as_view(), name='profile_own_view'),
url(r'^edit/', views.EditView.as_view(), name='profile_edit'),
url(r'^view/$', views.ViewView.as_view(), name='profile_own_view'),
... | DeWaster/Tviserrys | user_profile/urls.py | Python | mit | 674 |
# engine/interfaces.py
# Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Define core interfaces used by the engine system."""
from .. import util
#... | Haynie-Research-and-Development/jarvis | deps/lib/python3.4/site-packages/sqlalchemy/engine/interfaces.py | Python | gpl-2.0 | 41,201 |
from django.http import HttpResponse
from core.services import CartolafcAPIClient
def index(request):
return HttpResponse('Index')
def clubes(request):
client = CartolafcAPIClient()
clube_list = client.clubes()
return HttpResponse(', '.join([clube.abreviacao for clube in clube_list]))
| schiller/cartolafc | core/views.py | Python | mit | 307 |
from delegate.geni.v3.rspecs.parser_base import ParserBase
from delegate.geni.v3.rspecs.commons_tn import Node, Interface
from delegate.geni.v3.rspecs.commons_se import SELink
class SERMv3AdvertisementParser(ParserBase):
def __init__(self, from_file=None, from_string=None):
super(SERMv3AdvertisementParser... | dana-i2cat/felix | modules/resource/manager/stitching-entity/src/delegate/geni/v3/rspecs/serm/advertisement_parser.py | Python | apache-2.0 | 2,099 |
"""cyme.branch.intsup
- Internal supervisor used to ensure our threads are still running.
"""
from __future__ import absolute_import, with_statement
from os import _exit
from time import sleep
from cell.g import Event
from .thread import gThread
SUP_ERROR_NOT_STARTED = """\
found thread not able to start?\
"""
... | celery/cyme | cyme/branch/intsup.py | Python | bsd-3-clause | 1,798 |
# import_export_batches/controllers.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import BatchManager, BatchDescription, BatchHeaderMap, BatchRow, BatchRowActionOrganization, \
BatchRowActionMeasure, BatchRowActionElectedOffice, BatchRowActionContestOffice, BatchRowActionPolitician,... | wevote/WeVoteServer | import_export_batches/controllers.py | Python | mit | 317,173 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Subscriber.organization'
db.alter_column(u'accounting_subscriber', 'organization', self.... | puttarajubr/commcare-hq | corehq/apps/accounting/migrations/0014_auto__chg_field_subscriber_organization__chg_field_subscriber_domain.py | Python | bsd-3-clause | 18,509 |
# -*- coding: UTF-8 -*-
"""Store Events for MDES in an ordered manner."""
import bisect
from mdes.queue import BaseQueue
class EventQueue(BaseQueue):
"""Stores and manages Events."""
def add(self, event):
"""Insert Event in Queue, maintain ordered state."""
bisect.insort_right(self._queue, eve... | panagiks/MDES | mdes/event_queue.py | Python | mit | 324 |
#=========================================================================
# visitors.py
#=========================================================================
from __future__ import print_function
import ast, _ast
import re
import warnings
from ..ast_helpers import get_closure_dict, print_simple_ast
fro... | Abhinav117/pymtl | pymtl/tools/translation/visitors.py | Python | bsd-3-clause | 29,868 |
#!/usr/bin/env python2.6
"""
This is a Python version of the ForestMoon Dynamixel library originally
written in C# by Scott Ferguson.
The Python version was created by Patrick Goebel (mailto:patrick@pirobot.org)
for the Pi Robot Project which lives at http://www.pirobot.org.
The original license for the C#... | booi/aracna | RobotPi/dynamixel.py | Python | gpl-3.0 | 18,730 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os, sys
import time
import uuid
import win32api
import win32con
import win32gui
import win32console
import win32gui
from winsys import core, registry
def set_console_title(text):
title = win32console.GetConsoleTitle()
win32console.SetCon... | operepo/ope | laptop_credential/winsys/misc.py | Python | mit | 1,023 |
# This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
#
# MAUS 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... | mice-software/maus | tests/integration/test_simulation/test_tof/config.py | Python | gpl-3.0 | 1,865 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This module was created to generate a Go file with random key parameters."""
from __future__ import print_function
from random import randint, seed
import argparse
import os
TEMPLATE = """package config
// passwordKey returns the shared secret used to encrypt and de... | rafaeljusto/toglacier | internal/config/encpass_key_generator.py | Python | mit | 2,180 |
import logging, openravepy, prpy
from prpy.action import ActionMethod
from prpy.util import FindCatkinResource, GetPointFrom
import numpy, time
logger = logging.getLogger('herbpy')
@ActionMethod
def PointAt(robot, focus, manip=None, render=False):
"""
@param robot The robot performing the point
@param foc... | personalrobotics/herbpy | src/herbpy/action/rogue.py | Python | bsd-3-clause | 12,032 |
from django.apps import AppConfig
class PmConfig(AppConfig):
name = 'pm'
| tizianasellitto/personalmanager | pm/apps.py | Python | gpl-3.0 | 79 |
import unittest
from whoosh import index, spelling
from whoosh.filedb.filestore import RamStorage
class TestSpelling(unittest.TestCase):
def test_spelling(self):
st = RamStorage()
sp = spelling.SpellChecker(st, mingram=2)
wordlist = ["render", "animation", "animate", "sh... | jerem/Whoosh | tests/test_spelling.py | Python | apache-2.0 | 1,222 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- http://www.mdanalysis.org
# Copyright (c) 2006-2016 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
... | kain88-de/mdanalysis | testsuite/MDAnalysisTests/test_log.py | Python | gpl-2.0 | 7,911 |
# Copyright (C) 2008, One Laptop Per Child
# Copyright (C) 2009, Tomeu Vizoso
#
# 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 v... | rparrapy/sugar | extensions/cpsection/updater/view.py | Python | gpl-2.0 | 16,181 |
import datetime
import feedparser
from django.template.loader import render_to_string
from django.utils.timezone import make_aware, utc
from boxes.models import Box
from .models import BlogEntry
def get_all_entries(feed_url):
""" Retrieve all entries from a feed URL """
d = feedparser.parse(feed_url)
en... | fe11x/pythondotorg | blogs/parser.py | Python | apache-2.0 | 1,191 |
# Copyright 2008 Google 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 agreed to in writing, ... | nicko96/Chrome-Infra | appengine/chromium_rietveld/codereview/feeds.py | Python | bsd-3-clause | 5,680 |
# -*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.mail import send_mail
from django.contrib.auth import get_user_model
from django.conf import settings
from django.db.models import Q
from .models import Class, CourseStudent
import logging
logger ... | hacklabr/timtec | core/forms.py | Python | agpl-3.0 | 2,866 |
from rpython.annotator.policy import AnnotatorPolicy
from rpython.jit.tl import tiny1
from rpython.jit.backend.hlinfo import highleveljitinfo
def entry_point(args):
"""Main entry point of the stand-alone executable:
takes a list of strings and returns the exit code.
"""
# store args[0] in a place wher... | oblique-labs/pyVM | rpython/jit/tl/targettiny1.py | Python | mit | 760 |
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def compile_fn(api, checkout_root, out_dir):
flutter_dir = checkout_root.join('src')
configuration = api.vars.builder_cfg.get('configuration').lower()... | Hikari-no-Tenshi/android_external_skia | infra/bots/recipe_modules/build/flutter.py | Python | bsd-3-clause | 1,282 |
# 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, software
# distributed under the ... | mikalstill/nova | nova/tests/unit/compute/test_provider_tree.py | Python | apache-2.0 | 27,028 |
from .testutils import FullStackTests
from webrecorder.apiutils import wr_api_spec
import json
from mock import patch
import re
# ============================================================================
class TestApiUserLogin(FullStackTests):
val_reg = ''
def test_api_curr_user_temp_info(self):
... | webrecorder/webrecorder | webrecorder/test/test_api_user_login.py | Python | apache-2.0 | 20,663 |
#coding=utf8
from __future__ import unicode_literals
"""
This config will be used for parm project settings.
You can change them to fit your needs.
"""
#available plugins
plugins = []
#encoding of md file
encoding = 'utf8'
# The suffix of source filenames.
source_suffix = ['.md', '.markdown']
#template setttings
t... | uliwebext/uliweb-peafowl | docs/conf.py | Python | bsd-2-clause | 3,895 |
from PIL import ImageFilter, ImageStat, Image, ImageDraw
from multiprocessing import Pool, cpu_count
from sklearn.preprocessing import LabelEncoder
import pandas as pd
import numpy as np
import glob
import cv2
import processing_images
from keras.wrappers.scikit_learn import KerasClassifier
from keras.models import Seq... | sarmstr5/kaggle_intel_mobleODT_cervix_classification | src/starting_with_keras.py | Python | mit | 5,420 |
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
# Copyright 2018 Simone Rubino - Agile Business Group
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models
class QcTrigger(models.Model):
_inherit = "qc.trigger"
picking_type_id = fields.Many2one(
como... | OCA/manufacture | quality_control_stock_oca/models/qc_trigger.py | Python | agpl-3.0 | 391 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-25 20:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('customer_finance', '0004_auto_20170721_1848'),
]
ope... | michealcarrerweb/LHVent_app | customer_finance/migrations/0005_auto_20170725_2010.py | Python | mit | 588 |
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The facts class for vyos
this file validates each subset of facts and selectively
calls the appropriate facts gathering function
"""
from __future__ import absolute_import, division, print_functio... | thaim/ansible | lib/ansible/module_utils/network/vyos/facts/facts.py | Python | mit | 2,271 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libapreq2(AutotoolsPackage):
"""httpd-apreq is subproject of the Apache HTTP Server Projec... | LLNL/spack | var/spack/repos/builtin/packages/libapreq2/package.py | Python | lgpl-2.1 | 1,039 |
#
# Copyright (c) 2013-2015, Scott J Maddox
#
# This file is part of openbandparams.
#
# openbandparams 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
# ... | scott-maddox/openbandparams | src/openbandparams/iii_v_zinc_blende_binary.py | Python | agpl-3.0 | 1,531 |
#
# [The "BSD license"]
# Copyright (c) 2012 Terence Parr
# Copyright (c) 2012 Sam Harwell
# Copyright (c) 2014 Eric Vergnaud
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redis... | sidhart/antlr4 | runtime/Python2/src/antlr4/error/DiagnosticErrorListener.py | Python | bsd-3-clause | 5,634 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | dhalleine/tensorflow | tensorflow/contrib/learn/python/learn/models.py | Python | apache-2.0 | 17,582 |
from cadnano.gui.views.styles import *
from PyQt5.QtGui import QColor, QFont, QFontMetricsF
# Path Sizing
VIRTUALHELIXHANDLEITEM_RADIUS = 30
VIRTUALHELIXHANDLEITEM_STROKE_WIDTH = 2
PATH_BASE_WIDTH = 20 # used to size bases (grid squares, handles, etc)
PATH_HELIX_HEIGHT = 2 * PATH_BASE_WIDTH # staple + scaffold
PATH_... | amylittleyang/OtraCAD | cadnano25/cadnano/gui/views/pathview/pathstyles.py | Python | mit | 4,318 |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
import tempfile
import unittest
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from youtube_dl.utils import YoutubeDLCookieJar
class TestYoutubeDLCookieJar(unittest.TestCase... | vinegret/youtube-dl | test/test_YoutubeDLCookieJar.py | Python | unlicense | 1,936 |
import _plotly_utils.basevalidators
class CustomdataValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="customdata", parent_name="scatter3d", **kwargs):
super(CustomdataValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_na... | plotly/python-api | packages/python/plotly/plotly/validators/scatter3d/_customdata.py | Python | mit | 455 |
# ################################################################
#
# Active Particles on Curved Spaces (APCS)
#
# Author: Silke Henkes
#
# ICSMB, Department of Physics
# University of Aberdeen
# Author: Rastko Sknepnek
#
# Division of Physics
# School of Engineering, Physics and Mathem... | sknepneklab/SAMoS | analysis/batch_nematic/batch_analyze_nematic_R30b.py | Python | gpl-3.0 | 2,506 |
from bitmovin.resources.models import RotateFilter
from ..rest_service import RestService
class Rotate(RestService):
BASE_ENDPOINT_URL = 'encoding/filters/rotate'
def __init__(self, http_client):
super().__init__(http_client=http_client, relative_url=self.BASE_ENDPOINT_URL, class_=RotateFilter)
| bitmovin/bitmovin-python | bitmovin/services/filters/rotate_filter_service.py | Python | unlicense | 315 |
#
# Copyright (C) 2006-2008 Red Hat, Inc.
# Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (a... | dumbbell/virt-manager | src/virtManager/details.py | Python | gpl-2.0 | 129,288 |
from django.shortcuts import render, HttpResponseRedirect, redirect
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import CreateView
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django.forms.models import inlineformset_... | MrCrawdaddy/humans | profiles/views.py | Python | mit | 2,056 |
# coding=utf-8
__author__ = 'mlaptev'
def update_dictionary(d, key, value):
"""
>>> d = {}
>>> update_dictionary(d, 1, -1)
>>> d
{2: [-1]}
>>> update_dictionary(d, 2, -2)
>>> d
{2: [-1, -2]}
>>> update_dictionary(d, 1, -3)
>>> d
{2: [-1, -2, -3]}
"""
if key in d:
... | MikeLaptev/sandbox_python | stepic/python_basic/module3/Module3Lesson2Step5.py | Python | apache-2.0 | 512 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.