text stringlengths 12 6.59M |
|---|
# JSON API classes
import brainspell
from article_helpers import *
from base_handler import *
from search_helpers import *
from user_account_helpers import *
# For GitHub OAuth
import requests
import urllib.parse
import os
import hashlib
from tornado.concurrent import run_on_executor
import tornado.gen
REQ_DESC = "T... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
/*
This file is part of Bohrium and copyright (c) 2018 the Bohrium
<http://www.bh107.org>
Bohrium 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, either v... |
# -*- coding: utf-8 -*-
""" O/Rマッパー
* ID(プライマリキー)は `id` という名前のオートインクリメント値にすること
"""
from brocadefw.db import rdbutils
class BaseMapper(object):
""" マッパーのベースクラス """
# テーブル名(派生クラスで定義すること)
TABLENAME = None
# IDのカラム名
ID_NAME = "id"
# スレッドローカルデータ
from threading import local
__tld = local()
@staticmethod
def... |
# encoding: utf-8
import 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 'TopTag.date_updated'
db.add_column('radio_toptag', 'date_updated', self.gf('django.db.models.field... |
from ..lm import DomainLMResource, GigawordLMResource
from ..data import Resource, get_resource_manager
from ..sc import SCChunkResource, IdfResource
from ..pipeline import (
TfIdfExtractor, LMProbExtractor, BasicFeaturesExtractor,
QueryFeaturesExtractor, GeoFeaturesExtractor
)
import os
from cuttsum.detector i... |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __fu... |
import sys
import pandas as pd
import pyproj
from functools import partial
import os
if not 'READTHEDOCS' in os.environ:
from shapely.ops import transform
from edisgo.grid.components import Transformer, Line
from edisgo.grid.grids import LVGrid, MVGrid
def grid_expansion_costs(network):
"""
Calculates gr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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 applicab... |
"""
course_catalog api functions
"""
from datetime import datetime
import logging
import os
import re
from subprocess import check_call, CalledProcessError
from tempfile import TemporaryDirectory
import boto3
import rapidjson
from django.db import transaction
from django.conf import settings
from django.contrib.conten... |
import logging
from collections import deque
from spock.mcdata import constants
from spock.mcmap import mapdata
from spock.plugins.base import PluginBase
from spock.task import TaskCallback, TaskFailed, RunTask, accept
from spock.vector import Vector3 as Vec
from bat.command import register_command
logger = logging... |
#!/usr/bin/python
import sys
import os
import qrcode
import hashlib
import base64
from PIL import Image
from PIL.ImageQt import ImageQt
from PyQt4 import QtGui
from PyQt4 import Qt
class BearGapWindow(QtGui.QWidget):
def __init__(self):
super(BearGapWindow, self).__init__()
self.initUI()
def makeQRCode(se... |
# -*- coding: utf-8 -*-
"""
@author: Sebi
File: bftools.py
Date: 17.04.2017
Version. 2.2.1
"""
from __future__ import print_function
import javabridge as jv
import bioformats
import numpy as np
import czitools as czt
import os
import pandas as pd
from lxml import etree as etl
import sys
import re
from collections imp... |
VERSION = (0, 8, 1)
def get_version():
return ".".join([str(i) for i in VERSION])
__version__ = get_version()
|
#!/usr/bin/env python
"""
Turn recipes json into a readable menu
"""
import argparse
import json
from collections import OrderedDict
import pandas as pd
import numpy as np
def get_fraction(amount):
numer, denom = float(amount).as_integer_ratio()
if denom == 1:
return numer
whole = numer / denom
... |
import logging
import sys
from django.conf import settings
from django.forms.forms import BoundField
from django.template.loader import get_template
from django.utils.html import conditional_escape
# Global field template, default template used for rendering a field. This way we avoid
# loading the template every t... |
import sys
import datetime as dt
import json
import logging
import os
from dataset import DataSet
from mep.genetics.population import Population
if __name__ == "__main__":
if len(sys.argv) != 3:
print("ERROR: Expected usage 'python -m mep.main DATA_SET_NAME PYTHON_FILE_NAME'\n" +
" DATA_S... |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Jeff Bryner jbryner@mozilla.com
# Ant... |
#!/usr/bin/python
# -- Content-Encoding: UTF-8 --
"""
Provides functions for reading and writing (writing is WIP currently) Java
objects serialized or will be deserialized by ObjectOutputStream. This form of
object representation is a standard data interchange format in Java world.
javaobj module exposes an API famili... |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2018] EMBL-European Bioinformatics Institute
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... |
import numpy
from collections import deque
from nupic.bindings.math import GetNTAReal
from transit.transit_types import Keyword
def getBitStates(model):
spRegion = model._getSPRegion().getSelf()
spOutput = spRegion._spatialPoolerOutput
tp = model._getTPRegion().getSelf()._tfdr
npPredictedCells = tp.get... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
csvexport
----------
A django extension that simplifies model to csv conversions.
"""
__title__ = "csvexport"
__version__ = "1.1.3"
__build__ = 113
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2015-2018 Martin Sandström"
|
import numpy as np
from scipy.optimize import fsolve
from .eos_selecction import eos, convert_argument
'''
This module calculate parameters necessary to use the equations of state:
SRK, PR and RKPR
'''
# Constante universal de los gases R
RGAS = 0.08314472
# Definir el significado fisicoquímico
A0, B0, C0 = 0.0017, ... |
from datetime import datetime
from celery.exceptions import MaxRetriesExceededError
from celery.schedules import crontab
from celery.task import periodic_task
from dateutil.relativedelta import relativedelta
from casexml.apps.phone.models import SyncLogSQL
from corehq.apps.domain.auth import FORMPLAYER
from corehq.ap... |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from contextlib import contextmanager
from unittest import skip
from corehq.apps.fixtures.models import FixtureDataType, FixtureTypeField... |
"""Codewars: Difference of 2
6 kyu
URL: https://www.codewars.com/kata/5340298112fa30e786000688/
The objective is to return all pairs of integers from a given collection
of integers that have a difference of 2.
The result should be sorted in ascending order.
The input will consist of unique values. The order of the ... |
from __future__ import absolute_import
import io
import json
import os
import os.path
import posixpath
import shutil
import tempfile
import logging
import hashlib
from shutil import copyfile
import io
from pathlib2 import Path
from networkx.drawing.nx_agraph import graphviz_layout
from networkx.drawing.nx_agraph import... |
from __future__ import division
import numpy as np
from numpy import inf, pi
import scipy.integrate
import scipy
import warnings
import numdifftools.fornberg as ndf
from .CxDerivative import CxDeriv
def prod(C, f, df=None, phi=lambda z:1, psi=lambda z:1, absTol=1e-12, relTol=1e-12, divMax=10, method='quad'):
r"""
C... |
import re
import datetime
import time
import sys
from decimal import Decimal
from cymysql.constants import FIELD_TYPE, FLAG
try:
from cymysql.charsetx import charset_by_id
except ImportError:
from cymysql.charset import charset_by_id
PYTHON3 = sys.version_info[0] > 2
ESCAPE_REGEX = re.compile(r"[\0\n\r\032\'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = '0.5.1'
|
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Directory structure
TRAIN_DIR:
label0:
img0001.png
img0002.png
img0003.png
label1:
img0001.png
img0002.png
.
.
.
label9:
img0001.png
'''
import cv2, os, gzip, random
import numpy as np
from itertools import chain
class MakeMn... |
from conans.util.files import save
from conans.client.installer import build_id
class ConanGrapher(object):
def __init__(self, project_reference, deps_graph):
self._deps_graph = deps_graph
self._project_reference = project_reference
def graph(self):
graph_lines = ['digraph {\n']
... |
#
# Copyright (c) 2004-2005 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/... |
#
# Copyright (c) 2004-2006 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/... |
#!/usr/bin/env python
import glob
import os
import re
import shutil
import subprocess
import sys
import stat
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
get_target_arch, get_chromedriver_version, \
get_platform_key
from lib.util import scoped_c... |
#
# Copyright (c) 2004-2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/perma... |
#!/usr/bin/env python
import glob
import os
import re
import shutil
import subprocess
import sys
import stat
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, PLATFORM, \
get_target_arch, get_chromedriver_version, \
get_zip_name
from lib.util import scoped_cwd, ... |
#
# CSS
#
PIPELINE_CSS = {
'search': {
'source_filenames': (
'crashstats/css/lib/flatpickr.dark.min.css',
'supersearch/css/search.less',
),
'output_filename': 'css/search.min.css',
},
'select2': {
'source_filenames': (
'crashstats/js/lib/s... |
"""
.. module: lemur.users.service
:platform: Unix
:synopsis: This module contains all of the services level functions used to
administer users in Lemur
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisso... |
"""
This script executes the task of estimating the building type, based solely on the geometry for that building.
The data for this script can be generated by running the prep/get-data.sh and prep/preprocess-buildings.py scripts,
which will take about an hour or two.
"""
import os
from datetime import datetime
import... |
# Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import os.path as op
from nose.tools import assert_true
from numpy.testing import assert_array_almost_equal
from nose.tools import assert_raises
import numpy as np
from scipy import linalg
import warnings
from mne.cov import regu... |
#!/usr/bin/env python2
# Sozi - A presentation tool using the SVG standard
#
# Copyright (C) 2010-2012 Guillaume Savaton
#
# This program is dual licensed under the terms of the MIT license
# or the GNU General Public License (GPL) version 3.
# A copy of both licenses is provided in the doc/ folder of the
# official r... |
from .base import *
import os
DEBUG = False
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': os.environ['POSTGRES_DB'],
'USER': os.environ['POSTGRES_USER'],
'PASSWORD': os.environ.get('POSTGRES_PASS', ''),
'HOST'... |
from UM.Resources import Resources
from UM.Preferences import Preferences
import gettext
import os
## Wraps a gettext translation catalog for simplified use.
#
# This class wraps a gettext translation catalog to simplify its use.
# It will load the translation catalog from Resources' i18nLocation
# and allows ... |
# -*- coding: utf-8 -*-
# accdb - account database using human-editable flat files as storage
from __future__ import print_function
import os
import re
import subprocess
import sys
import time
import uuid
from collections import OrderedDict
from io import TextIOWrapper
from nullroute.core import Core
from .changeset ... |
# 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 agreed to in writing, ... |
#
# Copyright (c) 2004-2006 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/... |
#!/usr/bin/env python
"""
Generate the images and rst files for gallery of SfePy examples.
The following steps need to be made to regenerate the documentation with the
updated example files:
1. Generate the files:
- for sfepy.org deployment::
$ ./script/gen_gallery.py -l ../doc-devel
- for local test bu... |
import copy
import logging
from datetime import datetime
import six
from six import string_types
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk_index
from elasticutils._version import __version__ # noqa
from elasticutils import monkeypatch
monkeypatch.monkeypatch_es()
log = loggi... |
import argparse
import os
import math
import time
import servo_process as sp
class Arm:
def __init__(self):
self.init_servos()
# 'scooping', ''
self.spoon_status = ''
def init_servos(self):
self.sp = sp.ServoProcess()
self.sp.start()
# self.leg_servo = servo.Se... |
import re
''' -- imports from installed packages -- '''
from django.shortcuts import render_to_response
from django.template import RequestContext
# from django.core.urlresolvers import reverse
from mongokit import paginator
try:
from bson import ObjectId
except ImportError: # old pymongo
from pymongo.objectid i... |
import pymongo
import json
import traceback
import os
from stateHelper import stateNameToAbbrev, stateName, stateIcpsr
from searchParties import partyName, noun, partyColor, shortName
#from searchMeta import metaLookup
client = pymongo.MongoClient()
try:
dbConf = json.load(open("./model/db.json","r"))
nicknames = jso... |
import copy
import logging
from datetime import datetime
from operator import itemgetter
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk_index
from elasticutils._version import __version__ # noqa
log = logging.getLogger('elasticutils')
# Note: Don't change these--they're not part o... |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
import sys
from os.path import isdir, join
try:
from Crypto.PublicKey import RSA
fro... |
#!/usr/bin/env python
"""
@package ion.agents.instrument.test.test_driver_process
@file ion/agents.instrument/test_driver_process.py
@author Edward Hunter
@brief Test cases for DriverProcess.
"""
__author__ = 'Bill French'
__license__ = 'Apache 2.0'
import time
import unittest
from nose.plugins.attrib import attr
f... |
import argparse
import os
import math
import time
import servo_process as sp
class Arm:
def __init__(self):
self.init_servos()
# 'scooping', ''
self.spoon_status = ''
self.status = ''
def init_servos(self):
self.sp = sp.ServoProcess()
self.sp.start()
def ru... |
from __future__ import unicode_literals
class Choices(object):
"""
A class to encapsulate handy functionality for lists of choices
for a Django model field.
Each argument to ``Choices`` is a choice, represented as either a
string, a two-tuple, or a three-tuple.
If a single string is provided... |
from itertools import count, product
from toolz import merge, first, accumulate
from operator import getitem, add
from ..compatibility import long
import numpy as np
slice_names = ('slice-%d' % i for i in count(1))
def sanitize_index_elements(ind):
""" Sanitize the elements for indexing along one axis
>>> ... |
#!/usr/bin/env python3
import sys
import os
sys.path.append(
os.path.dirname(__file__)
)
import logging
import os
import time
import pymongo
import yaml
from datetime import datetime as dt
from datetime import timedelta
from pymongo import MongoClient
from bson.objectid import ObjectId
from backup_logger import... |
#!/usr/bin/env python
"""
plots the intermediate metric values of each slice registration
Usage:
plot_metric_values_and_differences values_dir [slice]
"""
from os.path import *
from os import listdir
from sys import argv
from numpy import genfromtxt
from metric_values import MetricValues
metric_values_dir = argv[1]
... |
'''
Madeira OpsAgent states adaptor
@author: Michael (michael@mc2.io)
'''
# System imports
import os
import hashlib
# Internal imports
from opsagent import utils
from opsagent.exception import StateException, OpsAgentException
class StateAdaptor(object):
ssh_key_type = ['ssh-rsa', 'ecdsa', 'ssh-dss']
supported_... |
# -*- coding: utf-8 -*-
import numpy as np # type: ignore
from PIL import Image # type: ignore
import matplotlib.cm # type: ignore
def format_as_image(expl,
interpolation=Image.LANCZOS,
colormap=matplotlib.cm.magma,
alpha_limit=165.75,
):
""" Format a :class:`eli5.base.Explanation` object as an i... |
import argparse
import os
import math
import time
import servo
class Arm:
def __init__(self):
self.init_servos()
# 'scooping', ''
self.spoon_status = ''
def init_servos(self):
self.spoon_servo = servo.Servo(2)
self.spoon_servo.start()
def run(self):
i = 0
... |
from itertools import count
from toolz import merge, accumulate, unique
from operator import getitem, setitem
import pandas as pd
import numpy as np
from .core import Frame, get
from ..compatibility import unicode
tokens = ('-%d' % i for i in count(1))
store_names = ('store-%d' % i for i in count(1))
sort_names = ('... |
#!/usr/bin/env python3
import sys
import os
sys.path.append(os.path.dirname(__file__))
import logging
import os
import time
import pymongo
import yaml
import argparse
from datetime import datetime as dt
from datetime import timedelta
from pymongo import MongoClient
from bson.objectid import ObjectId
CONFIG_FILE ... |
"""
email_parser
~~~~~~~~~~
Parses emails from a source directory and outputs text and html format.
:copyright: (c) 2014 by KeepSafe.
:license: Apache, see LICENSE for more details.
"""
import json
import os
from . import placeholder, fs, reader, renderer, const, config
from .model import *
cla... |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
"""eml_parser serves as a python module for parsing eml files and returning various
information found in the e-mail as well as computed information.
"""
#
# Georges Toth (c) 2013-2014 <georges@trypill.org>
# GOVCERT.LU (c) 2013-2017 <info@govcert.etat.lu>
#
# Th... |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
from __future__ import absolute_import, division, print_function # // , unicode_literals
#
# Georges Toth (c) 2013-2014 <georges@trypill.org>
# GOVCERT.LU (c) 2013-2017 <info@govcert.etat.lu>
#
# This program is free software: you can redistribute it and/or modi... |
# -*- coding: utf-8 -*-
###############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free sof... |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from information import ChainInformation, WorkflowInformationCollection
__author__ = "Romain Mormont <r.mormont@student.ulg.ac.be>"
class ImageProvider(object):
"""
An interface for any component that genre
"""
__metaclass__ = ABCMeta
... |
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISC... |
__author__ = 'Jordi Vilaplana'
import tweepy
import pymongo
from pymongo import MongoClient
import json
import logging
import time
import datetime
logging.basicConfig(filename='emovix_twitter_search.log',level=logging.WARNING)
# Configuration parameters
access_token = ""
access_token_secret = ""
consumer_key = ""
co... |
import StringIO
from pymongo import MongoClient
import sys
from matplotlib.figure import Figure
from matplotlib.backend_bases import key_press_handler
from matplotlib.backends.backend_qt4agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolbar)
from PyQt4.QtCore import *
from P... |
#!/usr/bin/env python
"""
Weather Module
**************
Routines to deal with bulk weather data from Environment Canada
WxDF Class
----------
* Update - Add years to data
* Save - Save consolidated data
* GetFirstDay - returns index to first day of data
* GetLastDay - Returns index to last day of data
... |
import os
from flask import Flask, request, redirect, url_for
from werkzeug.utils import secure_filename
UPLOAD_FOLDER = '/uploads'
ALLOWED_EXTENSIONS = set(['json'])
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
''' Target date, 5/15/2014
TODO: Upload/Download functionality working
TODO: Jazmy... |
# Copyright 2015 Intel Corporation.
#
# 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 writ... |
import sys
import numpy as np
import pandas as pd
try:
import cPickle as pickle
except:
import pickle
import lasagne
from lasagne import layers
from lasagne import nonlinearities
from nolearn.lasagne import NeuralNet
from sklearn import preprocessing
from sklearn.grid_search import GridSearchCV
# get the argu... |
import os
import requests
import json
from django.shortcuts import render
from django.http import HttpResponseNotFound
from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _
from webparticipation.apps.ureporter.models import Ureporter
from webparticipation.apps.ra... |
import random
import logging
import pandas
import numpy as np
import itertools
from predictions import MapqPredictions
from sklearn import cross_validation
__author__ = 'langmead'
def _np_deduping_indexes(m):
b = np.ascontiguousarray(m).view(np.dtype((np.void, m.dtype.itemsize * m.shape[1])))
_, idx, inv = n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Rowland circle geometry
=======================
Units here:
angular [deg]
spatial [mm]
energy [eV]
Table of variables and conventions
| description | here | XRT | RT4XES | SHADOW3 |
|------------------------+---------+--------+---------+-------... |
"""
Unit tests for django-smarter.
"""
import itertools
from django.test import TestCase
from django.http import HttpRequest
from django.conf.urls import patterns
from django.db import models
from django.core.urlresolvers import Resolver404
from smarter import SmarterSite
from views import BaseViews... |
# (C) Copyright 2017 Inova Development 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 appl... |
# Copyright 2012-2015 The Meson development team
# 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 agree... |
from flask import Flask, request
import bs4 as bs
import requests
import json
import os
import datetime
import time
import pytz
app = Flask(__name__)
debug_print_on = True
######################### Global Variables #########################
myjsonUrl = 'https://api.myjson.com/bins/'+str(os.environ.get('myjsonId'))
db... |
#!/usr/bin/python
# pose related functions
import fileinput
import math
import os
import re
import navpy
from props import getNode
import transformations
import Image
# a helpful constant
d2r = math.pi / 180.0
r2d = 180.0 / math.pi
# quaternions represent a rotation from one coordinate system to
# another (i.e. f... |
import httpretty
from .builder import EndpointMockBuilder
from .fixture_loader import Jinja2FixtureLoader
class InvalidEndpointSpecException(Exception):
pass
VALID_METHODS = set([
'GET', 'PUT', 'POST', 'DELETE', 'HEAD',
'PATCH', 'OPTIONS', 'CONNECT'])
def _parse_endpoint(spec):
try:
metho... |
import os
import re
import sys
# Support python2 and python3 quote import
try:
from urllib import quote, unquote
except ImportError:
from urllib.parse import quote, unquote
import uuid
import redis
from cryptography.fernet import Fernet
from flask import abort, Flask, render_template, request
from redis.excep... |
'''
Setup script.
To install snipper:
[sudo] python setup.py install
'''
import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
# Dynamically calculate the version based on snipper.VERSION.
setup(
name='snipper',
version=__import__('sni... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# GAM
#
# Copyright 2019, LLC 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/LIC... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os.path as osp
import sys
import json
import rospy
from jsk_2015_05_baxter_apc.msg import WorkOrder, WorkOrderArray
from jsk_apc2016_common import get_bin_contents, get_work_order
def get_sorted_work_order(json_file):
"""Sort work order to maximize the score"""
... |
#!/usr/bin/env python
#
# Copyright (C) 2014 Zeex
#
# 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... |
#!/usr/bin/env python
from gensim import corpora, models, similarities
import logging
import sys
import os
import glob
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',
level=logging.INFO)
logger = logging.getLogger()
# Check command line args
if len(sys.argv) != 4:
sys... |
# coding=utf-8
#
# This file is licensed under the Affero General Public License version 3 or
# later. See the COPYING file.
#
# @author Pauli Järvinen <pauli.jarvinen@gmail.com>
# @copyright Pauli Järvinen 2017
import argparse
import os
def ensure_parent_dir_exists(file_path):
directory = os.path.dirname(file_path... |
"""
Processing functions:
- Plane Wave Decomposition (pdc)
- Time domain signals reconstruction (tdt)
- Fast Inverse spatial Fourier (itc)
- Fast Spatial Fourier Transform (stc)
"""
import numpy as _np
from scipy.signal import hann, resample
from .sph import sph_harm
pi = _np.pi
def pdc(N, OmegaL, Pnm, dn, **kargs)... |
""" Defines the PlotAxis class, and associated validator and UI.
"""
# Major library import
from numpy import array, around, absolute, cos, dot, float64, inf, pi, \
sqrt, sin, transpose
# Enthought Library imports
from enthought.enable2.api import black_color_trait, transparent_color_trait, \
... |
#
#
# Copyright (C) 2006, 2007 Google Inc.
#
# 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 the License, or
# (at your option) any later version.
#
# This program is distri... |
#! /usr/bin/env python3.7
from modules.commands.helpers import get_category_string
from modules.commands.helpers import get_category_title
from modules.commands.helpers import time_formatter
from modules.commands.helpers import get_suffix
HELP_TEXT = ["!pb <user?> <game shortcode?> <category?>", "Retrieve users pb fo... |
# ============================================================================
# spontaneous_firing_test.py
#
# created 14 August 2017 Lungsi
# modified 31 August 2017 Lungsi
#
# ============================================================================
import os
import sciunit
import quantities as pq
from elephan... |
"""
Disagreement measures for the Committee model.
"""
import numpy as np
from collections import Counter
from scipy.stats import entropy
def vote_entropy(committee, X, **predict_proba_kwargs):
"""
Calculates the vote entropy for the Committee. First it computes the
predictions of X for each learner in t... |
from __future__ import unicode_literals
import uuid
from datetime import datetime
from django.db import models
from django.utils.translation import ugettext as _
from django.template.defaultfilters import slugify
from localflavor.us.models import USStateField, USZipCodeField
from custom_user.models import EmailUser as... |
# -*- coding: utf-8 -*-
from __future__ import division
from functools import partial
import logging
from numpy import (
busday_count as original_busday_count, datetime64, logical_not as not_, logical_or as or_, logical_and as and_,
maximum as max_, minimum as min_, round as round_, timedelta64
)
from da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.