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 |
|---|---|---|---|---|---|
#!/usr/bin/python3
# Build required code:
# $ ./examples/buildall.py
#
# Start zmqproxy (only one instance)
# $ ./build/zmqproxy
#
# Run client against server using ZMQ:
# $ LD_LIBRARY_PATH=build PYTHONPATH=build python3 examples/python_bindings_example_client.py -z localhost
#
import os
import time
import sys
import... | GomSpace/libcsp | examples/python_bindings_example_client.py | Python | lgpl-2.1 | 1,900 |
# -*- coding: utf-8 -*-
# Copyright (c) 2021 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from ansible.module_utils.common.arg_spec import ArgumentSpecVa... | privateip/ansible | test/units/module_utils/common/arg_spec/test_validate_invalid.py | Python | gpl-3.0 | 3,830 |
# -*- 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 field 'Ad.type'
db.add_column(u'polyclassifiedads_ad', 'type',
... | PolyLAN/polyclassifiedads | polyclassifiedads/migrations/0007_auto__add_field_ad_type__add_field_adnotification_filter_types.py | Python | bsd-2-clause | 7,039 |
from discord.ext.commands import Cog
from clembot.core.logs import Logger
from clembot.utilities.utils.embeds import Embeds
class InvalidInputError(Exception):
pass
class ErrorHandler(Cog):
@Cog.listener()
async def on_command_error(self, ctx, error):
Logger.error(f"{error.__type__} : {error}"... | TrainingB/Clembot | clembot/core/error_handler.py | Python | gpl-3.0 | 438 |
"""
Django settings for fablab_website project.
Generated by 'django-admin startproject' using Django 1.8.7.
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/
"""
impor... | fau-fablab/website | djangocms/fablab_website/settings.py | Python | gpl-3.0 | 5,237 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-10 04:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | vithd/vithd.github.io | django/mysite/polls/migrations/0001_initial.py | Python | mit | 1,230 |
import time
import socket
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
import paramiko
class Client(object):
def __init__(self, host, username, password, timeout=300):
self.host = host
self.username = username
self.password = password
s... | rackspace-titan/stacktester | stacktester/common/ssh.py | Python | apache-2.0 | 2,510 |
"""Tests for cleverhans.experimental.certification.optimization."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
from cleverhans.experimental.certification import dual_formulation
from cleverhans.experimental.c... | openai/cleverhans | cleverhans/experimental/certification/tests/optimization_test.py | Python | mit | 8,687 |
__all__ = ['vsfm_data', 'vsfmpy']
import logging
def setup_logger(name, loglevel = logging.INFO):
logger = logging.getLogger(name)
logger.setLevel(loglevel)
console_handler = logging.StreamHandler()
console_handler.setLevel(loglevel)
formatter = logging.Formatter('%(name)s - %(levelname)s - %(messag... | Fermi-Dirac/vsfmpy | __init__.py | Python | mit | 426 |
import mysql.connector
class Releve(object):
database = 'IENAC14_asa'
user = 'root'
password = 'root'
host = '127.0.0.1'
def __init__(self,id_rel,compteur=None,exploitant=None,index_deb=None,index_fin=None,date=None):
if id_rel>0:
self.load(id_rel)
else:
co... | Fabien-B/Web_ASA_Sourdoire | www/releve.py | Python | lgpl-3.0 | 7,918 |
'''
Tar interface for ORBKIT readers
'''
import tarfile
import numpy
from .tools import find_itype
def is_tar_file(infile):
itype = ''
if '.' in infile:
if 'tar' not in infile.split('.')[-2:]:
return None
else:
return True
else:
return None
def get_all_files_from_tar(infile, so... | orbkit/orbkit | orbkit/read/tar.py | Python | lgpl-3.0 | 1,800 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: metagriffin <mg.github@uberdev.org>
# date: 2013/11/27
# copy: (C) Copyright 2013-EOT metagriffin -- see LICENSE.txt
#-----------------------------------------------------------------------------... | metagriffin/parsedifflib | parsedifflib/parser.py | Python | gpl-3.0 | 12,543 |
from django.shortcuts import render
from galleryApp.models import *
from django.shortcuts import redirect, render, render_to_response
def index(request):
mainPicture = Picture.all().order_by('-datetime')[0]
pictures = Picture.all().order_by('-user__date_joined')[1:16]
return render(request, 'index.html', ... | leehosung/LemonEditor | sample/gallery/galleryApp/views.py | Python | gpl-2.0 | 718 |
from .helpers import arr_to_ascii_art, img_to_bin_arr
class BasicGlyph():
"""
Basic glyph just contains an Image, its top, bottom, xht, ht, wd
"""
def __init__(self, img_info=None):
if len(img_info) == 3:
self.init_from_img_dtop_dbot(*img_info)
elif len(img_info) == 2:
... | TeluguOCR/banti_telugu_ocr | banti/basicglyph.py | Python | apache-2.0 | 1,422 |
# -*- coding: utf-8 -*-
"""
tipfy
~~~~~
Minimalist WSGI application and utilities for App Engine.
:copyright: 2010 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
import logging
import os
from wsgiref.handlers import CGIHandler
# Werkzeug swiss knife.
# Need to import werkzeug ... | freeflightsim/ffs-app-engine | freeflightsim.appspot.com/distlib/tipfy/__init__.py | Python | gpl-2.0 | 41,328 |
#
# Symbol Table
#
import re
from Cython import Utils
from Errors import warning, error, InternalError
from StringEncoding import EncodedString
import Options, Naming
import PyrexTypes
from PyrexTypes import py_object_type, unspecified_type
import TypeSlots
from TypeSlots import \
pyfunction_signature, pymethod_... | bzzzz/cython | Cython/Compiler/Symtab.py | Python | apache-2.0 | 80,141 |
# package registry, used to convert packages installed on one os to another
#
# (C) Copyright 2011 Mo Morsi (mo@morsi.org)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, Version 3,
# as published by the Free Software Foundation
#
# This p... | movitto/snap | snap/packageregistry.py | Python | gpl-3.0 | 1,793 |
from google.appengine.ext import db
class Lecture(db.Model):
lecture_no = db.IntegerProperty()
lecture_title = db.StringProperty()
lecture_date = db.StringProperty()
| z-ohnami/whistory-bot | loader/model.py | Python | mit | 173 |
#File: Ex010_Defining_an_Edge_with_a_Spline.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python consol... | hyOzd/cadquery | examples/FreeCAD/Ex010_Defining_an_Edge_with_a_Spline.py | Python | lgpl-3.0 | 1,640 |
"""Added contest table
Revision ID: dc15c595d08
Revises: 4503a2e36a01
Create Date: 2015-06-02 10:52:14.233433
"""
# revision identifiers, used by Alembic.
revision = 'dc15c595d08'
down_revision = '4503a2e36a01'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
... | vigov5/oshougatsu2015 | alembic/versions/dc15c595d08_added_contest_table.py | Python | mit | 1,111 |
def printlist(listed):
for num in listed:
print num
def add_all(listed):
tots = 0
for x in listed:
tots += x
return tots
def all_caps_on_me(t):
out=[]
for s in t:
out.append(s.capitalize())
return out
list2 = [1,2,3,4]
print 'first element',list2[0]
print 'last element',list2[-1]
print 'search 42 ... | kaustubhhiware/hiPy | think_python/lists.py | Python | mit | 1,607 |
# Copyright 2016 Casey Jaymes
# This file is part of PySCAP.
#
# PySCAP 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.
#
# PySCAP is ... | cjaymes/pyscap | src/scap/model/ocil_2_0/ChoiceQuestionResultType.py | Python | gpl-3.0 | 988 |
# engine/result.py
# Copyright (C) 2005-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Define result set constructs including :class:`.ResultProxy`
and :class:`.RowProxy... | Br3nda/calcalcal | pylib/sqlalchemy/engine/result.py | Python | mit | 34,664 |
import unittest
from config import app
from datetime import datetime
from boardhood.models.conversations import Conversation
from boardhood.helpers.validator import is_integer, is_array
class TestConversationModel(unittest.TestCase):
def setUp(self):
self.model = Conversation()
Conversation.db = ap... | mayconbordin/boardhood | server_app/api/boardhood/tests/test_model_conversations.py | Python | mit | 8,541 |
# Copyright 2017 ForgeFlow S.L.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl-3.0).
from odoo import _, api, models
class StockMoveLine(models.Model):
_inherit = "stock.move.line"
@api.model
def _stock_request_confirm_done_message_content(self, message_data):
title = _("Receipt c... | OCA/stock-logistics-warehouse | stock_request/models/stock_move_line.py | Python | agpl-3.0 | 2,826 |
"""
Copyright 2014 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... | moyogo/tachyfont | build_time/src/common.py | Python | apache-2.0 | 1,422 |
'''
Created on Mar 6, 2016
@author: Laurent Marchelli
'''
import os
#import sys
# Define working directories
dir_root = os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))
dir_res = os.path.join(dir_root, 'tests/resources')
dir_tmp = os.path.join(dir_root , 'tests/tmp')
# if dir_root not in sys.path:
# ... | recalbox/recalbox-configgen | runtest/__init__.py | Python | mit | 890 |
# Copyright 2021 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/selfstudy-adversarial-robustness | common/data.py | Python | apache-2.0 | 3,545 |
# Here you put your App ID and token.
# Any questions? Email us at support@userapp.io
USERAPP_APP_ID="YOUR APP ID"
USERAPP_TOKEN="YOUR TOKEN" | userapp-io/userapp-python | examples/config.py | Python | mit | 142 |
# coding=utf-8
"""
Created by Chouayakh Mahdi
26/08/2010
The package contains the unit test of timescale_manager function
unit_tests : to perform un... | severin-lemaignan/dialogs | src/dialogs/timescale_manager_test.py | Python | bsd-3-clause | 33,296 |
""" Agent to extend the number of tasks given the Transformation definition
"""
from DIRAC import S_OK, gLogger
from DIRAC.Core.Base.AgentModule import AgentModule
from DIRAC.ConfigurationSystem.Client.Helpers.Operations ... | sposs/DIRAC | TransformationSystem/Agent/MCExtensionAgent.py | Python | gpl-3.0 | 4,963 |
# Definition for binary tree with next pointer.
class TreeLinkNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
self.next = None
class Solution(object):
def connect(self, root):
"""
:type root: TreeLinkNode
:rtype: nothi... | dborzov/practicin | 59-populationg-next-pointers-in-each-node-2/sol.py | Python | mit | 1,590 |
"""Script to add DNS records to TinyDNS"""
import logging
import os
import subprocess
DEFAULT_NS_TTL = 600
DEFAULT_TTL = 60
DEFAULT_WEIGHT = 10
DEFAULT_PRIORITY = 10
_LOGGER = logging.getLogger(__name__)
class TinyDnsClient(object):
"""Helper class to call tinyDNS"""
def __init__(self, dns_path):
... | gaocegege/treadmill | treadmill/tinydns_client.py | Python | apache-2.0 | 2,375 |
#!/usr/bin/python
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | caioserra/apiAdwords | examples/adspygoogle/dfp/v201311/line_item_creative_association_service/update_licas.py | Python | apache-2.0 | 2,240 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
from numpy import array, int32
from numpy import arange
from numpy import ma
from opus_core.logger import logger
from opus_core.datasets.abstract_d... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_core/datasets/dataset.py | Python | gpl-2.0 | 54,518 |
from __future__ import absolute_import
from django.conf import settings
from six import text_type
from zerver.lib.utils import make_safe_digest
import hashlib
def gravatar_hash(email):
# type: (text_type) -> text_type
"""Compute the Gravatar hash for an email address."""
# Non-ASCII characters aren't pe... | calvinleenyc/zulip | zerver/lib/avatar_hash.py | Python | apache-2.0 | 1,078 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_export_tessellated_faces_body1321.py | Python | mit | 9,092 |
"""
Student Views
"""
import datetime
import logging
import uuid
import json
import warnings
from collections import defaultdict
from pytz import UTC
from requests import HTTPError
from ipware.ip import get_ip
from django.conf import settings
from django.contrib.auth import logout, authenticate, login
from django.cont... | adoosii/edx-platform | common/djangoapps/student/views.py | Python | agpl-3.0 | 92,492 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*- #
#####################################################################
# #
# Frets on Fire X #
# Copyright (C) 20... | evilynux/fofix | setup.py | Python | gpl-2.0 | 17,079 |
# -*- coding: utf-8 -*-
"""Princeton(r) USB Camera Interface.
The module contains two main interfaces to the Lumenera pvcam API:
*API*, a low level ctypes interface to the Pvcam32.dll,
exposing all definitions/declarations found in the lucam.h C header.
*Princeton*, a high level object interface wrapping most of... | lauracorman/PythonPrincetonCamera | Princeton_wrapper.py | Python | gpl-2.0 | 137,837 |
#
# This file is part of the LibreOffice project.
#
# 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/.
#
# This file incorporates work covered by the following license noti... | tmtlakmal/EasyTuteLO | src/toolpanel.py | Python | lgpl-3.0 | 5,221 |
#
# Copyright John Reid 2007, 2008
#
"""
Traits of PSSMs modelled by HMMs.
"""
import hmm, numpy, pickle
from traits import BaseTraits
class PssmTraits(BaseTraits):
'''
Builds HMM models to represent PSSMs
'''
def name(self):
return 'pssm'
def __init__(
self,
K,
... | JohnReid/biopsy | Python/hmm/pssm/pssm_traits.py | Python | mit | 8,032 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from distutils.sysconfig import get_python_lib
from logging import getLogger
from os import chdir, getcwd
from os.path import abspath, dirname, exists, expanduser, expandvars, isdir, isfile, join, sep
try:
import pkg_resources
... | Microsoft/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/conda/_vendor/auxlib/path.py | Python | apache-2.0 | 3,073 |
# coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/communication/azure-communication-networktraversal/tests/_shared/asynctestcase.py | Python | mit | 1,075 |
# -*- coding: utf-8 -*-
config_page_name = ''
database = {
'host': 'localhost',
'user': '',
'passwd': '',
'db': '',
'table': '',
'charset': 'utf8mb4',
}
| Xi-Plus/Xiplus-Wikipedia-Bot | update-high-use/config.sample.py | Python | mit | 178 |
import os
import stat
import pwd
import grp
from datetime import datetime
def sizeof_fmt(num, suffix='B'):
for unit in ['', 'Ki', 'Mi', 'Gi', 'Ti', 'Pi', 'Ei', 'Zi']:
if abs(num) < 1024.0:
return "{:3.1f} {}{}".format(num, unit, suffix)
num /= 1024.0
return "{:.1f} %s%s".format(num... | zuloo/frisc | parser/FsMetaParser.py | Python | gpl-3.0 | 1,550 |
"""Integration tests for Google providers."""
from __future__ import absolute_import
import base64
import hashlib
import hmac
from django.conf import settings
from django.urls import reverse
import json
from mock import patch
from social_core.exceptions import AuthException
from student.tests.factories import UserFact... | jolyonb/edx-platform | common/djangoapps/third_party_auth/tests/specs/test_google.py | Python | agpl-3.0 | 6,373 |
import sys
import copy
import time
import signal
import logging
import importlib
from libfuzz.process_management import ProcessManagement
class Fuzzer():
"""
The base fuzzer class provides a standard handler
interfaces to be used from external libraries like
ProcessManagement.
"""
def __ini... | anhusa/pyfuzz | libfuzz/fuzzer.py | Python | bsd-3-clause | 6,407 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file."""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... | jcollado/cloudify-graphql | travis_pypi_setup.py | Python | mit | 4,084 |
# -*- coding: utf-8 -*-
"""
tests.helpers
~~~~~~~~~~~~~~~~~~~~~~~
Various helpers.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import os
import datetime
import flask
from logging import StreamHandler
from werkzeug.exceptions import BadRe... | antsar/flask | tests/test_helpers.py | Python | bsd-3-clause | 27,857 |
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
impo... | arth-co/shoop | shoop/simple_cms/__init__.py | Python | agpl-3.0 | 823 |
#! /usr/bin/env python
import logging
import logging.handlers
import sys
try:
import config.serverstatusconfig as config
except ImportError:
import serverstatusconfig as config
import socorro.lib.ConfigurationManager as configurationManager
import socorro.cron.serverstatus as serverstatus
try:
configContext... | boudewijnrempt/HyvesDesktop | 3rdparty/socorro/scripts/startServerStatus.py | Python | gpl-2.0 | 1,471 |
__author__ = 'kruh'
| jmakov/market_tia | tia/trad/tools/net/__init__.py | Python | mit | 20 |
import os
def parent_directories(start, stop=None, strict=True):
"""Iterates over parent directories of specified path.
If strict is False and start path points to directory, it will be
returned as well, unless stop is specified and start == stop.
Stop directory is always excluded from results.
... | east825/green-type | greentype/utils/paths.py | Python | mit | 949 |
# New model for HMC reuse
import pickle
from pystan import StanModel
model = """
data {
int<lower=1> N; // Number of data points
matrix[N,N] W; // the 1st predictor
int A[N,N]; // the 2nd predictor
}
parameters {
matrix[N,2] l;
real<lower=0> sigma;
real<lower=0> p;
real<lower=0> eta;
}
model ... | sheqi/TVpgGLM | test/practice6_pystan_hmc_Qi_instance2.py | Python | mit | 782 |
# 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 (t... | lym/allura-git | ForgeSVN/forgesvn/svn_main.py | Python | apache-2.0 | 8,582 |
#!/usr/bin/env python3
import argparse
from pathlib import Path
from PIL import Image
parser = argparse.ArgumentParser(
prog='emoji-extractor',
description="""Resize extracted emojis to 128x128.""")
parser.add_argument(
'-e', '--emojis',
help='folder where emojis are stored',
default='output/',
... | SMSSecure/SMSSecure | scripts/emoji-extractor/remove-emoji-margins.py | Python | gpl-3.0 | 738 |
import json
import logging
import re
import paho_mqtt_helpers as pmh
import serial
import serial.threaded
from . import comports as _comports
logger = logging.getLogger(__name__)
# Regular expression to match the following topics the manager listens for:
#
# serial_device/<port>/connect # Request connection:... | wheeler-microfluidics/serial_device | serial_device/mqtt.py | Python | gpl-3.0 | 13,950 |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - Import Script Package
@copyright: 2006 MoinMoin:ThomasWaldmann
@license: GNU GPL, see COPYING for details.
"""
from MoinMoin.util import pysupport
# create a list of extension scripts from the subpackage directory
import_scripts = pysupport.getPackageModules(__... | RealTimeWeb/wikisite | MoinMoin/script/import/__init__.py | Python | apache-2.0 | 354 |
from .filter import *
from collections import OrderedDict
from ..content.types.green_power_projects import GreenPowerProject
class GenericFilterSet(filters.FilterSet):
"""
The genric Filter form handling the filtering for all views: search,
content types and sustainability topic. The browse view might ext... | AASHE/hub | hub/apps/browse/filterset.py | Python | mit | 5,931 |
import numpy as np
from ..events import Model, Event
class Selection(object):
def __init__(self, indices, total):
'''A Selection is an object that keeps state of the selected
status of a collection of entities, such as atoms or bonds.
You don't instantiate them directly but th... | chemlab/chemlab | chemlab/mviewer/representations/state.py | Python | gpl-3.0 | 3,949 |
from django.test import TestCase
from treemenus.models import Menu, MenuItem
from treemenus.utils import move_item, clean_ranks, move_item_or_clean_ranks
class TreemenusTestCase(TestCase):
fixtures = ['testdata.xml']
urls = 'treemenus.test_urls'
def setUp(self):
login = self.client.logi... | boardman/django-treemenus | treemenus/tests.py | Python | bsd-3-clause | 25,701 |
from django.shortcuts import redirect, render
from lists.models import Item
def home_page(request):
if request.method == 'POST':
new_item_text = request.POST['item_text']
Item.objects.create(text=new_item_text)
return redirect('/lists/the-only-list-in-the-world/')
else:
return ... | marcusholmgren/tdd_with_python | superlists/lists/views.py | Python | mit | 454 |
import cv2
import socket
import time
import numpy as np
from common import draw_str
class VideoCamera(object):
address = "http://192.168.2.1:8080/?action=stream"
cascade_ad = "/home/rechie/git/opencv/data/haarcascades/haarcascade_frontalface_alt2.xml"
pre_frame = None
fps = 20
def __init__(self):... | rechie1995/me | python/flask/video-server/app/camera4.py | Python | gpl-3.0 | 2,175 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... | pgmcd/ansible | test/units/template/test_templar.py | Python | gpl-3.0 | 5,531 |
import logging
from aerodb.data.aerodromes import Aerodromes
from aerodb.duplicates import mark_iata_duplicates
def cleanup(infile, outfile=None, dry_run=False):
aerodromes = Aerodromes(infile)
mark_iata_duplicates(aerodromes)
to_delete = []
for key, aerodrome in aerodromes.aerodromes.iteritems(... | kurtraschke/aerodb | aerodb/cleanup.py | Python | mit | 735 |
from multiprocessing import Process, Queue
try:
from Queue import Empty
except ImportError:
from queue import Empty
class Actor(Process):
def __init__(self, receive_timeout=None):
Process.__init__(self)
self.inbox = Queue()
self.receive_timeout = receive_timeout
def send(self... | johnteee/awesome-pingpong | python/python3-process-queue/actor.py | Python | mit | 819 |
import unittest
import mock
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import links
from chainer import testing
from chainer.testing import attr
@testing.parameterize(
{'use_cudnn': True},
{'use_cudnn': False},
)
class TestMLPConvolution2D(unittest.TestCa... | benob/chainer | tests/chainer_tests/links_tests/connection_tests/test_mlp_convolution_2d.py | Python | mit | 2,762 |
import unittest
from esky import Esky
import esky.finder
from nxdrive.updater import AppUpdater
from nxdrive.updater import MissingUpdateSiteInfo
from nxdrive.updater import MissingCompatibleVersion
from nxdrive.utils import version_compare
from nxdrive.updater import UPDATE_STATUS_UPGRADE_NEEDED
from nxdrive.updater ... | arameshkumar/nuxeo-drive | nuxeo-drive-client/nxdrive/tests/test_updater.py | Python | lgpl-2.1 | 20,226 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pub_sub_device/run.py
EventPublisher / RemoteEventSubscriber Devices usage Demo.
For simplicity, both the EventPublisher and RemoteEventSubscriber run on the
local computer. The EventPublisher publishes all keyboard event types, and the
RemoteEventSubscriber subscr... | hoechenberger/psychopy | psychopy/demos/coder/iohub/remoteevents/run.py | Python | gpl-3.0 | 3,828 |
# $Id$
#
# Copyright (C) 2003 Rational Discovery LLC
# All Rights Reserved
#
from rdkit import RDConfig
from rdkit import six
import sys, os
from rdkit import Chem
from rdkit.VLib.Filter import FilterNode
class DupeFilter(FilterNode):
""" canonical-smiles based duplicate filter
Assumptions:
- inputs a... | jandom/rdkit | rdkit/VLib/NodeLib/SmilesDupeFilter.py | Python | bsd-3-clause | 1,442 |
#!/usr/bin/env python
import os
import sys
from learning.svm.libsvm.svm import __all__ as svm_all
from learning.svm.libsvm.svm import *
__all__ = ['evaluations', 'svm_load_model', 'svm_predict', 'svm_read_problem',
'svm_save_model', 'svm_train'] + svm_all
sys.path = [os.path.dirname(os.path.abspath(__file... | ParkJinSang/Logle | learning/svm/libsvm/svmutil.py | Python | mit | 8,736 |
from django.contrib.auth.models import User
from rest_framework import serializers
from servicelevelinterface.models import Monitor, Contact, Command
class MonitorSerializer(serializers.ModelSerializer):
owner = serializers.CharField(source='owner.username', read_only=True)
class Meta:
model = Monitor
... | lesavoie/nagiosservice | controlserver/servicelevelinterface/serializers.py | Python | gpl-2.0 | 816 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/Python/bin/2.78/scripts/addons/io_anim_camera.py | Python | gpl-3.0 | 5,424 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Nicolas P. Rougier
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
"""
Raw Segment Colle... | duyuan11/glumpy | glumpy/graphics/collections/raw_segment_collection.py | Python | bsd-3-clause | 3,960 |
from django.core.urlresolvers import reverse
from django.test import TestCase, Client
class CommonViewsTestCase(TestCase):
def setUp(self):
self.client = Client()
def test_index_page(self):
"""Test index/landing page"""
index_url = reverse('index')
response = self.client.get(i... | willingc/portal | systers_portal/common/tests/test_views.py | Python | gpl-2.0 | 995 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Spaghetti: Web Application Security Scanner
#
# @url: https://github.com/m4ll0k/Spaghetti
# @author: Momo Outaadi (M4ll0k)
# @license: See the file 'doc/LICENSE'
import drupal
import joomla
import wordpress
def Cms(content):
return (
drupal.Drupal().Run(content),
... | Yukinoshita47/Yuki-Chan-The-Auto-Pentest | Module/Spaghetti/modules/fingerprints/cms/cms.py | Python | mit | 393 |
from gpiozero import MCP3008
from time import sleep
def convert_temp(gen):
for value in gen:
yield (value * 3.3 - 0.5) * 100
adc = MCP3008(channel=0)
for temp in convert_temp(adc.values):
print('The temperature is', temp, 'C')
sleep(1)
| lurch/python-gpiozero | docs/examples/thermometer.py | Python | bsd-3-clause | 259 |
"""The main form for the application"""
from PythonCard import model
# Allow importing of our custom controls
import PythonCard.resource
PythonCard.resource.APP_COMPONENTS_PACKAGE = "vb2py.targets.pythoncard.vbcontrols"
class Background(model.Background):
def __getattr__(self, name):
"""If a name was no... | mvz/vb2py | vb/test2/test/frmMain.py | Python | bsd-3-clause | 3,511 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
from NDimInv.plot_helper import *
import numpy as np
from scipy import stats
import sys
sys.path.append('../../../')
import dd_resistivity
dd_res = dd_resistivity.dd_resistivity()
tau = np.logspace(-5,2,10) # create tau distribution
s = np.log10(tau)
mean = 0
std ... | m-weigand/ccd_tools | tests/ccd_single/NoCrashTests/SingleSpectra/spectrum_005/create.py | Python | gpl-3.0 | 1,200 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.models.building_location_choice_model import BuildingLocationChoiceModel as UrbansimBuildingLocationChoiceModel
from numpy import where, arange, zeros
from numpy import logical_or, ... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/models/building_location_choice_model.py | Python | gpl-2.0 | 5,528 |
# This file is part of beets.
# Copyright 2014, Adrian Sampson.
#
# 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 to use, copy, ... | DxCx/nzbToMedia | libs/beets/mediafile.py | Python | gpl-3.0 | 56,908 |
from dedalus import public as de
from dedalus import core
import numpy as np
import matplotlib.pyplot as plt
from pySDC.playgrounds.Dedalus.dedalus_field import dedalus_field
# class wrapper(core.field.Field):
#
# # def __init__(self, domain):
# # super(wrapper, self).__init__(domain)
#
# def __add__... | Parallel-in-Time/pySDC | pySDC/playgrounds/deprecated/Dedalus/playground.py | Python | bsd-2-clause | 3,972 |
from django.db import models
class Leg(models.Model):
BUY_OR_SELL_CHOICES = (("buy", "Buy"), ("sell", "Sell"),)
OPEN_OR_CLOSE_CHOICES = (("open", "Open"), ("close", "Close"),)
INSTRUMENT_CHOICES = (
("call", "Call"),
("put", "Put"),
("stock", "Stock"),
("fut", "Futures"),
... | ktarrant/options_csv | journal/trades/models.py | Python | mit | 1,098 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "%d минути до прочитане",
"(active)": "(активно)",
"Also available in:": "Достъпно също на:",
"Archive": "Архив",
"Authors": "Автори",
"Categories": "Категории",
"Comments": "Коментари"... | andredias/nikola | nikola/data/themes/base/messages/messages_bg.py | Python | mit | 2,386 |
"""
Helper functions and classes to support tests which need to connect through
the tor network.
::
ProxyError - Base error for proxy issues.
+- SocksError - Reports problems returned by the SOCKS proxy.
Socks - Communicate through a SOCKS5 proxy with a socket interface
SocksPatch - Force socket-using... | abcdef123/stem | test/network.py | Python | lgpl-3.0 | 7,189 |
import cgi
import errno
import io
import mimetypes
import os
import posixpath
import re
import shutil
import stat
import sys
import tempfile
from os import path
import django
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.core.management.utils import hand... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/core/management/templates.py | Python | mit | 14,053 |
"""
Test CentralComposite.
"""
# pylint: disable-msg=C0111,C0103
import unittest
from openmdao.lib.doegenerators.central_composite import CentralComposite
class TestCase(unittest.TestCase):
def setup(self):
pass
def teardown(self):
pass
def test_face_centered(self):
... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.lib-0.13.0-py2.7.egg/openmdao/lib/doegenerators/test/test_central_composite.py | Python | gpl-2.0 | 1,303 |
# shipBonusStrategicCruiserCaldariNaniteRepairTime2
#
# Used by:
# Ship: Tengu
type = "passive"
def handler(fit, ship, context):
fit.modules.filteredItemBoost(lambda mod: True, "moduleRepairRate",
ship.getModifiedItemAttr("shipBonusStrategicCruiserCaldari2"),
... | bsmr-eve/Pyfa | eos/effects/shipbonusstrategiccruisercaldarinaniterepairtime2.py | Python | gpl-3.0 | 369 |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="scattercarpet.line", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/scattercarpet/line/_width.py | Python | mit | 486 |
from tests.integration.components.mutually_exclusive.schema_urls import MUTUALLY_EXCLUSIVE_CURRENCY
from tests.integration.integration_test_case import IntegrationTestCase
class TestCurrencySingleCheckboxOverride(IntegrationTestCase):
"""
Tests to ensure that the server-side validation for mutually exclusive ... | ONSdigital/eq-survey-runner | tests/integration/components/mutually_exclusive/test_currency_single_checkbox_override.py | Python | mit | 1,528 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# portalocker.py - Cross-platform (posix/nt) API for flock-style file locking.
# Requires python 1.5.2 or better.
"""
Cross-platform (posix/nt) API for flock-style file locking.
Synopsis:
import portalocker
file = open(\"somefile\", \"r+\")
port... | henkelis/sonospy | web2py/gluon/portalocker.py | Python | gpl-3.0 | 2,491 |
#
# Copyright (C) 2017 nikoapos
#
# 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 version.
#
# This program is distributed in ... | nikoapos/PiHWCtrl | swig/examples/BMP180Example.py | Python | gpl-3.0 | 7,662 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-15 17:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('dbf', '0004_auto_20170323_0122')]
operations = [
migrations.AddField(
model_na... | AlertaDengue/AlertaDengue | AlertaDengue/dbf/migrations/0005_dbf_municipio.py | Python | gpl-3.0 | 452 |
import unittest, gzip, imp, subprocess, tempfile, shutil, os, os.path, time
import glob, sys
from apt import apt_pkg
try:
from urllib import urlopen
URLError = IOError
(urlopen) # pyflakes
except ImportError:
# python3
from urllib.request import urlopen
from urllib.error import URLError
if os... | rickysarraf/apport | test/test_backend_apt_dpkg.py | Python | gpl-2.0 | 54,123 |
# Copyright 2010 Dan Smith <dsmith@danplanet.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is ... | cl4u2/chirp | chirp/vx6.py | Python | gpl-3.0 | 12,216 |
import pyxbmct.addonwindow as pyxbmct
import plex
from common import printDebug, GLOBAL_SETUP
import xbmc
printDebug=printDebug("PleXBMC", "plex_signin")
class plex_signin(pyxbmct.AddonFullWindow):
def __init__(self, title=''):
"""Class constructor"""
# Call the base class' constructor.
su... | hippojay/plugin.video.plexbmc | resources/lib/plex_signin.py | Python | gpl-2.0 | 13,463 |
# -*- coding: utf-8 -*-
#
# Sphinx RTD theme demo documentation build configuration file, created by
# sphinx-quickstart on Sun Nov 3 11:56:36 2013.
#
# 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
# autogenerated... | thumbor/thumbor-sphinx-theme | demo_docs/source/conf.py | Python | mit | 8,062 |
import sys, os, inspect
from PyQt5.QtWidgets import QWidget, QTreeWidgetItem
from PyQt5 import uic
directory = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
sys.path.append(directory + "/lib")
from libstats import LibStats
from func_aux import paint_row, key_from_value
fro... | soker90/betcon | src/stats_tipster.py | Python | gpl-3.0 | 2,869 |
from django import dispatch
from django.db import models
from django.db.models import signals
import commonware.log
import amo
import amo.models
log = commonware.log.getLogger('z.users')
class Group(amo.models.ModelBase):
name = models.CharField(max_length=255, default='')
rules = models.TextField()
... | andymckay/zamboni | mkt/access/models.py | Python | bsd-3-clause | 1,442 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.