text stringlengths 17 737k |
|---|
# coding: utf-8
# maposmatic, the web front-end of the MapOSMatic city map generation system
# Copyright (C) 2009 David Decotigny
# Copyright (C) 2009 Frédéric Lehobey
# Copyright (C) 2009 David Mentré
# Copyright (C) 2009 Maxime Petazzoni
# Copyright (C) 2009 Thomas Petazzoni
# Copyright (C) 2009 Gaël Utard
# ... |
from pyramid.decorator import reify
from contentbase import (
Root,
root,
)
from .schema_formats import is_accession
from pyramid.security import (
ALL_PERMISSIONS,
Allow,
Authenticated,
Deny,
Everyone,
)
def includeme(config):
config.scan(__name__)
def acl_from_settings(settings):
... |
"""Module for getting stats from different monitoring backends.
It currently supports mongodb and there is some previous work on graphite and
dummy, which don't work right now.
From collectd we need stats for cpu, load, memory, network and disks.
Collectd returns these values in the following format:
We return only... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2018 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foun... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (C) 2008-2012 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the... |
#!/usr/bin/env python3
from autobahn.asyncio.websocket \
import WebSocketServerProtocol, WebSocketServerFactory
import logging as lg
import asyncio
import json
import random
import time
import os
import sys
lg.basicConfig(stream = sys.stdout , level = lg.DEBUG)
PROCESSORS_SERVER_IP = '0.0.0.0'
PROCESSORS_SERVER_PO... |
#!/usr/bin/python
# batchrungfortran.py
# Alex Szatmary
# September 8, 2009
# This script takes a raw Fortran file (By raw, I mean not ready to compile,
# having token codes like '$lngx$' present instead of an actual value, like 6.)
# and translates each token to a value set in this file. It does
import os, time, os.... |
#!/usr/bin/env python
# Author: Derrick H. Karimi
# Copyright 2014
# Unclassified
from bbot.Utils import *
from bbot.Strategy import Strategy
from bbot.WarParser import WarParser
from bbot.Data import *
from bbot.Wishlist import *
import math
S = SPACE_REGEX
N = NUM_REGEX
# % of attack strength compared to target ... |
"""Manages retrieving data from our GPSD daemon"""
import threading
import logging
import Queue
import time
import calendar
import re
from gps import *
from skypi.Manager import Event
class GPS(object):
"""Runs a thread for retrieving GPS status and a queue for giving location"""
def __init__(self, pimanager):
# ... |
from .shortcuts import (
define_relationship,
get_relationship,
get_connection,
create_connection,
connection_exists,
connections_from_object,
connections_to_object,
connected_objects,
connected_to_objects,
)
VERSION = (0, 2, 0, 'final', 1)
default_app_config = 'connections.apps.Co... |
"""
flask.ext.restless.views
~~~~~~~~~~~~~~~~~~~~~~~~
Provides the following view classes, subclasses of
:class:`flask.MethodView` which provide generic endpoints for fetching,
creating, updating, and deleting instances of a SQLAlchemy model.
The implementations here are designed to meet the r... |
#!/usr/bin/python2.5
# Copyright 2010 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 or ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from io.base import import_matlab_model, load_thermoDB
from cobra.io import load_json_model, load_yaml_model, read_sbml_model
from optim.variables import BinaryVariable
from thermo.tmodel import ThermoModel
CPLEX = 'optlang-cplex'
GUROBI = 'optlang-gurobi'
GLPK = 'optlan... |
# -*- coding: utf-8 -*-
"""
.. module:: pytfa
:platform: Unix, Windows
:synopsis: Thermodynamic constraints for Flux-Based Analysis of reactions
.. moduleauthor:: pyTFA team
Variable declarations
"""
from ..utils.str import camel2underscores
op_replace_dict = {
' + ': '_ADD_',
' - ': '_SUB_',
' *... |
#!/usr/bin/python
# Author: Disa Mhembere, Johns Hopkins University
# Separated: 10/2/2012
# Plot all .np arrays in a common dir on the same axis & save
# 1 indexed
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import pylab as pl
import numpy as np
import os
import sys
from glob import glo... |
import asyncio
import logging
import aiohttp
from flist.chat import opcode as opcode
logger = logging.getLogger(__name__)
class TransportErrors:
connection_closed = (0, "Websocket: Closed")
connection_error = (-1, "Websocket: Error")
connection_exception = (-2, "Websocket: Exception")
class Connectio... |
from internalapi.api import GlobalApi
from sendmail.mail import SendMail
from page.forms import CallbackSubmit, CallbackUpdate
from models import Callbacks
from flask import render_template, flash, redirect, session, url_for, request, Markup
from app import app, db
import datetime
import requests
@app.route('/callbac... |
from django.shortcuts import get_object_or_404
from django.conf import settings
from django.http import Http404
from xbrowse.analysis_modules.combine_mendelian_families import get_families_by_gene
from xbrowse_server.base.models import Project, Family, Cohort, FamilyGroup, VariantNote, VariantTag, GeneNote
from xbrows... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# fastmat documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 16 16:18:06 2017.
#
# 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
# au... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Extract data from a TSDB profile and write to a text file
Latest version can be found at https://github.com/letuananh/intsem.fx
References:
Python documentation:
https://docs.python.org/
argparse module:
https://docs.python.org/3/howto/argpars... |
#!/usr/bin/env python2
# Copyright 2016 The Fontbakery Authors
#
# 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... |
import threading
import re
from database_client import DatabaseClient
from util import Logger
from qpython import qconnection
from qpython.qcollection import QTable,QKeyedTable
class KdbPlusClient(DatabaseClient):
"""
Kdb+ Client
"""
@classmethod
def parse_condition(cls, condition):
"""
... |
#!/usr/bin/env python2
# Copyright 2016 The Fontbakery Authors
#
# 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... |
from xdict import ltdict
from xdict import utils
from xdict import jprint
import re
import copy
def is_name_index_mirror_dict(name_index_mirror_dict):
'''
>>>
>>> pobj(animd)
{
0: 'size',
1: 'color',
2: 'language',
3: 'expire',
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import subprocess as sp
from functools import partial
import sha
import os
from flask import Flask, request, render_template, send_from_directory, Markup, flash, redirect
from flask.ext.login import LoginManager, login_required, login_user, logout_user
... |
import taxonomy
import pprint
def create_encoding(class_name):
# Sort classes alphabetically
classes = sorted([key for key, value in taxonomy.superclasses.items()])
# Make a 1-of-k array for classes
class_array = [0] * len(classes)
class_array[classes.index(class_name)] = 1
# Big list with a... |
#!/usr/bin/env python
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs semi-automated update testing on a non-rooted device.
This script will help verify that app data is preserved during an upda... |
from bs4 import BeautifulSoup
import requests
from pymongo import MongoClient
from tornado import ioloop, httpclient
import functools
from urllib import quote, urlencode
from datetime import datetime
client = MongoClient('mongodb://localhost:27017/')
db = client.Bro
reviews_db = db.tripadvisor_reviews
place_db = db.tr... |
from random import randint
from flask import Flask, render_template, g, redirect, request, url_for, flash
from app import app, db, models
from .database import *
from .forms import SearchForm
from config import PER_PAGE
@app.route('/')
@app.route('/index/')
def index():
form = SearchForm()
query = 'select max... |
import datetime
import logging
import hashlib
import hmac
import json
import traceback
from app.models import SocialNetworkApp
from app.sync import save_sn_post, publish_idea_cp, save_sn_comment, publish_comment_cp, save_sn_vote, \
delete_post, delete_comment, delete_vote
from app.utils import get... |
import requests
import re
import urllib
from flask import Flask
from flask import jsonify
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return 'SkipBait'
# this is the route to access the meat of the application. you can test it with the following urls.
# since the app consumes the url to ski... |
# Copyright (c) 2014 Rackspace, 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 or agreed to in w... |
#!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage task list'''
import xml.etree.ElementTree as xmlMod
import os, re, math, threading, socket, time, shutil
from usefullFunctions import *
from save import *
from TaskList.Task import *
from TaskList.FileInfo.FileInfo import *
class TaskList:
'''class to mana... |
#!/usr/local/bin/python2.6 -tt
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (... |
"""
An interface that all future preprocessors should inherit from
"""
import os
import re
from errors import *
from .. import Gcode
class Preprocessor(object):
def __init__(self):
pass
def process_file(self, input_path, output_path):
pass
def inputs_are_gcode(self, input_path, output_path):
pass... |
#!/usr/bin/env python
"""
Extract genomic signal labels like Transcription Start Site[tss],
Translational Initiation Site[tis], Splice Sites [don, acc],
Transcription Stop Site[cleave] and Translation Stop Site [cdsstop]
from the genome sequence and annotation file.
The number of positive and negative labels for ea... |
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Olivier Grisel <olivier.grisel@ensta.org>
# Gael Varoquaux <gael.varoquaux@inria.fr>
#
# License: BSD 3 clause
import sys
import warnings
import numbers
from abc import ABCMeta, abstractm... |
"""
Final Project
Adam Pikielny
Roger Danilek
Tank Game
"""
from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame
from tank import Tank
from bullet import Bullet, Explosion
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
class TankGame(App):
def __init__(self, width, height):
super().... |
"""Run an `aiohttp.web.Application` on a local development server. If
:attr:`debug` is set to `True` on the application, the server will automatically
reload when code changes.
::
from aiohttp import web
from aiohttp_utils import run
app = web.Application()
# ...
run(app, app_uri='path.to.module:a... |
# coding: utf-8
from __future__ import unicode_literals
import functools
import itertools
import json
import re
from .common import InfoExtractor
from ..compat import (
compat_etree_Element,
compat_HTTPError,
compat_parse_qs,
compat_str,
compat_urllib_parse_urlparse,
compat_urlparse,
)
from ..... |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_urlencode,
compat_str,
compat_xpath,
)
from ..utils import (
ExtractorError,
find_xpath_attr,
fix_xml_ampersands,
float_or_none,
HEADRequest,
sanitized_Req... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Youtubedlg module responsible for the main app window. """
from __future__ import unicode_literals
import os
import gettext
import wx
from wx.lib.pubsub import setuparg1 #NOTE Should remove deprecated
from wx.lib.pubsub import pub as Publisher
from wx.lib.mixins.li... |
'''
Disable a package so it is hidden from resolves.
'''
from __future__ import print_function
# TEMP COMMENT PLS REMOVE
def setup_parser(parser, completions=False):
parser.add_argument(
"-u", "--unignore", action="store_true",
help="Unignore a package.")
PKG_action = parser.add_argument(
... |
from operator import mul
from django.conf import settings
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from django.db import models
from django.db.models import Max
from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.tim... |
import uuid
import prettytable
from keystoneclient import exceptions
# Decorator for cli-args
def arg(*args, **kwargs):
def _decorator(func):
# Because of the sematics of decorator composition if we just append
# to the options list positional options will appear to be backwards.
func.__... |
import tensorflow as tf
node1 = tf.constant(3.0,tf.float32)
node2 = tf.constant(4.0) # uses the tf.float32 implicitly!
print(node1,node2)
tensor("Const:0", shape=(), dtype=float32)
tensor("Const_1:0", shape=(),dtype=float32)
sess = tf.Session()
print(sess.run([node1,node2]))
node2 = tf.add(node1,node2)
print("node3... |
#!/usr/bin/env python
# Copyright (C) 2010-2011 Hideo Hattori
# Copyright (C) 2011-2013 Hideo Hattori, Steven Myint
# Copyright (C) 2013-2015 Hideo Hattori, Steven Myint, Bill Wendling
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files... |
#!/usr/bin/env python
#
# Copyright (C) 2010-2011 Hideo Hattori
# Copyright (C) 2011-2013 Hideo Hattori, Steven Myint
#
# 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, in... |
"""DistributedObjectAI module: contains the DistributedObjectAI class"""
from direct.directnotify.DirectNotifyGlobal import *
from direct.showbase import PythonUtil
from direct.showbase import DirectObject
from pandac.PandaModules import *
from PyDatagram import PyDatagram
from PyDatagramIterator import PyDatagramIter... |
import os
import sys
from datetime import datetime
from django.conf import settings
from django.db import models
from django.utils.functional import cached_property
from basis.models import PersistentModel, TimeStampModel
from sorl.thumbnail.shortcuts import get_thumbnail
from noetikon.helpers import slugify
from .m... |
import pandas
def iteritemsdeep(dct):
"""
Works like ``dict.iteritems`` but iterate over all descendant items
>>> dct = dict(a=1, b=2, c=dict(d=3, e=4))
>>> sorted(iteritemsdeep(dct))
[(('a',), 1), (('b',), 2), (('c', 'd'), 3), (('c', 'e'), 4)]
"""
for (key, val) in dct.items():
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
'''
Keeps your MPD playlist filled with music you like
Dependencies : python-mpd
pysqlite
'''
import os
import mpd
import random
import sqlite3
import time
import io
import sys
import threading
from socket import error as socketerror
## Config
server = "l... |
from unittest import skip
from datetime import datetime
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.gis.geos import Polygon
from django_fixmystreet.fixmystreet.tests import SampleFilesTestCase
from django_fixmystreet.fixmystreet.models import (
Report, Re... |
# -*- coding: utf-8 -*-
import hashlib
import os
from django.core.files import File
from django.core.files.uploadedfile import UploadedFile
def hash_filename(filename, digestmod=hashlib.sha1,
chunk_size=UploadedFile.DEFAULT_CHUNK_SIZE):
"""
Return the hash of the contents of a filename, u... |
#!/usr/bin/env python
# vim:set ts=8 sw=4 sts=4 et:
# Copyright (c) 2012 Serban Giuroiu
#
# 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 th... |
"""
inputlocator.py - locate input files by name based on the reference folder structure.
"""
import os
import tempfile
__author__ = "Daren Thomas"
__copyright__ = "Copyright 2016, Architecture and Building Systems - ETH Zurich"
__credits__ = ["Daren Thomas"]
__license__ = "MIT"
__version__ = "0.1"
__maintainer__ = "D... |
"""
Defines the ABC for a router.
"""
import abc
import typing
import kyoukai.app
from kyoukai import HTTPRequestContext
class ABCRoute(abc.ABC):
"""
A route is a wrapped coroutine object. It provides utilities that allows Kyoukai to interact with the bare route
command more easily.
:param blueprin... |
import numpy
numpy.random.seed(1)
sdf_sanders15= None #so we can set this up and then use in other tests
#Exact setup from Section 5 of Sanders, Bovy, and Erkal (2015); should reproduce those results (which have been checked against a simulation)
def test_sanders15_setup():
#Imports
from galpy.df import stream... |
#/usr/bin/python
# Ripmaster.tools
# Module containing tools used by Ripmaster
# By Sean Wallitsch, 2013/11/10
"""
Description
-----------
This module contains all the classes that Ripmaster uses to represent the files
and processes on disk.
Classes
-------
AudioTrack
Represents a single audio track within a <... |
#
# File : building.py
# This file is part of RT-Thread RTOS
# COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... |
0426eaf4-2e72-11e5-9284-b827eb9e62be |
efd20b4c-2e71-11e5-9284-b827eb9e62be |
d3f9aee6-2e73-11e5-9284-b827eb9e62be |
9beeef5c-2e73-11e5-9284-b827eb9e62be |
d2b4e262-2e73-11e5-9284-b827eb9e62be |
5c65771c-2e72-11e5-9284-b827eb9e62be |
05f50708-2e72-11e5-9284-b827eb9e62be |
9d2b4f42-2e72-11e5-9284-b827eb9e62be |
79decfa6-2e71-11e5-9284-b827eb9e62be |
0f873a60-2e73-11e5-9284-b827eb9e62be |
de734efe-2e73-11e5-9284-b827eb9e62be |
f3fd0874-2e72-11e5-9284-b827eb9e62be |
1323fc8a-2e73-11e5-9284-b827eb9e62be |
64a7412c-2e71-11e5-9284-b827eb9e62be |
997b8b1a-2e71-11e5-9284-b827eb9e62be |
c249cec4-2e73-11e5-9284-b827eb9e62be |
d2a3985e-2e73-11e5-9284-b827eb9e62be |
9a7b667a-2e71-11e5-9284-b827eb9e62be |
e63f9c42-2e72-11e5-9284-b827eb9e62be |
a58c159e-2e73-11e5-9284-b827eb9e62be |
7ca11f00-2e71-11e5-9284-b827eb9e62be |
756640c4-2e73-11e5-9284-b827eb9e62be |
56558bdc-2e72-11e5-9284-b827eb9e62be |
94efb22c-2e73-11e5-9284-b827eb9e62be |
6e66bc00-2e72-11e5-9284-b827eb9e62be |
6f5b971c-2e71-11e5-9284-b827eb9e62be |
855b0a60-2e72-11e5-9284-b827eb9e62be |
20a4410c-2e74-11e5-9284-b827eb9e62be |
f8272ec0-2e72-11e5-9284-b827eb9e62be |
import argparse
"""
usage: mfh.py [-h] [-c | --client [PORT]] [-u] [-v]
Serve some sweet honey to the ubiquitous bots!
optional arguments:
-h, --help show this help message and exit
-c launch client with on port defined in settings
--client [PORT] port to start a client on
-u, --updater ... |
bb133fba-2e72-11e5-9284-b827eb9e62be |
44145958-2e72-11e5-9284-b827eb9e62be |
6910d3f6-2e74-11e5-9284-b827eb9e62be |
ceb86efe-2e73-11e5-9284-b827eb9e62be |
04a71e7a-2e74-11e5-9284-b827eb9e62be |
# GRPC Node gyp file
# This currently builds the Node extension and dependencies
# This file has been automatically generated from a template file.
# Please look at the templates directory instead.
# This file can be regenerated from the template by running
# tools/buildgen/generate_projects.sh
# Copyright 2015, Googl... |
"""
Startmigration command, version 2.
"""
import sys
import os
import re
import string
import random
import inspect
import parser
from optparse import make_option
from django.core.management.base import BaseCommand
from django.core.management.color import no_style
from django.db import models
from django.db.models.f... |
{
"targets": [
{
"target_name": "lmdb-queue",
"include_dirs" : [
"<!(node -e \"require('nan')\")",
"deps"
],
"dependencies": [
"<(module_root_dir)/deps/lmdb.gyp:lmdb"
],
"sources": [
"src/module.cc",
"src/env.h",
"src/env.cc",
... |
"""
birthday.py
Author: Avery Wallis
Credit: Payton Stearns
Assignment:
Your program will ask the user the following questions, in this order:
1. Their name.
2. The name of the month they were born in (e.g. "September").
3. The year they were born in (e.g. "1962").
4. The day they were born on (e.g. "11").
If the us... |
"""
birthday.py
Author: Emma Supattapone
Credit: Abby Feyrer
Assignment:
Your program will ask the user the following questions, in this order:
1. Their name.
2. The name of the month they were born in (e.g. "September").
3. The year they were born in (e.g. "1962").
4. The day they were born on (e.g. "11").
If the u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.