src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaebusiness.business import CommandExecutionException
from tekton import router
from gaecookie.decorator import no_csrf
from lingAngular_app import facade
from routes.lingAngular... |
import numpy
ETA_PLUS = 1.2
ETA_MINUS = 0.5
def stochastic_gradient_descent(function,
derivative,
x, y,
theta=None,
iterations=100,
learning_rate=0.000001,
... |
# Copyright (c) 2017 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... |
#!/usr/bin/env python
#Python for biologists
#03_Sequence Alignment
#Align two DNA fragments
seq1 = "ATCGTGCTAGCTGCATC"
seq2 = "ATCATGCTAGCTGCTTC"
n = 0
seq1L = []
seq2L = []
bondL = []
seq1len = len(seq1)
seq2len = len(seq2)
print(seq1len, seq2len)
#Under condition of one nucleotide mutation (SNP), equal sequence l... |
import argparse
import os
import time
import datetime
import psutil
from datetime import timedelta
from pywinauto import timings
from pywinauto.application import Application
# Default settings
window_name = '- Power BI Desktop'
refresh_rate = '60'
def type_keys(string, element):
for char in string:
ele... |
"""
Created on Feb 28, 2013
@author: paulp
"""
import logging
import struct
import time
import register
import sbram
import snap
import tengbe
import qdr
from attribute_container import AttributeContainer
from utils import parse_fpg
LOGGER = logging.getLogger(__name__)
# known CASPER memory-accessible devices and ... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import json
import urllib2
from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
def geo_find(addr):
if not addr:
return None
url = 'https://maps.googleapis.com/maps/api/g... |
# Copyright (C) 2013 Google Inc.
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd is di... |
#!/usr/bin/env python
import sys
import os
from subprocess import *
if len(sys.argv) <= 1:
print('Usage: %s training_file [testing_file]' % sys.argv[0])
raise SystemExit
# svm, grid, and gnuplot executable files
is_win32 = (sys.platform == 'win32')
if not is_win32:
svmscale_exe = "../svm-scale"
svmtrain_exe = "... |
import mock
import csv
import furl
import pytz
import pytest
from datetime import datetime, timedelta
from nose import tools as nt
from django.test import RequestFactory
from django.http import Http404
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from djang... |
#!/usr/bin/env python
########################################
#Globale Karte fuer tests
# from Rabea Amther
########################################
# http://gfesuite.noaa.gov/developer/netCDFPythonInterface.html
import math
import numpy as np
import pylab as pl
import Scientific.IO.NetCDF as IO
import matplotlib as ... |
#!/usr/bin/env python
"""Py.test doctest custom plugin: setup script."""
import os, setuptools, itertools, ast
BLOCK_START = ".. %s"
BLOCK_END = ".. %s end"
PKG_DIR = os.path.dirname(__file__)
MODULE_FILE = os.path.join(PKG_DIR, "pytest_doctest_custom.py")
with open(os.path.join(PKG_DIR, "README.rst"), "r") as f:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# server.py: receive CSS and JS files from Chrome extension
# and save files locally
#
# Author: Tomi.Mickelsson@iki.fi
# 30.10.2011 - Created
try:
# python 2.x
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
except:
# python 3.x
from http.se... |
"""
WSGI config for gestionale project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION... |
import os
import shutil
from threading import Thread
import urllib
import requests
from tqdm import tqdm
class Internet:
@staticmethod
def write_to_failed_image_urls_file(file_name, image_url, failed_image_urls_file):
"""
Check image in file and write it if need
:param file_name: image... |
#Copyright 2016 EBORE APPS (http://www.eboreapps.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 law or agreed to... |
import logging
import numpy as np
from ray.rllib.utils.annotations import override, PublicAPI
logger = logging.getLogger(__name__)
@PublicAPI
class VectorEnv:
"""An environment that supports batch evaluation.
Subclasses must define the following attributes:
Attributes:
action_space (gym.Space)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# from scipy import stats
# import statsmodels.api as sm
# from numpy.random import randn
import matplotlib as mpl
# import seaborn as sns
# sns.set_color_palette("deep", desat=.6)
mpl.rc("figure", fig... |
# -*- coding: utf-8 -*-
import time
from django.conf import settings
from django.template import Context
from sekizai.context import SekizaiContext
from cms.api import add_plugin, create_page, create_title
from cms.cache import _get_cache_version, invalidate_cms_page_cache
from cms.cache.placeholder import (
_g... |
from __future__ import division
from math import sqrt
def sim_distance(prefs, item1, item2):
#get the list of shared items
si = {};
for item in prefs[item1]:
if item in prefs[item2]:
si[item] = 1;
#if they have no shared items,return 0;
if len(si) == 0: return 0;
#Add the s... |
import numpy as np
from neupy import layers
from neupy.utils import asfloat
from base import BaseTestCase
class EmbeddingLayerTestCase(BaseTestCase):
def test_embedding_layer(self):
weight = np.arange(10).reshape((5, 2))
network = layers.join(
layers.Input(1),
layers.Emb... |
# -*- coding: utf-8 -*-
#
#
# TheVirtualBrain-Framework Package. This package holds all Data Management, and
# Web-UI helpful to run brain-simulations. To use it, you also need do download
# TheVirtualBrain-Scientific Package (for simulators). See content of the
# documentation-folder for more details. See also http:/... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
r"""
==============
smartypants.py
==============
----------------------------
SmartyPants ported to Python
----------------------------
Ported by `Chad Miller`_
Copyright (c) 2004, 2007 Chad Miller
original `SmartyPants`_ by `John Gruber`_
Copyright (c) 2003 John Grube... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# This file is part of Edia.
#
# Ediap is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Edia is distributed in the hope that it will... |
#!/usr/bin/env python
import logging
import copy
import argparse
import StringIO
import hashlib
from Bio import SeqIO
logging.basicConfig(level=logging.INFO)
def dedup(fasta_file, mutation="mutate"):
records = list(SeqIO.parse(fasta_file, "fasta"))
output = StringIO.StringIO()
known_records = {}
ord... |
# Blobtastical
import threading
import logging
import serial
import time
class Port(object):
def __init__(self, dev, baud, parity):
if parity == 'e':
p = serial.PARITY_EVEN
if parity == 'n':
p = serial.PARITY_NONE
if parity == 'o':
p = serial.PARITY_ODD
... |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... |
# Credit: https://github.com/pabluk/twitter-application-only-auth/blob/master/application_only_auth/client.py
import base64
import json
import sys
try:
# For Python 3.0 and later
from urllib.request import urlopen, Request
from urllib.error import HTTPError
except ImportError:
# Fall back to Python 2... |
"""Definition of application object."""
from flask import Blueprint, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
from config import config
db = SQLAlchemy()
# pylint: disable=wrong-import-position
from .app import PmaApiFlask
from .response import QuerySetApiResult
root = Blueprin... |
import asyncio
import json
import aiohttp
from bs4 import BeautifulSoup
from .errors import (CharacterNotFound, FailedToParse, InvalidData,
ServiceUnavialable)
try:
import lxml
parser = 'lxml'
except ImportError:
parser = 'html.parser'
# types of weapons in game
VALID_WEAPONS = ['d... |
# Unix SMB/CIFS implementation.
# backend code for provisioning a Samba AD server
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007-2012
# Copyright (C) Andrew Bartlett <abartlet@samba.org> 2008-2009
# Copyright (C) Oliver Liebel <oliver@itc.li> 2008-2009
#
# Based on the original in EJS:
# Copyright (C) Andrew ... |
import binascii
import flask
import hashlib
import helpers
import json
import os
from prefixes import prefix_userprofile
import pygal_config as config
from pylibs import fstools
import time
basepath = os.path.abspath(os.path.dirname(__file__))
class time_limited_token(dict):
"""
Account erstellung erzeugt nu... |
import json
import os
import textwrap
import re
import sys
BASE_DIR = os.path.dirname(__file__)
# Global defines for the file paths
shaders_path = "shaders/"
shader_builder_class_path = "FileFragments/Shader/ShaderBuilderClass.part"
shader_method_path = "FileFragments/Shader/ShaderMethod.part"
shader_builder_header_... |
#!/usr/bin/python
# TODO - Figure out the best way to convert this to use sync_to_async calls
import os, sys
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
# Let's get sentry support going
from sentry_sdk import init, capture_exception
# This is the sentry queue for Fermentrack
#init('http://3a1cc1f229ae4b0f88a4c6f... |
# Copyright (c) 2015 Mirantis, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... |
# -*- coding: utf-8 -*-
# Recoge el input, ya sea mediante el STT de Google o por el bot de Telegram
import speech_recognition as sr
import time, datetime, telepot, os
from config import get_config
bot = telepot.Bot('BOT_KEY')
def ask():
modo = get_config.get_profile()["modo"]
os.system("aplay resources/sound2.wa... |
import re
import platform
from ajenti.ui import UI
from ajenti.com import *
from ajenti import version
from ajenti.api import ICategoryProvider, EventProcessor, SessionPlugin, event, URLHandler, url, get_environment_vars
from ajenti.ui import BasicTemplate
from ajenti.utils import ConfigurationError
from api import IP... |
from BaseWorker import *
class FlickrWorker(BaseWorker):
key = '391fb6763fe0b5011cf52638067e0fed'
secret = '369f46a112452186'
def __init__(self, parent = None):
super(FlickrWorker, self).__init__(parent)
def run(self):
self.progressSignal.emit(self.stampConfi... |
from __future__ import absolute_import
import sys
import os
import struct
import time
from Cura.util import mesh2
class stlModel(mesh2.mesh):
def __init__(self):
super(stlModel, self).__init__()
def load(self, filename):
f = open(filename, "rb")
if f.read(5).lower() == "solid":
self._loadAscii(f)
if s... |
#vim:set et sts=4 sw=4:
#
# Zanata Python Client
#
# Copyright (c) 2011 Jian Ni <jni@redhat.com>
# Copyright (c) 2011 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; eit... |
#!/usr/bin/env python
import gtk, sys, os
mynumber="5555555555"
calnum=0
fakenum=0
def press(widget):
num = entry.get_text()
pnum = widget.get_label()
entry.set_text(num + pnum)
def send_press(widget):
print("Dialing: " + entry.get_text())
def add_call(widget):
callnum = entry.get_text()
entry.set_text("")
d... |
#!/usr/bin/python
#
# Copyright 2017 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 a... |
# python3
# Copyright 2018 DeepMind Technologies Limited. 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 re... |
#!/usr/bin/env python2
import argparse
import csv
import itertools
import sys
import yaml
def main():
parser = argparse.ArgumentParser(
description='Convert a YAML mapping or sequence of mappings to a CSV'
)
parser.add_argument(
'file',
type=argparse.FileType('r... |
#
# Project: retdec-python
# Copyright: (c) 2015 by Petr Zemek <s3rvac@gmail.com> and contributors
# License: MIT, see the LICENSE file for more details
#
"""Matchers for tests."""
import abc
class Matcher(metaclass=abc.ABCMeta):
"""A base class of all matchers."""
@abc.abstractmethod
def __eq__(se... |
__author__ = 'bromix'
from six import PY2
from ... import kodion
from ...youtube.helper import utils
from ...kodion.items.video_item import VideoItem
def my_subscriptions_to_items(provider, context, json_data, do_filter=False):
result = []
video_id_dict = {}
incognito = str(context.get_param('incognito'... |
#!/usr/bin/env python3
import json, os, sys, logging, time, re
import urllib.request, shutil
from slackclient import SlackClient
if not 2 <= len(sys.argv) <= 3:
print("Usage: {} SLACK_API_TOKEN [SAVE_FOLDER]".format(sys.argv[0]))
print(" SLACK_API_TOKEN Slack API token (obtainable from https://api.slac... |
import pytest
from itertools import combinations
from utils import testgen
from utils.providers import get_crud
from cfme.common.provider import BaseProvider
from cfme.infrastructure.provider import discover, InfraProvider
from cfme.infrastructure.provider.rhevm import RHEVMProvider
from cfme.infrastructure.provider.s... |
import fechbase
class Records(fechbase.RecordsBase):
def __init__(self):
fechbase.RecordsBase.__init__(self)
self.fields = [
{'name': 'FORM TYPE', 'number': '1'},
{'name': 'FILER FEC CMTE ID', 'number': '2'},
{'name': 'NAT PARTY COMMITTEES %', 'number': '3'},
... |
#!/usr/bin/python
import focus_globals as CONFIG
from focus_globals import FILTERS
import fileinput, glob, pickle, pprint, os, re, time
"""
Compute statistics for computer usage and for specific text-based filters
@author cathywu
@created 2011-10-11
"""
# wrapper function to convert ascii string to unicode
def u(str... |
# coding: utf-8
import os
from itertools import repeat
from random import choice, randint
from StringIO import StringIO
from PIL import Image, ImageDraw, ImageFont
def output_character(amount=4, area='alnum'):
'output a string of area of amount'
'area is in alnum, alpha, digit, zh'
if not all([amount > ... |
'''Unit tests for Aronnax'''
from contextlib import contextmanager
import os.path as p
import re
import numpy as np
from scipy.io import FortranFile
import aronnax as aro
from aronnax.utils import working_directory
import pytest
import glob
self_path = p.dirname(p.abspath(__file__))
def test_open_mfdataarray_u_l... |
from csrv.model import actions
from csrv.model import events
from csrv.model import timing_phases
from csrv.model.cards import card_info
from csrv.model.cards import event
class ChooseIce(timing_phases.BasePhase):
"""Choose a piece of ice for card01037."""
def __init__(self, game, player):
timing_phases.Base... |
#!/usr/bin/env python3
import time
import math
import os
import cv2
from collections import namedtuple
from itertools import combinations
import numpy as np
import shm
from vision.modules.base import ModuleBase
from vision.options import IntOption, DoubleOption, BoolOption
from vision import vision_common
options = ... |
##########################################################################
##########################################################################
#
# mongodb-secure
# Copyright (C) 2016, Pedro Alves and Diego Aranha
# {pedro.alves, dfaranha}@ic.unicamp.br
# This program is free software: you can redistribute it an... |
"""Provides functionality to interact with fans."""
from datetime import timedelta
import functools as ft
import logging
from typing import Optional
import voluptuous as vol
from homeassistant.const import SERVICE_TOGGLE, SERVICE_TURN_OFF, SERVICE_TURN_ON
import homeassistant.helpers.config_validation as cv
from home... |
__source__ = 'https://leetcode.com/problems/swap-adjacent-in-lr-string/'
# Time: O(N)
# Space: O(1)
#
# Description: Leetcode # 777. Swap Adjacent in LR String
#
# In a string composed of 'L', 'R', and 'X' characters, like "RXXLRXRXL",
# a move consists of either replacing one occurrence of "XL" with "LX",
# or replac... |
#!/usr/bin/env python
import os
import sys
import time
from epumgmt.sbin import sbin_common
def get_logfiledir(p):
logfiledir = p.get_conf_or_none("logging", "logfiledir")
if not logfiledir:
sys.stderr.write("There is no logfiledir configuration")
return None
return sbin_common.apply_vardi... |
#!/usr/bin/env python
#
# Copyright 2004,2005,2007,2008,2012 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gru
from gnuradio import audio
from gnuradio.eng_arg import eng_float
from argparse import ArgumentParser
import os
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2021 AVSystem <avsystem@avsystem.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/LICEN... |
from aiohttp import web
import traceback
def make_response(status, payload, error):
data = dict(status=status, payload=payload, error=error)
return web.json_response(data=data, status=status)
async def json_middleware(app, handler):
async def middleware_handler(request):
try:
payload... |
import os
import django.conf.global_settings as DEFAULT_SETTINGS
# Automatically figure out the ROOT_DIR and PROJECT_DIR.
DJANGO_PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
ROOT_DIR = os.path.abspath(os.path.join(DJANGO_PROJECT_DIR, os.path.pardir, os.path.pardir))
#
# Stan... |
"""Simple-Salesforce Package Setup"""
from setuptools import setup
import textwrap
import sys
pyver_install_requires = []
pyver_tests_require = []
if sys.version_info < (2, 7):
pyver_install_requires.append('ordereddict>=1.1')
pyver_tests_require.append('unittest2>=0.5.1')
if sys.version_info < (3, 0):
p... |
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
class CodeData(object):
def __init__(self, code, tag, message):
self.code = code
self.message = message
self.tag = tag
def __str__(self):
return str(self.code)
def __eq__(self, other):
if ... |
import requests,json,random
import turtle
appid = 'a98689d8418b0ca737434c67064bb29d'
def coordinates():
send_url = 'http://freegeoip.net/json'
r = requests.get(send_url)
j = json.loads(r.text)
lat = j['latitude']
lon = j['longitude']
return [lat,lon]
def weather_geoloc(coordinates):
glo... |
#!/usr/bin/python
import os
import sys
import time
import glob
import shutil
import argparse
import datetime
import threading
import subprocess
logOnConsole = False
def log(str):
global logOnConsole
if logOnConsole:
print str
def initializeDir(dirname):
if not os.path.isdir(dirname):
os.makedirs(dirname)
log... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2021, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
import requests
from backend.util.response.error import ErrorSchema
def test_order(domain_url, auth_session, es_create, willorders_ws_db_session):
prod_list = es_create("products", 2)
item_id = prod_list[0].meta["id"]
item_id2 = prod_list[1].meta["id"]
auth_session.post(
domain_url + "/api/c... |
"""
"""
import wx
import sys
from copy import deepcopy
from sas.sascalc.dataloader.loader import Loader
from sas.sascalc.dataloader.data_info import Aperture, Collimation
from aperture_editor import ApertureDialog
from sas.sasgui.guiframe.utils import check_float
_BOX_WIDTH = 60
if sys.platform.count("win32") > 0:
... |
#! /usr/bin/python
#
# SIP Watcher
#
# Michael Pilgermann (michael.pilgermann@gmx.de)
# Version 0.1 (2008-10-31)
#
#
#import sys
import pjsua as pj
import WatcherApplet
import threading
import gtk
import thread
# Globals
#current_call = None
acc = None
acc_cb = None
#gui = None
# Callback to receive events from ac... |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... |
# Copyright (c) 2015-2021 Vector 35 Inc
#
# 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, merge, publish, ... |
# -*- coding: utf-8 -*-
""" This module provides the backend Flask server used by psiTurk. """
from __future__ import generator_stop
import os
import sys
import datetime
import logging
from random import choice
import user_agents
import requests
import re
import json
from jinja2 import TemplateNotFound
from collections... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
import django.utils.timezone
def gen_uuid(apps, schema_editor):
UserModel = apps.get_model('users', 'User')
for row in UserModel.objects.all():
row.sfa_token = uuid.uuid4()
row.... |
# Copyright 2012 Nebula, 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... |
from bonobo.util import get_name
class InactiveIOError(IOError):
pass
class InactiveReadableError(InactiveIOError):
pass
class InactiveWritableError(InactiveIOError):
pass
class ValidationError(RuntimeError):
def __init__(self, inst, message):
super(ValidationError, self).__init__(
... |
# Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL 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.
... |
"""
RsyslogConf - file ``/etc/rsyslog.conf``
========================================
The rsyslog configuration files can include statements with two different
line based formats along with snippets of 'RainerScript' that can span
multiple lines.
See http://www.rsyslog.com/doc/master/configuration/basic_structure.htm... |
import os, stat, time, weakref
from allmydata import node
from base64 import urlsafe_b64encode
from zope.interface import implements
from twisted.internet import reactor, defer
from twisted.application import service
from twisted.application.internet import TimerService
from twisted.python.filepath import FilePath
fro... |
import json, time
import flask
from flask import Flask, render_template, send_file, \
jsonify, send_from_directory, request
from flask_socketio import SocketIO, emit
rdb = None
try:
import rethinkdb as rdb
#rdb.connect('localhost', 28015).repl()
conn = rdb.connect(db='test')
except:
... |
# 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 (the
# "License"); you may... |
#! /usr/bin/env python3
# coding: utf-8
'''
Fonctions de manipulation et vérifications du fichier de configuration
'''
import json
import utils.misc as misc
CONF_FILE_NAME = "conf/conf.json"
'''
check_conf_valid: vérifie que le fichier de conf est bien dans un format json valide
entrée: pas d'argument (nom du fich... |
import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
concat,
date_range,
)
import pandas._testing as tm
@pytest.fixture(params=[True, False])
def sort(request):
"""Boolean sort keyword for concat and DataFrame.append."""
return... |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from django.http import JsonResponse
import requests
# Constants
RUN_URL = u'https://api.hackerearth.com/v3/code/run/'
CLIENT_SECRET = 'cd70993ac2dbee9e7c7b2c533a104a7d621632fa'
def home(request):
if request.method ==... |
#!/usr/bin/env python
"""Really lazy webpage - list of files in a directory."""
#####################################################################
# Configuration variables
#
# Path to where files are stored.
FILEPATH = './'
#
# Path to where files are publically available.
URLHIERARCHY = './'
#
# Page Title
TITLE... |
import re
import string
from nltk.tokenize import RegexpTokenizer, PunktSentenceTokenizer
WORD_RE = re.compile(r'\w+(?:[\',:]\w+)*')
END_PUNCT = set('.,?!:')
def token_spans(text):
for match in re.finditer(r'[^-/\s]+', text):
start, end = match.span()
token_match = WORD_RE.search(text, start, end)... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
########################################################################
# $HeadURL $
# File: ReplicateAndRegister.py
# Author: Krzysztof.Ciba@NOSPAMgmail.com
# Date: 2013/03/13 18:49:12
########################################################################
""" :mod: ReplicateAndRegister
=========================... |
from unittest import TestCase
from semNets.Topology import Topology
from semNets.Primitives import Node, Relation, RelationType, RelationAttributeType
from semNets.View import View
import json
def buildTopology():
t = Topology()
with open("TestData.json") as file:
net = json.load(file)
t = Topology()
... |
# coding: utf-8
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
#!/usr/bin/python3
import logging
import threading
from threading import Timer
import datetime
import ConfigParser
import sensorino
import common
import json
import mqttThread
from errors import *
import singleton
import traceback
# create logger with 'spam_application'
logger = logging.getLogger('sensorino_coreEngine... |
import unittest
from test import test_support
from org.python.core import PyFile
import re
import os
import javashell
# testCmds is a list of (command, expectedOutput)
# each command is executed twice, once in unitialized environment and
# once with initialized environment
# smaller set of commands for simple test
... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import numpy as np
from .spectrum import Spectrum
from .spectrum_utils import take_closest, binary_search_mz_values
from subprocess import call
from os.path import join
from os import remove
class Mass_Spectra... |
#
# based on Li = [0 0 0 0 0]
#
# while Li(1)
# check iteration number
# either load start lengh or decrease length by one value
# calculate length price
#
# while Li(2)
# check iteration number
# either load start lengh or decrease length by one value
# calculate length pri... |
# -*- coding: utf-8 -*-
import copy
from unittest import skipIf
import django
from django.db import models
from django.test import SimpleTestCase, TestCase
from osm_field.fields import LatitudeField, Location, LongitudeField, OSMField
from osm_field.validators import validate_latitude, validate_longitude
from osm_fi... |
# CTK: Cherokee Toolkit
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2010-2011 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.... |
# Copyright 2012-2016 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Access middleware."""
import http.client
import json
import logging
from pprint import pformat
import sys
import traceback
import attr
from crochet import TimeoutError
f... |
#!/usr/bin/python
# -*- coding: latin1 -*-
# $Id$
#
# Copyright and User License
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright Vasilis.Vlachoudis@cern.ch for the
# European Organization for Nuclear Research (CERN)
#
# All rights not expressly granted under this license are reserved.
#
# Installation, use, reproduction, disp... |
# -*- coding: utf-8 -*-
from pywikibot import family
__version__ = '$Id$'
# The Wikimedia family that is known as Wiktionary
class Family(family.WikimediaFamily):
def __init__(self):
super(Family, self).__init__()
self.name = 'wiktionary'
self.languages_by_size = [
'en', 'mg... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.