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 |
|---|---|---|---|---|---|
from test.parser.pattern.matching.base import PatternMatcherBaseClass
class PatternMatcherISetTests(PatternMatcherBaseClass):
def test_basic_iset_match(self):
self.add_pattern_to_graph(pattern="I AM A <iset>MAN, WOMAN</iset>", topic="*", that="*", template="1")
context = self.match_sentence("I ... | dkamotsky/program-y | src/test/parser/pattern/matching/test_iset.py | Python | mit | 1,582 |
__author__ = 'jdaniel'
from Algorithms import serial
from GaiaSolve.algorithm import Algorithm
class SERIAL(Algorithm):
def __init__(self):
"""
Wrapped version of the serial NSGA-2 algorithm
:return: None
"""
super(SERIAL, self).__init__()
def run(self):
"""
... | jldaniel/Gaia | GaiaSolve/Algorithms/_serial.py | Python | mit | 1,949 |
"""Implements nose test program and collector.
"""
from __future__ import generators
import logging
import os
import sys
import time
import unittest
from nose.config import Config, all_config_files
from nose.loader import defaultTestLoader
from nose.plugins.manager import PluginManager, DefaultPluginManager, \
R... | jokajak/itweb | data/env/lib/python2.6/site-packages/nose-0.11.4-py2.6.egg/nose/core.py | Python | gpl-3.0 | 12,663 |
#!/usr/bin/python
"""
Delete Snapshots: Script to delete system snapshots.
This script using the XMLRPC APIs will connect to the Satellite and
list or delete system snapshots based on the parameters given by the user.
Copyright (c) 2009--2015 Red Hat, Inc. Distributed under GPL.
Author: Brad Buckingham <bbuckingham@... | xkollar/spacewalk | utils/systemSnapshot.py | Python | gpl-2.0 | 12,601 |
import os
import time
from .util import do_commit
def delete_file_taggings(cursor, file_id):
"""Delete all taggings relating to a specific file_id
Returns
========
The number of affected rows (number of taggings removed)
"""
cursor.execute('DELETE FROM file_tag WHERE file_id = ?', (file_id,))
... | 0ion9/tmsoup | tmsoup/file.py | Python | lgpl-3.0 | 9,291 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# 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 version.
... | dav1x/ansible | lib/ansible/modules/network/vyos/vyos_system.py | Python | gpl-3.0 | 6,270 |
import unittest
from vodem.api import standby_dns_manual
class TestStandbyDnsManual(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.valid_response = {
'standby_dns_manual': '',
}
def test_call(self):
resp = standby_dns_manual()
self.assertEqual(self... | alzeih/python-vodem-vodafone-K4607-Z | test/unit/api/test_standby_dns_manual.py | Python | mit | 343 |
"""
Support for the Unitymedia Horizon HD Recorder.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/media_player.horizon/
"""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant import util
from homeassistant.component... | persandstrom/home-assistant | homeassistant/components/media_player/horizon.py | Python | apache-2.0 | 5,979 |
from __future__ import unicode_literals
from future.builtins import filter, str
try:
from urllib.parse import urljoin
except ImportError: # Python 2
from urlparse import urljoin
from django.core.urlresolvers import resolve, reverse
from django.db import models
from django.utils.encoding import python_2_uni... | cccs-web/mezzanine | mezzanine/pages/models.py | Python | bsd-2-clause | 10,568 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | tempbottle/ironpython3 | Tests/modules/misc/datetime_test.py | Python | apache-2.0 | 40,263 |
import logging
from sqp_project import settings
logging.basicConfig(filename=settings.LOG_FILENAME,level=logging.DEBUG,)
logging.debug('Started logging.')
| recsm/SQP | sqp/log.py | Python | mit | 158 |
import sys
import platform
from numpy.testing import *
import numpy.core.umath as ncu
import numpy as np
# TODO: branch cuts (use Pauli code)
# TODO: conj 'symmetry'
# TODO: FPU exceptions
# At least on Windows the results of many complex functions are not conforming
# to the C99 standard. See ticket 1574.
# Ditto f... | dwf/numpy | numpy/core/tests/test_umath_complex.py | Python | bsd-3-clause | 20,513 |
'''
Author: Jason.Parks
Created: Jan 17, 2012
Module: THQ_common.thq_perforce.p426.win64.__init__
Purpose: to import win64 perforce module
'''
print "THQ_common.thq_perforce.p426.win64.__init__ imported" | CountZer0/PipelineConstructionSet | python/common/perforce/p426/win64/__init__.py | Python | bsd-3-clause | 216 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
GdalUtils.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************... | tudorbarascu/QGIS | python/plugins/processing/algs/gdal/GdalUtils.py | Python | gpl-2.0 | 15,861 |
"""
Autotest scheduler watcher main library.
"""
import os, sys, signal, time, subprocess, logging
from optparse import OptionParser
try:
import autotest.common as common
except ImportError:
import common
from autotest.scheduler import watcher_logging_config
from autotest.client.shared import error, global_con... | nacc/autotest | scheduler/monitor_db_watcher.py | Python | gpl-2.0 | 6,407 |
from urllib.parse import urljoin
from pulsar import as_coroutine, task
from pulsar.utils.httpurl import Headers
from pulsar.utils.log import LocalMixin, local_property
from pulsar.apps.wsgi import Route, wsgi_request
from pulsar.apps.http import HttpClient
ENVIRON_HEADERS = ('content-type', 'content-length')
class... | ymero/pulsar | pulsar/apps/proxy/__init__.py | Python | bsd-3-clause | 2,279 |
from django.db import models
class Post(models.Model):
"""A blog post (attached to a senator via Appointment)"""
author = models.ForeignKey('senate.Appointment')
title = models.CharField(max_length=80)
body = models.TextField()
posted = models.DateTimeField(editable=True)
slug = models.Slu... | aspc/mainsite | aspc/blog/models.py | Python | mit | 902 |
import re
from debris.asset import encode
from debris.asset import decode
class Memory(object):
def __init__(self, config=None):
self.cache = {}
def get(self, key):
if key in self.cache:
return self.cache[key]
raise LookupError("Key not found in memory, %s" % key)
de... | stevepeak/debris | debris/addons/memory.py | Python | apache-2.0 | 1,282 |
##########################################################################
#
# Copyright (c) 2019, Image Engine Design 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:
#
# * Redistrib... | andrewkaufman/gaffer | python/GafferTest/SpreadsheetTest.py | Python | bsd-3-clause | 38,226 |
t = int(raw_input())
for i in range(t):
n,k = map(int, raw_input().split())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
maximum = (k/a[0])*b[0]
for j in range(n):
t = (k/a[j])*b[j]
if t > maximum:
maximum = t
print maximum | paramsingh/codechef-solutions | src/practice/chefstone.py | Python | mit | 260 |
class Sample(object):
"""
A data point of the Metric
:param metricId: Metric FQN
:type metricId: string
:param timestamp: Timestamp for the sample
:type timestamp: int
:param value: Value of the sample
:type value: float
:param min: Minimum of the sa... | Netuitive/netuitive-client-python | netuitive/sample.py | Python | apache-2.0 | 1,267 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, 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://ww... | ykaneko/neutron | neutron/tests/unit/test_security_groups_rpc.py | Python | apache-2.0 | 56,457 |
#! /usr/bin/python3
# -*- coding:Utf-8 -*-
"""
MyNotes - Sticky notes/post-it
Copyright 2016-2019 Juliette Monsel <j_4321@protonmail.com>
MyNotes 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 o... | j4321/MyNotes | mynoteslib/sticky.py | Python | gpl-3.0 | 52,023 |
import logging
import os
from pathlib import Path
from typing import Callable, List, Optional
from qgis.core import QgsCoordinateReferenceSystem, QgsProject
from qgis.gui import QgsProjectionSelectionWidget
from qgis.PyQt import uic
from qgis.PyQt.QtWidgets import (
QCheckBox,
QDialog,
QFileDialog,
QLi... | hoettges/QKan | qkan/muporter/application_dialog.py | Python | gpl-3.0 | 17,035 |
from feature_format import featureFormat, targetFeatureSplit
import pickle
from sklearn.naive_bayes import GaussianNB
from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
from sklearn.pipeline import Pipeline
from sklearn.feature... | rjegankumar/enron_email_fraud_identification | nb_classifier.py | Python | mit | 3,699 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | rwl/openpowersystem | ucte/wires/ratio_tap_changer.py | Python | agpl-3.0 | 1,893 |
#########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | geokala/cloudify-agent | setup.py | Python | apache-2.0 | 2,354 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
# Copyright (c) 2011 CCI Connect asbl (http://www.cciconnect.be) All Rights Reserved.
# Philmer <philmer@cciconnect.be>
{
'name': 'Accounting Consistency Tests',
'version': '1.0',
'cate... | jeremiahyan/odoo | addons/account_test/__manifest__.py | Python | gpl-3.0 | 1,166 |
#!/usr/bin/env python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TODO(slightlyoff): move to using shared version of this script.
'''This script makes it easy to combine libs and object files to... | kuscsik/chromiumembedded | tools/combine_libs.py | Python | bsd-3-clause | 3,327 |
# -*- coding: utf-8 -*-
# Copyright © 2015-2017 AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import stock_picking_wave
| oihane/temp-addons | stock_picking_wave_package_label/models/__init__.py | Python | agpl-3.0 | 157 |
"""
Instructor API endpoint urls.
"""
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^students_update_enrollment$',
'instructor.views.api.students_update_enrollment', name="students_update_enrollment"),
url(r'^register_and_enroll_students$',
'instructor.views... | beni55/edx-platform | lms/djangoapps/instructor/views/api_urls.py | Python | agpl-3.0 | 5,610 |
# 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 sys
import traceback
from StringIO import StringIO
import re
import datetime
from urllib import urlencode
from co... | mozilla/pto | pto/apps/dates/views.py | Python | mpl-2.0 | 37,380 |
import tempfile
import unittest
from brocclib.get_xml import (
get_taxid, get_lineage, NcbiEutils,
)
class NcbiEutilsTests(unittest.TestCase):
def test_get_taxon_id(self):
db = NcbiEutils()
self.assertEqual(db.get_taxon_id("HQ608011.1"), "531911")
self.assertEqual(db.taxon_ids, {"... | kylebittinger/brocc | tests/test_get_xml.py | Python | gpl-3.0 | 1,775 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import shipping.models
class Migration(migrations.Migration):
dependencies = [
('shipping', '0002_country_is_main'),
('orders', '0013_order_shipping_cost'),
]
operations = [
... | juntatalor/qexx | orders/migrations/0014_order_country.py | Python | mit | 559 |
# coding:utf-8
import urllib
import json
import base64
import time
from threading import Timer
from QUANTAXIS_Trade.util import base_trade
import pandas as pd
import requests
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
class Td... | EmmaIshta/QUANTAXIS | QUANTAXIS_Trade/QA_Tdxtradeserver/__init__.py | Python | mit | 6,984 |
# This is only a test file
import logging
from cloud.metrics.metric import Metric
from cloud.models.virtual_machine import VirtualMachine
# Configure logging for the module name
logger = logging.getLogger(__name__)
# Extends the Metric class to inherit basic functionalities
class VMGetState(Metric):
#... | ComputerNetworks-UFRGS/Aurora | cloud/metrics/VMGetState.py | Python | gpl-2.0 | 746 |
# NOTE (CCB): These functions are copied from oscar.apps.offer.custom due to a bug
# detailed at https://github.com/django-oscar/django-oscar/issues/2345. This file
# should be removed after the fix for the bug is released.
# TODO: Issue above is fixed; we need to upgrade to django-oscar==1.5 and this can be removed.
#... | edx/ecommerce | ecommerce/programs/custom.py | Python | agpl-3.0 | 787 |
# -*- coding: utf-8 -*-
#
# papyon - a python client library for Msn
#
# Copyright (C) 2005-2006 Ali Sabil <ali.sabil@gmail.com>
# Copyright (C) 2007-2008 Johann Prieur <johann.prieur@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | billiob/papyon | papyon/profile.py | Python | gpl-2.0 | 31,976 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this f... | SUSE-Cloud/nova | nova/virt/vmwareapi/fake.py | Python | apache-2.0 | 42,540 |
# This file is part of Viper - https://github.com/viper-framework/viper
# See the file 'LICENSE' for copying permission.
import os
import json
import tempfile
from viper.common.abstracts import Module
from viper.common.utils import get_type
from viper.core.session import __sessions__
from pdftools.pdfid import PDFiD... | postfix/viper-1 | modules/pdf.py | Python | bsd-3-clause | 7,025 |
# -*- coding: utf-8 -*-
from positioning.app import App
def run(config, engine_id):
app = App(config, engine_id)
app.start_engine()
app.run()
| maveron58/indiana | positioning/runner.py | Python | mit | 157 |
##########################################
# File: util.py
# Author: Wang Zixu
# Co-Author: CHEN Zhihan
# Last modified: Jan 17, 2017
##########################################
import copy
from PIL import Image, ImageDraw
# Debug echo flag.
DEBUG = False
# True represents light pixels... | LaytonW/qrcode | lib/util.py | Python | mit | 6,276 |
import sys
class ExceptionHook:
instance = None
def __call__(self, *args, **kwargs):
if self.instance is None:
from IPython.core import ultratb
self.instance = ultratb.FormattedTB(mode='Plain',
color_scheme='Linux', call_pdb=1)
return self.instance(*arg... | jasonleaster/LeetCode | crash_python.py | Python | gpl-2.0 | 367 |
from glob import glob
import h5py as hdf
from numpy import where
files = glob('*Oii.hdf5')
outFile = open('buzzard_truth.txt', 'w')
for f in files:
print f
with hdf.File(f, 'r') as f:
dset = f[f.keys()[0]]
ra = dset['RA']
dec = dset['DEC']
if ra.max() > 300. and ra.min() < 10... | boada/desCluster | data/buzzard_v1.0/allbands/truth/find_RADEX.py | Python | mit | 692 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... | ProjectSWGCore/NGECore2 | scripts/mobiles/tatooine/bone_gnasher.py | Python | lgpl-3.0 | 1,409 |
#!/d/Bin/Python/python.exe
# -*- coding: utf-8 -*-
#
#
# $Date: 2005/04/02 07:29:46 $, by $Author: ivan $, $Revision: 1.1 $
#
from testSPARQL import ns_rdf
from testSPARQL import ns_rdfs
from testSPARQL import ns_dc
from testSPARQL import ns_foaf
from testSPARQL import ns_ns
from testSPARQL import ns_book
from rdflib... | MjAbuz/watchdog | vendor/rdflib-2.4.0/test/sparql/QueryTests/Test5_2.py | Python | agpl-3.0 | 1,627 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | abhinavsingh/proxy.py | proxy/http/descriptors.py | Python | bsd-3-clause | 1,550 |
# GENERATED FILE, do not edit by hand
# Source: test/jinja2.test_pytorch.py
from __future__ import print_function, division
import PyTorch
import numpy
import inspect
from test.test_helpers import myeval, myexec
def test_pytorchLong():
PyTorch.manualSeed(123)
numpy.random.seed(123)
LongTensor = PyTorch.... | hughperkins/pytorch | test/test_pytorch.py | Python | bsd-2-clause | 21,095 |
import RPi.GPIO as GPIO
ReedPin = 11
LedPin = 12
def setup():
GPIO.setmode(GPIO.BOARD) # Numbers GPIOs by physical location
GPIO.setup(LedPin, GPIO.OUT) # Set LedPin's mode is output
GPIO.setup(ReedPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.output(LedPin, GPIO.LOW) # Set LedPin high(+3.3V) to off led
... | bicard/raspberrypi | quad-store-sensors/37in1/reed-and-mini-reed-switch-rgb-led-smd.py | Python | gpl-3.0 | 943 |
# Copyright (c) 2010 by Cisco Systems, Inc.
"""
Show concurrent processes for a single instmake log.
"""
# The Python libraries that we need
from instmakelib import instmake_log as LOG
import sys
import getopt
from instmakelib import concurrency
description = "Show concurrent-process stats."
def usage():
print "... | gilramir/instmake | instmakeplugins/report_conprocs.py | Python | bsd-3-clause | 5,024 |
from django import template
register = template.Library()
@register.filter
def lookup(dict, key):
return dict[key]
| mtarsel/Django-MOOC | instructor_portal/app_tags/app_tags.py | Python | gpl-2.0 | 121 |
"""Test cases for the limits extension."""
from django.core.urlresolvers import reverse
from modoboa.core.factories import UserFactory
from modoboa.core.models import User
from modoboa.lib import parameters
from modoboa.lib.tests import ModoTestCase
from modoboa_admin.factories import populate_database
from modoboa_... | disko/modoboa-admin-limits | modoboa_admin_limits/tests.py | Python | mit | 15,385 |
#!/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... | Suwmlee/XX-Net | gae_proxy/server/lib/google/appengine/tools/sdk_update_checker.py | Python | bsd-2-clause | 14,750 |
#!/usr/bin/env python
from setuptools import setup, find_packages
with open('README.md') as f:
long_description = f.read()
setup(
name='harvest_api_client',
version='1.1.3',
description='A client for the Harvest API (getharvest.com)',
license='MIT',
author='Alex Maslakov',
author_email='A... | GildedHonour/harvest-api-client | setup.py | Python | mit | 1,002 |
#!/usr/bin/env python
# encoding: utf-8
#
# Description: Plugin for processing Chuck Norris requests
# Author: Pablo Iranzo Gomez (Pablo.Iranzo@gmail.com)
import json
import logging
import requests
import stampy.plugin.config
import stampy.stampy
from stampy.i18n import _
from stampy.i18n import _L
import random
de... | iranzo/stampython | stampy/plugin/chuck.py | Python | gpl-3.0 | 2,702 |
'''Tools for working with files in the samtools pileup -c format.'''
import collections
import pysam
PileupSubstitution = collections.namedtuple("PileupSubstitution",
" ".join((
"chromosome",
... | kyleabeauchamp/pysam | pysam/Pileup.py | Python | mit | 8,975 |
#
# Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope ... | ioggstream/mysql-utilities | mysql/fabric/services/resharding.py | Python | gpl-2.0 | 35,111 |
# Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks.Tasks could be done without original order. Each task could be done in one interval. For each interval, CPU could finish one task or just be idle.
# However, there is a non-negat... | seanxwzhang/LeetCode | 621 Task Scheduler/solution.py | Python | mit | 1,666 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jart/tensorflow | tensorflow/python/kernel_tests/linalg/linear_operator_identity_test.py | Python | apache-2.0 | 17,629 |
"""
Description:
* An interface is defined for creating an object.
* Comparing to simple factory, subclasses decide which class is instantiated.
@author: Paul Bodean
@date: 12/08/2017
"""
from abc import ABCMeta, abstractmethod
from typing import Union
from selenium.webdriver import Chrome, Firefox
from src.factory.p... | paulbodean88/automation-design-patterns | src/factory/factory_method.py | Python | mit | 3,564 |
"""Tests for the system_log component."""
| fbradyirl/home-assistant | tests/components/system_log/__init__.py | Python | apache-2.0 | 42 |
pytest_plugins = "pytester"
def test_exceptions_dont_cause_leaking_between_tests(testdir, capsys):
testdir.makepyfile("""
from doubles.targets.expectation_target import expect
from doubles.testing import User
def test_that_sets_expectation_then_raises():
expect(User).class_me... | uber/doubles | test/pytest_test.py | Python | mit | 1,505 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Role.description'
db.alter_column(u'units_role', 'desc... | ArcaniteSolutions/truffe2 | truffe2/units/migrations/0003_auto__chg_field_role_description.py | Python | bsd-2-clause | 7,549 |
# Copyright 2019 Objectif Libre
#
# 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 agr... | stackforge/cloudkitty | cloudkitty/api/v2/scope/state.py | Python | apache-2.0 | 4,899 |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2006-2018 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 ... | mesheven/pyOCD | pyocd/target/__init__.py | Python | apache-2.0 | 6,399 |
# -*- coding: utf-8 -*-
from gitlint.tests.base import BaseTestCase
from gitlint.rules import AuthorValidEmail, RuleViolation
class MetaRuleTests(BaseTestCase):
def test_author_valid_email_rule(self):
rule = AuthorValidEmail()
# valid email addresses
valid_email_addresses = ["föo@bar.com"... | jorisroovers/gitlint | gitlint-core/gitlint/tests/rules/test_meta_rules.py | Python | mit | 2,792 |
#!/usr/bin/env python
"""This is a script that removes all staffline, staffspace and staff
symbols, and all relationships that lead to them."""
from __future__ import print_function, unicode_literals
import argparse
import copy
import logging
import os
import time
from muscima.io import parse_cropobject_list, export_c... | hajicj/muscima | scripts/strip_staffline_symbols.py | Python | mit | 3,277 |
# dialogs.folder
"""A collection of dialogs to do things to all fonts in a given folder."""
# import
from actions import actionsFolderDialog
from ufo2otf import UFOsToOTFsDialog
from otf2ufo import OTFsToUFOsDialog
from woff2ufo import WOFFsToUFOsDialog
# export
__all__ = [
'actionsFolderDialog',
'OTFsToUF... | gferreira/hTools2_extension | hTools2.roboFontExt/lib/hTools2/dialogs/folder/__init__.py | Python | bsd-3-clause | 382 |
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2011,2017 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permis... | waynechu/PythonProject | dns/wiredata.py | Python | mit | 3,751 |
from flask_bcrypt import Bcrypt
from flask_caching import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
import logging
bcrypt = Bcrypt()
login_manager = LoginManager()
db = SQLAlchemy()
migrate =... | rileymjohnson/fbla | app/extensions.py | Python | mit | 446 |
r"""
Fourier transform
=================
The graph Fourier transform :meth:`pygsp.graphs.Graph.gft` transforms a
signal from the vertex domain to the spectral domain. The smoother the signal
(see :meth:`pygsp.graphs.Graph.dirichlet_energy`), the lower in the frequencies
its energy is concentrated.
"""
import numpy as... | epfl-lts2/pygsp | examples/fourier_transform.py | Python | bsd-3-clause | 1,371 |
import apsw
import datetime
from playhouse.apsw_ext import *
from playhouse.tests.base import ModelTestCase
db = APSWDatabase(':memory:')
class BaseModel(Model):
class Meta:
database = db
class User(BaseModel):
username = CharField()
class Message(BaseModel):
user = ForeignKeyField(User)
m... | funkypawz/MakerRobot | peewee-master/playhouse/tests/test_apsw.py | Python | gpl-3.0 | 4,048 |
#!/usr/bin/python
#This is not my code, but a really nice wrapper ( taken from https://realpython.com/blog/python/primer-on-python-decorators/ )
import time
def timing_function(some_function):
"""
Outputs the time a function takes
to execute.
"""
def wrapper():
t1 = time.time()
... | shravanshandilya/catching-up-with-python | Decorators/timing_decorator.py | Python | mit | 663 |
import csv
import osgeo.ogr
from osgeo import ogr, osr
EPSG_LAT_LON = 4326
def read_tazs_from_csv(csv_zone_locs_fname):
taz_tuples = []
tfile = open(csv_zone_locs_fname, 'rb')
treader = csv.reader(tfile, delimiter=',', quotechar="'")
for ii, row in enumerate(treader):
if ii == 0: continue
... | PatSunter/pyOTPA | TAZs-OD-Matrix/taz_files.py | Python | bsd-3-clause | 1,176 |
# Copyright 2010-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
"""Contains private support functions for the Display class
in output.py
"""
from __future__ import unicode_literals
__all__ = (
)
import io
import re
import sys
from portage import os
from portage import _e... | entoo/portage-src | pym/_emerge/resolver/output_helpers.py | Python | gpl-2.0 | 19,925 |
from helpers.manipulator_base import ManipulatorBase
class InsightManipulator(ManipulatorBase):
"""
Handle Insight database writes.
"""
@classmethod
def updateMerge(self, new_insight, old_insight, auto_union=True):
"""
Given an "old" and a "new" Insight object, replace the fields ... | the-blue-alliance/the-blue-alliance | old_py2/helpers/insight_manipulator.py | Python | mit | 1,096 |
#!/usr/bin/env python
# encoding: utf-8
from smisk.test import *
from smisk.inflection import inflection as en
class English(TestCase):
def test_plural(self):
assert en.pluralize(u'mouse') == u'mice'
assert en.pluralize(u'train') == u'trains'
assert en.pluralize(u'commotion') == u'commotion'
assert e... | rsms/smisk | lib/smisk/test/inflection.py | Python | mit | 3,656 |
# 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 use ... | Kami/libcloud | libcloud/compute/drivers/gig_g8.py | Python | apache-2.0 | 22,013 |
"""This module implements functions for querying properties of the operating
system or for the specific process the code is running in.
"""
import os
import sys
import re
import multiprocessing
import subprocess
try:
from subprocess import check_output as _execute_program
except ImportError:
def _execute_pro... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/newrelic-2.46.0.37/newrelic/common/system_info.py | Python | agpl-3.0 | 10,108 |
# tests.integration
# Integration testing - executes a complete simulation to look for errors.
#
# Author: Benjamin Bengfort <bengfort@cs.umd.edu>
# Created: Mon Apr 04 09:02:14 2016 -0400
#
# Copyright (C) 2016 University of Maryland
# For license information, see LICENSE.txt
#
# ID: integration.py [] benjamin@beng... | bbengfort/cloudscope | tests/integration.py | Python | mit | 2,410 |
from jawaf.conf import settings
from jawaf.management.base import BaseCommand
from jawaf.server import Jawaf
class Command(BaseCommand):
"""Run Jawaf"""
def add_arguments(self, parser):
parser.add_argument('--host', help='Server host')
parser.add_argument('--port', help='Server port')
... | danpozmanter/jawaf | jawaf/management/commands/run.py | Python | bsd-3-clause | 1,049 |
# Copyright 2014-2016 Presslabs SRL
#
# 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 wri... | PressLabs/gitfs | gitfs/views/view.py | Python | apache-2.0 | 1,072 |
#!/usr/bin/env python
# (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
# (c) 2012-2014, Michael DeHaan <michael@ansible.com> and others
#
# 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 So... | donckers/ansible | hacking/module_formatter.py | Python | gpl-3.0 | 18,660 |
import json
from decimal import Decimal
from django import test
from factories import (
workflow_models as w_factories,
indicators_models as i_factories
)
from tola_management.models import ProgramAuditLog
from indicators.models import Indicator, Result, DisaggregatedValue
class TestResultAuditLog(test.TestCa... | mercycorps/TolaActivity | tola_management/tests/test_program_audit_log.py | Python | apache-2.0 | 10,601 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from comic_dl import globalFunctions
import os
class ReadComicsIO():
def __init__(self, manga_url, download_directory, chapter_range, **kwargs):
current_directory = kwargs.get("current_directory")
conversion = kwargs.get("conversion")
keep_fil... | Xonshiz/comic-dl | comic_dl/sites/readComicsIO.py | Python | mit | 6,267 |
#!/usr/bin/python
#-*-coding: utf-8-*-
#
# resources.py
#
# Author: Miguel Angel Martinez <miguelang.martinezl@gmail.com>
#
import os
resourceBasePath = ''
def setBasePath(path):
global resourceBasePath
resourceBasePath = path
def getPath(name):
path = os.path.normpath(os.path.join(resourceBasePath, name)... | MartinezLopez/icue | src/util/resources.py | Python | gpl-2.0 | 335 |
from django.urls import reverse
from django.views.generic import TemplateView, CreateView, FormView
class CompletedPage(TemplateView):
template_name = "contact_form/contact_completed.html"
class ContactFormMixin(object):
"""
Form view that sends email when form is valid. You'll need
to define your o... | madisona/django-contact-form | contact_form/views.py | Python | bsd-3-clause | 705 |
from . import *
@route('/')
def do_env(request):
def _env():
for x in sorted(request.environ.items()):
yield '%s: %r\n' % x
return Response(_env(), mimetype='text/plain')
| mikeboers/Nitrogen | example/controllers/env.py | Python | bsd-3-clause | 200 |
import sublime
import sublime_plugin
class EraseViewCommand(sublime_plugin.TextCommand):
def run(self, edit, size=0):
self.view.erase(edit, sublime.Region(0, size))
| klaascuvelier/sublime-phpunit | commands/erase_view_command.py | Python | bsd-3-clause | 178 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('inventory', '0005_remove_distribution_validation_extension'),
]
operations = [
migrations.RenameField(
model_nam... | opennorth/inventory | inventory/migrations/0006_auto_20150217_2002.py | Python | mit | 1,132 |
from __future__ import unicode_literals
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.feature_extraction import FeatureHasher
from sklearn.utils.testing import (assert_raises, assert_true, assert_equal,
ignore_warnings, fails_if_pypy)
pytestmark = fai... | vortex-ape/scikit-learn | sklearn/feature_extraction/tests/test_feature_hasher.py | Python | bsd-3-clause | 6,259 |
"""Reads in an HTML file from the command line and pretty-prints it."""
from xml.dom.ext.reader import HtmlLib
from xml.dom import ext
def read_html_from_file(fileName):
#build a DOM tree from the file
reader = HtmlLib.Reader()
dom_object = reader.fromUri(fileName)
#strip any ignorable white-space in... | Pikecillo/genna | external/PyXML-0.8.4/demo/dom/dom_from_html_file.py | Python | gpl-2.0 | 585 |
from LTTL.Input import Input
from LTTL.Segmenter import concatenate
def main():
input1 = Input('hello', 'str1')
input2 = Input('world', 'str2')
input3 = Input('!', 'str3')
merged = concatenate([input1, input2, input3])
print(merged.to_string())
if __name__ == '__main__':
main()
| axanthos/LTTL | bugs/solved/bug_concatenate.py | Python | gpl-3.0 | 307 |
# Copyright (C) 2011 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 conditions and the f... | leighpauls/k2cro4 | third_party/WebKit/Tools/Scripts/webkitpy/common/watchlist/watchlistparser_unittest.py | Python | bsd-3-clause | 10,786 |
# -*- coding: utf-8 -*-
# Standard library
import logging
# PyQT
from qgis.PyQt.QtCore import pyqtSignal, QObject, pyqtSlot
# Plugin modules
from ..tools import IsogeoPlgTools
# ############################################################################
# ########## Globals ###############
# ######################... | isogeo/isogeo-plugin-qgis | modules/api/shares.py | Python | gpl-3.0 | 4,030 |
#!/usr/bin/env python3
#
# Generates a DocBook section documenting all PLCAPI methods on
# stdout.
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
# dec 2018
# going for python3; xml.dom.minidom has changed a lot
# working around the changes in a rather quick & dir... | dreibh/planetlab-lxc-plcapi | doc/DocBook.py | Python | bsd-3-clause | 5,382 |
from urlparse import urlparse
from api_tests.nodes.views.test_node_contributors_list import NodeCRUDTestCase
from nose.tools import * # flake8: noqa
from api.base.settings.defaults import API_BASE
from framework.auth.core import Auth
from tests.base import fake
from osf_tests.factories import (
ProjectFactory,
... | monikagrabowska/osf.io | api_tests/registrations/views/test_withdrawn_registrations.py | Python | apache-2.0 | 7,865 |
from django.utils.translation import gettext_lazy as _
ModuleTitle = _("components")
Title = _("Components")
Perms = False
Index = "None"
Urls = (
(
"codeeditor?schtml=browser",
_("Code editor"),
None,
"""png://actions/format-justify-center.png""",
),
("d3?schtml=browser", _... | Splawik/pytigon | pytigon/prj/schpytigondemo/schcomponents_demo/__init__.py | Python | lgpl-3.0 | 2,497 |
import unittest
from packaging.version import parse
import sdafile
from sdafile.version import version
class Version(unittest.TestCase):
def test_imports(self):
self.assertEqual(sdafile.__version__, version)
def test_pep_440(self):
# Raises InvalidVersion if version does not conform to pep... | enthought/sandia-data-archive | sdafile/tests/test_version.py | Python | bsd-3-clause | 347 |
import os
import tempfile
import shutil
import sys
import webtest
import time
import threading
from io import BytesIO
from pywb.webapp.pywb_init import create_wb_router
from pywb.manager.manager import main
import pywb.manager.autoindex
from pywb.warc.cdxindexer import main as cdxindexer_main
from pywb import ge... | machawk1/pywb | tests/test_auto_colls.py | Python | gpl-3.0 | 19,169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.