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 |
|---|---|---|---|---|---|
import unittest
from .case_board import BoardTestCase
from .helpers import C, WHITE, BLACK
class TestBoardConstruction(BoardTestCase):
def get_board(self, *args, **kwargs):
from chess.models import Board
return Board(*args, **kwargs)
def test_empty(self):
board = self.get_board()
... | renatopp/liac-chess | tests/test_board_construction.py | Python | mit | 1,081 |
import unittest
import mock
import DIRT
from models import match_set_factory
import utilities.path
def iter_match_passages(match_set):
for match in match_set.matches:
yield match.alpha_passage
yield match.beta_passage
def contains_contains(l, search_for):
for item in l:
if search_f... | gnarph/DIRT | tests.py | Python | mit | 2,905 |
#!/usr/bin/python
# Copyright (c)2010-2012 the Boeing Company.
# See the LICENSE file included in this distribution.
# run iperf to measure the effective throughput between two nodes when
# n nodes are connected to a virtual hub/switch; run test for testsec
# and repeat for minnodes <= n <= maxnodes with a step size ... | Benocs/core | src/daemon/examples/netns/switchtest.py | Python | bsd-3-clause | 3,358 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a syntax highlighter for unified and context diff outputs.
"""
from __future__ import unicode_literals
from E5Gui.E5GenericDiffHighlighter import TERMINAL, E5GenericDiffHighlighter
class SvnDiffHighl... | testmana2/test | Plugins/VcsPlugins/vcsSubversion/SvnDiffHighlighter.py | Python | gpl-3.0 | 2,136 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2009 Hewlett-Packard Development Company, L.P.
#
# 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 Lice... | Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/hplip/probe.py | Python | gpl-3.0 | 8,190 |
"""
Basic IRT support for assessment items
"""
from dlkit.json_.osid.metadata import Metadata
from dlkit.abstract_osid.assessment import record_templates as abc_assessment_records
from dlkit.abstract_osid.osid.errors import IllegalState, InvalidArgument
from ...osid.base_records import DecimalValuesRecord,\
Deci... | mitsei/dlkit | dlkit/records/assessment/analytic/irt.py | Python | mit | 7,495 |
"""
unittests for xmodule
Run like this:
paver test_lib -l common/lib/xmodule
"""
import json
import os
import pprint
import unittest
import inspect
from contextlib import contextmanager
from lazy import lazy
from mock import Mock
from operator import attrgetter
from path import path
from xblock.field_data im... | sameetb-cuelogic/edx-platform-test | common/lib/xmodule/xmodule/tests/__init__.py | Python | agpl-3.0 | 23,045 |
from flask.testing import FlaskClient
from app import create_app, db
from app.models import Framework, FrameworkLot
class TestClient(FlaskClient):
"""This is a custom Test Client for handling the creation of a dedicated application context on a per request basis.
Flask-SQLAlchemy attaches its db operations ... | alphagov/digitalmarketplace-api | tests/bases.py | Python | mit | 4,405 |
#!/usr/bin/env python2
# coding: utf-8
import pygame
import sys
from functions import load_png
from config import ASSET_JOUEUR
from config import PLAYER_SPEED, PLAYER_LIFE_MAX, BOMB_RANGE, SIDE_LENGTH
from map import Bombe
class Joueur(pygame.sprite.Sprite):
def __init__(self, numero, spawn_topleft):
py... | simsor/BomberLAN | serveur/joueur.py | Python | mit | 5,116 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import fields, models, api
import log... | odoo-argentina/config | l10n_ar_base/res_config.py | Python | agpl-3.0 | 5,591 |
#!/usr/bin/env python2
import nose.tools as nt
from ovirtlago import testlib
@testlib.with_ovirt_prefix
def test_cpu_model_host(prefix):
cpu_family = prefix.virt_env.get_ovirt_cpu_family()
nt.assert_equals(cpu_family, 'Intel Westmere Family')
@testlib.with_ovirt_prefix
def test_cpu_model_engine(prefix):
... | lago-project/lago-ost-plugin | tests/functional/fixtures/ovirt.runtest/002_testlib.py | Python | gpl-2.0 | 784 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from websocket import create_connection
from websocket import ABNF
from reimp import Box
ws = create_connection("ws://127.0.0.1:8000/echo")
# ws = create_connection("ws://115.28.224.64:8000/echo")
box = Box()
box.cmd = 101
box.body = '我爱你'
t1 = time.time()
#... | yangdw/repo.python | src/annotation/haven/examples/websocket_demo/client.py | Python | mit | 538 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt
from pisi.actionsapi import kde4
#from pisi.actionsapi import pisitools
# if pisi can't find source directory, see /var/pisi/nmapis4/work/ and:
# WorkDir="nmapis4-"+... | pisiganesh/my_pisi_files | nmapsi4/actions.py | Python | gpl-2.0 | 1,010 |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.test import TestCase
from StringIO import StringIO
import mock
import pytest
import factory
from openpyxl import Workbook
from spreadsheetresponsemixin import SpreadsheetResponseMixin
from .models import MockModel, MockAuthor
class MockModelFac... | aptivate/django-spreadsheetresponsemixin | tests/test_views.py | Python | gpl-3.0 | 19,878 |
import os
from ..java import (
Class as JavaClass,
Field as JavaField,
Method as JavaMethod,
Code as JavaCode,
opcodes as JavaOpcodes,
SourceFile,
Signature,
# LineNumberTable
)
from .blocks import Block, IgnoreBlock
from .methods import MainMethod, Method, extract_parameters
from .opco... | shaunstanislaus/voc | voc/python/modules.py | Python | bsd-3-clause | 8,535 |
from unittest import TestCase, main
from datetime import datetime
from future.utils import viewitems
from qiita_core.exceptions import IncompetentQiitaDeveloperError
from qiita_core.qiita_settings import qiita_config
from qiita_core.util import qiita_test_checker
from qiita_db.base import QiitaObject
from qiita_db.st... | adamrp/qiita | qiita_db/test/test_study.py | Python | bsd-3-clause | 29,183 |
"""PyPI and direct package downloading"""
import sys, os.path, re, urlparse, urllib, urllib2, shutil, random, socket, cStringIO
import base64
import httplib
from pkg_resources import *
from distutils import log
from distutils.errors import DistutilsError
try:
from hashlib import md5
except ImportError:
from md5... | xbianonpi/xbian-package-development | content/usr/local/lib/python2.7/dist-packages/distribute-0.6.30-py2.7.egg/setuptools/package_index.py | Python | gpl-2.0 | 31,252 |
import collections
import json
import re
import urllib
from bs4 import BeautifulSoup
import HTMLParser
def get_properties (message):
"""
Processes a given chat message to identify particular properties: mentions,
emoticons and links. See the README.md file for more detailed documentation.
Args:
... | erichaase/atlassian | atlassian/hip_chat.py | Python | mit | 3,247 |
#!/usr/bin/python
# license:BSD-3-Clause
# copyright-holders:Olivier Galibert
from __future__ import print_function
USAGE = """
Usage:
%s h8.lst <mode> <type> h8.inc (mode = s/d, type = o/h/s20/s26)
"""
import sys
def name_to_type(name):
if name == "o":
return 0
if name == "h":
return 1
if... | johnparker007/mame | src/devices/cpu/h8/h8make.py | Python | gpl-2.0 | 18,115 |
import numpy as np
import numpy.linalg as npl
import json as json
import typedbytes as tb
from utils import Block_Mapper
from quantreg import quantreg_ipm
class Unif_Samp_Mapper(Block_Mapper):
"""
Random sampling uniformly
"""
def __init__(self):
import os
Block_Mapper.__init__(self, ... | chocjy/randomized-quantile-regression-solvers | hadoop/src/quantreg_unifsamp_solve.py | Python | apache-2.0 | 1,499 |
#!/usr/bin/python
import argparse
import subprocess
import os
import shutil
def run(cmd):
try:
p = subprocess.Popen(cmd, shell=True)
p.communicate()
status = p.returncode
if status:
raise
except:
print "An error has occured while running the following shell... | codingpoets/tigl | misc/createChangeLog/changeLogToWikiAndDoc.py | Python | apache-2.0 | 2,221 |
# Test process monitoring
#
# Copyright (C) 2020 Simon Dobson
#
# This file is part of epydemic, epidemic network simulations in Python.
#
# epydemic 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 vers... | simoninireland/epydemic | test/test_monitor.py | Python | gpl-3.0 | 3,479 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) 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.
#
# This program is distributed in the hope that it ... | obsoleter/suds | suds/umx/core.py | Python | lgpl-3.0 | 7,783 |
####
#### Steps for operating on the various forms and their results.
####
from behave import *
###
### radio button click
###
@given('I click the "{id}" radio button')
def step_impl(context, id):
webelt = context.browser.find_element_by_id(id)
webelt.click()
###
### Submission.
###
## Submit analyze pheno... | kshefchek/monarch-app | tests/behave/steps/selenium-forms.py | Python | bsd-3-clause | 1,359 |
__author__ = 'Guorong Xu<g1xu@ucsd.edu>'
import sys
import subprocess
import PBSTracker
import YamlFileReader
root_dir = "/shared/workspace/ChiPSeqPipeline"
data_dir = "/shared/workspace/data_archive/ChiPSeq"
## run all analysis from download, alignment, counting and differential calculation.
def run_analysis(yaml_f... | ucsd-ccbb/jupyter-genomics | src/awsCluster/server/ChipSeqPipeline/homer_workflow/ChipSeqPipeline.py | Python | mit | 15,575 |
def extractTttranslationsWordpressCom(item):
'''
Parser for 'tttranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Reiryuu Academy Student Council', 'Reiryuu Academ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractTttranslationsWordpressCom.py | Python | bsd-3-clause | 680 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Data Objects
###################################
Data objects are used to store typed data coming from an external source (for
example a file on disk). There are three primary da... | avmarchenko/exa | exa/core/numerical.py | Python | apache-2.0 | 15,937 |
# Copyright 2006 James Tauber and contributors
# Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
#
# 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/... | anandology/pyjamas | library/gwt/ui/Widget.py | Python | apache-2.0 | 5,366 |
from .decorators import render_to_json
from .helper import HeadFileUploader, ImageFactory, BaseModelManager, get_first_letter, convertjson | xlk521/cloudguantou | utils/__init__.py | Python | bsd-3-clause | 138 |
#! /usr/bin/python
import readline
commands = [
"eggs",
"cheese",
"bread",
"five"
]
def completer(text, state):
print "in completer"
options = [i for i in commands if i.startswith(text)]
if state < len(options):
return options[state]
else:
return None
readline.parse_a... | CospanDesign/python | autocomplete/autocomplete.py | Python | mit | 379 |
from __future__ import unicode_literals
import io
import os
import re
import warnings
from django.apps import apps
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models, router
from django.utils.deprecation import RemovedInDjango19Warning
def check_for_mi... | andyzsf/django | django/core/management/sql.py | Python | bsd-3-clause | 11,489 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2014 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 b... | jaor/bigmler | bigmler/export/out_model/rmodel.py | Python | apache-2.0 | 7,665 |
from __future__ import absolute_import
from collections import defaultdict
import itertools
import sys
from bs4.element import (
CharsetMetaAttributeValue,
ContentMetaAttributeValue,
whitespace_re
)
import six
__all__ = [
'HTMLTreeBuilder',
'SAXTreeBuilder',
'TreeBuilder',
'TreeBuilderR... | catapult-project/catapult | third_party/beautifulsoup4/bs4/builder/__init__.py | Python | bsd-3-clause | 11,207 |
#!/usr/bin/env python
#
# This example shows some examples of scope you can use for dashboards.
#
import sys
from sdcclient import SdcClient
#
# Scopes can be passed to most of dashboard-related functions, e.g. create_dashboard_from_file.
#
# NOTE: convert_scope_string_to_expression should never be used in a user s... | draios/python-sdc-client | examples/dashboard_scope.py | Python | mit | 2,360 |
from mediawords.db import connect_to_db
def test_connect_to_db():
# Default database
db = connect_to_db()
database_name = db.query('SELECT current_database()').hash()
assert database_name['current_database'] == 'mediacloud'
| berkmancenter/mediacloud | apps/common/tests/python/mediawords/test_db.py | Python | agpl-3.0 | 242 |
import unittest
import constants as const
from config import SkynetConfig
class SkynetConfigTestCase(unittest.TestCase):
def test_reading_text_level_information(self):
conf = SkynetConfig()
conf.read_config('testconfig.ini')
expected_data = ('text', 'question0', 'answer0', '0')
lv... | Hethurin/skynet-bot | testconfig.py | Python | mit | 1,089 |
#!/usr/bin/env python
import os, sys, re, string
# the list only for debugging. The real list, used in the real OpenCV build, is specified in CMakeLists.txt
opencv_hdr_list = [
"../../core/include/opencv2/core/core.hpp",
"../../flann/include/opencv2/flann/miniflann.hpp",
"../../ml/include/opencv2/ml/ml.hpp",
"../../i... | grace-/opencv-3.0.0-cvpr | opencv/modules/python/src2/hdr_parser.py | Python | bsd-3-clause | 33,980 |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Rds20140815CheckAccountNameAvailableRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.AccountName = None
self.DBInstanceId = None
self.resourceOwnerAccount = None
... | francisar/rds_manager | aliyun/api/rest/Rds20140815CheckAccountNameAvailableRequest.py | Python | mit | 408 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from twisted.trial import unittest
from hiitrack.lib.spatial import spatial_hash
from random import randint
from base64 import b64encode
class SpatialTestCase(unittest.TestCase):
def test_generation(self):
size = randint(0, 1000000)
point_count = 1000
dimensions =... | hiidef/hiitrack-api | tests/spatial.py | Python | mit | 1,469 |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... | barnone/EigenD | app_browser2/belcanto_panel.py | Python | gpl-3.0 | 3,432 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Acl(AutotoolsPackage):
"""Commands for Manipulating POSIX Access Control Lists."""
ho... | LLNL/spack | var/spack/repos/builtin/packages/acl/package.py | Python | lgpl-2.1 | 1,448 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from asdf.yamlutil import custom_tree_to_tagged_tree
from astropy.time import TimeDelta
from astropy.time.tests.test_delta import (allclose_jd, allclose_jd2,
allclose_sec)
from ...types... | bsipocz/astropy | astropy/io/misc/asdf/tags/time/timedelta.py | Python | bsd-3-clause | 908 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_takestep_explorer.ui'
#
# Created: Wed Apr 24 11:11:57 2013
# by: PyQt4 UI code generator 4.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
e... | js850/PyGMIN | pygmin/gui/ui/ui_takestep_explorer.py | Python | gpl-3.0 | 5,129 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v10/services/services/customer_label_service/transports/__init__.py | Python | apache-2.0 | 1,061 |
import unittest
import numpy
import chainer
from chainer import backend
from chainer.backends import cuda
from chainer import gradient_check
from chainer import links
from chainer import testing
from chainer.testing import attr
def _sigmoid(x):
xp = backend.get_array_module(x)
half = x.dtype.type(0.5)
r... | jnishi/chainer | tests/chainer_tests/links_tests/connection_tests/test_peephole.py | Python | mit | 7,504 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Modbus documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 13 21:13:48 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | AdvancedClimateSystems/python-modbus | docs/source/conf.py | Python | mpl-2.0 | 9,496 |
print 'Hello, world! And x is %d' % x
x = x + 1
print 'Also x is %d' % x
x = x + 1
print 'Also x is %d' % x
x = x + 1
print 'Also x is %d' % x
x = x + 1
print 'Also x is %d' % x
caster.sayMoo()
caster.mutableNumber.add (1)
result = True | kibertoad/swampmachine | swampmachine-scripting/src/test/resources/net/kiberion/swampmachine/scripting/jython/test.py | Python | apache-2.0 | 238 |
import numpy as np
import simtk.openmm as mm
import simtk.openmm.app as app
import simtk.unit as u
eu = u.kilocalories_per_mole
temperature = 300 * u.kelvin
friction = 1.0 / u.picosecond
pdb = app.PDBFile('pdb/resi-1-15.pdb')
forcefield = app.ForceField('amber99sb.xml',"tip3p.xml")
m = app.modeller.Modeller(pdb.to... | kyleabeauchamp/AlphaSynuclein | python/solvate.py | Python | apache-2.0 | 830 |
import re
import csv
import ipaddress
__version__ = 1.0
# Each route will have the following values
class Route_Template(object):
def __init__(self):
self.route = {}
self.protocol = []
self.metric = []
self.next_hop = []
self.age = []
self.interface = []
def __r... | abbacode/ciscorouteparser | route_parse_nxos.py | Python | mit | 5,396 |
import warnings
from django.core.exceptions import MiddlewareNotUsed
from django.db import connection, transaction
from django.utils.deprecation import RemovedInDjango18Warning
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/middleware/transaction.py | Python | gpl-2.0 | 2,703 |
"""bluesky.modules.extrafiles
"""
__author__ = "Joel Dubowy"
__all__ = [
'run'
]
__version__ = "0.1.0"
import os
from bluesky.config import Config
from bluesky.exceptions import BlueSkyConfigurationError
from bluesky.extrafilewriters import (
emissionscsv, firescsvs, smokeready
)
EXTRA_FILE_WRITERS = {
... | pnwairfire/bluesky | bluesky/modules/extrafiles.py | Python | gpl-3.0 | 1,867 |
# Copyright (c) 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 ... | dims/nova | nova/tests/unit/compute/test_resource_tracker.py | Python | apache-2.0 | 57,495 |
#!/usr/bin/env python
#
# Copyright (C) 2009-2010:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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... | staute/shinken-mod-pickle-retention-file-generic | test/test_module_pickle_retention_arbiter.py | Python | agpl-3.0 | 3,039 |
#!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import os
import pymongo
import urllib
import matplotlib.pyplot as plt
import cv2
# the directory to store the movie preview clips in
image_directory = "/home/greg/Databases/chimp/images/"
# connect to the mongodb server
client = pymongo.MongoClient()
... | zooniverse/aggregation | experimental/algorithms/chimp.py | Python | apache-2.0 | 2,689 |
import json
import re
import sys
debug = False # toggle debug to print broken lines
# All the individual fields we care about
last = r'(?P<lastname>[A-z]+)'
first = r'(?P<firstname>[A-z]+(\s\w\.)?)'
phone = r'(?P<phonenumber>.+)'
color = r'(?P<color>[A-z ]+)'
zipcode = r'(?P<zipcode>\d{5})'
delim = r',\s+'
# Buil... | preds/kata | rolodex/rolodex.py | Python | gpl-3.0 | 2,873 |
# coding=utf-8
from qgis.core import qgsfunction
from safe.common.parameters.resource_parameter import ResourceParameter
from safe.definitions.fields import (
under_5_displaced_count_field,
over_60_displaced_count_field)
from safe.definitions.reports.infographic import (
infographic_header,
map_overvi... | akbargumbira/inasafe | safe/report/expressions/infographic.py | Python | gpl-3.0 | 7,891 |
# *********************************************
# PyOFTK.ossm() test
# Example from A. de Toroker et al.
# Bragg Soliton
#
#
#
# Author: Martin Laprise
# Universite Laval
# martin.laprise.1@ulaval.ca
#
# *********************************************
from numpy import *
from pylab import *
... | mlaprise/PyOFTK | PyOFTK/examples/bragg_soliton_cpu.py | Python | gpl-2.0 | 3,054 |
from .ExtendedFormatter import ExtendedFormatter as _ExtendedFormatter
from .sql import *
eformat = _ExtendedFormatter() | DavidWhittingham/arcpyext | arcpyext/_str/__init__.py | Python | bsd-3-clause | 121 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | eriklavander/klaviaturregistret | web/migrations/0001_initial.py | Python | gpl-2.0 | 4,011 |
from django.shortcuts import render, redirect, get_object_or_404
from bookshelf.forms import (SearchBookForm, AddBookForm,
EditAuthorForm, PostReviewForm,
EditGenreForm)
from bookshelf.models import Book, Author, Genre, BookReview
from collections import Ordered... | tdhris/MyBookShelf | bookshelf/views.py | Python | gpl-2.0 | 6,306 |
from __future__ import absolute_import, division, unicode_literals
from six import text_type
import re
from codecs import register_error, xmlcharrefreplace_errors
from .constants import voidElements, booleanAttributes, spaceCharacters
from .constants import rcdataElements, entities, xmlEntities
from . import treewal... | sserrot/champion_relationships | venv/Lib/site-packages/bleach/_vendor/html5lib/serializer.py | Python | mit | 15,746 |
########################################################################
## File name: generate_readme.py ##
## Author: Rick van Rheenen ##
## Date created: 2016-04-14 ##
## Date last modified: 2016-... | iMylene/kattis | scripts/generate_readme.py | Python | mit | 10,424 |
from main import Yify
def start():
return Yify()
config = [{
'name': 'yify',
'groups': [
{
'tab': 'searcher',
'list': 'torrent_providers',
'name': 'Yify',
'description': 'Free provider, less accurate. Small HD movies, encoded by <a href="https://yify... | rooi/CouchPotatoServer | couchpotato/core/providers/torrent/yify/__init__.py | Python | gpl-3.0 | 1,735 |
## Errors for all modules
##
## Biskit, a toolkit for the manipulation of macromolecular structures
## Copyright (C) 2004-2018 Raik Gruenberg & Johan Leckner
##
## 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 Sof... | graik/biskit | biskit/errors.py | Python | gpl-3.0 | 1,755 |
#!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: Access module - Models
# © Copyright 2013-2015 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General P... | nikitos/npui | netprofile_access/netprofile_access/models.py | Python | agpl-3.0 | 23,665 |
from starcluster.clustersetup import ClusterSetup
from starcluster.logger import log
class SalmonInstaller(ClusterSetup):
def run(self, nodes, master, user, user_shell, volumes):
for node in nodes:
log.info("Installing Salmon 0.3.0 on %s" % (node.alias))
node.ssh.execute('mkdir -p /opt/software/salmon/0.3.0/'... | meissnert/StarCluster-Plugins | salmon_0_3_0.py | Python | mit | 1,179 |
"""
WSGI config for ubermanage project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | nerdoc/ubermanage | ubermanage/wsgi.py | Python | agpl-3.0 | 397 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
try:
import cStringIO as StringIO
except ImportError:
import StringIO
from PIL import Image
from PIL import ImageEnhance
from random import randrange
# ----------------------------------------
# Image resizing
... | laslabs/odoo | openerp/tools/image.py | Python | agpl-3.0 | 13,237 |
# Definition for a binary tree node
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class BSTIterator(object):
def __init__(self, root):
"""
:type root: TreeNode
"""
self.root = root
self.i... | zeyuanxy/leet-code | vol4/binary-search-tree-iterator/binary-search-tree-iterator.py | Python | mit | 1,580 |
"""
==============================================================================
Program: roiAnalysis.py
Author: Kyle Reese Almryde
Date: 11/20/2012 @ 13:16:12 PM
Description: This module contains methods for performing ROI analysis on
functional Magnetic Resonance Images.
========================... | KrbAlmryde/Utilities | WorkShop/PYTHON/roiAnalysis.py | Python | mit | 6,956 |
#!/usr/bin/python
# Copyright (c) 2009, Purdue University
# 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 ... | uberj/iscpy | test/named_importer_lib_regtest.py | Python | bsd-3-clause | 18,652 |
#!/usr/bin/env python
#coding:utf-8
# Author: mozman
# Purpose: a hack to generate XML containing CDATA by ElementTree
# Created: 26.05.2012
# Copyright (C) 2012, Manfred Moitzi
# License: GPLv3
# usage:
#
# from svgwrite.etree import etree, CDATA
#
# element = etree.Element('myTag')
# element.append(CD... | hirobert/svgwrite | svgwrite/etree.py | Python | gpl-3.0 | 1,493 |
# Generated by Django 2.0 on 2018-05-15 15:28
import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = ... | diaspa-nds/cfar | core/migrations/0001_initial.py | Python | gpl-2.0 | 13,647 |
from pylab import *
from sourceifc import sourceifc
class plotsamples:
class out_plot(sourceifc.out_callbacks):
def send_samples(self, timestamp, samples):
plot(samples)
show()
def __init__(self, src):
src.register_callbacks(plotsamples.out_plot())
def __del__(self):... | migueltorroja/rds-sdr | plotsamples.py | Python | mit | 334 |
from . import sale_order
from . import stock_picking
| Comunitea/CMNT_004_15 | project-addons/ubl_edi_from_it/models/__init__.py | Python | agpl-3.0 | 53 |
# Copyright 2012 VMware, 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 ... | bigswitch/neutron | neutron/tests/unit/agent/l3/test_agent.py | Python | apache-2.0 | 133,544 |
#!/usr/bin/env python
# REF [site] >> https://github.com/baidu-research/warp-ctc
import numpy as np
import tensorflow as tf
import warpctc_tensorflow
# REF [site] >> https://github.com/baidu-research/warp-ctc/blob/master/tests/test_cpu.cpp
def simple_toy_example_1():
#num_time_steps = 5
#num_batches = 2
#alphabet... | sangwook236/general-development-and-testing | sw_dev/python/rnd/test/machine_learning/warp_ctc_test.py | Python | gpl-2.0 | 3,530 |
# 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... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/tensorflow/contrib/input_pipeline/python/ops/input_pipeline_ops.py | Python | bsd-2-clause | 4,117 |
import re
from collections import defaultdict
from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import PermissionDenied
from django.forms import ModelForm
from django.shortcuts import redirect
from django.views.generic import CreateView, DetailView, RedirectView
from recipes.model... | vanatteveldt/luctor | recipes/menu.py | Python | mit | 5,407 |
import logging
import argparse
import json
import sys
import traceback
import threading
from doc2pdf import worker
EXAMPLE_CONFIG = """
{
"log_file": "C:\\\\pathtolog.txt",
"autodelete": false,
"converter_timeout": 60,
"converter_retries": 3,
"converter_delay": 5,
"queue_capa... | andiwand/doc2pdf | src/doc2pdf/cli.py | Python | lgpl-3.0 | 2,717 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-03-01 17:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bearing', '0043_auto_20180227_1914'),
]
operations... | manti-by/POD | app/bearing/migrations/0044_bearingsearch.py | Python | bsd-3-clause | 939 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import socket
import six
from django.core.exceptions import ValidationError
from django.core.validators import validate_ipv46_address
from django.utils.translation import ugettext_lazy as _
RE_PATH = re.compile('([\w/\[\] .-]+)$', re.UNICODE)
... | ehooo/email_backup | email_backup/core/validators.py | Python | gpl-3.0 | 2,289 |
# coding: utf-8
from __future__ import unicode_literals
from boxsdk.exception import BoxAPIException
import csv
import os
from box_manage_users.scripts.script import Script
class MassProvisionScript(Script):
"""
Script to create many users in an enterprise at once.
"""
_title = 'Provision Users & Cre... | box-samples/user-management | box_manage_users/scripts/provision.py | Python | apache-2.0 | 2,384 |
script = b'info = \'Set by the %s script\';'
def main(request, response):
type = request.GET[b'type']
if request.GET[b'type'] == b'fallingback':
return 404, [(b'Content-Type', b'text/plain')], u"Page not found"
return [(b'Content-Type', b'text/javascript')], script % type
| scheib/chromium | third_party/blink/web_tests/external/wpt/html/browsers/offline/appcache/workers/resources/appcache-worker-import.py | Python | bsd-3-clause | 294 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | francbartoli/geonode | geonode/layers/models.py | Python | gpl-3.0 | 24,953 |
import urllib.request
import time
preço = 99.99 #algum valor maior
while preço >= 4.74:
pagina = urllib.request.urlopen(
'http://beans.itcarlow.ie/prices-loyalty.html')
texto = pagina.read().decode('utf8')
onde = texto.find('>$')
início = onde + 2
fim = início + 4
preço = float(t... | wsricardo/mcestudos | treinamento-webScraping/Abraji/p11.py | Python | gpl-3.0 | 468 |
# Define plugins for py.test
import pytest
def pytest_addoption(parser):
parser.addoption("--runslow", action="store_true",
help="run slow tests")
| aswolf/xmeos | xmeos/conftest.py | Python | mit | 160 |
# Copyright (c) 2014 Mirantis 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 or ... | CiscoSystems/tempest | tempest/api/data_processing/test_node_group_templates.py | Python | apache-2.0 | 3,476 |
#!/usr/bin/env python
from __future__ import division, print_function, absolute_import
def configuration(parent_package='', top_path=None):
from numpy.distutils.misc_util import Configuration
config = Configuration('signal', parent_package, top_path)
config.add_data_dir('tests')
config.add_data_dir(... | chaluemwut/fbserver | venv/lib/python2.7/site-packages/scipy/signal/setup.py | Python | apache-2.0 | 1,168 |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | googleads/google-ads-python | google/ads/googleads/v9/errors/types/conversion_value_rule_error.py | Python | apache-2.0 | 1,666 |
# 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 agreed to in writing, ... | GoogleCloudPlatform/cloud-foundation-fabric | tests/modules/cloud_function/test_plan.py | Python | apache-2.0 | 1,062 |
#!/usr/bin/env python
"""
Create a directed graph, allowing multiple edges and self loops, from
a unix mailbox. The nodes are email addresses with links
that point from the sender to the recievers. The edge data
is a Python email.Message object which contains all of
the email message data.
This example shows the pow... | elenanst/HPOlib | virtualHPOlib/share/doc/networkx-1.11/examples/graph/unix_email.py | Python | gpl-3.0 | 2,670 |
# Copyright 2018 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... | jendap/tensorflow | tensorflow/tools/compatibility/tf_upgrade_v2.py | Python | apache-2.0 | 64,405 |
# -*- coding: utf-8 -*-
# stdlib
import random
import time
import unittest
# 3p
from nose.plugins.attrib import attr
import nose.tools as nt
# project
from aggregator import DEFAULT_HISTOGRAM_AGGREGATES
from dogstatsd import MetricsBucketAggregator
@attr(requires='core_integration')
class TestUnitMetricsBucketAggreg... | WPMedia/dd-agent | tests/core/test_bucket_aggregator.py | Python | bsd-3-clause | 42,702 |
# 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
# distribu... | quantumlib/OpenFermion | src/openfermion/transforms/opconversions/verstraete_cirac_test.py | Python | apache-2.0 | 4,897 |
from datetime import datetime
from django.db import models, transaction, DatabaseError
from django.db.models import Q
from django.utils import timezone
import pytz
from threepio import logger
from core.models.abstract import BaseSource
from core.models.instance_source import InstanceSource
from core.models.provider... | CCI-MOC/GUI-Backend | core/models/volume.py | Python | apache-2.0 | 10,159 |
#Part 1: Terminology (15 points)
#1 1pt) What is the symbol "=" used for?
#The "=" symbol is called an assignment operator and it does what it says.
#It assigns values to variables, which is called an assignment statement.
#ex: x = 5
#2 3pts) Write a technical definition for 'function'
#A function is a defined set of... | jaejun1679-cmis/jaejun1679-cmis-cs2 | cs2quiz1.py | Python | cc0-1.0 | 3,123 |
import ConfigParser
import logging
from logging.handlers import RotatingFileHandler
from flask import Flask, url_for
app = Flask(__name__)
@app.route('/')
def root():
this_route = url_for('.root')
app.logger.info("Logging a test message from "+this_route)
return "Hello Napier from the configu... | siwells/teaching_set09103 | code/topic_08/logs.py | Python | gpl-3.0 | 1,689 |
"""Common test objects."""
import copy
import json
from unittest.mock import ANY
from hatasmota.const import (
CONF_MAC,
CONF_OFFLINE,
CONF_ONLINE,
CONF_PREFIX,
PREFIX_CMND,
PREFIX_TELE,
)
from hatasmota.utils import (
config_get_state_offline,
config_get_state_online,
get_topic_tel... | w1ll1am23/home-assistant | tests/components/tasmota/test_common.py | Python | apache-2.0 | 19,194 |
# Programmer: Noah Osterhout
# Date: September 30th 2016 1:40PM EST
# Project: Kirby_Physics.py
#Ask what Problem they will be using
print()
print("This Program will find the misisng Variables using the three known ones and using PEMDAS")
print()
beetles_mem = input("What Beetles member will you be using? ")... | NoahFlowa/CTC_Projects | Osterhout_Python/Kirby_Physics.py | Python | mit | 1,794 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.