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/env python
# -*- coding: utf-8 -*-
import os, sys
import unittest
from collections import defaultdict
from scaffold.core.data.database import db
from data import site_user
class TestBasePage(unittest.TestCase):
def test_fetch_non_existant_oauth_user(self):
site_user.create_oauth_login().execu... | olymk2/maidstone-hackspace | website/tests/test_users.py | Python | gpl-3.0 | 898 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='FailedAccessAttempt',
fields=[
('id', models.Au... | django-py/django-doberman | doberman/migrations/0001_initial.py | Python | mit | 1,627 |
class Node:
rChild, lChild, data = None, None, None
def __init__(self, data):
self.rChild = None
self.lChild = None
self.data = data
def insert(root, val):
if root is None:
root = Node(val)
elif root.data > val:
if root.lChild is None:
root.lChild = Node(val)
else:
insert(root.lChild, val)
else... | ruchikd/Algorithms | Python/ImplementBST/bst.py | Python | gpl-3.0 | 687 |
#
# Copyright 2016-2017 Red Hat, Inc.
#
# 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 distributed ... | EdDev/vdsm | lib/vdsm/storage/check.py | Python | gpl-2.0 | 12,176 |
import functools
from pluss.app import app
from pluss.util.cache import Cache
RATE_LIMIT_CACHE_KEY_TEMPLATE = 'pluss--remoteip--ratelimit--1--%s'
def ratelimited(func):
"""Includes the wrapped handler in the global rate limiter (60 calls/min)."""
@functools.wraps(func)
def wrapper(*args, **kwargs):
... | ayust/pluss | pluss/util/ratelimit.py | Python | mit | 1,111 |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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... | davidsb30/eve-wspace | evewspace/Map/views.py | Python | gpl-3.0 | 30,128 |
'''
Created on 2013-11-08, revised 2016-04-15
This module contains meta data for all available WRF experiments.
@author: Andre R. Erler, GPL v3
'''
from importlib import import_module
from collections import OrderedDict
from datasets.common import addLoadFcts
from datasets.WRF import Exp
# list of projects to merg... | aerler/WRF-Projects | src/projects/WRF_experiments.py | Python | gpl-3.0 | 2,220 |
import acoustid
import logging
import os
from . import utils
from .models import Artist, Album, Song
from beets.mediafile import MediaFile, FileTypeError, UnreadableFileError
#LOSSY_MEDIA_FORMATS = ["mp3", "aac", "ogg", "ape", "m4a", "asf", "wma"]
LOSSY_MEDIA_FORMATS = ["mp3", "ogg", "m4a"]
LOSSLESS_MEDIA_FORMATS =... | endthestart/tinsparrow | tinsparrow/tinsparrow/importer.py | Python | mit | 6,020 |
import json
from django import forms
from django.utils import six
from django.utils.translation import ugettext_lazy as _
__all__ = ['JSONField']
class InvalidJSONInput(six.text_type):
pass
class JSONString(six.text_type):
pass
class JSONField(forms.CharField):
default_error_messages = {
'in... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/contrib/postgres/forms/jsonb.py | Python | mit | 1,395 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# 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 program is distributed in the ho... | mtambos/bachelorsthesis | src/run_oger_narma_30.py | Python | gpl-3.0 | 5,975 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2014, GEM Foundation
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Licen... | g-weatherill/oq-risklib | openquake/calculators/risk.py | Python | agpl-3.0 | 1,002 |
# ===============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of eos.
#
# eos 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, ... | blitzmann/Pyfa | eos/utils/spoolSupport.py | Python | gpl-3.0 | 2,653 |
#! /usr/bin/python
#
# Copyright (c) 2017 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation o... | vineodd/PIMSim | GEM5Simulation/gem5/util/plot_dram/lowp_dram_sweep_plot.py | Python | gpl-3.0 | 5,637 |
# -*- coding: utf-8 -*-
import pytest
import datetime
import ioex.datetimeex
import pytz
yaml = pytest.importorskip('yaml')
@pytest.mark.parametrize(('loader'), [yaml.Loader, yaml.SafeLoader])
@pytest.mark.parametrize(('expected_period', 'yaml_string'), [
[
ioex.datetimeex.Period(
start = date... | fphammerle/ioex | tests/datetimeex/test_period_yaml.py | Python | mit | 3,561 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/rdbms/azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/operations/_firewall_rules_operations.py | Python | mit | 22,092 |
# The py library is part of the "py.test" testing suite (python-codespeak-lib on
# Debian), see http://codespeak.net/py/
import py
#this makes py.test put sympy directory into the sys.path, so that we can
#"import sympy" from tests nicely
rootdir = py.magic.autopath().dirpath()
| GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/conftest.py | Python | agpl-3.0 | 281 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import MutableMapping
class ImmutableDict(MutableMapping):
"""Configuration value object for immutable dict
Configuration represented by this class is **Immutable**
"""
def __init__(self, inner):
self._inner = inner
def __ge... | michalbachowski/pycomber | src/pycomber/value_objects.py | Python | mit | 738 |
# -*- coding: utf-8 -*-
#
# This file is part of Linux Show Player
#
# Copyright 2012-2017 Francesco Ceruti <ceppofrancy@gmail.com>
#
# Linux Show Player 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 ... | offtools/linux-show-player | lisp/ui/settings/pages/cue_general.py | Python | gpl-3.0 | 12,203 |
import numpy as np
from subprocess import call
#this readies the data for svm
data_folder_path = '../data/'
file_names = ['test']
word_embedding_size = 50
# read the vectors.bin file and create a map
vec_dict = {}
# vec_file = open ('vectors.bin', 'r')
# create vectors and counts
for f in file_names:
with open (... | mawri/sswe-team9 | src/prepare_svm_data.py | Python | mit | 3,249 |
from math import pi
from taichi.lang.matrix import Vector
from .utils import euler_to_vec, vec_to_euler
class Camera:
def __init__(self, ptr):
self.ptr = ptr
self.position(0.0, 0.0, 0.0)
self.lookat(0.0, 0.0, 1.0)
self.up(0.0, 1.0, 0.0)
# used for tracking user inputs
... | yuanming-hu/taichi | python/taichi/ui/camera.py | Python | mit | 3,338 |
'''
Created on 10.07.2011
@author: michi
'''
import sys
from PyQt4.QtCore import QObject, QRectF, QPointF, QSizeF, Qt
from PyQt4.QtGui import QTreeWidgetItem, QFontMetrics, QFont, QPrinter
from PyQt4.QtGui import QPalette, QDialogButtonBox, QVBoxLayout, QHBoxLayout
from PyQt4.QtGui import QFormLayout, QGridLayout
f... | mtils/ems | ems/qt4/gui/util.py | Python | mit | 8,464 |
'''
maxout-train-hypercube.py
author: Luke de Oliveira (lukedeo@stanford.edu)
description: script to train a maxout net in a hypercube
'''
from keras.models import Sequential, model_from_yaml
from keras.layers.core import Dense, Dropout, MaxoutDense, Activation, Flatten, Merge
from keras.layers.normalization import... | ml-slac/deep-jets | training/maxout-train-hypercube.py | Python | mit | 6,307 |
# coding: utf-8
import cherrypy
from app import datenbank,templates,authentifizierung
class Request(object):
exposed = True
def __init__(self):
self.db = datenbank.Datenbank()
def POST(self,action,originalusername=None,username=None,password=None,role=None):
authentifizierung.ValidateAdmin()
if acti... | fr34kyn01535/PyForum | app/administration.py | Python | gpl-2.0 | 1,217 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# 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 withou... | jeremiedecock/snippets | python/dbm/python2/test_gdbm.py | Python | mit | 1,957 |
from flask import g
from flask.ext.restplus import Namespace, reqparse, marshal
from app.api.attendees import TICKET
from app.api.microlocations import MICROLOCATION
from app.api.sessions import SESSION
from app.api.speakers import SPEAKER
from app.api.sponsors import SPONSOR
from app.api.tracks import TRACK
from app.... | SaptakS/open-event-orga-server | app/api/events.py | Python | gpl-3.0 | 15,813 |
from pyramid.view import view_config
import utils
import admin_utils
| Nolski/yellr-server | yellr-serv/yellrserv/ep_admin_misc.py | Python | agpl-3.0 | 71 |
'''OpenGL extension ARB.fragment_program
This module customises the behaviour of the
OpenGL.raw.GL.ARB.fragment_program to provide a more
Python-friendly API
Overview (from the spec)
Unextended OpenGL mandates a certain set of configurable per-
fragment computations defining texture application, texture
envir... | D4wN/brickv | src/build_data/windows/OpenGL/GL/ARB/fragment_program.py | Python | gpl-2.0 | 3,247 |
from statsmodels.compat.python import lmap, map
import numpy as np
import pandas as pd
from numpy.testing import dec, assert_equal
import statsmodels.api as sm
from statsmodels.graphics.tsaplots import (plot_acf, plot_pacf, month_plot,
quarter_plot, seasonal_plot)
import stat... | yl565/statsmodels | statsmodels/graphics/tests/test_tsaplots.py | Python | bsd-3-clause | 4,837 |
import pickle
import os
import errno
import os
import sys
import numpy as np
import json
from scipy.signal import savgol_filter
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import seaborn as sns
matplotlib.rc('text', usetex=True)
import matplotlib.patches as mpatches
color_list = sns.color_... | brain-research/mirage-rl-stein | evaluation/traj_visualize.py | Python | mit | 4,073 |
""" -*- coding: utf-8 -*- """
| jhazelwo/docker-as-python | __init__.py | Python | mit | 30 |
# Natural Language Toolkit: Interface to Mallet Machine Learning Package
#
# Copyright (C) 2001-2013 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
A set of functions used to interface with the external Mallet_ machine l... | bbengfort/TextBlob | textblob/nltk/classify/mallet.py | Python | mit | 2,960 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('guests', '0002_auto_20150225_1926'),
]
operations = [
migrations.AlterField(
mo... | Samael500/wed | mywed/guests/migrations/0003_auto_20150225_1949.py | Python | unlicense | 540 |
from django.core.management.base import BaseCommand
from tests.setup import create_fixture
class Command(BaseCommand):
help = 'Loads fixture data'
def handle(self, *args, **options):
create_fixture()
self.stdout.write("Loaded fixtures.")
| sanoma/dynamic-rest | tests/management/commands/initialize_fixture.py | Python | mit | 267 |
# encoding: utf-8
from __future__ import unicode_literals
import json
import re
import itertools
from .common import InfoExtractor
from .subtitles import SubtitlesInfoExtractor
from ..utils import (
compat_HTTPError,
compat_urllib_parse,
compat_urllib_request,
clean_html,
get_element_by_attribute,... | huangciyin/youtube-dl | youtube_dl/extractor/vimeo.py | Python | unlicense | 19,826 |
# Generated by Django 3.2.5 on 2021-07-12 19:04
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="DocumentURL",
fields=[
... | mozilla/kuma | kuma/documenturls/migrations/0001_initial.py | Python | mpl-2.0 | 2,240 |
from conans import (
CMake,
ConanFile,
python_requires,
)
import os
b2 = python_requires("b2-helper/0.5.0@grisumbras/stable")
class EnumFlagsTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch",
build_requires = (
"boost_build/[>=4.0]@bincrafters/testing",
"boo... | grisumbras/enum-flags | test/conanfile.py | Python | mit | 1,071 |
#!/usr/bin/python
import sys,os
from email.Utils import COMMASPACE, formatdate
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from email.MIMEImage import MIMEImage
from email.MIMEImage import MIMEImage
from email.MIMEBase import MIMEBase
from email import Encoders
import smtplib
impor... | fcauwe/brother-scan | sendfile.py | Python | gpl-3.0 | 1,234 |
import random
from generate import IMAGES
from generate.json_loader import load_json
POST_COUNT = 20
def generate():
objects = []
# gen post objects
for i in range(1, POST_COUNT + 1):
objects.append({
"model": "post.Post",
"fields": {
"title": "Post %s Tit... | praekelt/panya-post | post/generator.py | Python | bsd-3-clause | 841 |
import errno
import os
import pkgutil
import shutil
import glob
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
import pymunin #@UnusedImport
import pymunin.plugins
PYMUNIN_SCRIPT_FILENAME_PREFIX = u'pymunin'
PYMUNIN_PLUGIN_DIR = u'./share/munin/plugins'
def r... | aouyar/PyMunin | setup.py | Python | gpl-3.0 | 5,333 |
#!/usr/bin/env python
#
# Copyright 2016 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 requir... | Aloomaio/googleads-python-lib | examples/ad_manager/v201805/product_package_item_service/get_product_package_items_for_product_package.py | Python | apache-2.0 | 2,302 |
import os
import sys
from repoman_client.logger import log
from repoman_client.client import RepomanClient
from repoman_client.config import config
# Import the RepomanCLI singleton instance:
from repoman_client.parsers import repoman_cli
class SubCommand(object):
"""A baseclass that all subcommands must be subcl... | hep-gc/repoman | repoman-client/repoman_client/subcommand.py | Python | gpl-3.0 | 4,313 |
from django.contrib.auth.forms import AuthenticationForm, PasswordChangeForm
from django.forms.widgets import TextInput, PasswordInput, Textarea, FileInput, Select, CheckboxInput, CheckboxSelectMultiple, HiddenInput, MultipleHiddenInput
from django.forms.models import ModelMultipleChoiceField
from django import forms
f... | jpulec/twnkl | twnkl/apps/main/forms.py | Python | gpl-2.0 | 6,301 |
""" This is a test of using SandboxStoreClient in the WMS
In order to run this test we need the following DBs installed:
- SandboxMetadataDB
And the following services should also be on:
- SandboxStore
And a SandboxSE should be configured, something like:
SandboxStore
{
LocalS... | yujikato/DIRAC | tests/Integration/WorkloadManagementSystem/Test_SandboxStoreClient.py | Python | gpl-3.0 | 2,167 |
#!/usr/bin/python
# coding=utf-8
################################################################################
import os
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
from mock import Mock
from mock import patch
from mock import mock_open... | TAKEALOT/Diamond | src/collectors/docker_collector/test/testdocker_collector.py | Python | mit | 5,993 |
from threading import Thread, Timer, Condition
import time
import random
import traceback
import animations
DITHER_CEIL=173
class ImageManager:
def __init__(self):
self.gamma = bytearray(256)
for i in range(256):
if i>0 and i<28:
self.gamma[i] = 0x81
else:
... | NanoExplorer/LightStripServer | DeskLogicThread.py | Python | mit | 7,378 |
from __future__ import absolute_import
from .celery_broker import app
import celery.signals
import os
import sys
import time
import json
import traceback
import numpy
from next.constants import DEBUG_ON
import hashlib
# import next.logging_client.LoggerHTTP as ell
from next.database_client.DatabaseAPI import DatabaseA... | sumeetsk/NEXT | next/broker/celery_app/tasks.py | Python | apache-2.0 | 8,617 |
class PostprocessPlugin:
r"""
Base postprocess plugin class
"""
class SimulationPlugin:
r"""
Base simulation plugin class
"""
class PinObject(SimulationPlugin):
r"""
Contains the special value `Unrestricted` for unrestricted axes in :any:`createPinObject`.
... | dimaleks/uDeviceX | docs/source/_mirheo/Plugins/__init__.py | Python | gpl-3.0 | 35,404 |
from libturpial.api.models.column import Column
class TestColumn:
@classmethod
def setup_class(self):
self.column = Column("foo-twitter", "timeline")
def test_structure(self):
assert self.column.size == 0
assert self.column.id_ == "foo-twitter-timeline"
assert self.column.s... | satanas/libturpial | tests/models/test_column.py | Python | gpl-3.0 | 600 |
import threading
import time
from PyQt4 import QtCore, QtGui, QtTest
import robouser
class QObj(QtCore.QObject):
# For use with sending signals when you don't have a handle on
# a calling widget
somethingHappened = QtCore.Signal()
def center(widget, view_index=None):
"""
Gets the global position... | boylea/qtbot | qtbot.py | Python | mit | 9,378 |
# -*- coding: UTF-8 -*-
'''
@author: oShine <oyjqdlp@126.com>
@link: https://github.com/ouyangjunqiu/ou.py
异常处理
'''
class AppExitException(Exception):
@staticmethod
def sigterm_handler(signum, frame):
raise AppExitException()
pass | ouyangjunqiu/ou.py | RuntimeError.py | Python | mit | 260 |
import modod
from graph import graph
cases = [
#format: input expected comment
#if expected=='', no comparison is performed
['((a? | b?)? |(c? | d?)?)?','(a|b|c|d)?','4.1'],
['(a? b?)+','(a|b)+?','4.2'],
['(a?|(b?,c?))?','(a|(b?,c?))','4.3'],
['(((a1? | b1?)? |(c1? | d1?)?)?,((a2? | b2?)? |(c2? | d2?... | cburschka/modod | src/test_pnf.py | Python | mit | 1,327 |
# Copyright 2015, 2018 IBM Corp.
#
# 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 require... | powervm/pypowervm | pypowervm/tests/tasks/monitor/test_monitor.py | Python | apache-2.0 | 18,055 |
import itertools
import random
import mock
from nose.tools import eq_
import amo
import amo.tests
from addons.models import Addon, AddonCategory, AddonRecommendation, Category
from bandwagon.models import (Collection, CollectionAddon, CollectionUser,
CollectionWatcher,
... | jbalogh/zamboni | apps/bandwagon/tests/test_models.py | Python | bsd-3-clause | 6,432 |
# wsse/server/django/wsse/__init__.py
# coding=utf-8
# pywsse
# Authors: Rushy Panchal, Naphat Sanguansin, Adam Libresco, Jérémie Lumbroso
# Date: September 1st, 2016
from django.conf import settings
if not (hasattr(settings, 'TESTING') and settings.TESTING):
default_app_config = 'wsse.server.django.wsse.apps.WsseCon... | PrincetonUniversity/pywsse | wsse/server/django/wsse/__init__.py | Python | lgpl-3.0 | 327 |
#
# Project: MXCuBE
# https://github.com/mxcube
#
# This file is part of MXCuBE software.
#
# MXCuBE 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... | IvarsKarpics/mxcube | gui/widgets/energy_scan_parameters_widget.py | Python | lgpl-3.0 | 8,553 |
# -*- coding: utf8 -*-
from __future__ import print_function
import requests
import six
from breadability.readable import Article
from goose import Goose
from requests import Request, Session
from requests.adapters import HTTPAdapter
from requests.cookies import RequestsCookieJar
from sumy.models.dom import ObjectDocu... | cowvin/LMC-3403-Explain-To-Me | ExplainToMe/textrank.py | Python | apache-2.0 | 5,406 |
__author__ = "Gordon Ball <gordon@chronitis.net>"
__version__ = "0.4.3"
from .ipyrmd import ipynb_to_rmd, rmd_to_ipynb, ipynb_to_spin, spin_to_ipynb
| chronitis/ipyrmd | ipyrmd/__init__.py | Python | mit | 150 |
#!/usr/bin/python
# -*- coding = utf-8 -*-
#---
#
# ------------
# Description:
# ------------
#
# Arabic codes
#
# (C) Copyright 2010, Taha Zerrouki
# -----------------
# $Date: 2010/03/01
# $Author: Taha Zerrouki$
# $Revision: 0.1 $
# This program is written under the Gnu Public License.
#
"""
Arabic module
@aut... | linuxscout/pyarabic | pyarabic/araby_const.py | Python | gpl-3.0 | 6,462 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-03 13:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dataschema_manager', '0003_auto_20170503_1328'),
]
operations = [
migrations.... | MOOCworkbench/MOOCworkbench | dataschema_manager/migrations/0004_auto_20170503_1348.py | Python | mit | 1,040 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | nash-x/hws | nova/fusioncompute/service.py | Python | apache-2.0 | 21,182 |
"""
Delivery Fee
"""
def get_fee(size, weight):
if size <= 60 and weight <= 2:
return 600
elif size <= 80 and weight <= 5:
return 800
elif size <= 100 and weight <= 10:
return 1000
elif size <= 120 and weight <= 15:
return 1200
elif size <= 140 and weight <= 20:
... | miyazaki-tm/aoj | Volume1/0160.py | Python | mit | 687 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | mohittahiliani/tcp-eval-suite-ns3 | src/nix-vector-routing/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 373,845 |
import optparse
import socket
import sys
class Server:
def __init__(self,port):
self.host = ""
self.port = port
self.client = None
self.cache = ''
self.messages = {}
self.size = 1024
self.parse_options()
self.open_socket()
self.run()
def ... | glubeck/threaded-message-service | messageDaemon.py | Python | gpl-2.0 | 4,725 |
import re
from .base import Command
class Rebirth(Command):
def __init__(self):
self.allowable = re.compile('^[0-9a-zA-Z]+$')
def on_command(self, bot, event, args):
if not self.allowable.match(args):
bot.respond(event, "i'm afraid i can't let you do that $nick")
retur... | Alakala/eggpy | eggy/commands/misc.py | Python | mit | 496 |
#
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: see AUTHORS file
# :copyright: (c) 2007-2015, The Tor Project, Inc.
# :license: 3-Clause BSD, see LICENSE for licensing information
"""
Boilerplate setup for GeoIP. GeoIP allows us to look up the country code
associated with an IP add... | pagea/bridgedb | lib/bridgedb/geo.py | Python | bsd-3-clause | 2,585 |
"""
The guts that actually do the work. This is available here for the
'qtfaststart' script and for your application's direct use.
"""
import shutil
import logging
import os
import struct
import collections
import xbmc
import xbmcgui
from kmediatorrent import plugin
import io
from qtfaststart.exceptions impo... | jmarth/plugin.video.kmediatorrent | resources/site-packages/qtfaststart/processor.py | Python | gpl-3.0 | 10,448 |
""" Tests for utils. """
import collections
import copy
import mock
from datetime import datetime, timedelta
from pytz import UTC
from django.test import TestCase
from django.test.utils import override_settings
from contentstore import utils
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tes... | carsongee/edx-platform | cms/djangoapps/contentstore/tests/test_utils.py | Python | agpl-3.0 | 12,292 |
#!/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 F... | xorpaul/shinken | test/test_hostgroup_with_space.py | Python | agpl-3.0 | 1,417 |
"""
Deserves documentation.
"""
#~ import lino.changes
#~ from lino.utils import gendoc
#~ print [unicode(e) for e in gendoc.ENTRIES_LIST]
| MaxTyutyunnikov/lino | lino/history/show.py | Python | gpl-3.0 | 143 |
from faker import Faker
from opsy.auth.models import Role, User
from opsy.utils import get_valid_permissions
def test_user():
test_user = User.create(
name='test', full_name='Test User', password='weakpass')
test_role = Role.create(name='users')
test_role.add_user(test_user)
return test_user
... | cryptk/opsy | tests/data/auth.py | Python | mit | 1,425 |
import numpy as np
import pytest
from astropy import units as u
from hypothesis import given, strategies as st
from eniric.atmosphere import Atmosphere
from eniric.legacy import RVprec_calc_masked, RVprec_calc_weights_masked, mask_clumping
def test_RV_prec_masked(test_spec):
"""Test same precision results betwee... | jason-neal/eniric | tests/test_legacy.py | Python | mit | 3,783 |
from util.serial import query_serial
def StripData(out):
n = out.find('_')
if n != -1: out = out[n + 1:]
out = out.replace('\n', ';')
out = out.replace('\r', ';')
out = out.replace(']', ';')
out = out.replace(';;', ';')
out = out.strip(';')
return out
def SDM300A_cmd(port='ttyUSB0', addr='1', pa... | ivanovev/hm | srv/SDM300A.py | Python | gpl-3.0 | 1,332 |
def filterTags(attrs):
if not attrs:
return
tags = {}
if 'Building_ID' in attrs:
tags['nps:building_id'] = attrs['Building_ID']
if 'MAXIMO_ID' in attrs:
tags['nps:fmss_id'] = attrs['MAXIMO_ID']
if 'Common_Name' in attrs:
tags['name'] = attrs['Common_Name'].title()... | regan-sarwas/places-api | scripts/tools/buildings_translate.py | Python | unlicense | 11,167 |
##########################################################################
## Prediction Package Tests
##########################################################################
# to execute tests, run from *project* root. This runs all test packages
# (this one and any other in the /tests folder)
#
# nosetests --ve... | georgetown-analytics/housing-risk | code/tests/test_prediction.py | Python | mit | 2,959 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | QingChenmsft/azure-cli | src/azure-cli-core/azure/cli/core/tests/test_resource_id.py | Python | mit | 3,344 |
#!/usr/bin/env python
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verify that pulling in a dependency a second time in a conditional works for
shared_library targets. Regression test for http://... | Jet-Streaming/gyp | test/self-dependency/gyptest-self-dependency.py | Python | bsd-3-clause | 487 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
from os.path import dirname, abspath, join
TEST_HOST = 'http://localhost:8112'
SIMPLE_PLAYLIST = '''
#EXTM3U
#EXT-X-TARGETDURATION:52... | pbs/m3u8 | tests/playlists.py | Python | mit | 17,174 |
import copy
import datetime
from decimal import Decimal
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import connection
from django.db.models import fields
from django.db.models.query_utils import Q
from django.utils.deconstruct import deconstructible
from django.utils.functional import ... | reinout/django | django/db/models/expressions.py | Python | bsd-3-clause | 47,078 |
# Copyright 2014 NEC Corporation. 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 ... | luzheqi1987/nova-annotation | nova/api/openstack/compute/schemas/v3/create_backup.py | Python | apache-2.0 | 1,432 |
import os
import shutil
from collections import OrderedDict
from git import Repo
def get_raw_data():
cldr_version = '31.0.1'
raw_data_directory = "../raw_data"
cldr_data = {
'dates_full': {
'url': 'https://github.com/unicode-cldr/cldr-dates-full.git',
'dir': "{}/cldr_date... | scrapinghub/dateparser | dateparser_scripts/utils.py | Python | bsd-3-clause | 2,562 |
import os, sys
import xmlrpclib
from ConfigParser import NoSectionError
from ConfigParser import SafeConfigParser, NoOptionError
from pprint import pprint
def print_exception_context():
"""
Print File name and line number of raised exception.
"""
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = ... | TabsterApp/CMDTwiddler | cmdtwiddler/RPCHelper.py | Python | mit | 3,442 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | luzheqi1987/nova-annotation | nova/tests/unit/integrated/v3/test_hypervisors.py | Python | apache-2.0 | 2,754 |
from functools import wraps
import re
import sys
import django
from django.db.models import F, NOT_PROVIDED
from django.db.models.sql import aggregates as sqlaggregates
from django.db.models.sql.constants import MULTI
from django.db.models.sql.where import OR
from django.db.utils import DatabaseError, IntegrityError
f... | otherness-space/myProject003 | my_project_003/lib/python2.7/site-packages/django_mongodb_engine/compiler.py | Python | mit | 16,913 |
#! /usr/bin/env python
# Validate treatment of line radiative transfer in SPARX by doing synthetic
# observations on a spherical gas cloud containing two-level o-H2O in LTE, which is
# optically thin.
#
# Since the cloud is optically thin, the brightness temperature Tb for a cloud of
# kinetic temperature Tk and optic... | itahsieh/sparx-alpha | bin/sparx-validate-line.py | Python | gpl-3.0 | 5,309 |
import pytz
from pyrfc3339.utils import timezone, timedelta_seconds
def generate(dt, utc=True, accept_naive=False, microseconds=False):
'''
Generate an :RFC:`3339`-formatted timestamp from a
:class:`datetime.datetime`.
>>> from datetime import datetime
>>> generate(datetime(2009,1,1,12,59,59,0,p... | kurtraschke/pyRFC3339 | pyrfc3339/generator.py | Python | mit | 2,170 |
"""
:func:`~pandas.eval` parsers.
"""
import ast
from functools import partial, reduce
from keyword import iskeyword
import tokenize
from typing import Callable, Optional, Set, Tuple, Type, TypeVar
import numpy as np
import pandas.core.common as com
from pandas.core.computation.ops import (
_LOCAL_TAG,
BinOp... | TomAugspurger/pandas | pandas/core/computation/expr.py | Python | bsd-3-clause | 24,166 |
#!/usr/bin/env python
from nose.tools import eq_
from utilities import execution_path, run_all, get_unique_colors
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_dataraster_colori... | sebastic/python-mapnik | test/python_tests/raster_symbolizer_test.py | Python | lgpl-2.1 | 8,176 |
import os
import sys
import sphinx
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('..'))
fr... | MSLNZ/msl-equipment | docs/conf.py | Python | mit | 7,086 |
#kruskal algorithm
#code from https://github.com/israelst/
parent = dict()
rank = dict()
def make_set(vertice):
parent[vertice] = vertice
rank[vertice] = 0
def find(vertice):
if parent[vertice] != vertice:
parent[vertice] = find(parent[vertice])
return parent[vertice]
def union(vertice1, vert... | pragalakis/100-python-projects | graph/minimum-spanning-tree.py | Python | mit | 1,425 |
import random
from calendar import Calendar
from datetime import date
from flask import render_template, request, session, flash, redirect, url_for, make_response
from loremipsum import get_sentences
from form import RecaptchaForm, RegistrationForm
from project import app, config
from project.tools.logger import logC... | WebMole/crawler-benchmark | project/controllers/traps.py | Python | gpl-2.0 | 6,933 |
"""Tests for laguerre module.
"""
from __future__ import division
import numpy as np
import numpy.polynomial.laguerre as lag
from numpy.polynomial.polynomial import polyval
from numpy.testing import (
TestCase, assert_almost_equal, assert_raises,
assert_equal, assert_, run_module_suite)
L0 = np.array... | lthurlow/Network-Grapher | proj/external/numpy-1.7.0/numpy/polynomial/tests/test_laguerre.py | Python | mit | 15,849 |
"""
Text files to Pandas
"""
import pandas
def txt_to_pandas(csvFile, _delimiter, encoding_='utf8'):
"""
Text file to Pandas Dataframe
"""
return pandas.read_csv(
csvFile, sep=_delimiter, low_memory=False,
#encoding=encoding_
)
| JoaquimPatriarca/senpy-for-gis | gasp/fromtxt/pnd.py | Python | gpl-3.0 | 272 |
# packetGenerator
import threading
import random
import struct
import Queue
import time
from config import *
from msgMonitor import GENERATE_DATA
#Max length of the data portion of the packet
_MAX_PACKET_DATA_LENGTH = MAX_PACKET_LENGTH - (PACKET_GENERATOR_HASHLIB_ALGORITHM().digest_size + (len(struct.pack('!H', 0))... | JosephLutz/serialCommTest | packetGenerator.py | Python | mit | 6,662 |
"""
Conversions to unicode.
Author(s): Arno Bakker
"""
from __future__ import absolute_import
import sys
from six import text_type
def bin2unicode(bin, possible_encoding='utf_8'):
sysenc = sys.getfilesystemencoding()
if possible_encoding is None:
possible_encoding = sysenc
try:
return b... | Captain-Coder/tribler | Tribler/Core/Utilities/unicode.py | Python | lgpl-3.0 | 1,439 |
# -*- coding:utf-8 -*-
import unittest
import mock
from django import forms
from employee import constants as employee_constants
from ..forms import JobPostingForm
from .. import strings, constants
class JobPostingFormTestCase(unittest.TestCase):
def setUp(self):
self.cleaned_data = dict(
##... | hellhovnd/dentexchange | dentexchange/apps/employer/tests/test_job_posting_form.py | Python | bsd-3-clause | 8,943 |
# Copyright 2016 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 agre... | google/openhtf | test/core/monitors_test.py | Python | apache-2.0 | 3,303 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008-2014,2016,2019 Contributor
#
# 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 Li... | quattor/aquilon | lib/aquilon/worker/formats/filesystem.py | Python | apache-2.0 | 2,420 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/pulse/pulse_lib/continuous.py | Python | apache-2.0 | 11,951 |
#!/usr/bin/env python3
## INFO ########################################################################
## ##
## pypp ##
## ==== ... | petervaro/pypp | build.py | Python | gpl-3.0 | 3,589 |
"""
Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion 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 l... | GREO/gnuradio-git | grc/python/Port.py | Python | gpl-3.0 | 6,046 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.