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 |
|---|---|---|---|---|---|
# Copyright (c) 2015 Red Hat Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | jacknjzhou/neutron | neutron/services/qos/qos_plugin.py | Python | apache-2.0 | 7,356 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | MrSenko/Nitrate | tcms/core/contrib/auth/migrations/0001_initial.py | Python | gpl-2.0 | 867 |
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
""" Karma for the Answer Tracker. """
__metaclass__ = type
__all__ = [
'assignKarmaUsingQuestionContext',
]
from lp.answers.enums import QuestionAction
from lp.registry.i... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/answers/karma.py | Python | agpl-3.0 | 3,545 |
#!/usr/bin/env python
class RequiresType(object):
"""
Checks that the first (or position given by the keyword argument 'position'
argument to the function is an instance of one of the types given in the
positional decorator arguments
"""
def __init__(self, *types, **kwargs):
self.type... | rasher/reddit-modbot | decorators.py | Python | bsd-3-clause | 921 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-12 17:15
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0060_add_nodelog_should_hide_nid_index'),
('osf', '0062_accept_preprints'),
]
... | TomBaxter/osf.io | osf/migrations/0063_merge_20171012_1215.py | Python | apache-2.0 | 343 |
# This work is licensed by James Town and ACOE Core Learning under a
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0
# International License: http://creativecommons.org/licenses/by-nc-sa/4.0/
import linkbot # loads library for the Linkbots
robot1 = linkbot.Linkbot('ABCD') #assigns the name robot1 to... | acoecorelearning/Algebra1wRobots | 4-RaceToTie2/raceToTie2.py | Python | gpl-3.0 | 884 |
"""
sentry.tagstore.v2.models.eventtag
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2017 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.db import models, router, connections
from django.utils import timezone
from... | looker/sentry | src/sentry/tagstore/v2/models/eventtag.py | Python | bsd-3-clause | 1,403 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-trip | account_trip_edi_imap/__init__.py | Python | agpl-3.0 | 974 |
# This script tests multiple simultaneous rznet connections ON SAME RZNET.
import fcntl, struct, time, socket, tty, os, select, sys, array, math
from termios import *
RZNET_IOCGNODES = 0x54E10011
def _get_nodes_list():
str_nodes = 1024 * '\0'
str_nodes = fcntl.ioctl(fd_ttyS5, RZNET_IOCGNODES, str_nodes)
nodes_t... | mcruse/monotreme-mstp | test_ioctl.py | Python | gpl-2.0 | 1,834 |
# Copyright (c) 2010-2015 openpyxl
#
# stdlib imports
from io import BytesIO
import zipfile
import pytest
# package imports
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import ExcelWriter
@pytest.mark.pil_required
def test_write_images(datadir):
datadir.chdir()
wb = Workbook()
ew =... | maheshcn/memory-usage-from-ldfile | openpyxl/writer/tests/test_drawing.py | Python | gpl-2.0 | 711 |
from setuptools import setup
# Dynamically calculate the version based on dbsettings.VERSION
version_tuple = (0, 8, 1)
if version_tuple[2] is not None:
if type(version_tuple[2]) == int:
version = "%d.%d.%s" % version_tuple
else:
version = "%d.%d_%s" % version_tuple
else:
version = "%d.%d" %... | nwaxiomatic/django-dbsettings | setup.py | Python | bsd-3-clause | 1,294 |
from __future__ import unicode_literals
import datetime
import unittest
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.loading import BaseAppCache
from django.test import TestCase
from .models import (CustomPKModel, UniqueTogetherModel, UniqueFieldsModel,
Un... | AlexHill/django | tests/validation/test_unique.py | Python | bsd-3-clause | 7,130 |
from django.dispatch import Signal
user_enrolled = Signal(providing_args=['experiment', 'alternative', 'user', 'session'])
| uhuramedia/django-experiments | experiments/signals.py | Python | mit | 124 |
# -*- coding: utf-8 -*-
"""
Display number of issues, requests and more from a GitLab project.
A token is required. See https://gitlab.com/profile/personal_access_tokens
to make one. Make a name, eg py3status, and enable api in scopes. Save.
Configuration parameters:
auth_token: specify a personal access token to... | Andrwe/py3status | py3status/modules/gitlab.py | Python | bsd-3-clause | 5,946 |
import urllib2
import locale
from django.http import QueryDict
from django.utils.http import urlencode
from mezzanine.conf import settings
from cartridge.shop.checkout import CheckoutError
PAYPAL_NVP_API_ENDPOINT_SANDBOX = 'https://api-3t.sandbox.paypal.com/nvp'
PAYPAL_NVP_API_ENDPOINT = 'https://api-3t.paypal.com/... | readevalprint/cartridge | cartridge/shop/payment/paypal.py | Python | bsd-2-clause | 11,377 |
#python
import k3d
k3d.check_node_environment(context, "MeshSourceScript")
# Construct a cube mesh primitive ...
cubes = context.output.primitives().create("cube")
matrices = cubes.topology().create("matrices", "k3d::matrix4")
materials = cubes.topology().create("materials", "k3d::imaterial*")
uniform = cubes.attribu... | barche/k3d | share/k3d/scripts/MeshSourceScript/cubes.py | Python | gpl-2.0 | 771 |
from allthepairs.combinatorics import xuniqueCombinations
class node:
def __init__(self, id):
self.id = id
self.counter = 0
self.in_ = set()
self.out = set()
def __str__(self):
return str(self.__dict__)
def key( items ):
return "->".join([x.id for x in items])
cla... | devalbo/allthepairs | allthepairs/pairs_storage.py | Python | mit | 1,515 |
########
# Copyright (c) 2015 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 the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | kemiz/cloudify-host-pool-service | setup.py | Python | apache-2.0 | 1,127 |
#
# __init__.py
#
# Package initialization
#
# Copyright (C) 2012 Lukas Solanka <l.solanka@sms.ed.ac.uk>
#
# 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, eit... | MattNolanLab/ei-attractor | grid_cell_model/submitting/__init__.py | Python | gpl-3.0 | 882 |
# encoding: utf-8
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobilit... | datanel/navitia | source/jormungandr/jormungandr/__init__.py | Python | agpl-3.0 | 2,884 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LrsPlugin
A QGIS plugin
Linear reference system builder and editor
-------------------
begin : 2013-10-02
copyright ... | blazek/lrs | lrs/ui/lrscombomanagerbase.py | Python | gpl-2.0 | 5,538 |
# -*- coding: utf-8 -*-
'''dLeyna Media Device mock template'''
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option) any
# later version. ... | jasuarez/grilo-plugins | tests/dleyna/dbusmock/dleynamediadevice.py | Python | lgpl-2.1 | 5,436 |
"""
Module containing NRML 0.3 constants and utility methods.
"""
from lxml import etree
import numpy
from openquake.hazardlib.geo import Point
from oqtoolsui.converters import gml
NRML03_NS = 'http://openquake.org/xmlns/nrml/0.3'
NRML03 = '{%s}' % NRML03_NS
NRML03_AREA_SOURCE = etree.QName(NRML03_NS, 'areaSource')
NR... | ocozalp/OQToolsUI | oqtoolsui/converters/nrml03.py | Python | agpl-3.0 | 9,117 |
#!/usr/bin/env python
import subprocess
def main():
"""Test subprocess."""
cmd_list = ['/bin/df', '-h']
proc = subprocess.Popen(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(std_out, std_err) = proc.communicate()
print
print std_err
print std_out
print
if __name__ == "__ma... | wjohnston888/pynet_test- | subprocess_test.py | Python | apache-2.0 | 338 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
import httplib2
import urllib
import time
import traceback
def main():
module = AnsibleModule(
argument_spec = dict(
base_url = dict(required = True),
path = dict(default = ''),
login_path = dict(default = ''),
login_method = dict(default = 'POST'),
logi... | touchhealth/ansible-base | library/invoke_url.py | Python | apache-2.0 | 2,409 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class X(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "isosurface.caps"
_path_str = "isosurface.caps.x"
_valid_props = {"fill", "show"}
# fill
... | plotly/python-api | packages/python/plotly/plotly/graph_objs/isosurface/caps/_x.py | Python | mit | 4,641 |
#import unittest
import mt
import queue
import _thread
import time
class DummySocket:
def __init__(self, ID):
self.id = ID
self.lastMsg = ""
def send(self, msg):
print(self.id+":",msg)
self.lastMsg = msg
def close(self):
print(self.id+": CLOSE CALLED")
self... | Griffiths117/TG-s-IRC | server/mtUnitTests.py | Python | mit | 1,945 |
# ==================================================================================================
# Copyright 2012 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | foursquare/commons-old | src/python/twitter/pants/tasks/ide_gen.py | Python | apache-2.0 | 20,124 |
# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 9
_modified_time = 1382819994.486941
_enable_loop = True
_template_filename = u'/home/ali/BLOG/VENV/local/lib/python2.7/site-packages/nikola/data/themes/bas... | apjd/wwwapjd | cache/.mako.tmp/tags.tmpl.py | Python | mit | 3,793 |
#!/usr/bin/env python
from __future__ import print_function
import re
import numpy as np
import numpy.testing as npt
import logging
logging.basicConfig(level=logging.DEBUG)
import unittest
# import the module
import tomographer.tools.densedm
import tomographer.tools.densedm.mle
import tomographer
import tomographe... | Tomographer/tomographer | test/pytest_t_tools_densedm.py | Python | mit | 1,933 |
# Copyright (c) 2008 Mikeal Rogers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | nanolearning/edx-platform | common/djangoapps/edxmako/middleware.py | Python | agpl-3.0 | 972 |
from setuptools import setup, find_packages
with open('requirements.txt') as fd:
setup(name='kiwi',
version='1',
packages=find_packages(),
install_requires=fd.readlines(),
entry_points={
'console_scripts': [
'kiwi = kiwi.main:main',
... | fcantournet/kiwi | setup.py | Python | apache-2.0 | 351 |
"""
`GrammarLexer` is compatible with Pygments lexers and can be used to highlight
the input using a regular grammar with token annotations.
"""
from __future__ import unicode_literals
from pygments.token import Token
from prompt_toolkit.layout.lexers import Lexer
from .compiler import _CompiledGrammar
__all__ = (
... | niklasf/python-prompt-toolkit | prompt_toolkit/contrib/regular_languages/lexer.py | Python | bsd-3-clause | 2,621 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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... | jainaman224/zenodo | zenodo/modules/deposit/minters.py | Python | gpl-2.0 | 2,471 |
#
# Manually written part of python bindings for libvirt
#
# On cygwin, the DLL is called cygvirtmod.dll
try:
import libvirtmod
except ImportError, lib_e:
try:
import cygvirtmod as libvirtmod
except ImportError, cyg_e:
if str(cyg_e).count("No module named"):
raise lib_e
import ... | iam-TJ/libvirt | python/libvirt-override.py | Python | lgpl-2.1 | 6,185 |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# 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... | sidzan/netforce | netforce_terminal/netforce_terminal/message.py | Python | mit | 1,913 |
from __future__ import annotations
from setuptools import Extension
from setuptools import setup
setup(
name='multidir',
ext_modules=[
Extension(
'multidir', ['dir1/sum.go', 'dir2/sum_support.go'],
),
],
build_golang={'root': 'github.com/asottile/fake'},
# Would do thi... | asottile/setuptools-golang | testing/multidir/setup.py | Python | mit | 524 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from core.views import index, space, signout, signin, register, edit_user, new_message, delete_message, new_space, \
edit_space, \
delete_space, archive_space, add_collaborators, activate, recover_password, new_password, edit_rights
urlpatterns = [
... | lucekdudek/embigo | core/urls.py | Python | gpl-2.0 | 1,572 |
from setuptools import setup, find_packages
__version__ = '0.0.1'
setup(
name='spotiplay',
version=__version__,
description='Spotify rooms.',
long_description='https://github.com/jaruserickson/spotiplay',
url='https://github.com/jaruserickson/spotiplay',
download_url='https://pypi.python.org/p... | jaruserickson/spotiplay | setup.py | Python | mit | 1,321 |
# mysql/oursql.py
# Copyright (C) 2005-2018 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
"""
.. dialect:: mysql+oursql
:name: OurSQL
:dbapi: oursql
:connectstri... | fernandog/Medusa | ext/sqlalchemy/dialects/mysql/oursql.py | Python | gpl-3.0 | 7,776 |
#!/usr/bin/env python
import os, sys
usage = "usage: %s [infile [outfile]]" % os.path.basename(sys.argv[0])
if len(sys.argv) < 1:
print (usage)
else:
stext = "<insert_a_suppression_name_here>"
rtext = "memcheck problem #"
input = sys.stdin
output = sys.stdout
hit = 0
if len(sys.argv) > 1:
... | lubosz/gst-plugins-vr | valgrind_helpers/valgrind-make-fix-list.py | Python | lgpl-2.1 | 628 |
"""Global test fixtures."""
import uuid
import pytest
from s3keyring.s3 import S3Keyring
from s3keyring.settings import config
from keyring.errors import PasswordDeleteError
@pytest.fixture
def keyring(scope="module"):
config.boto_config.activate_profile("test")
return S3Keyring()
@pytest.yield_fixture
d... | InnovativeTravel/s3-keyring | tests/conftest.py | Python | mit | 714 |
"""PyPI and direct package downloading"""
import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO
import httplib, urllib
from pkg_resources import *
from distutils import log
from distutils.errors import DistutilsError
try:
from hashlib import md5
except ImportError:
from md5 import md5
fr... | igoralmeida/tahoe-lafs | setuptools-0.6c16dev6.egg/setuptools/package_index.py | Python | gpl-2.0 | 29,330 |
from django.db import models
import uuid
# Create your models here.
class Archetype(models.Model):
'''
Les archétypes sont des ossatures d'attributs, compétences,
équipement, et autres renseignements qui sont stockés
en listes de longueurs variables dans des champs
thém... | sighill/shade_app | arach/models.py | Python | mit | 1,804 |
'''
Created on 2014-6-25
@author: xiajie
'''
| jayshonzs/ESL | ModelAssessmentAndSelection/BIC.py | Python | mit | 46 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
################################################################################
#
# MEASURE - Master Equation Automatic Solver for Unimolecular REactions
#
# Copyright (c) 2010 by Joshua W. Allen (jwallen@mit.edu)
#
# Permission is hereby granted, free of charge, to any... | jwallen/MEASURE | measure/network.py | Python | mit | 45,290 |
# Generated by Django 2.0.5 on 2018-06-05 09:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0014_auto_20170725_1302'),
]
operations = [
migrations.AlterField(
model_name='formfield',
name='field_type'... | UTNkar/moore | src/home/migrations/0015_auto_20180605_1111.py | Python | agpl-3.0 | 775 |
"""Parse web services description language to get SOAP methods.
Rudimentary support."""
ident = '$Id: WSDL.py,v 1.11 2005/02/21 20:16:15 warnes Exp $'
from version import __version__
import wstools
from Client import SOAPProxy, SOAPAddress
from Config import Config
import urllib
class Proxy:
"""WSDL Proxy.
... | 2ndy/RaspIM | usr/share/python-support/python-soappy/SOAPpy/WSDL.py | Python | gpl-2.0 | 4,043 |
from aiida.orm import Code, DataFactory
from aiida.orm.workflow import Workflow
from aiida.orm import load_node
from aiida.orm.calculation.inline import make_inline
StructureData = DataFactory('structure')
ParameterData = DataFactory('parameter')
ArrayData = DataFactory('array')
import numpy as np
# Create superc... | abelcarreras/aiida_extensions | workflows/old/wf_phonon_lammps.py | Python | mit | 10,231 |
# coding: utf-8
#
# Copyright 2014 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... | won0089/oppia | extensions/rules/click_on_image_test.py | Python | apache-2.0 | 1,602 |
# -*- coding: utf-8 -*-
import logging
import os
from collections import Counter, defaultdict
import arrow
from twython import Twython
from nightwatch_imax.history import get_history_list, History, save_history_list
from nightwatch_imax.movie import get_movie_info
from nightwatch_imax.schedule import get_latest_sched... | maplejune/nightwatch-imax | nightwatch_imax/reporter.py | Python | mit | 5,366 |
# -*- coding: utf-8 -*-
import yaml
from alchemyapi import AlchemyAPI
from ... import config
if "alchemy" in config.engines:
labels = config.engines["alchemy"]["labels"]
def convert_label(label):
if label in labels:
return labels[label]
else:
print "alchemy:", label
return label
def extract_entities(tex... | axelspringer/semaeval | semaeval/engine/alchemy/alchemy.py | Python | mit | 629 |
VERSION = '1.23.0'
| speedplane/stripe-python | stripe/version.py | Python | mit | 19 |
# proxy module
from __future__ import absolute_import
from enable.api import *
| enthought/etsproxy | enthought/enable/api.py | Python | bsd-3-clause | 79 |
# -*- test-case-name: twisted.python.test.test_release -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Twisted's automated release system.
This module is only for use within Twisted's release system. If you are anyone
else, do not use it. The interface and behaviour will change without... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/python/_release.py | Python | mit | 29,029 |
from bz2 import BZ2File
import gzip
from io import BytesIO
import numpy as np
import os
import shutil
from tempfile import NamedTemporaryFile
from sklearn.externals.six import b
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_... | JT5D/scikit-learn | sklearn/datasets/tests/test_svmlight_format.py | Python | bsd-3-clause | 10,540 |
# 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 t... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/keystoneauth1/loading/base.py | Python | mit | 3,953 |
''' Study views. '''
from django.contrib import messages
from django.http import Http404
from django.http.response import JsonResponse
from django.views.generic.base import TemplateView, View
from core.views import SectionMixin
from criteria.helper.study_criteria import StudyCriteria
from elastic.elastic_settings impo... | tcarver/pydgin | pydgin/local_apps/study/views.py | Python | gpl-3.0 | 8,086 |
__author__ = 'Tina'
from pymatgen.core.structure import Structure
import connectivity_from_structure as connectivity
import unittest
class TestConnectivity(unittest.TestCase):
def setUp(self):
"""Loading structures before tests"""
#print "TestConnectivityMethods:setUp_"
print "Loading st... | tchen0965/structural_descriptors_repo | examples/connectivity_test.py | Python | mit | 11,683 |
"""
This defines a generic session class. All connection instances (both
on Portal and Server side) should inherit from this class.
"""
import time
#------------------------------------------------------------
# Server Session
#------------------------------------------------------------
class Session(object):
... | TaliesinSkye/evennia | src/server/session.py | Python | bsd-3-clause | 4,915 |
from flask import Flask, request
import telepot
import urllib3
from app.config_loader import ConfigLoader
from app.log import Log
from app.message_handler import MessageHandler, InlineMessageNoThreadHandler
flask_app = None
class PawApp():
TELEGRAM_TOKEN = ConfigLoader.load("telegram_bot_token")
def __init__(self... | nkming2/google-search-telegram-bot | src/app/paw_app.py | Python | apache-2.0 | 1,649 |
"""IoTaWatt DataUpdateCoordinator."""
from __future__ import annotations
from datetime import datetime, timedelta
import logging
from iotawattpy.iotawatt import Iotawatt
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.cor... | rohitranjan1991/home-assistant | homeassistant/components/iotawatt/coordinator.py | Python | mit | 2,727 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2018-03-19
git sha ... | lcoandrade/DsgTools | gui/ProductionTools/MapTools/FlipLineTool/flipLineTool.py | Python | gpl-2.0 | 6,993 |
# Generated by Django 2.1 on 2018-09-03 03:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('orgs', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='organization',
options={'verbose_name': 'Organiza... | eli261/jumpserver | apps/orgs/migrations/0002_auto_20180903_1132.py | Python | gpl-2.0 | 345 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-15 17:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0043_holesaw'),
]
operations = [
migrations.CreateModel(
... | n2o/guhema | products/migrations/0044_auto_20160115_1704.py | Python | mit | 950 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-12-09 19:18
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('sdnctl', '0013_auto_20161209_1631'),
]
operations = [
migrations.RemoveField(
... | luisza/sdn_control | sdnctl/migrations/0014_auto_20161209_1918.py | Python | gpl-3.0 | 1,549 |
import dredd_hooks as hooks
import imp
import os
import json
import hashlib
import requests
import uuid
from dataservice.config import create_config
from dataservice.core.fileuploader import FileUploadOperations, FileUploader, ParallelChunkProcessor
from dataservice.core.util import ProgressPrinter
from dataservice.co... | benneely/duke-data-service-dredd | dredd/dredd_scripts/11_uploads.py | Python | gpl-3.0 | 3,630 |
def count_substring(string, sub_string):
return
if __name__ == '__main__':
string = input().strip()
sub_string = input().strip()
count = count_substring(string, sub_string)
print(count)
| jerodg/hackerrank-python | python/02.Strings/04.FindAString/template.py | Python | mit | 209 |
# This file is heavily inspired from the django admin autodiscover
__version_info__ = {
'major': 1,
'minor': 0,
'micro': 2,
'releaselevel': 'final',
'serial': 0
}
def autodiscover():
"""
Auto-discover INSTALLED_APPS admin.py modules and fail silently when
not present. This forces an i... | kingctan/django-health-check | health_check/__init__.py | Python | mit | 1,966 |
# 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 t... | stackforge/python-openstacksdk | openstack/tests/unit/object_store/v1/test_container.py | Python | apache-2.0 | 9,111 |
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext, loader
from django.core.urlresolvers import reverse
from django.shortcuts import render, get_object_or_404
from .models import Choice, Poll
def index(request):
latest_poll_list = Poll.objects.all().order_by('-pu... | gmaclinuxer/django-docker | polls/views.py | Python | apache-2.0 | 1,519 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | google/cloud/aiplatform_v1/services/featurestore_service/pagers.py | Python | apache-2.0 | 21,510 |
# encoding=utf-8
def customize_login_manager(login_manager):
login_manager.session_protection = 'strong'
login_manager.login_view = 'user.login'
login_manager.login_message = u'请在登录后再访问所有功能'
login_manager.login_message_category = 'warning' | realityone/MentalUs | MentalUs/helpers.py | Python | apache-2.0 | 281 |
import math
import os
import sys
# import pygame
import time
import string
import util
import splines
# import Image
import traceback
import random
from threading import Thread
# from math import pi, sin, cos, sqrt, atan2
from util import *
from traceback import *
from numpy import *
twopi = 2.0*pi... | broxtronix/phosphoressence | src/scripts/ergo/sprite.py | Python | gpl-3.0 | 51,938 |
#!/usr/bin/env python
#
# Copyright 2007 Doug Hellmann.
#
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and tha... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/inspect/inspect_getmembers_module.py | Python | gpl-3.0 | 1,280 |
# -*- coding: UTF-8 -*-
import re
def mgo_text_split(query_text):
''' split text to support mongodb $text match on a phrase '''
sep = r'[`\-=~!@#$%^&*()_+\[\]{};\'\\:"|<,./<>?]'
word_lst = re.split(sep, query_text)
text_query = ' '.join('\"{}\"'.format(w) for w in word_lst)
return text_query
# 搜... | ysrc/xunfeng | views/lib/QueryLogic.py | Python | gpl-3.0 | 2,319 |
"""Tests for the NWS weather component."""
from datetime import timedelta
from unittest.mock import patch
import aiohttp
import pytest
from homeassistant.components import nws
from homeassistant.components.weather import (
ATTR_CONDITION_SUNNY,
ATTR_FORECAST,
DOMAIN as WEATHER_DOMAIN,
)
from homeassistant... | partofthething/home-assistant | tests/components/nws/test_weather.py | Python | apache-2.0 | 10,602 |
import imp
import os
import sys
import hashlib
import getpass
def bootstrap_script(path, project_path_components):
project_path = os.path.join(find_parent_path(path, project_path_components), *project_path_components)
bootstrap(project_path)
def bootstrap(path):
path = find_settings_path(path)
from d... | tarequeh/django-config | djangoconfig/deployment.py | Python | mit | 5,963 |
import codecs
import os
import re
import sys
from pkg_resources import parse_version
from setuptools import __version__ as setuptools_version
from setuptools import find_packages
from setuptools import setup
min_setuptools_version='39.0.1'
# This conditional isn't necessary, but it provides better error messages to
#... | letsencrypt/letsencrypt | certbot/setup.py | Python | apache-2.0 | 5,451 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Enables directory-specific presubmit checks to run at upload and/or commit.
"""
__version__ = '1.8.0'
# TODO(joi) Add caching ... | fracting/depot_tools | presubmit_support.py | Python | bsd-3-clause | 61,020 |
import os
import nose
from unittest import TestCase
from hashlib import md5
# First md5 is for csv, second md5 is for sqlite
known_md5s = {'sqlite': {'AvianBodySize' : '72256f681cdce96eba32d4ece270bcb2',
'DelMoral2010' : '92b6cd535f8e6c82d6fc19802d6ba64f',
'MoM2003' : ... | bendmorris/retriever | test/test_regression_cli.py | Python | mit | 4,362 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import gobject
import clutter
from clutter import cogl
class OutlinedRoundRectangle(clutter.Actor):
__gtype_name__ = 'OutlinedRoundRectangle'
__gproperties__ = {
'color' : (
str, 'color', 'Color', None, gobject.PARAM_READWRITE
... | UbiCastTeam/candies | candies2/roundrect.py | Python | lgpl-3.0 | 14,572 |
# Copyright (C) 2011-2013 Andy Balaam and The Pepper Developers
# Released under the MIT License. See the file COPYING.txt for details.
# He has walled me in so that I cannot escape; he has weighed me down
# with chains. Lamentations 3 v7
from itertools import izip
from libpepper.usererrorexception import PepUserE... | andybalaam/pepper | old/pepper1/src/libpepper/vals/functions/pepfunctionoverloadlist.py | Python | mit | 5,336 |
from jug import TaskGenerator
from glob import glob
import mahotas as mh
@TaskGenerator
def compute_texture(im):
from features import texture
imc = mh.imread(im)
return texture(mh.colors.rgb2gray(imc))
@TaskGenerator
def chist_file(fname):
from features import chist
im = mh.imread(fname)
ret... | sssllliang/BuildingMachineLearningSystemsWithPython | ch12/chapter.py | Python | mit | 2,634 |
"""
Title: Distributed hyperparameter tuning
Authors: Tom O'Malley, Haifeng Jin
Date created: 2019/10/24
Last modified: 2021/06/02
Description: Tuning the hyperparameters of the models with multiple GPUs and multiple machines.
"""
"""
## Introduction
KerasTuner makes it easy to perform distributed hyperparameter sear... | keras-team/keras-io | guides/keras_tuner/distributed_tuning.py | Python | apache-2.0 | 5,477 |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
#
# 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... | TribeMedia/synapse | synapse/storage/stream.py | Python | apache-2.0 | 29,657 |
'''
@author: Frank
'''
from virtualrouter import virtualrouter
from zstacklib.utils import http
from zstacklib.utils import jsonobject
from zstacklib.utils import linux
from zstacklib.utils import log
from zstacklib.utils import shell
from zstacklib.utils import lock
import os.path
logger = log.get_logger(__name__)
... | live4thee/zstack-utility | virtualrouter/virtualrouter/plugins/dns.py | Python | apache-2.0 | 3,621 |
# -*- coding: utf-8 -*-
"""
post_request.py
~~~~~~~~~~~~~~~
A short example that demonstrates a client that makes POST requests to certain
websites.
This example is intended to demonstrate how to handle uploading request bodies.
In this instance, a file will be uploaded. In order to handle arbitrary files,
this examp... | KiChjang/servo | tests/wpt/web-platform-tests/tools/third_party/h2/examples/twisted/post_request.py | Python | mpl-2.0 | 8,615 |
# Copyright (c) 2001, Stanford University
# All rights reserved.
#
# See the file LICENSE.txt for information on redistributing this software.
import sys
sys.path.append( "../../glapi_parser" )
import apiutil
keys = apiutil.GetDispatchedFunctions("../../glapi_parser/APIspec.txt")
def EmitHeader():
apiutil.Copyri... | rpavlik/chromium | spu/apihistogram/histogram.py | Python | bsd-3-clause | 2,653 |
class ExportableInterface(object):
pass
class ExporterInterface(object):
def export(self, method, in_signature, out_signature):
# to be overridden by concrete implementation
raise NotImplementedError()
def signal(self, method, out_signature):
# to be overridden by concrete implementation
raise NotImplement... | redhat-performance/tuned | tuned/exports/interfaces.py | Python | gpl-2.0 | 555 |
"""
Module for accessing vdsm, part of virt-who
Parts of this file is based on rhn-virtualization from spacewalk
http://git.fedorahosted.org/git/?p=spacewalk.git;a=tree;f=client/tools/rhn-virtualization
Copyright (C) 2011 Radek Novacek <rnovacek@redhat.com>
This program is free software; you can redistribute it and/... | alikins/virt-who | vdsm.py | Python | gpl-2.0 | 3,998 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2017 CERN.
#
# Invenio 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... | inveniosoftware/iugw2017 | 5-develop/invenio-unicorn/invenio_unicorn/utils.py | Python | gpl-3.0 | 2,021 |
"""
WSGI config for straymapper project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATIO... | codeforamerica/straymapper | straymapper/wsgi.py | Python | bsd-3-clause | 1,144 |
from enum import Enum
class ManifestAssetKind(Enum):
SoftwarePackage = 'software-package'
FullSizeImage = 'full-size-image'
DisplayImage = 'display-image'
| mosen/commandment | commandment/pkg/__init__.py | Python | mit | 170 |
# -*-python-*-
# GemRB - Infinity Engine Emulator
# Copyright (C) 2003 The GemRB Project
#
# 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) ... | flaing/gemrb | gemrb/GUIScripts/iwd2/Start.py | Python | gpl-2.0 | 6,550 |
# Copyright (C) 2015 University of Vienna
# All rights reserved.
# BSD license.
# Author: Ali Baharev <ali.baharev@gmail.com>
from __future__ import print_function, division
from collections import namedtuple
from itertools import chain
from networkx import connected_component_subgraphs
from order_util import check_non... | baharev/sdopt-tearing | bb2_tear.py | Python | bsd-3-clause | 10,837 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.image_list, name='list'),
url(r'^create/$', views.image_create, name='create'),
url(r'^detail/(?P<id>\d+)/(?P<slug>[-\w]+)/$',
views.image_detail, name='detail'),
url(r'^like/$', views.image_like, name='like... | EssaAlshammri/django-by-example | bookmarks/bookmarks/images/urls.py | Python | mit | 384 |
#!/usr/bin/env python
# this script processes transposon caller output to calculate how many transposons of each family and totals were found in a strain
# USE: te_totals.py <bam_name_temp_nonredundant.bed> <consensus_renamed> <bam_name> <name_results_file> <method> <no_of_end_tes>
# called on by ProcessTransposonCal... | klaricch/Transposons2 | scripts/te_totals.py | Python | mit | 2,506 |
"""Rabbitmq example for Compose RabbitMQ/Python Grand Tour"""
import os
from urllib.parse import urlparse
from flask import Flask
from flask import render_template
from flask import request
import pika
app = Flask(__name__)
# connection string and initialization
compose_rabbitmq_url = os.environ['COMPOSE_RABBITMQ_... | compose-grandtour/python | example-rabbitmq/rabbitmq_example.py | Python | mit | 2,237 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2018 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Nicolas Bornand
#
# The licence is in the file __manifest__.py
#
################... | eicher31/compassion-modules | partner_communication/migrations/10.0.1.0.1/post-migration.py | Python | agpl-3.0 | 1,000 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.