code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from tcp_ip_raw_socket import *
def main():
fd = createSocket()
pkt = buildPacket("10.1.1.2", "10.1.1.1", 54321, 80, "Hello, how are you?")
try:
print "Starting flood"
while True:
sendPacket(fd, pkt, "10.1.1.2")
except KeyboardInterrupt:
print "Closing..."
if __name__ == "__main__":
main() | Digoss/funny_python | syn_flood.py | Python | bsd-3-clause | 310 |
__author__ = 'Bohdan Mushkevych'
from threading import Thread
from werkzeug.wrappers import Request
from werkzeug.wsgi import ClosingIterator
from werkzeug.middleware.shared_data import SharedDataMiddleware
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.serving import run_simple
from synergy.con... | mushkevych/scheduler | synergy/mx/synergy_mx.py | Python | bsd-3-clause | 5,162 |
from datetime import datetime
import inspect
import numpy as np
import pytest
from pandas.core.dtypes.common import (
is_categorical_dtype,
is_interval_dtype,
is_object_dtype,
)
from pandas import (
Categorical,
DataFrame,
DatetimeIndex,
Index,
IntervalIndex,
Series,
Timestamp... | TomAugspurger/pandas | pandas/tests/frame/test_alter_axes.py | Python | bsd-3-clause | 8,801 |
# -*- coding: utf-8 -*-
import os.path
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.server.handler.threadedhandler import WebSocketHandler, EchoWebSocketHandler
class BroadcastWebSocketHandler(WebSocketHandler):
def received_message(self, m):
cherrypy.e... | progrium/WebSocket-for-Python | example/droid_sensor_cherrypy_server.py | Python | bsd-3-clause | 2,324 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
... | Eric89GXL/vispy | examples/basics/scene/isocurve_for_trisurface.py | Python | bsd-3-clause | 1,317 |
"""
Forest of trees-based ensemble methods.
Those methods include random forests and extremely randomized trees.
The module structure is the following:
- The ``BaseForest`` base class implements a common ``fit`` method for all
the estimators in the module. The ``fit`` method of the base ``Forest``
class calls th... | kevin-intel/scikit-learn | sklearn/ensemble/_forest.py | Python | bsd-3-clause | 102,940 |
from __future__ import unicode_literals
from celery_longterm_scheduler import get_scheduler
from celery_longterm_scheduler.conftest import CELERY
import mock
import pendulum
@CELERY.task
def echo(arg):
return arg
def test_should_store_all_arguments_needed_for_send_task(celery_worker):
# Cannot do this with ... | ZeitOnline/celery_longterm_scheduler | src/celery_longterm_scheduler/tests/test_task.py | Python | bsd-3-clause | 3,059 |
# proxy module
from pyface.ui.wx.system_metrics import *
| enthought/etsproxy | enthought/pyface/ui/wx/system_metrics.py | Python | bsd-3-clause | 57 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-12 08:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import tagulous.models.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]... | Candihub/pixel | apps/core/migrations/0002_auto_20171012_0855.py | Python | bsd-3-clause | 1,878 |
#!/usr/bin/env python3
#==============================================================================
# author : Pavel Polishchuk
# date : 14-08-2019
# version :
# python_version :
# copyright : Pavel Polishchuk 2019
# license :
#===========================================... | DrrDom/crem | crem/__init__.py | Python | bsd-3-clause | 379 |
# Copyright (c) 2015, National Documentation Centre (EKT, www.ekt.gr)
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# Redistributions of source code must retain the above copyright
# n... | EKT/pyrundeck | pyrundeck/exceptions.py | Python | bsd-3-clause | 1,781 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyPulses Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ---------... | Ecpy/ecpy_pulses | exopy_pulses/testing/context.py | Python | bsd-3-clause | 1,203 |
__author__ = 'Thomas Rueckstiess, ruecksti@in.tum.de'
from agent import Agent
from pybrain.datasets import ReinforcementDataSet
class HistoryAgent(Agent):
""" This agent stores actions, states, and rewards encountered during interaction with an environment
in a ReinforcementDataSet (which is a variation o... | daanwierstra/pybrain | pybrain/rl/agents/history.py | Python | bsd-3-clause | 2,202 |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test.sqlite',
}
}
INSTALLED_APPS = [
'nocaptcha_recaptcha',
]
MIDDLEWARE_CLASSES = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.... | ImaginaryLandscape/django-nocaptcha-recaptcha | test_settings.py | Python | bsd-3-clause | 636 |
# -*- coding: utf-8 -*-
"""Test forms."""
from personal_website.article.forms import ArticleForm
from personal_website.public.forms import LoginForm
class TestArticleForm:
"""Article Form."""
def test_title_required(self, article):
"""Publish article."""
form = ArticleForm(body=article.body,... | arewellborn/Personal-Website | tests/test_forms.py | Python | bsd-3-clause | 2,446 |
from django.contrib import admin
import models
admin.site.register(models.Song)
admin.site.register(models.Station)
admin.site.register(models.Vote)
admin.site.register(models.StationPoll)
admin.site.register(models.StationVote) | f4nt/djpandora | djpandora/admin.py | Python | bsd-3-clause | 230 |
# Copyright (c) 2013,Vienna University of Technology, Department of Geodesy and Geoinformation
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the a... | christophreimer/pytesmo | tests/test_ismn/test_readers.py | Python | bsd-3-clause | 8,660 |
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.db import transaction
from django.forms.models import inlineformset_factory, modelform_factory
from django.forms.widgets import HiddenInput
from django.shortcuts import get_object_or_404
from vanilla import ... | jAlpedrinha/DeclRY | declry/views.py | Python | bsd-3-clause | 9,652 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='FanUser... | vivyly/fancastic_17 | fancastic_17/fan/migrations/0001_initial.py | Python | bsd-3-clause | 909 |
"""
=====================================================
Analysis for project 29
=====================================================
:Author: Nick Ilott
:Release: $Id$
:Date: |today|
:Tags: Python
"""
# load modules
from ruffus import *
import CGAT.Experiment as E
import logging as L
import CGAT.Database as Data... | CGATOxford/proj029 | Proj029Pipelines/pipeline_proj029.py | Python | bsd-3-clause | 12,528 |
import os
from time import sleep
from cement.utils.test import TestApp
from cement.utils.misc import init_defaults
if 'REDIS_HOST' in os.environ.keys():
redis_host = os.environ['REDIS_HOST']
else:
redis_host = 'localhost'
defaults = init_defaults('cache.redis')
defaults['cache.redis']['host'] = redis_host
... | datafolklabs/cement | tests/ext/test_ext_redis.py | Python | bsd-3-clause | 1,437 |
#!/usr/bin/env python
import sys
from hiclib import mapping, fragmentHiC
from mirnylib import h5dict, genome
import h5py
basedir = sys.argv[1]
genome_db = genome.Genome('%s/Data/Genome/mm9_fasta' % basedir, readChrms=['1'], chrmFileTemplate="%s.fa")
temp = h5py.File('%s/Data/Timing/hiclib_data_norm.hdf5' % basedi... | bxlab/HiFive_Paper | Scripts/Timing/hiclib_heatmap.py | Python | bsd-3-clause | 813 |
#from django.conf import settings
#settings.INSTALLED_APPS += ("mptt", "hvad", "galleries",) | marcopompili/django-market | django_market/__init__.py | Python | bsd-3-clause | 94 |
from rdr_service.model.genomics import GenomicGCValidationMetrics, GenomicSetMember
from rdr_service.tools.tool_libs.tool_base import cli_run, ToolBase
tool_cmd = 'backfill-gvcf'
tool_desc = 'Backfill the gVCF paths in genomic_gc_validation_metrics'
class GVcfBackfillTool(ToolBase):
def run(self):
super(... | all-of-us/raw-data-repository | rdr_service/tools/tool_libs/backfill_gvcf_paths.py | Python | bsd-3-clause | 2,248 |
#!/usr/bin/python2
"""Syncs to a given Cobalt build id.
Syncs current gclient instance to a given build id, as
generated by "build_id.py" and stored on carbon-airlock-95823.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import json
im... | youtube/cobalt | cobalt/build/sync_to_build_id.py | Python | bsd-3-clause | 6,399 |
from models import *
from django.db import connection
import collections
import time
import calendar
def GetCreditCardList(contactid):
cards_list = []
orders = Orders.objects.all().filter(ocustomerid = contactid)
cards_hash = {}
for order in orders:
if order.ocardno:
if order.ocardno not in cards_h... | hughsons/saltwaterfish | classes_bkp_0621.py | Python | bsd-3-clause | 19,445 |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
# Download and build the da... | calee88/ParlAI | parlai/tasks/vqa_v2/build.py | Python | bsd-3-clause | 2,271 |
from django.core.exceptions import ImproperlyConfigured
from django.db.models import F, fields
from django.db.models.functions import Cast, Coalesce
from django.utils.translation import gettext_lazy as _
from .conf import get_default_language, get_fallback_chain, get_modeltrans_setting
from .utils import (
Fallbac... | zostera/django-modeltrans | modeltrans/fields.py | Python | bsd-3-clause | 12,105 |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import collections
import itertools
from contextlib import contextmanager... | sholsapp/cryptography | src/cryptography/hazmat/backends/openssl/backend.py | Python | bsd-3-clause | 49,028 |
"""Workflow for uploading many many many log files at once."""
from __future__ import absolute_import
import os
from os.path import isfile, getsize
import logging
import re
import luigi
import psycopg2
import pandas as pd
# import sqlalchemy
try:
from .pylog_parse import LogFile
except:
from pylog_parse impor... | sethmenghi/pylog_parse | pylog_parse/workflow.py | Python | bsd-3-clause | 4,335 |
import os
from setuptools import setup, find_packages
setup(
name='django-scrape',
version='0.1',
author='Luke Hodkinson',
author_email='furious.luke@gmail.com',
maintainer='Luke Hodkinson',
maintainer_email='furious.luke@gmail.com',
url='https://github.com/furious-luke/django-scrape',
... | furious-luke/django-scrape | setup.py | Python | bsd-3-clause | 990 |
from __future__ import absolute_import
import base64
import json
import unittest
import urllib
import urllib2
import urlparse
from celery.exceptions import RetryTaskError
from mock import MagicMock as Mock
import mock
from . import tasks
from .conf import settings as mp_settings
class TestCase(unittest.TestCase):... | bss/mixpanel-celery | mixpanel/tests.py | Python | bsd-3-clause | 7,560 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/rl_config.py
__version__=''' $Id$ '''
__doc__='''Configuration file. You may edit this if you wish.'''
allowTableBoundsErrors = 1 # set to 0 to di... | makinacorpus/reportlab-ecomobile | src/reportlab/rl_config.py | Python | bsd-3-clause | 10,215 |
import os
from google.appengine.api import memcache
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app
from twimonial.models import Twimonial, User
from twimonial.ui import render_write
import config
class HomePage(webap... | livibetter-backup/twimonial | src/index.py | Python | bsd-3-clause | 2,779 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# rfMHC documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26: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
# autog... | dnolivieri/rfMHC | docs/conf.py | Python | bsd-3-clause | 8,369 |
def extractFullybookedtranslationsWordpressCom(item):
'''
Parser for 'fullybookedtranslations.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractFullybookedtranslationsWordpressCom.py | Python | bsd-3-clause | 586 |
"""
Set of utility programs for IRIS.
"""
import os
import re
import io
import numpy as np
import pandas as pd
from datetime import datetime, timedelta
from glob import glob
# pylint: disable=F0401,E0611,E1103
from urllib.request import urlopen
from urllib.parse import urljoin, urlparse
from urllib.error import HTTPEr... | ITA-Solar/helita | helita/obs/iris_util.py | Python | bsd-3-clause | 9,925 |
from __future__ import absolute_import, division, print_function
_TRIGGERS = {}
def register(tpe, start, stop, join):
def decorator(f):
_TRIGGERS[tpe] = {
"parser": f,
"start": start,
"stop": stop,
"join": join,
"threads": []
}
... | stcorp/legato | legato/registry.py | Python | bsd-3-clause | 987 |
import sublime, sublime_plugin, os
class ExpandTabsOnSave(sublime_plugin.EventListener):
def on_pre_save(self, view):
if view.settings().get('expand_tabs_on_save') == 1:
view.window().run_command('expand_tabs')
| edonet/package | Edoner/expand_tabs_on_save.py | Python | isc | 236 |
import os
import load_data
import numpy as np
from keras.backend import theano_backend as K
from keras.callbacks import ModelCheckpoint, EarlyStopping
from keras.utils.generic_utils import Progbar
from keras.callbacks import Callback
import generative_models as gm
from common import CsvHistory
from common import merg... | jstarc/deep_reasoning | generative_alg.py | Python | mit | 12,160 |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test that the wallet resends transactions periodically."""
from collections import defaultdict
import t... | nlgcoin/guldencoin-official | test/functional/wallet_resendwallettransactions.py | Python | mit | 2,912 |
#import SYS
import ShareYourSystem as SYS
#Definition
MyBrianer=SYS.BrianerClass(
).collect(
"Neurongroupers",
'P',
SYS.NeurongrouperClass(
#Here are defined the brian classic shared arguments for each pop
**{
'NeurongroupingKwargVariablesDict':
{
'N':2,
'model':
'''
Jr : 1
... | Ledoux/ShareYourSystem | Pythonlogy/draft/Simulaters/Brianer/draft/07_ExampleDoc.py | Python | mit | 1,597 |
# -*- coding: utf-8 -*-
import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _
class RegisterToken(models.Model):
user = models.ForeignKey(User)
token = models.CharField(_(u'token'), max_length=32)
created = models... | dotKom/studlan | apps/authentication/models.py | Python | mit | 674 |
from py_word_suggest.utils import *
import pytest
raw_json = """
{"lang:nl:0:ben":[["ik", 22.0], ["er", 8.0], ["een", 7.0], ["je", 5.0]],"lang:nl:0:Ik":[["heb", 66.0], ["ben", 52.0], ["denk", 15.0], [
"wil", 13.0], ["acht", 1.0]],"lang:eng:0:I":[["am", 100], ["want", 246], ["love", 999]],"lang:eng:0:am":[["the",100... | eronde/vim_suggest | tests/test_utils.py | Python | mit | 9,992 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class BuildConfig(AppConfig):
name = 'build'
| inventree/InvenTree | InvenTree/build/apps.py | Python | mit | 150 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness
if __name__ == '__main__':
harness = TestHarness('statepoint.5.*', True)
harness.main()
| kellyrowland/openmc | tests/test_many_scores/test_many_scores.py | Python | mit | 212 |
class CouldNotSendError(Exception): pass
class AlertIDAlreadyInUse(Exception): pass
class AlertBackendIDAlreadyInUse(Exception): pass
class InvalidApplicableUsers(Exception): pass | jiaaro/django-alert | alert/exceptions.py | Python | mit | 180 |
"""
Combination of multiple media players into one for a universal controller.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.universal/
"""
import logging
# pylint: disable=import-error
from copy import copy
from homeassistant.components.... | instantchow/home-assistant | homeassistant/components/media_player/universal.py | Python | mit | 13,920 |
import gc
import os.path
from mock import Mock
from pythoscope.code_trees_manager import CodeTreeNotFound, \
FilesystemCodeTreesManager
from pythoscope.store import CodeTree, Module
from assertions import *
from helper import TempDirectory
class TestFilesystemCodeTreesManager(TempDirectory):
def setUp(self... | mkwiatkowski/pythoscope | test/test_code_trees_manager.py | Python | mit | 4,388 |
# -*- coding: utf-8 -
#
# This file is part of socketpool.
# See the NOTICE for more information.
import errno
import os
import platform
import select
import socket
import sys
try:
from importlib import import_module
except ImportError:
import sys
def _resolve_name(name, package, level):
"""Retur... | benoitc/socketpool | socketpool/util.py | Python | mit | 4,541 |
import sys
from pycsp import * | IanField90/Coursework | Part 3/SE3AC11/eticket/eticket_uint.py | Python | mit | 30 |
#!/usr/bin/python3
import os
import re
import requests
def download_file(url):
out_file = os.path.join("SOURCES", url.rsplit("/")[-1])
r = requests.get(url, stream=True)
print("Downloading {} to {}".format(url, out_file))
with open(out_file, "wb") as out:
for chunk in r.iter_content(chunk_size... | kyl191/nginx-pagespeed | download_sources.py | Python | mit | 1,266 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | twilio/twilio-python | twilio/rest/video/v1/room/room_participant/__init__.py | Python | mit | 20,355 |
from nltk.corpus import wordnet
import json
import codecs
import sys
import time
major_weight = 1.0
minor_weight = 0.8
similarity_threshold = 0.65
def fn(ss1, ss2, weight):
similarity = ss1.wup_similarity(ss2)
return (ss1, ss2, weight * similarity if similarity else 0 )
def isSynsetForm(s):
return '.n.' in s o... | darenr/MOMA-Art | kadist/wup.py | Python | mit | 1,480 |
'''@file alignment_decoder.py
contains the AlignmentDecoder'''
import os
import struct
import numpy as np
import tensorflow as tf
import decoder
class AlignmentDecoder(decoder.Decoder):
'''gets the HMM state posteriors'''
def __call__(self, inputs, input_seq_length):
'''decode a batch of data
... | vrenkens/Nabu-asr | nabu/neuralnetworks/decoders/alignment_decoder.py | Python | mit | 3,558 |
from unittest import TestCase
from unittest.mock import patch
from genes.apt.get import APTGet
class APTGetInstallTestCase(TestCase):
def test_apt_get_install_no_items_fails(self):
with patch('genes.process.process.Popen') as mock_popen:
apt_get = APTGet()
with self.assertRaises(V... | hatchery/Genepool2 | genes/apt/test_get.py | Python | mit | 1,570 |
import src.dot.dotentity
class DotHeart(src.dot.dotentity.DotEntity):
def __init__(self):
res = [
"assets/img/red-brick.png",
"assets/img/black-brick.png"
]
grid = [
[0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0],
[0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
... | m4nolo/steering-all | src/dot/entities/dotheart.py | Python | mit | 817 |
import bootstrap # noqa
import pytest
from modviz.cli import parse_arguments, validate_path, validate_fold_paths
def test_argument_parsing():
with pytest.raises(SystemExit):
parse_arguments([])
namespace = parse_arguments(["foo"])
assert namespace.path == "foo"
assert namespace.target is No... | Bogdanp/modviz | tests/test_cli.py | Python | mit | 1,467 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_commoner_tatooine_rodian_male_04.iff"
result.attribute... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_commoner_tatooine_rodian_male_04.py | Python | mit | 466 |
import functools
from ...drivers.spi_interfaces import SPI_INTERFACES
USAGE = """
A spi_interface is represented by a string.
Possible values are """ + ', '.join(sorted(SPI_INTERFACES.__members__))
@functools.singledispatch
def make(c):
raise ValueError("Don't understand type %s" % type(c), USAGE)
@make.regis... | ManiacalLabs/BiblioPixel | bibliopixel/project/types/spi_interface.py | Python | mit | 424 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
# Some initial, primary places.
PLACES = [
('Work', 'work'),
('Home', 'home'),
('School', 'school'),
]
def create_primary_place(apps, schema_editor=None):
Place = apps.get_model("userprofile", "... | izzyalonso/tndata_backend | tndata_backend/userprofile/migrations/0011_create_places.py | Python | mit | 622 |
from __future__ import unicode_literals, division, absolute_import
import argparse
import logging
import re
import time
from copy import copy
from datetime import datetime, timedelta
from sqlalchemy import (Column, Integer, String, Unicode, DateTime, Boolean,
desc, select, update, delete, Forei... | tvcsantos/Flexget | flexget/plugins/filter/series.py | Python | mit | 70,663 |
from django.dispatch import dispatcher
from django.db.models import signals
from django.utils.translation import ugettext_noop as _
try:
from notification import models as notification
def create_notice_types(app, created_models, verbosity, **kwargs):
notification.create_notice_type("swaps_propos... | indro/t2c | apps/external_apps/swaps/management.py | Python | mit | 1,734 |
#!/usr/bin/env python
# coding:utf8
import ctypes
from utils import Loader
from utils import convert_data
import numpy as np
import api
mv_lib = Loader.get_lib()
class TableHandler(object):
'''`TableHandler` is an interface to sync different kinds of values.
If you are not writing python code based on the... | you-n-g/multiverso | binding/python/multiverso/tables.py | Python | mit | 7,029 |
import pytest
from hackathon.constants import VE_PROVIDER, TEMPLATE_STATUS
from hackathon.hmongo.models import User, Template, UserHackathon
from hackathon.hmongo.database import add_super_user
@pytest.fixture(scope="class")
def user1():
# return new user named one
one = User(
name="test_one",
... | juniwang/open-hackathon | open-hackathon-server/src/tests/conftest.py | Python | mit | 1,534 |
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponseRedirect
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.template.lo... | afriestad/interlecture | interlecture/interauth/views.py | Python | mit | 4,933 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'topics.views.topics', name="topic_list"),
url(r'^(?P<topic_id>\d+)/edit/$', 'topics.views.topic', kwargs={"edit": True}, name="topic_edit"),
url(r'^(?P<topic_id>\d+)/delete/$', 'topics.views.topic_delete', name="topic_delete"),
... | ericholscher/pinax | pinax/apps/topics/urls.py | Python | mit | 399 |
import logging
from django.conf import settings
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db import models
from django.utils.translation import ugettext_lazy as _
from wagtail.admin.edit_handlers import FieldPanel, MultiFieldPanel
from wagtail.core.fields import RichTextField... | ilendl2/wagtail-cookiecutter-foundation | {{cookiecutter.project_slug}}/gallery/models.py | Python | mit | 4,587 |
"""Splits the time dimension into an reftime and a leadtime
so that multiple files can be concatenated more easily"""
import sys
from netCDF4 import Dataset, num2date, date2num
for f in sys.argv[1:]:
dataset = Dataset(f, 'a')
# rename record dimension to reftime
dataset.renameDimension('record', 'reftime... | samwisehawkins/wrftools | util/split_time_dimension.py | Python | mit | 1,878 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/target_cost_properties.py | Python | mit | 2,286 |
import unittest
import base64
from hashlib import md5 as basic_md5
from flask import Flask
from flask_httpauth import HTTPBasicAuth
def md5(s):
if isinstance(s, str):
s = s.encode('utf-8')
return basic_md5(s)
class HTTPAuthTestCase(unittest.TestCase):
def setUp(self):
app = Flask(__name_... | miguelgrinberg/Flask-HTTPAuth | tests/test_basic_hashed_password.py | Python | mit | 2,215 |
"""
Module. Includes classes for all time dependent lattice.
"""
import sys
import os
import math
from orbit.teapot import TEAPOT_Lattice
from orbit.parsers.mad_parser import MAD_Parser, MAD_LattLine
from orbit.lattice import AccNode, AccActionsContainer
from orbit.time_dep import waveform
class TIME_DEP_Lattice(TEAP... | PyORBIT-Collaboration/py-orbit | py/orbit/time_dep/time_dep.py | Python | mit | 4,174 |
from .cpu import Cpu
| Hexadorsimal/pynes | nes/processors/cpu/__init__.py | Python | mit | 21 |
#! /usr/bin/python2
#
# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
import argparse
import collections
import re
import subprocess
import sys
__DESCRIPTION = """
Processes a perf.data sample file a... | hoho/dosido | nodejs/deps/v8/tools/ignition/linux_perf_report.py | Python | mit | 8,176 |
import argparse
import os
import sys
import numpy as np
from PIL import Image
import chainer
from chainer import cuda
import chainer.functions as F
from chainer.functions import caffe
from chainer import Variable, optimizers
import pickle
def subtract_mean(x0):
x = x0.copy()
x[0,0,:,:] -= 104
x[0,1,:,... | wf9a5m75/chainer-gogh | chainer-gogh.py | Python | mit | 7,054 |
## Copyright (c) 2001-2010, Scott D. Peckham
## January 2009 (converted from IDL)
## November 2009 (collected into cfg_files.py
## May 2010 (added read_key_value_pair())
## July 2010 (added read_list()
import numpy
#---------------------------------------------------------------------
#
# unit_test()
#
# skip_h... | mdpiper/topoflow | topoflow/utils/cfg_files.py | Python | mit | 12,732 |
import os
import shutil
import subprocess
def which(program):
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(... | liangjg/openmc | tools/ci/travis-install.py | Python | mit | 2,019 |
#!/usr/bin/env python
"""
Apply a surface field to a shape
"""
from __future__ import print_function
import argparse
import time
import sys
import re
from numpy import linspace
from icqsol.shapes.icqShapeManager import ShapeManager
from icqsol import util
# time stamp
tid = re.sub(r'\.', '', str(time.time()))
descr... | gregvonkuster/icqsol | examples/addSurfaceFieldFromExpression.py | Python | mit | 3,166 |
#!/usr/bin/python3
"""
Simple wrapper to get diff of two schedules
It's able to show different attributes (by 'attrs' kwarg)
and indicate missing phases
Follows 'diff' exit codes:
0 - same
1 - different
2 - other trouble
Test as "python -m schedules_tools.batches.diff"
"""
import argparse
from datetime... | RedHat-Eng-PGM/schedules-tools | schedules_tools/diff.py | Python | mit | 16,312 |
from __future__ import print_function
class Sequence(object):
def __init__(self, name, seq):
"""
:param seq: the sequence
:type seq: string
"""
self.name = name
self.sequence = seq
def __len__(self):
return len(self.sequence)
def to_fasta(self):
... | C3BI-pasteur-fr/python-course-1 | source/_static/code/inheritance_sequence.py | Python | cc0-1.0 | 1,463 |
# -*- coding: utf-8 -*-
#
# This file is part of Zenodo.
# Copyright (C) 2016 CERN.
#
# Zenodo 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 v... | slint/zenodo | tests/unit/records/test_schemas_marcxml.py | Python | gpl-2.0 | 13,950 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated Thu Dec 1 09:58:36 2011 by generateDS.py version 2.7a.
#
import sys
import getopt
import re as re_
etree_ = None
Verbose_import_ = False
(XMLParser_import_none, XMLParser_import_lxml,
XMLParser_import_elementtree
) = range(3)
XMLParser_import_library ... | joyxu/autotest | client/tools/JUnit_api.py | Python | gpl-2.0 | 65,100 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
PostGISExecuteSQL.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya and Carterix Geomatics
Email : volayaf at gmail dot c... | bstroebl/QGIS | python/plugins/sextante/admintools/PostGISExecuteSQL.py | Python | gpl-2.0 | 3,170 |
# -*- coding: utf-8 -*-
from django.db import models
class Profiles(models.Model):
userid = models.AutoField(primary_key=True)
login_name = models.CharField(max_length=255, unique=True)
cryptpassword = models.CharField(max_length=128, blank=True)
realname = models.CharField(max_length=255)
disable... | Nitrate/Nitrate | src/tcms/profiles/models.py | Python | gpl-2.0 | 2,379 |
# If you start collecting a wave and then regret it, you can use this
# to roll back the data collection. I would recommend duplicating the database
# first and letting this program loose on a copy, as you won't be able to
# get back any of the data you don't explicitly tell it to keep.
import sqlite3
import itertools... | ValuingElectronicMusic/network-analysis | remove_waves.py | Python | gpl-2.0 | 2,612 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-,
import sys
import os.path
import unittest
from io import StringIO
from suse_git import header
class TestHeaderChecker(unittest.TestCase):
def test_empty(self):
try:
self.header = header.Checker("")
except header.HeaderException as e:
... | kdave/kernel-source | scripts/python/tests/test_header.py | Python | gpl-2.0 | 20,987 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('QuickBooking', '0010_auto_20150704_1942'),
]
operations = [
migrations.AlterField(
model_name='seat',
... | noorelden/QuickBooking | QuickBooking/migrations/0011_auto_20150704_2001.py | Python | gpl-2.0 | 426 |
import fill
import array
a = array.array('I')
a.append(1)
a.append(1)
a.append(3)
a.append(2)
a.append(2)
a.append(2)
a.append(2)
a.append(2)
a.append(2)
a.append(2)
a.append(2)
a.append(2)
print "before", a
b = fill.fill(a, 2, 2, 3, 3, 4278190080)
print "after", b
print "after 2", array.array('I', b)
| samdroid-apps/paint-activity | test_fill.py | Python | gpl-2.0 | 304 |
from miasm2.core.asmblock import disasmEngine
from miasm2.arch.aarch64.arch import mn_aarch64
cb_aarch64_funcs = []
def cb_aarch64_disasm(*args, **kwargs):
for func in cb_aarch64_funcs:
func(*args, **kwargs)
class dis_aarch64b(disasmEngine):
attrib = "b"
def __init__(self, bs=None, **kwargs):
... | stephengroat/miasm | miasm2/arch/aarch64/disasm.py | Python | gpl-2.0 | 731 |
# This file is part of BuhIRC.
#
# BuhIRC 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.
#
# BuhIRC is distributed in the hope that ... | AppleDash/burpyhooves | modules/vore.py | Python | gpl-3.0 | 3,226 |
"""
WSGI config for group_warning project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | fazlerabby7/group_warning | group_warning/wsgi.py | Python | gpl-3.0 | 404 |
#!/usr/bin/python3
from ansible.module_utils.arvados_common import process
def main():
additional_argument_spec={
"uuid": dict(required=True, type="str"),
"owner_uuid": dict(required=True, type="str"),
"name": dict(required=True, type="str"),
}
filter_property = "uuid"
filter... | wtsi-hgi/hgi-ansible | ansible/library/arvados_repository.py | Python | gpl-3.0 | 670 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
"""Use AppConf to store sensible defaults for settings. This also documents the
settings that lizard_damage defines. Each setting name automatically has
"FLOODING_LIB_" prepended to it.
By puttng the AppConf in this module and importing... | lizardsystem/flooding | flooding_lib/conf.py | Python | gpl-3.0 | 875 |
# -*- coding: utf-8 -*-
"""
<license>
CSPLN_MaryKeelerEdition; Manages images to which notes can be added.
Copyright (C) 2015, Thomas Kercheval
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 ... | jjs0sbw/CSPLN | test/update_test_subreadme.py | Python | gpl-3.0 | 3,717 |
# -*- coding: UTF-8 -*-
"""
Lastship Add-on (C) 2019
Credits to Lastship, Placenta and Covenant; our thanks go to their creators
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, e... | lastship/plugin.video.lastship | resources/lib/sources/de/movie4k.py | Python | gpl-3.0 | 8,599 |
../../../../../share/pyshared/checkbox/reports/__init__.py | Alberto-Beralix/Beralix | i386-squashfs-root/usr/lib/python2.7/dist-packages/checkbox/reports/__init__.py | Python | gpl-3.0 | 58 |
######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | nipunreddevil/bayespy | bayespy/inference/vmp/nodes/gaussian_wishart.py | Python | gpl-3.0 | 10,240 |
#
# This file is part of Checkbox.
#
# Copyright 2008 Canonical Ltd.
#
# Checkbox 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.
#
# C... | jds2001/ocp-checkbox | checkbox/lib/safe.py | Python | gpl-3.0 | 2,778 |
from py2neo import Graph
from py2neo.ext.gremlin import Gremlin
import os
DEFAULT_GRAPHDB_URL = "http://localhost:7474/db/data/"
DEFAULT_STEP_DIR = os.path.dirname(__file__) + '/bjoernsteps/'
class BjoernSteps:
def __init__(self):
self._initJoernSteps()
self.initCommandSent = False
def setGr... | mrphrazer/bjoern | python-bjoern/bjoern/all.py | Python | gpl-3.0 | 2,645 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Ansible module to manage A10 Networks slb service-group objects
(c) 2014, Mischa Peters <mpeters@a10networks.com>,
Eric Chou <ericc@a10networks.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... | kbrebanov/ansible-modules-extras | network/a10/a10_service_group.py | Python | gpl-3.0 | 13,531 |