code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 10:52:38 2017
@author: Andrew Ruba
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at ... | andrewruba/YangLab | JPC simulations 2019/Figure 8 - labeling efficiency/simulation.py | Python | gpl-3.0 | 13,992 |
'''Space of random variables over which stochastic collocation is performed'''
__copyright__ = 'Copyright (C) 2011 Aravind Alwan'
__license__ = '''
This file is part of UnyQuE.
UnyQuE 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... | aravindalwan/unyque | unyque/rdomain.py | Python | gpl-3.0 | 9,368 |
import unittest
import numpy as np
from kona.linalg.memory import KonaMemory
from dummy_solver import DummySolver
from kona.linalg.vectors.composite import ReducedKKTVector
class ReducedKKTVectorTestCase(unittest.TestCase):
def setUp(self):
solver = DummySolver(10, 0, 5)
self.km = km = KonaMemory... | JustinSGray/Kona | src/kona/test/test_reduced_kkt_vector.py | Python | lgpl-3.0 | 4,681 |
import logging
from monitor.core.utils import tr
class Colors:
STANDART = 1
HEALTH_POINTS = 2
POWER_POINTS = 3
ATTENTION = 4
MONEY = 5
HEALING = 6
class TextEntry:
def __init__(self, predefined_text, key, width, color = Colors.STANDART):
self.predefin... | aserebryakov/godville-monitor-console | monitor/core/text_entry.py | Python | gpl-2.0 | 2,446 |
##############################################################
## PKI settings
##############################################################
import os
from django.conf import settings
from django.core.urlresolvers import get_script_prefix
PKI_APP_DIR = os.path.abspath(os.path.dirname(__file__))
# blacklisted CA nam... | dkerwin/django-pki | pki/settings.py | Python | gpl-2.0 | 2,505 |
# Copyright (c) 2009-2014 Denis Bilenko and gevent contributors. See LICENSE for details.
"""Cooperative low-level networking interface.
This module provides socket operations and some related functions.
The API of the functions and classes matches the API of the corresponding
items in the standard :mod:`socket` modu... | burzillibus/RobHome | venv/lib/python2.7/site-packages/gevent/socket.py | Python | mit | 4,311 |
"""Categorisation related implementations."""
import os
import pickle
import numpy as np
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.linear_model import SGDClassifier
from sklearn.pipeline import Pipeline
from... | dmkent/cattrack | ctrack/categories.py | Python | mit | 3,425 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
# ---------------------------------------------------------------------------
#
# Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
# Copyright (C) 2003 Mt. Hood Playing Card Co.
# Copyright (C) 2005-2009 Skomoroh
#
# This program is free software... | jimsize/PySolFC | pysollib/winsystems/common.py | Python | gpl-3.0 | 3,751 |
import copy
from django.conf import settings
from corehq.apps.change_feed import topics
from corehq.apps.change_feed.consumer.feed import KafkaChangeFeed, KafkaCheckpointEventHandler
from corehq.elastic import get_es_new
from corehq.pillows.mappings.reportcase_mapping import REPORT_CASE_INDEX_INFO
from pillowtop.chec... | dimagi/commcare-hq | corehq/pillows/reportcase.py | Python | bsd-3-clause | 3,461 |
# Copyright (C) 2012 University of Southern California
# This software is licensed under the GPLv3 license, included in
# ./GPLv3-LICENSE.txt in the source distribution
from base import Testbed
import logging
import socket
log = logging.getLogger(__name__)
class DesktopExperiment(Testbed):
def __init__(self... | deter-project/magi | magi/testbed/desktop.py | Python | gpl-2.0 | 2,768 |
# Generated by Django 2.2.10 on 2020-02-15 22:05
import diventi.accounts.models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0247_auto_20200215_1909'),
]
operations = [
migrations.AlterModelManagers(
name='diventiuser... | flavoi/diventi | diventi/accounts/migrations/0248_auto_20200215_2305.py | Python | apache-2.0 | 453 |
"""
Module that enables the use of neural networks with NowTrade.
"""
import cPickle
import numpy as np
from pybrain.tools.shortcuts import buildNetwork
from pybrain.datasets.supervised import SupervisedDataSet
from pybrain.supervised.trainers.backprop import BackpropTrainer
from nowtrade import logger
# Networks
FEED... | edouardpoitras/NowTrade | nowtrade/neural_network.py | Python | mit | 7,380 |
import datetime
import pytz
import requests
from flask import flash
from fernet import app
API_URL = app.config['TEKNOLOGKORENSE_API_URL']
AUTH = requests.auth.HTTPBasicAuth(
app.config['TEKNOLOGKORENSE_API_USERNAME'],
app.config['TEKNOLOGKORENSE_API_PASSWORD']
)
def make_request(requests_fun... | teknologkoren/fernet | fernet/teknologkoren_se.py | Python | mpl-2.0 | 6,430 |
# Copyright (C) 2008-2010 INRIA - EDF R&D
# Author: Damien Garaud
#
# This file is part of the PuppetMaster project. It checks the module
# 'network'.
#
# This script is free; 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... | garaud/puppetmaster | test/network_test.py | Python | gpl-2.0 | 8,973 |
import functools
from . import (
constants,
utils,
)
class Card():
def __init__(self, kind=None, strength=None, value=None, verbose=None, **kwargs):
if kind is None:
raise(TypeError("Missing required 'kind' argument."))
self.kind = kind
self.strength = strength
... | julka2010/games | games/tichu/cards.py | Python | mpl-2.0 | 2,702 |
from cloudinit import cloud
from cloudinit.config import cc_ca_certs
from cloudinit import helpers
from cloudinit import util
from ..helpers import TestCase
import logging
import shutil
import tempfile
import unittest
try:
from unittest import mock
except ImportError:
import mock
try:
from contextlib imp... | prometheanfire/cloud-init | tests/unittests/test_handler/test_handler_ca_certs.py | Python | gpl-3.0 | 10,161 |
"""
NOTE: this code is a legacy from the early days of the application,
and currently not used.
"""
from __future__ import annotations
import json
from flask import Blueprint, make_response, request
from flask_login import current_user, login_required
from abilian.core.extensions import db
from abilian.core.models.... | abilian/abilian-sbe | src/abilian/sbe/apps/social/restapi.py | Python | lgpl-2.1 | 7,998 |
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
class hr(osv.osv):
_inherit = 'hr.employee'
_columns = {
'website_published': fields.boolean('Available in the website', copy=False),
'public_info': fields.text('Public Info'),
}
_defaults = {
'website_published': Fal... | mycodeday/crm-platform | website_hr/models/hr.py | Python | gpl-3.0 | 329 |
import pytest
from pages.treeherder import TreeherderPage
@pytest.mark.nondestructive
def test_load_next_results(base_url, selenium):
page = TreeherderPage(selenium, base_url).open()
assert len(page.result_sets) == 10
page.get_next_ten_results()
assert len(page.result_sets) == 20
page.get_next_... | tojonmz/treeherder | tests/jenkins/tests/test_load_page_results.py | Python | mpl-2.0 | 483 |
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.contrib.auth import logout
from django.contrib.auth.models import User
from boards.models import Board, List, ListEntry, Comment
from django.http import Http404
@login_required
def bo... | KristianTashkov/prello | boards/views.py | Python | gpl-2.0 | 6,498 |
# Copyright (c) 2003-2009 Ralph Meijer
# See LICENSE for details.
"""
Tests for L{wokkel.disco}.
"""
from zope.interface import implements
from twisted.internet import defer
from twisted.trial import unittest
from twisted.words.protocols.jabber.jid import JID
from twisted.words.protocols.jabber.xmlstream import toRe... | dustin/wokkel | wokkel/test/test_disco.py | Python | mit | 28,055 |
""" Utilities for matplotlib examples """
import pylab
from numpy import ones, array, double, meshgrid, reshape, linspace, \
concatenate, ravel, pi, sinc
from numpy.random import randn, rand
from modshogun import BinaryLabels, RegressionLabels, RealFeatures, SparseRealFeatures
QUITKEY='q'
NUM_EXAMPLES=100
DISTANCE=2... | AzamYahya/shogun | examples/undocumented/python_modular/graphical/util.py | Python | gpl-3.0 | 2,670 |
import factory
import datetime
from factory.django import DjangoModelFactory
from django.test import TestCase
from django.utils import timezone
from events.models import Tournament, Participant, Event
from members.models import Person, InvoiceItem, ItemType, Subscription
import logging
logger = logging.getLogger("fact... | ianastewart/cwltc-admin | events/tests/test_billing.py | Python | mit | 4,895 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
import numpy.ma as ma
from astropy.convolution.convolve import convolve, convolve_fft
from astropy.convolution.kernels import Gaussian2DKernel
from astropy.utils.exceptions import AstropyUserWarning
from astropy import un... | StuartLittlefair/astropy | astropy/convolution/tests/test_convolve.py | Python | bsd-3-clause | 42,432 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import nltk.sem.logic as nll
from .condition import Condition
tlp = nll.LogicParser(type_check=True)
class SemRepRule:
"""A rule assigning a semantic representation if conditions are met.
A SemRepRule object consists of conditions that can be appl... | Simon-Will/montesniere | montesniere/assign.py | Python | gpl-3.0 | 8,858 |
import zlib
import httplib
import urllib
import urllib2
import gzip
import StringIO
import json
from urlparse import urlparse
# POST
def post(host, url, params):
parameters = urllib.urlencode(params)
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain",
"Accept... | camalot/plugin.video.microsoftvirtualacademy | resources/lib/http_request.py | Python | apache-2.0 | 2,566 |
from mod_base import *
class AutoReJoin(Listener):
"""Automatically rejoin a channel after kick."""
def init(self):
self.events = [IRC_EVT_CHAN_KICK]
def event(self, event):
print event
print self.bot.me
print event.user
if event.user.GetNick() == self.bot.me.GetNic... | richrd/bx | modules/autorejoin.py | Python | apache-2.0 | 463 |
import argparse
import glob
import collections
import itertools
import random
import matplotlib
matplotlib.use("AGG")
import matplotlib.pyplot as plt
import cv2
import numpy as np
import os
import pipeline
_WINDOW_NAME = "Pipeline"
def add_and_return(s, x):
s.add(x)
return x
def advance(pos, npos):
pos = ... | danblick/robocar | lines/inspect_stage.py | Python | mit | 6,898 |
from mock import Mock
import numpy
import pytest
import theano
class TestLayer:
@pytest.fixture
def layer(self):
from nntools.layers.base import Layer
return Layer(Mock())
def test_get_output_shape(self, layer):
assert layer.get_output_shape() == layer.input_layer.get_output_shape... | 317070/nntools | nntools/tests/test_layers.py | Python | mit | 11,170 |
def VtkDefineIdFilter(nmbIdFilter):
# vtkIdFilter genera escalares a partir del identificador
nmbIdFilter= vtk.vtkIdFilter()
nmbIdFilter.SetInput(ugrid)
nmbIdFilter.CellIdsOff()
nmbIdFilter.PointIdsOff()
| lcpt/xc | python_modules/postprocess/xcVtk/vtk_define_id_filter.py | Python | gpl-3.0 | 215 |
"""empty message
Revision ID: 29d499553de3
Revises: 4b5f6069c5df
Create Date: 2015-03-11 10:34:38.801595
"""
# revision identifiers, used by Alembic.
revision = '29d499553de3'
down_revision = '4b5f6069c5df'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | jglamine/phamdb | webphamerator/migrations/versions/29d499553de3_.py | Python | gpl-3.0 | 506 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2018 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ver... | timlinux/geonode | geonode/apps.py | Python | gpl-3.0 | 1,315 |
speed = [0.1, 17.5, 40, 48, 52, 69, 88]
lifespan = [2, 8, 70, 1.5, 25, 12, 28]
index = ['snail', 'pig', 'elephant',
'rabbit', 'giraffe', 'coyote', 'horse']
df = pd.DataFrame({'speed': speed,
'lifespan': lifespan}, index=index)
ax = df.plot.bar(rot=0)
| datapythonista/datapythonista.github.io | docs/new-pandas-doc/generated/pandas-DataFrame-plot-bar-2.py | Python | apache-2.0 | 279 |
# Задача 2. Вариант 8.
#Напишите программу, которая будет выводить на экран наиболее понравившееся вам высказывание, автором которого является Лао-Цзы. Не забудьте о том, что автор должен быть упомянут на отдельной строке.
# Ionova A. K.
#30.04.2016
print("Нельзя обожествлять бесов.\n\t\t\t\t\t\t\t\tЛао-цзы")
... | Mariaanisimova/pythonintask | INBa/2015/Ionova_A_K/task_2_8.py | Python | apache-2.0 | 579 |
#!/usr/bin/env python
from flup.server.fcgi import WSGIServer
from frontend import app
WSGIServer(app, bindAddress=app.config['FCGI_SOCKET']).run()
| jkossen/imposter | examples/frontend_fcgi.py | Python | bsd-2-clause | 149 |
"""adhoc filters
Revision ID: bddc498dd179
Revises: afb7730f6a9c
Create Date: 2018-06-13 14:54:47.086507
"""
# revision identifiers, used by Alembic.
revision = 'bddc498dd179'
down_revision = '80a67c5192fa'
from collections import defaultdict
import json
import uuid
from alembic import op
from sqlalchemy.ext.decl... | dmigo/incubator-superset | superset/migrations/versions/bddc498dd179_adhoc_filters.py | Python | apache-2.0 | 2,689 |
fileXmlJs = open("demo.xml.js", 'w', encoding="utf-8")
fileXmlJs.write("var xml = '\\" + "\n")
with open("demo.xml", 'r', encoding="utf-8") as f:
for line in f:
fileXmlJs.write(line.replace("\n", "") + "\\\n")
fileXmlJs.write("';")
fileXmlJs.close()
fileXslJs = open("demo.xsl.js", 'w', encoding="utf-8")
fileXslJs.w... | pavelstudeny/mxmlt | updateXmlXlsInJS.py | Python | agpl-3.0 | 506 |
#=======================================================================
# Author: Donovan Parks
#
# Copyright 2009 Donovan Parks
#
# This file is part of GenGIS.
#
# GenGIS 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... | beiko-lab/gengis | plugins/LocationTable/LocationTable.py | Python | gpl-3.0 | 3,479 |
# -*- coding: utf8 -*-
#
# 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... | rdo-management/tuskar-ui | tuskar_ui/infrastructure/flavors/utils.py | Python | apache-2.0 | 3,662 |
#
# Copyright (c) 2015 Intel Corporation
#
# Author: Alberto Murillo <alberto.murillo.silva@intel.com>
#
# 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/... | clearlinux/clearstack | clearstack/templates/horizon.py | Python | apache-2.0 | 756 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import path, getcwd
from collections import defaultdict
config = defaultdict(defaultdict)
config["importer"] = "osm2pgsql" # either 'imposm' or 'osm2pgsql'
# The name given to the style. This is the name it will have in the TileMill
# project list, and a sanitize... | hholzgra/maposmatic-vagrant | files/config-files/osmbright-configure.py | Python | unlicense | 2,366 |
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in... | fener06/pyload | module/plugins/accounts/FreakshareCom.py | Python | gpl-3.0 | 1,957 |
import os
# Django settings for oscar project.
PROJECT_DIR = os.path.dirname(__file__)
location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
DEBUG = True
TEMPLATE_DEBUG = True
SQL_DEBUG = True
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
EMAIL_BACKEND = 'django.core.mail.bac... | britco/django-oscar-stripe | sandbox/settings.py | Python | bsd-3-clause | 7,734 |
from underthesea import word_sent
from underthesea.pos_tag.model import CRFModel
def pos_tag(sentence, format=None):
"""
part of speech tagging
:param unicode|str sentence: raw sentence
:return: tagged sentence
:rtype: list
"""
sentence = word_sent(sentence)
crf_model = CRFModel... | rain1024/underthesea | underthesea/pos_tag/pos_tag.py | Python | gpl-3.0 | 400 |
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import render
from django.utils.html import escape
from django.views.decorators.csrf import ensure_csrf_cookie
from django.contrib.auth import authenticate, login, logout
import json
# Create your views here.
@ensure_csrf_cookie
def index... | saigkrish/finance | PY/views.py | Python | apache-2.0 | 3,119 |
#!/usr/bin/python3
class Person:
def sayHi(self):
print('Hello, how are you?')
p = Person()
p.sayHi()
| louistin/thinkstation | a_byte_of_python/unit_12_object_oriented_programming/method.py | Python | mit | 116 |
# test_num = 1406357289
import time
def is_pandigital(num):
set_of_num = set(i for i in str(num))
set_of_all_digits = set(str(i) for i in range(0, 10))
return len(str(num)) == len(set_of_num) and set_of_all_digits.difference(set_of_num) == set()
start_time = time.time()
multiples_of_17 =[str(i*17).zfill(3... | BinDigit1/EulerProjects | Problem 43/substring_divisibility.py | Python | gpl-2.0 | 1,358 |
import job
import ci
import response
| vincent-psarga/job-sensors | src/jobsensors/jobs/__init__.py | Python | gpl-2.0 | 37 |
from openpds.core.models import *
from django.contrib import admin
def resetDays(modeladmin, request, queryset):
for q in queryset:
if q.start and q.end:
days = int((int(q.end.strftime("%s")) - int(q.start.strftime("%s"))) / 60.0/60.0/24.0)
if q.days != days:
q.days ... | eschloss/FluFuture | openpds/core/admin.py | Python | mit | 1,670 |
# -*- coding: utf-8 -*-
# © 2015 Oihane Crucelaegui
# © 2015 Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Partner multi-company",
"summary": "Select individually the partner visibility on each company",
"version": "8.0.1.0.1",
... | acsone/multi-company | partner_multi_company/__openerp__.py | Python | agpl-3.0 | 817 |
#!/usr/bin/env python
import warnings
import numpy as np
import pandas as pd
import pandas.compat as compat
import pandas_ml.imbaccessors as imbaccessors
import pandas_ml.skaccessors as skaccessors
import pandas_ml.smaccessors as smaccessors
import pandas_ml.snsaccessors as snsaccessors
import pandas_ml.... | sinhrks/expandas | pandas_ml/core/frame.py | Python | bsd-3-clause | 32,117 |
# MolMod is a collection of molecular modelling tools for python.
# Copyright (C) 2007 - 2008 Toon Verstraelen <Toon.Verstraelen@UGent.be>
#
# This file is part of MolMod.
#
# MolMod 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... | woutersmet/Molmodsummer | test/binning.py | Python | gpl-3.0 | 6,466 |
"""
WSGI config for miniature 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_APPLICATION`... | vitorh45/django-ecommerce-exemplo1 | django-cielo-exemplo/wsgi.py | Python | apache-2.0 | 1,151 |
from service import *
db = PymongoManger().getNew()
distinct_domain = db.users.find().distinct("web_accounts.domain");
for domain in distinct_domain:
account_count = db.users.find({"web_accounts.domain":domain}).count()
print "%s: %d" % (domain,account_count)
| kittolau/selepy | db_users_stat.py | Python | mit | 270 |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLI... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_lib_mpp_oper.py | Python | apache-2.0 | 17,334 |
age = dict(tom=23, jane=32, mike=27, linda=25)
print(age['mike'])
print(age['linda'])
print(age['jane'])
print(age['tom'])
| codermoji-contrib/python | start/Intro to Dicts/printdict/printval4.py | Python | mit | 123 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# jeepr documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 27 14:05:23 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... | agile-geoscience/jeepr | docs/conf.py | Python | apache-2.0 | 5,577 |
'''
Created on May 17, 2013
@author: Yubin Bai
'''
class Solution:
# permute the sequence in place, allows duplicate elements
# raise error if reached end of permutation
# @param num, a list of integer
# @return a list of integer
def nextPermutation(self, num):
size = len(num)
if ... | asraf209/leetcode | src/nextPermutation/main.py | Python | gpl-3.0 | 1,127 |
"""
Classes to support [encrypted] database export and import.
Classes in this module do not write out any files to the filesystem; it is the
responsibility of the calling code to handle the persistence of any file streams
(and make sure it's done securely, etc.).
"""
import os
import abc
from cStringIO import StringI... | EliAndrewC/ensconce | ensconce/export.py | Python | bsd-3-clause | 15,339 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2017_10_01/aio/operations/_security_rules_operations.py | Python | mit | 22,275 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2019 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.... | rbaumg/trac | trac/versioncontrol/api.py | Python | bsd-3-clause | 52,009 |
# coding=latin-1
from flask import request, g
from flask import abort, flash
from functools import wraps
def checa_permissao(permissao):
def decorator(f):
@wraps(f)
def inner(*args, **kwargs):
if g.user and g.user.checa_permissao(permissao):
return f(*args, *... | dedeco/cnddh-denuncias | cnddh/decorators.py | Python | apache-2.0 | 593 |
from testbase import *
import simpleobsoletestests
# Obsolete for conflict
class ComplicatedTests(OperationsTests):
@staticmethod
def buildPkgs(pkgs, *args):
simpleobsoletestests.SimpleObsoletesTests.buildPkgs(pkgs)
# conflicts
pkgs.conflicts = FakePackage('super-zippy', '0.3', '1', '0... | ErwanAliasr1/yum | test/operationstests.py | Python | gpl-2.0 | 11,202 |
'''
sipShell2Abq.py: procedure part of the 2DImage2Mesh project
Create a 2D quadrangular mesh or a 3D hexahedral mesh (extrusion mesh) from one image using scanIP (Simpleware Ltd) and Abaqus (Dassault Systeme)
----------------------------------------------
INSTRUCTIONS: see readme.md
-----------------------------------... | mengomarlene/2DImage2Mesh | sipShell2Abq.py | Python | gpl-2.0 | 7,935 |
#!/usr/bin/env python
"""
Manipulates MacBinary files.
"""
from __future__ import absolute_import
from classicbox.io import BytesIO
from classicbox.io import print_structure_format
from classicbox.macbinary import _MACBINARY_HEADER_MEMBERS
from classicbox.macbinary import print_macbinary
from classicbox.macbinary im... | davidfstr/ClassicBox | macbinary_file.py | Python | gpl-2.0 | 1,986 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name = 'c2c.recipe.cssmin',
version = '0.6',
license = 'MIT License',
author = 'Frederic Junod',
author_email = 'frederic.junod@camptocamp.com',
url = 'https://github.com/camptocamp/c2c.recipe.cs... | camptocamp/c2c.recipe.cssmin | setup.py | Python | mit | 933 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathPostProcessor.py | Python | lgpl-2.1 | 4,419 |
"""
Currency exchange rate support that comes from fixer.io.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.fixer/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SC... | Smart-Torvy/torvy-home-assistant | homeassistant/components/sensor/fixer.py | Python | mit | 3,748 |
# Copyright 2012 OpenStack Foundation
#
# 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 ... | Hybrid-Cloud/cinder | cinder/api/contrib/used_limits.py | Python | apache-2.0 | 2,116 |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
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... | eswartz/RenderPipeline | rpcore/native/__init__.py | Python | mit | 3,413 |
import redis
from os import chdir
from subprocess import check_call as call
import traceback
rd = redis.StrictRedis(host='localhost', port=6379, db=0)
try:
mapping_keys = rd.keys("rosetta-mapping-*")
for key in mapping_keys:
rd.delete(key)
call(["curl", "-XDELETE", "http://localhost:9200/throwtab... | xkxx/algodb | AlgorithmNames/reindex_rosetta.py | Python | mit | 1,311 |
import re
import yaml
from . import gcloud
from .cluster_config import ClusterConfig
DEFAULT_PROPERTIES = {
"spark:spark.task.maxFailures": "20",
"spark:spark.driver.extraJavaOptions": "-Xss4M",
"spark:spark.executor.extraJavaOptions": "-Xss4M",
'spark:spark.speculation': 'true',
"hdfs:dfs.replic... | hail-is/hail | hail/python/hailtop/hailctl/dataproc/start.py | Python | mit | 20,216 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta 4
# Copyright 2015 tvalacarta@gmail.com
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#
# Distributed under the terms of GNU General Public License v3 (GPLv3)
# http://www.gnu.org/licenses/gpl-3.0.html
# --... | ChopChopKodi/pelisalacarta | python/main-classic/core/channeltools.py | Python | gpl-3.0 | 10,879 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
from lxml import html
import re
from lltk.scraping import DictScraper, register
class LeoIt(DictScraper):
def __init__(self, word):
super(LeoIt, self).__init__(word)
self.name = 'Leo.org'
self.url = 'http://dict.leo.org/dictQuery/m-vocab/itde/de.html... | lltk/lltk | lltk/it/scrapers/leo.py | Python | lgpl-3.0 | 2,175 |
from functools import wraps
import numpy
from theano import scalar as scal, Constant
from theano.gof import local_optimizer
from theano.tensor import (DimShuffle, get_scalar_constant_value,
NotScalarConstantError)
from .basic_ops import GpuFromHost, HostFromGpu, GpuAllocEmpty
from .elemwis... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/Theano-0.7.0-py3.4.egg/theano/sandbox/gpuarray/opt_util.py | Python | gpl-2.0 | 11,439 |
#!/usr/bin/env python3
#
# Copyright (C) 2015 Clifford Wolf <clifford@clifford.at>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTW... | SymbiFlow/icestorm | icebox/icebox_maps.py | Python | isc | 5,109 |
import mock
from nose import tools as nt
from django.test import RequestFactory
from django.core.urlresolvers import reverse
from django.core.exceptions import PermissionDenied
from django.contrib.auth.models import Permission
from tests.base import AdminTestCase
from tests.factories import AuthUserFactory, ProjectFac... | hmoco/osf.io | admin_tests/nodes/test_views.py | Python | apache-2.0 | 8,170 |
"""
Streamline plotting like Mathematica.
Copyright (c) 2011 Tom Flannaghan.
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, co... | juselius/gimic | src/pygimic/streamplot.py | Python | gpl-2.0 | 15,026 |
"""Support for Axis devices."""
import logging
from homeassistant.const import CONF_DEVICE, EVENT_HOMEASSISTANT_STOP
from .const import DOMAIN as AXIS_DOMAIN
from .device import AxisNetworkDevice
LOGGER = logging.getLogger(__name__)
async def async_setup(hass, config):
"""Old way to set up Axis devices."""
... | tchellomello/home-assistant | homeassistant/components/axis/__init__.py | Python | apache-2.0 | 1,685 |
###########################################################################
# (C) Vrije Universiteit, Amsterdam (the Netherlands) #
# #
# This file is part of AmCAT - The Amsterdam Content Analysis Toolkit #
# ... | tschmorleiz/amcat | api/rest/viewsets/sentence.py | Python | agpl-3.0 | 2,235 |
from lib import action
class VaultIsInitializedAction(action.VaultBaseAction):
def run(self):
return self.vault.is_initialized()
| pidah/st2contrib | packs/vault/actions/is_initialized.py | Python | apache-2.0 | 143 |
import zipfile
import io
from datetime import datetime
from util.ncconv.experimental.ocg_converter.subocg_converter import SubOcgConverter
#from xml.sax.saxutils import escape
class KmlConverter(SubOcgConverter):
'''Converts data to a KML string'''
def _convert_(self,request):
from pykml.factory i... | OpenSource-/OpenClimateGIS | src/openclimategis/util/ncconv/experimental/ocg_converter/kml.py | Python | bsd-3-clause | 9,896 |
## features.py
##
## Copyright (C) 2003-2004 Alexey "Snake" Nezhdanov
##
## 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, or (at your option)
## any later versio... | jjculber/xmpp-server-scanner | pybot/include/xmpp/features.py | Python | gpl-2.0 | 8,833 |
"""A writable test, not specifically important what is tested"""
from django.db import transaction
from django.db.utils import IntegrityError
from django.test import TestCase
from .models import Lead, User
class Test(TestCase):
databases = '__all__'
def test_lead_owner_without_default(self):
test_us... | django-salesforce/django-salesforce | tests/no_salesforce/tests.py | Python | mit | 939 |
# 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
# ... | roopali8/keystone | keystone/server/common.py | Python | apache-2.0 | 1,635 |
import networkx as nx
from bokeh.io import output_file, show
from bokeh.plotting import figure, from_networkx
G = nx.karate_club_graph()
plot = figure(title="Networkx Integration Demonstration", x_range=(-1.1,1.1), y_range=(-1.1,1.1),
tools="", toolbar_location=None)
graph = from_networkx(G, nx.spring... | ericmjl/bokeh | sphinx/source/docs/user_guide/examples/graph_networkx.py | Python | bsd-3-clause | 428 |
import hashlib
from io import StringIO
from datetime import timedelta
import re
import random
import string
import struct
import time
import sys
import shutil
import subprocess
import os
import numpy as np
import requests
import tempfile
import uuid
from studio.storage import storage_setup
from studio.storage.storage_t... | studioml/studio | studio/extra_util.py | Python | apache-2.0 | 7,782 |
'''Jira client can be found at https://github.com/zebpalmer/JiraClient''' | Badger32d/JiraClient | jiraclient/__init__.py | Python | gpl-3.0 | 73 |
from __future__ import division
import operator
import os
import itertools
from django.template import loader
import olympia.core.logger
from olympia import amo
from olympia.amo.celery import task
from olympia.amo.decorators import use_primary_db
from olympia.amo.utils import extract_colors_from_image, pngcrush_imag... | eviljeff/olympia | src/olympia/versions/tasks.py | Python | bsd-3-clause | 4,306 |
"""Primary methods that power time2relax."""
import json
from posixpath import join as urljoin
from requests import compat
from time2relax import utils # pylint: disable=import-self
_LIST = "_list"
_SHOW = "_show"
_VIEW = "_view"
def all_docs(**kwargs):
"""Fetch multiple documents.
- http://docs.couchdb... | rwanyoike/time2relax | time2relax/time2relax.py | Python | mit | 11,119 |
#!/usr/bin/env python
########################################################################
# File : dirac-admin-get-pilot-info
# Author : Ricardo Graciani
########################################################################
"""
Retrieve available info about the given pilot
Example:
$ dirac-admin-get-pilo... | ic-hep/DIRAC | src/DIRAC/Interfaces/scripts/dirac_admin_get_pilot_info.py | Python | gpl-3.0 | 4,570 |
#!/usr/bin/python3
# Tool to help searching the database
import argparse
import sqlite3
# Arguments
parser = argparse.ArgumentParser(description='Interactive SQLite3 Search Tool')
parser.add_argument('fname',action='store',nargs=1,help='Database file',
metavar='FILE')
args = vars(parser.parse_args())
conn = sqlit... | henfredemars/python-personal-projects | PyArchive/Search.py | Python | mit | 1,291 |
from selenium import webdriver
from unittest import skip
import unittest
from django.test import LiveServerTestCase
from selenium.webdriver.common.keys import Keys
import time
class NewVisitorTest(LiveServerTestCase):
def setUp(self):
self.browser=webdriver.Firefox()
self.browser.implicitly_wait(3)
... | HaoPatrick/tdd-pyhton | functional_tests/bse.py | Python | mit | 1,224 |
#
# python module SettingReader.py
#
# Version: 0.0.1
# Author: Nguyen Linh
# Contact: nvl1109@gmail.com
# License: MIT License
#
# Tested with python 2.7 and 3.2
#
# Copyright (c) 2013 Alejandro Lopez Correa
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy... | nvl1109/testclient | lib/SettingReader.py | Python | gpl-2.0 | 1,916 |
# Copyright (C) 2015 Jeffrey Meyers
# This program is released under the "MIT License".
# Please see the file COPYING in the source
# distribution of this software for license terms.
import os
import sys
import time
import json
from decimal import Decimal
from flask import make_response, Blueprint, redirect
from fla... | TransitSurveyor/Dashboard | dashboard/mod_onoff/views.py | Python | mit | 9,739 |
#!/usr/bin/env python3
class ShellSort(object):
def __init__(self, elements, gaps):
self._elements = elements
self._gaps = gaps
def sort(self):
size = len(self._elements)
for gap in reversed(self._gaps):
if (gap > size):
continue
for idx ... | bertothunder/coursera-algorithms | ShellSort.py | Python | gpl-3.0 | 1,843 |
#-*-coding:utf-8-*-
from pyramid.events import subscriber
from ..events.resources import (
ResourceCreated,
ResourceChanged,
ResourceDeleted,
ResourceAssigned,
)
from ..scheduler.notifications import add_notification
from ..bl.subscriptions import subscribe_resource
@subscriber(ResourceCreated)
def... | mazvv/travelcrm | travelcrm/lib/subscribers/resources.py | Python | gpl-3.0 | 796 |
# -*- coding:utf-8 -*-
import unittest
import mock
from ..models import JobPosting
class JobPostingTestCase(unittest.TestCase):
def test_unicode_should_return_position_name(self):
# setup
model = JobPosting()
model.position_name = 'Position Name'
# action
email = unicode(... | hellhovnd/dentexchange | dentexchange/apps/employer/tests/test_job_posting.py | Python | bsd-3-clause | 398 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ... import units as u
from ..distances import Distance
from ..builtin_frames import (ICRS, FK5, ... | AustereCuriosity/astropy | astropy/coordinates/tests/test_celestial_transformations.py | Python | bsd-3-clause | 11,657 |
# -*- coding: cp1252 -*-
from __future__ import division
from sys import argv
from math import floor, fabs, log10, pow
# codigo encontrado em:
# http://stackoverflow.com/questions/15733772/convert-float-number-to-string-with-engineering-notation-with-si-prefixe-in-py
def ToSI(d):
incPrefixes = ['k', 'M', '... | felipeband/ASP | source/vv.py | Python | apache-2.0 | 1,372 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.