code stringlengths 1 199k |
|---|
from flask import request
from flask import make_response
from flask import render_template
from siege.service import app, socketio, get_game_manager
from siege.decorators import ensure_player
from siege.views.view_utils import jsonate
from siege.models import Game, Device, Player
@app.route('/game')
@ensure_player
def... |
import unittest
import xml.etree.ElementTree as ET
from lelei import parser as structureparser
class TestSpareType(unittest.TestCase):
def test_spareField(self):
spare_desc = ET.fromstring('<field type="spare" bits="8">woot</field>')
parsed_field = structureparser.parse_field(spare_desc)
sel... |
import argparse
from .. import broker
from . import config
from . import start
def run( args ):
"""Parse command line arguments to poll the inverter.
= INPUTS
- args [str]: List of command line arguments. [0] should be the
program name.
"""
p = argparse.ArgumentParser( prog=args[0],
... |
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""
Test file created by XlsxWriter against a file created by Excel.
"""
def setUp(self):
self.set_filename('fit_to_pages02.xlsx')
self.ignore_files =... |
'''Autogenerated by get_gl_extensions script, do not edit!'''
from OpenGL import platform as _p, constants as _cs, arrays
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_ARB_sync'
def _f( function ):
return _p.createFunction( function,_p.GL,'GL_ARB_sync',False)
_p.unpack_constants( """GL_MAX_SERVER_W... |
"""Parallel workflow execution via Condor
"""
import os
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
from nipype.interfaces.base import CommandLine
from time import sleep
class CondorPlugin(SGELikeBatchManagerBase):
"""Execute using Condor
This plugin doesn't work with a plain stock-Co... |
from numpy.testing import assert_almost_equal, TestCase
import numpy as np
from nipy.neurospin.glm.glm import glm
class TestFitting(TestCase):
def make_data(self):
dimt = 100
dimx = 10
dimy = 11
dimz = 12
self.y = np.random.randn(dimt, dimx, dimy, dimz)
X = np.array([... |
from publication_linker.models import *
from django.contrib import admin
admin.site.register(Author)
admin.site.register(Article)
admin.site.register(Journal) |
import sys
import os
from requests import session
def LogConsole(arg):
print("%s" % arg)
import json
class Base:
def login(self, username, password):
print '======================================================================'
#
# login
#
payload = {
'username': username,
'password... |
'''
The dataio module is responsible for loading input files and saving
models to the disk as pandas frames.
'''
from __future__ import division, print_function
from tribeflow.mycollections.stamp_lists import StampLists
from collections import defaultdict
from collections import OrderedDict
import numpy as np
import pa... |
from __future__ import unicode_literals
__author__ = 'ego'
import MySQLdb
import re
import time
import warnings
import six
try:
from collections import OrderedDict
except ImportError:
from django.utils.datastructures import SortedDict as OrderedDict # Python < 2.7
from datetime import datetime, date
try:
im... |
from dash.orgs.views import OrgObjPermsMixin, OrgPermsMixin
from smartmin.views import SmartCRUDL, SmartListView, SmartReadView, SmartTemplateView
from django.http import HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404
from casepro.msg_board.models import MessageBoardComment
from casepro.utils... |
from __future__ import absolute_import, unicode_literals
from dash.orgs.views import OrgPermsMixin
from django.utils.translation import ugettext_lazy as _
from smartmin.views import SmartTemplateView
from tracpro.baseline.charts import chart_baseline
from tracpro.baseline.forms import BaselineTermFilterForm
from tracpr... |
from django.db import models
"""
Representa las opciones de estados que tiene cada normativa jurisdiccional
"""
class EstadoNormativaJurisdiccional(models.Model):
NO_VIGENTE = u'No vigente'
VIGENTE = u'Vigente'
nombre = models.CharField(max_length = 50, unique = True)
class Meta:
app_label = 'ti... |
import os
import sys
from distutils.version import StrictVersion
import django
django_version_string = django.get_version()
if django_version_string.startswith('2.0.dev'):
DJANGO_VERSION = StrictVersion('2.0')
else:
DJANGO_VERSION = StrictVersion(django.get_version())
DJANGO_20 = StrictVersion('2.0')
DJANGO_11 ... |
import sys
from django import forms
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import get_resolver
from django.shortcuts import render_to_response, render
from django.template import Context, RequestContext, TemplateDoesNotExist
from django.views.debug import technical_500_... |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
BTN_PIN = 11
LED_PIN = 12
WAIT_TIME = 200
status = GPIO.LOW
GPIO.setup(BTN_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(LED_PIN, GPIO.OUT, initial=status)
def mycallback(channel):
print("Button pressed @", time.ctime())
global status
if status == GP... |
import setuptools
setuptools.setup(
name="dbfeeder",
version="0.1.0",
url="https://github.com/elgleidson/dbfeeder",
author="Gleidson Echeli",
author_email="el.gleidson@gmail.com",
description="A data generator for relational databases",
long_description=open('README.rst').read(),
package... |
from rest_framework import viewsets
from tag.api.v1.serializers import TreeTagSerializer, TagSerializer
from tag.models import Tag, TreeTag
class ReadOnlyTreeTagViewSet(viewsets.ReadOnlyModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = TreeTag.objects.all()
ser... |
"""
Analytic solution wave equation 2D for free space.
Using cylindrical coordinates for a free a space medium homogeneous of
velocity **$v$**. If the observer is at a **$\rho$** distance from the source.
The analytical solution is written from the frequency domain solution as:
math::
U(\rho, t) = \frac{1}{2\pi}\in... |
class VirtTechClass:
VIRT_TECH_TYPE_XEN = "xen"
VIRT_TECH_CHOICES = (
(VIRT_TECH_TYPE_XEN, 'XEN'),
)
@staticmethod
def validateVirtTech(value):
for tuple in VirtTechClass.VIRT_TECH_CHOICES:
if value in tuple:
return
raise Exception("Virtualization Type not valid")
class OSDistClass():
OS_DIST_TYPE_DE... |
"""Fichier contenant le paramètre 'vider' de la commande 'groupe inclus'."""
from primaires.interpreteur.masque.parametre import Parametre
class PrmInclusVider(Parametre):
"""Commande 'groupe inclus vider'.
"""
def __init__(self):
"""Constructeur du paramètre"""
Parametre.__init__(self, "vid... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Fisher'] , ['Lag1Trend'] , ['Seasonal_DayOfMonth'] , ['SVR'] ); |
__author__ = 'Konstantin Dmitriev'
from renderchan.module import RenderChanModule
from renderchan.utils import which
import subprocess
import os
import random
class RenderChanFfmpegModule(RenderChanModule):
def __init__(self):
RenderChanModule.__init__(self)
if os.name == 'nt':
self.conf... |
import glob
import os
import subprocess
import sys
from telemetry.internal.platform import profiler
_PGOSWEEP_EXECUTABLE = 'pgosweep.exe'
class WinPGOProfiler(profiler.Profiler):
"""A profiler that run the Visual Studio PGO utility 'pgosweep.exe' before
terminating a browser or a renderer process.
TODO(sebmarchan... |
"""
GitHub OAuth support.
This contribution adds support for GitHub OAuth service. The settings
GITHUB_APP_ID and GITHUB_API_SECRET must be defined with the values
given by GitHub application registration process.
Extended permissions are supported by defining GITHUB_EXTENDED_PERMISSIONS
setting, it must be a list of v... |
"""Tests whether the given file contains valid DNA nucleotide sequences.
Exits with exit code 0 if file checks out; exit code 1 if not."""
import re;
import csv;
import sys;
nuc_re = re.compile("^[aAcCgGtT]*$");
def is_nucleotide_sequence(possible_seq):
"""Tests argument to see if it is a valid DNA nucleotide seque... |
# -*- coding: utf-8 -*-
import logging
import sys
import klarna
from klarna.const import *
from Acquisition import aq_inner
from zope.component import getMultiAdapter
from zope.i18nmessageid import MessageFactory
from Products.Five import BrowserView
from zope.component import getUtility
from plone.registry.interfa... |
import argparse
import base64
import h5py
import lmdb
import logging
import numpy as np
import PIL.Image
import os
import sys
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import digits.config... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Route',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False,... |
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import models
from django.dispatch import receiver
from django.contrib.sites.models import Site
import multisitesutils
from .managers import SiteManager, SingletonSiteManager
class SiteModel(models.Model):
""" Abstract mod... |
from scipy.sparse import csr_matrix, isspmatrix_csr
from scipy.sparse import triu, tril, spdiags, eye
from scipy.sparse.linalg import LinearOperator
from numpy import zeros, dot
import splinalg
__docformat__ = "restructuredtext en"
__all__ = ['lusolve']
def lusolve(L,U,r):
"""
M z = r
L U z = r
... |
import os
import sys
import re
optrs_version = '1.0.4'
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
readme = 'OpticalRS is a free and open source Python implementation of passive optical remote sensing methods for the derivation of bathymetric maps and ma... |
""" test where we are determining what we are grouping, or getting groups """
import numpy as np
import pytest
import pandas as pd
from pandas import (
CategoricalIndex,
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
from pandas.core.groupby.group... |
import xadmin
from xadmin import views
from models import IDC, Host, MaintainLog, HostGroup, AccessRecord
from xadmin.layout import Main, TabHolder, Tab, Fieldset, Row, Col, AppendedText, Side
from xadmin.plugins.inline import Inline
from xadmin.plugins.batch import BatchChangeAction
class MainDashboard(object):
wi... |
"""
Application settings
"""
import time
import os
import logging
import sas.sasview
__appname__ = "SasView"
__version__ = sas.sasview.__version__
__build__ = sas.sasview.__build__
__download_page__ = 'https://github.com/SasView/sasview/releases'
__update_URL__ = 'http://www.sasview.org/latestversion.json'
__EVT_DE... |
import os
import sys
import codecs
import platform
from pkg_resources import parse_version
try:
from setuptools import setup, find_packages, Command
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages, Command
import repchan as distmeta
if... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 30, transform = "Integration", sigma = 0.0, exog_count = 0, ar_order = 0); |
import pytest
import numpy as np
import pandas.testing as pdt
from tardis.visualization.widgets.shell_info import (
BaseShellInfo,
SimulationShellInfo,
HDFShellInfo,
ShellInfoWidget,
)
@pytest.fixture(scope="class")
def base_shell_info(simulation_verysimple):
return BaseShellInfo(
simulation... |
class TestWorkflow(object):
components = (
{
'name': u'global',
},
)
task_types = (
{
'name': u'task',
'order': 1,
},
)
priorities = (
{
'name': u'minor',
'order': 1,
},
)
statuses = (... |
"""
0.0.0 - Starting from old version. Some features may not be working. My
idea is to implement each of the scripts as a bin to be
installed using setup.py and the entry_points keyword.
0.1.0 - xjoin was released again. It is working and installed using
entry_poi... |
"""
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Test the render_pictures binary.
"""
import copy
import json
import os
import shutil
import tempfile
import fix_pythonpath # pylint: disable=W0611
import base_unittest
import find_run_binary... |
from inspect import getargspec
from django import template
from django.template import TemplateSyntaxError, Variable
def simple_decorator(decorator):
"""This decorator can be used to turn simple functions
into well-behaved decorators, so long as the decorators
are fairly simple. If a decorator expects a function an... |
OAC = False
try:
from oac.models import Institution
from oac.models import get_institutions_for_user
OAC = True
except ImportError:
from collection_record.models import PublishingInstitution
pass
if not OAC:
class CollectionRecordPermissionBackend(object):
'''Reject all requests if not i... |
import hashlib
import hmac
import os
import urllib
import postmark
import requests
from postmark_inbound import PostmarkInbound
from raven.contrib.flask import Sentry
from flask import Flask, request, render_template, redirect
SERVICE_EMAIL = os.environ.get('SERVICE_EMAIL')
POSTMARK_KEY = os.environ.get('POSTMARK_KEY')... |
import os, sys
import django.core.handlers.wsgi
os.environ['DJANGO_SETTINGS_MODULE']= 'broke.settings'
application = django.core.handlers.wsgi.WSGIHandler() |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import unicode_literals, absolute_import
import copy
import json
import koji
import os
import time
import logging
from tempfile... |
from django.contrib import admin
from django.db.models import Count
from poradnia.stats.models import Graph, Item, Value
@admin.register(Item)
class ItemAdmin(admin.ModelAdmin):
"""
Admin View for Item
"""
list_display = [
"name",
"key",
"description",
"last_updated",... |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
orm.ActionCluster.objects.all().update(is_approved=True)
def bac... |
"""
Support for rolls, leave and join events (i.e. Roll Call).
"""
from __future__ import absolute_import
import datetime
import pmxbot
from . import storage
from . import logging
from pmxbot.core import on_join, on_leave
class ParticipantLogger(storage.SelectableStorage):
"Base class for logging participants"
@class... |
import json
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.http import Http404
from django.template.defaultfilters import filesizeformat
from django.urls import reverse
from django.utils.decorators import method... |
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from progressbar import ProgressBar, SimpleProgress
import os, sys, subprocess
from django.conf import settings
from emma.core.metadata import Metadata
class Command(BaseCommand):
"""
Migrates keywords from the IP... |
from __future__ import absolute_import
import os
import sys
import struct
import uuid
from itertools import chain
try:
from collections.abc import Mapping
except ImportError:
from collections import Mapping
import uproot_methods.convert
import uproot3.const
import uproot3.source.file
import uproot3.write.compre... |
import os
import uuid
from rest_framework import serializers
from rest_framework.fields import get_component
from rest_framework.compat import smart_text
from rest_framework.reverse import reverse
from tastypie.bundle import Bundle
from tower import ugettext_lazy as _
import waffle
from django.conf import settings
from... |
"""Easy I/O with resources stored on disk and visual editing.
Use the :meth:`~klampt.io.resource.get`,
:meth:`~klampt.io.resource.set`, and
:meth:`~klampt.io.resource.edit` functions to retrieve / store / edit
resources dynamically.
:meth:`~klampt.io.resource.load` and :meth:`~klampt.io.resource.save` launch
a file bro... |
import os
import sys
import django
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
USE_TZ = True
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',... |
import pytest
import datetime
import pytz
from traitlets import TraitError
from ..widget_datetime import NaiveDatetimePicker
def test_time_creation_blank():
w = NaiveDatetimePicker()
assert w.value is None
def test_time_creation_value():
t = datetime.datetime.today()
w = NaiveDatetimePicker(value=t)
... |
from __future__ import with_statement
import codecs
import os
import posixpath
import shutil
import sys
import tempfile
from StringIO import StringIO
from django.template import loader, Context
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import... |
import json
import os
import shutil
import sys
import tempfile
import unittest
import logging
import mock
from py_utils import cloud_storage
from py_utils.constants import exit_codes
from telemetry import benchmark
from telemetry.core import exceptions
from telemetry.core import util
from telemetry.internal.actions imp... |
from django.contrib import admin
from olympia.translations.templatetags.jinja_helpers import truncate
from .models import CannedResponse, EventLog, ReviewerScore
class CannedResponseAdmin(admin.ModelAdmin):
def truncate_response(obj):
return truncate(obj.response, 50)
truncate_response.short_description... |
"""
This file has been copied from clint on github, until an actual release contains
this functionality
"""
from re import match, I
def yn(prompt, default='y', batch=False):
# A sanity check against default value
# If not y/n then y is assumed
if default not in ['y', 'n']:
default = 'y'
# Let's ... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import tornado.web
from pkg_resources import resource_filename as rs_fn
import ujson
import pymongo.cursor
SCHEMA_PATH = 'schemas'
SCHEMA_NAMES = {'analysis_header': 'analysis_header.json',
'anal... |
"""
Created on Thu Oct 20 20:00:40 2016
III - stage detector provided by Tomasso Fedele.
Reprogrammed to python by Jan Cimbalnik..
If you use this detector please cite!
Ing.,Mgr. (MSc.) Jan Cimbálník
Biomedical engineering
International Clinical Research Center
St. Anne's University Hospital in Brno
Czech Republic
&
Ma... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("SVC_sigmoid" , "FourClass_10" , "hive") |
from collections import Iterable
import os
import os.path as op
import numpy as np
import xml.etree.ElementTree as ElementTree
from ..viz import plot_montage
from .channels import _contains_ch_type
from ..transforms import (apply_trans, get_ras_to_neuromag_trans, _sph_to_cart,
_topo_to_sph, _s... |
from datetime import datetime
from uuid import uuid4
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
class SupportGroup(models.Model):
name = models.CharField(_("name"), max_length=255)
agents = ... |
"""Package for analyzing stock returns using the CAPE framework from Robert Shiller."""
from .reader import read_ie_data
from .returns import BondHoldToMaturityReturns, Inflation, StockReturns, WaitingReturns
from .analysis import Cape, CapeNeighborsEstimator, WarrantedReturns
from .ui import UiData
__author__ = 'Chand... |
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
..... |
"""Functions for discovering and executing various cookiecutter hooks."""
import errno
import io
import logging
import os
import subprocess
import sys
import tempfile
from cookiecutter import utils
from cookiecutter.environment import StrictEnvironment
from .exceptions import FailedHookException
logger = logging.getLog... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
def regression(file_name, second_index_quality, order):
COLUMN_SEPARATOR = ','
metrics_data = pd.DataFrame.from_csv(file_name, sep=COLUMN_SEPARATOR, header=None)
labels = ['',
'Test Coverage',
'Branch Coverage... |
__author__ = "Tom De Smedt, Frederik De Bleser"
__version__ = "1.5"
__copyright__ = "Copyright (c) 2008-2010 City In A Bottle (cityinabottle.org)"
__license__ = "BSD"
try: import psyco; psyco.profile()
except:
try: from ext import psyco; psyco.profile()
except:
pass
import nodebox |
"""Algorithms for spectral clustering"""
import warnings
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import check_random_state, as_float_array
from ..utils.validation import _deprecate_positional_args
from ..metrics.pairwise import pairwise_kernels
from ..neighbors import kneighbors_g... |
import tests.expsmooth.expsmooth_dataset_test as exps
exps.analyze_dataset("msales.csv" , 2);
exps.analyze_dataset("msales.csv" , 4);
exps.analyze_dataset("msales.csv" , 8);
exps.analyze_dataset("msales.csv" , 12); |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name='pages/home.html'... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "PolyTrend", cycle_length = 7, transform = "Difference", sigma = 0.0, exog_count = 100, ar_order = 0); |
'''
Script for getting all images without duplicates from the csv file.
Date: May 23, 2016
The mapFlName referred to in the entire script is : ../data/imageGID_job_map_expt2_corrected.csv
'''
import BuildConsolidatedFeaturesFile as Features, DataStructsHelperAPI as DS, mongod_helper as mh
import importlib, re, json, p... |
"""Creates the excercise outline."""
import copy
import itertools
import logging
import os
import random
import re
from typing import Callable, Generator, Dict, List, Optional, Set, Union
import yaml
from lilypond_source import get_random_transpose_key, LilySource
LOGGER = logging.getLogger(__name__)
class ContentExcep... |
from pyston.contrib.dynamo.paginator import DynamoCursorBasedPaginator as OriginDynamoCursorBasedPaginator
class DynamoCursorBasedPaginator(OriginDynamoCursorBasedPaginator):
type = 'cursor-based-paginator' |
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Animal.views'
db.add_column(u'animalia_animal', 'views',
self.... |
from .settings import *
from .convert import *
from .versions import * |
"""Plot to test text"""
import matplotlib.pyplot as plt
import numpy as np
def main():
fig, ax = plt.subplots()
ax.grid(color='lightgray')
x = np.linspace(0, 4 * np.pi, 1000)
y1 = 0.5 * np.sin(0.5 * x)
y2 = np.sin(x)
y3 = np.cos(x)
ax.fill(x, y1, alpha=0.3, facecolor='green')
ax.fill_bet... |
"""
ODMTools Console
"""
import wx
from wx.py.crust import CrustFrame, Crust
from wx.py.frame import Frame, ShellFrameMixin
__author__ = 'Jacob'
class ModifiedFrame(Frame):
"""Override standard PyCrust frame in order to remove exit and about page"""
def __init__(self, *args, **kwargs):
Frame.__init_... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _sym... |
import time
from datetime import datetime, date
from stdnet import odm
class CustomManager(odm.Manager):
def small_query(self, **kwargs):
return self.query(**kwargs).load_only('code', 'group')
def something(self):
return "I'm a custom manager"
class SimpleModel(odm.StdModel):
code = odm.Symb... |
import webview
import time
"""
This example demonstrates how to create a topmost webview window.
"""
def deactivate(window):
#window starts on top and is changed later
time.sleep(5)
window.on_top = False
if __name__ == '__main__':
# Create webview window that stays on top of, or in front of, all other w... |
"""
Django template tag for djangocms_maps
"""
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
VIAMICHELIN_LANGUAGE_MAP = {
'cs': 'ces', # Czech
'da': 'dan', # Danish
'de': 'deu', # German
'en': 'eng', # English
'fi': 'fin', # Fi... |
import numpy
from prpy.tsr.tsrlibrary import TSRFactory
from prpy.tsr.tsr import TSR, TSRChain
@TSRFactory('herb', 'plastic_bowl', 'grasp')
def bowl_grasp(robot, bowl, manip=None):
'''
@param robot The robot performing the grasp
@param bowl The bowl to grasp
@param manip The manipulator to perform the g... |
""".."""
from bs4 import BeautifulSoup as Bs
import requests
import traceback
import json
import re
import pandas as pd
import numpy as np
def json2df(fname, year):
with open(fname, "r") as f_in:
orgData = json.load(f_in)
cleanTitles = {}
pattern = "[0-9]+\."
for k, v in orgData.iteritems():
... |
from south.db import db
from django.db import models
from ietf.idtracker.models import *
class Migration:
def forwards(self, orm):
# Adding field 'InternetDraft.shepherd'
db.add_column('internet_drafts', 'shepherd', orm['idtracker.internetdraft:shepherd'])
def backwards(self, orm):
# Del... |
import sys, os
cwd = os.getcwd()
parent = os.path.dirname(cwd)
sys.path.append(parent)
import positions
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'django-publica-positions'
copyright = u'2014, Daryl Antony'
version =... |
"""Configuration variables for controlling specific things in VisTrails."""
import copy
import os.path
import shutil
import sys
import tempfile
import weakref
from core import debug
from core import system
from core.utils import (InstanceObject, Ref, append_to_dict_of_lists,
VistrailsInternalErr... |
from __future__ import absolute_import
import base64
import datetime
import getpass
import logging
import os.path
import socket
import time
from django.conf import settings as django_settings
from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
from djang... |
import six
from json import dumps, loads
from datetime import datetime
EPOCH = datetime.utcfromtimestamp(0)
ADAYINSECONDS = 24 * 3600
try:
from msgpack import Unpacker
MSGPACK_AVAILABLE = True
except ImportError:
MSGPACK_AVAILABLE = False
def jlencode(iterable):
if isinstance(iterable, (dict, six.string... |
"""
Email APIs
Example usage:
recipients = User.objects.all()[:10]
messages = messages_for_recipients([
(recipient, context_for_user(user=user, extra_context={
# per-recipient context here
})) for recipient, user in safe_format_recipients(recipients)
], 'sample')
send_messages(messages)
"""
from email.u... |
import os
import sys
sys.path.append(os.path.dirname(__file__))
from mem import Mem
from mmu import MMU
from alu import ALU
from intvec import IntVec
from stack import Stack
from clock import Clock
__all__ = [ 'ALU',
'Mem',
'MMU',
'IntVec',
'Stack',
'Clock' ] |
from greenlet import greenlet
def test1():
print 12
gr2.switch()
print 34
def test2():
print 56
gr1.switch()
print 78
gr1 = greenlet(test1)
gr2 = greenlet(test2)
gr1.switch() |
"""
pyClanSphere.forms
~~~~~~~~~~~~~~~~~~
The form classes the pyClanSphere core uses.
:copyright: (c) 2009 - 2010 by the pyClanSphere Team,
see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from copy import copy
from operator import itemgetter
from pyCla... |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("DummyClassifier" , "digits" , "postgresql") |
"""Application assets."""
from flask_assets import Bundle, Environment
css = Bundle(
'libs/bootstrap/dist/css/bootstrap.css',
'css/style.css',
filters='cssmin',
output='public/css/common.css'
)
js = Bundle(
'libs/jquery/dist/jquery.js',
'libs/bootstrap/dist/js/bootstrap.js',
'libs/datatables... |
import robot_detection
from ipware.ip import get_ip
from hs_tools_resource.models import RequestUrlBase, RequestUrlBaseAggregation, RequestUrlBaseFile
from urllib.parse import urlparse
def get_client_ip(request):
return get_ip(request)
def get_user_type(session):
try:
user = session.visitor.user
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.