text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import numpy as np
import numpy.random as rng
import theano
import theano.tensor as T
from theano.tensor.nnet import conv2d
minibatch = 3
image_height,image_width = 28,28
filter_height,filter_width = 3,3
n_filters = 1
n_channels = 1
n = 1/(np.sqrt(image_height*image_width))
X = T.tensor4(name='X')
X_shape = (minibat... | nzufelt/theano_nn | min_work_ex.py | Python | mit | 757 | 0.029062 |
from django.core.urlresolvers import get_resolver
from django.http import HttpResponse
class HandlerRegistry(dict):
def __init__(self):
self.maxlength = 0
def __setitem__(self, name, value):
self.maxlength = max(self.maxlength, len(str(value)))
super(HandlerRegistry, self).__setitem__(... | j2a/django-simprest | simprest/docs.py | Python | bsd-3-clause | 1,557 | 0.001927 |
callback_classes = [
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'double', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'int', 'ns... | letiangit/802.11ah-ns3 | src/energy/bindings/callbacks_list.py | Python | gpl-2.0 | 641 | 0.00624 |
#!/usr/bin/python
import requests
from bs4 import BeautifulSoup
class CoverGrabber:
def __init__(self, url=None):
if url is None:
self.url = 'http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias=aps&field-keywords=cd'
else:
self.url = url
def request_service(self... | Ganapati/DjangoZik | infos_grabber/coverGrabber.py | Python | gpl-2.0 | 998 | 0.002004 |
# -*- coding: utf-8 -*-
from functools import partial
from types import NoneType
from navmazing import NavigateToSibling, NavigateToAttribute
from cfme.exceptions import DestinationNotFound
from cfme.fixtures import pytest_selenium as sel
from cfme.provisioning import provisioning_form as request_form
from cfme.web_u... | rananda/cfme_tests | cfme/services/catalogs/catalog_item.py | Python | gpl-2.0 | 16,459 | 0.001701 |
# Taken from here: https://stackoverflow.com/questions/50566934/why-is-this-singleton-implementation-not-thread-safe
import functools
import threading
lock = threading.Lock()
def synchronized(lock):
""" Synchronization decorator """
def wrapper(f):
@functools.wraps(f)
def inner_wrapper(*args... | cinepost/Copperfield_FX | copper/core/utils/singleton.py | Python | unlicense | 849 | 0.003534 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^$', 'boar.accounts.views.accounts', name='accounts'),
url(r'^signout/$', 'boar.accounts.views.signout', name='accounts_signout'),
url(r'^settings/$', 'boar.accounts.views.settings_form', name='accounts_settings'),
url(r'^mailing-... | boar/boar | boar/accounts/urls.py | Python | bsd-3-clause | 562 | 0.010676 |
#!/usr/bin/env python
# encoding: utf-8
from conftests import *
from rurouni.exceptions import *
from rurouni.types import *
from rurouni import Database, Column, Table
def test_insert_errors(db):
class Client(Table):
__db__ = db
name = Column(String)
birthdate = Column(Date)
with pyt... | magnunleno/Rurouni | tests/test_basic_operations.py | Python | gpl-3.0 | 5,681 | 0.010033 |
# -*- coding: utf-8 -*-
"""
Clement Michard (c) 2015
"""
import os
import sys
import nltk
from emotion import Emotion
from nltk.corpus import WordNetCorpusReader
import xml.etree.ElementTree as ET
class WNAffect:
"""WordNet-Affect ressource."""
def __init__(self, wordnet16_dir, wn_domains_dir):
"... | Arnukk/TDS | wnaffect.py | Python | mit | 3,540 | 0.012994 |
from _pydev_imps._pydev_saved_modules import threading
def wrapper(fun):
def pydev_after_run_call():
pass
def inner(*args, **kwargs):
fun(*args, **kwargs)
pydev_after_run_call()
return inner
def wrap_attr(obj, attr):
t_save_start = getattr(obj, attr)
setat... | SlicerRt/SlicerDebuggingTools | PyDevRemoteDebug/ptvsd-4.1.3/ptvsd/_vendored/pydevd/pydevd_concurrency_analyser/pydevd_thread_wrappers.py | Python | bsd-3-clause | 2,233 | 0.002239 |
# -*- coding: utf-8 -*-
__author__ = 'hal9000'
__all__ = ['Cache', 'CacheServer']
import socket
import time
import json
import hashlib
from sqlite3 import dbapi2 as sqlite
import xbmc
import log
import gui
import system
SOCKET = '127.0.0.1', 59999
CLEAR = 60*60*24 # 1 day
class SQL:
def __init__(self, name,... | chimkentec/KodiMODo_rep | script.module.xbmcup/lib/xbmcup/cache.py | Python | gpl-3.0 | 7,268 | 0.004403 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0013_merge'),
]
operations = [
migrations.AlterField(
model_name='user',
name='public',
... | joshsamara/game-website | core/migrations/0014_auto_20150413_1639.py | Python | mit | 496 | 0.002016 |
#!/usr/bin/env python
"""
@file costFunctionChecker.py
@author Michael Behrisch
@author Daniel Krajzewicz
@author Jakob Erdmann
@date 2009-08-31
@version $Id: costFunctionChecker.py 13811 2013-05-01 20:31:43Z behrisch $
Run duarouter repeatedly and simulate weight changes via a cost function.
SUMO, Simulatio... | rudhir-upretee/Sumo17_With_Netsim | tools/assign/costFunctionChecker.py | Python | gpl-3.0 | 8,986 | 0.004118 |
import datetime
import logging
import time
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.mail.message import EmailMultiAlternatives
from django.core.management.base import BaseCommand
from django.db.models import Q
from django.template.loader import render_to_string
fro... | waterdotorg/power.Water | project/custom/management/commands/friend_joined_email.py | Python | gpl-3.0 | 2,527 | 0.004353 |
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | matthijsvk/multimodalSR | code/Experiments/neon-master/tests/test_bleuscore.py | Python | mit | 1,914 | 0.001045 |
"""
A Pillow loader for .ftc and .ftu files (FTEX)
Jerome Leclanche <jerome@leclan.ch>
The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license:
https://creativecommons.org/publicdomain/zero/1.0/
Independence War 2: Edge Of Chaos - Texture File Format - 16 October 2001
... | ryfeus/lambda-packs | pytorch/source/PIL/FtexImagePlugin.py | Python | mit | 3,322 | 0 |
"""
Provides functionality to interact with thermostats.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/thermostat/
"""
import logging
import os
import voluptuous as vol
from homeassistant.helpers.entity_component import EntityComponent
from homeassi... | Zyell/home-assistant | homeassistant/components/thermostat/__init__.py | Python | mit | 8,539 | 0 |
#!/usr/bin/env python3
import sys
import os
import path_utils
import git_lib
import svn_lib
REPO_TYPE_GIT_BARE="git/bare"
REPO_TYPE_GIT_STD="git/std"
REPO_TYPE_GIT_SUB="git/sub"
REPO_TYPE_SVN="svn"
REPO_TYPES = [REPO_TYPE_GIT_BARE, REPO_TYPE_GIT_STD, REPO_TYPE_GIT_SUB, REPO_TYPE_SVN]
def detect_repo_type(path):
... | mvendra/mvtools | detect_repo_type.py | Python | mit | 1,152 | 0.007813 |
"""Compute the sound field generated by a sound source.
The Green's function describes the spatial sound propagation over time.
.. include:: math-definitions.rst
"""
from __future__ import division
import numpy as np
from .. import util
from .. import defs
def point(xs, signal, observation_time, grid, c=None):
... | chris-hld/sfs-python | sfs/time/source.py | Python | mit | 3,359 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Dummy conftest.py for graph_stix.
If you don't know what this is for, just leave it empty.
Read more about conftest.py under:
https://pytest.org/latest/plugins.html
"""
from __future__ import print_function, absolute_import, division
import pytest
| arangaraju/graph-stix | tests/conftest.py | Python | mit | 316 | 0 |
#!/usr/bin/env python
import os.path
import random
import subprocess as sp
from runtest import TestBase
TDIR = 'xxx'
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'abc', """
# DURATION TID FUNCTION
62.202 us [28141] | __cxa_atexit();
[28141] | main() {
... | namhyung/uftrace | tests/t142_recv_multi.py | Python | gpl-2.0 | 1,783 | 0.001122 |
"""
Commands that are available from the connect screen.
"""
import re
import traceback
from django.conf import settings
from src.players.models import PlayerDB
from src.objects.models import ObjectDB
from src.server.models import ServerConfig
from src.comms.models import Channel
from src.utils import create, logger, ... | TaliesinSkye/evennia | wintersoasis-master/commands/unloggedin.py | Python | bsd-3-clause | 12,835 | 0.004441 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('robocrm', '0006_auto_20141005_1800'),
]
operations = [
migrations.AddField(
model_name='robouser',
n... | CMU-Robotics-Club/roboticsclub.org | robocrm/migrations/0007_robouser_magnetic.py | Python | mit | 461 | 0 |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | levibostian/myBlanky | googleAppEngine/google/appengine/tools/dev_appserver_apiserver.py | Python | mit | 53,339 | 0.00718 |
"""
XML tag writer utilities.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
import cStringIO
__author__ = 'Enrique Perez (perez_enrique@yahoo.c... | dob71/x2swn | skeinforge/fabmetheus_utilities/xml_simple_writer.py | Python | gpl-3.0 | 4,447 | 0.02586 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | phenoxim/cinder | cinder/tests/unit/volume/test_init_host.py | Python | apache-2.0 | 14,005 | 0 |
###############################################################################
# Name: style_editor.py #
# Purpose: Syntax Highlighting configuration dialog #
# Author: Cody Precord <cprecord@editra.org> #
... | ezequielpereira/Time-Line | libs/wx/tools/Editra/src/style_editor.py | Python | gpl-3.0 | 30,179 | 0.001922 |
#!/usr/bin/env python
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
| alvarolopez/pyocci | setup.py | Python | apache-2.0 | 171 | 0 |
# -*- coding: utf-8 -*-
# ocitysmap, city map and street index generator from OpenStreetMap data
# Copyright (C) 2010 David Decotigny
# Copyright (C) 2010 Frédéric Lehobey
# Copyright (C) 2010 Pierre Mauduit
# Copyright (C) 2010 David Mentré
# Copyright (C) 2010 Maxime Petazzoni
# Copyright (C) 2010 Thomas Petaz... | dittaeva/ocitysmap | ocitysmap2/layoutlib/commons.py | Python | agpl-3.0 | 1,272 | 0.003943 |
"""
AWGs
"""
from atom.api import Atom, List, Int, Float, Range, Enum, Bool, Constant, Str
from Instrument import Instrument
import enaml
from enaml.qt.qt_application import QtApplication
from instruments.AWGBase import AWGChannel, AWG, AWGDriver
from plugins import find_plugins
AWGList = []
# local plugin regi... | rmcgurrin/PyQLab | instruments/AWGs.py | Python | apache-2.0 | 872 | 0 |
# Copyright (c) 2018 Cisco and/or its affiliates.
#
# 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) any later v... | Jorge-Rodriguez/ansible | test/units/modules/network/ftd/test_ftd_configuration.py | Python | gpl-3.0 | 5,145 | 0.002527 |
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com
#
# 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 ... | capturePointer/or-tools | examples/python/nontransitive_dice.py | Python | apache-2.0 | 5,680 | 0.011972 |
# -*- coding: utf-8 -*-
'''
This module (mostly) uses the XenAPI to manage Xen virtual machines.
Big fat warning: the XenAPI used in this file is the one bundled with
Xen Source, NOT XenServer nor Xen Cloud Platform. As a matter of fact it
*will* fail under those platforms. From what I've read, little work is needed
t... | victorywang80/Maintenance | saltstack/src/salt/modules/xapi.py | Python | apache-2.0 | 24,954 | 0.000761 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | frreiss/tensorflow-fred | tensorflow/python/tpu/tpu.py | Python | apache-2.0 | 97,112 | 0.006683 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestViewLog(unittest.TestCase):
def tearDown(self):
frappe.set_user('Administrator')
def test_if_user_is_added(self):
ev = frappe.get_... | vjFaLk/frappe | frappe/core/doctype/view_log/test_view_log.py | Python | mit | 850 | 0.031765 |
# -*- 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):
# Changing field 'Student.student_id'
db.alter_column('publications_stud... | evildmp/arkestra-publications | publications/migrations/0003_auto__chg_field_student_student_id.py | Python | bsd-2-clause | 40,862 | 0.007905 |
# -*- coding: utf-8 -*-
"""Composing task work-flows.
.. seealso:
You should import these from :mod:`celery` and not this module.
"""
from __future__ import absolute_import, unicode_literals
import itertools
import operator
from collections import deque
from copy import deepcopy
from functools import partial as ... | mdworks2016/work_development | Python/20_Third_Certification/venv/lib/python3.7/site-packages/celery/canvas.py | Python | apache-2.0 | 55,734 | 0.000036 |
from Screen import Screen
from Components.ServiceEventTracker import ServiceEventTracker
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.ChoiceList import ChoiceList, ChoiceEntryComponent
from Components.config import config, ConfigSubsection, getConfigListE... | popazerty/e2-dmm | lib/python/Screens/AudioSelectionExtended.py | Python | gpl-2.0 | 9,756 | 0.031673 |
import commonware.log
from datetime import datetime, timedelta
import re
from session_csrf import anonymous_csrf
from django.shortcuts import redirect, render, get_object_or_404
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import CreateView, ... | softak/webfaction_demo | apps/stores/views.py | Python | bsd-3-clause | 11,025 | 0.004535 |
from docs import *
| cyphactor/lifecyclemanager | extra/plugins/docs/docs/__init__.py | Python | gpl-3.0 | 20 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-resource-manager | samples/generated_samples/cloudresourcemanager_v3_generated_tag_keys_get_tag_key_async.py | Python | apache-2.0 | 1,477 | 0.000677 |
from __future__ import division
from pyvx import *
from array import array
class TestDiv(object):
def test_div(self):
g = Graph()
with g:
img = Image(3, 4, DF_IMAGE_U8, array('B', range(12)))
sa1 = img / 2
sa2 = img // 2
sa1.force()
sa2.fo... | hakanardo/pyvx | old/test/test_truediv.py | Python | mit | 494 | 0.002024 |
from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.test import TestCase
# Create your tests here.
from portfolio.apps.core.models import User
class UserModelTests(TestCase):
def test_admin_user_exist(self):
sel... | i404ed/portfolio-dir | portfolio/apps/core/tests.py | Python | gpl-3.0 | 697 | 0.002869 |
import sys
import string
import re
import os
input_file = open(sys.argv[1])
prev_value = int(0)
true = 1
while true:
input_line = input_file.readline()
if input_line == "":
break
input_line = re.sub('#line.*','',input_line)
input_line = re.sub('# [0-9].*','',input_line)
print input_line
| ucolesanti/tinyos-wrappers | support/sdk/python/pynopath.py | Python | bsd-3-clause | 296 | 0.037162 |
#! /usr/bin/python
import threading
import socket
import sys,time
import SocketServer,struct,select
global bufLen
global endflag
global socksPort
###################
socksPort = 50000 #Default socks5 proxy port
###################
endflag = []
bufLen = 4*1024
class startThreadSoket(threading.Thread):
def __init_... | 0ps/reprocks | client/reprocks_client.py | Python | mit | 9,685 | 0.010532 |
import hashlib
import mimetypes
import os
import posixpath
import re
from time import time
from urlparse import urlsplit, urlunsplit
from werkzeug.exceptions import NotFound
from werkzeug.http import is_resource_modified, http_date
from spa.static.handlers import StaticHandler
from spa.utils import clean_path
class... | pawpro/spa | spa/static/hashed.py | Python | bsd-3-clause | 8,271 | 0.000484 |
# All Rights Reserved 2020
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | openstack/tap-as-a-service | neutron_taas/tests/unit/taas_client/osc/test_osc_tap_flow.py | Python | apache-2.0 | 9,088 | 0 |
#!/usr/bin/env python
"""
Process meme.txt files to
generate conservation plots
"""
import argparse
import csv
import sys
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
from Bio import motifs
def plot_meme_against_phylo(meme_record, phylo):
sns.set(s... | saketkc/bio-tricks | meme_parser/meme_processory.py | Python | mit | 2,759 | 0.007249 |
from django.conf.urls import patterns, include, url
from volunteers import views
urlpatterns = patterns('',
#url(r'^$', views.index, name='volunteer_index'),
#url(r'^(?P<volunteer_id>\d+)/$', views.volunteer_detail, name='volunteer_detail'),
#url(r'^AddTasks/$', views.add_tasks, name='add_tasks'),
#url... | cateee/fosdem-volunteers | volunteers/urls.py | Python | agpl-3.0 | 403 | 0.027295 |
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise, fulfill_after, fulfill_before
class OpenResponsePage(PageObject):
"""
Open-ended response in the courseware.
"""
@property
def name(self):
return "lms.open_response"
@property
def requirejs(sel... | mjg2203/edx-platform-seas | common/test/bok_choy/edxapp_pages/lms/open_response.py | Python | agpl-3.0 | 7,752 | 0.001806 |
#!/usr/bin/env python
#-*-coding=utf-8-*-
| rockyzhengwu/mlpractice | algorithm/perceptron.py | Python | mit | 44 | 0.045455 |
# TODO: use a unit-testing library for asserts
# invoke with:
# ./pox.py --script=tests.topology.topology topology
#
# Maybe there is a less awkward way to invoke tests...
from pox.core import core
from pox.lib.revent import *
topology = core.components['topology']
def autobinds_correctly():
topology.listenTo(c... | sstjohn/pox | tests/topology/topology.py | Python | gpl-3.0 | 423 | 0.014184 |
VERSION = "0.12beta4"
VERSION_NAME = "Anderssen"
| btrent/knave | pychess/__init__.py | Python | gpl-3.0 | 49 | 0 |
f = raw_input('filename: ')
def make_word_dict(f):
"""
Read the file f and, store each word as dictionary key.
Values are not important.
Return the dictioonary.
"""
c = open(f)
d = dict()
i = 0
for word in c:
w = word.strip('\n\r')
d[w] = i
i += 1
#l... | sokolowskik/Tutorials | ThinkPython/chap11/ex10.py | Python | mit | 980 | 0.006122 |
#
# Vortex OpenSplice
#
# This software and documentation are Copyright 2006 to TO_YEAR ADLINK
# Technology Limited, its affiliated companies and licensors. All rights
# reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | PrismTech/opensplice | src/api/dcps/python/test/TestSequence.py | Python | gpl-3.0 | 2,566 | 0.005456 |
import json
import unittest
import mock
from django.http import HttpResponseBadRequest
from base import (assert_auth_CREATE, assert_auth_READ, assert_auth_UPDATE, assert_auth_DELETE,
assert_auth_EXECUTE)
from pulp.server.exceptions import InvalidValue, MissingResource, MissingValue, OperationPostpon... | ulif/pulp | server/test/unit/server/webservices/views/test_consumer_groups.py | Python | gpl-2.0 | 24,673 | 0.003364 |
#!/usr/bin/env python3
# coding: utf-8
import io
from setuptools import setup, find_packages
# http://blog.ionelmc.ro/2014/05/25/python-packaging/
setup(
name="tfgraph",
version="0.2",
description="Python's Tensorflow Graph Library",
author="garciparedes",
author_email="sergio@garciparedes.me",
url="http... | tfgraph/tfgraph | setup.py | Python | apache-2.0 | 1,296 | 0 |
import pyglet
import util
class PhysicalObject(pyglet.sprite.Sprite):
"""A sprite with physical properties such as velocity"""
def __init__(self, *args, **kwargs):
super(PhysicalObject, self).__init__(*args, **kwargs)
# Velocity
self.velocity_x, self.velocity_y = 0.0, 0.0
# ... | Akagi201/learning-python | pyglet/mygame/game/physicalobject.py | Python | mit | 2,456 | 0.000814 |
# -*- coding: utf-8 -*-
from django.core.cache import cache
from django.shortcuts import render
from django.http import Http404
from styleguide.utils import (Styleguide, STYLEGUIDE_DIR_NAME,
STYLEGUIDE_DEBUG, STYLEGUIDE_CACHE_NAME,
STYLEGUIDE_ACCESS)
def in... | andrefarzat/django-styleguide | styleguide/views.py | Python | mit | 897 | 0 |
from template.test import TestCase, main
class MacroTest(TestCase):
def testMacro(self):
config = { "INCLUDE_PATH": "test/src",
"TRIM": 1,
"EVAL_PYTHON": True }
self.Expect(DATA, config, self._callsign())
DATA = r"""
-- test --
[% MACRO foo INCLUDE foo -%]
foo: [% foo %]
foo(... | aifeiasdf/Template-tookit | t/macro_test.py | Python | artistic-2.0 | 2,554 | 0.002741 |
"""add vendor, opportunity, category models
Revision ID: 29562eda8fbc
Revises: 3473ff14af7e
Create Date: 2015-05-28 02:31:47.039725
"""
# revision identifiers, used by Alembic.
revision = '29562eda8fbc'
down_revision = '3473ff14af7e'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands a... | CityofPittsburgh/pittsburgh-purchasing-suite | migrations/versions/29562eda8fbc_add_vendor_opportunity_category_models.py | Python | bsd-3-clause | 3,927 | 0.012478 |
#!/usr/bin/python3
# Example using a character LCD connected to a Raspberry Pi or BeagleBone Black.
import time
import datetime
import Adafruit_CharLCD as LCD
def file_get_contents(filename):
with open(filename) as f:
return f.read()
# Raspberry Pi pin configuration:
lcd_rs = 24 # Note this might ... | mhkyg/OrangePIStuff | lcd/lcd_update.py | Python | mit | 1,190 | 0.012605 |
#!/usr/bin/env python
# coding: utf-8
#
# Copyright 2010 Alexandre Fiori
# based on the original Tornado by Facebook
#
# 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.... | shirk3y/cyclone | demos/helloworld/helloworld.py | Python | apache-2.0 | 1,114 | 0 |
#!/usr/bin/env python
'''
xtreme Rat Config Decoder
'''
__description__ = 'xtreme Rat Config Extractor'
__author__ = 'Kevin Breen http://techanarchy.net http://malwareconfig.com'
__version__ = '0.1'
__date__ = '2014/04/10'
#Standard Imports Go Here
import os
import sys
import string
from struct import unpack
from op... | 0x0mar/RATDecoders | Xtreme.py | Python | gpl-3.0 | 10,565 | 0.030951 |
from __future__ import absolute_import
from . import TypeSlots
from .ExprNodes import not_a_constant
import cython
cython.declare(UtilityCode=object, EncodedString=object, BytesLiteral=object,
Nodes=object, ExprNodes=object, PyrexTypes=object, Builtin=object,
UtilNodes=object)
from . imp... | ABcDexter/cython | Cython/Compiler/Optimize.py | Python | apache-2.0 | 169,504 | 0.004501 |
"""Views for the ``event_rsvp`` app."""
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseRedirect
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views.generic import (
... | bitmazk/django-event-rsvp | event_rsvp/views.py | Python | mit | 8,144 | 0.000491 |
#
# Copyright (c) Elliot Peele <elliot@bentlogic.net>
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program is distributed in the hope that it... | elliotpeele/pyramid_oauth2_provider | pyramid_oauth2_provider/models.py | Python | mit | 6,539 | 0 |
import numpy as np
from ..utils import check_random_state
class ChainWorld(object):
def __init__(self, left_length, left_reward, right_length, right_reward, on_chain_reward, p_return_to_start, random_state=None):
self.left_length = left_length
self.left_reward = left_reward
self.right_lengt... | dustinvtran/bayesrl | bayesrl/environments/chainworld.py | Python | mit | 1,441 | 0.002082 |
#### 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 = Building()
result.template = "object/building/poi/shared_tatooine_hutt_assassin_camp_large1.iff"
result.attribute... | obi-two/Rebelion | data/scripts/templates/object/building/poi/shared_tatooine_hutt_assassin_camp_large1.py | Python | mit | 465 | 0.047312 |
"""Preprocessing with artifact detection, SSP, and ICA."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Matti Hämäläinen <msh@nmr.mgh.harvard.edu>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
# Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD-3-Clause
from .annot... | wmvanvliet/mne-python | mne/preprocessing/__init__.py | Python | bsd-3-clause | 1,572 | 0 |
from .hub import Hub
class Client(object):
def __init__(self, mac):
self.__mac__ = mac
def hub(self, hub):
return Hub(self.__mac__, hub)
| fancl20/pili-python | pili/client.py | Python | mit | 163 | 0.006135 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import logging
from time import sleep
from sanji.core import Sanji
from sanji.connection.mqtt import Mqtt
REQ_RESOURCE = "/system/firmware"
class View(Sanji):
# This function will be executed after registered.
def run(self):
for count in xrange(0, 10... | Sanji-IO/sanji-firmware | tests/test_e2e/view_firmware.py | Python | gpl-2.0 | 4,216 | 0 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | chemelnucfin/tensorflow | tensorflow/python/autograph/impl/api_test.py | Python | apache-2.0 | 30,339 | 0.008141 |
import os
from conan.tools.files.files import save_toolchain_args
from conan.tools.gnu import Autotools
from conans.test.utils.mocks import ConanFileMock
from conans.test.utils.test_files import temp_folder
def test_source_folder_works():
folder = temp_folder()
os.chdir(folder)
save_toolchain_args({
... | conan-io/conan | conans/test/unittests/tools/gnu/autotools_test.py | Python | mit | 857 | 0.002334 |
from controlscript import *
print "This is a simple control script. It just does nothing and exits successfully."
print "Start parameter is %s, additional parameters are %s" % (start, arguments)
class DoNothing(ControlAction):
""" Control script action for exiting with error 1 on stop """
def __init__(self):
Cont... | remybaranx/qtaste | Testbeds/ControlScripts/do_nothing.py | Python | gpl-3.0 | 507 | 0.027613 |
import re
import Queue
import HTMLParser
import dateutil.parser as parser
class TwitterData:
#Twitter Datum properties
tweet_fields_list = ['id', 'user_id', 'in_reply_to_status_id', 'in_reply_to_user_id', 'favorited', 'retweeted', 'retweet_count', 'lang', 'created_at']
tweet_text_fields_list = ['tweet_id... | kuzeko/Twitter-Importer | twitter_helper/twitter_data.py | Python | mit | 8,560 | 0.002921 |
from __future__ import absolute_import
import os
from celery import Celery
from django.conf import settings
from celery.schedules import crontab
from sendit.settings import (
INSTALLED_APPS,
BROKER_URL
)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sendit.settings')
app = Celery('sendit',broker=BROKER_URL)... | pydicom/sendit | sendit/celery.py | Python | mit | 512 | 0.001953 |
# encoding: utf-8
from django.db import models
from gemeinde import settings
from mezzanine.generic.fields import KeywordsField
from mezzanine.pages.models import Page
from pytz import timezone
# from django.utils.timezone import activate
# activate()
class Gottesdienst(models.Model):
u"""Repräsentiert einen Gott... | jammon/gemeinde | gottesdienste/models.py | Python | mit | 2,564 | 0.007419 |
from django.http import HttpResponse
from django.template import Template
def admin_required_view(request):
if request.user.is_staff:
return HttpResponse(Template('You are an admin').render({}))
return HttpResponse(Template('Access denied').render({}))
| bfirsh/pytest_django | tests/views.py | Python | bsd-3-clause | 270 | 0.003704 |
#!/usr/bin/env python
"""
Copyright (c) 2013-2014 Ben Croston
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, modify, mer... | NeoBelerophon/Arietta.GPIO | test/test.py | Python | mit | 18,250 | 0.003671 |
from setuptools import setup, find_packages
model_blocks = __import__('model_blocks')
readme_file = 'README.rst'
try:
long_description = open(readme_file).read()
except IOError, err:
sys.stderr.write("[ERROR] Cannot find file specified as "
"``long_description`` (%s)\n" % readme_file)
sys.exit(1)
... | mjumbewu/django-model-blocks | setup.py | Python | bsd-3-clause | 1,497 | 0.008684 |
"""gui systems to manage actions
"""
import os
from sftoolbox.content import ActionContent, PanelContent
from sftoolboxqt import qtgui, qtcore
from sftoolboxqt.tree import PanelsModel, PanelsTreeWidget
class ActionsTreeWidget(qtgui.QTreeWidget):
"""tree widget holding actions
"""
def startDrag(self, dro... | svenfraeys/sftoolbox | sftoolboxqt/editor.py | Python | mit | 4,569 | 0 |
from app import setup
app = setup()
| OniOni/ril | wsgi.py | Python | apache-2.0 | 37 | 0 |
"""
strategies
~~~~~~~~~~
Various strategies.
:copyright: (c) 2013 by Matthias Hummel and Kristoffer Kleine.
:license: BSD, see LICENSE for more details.
"""
from graph import (State, make_walkable, split_into_extended_islands,
split_into_subgraphs, make_flooded)
def get_direction(current, targe... | kkris/wheatley | strategies.py | Python | bsd-3-clause | 10,513 | 0.003044 |
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 26 23:01:44 2014
@author: Jose Capriles
"""
import pygame, Buttons
from pygame.locals import *
#Initialize pygame
pygame.init()
class Button_Test:
def __init__(self):
self.loopFlag = True
self.main()
#Create a display
... | jrcapriles/armSimulator | ButtonTest.py | Python | mit | 1,443 | 0.028413 |
# -*- coding: utf-8 -*-
from enigma import eEnv
from Components.SystemInfo import SystemInfo
from Components.config import config
from os import path, listdir
import xml.etree.cElementTree
from Plugins.Extensions.OpenWebif.__init__ import _
def addCollapsedMenu(name):
tags = config.OpenWebif.webcache.collapsedmenus... | MOA-2011/enigma2-plugin-extensions-openwebif | plugin/controllers/models/config.py | Python | gpl-2.0 | 7,243 | 0.034102 |
from django.conf.urls import url
from . import views
urlpatterns = [
# url(r'^news/([\w-]+)$', views.ListView.as_view(), name='list'),
url(r'^news/$', views.ListView.as_view(), name='list_all'),
url(r'^news/(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
]
| Zex0n/django-simple-cms | news/urls.py | Python | mit | 286 | 0 |
#!/usr/bin/env python
if __name__ == '__main__':
from gevent import monkey
monkey.patch_all()
import redis
import json
import pprint
import argparse
import mturk_vision
import base64
import uuid
import pickle
import time
import databases
from hadoop_parse import scrape_hadoop_jobs
class UnauthorizedException(... | bwhite/picarus | server/jobs.py | Python | apache-2.0 | 9,515 | 0.002207 |
"""Points and related utilities
"""
from ctypes import c_double
from ctypes import cast, POINTER
from shapely.coords import required
from shapely.geos import lgeos, DimensionError
from shapely.geometry.base import BaseGeometry
from shapely.geometry.proxy import CachingGeometryProxy
__all__ = ['Point', 'asPoint']
c... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/shapely/geometry/point.py | Python | agpl-3.0 | 6,390 | 0.002817 |
# Simple script to run required operations to
# 1. Download FASTAs from database
# 2. Copy FASTAs to nextflu directory
# 3. Download titer tables from database
# 4. Copy titer tables to nextflu directory
# Run from base fauna directory with python flu/download_all.py
# Assumes that nextflu/, nextflu-cdc/ and nextflu-cd... | blab/nextstrain-db | download_all.py | Python | agpl-3.0 | 7,407 | 0.006615 |
# Kingsoft Antivirus
# CVE-NOMATCH
import logging
log = logging.getLogger("Thug")
def SetUninstallName(self, arg):
if len(arg) > 900:
log.ThugLogging.log_exploit_event(self._window.url,
"Kingsoft AntiVirus ActiveX",
"Set... | tweemeterjop/thug | thug/ActiveX/modules/Kingsoft.py | Python | gpl-2.0 | 350 | 0 |
# -*- coding: utf-8 -*-
from openerp import http
# class PayrollCancel(http.Controller):
# @http.route('/payroll_cancel/payroll_cancel/', auth='public')
# def index(self, **kw):
# return "Hello, world"
# @http.route('/payroll_cancel/payroll_cancel/objects/', auth='public')
# def list(self, **k... | suhe/odoo | addons/payroll_cancel/controllers/controllers.py | Python | gpl-3.0 | 806 | 0.003722 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | diogocs1/comps | web/addons/note/note.py | Python | apache-2.0 | 8,900 | 0.01 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-09-17 15:22
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('reference_data', '0007_auto_20180809_2053'),
]
operations = [
migrations.CreateModel(... | macarthur-lab/seqr | reference_data/migrations/0008_geneexpression.py | Python | agpl-3.0 | 724 | 0.002762 |
#-------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions ... | enthought/traitsgui | enthought/pyface/dock/dock_sizer.py | Python | bsd-3-clause | 155,245 | 0.020265 |
from django.contrib import admin
from courses.models import Course, Instructor, Page, Enrollment
class CourseAdmin(admin.ModelAdmin):
list_display = ['title', 'instructor', 'language', 'popularity', 'is_public', 'deleted']
prepopulated_fields = {
'slug': ('title', )
}
def queryset(self, request... | Uberlearner/uberlearner | uberlearner/courses/admin.py | Python | mit | 848 | 0.008255 |
import parsley
_grammar = r"""
parse = pair:head (' '+ pair)*:tail -> dict([head] + tail)
pair = ident:i '=' value:v -> (i, v)
ident = <letter letterOrDigit*>
value = string | regex | number | word
string = '"' (escapedChar | ~'"' anything)*:c '"' -> ''.join(c)
| "'" (escapedChar | ~"'" anything)*:c "'" -> ''.... | hamperbot/factoids2 | hamper_factoids/parser.py | Python | mpl-2.0 | 1,049 | 0.000953 |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
# This file is only used if you use `make publish` or
# explicitly specify it as your config file.
import os
import sys
sys.path.append(os.curdir)
from pelicanconf import *
SITEURL = 'http://mpdev.mattew.se'
RELATIVE_URLS = False... | mattew/mattew.github.io-src | publishconf.py | Python | mit | 531 | 0.00565 |
# Copyright (C) 2010 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | cs-au-dk/Artemis | WebKit/Tools/Scripts/webkitpy/layout_tests/layout_package/json_layout_results_generator.py | Python | gpl-3.0 | 7,573 | 0.002377 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['LinearTrend'] , ['Seasonal_DayOfMonth'] , ['SVR'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_LinearTrend_Seasonal_DayOfMonth_SVR.py | Python | bsd-3-clause | 160 | 0.05 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.