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 |
|---|---|---|---|---|---|
"""
Django settings for hackerspace_online project.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_D... | kinglyduck/hackerspace | src/hackerspace_online/settings/base.py | Python | gpl-2.0 | 13,599 |
import openapp.api.template.template as template
import unittest
import webob
class FakeApp(object):
def __call__(self, env, start_response):
return Response(body = "OK")(env, start_response)
class RestTest(unittest.TestCase):
def test_template_application(self):
request = webob.Request.blan... | Yusuke1987/openstack_template | openapp/tests/unit/test_template.py | Python | apache-2.0 | 523 |
import time
from threading import Thread
from Queue import Queue,Empty
import traceback
from wtfj_ids import *
from wtfj_utils import *
from wtfj_runner import *
class Piece(object):
''' Pretty much everything in the system that's not a pipe is made of this '''
''' Pieces are assigned identifiers based on their cla... | WritingTechForJarrod/app | src/wtfj/piece.py | Python | gpl-3.0 | 5,481 |
import json
from django.test import TestCase
from tests.sampledata import SampleData
from treeherder.etl.perf_data_adapters import TalosDataAdapter
from treeherder.model.models import (MachinePlatform, Option,
OptionCollection, Repository,
Repo... | moijes12/treeherder | tests/etl/test_perf_data_adapters.py | Python | mpl-2.0 | 5,633 |
from a10sdk.common.A10BaseClass import A10BaseClass
class SynCookie(A10BaseClass):
"""Class Description::
Global Syn-Cookie Protection.
Class syn-cookie supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param on_threshold... | amwelch/a10sdk-python | a10sdk/core/syn/syn_cookie.py | Python | apache-2.0 | 1,681 |
#!/usr/bin/env python3
"""tic-tac-toe game simulator
"""
import sys
import argparse
from game.constants import CHARS
from game.tictactoe import TicTacToe
from game.player import HumanPlayer, ComputerPlayer
def get_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('mode', choi... | consttgit/tic-tac-toe | tic-tac-toe.py | Python | mit | 2,177 |
"""
The ``image_loader`` module
======================
Contains methods for loading images, cropping, exporting, generating splicing, etc.
"""
from PIL import Image
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
import numpy as np
import os, os.path
import sys
import random
class Dat... | NicoRahm/CGvsPhoto | CGvsPhoto/image_loader.py | Python | mit | 29,649 |
import json
import os
import shutil
import datetime
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
try:
import subprocess32 as subprocess
except ImportError:
import subprocess
try:
from os import scandir, walk
except ImportError:
from scandir import s... | dougbenjamin/panda-harvester | pandaharvester/harvestermessenger/shared_file_messenger.py | Python | apache-2.0 | 35,562 |
# -*- coding: utf-8 -*-
"""Tests for LTI Xmodule LTIv2.0 functional logic."""
import datetime
import textwrap
from mock import Mock
from pytz import UTC
from xmodule.lti_2_util import LTIError
from xmodule.lti_module import LTIDescriptor
from . import LogicTest
class LTI20RESTResultServiceTest(LogicTest):
""... | edx-solutions/edx-platform | common/lib/xmodule/xmodule/tests/test_lti20_unit.py | Python | agpl-3.0 | 17,188 |
from collections import defaultdict
from functools import reduce
import math
import operator
import random
from flax.component import Breakable, IPhysics, Empty
import flax.entity as e
from flax.entity import (
Entity, CaveWall, Floor, Tree, Grass, CutGrass, Salamango, Armor,
Potion, StairsDown, StairsUp,
... | eevee/flax | flax/fractor.py | Python | mit | 35,545 |
import cPickle
import twisted.python.failure
import datetime
import dateutil.parser
import hashlib
import logging
import time
import copy
from twisted.internet.defer import maybeDeferred
from .requestqueuer import RequestQueuer
from .unicodeconverter import convertToUTF8, convertToUnicode
from .exceptions import StaleC... | wehriam/awspider | awspider/pagegetter.py | Python | mit | 19,925 |
from WhiteLibrary.keywords.librarycomponent import LibraryComponent
from WhiteLibrary.keywords.robotlibcore import keyword
from TestStack.White.InputDevices import Keyboard # noqa: F401 #pylint: disable=unused-import
from TestStack.White.WindowsAPI import KeyboardInput
SPECIAL_KEYS = ["SHIFT", "CONTROL", "ALT", "LEF... | Omenia/robotframework-whitelibrary | src/WhiteLibrary/keywords/keyboard.py | Python | apache-2.0 | 2,787 |
import urllib
from bs4 import BeautifulSoup
class LinearIconsUnicodeResolver:
html = False
unicodes = {}
def __init__(self, url):
self.getHtmlFromUrl(url)
self.saveAsSass()
def getHtmlFromUrl(self, url):
try:
htmlfile = urllib.urlopen(url)
response = ht... | Electrofenster/font-extractor | libaries/linearIcons.py | Python | mit | 1,499 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0031_status_start_end'),
]
operations = [
migrations.AddField(
model_name='layer',
name='dis... | kdeloach/raster-foundry | src/rf/apps/core/migrations/0032_add_dismissed.py | Python | apache-2.0 | 400 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis_louvain | cms/models/translated_text.py | Python | agpl-3.0 | 4,701 |
import sys
import urllib
import json
from addontools import AddonHelper
from guidebox import Guidebox
from themoviedb import TheMovieDB
chromeLauncherBaseUrl = "plugin://plugin.program.chrome.launcher/"
print "Args: " + ";".join(sys.argv)
addonHelper = AddonHelper(sys.argv)
currentPath = addonHelper.get_... | bcingle/sigo-kodi-repository | src/plugin.video.guideboxkodi/default.py | Python | gpl-3.0 | 28,996 |
from django.shortcuts import render
from django.http import HttpRequest, Http404
from django.template import TemplateDoesNotExist
from static_site import rewriter
# Create your views here.
def page(request, path):
# if top of path is not '/', insert '/' into a top of path.
p = path
if not len(p) or p... | zakuro9715/django-static-site | static_site/views.py | Python | mit | 559 |
"""Common data structures, enumerators, and constants."""
import collections
import hienoi._nani
from hienoi._numeric import Float32
from hienoi._vectors import VECTOR2F, COLOR4F
class ParticleDisplay(object):
"""Enumerator for the displays available to draw particles.
Attributes
----------
POINT
... | christophercrouzet/hienoi | hienoi/_common.py | Python | mit | 1,731 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='PyGLM',
version='0.1',
description='Bayesian inference in GLMs for neural spike trains',
author='Scott Linderman',
author_email='slinderman@seas.harvard.edu',
url='http://www.github.com/slinderman/pyglm',
packages=[... | slinderman/theano_pyglm | setup.py | Python | mit | 504 |
import re
import requests
import matplotlib.path as matplotlib_path
import numpy as np
from pyquery import PyQuery as pq
from sodapy import Socrata
from django.db import models
from django.utils import timezone
from django.template.loader import render_to_string
from django.core.files.base import ContentFile
from dja... | matthewoconnor/maps | map/models.py | Python | mit | 17,607 |
import Character
import unittest
class TestCharCreation(unittest.TestCase):
def test_strength(self):
temp=Character.character("testchar.aks16")
self.assertEqual(temp.strength,12)
def test_MP(self):
temp=Character.character("testchar.aks16")
self.assertEqual(temp.MPmax,12)
... | ijtodorov/Python_aksiom16 | tests.py | Python | mit | 638 |
import os
import platform
from twisted.internet import defer
from .. import data, helper
from p2pool.util import pack
P2P_PREFIX = 'fac3b6da'.decode('hex') #pchmessagestart
P2P_PORT = 12024
ADDRESS_VERSION = 30 #pubkey_address
RPC_PORT = 14022
RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue(
... | mcpool/p2pool-dgb | p2pool/bitcoin/networks/digibyteSha.py | Python | gpl-3.0 | 1,172 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Intel Corp.
#
"""
Implements a power_control plugin for controlling nodes.
"""
from ...plugin import DeclarePlugin
from ..power_control import PowerControl
@DeclarePlugin('rest_power', 100)
class RestPower(PowerControl):
"""This class controls node power.
"""
... | intel-ctrlsys/actsys | actsys/control/power_control/rest/rest_power.py | Python | apache-2.0 | 1,843 |
# Copyright (c) 2014 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from collections import defaultdict
import pprint
import sys
from merge_data import CreateIndexedLookup, MergeRawTree
from print_data import PrintD... | davidbrazdil/nacl | tools/scons_to_gn/merge_data_test.py | Python | bsd-3-clause | 2,792 |
# 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... | asimshankar/tensorflow | tensorflow/contrib/distribute/python/parameter_server_strategy.py | Python | apache-2.0 | 21,809 |
# A simple round off error estimation of polynomial expressions
# Alexey Solovyev, 2016
# https://github.com/monadius/poly_fp
# MIT License
from fractions import Fraction
from numbers import Rational
# This flag controls string conversion behavior of some internal objects.
# If True then additional information is pri... | monadius/poly_fp | poly_fp.py | Python | mit | 21,765 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.test import override_settings
from django.test.client import Req... | shoopio/shoop | shuup_tests/campaigns/test_context_conditions.py | Python | agpl-3.0 | 4,778 |
"""
demo_date_compare.py -- Show comparisons of dates in python
Version 0.1 MC 2013-12-28
-- Initial version.
Version 0.2 MC 2014-08-30
-- Updated formatting for PEP-8
"""
__author__ = "Michael Conlon"
__copyright__ = "Copyright 2014, University of Florida"
__license__ = "BSD 3-Clause license"
_... | mconlon17/vivo-1.5-improvement | tools/demo_date_compare.py | Python | bsd-3-clause | 997 |
class DbnConfig(object):
dataset_file = '../../imnet_data/imnet_0.pkl'
label_file = '../../imnet_data/0_label.txt'
pretrain_model_file = '../../model/dbn.pretrain.c1000.pkl'
finetuned_model_file = '../../model/dbn.finetuned.c1000.pkl'
hidden_layers_sizes = [2048]
pretraining_epochs = 100
p... | jraman/gpupetuum | src/conf/imnet/dbn_c1000_l1.py | Python | lgpl-2.1 | 753 |
# -*- coding: utf-8 -*-
from .lancamento import *
from .plano import *
| thiagopena/djangoSIGE | djangosige/apps/financeiro/models/__init__.py | Python | mit | 72 |
# vim: fdm=indent
# author: Fabio Zanini
# date: 02/08/17
# content: Support module for filenames related to LOOM files.
# Modules
import numpy as np
import pandas as pd
from singlet.config import config
# Parser
def parse_dataset(
path,
obsm_keys=None,
):
import anndata
... | iosonofabio/singlet | singlet/io/h5ad/__init__.py | Python | mit | 1,069 |
"""
Create indexes
Revision ID: 49ab4e1139ef
Created at: 2016-05-09 09:38:28.078936
"""
import sqlalchemy as sa
from alembic import op
revision = "49ab4e1139ef"
down_revision = "23abaf4a0a4b"
branch_labels = None
depends_on = None
def upgrade():
for index_name, table_name, column_name in [
("ix_comment... | rr-/szurubooru | server/szurubooru/migrations/versions/49ab4e1139ef_create_indexes.py | Python | gpl-3.0 | 3,135 |
from compas.geometry import allclose
from compas.geometry import intersection_sphere_line
from compas.geometry import intersection_plane_circle
def test_intersection_sphere_line():
sphere = (3.0, 7.0, 4.0), 10.0
line = (1.0, 0, 0.5), (2.0, 1.0, 0.5)
ipt1, ipt2 = intersection_sphere_line(sphere, line)
... | compas-dev/compas | tests/compas/geometry/test_intersections.py | Python | mit | 737 |
# Copyright 2012, SIL International
# All rights reserved.
#
# This library 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 2.1 of License, or
# (at your option) any lat... | silnrsi/graide | lib/ttfrename/__init__.py | Python | lgpl-2.1 | 943 |
import xml.etree.cElementTree as ET
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from busstops.models import DataSource
from .management.commands.import_siri_sx import handle_item
from .models import Situation
def situation(request, id):
situation = get_object_or_404(Situati... | jclgoodwin/bustimes.org.uk | disruptions/views.py | Python | mpl-2.0 | 1,217 |
# Copyright (c) 2014-2015 Cedric Bellegarde <cedric.bellegarde@adishatz.org>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later vers... | kenden/lollypop | src/view_artist_albums.py | Python | gpl-3.0 | 5,039 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2009-2010 Zuza Software Foundation
# Copyright 2013,2016 F Wolff
#
# This file is part of Virtaal.
#
# 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 Softwa... | unho/virtaal | virtaal/views/placeablesguiinfo.py | Python | gpl-2.0 | 15,117 |
class BaseEntry(object):
"""Extracts a post's title/content."""
def applies(self, soup):
"""Returns if this filter recognizes the given soup."""
return False
def extract_title(self, soup):
"""Returns the title of this soup."""
raise NotImplementedError
def extract_content(self, soup):
"""... | kchodorow/blook | filters/base.py | Python | apache-2.0 | 1,144 |
#PyjsArray - Python-to-JavaScript TypedArray Module
#Copyright (c) 2013 James Garnon
#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... | jggatc/pyjsbitset | pyjsarray.py | Python | mit | 44,645 |
import os
import unittest
from datasources.FileDataSource import FileDataSource
from parsers.CanteenParser import CanteenParser
class CanteenParserTest(unittest.TestCase):
def test_parse(self):
parser = CanteenParser(FileDataSource(os.path.dirname(__file__) + '/page_canteen.html', 'cp1250'))
items... | BrandEmbassy/dailymenu | tests/parsers/CanteenParserTest.py | Python | mit | 3,966 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distr... | spiceqa/tp-spice | spice/ovirt/lib4x/admin_portal/admin_login.py | Python | gpl-2.0 | 1,902 |
# Copyright 2018 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to ... | QuLogic/meson | mesonbuild/ast/introspection.py | Python | apache-2.0 | 15,829 |
import os
import glob
import utils
import yaml
import functools
from maptools import PointTool, InspectionTool, EditTool
from qgis.core import QgsMapLayerRegistry, QGis, QgsTolerance, QgsVectorLayer
from utils import log
from syncing import replication
import imp
import importlib
class NoMapToolConfigured(Exception):
... | NathanW2/qmap | src/qmap/project.py | Python | gpl-2.0 | 7,832 |
from django import template
register = template.Library()
@register.filter
def add_css_class(field, css):
return field.as_widget(attrs={"class": css})
@register.filter
def space_to_underscore(string):
return string.replace(" ", "_")
#loop over queryset in groups of n
def grouped(l, n):
# Yield success... | Sult/evehub | users/templatetags/add_css.py | Python | mit | 481 |
# This file is part of eventmq.
#
# eventmq 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 2.1 of the License, or (at your option)
# any later version.
#
# eventmq is distributed in the ... | com4/eventmq | eventmq/client/__init__.py | Python | lgpl-2.1 | 933 |
import sys
lines = open(sys.argv[1], 'r')
for line in lines:
line = line.replace('\n', '').replace('\r', '')
if len(line) > 0:
num = int(line)
print(num == sum([int(x) ** len(line) for x in line]))
lines.close()
| AstrorEnales/CodeEval | Easy/Armstrong Numbers/main.py | Python | mit | 248 |
# -*- 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 ... | MapStory/geonode | geonode/layers/tests.py | Python | gpl-3.0 | 46,775 |
# Copyright 2015 gRPC authors.
#
# 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... | thinkerou/grpc | src/python/grpcio_tests/commands.py | Python | apache-2.0 | 7,542 |
from github import Github
def connect():
token_file = open('token')
try:
token = token_file.read()
finally:
token_file.close()
g = Github(token, per_page=100)
return g
G = connect()
| wuminorb/discoverGithub | cache_github/connect.py | Python | mit | 221 |
#!/usr/bin/env python
import sys
import os
import hashlib, binascii
import echolib
import traceback
import signal
from manus.messages import PrivilegedCommand, PrivilegedCommandType, PrivilegedCommandSubscriber
from manus_starter.privileged import *
if __name__ == '__main__':
if len(sys.argv) > 1:
h = h... | lukacu/manus | python/manus_starter/privileged/__main__.py | Python | mit | 1,741 |
# -*- 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):
# Adding model 'VolunteerTalk'
db.create_table(u'volunteers_volunteertalk... | cateee/fosdem-volunteers | volunteers/migrations/0012_auto__add_volunteertalk.py | Python | agpl-3.0 | 12,733 |
# Copyright (C) 2006-2008, 2013-2014 Red Hat, Inc.
# Copyright (C) 2006 Daniel P. Berrange <berrange@redhat.com>
#
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from ... | virt-manager/virt-manager | virtManager/manager.py | Python | gpl-2.0 | 36,224 |
#!/usr/bin/env python
def run(c, *channels):
server = c['MainWindow'].ui_plugins['ServerList'].active_server
connection = c['MainWindow'].ui_plugins['ServerList'].servers[server]['connection']
if isinstance(channels, str):
channels = [channels]
for channel in channels:
if channel.start... | Sjc1000/PyRC | Commands/join.py | Python | gpl-2.0 | 505 |
# scp.py
# Copyright (C) 2008 James Bardin <j.bardin@gmail.com>
"""
Utilities for sending files over ssh using the scp1 protocol.
"""
__version__ = '0.13.0'
import locale
import os
import re
from socket import timeout as SocketTimeout
import types
# this is quote from the shlex module, added in py3.3
_find_unsafe ... | kenshay/ImageScript | Script_Runner/PYTHON/Lib/site-packages/scp.py | Python | gpl-3.0 | 19,924 |
#
# This file is part of Scalable COncurrent Operations in Python (SCOOP).
#
# SCOOP 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)... | soravux/scoop | scoop/_comm/scoopzmq.py | Python | lgpl-3.0 | 17,754 |
import sqlite3
from pdb import set_trace as debug
class MassObject:
def __init__(self, attributes):
for name, value in attributes.items():
setattr(self, name, value)
class SqlObject(MassObject):
def __init__(self, db_connection, table_name, attributes = {}, id = None):
super().__in... | zackmdavis/Wires | serpentine_record/serpentine_record.py | Python | mit | 4,737 |
# -*- coding: utf-8 -*-
MDL_BYTE = 1
MDL_UNSIGNED_BYTE = 2
MDL_SHORT = 3
MDL_UNSIGNED_SHORT = 4
MDL_HALF = 5
MDL_INT = 6
MDL_UNSIGNED_INT = 7
MDL_FLOAT = 8
MDL_DOUBLE = 9
MDL_FILE = 1
MDL_NODE = 2
MDL_MESH = 3
MDL_BONE = 4
MDL_VERTEXARRAY = 5
MDL_INDICEARRAY = 6
MDL_PROPERTIES = 7
MDL_ANIMATIONKEYS = 8
MDL_AABB = 9
M... | alrusdi/leadwerks-blender-exporter | io_scene_leadwerks/leadwerks/constants.py | Python | gpl-3.0 | 700 |
from setuptools import setup
from codecs import open
from os import path
from peewee_validates import __version__
root_dir = path.abspath(path.dirname(__file__))
with open(path.join(root_dir, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
with open(path.join(root_dir, 'requirements.txt'), en... | ccssrryy/peewee-validates | setup.py | Python | mit | 1,215 |
"""
{{cookiecutter.repo_name|capitalize}} service modules
"""
| zmingee/flaskell | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/services/__init__.py | Python | mit | 62 |
"""
Problem 20
n! means n × (n − 1) × ... × 3 × 2 × 1
For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
Find the sum of the digits in the number 100!
"""
from math import factorial
from Euler import sumOfDigits
product = factorial... | Tony-Tsoi/proj-euler-ans | problems/prob020.py | Python | mit | 366 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | akretion/connector-magento | magentoerpconnect/unit/delete_synchronizer.py | Python | agpl-3.0 | 1,870 |
from locust.core import HttpLocust, Locust, TaskSet
from locust import main
from .testcases import LocustTestCase
class TestTaskSet(LocustTestCase):
def test_is_locust(self):
self.assertFalse(main.is_locust(("Locust", Locust)))
self.assertFalse(main.is_locust(("HttpLocust", HttpLocust)))
se... | codelieche/webpts | projects/webptspy/extra_apps/locust/locust/test/test_main.py | Python | mit | 939 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 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... | dset0x/invenio-checker | invenio_checker/clients/worker.py | Python | gpl-2.0 | 12,917 |
#!/usr/bin/env python
from __future__ import print_function
from datetime import datetime, timedelta, tzinfo
import boto3
from botocore.exceptions import ClientError
DEFAULT_RETENTION_DAYS = None
"""If None, no default retention is applied"""
ZERO = timedelta(0)
class UTC(tzinfo):
"""
Implements UTC time... | meredith-digops/awsops | snapshotcleanup/snapshotcleanup.py | Python | mit | 2,000 |
import os
import json
import zipfile
import tempfile
from decimal import Decimal
from django.db import migrations, models
from django.core.files import File
# FW 3.2 documents can be upgraded to 3.3 by adding IDs to lists and tables
OLD_FW_DOCUMENT_VERSION = 3.2
FW_DOCUMENT_VERSION = 3.3
ID_COUNTER = 0
def update_... | fiduswriter/fiduswriter | fiduswriter/document/migrations/0003_fidus_3_3.py | Python | agpl-3.0 | 7,091 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | rogerscristo/BotFWD | env/lib/python3.6/site-packages/pytests/test_dispatcher.py | Python | mit | 5,946 |
from django.contrib import admin
from registration.models import User, Tool, ShareZone
from sheds.models import Sheds
admin.site.register(User)
admin.site.register(Tool)
admin.site.register(ShareZone)
admin.site.register(Sheds) | SociedadMartinez/ToolShare | registration/admin.py | Python | gpl-3.0 | 228 |
from __future__ import print_function, absolute_import
import time, math, numpy
def reset_orientation(lbot, keygyro = "Z_AXIS"):
lbot.resetGyroscope(keygyro)
curAngle= lbot.getGyroscope(keygyro)
if curAngle is not None:
while curAngle>1:
curAngle = lbot.getGyroscope(keygyro)
| robocomp/learnbot | learnbot_dsl/functions/motor/base/reset_orientation.py | Python | gpl-3.0 | 310 |
"""This is a wrapper for the pyusb-implementation of the seabreeze-library
"""
from .wrapper import (SeaBreezeError,
SeaBreezeDevice,
initialize,
shutdown,
device_list_devices,
device_open,
... | TobiasNils/python-seabreeze | seabreeze/pyseabreeze/__init__.py | Python | mit | 3,030 |
# coding=utf-8
class Content:
def __init__(self, exp):
a=a | fpost-org/fpost | app/post.py | Python | mit | 75 |
from django import forms
from .models import Interaction
class InteractionInlineForm(forms.ModelForm):
class Meta:
model = Interaction
fields = "__all__"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if not self.request.user.has_perm("aklub.can_edit_a... | auto-mat/klub | apps/interactions/forms.py | Python | gpl-3.0 | 1,529 |
import chainer
import chainer.backends
from chainer.backends.cuda import cupy
import chainer.links as L
import chainer.testing
import chainermn
import numpy as np
import pytest
class Param(object):
def __init__(self, param):
self.dtype = None
self.__dict__.update(param)
params = [Param(p) for p ... | wkentaro/chainer | tests/chainermn_tests/links_tests/test_multi_node_chain_list.py | Python | mit | 15,041 |
from unittest.case import TestCase
from word_stairs import find_flights
class WordStairsTest(TestCase):
def test_simple(self):
all_words = "take these seven vendors home".split()
expected_flights = ["these seven vendors".split()]
flights = list(find_flights(all_words))
self.asser... | donkirkby/vograbulary | wordpile/word_stairs_test.py | Python | mit | 1,341 |
"""Sanity test for proper import exception handling."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
from .. import types as t
from ..sanity import (
SanityMultipleVersion,
SanityMessage,
SanityFailure,
SanitySuccess,
SanitySkipped,
SANITY_... | roadmapper/ansible | test/lib/ansible_test/_internal/sanity/import.py | Python | gpl-3.0 | 6,902 |
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
import maya.cmds as cmds
import constants as const
import rigBuildLib as complib
reload(complib)
class Component(object):
def __init__(self):
self.cmpdata = {}
self.compName = None
self.compSide = None
self.... | jamesbdunlop/defaultMayaLibrary | tools/rigComponentBuilder.py | Python | apache-2.0 | 4,466 |
import json
import os
from .utils.appdirs import AppDirs
try:
from yaml import load as yaml_load, dump as yaml_dump, YAMLError
except ImportError:
useYAML = False
else:
useYAML = True
try:
from yaml import CLoader as YAMLLoader, CDumper as YAMLDumper
except ImportError:
from yaml i... | wlerin/showroom | showroom/settings.py | Python | mit | 14,898 |
"""
Python file backup utility
1. Copy files from src to dst
"""
import os;
import shutil, errno
import copyfiles
user="dhruvmullick"
# src = "/Users/%s/python-backup-utility/main.py" %(user)
src = "/Users/%s/python-backup-utility/srcFolder/" %(user)
dst = "/Users/%s/python-backup-utility/destFolder/" %(user)
ignore... | dhruvmullick/superBackup | srcFolder/Chetan.py | Python | apache-2.0 | 397 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.dsvsv
# Copyright 2015 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
#
# ... | paninetworks/neutron | neutron/tests/api/admin/test_shared_network_extension.py | Python | apache-2.0 | 7,946 |
import pytest
import numpy as np
from scipy import sparse
from scipy.stats import kstest
import io
from sklearn.utils._testing import assert_allclose
from sklearn.utils._testing import assert_allclose_dense_sparse
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_array_a... | sergeyf/scikit-learn | sklearn/impute/tests/test_impute.py | Python | bsd-3-clause | 54,329 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCOMPSs Testbench Tasks
========================
"""
# Imports
import unittest
from pycompss.api.task import task
from pycompss.functions.reduce import mergeReduce, simpleReduce
from pycompss.functions.map import map
@task(returns=int)
def sumTask(x, y):
return x... | mF2C/COMPSs | tests/sources/python/0_basic2/src/modules/testFunctions.py | Python | apache-2.0 | 2,612 |
#!/usr/bin/env python3
import pystache as TPL
import yaml
import os
from pathlib import Path
from shutil import copyfile
tpl = """
<!DOCTYPE html>
<html>
<head>
<title>{{title_seo}}</title>
<link href='/documentation.css' type='text/css' rel='stylesheet' />
<meta http-equiv="Content-Type" content="text/h... | paulasmuth/fnordmetric | doc/web/build_layout.py | Python | gpl-3.0 | 3,254 |
# -*- coding: utf-8 -*-
#
# Copyright 2016 Capital One Services, 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 ... | capitalone/giraffez | giraffez/secret.py | Python | apache-2.0 | 2,604 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "repowatcher.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| oracal/repowatcher | manage.py | Python | mit | 254 |
from app.TwitterSearcher import TwitterSearcher
class SearcherInterface:
@staticmethod
def search_for_search_terms_in_twitter(num_tweets, auth, terms, rt):
"""Start searching for tweets that include search terms provided as parameters, includg a RT flag to indicate
if RTs should be included i... | jasonflorack/OS-tweets | app/SearcherInterface.py | Python | mit | 578 |
from setuptools import setup, find_packages
import re
import os
cwd = os.path.dirname(os.path.abspath(__file__))
# obtain version
with open(os.path.join(cwd, "screenconnect", "__init__.py")) as f:
version = re.search(r"__version__\s+=\s+\"(.*)\"", f.read()).group(1)
# obtain long description (readme file)
wit... | jacobeturpin/python-screenconnect | setup.py | Python | mit | 1,497 |
import unittest
import configparser
from ... import maxima_worker
from queue import Queue
class MaximaWorkerTests(unittest.TestCase):
def setUp(self):
config = configparser.ConfigParser()
config.readfp(open('../default.cfg'))
self.queries = Queue()
self.worker = MaximaWorker('test... | navigium/tcp2maxima | tests/maxima_threads_tests.py | Python | agpl-3.0 | 795 |
from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
import xarray as xr
from . import parameterized, randn, requires_dask
nx = 3000
long_nx = 30000000
ny = 2000
nt = 1000
window = 20
randn_xy = randn((nx, ny), frac_nan=0.1)
randn_xt = randn((nx, nt))
randn_t = ra... | chunweiyuan/xarray | asv_bench/benchmarks/interp.py | Python | apache-2.0 | 1,644 |
#!/usr/bin/env python
"""Usage: python flickr_crawler.py TAGS
TAGS is a space delimited list of tags
Created by Shuai Chen on 2017-06-08
Credit to Matt Warren of HalOtis
"""
__author__ = "Shuai Chen <shuaic92@gmail.com>"
__version__ = "$Rev: 3 $"
__date__ = "$Date: 2017-06-18 10:00:00 +0000 (Sun, 18 Jun 2017) $"
__cop... | chenusc11/flickr-crawler | flickr_crawler.py | Python | mit | 1,406 |
from nose.tools import eq_
from pyquery import PyQuery as pq
import mkt.site.tests
from mkt.translations import models, widgets
class TestWidget(mkt.site.tests.TestCase):
def test_avoid_purified_translation(self):
# Even if we pass in a LinkifiedTranslation the widget switches to a
# normal Tran... | mozilla/zamboni | mkt/translations/tests/test_widgets.py | Python | bsd-3-clause | 976 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Fernando Hidalgo (http://www.hidalgofernando.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | barct/odoo-coop | cooperativa_anisacate_customization/__openerp__.py | Python | gpl-3.0 | 2,027 |
from collections import namedtuple
from dataclasses import make_dataclass
import numpy as np
import warnings
from itertools import combinations
import scipy.stats
from scipy.optimize import shgo
from . import distributions
from ._continuous_distns import chi2, norm
from scipy.special import gamma, kv, gammaln
from . im... | WarrenWeckesser/scipy | scipy/stats/_hypotests.py | Python | bsd-3-clause | 45,046 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sampleProj.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that t... | angelawh/mapping-pton | sampleProj/manage.py | Python | mit | 808 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-30 19:33
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contratos', '0002_auto_20170330_1328'),
]
operations = [
migrations.RenameField(
... | axelleonhart/TrainingDjango | materiales/apps/contratos/migrations/0003_auto_20170330_1333.py | Python | lgpl-3.0 | 432 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
import farxiv.urls
urlpatterns = patterns('',
url(r'', include(farxiv.urls)),
url(r'^admin/', include(admin.site.urls)),
url(r'^users/', include('registration.backends.default.urls')),
)
| ghallsimpsons/farxiv | urls.py | Python | unlicense | 285 |
import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(0, 2*np.pi, 1001)
y1 = np.exp(-x)*np.sin(2*x)
y2 = np.exp(-0.5*x)*np.sin(2*x)
plt.plot(x, y1, 'r-', x, y2, 'b--')
plt.xlabel('x'); plt.ylabel('y')
# legends do not work in Bokeh
#plt.legend([r'$e^{-x}\sin 2x$', r'$e^{-\frac{1}{2}x}\sin 2x$'])
plt.tit... | sjsrey/doconce | doc/src/manual/mpl2bokeh.py | Python | bsd-3-clause | 610 |
# -*- coding: utf-8 -*-
import sys
import logging
import six
from six.moves import http_client
from redis import StrictRedis
import django
if django.VERSION[:2] >= (1, 7):
django.setup()
from django.conf import settings
from django.contrib.auth import get_user
from django.core.handlers.wsgi import WSGIRequest
from... | jrief/django-websocket-redis | ws4redis/wsgi_server.py | Python | mit | 8,609 |
from __future__ import print_function
import unittest
import six
import pyrtl
class TestBlock(unittest.TestCase):
def setUp(self):
pyrtl.reset_working_block()
def tearDown(self):
pyrtl.reset_working_block()
def test_add_wirevector_simple(self):
w = pyrtl.WireVector(name='testwire... | UCSBarchlab/PyRTL | tests/test_core.py | Python | bsd-3-clause | 29,585 |
# Copyright (c) 2001 Autonomous Zone Industries
# Copyright (c) 2002-2009 Zooko Wilcox-O'Hearn
# This file is part of pyutil; see README.rst for licensing terms.
"""
An object that makes some of the attributes of your class persistent, pickling
them and lazily writing them to a file.
"""
# from the Python Standard... | heathseals/CouchPotatoServer | libs/pyutil/PickleSaver.py | Python | gpl-3.0 | 8,932 |
import opengm
import vigra
import numpy
import sys
if __name__ == "__main__":
args = sys.argv
if len(args)!=11 :
print "Usage: ", args[0] , " infile outfile red1 green1 blue1 red2 green2 blue2 T lambda"
sys.exit(0)
img = vigra.readImage(args[1])
if img.shape[2]!=3:
print "Image must be RGB"
sys.exit(... | joergkappes/opengm | src/tutorials/python/demo/demo4.py | Python | mit | 1,560 |
"""
Support for installing and building the "wheel" binary package format.
"""
from __future__ import absolute_import
import collections
import compileall
import copy
import csv
import hashlib
import logging
import os.path
import re
import shutil
import stat
import sys
import warnings
from base64 impo... | ncos/lisa | src/lisa_drive/scripts/venv/lib/python3.5/site-packages/pip-10.0.1-py3.5.egg/pip/_internal/wheel.py | Python | mit | 31,967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.