text stringlengths 12 6.59M |
|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 Anso Labs, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2018, Arm Limited and contributors.
#
# 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
#
# ... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from tutor.models import *
def study(request):
"""Choose the next question for the user to study."""
return render(request, 'tutor/study.html')
def list(r... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from tutor.models import *
def study(request):
"""Choose the next question for the user to study."""
return render(request, 'tutor/study.html')
def list(r... |
"""
Support for Google Calendar event device sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/calendar/
"""
import asyncio
import logging
from datetime import timedelta
import re
from homeassistant.components.google import (CONF_OFFSET,
... |
"""
Helper functions shared between the other modules
"""
import re
import json
import sys
from collections import defaultdict
def load_json(filename):
"""
Parse a JSON file
First remove all comments, then use the standard json package
Comments look like :
// ...
or
/*
..... |
"""Provide functionality to interact with Cast devices on the network."""
from __future__ import annotations
import asyncio
from contextlib import suppress
from datetime import timedelta
import functools as ft
import json
import logging
import pychromecast
from pychromecast.controllers.homeassistant import HomeAssist... |
'''
:Authors: Sana Dev Team
:Version: 2.0
'''
import logging
from datetime import datetime
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.forms.widgets import PasswordInput
from django.contrib.auth.models import User
from extra_views import InlineFormSet
from mds.core.... |
"""
Empirical Likelihood Implementation
Start: 21 May 2012
Last Updated: 10 June 2012
General References:
Owen, A. (2001). "Empirical Likelihood." Chapman and Hall
TODO (Long-term) Create a dict that forms estimating functions given
a user input. Then all tests can be combined into one function.
TODO (Medium-ter... |
"""Support for Huawei LTE sensors."""
from __future__ import annotations
from bisect import bisect
from collections.abc import Callable
import logging
import re
from typing import NamedTuple
import attr
from homeassistant.components.sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_SIGNAL_STRENGTH,
DOMA... |
import asyncio
import json
import logging
import time
import subprocess
import collections
import base64
import binascii
import pathlib
import os
import pprint
import motor.motor_asyncio
import itsdangerous
from aiohttp import web
from itsdangerous import TimestampSigner
import litecord.api as api
import litecord.man... |
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, SixSq Sarl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... |
"""
Support for Xiaomi Philips Lights (LED Ball & Ceiling Lamp, Eyecare Lamp 2).
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/light.xiaomi_miio/
"""
import asyncio
from functools import partial
import logging
from math import ceil
from datetime import tim... |
#!/usr/bin/env python
from __future__ import with_statement
import getopt
import os
import subprocess
import time
import sys
path0 = os.path.dirname(os.path.abspath(__file__))
path1 = os.path.abspath(os.path.join(path0, os.pardir, 'interestingness'))
sys.path.append(path1)
import ximport
def usage():
print """L... |
from collections import namedtuple
import datetime
import random
import hotmodel
ProcessOperation = namedtuple("ProcessOperation", [
"operation",
"act",
])
ProductOperation = namedtuple("ProductOperation", [
"operation",
"tm",
"workplace",
])
class Server(object):
"""
... |
"""
homeassistant.components.media_player.kodi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Provides an interface to the XBMC/Kodi JSON-RPC API
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.kodi.html
"""
import urllib
import logging
from hom... |
"""
Pushbullet platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.pushbullet/
"""
import logging
import mimetypes
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA, ATTR_TARGET, ATTR_... |
"""Platform for the opengarage.io sensor component."""
from __future__ import annotations
import logging
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_SIGNAL_STRE... |
"""Constants for the Xiaomi Miio component."""
from miio.vacuum import (
ROCKROBO_S5,
ROCKROBO_S6,
ROCKROBO_S6_MAXV,
ROCKROBO_S7,
ROCKROBO_V1,
)
DOMAIN = "xiaomi_miio"
# Config flow
CONF_FLOW_TYPE = "config_flow_device"
CONF_GATEWAY = "gateway"
CONF_DEVICE = "device"
CONF_MODEL = "model"
CONF_MAC ... |
import logging
import csv
import os
from datetime import datetime, timedelta
from threading import Lock
import requests
MIN_TIME_BETWEEN_SCANS = timedelta(seconds=5)
KNOWN_DEVICES_FILE = "tomato_known_devices.csv"
class TomatoDeviceScanner(object):
""" This class tracks devices connected to a wireless router ru... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# FIXME: this is horrible code. horrible.
# Ideally we would want pandoc to rescue us ..
import sys
import os
dir_ = os.path.dirname(os.path.abspath(__file__))
sys.path.append (os.path.abspath(os.path.join(dir_, os.pardir, "src")))
import StringIO
from lxml import etree... |
import os
import tempfile
from rest_framework import status
from hs_core.hydroshare import resource
from .base import HSRESTTestCase
class TestPublicResourceFlagsEndpoint(HSRESTTestCase):
def setUp(self):
super(TestPublicResourceFlagsEndpoint, self).setUp()
self.tmp_dir = tempfile.mkdtemp()
... |
import os
import sys
from time import sleep
sys.path.insert(0, os.getcwd())
import analyzeLine
import runAnalyzeLine
from runAnalyzeLine import runAnalyzeLines
from analyzeLine import findBlockingBlobs
from get_images_from_pi import get_image, valid_image
from connect import new_connection, send_command, receive_confir... |
#!/usr/bin/env python3
import uuid
from typing import Dict, List, Optional, Union
import stoq.helpers as helpers
class PayloadMeta():
def __init__(self,
should_archive: bool = True,
extra_data: Optional[Dict] = None,
dispatch_to: List[str] = None) -> None:
... |
# -*- coding: utf-8 -*-
import urllib2
def api():
if request.args[0] == 'zonky':
request.headers = {'X-Page': '0', 'X-Size': '30'}
url = 'https://api.zonky.cz/loans/marketplace?rating__eq=%s' % request.args[1]
if url:
response.headers = {'Access-Control-Allow-Origin': '*'}
ret... |
# coding: utf8
def index(): return plugin_flatpage()
@auth.requires_login()
def books(): return plugin_flatpage()
@auth.requires_login()
def tools(): return plugin_flatpage()
@auth.requires_login()
def other(): return plugin_flatpage()
@auth.requires_login()
def hotels(): return plugin_flatpage()
|
# Copyright (C) 2015-2016 Allen Li
#
# 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 wri... |
import math
class Vector(object):
"""
X/Y and Polar representations of a vector. Each representation is only
update when it is accessed.
"""
def __init__(self, x=None, y=None, a=None, m=None):
# Initialize variables
self._a = None
self._m = None
self._x = None
... |
from django.test import TestCase, Client, override_settings
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from qa.models import (Question, Answer, QuestionComment, QuestionVote,
AnswerVote, UserQAProf... |
# -----------------------------------------------------------------------------
# Copyright (c) 2014--, The Qiita Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
import csv
from prettytable import PrettyTable
import re
import argparse
class tunipost:
def code(self,location):
results=[]
with open('codes.csv') as f:
reader = csv.reader(f)
for row in reader:
match = re.search(location, row[2].lower())
if ... |
import rdflib as R
import logging
import hashlib
import six
import random
from .mapper import (
MappedPropertyClass,
MappedClass,
Resolver,
get_most_specific_rdf_type,
oid)
from .dataUser import DataUser
from .configure import BadConf
from .simpleProperty import (SimpleProperty, DatatypeProperty, O... |
"""The YAWT extension package.
This file contains utility classes in use by various extensions in YAWT
"""
from __future__ import absolute_import
import os
import jsonpickle
from flask import g, request
from yawt.utils import load_file, save_file, abs_state_folder, cfg,\
single_dict_var, ReprMixin, EqMixin, full... |
# yellowbrick.base
# Abstract base classes and interface for Yellowbrick.
#
# Author: Benjamin Bengfort <bbengfort@districtdatalabs.com>
# Created: Fri Jun 03 10:20:59 2016 -0700
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: base.py [4a59c49] benjamin@bengfort.com $
""... |
from app.readers import tsv as tsvreader
from app.dataformats import mzidtsv as mzidtsvdata
from app.sqlite import ProteinPeptideDB
from app.preparation.mzidtsv import confidencefilters as conffilt
def get_header_with_proteingroups(header):
ix = header.index(mzidtsvdata.HEADER_PROTEIN) + 1
return header[:ix] ... |
import logging
from django.views.generic import (
ListView,
DetailView,
CreateView,
UpdateView,
)
from django.contrib.syndication.views import Feed
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.shortcuts import get_object_or_404
from .forms im... |
'''
Base connection class for netmiko
Handles SSH connection and methods that are generically applicable to different
platforms (Cisco and non-Cisco).
Also defines methods that should generally be supported by child classes
'''
from __future__ import print_function
from __future__ import unicode_literals
import par... |
# -*- coding: utf-8; -*-
import argparse
import io
import os
import httpolice
__version__ = '0.3.0.dev4'
reports = {'text': httpolice.text_report, 'html': httpolice.html_report}
def start(context, argv):
parser = argparse.ArgumentParser(prog=os.path.basename(__file__),
ad... |
'''
Base connection class for netmiko
Handles SSH connection and methods that are generically applicable to different
platforms (Cisco and non-Cisco).
Also defines methods that should generally be supported by child classes
'''
from __future__ import print_function
from __future__ import unicode_literals
import par... |
# -*- coding: utf-8 -*-
'''
Tests for the file state
'''
# Import python libs
from __future__ import absolute_import
import errno
import os
import textwrap
import tempfile
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import salt libs
import integration
imp... |
# Copyright (c) 2016 Cisco Systems, 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 r... |
import json
import os
import random
import string
import time
import uuid
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
import mock
import paramiko
import pylxd
import pytest
from juju import jasyncio
from juju.client import client
from juju.errors import JujuError, JujuUnitError, JujuCon... |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange 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 applic... |
#!/usr/bin/python3
"""
A robot that downloads stats for MNL creates an image to send to slack.
"""
import argparse
import csv
import datetime
import io
import logging
import math
from collections import OrderedDict
import os
try:
import matplotlib.pyplot as plt
except ImportError as e:
print(e)
plt = None... |
#!/usr/bin/env python
"""
Backend program invoked by MPI spawn.
"""
import importlib
# Use dill for mpi4py object serialization to accomodate a wider range of argument
# possibilities than possible with pickle:
import dill
# Fix for bug https://github.com/uqfoundation/dill/issues/81
@dill.register(property)
def sav... |
#!/usr/bin/python2.5
#
# Copyright 2009 the Melange 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 applicable... |
from flask import Module, url_for, \
redirect, g, flash, request, current_app
from flaskext.mail import Message
from flaskext.babel import gettext as _
from newsmeme.models import Post, Tag
from newsmeme.extensions import mail, db
from newsmeme.helpers import render_template, cached
from newsmeme.forms import Pos... |
#!/usr/bin/python
import os
import sys
from subprocess import check_call
from charmhelpers.contrib.unison import (
ensure_user,
get_homedir,
ssh_authorized_peers,
)
from charmhelpers.core.hookenv import (
Hooks,
UnregisteredHookError,
config,
log,
relation_get,
relation_ids,
... |
# Copyright (c) 2017, Somia Reality Oy
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions an... |
#!/usr/bin/python
import os
import sys
import time
from subprocess import check_call
from charmhelpers.contrib import unison
from charmhelpers.core.hookenv import (
Hooks,
UnregisteredHookError,
config,
is_relation_made,
log,
ERROR,
relation_get,
relation_ids,
relation_set,
r... |
"""
Test the design_matrix utilities.
Note that the tests just looks whether the data produces has correct dimension,
not whether it is exact
"""
from __future__ import with_statement
from os import path as osp
import numpy as np
import pandas as pd
from nibabel.tmpdirs import InTemporaryDirectory
from nilearn._ut... |
#!/usr/bin/python
import subprocess
import os
import urlparse
import time
from base64 import b64encode
from collections import OrderedDict
from copy import deepcopy
from charmhelpers.contrib.hahelpers.cluster import(
eligible_leader,
determine_api_port,
https,
is_clustered
)
from charmhelpers.contrib... |
from ggame import App
myapp = App()
myapp.run()
from ggame import App, Color, LineStyle, Sprite
from ggame import RectangleAsset, CircleAsset, EllipseAsset, PolygonAsset
# Three primary colors with no transparency (alpha = 1.0)
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black =... |
from utils import genmaxent, words
import os
import math
import marisa_trie
def features(context):
length = len(context)
if length > 2:
collocations = [':' + word for word in context[0:length-3]]
return collocations + ['2' + context[-2], '1' + context[-1]]
elif length == 2:
return [... |
#!/usr/bin/python
import subprocess
import os
import urlparse
import time
from base64 import b64encode
from collections import OrderedDict
from copy import deepcopy
from charmhelpers.contrib.hahelpers.cluster import(
eligible_leader,
determine_api_port,
https,
is_clustered
)
from charmhelpers.contrib... |
#!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:Creative Commons GNU GPL v2
# (http://creativecommons.org/licenses/GPL/2.0/)
"""Simple-to-use Python interface to The TVDB's API (www.thetvdb.com)
Example usage:
>>> from tvdb_api import Tvdb
>... |
import os
import numpy as np
import nibabel as nb
import pandas as pd
import glob
from nltools.simulator import Simulator
from nltools.data import (Brain_Data,
Adjacency,
Groupby,
Design_Matrix)
from nltools.stats import threshold, align
from nltoo... |
#!/usr/bin/python
import glob
import grp
import hashlib
import json
import os
import pwd
import re
import shutil
import subprocess
import tarfile
import threading
import time
import urlparse
import uuid
from itertools import chain
from base64 import b64encode
from collections import OrderedDict
from copy import deepco... |
#!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:Creative Commons GNU GPL v2
# (http://creativecommons.org/licenses/GPL/2.0/)
"""Simple-to-use Python interface to The TVDB's API (www.thetvdb.com)
Example usage:
>>> from tvdb_api import Tvdb
>... |
"""Symbolic configuration API."""
from __future__ import absolute_import as _abs
import sys as _sys
import os as _os
import ctypes as _ctypes
from numbers import Number as _Number
from . import _base
from ._base import _LIB, check_call as _check_call
from . import _symbol_internal as _internal
from .attribute import A... |
# coding=utf-8
from django.views.generic import TemplateView
from .models import StatisticsEntry
class StatsView(TemplateView):
template_name = 'stats/stats.html'
def get_context_data(self, **kwargs):
context = super(StatsView, self).get_context_data(**kwargs)
context['user_counts'] = lis... |
# -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import
import humanize
import json
import os
import re
import requests
import time
from hashlib import sha1
from bs4 import BeautifulSoup
from u115 import conf
from u115.utils import (get_timestamp, get_utcdatetime, string_to_datetime,
... |
import os, sys, argparse
reload(sys)
sys.setdefaultencoding('utf8')
import pygraphviz as pg
import cPickle as pickle
from hotdoc.core.alchemy_integration import session, finalize_db, purge_db
from .naive_index import NaiveIndexFormatter
from .links import LinkResolver
from .base_extension import BaseExtension
fr... |
from hotspringsapp import app,db
from werkzeug.security import generate_password_hash, check_password_hash
from sqlalchemy.sql import text
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import sessionmaker
class Location(db.Model):
__tablename__ = 'public_location'
id = d... |
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
MITX_FEATURES[...]. Modules that extend this one can change the feature
configura... |
# coding: utf-8
""" Class for reading data from SCF simulations """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os, sys
import logging
import re
# Third-party
import numpy as np
import astropy.units as u
from astropy.constants import G
fro... |
import re
import pandas as pd
from collections import OrderedDict
import copy
import quantipy as qp
import numpy as np
class Rules(object):
# ------------------------------------------------------------------------
# init
# ------------------------------------------------------------------------
def _... |
# Copyright (c) 2014, Illumina
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the follow... |
"""
Tools for drawing Python object reference graphs with graphviz.
You can find documentation online at http://mg.pov.lt/objgraph/
Copyright (c) 2008-2015 Marius Gedminas <marius@pov.lt> and contributors
Released under the MIT licence.
"""
# Permission is hereby granted, free of charge, to any person obtaining a
# ... |
from datetime import timedelta
from django.apps import apps
from django.conf import settings
from django.core.checks import Error, Info, register as register_check
from django.core.exceptions import ImproperlyConfigured
from django.db.utils import OperationalError, ProgrammingError
import requests.exceptions
from no... |
import os.path as op
import inspect
from .base import (PYTYPE2SPEC, tmpl_replace, copy_objp_unit, ArgSpec, MethodSpec, ClassSpec,
get_objc_signature)
TEMPLATE_HEADER = """
#import <Cocoa/Cocoa.h>
#import <Python.h>
%%imports%%
@interface %%classname%%:NSObject %%protocols%%
{
PyObject *py;
}
- (PyObject *)py... |
'''
Created on Jun 26, 2012
@author: ayoola_al
'''
from django import forms
from models import QuestionAnswer
from django.forms.fields import CharField,BooleanField,ChoiceField,MultipleChoiceField
from django.forms.widgets import RadioSelect
from django.utils.datastructures import SortedDict
from django.db.models i... |
""" ResourceModel class is a list of resource nodes that can be used to
construct a resource set at a server location or to inspect resources
at a server location. The model can be populated by loading a
constructor in the collection+senml+json content format, and an
existing model can likewise be s... |
try:
from urlparse import urlsplit
except ImportError:
from urllib.parse import urlsplit
from django import http
from django.utils.translation import check_for_language
from localeurl import utils
from localeurl import settings as localeurl_settings
def change_locale(request):
"""
Redirect to a given u... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2014, MIT Probabilistic Computing Project
#
# 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/LICENS... |
import math
from matplotlib import pyplot as plt
class Graph:
def __init__(self, graph_dict={}):
self.__graph_dict = graph_dict
def add_vertex(self, vertex):
if vertex not in self.__graph_dict:
self.__graph_dict[vertex] = []
def add_edge(self, edge):
... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... |
# TensorFlow Model !
import os
import shutil
import numpy as np
import tensorflow as tf
tf.reset_default_graph()
from cell import ConvLSTMCell
import sys
module_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
if module_path not in sys.path:
sys.path.append(module_path)
from datasets.batch_ge... |
"""Extract files from OLE object fields inside Microsoft Access databases"""
import struct
import re
import sys
from pprint import pprint
class BadDataError(Exception):
pass
def bmps(oleobject):
"""Return iterator over all BMPs inside OLE object field"""
for object_type, data in objects(oleobject):
... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import ConfigParser
import os
from quickrelease import constants
from quickrelease.exception import ReleaseFrameworkError
class ConfigSpecError(ReleaseFrameworkError):
NO_OPTION_ERROR = 0
INTERPOLATION_MISSING_OPTION_ERR... |
# -*- coding: utf-8 -*-
"""
Command line parsing and command dispatch
"""
from __future__ import print_function
from builtins import input
import argparse
import json
import os
import stat
import sys
import time
import webbrowser
import pandas as pd
import requests
from packaging.version import Version
from .build i... |
#! python3
# This script is created for scraping douban group topics
# Should be able to scrape [topic,author,follow,lastresponse]
# info of all group topics
# TODO: reorganize this long code into classes.
import requests, bs4, csv
import datetime
import time
# import psycopg2
class CSVfileNameError(Exception):
d... |
"""Functions for generating quantum operators.
"""
from operator import add
import math
import functools
import itertools
import operator
from cytoolz import isiterable, concat, unique
import numpy as np
import scipy.sparse as sp
from scipy.special import comb
from ..core import (qarray, make_immutable, get_thread_po... |
from flask import Blueprint, request, render_template, redirect
from .forms import *
from quupod import app, login_manager, whitelist, googleclientID
from quupod.models import User, Inquiry, Queue
from quupod.views import anonymous_required, render, url_for
from quupod.notifications import *
from oauth2client import cl... |
#!/usr/bin/env python
"""
Загрузчик справки с сайта
Microsoft's Old API Help File Reborn
http://laurencejackson.com/win32
"""
from urllib.request import urlopen
#
# read_chunk(url, max_chunk)
#
def read_chunk(url, max_chunk=8192*8):
"""Генератор содержимого web-файла, для использования в инструкции for"""
w... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pandas
import inspect
import numpy as np
# from .utils import _inherit_docstrings
def na_op():
"""Pandas uses a similar function to handle na values.
"""
raise NotImplementedError("Not Ye... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp.
#
# 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.a... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
"""@file tabulate_correlated_const_shear_metric_rev1.py
Tabulate values of the new constant shear metrics (revision 1: Dec 13/Jan 14) for given biases, for
inclusion in the GREAT3 Handbook, including intra branch correlations.
"""
import sys
import os
import tempfile
import numpy as np
import g3metrics
path, module =... |
# coding: utf-8
"""
Basic tests for the 'admin' application
=======================================
"""
from django.test import TestCase
from django.test.client import Client
from django.utils import simplejson
from django.core.urlresolvers import reverse
from models import *
from modoboa.admin.lib import *
from modo... |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.test.client import Client
from django.http import HttpRequest
from django.contrib.auth import SESSION_KEY
from tardis.tardis_portal.models import User
from tardis.tardis_portal.auth.interfaces import GroupProvider
class MockSettings(object):
d... |
from __future__ import absolute_import
from memoized import memoized
from corehq.apps.app_manager.app_translations import (
expected_bulk_app_sheet_headers,
expected_bulk_app_sheet_rows,
get_unicode_dicts,
)
from corehq.apps.app_manager.app_translations.const import MODULES_AND_FORMS_SHEET_NAME
COLUMNS_TO... |
import uuid
import mock
import os
from xml.etree import ElementTree
from corehq.util.test_utils import flag_enabled
from datetime import datetime, timedelta
from django.test import TestCase
from casexml.apps.phone.models import SyncLog
from casexml.apps.phone.tests.utils import create_restore_user
from corehq.apps.do... |
from __future__ import absolute_import
import time
import uuid
from datetime import datetime
from unittest import SkipTest
from django.conf import settings
from django.db import connections
from django.test import TestCase
from corehq.form_processor.backends.sql.dbaccessors import (
CaseAccessorSQL, FormReindexAc... |
#!/usr/bin/env python3
#
# Copyright (c) 2020, The Linux Foundation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notic... |
import os
import os.path
import sys
import subprocess
import re
import tempfile
import threading
from util import *
FILE_ADDED = 'A'
FILE_MODIFIED = 'M'
FILE_DELETED = 'D'
FILE_COPIED = 'C'
FILE_RENAMED = 'R'
FILE_UNMERGED = 'U'
FILE_TYPECHANGED = 'T'
FILE_UNTRACKED = 'N'
FILE_BROKEN = ... |
#!/usr/bin/env python
import sys, time, os, urllib2, shelve, string, xmltramp, mimetools, mimetypes, md5, webbrowser, unicodedata
#
# uploadr.py
#
# Upload images placed within a directory to your Flickr account.
#
# Requires:
# xmltramp http://www.aaronsw.com/2002/xmltramp/
# flickr account http://f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
$ urlwait [SERVICE URL] [TIMEOUT]
SERVICE URL is a connection url, e.g. a typical value for $DATABASE_URL. TIMEOUT is
a number of seconds to try to connect to the host and port specified in the SERVICE
URL. These values may also be specified in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.