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 |
|---|---|---|---|---|---|
'''
Created on Oct 20, 2015
@author: Dallas
'''
| fras2560/graph-helper | algorithms/critical.py | Python | apache-2.0 | 49 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/internal/factory_test1.proto
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _refle... | sklearn-theano/sklearn-theano | sklearn_theano/externals/google/protobuf/internal/factory_test1_pb2.py | Python | bsd-3-clause | 7,622 |
# -*- coding: utf-8 -*-
#!/usr/bin/python2.7
#description :This file creates a plot: Calculates the development of invalid polygons (total amount and percentage)
#author :Christopher Barron @ http://giscience.uni-hd.de/
#date :19.01.2013
#version :0.1
#usage :python pyscript.... | zehpunktbarron/iOSMAnalyzer | scripts/c6_invalid_poly.py | Python | gpl-3.0 | 5,346 |
########################################################################
#
# EXE to BAT converter Version 2.0 #
# Much improved EXE2BAT script with base 64 decode COM stub and no #
# size limits. #
# ... | knightmare2600/d4rkc0de | others/batconv.py | Python | gpl-2.0 | 2,335 |
from django.apps import AppConfig
class PicturesConfig(AppConfig):
name = 'pictures'
| DjangoGirls/djangogirls | pictures/apps.py | Python | bsd-3-clause | 91 |
"""SCons.Tool.PharLapCommon
This module contains common code used by all Tools for the
Phar Lap ETS tool chain. Right now, this is linkloc and
386asm.
"""
#
# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associ... | OpenKore/OpenKore | src/scons-local-3.1.2/scons-local-3.1.2/SCons/Tool/PharLapCommon.py | Python | gpl-2.0 | 4,464 |
rows = int(input("Quante righe: "))
columns = int(input("Quante colonne: "))
for i in range(rows):
for j in range(columns):
print(" ---", end="")
print("\n")
for j in range(columns):
print("|", end=" ")
print("|\n")
for j in range(columns):
print(" ---", end="")
print("\n") | daniLOLZ/variaRoba | Python/24.py | Python | mit | 286 |
#!/usr/bin/env python
#encode=utf-8
#vim: tabstop=4 shiftwidth=4 softtabstop=4
#Created on 2013-8-27
#Copyright 2013 nuoqingyun xuqifeng
"""
Client side of the glancei pull RPC API
"""
from oslo.config import cfg
from glance.rpc.proxy import RpcProxy
pull_rpcapi_opts = [
cfg.StrOpt('glance_topic',
... | homhei/glance | glance/glance_pull/rpcapi.py | Python | apache-2.0 | 3,729 |
# #
# Copyright 2012-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | gppezzi/easybuild-framework | easybuild/tools/utilities.py | Python | gpl-2.0 | 11,107 |
# Copyright 2020 Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | googleapis/python-spanner | google/cloud/spanner_v1/backup.py | Python | apache-2.0 | 11,271 |
# python version 1.0 DO NOT EDIT
#
# Generated by smidump version 0.4.8:
#
# smidump -f python IBM-PDU-MIB
FILENAME = "ibmdpi_v01.3_1.mib"
MIB = {
"moduleName" : "IBM-PDU-MIB",
"IBM-PDU-MIB" : {
"nodetype" : "module",
"language" : "SMIv2",
"organization" :
"""Intern... | sigmunau/nav | python/nav/smidumps/ibm_pdu_mib.py | Python | gpl-2.0 | 89,789 |
# -*- coding: utf-8 -*-
import numpy as np
import json
import algo.arranging.base as arr
import algo.arranging.metrics as metrics
def put_vertical(ax, line, xs):
ymin, ymax = ax.get_ylim()
for x in xs:
ax.plot([x, x], [ymin, ymax], color="red")
model = research.model
if model.layers_count != 2:
... | bigartm/visartm | algo/research/hier_spectrum_test.py | Python | bsd-3-clause | 2,161 |
"""<b> Measure Image Area Occupied</b> measures the total area in an image that is
occupied by objects.
<hr>
This module reports the sum of the areas and perimeters of the objects defined by one
of the <b>Identify</b> modules, or the area of the foreground in a binary
image. If the input image has a mask (for example,... | sstoma/CellProfiler | cellprofiler/modules/measureimageareaoccupied.py | Python | gpl-2.0 | 15,817 |
# coding: utf-8
from django.db import models, transaction
from django.utils.translation import ugettext as _
from grappelli.fields import PositionField
class Help(models.Model):
"""
Help Entry.
"""
title = models.CharField(_('Title'), max_length=50)
# order
order = PositionField(_('... | pielgrzym/django-minishop | grappelli/models/help.py | Python | gpl-3.0 | 1,453 |
import collections
import six
from moto.core.utils import get_random_hex
def get_random_pipeline_id():
return "df-{0}".format(get_random_hex(length=19))
def remove_capitalization_of_dict_keys(obj):
if isinstance(obj, collections.Mapping):
result = obj.__class__()
for key, value in obj.items(... | botify-labs/moto | moto/datapipeline/utils.py | Python | apache-2.0 | 744 |
import os
import time
import fnmatch
import signal
import tempfile
import subprocess
from unittest import TestCase
from subunit import ProtocolTestCase
def startYeti():
yeti = os.environ["YETI"]
port = os.environ.get("YETI_PORT", "4422")
capture_timeout = int(os.environ.get(
"YETI_CAPTURE_TIMEOU... | swryan/lazr.testing | src/lazr/testing/yeti.py | Python | lgpl-3.0 | 4,479 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the attribute table model.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later vers... | NINAnor/QGIS | tests/src/python/test_qgsattributetablemodel.py | Python | gpl-2.0 | 2,783 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
class Cola:
""" Representa una cola con operaciones de encolar, desencolar y
verificar si está vacía. """
def __init__(self):
""" Crea una cola vacía. """
# La cola vacía se representa con una lista vacía
self.items=[]
def encolar(s... | MauricioAcosta/Estructuras | cola.py | Python | gpl-3.0 | 909 |
#
# exception.py - general exception formatting and saving
#
# Copyright (C) 2000-2013 Red Hat, Inc.
# All rights reserved.
#
# 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 ... | projectatomic/anaconda | pyanaconda/exception.py | Python | gpl-2.0 | 12,466 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
from socorro.external.postgresql.base import PostgreSQLBase
from socorro.external import MissingArgument... | Serg09/socorro | socorro/external/postgresql/gccrashes.py | Python | mpl-2.0 | 1,581 |
# coding: utf-8
"""
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in com... | melphi/algobox | python/algobox/src/algobox/client/generated/api/models/price_tick.py | Python | apache-2.0 | 4,861 |
# Copyright 2018-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | abydos/distance/_minkowski.py | Python | gpl-3.0 | 5,963 |
__author__ = "ThinkPad"
| clementlefevre/hunger-game | app/main/helper/__init__.py | Python | mit | 24 |
# 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 | ipagnn/datasets/control_flow_programs/control_flow_programs_config.py | Python | apache-2.0 | 2,020 |
# -*- encoding: utf-8 -*-
def info_lbp(f):
import numpy as np
f = np.array(f, dtype='uint8')
m,n = f.shape
F = np.zeros(np.array(f.shape)+2, dtype='uint8')
F[1:-1, 1:-1] = f
g = 0
for i, j, k in np.array([(0,0,1), (0,1,2), (0,2,4), (1,0,128), (1,2,8), (2,0,64), (2,1,32), (2,2,16)], dtype='u... | mariecpereira/IA369Z | deliver/functions_will/info_lbp.py | Python | mit | 381 |
from test_base import BaseTestCase
import unittest
import flask_testing
class TestCnesProfessionalApiTests(BaseTestCase):
def test_should_respond_ok_to_cnes_professional_path(self):
response = self.client.get('/cnes_professional/year/')
self.assert_200(response)
def test_should_check_if_all_... | daniel1409/dataviva-api | tests/api/test_cnes_professional_api.py | Python | mit | 1,371 |
# 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... | dtroyer/python-openstacksdk | openstack/cloud/_network.py | Python | apache-2.0 | 104,230 |
class Foo(object):
def __init__(self):
self.bar=3
| caot/intellij-community | python/testData/completion/nonExistingProperty.after.py | Python | apache-2.0 | 62 |
# encoding=utf-8
"""
We don't use a fixture here because:
1. Each set of pages needs to point to a different region. Not sure how
to do this using fixtures.
2. Translations are easier.
"""
from django.utils.translation import ugettext as _
from pages.models import Page, slugify
NUM_DEFAULT_PAGES = 1... | lowiki-org/localwiki-backend-server | localwiki/regions/initial_data/__init__.py | Python | gpl-2.0 | 13,671 |
# self file was generated automatically by the Snowball to Python interpreter
from .basestemmer import BaseStemmer
from .among import Among
class PorterStemmer(BaseStemmer):
'''
self class was automatically generated by a Snowball to Python interpreter
It implements the stemming algorithm defined by a sn... | ruchee/vimrc | vimfiles/bundle/vim-python/submodules/snowball_py/snowballstemmer/porter_stemmer.py | Python | mit | 24,625 |
# -*- coding: 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):
# Adding model 'Diploma'
db.create_table('nmadb_students_diploma', (
('id', self.gf('django.db.m... | vakaras/nmadb-students | src/nmadb_students/migrations/0002_auto__add_diploma__add_field_alumni_activity_fields__add_field_alumni_.py | Python | lgpl-3.0 | 11,269 |
"""
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... | Belgabor/django | django/db/models/sql/query.py | Python | bsd-3-clause | 77,816 |
# coding: utf-8
"""
Flip API
Flip # noqa: E501
The version of the OpenAPI document: 3.1
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_flip.configuration import Configuration
class... | Telestream/telestream-cloud-python-sdk | telestream_cloud_flip_sdk/telestream_cloud_flip/models/count_response.py | Python | mit | 3,378 |
from .build_jsoncpp import Builder_jsoncpp | lovewinds/story-project | external/scripts/packages/jsoncpp/__init__.py | Python | gpl-2.0 | 42 |
# Copyright 2013 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.
# This module's classes provide an interface to mojo modules. Modules are
# collections of interfaces and structs to be used by mojo ipc clients and
# server... | js0701/chromium-crosswalk | mojo/public/tools/bindings/pylib/mojom/generate/module.py | Python | bsd-3-clause | 18,672 |
from h5py import tests
from h5py import *
class TestCreate(tests.HTest):
def setUp(self):
self.fid, self.name = tests.gettemp()
def tearDown(self):
import os
self.fid.close()
os.unlink(self.name)
@tests.require(api=18)
def test_create_anon(self):
""" (H5D) Ano... | qsnake/h5py | h5py/tests/low/test_h5d.py | Python | bsd-3-clause | 529 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['MovingMedian'] , ['Seasonal_DayOfMonth'] , ['AR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_None/model_control_one_enabled_None_MovingMedian_Seasonal_DayOfMonth_AR.py | Python | bsd-3-clause | 159 |
# -*- coding: utf-8 -*-
import functools
import inspect
from .ps import emit
__all__ = ["pub_message", "device_attr", "pub_result"]
def _pub_message_around_method(method):
''' Publish message before and after "setUp", "tearDown", "test...."
method is invoked.
'''
if method.__name__ == "setUp":
... | xiaocong/rock | rock/inject.py | Python | mit | 2,208 |
#!/usr/bin/python2.6
# This file is a part of Metagam project.
#
# Metagam 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
# any later version.
#
# Metagam is distributed ... | JoyTeam/metagam | mg/constructor/doc.py | Python | gpl-3.0 | 6,986 |
# django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2013 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyr... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django_openid_auth/tests/test_settings.py | Python | agpl-3.0 | 2,374 |
#!/usr/bin/env python
'''
Appendix F. Grid Mappings
---
Each recognized grid mapping is described in one of the sections below. Each
section contains: the valid name that is used with the grid_mapping_name
attribute; a list of the specific attributes that may be used to assign values
to the mapping's parameters; the st... | webtrike/compliance-checker | compliance_checker/cf/appendix_f.py | Python | apache-2.0 | 2,157 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2013, 2014 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 l... | jmartinm/invenio-workflows | invenio_workflows/tasks/logic_tasks.py | Python | gpl-2.0 | 10,642 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# MIT License. See license.txt
"""
globals attached to webnotes module
+ some utility functions that should probably be moved
"""
from __future__ import unicode_literals
class _dict(dict):
"""dict like object that exposes keys as attributes"""
def __getattr__(... | gangadhar-kadam/sapphite_lib | webnotes/__init__.py | Python | mit | 13,576 |
"""Server API tests."""
import unittest
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
import mock
from treadmill import admin
from treadmill.api import server
class ApiServerTest(unittest.TestCase):
"""treadmill.api.server tests."""
def setUp(self):
self... | toenuff/treadmill | tests/api/server_test.py | Python | apache-2.0 | 2,316 |
""" Functions related to convolution."""
# py2.6+ compatibility
from __future__ import division, print_function, unicode_literals
import numpy as np
from .utilities import nan2num
from .sed import make_constant_dv_wa_scale
def convolve_psf(a, fwhm, edge='invert', replace_nan=True, debug=False):
""" Convolve an ... | nhmc/Barak | barak/convolve.py | Python | bsd-3-clause | 6,017 |
from django.conf import settings
from django.conf.urls import include, patterns, url
from django.contrib import admin
from django.views.decorators.cache import cache_page
import apps.api.urls
from apps.core.views import (HomePageView, JobDetailView, JobHistoryView,
JobsDiffView, JobsListVi... | lhellebr/GreenTea | tttt/urls.py | Python | gpl-2.0 | 3,215 |
r""" My attempt at a proper STAN model.
Parameters
----------
**Cosmological parameters**:
* :math:`\Omega_m`: matter density
* :math:`w`: dark energy equation of state
* :math:`\alpha`: Phillips correction for stretch
* :math:`\beta`: Tripp correction for colour
**Population parameters**:
* :... | dessn/sn-bhm | dessn/framework/models/__init__.py | Python | mit | 35,952 |
"""gom_server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | jhogg41/gm-o-matic | gom_server/gom_server/urls.py | Python | bsd-2-clause | 1,187 |
# -*- test-case-name: twisted.test.test_sip -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""Session Initialization Protocol.
Documented in RFC 2543.
[Superceded by 3261]
"""
# system imports
import socket
import random
import time
import md5
import sys
from zope.interface i... | mclois/iteexe | twisted/protocols/sip.py | Python | gpl-2.0 | 37,736 |
# Copyright 2015 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed ... | google/prettytensor | prettytensor/scopes.py | Python | apache-2.0 | 5,137 |
from discord.ext import commands
import os
import os.path
import random
from urllib import request
class Gifs:
"""GIF related commands."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True)
async def g(self, ctx, *, content: str='gif'):
"""call a gif."""
... | Kuenaimaku/DiscordBot | cogs/gifs.py | Python | mit | 3,900 |
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core import mail
import mock
from nose.tools import eq_
from kitsune.kbforums.events import NewPostEvent, NewThreadEvent
from kitsune.kbforums.models import Thread, Post
from kitsune.kbforums.tests import KBForumTestC... | dbbhattacharya/kitsune | kitsune/kbforums/tests/test_notifications.py | Python | bsd-3-clause | 16,417 |
from django.conf.urls import url
from . import views
song_path = r'^song/(?P<song_slug>[\w\-]+)'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(song_path + '/$', views.song, name='song'),
url(song_path + '/.json/$', views.song_json, name='song_json'),
url(song_path + '/add_bookmark/$', v... | Ilias95/guitarchords | chords/urls.py | Python | mit | 1,273 |
import asyncio
import os
import signal
import threading
import traceback
import sys
PYMPLER_ENABLED = False
if PYMPLER_ENABLED:
try:
import pympler
import pympler.muppy
import pympler.summary
import pympler.tracker
except ImportError:
pympler = None
else:
pympler = ... | bharaths/CloudBot | plugins/profiling.py | Python | gpl-3.0 | 3,087 |
# coding: utf-8
"""
Django settings for esperancanordeste project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.p... | klebercode/esperancanordeste | esperancanordeste/settings.py | Python | mit | 4,966 |
import RPi.GPIO as GPIO
import time
from servo import Servo
import servo
from stepper import Stepper
#This program use the board numerotation for GPIOs, so up left is 1 and down right is 40
RED_LED_GPIO = 26
GREEN_LED_GPIO = 29
BLUE_LED_GPIO = 31
SERVO_A_GPIO = 25 #GPIO number, not board number
SERVO_B_GPIO = 26 #GPIO... | pi-bot/.v2 | tests/raspberryTest.py | Python | gpl-3.0 | 2,212 |
__author__ = 'Shailesh'
class PredictionFunctions:
NegativeModifiers = {"not", "n't", "no", "nothing", "at"}
PositiveModifiers = {"very", "so", "really", "super", "extremely"}
NeutralModifiers = {"neither", "nor"}
TooExceptionList = {"good", "awesome", "brilliant", "kind", "great", "tempting", "big",... | shaileshahuja/SentimentBlade | src/PredictionFunctions.py | Python | apache-2.0 | 4,397 |
#!/bin/python
#A crappy program to convert a text file delimited by spaces to an array for python.
#DOES NOT DO ANY ERROR CHECKING!
import csv
csv.QUOTE_ALL=True
filename = raw_input("Name of file containing array data separated by spaces: ")
arrayname = raw_input("What is the name of the array: ")
with open(filename... | ddworken/recoverableSecretGenerator | fileToArray.py | Python | gpl-2.0 | 450 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under t... | MDAnalysis/mdanalysis | package/MDAnalysis/analysis/bat.py | Python | gpl-2.0 | 23,211 |
"""
Classes that describe how a particular model should be viewed.
"""
from collections import defaultdict, OrderedDict
import json
import string
from django.core.urlresolvers import reverse
from main.models import AlignmentGroup
from main.models import Variant
from main.model_view_utils import create_variant_links_... | woodymit/millstone_accidental_source | genome_designer/main/model_views.py | Python | mit | 27,438 |
""" Module contains functions that are used to format, transform or classify date-time presented in a synergy format """
__author__ = 'Bohdan Mushkevych'
import calendar
from datetime import datetime, timedelta
from synergy.system.time_qualifier import *
SYNERGY_SESSION_PATTERN = '%Y%m%d%H%M%S'
SYNERGY_HOURLY_PATTE... | eggsandbeer/scheduler | synergy/system/time_helper.py | Python | bsd-3-clause | 7,045 |
from clothstream.lib.rest import SharedAPIRootRouter
from .views import CollectionCreate, CollectionUpdate, CollectionListRetrieve, CollectionDestroy, \
CollectedItemDestroy, CollectedItemCreate
router = SharedAPIRootRouter()
router.register(r'collections/create', CollectionCreate, base_name='collection-create')
r... | julienaubert/clothstream | clothstream/collection/urls.py | Python | mit | 745 |
from celery.utils.log import get_task_logger
from django.utils.six import text_type
from que.erigonesd import cq
from que.mgmt import MgmtTask
from que.exceptions import MgmtTaskException
from que.utils import dc_id_from_task_id
from api.task.utils import mgmt_task, mgmt_lock
from api.mon.log import save_task_log
from... | erigones/esdc-ce | api/mon/vm/tasks.py | Python | apache-2.0 | 5,063 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib
import sys
import re
import os
import subprocess
import xbmcplugin
import xbmcgui
import xbmcaddon
addon = xbmcaddon.Addon()
pluginhandle = int(sys.argv[1])
addonID = addon.getAddonInfo('id')
addonPath = addon.getAddonInfo('path')
translation = addon.getLocalize... | maxoflow/MaXoFloW-Repo | plugin.program.MaXoFloW-GuiaTV-Chrome/default.py | Python | gpl-2.0 | 11,553 |
# -*- coding: utf-8 -*-
"""
Enumerazioni delle costellazioni visibili in cielo.
"""
from src.element import EnumElement, finalize_enumeration
from src.enums import MONTH
#-------------------------------------------------------------------------------
name = __name__[__name__.rfind(".")+1 : ]
elements = []
cycle... | Onirik79/aaritmud | src/enums/CONSTELLATION.py | Python | gpl-2.0 | 3,446 |
# -*- coding: utf8 -*-
#
# Copyright (C) 2014 NDP Systèmes (<http://www.ndp-systemes.fr>).
#
# This program 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,... | ndp-systemes/odoo-addons | odoo_online_documentation/__openerp__.py | Python | agpl-3.0 | 1,481 |
#!/usr/bin/env python3
from book import Book, Library
import parsers.bestbooks
import parsers.readrate
import parsers.stotop
import parsers.wiki100
L = Library()
ratings = []
ratings.append(parsers.wiki100.get())
ratings.append(parsers.bestbooks.get())
ratings.append(parsers.readrate.get())
ratings.append(parsers.s... | dzeban/cool-books | cool-books.py | Python | mit | 519 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# addfeeddialog.py
#
# This file is part of uPodcatcher
#
# Copyright (C) 2014
# Lorenzo Carbonell Cerezo <lorenzo.carbonell.cerezo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | atareao/upodcatcher | src/upodcatcher/addfeeddialog.py | Python | gpl-3.0 | 2,469 |
# -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from group import Group
import unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unittest.TestCase):
def setUp(self):
s... | nikitabar/python_training | test_add_group.py | Python | apache-2.0 | 2,720 |
### The World knows about the map, terrain, objects, etc.
import sys
import pygame
import random
from collections import defaultdict
from renderer import Renderer
from level import TestLevel
from actor import Player
from quest import MainQuest
from constants import *
class World:
def __init__(self, screen):
... | fish-face/agutaywusyg | src/world.py | Python | bsd-3-clause | 9,950 |
from django.conf import settings
from django.urls import path, include
from django.views.generic import RedirectView
from rest_framework import routers
from geotrek.api.v2 import views as api_views
from geotrek.api.v2.viewsets import get_geotrek_version
router = routers.DefaultRouter()
router.register('structure', a... | makinacorpus/Geotrek | geotrek/api/v2/urls.py | Python | bsd-2-clause | 6,457 |
from __future__ import unicode_literals
from moto.core.exceptions import RESTError
class EC2ClientError(RESTError):
code = 400
class DependencyViolationError(EC2ClientError):
def __init__(self, message):
super(DependencyViolationError, self).__init__(
"DependencyViolation", message)
cl... | kennethd/moto | moto/ec2/exceptions.py | Python | apache-2.0 | 10,404 |
from __future__ import unicode_literals
from django.contrib import admin
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from .widgets import FilteredSelectMultipleWrapper, RelatedFieldWidgetWrapper
class EnhancedAdminMixin(object):
enhance_exclude = ()
filtered_... | Venturi/oldcms | env/lib/python2.7/site-packages/admin_enhancer/admin.py | Python | apache-2.0 | 2,823 |
# -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import datetime
from django.http import HttpResponse
from django.views.gener... | arth-co/shoop | shoop_tests/admin/fixtures/test_module.py | Python | agpl-3.0 | 2,429 |
__author__ = 'caninemwenja'
import logging
import logging.config
DEBUG = True
DATABASE = 'sqlite:///siafu.db'
LOGGING = {
'version': 1.0,
'disable_existing_loggers': True,
'formatters': {
'simple': {
'format': '%(asctime)s %(levelname)s '
'%(message)s'
}... | caninemwenja/siafu | settings.py | Python | mit | 1,130 |
# Copyright (c) 2011 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | fabian4/trove | trove/guestagent/common/sql_query.py | Python | apache-2.0 | 11,924 |
'''Game main module.
Contains the entry point used by the run_game.py script.
Feel free to put all your game code here, or in other modules in this "gamelib"
package.
'''
import json
import pygame
import data
import engine
class Game(object):
'''A class that delegates its engine functionalities to a hot-swappab... | shundread/pyweek24 | gamelib/main.py | Python | gpl-3.0 | 3,587 |
# 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/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models_py3.py | Python | mit | 121,869 |
import sys
import json
# Example from http://www.cs.brandeis.edu//~clp/conll15st/blog/data_statistics.html
# python data_stat.py data/conll15st-en-03-29-16-blind-test > data/stat_conll15st-en-03-29-16-blind-test.txt
# python data_stat.py data/conll16-st-dev-en-2016-03-29 > data/stat_conll16-st-dev-en-2016-03-29.txt
# ... | jimmycallin/master-thesis | architectures/conll16st-hd-sdp/data_stat.py | Python | mit | 2,461 |
from django.conf.urls import url
from api.region import views
app_name = 'api'
urlpatterns = [
url(r'^$', views.RegionList.as_view(), name='region-list'),
url(
r'^(?P<pk>[^@$&+,/:;=?]+)/$',
views.RegionDetail.as_view(),
name='region-detail'
),
]
| openaid-IATI/OIPA | OIPA/api/region/urls.py | Python | agpl-3.0 | 284 |
"""
Student Views
"""
import datetime
import json
import logging
import uuid
import warnings
from collections import defaultdict, namedtuple
from urlparse import parse_qs, urlsplit, urlunsplit
import analytics
import edx_oauth2_provider
import waffle
from django.conf import settings
from django.contrib import message... | Lektorium-LLC/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 123,198 |
from sympy import (
Rational, combsimp, factorial, gamma, binomial, Symbol, pi, S,
sin, exp, powsimp, sqrt, sympify, FallingFactorial, RisingFactorial,
simplify, symbols, cos, rf)
from sympy.abc import x, y, z, t, a, b, c, d, e, f, g, h, i, k
def test_combsimp():
from sympy.abc import n, k
asser... | kaichogami/sympy | sympy/simplify/tests/test_combsimp.py | Python | bsd-3-clause | 5,586 |
import tempfile
from model_mommy import mommy
from django.test import override_settings
from django.urls import reverse
from meupet.models import Kind, PetStatus
from meupet.tests.tests import MEDIA_ROOT, MeuPetTestCase
@override_settings(MEDIA_ROOT=MEDIA_ROOT)
class PetRegisterTest(MeuPetTestCase):
@staticmet... | dirtycoder/pets | pets/meupet/tests/test_view_register_pet.py | Python | mit | 1,957 |
"""
This plugin matches incoming identifiers to Publisher configurations from the database.
It's a bit special - instead of storing what license statements match to what licenses
in the code, it fetches these (called Publisher configurations) from the database.
"""
import requests
from openarticlegauge import plugin
f... | CottageLabs/OpenArticleGauge | openarticlegauge/plugins/generic_string_matcher.py | Python | bsd-3-clause | 9,007 |
# -*- coding: utf-8 -*-
from taiga import TaigaAPI
api = TaigaAPI(
host='http://127.0.0.1:8000'
)
api.auth(
username='admin',
password='123123'
)
print (api.me())
new_project = api.projects.create('TEST PROJECT', 'TESTING API')
new_project.name = 'TEST PROJECT 3'
new_project.update()
jan_feb_mileston... | jespino/python-taiga | demo.py | Python | mit | 1,892 |
# -*- coding: utf-8 -*-
import logging
from record_manager import RecordManager
from scan_manager import ScanManager
import scraper
from rbm2m.util import to_str
logger = logging.getLogger(__name__)
class RecordImporter(object):
def __init__(self, session, scan):
self.session = session
self.sc... | notapresent/rbm2m | rbm2m/action/record_importer.py | Python | apache-2.0 | 3,718 |
# (C) British Crown Copyright 2014, Met Office
#
# This file is part of cartopy.
#
# cartopy 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 la... | ajdawson/cartopy | lib/cartopy/tests/test_util.py | Python | lgpl-3.0 | 3,024 |
from __future__ import absolute_import, print_function
from myhdl import Signal, intbv, ResetSignal, always_seq, instance, delay, \
StopSimulation, conversion
import os
path = os.path
def NonlocalBench():
ALL_ONES = 2**7-1
ONE = 1
qout = Signal(intbv(ONE)[8:])
init = Signal(bool(0))
clk = Si... | jmgc/myhdl-numeric | myhdl/test/conversion/general/test_nonlocal.py | Python | lgpl-2.1 | 1,404 |
"""Operator definitions."""
import logging
from pymachine.control import KRPosControl
from pymachine.machine import Machine
class Operator(object):
"""The abstract superclass of the operator hierarchy."""
def __init__(self, working_area=None):
"""The working area is that of the enclosing Construction... | kornai/pymachine | src/pymachine/operators.py | Python | mit | 8,373 |
from nltk.corpus import PlaintextCorpusReader
corpus_root = '/usr/share/dict'
wordlists = PlaintextCorpusReader(corpus_root, '.*')
print(wordlists.fileids())
print(wordlists.words('spanish'))
| davidam/python-examples | nlp/nltk/dictcorpus.py | Python | gpl-3.0 | 194 |
def fact(n):
if n == 1:
return 1
return n*fact(n-1)
print(fact(5)) | ironxu/DevStack | Language/Python/tmp.py | Python | apache-2.0 | 83 |
# -*- coding: UTF-8 -*
'''
Created on 2013-10-11
@author: RobinTang
'''
import web
import random
import time
from SinKVDB import SinKVDB
from dbbase import get_connect
render = web.template.render('templates/')
urls = (
'/upload/(.*)', 'Upload',
'/list/(.*)', 'List',
'/get/(.*)', 'Source',
'/(.*)', 'Upload',
'.... | sintrb/BigStorage | webpy.py | Python | gpl-2.0 | 2,847 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
插件通用库
"""
import os
import json
import logging
from libs.utils import *
# 日志处理
logger = logging.getLogger('plugin')
# 获取配置项
def load_config(config_file_name):
if os.path.exists(config_file_name):
config_file = open(config_file_name, "r+")
content... | lianwutech/plugin_test_mock | libs/plugin.py | Python | apache-2.0 | 787 |
import copy
from .elements import (RightAlignedClauseElement, LeftAlignedClauseElement,
NotRightAlignedClauseElement, NotLeftAlignedClauseElement)
from .attributes import (HierarchicalAnnotation)
from .results import QueryResults
from polyglotdb.exceptions import GraphQueryError
from ..base... | PhonologicalCorpusTools/PolyglotDB | polyglotdb/query/annotations/query.py | Python | mit | 16,448 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-10-04 14:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Post',... | bugulin/gymgeek-web | core/migrations/0001_initial.py | Python | apache-2.0 | 653 |
import sys
from math import sqrt
f = open(sys.argv[1] if len(sys.argv)>1 else 'double_squares_test.txt')
N = int(f.readline().strip('\n'))
X = map(int, [f.readline().strip('\n') for i in xrange(N)])
for i in xrange(N):
_max_int = int(sqrt(X[i])//1)
perfect_sqrs = [x**2 for x in xrange(_max_int+1)]
hits = 0
beg... | andersoncardoso/coding_challenges | fb_hackercup/double_squares/double_squares2.py | Python | mit | 515 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Radware LTD.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | Yannig/ansible | test/units/modules/network/radware/test_vdirect_file.py | Python | gpl-3.0 | 8,284 |
import sublime, sublime_plugin
import subprocess
import os
try:
from EvalPrinter.KillableCmd import KillableCmd
except:
from KillableCmd import KillableCmd
class EvalPrintCommand(sublime_plugin.TextCommand):
def run(self, edit, codeStr=None):
view = self.view
codeStr = codeStr or Helper.getSele... | philippotto/Sublime-EvalPrinter | EvalPrinter.py | Python | mit | 6,504 |
'''
Nesse exer você deve casar linha que tem 'tio', mas que tenham 1 caractere
antes.
Para fixação, usar o '.' (ponto).
'''
import re
import sys
REGEX = r''
lines = sys.stdin.readlines()
for line in lines:
if re.search(REGEX, line):
print(line.replace('\n', ''))
| deniscostadsc/regex-tutorial | 17-exercises/01-ponto/regex.py | Python | mit | 282 |
"""
.. function:: timeslidingwindow(timewindow, timecolumn) -> query results
Returns the query input results annotated with the window id as an extra column.
The following arguments can be passed as parameters:
timewindow: It can be a numeric value that specifies the time length of
the window (in seconds).
timecol... | sosguns2002/interactive-mining | interactive-mining-3rdparty-madis/madis/src/functions/vtable/timeslidingwindow.py | Python | gpl-3.0 | 6,001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.