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 -*-
# installed helper list
INSTALLED_HELPERS = (
'dc',
)
| tao12345666333/Talk-Is-Cheap | python/hayate/helpers/settings.py | Python | mit | 82 |
#!/usr/bin/env python
import datetime
import re
from mongokit import Document
from app_creator import app, connection
Document.authorized_types.append(basestring)
def email_validator(value):
email = re.compile(r"(?:^|\s)[-a-z0-9_.]+@(?:[-a-z0-9]+\.)+[a-z]{2,6}(?:\s|$)",re.IGNORECASE)
return bool(email.match(v... | kailashbuki/predator | installed/webserver/models/documents.py | Python | mit | 1,369 |
#!/usr/bin/env python
def iterate_list():
for item in [ 1, 2, 3 ]:
yield item
def identity(object):
return object
def simple_callback(callback, value):
return callback(value)
def simple_generator(callback):
output = []
for i in callback():
output.append(i)
return output
def named_args(arg1, arg... | newcontext/rubypython | spec/python_helpers/basics.py | Python | mit | 409 |
# -*- coding: utf-8 -*-
# 2005/12/06
# Version 0.2.4
# pathutils.py
# Functions useful for working with files and paths.
# http://www.voidspace.org.uk/python/recipebook.shtml#utils
# Copyright Michael Foord 2004
# Released subject to the BSD License
# Please see http://www.voidspace.org.uk/python/license.shtml
# For ... | amir-zeldes/rstWeb | modules/pathutils.py | Python | mit | 19,405 |
# Databricks notebook source
# MAGIC %md
# MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html)
# MAGIC
# MAGIC This is a 2019-2021 augmentation and update of [Adam Breindel](https://www.linkedin.com/in/adbreind)'s initial ... | lamastex/scalable-data-science | dbcArchives/2021/000_6-sds-3-x-dl/050_DLbyABr_01-Intro.py | Python | unlicense | 11,517 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8 -*-
# (c) Valik mailto:vasnake@gmail.com
r""" Map Feature Server module.
Featureserver realization for API
http://resources.arcgis.com/en/help/rest/apiref/fslayer.html
Copyright 2012-2013 Valentin Fedulov
This file is part of Mapfeatureserver.
Mapf... | vasnake/mapfeatureserver | wsgi/layermeta.py | Python | gpl-3.0 | 5,685 |
"""Support for IKEA Tradfri lights."""
import logging
from homeassistant.components.light import (
ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, ATTR_HS_COLOR, ATTR_TRANSITION,
PLATFORM_SCHEMA as LIGHT_PLATFORM_SCHEMA, SUPPORT_BRIGHTNESS,
SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_TRANSITION, Light)
from homeassistant... | jnewland/home-assistant | homeassistant/components/tradfri/light.py | Python | apache-2.0 | 13,016 |
#!/usr/bin/python2.4
# Copyright 2009, Google Inc.
# All rights reserved.
#
# 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 copyright
# notice, this list of... | nguyentran/openviber | tools/swtoolkit/site_scons/pulse_latest.py | Python | mit | 3,490 |
from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy import array, arange, nditer, all
from numpy.compat import asbytes, sixu
from numpy.core.multiarray_tests import test_nditer_too_large
from numpy.testing import (
run_module_suite, assert_, assert_equal, asse... | AustereCuriosity/numpy | numpy/core/tests/test_nditer.py | Python | bsd-3-clause | 103,893 |
python -c 'import sys; print sys.stdin.read().upper(),'
| anokata/pythonPetProjects | var_scripts/to_upper.py | Python | mit | 56 |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015-2019 OpenCraft <contact@opencraft.com>
#
# 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 Fre... | open-craft/opencraft | pr_watch/tests/test_github.py | Python | agpl-3.0 | 8,209 |
from ..model.model_base import ModelBase
from ..model import build_model
import inspect, warnings
class EstimatorAttributeError(AttributeError):
def __init__(self,obj,method):
super(AttributeError, self).__init__("No {} method for {}".format(method,obj.__class__.__name__))
class H2OEstimator(ModelBase):
"""H... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/h2o/estimators/estimator_base.py | Python | apache-2.0 | 4,467 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Noah Sparks <nsparks@outlook.com>
# Copyright: (c) 2017, Henrik Wallström <henrik@wallstroms.nu>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | anryko/ansible | lib/ansible/modules/windows/win_iis_webbinding.py | Python | gpl-3.0 | 4,112 |
#!/usr/bin/env python
#
# code inspired by Raymond Hettinger's LFU and LRU cache decorators
# on http://code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators
# and subsequent forks as well as the version available in python3.3
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 201... | RaoUmer/klepto | klepto/_cache.py | Python | bsd-3-clause | 54,384 |
"""
Runs peaktrough.py, which generates Cooley-Rupert figures for specified
series from FRED.
Execute peaktrough.py first, then run this program.
Written by Dave Backus under the watchful eye of Chase Coleman and Spencer Lyon
Date: July 10, 2014
"""
# import functions from peaktrough.py. * means all of them
# genera... | DaveBackus/Data_Bootcamp | Code/Lab/fred_CooleyRupert_run.py | Python | mit | 1,002 |
import pytest
import json
import os
class TestOSDs(object):
@pytest.mark.no_docker
def test_ceph_osd_package_is_installed(self, node, host):
assert host.package("ceph-osd").is_installed
def test_osds_listen_on_public_network(self, node, host):
# TODO: figure out way to paramaterize this ... | font/ceph-ansible | tests/functional/tests/osd/test_osds.py | Python | apache-2.0 | 3,429 |
#!/usr/bin/env python
# encoding: utf-8
# hugin
import hugin.analyze as plugin
from hugin.harvest.session import Session
class PlotLangChange(plugin.IModifier):
def __init__(self):
self._session = Session()
def modify(self, movie, attr_name='plot', change_to='en'):
query = self._session.cre... | qitta/libhugin | hugin/analyze/modifier/plotlangchange/plotlangchange.py | Python | gpl-3.0 | 832 |
import _plotly_utils.basevalidators
class TemplateitemnameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="templateitemname",
parent_name="parcoords.dimension",
**kwargs
):
super(TemplateitemnameValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/parcoords/dimension/_templateitemname.py | Python | mit | 473 |
"""
Course Goals Models
"""
from django.contrib.auth.models import User
from django.db import models
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _
from opaque_keys.edx.django.models import CourseKeyField
from model_utils import Choices
from .api import add_course_goal, re... | Stanford-Online/edx-platform | lms/djangoapps/course_goals/models.py | Python | agpl-3.0 | 2,077 |
#!/usr/bin/env python
'''
Copyright (C) 2007 John Beard john.j.beard@gmail.com
##This extension allows you to draw a Cartesian grid in Inkscape.
##There is a wide range of options including subdivision, subsubdivions
## and logarithmic scales. Custom line widths are also possible.
##All elements are grouped with simi... | step21/inkscape-osx-packaging-native | packaging/macosx/Inkscape.app/Contents/Resources/extensions/grid_cartesian.py | Python | lgpl-2.1 | 14,260 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | GoogleCloudPlatform/python-compat-runtime | appengine-compat/exported_appengine_sdk/google/appengine/datastore/entity_pb.py | Python | apache-2.0 | 141,499 |
import sys
__author__ = 'abhishekanurag'
'''
Given N lists of different sizes produce N-tuple cross product of them
'''
def cross_product(lists):
sizes = []
for some_list in lists:
size = len(some_list)
if size == 0:
return []
sizes.append(size)
counters = [0] * len(l... | AA33/dsa_exp | l33t_code/cross_product.py | Python | gpl-3.0 | 1,208 |
from threading import RLock
import hashlib
import secrets
import sockServer
import binascii
import datetime
from sagittarius import sagGame
rng = secrets.SystemRandom()
class data:
def __init__(self, debug):
self.debug = debug
self.lock = RLock()
self.users = []
self.sagGames = []
... | JaredButcher/dayOfSagittariusIII | Server/dataManagement.py | Python | mit | 3,256 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
feedjack
Gustavo Picón
update_feeds.py
"""
import os
import time
import optparse
import datetime
import socket
import traceback
import sys
import feedparser
try:
import threadpool
except ImportError:
threadpool = None
VERSION = '0.9.16'
URL = 'http://www.fe... | SerCna/feedjack | feedjack/bin/feedjack_update.py | Python | bsd-3-clause | 17,855 |
# -*- coding: utf-8 -*-
"""
Audits WikiProjects for inconsistencies between their project pages and their categories
Copyright (C) 2015 James Hare
Licensed under MIT License: http://mitlicense.org
"""
import pywikibot
from project_index import WikiProjectTools
class ProjectCategoryAudit:
def go(self):
w... | harej/wikiproject_scripts | unported/project_category_audit.py | Python | mit | 3,608 |
from twilio.rest import TwilioRestClient
# put your own credentials here
ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
AUTH_TOKEN = "your_auth_token"
client = TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
client.messages.create(
to="+15558675309",
from_="+15017250604",
body="McAvoy or Stewart? These tim... | teoreteetik/api-snippets | rest/messages/send-sms-callback/send-sms-callback.5.x.py | Python | mit | 403 |
import pandas as pd
import numpy as np
import cython as cy
#coding=UTF8
class Strategy(object):
_capital = cy.declare(cy.double)
_net_flows = cy.declare(cy.double)
_last_value = cy.declare(cy.double)
_last_price = cy.declare(cy.double)
_last_fee = cy.declare(cy.double)
def run(self):... | dingmingliu/quanttrade | quanttrade/core/strategy.py | Python | apache-2.0 | 1,007 |
# -*- coding: utf-8 -*-
from rpihelper.app import create_app
| Gr1N/rpihelper | rpihelper/__init__.py | Python | mit | 62 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 - INECO PARTNERSHIP LIMITED (<http://www.ineco.co.th>).
#
# This program is free software: you can redistribute it and/or modify
# it under... | jeffery9/mixprint_addons | ineco_crm/__openerp__.py | Python | agpl-3.0 | 1,605 |
import sys
import numpy
import pickle
def gather():
lens={} #length -> [sim,sim....]
for line in sys.stdin:
line=line.strip()
cols=line.split("\t")
if len(cols)==4: #output with numbered lines, drop
cols=cols[1:]
sim,en,fi=cols
sim=float(sim)
fi_le... | TurkuNLP/SRNNMT | s_lengths.py | Python | apache-2.0 | 1,314 |
# here for python3 patch avoid of python2 SyntaxError
import asyncio
from functools import wraps
from inspect import isawaitable
from json import loads
from logging import getLogger
from typing import Coroutine, Tuple, Type
from aiohttp import ClientResponse
# python3.7+ 's asyncio.all_tasks'
try:
_py36_all_task_... | ClericPy/torequests | torequests/_py3_patch.py | Python | mit | 4,572 |
#
# This file is part of LiteX-Boards.
#
# Copyright (c) 2019 Vamsi K Vytla <vamsi.vytla@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
from litex.build.generic_platform import *
from litex.build.xilinx import XilinxPlatform
from litex.build.openocd import OpenOCD
# IOs -------------------------------------------... | litex-hub/litex-boards | litex_boards/platforms/xilinx_ac701.py | Python | bsd-2-clause | 8,668 |
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "... | jai1/pulsar | pulsar-functions/instance/src/main/python/python_instance.py | Python | apache-2.0 | 16,853 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ValidationError, ImproperlyConfigured
from django.test import TestCase
from .fields import IBANField, SWIFTBICField
from .forms import IBANFormField, SWIFTBICFormField
from .validators import IBANValidator, swift_bic_va... | benkonrath/django-iban | django_iban/tests.py | Python | bsd-3-clause | 8,418 |
from __future__ import unicode_literals
from mock import patch
import sure # noqa
from moto.server import main, create_backend_app, DomainDispatcherApplication
def test_wrong_arguments():
try:
main(["name", "test1", "test2", "test3"])
assert False, ("main() when called with the incorrect number ... | rouge8/moto | tests/test_core/test_server.py | Python | apache-2.0 | 1,693 |
"""
Functionality for preprocessing Datasets.
"""
__authors__ = "Ian Goodfellow, David Warde-Farley, Guillaume Desjardins, " \
"and Mehdi Mirza"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow", "David Warde-Farley", "Guillaume Desjardins",
"Meh... | ml-lab/pylearn2 | pylearn2/datasets/preprocessing.py | Python | bsd-3-clause | 58,298 |
###########################################
# Separate Less Loose v1.1 by Kai Kostack #
###########################################
# Separates all connected loose parts in a specific random radius into new objects.
# (Makes larger pieces then regular separate loose.)
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This pr... | KaiKostack/bullet-constraints-builder | kk_bullet_constraints_builder/extern/kk_mesh_separate_less_loose.py | Python | gpl-2.0 | 17,158 |
try:
from cStringIO import StringIO
except ImportError: # pragma: no cover
from io import StringIO # pragma: no cover
assert StringIO # silence PyFlakes
| themattrix/python-abduct | abduct/compat.py | Python | mit | 185 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_unquote,
)
from ..utils import (
ExtractorError,
int_or_none,
JSON_LD_RE,
NO_DEFAULT,
parse_age_limit,
parse_duration,
try_get,... | stannynuytkens/youtube-dl | youtube_dl/extractor/nrk.py | Python | unlicense | 23,638 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# (c) 2012 Michal Kalewski <mkalewski at cs.put.poznan.pl>
#
# This file is a part of the Simple Network Simulator (sim2net) project.
# USE, MODIFICATION, COPYING AND DISTRIBUTION OF THIS SOFTWARE IS SUBJECT TO
# THE TERMS AND CONDITIONS OF THE MIT LICENSE. YOU SHOULD H... | mkalewski/sim2net | sim2net/placement/__init__.py | Python | mit | 941 |
# -*- coding: utf-8 -*-
# vi:tabstop=4:expandtab:sw=4
"""Transliterate Unicode text into plain 7-bit ASCII.
Example usage:
>>> from unidecode import unidecode:
>>> unidecode(u"\\u5317\\u4EB0")
"Bei Jing "
The transliteration uses a straightforward map, and doesn't have alternatives
for the same character based on lan... | rembo10/headphones | lib/unidecode/__init__.py | Python | gpl-3.0 | 2,139 |
# -*- encoding: utf-8 -*-
'''
Created on: 2016
Author: Mizael Martinez
'''
import time
from base_datos import *
from Controlador import *
class Controlador_Principal:
def __init__(self):
self.bd=BaseDatos(False)
print "Constructor..."
def procesarPendiente(self,pendiente):
id_pendientes=pendiente[0]
... | martinezmizael/Compresion-Astrofisica | Servidor_Background/controller/Controlador_Principal.py | Python | mit | 701 |
import pytest
from cloudify_rest_client.exceptions import CloudifyClientError
from integration_tests import AgentlessTestCase
from integration_tests.tests.utils import get_resource as resource
pytestmark = pytest.mark.group_premium
class MultiTenantIDDsTest(AgentlessTestCase):
def setUp(self):
self.cli... | cloudify-cosmo/cloudify-manager | tests/integration_tests/tests/agentless_tests/multi_tenancy/test_idds.py | Python | apache-2.0 | 3,699 |
from .plugin import PlushiePlugin, plushieCmd, commandDoc
import urllib.parse
import urllib.request
import json
import re
# API, Wiki page
BASE_URLS = {
"wikipedia": ("http://en.wikipedia.org/w/api.php", "http://en.wikipedia.org/wiki/"),
"simple": ("http://simple.wikipedia.org/w/api.php", "http://simple.wiki... | Etzos/PlushieBot | plugins/searchplugin.py | Python | gpl-3.0 | 7,177 |
#!/usr/bin/python
from __future__ import print_function
from builtins import map
import collections as c
import itertools as it
import json
import forgi.threedee.model.coarse_grain as ftmc
import forgi.threedee.utilities.graph_pdb as ftug
import forgi.threedee.utilities.pdb as ftup
import forgi.threedee.utilities.vec... | ViennaRNA/forgi | examples/average_atom_positions.py | Python | gpl-3.0 | 1,677 |
from django.conf.urls import patterns, include, url
from pybbm_tag.views import AddPostViewWrapper,ForumViewWrapper, EditPostViewWrapper, TopicViewWrapper
urlpatterns = patterns('',
url('^forum/(?P<forum_id>\d+)/topic/add/$', AddPostViewWrapper.as_view(), name='add_topic'),
url('^forum/(?P<pk>\d+)/$', F... | The-WebOps-Club/odia-forum | pybbm_tag/urls.py | Python | gpl-2.0 | 553 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AlgorithmDialogBase.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*******************... | michaelkirk/QGIS | python/plugins/processing/gui/AlgorithmDialogBase.py | Python | gpl-2.0 | 4,619 |
# Copyright 2015 Antiun Ingenieria S.L. - Antonio Espinosa
# Copyright 2017 Tecnativa - Vicent Cubells
# Copyright 2017 Tecnativa - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import odoo.tests
from odoo.tests import tagged
from ..hooks import post_init_hook
@tagged("post_instal... | OCA/contract | contract_payment_mode/tests/test_contract_payment.py | Python | agpl-3.0 | 4,020 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Pexego Sistemas Informáticos All Rights Reserved
# $Jesús Ventosinos Mayor <jesus@pexego.es>$
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | Pexego/PXGO_00053_2013_VT | project-addons/pmp_landed_costs/__openerp__.py | Python | agpl-3.0 | 1,371 |
#!/usr/bin/python2.4
#
# Copyright 2014 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 require... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/oauth2client/tests/test_oauth2client.py | Python | gpl-3.0 | 41,466 |
# Copyright 2013-2017 The Meson development team
# 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 agree... | rhd/meson | mesonbuild/dependencies/dev.py | Python | apache-2.0 | 11,025 |
#!/usr/bin/env python
""" Read the inferred tree parameters from Connor's json files, and generate a bunch of trees to later sample from. """
import sys
import os
import re
import random
import json
import numpy
import math
from cStringIO import StringIO
import tempfile
from subprocess import check_call
from Bio impor... | matsengrp/bioboxpartis | python/treegenerator.py | Python | gpl-3.0 | 9,031 |
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
class EmailOrUsernameBackend(ModelBackend):
def authenticate(self, username=None, password=None):
try:
kwargs = {'email': username}
user = User.objects.get(**kwargs)
except:
kwargs = {'userna... | haystack/eyebrowse-server | eyebrowse/backends.py | Python | mit | 667 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from trainer.models import Language
class AddWordForm(forms.Form):
language = forms.ModelChoiceField(queryset=Language.objects.all())
word = forms.CharField(required=True)
class Create... | chrigu6/vocabulary | vocabulary/trainer/forms.py | Python | gpl-3.0 | 1,356 |
import cairocffi
from .. import bar, hook
from . import base
class TaskList(base._Widget, base.PaddingMixin, base.MarginMixin):
defaults = [
("font", "Arial", "Default font"),
("fontsize", None, "Font size. Calculated if None."),
("foreground", "ffffff", "Foreground colour"),
(
... | encukou/qtile | libqtile/widget/tasklist.py | Python | mit | 7,183 |
# jhbuild - a tool to ease building collections of source packages
# Copyright (C) 2001-2006 James Henstridge
# Copyright (C) 2003-2004 Seth Nickell
#
# terminal.py: build logic for a terminal interface
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General ... | zhw2101024/jhbuild | jhbuild/frontends/terminal.py | Python | gpl-2.0 | 14,413 |
#!/usr/bin/env python
import docker
import json
import urllib2
import hashlib
import subprocess
import base64
import os
DOCKER_SOCK = 'unix:///docker.sock'
def get(d, *keys):
empty = {}
return reduce(lambda d, k: d.get(k, empty), keys, d) or None
class DockerMonitor(object):
def __init__(self, client):
... | realPy/docker-dyndock | event.py | Python | gpl-2.0 | 2,353 |
# -*- coding: utf-8 -*-
'''
Exodus Add-on
Copyright (C) 2016 Exodus
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 l... | viranch/exodus | resources/lib/sources/crazy.py | Python | gpl-3.0 | 6,195 |
#!/usr/bin/python
#
# (c) 2015, Steve Gargan <steve.gargan@gmail.com>
#
# 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... | ritzk/ansible-modules-extras | clustering/consul_session.py | Python | gpl-3.0 | 9,104 |
# _*_ coding:utf-8 _*_
__author__ = 'Y-ling'
__date__ = '2017/9/15 11:11'
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import unittest
import os
import time
import copy
import utils
from elements_path import LOGIN_FORM, TOP_BAR, CENTER, CENTER_PERSONAL, CENTER_RESET_PA... | cyllyq/nutsbp-test | test_case/demo.py | Python | gpl-2.0 | 407 |
from optparse import make_option
import traceback
import os.path
import pkgutil
from django.core.management.base import BaseCommand
from misago.models import Fixture
from misago.utils.fixtures import load_fixture, update_fixture
import misago.fixtures
class Command(BaseCommand):
"""
Loads Misago fixtures
"... | Maronato/aosalunos | misago/management/commands/syncfixtures.py | Python | gpl-2.0 | 1,851 |
r"""
Utilities and helper classes/functions
======================================
This module contains two very important classes (Project and Workspace)
as well as a number of helper classes.
"""
import logging as logging
from .misc import *
from ._settings import *
from ._workspace import *
from ._project import ... | PMEAL/OpenPNM | openpnm/utils/__init__.py | Python | mit | 983 |
import ply.lex
reserved = { # pattern : token-name
'input' : 'INPUT',
'output' : 'OUTPUT',
'import' : 'IMPORT',
}
# 'tokens' is a special word in ply's lexers.
tokens = [
'LPAREN','RPAREN', # Individual parentheses
'LBRACE','RBRACE', # Individual braces
'OP_ADD','OP_SUB','OP_MUL','OP_DIV', # the four basi... | cs207-project/pype-package | pype/lexer.py | Python | mit | 2,415 |
from ctypes import *
from functools import partial
import sys
_libchewing = None
if sys.platform == "win32": # Windows
import os.path
# find in current dir first
dll_path = os.path.join(os.path.dirname(__file__), "chewing.dll")
if not os.path.exists(dll_path):
dll_path = "chewing.dll" # search ... | chewing/libchewing | contrib/python/chewing.py | Python | lgpl-2.1 | 1,943 |
# Copyright 2012 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 requ... | Vaidyanath/tempest | tempest/api/identity/admin/test_roles.py | Python | apache-2.0 | 4,145 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 19 15:53:32 2018
@author: Han Luo
"""
## read capitelli data
#http://arc.aiaa.org/doi/10.2514/2.6517
import numpy as np
import re
import json
mass = {'N':14.007,'O':15.999,'H':1.008,'C':12.011,'Ar':39.948,
'N2':14.007*2, 'O2':31.9988, 'NO'... | luohancfd/FluidDynamicTools | Thermo_Chemical_Properties/Collision_Integral/RawData/ReadCapitelliTxt.py | Python | gpl-3.0 | 3,647 |
# Copyright 2018 Gergo Rozner
# 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, so... | google/or-tools | examples/contrib/magic_sequence_sat.py | Python | apache-2.0 | 1,485 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine (xbmcmegapack@gmail.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Softwar... | xbmcmegapack/plugin.video.megapack.dev | resources/lib/menus/home_countries_armenia.py | Python | gpl-3.0 | 1,111 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... | offlinehacker/flumotion | flumotion/component/bouncers/admin_gtk.py | Python | gpl-2.0 | 4,963 |
# Copyright (C) 2010 CENATIC: Centro Nacional de Referencia de
# Aplicacion de las TIC basadas en Fuentes Abiertas, Spain.
#
# 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 reta... | helix84/activae | deployment/__init__.py | Python | bsd-3-clause | 3,590 |
"""
URLconf for registration and activation, based on django-registration's
default backend.
"""
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from domain.decorators import login_and_domain_required, domain_admin_required
from user_registration.views import activa... | commtrack/commtrack-core | apps/user_registration/urls.py | Python | bsd-3-clause | 3,504 |
# -*- coding: utf-8 -*-
"""
Written by Daniel M. Aukes.
Email: danaukes<at>seas.harvard.edu.
Please see LICENSE.txt for full license.
"""
import PySide.QtCore as qc
import PySide.QtGui as qg
#import popupcad.graphics2d.modes as modes
#from popupcad.graphics2d.graphicsitems import Common
from popupcad.graphics2d.intera... | Skylion007/popupcad | popupcad/graphics2d/interactivevertex.py | Python | mit | 2,768 |
import time
import datetime
import os
f = open("/home/pi/rpi_automation/water.txt", "r")
last_line = f.readlines()[-1]
f.close()
start_date = time.strftime("%d/%m/%Y")
start_hour = time.strftime("%H:%M:%S")
last_line = last_line.rstrip().replace("'", "").replace("[","").replace("]","")
last_date = last_line.split(",... | midorineko/rpi_automation | water_cron.py | Python | mit | 974 |
#!/usr/bin/env python
"""
shopy-find.py Copyright 2015 by stefanlehmann
"""
import sys
import re
import logging
import webbrowser
from tabulate import tabulate
sys.path.insert(0, '..')
from shopy.shop import Shop
from shopy.utils import iter_shops, green
from shopy import Shoplist
HEADERS = ('nr', 'name', 'pr... | MrLeeh/shopy | scripts/ishopy.py | Python | mit | 2,423 |
def while_func(num, mystep=1):
i = 0
numbers = []
for i in range(0,num,mystep):
# while i < num:
print ("At the top i is %d" % i)
numbers.append(i)
# i = i + mystep
print ("Numbers now: ", numbers)
print ("At the bottom i is %d" % i)
print ("The numbers: "... | Baumelbi/IntroPython2016 | students/jbearer/session02/lpthw_ex33.py | Python | unlicense | 1,188 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2013 ARM Limited
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 ... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/pyOCD/flash/flash_stm32f051.py | Python | apache-2.0 | 3,155 |
# tests for slice objects; in particular the indices method.
import unittest
from test import test_support
import sys
class SliceTest(unittest.TestCase):
def test_constructor(self):
self.assertRaises(TypeError, slice)
self.assertRaises(TypeError, slice, 1, 2, 3, 4)
def test_repr(self):
... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_slice.py | Python | gpl-2.0 | 2,904 |
from django.test import TestCase
from .models import Source, Item
class ReverseSingleRelatedTests(TestCase):
"""
Regression tests for an object that cannot access a single related
object due to a restrictive default manager.
"""
def test_reverse_single_related(self):
public_source = Sou... | rogerhu/django | tests/reverse_single_related/tests.py | Python | bsd-3-clause | 1,443 |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
import tamil
import codecs
# setup the paths
from opentamiltests import *
from ngram.Corpus import Corpus
from ngram import LetterModels
import tamil.utf8 as utf8
class Letters(unittest.TestCase):
def test_data_op(self):
dat = '\x97\xC8\xA2\xD7\xC3\xA... | atvKumar/open-tamil | tests/DemoTest.py | Python | mit | 1,599 |
from django.conf.urls import patterns, url
from cart.views import ItemView
urlpatterns = patterns(
'',
url(r'^(?P<product_id>\d+)/', ItemView.as_view(), name='item'),
)
| sorz/isi | store/cart/urls_api.py | Python | mit | 179 |
#!/usr/bin/env python
"""
lowlink.py
Recursively creates lower case symlinks to filenames with uppercase letters.
(c) 2013 Kasper Souren
See LICENSE
"""
import os
def lowlink(path = '.'):
cwd = os.getcwd() # os.walk can't handle path changes very well
for root, dirs, files in os.walk(path):
... | guaka/lowlink | lowlink.py | Python | mit | 1,121 |
# -*- coding: utf-8 -*-
import json
import datetime
from optionaldict import optionaldict
from wechatpy.client.api.base import BaseWeChatAPI
class WeChatMarketing(BaseWeChatAPI):
API_BASE_URL = "https://api.weixin.qq.com/marketing/"
def add_user_action_sets(self, _type, name, description, version="v1.0")... | wechatpy/wechatpy | wechatpy/client/api/marketing.py | Python | mit | 4,851 |
#!/usr/bin/env python
import sys
import SocketServer
import fply
from config import fplyServerPort as defaultPort
class FPLYService(SocketServer.BaseRequestHandler):
def setup(self):
self.fply = fply.FPLY()
def handle(self):
print "Connection from", self.client_address[0]
data = self.request.recv(self.fply.... | tzwenn/PyOpenAirMirror | fplyServer.py | Python | bsd-2-clause | 812 |
# -*- coding: utf-8 -*-
from django import forms
class FloatField(forms.FloatField):
"""
The internal ``django.forms.FloatField`` does not handle the step value in its number widget.
"""
def __init__(self, *args, **kwargs):
self.step = kwargs.pop('step', None)
super(FloatField, self)._... | adrienbrunet/django-angular | djng/forms/fields.py | Python | mit | 501 |
from email.mime.multipart import MIMEMultipart
import os
from tests.BaseTestClasses import Email2PDFTestCase
class AttachmentDetection(Email2PDFTestCase):
def setUp(self):
super(AttachmentDetection, self).setUp()
self.msg = MIMEMultipart()
def test_pdf_as_octet_stream(self):
self.ad... | andrewferrier/email2pdf | tests/Direct/test_Direct_AttachmentDetection.py | Python | mit | 7,139 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | xpansa/stock-logistics-tracking | stock_tracking_swap_pack/wizard/swap.py | Python | agpl-3.0 | 6,730 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Decorator functions
Created by: Rui Carmo
"""
from bottle import request, response, route, abort
import time, binascii, hashlib, email.utils, functools, json, cProfile, collections
from datetime import datetime
import logging
from core import tb
# Allow importing eve... | rcarmo/python-utils | decorators.py | Python | mit | 7,362 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('oef', '0009_auto_20180131_0938'),
]
def insert_instructions(apps, schema_edit... | philanthropy-u/edx-platform | lms/djangoapps/oef/migrations/0010_load_instructions.py | Python | agpl-3.0 | 16,100 |
import os
import fnmatch
from django.core.management.base import NoArgsCommand, CommandError
from django.conf import settings
from optparse import make_option
from os.path import join as _j
from django_extensions.management.utils import signalcommand
class Command(NoArgsCommand):
option_list = NoArgsCommand.opti... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/django-extensions-1.5.0/django_extensions/management/commands/clean_pyc.py | Python | gpl-2.0 | 1,525 |
#!/usr/bin/env python3
#
# Christian Sommerfeldt Øien
# All rights reserved
from sys import argv
from os import system
from math import exp, log
from argparse import ArgumentParser
def sy(c):
print(c)
system(c)
def linear(a, b, t):
return a + (b - a) * t
def delinear(a, b, t):
return (t ... | biotty/rmg | graphics/baum/zoom_feigen.py | Python | bsd-2-clause | 2,674 |
import subprocess
import logging
from adapter import Adapter
class Logcat(Adapter):
"""
A connection with the target device through logcat.
"""
def __init__(self, device=None):
"""
initialize logcat connection
:param device: a Device instance
"""
self.logger = ... | nastya/droidbot | droidbot/adapter/logcat.py | Python | mit | 1,959 |
from flask import render_template
from flask.ext.login import login_user
from realms import ldap
from flask_ldap_login import LDAPLoginForm
from ..models import BaseUser
users = {}
@ldap.save_user
def save_user(username, userdata):
user = User(userdata.get('username'), userdata.get('email'))
users[user.id] ... | drptbl/realms-wiki-vagrant | realms/modules/auth/ldap/models.py | Python | gpl-2.0 | 1,236 |
import xml.etree.ElementTree as ET
ET._original_serialize_xml = ET._serialize_xml
def _serialize_xml(write, elem, encoding, qnames, namespaces):
if elem.tag == '![CDATA[':
write("<%s%s]]>%s" % (elem.tag, elem.text, "" if elem.tail is None else elem.tail))
return
return ET._original_serialize_... | vamdt/spider | zaobao/rss.py | Python | mit | 3,235 |
#!/usr/bin/env python
r'''
Implementation of the agent algorithm in tables 33-1 and 33-2 of the IDEAL MOOC
lessons, with modifications required in the programming assignment.
For details see http://liris.cnrs.fr/ideal/mooc/lesson.php?n=033
'''
from collections import namedtuple
from itertools import cycle
# Defaul... | xperroni/DevAI2014MOOC | agent03.py | Python | gpl-3.0 | 6,019 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/backend_address_pool.py | Python | mit | 2,947 |
# Copyright ClusterHQ Limited. See LICENSE file for details.
"""
Test utilties for testing the proxy.
"""
from twisted.web import server, resource
import json
class FakeDockerServer(server.Site):
def __init__(self, **kw):
self.root = FakeDockerRoot(**kw)
server.Site.__init__(self, self.root)
c... | mattaitchison/powerstrip | powerstrip/testtools.py | Python | apache-2.0 | 5,021 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... | concordusapps/python-cmislib | src/tests/settings.py | Python | apache-2.0 | 3,135 |
# coding=utf-8
# Copyright 2018 The HuggingFace Inc. team.
#
# 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... | huggingface/transformers | src/transformers/convert_slow_tokenizers_checkpoints_to_fast.py | Python | apache-2.0 | 4,954 |
import unittest
import os.path
import json
from asposestoragecloud.ApiClient import ApiClient
from asposestoragecloud.StorageApi import StorageApi
from asposestoragecloud.ApiClient import ApiException
from asposestoragecloud.models import ResponseMessage
from asposestoragecloud.models import DiscUsageResponse
from asp... | imranwar/AsposeStoragePHP | SDKs/Aspose.Storage_Cloud_SDK_For_Python/tests/test.py | Python | mit | 7,987 |
'''
A utility to monitor source tree and trigger the sphinx_build when changes are detected.
Run it from the root of the src tree in a console as:
python auto_rebuild.py
'''
import os.path
import subprocess
import tornado.autoreload
import tornado.ioloop
#an alternative:
#watchmedo shell-command --pattern="*.rs... | biothings/biothings.api | docs/auto_rebuild.py | Python | apache-2.0 | 1,304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.