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 |
|---|---|---|---|---|---|
"""verify_ganglia_running.py: Script for ganglia initialization action test.
"""
import socket
import subprocess
from requests_html import HTMLSession
BASE = 'localhost'
PORT = 80
class Ganglia(object):
def __init__(self, base, port):
self.path = 'http://{}:{}/ganglia/'.format(base, port)
self.h... | GoogleCloudDataproc/initialization-actions | ganglia/verify_ganglia_running.py | Python | apache-2.0 | 2,442 |
import os
import sys
def colorize(sheet_content):
""" Colorizes cheatsheet content if so configured """
# only colorize if so configured
# if not 'CHEATCOLORS' in os.environ:
# return sheet_content
try:
from pygments import highlight
from pygments.lexers import BashLexer
... | lujinda/cheat | cheat/utils.py | Python | gpl-3.0 | 1,405 |
# Generated by Django 2.0.5 on 2018-06-21 05:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('podcast', '0020_auto_20180621_0526'),
]
operations = [
migrations.AlterField(
model_name='episode',
name='dateCreate... | Arlefreak/ApiArlefreak | podcast/migrations/0021_auto_20180621_0527.py | Python | mit | 533 |
from pyrobot.camera.v4l2 import V4L2Camera
from pyrobot.vision.cvision import VisionSystem
from pyrobot.system.share import ask
def INIT(robot):
retval = ask("Please enter the parameters for the Video4Linux2 Camera",
(("Device", "/dev/video0"),
("Width", "160"),
... | emilydolson/forestcat | pyrobot/plugins/devices/V4L2Camera.py | Python | agpl-3.0 | 805 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | lukecwik/incubator-beam | sdks/python/apache_beam/examples/complete/top_wikipedia_sessions_test.py | Python | apache-2.0 | 2,558 |
from setuptools import setup, find_packages
setup(
name = "django-test-extensions",
version = "0.14",
author = "Gareth Rushgrove",
author_email = "gareth@morethanseven.net",
url = "http://github.com/garethr/django-test-extensions/",
packages = find_packages('src'),
package_dir = {'':'s... | garethr/django-test-extensions | setup.py | Python | mit | 824 |
##
# Copyright 2002-2012 Ilja Livenson, PDC KTH
#
# 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... | livenson/vcdm | src/vcdm/server/cdmi/capabilities.py | Python | bsd-3-clause | 2,341 |
# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest
class RoadsSurfaceCobblestoneValueTransformed(FixtureTest):
def test_transform(self):
# transform cobblestone:flattened to cobblestone_flattened
# Illicha Avenue in Donetsk, Ukraine
se... | mapzen/vector-datasource | integration-test/1337-roads-surface-cobblestone-value-transformed.py | Python | mit | 1,326 |
from io import BytesIO
import os
import zipfile
import numpy as np
import pytest
from pandas import (
DataFrame,
date_range,
read_csv,
read_excel,
read_json,
read_parquet,
)
import pandas._testing as tm
from pandas.util import _test_decorators as td
import pandas.io.common as icom
@pytest.f... | pandas-dev/pandas | pandas/tests/io/test_gcs.py | Python | bsd-3-clause | 5,626 |
import os
import re
import csv
import pypascalmarkup
import numpy as np
import ExifTags
from PIL import Image
from collections import defaultdict
# maps img_id -> img_name, to look up images names from chip_table's ImgID
def load_data(image_table_filename, chip_table_filename):
image_ids = defaultdict(list)
w... | bluemellophone/detecttools | detecttools/pypascalmarkup/scripts/main.py | Python | apache-2.0 | 5,261 |
from xml.etree import ElementTree
from contextlib import closing
from itertools import *
import urllib
import re
# Wraps the dictionary.com API, representing a single API key. Raises IOError and ProtocolError for
# respectively low- and high-level errors occuring during network communcation.
class Dictionary(object):
... | iogf/candocabot | plugins/define/dictionary.py | Python | apache-2.0 | 2,859 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
u"""
Rendering thread. General implementation of a threading helper that can enqueue
operations on other objects and report once those operations are done,
delivering the returned content.
Copyright (C) 2009 Christoph Burgmer
(cburgmer@ira.uka.de)
This program is free softwar... | cburgmer/eclectus | eclectusqt/renderthread.py | Python | gpl-3.0 | 27,208 |
#pylint: disable=no-init,invalid-name
"""
These system tests are to verify the behaviour of the ISIS reflectometry reduction scripts
"""
from __future__ import (absolute_import, division, print_function)
import stresstesting
from mantid.simpleapi import *
from abc import ABCMeta, abstractmethod
from six import with_m... | wdzhou/mantid | Testing/SystemTests/tests/analysis/ReflectometryISIS.py | Python | gpl-3.0 | 5,658 |
import json
from django.core.urlresolvers import reverse
from tastypie import authorization
from tastypie.authentication import MultiAuthentication
from tastypie.exceptions import BadRequest
from crits.services.handlers import add_result, add_results, add_log, finish_task
from crits.services.service import CRITsServic... | cfossace/crits | crits/services/api.py | Python | mit | 5,003 |
# (C) 2016, Ievgen Khmelenko <ujenmr@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 option) any later ver... | camradal/ansible | lib/ansible/plugins/callback/logstash.py | Python | gpl-3.0 | 6,893 |
# -*- encoding: utf-8 -*-
__author__ = 'ray'
__date__ = '10/28/15'
import os
import shutil
import unittest
import tempfile
import six
from stonemason.storage.backends.disk import DiskStorage
TEST_BUCKET_NAME = 'tilestorage'
class TestS3Storage(unittest.TestCase):
def setUp(self):
self.root = tempfile... | Kotaimen/stonemason | tests/storage/backends/test_disk.py | Python | mit | 1,969 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | pinterb/st2 | st2common/st2common/services/action.py | Python | apache-2.0 | 4,646 |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2013 Dariusz Suchojad <dsuch at zato.io>
Licensed under LGPLv3, see LICENSE.txt for terms and conditions.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
# Bunch
from bunch import Bunch
# Zato
from zato.common import zato_namespace
fr... | alirizakeles/zato | code/zato-server/test/zato/server/service/internal/kvdb/data_dict/test_dictionary.py | Python | gpl-3.0 | 9,517 |
# This file is part of DEAP.
#
# DEAP is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# DEAP is distributed ... | marcioweck/PSSLib | reference/deap/doc/code/tutorials/part_4/4_4_Using_Cpp_NSGA.py | Python | lgpl-3.0 | 4,997 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from helpers.hotwallethelpers import get_address_from_wallet
from helpers.setupscripthelpers import spellbook_call, clean_up_triggers
print('Starting Spellbook integration test: Balance trigger conditions')
print('----------------------------------------------\n')
# Clea... | ValyrianTech/BitcoinSpellbook-v0.3 | integrationtests/integration_test_trigger_conditions_BalanceTrigger.py | Python | gpl-3.0 | 2,370 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-01-20 15:34
from django.db import migrations, models
from django.db.models import F
def draft_title(apps, schema_editor):
Page = apps.get_model("wagtailcore", "Page")
Page.objects.all().update(draft_title=F("title"))
class Migration(migrations.Mi... | wagtail/wagtail | wagtail/core/migrations/0040_page_draft_title.py | Python | bsd-3-clause | 732 |
import numpy
import matplotlib.pyplot as plt
s = numpy.random.normal(4, 1.5, 10000)
l = numpy.random.normal(-4, 1.2, 10000)
print(s)
print(l)
h= [0]*41
print(h)
c=0
for a in s:
if (-21 < a and a <20):
h[int(round(a))+20] =h[int(round(a))+20]+1
c=c+1
print (h)
for i in range(len(h)):
h[i]=floa... | gulcegunal/dagitik | odev/odev01.py | Python | gpl-2.0 | 1,070 |
"""Implementation of treadmill admin ldap CLI cell plugin.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import click
from ldap3.core import exceptions as ldap_exceptions
from treadmill import admin
... | bretttegart/treadmill | lib/python/treadmill/cli/admin/ldap/cell.py | Python | apache-2.0 | 6,420 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: hp_roman8.py
""" Python Character Mapping Codec generated from 'hp_roman8.txt' with gencodec.py.
Based on data from ftp://dkuug.dk/i18n/charmaps... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/hp_roman8.py | Python | unlicense | 2,809 |
"""Tornado handlers for cluster web service."""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import json
from tornado import web
from ...base.handlers import IPythonHandler
#-----------------------------------------------------------------------------
# Clust... | madelynfreed/rlundo | venv/lib/python2.7/site-packages/IPython/html/services/clusters/handlers.py | Python | gpl-3.0 | 1,761 |
# 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 nose.plugins.attrib import attr
from nose.tools import eq_, ok_
from socorro.external.postgresql.p... | rhelmer/socorro-lib | socorro/unittest/external/postgresql/test_products.py | Python | mpl-2.0 | 12,464 |
import _plotly_utils.basevalidators
class IdsValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(self, plotly_name="ids", parent_name="carpet", **kwargs):
super(IdsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
anim=kwa... | plotly/python-api | packages/python/plotly/plotly/validators/carpet/_ids.py | Python | mit | 474 |
#!/usr/bin/env python
##-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
## py-arduino - Access your Arduino from Python
## Copyright (C) 2011-2013 - Horacio Guillermo de Oro <hgdeoro@gmail.com>
##
## This file is part of py-arduino.
##
## py-arduino is free software; you can redi... | hgdeoro/py-arduino | py_arduino/tests/test_emulator.py | Python | gpl-2.0 | 9,534 |
# -*- coding: utf-8 -*-
'''
--------------------------------
Worldbank Data & Reports WDS API
--------------------------------
Class for handling D&R API queries
For more information about the API go to:
http://documents.worldbank.org/curated/en/developers
'''
import urllib2
class WdsQueryContainer(object):
d... | the-sumit/worldbank-api | api/query.py | Python | gpl-2.0 | 2,554 |
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Cost and Usage Report"
prefix = "cur"
class Action(BaseAction):
def __init__(self, action: str = None) -> None:
... | cloudtools/awacs | awacs/cur.py | Python | bsd-2-clause | 818 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class EddieItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| discretepackets/eddie | eddie/items.py | Python | mit | 284 |
import logging
import time
from datetime import datetime
from hashlib import sha1
import newrelic.agent
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db.utils import IntegrityError
from treeherder.etl.artifact import (serialize_artifact_json_blobs,
... | tojonmz/treeherder | treeherder/etl/jobs.py | Python | mpl-2.0 | 19,908 |
class ttyP:
def __init__(self, optionNum, textInput):
endc = '\033[0m' # Clear color and other terminal states
clrLine = '\033[2K' # Erases the entire current line.
returnCur = "\r"
def none():
print(textInput)
def header():
print('\033[95m' + text... | lucid281/pyEfi | app/pyefi/ttyP.py | Python | apache-2.0 | 1,294 |
# Natural Language Toolkit: Toolbox Reader
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# Stuart Robinson <Stuart.Robinson@mpi.nl>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Module for reading, w... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/corpus/reader/toolbox.py | Python | mit | 2,146 |
##Source of problem: https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/unit-1/lecture-4-machine-interpretation-of-a-program/MIT6_00SCS11_ps1.pdf
# bal = float(raw_input('Outstanding balance: '))
# intrate = float(raw_in... | Am3ra/CS | CS600/hw/beginner.py | Python | mit | 2,642 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_twutil
----------------------------------
Tests for `twutil` module.
"""
import unittest
from twutil import twutil
class TestTwutil(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
... | tapilab/twutil | tests/test_twutil.py | Python | bsd-3-clause | 377 |
__source__ = 'https://leetcode.com/problems/unique-paths-ii/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/unique-paths-ii.py
# Time: O(m * n)
# Space: O(m + n)
# DP
#
# Description: Leetcode # 63. Unique Paths II
#
# Follow up for "Unique Paths":
#
# Now consider if some obstacles are added t... | JulyKikuAkita/PythonPrac | cs15211/UniquePathsII.py | Python | apache-2.0 | 4,944 |
import os
import sys
sys.path.insert(0, "..")
from praw import __version__
copyright = "2017, Bryce Boe"
exclude_patterns = ["_build"]
extensions = ["sphinx.ext.autodoc", "sphinx.ext.intersphinx"]
html_static_path = ["_static"]
html_theme = "sphinx_rtd_theme"
html_theme_options = {"collapse_navigation": True}
htmlhe... | leviroth/praw | docs/conf.py | Python | bsd-2-clause | 1,131 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem249.py
#
# Prime Subset Sums
# =================
# Published on Saturday, 13th June 2009, 05:00 am
#
# Let S = {2, 3, 5, ..., 4999} be the set of prime numbers less than 5000. Find
# the number of subsets of S, the sum of whose elements is a prime number.
# Ente... | olduvaihand/ProjectEuler | src/python/problem249.py | Python | mit | 452 |
from django import template
register = template.Library()
@register.filter
def partition(thelist, n):
try:
n = int(n)
thelist = list(thelist)
except (ValueError, TypeError):
return [thelist]
p = len(thelist)/n
return [thelist[p*i:p*(i+1)] for i in range(n-1)]+[thelist[p*(i+1):... | tbpmig/mig-website | member_resources/templatetags/member_resources_extras.py | Python | apache-2.0 | 323 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-18 08:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0021_auto_20170509_1759'),
]
operations = [
migrations.AddF... | helfertool/helfertool | src/registration/migrations/0022_shift_hidden.py | Python | agpl-3.0 | 532 |
#!/usr/bin/python
def print_top_n_word_out_of_box( Blines0, lines, top_ii, start_ii ):
skip_ii = 0
print_ii = 0
for Bstring in Blines0:
Blines = re.split('\.', Bstring)
for Bline in Blines:
if ( skip_ii < start_ii ) :
skip_ii += 1
continue
if Bline in lines:
skip_ii += 1
... | bayvictor/distributed-polling-system | bin/top_n_word_out_of_box02.py | Python | apache-2.0 | 3,963 |
# Copyright (c) 2011 Openstack, 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 requi... | nii-cloud/dodai-compute | nova/scheduler/least_cost.py | Python | apache-2.0 | 6,182 |
# -*- coding: utf-8 -*-
from django.dispatch import Signal
pre_transition = Signal(providing_args=['instance', 'name', 'source', 'target'])
post_transition = Signal(providing_args=['instance', 'name', 'source', 'target'])
| deis/django-fsm | django_fsm/signals.py | Python | mit | 223 |
###############################################################################
#
# Test cases for xlsxwriter.lua.
#
# Copyright 2014-2015, John McNamara, jmcnamara@cpan.org
#
import base_test_class
class TestCompareXLSXFiles(base_test_class.XLSXBaseTest):
"""
Test file created with xlsxwriter.lua against a f... | moteus/xlsxwriter.lua | test/comparison/test_format.py | Python | mit | 1,163 |
#!/usr/bin/env python2
#-*-coding: utf-8 -*-
from __future__ import print_function, division
import sys, os.path
pkg_dir = os.path.dirname(os.path.realpath(__file__)) + '/../'
sys.path.append(pkg_dir)
import argparse, sys, csv, gzip, os.path
import numpy as np
import pyopencl as cl
from MPBNP import ibp
from time im... | tqian86/MPBNP | IBPSamplingUtility.py | Python | mit | 5,042 |
# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | yyuu/botornado | boto/dynamodb/table.py | Python | mit | 15,507 |
# -*- coding: utf-8 -*-
#
# PartMgr - Utils
#
# Copyright 2014 Michael Buesch <m@bues.ch>
#
# 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)... | mbuesch/partmgr | partmgr/core/util.py | Python | gpl-2.0 | 1,529 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'StateEnergyProductionEstimates'
db.delete_table('data_stateenergyproductionestimates')
... | npp/npp-api | data/migrations/0008_auto__del_stateenergyproductionestimates.py | Python | mit | 127,609 |
"""A collection of random tools for dealing with dates in Python"""
from pandas.tseries.tools import *
from pandas.tseries.offsets import *
from pandas.tseries.frequencies import *
day = DateOffset()
bday = BDay()
businessDay = bday
try:
cday = CDay()
customBusinessDay = CustomBusinessDay()
customBusiness... | bdh1011/wau | venv/lib/python2.7/site-packages/pandas/core/datetools.py | Python | mit | 1,729 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" procman
----------------Authors----------------
Lachlan de Waard <lachlan.00@gmail.com>
----------------Licence----------------
GNU General Public License version 3
This program is free software: you can redistribute it and/or modify
it under t... | PirumSoftware/pirum-shell | pirum-shell/procman.py | Python | gpl-3.0 | 2,345 |
#
# Solution to Project Euler problem 95
# Philippe Legault
#
# https://github.com/Bathlamos/Project-Euler-Solutions
from itertools import permutations
def compute():
limit = 1000000
proper_divisors = [set() for i in range(0, limit + 1)]
proper_divisors[1] = set()
num = 2
multiplied = 2 * num
while num <= l... | Bathlamos/Project-Euler-Solutions | solutions/p095.py | Python | mit | 1,032 |
#!/usr/bin/env python
import unittest
import preprocessor
class Test(unittest.TestCase):
def testEmpty(self):
pp = preprocessor.T('')
def testIfdef(self):
pp = preprocessor.T('''
$IFDEF wibble
>>><<<
$ENDIF
wobble
''')
self.assertEqual(pp.out()... | ericchill/gnofract4d | fract4d/test_preprocessor.py | Python | bsd-3-clause | 6,801 |
# -*- coding: utf-8 -*-
__author__ = 'idbord'
from model.token import Token
import string
class Lexer:
def __init__(self):
pass
bufferStream = None
currentStr = ""
lineNum = 1
@classmethod
def lexer_analysis(cls, stream):
Lexer.bufferStream = stream
token_list = []
... | idbord/CMM_Python | cmm/lexer.py | Python | mit | 8,150 |
# -*- coding: UTF-8 -*-
from django.test import TestCase
from django.core import mail
from django.test.client import Client
from django.contrib.auth.models import User
from models import *
def data():
'''
Data for testing include 2 Users: admin and juanjo,
3 Notice Types: Error, Warning and Inf... | daonb/django-notification | notification/tests.py | Python | mit | 1,992 |
tests=[
("python","testMolDescriptors.py",{}),
]
longTests=[]
if __name__=='__main__':
import sys
from rdkit import TestRunner
failed,tests = TestRunner.RunScript('test_list.py',0,1)
sys.exit(len(failed))
| soerendip42/rdkit | Code/GraphMol/Descriptors/Wrap/test_list.py | Python | bsd-3-clause | 224 |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... | iEngage/python-sdk | iengage_client/models/user.py | Python | apache-2.0 | 9,891 |
#pylint: disable=invalid-name
"""
Classes for each reduction step. Those are kept separately
from the the interface class so that the DgsReduction class could
be used independently of the interface implementation
"""
from __future__ import (absolute_import, division, print_function)
import xml.dom.minidom
... | dymkowsk/mantid | scripts/Interface/reduction_gui/reduction/diffraction/diffraction_adv_setup_script.py | Python | gpl-3.0 | 10,634 |
from django import forms
from django.contrib.admin.widgets import AdminFileWidget
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.utils.encoding import force_text
from django.utils.html import conditional_escape, format_html
from django.utils.safestring import... | onepercentclub/onepercentclub-site | apps/organizations/forms.py | Python | bsd-3-clause | 1,111 |
import pytest
from testapp.models import (
UnlimitedModel, LimitedModel, RelatedModel, ShorthandModel
)
try:
import south
except ImportError:
from migrations.django_migrations import (
apply_django_migration, LimitedMigration1, LimitedMigration2,
ShorthandMigration, UnlimitedMigration
... | anentropic/django-exclusivebooleanfield | tests/test_migrations.py | Python | mit | 1,698 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('aldryn_newsblog', '0002_newsblogconfig_template_prefix'),
]
operations = [
migrations.AlterField(
model_name='ne... | Venturi/cms | env/lib/python2.7/site-packages/aldryn_newsblog/migrations/0003_auto_20150422_1921.py | Python | gpl-2.0 | 570 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('solicitacao', '0015_auto_20150415_1330'),
]
operations = [
migrations.AlterField(
model_name='so... | dudanogueira/microerp | microerp/solicitacao/migrations/0016_auto_20150415_1332.py | Python | lgpl-3.0 | 470 |
# 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
# d... | ntymtsiv/tempest | tempest/api/orchestration/stacks/test_non_empty_stack.py | Python | apache-2.0 | 8,578 |
# -*- Mode: python; coding: utf-8; tab-width: 4; indent-tabs-mode: nil; -*-
#
# Copyright (C) 2014 - fossfreedom
# GTK3 port https://github.com/exaile-dev/exaile/blob/master/xlgui/cover.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | fossfreedom/coverart-browser | coverart_window.py | Python | gpl-3.0 | 9,621 |
import gutil
import headers
import misc
import pdf
import pml
import util
import wx
class HeadersDlg(wx.Dialog):
def __init__(self, parent, headers, cfg, cfgGl, applyFunc):
wx.Dialog.__init__(self, parent, -1, "Headers",
style = wx.DEFAULT_DIALOG_STYLE)
self.headers = h... | tarikfayad/trelby | src/headersdlg.py | Python | gpl-2.0 | 9,426 |
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
import requests
import six
import soundcloud
from . import hashconversions
def is_file_like(f):
"""Check to see if ```f``` has a ```read()``` method."""
return hasattr(f, 'read') and callable(f.r... | adazey/Muzez | libs/soundcloud/request.py | Python | gpl-3.0 | 4,486 |
# Copyright 2011 Justin Santa Barbara
# 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... | phenoxim/cinder | cinder/tests/functional/test_extensions.py | Python | apache-2.0 | 5,716 |
# example
import string
lowercase = []
uppercase = []
for i,letter in enumerate(string.ascii_lowercase, 1):
lowercase.append([letter,i])
for i,letter in enumerate(string.ascii_uppercase, 1):
uppercase.append([letter,i])
lowercaseDict = dict(lowercase)
uppercaseDict = dict(uppercase)
def printLowercase():
print... | scrasmussen/euler-enigma | GCHQ/src/alphanumeric.py | Python | mit | 538 |
from . import transforms, densities
from . import tf_wraps
from . import _settings
from . import param, model, variationals
from . import nn
from . import gp
from ._version import __version__
from ._settings import settings
| fujii-team/Henbun | Henbun/__init__.py | Python | apache-2.0 | 224 |
# -*- 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 unique constraint on 'DocumentZone', fields ['document']
db.create_unique('wiki_documentzone', ['do... | mastizada/kuma | kuma/wiki/migrations/0030_auto__add_unique_documentzone_document.py | Python | mpl-2.0 | 18,910 |
from os.path import expanduser, exists
from os import makedirs
import json
CONFIG_PATH = expanduser('~/.steem_rocks')
STATE = expanduser("%s/state" % CONFIG_PATH)
CHECKPOINT = expanduser("%s/checkpoint" % CONFIG_PATH)
def load_state(fallback_data=None):
try:
return json.loads(open(STATE).read())
exce... | emre/steemrocks | steemrocks/state.py | Python | mit | 965 |
from __future__ import division, print_function
import numpy as np
import astropy.units as u
from astropy.time import Time
from astropy.table import Table
from astropy import log
from scipy.interpolate import InterpolatedUnivariateSpline
from astropy.coordinates import GCRS, ITRS, EarthLocation, CartesianRepresentation... | paulray/NICERsoft | nicer/latloninterp.py | Python | mit | 1,554 |
#!/usr/bin/env python
# coding=utf-8
# from openpyxl import Workbook
# from openpyxl import load_workbook
# wb = load_workbook('TUNIU-Look-to-Book_v202233_s532_2017-06-08-00-00.xls')
# ws = wb.active
# row_range = ws[22:51]
from bs4 import BeautifulSoup
import locale
# locale.setlocale( locale.LC_ALL, 'en_US... | Fatman13/gta_swarm | fault_http.py | Python | mit | 9,724 |
import logging
from django.utils.translation import ugettext_lazy as _
from .fulfillment import MwsFulfillmentError
logger = logging.getLogger('oscar_mws')
def submit_order_to_mws(order, user, **kwargs):
if kwargs.get('raw', False):
return
# these modules have to be imported here because they rely... | django-oscar/django-oscar-mws | oscar_mws/receivers.py | Python | bsd-3-clause | 1,551 |
from __future__ import division
from ase import Atoms as ase_Atoms
import numpy as np
from copy import copy
from hotbit.containers import *
from ase.io import PickleTrajectory
def container_magic(atoms,container=None):
"""
Set or get container
(according to the element [0,0])
"""
lst = ['Wedge',... | pekkosk/hotbit | hotbit/atoms.py | Python | gpl-2.0 | 9,321 |
# coding=utf8
from types import MethodType
def implant_method(obj, func, func_name):
base_class = obj.__class__
event = MethodType(func, obj, base_class)
setattr(obj, func_name, event)
if __name__ == "__main__":
pass
| cineuse/CNCGToolKit | cgtkLibs/cgtk_py/implant_method.py | Python | mit | 238 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2013 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | SDSG-Invenio/inis | inis/base/recordext/functions/get_bibdoc.py | Python | gpl-2.0 | 1,167 |
# Generated by Django 3.2.9 on 2021-11-30 15:55
from django.db import migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
("cryptonews", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="news",
na... | edison7500/dugong | apps/cryptonews/migrations/0002_news_slug.py | Python | gpl-3.0 | 610 |
from recipe_scrapers.innit import Innit
from tests import ScraperTest
class TestInnitScraper(ScraperTest):
scraper_class = Innit
def test_host(self):
self.assertEqual("innit.com", self.harvester_class.host())
def test_title(self):
self.assertEqual(
"Tofu Mixed Greens Salad w... | hhursev/recipe-scraper | tests/test_innit.py | Python | mit | 3,331 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | danielfrg/jupyterhub-kubernetes_spawner | kubernetes_spawner/swagger_client/models/v1_container_image.py | Python | apache-2.0 | 3,950 |
# -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# 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 t... | s2hc-johan/nikola | nikola/plugins/task/posts.py | Python | mit | 5,170 |
from django.utils.translation import ugettext as _
from django import settings
from django import forms
from video.types import video_type_registrar
from utils.text import fmt
class VideoURLField(forms.URLField):
def validate(self, video_url):
"Check if value consists only of valid emails."
tr... | ofer43211/unisubs | apps/videos/types/forms.py | Python | agpl-3.0 | 2,132 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow-cx | samples/generated_samples/dialogflow_v3_generated_agents_restore_agent_sync.py | Python | apache-2.0 | 1,563 |
# 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/compute/azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/aio/operations/_virtual_machine_scale_sets_operations.py | Python | mit | 68,765 |
import copy
import json
import logging
import os
import sys
from lxml import etree
from lxml.etree import Element, ElementTree, XMLParser
from xblock.core import XML_NAMESPACES
from xblock.fields import Dict, Scope, ScopeIds
from xblock.runtime import KvsFieldData
import dogstats_wrapper as dog_stats_api
from xmodule... | hastexo/edx-platform | common/lib/xmodule/xmodule/xml_module.py | Python | agpl-3.0 | 23,039 |
# 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 a... | RyanYoung25/tensorflow | tensorflow/python/ops/embedding_ops.py | Python | apache-2.0 | 13,874 |
import unittest
from core import test_agent
from core import test_git
from core import test_clouds
suites = [
unittest.TestLoader().loadTestsFromTestCase(test_agent.TestAgent),
unittest.TestLoader().loadTestsFromTestCase(test_git.TestGit),
unittest.TestLoader().loadTestsFromTestCase(test_clouds.TestClouds... | mihaisoloi/conpaas | conpaas-services/src/tests/run_tests.py | Python | bsd-3-clause | 489 |
from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
from ..utils import gisfield_may_be_null
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract ... | weiawe/django | tests/gis_tests/geoapp/models.py | Python | bsd-3-clause | 1,958 |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from templated_email.backends.vanilla_django import TemplateBackend
import warnings
warnings.filterwarnings('error', 'django.utils.importlib')
try:
# Django <= 1.7
from django.utils.importlib import import_module
except:
... | dpetzold/django-templated-email | templated_email/__init__.py | Python | mit | 3,779 |
#!/usr/bin/env python
from __future__ import print_function
import os
import json
from ethereum._solidity import compile_contract
from ethereum.utils import decode_hex
from pyethapp.rpc_client import JSONRPCClient
from pyethapp.jsonrpc import default_gasprice
from raiden.utils import get_contract_path
from raiden.net... | charles-cooper/raiden | tools/deploy.py | Python | mit | 2,431 |
"""Custom exceptions for RAPD project"""
"""
This file is part of RAPD
Copyright (C) 2017-2018, Cornell University
All rights reserved.
RAPD 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, version 3.
RA... | RAPD/RAPD | src/utils/exceptions.py | Python | agpl-3.0 | 1,460 |
"""
Simple test that executes date command in a sanbox and verifies it is correct
"""
import datetime
from autotest.client.shared import error
from virttest.lvsb import make_sandboxes
def verify_datetime(start_time, stop_time, result_list):
"""
Return the number of sandboxes which reported incorrect date
... | spiceqa/virt-test | lvsb/tests/src/lvsb_date.py | Python | gpl-2.0 | 2,938 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import time
import compas
import compas._os
from compas.rpc import RPCServerError
from compas.utilities import DataDecoder
from compas.utilities import DataEncoder
try:
from xmlrpclib import S... | compas-dev/compas | src/compas/rpc/proxy.py | Python | mit | 14,267 |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2020 BigML
#
# 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 ... | jaor/bigmler | bigmler/retrain/retrain.py | Python | apache-2.0 | 8,838 |
#Implements a minimal reader for OGIP PHA format for spectral data
# (https://heasarc.gsfc.nasa.gov/docs/heasarc/ofwg/docs/spectra/ogip_92_007/node6.html)
#Author: Giacomo Vianello (giacomov@slac.stanford.edu)
import os
import astropy.io.fits as pyfits
import numpy
requiredKeywords = {}
requiredKeywords[... | sybenzvi/3ML | threeML/plugins/ogip.py | Python | bsd-3-clause | 6,399 |
# -*- coding: utf-8 -*-
########################################################################
#
# License: BSD
# Created: November 25, 2009
# Author: Francesc Alted - faltet@pytables.com
#
# $Id$
#
########################################################################
"""Create links in the HDF5 file.
This modu... | gdementen/PyTables | tables/link.py | Python | bsd-3-clause | 13,584 |
#!/usr/bin/env python3
import os
import requests
import time
from collections import namedtuple
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter
class TimeoutRequestsSession(requests.Session):
def __init__(self, *args, **kwargs):
self.__default_timeout = None
if 'tim... | alberthdev/cihelper | cihelper/download.py | Python | mit | 2,101 |
import xml.sax, re, sys, xml.sax.saxutils
import base64
from gourmet.importers import xml_importer
from gourmet.gdebug import *
from gourmet.gglobals import *
class KrecHandler (xml_importer.RecHandler):
ADD = 1
IS = 2
AND = 3
BASE_64 = 4
RECTAGS={'title':('title',IS),
'author':('sourc... | Linutux/Gourmet | gourmet/plugins/import_export/krecipe_plugin/krecipe_importer.py | Python | gpl-2.0 | 2,521 |
"""Gradient Boosted Regression Trees
This module contains methods for fitting gradient boosted regression trees for
both classification and regression.
The module structure is the following:
- The ``BaseGradientBoosting`` base class implements a common ``fit`` method
for all the estimators in the module. Regressio... | sonnyhu/scikit-learn | sklearn/ensemble/gradient_boosting.py | Python | bsd-3-clause | 72,860 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable
from variable_functions import my_attribute_label
class number_of_jobs_of_sector_DDD(Variable):
"""number of jobs of sector DDD in a given... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/zone/number_of_jobs_of_sector_DDD.py | Python | gpl-2.0 | 2,244 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.